|
@@ -79,7 +79,7 @@
|
|
|
ref="planTable"
|
|
ref="planTable"
|
|
|
:columns="columns"
|
|
:columns="columns"
|
|
|
:cache-key="planTableCacheKey"
|
|
:cache-key="planTableCacheKey"
|
|
|
- :datasource="planDataList"
|
|
|
|
|
|
|
+ :datasource="sortedPlanDataList"
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
:selection.sync="selection"
|
|
:selection.sync="selection"
|
|
|
:height="planTableHeight"
|
|
:height="planTableHeight"
|
|
@@ -263,6 +263,7 @@
|
|
|
savePlanDotLine
|
|
savePlanDotLine
|
|
|
} from '@/api/productionPlan/planDotLine';
|
|
} from '@/api/productionPlan/planDotLine';
|
|
|
import { deepClone } from '@/utils';
|
|
import { deepClone } from '@/utils';
|
|
|
|
|
+ import { compareBatchNo } from '@/utils/batchNoSort';
|
|
|
import {
|
|
import {
|
|
|
EXEC_TYPE,
|
|
EXEC_TYPE,
|
|
|
EXEC_TYPE_OPTIONS,
|
|
EXEC_TYPE_OPTIONS,
|
|
@@ -441,6 +442,20 @@
|
|
|
? 'aps-team-scheduling-work-order-table'
|
|
? 'aps-team-scheduling-work-order-table'
|
|
|
: 'aps-factory-scheduling-plan-table';
|
|
: 'aps-factory-scheduling-plan-table';
|
|
|
},
|
|
},
|
|
|
|
|
+ // 不论 planDataList 由哪条路径赋值,最终给表格用的数据都按 batchNo 排序:
|
|
|
|
|
+ // 基础号相同的,"20260914-1" 这类带 "-N" 后缀的按数字升序排在基础号之后
|
|
|
|
|
+ sortedPlanDataList() {
|
|
|
|
|
+ if (!Array.isArray(this.planDataList)) {
|
|
|
|
|
+ return this.planDataList;
|
|
|
|
|
+ }
|
|
|
|
|
+ return [...this.planDataList].sort((a, b) =>
|
|
|
|
|
+ compareBatchNo(a?.batchNo, b?.batchNo)
|
|
|
|
|
+ ).sort((a, b) =>{
|
|
|
|
|
+ const startTimeA = new Date(a?.startTime || 0).getTime();
|
|
|
|
|
+ const startTimeB = new Date(b?.startTime || 0).getTime();
|
|
|
|
|
+ return startTimeB - startTimeA
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
cacheKeyUrl() {
|
|
cacheKeyUrl() {
|
|
|
return this.planTableCacheKey;
|
|
return this.planTableCacheKey;
|
|
|
},
|
|
},
|
|
@@ -1162,6 +1177,13 @@
|
|
|
);
|
|
);
|
|
|
const list = Array.isArray(data?.list) ? data.list : [];
|
|
const list = Array.isArray(data?.list) ? data.list : [];
|
|
|
return [...list].sort((a, b) => {
|
|
return [...list].sort((a, b) => {
|
|
|
|
|
+ // 主排序:按 batchNo 排序,基础号相同的把 "20260914-1" 这类
|
|
|
|
|
+ // 带 "-N" 后缀的按数字升序排在 "20260914" 基础号之后
|
|
|
|
|
+ const batchCompare = compareBatchNo(a?.batchNo, b?.batchNo);
|
|
|
|
|
+ if (batchCompare !== 0) {
|
|
|
|
|
+ return batchCompare;
|
|
|
|
|
+ }
|
|
|
|
|
+ // batchNo 相同时,兜底使用原始 ID 入参顺序
|
|
|
const aIndex = orderMap.get(String(a?.id ?? ''));
|
|
const aIndex = orderMap.get(String(a?.id ?? ''));
|
|
|
const bIndex = orderMap.get(String(b?.id ?? ''));
|
|
const bIndex = orderMap.get(String(b?.id ?? ''));
|
|
|
return (
|
|
return (
|
|
@@ -1180,7 +1202,12 @@
|
|
|
.map((item) => this.getPlanRowKey(item))
|
|
.map((item) => this.getPlanRowKey(item))
|
|
|
.filter((item) => item !== '')
|
|
.filter((item) => item !== '')
|
|
|
);
|
|
);
|
|
|
- return sourceList
|
|
|
|
|
|
|
+ // 按 batchNo 排序:基础号相同的,"20260914-1" 这类带 "-N" 后缀的
|
|
|
|
|
+ // 按数字升序排在 "20260914" 基础号之后
|
|
|
|
|
+ const sortedSourceList = [...sourceList].sort((a, b) =>
|
|
|
|
|
+ compareBatchNo(a?.batchNo, b?.batchNo)
|
|
|
|
|
+ );
|
|
|
|
|
+ return sortedSourceList
|
|
|
.filter((item) => selectedKeySet.has(this.getPlanRowKey(item)))
|
|
.filter((item) => selectedKeySet.has(this.getPlanRowKey(item)))
|
|
|
.map((item, index) => ({
|
|
.map((item, index) => ({
|
|
|
...deepClone(item),
|
|
...deepClone(item),
|
|
@@ -1188,7 +1215,12 @@
|
|
|
}));
|
|
}));
|
|
|
},
|
|
},
|
|
|
buildWorkOrderTableRows(rows = []) {
|
|
buildWorkOrderTableRows(rows = []) {
|
|
|
- return (rows || []).map((item, index) => ({
|
|
|
|
|
|
|
+ // 按 batchNo 排序:基础号相同的,"20260914-1" 这类带 "-N" 后缀的
|
|
|
|
|
+ // 按数字升序排在 "20260914" 基础号之后
|
|
|
|
|
+ const sortedRows = [...(rows || [])].sort((a, b) =>
|
|
|
|
|
+ compareBatchNo(a?.batchNo, b?.batchNo)
|
|
|
|
|
+ );
|
|
|
|
|
+ return sortedRows.map((item, index) => ({
|
|
|
...deepClone(item),
|
|
...deepClone(item),
|
|
|
id: item.id ?? item.code ?? `work-order-${index}`,
|
|
id: item.id ?? item.code ?? `work-order-${index}`,
|
|
|
serialNumber: index + 1
|
|
serialNumber: index + 1
|