实体添加 标题显示 字段的标题显示

(注释了实体表 编辑请求的判断模块是否有实体)
master
shiji 1 year ago
parent e1975c46b2
commit 3716dc00ea
  1. 11
      ant-design-vue-jeecg/src/views/fieldx/FieldxList.vue
  2. 881
      ant-design-vue-jeecg/src/views/tablex/TablexList.vue
  3. 33
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java

@ -9,6 +9,7 @@
>
<div>
<span style="text-align: center;display:block;font-weight:bold;">实体名称{{tableName}}</span>
<j-vxe-table
ref="xTable"
:columns="columns"
@ -115,11 +116,11 @@
// placeholder: '${title}',
// disabled: true,
// },
{
key: 'tableId_dictText', title: '对应实体', width: '6%',
type: JVXETypes.normal,
disabled: true,
},
// {
// key: 'tableId_dictText', title: '', width: '6%',
// type: JVXETypes.normal,
// disabled: true,
// },
{
key: 'fieldName', title: '中文名称', width: '6%',
type: JVXETypes.input,

@ -5,376 +5,591 @@
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
:bordered="false">
<!-- &lt;!&ndash; 查询区域 &ndash;&gt;-->
<div class="table-page-search-wrapper">
<!-- <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="中文名称">-->
<!-- <a-input placeholder="中文名称" v-model="queryParam.tableName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="英文名称">-->
<!-- <a-input placeholder="英文名称" v-model="queryParam.tableEnName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="实体状态">-->
<!-- <j-dict-select-tag type="list" v-model="queryParam.status" dictCode="a_status" placeholder="请选择实体状态" />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<!-- <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
<!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
<!-- </span>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-form>-->
<!-- </div>-->
<!-- &lt;!&ndash; 查询区域-END &ndash;&gt;-->
@cancel="handleCancel">
<!-- &lt;!&ndash; 查询区域 &ndash;&gt;-->
<div>
<span style="text-align: center;display:block;font-weight:bold;">模块名称{{moduleName}}</span>
<!-- <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="中文名称">-->
<!-- <a-input placeholder="中文名称" v-model="queryParam.tableName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="英文名称">-->
<!-- <a-input placeholder="英文名称" v-model="queryParam.tableEnName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="实体状态">-->
<!-- <j-dict-select-tag type="list" v-model="queryParam.status" dictCode="a_status" placeholder="请选择实体状态" />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<!-- <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
<!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
<!-- </span>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-form>-->
<!-- </div>-->
<!-- &lt;!&ndash; 查询区域-END &ndash;&gt;-->
<!-- &lt;!&ndash; 操作按钮区域 &ndash;&gt;-->
<!-- <div class="table-operator">-->
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<!-- <a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button>-->
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>-->
<!-- &lt;!&ndash; 高级查询区域 &ndash;&gt;-->
<!--&lt;!&ndash; <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>&ndash;&gt;-->
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!-- </a-menu>-->
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
<!-- </a-dropdown>-->
<!-- <a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>-->
<!-- </div>-->
<!-- 操作按钮区域 -->
<!-- <div class="table-operator">-->
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<!-- <a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button>-->
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>-->
<!-- &lt;!&ndash; 高级查询区域 &ndash;&gt;-->
<!--&lt;!&ndash; <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>&ndash;&gt;-->
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!-- </a-menu>-->
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
<!-- </a-dropdown>-->
<!-- <a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>-->
<!-- </div>-->
<!-- &lt;!&ndash; table区域-begin &ndash;&gt;-->
<!-- <div>-->
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>-->
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
<!-- </div>-->
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
<!-- &lt;!&ndash; table区域-begin &ndash;&gt;-->
<!-- <div>-->
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>-->
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
<!-- </div>-->
<j-vxe-table
ref="xTable"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
height='auto'
toolbar
:toolbarConfig="toolbarConfig"
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
row-number
row-selection
keep-source
async-remove
:pagination="pagination"
style="margin-top: 8px;"
@pageChange="handlePageChange"
@added="added">
<template v-slot:toolbarSuffix>
<a style="
background: #e6f7ff;
color: red;
position: relative;
border: 1px solid #91d5ff;
padding: 6px 300px 8px 31px;
border-radius: 5px;">
注意: 编辑后请点击保存按钮保存数据</a>
<!-- <a-button type="primary" icon="rollback" @click="fanHui()">返回</a-button>-->
<!-- <p style="color: red;font-size: 16px"></p>-->
</template>
<!-- <template slot="htmlSlot" slot-scope="text">-->
<!-- <div v-html="text"></div>-->
<!-- </template>-->
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<!-- <template slot="fileSlot" slot-scope="text">-->
<!-- <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>-->
<!-- <a-button-->
<!-- v-else-->
<!-- :ghost="true"-->
<!-- type="primary"-->
<!-- icon="download"-->
<!-- size="small"-->
<!-- @click="downloadFile(text)">-->
<!-- 下载-->
<!-- </a-button>-->
<!-- </template>-->
<!-- <template slot="htmlSlot" slot-scope="text,record">-->
<!-- <a @click="viewVid(record)">字段</a>-->
<!-- </template>-->
<!-- <template slot="htmlSlot" slot-scope="text,record">-->
<!-- <a @click="viewVid(record)">字段</a>-->
<!-- </template>-->
<span slot="action" slot-scope="text, record">
<!-- <span slot="action" slot-scope="text, record">-->
<a @click="handleEdit(record)">编辑</a>
<!-- <a @click="handleEdit(record)">编辑</a>-->
<a-divider type="vertical" />
<a @click="handleDetail(record)">详情</a>
<a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<!-- <a-divider type="vertical" />-->
<!-- <a @click="handleDetail(record)">详情</a>-->
<!-- <a-divider type="vertical" />-->
<!-- <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
<!-- <a>删除</a>-->
<!-- </a-popconfirm>-->
<!-- </span>-->
<template v-slot:action="props">
<a @click="submitForm(props)">保存</a>
<a-divider type="vertical"/>
<!-- <a @click="viewDetail(props.rowId)">详情</a>-->
<!-- <a-divider type="vertical"/>-->
<a-popconfirm title="确定删除吗?" @confirm="handleDelete(props.rowId)">
<a>删除</a>
</a-popconfirm>
</span>
</a-table>
</template>
</j-vxe-table>
</div>
<tablex-modal ref="modalForm" @ok="modalFormOk"></tablex-modal>
<FieldxList ref="FieldxList"></FieldxList>
<!-- <tablex-modal ref="modalForm" @ok="modalFormOk"></tablex-modal>-->
<!-- <FieldxList ref="FieldxList"></FieldxList>-->
</a-modal>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TablexModal from './modules/TablexModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import JEllipsis from '@/components/jeecg/JEllipsis'
import FieldxList from "@/views/fieldx/FieldxList";
import {getAction} from "@api/manage";
import {filterObj} from "@/utils/util";
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TablexModal from './modules/TablexModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import JEllipsis from '@/components/jeecg/JEllipsis'
import FieldxList from "@/views/fieldx/FieldxList";
import {getAction, httpAction} from "@api/manage";
import {filterObj} from "@/utils/util";
import {JVXETypes} from "@comp/jeecg/JVxeTable";
export default {
name: 'TablexList',
mixins:[JeecgListMixin, mixinDevice],
components: {
TablexModal,
JEllipsis,
FieldxList,
},
data () {
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
return {
// loadRouteType:false,
description: '实体表管理页面',
moduleid:'',
//
visible: false,
confirmLoading: false,
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'对应模块',
align:"center",
dataIndex: 'moduleId_dictText'
},
{
title:'中文名称',
align:"center",
dataIndex: 'tableName'
},
{
title:'英文名称',
align:"center",
dataIndex: 'tableEnName'
},
{
title:'表结构SQL',
align:"center",
dataIndex: 'tableStructure',
customRender: (t)=>ellipsis(t)
},
{
title:'结构图',
align:"center",
dataIndex: 'structuralDiagram',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'创建人',
align:"center",
dataIndex: 'createBy'
},
{
title:'创建时间',
align:"center",
dataIndex: 'createTime'
},
{
title:'修改人',
align:"center",
dataIndex: 'updateBy'
},
{
title:'修改时间',
align:"center",
dataIndex: 'updateTime'
},
{
title:'实体状态',
align:"center",
dataIndex: 'status_dictText'
},
{
title:'版本状态',
align:"center",
dataIndex: 'verisonStatus_dictText'
},
{
title:'版本号',
align:"center",
dataIndex: 'verison'
},
// {
// title: '',
// dataIndex: 'htmlSlot',
// align: "center",
// fixed: "right",
// width: 147,
// scopedSlots: {customRender: 'htmlSlot'}
// },
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/tablex/tablex/list",
delete: "/tablex/tablex/delete",
deleteBatch: "/tablex/tablex/deleteBatch",
exportXlsUrl: "/tablex/tablex/exportXls",
importExcelUrl: "tablex/tablex/importExcel",
export default {
name: 'TablexList',
mixins:[JeecgListMixin, mixinDevice],
components: {
// TablexModal,
// JEllipsis,
// FieldxList,
},
data () {
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
return {
// loadRouteType:false,
description: '实体表管理页面',
moduleid:'',
//
visible: false,
confirmLoading: false,
//
toolbarConfig: {
// add remove clearSelection
btn: ['add'],
},
//
loading: false,
//
pagination: {
//
current: 1,
//
pageSize: 10,
//
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 0
total: 0,
showQuickJumper: true,
showSizeChanger: true,
id: null
},
// reload
reloadEffect:true,
columns: [
// {
// key: 'moduleId_dictText',
// title:'',
// width: '6%',
// type: JVXETypes.normal,
// disabled: true,
// },
{
key: 'tableName', title: '中文名称', width: '6%',
validateRules: [{required: true, message: '${title}不能为空'}],
type: JVXETypes.normal,
disabled: true,
},
{
key: 'tableEnName', title: '英文名称', width: '6%',
validateRules: [{required: true, message: '${title}不能为空'}],
type: JVXETypes.normal,
disabled: true,
},
{
title:'表结构SQL', width: '14%',
key: 'tableStructure',
type: JVXETypes.normal,
align: 'center',
disabled: true,
customRender: (t)=>ellipsis(t)
},
{
title:'结构图', width: '10%',
key: 'structuralDiagram',
type: JVXETypes.upload,
scopedSlots: {customRender: 'imgSlot'},
align: 'center',
},
dictOptions:{},
superFieldList:[],
{
title:'创建人',width: '6%',
align:"center",
key: 'createBy'
},
{
title:'创建时间',width: '6%',
align:"center",
key: 'createTime'
},
{
title:'修改人',width: '6%',
align:"center",
key: 'updateBy'
},
{
title:'修改时间',width: '6%',
align:"center",
key: 'updateTime'
},
{
title:'实体状态', width: '6%',
key: 'status_dictText',
dictCode:'a_status',
defaultValue:1,
type: JVXETypes.select,
align: 'center',
},
{
key: 'verisonStatus', title: '版本状态', width: '6%',
type: JVXETypes.select,
dictCode:'verison_status',
defaultValue:1,
validateRules: [{required: true, message: '${title}不能为空'}],
align: 'center',
},
{
key: 'verison', title: '版本号', width: '6%',
type: JVXETypes.normal,
dictCode:'yn',
align: 'center',
},
{
title: '操作',
key: 'action',
type: JVXETypes.slot,
fixed: 'right',
//
align: 'center',
minWidth: '6%',
slotName: 'action',
}
],
// columns: [
// {
// title: '#',
// dataIndex: '',
// key:'rowIndex',
// width:60,
// align:"center",
// customRender:function (t,r,index) {
// return parseInt(index)+1;
// }
// },
// {
// title:'',
// align:"center",
// dataIndex: 'moduleId_dictText'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'tableName'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'tableEnName'
// },
// {
// title:'SQL',
// align:"center",
// dataIndex: 'tableStructure',
// customRender: (t)=>ellipsis(t)
// },
// {
// title:'',
// align:"center",
// dataIndex: 'structuralDiagram',
// scopedSlots: {customRender: 'imgSlot'}
// },
// {
// title:'',
// align:"center",
// dataIndex: 'createBy'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'createTime'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'updateBy'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'updateTime'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'status_dictText'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'verisonStatus_dictText'
// },
// {
// title:'',
// align:"center",
// dataIndex: 'verison'
// },
// // {
// // title: '',
// // dataIndex: 'htmlSlot',
// // align: "center",
// // fixed: "right",
// // width: 147,
// // scopedSlots: {customRender: 'htmlSlot'}
// // },
// {
// title: '',
// dataIndex: 'action',
// align:"center",
// fixed:"right",
// width:147,
// scopedSlots: { customRender: 'action' }
// }
// ],
url: {
add: "/tablex/tablex/add",
edit: "/tablex/tablex/edit",
list: "/tablex/tablex/list",
delete: "/tablex/tablex/delete",
deleteBatch: "/tablex/tablex/deleteBatch",
exportXlsUrl: "/tablex/tablex/exportXls",
importExcelUrl: "tablex/tablex/importExcel",
getTableByModuleId:"tablex/tablex/getTableByModuleId",
},
dictOptions:{},
superFieldList:[],
//
loadRouteType: false,
isorterx: {
column: 'createTime',
order: 'asc',
},
moduleName:'',
}
},
created() {
// this.loadParameter();
this.getSuperFieldList();
// this.loadData();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
submitForm(props) {
this.model = Object.assign({}, props);
var str = props.rowId;
let httpurl = '';
let method = '';
if (str.search("row") !== -1) {
props.row.id ='';
console.log("新增")
httpurl += this.url.add;
method = 'post';
} else {
console.log("编辑")
httpurl += this.url.edit;
method = 'put';
}
props.row.moduleId = this.moduleid
console.log(props.row)
httpAction(httpurl, props.row, method).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.$emit('ok');
} else {
this.$message.warning(res.message);
}
})
props.row
},
created() {
// this.loadParameter();
this.getSuperFieldList();
// this.loadData();
fanhui(){
this.$router.push({
/*返回产品*/
path: '/src/views/modulex/ModulexList',
query:{
project:this.$route.query.project
}/*在引号中填写返回vue*/
});
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
handlePageChange(event) {
//
this.pagination.current = event.current
this.pagination.pageSize = event.pageSize
//
this.loadData()
},
methods: {
fanhui(){
this.$router.push({
/*返回产品*/
path: '/src/views/modulex/ModulexList',
query:{
project:this.$route.query.project
}/*在引号中填写返回vue*/
});
},
edit(record) {
this.model = Object.assign({}, record);
console.log(this.model)
//console.log(topicid);
this.queryParam.moduleId = this.model.id;
this.tableid = this.model.id
this.tableName=this.model.tableName;
console.log(this.queryParam.moduleId);
this.loadData();
},
showModal() {
this.visible = true;
},
handleOk(e) {
this.visible = false;
},
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
viewVid(record) {
this.$refs.FieldxList.showModal();
this.$refs.FieldxList.edit(record);
this.$refs.FieldxList.disableSubmit = false;
},
// loadParameter() {
// this.queryParam.moduleId = this.$route.query.moduleid;
// // console.log("***********")
// this.loadRouteType = true;
// this.loadData();
// },
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'sel_search',value:'moduleId',text:'对应模块id',dictTable:'modulex', dictText:'module_name', dictCode:'id'})
fieldList.push({type:'string',value:'tableName',text:'中文名称',dictCode:''})
fieldList.push({type:'string',value:'tableEnName',text:'英文名称',dictCode:''})
fieldList.push({type:'string',value:'tableStructure',text:'表结构SQL',dictCode:''})
fieldList.push({type:'string',value:'structuralDiagram',text:'结构图',dictCode:''})
fieldList.push({type:'int',value:'status',text:'实体状态',dictCode:''})
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''})
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''})
this.superFieldList = fieldList
},
loadParameter() {
if (this.loadRouteType === false) {
this.id = this.$route.query.moduleid;
// console.log("***********")
this.loadRouteType = true;
//
added(event) {
//ref
// const values = this.$refs.xTable.getTableData()
// console.log(':', { values })
const {type, row, column, value, target} = event
console.log(event,"-------")
target.setValues([{
rowKey: row.id,
values: {moduleId_dictText: this.moduleName,
tableName: this.moduleName,
tableEnName:this.moduleEnName
}
},
loadData(arg) {
// if (!this.url.list) {
// this.$message.error("url.list!");
// return
// }
// 1
if (arg === 1) {
this.ipagination.current = 1;
}])
},
//
async handleValueChange(event) {
//this.submitForm(event)
// console.log("//", event);
//const str = event.row.id;
let httpUrl = this.url.edit;
let method = 'put';
await httpAction(httpUrl, event.row, method).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.$emit('ok');
} else {
this.$message.warning(res.message);
}
this.loadParameter();
var params = this.getQueryParams();//
console.log(params)
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for------------
this.dataSource = res.result.records || res.result;
if (res.result.total) {
this.ipagination.total = res.result.total;
} else {
this.ipagination.total = 0;
}
//update-end---author:zhangyafei Date:20201118 for------------
})
},
edit(record) {
this.model = Object.assign({}, record);
console.log(this.model)
//console.log(topicid);
this.queryParam.moduleId = this.model.id;
this.moduleid = this.model.id
this.moduleName=this.model.moduleName;
this.moduleEnName=this.model.moduleEnName;
console.log(this.queryParam.moduleId);
this.loadData();
},
showModal() {
this.visible = true;
},
handleOk(e) {
this.visible = false;
},
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
viewVid(record) {
this.$refs.FieldxList.showModal();
this.$refs.FieldxList.edit(record);
this.$refs.FieldxList.disableSubmit = false;
},
// loadParameter() {
// this.queryParam.moduleId = this.$route.query.moduleid;
// // console.log("***********")
// this.loadRouteType = true;
// this.loadData();
// },
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'sel_search',value:'moduleId',text:'对应模块id',dictTable:'modulex', dictText:'module_name', dictCode:'id'})
fieldList.push({type:'string',value:'tableName',text:'中文名称',dictCode:''})
fieldList.push({type:'string',value:'tableEnName',text:'英文名称',dictCode:''})
fieldList.push({type:'string',value:'tableStructure',text:'表结构SQL',dictCode:''})
fieldList.push({type:'string',value:'structuralDiagram',text:'结构图',dictCode:''})
fieldList.push({type:'int',value:'status',text:'实体状态',dictCode:''})
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''})
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''})
this.superFieldList = fieldList
},
loadParameter() {
if (this.loadRouteType === false) {
this.id = this.$route.query.moduleid;
// console.log("***********")
this.loadRouteType = true;
}
},
loadData(arg) {
// if (!this.url.list) {
// this.$message.error("url.list!");
// return
// }
// 1
if (arg === 1) {
this.ipagination.current = 1;
}
this.loadParameter();
var params = this.getQueryParams();//
console.log(params)
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for------------
this.dataSource = res.result.records || res.result;
if (res.result.total) {
this.ipagination.total = res.result.total;
} else {
this.$message.warning(res.message)
this.ipagination.total = 0;
}
}).finally(() => {
this.loading = false
})
},
getQueryParams() {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
//update-end---author:zhangyafei Date:20201118 for------------
} else {
this.$message.warning(res.message)
}
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//param.id=this.id;
// param.moduleId = this.$route.query.moduleid;
return filterObj(param);
},
searchReset() {
this.queryParam=''
this.loadData();
},
}
}).finally(() => {
this.loading = false
})
},
getQueryParams() {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//param.id=this.id;
// param.moduleId = this.$route.query.moduleid;
return filterObj(param);
},
searchReset() {
this.queryParam=''
this.loadData();
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>

@ -1,8 +1,6 @@
package org.jeecg.modules.tablex.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -86,7 +84,22 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
IPage<Tablex> pageList = tablexService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "实体管理-通过模块查询实体")
@ApiOperation(value="实体管理-通过模块查询实体", notes="实体管理-通过模块查询实体")
@GetMapping(value = "/getTableByModuleId")
public Result<?> getTableByModuleId(@RequestParam(name="moduleId",required=true) String moduleId){
if (moduleId!=null){
List<Tablex> tablexList = tablexService.list(new QueryWrapper<Tablex>().eq("module_id", moduleId));
ArrayList<HashMap> hashMaps = new ArrayList<>();
for (Tablex tablex:tablexList){
HashMap<Object, Object> hashMap = new HashMap<>();
hashMap.put("text",tablex.getTableName());
hashMap.put("value",tablex.getId());
hashMaps.add(hashMap);
}
return Result.OK(hashMaps);
}else return Result.error("未找到数据,请重试");
}
/**
* 添加
*
@ -127,12 +140,12 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Tablex tablex) {
tablex.setVerison(tablex.getVerison()+1);
List<Tablex> tablexList = tablexService.list();
for (Tablex tablex1 : tablexList){
if (tablex1.getModuleId().equals(tablex.getModuleId())){
return Result.error("该模块已有实体,编辑失败");
}
}
// List<Tablex> tablexList = tablexService.list();
// for (Tablex tablex1 : tablexList){
// if (tablex1.getModuleId().equals(tablex.getModuleId())){
// return Result.error("该模块已有实体,编辑失败");
// }
// }
if (tablex.getModuleId() != null){
Modulex modulex = modulexService.getById(tablex.getModuleId());
tablex.setTableName(modulex.getModuleName());

Loading…
Cancel
Save