From 4955996ab044bc275ac78da3543b9d9f5ad7f8d9 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期五, 12 十二月 2025 16:21:26 +0800
Subject: [PATCH] 提交浏览发货信息
---
north-glass-erp/northglass-erp/src/components/BasicTable.vue | 73 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/components/BasicTable.vue b/north-glass-erp/northglass-erp/src/components/BasicTable.vue
index 8f846f1..3318e50 100644
--- a/north-glass-erp/northglass-erp/src/components/BasicTable.vue
+++ b/north-glass-erp/northglass-erp/src/components/BasicTable.vue
@@ -130,6 +130,71 @@
return count.toFixed(2)
}
+//鍚堝苟鏄剧ず鍏朵粬鍒�
+const handleDynamicColumns = (data,title) => {
+ // 1. 鏀堕泦鎵�鏈夎鐨刼therColumns瀛楁锛堝幓閲嶏級
+ const allOtherFields = new Set();
+ data.forEach(row => {
+ if (!row || !row.otherColumns) return;
+
+ let parsedOtherColumns;
+ try {
+ // 鏍稿績锛氬皢瀛楃涓茶В鏋愪负JSON
+ parsedOtherColumns = JSON.parse(row.otherColumns);
+ } catch (e) {
+ console.error('瑙f瀽otherColumns澶辫触锛�', e, '鍘熷鏁版嵁锛�', row.otherColumns);
+ return;
+ }
+
+ // 2. 浠庤В鏋愬悗鐨凧SON涓敹闆嗗瓧娈碉紙鏀寔鏁扮粍鎴栧璞℃牸寮忥級
+ if (Array.isArray(parsedOtherColumns)) {
+ // 鏁扮粍鏍煎紡锛歔{ key: 'field1', label: '瀛楁1', value: '鍊�1' }, ...]
+ parsedOtherColumns.forEach(item => {
+ if (item.key) allOtherFields.add(item.key);
+ });
+ } else if (typeof parsedOtherColumns === 'object' && parsedOtherColumns !== null) {
+ // 瀵硅薄鏍煎紡锛歿 field1: { label: '瀛楁1', value: '鍊�1' }, ... }
+ Object.keys(parsedOtherColumns).forEach(key => {
+ allOtherFields.add(key);
+ });
+ }
+ });
+
+ // 2. 鐢熸垚鍔ㄦ�佸瓙鍒楋紙浣滀负processList鐨刢hildren锛�
+ const otherColumns = Array.from(allOtherFields).map(field => {
+ // 灏濊瘯鑾峰彇瀛楁瀵瑰簲鐨刲abel锛堜紭鍏堝彇绗竴涓嚭鐜扮殑label锛�
+ let label=field;
+ title.forEach(item=>{
+ if(field==item.column){
+ label=item.alias
+ }
+ })
+ return {
+ title: label,
+ field: `otherColumnsJson.${field}`,
+ width: 120,
+ align: 'center',
+ // 澶勭悊瀛楁鍊兼樉绀猴紙鍏煎鏁扮粍/瀵硅薄绫诲瀷鐨刼therColumns锛�
+ formatter: ({ row }) => {
+ return row.otherColumnsJson?.[field] || '';
+
+ }
+ };
+ });
+
+ // 3. 瀹氫箟鐖剁骇鍒梡rocessList锛屽寘鍚姩鎬佸瓙鍒�
+ const processList = {
+ title: t('鍏朵粬鍒�'),
+ field: 'process',
+ children: otherColumns // 灏嗗姩鎬佸垪浣滀负瀛愬垪
+ };
+
+ // 4. 鍏堢Щ闄ゅ凡瀛樺湪鐨刾rocess鍒楋紙閬垮厤閲嶅锛夛紝鍐嶆坊鍔犳柊鍒�
+ gridOptions.columns = gridOptions.columns.filter(col => col.field !== 'process');
+ gridOptions.columns.push(processList);
+}
+
+
watch(props, (newVal) => {
@@ -180,6 +245,12 @@
basicProp.value.pageTotal = res.data.total.pageTotal
basicProp.value.dataTotal = res.data.total.total
orderInfo.reportFormDate = res.data.selectDate
+
+ //璁㈠崟鏄庣粏鎶ヨ〃
+ if (props.childrenData.url === '/order/getOrderReport') {
+ const dataList = res.data.data || [];
+ handleDynamicColumns(dataList,res.data.title)
+ }
}
})
return
@@ -190,6 +261,8 @@
basicProp.value.pageTotal = res.data.total.pageTotal
basicProp.value.dataTotal = res.data.total.total
orderInfo.reportFormDate = res.data.selectDate
+
+
}
})
}
--
Gitblit v1.8.0