From 78278ebbdaf110363ecdde4fb25a5bc40e4fe1fd Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期六, 25 四月 2026 17:03:00 +0800
Subject: [PATCH] 文件上传修改

---
 src/views/safeProduction/safeQualifications/index.vue                    |    2 
 src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue     |   75 -------
 src/views/salesManagement/deliveryLedger/index.vue                       |    2 
 src/api/procurementManagement/procurementInvoiceLedger.js                |    8 
 src/views/financialManagement/revenueManagement/index.vue                |    1 
 src/views/salesManagement/salesLedger/index.vue                          |   73 -------
 /dev/null                                                                |  256 ----------------------------
 src/components/ProjectManagement/ProgressReportDialog.vue                |   48 ----
 src/views/collaborativeApproval/purchaseApproval/index.vue               |   12 
 src/views/projectManagement/Management/projectDetail.vue                 |    2 
 src/views/projectManagement/projectType/components/ProjectTypeDialog.vue |   51 ----
 src/views/safeProduction/safetyTrainingAssessment/index.vue              |    2 
 src/components/Dialog/FileListDialog.vue                                 |    1 
 src/views/projectManagement/Management/index.vue                         |    2 
 src/views/safeProduction/dangerInvestigation/index.vue                   |    2 
 15 files changed, 35 insertions(+), 502 deletions(-)

diff --git a/src/api/procurementManagement/procurementInvoiceLedger.js b/src/api/procurementManagement/procurementInvoiceLedger.js
index 038e94f..d0716f9 100644
--- a/src/api/procurementManagement/procurementInvoiceLedger.js
+++ b/src/api/procurementManagement/procurementInvoiceLedger.js
@@ -75,14 +75,6 @@
   });
 }
 
-export function productUploadFile(data) {
-  return request({
-    url: "/file/uploadFile",
-    method: "post",
-    data: data,
-  });
-}
-
 // export function getProductRecordById(params) {
 //   return request({
 //     url: "/purchase/registration/getProductRecordById",
diff --git a/src/components/Dialog/FileListDialog.vue b/src/components/Dialog/FileListDialog.vue
index fc82411..6fea795 100644
--- a/src/components/Dialog/FileListDialog.vue
+++ b/src/components/Dialog/FileListDialog.vue
@@ -77,6 +77,7 @@
                 @pagination="paginationSearch"
                 @change="handleChange" />
   </el-dialog>
+<!-- // todo 闄勪欢棰勮鐩稿叧 -->
   <filePreview v-if="showPreview"
                ref="filePreviewRef" />
 </template>
diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue
deleted file mode 100644
index 00212c5..0000000
--- a/src/components/ImagePreview/index.vue
+++ /dev/null
@@ -1,92 +0,0 @@
-<template>
-  <el-image
-    :src="`${realSrc}`"
-    fit="cover"
-    :style="`width:${realWidth};height:${realHeight};`"
-    :preview-src-list="realSrcList"
-    preview-teleported
-  >
-    <template #error>
-      <div class="image-slot">
-        <el-icon><picture-filled /></el-icon>
-      </div>
-    </template>
-  </el-image>
-</template>
-
-<script setup>
-import { isExternal } from "@/utils/validate"
-
-const props = defineProps({
-  src: {
-    type: String,
-    default: ""
-  },
-  width: {
-    type: [Number, String],
-    default: ""
-  },
-  height: {
-    type: [Number, String],
-    default: ""
-  }
-})
-
-const realSrc = computed(() => {
-  if (!props.src) {
-    return
-  }
-  let real_src = props.src.split(",")[0]
-  if (isExternal(real_src)) {
-    return real_src
-  }
-  return import.meta.env.VITE_APP_BASE_API + real_src
-})
-
-const realSrcList = computed(() => {
-  if (!props.src) {
-    return
-  }
-  let real_src_list = props.src.split(",")
-  let srcList = []
-  real_src_list.forEach(item => {
-    if (isExternal(item)) {
-      return srcList.push(item)
-    }
-    return srcList.push(import.meta.env.VITE_APP_BASE_API + item)
-  })
-  return srcList
-})
-
-const realWidth = computed(() =>
-  typeof props.width == "string" ? props.width : `${props.width}px`
-)
-
-const realHeight = computed(() =>
-  typeof props.height == "string" ? props.height : `${props.height}px`
-)
-</script>
-
-<style lang="scss" scoped>
-.el-image {
-  border-radius: 5px;
-  background-color: #ebeef5;
-  box-shadow: 0 0 5px 1px #ccc;
-  :deep(.el-image__inner) {
-    transition: all 0.3s;
-    cursor: pointer;
-    &:hover {
-      transform: scale(1.2);
-    }
-  }
-  :deep(.image-slot) {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    width: 100%;
-    height: 100%;
-    color: #909399;
-    font-size: 30px;
-  }
-}
-</style>
diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue
deleted file mode 100644
index 9670c72..0000000
--- a/src/components/ImageUpload/index.vue
+++ /dev/null
@@ -1,256 +0,0 @@
-<template>
-  <div class="component-upload-image">
-    <el-upload
-      multiple
-      :action="uploadImgUrl"
-      list-type="picture-card"
-      :on-success="handleUploadSuccess"
-      :before-upload="handleBeforeUpload"
-      :data="data"
-      :limit="limit"
-      :on-error="handleUploadError"
-      :on-exceed="handleExceed"
-      ref="imageUpload"
-      :before-remove="handleDelete"
-      :show-file-list="true"
-      :headers="headers"
-      :file-list="fileList"
-      :on-preview="handlePictureCardPreview"
-      :class="{ hide: fileList.length >= limit }"
-    >
-      <el-icon class="avatar-uploader-icon"><plus /></el-icon>
-    </el-upload>
-    <!-- 涓婁紶鎻愮ず -->
-    <div class="el-upload__tip" v-if="showTip">
-      璇蜂笂浼�
-      <template v-if="fileSize">
-        澶у皬涓嶈秴杩� <b style="color: #f56c6c">{{ fileSize }}MB</b>
-      </template>
-      <template v-if="fileType">
-        鏍煎紡涓� <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
-      </template>
-      鐨勬枃浠�
-    </div>
-
-    <el-dialog
-      v-model="dialogVisible"
-      title="棰勮"
-      width="800px"
-      append-to-body
-    >
-      <img
-        :src="dialogImageUrl"
-        style="display: block; max-width: 100%; margin: 0 auto"
-      />
-    </el-dialog>
-  </div>
-</template>
-
-<script setup>
-import { getToken } from "@/utils/auth";
-import { isExternal } from "@/utils/validate";
-import Sortable from "sortablejs";
-
-const props = defineProps({
-  modelValue: [String, Object, Array],
-  // 涓婁紶鎺ュ彛鍦板潃
-  action: {
-    type: String,
-    default: "/common/upload",
-  },
-  // 涓婁紶鎼哄甫鐨勫弬鏁�
-  data: {
-    type: Object,
-  },
-  // 鍥剧墖鏁伴噺闄愬埗
-  limit: {
-    type: Number,
-    default: 5,
-  },
-  // 澶у皬闄愬埗(MB)
-  fileSize: {
-    type: Number,
-    default: 5,
-  },
-  // 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg']
-  fileType: {
-    type: Array,
-    default: () => ["png", "jpg", "jpeg"],
-  },
-  // 鏄惁鏄剧ず鎻愮ず
-  isShowTip: {
-    type: Boolean,
-    default: true,
-  },
-  // 鎷栧姩鎺掑簭
-  drag: {
-    type: Boolean,
-    default: true,
-  },
-});
-
-const { proxy } = getCurrentInstance();
-const emit = defineEmits();
-const number = ref(0);
-const uploadList = ref([]);
-const dialogImageUrl = ref("");
-const dialogVisible = ref(false);
-const baseUrl = import.meta.env.VITE_APP_BASE_API;
-const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
-const headers = ref({ Authorization: "Bearer " + getToken() });
-const fileList = ref([]);
-const showTip = computed(
-  () => props.isShowTip && (props.fileType || props.fileSize)
-);
-
-watch(
-  () => props.modelValue,
-  (val) => {
-    if (val) {
-      // 棣栧厛灏嗗�艰浆涓烘暟缁�
-      const list = Array.isArray(val) ? val : props.modelValue.split(",");
-      // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁�
-      fileList.value = list.map((item) => {
-        if (typeof item === "string") {
-          if (item.indexOf(baseUrl) === -1 && !isExternal(item)) {
-            item = { name: baseUrl + item, url: baseUrl + item };
-          } else {
-            item = { name: item, url: item };
-          }
-        }
-        return item;
-      });
-    } else {
-      fileList.value = [];
-      return [];
-    }
-  },
-  { deep: true, immediate: true }
-);
-
-// 涓婁紶鍓峫oading鍔犺浇
-function handleBeforeUpload(file) {
-  let isImg = false;
-  if (props.fileType.length) {
-    let fileExtension = "";
-    if (file.name.lastIndexOf(".") > -1) {
-      fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
-    }
-    isImg = props.fileType.some((type) => {
-      if (file.type.indexOf(type) > -1) return true;
-      if (fileExtension && fileExtension.indexOf(type) > -1) return true;
-      return false;
-    });
-  } else {
-    isImg = file.type.indexOf("image") > -1;
-  }
-  if (!isImg) {
-    proxy.$modal.msgError(
-      `鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鍥剧墖鏍煎紡鏂囦欢!`
-    );
-    return false;
-  }
-  if (file.name.includes(",")) {
-    proxy.$modal.msgError("鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!");
-    return false;
-  }
-  if (props.fileSize) {
-    const isLt = file.size / 1024 / 1024 < props.fileSize;
-    if (!isLt) {
-      proxy.$modal.msgError(`涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`);
-      return false;
-    }
-  }
-  proxy.$modal.loading("姝e湪涓婁紶鍥剧墖锛岃绋嶅��...");
-  number.value++;
-}
-
-// 鏂囦欢涓暟瓒呭嚭
-function handleExceed() {
-  proxy.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`);
-}
-
-// 涓婁紶鎴愬姛鍥炶皟
-function handleUploadSuccess(res, file) {
-  if (res.code === 200) {
-    uploadList.value.push({ name: res.fileName, url: res.fileName });
-    uploadedSuccessfully();
-  } else {
-    number.value--;
-    proxy.$modal.closeLoading();
-    proxy.$modal.msgError(res.msg);
-    proxy.$refs.imageUpload.handleRemove(file);
-    uploadedSuccessfully();
-  }
-}
-
-// 鍒犻櫎鍥剧墖
-function handleDelete(file) {
-  const findex = fileList.value.map((f) => f.name).indexOf(file.name);
-  if (findex > -1 && uploadList.value.length === number.value) {
-    fileList.value.splice(findex, 1);
-    emit("update:modelValue", listToString(fileList.value));
-    return false;
-  }
-}
-
-// 涓婁紶缁撴潫澶勭悊
-function uploadedSuccessfully() {
-  if (number.value > 0 && uploadList.value.length === number.value) {
-    fileList.value = fileList.value
-      .filter((f) => f.url !== undefined)
-      .concat(uploadList.value);
-    uploadList.value = [];
-    number.value = 0;
-    emit("update:modelValue", listToString(fileList.value));
-    proxy.$modal.closeLoading();
-  }
-}
-
-// 涓婁紶澶辫触
-function handleUploadError() {
-  proxy.$modal.msgError("涓婁紶鍥剧墖澶辫触");
-  proxy.$modal.closeLoading();
-}
-
-// 棰勮
-function handlePictureCardPreview(file) {
-  dialogImageUrl.value = file.url;
-  dialogVisible.value = true;
-}
-
-// 瀵硅薄杞垚鎸囧畾瀛楃涓插垎闅�
-function listToString(list, separator) {
-  let strs = "";
-  separator = separator || ",";
-  for (let i in list) {
-    if (undefined !== list[i].url && list[i].url.indexOf("blob:") !== 0) {
-      strs += list[i].url.replace(baseUrl, "") + separator;
-    }
-  }
-  return strs != "" ? strs.substr(0, strs.length - 1) : "";
-}
-
-// 鍒濆鍖栨嫋鎷芥帓搴�
-onMounted(() => {
-  if (props.drag) {
-    nextTick(() => {
-      const element = document.querySelector(".el-upload-list");
-      Sortable.create(element, {
-        onEnd: (evt) => {
-          const movedItem = fileList.value.splice(evt.oldIndex, 1)[0];
-          fileList.value.splice(evt.newIndex, 0, movedItem);
-          emit("update:modelValue", listToString(fileList.value));
-        },
-      });
-    });
-  }
-});
-</script>
-
-<style scoped lang="scss">
-// .el-upload--picture-card 鎺у埗鍔犲彿閮ㄥ垎
-:deep(.hide .el-upload--picture-card) {
-  display: none;
-}
-</style>
diff --git a/src/components/ProjectManagement/ProgressReportDialog.vue b/src/components/ProjectManagement/ProgressReportDialog.vue
index d9402c2..51ebdf7 100644
--- a/src/components/ProjectManagement/ProgressReportDialog.vue
+++ b/src/components/ProjectManagement/ProgressReportDialog.vue
@@ -116,18 +116,7 @@
       </el-row>
 
       <el-form-item label="闄勪欢" prop="attachmentIds">
-        <el-upload
-          v-model:file-list="fileList"
-          :action="upload.url"
-          :headers="upload.headers"
-          multiple
-          name="files"
-          :on-success="handleUploadSuccess"
-          :on-error="handleUploadError"
-          :on-remove="handleRemove"
-        >
-          <el-button type="primary">涓婁紶鏂囦欢</el-button>
-        </el-upload>
+        <FileUpload v-model:file-list="form.storageBlobDTOs" />
       </el-form-item>
     </el-form>
 
@@ -144,6 +133,7 @@
 import { computed, reactive, ref, watch } from 'vue'
 import { ElMessage } from 'element-plus'
 import { getToken } from '@/utils/auth'
+import FileUpload from "@/components/AttachmentUpload/file/index.vue";
 
 const props = defineProps({
   modelValue: { type: Boolean, default: false },
@@ -161,11 +151,6 @@
 })
 
 const formRef = ref()
-const fileList = ref([])
-const upload = reactive({
-  url: import.meta.env.VITE_APP_BASE_API + '/basic/customer-follow/upload',
-  headers: { Authorization: 'Bearer ' + getToken() }
-})
 
 const form = ref({
   planNodeId: undefined,
@@ -180,7 +165,7 @@
   managerName: '',
   departmentName: '',
   remark: '',
-  attachmentIds: []
+  storageBlobDTOs: []
 })
 
 const rules = {
@@ -217,9 +202,8 @@
     managerName: info.managerName || '',
     departmentName: info.departmentName || '',
     remark: '',
-    attachmentIds: []
+    storageBlobDTOs: []
   }
-  fileList.value = []
 }
 
 watch(
@@ -237,30 +221,6 @@
   form.value.completionProgress = 100
   form.value.totalProgress = 100
   if (!form.value.actualEndTime) form.value.actualEndTime = form.value.reportDate || ''
-}
-
-function handleUploadError() {
-  ElMessage.error('涓婁紶鏂囦欢澶辫触')
-}
-
-function handleUploadSuccess(res, file) {
-  if (res?.code !== 200) {
-    ElMessage.error(res?.msg || '涓婁紶澶辫触')
-    return
-  }
-  const attachmentId = res?.data?.id ?? res?.data?.tempId ?? ''
-  if (!attachmentId) return
-  form.value.attachmentIds.push(attachmentId)
-  try {
-    file.attachmentId = attachmentId
-  } catch (e) {}
-  ElMessage.success('涓婁紶鎴愬姛')
-}
-
-function handleRemove(file) {
-  const attachmentId = file?.attachmentId
-  if (!attachmentId) return
-  form.value.attachmentIds = (form.value.attachmentIds || []).filter(id => id !== attachmentId)
 }
 
 async function submit() {
diff --git a/src/views/collaborativeApproval/purchaseApproval/index.vue b/src/views/collaborativeApproval/purchaseApproval/index.vue
index e3680fe..fe90686 100644
--- a/src/views/collaborativeApproval/purchaseApproval/index.vue
+++ b/src/views/collaborativeApproval/purchaseApproval/index.vue
@@ -329,12 +329,12 @@
     },
   });
   const { productForm, productRules } = toRefs(productFormData);
-  const upload = reactive({
-    // 涓婁紶鐨勫湴鍧�
-    url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
-    // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-    headers: { Authorization: "Bearer " + getToken() },
-  });
+  // const upload = reactive({
+  //   // 涓婁紶鐨勫湴鍧�
+  //   url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+  //   // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+  //   headers: { Authorization: "Bearer " + getToken() },
+  // });
 
   const changeDaterange = value => {
     if (value) {
diff --git a/src/views/financialManagement/revenueManagement/index.vue b/src/views/financialManagement/revenueManagement/index.vue
index 12abfe3..820b3d9 100644
--- a/src/views/financialManagement/revenueManagement/index.vue
+++ b/src/views/financialManagement/revenueManagement/index.vue
@@ -76,6 +76,7 @@
       </PIMTable>
     </div>
     <Modal ref="modalRef" @success="getTableData"></Modal>
+    <!--  todo 闄勪欢棰勮鐩稿叧 -->
     <FileListDialog 
       ref="fileListRef" 
       v-model="fileListDialogVisible"
diff --git a/src/views/projectManagement/Management/index.vue b/src/views/projectManagement/Management/index.vue
index 1afdacb..0438aef 100644
--- a/src/views/projectManagement/Management/index.vue
+++ b/src/views/projectManagement/Management/index.vue
@@ -384,7 +384,7 @@
       actualStartTime: payload.actualStartTime || null,
       actualEndTime: payload.actualEndTime || null,
       progress: Number(payload.totalProgress ?? payload.completionProgress ?? 0) || 0,
-      attachmentIds: Array.isArray(payload.attachmentIds) ? payload.attachmentIds : []
+      storageBlobDTOs: Array.isArray(payload.storageBlobDTOs) ? payload.storageBlobDTOs : []
     }
     const res = await saveStage(req)
     if (res?.code === 200) {
diff --git a/src/views/projectManagement/Management/projectDetail.vue b/src/views/projectManagement/Management/projectDetail.vue
index c54a389..b526fc6 100644
--- a/src/views/projectManagement/Management/projectDetail.vue
+++ b/src/views/projectManagement/Management/projectDetail.vue
@@ -319,7 +319,7 @@
       actualStartTime: payload.actualStartTime || null,
       actualEndTime: payload.actualEndTime || null,
       progress: Number(payload.totalProgress ?? payload.completionProgress ?? 0) || 0,
-      attachmentIds: Array.isArray(payload.attachmentIds) ? payload.attachmentIds : []
+      storageBlobDTOs: Array.isArray(payload.storageBlobDTOs) ? payload.storageBlobDTOs : []
     }
     const res = await saveStage(req)
     if (res?.code === 200) {
diff --git a/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue b/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
index 551427a..bc1e196 100644
--- a/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
+++ b/src/views/projectManagement/projectType/components/ProjectTypeDialog.vue
@@ -29,24 +29,15 @@
             style="width: 220px"
           />
         </div>
+      </div>
+      <div class="base-info-row">
         <div class="info-item">
           <span class="item-label">闄勪欢</span>
-          <el-upload
-            v-if="isEdit"
-            :action="uploadUrl"
-            :headers="uploadHeaders"
-            :on-success="handleUploadSuccess"
-            :on-remove="handleRemove"
-            v-model:file-list="uploadFileList"
-            :limit="3"
-            name="files"
-            multiple
-          >
-            <el-button type="primary">涓婁紶闄勪欢</el-button>
-          </el-upload>
+          <FileUpload v-if="isEdit" v-model:file-list="uploadFileList" />
           <span v-else class="text-gray-400 text-sm">璇峰厛淇濆瓨鍚庡啀涓婁紶闄勪欢</span>
         </div>
       </div>
+
 
       <!-- 姝ラ閰嶇疆琛ㄦ牸 -->
        <p class="top-tip">璇锋寜鐓ч『搴忛厤缃」鐩樁娈碉紝鎷栨嫿<b>姝ラ</b>鎺掑簭鍗冲彲</p>
@@ -162,6 +153,7 @@
 import { ElMessage, ElMessageBox } from 'element-plus';
 import { getToken } from '@/utils/auth';
 import Sortable from 'sortablejs';
+import FileUpload from "@/components/AttachmentUpload/file/index.vue";
 
 const props = defineProps({
   modelValue: Boolean,
@@ -175,16 +167,12 @@
 const formRef = ref(null);
 const userOptions = ref([]);
 const isEdit = ref(false);
-const uploadHeaders = { Authorization: "Bearer " + getToken() };
-// 涓婁紶鍦板潃
-const uploadUrl = import.meta.env.VITE_APP_BASE_API + "/basic/customer-follow/upload";
 let sortable = null;
 
 const form = ref({
   id: undefined,
   name: '',
   description: '',
-  attachmentIds: [],
   savePlanNodeList: []
 });
 const uploadFileList = ref([]);
@@ -204,11 +192,9 @@
         id: props.data.id,
         name: props.data.name,
         description: props.data.description,
-        attachmentIds: Array.isArray(props.data.attachmentIds)
-          ? props.data.attachmentIds
-          : (props.data.attachmentList || []).map(f => f.id).filter(Boolean),
         savePlanNodeList: []
       };
+      uploadFileList.value = props.data.storageBlobDTOs || [];
       
       // 鍥炴樉姝ラ鑺傜偣
       if (props.data.planNodeList && props.data.planNodeList.length > 0) {
@@ -279,7 +265,6 @@
     id: undefined,
     name: '',
     description: '',
-    attachmentIds: [],
     savePlanNodeList: [createDefaultNode()]
   };
   uploadFileList.value = [];
@@ -306,29 +291,6 @@
   if (user) {
     row.leaderName = user.nickName;
   }
-}
-
-/** 澶勭悊鏂囦欢涓婁紶鎴愬姛 */
-function handleUploadSuccess(response, file, fileList) {
-  if (response.code === 200) {
-    const newFile = response.data;
-    const list = Array.isArray(newFile) ? newFile : [newFile];
-    list.forEach(element => {
-      const id = element?.id;
-      if (id && !form.value.attachmentIds.includes(id)) {
-        form.value.attachmentIds.push(id);
-      }
-    });
-  } else {
-    ElMessage.error(response.msg || '涓婁紶澶辫触');
-  }
-}
-
-/** 澶勭悊鏂囦欢绉婚櫎 */
-function handleRemove(file) {
-  const removedId = file?.id || file?.response?.data?.id;
-  if (!removedId) return;
-  form.value.attachmentIds = form.value.attachmentIds.filter(id => id !== removedId);
 }
 
 /** 娣诲姞姝ラ */
@@ -374,6 +336,7 @@
       form.value.savePlanNodeList.forEach((node, index) => {
         node.sort = index;
       });
+      form.value.storageBlobDTOs = uploadFileList.value;
       emit('submit', form.value);
     }
   } catch (error) {
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index 49965e9..12da6da 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -415,7 +415,7 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <!-- 闄勪欢鍒楄〃寮圭獥 -->
+  <!--  todo 闄勪欢棰勮鐩稿叧 -->
     <FileListDialog ref="fileListRef"
                     v-model="fileListDialogVisible"
                     :show-upload-button="true"
diff --git a/src/views/safeProduction/safeQualifications/index.vue b/src/views/safeProduction/safeQualifications/index.vue
index 4894d80..819c6da 100644
--- a/src/views/safeProduction/safeQualifications/index.vue
+++ b/src/views/safeProduction/safeQualifications/index.vue
@@ -202,7 +202,7 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <!-- 闄勪欢鍒楄〃寮圭獥 -->
+<!-- todo 闄勪欢棰勮鐩稿叧 -->
     <FileListDialog ref="fileListRef"
                     v-model="fileListDialogVisible"
                     :show-upload-button="true"
diff --git a/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue b/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue
index 02b728e..a26ef0a 100644
--- a/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue
+++ b/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue
@@ -171,26 +171,7 @@
           <el-col :span="24">
             <el-form-item label="闄勪欢鏉愭枡锛�"
                           prop="remark">
-              <el-upload v-model:file-list="fileList"
-                         :action="upload.url"
-                         multiple
-                         ref="fileUpload"
-                         auto-upload
-                         :headers="upload.headers"
-                         :before-upload="handleBeforeUpload"
-                         :on-error="handleUploadError"
-                         :on-success="handleUploadSuccess"
-                         :on-remove="handleRemove">
-                <el-button type="primary"
-                           v-if="operationType !== 'view'">涓婁紶</el-button>
-                <template #tip
-                          v-if="operationType !== 'view'">
-                  <div class="el-upload__tip">
-                    鏂囦欢鏍煎紡鏀寔
-                    doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z
-                  </div>
-                </template>
-              </el-upload>
+              <FileUpload v-model:file-list="fileList" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -222,17 +203,12 @@
   import useUserStore from "@/store/modules/user";
   import { getCurrentDate } from "@/utils/index.js";
   import log from "@/views/monitor/job/log.vue";
+  import FileUpload from "@/components/AttachmentUpload/file/index.vue";
   const userStore = useUserStore();
 
   const dialogFormVisible = ref(false);
   const operationType = ref("");
   const fileList = ref([]);
-  const upload = reactive({
-    // 涓婁紶鐨勫湴鍧�
-    url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
-    // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-    headers: { Authorization: "Bearer " + getToken() },
-  });
   const data = reactive({
     form: {
       approveTime: "",
@@ -242,7 +218,7 @@
       approveDeptName: "",
       approveReason: "",
       checkResult: "",
-      tempFileIds: [],
+      storageBlobDTOs: [],
       approverList: [], // 鏂板瀛楁锛屽瓨鍌ㄦ墍鏈夎妭鐐圭殑瀹℃壒浜篿d
       startDate: "", // 璇峰亣寮�濮嬫椂闂�
       endDate: "", // 璇峰亣缁撴潫鏃堕棿
@@ -317,8 +293,7 @@
     // 鍔犺浇閮ㄩ棬閫夐」锛屽苟鍦ㄥ姞杞藉畬鎴愬悗璁剧疆閮ㄩ棬鍚嶇О
     getProductOptions();
     if (operationType.value === "edit") {
-      fileList.value = row.commonFileList;
-      form.value.tempFileIds = fileList.value.map(file => file.id);
+      fileList.value = row.storageBlobVOs;
       currentApproveStatus.value = row.approveStatus;
       approveProcessGetInfo({ id: row.approveId, approveReason: "1" }).then(
         res => {
@@ -412,6 +387,7 @@
         return;
       }
     }
+    form.value.storageBlobDTOs = fileList.value;
     proxy.$refs.formRef.validate(valid => {
       if (valid) {
         if (operationType.value === "add" || currentApproveStatus.value == 3) {
@@ -435,47 +411,6 @@
     dialogFormVisible.value = false;
     emit("close");
   };
-
-  // 涓婁紶鍓嶆牎妫�
-  function handleBeforeUpload(file) {
-    // 鏍℃鏂囦欢澶у皬
-    // if (file.size > 1024 * 1024 * 10) {
-    //   proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
-    //   return false;
-    // }
-    proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
-    return true;
-  }
-  // 涓婁紶澶辫触
-  function handleUploadError(err) {
-    proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
-    proxy.$modal.closeLoading();
-  }
-  // 涓婁紶鎴愬姛鍥炶皟
-  function handleUploadSuccess(res, file, uploadFiles) {
-    proxy.$modal.closeLoading();
-    if (res.code === 200) {
-      // 纭繚 tempFileIds 瀛樺湪涓斾负鏁扮粍
-      if (!form.value.tempFileIds) {
-        form.value.tempFileIds = [];
-      }
-      form.value.tempFileIds.push(res.data.tempId);
-      proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
-    } else {
-      proxy.$modal.msgError(res.msg);
-      proxy.$refs.fileUpload.handleRemove(file);
-    }
-  }
-  // 绉婚櫎鏂囦欢
-  function handleRemove(file) {
-    if (operationType.value === "edit") {
-      let ids = [];
-      ids.push(file.id);
-      delLedgerFile(ids).then(res => {
-        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      });
-    }
-  }
 
   defineExpose({
     openDialog,
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index cbc35b8..b595bf6 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -358,7 +358,7 @@
         </span>
       </template>
     </el-dialog>
-    <!-- 闄勪欢鍒楄〃寮圭獥 -->
+    <!--  todo 闄勪欢棰勮鐩稿叧 -->
     <FileListDialog ref="fileListRef"
                     v-model="fileListDialogVisible"
                     :show-upload-button="true"
diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 223c6e9..8305e8b 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -313,7 +313,7 @@
       expressCompany: row.expressCompany ?? "",
       expressNumber: row.expressNumber ?? "",
     };
-    deliveryFileList.value = row.storageBlobVOS || [];
+    deliveryFileList.value = row.storageBlobVOs || [];
   }
 
   dialogFormVisible.value = true;
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 1edda61..dc648be 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -475,26 +475,7 @@
           <el-col :span="24">
             <el-form-item label="闄勪欢鏉愭枡锛�"
                           prop="salesLedgerFiles">
-              <el-upload v-model:file-list="fileList"
-                         :action="upload.url"
-                         multiple
-                         ref="fileUpload"
-                         auto-upload
-                         :headers="upload.headers"
-                         :before-upload="handleBeforeUpload"
-                         :on-error="handleUploadError"
-                         :on-success="handleUploadSuccess"
-                         :on-remove="handleRemove">
-                <el-button type="primary"
-                           v-if="operationType !== 'view'">涓婁紶</el-button>
-                <template #tip
-                          v-if="operationType !== 'view'">
-                  <div class="el-upload__tip">
-                    鏂囦欢鏍煎紡鏀寔
-                    doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z
-                  </div>
-                </template>
-              </el-upload>
+              <FileUpload v-model:file-list="fileList" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -757,6 +738,7 @@
         </template>
       </el-upload>
     </FormDialog>
+<!-- // todo 闄勪欢棰勮鐩稿叧 -->
     <!-- 闄勪欢鍒楄〃寮圭獥 -->
     <FileListDialog ref="fileListRef"
                     v-model="fileListDialogVisible"
@@ -946,6 +928,7 @@
   import { getCurrentDate } from "@/utils/index.js";
   import { useRouter, useRoute } from "vue-router";
   import { listCustomerPrivatePool } from "@/api/basicData/customerFile.js";
+  import FileUpload from "@/components/AttachmentUpload/file/index.vue";
   const router = useRouter();
   const route = useRoute();
   const userStore = useUserStore();
@@ -1042,12 +1025,6 @@
   const { productForm, productRules } = toRefs(productFormData);
   // 闃叉寰幆璁$畻鐨勬爣蹇�
   const isCalculating = ref(false);
-  const upload = reactive({
-    // 涓婁紶鐨勫湴鍧�
-    url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
-    // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-    headers: { Authorization: "Bearer " + getToken() },
-  });
   // 鎵撳嵃鐩稿叧
   const printPreviewVisible = ref(false);
   const printData = ref([]);
@@ -1409,7 +1386,7 @@
         form.value = { ...res };
         form.value.entryPerson = Number(res.entryPerson);
         productData.value = form.value.productData;
-        fileList.value = form.value.salesLedgerFiles;
+        fileList.value = form.value.storageBlobVOs;
       });
     }
     // let userAll = await userStore.getInfo()
@@ -1529,42 +1506,6 @@
   function changs(val) {
     console.log(val);
   }
-  // 涓婁紶鍓嶆牎妫�
-  function handleBeforeUpload(file) {
-    // 鏍℃鏂囦欢澶у皬
-    // if (file.size > 1024 * 1024 * 10) {
-    //   proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
-    //   return false;
-    // }
-    proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
-    return true;
-  }
-  // 涓婁紶澶辫触
-  function handleUploadError(err) {
-    proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
-    proxy.$modal.closeLoading();
-  }
-  // 涓婁紶鎴愬姛鍥炶皟
-  function handleUploadSuccess(res, file, uploadFiles) {
-    proxy.$modal.closeLoading();
-    if (res.code === 200) {
-      file.tempId = res.data.tempId;
-      proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
-    } else {
-      proxy.$modal.msgError(res.msg);
-      proxy.$refs.fileUpload.handleRemove(file);
-    }
-  }
-  // 绉婚櫎鏂囦欢
-  function handleRemove(file) {
-    if (operationType.value === "edit") {
-      let ids = [];
-      ids.push(file.id);
-      delLedgerFile(ids).then(res => {
-        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      });
-    }
-  }
   // 鎻愪氦琛ㄥ崟
   const submitForm = () => {
     proxy.$refs["formRef"].validate(valid => {
@@ -1576,11 +1517,7 @@
           proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
           return;
         }
-        let tempFileIds = [];
-        if (fileList.value !== null && fileList.value.length > 0) {
-          tempFileIds = fileList.value.map(item => item.tempId);
-        }
-        form.value.tempFileIds = tempFileIds;
+        form.value.storageBlobDTOs = fileList;
         form.value.type = 1;
         addOrUpdateSalesLedger(form.value).then(res => {
           proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");

--
Gitblit v1.9.3