zjk
5 小时以前 173766e82d7cde9a7ae30b8896a9a287dff411f8
laboratory/src/views/deliveryAssessment/assayTaskList/components/CraftDialog.vue
@@ -59,6 +59,7 @@
</template>
<script>
import {getDetailById} from '../service'
export default {
    name: 'CraftDialog',
    props: {
@@ -69,7 +70,11 @@
        reportData: {
            type: Object,
            default: () => { }
        }
        },id: {
      type: [String, Number],
      default: "",
    //   required: true,
    },
    },
    data() {
        return {
@@ -121,20 +126,45 @@
        modelValue: {
            handler(val) {
                this.dialogVisible = val;
                if (val && this.id) {
          this.fetchDetail();
        }
            },
            immediate: true
        },
        reportData: {
            handler(val) {
                if (val) {
                    this.form.reportNo = val.reportNo || '';
                    this.form.reportName = val.reportName || '';
                }
            },
            immediate: true
        }
        id(val) {
      if (this.modelValue && val) {
        this.fetchDetail();
      }
    },
    },
    methods: {
        async fetchDetail() {
      try {
        const res = await getDetailById({ id: this.id });
        if (res) {
          this.evaluateInfo = { ...res };
          this.form.reportNo = res.reportCode || "";
          this.form.reportName = res.reportTitle || "";
          // 详情回显分数
          if (res.evaluateScore) {
            if (
              this.type === "detail" &&
              typeof res.evaluateScore === "string"
            ) {
              const scoreArr = res.evaluateScore
                .split(",")
                .map((s) => Number(s));
              this.criteriaList.forEach((item, idx) => {
                item.score = scoreArr[idx] || 0;
              });
            }
          }
        }
      } catch (e) {
        this.$message && this.$message.error("获取详情失败");
      }
    },
        handleClose() {
            this.$emit('update:modelValue', false);
        },