From bbb2908effe0f51cc778249e9733ebbe369152c5 Mon Sep 17 00:00:00 2001 From: xuyucheng Date: Fri, 6 May 2022 16:27:28 +0800 Subject: [PATCH] mode --- src/components/FecrTable.vue | 4 +- src/view/appraisal/credit/index.vue | 59 ++++++++++++---- src/view/appraisal/credit/stepFinancial.vue | 76 ++++++++++++++------- src/view/company/stepCompanyInfo.vue | 38 +++++------ src/view/company/stepElementsAppraisal.vue | 34 +++------ src/view/company/stepRiskAppraisal.vue | 29 +++++--- 6 files changed, 146 insertions(+), 94 deletions(-) diff --git a/src/components/FecrTable.vue b/src/components/FecrTable.vue index eabb9f6..47f960e 100644 --- a/src/components/FecrTable.vue +++ b/src/components/FecrTable.vue @@ -111,10 +111,10 @@ export default { return parseInt(scope.row[item.prop]) > 0 ? `${ scope.row[item.prop] - }` + }` : `${ scope.row[item.prop] - }`; + }`; } else { return scope.row[item.prop]; } diff --git a/src/view/appraisal/credit/index.vue b/src/view/appraisal/credit/index.vue index 29ac475..ddd136e 100644 --- a/src/view/appraisal/credit/index.vue +++ b/src/view/appraisal/credit/index.vue @@ -43,6 +43,7 @@ :data="data" @mode="mode" @getSaveState="getSaveState" + @getUnit="getUnit" v-else-if="step === 2" /> @@ -84,6 +85,7 @@ export default { data: {}, step: 0, saveState: false, + unit: "元", }; }, @@ -114,22 +116,49 @@ export default { this.step--; }, + getUnit(e) { + this.unit = e; + }, + save() { - this.step < 3 - ? JsonPost("/input/save_general_input_form", { - input_form: this.data, - }).then(() => { - this.step++; - }) - : get("/input/submit_general_rating_input").then((res) => { - if (res.info === "评分成功,请前往主页查看") { - this.$message.success(res.info); - this.$router.push("/company"); - } else { - this.$message.warning(res.info); - this.$router.push("/appraisal"); - } + if (this.step < 2) { + JsonPost("/input/save_general_input_form", { + input_form: this.data, + }).then(() => { + this.step++; + }); + } else if (this.step === 3) { + get("/input/submit_general_rating_input").then((res) => { + if (res.info === "评分成功,请前往主页查看") { + this.$message.success(res.info); + this.$router.push("/company"); + } else { + this.$message.warning(res.info); + this.$router.push("/appraisal"); + } + }); + } else { + Object.keys(this.data["财务填报"]).map((k) => { + return this.data["财务填报"][k].map((ele) => { + return Object.keys(ele).map((key) => { + if (key !== "报告期") { + if (this.unit === "万元") { + return (ele[key] = ele[key] * 10000); + } else if (this.unit === "亿元") { + return (ele[key] = ele[key] * 100000000); + } else { + return ele[key]; + } + } + }); }); + }); + JsonPost("/input/save_general_input_form", { + input_form: this.data, + }).then(() => { + this.step++; + }); + } }, }, }; @@ -149,7 +178,7 @@ export default { .el-footer { width: 100%; - margin-top:20px; + margin-top: 20px; } } .el-row { diff --git a/src/view/appraisal/credit/stepFinancial.vue b/src/view/appraisal/credit/stepFinancial.vue index cb6d5a2..08a14ca 100644 --- a/src/view/appraisal/credit/stepFinancial.vue +++ b/src/view/appraisal/credit/stepFinancial.vue @@ -16,7 +16,12 @@ 3. 单位:元 - + { - return Object.keys(item).map((key) => { - if (key !== "报告期") { - if (this.unit === "元") { - return { [key]: item[key] }; - } else if (this.unit === "万元") { - return { [key]: item[key] }; + onChangeUnit(e) { + const preUnit = this.$refs.preUnit.value; + const target = {资产负债表:[],利润表:[],补充数据表:[]}; + var data = Object.keys(this.data["财务填报"]).map((k) => { + return this.data["财务填报"][k].map((item) => { + return Object.keys(item).map((key) => { + if (key !== "报告期") { + if (e === "元") { + if (preUnit === "万元") { + return { [key]: item[key] * 10000 }; + } else if (preUnit === "亿元") { + return { [key]: item[key] * 100000000 }; + } else { + return { [key]: item[key] }; + } + } else if (e === "万元") { + if (preUnit === "元") { + return { [key]: item[key] / 10000 }; + } else if (preUnit === "亿元") { + return { [key]: item[key] * 10000 }; + } else { + return { [key]: item[key] }; + } + } else { + if (preUnit === "元") { + return { [key]: item[key] / 100000000 }; + } else if (preUnit === "万元") { + return { [key]: item[key] / 10000 }; + } else { + return { [key]: item[key] }; + } + } } else { - return { [key]: item[key]}; + return { [key]: item[key] }; } - } else { - return { [key]: item[key] }; - } + }); }); }); + data.forEach((item, index) => { - var obj = {}; - item.forEach((child) => { - obj = { ...obj, ...child }; + item.forEach((ele, i) => { + var obj = {}; + ele.forEach((child) => { + obj = { ...obj, ...child }; + }); + target[Object.keys(target)[index]][i] = obj; }); - target[index] = obj; }); - this.data["财务填报"][this.prop] = target; + this.data["财务填报"] = target; + }, + + backData(val) { + this.data["财务填报"][this.prop] = val; }, isSuccess(val) { @@ -184,6 +213,7 @@ export default { return item ? true : false; }); this.$emit("getSaveState", save); + this.$emit("getUnit", this.unit); }, immediate: true, deep: true, diff --git a/src/view/company/stepCompanyInfo.vue b/src/view/company/stepCompanyInfo.vue index 2b4db56..d24edf9 100644 --- a/src/view/company/stepCompanyInfo.vue +++ b/src/view/company/stepCompanyInfo.vue @@ -1,28 +1,21 @@