From a19e6b1a393cf9febc55831ac96e5f5551d231af Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 05 十一月 2025 13:55:57 +0800
Subject: [PATCH] 1. 修复问题修改界面修改问题后,问题的id未同步更新的问题; 2. 修复删除问题时,列表属性错误的问题

---
 src/views/fysp/check/components/CompProblemAddOrUpd copy.vue |  773 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/composables/messageBox.js                                |    2 
 src/views/fysp/check/ProCheck.vue                            |    7 
 src/views/fysp/check/components/CompProblemAddOrUpd.vue      |   49 ++-
 src/views/fysp/check/components/CompProblemCard.vue          |   16 
 5 files changed, 818 insertions(+), 29 deletions(-)

diff --git a/src/composables/messageBox.js b/src/composables/messageBox.js
index 8606bd6..6cb46f8 100644
--- a/src/composables/messageBox.js
+++ b/src/composables/messageBox.js
@@ -24,7 +24,7 @@
         message: msg,
         type: 'success',
         // offset: 170,
-        position: 'bottom-left',
+        position: 'top-right',
       });
     })
     .catch((err) => {
diff --git a/src/views/fysp/check/ProCheck.vue b/src/views/fysp/check/ProCheck.vue
index d47f6a0..58f0366 100644
--- a/src/views/fysp/check/ProCheck.vue
+++ b/src/views/fysp/check/ProCheck.vue
@@ -34,12 +34,13 @@
           <CompProblemCard
             :key="i"
             v-for="(p, i) in curProList"
-            :index="i + 1"
+            :index="i"
             :problem="p"
             :subtask="curSubtask.data"
             :topTask="topTask"
             @submit="updateSubtask"
             @check="handleProblemCheck"
+            @delete="handleProblemDelete"
           ></CompProblemCard>
         </div>
         <el-empty v-else description="鏆傛棤闂" v-loading="mainLoading" />
@@ -273,6 +274,10 @@
       this.curSubtask.data.changeNum = status.changeNum;
       this.curSubtask.data.changeCheckedNum = status.changeCheckedNum;
       this.curSubtask.type = ProCheckProxy.getSubtaskType(this.curSubtask.data);
+    },
+    // 鍒犻櫎闂
+    handleProblemDelete(index) {
+      this.curProList.splice(index, 1);
     }
   },
   mounted() {}
diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd copy.vue b/src/views/fysp/check/components/CompProblemAddOrUpd copy.vue
new file mode 100644
index 0000000..949e1c6
--- /dev/null
+++ b/src/views/fysp/check/components/CompProblemAddOrUpd copy.vue
@@ -0,0 +1,773 @@
+<template>
+  <CompGenericWrapper type="dialog" append-to-body>
+    <template #content>
+      <div class="main-container">
+        <el-form
+          :rules="rules"
+          :model="deepCopyProblem"
+          label-width="auto"
+          style="max-width: 95%"
+          ref="formRef"
+        >
+          <el-form-item label="闂浣嶇疆" prop="locationid">
+            <el-select
+              v-model="deepCopyProblem.locationid"
+              @change="onProLocationChange"
+              class="row"
+              :disabled="readonly"
+            >
+              <el-option
+                v-for="item in posList"
+                :key="item.index"
+                :label="item.text"
+                :value="item.index"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="闂绫诲瀷" prop="_proType">
+            <el-select
+              v-model="deepCopyProblem._proType"
+              @change="onProTypeChange"
+              class="row"
+              :disabled="readonly"
+            >
+              <el-option
+                v-for="item in problemTypeOptions"
+                :key="item.typeid"
+                :label="item.typename"
+                :value="item.typename"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="闂鎻忚堪" prop="description">
+            <el-select
+              v-model="deepCopyProblem.description"
+              @change="onProDesChange"
+              class="row"
+              :disabled="readonly"
+            >
+              <el-option
+                v-for="item in descriptionOptions"
+                :key="item.guid"
+                :label="item.description"
+                :value="item.description"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="琛ュ厖璇存槑" :disabled="readonly" prop="proRemark">
+            <el-input
+              v-model="proRemark"
+              type="textarea"
+              @change="onProRemarkChange"
+              class="row"
+              placeholder="璇疯緭鍏�"
+              :disabled="readonly"
+            />
+          </el-form-item>
+          <el-form-item label="闂寤鸿" prop="advice">
+            <el-select
+              v-model="deepCopyProblem.advice"
+              class="row"
+              :disabled="readonly"
+              @change="onProAdviseChange"
+            >
+              <el-option
+                v-for="item in adviseOptions"
+                :key="item.adGuid"
+                :label="item.adName"
+                :value="item.adName"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            label="闂寤鸿淇"
+            prop="_adviseEdit"
+            :disabled="false"
+          >
+            <el-input
+              v-model="deepCopyProblem._adviseEdit"
+              type="textarea"
+              @change="onProAdviseEditChange"
+              class="row"
+              placeholder="璇疯緭鍏ラ棶棰樺缓璁慨姝�"
+              :disabled="readonly"
+            />
+          </el-form-item>
+          <el-form-item label="闂鍥剧墖">
+            <el-row>
+              <el-col>
+                <el-button
+                  @click="chosePicFromAnyPic"
+                  v-show="!readonly"
+                  :disabled="fileList.length >= 3"
+                  >浠庡満鏅浘鐗囬�夊彇</el-button
+                >
+                <el-button
+                  @click="chosePicFromDevicePic"
+                  v-show="!readonly"
+                  :disabled="fileList.length >= 3"
+                  >浠庤澶囧浘鐗囬�夊彇</el-button
+                >
+                <el-button
+                  @click="chosePicFromLedgerPic"
+                  v-show="!readonly"
+                  :disabled="fileList.length >= 3"
+                  >浠庡彴璐﹂�夊彇</el-button
+                >
+                <el-button
+                  @click="choseChangePic"
+                  v-show="!readonly"
+                  :disabled="fileList.length >= 3"
+                  >浠庢枃浠跺す閫夊彇</el-button
+                >
+              </el-col>
+              <el-col v-if="!fileList || fileList.length <= 0">
+                <el-empty
+                  style="height: 145px"
+                  class="img-upload"
+                  description="璇锋坊鍔犲浘鐗�"
+                />
+              </el-col>
+              <el-col>
+                <el-upload
+                  v-show="fileList && fileList.length > 0"
+                  class="img-upload"
+                  ref="uploadRef"
+                  v-model:file-list="fileList"
+                  list-type="picture-card"
+                  multiple
+                  :auto-upload="false"
+                  crossorigin="Anonymous"
+                  :before-remove="beforeRemoveFile"
+                  :on-preview="handlePictureCardPreview"
+                  :disabled="readonly"
+                  accept="image/*"
+                >
+                  <template #trigger v-if="fileList.length < 3 && !readonly">
+                    <el-button
+                      v-if="fileList.length < 3"
+                      type="primary"
+                      id="uploadBtnId"
+                      style="display: none"
+                    ></el-button>
+                    <el-icon>
+                      <Plus />
+                    </el-icon>
+                  </template>
+                  <template #tip>
+                    <div style="color: #f56c6c">
+                      鏈�灏戜笂浼犱竴寮犲浘鐗囷紝鏈�澶氶�夋嫨涓夊紶鍥剧墖
+                    </div>
+                  </template>
+                </el-upload>
+              </el-col>
+            </el-row>
+          </el-form-item>
+        </el-form>
+        <el-row justify="end">
+          <el-button type="primary" @click="onSubmit" v-show="!readonly"
+            >淇濆瓨</el-button
+          >
+          <el-button @click="onCancel" v-show="!readonly">鍙栨秷</el-button>
+        </el-row>
+        <ArbitraryPhoto
+          :max-select="maxSelectImgCount - fileList.length"
+          v-model:dialog-visible="anyPhotoDialog"
+          @submit="handleSelectedAnyPhono"
+          :subtask="subtask"
+          :defaultFile="fileList"
+          ref="arbitraryPhotoRef"
+        >
+        </ArbitraryPhoto>
+        <CompLedgerPhoto
+          :max-select="maxSelectImgCount - fileList.length"
+          v-model:dialog-visible="ledgerPicDialog"
+          @submit="handleLedgerPicPhono"
+          :subtask="subtask"
+          :defaultFile="fileList"
+          ref="ledgerPhotoRef"
+        ></CompLedgerPhoto>
+        <CompDevicePhoto
+          :max-select="maxSelectImgCount - fileList.length"
+          v-model:dialog-visible="deiveceImgDialog"
+          @submit="handleSelectedDevicePhono"
+          :subtask="subtask"
+          :defaultFile="fileList"
+          ref="deiveceImgDialogRef"
+        >
+        </CompDevicePhoto>
+        <el-image-viewer
+          v-if="previewDialogVisible"
+          :url-list="fileList.map((item) => item.url)"
+          :initial-index="initialIndex"
+          @close="previewDialogVisible = false"
+          alt="棰勮"
+          class="preview-pic"
+        />
+        <!-- <el-dialog v-model="previewDialogVisible">
+          
+        </el-dialog> -->
+      </div>
+    </template>
+  </CompGenericWrapper>
+</template>
+<script>
+import ArbitraryPhoto from './ArbitraryPhoto.vue';
+import CompLedgerPhoto from './CompLedgerPhoto.vue';
+import CompDevicePhoto from './CompDevicePhoto.vue';
+import problemApi from '@/api/fysp/problemApi.js';
+
+import { $fysp } from '@/api/index.js';
+import fileUtil from '@/utils/fileUtils.js';
+import { useCloned } from '@vueuse/core';
+import { ElMessage } from 'element-plus';
+import deviceApi from '@/api/fysp/deviceApi';
+import { useFormConfirm } from '@/composables/formConfirm';
+export default {
+  emits: ['submit', 'cancel'],
+  components: {
+    ArbitraryPhoto,
+    CompDevicePhoto,
+    CompLedgerPhoto
+  },
+  props: {
+    readonly: {
+      type: Boolean,
+      default: false
+    },
+    topTask: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    },
+    subtask: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    },
+    insGuid: {
+      type: String
+    },
+    problem: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    }
+  },
+  data() {
+    return {
+      // fixme 2024.11.20 瀛愮粍浠跺垵濮嬪寲鏃舵満闂
+      initPropsCount: 0,
+      // 鍒濆棰勮鍥剧墖index
+      initialIndex: -1,
+      // 鍥剧墖閫夋嫨鏈�澶ф暟閲�
+      maxSelectImgCount: 3,
+      previewDialogVisible: false,
+      previewDialogImageUrl: '',
+      // 璁惧鍥剧墖鍒楄〃
+      deviceImgObjList: [],
+      // 0浠h〃鏂板 1淇敼
+      type: -1,
+      deepCopyProblem: {},
+      currProTypeGuid: '',
+      proType: '',
+      proRemark: null,
+
+      suggestions: [],
+      problemTypeList: [],
+      posList: [],
+
+      fileList: [],
+      oldFileList: [],
+      deleteImg: [],
+      deiveceImgDialog: false,
+      anyPhotoDialog: false,
+      // 鍙拌处
+      month: -1,
+      ledgerPicDialog: false,
+      rules: {
+        _proType: {
+          required: true,
+          message: '闂绫诲瀷涓嶈兘涓虹┖',
+          trigger: 'change'
+        },
+        description: {
+          required: true,
+          message: '闂鎻忚堪涓嶈兘涓虹┖',
+          trigger: 'change'
+        },
+        locationid: {
+          required: true,
+          message: '闂浣嶇疆涓嶈兘涓虹┖',
+          trigger: 'change'
+        },
+        advice: {
+          required: true,
+          message: '闂寤鸿涓嶈兘涓虹┖',
+          trigger: 'change'
+        }
+      },
+      deviceTopTypes: [
+        { id: 0, label: '鐩戞帶璁惧' },
+        { id: 1, label: '娌荤悊璁惧' },
+        { id: 2, label: '鐢熶骇璁惧' }
+      ]
+    };
+  },
+  watch: {
+    fileList: {
+      handler(newFileList, oldFileList) {
+        // 鍥剧墖鏍¢獙
+        this.pictureValidate();
+      },
+      deep: true
+    },
+    initPropsCount: {
+      handler(nv, ov) {
+        if (nv >= 3) {
+          this.initOptions();
+        }
+      },
+      immediate: true
+    },
+    problem: {
+      handler(nv, ov) {
+        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: {
+    descriptionOptions() {
+      const descriptions = [];
+
+      this.problemTypeList.forEach((item) => {
+        if (item.typename == this.deepCopyProblem._proType) {
+          descriptions.push(item);
+        }
+      });
+
+      return descriptions;
+    },
+    problemTypeOptions() {
+      return this.problemTypeList.reduce((acc, current) => {
+        const x = acc.find((item) => item.typeid === current.typeid);
+        if (!x) {
+          acc.push(current);
+        }
+        return acc;
+      }, []);
+    },
+    adviseOptions() {
+      let problemGuid = this.currProTypeGuid || this.problem.guid;
+      let array = this.suggestions.filter(
+        (item) => item.adProblemtypeguid == problemGuid
+      );
+      return array;
+    }
+  },
+  mounted() {},
+  methods: {
+    onProAdviseChange(value) {
+      this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
+    },
+    handlePictureCardPreview(uploadFile) {
+      this.initialIndex = this.fileList.indexOf(uploadFile);
+      this.previewDialogVisible = true;
+      this.previewDialogImageUrl = uploadFile.url;
+    },
+    beforeDeiveceImgDialogclose() {
+      this.deiveceImgDialog = false;
+    },
+    initOptions() {
+      if (!this.problem || !this.subtask || !this.topTask) {
+        return;
+      }
+      if (this.problem == undefined || this.problem == null) {
+        this.deepCopyProblem = {};
+      } else {
+        this.deepCopyProblem = useCloned(this.problem).cloned.value;
+        this.currProTypeGuid = this.problem.guid;
+        this.deepCopyProblem.advice = this.deepCopyProblem.advise;
+        this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
+      }
+
+      this.type = 'guid' in this.deepCopyProblem ? 1 : 0;
+
+      // 鑾峰彇闂绫诲瀷
+      let data = {
+        sceneTypeId: this.subtask.sceneTypeId,
+        cityCode: this.topTask.citycode,
+        districtCode: this.topTask.districtcode
+      };
+      problemApi.fetchProblemType(data).then((res) => {
+        this.problemTypeList = res;
+
+        if (this.type == 1) {
+          let currProName = String(this.problem.problemname);
+
+          let currDescription;
+          if (currProName.lastIndexOf('(') == -1) {
+            currDescription = currProName;
+            this.problemTypeList.forEach((item) => {
+              if (item.description == currDescription) {
+                this.deepCopyProblem._proType = item.typename;
+              }
+            });
+            this.deepCopyProblem.description = currDescription;
+            this.proRemark = '';
+          } else {
+            currDescription = currProName.substring(
+              0,
+              currProName.lastIndexOf('(')
+            );
+
+            this.problemTypeList.forEach((item) => {
+              if (item.description === currDescription) {
+                this.deepCopyProblem._proType = item.typename;
+              }
+            });
+            this.deepCopyProblem.description = currDescription;
+            this.proRemark = currProName.substring(
+              currProName.lastIndexOf('(') + 1,
+              currProName.length - 1
+            );
+          }
+
+          let beforeEditImgList = [];
+          let oldFiles = this.problem.mediafileList;
+          if (oldFiles && oldFiles.length > 0) {
+            this.problem.mediafileList.forEach((item) => {
+              if (item.ischanged == 0) {
+                item.url = $fysp.imgUrl + item.extension1 + item.guid + '.jpg';
+                item.name = '1';
+                beforeEditImgList.push(item);
+              }
+            });
+            this.fileList = useCloned(beforeEditImgList).cloned.value;
+            this.oldFileList = useCloned(beforeEditImgList).cloned.value;
+          }
+        }
+      });
+
+      // 闂寤鸿
+      problemApi.getSuggestion().then((res) => {
+        this.suggestions = res.data;
+      });
+
+      // 闂浣嶇疆
+      problemApi
+        .getLocation({
+          sceneTypeId: this.subtask.sceneTypeId
+        })
+        .then((res) => {
+          this.posList = res.data;
+        });
+    },
+    beforeRemoveFile(file, fileList) {
+      if (file.remark == '宸蹭笂浼�') {
+        this.deleteImg.push(file.guid);
+        this.oldFileList.filter((item) => item.url != file.url);
+      }
+    },
+    handleLedgerPicPhono(data) {
+      this.beforeLedgerPicDialogclose();
+      let isExist = false;
+      for (const item of data) {
+        for (const already of this.fileList) {
+          if (item.url == already.url) {
+            isExist = true;
+          }
+        }
+        if (!isExist) {
+          this.fileList.push({
+            url: item.url,
+            name: '1'
+          });
+        }
+        isExist = false;
+      }
+    },
+    findProTypeByGuid(guid) {
+      let result;
+      this.problemTypeList.forEach((item) => {
+        if (item.guid == guid) {
+          result = item;
+        }
+      });
+      return result;
+    },
+    changeProblemname() {
+      if (!this.proRemark || this.proRemark == null || this.proRemark == '') {
+        this.deepCopyProblem.problemname = this.deepCopyProblem.description;
+      } else {
+        this.deepCopyProblem.problemname =
+          this.deepCopyProblem.description + '(' + this.proRemark + ')';
+      }
+    },
+    onProRemarkChange(value) {
+      this.changeProblemname();
+    },
+    onProAdviseEditChange(value) {},
+    onProTypeChange(value) {
+      // 榛樿闂鎻忚堪鍜岄棶棰樺缓璁负绗竴涓�
+      this.currProTypeGuid = this.descriptionOptions[0].guid;
+      this.deepCopyProblem.ptguid = this.currProTypeGuid
+      this.deepCopyProblem.description = this.descriptionOptions[0].description;
+      this.onProDesChange(this.deepCopyProblem.description);
+      this.deepCopyProblem.advice = this.adviseOptions[0].adName;
+      this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
+    },
+    findProByProDesName(name) {
+      let result;
+      this.problemTypeList.forEach((item) => {
+        if (item.description == name) {
+          result = item;
+        }
+      });
+      return result;
+    },
+    onProDesChange(value) {
+      let currPro = this.findProByProDesName(value);
+      this.currProTypeGuid = currPro.guid;
+      // this.deepCopyProblem.description = currPro.description;
+      this.changeProblemname();
+      var adName =
+        this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName;
+      this.deepCopyProblem.advice = adName;
+      this.$nextTick(() => {
+        this.deepCopyProblem._adviseEdit = this.deepCopyProblem.advice;
+      });
+    },
+    onProLocationChange(value) {
+      this.posList.forEach((item) => {
+        if (item.index == value) {
+          this.deepCopyProblem.location = item.text;
+        }
+      });
+    },
+    pictureValidate() {
+      if (this.fileList.length < 1) {
+        ElMessage({
+          message: '鑷冲皯涓婁紶涓�寮犲浘鐗�',
+          type: 'error'
+        });
+        return false;
+      } else if (this.fileList.length > 3) {
+        ElMessage({
+          message: '瓒呰繃涓夊紶, 宸插垹闄ゅ鍑虹殑鍥剧墖',
+          type: 'error'
+        });
+        this.fileList = this.fileList.slice(0, 3);
+        return false;
+      }
+      return true;
+    },
+    onCancel() {
+      this.$emit('cancel');
+      this.$emit('update:visible', false);
+    },
+    onSubmit() {
+      this.$refs.formRef.validate((valid) => {
+        if (valid && this.pictureValidate()) {
+          // 鏁版嵁鍑嗗
+          let deepCopyPro = useCloned(this.deepCopyProblem).cloned.value;
+          let data = new FormData();
+          var picUrls = [];
+          this.fileList.forEach((item) => {
+            if (!('guid' in item)) {
+              // 鏂扮殑
+              let exclude = false;
+              for (let index = 0; index < this.oldFileList.length; index++) {
+                const element = this.oldFileList[index];
+                if (item.url == element.url) {
+                  exclude = true;
+                  break;
+                }
+              }
+              if (!exclude) {
+                picUrls.push(item.url);
+              }
+              exclude = false;
+              // picUrls.push(item)
+            }
+          });
+          if (this.type == 1) {
+            let deleteImgCopy = this.deleteImg;
+            fileUtil.getImageFiles(picUrls, (files) => {
+              data.append('deleteImg', deleteImgCopy);
+              deepCopyPro.advise = deepCopyPro.advice;
+              deepCopyPro.ptguid = this.findProTypeByGuid(
+                this.currProTypeGuid
+              ).guid;
+              deepCopyPro.problemname
+              delete deepCopyPro['advice'];
+              delete deepCopyPro['mediafileList'];
+              delete deepCopyPro['description'];
+              delete deepCopyPro['_adviseEdit'];
+              delete deepCopyPro['_proType'];
+              delete deepCopyPro['proType'];
+              data.append('problem', JSON.stringify(deepCopyPro));
+              files.forEach((image) => {
+                data.append('images', image);
+              });
+              problemApi.updateProblem(data).then((res) => {
+                this.$emit('submit', false);
+              });
+            });
+          } else {
+            const deepCopySubTask = useCloned(this.subtask).cloned.value;
+            fileUtil.getImageFiles(picUrls, (files) => {
+              deepCopyPro.insGuid = deepCopySubTask.insGuid;
+              delete deepCopyPro['description'];
+              deepCopyPro.proName = deepCopyPro.problemname;
+              delete deepCopyPro['problemname'];
+              deepCopyPro.ptGuid = this.findProTypeByGuid(
+                this.currProTypeGuid
+              ).guid;
+              deepCopyPro.locationId = deepCopyPro.locationid;
+              delete deepCopyPro['locationid'];
+              delete deepCopyPro['_adviseEdit'];
+              delete deepCopyPro['_proType'];
+              data.append('problemVo', JSON.stringify(deepCopyPro));
+              files.forEach((image) => {
+                data.append('images', image);
+              });
+              problemApi.newProblem(data).then((res) => {
+                this.$emit('submit', true);
+              });
+            });
+          }
+        }
+      });
+    },
+    handleSelectedAnyPhono(data) {
+      this.beforeAnyPhotoDialogclose();
+      let isExist = false;
+      for (const item of data) {
+        for (const already of this.fileList) {
+          if (item.url == already.url) {
+            isExist = true;
+          }
+        }
+        if (!isExist) {
+          this.fileList.push({
+            url: item.url,
+            name: '1'
+          });
+        }
+        isExist = false;
+      }
+    },
+    handleSelectedDevicePhono(data) {
+      let isExist = false;
+      for (const item of data) {
+        for (const already of this.fileList) {
+          if (item.url == already.url) {
+            isExist = true;
+          }
+        }
+        if (!isExist) {
+          this.fileList.push({
+            url: item.url,
+            name: '1'
+          });
+        }
+        isExist = false;
+      }
+    },
+    chosePicFromAnyPic() {
+      this.anyPhotoDialog = true;
+    },
+    chosePicFromDevicePic() {
+      this.deiveceImgDialog = true;
+    },
+    chosePicFromLedgerPic() {
+      // 浣跨敤Date瀵硅薄瑙f瀽鏃ユ湡瀛楃涓�
+      var date = new Date(this.subtask.subtask.planstarttime);
+      // 鑾峰彇鏈堜唤淇℃伅锛屾湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ラ渶瑕佸姞1
+      this.month = date.getMonth() + 1;
+      if (String(this.month).length == 1) {
+        this.month = `0${this.month}`;
+      }
+      var year = date.getFullYear();
+      this.month = `${year}-${this.month}`;
+      this.ledgerPicDialog = true;
+    },
+    // 浠庢枃浠跺す涓�
+    choseChangePic() {
+      // 鑾峰彇鎸囧畾ID鐨勫厓绱�
+      var btnElement = document.getElementById('uploadBtnId');
+      // 妫�鏌ュ厓绱犳槸鍚﹀瓨鍦�
+      if (btnElement) {
+        // 瑙﹀彂鐐瑰嚮浜嬩欢
+        btnElement.click();
+      }
+    },
+    beforeAnyPhotoDialogclose() {
+      this.anyPhotoDialog = false;
+    },
+    beforeLedgerPicDialogclose() {
+      this.ledgerPicDialog = false;
+    }
+  }
+};
+</script>
+<style scoped>
+.main-container {
+  padding: 3px;
+}
+.t-card_item {
+  display: flex;
+}
+
+.w-msg-img {
+  position: absolute;
+  width: 25rem;
+  height: 27rem;
+}
+
+.img-upload {
+  margin-top: 30px;
+  margin-bottom: 30px;
+}
+.row {
+  width: 100%;
+}
+::v-deep .el-upload-list--picture-card .el-upload-list__item-thumbnail {
+  object-fit: cover !important;
+}
+.preview-pic {
+  object-fit: cover;
+  width: 100%;
+  height: 100%;
+}
+::v-deep .el-upload--picture-card {
+  display: none;
+}
+/* 闅愯棌el-upload涓婁紶鎴愬姛缁勪欢 */
+::v-deep .el-upload-list__item-status-label {
+  display: none !important;
+}
+</style>
diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue
index bc0ee30..5bf78fb 100644
--- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue
+++ b/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,9 +632,14 @@
               files.forEach((image) => {
                 data.append('images', image);
               });
-              problemApi.updateProblem(data).then((res) => {
-                this.$emit('submit', false);
-              });
+              problemApi
+                .updateProblem(data)
+                .then((res) => {
+                  this.$emit('submit', false);
+                })
+                .finally(() => {
+                  this.loading = false;
+                });
             });
           } else {
             const deepCopySubTask = useCloned(this.subtask).cloned.value;
@@ -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,9 +658,14 @@
               files.forEach((image) => {
                 data.append('images', image);
               });
-              problemApi.newProblem(data).then((res) => {
-                this.$emit('submit', true);
-              });
+              problemApi
+                .newProblem(data)
+                .then((res) => {
+                  this.$emit('submit', true);
+                })
+                .finally(() => {
+                  this.loading = false;
+                });
             });
           }
         }
