From bcf74dfa254d842ff3527d44840b4172f879e55b Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 29 七月 2024 10:28:41 +0800
Subject: [PATCH] refactor:合同扣分
---
src/views/system/contract/score/index.vue | 19 +++++++++++++++++++
src/views/system/contract/contract/index.vue | 12 +++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/views/system/contract/contract/index.vue b/src/views/system/contract/contract/index.vue
index f2e4eee..57e22d0 100644
--- a/src/views/system/contract/contract/index.vue
+++ b/src/views/system/contract/contract/index.vue
@@ -474,11 +474,13 @@
getRuleList(item) {
getRuleListByContractId(item.id).then((response) => {
this.ruleData = response.data;
- this.ruleName = this.ruleData.map((item) => {
- return item.ruleName;
- });
- this.ruleName = [...new Set(this.ruleName)];
- console.log('this.ruleName', this.ruleName);
+ if (this.ruleData) {
+ this.ruleName = this.ruleData.map((item) => {
+ return item.ruleName;
+ });
+ this.ruleName = [...new Set(this.ruleName)];
+ console.log('this.ruleName', this.ruleName);
+ }
this.form.id = item.id;
this.contractInfo = item;
});
diff --git a/src/views/system/contract/score/index.vue b/src/views/system/contract/score/index.vue
index dfb9565..c1ae99c 100644
--- a/src/views/system/contract/score/index.vue
+++ b/src/views/system/contract/score/index.vue
@@ -289,6 +289,7 @@
let item = this.$refs['cascader'].getCheckedNodes()[0].data;
this.calcObj = item;
this.form.contractId = item.contractId;
+ this.form.ruleName = item.ruleName + "/" + item.label;
this.form.deductCategory = item.deductCategory == '鍒嗘暟涔樹互鏁伴噺' ? '鎵�' + item.calcFraction + '鍒�*鏁伴噺 ' : item.deductCategory == '闄や互鏁伴噺鍚庝箻浠ュ垎鏁�' ? '鎵�' + item.calcFraction + '鍒�/' + item.calcUnit + '灏忔椂' : '鎵�' + item.calcFraction + '鍒�';
if (item.deductCategory == "鎵f寚瀹氬垎鏁�") {
this.needNum = false;
@@ -315,6 +316,24 @@
handleChangeUnit(value) {
getRuleListByUnitId(value).then((res) => {
this.options = this.getTreeData(res.data);
+ // 鎵嬪姩鏍戝舰缁撴瀯
+ if (this.options) {
+ let groupedList = {};
+ this.options.forEach(item => {
+ if (!groupedList[item.ruleName]) {
+ groupedList[item.ruleName] = {
+ value: 0,
+ children: [],
+ label: item.ruleName,
+ ruleName: item.ruleName,
+ contractId: item.contractId
+ };
+ }
+ groupedList[item.ruleName].children.push(item);
+ });
+ let result = Object.values(groupedList);
+ this.options = result;
+ }
})
},
getTreeData(data) {
--
Gitblit v1.8.0