From ae234efb788bca2fa77f700442427996fa7f4aca Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 14 十一月 2024 11:58:00 +0800
Subject: [PATCH] Merge branch 'hc-dataproduct-v1112' into lsf-dataproduct-1024

---
 src/views/fysp/check/components/ComChangeEdit.vue |   89 ++++++++++++++++++++++++++++----------------
 1 files changed, 56 insertions(+), 33 deletions(-)

diff --git a/src/views/fysp/check/components/ComChangeEdit.vue b/src/views/fysp/check/components/ComChangeEdit.vue
index 6c52b21..c297afb 100644
--- a/src/views/fysp/check/components/ComChangeEdit.vue
+++ b/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 == '宸蹭笂浼�') {

--
Gitblit v1.9.3