Compare commits

...

3 Commits

  1. 26
      ant-design-vue-jeecg/src/views/fieldx/FieldxList.vue
  2. 11
      ant-design-vue-jeecg/src/views/fieldx/modules/FieldxForm.vue
  3. 21
      ant-design-vue-jeecg/src/views/tablex/TablexList.vue
  4. 20
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java
  5. 12
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java

@ -138,7 +138,7 @@
} }
}, },
{ {
title:'对应实体id', title:'对应实体',
align:"center", align:"center",
dataIndex: 'tableId_dictText' dataIndex: 'tableId_dictText'
}, },
@ -245,8 +245,9 @@
} }
}, },
created() { created() {
this.getSuperFieldList(); this.loadParameter();
this.loadParameter(); this.getSuperFieldList();
this.searchQuery();
}, },
computed: { computed: {
importExcelUrl: function(){ importExcelUrl: function(){
@ -256,17 +257,30 @@
methods: { methods: {
initDictConfig(){ initDictConfig(){
}, },
searchReset() {
this.tableId = this.$route.query.tableId;
this.queryParam ={};
this.queryParam.tableId = this.tableId;
this.loadData(1);
},
searchQuery(){
this.tableId = this.$route.query.tableId;
this.queryParam.tableId = this.$route.query.tableId;
this.loadData(1);
},
// //
loadParameter() { loadParameter() {
if (this.loadRouteType == false) { if (this.loadRouteType == false) {
this.tableId = this.$route.query.id; this.queryParam.tableId = this.$route.query.tableId;
console.log(this.tableId) this.tableId = this.$route.query.tableId;
console.log(this.queryParam.tableId)
this.loadRouteType = true; this.loadRouteType = true;
this.loadData(1);
} }
}, },
getSuperFieldList(){ getSuperFieldList(){
let fieldList=[]; let fieldList=[];
fieldList.push({type:'string',value:'tableId',text:'对应实体id',dictCode:'tablex,table_name,id'}) fieldList.push({type:'string',value:'tableId',text:'对应实体',dictCode:'tablex,table_name,id'})
fieldList.push({type:'string',value:'fieldName',text:'中文名称',dictCode:''}) fieldList.push({type:'string',value:'fieldName',text:'中文名称',dictCode:''})
fieldList.push({type:'string',value:'fieldEnName',text:'英文名称',dictCode:''}) fieldList.push({type:'string',value:'fieldEnName',text:'英文名称',dictCode:''})
fieldList.push({type:'sel_search',value:'type',text:'数据类型',dictTable:'', dictText:'', dictCode:'date_type'}) fieldList.push({type:'sel_search',value:'type',text:'数据类型',dictTable:'', dictText:'', dictCode:'date_type'})

@ -50,12 +50,12 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="关联实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateTable"> <a-form-model-item label="关联实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateTable">
<j-search-select-tag v-model="model.associateTable" dict="tablex,table_name,id" ></j-search-select-tag> <j-search-select-tag v-model="model.associateTable" dict="tablex,table_name,id" @change="ziduan" ></j-search-select-tag>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="关联字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateField"> <a-form-model-item label="关联字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateField">
<j-search-select-tag v-model="model.associateField" placeholder="请输入关联字段" dict="fieldx,field_name,id"></j-search-select-tag> <j-search-select-tag v-model="model.associateField" placeholder="请输入关联字段" :dict=field></j-search-select-tag>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
@ -163,7 +163,8 @@
add: "/fieldx/fieldx/add", add: "/fieldx/fieldx/add",
edit: "/fieldx/fieldx/edit", edit: "/fieldx/fieldx/edit",
queryById: "/fieldx/fieldx/queryById" queryById: "/fieldx/fieldx/queryById"
} },
field:'fieldx,field_name,id',
} }
}, },
computed: { computed: {
@ -176,6 +177,10 @@
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
ziduan(){
this.field="fieldx,field_name,id,table_id="+this.model.associateTable;
this.model.associateField = '';
},
add () { add () {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },

@ -88,9 +88,11 @@
</a-button> </a-button>
</template> </template>
<template slot="htmlSlot" slot-scope="text,record">
<a @click="tablemanage(record.id)">字段</a>
</template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="tablemanage(record.id)">实体管理</a>
<a-divider type="vertical" />
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
@ -165,7 +167,8 @@
{ {
title:'结构图', title:'结构图',
align:"center", align:"center",
dataIndex: 'structuralDiagram' dataIndex: 'structuralDiagram',
scopedSlots: {customRender: 'imgSlot'}
}, },
{ {
title:'创建人', title:'创建人',
@ -202,6 +205,14 @@
align:"center", align:"center",
dataIndex: 'verison' dataIndex: 'verison'
}, },
{
title: '管理',
dataIndex: 'htmlSlot',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'htmlSlot'}
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
@ -232,10 +243,10 @@
}, },
}, },
methods: { methods: {
tablemanage(id) { tablemanage(tableId) {
this.$router.push({ this.$router.push({
path: '/fieldx/FieldxList', path: '/fieldx/FieldxList',
query: {id: id} query: {tableId: tableId}
}) })
}, },
initDictConfig(){ initDictConfig(){

@ -87,6 +87,9 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody Fieldx fieldx) { public Result<?> add(@RequestBody Fieldx fieldx) {
fieldx.setVerison(1); fieldx.setVerison(1);
if (fieldx.getAssociateTable() != null && fieldx.getAssociateTable().equals(fieldx.getTableId())){
return Result.error("实体不能关联自身,添加失败");
}
if (fieldx.getTableId() != null){ if (fieldx.getTableId() != null){
List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId())); List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId()));
for (Fieldx fieldx1 : fieldxList){ for (Fieldx fieldx1 : fieldxList){
@ -116,6 +119,23 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
@ApiOperation(value="字段管理-编辑", notes="字段管理-编辑") @ApiOperation(value="字段管理-编辑", notes="字段管理-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Fieldx fieldx) { public Result<?> edit(@RequestBody Fieldx fieldx) {
if (fieldx.getAssociateTable() != null && fieldx.getAssociateTable().equals(fieldx.getTableId())){
return Result.error("实体不能关联自身,编辑失败");
}
if (fieldx.getTableId() != null){
List<Fieldx> fieldxList = fieldxService.list(new QueryWrapper<Fieldx>().eq("table_id", fieldx.getTableId()));
for (Fieldx fieldx1 : fieldxList){
if (fieldx1.getFieldName().equals(fieldx.getFieldName())){
return Result.error("编辑失败,所属实体已有该中文名称");
}
if (fieldx1.getFieldEnName().equals(fieldx.getFieldEnName())){
return Result.error("编辑失败,所属实体已有该英文名称");
}
if (fieldx.getIsPk() == 1 && fieldx1.getIsPk() == 1){
return Result.error("该实体已经有主键,编辑失败");
}
}
}
fieldxService.updateById(fieldx); fieldxService.updateById(fieldx);
tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId())); tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId()));
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");

@ -97,6 +97,12 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
@ApiOperation(value="实体表-添加", notes="实体表-添加") @ApiOperation(value="实体表-添加", notes="实体表-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody Tablex tablex) { public Result<?> add(@RequestBody Tablex tablex) {
List<Tablex> tablexList = tablexService.list();
for (Tablex tablex1 : tablexList){
if (tablex1.getModuleId().equals(tablex.getModuleId())){
return Result.error("该模块已有实体,添加失败");
}
}
if (tablex.getModuleId() != null){ if (tablex.getModuleId() != null){
Modulex modulex = modulexService.getById(tablex.getModuleId()); Modulex modulex = modulexService.getById(tablex.getModuleId());
tablex.setTableName(modulex.getModuleName()); tablex.setTableName(modulex.getModuleName());
@ -118,6 +124,12 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
@ApiOperation(value="实体表-编辑", notes="实体表-编辑") @ApiOperation(value="实体表-编辑", notes="实体表-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Tablex tablex) { public Result<?> edit(@RequestBody Tablex tablex) {
List<Tablex> tablexList = tablexService.list();
for (Tablex tablex1 : tablexList){
if (tablex1.getModuleId().equals(tablex.getModuleId())){
return Result.error("该模块已有实体,编辑失败");
}
}
if (tablex.getModuleId() != null){ if (tablex.getModuleId() != null){
Modulex modulex = modulexService.getById(tablex.getModuleId()); Modulex modulex = modulexService.getById(tablex.getModuleId());
tablex.setTableName(modulex.getModuleName()); tablex.setTableName(modulex.getModuleName());

Loading…
Cancel
Save