riku
2024-04-25 743044407e35a10ff824ef18cb883ac2b66e2d12
新增自动评估细则界面
已修改2个文件
49 ■■■■■ 文件已修改
src/api/fysp/evaluateApi.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/evaluation/EvalutationEdit.vue 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/evaluateApi.js
@@ -12,7 +12,18 @@
  /**
   * 根据巡查任务获取评分细则
   */
  fetchItemEvaluation(subTaskId) {
    const params = `?subTaskId=${subTaskId}`;
    return $fysp.get(`evaluationsubrule/score${params}`).then((res) => res.data);
  },
  /**
   * 批量更新评分细则得分
   */
  updateItemEvaluation(param) {
    return $fysp.post(`itemevaluation/uplist`, param).then((res) => res.data);
  },
  /**
   * 查询评估总规则
src/views/fysp/evaluation/EvalutationEdit.vue
@@ -3,11 +3,41 @@
</template>
<script>
import evaluateApi from '@/api/fysp/evaluateApi';
import { useFetchData } from '@/composables/fetchData';
export default {
  data() {
    return {};
  setup() {
    const { loading, fetchData } = useFetchData();
    return { loading, fetchData };
  },
  methods: {}
  data() {
    return {
      evaluation: {}
    };
  },
  created() {
    // watch 路由的参数,以便再次获取数据
    this.$watch(
      () => this.$route.params,
      () => {
        this.getScore();
      },
      // 组件创建完后获取数据,
      // 此时 data 已经被 observed 了
      { immediate: true }
    );
  },
  methods: {
    // 获取评分
    getScore() {
      this.fetchData(() => {
        return evaluateApi.fetchItemEvaluation(this.$route.params.subTaskId).then((res) => {
          this.evaluation = res;
        });
      });
    }
  }
};
</script>
<style scoped></style>