From cfededd9721be4322e660fc879f11a806fcc7963 Mon Sep 17 00:00:00 2001 From: weidy <lastanimals@163.com> Date: 星期二, 20 六月 2023 17:07:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/components/FormTemplate/index.vue | 184 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 166 insertions(+), 18 deletions(-) diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue index a5e99a0..b6946b6 100644 --- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue +++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue @@ -3,9 +3,8 @@ :visible.sync="dialogVisible" v-if="dialogVisible" v-dialogDrag - top="0vh" + top="5vh" :title="title" - class="avue-dialog avue-dialog--top" :width="width" append-to-body @opened="openDialog" @@ -25,18 +24,20 @@ v-if=" type !== 'detail' && dialogVisible && - (showCodeApply || showResembleQuery) + (showCodeApply || showResembleQuery) && + type !== 'preview' " > <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick"> - <el-tab-pane label="鐮佸�肩敵璇�" name="codeApply" v-if="showCodeApply"> + <el-tab-pane label="鐮佸�肩敵璇�" name="codeApply"> <FormTempalte v-bind="$attrs" :type="type" :selfColumnType="selfColumnType" :selfColumnConfig="selfColumnConfig" ref="CodeApply" - @getFormData="getFormData" + @getFormData="getCodeApplyFormData" + @referConfigDataUpdate="referConfigDataUpdate" ></FormTempalte> </el-tab-pane> <el-tab-pane @@ -58,9 +59,9 @@ </div> <div class="avue-dialog__footer" v-if="type !== 'detail'"> <el-button @click="close()">鍙� 娑�</el-button> - <el-button @click="submit()" type="primary" :loading="submitBtnLoading" - >纭� 瀹�</el-button - > + <el-button @click="submit()" type="primary" :loading="submitBtnLoading">{{ + submitText + }}</el-button> <el-button @click="resembleQuerySubmit" type="primary" @@ -104,6 +105,10 @@ type: String, default: "", }, + submitText: { + type: String, + default: "纭� 瀹�", + }, }, data() { return { @@ -113,6 +118,7 @@ resembleTableColumn: [], secVOList: [], form: {}, + codeApplyForm: {}, activeName: "codeApply", showCodeApply: true, showResembleQuery: true, @@ -127,6 +133,8 @@ required: this.isRequired, dicData: this.getOptionList, type: this.getType, + referConfig: this.getReferConfig, + readOnly: this.getDisabled, }, exchange: { text: "name", @@ -146,6 +154,38 @@ }, }, }, + defaultKeys: [ + "oid", + "id", + "name", + "description", + "revisionoid", + "nameoid", + "btmname", + "lastr", + "firstr", + "lastv", + "firstv", + "creator", + "createtime", + "lastModifier", + "lastmodifytime", + "revisionrule", + "revisionseq", + "revisionvalue", + "versionrule", + "versionseq", + "versionvalue", + "lcstatus", + "ts", + "owner", + "checkinby", + "checkintime", + "checkoutby", + "checkouttime", + "copyfromversion", + "secretgrade", + ], }; }, created() {}, @@ -162,7 +202,7 @@ methods: { openDialog() { this.getFormTemplate(); - if (this.type === 'add') { + if (this.type === "add") { this.getCodeRule(); } }, @@ -183,15 +223,14 @@ res.data.resembleTableVO.cols.length > 0; this.resembleTableColumn = res.data.resembleTableVO.cols || []; if (this.hasResemble) { - this.activeName = 'resembleQuery' - this.showResembleQuery = true + this.activeName = "resembleQuery"; + this.showResembleQuery = true; } this.$refs.FormTempalte.templateRender(res.data.formDefineVO.items); } }) .catch((err) => { this.loading = false; - console.log(err); }); }, // 鑾峰彇鐮佸�肩敵璇锋暟鎹� @@ -208,12 +247,12 @@ typeList.includes(item) ); this.$nextTick(() => { - if (this.secVOList.length > 0 && this.type === 'add') { - this.showCodeApply = true - this.activeName = 'codeApply' + if (this.secVOList.length > 0 && this.type === "add") { + this.showCodeApply = true; + this.activeName = "codeApply"; this.$refs.CodeApply.templateRender(this.secVOList); } else { - this.showCodeApply = false + this.showCodeApply = false; } }); } @@ -221,6 +260,21 @@ }, getFormData(form) { this.form = form; + }, + getCodeApplyFormData(codeApplyForm) { + this.codeApplyForm = codeApplyForm; + }, + // 鍙傜収缁勪欢鏁版嵁鍙樻洿 + referConfigDataUpdate(data) { + const { field } = data; + this.secVOList = this.secVOList.map((item) => { + if (item.parentClassifySecOid === field) { + this.$refs.CodeApply.form[item.oid] = undefined; + this.$refs.CodeApply.form[item.name] = undefined; + } + return item; + }); + this.$refs.CodeApply.templateRender(this.secVOList); }, resembleQuerySubmit() { this.activeName = "resembleQuery"; @@ -238,7 +292,8 @@ let codeValidate = true; // 杩涜鐮佸�肩敵璇锋牎楠� if (this.showCodeApply) { - codeValidate = await this.$refs.codeApply.validate(); + codeValidate = await this.$refs.CodeApply.validate(); + console.log(9999); if (!codeValidate) return; } // 杩涜鐩镐技椤规煡璇� @@ -246,7 +301,20 @@ this.form ); if (resembleQueryList.length === 0) { - this.$emit("submit", this.form); + let resForm = {} + const { defaultValue, formValue } = this.getDefaultValueAndFormValues(this.form) + resForm.data = formValue + resForm = Object.assign({}, resForm, defaultValue) + resForm.secDTOList = [] + for (const key in this.codeApplyForm) { + if (Object.hasOwnProperty.call(this.codeApplyForm, key)) { + const value = this.codeApplyForm[key]; + if (value) { + resForm.secDTOList.push({[key]: value}) + } + } + } + this.$emit("submit", resForm); } else { this.$confirm( `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋, @@ -263,9 +331,89 @@ .catch(() => {}); } }, + getDefaultValueAndFormValues(form) { + let defaultValue = {}; + let formValue = {}; + for (const key in form) { + if (Object.hasOwnProperty.call(form, key)) { + const element = form[key]; + if (this.defaultKeys.includes(key)) { + defaultValue[key] = element; + } else { + formValue[key] = element; + } + } + } + return { + defaultValue, + formValue, + }; + }, getType(item) { return this.selfColumnType[item.sectype]; }, + getReferConfig(item) { + let params = {}; + if (item.sectype == "codeclassifysec") { + params = { + isMuti: false, + type: "grid", + tableConfig: { + limit: -1, + cols: [ + { + field: "id", + title: "鑻辨枃鍚嶇О", + sort: true, + width: 150, + }, + { + field: "name", + title: "涓枃鍚嶇О", + sort: true, + width: 150, + }, + { + field: "description", + title: "鎻忚堪", + width: 250, + }, + ], + queryColumns: [ + { + field: "id", + title: "鑻辨枃鍚嶇О", + }, + { + field: "name", + title: "涓枃鍚嶇О", + }, + ], + }, + url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid", + extraParams: { + classifySecOid: item.oid, + parentClassifyValueOid: item.parentClassifySecOid + ? this.codeApplyForm[item.parentClassifySecOid] + : "", + }, + }; + } else if (item.sectype == "coderefersec") { + params = JSON.parse(item.referValueInfo); + } + return params; + }, + getDisabled(item) { + if (item.sectype === "codeclassifysec") { + if (item.parentClassifySecOid) { + if (!this.codeApplyForm[item.parentClassifySecOid]) { + return true; + } else { + return false; + } + } + } + }, isRequired(item) { return item.nullableFlag != "true"; }, -- Gitblit v1.9.3