hcong
2024-11-12 2527a643d7ac70c7a4742b297972d46c8b1495a4
src/views/fysp/check/components/ComChangeEdit.vue
@@ -3,7 +3,7 @@
    <div class="t-card_item">
      整改图片&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <div>
        <el-button @click="chosePicFromAnyPic">从任意图片选取</el-button>
        <!-- <el-button @click="chosePicFromAnyPic">从任意图片选取</el-button> -->
        <!-- <el-button type="primary" @click="chosePicFromLedgerPic">从台账选取</el-button> -->
        <el-button @click="choseChangePic">从文件夹选取</el-button>
      </div>
@@ -21,7 +21,11 @@
      :disabled="readonly"
      accept="image/*"
    >
      <el-button type="primary" id="uploadBtnId" style="display: none"></el-button>
      <el-button
        type="primary"
        id="uploadBtnId"
        style="display: none"
      ></el-button>
      <el-icon>
        <Plus />
      </el-icon>
@@ -30,21 +34,16 @@
      <el-button type="primary" @click="onSubmit">保存</el-button>
      <el-button @click="this.$emit('submited', false)">取消</el-button>
    </div>
    <el-dialog
      title="任意图片"
      width="80%"
      v-model="anyPhotoDialog"
      :before-close="beforeAnyPhotoDialogclose"
    <ArbitraryPhoto
      :max-select="3"
      v-if="anyPhotoDialog"
      v-model:dialog-visible="anyPhotoDialog"
      @selectByAnyPhonoEvent="handleSelectedAnyPhono"
      :subtask="subtask"
      :defaultFile="fileList"
      ref="arbitraryPhotoRef"
    >
      <ArbitraryPhoto
        v-if="anyPhotoDialog"
        @selectByAnyPhonoEvent="handleSelectedAnyPhono"
        :subtask="subtask"
        :defaultFile="fileList"
        ref="arbitraryPhotoRef"
      >
      </ArbitraryPhoto>
    </el-dialog>
    </ArbitraryPhoto>
    <el-dialog
      title="台账图片"
      width="80%"
@@ -88,6 +87,9 @@
    }
  },
  props: {
    changeType: {
      type: Number
    },
    problemId: {
      type: String
    },
@@ -121,7 +123,7 @@
  },
  methods: {
    pictureValidate() {
      if (this.fileList.length < 1) {
      if (this.changeType == 1 && this.fileList.length < 1) {
        ElMessage({
          message: '至少上传一张图片',
          type: 'error'
@@ -132,20 +134,29 @@
          message: '超过三张, 已删除多出的图片',
          type: 'error'
        });
        this.fileList = this.fileList.slice(0, 3);
        return false;
      }
      return true;
    },
    initParams() {
      if (this.changeType == 0) {
        return;
      }
      let beforeEditImgList = [];
      useCloned(this.oldChangeFileList).cloned.value.forEach((oldChangeFileitem) => {
        if (oldChangeFileitem.ischanged == 1) {
          oldChangeFileitem.url =
            $fysp.imgUrl + oldChangeFileitem.extension1 + oldChangeFileitem.guid + '.jpg';
          oldChangeFileitem.name = '1';
          beforeEditImgList.push(oldChangeFileitem);
      useCloned(this.oldChangeFileList).cloned.value.forEach(
        (oldChangeFileitem) => {
          if (oldChangeFileitem.ischanged == 1) {
            oldChangeFileitem.url =
              $fysp.imgUrl +
              oldChangeFileitem.extension1 +
              oldChangeFileitem.guid +
              '.jpg';
            oldChangeFileitem.name = '1';
            beforeEditImgList.push(oldChangeFileitem);
          }
        }
      });
      );
      this.fileList = useCloned(beforeEditImgList).cloned.value;
      this.oldFileList = useCloned(beforeEditImgList).cloned.value;
    },
@@ -172,21 +183,33 @@
          }
          exclude = false;
          // picUrls.push(item)
        } else {
        }
      });
      const that = this;
      let deleteImgCopy = this.deleteImg;
      fileUtil.getImageFiles(picUrls, function (files) {
        data.append('deleteImg', deleteImgCopy);
        data.append('problemId', that.problemId);
        files.forEach((image) => {
          data.append('images', image);
      if (this.changeType == 1) {
        fileUtil.getImageFiles(picUrls, function (files) {
          data.append('deleteImg', deleteImgCopy);
          data.append('problemId', that.problemId);
          files.forEach((image) => {
            data.append('images', image);
          });
          problemApi.updateChange(data).then((res) => {});
        });
        problemApi.updateChange(data).then((res) => {});
      });
      this.$emit('submited', true);
        that.$emit('submited', true);
      } else {
        fileUtil.getImageFiles(picUrls, function (files) {
          data.append('problemId', that.problemId);
          files.forEach((image) => {
            data.append('images', image);
          });
          problemApi.changeProblem(data).then((res) => {});
          that.$emit('submited', true);
        });
      }
    },
    beforeRemoveFile(file, fileList) {
      if (file.remark == '已上传') {