From 39f51cb984ac3ecd77f541ee7f73a75771109e65 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 24 四月 2026 11:06:51 +0800
Subject: [PATCH] 对库存管理视图进行重构,以支持动态产品类别和型号,并提升库存检索功能
---
src/views/salesManagement/deliveryLedger/index.vue | 52 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 2b1b0b0..7e96f23 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -36,6 +36,7 @@
<el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip />
<el-table-column label="浜у搧鍚嶇О" prop="productName" show-overflow-tooltip />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
+ <el-table-column label="鍘氬害(mm)" prop="thickness" show-overflow-tooltip />
<el-table-column label="鍙戣揣鏃堕棿" prop="shippingDate" show-overflow-tooltip />
<el-table-column label="鍙戣揣杞︾墝鍙�" prop="shippingCarNumber" show-overflow-tooltip />
<el-table-column label="蹇�掑叕鍙�" prop="expressCompany" show-overflow-tooltip />
@@ -47,24 +48,22 @@
</el-tag>
</template>
</el-table-column>
- <el-table-column fixed="right" label="鎿嶄綔" width="200" align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" width="220" align="center">
<template #default="scope">
<el-button
link
- type="primary"
- size="small"
+ type="primary"
:disabled="!isApproved(scope.row.status)"
@click="openForm('edit', scope.row)">琛ュ厖鍙戣揣淇℃伅</el-button>
<el-button
link
type="primary"
- size="small"
+ style="color: #67C23A"
@click="openDetail(scope.row)"
>璇︽儏</el-button>
<el-button
link
- type="danger"
- size="small"
+ type="danger"
:disabled="isApproving(scope.row.status)"
@click="handleDeleteSingle(scope.row)">鍒犻櫎</el-button>
</template>
@@ -246,20 +245,37 @@
const detailRow = ref(null);
const detailImages = ref([]);
+const getFileAccessUrl = (file = {}) => {
+ if (file?.link) {
+ if (String(file.link).startsWith('http')) return file.link;
+ return normalizeFileUrl(file.link);
+ }
+ return normalizeFileUrl(file?.url || '');
+};
+
const normalizeFileUrl = (rawUrl = '') => {
let fileUrl = rawUrl || '';
- // Windows 璺緞杞� URL
+
if (fileUrl && fileUrl.indexOf('\\') > -1) {
- const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
- if (uploadsIndex > -1) {
- const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
- fileUrl = '/' + relativePath;
- } else {
- const parts = fileUrl.split('\\');
- const fileName = parts[parts.length - 1];
- fileUrl = '/uploads/' + fileName;
- }
+ fileUrl = fileUrl.replace(/\\/g, '/');
}
+
+ const lowerPath = fileUrl.toLowerCase();
+
+ const uploadPathIndex = lowerPath.indexOf('/uploadpath/');
+ if (uploadPathIndex > -1) {
+ fileUrl = '/profile' + fileUrl.substring(uploadPathIndex + '/uploadpath'.length);
+ }
+
+ const fileRootIndex = fileUrl.toLowerCase().indexOf('/file/');
+ if (!fileUrl.startsWith('/profile/') && fileRootIndex > -1) {
+ fileUrl = '/profile' + fileUrl.substring(fileRootIndex + '/file'.length);
+ }
+
+ if (!fileUrl.startsWith('http') && fileUrl.toLowerCase().startsWith('profile/')) {
+ fileUrl = '/' + fileUrl;
+ }
+
if (fileUrl && !fileUrl.startsWith('http')) {
if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
fileUrl = javaApi + fileUrl;
@@ -379,7 +395,7 @@
// 濡傛灉鏈夊浘鐗囷紝灏� commonFileList 杞崲涓烘枃浠跺垪琛ㄦ牸寮�
if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
deliveryFileList.value = row.commonFileList.map((file, index) => {
- const fileUrl = normalizeFileUrl(file.url || '');
+ const fileUrl = getFileAccessUrl(file);
return {
uid: file.id || Date.now() + index,
@@ -421,7 +437,7 @@
detailRow.value = row || null;
const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
detailImages.value = list
- .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
+ .map((f) => ({ url: getFileAccessUrl(f) }))
.filter((i) => !!i.url);
detailDialogVisible.value = true;
};
--
Gitblit v1.9.3