diff --git a/src/views/fysp/check/components/CompProblemCard.vue b/src/views/fysp/check/components/CompProblemCard.vue
index 77f907d..e59b9f9 100644
--- a/src/views/fysp/check/components/CompProblemCard.vue
+++ b/src/views/fysp/check/components/CompProblemCard.vue
@@ -15,7 +15,7 @@
 
     <el-descriptions :column="2" size="small" border>
       <template #title>
-        <span class="d-index">{{ index }}</span>
+        <span class="d-index">{{ index + 1 }}</span>
         <span class="d-title">{{ title }}</span>
       </template>
       <template #extra>
@@ -100,20 +100,20 @@
       </el-col>
       <el-col :span="12">
         <el-row justify="end" class="btn-group">
-          <el-button
+          <!-- <el-button
             type="danger"
             size="small"
             @click="deletePro"
             :disabled="true"
             >鍒犻櫎</el-button
-          >
-          <!-- <el-button
+          > -->
+          <el-button
             type="danger"
             size="small"
             @click="deletePro"
             :disabled="!proStatus.deletable"
             >鍒犻櫎</el-button
-          > -->
+          >
           <!-- 瀹℃牳椹冲洖鎿嶄綔 -->
           <el-button
             v-if="
@@ -235,7 +235,7 @@
     },
     index: {
       type: Number,
-      default: 1
+      default: 0
     }
   },
   data() {
@@ -336,7 +336,7 @@
     deletePro() {
       useMessageBoxTip({
         confirmMsg: '鏄惁鍒犻櫎闂',
-        confirmTitle: '纭畾',
+        confirmTitle: '鍒犻櫎闂',
         onConfirm: () => {
           return problemApi
             .deleteProblem({
@@ -344,7 +344,7 @@
             })
             .then((res) => {
               if (res.success) {
-                this.$emit('submit');
+                this.$emit('delete', this.index);
               }
             });
         }

--
Gitblit v1.9.3