From a3af7a6ba06cf7c4579ded1dbdf6bec04991dcc9 Mon Sep 17 00:00:00 2001 From: zhangqi <2794379662@qq.com> Date: Wed, 27 Jan 2021 12:07:53 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=B3=95=E4=BA=BA=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/http.js | 47 ++- src/views/CA/Index.vue | 2 +- src/views/CA/UnitApply.composition.vue | 506 +++++++++++++++++++++++++ src/views/CA/UnitApply.vue | 120 ++++-- src/views/CA/UserApply.composition.vue | 126 ++++++ vue.config.js | 8 + 6 files changed, 753 insertions(+), 56 deletions(-) create mode 100644 src/views/CA/UnitApply.composition.vue create mode 100644 src/views/CA/UserApply.composition.vue diff --git a/src/services/http.js b/src/services/http.js index c914785..37183ee 100644 --- a/src/services/http.js +++ b/src/services/http.js @@ -1,28 +1,37 @@ -import { message } from "ant-design-vue"; import axios from "axios"; export async function get(url, params) { - var response = await axios.get(url, { params }); - if (response.status == 200) { + try { + var response = await axios.get(url, { params }); return response.data; - } else if (response.status == 401) { - message.warning( - "未登录或身份认证信息已过期", - (onclose = () => { - top && top.login(); - }) - ); + } catch (error) { + if (error.response && error.response.status == "401") { + return new { + errorCode: -1, + errorMsg: "身份认证失败" + }(); + } else { + return new { + errorCode: -1, + errorMsg: "请求出错" + }(); + } } } export async function post(url, data) { - var response = await axios.post(url, data); - if (response.status == 200) { + try { + var response = await axios.post(url, data); return response.data; - } else if (response.status == 401) { - message.warning( - "未登录或身份认证信息已过期", - (onclose = () => { - top && top.login(); - }) - ); + } catch (error) { + if (error.response && error.response.status == "401") { + return new { + errorCode: -1, + errorMsg: "身份认证失败" + }(); + } else { + return new { + errorCode: -1, + errorMsg: "请求出错" + }(); + } } } diff --git a/src/views/CA/Index.vue b/src/views/CA/Index.vue index 4267b5d..47cfc28 100644 --- a/src/views/CA/Index.vue +++ b/src/views/CA/Index.vue @@ -1,7 +1,7 @@
- @@ -141,7 +139,7 @@

{{ unitApply.unitName @@ -151,6 +149,13 @@

经办人: {{ unitApply.operatorName }} {{ unitApply.operatorPhone }}

发起时间: {{ unitApply.time }}

+
@@ -249,6 +254,7 @@ export default { organizeList: [], drawVisible: false, disabled: true, + disableUpload: true, countdown: 0, isSuccess: false, rules: { @@ -353,37 +359,10 @@ export default { this.isSuccess = !!unitApplyList.data.find(d => d.status == 1); this.unitApplyList = unitApplyList.data; if (current) { - //省市信息初始化 - const [code0, code1] = current.code; - var option0 = this.areaOptions.find(o => o.value == code0); - option0.children = await getAreaOptions(code0); - var option1 = option0.children.find(o => o.value == code1); - option1.children = await getAreaOptions(code1); - this.form = current; - this.currentId = current.id; - this.currentStatus = current.status; - picUploadConfig[0].defaultFileList.push({ - uid: -1, - status: "done", - url: current.loaPicPath - }); - picUploadConfig[1].defaultFileList.push({ - uid: -1, - status: "done", - url: current.idCardFrontPicPath - }); - picUploadConfig[2].defaultFileList.push({ - uid: -1, - status: "done", - url: current.idCardBackPicPath - }); - picUploadConfig[3].defaultFileList.push({ - uid: -1, - status: "done", - url: current.businessLicensePicPath - }); + this.initForm(current); } else { this.disabled = false; + this.disableUpload = false; } }, methods: { @@ -428,6 +407,30 @@ export default { this.areaOptions = [...this.areaOptions]; }, async createUnitApply() { + if (this.form.orderNo) { + //有orderNo 修改 + const resp = await post("/api2/CA/ModifyUnitApply", { + id: this.form.id, + orderNo: this.form.orderNo, + loaPicId: this.form.loaPicId, + idCardFrontPicId: this.form.idCardFrontPicId, + idCardBackPicId: this.form.idCardBackPicId, + businessLicensePicId: this.form.businessLicensePicId + }); + if (resp.errorCode != 0) { + message.error(resp.errorMsg); + } else { + message.success("修改成功"); + this.disabled = true; + this.disableUpload = true; + this.currentId = resp.data; + this.currentStatus = null; + await delay(500); + await this.sendUnitApply(); + } + return; + } + try { await this.$refs.ruleForm.validate(); } catch (error) { @@ -454,7 +457,7 @@ export default { if (resp.errorCode != 0) { message.error(resp.errorMsg); } else { - message.success(resp.errorMsg); + message.success("发起申请成功"); this.currentStatus = 0; } } @@ -466,6 +469,7 @@ export default { }); if (res.errorCode == 0) { Modal.success({ title: "完成", content: "数字证书申领流程已完成" }); + this.isSuccess = true; } else { Modal.info({ title: "当前状态", content: res.errorMsg }); } @@ -500,6 +504,50 @@ export default { } else { this.form.tydm = res.data; } + }, + async initForm(unitApply) { + //省市信息初始化 + const [code0, code1] = unitApply.code; + var option0 = this.areaOptions.find(o => o.value == code0); + option0.children = await getAreaOptions(code0); + var option1 = option0.children.find(o => o.value == code1); + option1.children = await getAreaOptions(code1); + this.form = unitApply; + this.currentId = unitApply.id; + this.currentStatus = unitApply.status; + picUploadConfig[0].defaultFileList.push({ + uid: -1, + status: "done", + url: unitApply.loaPicPath + }); + picUploadConfig[0].disabled = true; + picUploadConfig[1].defaultFileList.push({ + uid: -1, + status: "done", + url: unitApply.idCardFrontPicPath + }); + picUploadConfig[1].disabled = true; + + picUploadConfig[2].defaultFileList.push({ + uid: -1, + status: "done", + url: unitApply.idCardBackPicPath + }); + picUploadConfig[2].disabled = true; + + picUploadConfig[3].defaultFileList.push({ + uid: -1, + status: "done", + url: unitApply.businessLicensePicPath + }); + picUploadConfig[3].disabled = true; + }, + async modifyOrder(unitApply) { + await this.initForm(unitApply); + this.currentId = 0; + this.disabled = true; + this.disableUpload = false; + this.currentStatus = null; } } }; diff --git a/src/views/CA/UserApply.composition.vue b/src/views/CA/UserApply.composition.vue new file mode 100644 index 0000000..654ff1c --- /dev/null +++ b/src/views/CA/UserApply.composition.vue @@ -0,0 +1,126 @@ + + + diff --git a/vue.config.js b/vue.config.js index 2901c27..6e12d0c 100644 --- a/vue.config.js +++ b/vue.config.js @@ -11,5 +11,13 @@ module.exports = { }, devServer: { proxy: "http://localhost:42127" + }, + chainWebpack: config => { + config.module + .rule("eslint") + .use("eslint-loader") + .options({ + fix: true + }); } };