From 6f0dc3fbe36e23f2f5f5e04a35751cafa487e9fb Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 05 十二月 2023 17:17:41 +0800 Subject: [PATCH] 主数据-标准 整合代码 --- Source/UBCS-WEB/src/components/FormTemplate/index.vue | 232 +++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 158 insertions(+), 74 deletions(-) diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue index 2567d87..eb80c97 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue @@ -14,6 +14,7 @@ v-if="dialogVisible" key="masterForm" ref="FormTemplate" v-bind="$attrs" + :selectRow="selectRow" :TreeValue="TreeValue" :eventList="eventList" :rowOid="rowOid" @@ -41,6 +42,7 @@ :selfColumnConfig="selfColumnConfig" :selfColumnType="selfColumnType" :type="type" + :status="status" data-key="codeApplyForm" secDTOListv-bind="$attrs" @attrList="attrListForm" @@ -139,6 +141,10 @@ type: Object, default: () => ({}), }, + selectRow:{ + type:Array, + default:[] + } }, data() { return { @@ -242,15 +248,11 @@ }, }, watch: { - codeApplyForm: { - handler(newval, oldval) { - // console.log('newval',newval) - } - } + }, methods: { openDialog() { - //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢� + //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�(鏈夋敼鍔� 涓嶉渶瑕佸湪浣跨敤edit锛屾柟娉曟病浠�涔堝奖鍝�) this.getFormTemplate(); if (this.type === "add" || (this.type !== "add" && this.status === "amend")) { this.getCodeRule(); @@ -413,78 +415,160 @@ } }, async submit() { - // 杩涜琛ㄥ崟鏍¢獙 - const formValidate = await this.$refs.FormTemplate.validate(); - if (!formValidate) return; - let codeValidate = true; - // 杩涜鐮佸�肩敵璇锋牎楠� - // if (this.showCodeApply) { - // codeValidate = await this.$refs.CodeApply.validate(); - // if (!codeValidate) { - // this.activeName = "codeApply"; - // return false; - // } - // } - let resembleQueryList = []; - if (this.showResembleQuery && this.$refs.resembleQueryRef) { - // 杩涜鐩镐技椤规煡璇� - resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery( + if(this.status){ + // 杩涜琛ㄥ崟鏍¢獙 + const formValidate = await this.$refs.FormTemplate.validate(); + if (!formValidate) return; + let resembleQueryList = []; + if (this.showResembleQuery && this.$refs.resembleQueryRef) { + // 杩涜鐩镐技椤规煡璇� + resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery( + this.form + ); + } + if (resembleQueryList.length > 0) { + await this.$confirm( + `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋, + "闇�瑕佹偍纭", + { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + } + ); + } + // 鎺掗櫎涓�浜涘瓧娈� + const noData = [ + "jiliangdwname", + "materialtypeText", + "morengongysname", + "$caigouwl", + "$xiaoshouwl", + "$shifoupihaoguanli", + "lcstatus_text", + "hesuanfenleiname", + "$kucunwl", + "lastmodifier" + ]; + + let resForm = {}; + const {defaultValue, formValue} = this.getDefaultValueAndFormValues( this.form ); - } - if (resembleQueryList.length > 0) { - await this.$confirm( - `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋, - "闇�瑕佹偍纭", - { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning", - } - ); - } - // 鎺掗櫎涓�浜涘瓧娈� - const noData = [ - "jiliangdwname", - "materialtypeText", - "morengongysname", - "$caigouwl", - "$xiaoshouwl", - "$shifoupihaoguanli", - "lcstatus_text", - "hesuanfenleiname", - "$kucunwl", - "oldcode", - "lastmodifier" - ]; - let resForm = {}; - const {defaultValue, formValue} = this.getDefaultValueAndFormValues( - this.form - ); - noData.forEach((item) => { - this.$delete(formValue, item); - }); - const keys = Object.keys(formValue); - keys.forEach((item, index) => { - keys.forEach((itm, idx) => { - if ((item === ('$' + itm)) && idx !== index) { - this.$delete(formValue, keys[index]); - } - }) - }); + noData.forEach((item) => { + this.$delete(formValue, item); + }); + const keys = Object.keys(formValue); + keys.forEach((item, index) => { + keys.forEach((itm, idx) => { + if ((item === ('$' + itm)) && idx !== index) { + this.$delete(formValue, keys[index]); + } + }) + }); - resForm.data = formValue; - resForm = Object.assign({}, resForm, defaultValue); - resForm.secDTOList = this.secVOList.map((item) => { - return { - secOid: item.oid, - secValue: this.codeApplyForm[item.oid], + resForm.data = formValue; + resForm.data = Object.assign({}, resForm.data, defaultValue); + resForm.secDTOList = this.secVOList.map((item) => { + return { + secOid: item.oid, + secValue: this.codeApplyForm[item.oid], + }; + }); + //鏍囧噯鐗瑰畾瀛楁鏄犲皠 + const mappings = { + codeStandardEditType: 'operationType', + reviseSeries: 'series', + oldcode: 'oldCode', + releaseDate: 'releaseTime', + isSeries: 'isEditseries' }; - }); - resForm.codeClassifyOid = this.codeClassifyOid; - resForm.codeRuleOid = this.codeRuleOid; - resForm.templateOid = this.templateOid; - this.$emit("submit", resForm); + + for (const key in mappings) { + if (formValue[key]) { + resForm[mappings[key]] = formValue[key]; + } + } + // + resForm.codeClassifyOid = this.codeClassifyOid; + resForm.codeRuleOid = this.codeRuleOid; + resForm.templateOid = this.templateOid; + this.$emit("submit", resForm); + }else { + // 杩涜琛ㄥ崟鏍¢獙 + const formValidate = await this.$refs.FormTemplate.validate(); + if (!formValidate) return; + let codeValidate = true; + // 杩涜鐮佸�肩敵璇锋牎楠� + // if (this.showCodeApply) { + // codeValidate = await this.$refs.CodeApply.validate(); + // if (!codeValidate) { + // this.activeName = "codeApply"; + // return false; + // } + // } + let resembleQueryList = []; + if (this.showResembleQuery && this.$refs.resembleQueryRef) { + // 杩涜鐩镐技椤规煡璇� + resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery( + this.form + ); + } + if (resembleQueryList.length > 0) { + await this.$confirm( + `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋, + "闇�瑕佹偍纭", + { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + } + ); + } + // 鎺掗櫎涓�浜涘瓧娈� + const noData = [ + "jiliangdwname", + "materialtypeText", + "morengongysname", + "$caigouwl", + "$xiaoshouwl", + "$shifoupihaoguanli", + "lcstatus_text", + "hesuanfenleiname", + "$kucunwl", + "oldcode", + "lastmodifier" + ]; + + let resForm = {}; + const {defaultValue, formValue} = this.getDefaultValueAndFormValues( + this.form + ); + noData.forEach((item) => { + this.$delete(formValue, item); + }); + const keys = Object.keys(formValue); + keys.forEach((item, index) => { + keys.forEach((itm, idx) => { + if ((item === ('$' + itm)) && idx !== index) { + this.$delete(formValue, keys[index]); + } + }) + }); + + resForm.data = formValue; + resForm = Object.assign({}, resForm, defaultValue); + resForm.secDTOList = this.secVOList.map((item) => { + return { + secOid: item.oid, + secValue: this.codeApplyForm[item.oid], + }; + }); + resForm.codeClassifyOid = this.codeClassifyOid; + resForm.codeRuleOid = this.codeRuleOid; + resForm.templateOid = this.templateOid; + this.$emit("submit", resForm); + } }, getDefaultValueAndFormValues(form) { let defaultValue = {}; -- Gitblit v1.9.3