master
admin 2 years ago
parent bd4dfaf03d
commit 105ba9a87f
  1. 13
      ant-design-vue-jeecg/src/views/fieldx/FieldxList.vue
  2. 11
      ant-design-vue-jeecg/src/views/fieldx/modules/FieldxForm.vue
  3. 9
      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

@ -247,6 +247,7 @@
created() {
this.loadParameter();
this.getSuperFieldList();
this.searchQuery();
},
computed: {
importExcelUrl: function(){
@ -257,19 +258,25 @@
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() {
if (this.loadRouteType == false) {
this.queryParam.tableId = this.$route.query.id;
this.tableId = this.$route.query.id;
this.queryParam.tableId = this.$route.query.tableId;
this.tableId = this.$route.query.tableId;
console.log(this.queryParam.tableId)
this.loadRouteType = true;
this.loadData(1);
}
this.searchQuery();
},
getSuperFieldList(){
let fieldList=[];

@ -50,12 +50,12 @@
</a-col>
<a-col :span="24">
<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-col>
<a-col :span="24">
<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-col>
<a-col :span="24">
@ -163,7 +163,8 @@
add: "/fieldx/fieldx/add",
edit: "/fieldx/fieldx/edit",
queryById: "/fieldx/fieldx/queryById"
}
},
field:'fieldx,field_name,id',
}
},
computed: {
@ -176,6 +177,10 @@
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
ziduan(){
this.field="fieldx,field_name,id,table_id="+this.model.associateTable;
this.model.associateField = '';
},
add () {
this.edit(this.modelDefault);
},

@ -89,7 +89,7 @@
</template>
<template slot="htmlSlot" slot-scope="text,record">
<a @click="tablemanage(record.id)">实体管理</a>
<a @click="tablemanage(record.id)">字段</a>
</template>
<span slot="action" slot-scope="text, record">
@ -167,7 +167,8 @@
{
title:'结构图',
align:"center",
dataIndex: 'structuralDiagram'
dataIndex: 'structuralDiagram',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'创建人',
@ -242,10 +243,10 @@
},
},
methods: {
tablemanage(id) {
tablemanage(tableId) {
this.$router.push({
path: '/fieldx/FieldxList',
query: {id: id}
query: {tableId: tableId}
})
},
initDictConfig(){

@ -87,6 +87,9 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Fieldx fieldx) {
fieldx.setVerison(1);
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){
@ -116,6 +119,23 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
@ApiOperation(value="字段管理-编辑", notes="字段管理-编辑")
@PutMapping(value = "/edit")
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);
tablexService.updateSql(fieldx.getTableId(),createSql(fieldx.getTableId()));
return Result.OK("编辑成功!");

Loading…
Cancel
Save