riku
2024-09-29 b0379edfce842cf521edd555269412f8cd0ec11b
src/views/fysp/evaluation/EvalutationRecord.vue
@@ -104,7 +104,12 @@
            @click="scoreShow = true"
            >监测数据得分</el-button
          >
          <el-button v-show="scoreShow" size="small" type="primary" @click="updateMultipleScore"
          <el-button
            v-show="scoreShow"
            size="small"
            type="primary"
            @click="updateMultipleScore"
            :loading="updateLoading"
            >上传</el-button
          >
          <el-button v-show="scoreShow" size="small" type="error" @click="scoreShow = false"
@@ -161,7 +166,8 @@
          name: '监测数据月均值超区域月均值20%以上或数据明显异常'
        }
      },
      scoreShow: false
      scoreShow: false,
      updateLoading: false
    };
  },
  computed: {
@@ -208,8 +214,21 @@
        evaluateApi.fetchAutoEvaluation(this.area).then((res) => {
          if (res.data) {
            this.tableData = res.data;
            this.tableData.forEach((v) => {
              // 将原始的得分展示到表格中
              if (v.itemEvaluations) {
                for (const key in this.ruleName) {
                  const value = this.ruleName[key];
                  const itemEva = v.itemEvaluations.find((ie) => {
                    return ie.esrguid == value.id && ie.extension1 == 'true';
                  });
                  if (itemEva) {
                    v[key] = itemEva.value;
                  }
                }
              }
            });
            this.orginData = useCloned(this.tableData).cloned;
            console.log(this.orginData);
            this.getFilters(res.data);
            if (typeof func === 'function') {
              func({ data: this.tableData });
@@ -245,29 +264,35 @@
    },
    // 批量更新监测数据得分
    updateMultipleScore() {
      this.updateLoading = true;
      useMessageBoxTip({
        confirmMsg: '是否上传监测数据得分',
        confirmTitle: '上传监测数据得分',
        onConfirm: () => {
        onConfirm: async () => {
          if (this.evaluationRule) {
            const param = this.tableData.map((v) => {
            const subTaskEvaList = this.tableData.map((v) => {
              const subRule = [];
              for (const key in this.ruleName) {
                const value = this.ruleName[key];
                subRule.push({
                  first: value.id,
                  second: v[key].trim() != ''
                  id: value.id,
                  selected: v[key] && (v[key] + '').trim() != ''
                });
              }
              return {
                ...this.area,
                subTaskId: v.subTaskId,
                ruleId: this.evaluationRule.guid,
                subRule
              };
            });
            const param = {
              ...this.area,
              subTaskEvaList
            };
            evaluateApi.updateMultipleScore(param);
            return await evaluateApi
              .updateMultipleScore(param)
              .finally(() => (this.updateLoading = false));
          }
        }
      });