+
无
@@ -146,7 +150,7 @@
-
+
@@ -405,6 +409,7 @@ const updateSupport = ref(false);
const importFile = ref(null);
const additionPreviewMap = ref({});
const additionPreviewLoading = ref({});
+const imagePreviewMap = ref({});
const manualOpen = ref(false);
const manualLoading = ref(false);
const manualFiles = ref([]);
@@ -430,7 +435,7 @@ const formatterTime = (time) => {
return proxy.parseTime(time, '{y}-{m}-{d}')
}
-const productTypeLabel = (val) => (val === 'semi' ? '半成品' : '产品');
+const productTypeLabel = (val) => (val === 'semi' ? '半成品' : '成品');
const productTypeTagType = (val) => (val === 'semi' ? 'warning' : 'success');
const data = reactive({
@@ -471,6 +476,7 @@ function getList() {
productList.value = response.rows;
total.value = response.total;
prefetchAdditions(productList.value);
+ prefetchImages(productList.value);
loading.value = false;
});
}
@@ -549,11 +555,28 @@ function handleUpdate(row) {
// 处理图片文件列表
if (form.value.productImages) {
- imageFileList.value = form.value.productImages.split(',').map((url, index) => ({
- name: url.substring(url.lastIndexOf('/') + 1),
- url: url,
- uid: Date.now() + index
- }));
+ const raw = String(form.value.productImages).trim();
+ if (isOssIdList(raw)) {
+ listByIds(raw).then(res => {
+ const list = res?.data || [];
+ const urls = list.map(oss => oss?.url).filter(Boolean);
+ form.value.productImages = urls.join(',');
+ imageFileList.value = urls.map((url, index) => ({
+ name: getFileNameFromUrl(url),
+ url,
+ uid: Date.now() + index
+ }));
+ }).catch(() => {
+ imageFileList.value = [];
+ });
+ } else {
+ const urls = raw.split(',').map(s => String(s).trim()).filter(Boolean);
+ imageFileList.value = urls.map((url, index) => ({
+ name: getFileNameFromUrl(url),
+ url,
+ uid: Date.now() + index
+ }));
+ }
} else {
imageFileList.value = [];
}
@@ -884,6 +907,59 @@ function prefetchAdditions(list) {
}).catch(() => {});
}
+function normalizeImageUrlList(raw) {
+ const str = raw == null ? '' : String(raw).trim();
+ if (!str) return [];
+ if (isOssIdList(str)) return [];
+ return str
+ .split(',')
+ .map(s => String(s).trim())
+ .filter(Boolean)
+ .filter(u => /^https?:\/\//i.test(u) || u.startsWith('/') || u.startsWith('data:'));
+}
+
+function imageUrls(row) {
+ const key = row?.productId != null ? String(row.productId) : '';
+ const cached = key ? imagePreviewMap.value[key] : null;
+ if (Array.isArray(cached)) return cached;
+ return normalizeImageUrlList(row?.productImages);
+}
+
+function prefetchImages(list) {
+ const rows = Array.isArray(list) ? list : [];
+ const targets = rows
+ .map(r => ({ productId: r?.productId, raw: String(r?.productImages || '').trim() }))
+ .filter(x => x.productId != null && x.raw && isOssIdList(x.raw));
+ if (!targets.length) return;
+ const idSet = new Set();
+ for (const it of targets) {
+ const ids = it.raw.split(',').map(s => String(s).trim()).filter(Boolean);
+ for (const id of ids) idSet.add(id);
+ }
+ const all = Array.from(idSet);
+ if (!all.length) return;
+ listByIds(all.join(',')).then(res => {
+ const list = res?.data || [];
+ const map = {};
+ for (const oss of list) {
+ if (oss?.ossId != null && oss?.url) {
+ map[String(oss.ossId)] = oss.url;
+ }
+ }
+ const next = { ...imagePreviewMap.value };
+ for (const it of targets) {
+ const urls = it.raw
+ .split(',')
+ .map(s => String(s).trim())
+ .filter(Boolean)
+ .map(id => map[String(id)])
+ .filter(Boolean);
+ next[String(it.productId)] = urls;
+ }
+ imagePreviewMap.value = next;
+ }).catch(() => {});
+}
+
function pdfCount(row) {
const raw = String(row?.productPdfs || '').trim();
if (!raw) return 0;
@@ -1092,6 +1168,18 @@ getList();
gap: 6px;
}
+.image-error {
+ width: 32px;
+ height: 32px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #f5f7fa;
+ color: #c0c4cc;
+ border-radius: 2px;
+ font-size: 12px;
+}
+
:deep(.el-table .el-table__cell) {
padding-top: 8px;
padding-bottom: 8px;
diff --git a/gear-ui3/src/views/mat/productOutsource/index.vue b/gear-ui3/src/views/mat/productOutsource/index.vue
index e03f5b9..6962e14 100644
--- a/gear-ui3/src/views/mat/productOutsource/index.vue
+++ b/gear-ui3/src/views/mat/productOutsource/index.vue
@@ -74,13 +74,13 @@
{{ formatDecimal(scope.row.receivedQty) }}
-
+
{{ formatterTime(scope.row.outTime) }}
@@ -90,7 +90,7 @@
- 收回
+
撤回
@@ -149,7 +149,7 @@
-
+