|
@@ -74,6 +74,7 @@ import {getToken} from "@/util/auth";
|
|
|
import projectSelect from "@/components/project-select";
|
|
import projectSelect from "@/components/project-select";
|
|
|
import {downloadXls} from "@/util/util";
|
|
import {downloadXls} from "@/util/util";
|
|
|
import changeForm from "./components/change-form.vue";
|
|
import changeForm from "./components/change-form.vue";
|
|
|
|
|
+import Decimal from "decimal.js";
|
|
|
|
|
|
|
|
|
|
|
|
|
export default window.$crudCommon({
|
|
export default window.$crudCommon({
|
|
@@ -148,10 +149,42 @@ export default window.$crudCommon({
|
|
|
handleChangeSucc() {
|
|
handleChangeSucc() {
|
|
|
this.drawerVisible = false;
|
|
this.drawerVisible = false;
|
|
|
this.getList();
|
|
this.getList();
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
}, {
|
|
}, {
|
|
|
// 模块路径
|
|
// 模块路径
|
|
|
name: 'projectManage/change',
|
|
name: 'projectManage/change',
|
|
|
|
|
+ res: ({data}) => {
|
|
|
|
|
+ // 计算预算总额
|
|
|
|
|
+ const calcXmAmountTotal = list => {
|
|
|
|
|
+ let total = new Decimal(0);
|
|
|
|
|
+ list.forEach(item => {
|
|
|
|
|
+ total = total.add(new Decimal(item.amount || 0));
|
|
|
|
|
+ });
|
|
|
|
|
+ return total;
|
|
|
|
|
+ };
|
|
|
|
|
+ const formatXmysLabel = list => {
|
|
|
|
|
+ let yearAmountCN = list.map(item => {
|
|
|
|
|
+ return `${item.year}年${item.amount}万元`;
|
|
|
|
|
+ }).join('、');
|
|
|
|
|
+ let total = calcXmAmountTotal(list);
|
|
|
|
|
+ return `总计:${total}万元;其中${yearAmountCN}`
|
|
|
|
|
+ }
|
|
|
|
|
+ data.records = data.records.map(item => {
|
|
|
|
|
+ // 项目预算
|
|
|
|
|
+ if (item.zdmc === 'XMYSZEMX') {
|
|
|
|
|
+ // 变更前的值
|
|
|
|
|
+ let bgqmx = JSON.parse(item.bgqdz);
|
|
|
|
|
+ item.bgqdz = formatXmysLabel(bgqmx);
|
|
|
|
|
+
|
|
|
|
|
+ // 变更后的值
|
|
|
|
|
+ let bghmx = JSON.parse(item.bghdz);
|
|
|
|
|
+ item.bghdz = formatXmysLabel(bghmx)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return item;
|
|
|
|
|
+ });
|
|
|
|
|
+ return data;
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|