From c2ee2b74bd587fdad8e9e276beb3c792f56f5b6c Mon Sep 17 00:00:00 2001 From: lihang <lihang@vci-tech.com> Date: 星期三, 05 七月 2023 16:33:55 +0800 Subject: [PATCH] 业务类型和元数据相关的修正 --- Source/UBCS-WEB/src/views/modeling/original.vue | 40 +++++++++++-- Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue | 32 ++++++---- Source/UBCS-WEB/src/views/modeling/originalAdd.vue | 78 +++++++++++++++++--------- 3 files changed, 103 insertions(+), 47 deletions(-) diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue index 1515c8f..7e4f639 100644 --- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue +++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue @@ -1,5 +1,5 @@ <template> - <el-dialog + <el-dialog title="涓氬姟绫诲瀷" :visible.sync="showSubmitDialog" append-to-body @@ -43,16 +43,16 @@ </el-form-item> </div> <el-form-item label="鎻忚堪" label-width="100px" class="description"> - <el-input v-model="btmType.description" - :prefix-icon="icons.desc" + <el-input v-model="btmType.description" + :prefix-icon="icons.desc" class="descClass" id="descId" ></el-input> </el-form-item> </el-form> - <avue-crud :option="option" - :data="btmType.attributes" - :page.sync="page" + <avue-crud :option="option" + :data="btmType.attributes" + :page.sync="page" ref="attrTable" @cell-mouse-enter="cellEditClick" @cell-mouse-leave="cellEditSave"> @@ -62,7 +62,7 @@ size="small" @click="rowAdd()">灞炴�ч�夋嫨</el-button> </template> - + </avue-crud> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitBtmType">纭畾</el-button> @@ -76,9 +76,9 @@ @close="closeAttrDialog" width="80%" > - <avue-crud class="attrRef" - :option="attrRef.option" - :data="attrRef.data" + <avue-crud class="attrRef" + :option="attrRef.option" + :data="attrRef.data" :page.sync="attrRef.page" ref="attrRef" @on-load="attrRefOnLoad" @@ -98,7 +98,7 @@ :visible.sync="revisionRef.visible" append-to-body width="80%"> - + <avue-crud class="revisionRef" :option="revisionRef.option" :data="revisionRef.data" @@ -320,7 +320,7 @@ id: [ { required: true, message: '璇疯緭鍏ヤ笟鍔$被鍨嬬紪鍙�', trigger: 'blur' }, { pattern: /^[A-Za-z]+$/, message: '涓氬姟绫诲瀷缂栧彿鍙兘涓鸿嫳鏂�', trigger: 'blur' }, - { min: 2, max: 15, message: '闀垮害鍦�2鍒�15涓瓧绗�', trigger: 'blur' } + { min: 2, max: 20, message: '闀垮害鍦�2鍒�20涓瓧绗�', trigger: 'blur' } ], domain: [ { required: true, message: '璇烽�夋嫨鎵�灞為鍩�', trigger: 'blur' } @@ -387,7 +387,11 @@ attrDataType : item.typeKey, defaultValue: item.defaultValue, description: item.description, - attributeLength: item.maxLength + attributeLength: item.maxLength, + referBtmTypeId: item.referTypeCode, + referBtmTypeName: item.referToName, + enumId: item.dictCode, + // enumName: item, }); this.attrRef.queryNotIn += (item.id + ",") }); @@ -420,7 +424,7 @@ this.$refs.attrTable.refreshTable(); }) }, - // + // viewChange(){ }, diff --git a/Source/UBCS-WEB/src/views/modeling/original.vue b/Source/UBCS-WEB/src/views/modeling/original.vue index 805e99f..6588c67 100644 --- a/Source/UBCS-WEB/src/views/modeling/original.vue +++ b/Source/UBCS-WEB/src/views/modeling/original.vue @@ -122,14 +122,14 @@ <template slot="label"> 鏋氫妇绫诲瀷 </template> - {{ itemForm.itemData.dictCode }} + {{ itemForm.itemData.dictValue }} </el-descriptions-item> </el-descriptions> </el-tab-pane> </el-tabs> </basic-container> </el-aside> - <originalAdd ref="originalAdd" @refreshTable="refreshChange"></originalAdd> + <originalAdd ref="originalAdd" @refreshTable="refreshChange" :attribute="editAttribute"></originalAdd> </el-container> </template> @@ -141,6 +141,7 @@ update, getPage, getApplyRange } from "@/api/omd/OmdAttribute"; import Versionpackage from "./Versionpackage.vue"; +import {getDictionary} from "@/api/omd/enum"; export default { name: "original", @@ -157,7 +158,7 @@ attribute: { nullable: true }, - editAttibute: {}, + editAttribute: {}, applyRangeData: [], option: { height: "550px", @@ -250,6 +251,8 @@ itemForm: { itemData: {}, activeName: "referTab", + enumInitFlag:false, + referInitFlag: false, form: {} }, searchId: '', @@ -268,10 +271,14 @@ updateSave(row,index) { this.selectRow = index; var json = JSON.stringify(row); - this.editAttibute = JSON.parse(json); - this.editAttibute.nullable = row.nullable == 'true' ? true : false; - this.$refs.originalAdd.attribute = this.editAttibute; + this.editAttribute = JSON.parse(json); + this.editAttribute.nullable = row.nullable == 'true' ? true : false; + this.$refs.originalAdd.attribute = this.editAttribute; this.$refs.originalAdd.showSubmitDialog = true; + this.checkUsingReferDict(row); + this.$refs.originalAdd.activeName = this.itemForm.activeName; + this.$refs.originalAdd.enumInitFlag = this.itemForm.enumInitFlag; + this.$refs.originalAdd.referInitFlag = this.itemForm.referInitFlag; this.refreshChange() }, deleteSave(row,index) { @@ -296,6 +303,27 @@ this.itemForm.itemData = row; this.selectRow = row.$index; this.attribute = row; + this.checkUsingReferDict(row); + }, + checkUsingReferDict(row){ + if (row.referToId !== null && row.referToId !== ""){ + this.itemForm.activeName = 'referTab'; + this.itemForm.referInitFlag = true; + this.itemForm.enumInitFlag = false; + }else if (row.usingDict === 'true'){ + this.itemForm.activeName = 'enumTab'; + this.itemForm.referInitFlag = false; + this.itemForm.enumInitFlag = true; + getDictionary({code: row.dictCode}).then(res => { + this.editAttribute.dictValue = res.data.data[0].label; + this.itemForm.itemData.dictValue = this.editAttribute.dictValue; + this.$refs.originalAdd.dictEnums = res.data.data; + }) + }else { + this.itemForm.activeName = 'referTab'; + this.itemForm.referInitFlag = true; + this.itemForm.enumInitFlag = false; + } }, selectBtmType() { this.referType.display = true; diff --git a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue index c6e0c48..f73ccfa 100644 --- a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue +++ b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue @@ -37,7 +37,6 @@ <el-form-item label="鎻忚堪" label-width="100px"> <el-input v-model="attribute.description" type="text"></el-input> </el-form-item> - <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true"> <el-tab-pane label="鍙傜収" name="referTab"> <el-form-item label="鍙傜収绫诲瀷" label-width="100px"> @@ -61,14 +60,16 @@ </el-input> </el-form-item> <el-form-item label="鏋氫妇椤�" label-width="100px"> - + <el-tag v-for="eItem in dictEnums" :key="eItem.itemName" type="info"> + {{eItem.itemName}} + </el-tag> </el-form-item> </el-tab-pane> </el-tabs> </el-form> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitAttribute">纭畾</el-button> - <el-button @click="cancleSubmit">鍙栨秷</el-button> + <el-button @click="cancelSubmit">鍙栨秷</el-button> </div> <!-- 閫夋嫨鍙傜収鏃剁殑寮圭獥 --> <el-dialog title="鍙傜収鍒楄〃" :visible.sync="btmRefer.show" append-to-body @close="closeReferDialog" width="80%" @@ -104,7 +105,7 @@ </el-container> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="confirmBtm" size="small">纭畾</el-button> - <el-button @click="cancleBtm" size="small">鍙栨秷</el-button> + <el-button @click="cancelBtm" size="small">鍙栨秷</el-button> </div> </el-dialog> <!-- 閫夋嫨鏋氫妇鏃剁殑寮圭獥 --> @@ -119,7 +120,7 @@ </avue-crud> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="confirmEnum" size="small">纭畾</el-button> - <el-button @click="cancleEnum" size="small">鍙栨秷</el-button> + <el-button @click="cancelEnum" size="small">鍙栨秷</el-button> </div> </el-dialog> </el-dialog> @@ -223,7 +224,7 @@ addBtn: false, refreshBtn: false, columnBtn: false, - selection: true, + // selection: true, menu: false, border: true, reserveSelection: true, @@ -267,7 +268,12 @@ value: 'oid', } } - } + }, + dictEnums: [], + enumEditFlag: false, + enumInitFlag: false, + referInitFlag: false, + referEditFlag: false, } }, created() { @@ -286,9 +292,23 @@ }; this.referToFlag = true; this.$refs.form.resetFields(); + this.dictEnums = []; }, submitAttribute() { const that = this; + if (that.referInitFlag && that.referEditFlag){ + this.$delete(this.attribute,'dictCode'); + this.$delete(this.attribute,'dictKey'); + this.$delete(this.attribute,'dictValue'); + this.$delete(this.attribute,'usingDict'); + } + if (that.enumInitFlag && that.enumEditFlag){ + this.$delete(this.attribute,'referTypeCode'); + this.$delete(this.attribute,'referTypeKey'); + this.$delete(this.attribute,'referTypeValue'); + this.$delete(this.attribute,'referToId'); + this.$delete(this.attribute,'referToName'); + } this.$refs.form.validate(function (pass, field) { if (pass) { add(that.attribute).then(res => { @@ -302,21 +322,23 @@ } }) }, - cancleSubmit() { + cancelSubmit() { this.closeSubmitDialog(); }, closeEnumDialog() { - this.cancleEnum(); + this.cancelEnum(); }, closeReferDialog() { - this.cancleBtm(); + this.cancelBtm(); }, confirmBtm() { this.attribute.referToId = this.btmRefer.selectItem.oid; this.attribute.referToName = this.btmRefer.selectItem.name; this.btmRefer.show = false; + this.referEditFlag = true; + this.enumEditFlag = false; }, - cancleBtm() { + cancelBtm() { this.btmRefer.selectItem = {}; this.btmRefer.show = false; this.btmRefer.selectRow = ''; @@ -326,8 +348,13 @@ this.attribute.dictCode = this.enumRefer.selectItem.name; this.attribute.dictValue = this.enumRefer.selectItem.label; this.enumRefer.show = false; + getDictionary({code :this.enumRefer.selectItem.name}).then(res => { + this.dictEnums = res.data.data; + }); + this.referEditFlag = false; + this.enumEditFlag = true; }, - cancleEnum() { + cancelEnum() { this.enumRefer.selectItem = {}; this.enumRefer.show = false; this.enumRefer.selectRow = ''; @@ -345,13 +372,12 @@ this.domain.data = res.data.data; }) this.btmRefer.show = true; - }, // 鍙傜収绫诲瀷鏍戠殑鐐瑰嚮浜嬩欢 nodeClick(data) { // 鍖哄垎涓氬姟绫诲瀷鐨勬煡璇㈠拰閾炬帴绫诲瀷鐨勬煡璇� if (this.attribute.referTypeKey == 'btmType') { - btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { domain: data.id }).then(res => { + btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { bizDomain: data.id }).then(res => { this.btmRefer.data = res.data.data.records; this.btmRefer.btmPage.total = res.data.data.total; }) @@ -431,18 +457,16 @@ this.btmRefer.selectItem = {}; this.btmRefer.selectRow = ''; }, - // handleClick(tab){ - // // 鍥犱负鍙兘鍙傜収鍜屾灇涓句簩閫変竴銆傛墍浠ュ湪鍒囨崲鐨勬椂鍊欐妸灞炴�х粰娓呯┖銆� - // this.$delete(this.attribute,'referTypeCode'); - // this.$delete(this.attribute,'referTypeKey'); - // this.$delete(this.attribute,'referTypeValue'); - // this.$delete(this.attribute,'referToId'); - // this.$delete(this.attribute,'referToName'); - // this.$delete(this.attribute,'dictCode'); - // this.$delete(this.attribute,'dictKey'); - // this.$delete(this.attribute,'dictValue'); - // this.$delete(this.attribute,'usingDict'); - // } + handleClick(tab){ + // 鍥犱负鍙兘鍙傜収鍜屾灇涓句簩閫変竴銆傛墍浠ュ湪鍒囨崲鐨勬椂鍊欐妸灞炴�х粰娓呯┖銆� + if (tab.name === 'enumTab'){ + this.enumInitFlag = true; + this.referInitFlag = false; + }else { + this.enumInitFlag = false; + this.referInitFlag = true; + } + } } } </script> @@ -462,4 +486,4 @@ .attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner { width: 200px; -}</style> \ No newline at end of file +}</style> -- Gitblit v1.9.3