src/views/fysp/check/components/CompProblemAddOrUpd.vue
@@ -165,7 +165,11 @@
          </el-form-item>
        </el-form>
        <el-row justify="end">
          <el-button type="primary" @click="onSubmit" v-show="!readonly"
          <el-button
            type="primary"
            @click="onSubmit"
            v-show="!readonly"
            :loading="loading"
            >保存</el-button
          >
          <el-button @click="onCancel" v-show="!readonly">取消</el-button>
@@ -314,7 +318,8 @@
        { id: 0, label: '监控设备' },
        { id: 1, label: '治理设备' },
        { id: 2, label: '生产设备' }
      ]
      ],
      loading: false
    };
  },
  watch: {
@@ -532,9 +537,7 @@
    onProAdviseEditChange(value) {},
    onProTypeChange(value) {
      // 默认问题描述和问题建议为第一个
      this.currProTypeGuid = this.descriptionOptions[0].guid;
      this.deepCopyProblem.description = this.descriptionOptions[0].description;
      this.onProDesChange(this.deepCopyProblem.description);
      this.onProDesChange(this.descriptionOptions[0].description);
      this.deepCopyProblem.advice = this.adviseOptions[0].adName;
      this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
    },
@@ -550,7 +553,8 @@
    onProDesChange(value) {
      let currPro = this.findProByProDesName(value);
      this.currProTypeGuid = currPro.guid;
      // this.deepCopyProblem.description = currPro.description;
      this.deepCopyProblem.description = currPro.description;
      this.deepCopyProblem.ptguid = this.currProTypeGuid;
      this.changeProblemname();
      var adName =
        this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName;
@@ -588,6 +592,7 @@
      this.$emit('update:visible', false);
    },
    onSubmit() {
      this.loading = true;
      this.$refs.formRef.validate((valid) => {
        if (valid && this.pictureValidate()) {
          // 数据准备
@@ -616,10 +621,7 @@
            let deleteImgCopy = this.deleteImg;
            fileUtil.getImageFiles(picUrls, (files) => {
              data.append('deleteImg', deleteImgCopy);
              deepCopyPro.advise = deepCopyPro.advice;
              deepCopyPro.ptGuid = this.findProTypeByGuid(
                this.currProTypeGuid
              ).guid;
              deepCopyPro.advise = deepCopyPro._adviseEdit;
              delete deepCopyPro['advice'];
              delete deepCopyPro['mediafileList'];
              delete deepCopyPro['description'];
@@ -630,8 +632,13 @@
              files.forEach((image) => {
                data.append('images', image);
              });
              problemApi.updateProblem(data).then((res) => {
              problemApi
                .updateProblem(data)
                .then((res) => {
                this.$emit('submit', false);
                })
                .finally(() => {
                  this.loading = false;
              });
            });
          } else {
@@ -641,9 +648,8 @@
              delete deepCopyPro['description'];
              deepCopyPro.proName = deepCopyPro.problemname;
              delete deepCopyPro['problemname'];
              deepCopyPro.ptGuid = this.findProTypeByGuid(
                this.currProTypeGuid
              ).guid;
              deepCopyPro.ptGuid = this.currProTypeGuid;
              delete deepCopyPro['ptguid'];
              deepCopyPro.locationId = deepCopyPro.locationid;
              delete deepCopyPro['locationid'];
              delete deepCopyPro['_adviseEdit'];
@@ -652,8 +658,13 @@
              files.forEach((image) => {
                data.append('images', image);
              });
              problemApi.newProblem(data).then((res) => {
              problemApi
                .newProblem(data)
                .then((res) => {
                this.$emit('submit', true);
                })
                .finally(() => {
                  this.loading = false;
              });
            });
          }