From c0d2789b5338373117fe37e9b2536772f8b11729 Mon Sep 17 00:00:00 2001 From: zyn Date: Thu, 4 Jan 2024 14:49:46 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qbrk-product/bussLibraryProduct.vue | 135 +++++++++--------- 1 file changed, 69 insertions(+), 66 deletions(-) diff --git a/src/pages/processCenter/pages/creatProcess/qbrk-product/bussLibraryProduct.vue b/src/pages/processCenter/pages/creatProcess/qbrk-product/bussLibraryProduct.vue index 1bb853a3c..7f7de6921 100644 --- a/src/pages/processCenter/pages/creatProcess/qbrk-product/bussLibraryProduct.vue +++ b/src/pages/processCenter/pages/creatProcess/qbrk-product/bussLibraryProduct.vue @@ -73,7 +73,7 @@
- +
@@ -176,6 +176,9 @@ export default { data () { const verify = { validateFBGBUSS: (rule, value, callback) => { + if(this.$route.params.type === '1' || this.$route.params.type === '2') { + return callback() + } if(!this.form.FBGBUSS || this.form.FBGBUSS === '') { return callback(new Error('请上传发布稿文件!')) } @@ -279,7 +282,7 @@ export default { { required: true, message: '请选择制修订类型', trigger: [ 'change', 'blur' ] } ], standCode: [ - { required: false, message: '请输入企业标准号', trigger: [ 'change', 'blur' ] }, + { required: true, message: '请输入企业标准号', trigger: [ 'change', 'blur' ] }, { min: 1, max: 100, message: '长度在 1 到 100 个字符', trigger: [ 'change', 'blur' ] }, ], expirationDate: [ @@ -507,14 +510,13 @@ export default { }, addRules () { const type = this.$route.params.type - if (type !== '1' && type !== 'C1') { + if (type !== '1' && type !== '2') { this.rules.FBGBUSSName[0].required = true } if (type === '13') { this.rules.issueTime[0].required = true this.rules.standYear[0].required = true this.rules.standNum[0].required = true - this.rules.standCode[0].required = true } }, handleTabs (val) { @@ -572,13 +574,22 @@ export default { this.form.FBGBUSS = '' this.form.FBGBUSSName = '' - if (this.form.standStatus === '2') { + if (this.type === '13' && this.form.standStatus === '2') { this.getStandByRevision('1') } this.refreshPage() }, standStatusChange (e) { + if(this.$route.params.type === '1') { + this.form = { ...this.initForm } + this.form.standStatus = e + return + } + this.form.standStatus = e + + if (this.type !== '13') return; + this.form.standYear = this.init.standYear this.form.standNum = this.init.standNum this.form.standCode = this.init.standCode @@ -601,12 +612,6 @@ export default { }) this.setInitValue('old', this.form.standSort, this.form.standNum, this.form.standYear, this.form.standCode) - // this.old = { - // standYear: this.form.standYear, - // standNum: this.form.standNum, - // standCode: this.form.standCode, - // standSort: this.form.standSort - // } } if (this.form.standStatus === '2') { this.form.standYear = year.toString() @@ -616,33 +621,13 @@ export default { const oldStandYear = oldYear.slice(0, 4) const oldStandNum = this.form.standCode.slice(0, this.form.standCode.lastIndexOf('-')).replace(this.form.standSort, '') - // this.old = { - // standYear: oldStandYear, - // standNum: oldStandNum, - // standCode: this.form.standCode, - // standSort: this.form.standSort - // } this.setInitValue('old', this.form.standSort, oldStandNum, oldStandYear, this.form.standCode) - if (oldStandYear === this.form.standYear) { - if (oldYear.indexOf('X') > -1) { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + 'X' - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + ' X' - } - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + this.form.standYear - } + this.getStandCode(oldStandNum, oldStandYear, oldYear) } else { // 制定切修订 -> 顺序号和企标号是空的 if (!this.form.DTQBBHBUSS || this.form.DTQBBHBUSS === '') { this.setInitValue('old', this.form.standSort, '', this.form.standYear, '') - // this.old = { - // standYear: this.form.standYear, - // standNum: '', - // standCode: '', - // standSort: this.form.standSort - // } } else { const standCode = this.form.standCode = this.form.DTQBBHBUSS this.$http._getData('/lawss/sarBussionessStand/queryBussinessStandByStandCode', { standCode }).then(res => { @@ -655,15 +640,7 @@ export default { this.setInitValue('old', this.form.standSort, oldStandNum, oldStandYear, this.form.standCode) - if (oldStandYear === this.form.standYear) { - if (oldYear.indexOf('X') > -1) { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + 'X' - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + ' X' - } - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + this.form.standYear - } + this.getStandCode(oldStandNum, oldStandYear, oldYear) } }) } @@ -672,12 +649,6 @@ export default { if (this.form.standStatus === '3') { this.setInitValue('old', this.form.standSort, this.form.standNum, this.form.standYear, this.form.standCode) - // this.old = { - // standYear: this.form.standYear, - // standNum: this.form.standNum, - // standCode: this.form.standCode, - // standSort: this.form.standSort - // } } this.refreshPage() @@ -686,6 +657,8 @@ export default { this[key] = { standYear, standNum, standCode, standSort } }, standSortChange () { + if (this.type !== '13') return; + this.getStandByFormulate() this.getStandByRevision() }, @@ -696,6 +669,8 @@ export default { this.form = { ...this.form } }, DTQBBHBUSSChange (obj) { + if (this.type !== '13') return; + const { standCode, standSort } = obj this.getStandByRevision('2', standCode, standSort) }, @@ -735,15 +710,7 @@ export default { const oldStandYear = oldYear.slice(0, 4) const oldStandNum = this.old.standCode.slice(0, this.old.standCode.lastIndexOf('-')).replace(this.old.standSort, '') - if (oldStandYear === this.form.standYear) { - if (oldYear.indexOf('X') > -1) { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + 'X' - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + ' X' - } - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + this.form.standYear - } + this.getStandCode(oldStandNum, oldStandYear, oldYear) } }, getStandInfoByReviseStatus (type, standCode, standSort) { @@ -780,6 +747,32 @@ export default { if (this.form.standStatus === '2') { this.form.standYear = year.toString() + if (!this.form.standCode || this.form.standCode === '') { + if (this.form.DTQBBHBUSS && this.form.DTQBBHBUSS !== '') { + // 企业标准号空 代替企标编号非空 + const standCode = this.form.standCode = this.form.DTQBBHBUSS + this.$http._getData('/lawss/sarBussionessStand/queryBussinessStandByStandCode', { standCode }).then(res => { + if (res.ok) { + this.form.standSort = res.data.standSort || res.data.standSortShow + + const oldYear = this.form.standCode.slice(this.form.standCode.lastIndexOf('-') + 1) // 2022 2022 X + const oldStandYear = oldYear.slice(0, 4) + const oldStandNum = this.form.standCode.slice(0, this.form.standCode.lastIndexOf('-')).replace(this.form.standSort, '') + + this.setInitValue('init', this.form.standSort, oldStandNum, oldStandYear, this.form.standCode) + this.old = JSON.parse(JSON.stringify(this.init)) + + this.getStandCode(oldStandNum, oldStandYear, oldYear) + } + }) + return + } + // 企业标准号空 代替企标编号空 + this.setInitValue('init', this.form.standSort, '', '', '') + this.old = JSON.parse(JSON.stringify(this.init)) + return + } + // 企业标准号非空 const oldYear = this.form.standCode.slice(this.form.standCode.lastIndexOf('-') + 1) // 2022 2022 X const oldStandYear = oldYear.slice(0, 4) const oldStandNum = this.form.standCode.slice(0, this.form.standCode.lastIndexOf('-')).replace(this.form.standSort, '') @@ -787,23 +780,31 @@ export default { this.setInitValue('init', this.form.standSort, oldStandNum, oldStandYear, this.form.standCode) this.old = JSON.parse(JSON.stringify(this.init)) - if (oldStandYear === this.form.standYear) { - if (oldYear.indexOf('X') > -1) { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + 'X' - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + ' X' - } - } else { - this.form.standCode = this.form.standSort + oldStandNum + '-' + this.form.standYear - } + this.getStandCode(oldStandNum, oldStandYear, oldYear) } if (this.form.standStatus === '3') { + if (!this.form.standCode || this.form.standCode === '') { + this.setInitValue('init', this.form.standSort, '', '', '') + this.old = JSON.parse(JSON.stringify(this.init)) + return + } const oldStandNum = this.form.standCode.slice(0, this.form.standCode.lastIndexOf('-')).replace(this.form.standSort, '') this.setInitValue('init', this.form.standSort, oldStandNum, this.form.standYear, this.form.standCode) this.old = JSON.parse(JSON.stringify(this.init)) } }, + getStandCode (oldStandNum, oldStandYear, oldYear) { + if (oldStandYear === this.form.standYear) { + if (oldYear.indexOf('X') > -1) { + this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + 'X' + } else { + this.form.standCode = this.form.standSort + oldStandNum + '-' + oldYear + ' X' + } + } else { + this.form.standCode = this.form.standSort + oldStandNum + '-' + this.form.standYear + } + }, getData () { const { bpnId, taskIds, prcId } = this.$route.query @@ -820,7 +821,9 @@ export default { this.form = JSON.parse(JSON.stringify(processForm.form)) this.roleForm = JSON.parse(JSON.stringify(processForm.roleForm)) this.afterCompatible(processForm) // 兼容旧数据 - this.getInitData() + if (this.type === '13') { + this.getInitData() + } this.$nextTick(() => { this.reloadForm = true })