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

(注释了实体表 编辑请求的判断模块是否有实体)
master
shiji 1 year ago
parent e1975c46b2
commit 3716dc00ea
  1. 11
      ant-design-vue-jeecg/src/views/fieldx/FieldxList.vue
  2. 551
      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,140 +5,167 @@
: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"
row-number
row-selection
keep-source
async-remove
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
: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 {
export default {
name: 'TablexList',
mixins:[JeecgListMixin, mixinDevice],
components: {
TablexModal,
JEllipsis,
FieldxList,
// TablexModal,
// JEllipsis,
// FieldxList,
},
data () {
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
@ -149,106 +176,227 @@
//
visible: false,
confirmLoading: false,
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
//
toolbarConfig: {
// add remove clearSelection
btn: ['add'],
},
{
title:'对应模块',
align:"center",
dataIndex: 'moduleId_dictText'
//
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,
// },
{
title:'中文名称',
align:"center",
dataIndex: 'tableName'
key: 'tableName', title: '中文名称', width: '6%',
validateRules: [{required: true, message: '${title}不能为空'}],
type: JVXETypes.normal,
disabled: true,
},
{
title:'英文名称',
align:"center",
dataIndex: 'tableEnName'
key: 'tableEnName', title: '英文名称', width: '6%',
validateRules: [{required: true, message: '${title}不能为空'}],
type: JVXETypes.normal,
disabled: true,
},
{
title:'表结构SQL',
align:"center",
dataIndex: 'tableStructure',
title:'表结构SQL', width: '14%',
key: 'tableStructure',
type: JVXETypes.normal,
align: 'center',
disabled: true,
customRender: (t)=>ellipsis(t)
},
{
title:'结构图',
align:"center",
dataIndex: 'structuralDiagram',
scopedSlots: {customRender: 'imgSlot'}
title:'结构图', width: '10%',
key: 'structuralDiagram',
type: JVXETypes.upload,
scopedSlots: {customRender: 'imgSlot'},
align: 'center',
},
{
title:'创建人',
title:'创建人',width: '6%',
align:"center",
dataIndex: 'createBy'
key: 'createBy'
},
{
title:'创建时间',
title:'创建时间',width: '6%',
align:"center",
dataIndex: 'createTime'
key: 'createTime'
},
{
title:'修改人',
title:'修改人',width: '6%',
align:"center",
dataIndex: 'updateBy'
key: 'updateBy'
},
{
title:'修改时间',
title:'修改时间',width: '6%',
align:"center",
dataIndex: 'updateTime'
key: 'updateTime'
},
{
title:'实体状态',
align:"center",
dataIndex: 'status_dictText'
title:'实体状态', width: '6%',
key: 'status_dictText',
dictCode:'a_status',
defaultValue:1,
type: JVXETypes.select,
align: 'center',
},
{
title:'版本状态',
align:"center",
dataIndex: 'verisonStatus_dictText'
key: 'verisonStatus', title: '版本状态', width: '6%',
type: JVXETypes.select,
dictCode:'verison_status',
defaultValue:1,
validateRules: [{required: true, message: '${title}不能为空'}],
align: 'center',
},
{
title:'版本号',
align:"center",
dataIndex: 'verison'
key: 'verison', title: '版本号', width: '6%',
type: JVXETypes.normal,
dictCode:'yn',
align: 'center',
},
// {
// title: '',
// dataIndex: 'htmlSlot',
// align: "center",
// fixed: "right",
// width: 147,
// scopedSlots: {customRender: 'htmlSlot'}
// },
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
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() {
@ -262,6 +410,33 @@
},
},
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
},
fanhui(){
this.$router.push({
/*返回产品*/
@ -271,13 +446,53 @@
}/*在引号中填写返回vue*/
});
},
handlePageChange(event) {
//
this.pagination.current = event.current
this.pagination.pageSize = event.pageSize
//
this.loadData()
},
//
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
}
}])
},
//
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);
}
})
},
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;
this.moduleid = this.model.id
this.moduleName=this.model.moduleName;
this.moduleEnName=this.model.moduleEnName;
console.log(this.queryParam.moduleId);
this.loadData();
},
@ -373,8 +588,8 @@
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