黄何裕
2024-07-30 1995e710dcf70e635c4edaa8173f8b66cd67d499
src/views/system/contract/score/index.vue
@@ -99,8 +99,8 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitAuditing">确 定</el-button>
        <el-button @click="closeAuditing">取 消</el-button>
        <el-button type="primary" @click="submitAuditing">确 定</el-button>
      </div>
    </el-dialog>
@@ -151,8 +151,8 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>
@@ -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) {