龚焕茏
2024-07-29 bcf74dfa254d842ff3527d44840b4172f879e55b
refactor:合同扣分
2个文件已修改
31 ■■■■ 已修改文件
src/views/system/contract/contract/index.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/contract/score/index.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
      });
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 == "扣指定分数") {
        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) {