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/salesManagement/salesLedger/index.vue | 73 ++----------------------------------
1 files changed, 5 insertions(+), 68 deletions(-)
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