From 8f779cd47ae1d96e01e9cec83950e1a9dbbc0f6c Mon Sep 17 00:00:00 2001 From: zyn Date: Mon, 17 Apr 2023 16:09:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B0=81=E8=A3=85axios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/axios/index.js | 50 ++++++++++++++++++- .../home2/components/releaseQA2/index.vue | 41 +++++++++------ .../personal/pages/my-questions/index.vue | 29 +++++++---- 3 files changed, 92 insertions(+), 28 deletions(-) diff --git a/src/common/axios/index.js b/src/common/axios/index.js index 82c0c5fe3..6d9d0f0fb 100644 --- a/src/common/axios/index.js +++ b/src/common/axios/index.js @@ -536,5 +536,53 @@ export default { }).catch(err => { exeFun.call(this, err) }) - } + }, + + _getData (url, params, config = {}) { + return new Promise((resolve,reject)=>{ + // 参数包含this + let _this = config._this || false + // 参数包含loading + let loading = config.loading || false + if (_this && loading) { + _this[loading] = true + } + + _axios.get(api() + url + '?_t=' + new Date().getTime(), { params }).then(res => { + resolve(res.data) + }).catch(err => { + reject(err) + }).finally(()=>{ + if (_this && loading) { _this[loading] = false } + }) + }) + }, + + _postData (url, param, config = {}) { + return new Promise((resolve,reject) => { + var _formData = formData(param) + // 参数包含this + let _this = config._this || false + // 参数包含loading + let loading = config.loading || false + // 是否显示操作提示 + let showTips = config.showTips === undefined ? true : config.showTips + if (_this && loading) { _this[loading] = true } + + _axios.post(api() + url + '?' + new Date().getTime(), _formData).then(res => { + if (res.data.ok !== undefined && showTips) { + let type = res.data.ok ? 'success' : 'warning' + if (_this && res.data.message !== '' && res.data.message !== null) { + Message[type](res.data.message) + } + } + resolve(res.data) + }).catch(err => { + reject(err) + }).finally(()=>{ + if (_this && loading) { _this[loading] = false } + }) + }) + }, + } diff --git a/src/pages/home2/components/releaseQA2/index.vue b/src/pages/home2/components/releaseQA2/index.vue index d148dfa74..52d4f1b93 100644 --- a/src/pages/home2/components/releaseQA2/index.vue +++ b/src/pages/home2/components/releaseQA2/index.vue @@ -124,26 +124,35 @@ export default { }, methods: { getDate(){ - this.loading = true + // this.loading = true let form = this.form form.userId = this.$store.getters.userInfo.account form.pageSize = this.pageSize form.page = this.currentPage - return new Promise((resolve,reject)=>{ - this.$http.get('lawss/AskQuestions/getAskQuestionsPage', form, {_this: this }, res => { - if(res.data){ - const data = res.data - this.data = data.records - this.total = data.total - this.currentPage = data.current - this.pageSize = data.size - } - this.loading = false - resolve(res) - }, e => { - this.loading = false - reject(e) - }) + // return new Promise((resolve,reject)=>{ + // this.$http.get('lawss/AskQuestions/getAskQuestionsPage', form, {_this: this }, res => { + // if(res.data){ + // const data = res.data + // this.data = data.records + // this.total = data.total + // this.currentPage = data.current + // this.pageSize = data.size + // } + // this.loading = false + // resolve(res) + // }, e => { + // this.loading = false + // reject(e) + // }) + // }) + this.$http._getData('lawss/AskQuestions/getAskQuestionsPage', form, {_this: this, loading: 'loading' }).then(res => { + if(res.data){ + const data = res.data + this.data = data.records + this.total = data.total + this.currentPage = data.current + this.pageSize = data.size + } }) }, onSubmit(){ diff --git a/src/pages/personal/pages/my-questions/index.vue b/src/pages/personal/pages/my-questions/index.vue index 3447d6e1e..65ee3d817 100644 --- a/src/pages/personal/pages/my-questions/index.vue +++ b/src/pages/personal/pages/my-questions/index.vue @@ -1984,17 +1984,24 @@ export default { { _this: this }, val => { - this.$http.post('lawss/activiti/completeTask',{ - taskIds: val.data, - userId : this.$store.getters.userInfo.userId, - json: JSON.stringify(res.data), - }, - { - _this: this - }, res => { - this.submitGetData(); - }, e => { - }) + // this.$http.post('lawss/activiti/completeTask',{ + // taskIds: val.data, + // userId : this.$store.getters.userInfo.userId, + // json: JSON.stringify(res.data), + // }, + // { + // _this: this + // }, res => { + // this.submitGetData(); + // }, e => { + // }) + this.$http._postData('lawss/activiti/completeTask',{ + taskIds: val.data, + userId : this.$store.getters.userInfo.userId, + json: JSON.stringify(res.data), + }).then(res => { + this.submitGetData(); + }) }, e => { }) }, e => { From 5174da6d423125fa248c6bcc08dcd8bdfa432ab8 Mon Sep 17 00:00:00 2001 From: zyn Date: Tue, 18 Apr 2023 11:30:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/processCenter/pages/components/ProcessMixin.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/processCenter/pages/components/ProcessMixin.vue b/src/pages/processCenter/pages/components/ProcessMixin.vue index 281de6f8c..090e0772c 100644 --- a/src/pages/processCenter/pages/components/ProcessMixin.vue +++ b/src/pages/processCenter/pages/components/ProcessMixin.vue @@ -129,8 +129,9 @@ export default { }, methods: { getPrcNameFilter(row){ - if(row && row.prcType === 'buss3'){ - return row.prcName + if(row && row.prcType === '25' && row.taskInfo === '技术标准起草'){ + let _index = row.prcName.lastIndexOf('-') + return row.prcName.slice(0 , _index + 1) + '企标制修订' }else { return row.prcName } From 454bff7c8bd154fc66aaa0d01cc3bf4961f1f9f2 Mon Sep 17 00:00:00 2001 From: zyn Date: Tue, 18 Apr 2023 16:21:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B3=95=E8=A7=84=E5=BA=93-=E7=BC=96?= =?UTF-8?q?=E8=BE=91-=E6=A0=87=E5=87=86=E7=BC=96=E5=8F=B7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0;=EF=BC=9B=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/verify/index.js | 10 ++++++++++ .../domesticStandardsAndRegulations/index.vue | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/common/verify/index.js b/src/common/verify/index.js index b217a4af9..eb3e8843a 100644 --- a/src/common/verify/index.js +++ b/src/common/verify/index.js @@ -32,6 +32,16 @@ export default { callback() } }, + validateStandardItem2 (rule, value, callback) { + // return callback() + let testval = /^[A-Za-z0-9/]+$/ + let testval1 = /[.-;;]+/ + if (value && !value.match(testval) && !value.match(testval1)) { + return callback(new Error('只能为(字母、数字、.、-、;、;)')) + } else { + callback() + } + }, /** * 验证字母、数字、.、-的正则且不能重复 diff --git a/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue b/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue index fa5a583a1..c27def6ee 100644 --- a/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue +++ b/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue @@ -2844,7 +2844,7 @@ export default { standNumber: [ {required: true, type: 'string', message: '标准编号不能为空', trigger: 'change'}, {type: 'string', max: 100, message: '标准编号不能超过100个字符', trigger: 'change'}, - {type: 'string', validator: this.verify.validateStandardItem, trigger: 'change'} + {type: 'string', validator: this.verify.validateStandardItem2, trigger: 'change'} ], synopsis: [ {type: 'string', max: 500, message: '文本说明不能超过500个字符', trigger: 'change'}