src/views/fysp/check/components/CompProblemAddOrUpd.vue
@@ -167,9 +167,7 @@
            <el-button type="primary" @click="onSubmit" v-show="!readonly"
              >保存</el-button
            >
            <el-button @click="onCancel" v-show="!readonly"
              >取消</el-button
            >
            <el-button @click="onCancel" v-show="!readonly">取消</el-button>
          </el-form-item>
        </el-form>
        <ArbitraryPhoto
@@ -214,7 +212,6 @@
  </CompGenericWrapper>
</template>
<script>
import CompGenericWrapper from './CompGenericWrapper.vue';
import ArbitraryPhoto from './ArbitraryPhoto.vue';
import CompLedgerPhoto from './CompLedgerPhoto.vue';
import CompDevicePhoto from './CompDevicePhoto.vue';
@@ -231,8 +228,7 @@
  components: {
    ArbitraryPhoto,
    CompDevicePhoto,
    CompLedgerPhoto,
    CompGenericWrapper
    CompLedgerPhoto
  },
  props: {
    readonly: {
@@ -263,6 +259,8 @@
  },
  data() {
    return {
      // fixme 2024.11.20 子组件初始化时机问题
      initPropsCount: 0,
      // 初始预览图片index
      initialIndex: -1,
      // 图片选择最大数量
@@ -327,10 +325,37 @@
      },
      deep: true
    },
    initPropsCount: {
      handler(nv, ov) {
        if (nv >= 3) {
          this.initOptions();
        }
      },
      immediate: true
    },
    problem: {
      handler(nv, ov) {
        this.initOptions();
      }
        if (nv != null && nv != undefined) {
          this.initPropsCount++;
        }
      },
      immediate: true
    },
    topTask: {
      handler(nv, ov) {
        if (nv != null && nv != undefined) {
          this.initPropsCount++;
        }
      },
      immediate: true
    },
    subtask: {
      handler(nv, ov) {
        if (nv != null && nv != undefined) {
          this.initPropsCount++;
        }
      },
      immediate: true
    }
  },
  computed: {
@@ -362,15 +387,13 @@
      return array;
    }
  },
  mounted() {
    this.initOptions();
  },
  mounted() {},
  methods: {
    onProAdviseChange(value) {
      this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
    },
    handlePictureCardPreview(uploadFile) {
      this.initialIndex = this.fileList.indexOf(uploadFile)
      this.initialIndex = this.fileList.indexOf(uploadFile);
      this.previewDialogVisible = true;
      this.previewDialogImageUrl = uploadFile.url;
    },
@@ -561,7 +584,8 @@
      return true;
    },
    onCancel() {
      this.$emit("cancel")
      this.$emit('cancel');
      this.$emit('update:visible', false);
    },
    onSubmit() {
      this.$refs.formRef.validate((valid) => {
@@ -590,7 +614,7 @@
          });
          if (this.type == 1) {
            let deleteImgCopy = this.deleteImg;
            fileUtil.getImageFiles(picUrls, function (files) {
            fileUtil.getImageFiles(picUrls, (files) => {
              data.append('deleteImg', deleteImgCopy);
              deepCopyPro.advise = deepCopyPro.advice;
              delete deepCopyPro['advice'];
@@ -603,19 +627,19 @@
              files.forEach((image) => {
                data.append('images', image);
              });
              problemApi.updateProblem(data).then((res) => {});
              problemApi.updateProblem(data).then((res) => {
                this.$emit('submit', false);
              });
            });
            this.$emit('submit', false);
          } else {
            const deepCopySubTask = useCloned(this.subtask).cloned.value;
            const that = this;
            fileUtil.getImageFiles(picUrls, function (files) {
            fileUtil.getImageFiles(picUrls, (files) => {
              deepCopyPro.insGuid = deepCopySubTask.insGuid;
              delete deepCopyPro['description'];
              deepCopyPro.proName = deepCopyPro.problemname;
              delete deepCopyPro['problemname'];
              deepCopyPro.ptGuid = that.findProTypeByGuid(
                that.currProTypeGuid
              deepCopyPro.ptGuid = this.findProTypeByGuid(
                this.currProTypeGuid
              ).guid;
              deepCopyPro.locationId = deepCopyPro.locationid;
              delete deepCopyPro['locationid'];
@@ -625,9 +649,10 @@
              files.forEach((image) => {
                data.append('images', image);
              });
              problemApi.newProblem(data).then((res) => {});
              problemApi.newProblem(data).then((res) => {
                this.$emit('submit', true);
              });
            });
            this.$emit('submit', true);
          }
        }
      });