@gct-paas/word 0.1.64 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/data/DataManager.d.ts +5 -2
- package/dist/core/data/paths/subtable-path.d.ts +2 -1
- package/dist/core/data/subtable/row.d.ts +2 -6
- package/dist/core/layout/LayoutContext.d.ts +0 -2
- package/dist/domain/table/business/material/types.d.ts +2 -0
- package/dist/domain/table/runtime/engines/row-runtime-engine.d.ts +1 -1
- package/dist/domain/table/runtime/table-runtime-context.d.ts +15 -5
- package/dist/index.es.js +185 -138
- package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts +5 -3
- package/dist/runtime/canvas/table/render/material-consume/service.d.ts +1 -1
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/autofill-runtime.d.ts +3 -1
- package/dist/word.css +18 -18
- package/package.json +1 -1
|
@@ -74,6 +74,11 @@ export declare class DataManager {
|
|
|
74
74
|
private shiftFieldRuntimeConfigAfterRowInsert;
|
|
75
75
|
/** 子表删行后:移除该行配置,其后行配置下标 -1 */
|
|
76
76
|
private shiftFieldRuntimeConfigAfterRowRemove;
|
|
77
|
+
private getSubFieldConfigMap;
|
|
78
|
+
/** 插行后同步 _subFieldConfig 下标 +1 */
|
|
79
|
+
private shiftSubFieldConfigAfterRowInsert;
|
|
80
|
+
/** 硬删后同步 _subFieldConfig:删该行并对其后行 -1 */
|
|
81
|
+
private shiftSubFieldConfigAfterRowRemove;
|
|
77
82
|
private parseSubtableFieldPath;
|
|
78
83
|
/** 收集 depGraph 中所有 DepNode(按 key 去重) */
|
|
79
84
|
private collectDepNodes;
|
|
@@ -110,8 +115,6 @@ export declare class DataManager {
|
|
|
110
115
|
* 检验表纵向轴配置只进 defaults,rawData 可能尚未物化多行。
|
|
111
116
|
*/
|
|
112
117
|
countDefaultsIndexedRows(subFieldKey: string): number;
|
|
113
|
-
/** 版面可见行下标 → rawData 数组实际下标 */
|
|
114
|
-
resolveSubtableVisibleIndex(arrayPath: JsonPath, visibleIndex: number): number;
|
|
115
118
|
private assignField;
|
|
116
119
|
/**
|
|
117
120
|
* 根据 jsonpath 设置数据
|
|
@@ -26,10 +26,11 @@ export type BusinessFieldChange = {
|
|
|
26
26
|
export declare function parseSubtableFieldPath(path: string): SubtableFieldPath | null;
|
|
27
27
|
/** 统一解析数据路径,区分主表 / 子表字段变更结构 */
|
|
28
28
|
export declare function parseBusinessFieldChange(changedPath: string): BusinessFieldChange | null;
|
|
29
|
-
/** 子表在 rawData
|
|
29
|
+
/** 子表在 rawData 中的未软删行数(含接口 { data: [] } 形态,未转数组时返回 0) */
|
|
30
30
|
export declare function countSubTableDataRows(rawData: Record<string, unknown>, subFieldKey: string): number;
|
|
31
31
|
/** 子表应展开的行数:已有数据行与版面槽位取较大值(动态表无数据时至少 1 行) */
|
|
32
32
|
export declare function resolveSubTableRowCount(doc: Doc | undefined, subFieldKey: string, rawData: Record<string, unknown>): number;
|
|
33
|
+
/** 返回应参与展开的存储下标;有数据时跳过 deleted_,指定 rowIndexes 时原样返回 */
|
|
33
34
|
export declare function resolveSubTableRowIndexes(doc: Doc | undefined, subFieldKey: string, rawData: Record<string, unknown>, rowIndexes?: number[]): number[];
|
|
34
35
|
export declare function mapTemplateToRowPaths(templatePath: string, rowIndexes: number[]): string[];
|
|
35
36
|
interface ExpandSubTableWidgetPathsOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** 子表行软删(与后端 deleted_ 约定一致;活跃行密排在前、软删行仅在后缀) */
|
|
2
2
|
export type AxisType = 'x' | 'y';
|
|
3
3
|
type PersistedSubtableRowContext = {
|
|
4
4
|
rawData?: Record<string, any>;
|
|
@@ -6,14 +6,10 @@ type PersistedSubtableRowContext = {
|
|
|
6
6
|
tableKey?: string;
|
|
7
7
|
axis?: AxisType;
|
|
8
8
|
};
|
|
9
|
-
/** 是否应软删(打 deleted_
|
|
9
|
+
/** 是否应软删(打 deleted_ 并移到后缀)而非物理删除 */
|
|
10
10
|
export declare function isPersistedSubtableRow(row: Record<string, any> | undefined | null, ctx?: PersistedSubtableRowContext): boolean;
|
|
11
11
|
/** 未软删的行数;空数组返回 0 */
|
|
12
12
|
export declare function countActiveSubtableRows(rows: unknown): number;
|
|
13
|
-
/** 版面可见行下标 → rawData 数组中的实际下标 */
|
|
14
|
-
export declare function resolveSubtableStorageIndex(rows: any[], visibleIndex: number): number;
|
|
15
|
-
/** 在可见下标处插入时对应的 splice 位置 */
|
|
16
|
-
export declare function resolveSubtableInsertIndex(rows: any[], visibleIndex: number): number;
|
|
17
13
|
/** 按字段列表拼接行分组/合并 key,空值视为 '' */
|
|
18
14
|
export declare function buildRowGroupKey(row: Record<string, unknown>, fieldKeys: readonly string[], separator?: string): string;
|
|
19
15
|
export {};
|
|
@@ -48,8 +48,6 @@ export declare class LayoutContext {
|
|
|
48
48
|
*/
|
|
49
49
|
getParagraphRemainingSize(): number;
|
|
50
50
|
addRun(run: LayoutNode): void;
|
|
51
|
-
/** 子表可见行下标 → rawData 存储下标(跳过 deleted_ 行) */
|
|
52
|
-
private mapSubtableVisibleIndex;
|
|
53
51
|
/**
|
|
54
52
|
* 根据 dataIndex 替换 path 中的 [n] 为实际值
|
|
55
53
|
* @param path 包含 [n] 的路径,如 "$.items[n].name"
|
|
@@ -7,7 +7,7 @@ export declare class RowRuntimeEngine {
|
|
|
7
7
|
hasRowInit(ctx: TableRuntimeContext): boolean;
|
|
8
8
|
/** 对单行执行行初始化 */
|
|
9
9
|
applyRowInit(ctx: TableRuntimeContext, rowIndex: number, rowSource?: string): void;
|
|
10
|
-
/**
|
|
10
|
+
/** 初始化时对所有未软删行执行行初始化 */
|
|
11
11
|
applyRowInitForAllRows(ctx: TableRuntimeContext): void;
|
|
12
12
|
/** 字段变更时执行 when=onFieldChange 的行处理器(按 watch 过滤) */
|
|
13
13
|
applyRowHandlersOnFieldChange(ctx: TableRuntimeContext, change: SubtableFieldPath, fieldChange?: FieldChangeDetail): void;
|
|
@@ -20,15 +20,25 @@ export declare class TableRuntimeContext {
|
|
|
20
20
|
get refModelType(): string;
|
|
21
21
|
/** 子表数组路径 $.subFieldKey */
|
|
22
22
|
get arrayPath(): string;
|
|
23
|
-
/** 指定行路径 $.subFieldKey[rowIndex] */
|
|
23
|
+
/** 指定行路径 $.subFieldKey[rowIndex];rowIndex 为存储下标 */
|
|
24
24
|
rowPath(rowIndex: number): string;
|
|
25
|
-
/**
|
|
25
|
+
/** 读取指定行数据;rowIndex 为存储下标 */
|
|
26
26
|
getRow(rowIndex: number): Record<string, unknown> | undefined;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* 子表存储行数(含软删),无数据默认返回 1
|
|
29
|
+
*/
|
|
28
30
|
getRowCount(): number;
|
|
29
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* 未软删行的存储下标。无数据时返回 [0](与版面默认空行一致);
|
|
33
|
+
* 仅剩软删行时返回 []。
|
|
34
|
+
*/
|
|
35
|
+
getActiveRowIndexes(): number[];
|
|
36
|
+
/** 构建单行规则执行上下文;rowIndex 为存储下标 */
|
|
30
37
|
buildRuleContext(rowIndex: number, changedFieldKey?: string): RuleContext;
|
|
31
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* 遍历子表数据行,支持指定单行或全量遍历,逐行注入 RuleContext。
|
|
40
|
+
* rowIndex / 全量遍历均使用存储下标;全量时跳过 deleted_ 行。
|
|
41
|
+
*/
|
|
32
42
|
eachRow(options: EachRowOptions, iteratee: (ctx: RuleContext) => void): void;
|
|
33
43
|
/** 在子表字段配置列表中查找指定字段配置(支持 match.fieldKey 为数组) */
|
|
34
44
|
findFieldProfile(fieldKey: string): BusinessFieldProfile | undefined;
|
package/dist/index.es.js
CHANGED
|
@@ -84171,7 +84171,7 @@ async function applyAutofillOnSubTableRowInit(doc, subFieldKey, rowIndex, fetchS
|
|
|
84171
84171
|
if (!bindings.length) return;
|
|
84172
84172
|
const updates = await buildAutofillUpdatesFromBindings(doc, bindings, {
|
|
84173
84173
|
rawData: doc.dataManager.getRawData(),
|
|
84174
|
-
rowIndexes: [
|
|
84174
|
+
rowIndexes: [rowIndex],
|
|
84175
84175
|
fetchSource
|
|
84176
84176
|
});
|
|
84177
84177
|
if (Object.keys(updates).length) {
|
|
@@ -85085,31 +85085,13 @@ function countActiveSubtableRows(rows) {
|
|
|
85085
85085
|
if (!Array.isArray(rows)) return 0;
|
|
85086
85086
|
return rows.filter((row) => !row?.deleted_).length;
|
|
85087
85087
|
}
|
|
85088
|
-
function resolveSubtableStorageIndex(rows, visibleIndex) {
|
|
85089
|
-
if (!Array.isArray(rows) || visibleIndex < 0) return visibleIndex;
|
|
85090
|
-
let seen = -1;
|
|
85091
|
-
for (let i = 0; i < rows.length; i++) {
|
|
85092
|
-
if (!rows[i]?.deleted_) {
|
|
85093
|
-
seen++;
|
|
85094
|
-
if (seen === visibleIndex) return i;
|
|
85095
|
-
}
|
|
85096
|
-
}
|
|
85097
|
-
return visibleIndex;
|
|
85098
|
-
}
|
|
85099
|
-
function resolveSubtableInsertIndex(rows, visibleIndex) {
|
|
85100
|
-
if (!Array.isArray(rows)) return 0;
|
|
85101
|
-
let seen = -1;
|
|
85102
|
-
for (let i = 0; i < rows.length; i++) {
|
|
85103
|
-
if (!rows[i]?.deleted_) {
|
|
85104
|
-
seen++;
|
|
85105
|
-
if (seen === visibleIndex) return i;
|
|
85106
|
-
}
|
|
85107
|
-
}
|
|
85108
|
-
return rows.length;
|
|
85109
|
-
}
|
|
85110
85088
|
function buildRowGroupKey(row, fieldKeys, separator = "|") {
|
|
85111
85089
|
return fieldKeys.map((key) => String(row[key] ?? "")).join(separator);
|
|
85112
85090
|
}
|
|
85091
|
+
function activeRowIndexes(rows) {
|
|
85092
|
+
const count = countActiveSubtableRows(rows);
|
|
85093
|
+
return Array.from({ length: count }, (_2, index2) => index2);
|
|
85094
|
+
}
|
|
85113
85095
|
function expandInitPathTemplates(templatePath, rawData) {
|
|
85114
85096
|
const parsed = parseValuePath(templatePath);
|
|
85115
85097
|
const hasCrossPlaceholder = templatePath.includes("[n_y]") || templatePath.includes("[n_x]");
|
|
@@ -85117,11 +85099,11 @@ function expandInitPathTemplates(templatePath, rawData) {
|
|
|
85117
85099
|
if (hasCrossPlaceholder) {
|
|
85118
85100
|
const yKey = parsed.parentFieldKey || "";
|
|
85119
85101
|
const xKey = parsed.linkFieldKey || "";
|
|
85120
|
-
const
|
|
85121
|
-
const
|
|
85102
|
+
const yIndexes = activeRowIndexes(get(rawData, yKey));
|
|
85103
|
+
const xIndexes = activeRowIndexes(get(rawData, xKey));
|
|
85122
85104
|
const paths = [];
|
|
85123
|
-
for (
|
|
85124
|
-
for (
|
|
85105
|
+
for (const y2 of yIndexes) {
|
|
85106
|
+
for (const x2 of xIndexes) {
|
|
85125
85107
|
paths.push(replacePathIndexPlaceholders({ templatePath, y: y2, x: x2, n: y2 }));
|
|
85126
85108
|
}
|
|
85127
85109
|
}
|
|
@@ -85129,12 +85111,9 @@ function expandInitPathTemplates(templatePath, rawData) {
|
|
|
85129
85111
|
}
|
|
85130
85112
|
if (hasSinglePlaceholder) {
|
|
85131
85113
|
const tableKey = parsed.parentFieldKey || "";
|
|
85132
|
-
|
|
85133
|
-
|
|
85134
|
-
|
|
85135
|
-
paths.push(replacePathIndexPlaceholders({ templatePath, n: i, y: i, x: i }));
|
|
85136
|
-
}
|
|
85137
|
-
return paths;
|
|
85114
|
+
return activeRowIndexes(get(rawData, tableKey)).map(
|
|
85115
|
+
(i) => replacePathIndexPlaceholders({ templatePath, n: i, y: i, x: i })
|
|
85116
|
+
);
|
|
85138
85117
|
}
|
|
85139
85118
|
return [templatePath];
|
|
85140
85119
|
}
|
|
@@ -85172,9 +85151,9 @@ function parseBusinessFieldChange(changedPath) {
|
|
|
85172
85151
|
}
|
|
85173
85152
|
function countSubTableDataRows(rawData, subFieldKey) {
|
|
85174
85153
|
const existing = get(rawData, subFieldKey);
|
|
85175
|
-
if (Array.isArray(existing)) return existing
|
|
85154
|
+
if (Array.isArray(existing)) return countActiveSubtableRows(existing);
|
|
85176
85155
|
if (existing && typeof existing === "object" && Array.isArray(existing.data)) {
|
|
85177
|
-
return existing.data
|
|
85156
|
+
return countActiveSubtableRows(existing.data);
|
|
85178
85157
|
}
|
|
85179
85158
|
return 0;
|
|
85180
85159
|
}
|
|
@@ -85185,6 +85164,18 @@ function resolveSubTableRowCount(doc, subFieldKey, rawData) {
|
|
|
85185
85164
|
}
|
|
85186
85165
|
function resolveSubTableRowIndexes(doc, subFieldKey, rawData, rowIndexes) {
|
|
85187
85166
|
if (rowIndexes?.length) return rowIndexes;
|
|
85167
|
+
const existing = get(rawData, subFieldKey);
|
|
85168
|
+
if (Array.isArray(existing) && existing.length > 0) {
|
|
85169
|
+
const count2 = countActiveSubtableRows(existing);
|
|
85170
|
+
return Array.from({ length: count2 }, (_2, index2) => index2);
|
|
85171
|
+
}
|
|
85172
|
+
if (existing && typeof existing === "object" && Array.isArray(existing.data)) {
|
|
85173
|
+
const data = existing.data;
|
|
85174
|
+
if (data.length > 0) {
|
|
85175
|
+
const count2 = countActiveSubtableRows(data);
|
|
85176
|
+
return Array.from({ length: count2 }, (_2, index2) => index2);
|
|
85177
|
+
}
|
|
85178
|
+
}
|
|
85188
85179
|
const count = resolveSubTableRowCount(doc, subFieldKey, rawData);
|
|
85189
85180
|
return Array.from({ length: count }, (_2, index2) => index2);
|
|
85190
85181
|
}
|
|
@@ -85429,6 +85420,51 @@ class DataManager {
|
|
|
85429
85420
|
this.doc?.eventManager?.eventBus.emit("field-runtime-config-changed", { path });
|
|
85430
85421
|
}
|
|
85431
85422
|
}
|
|
85423
|
+
getSubFieldConfigMap() {
|
|
85424
|
+
const key = "_subFieldConfig";
|
|
85425
|
+
const params = this.doc?.paramsConfig;
|
|
85426
|
+
const cfg = params?.[key];
|
|
85427
|
+
if (!cfg || typeof cfg !== "object") return void 0;
|
|
85428
|
+
return cfg;
|
|
85429
|
+
}
|
|
85430
|
+
/** 插行后同步 _subFieldConfig 下标 +1 */
|
|
85431
|
+
shiftSubFieldConfigAfterRowInsert(arrayPath, insertIndex) {
|
|
85432
|
+
const cfg = this.getSubFieldConfigMap();
|
|
85433
|
+
if (!cfg) return;
|
|
85434
|
+
const updates = {};
|
|
85435
|
+
const toDelete = [];
|
|
85436
|
+
for (const [path, value] of Object.entries(cfg)) {
|
|
85437
|
+
const parsed = this.parseSubtableFieldPath(path, arrayPath);
|
|
85438
|
+
if (!parsed) continue;
|
|
85439
|
+
const { rowIndex, suffix } = parsed;
|
|
85440
|
+
if (rowIndex >= insertIndex) {
|
|
85441
|
+
toDelete.push(path);
|
|
85442
|
+
updates[`${arrayPath}[${rowIndex + 1}]${suffix}`] = value;
|
|
85443
|
+
}
|
|
85444
|
+
}
|
|
85445
|
+
for (const path of toDelete) delete cfg[path];
|
|
85446
|
+
Object.assign(cfg, updates);
|
|
85447
|
+
}
|
|
85448
|
+
/** 硬删后同步 _subFieldConfig:删该行并对其后行 -1 */
|
|
85449
|
+
shiftSubFieldConfigAfterRowRemove(arrayPath, removeIndex) {
|
|
85450
|
+
const cfg = this.getSubFieldConfigMap();
|
|
85451
|
+
if (!cfg) return;
|
|
85452
|
+
const updates = {};
|
|
85453
|
+
const toDelete = [];
|
|
85454
|
+
for (const [path, value] of Object.entries(cfg)) {
|
|
85455
|
+
const parsed = this.parseSubtableFieldPath(path, arrayPath);
|
|
85456
|
+
if (!parsed) continue;
|
|
85457
|
+
const { rowIndex, suffix } = parsed;
|
|
85458
|
+
if (rowIndex === removeIndex) {
|
|
85459
|
+
toDelete.push(path);
|
|
85460
|
+
} else if (rowIndex > removeIndex) {
|
|
85461
|
+
toDelete.push(path);
|
|
85462
|
+
updates[`${arrayPath}[${rowIndex - 1}]${suffix}`] = value;
|
|
85463
|
+
}
|
|
85464
|
+
}
|
|
85465
|
+
for (const path of toDelete) delete cfg[path];
|
|
85466
|
+
Object.assign(cfg, updates);
|
|
85467
|
+
}
|
|
85432
85468
|
parseSubtableFieldPath(fullPath, arrayPath) {
|
|
85433
85469
|
const head = `${arrayPath}[`;
|
|
85434
85470
|
if (!fullPath.startsWith(head)) return null;
|
|
@@ -85581,12 +85617,6 @@ class DataManager {
|
|
|
85581
85617
|
}
|
|
85582
85618
|
return maxIndex + 1;
|
|
85583
85619
|
}
|
|
85584
|
-
/** 版面可见行下标 → rawData 数组实际下标 */
|
|
85585
|
-
resolveSubtableVisibleIndex(arrayPath, visibleIndex) {
|
|
85586
|
-
const rows = this.getByPath(this.rawData, arrayPath);
|
|
85587
|
-
if (!Array.isArray(rows)) return visibleIndex;
|
|
85588
|
-
return resolveSubtableStorageIndex(rows, visibleIndex);
|
|
85589
|
-
}
|
|
85590
85620
|
assignField(target, fieldPath, value) {
|
|
85591
85621
|
if (!fieldPath.includes(".") && !fieldPath.includes("[")) {
|
|
85592
85622
|
target[fieldPath] = value;
|
|
@@ -86007,10 +86037,11 @@ class DataManager {
|
|
|
86007
86037
|
arr = [{ ...DEFAULT_EMPTY_ITEM }];
|
|
86008
86038
|
this.set(path, arr, "parent");
|
|
86009
86039
|
}
|
|
86010
|
-
const
|
|
86011
|
-
if (
|
|
86040
|
+
const activeCount = countActiveSubtableRows(arr);
|
|
86041
|
+
if (index2 < 0 || index2 > activeCount) {
|
|
86012
86042
|
throw new Error(`Index ${index2} out of bounds for array of length ${arr.length}`);
|
|
86013
86043
|
}
|
|
86044
|
+
const storageIndex = index2;
|
|
86014
86045
|
const oldValue = [...arr];
|
|
86015
86046
|
const tableKey = path.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
86016
86047
|
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
@@ -86026,6 +86057,7 @@ class DataManager {
|
|
|
86026
86057
|
this.emit(path, arr, oldValue);
|
|
86027
86058
|
this.shiftFieldRuntimeConfigAfterRowInsert(path, storageIndex);
|
|
86028
86059
|
this.shiftDependencyGraphAfterRowInsert(path, storageIndex);
|
|
86060
|
+
this.shiftSubFieldConfigAfterRowInsert(path, storageIndex);
|
|
86029
86061
|
return true;
|
|
86030
86062
|
} catch (error) {
|
|
86031
86063
|
console.error(`Failed to insert value at path "${path}":`, error);
|
|
@@ -86044,10 +86076,11 @@ class DataManager {
|
|
|
86044
86076
|
if (!Array.isArray(arr)) {
|
|
86045
86077
|
throw new Error(`Path "${path}" is not an array`);
|
|
86046
86078
|
}
|
|
86047
|
-
const
|
|
86048
|
-
if (
|
|
86079
|
+
const activeCount = countActiveSubtableRows(arr);
|
|
86080
|
+
if (index2 < 0 || index2 >= activeCount) {
|
|
86049
86081
|
throw new Error(`Index ${index2} out of bounds for array of length ${arr.length}`);
|
|
86050
86082
|
}
|
|
86083
|
+
const storageIndex = index2;
|
|
86051
86084
|
const tableKey = path.replace(/^\$\./, "").replace(/\[(n|\d+)\]/g, "");
|
|
86052
86085
|
const axisInfo = this.resolveAxisByTableKey(tableKey);
|
|
86053
86086
|
const row = arr[storageIndex];
|
|
@@ -86057,15 +86090,21 @@ class DataManager {
|
|
|
86057
86090
|
axis: axisInfo?.axis
|
|
86058
86091
|
})) {
|
|
86059
86092
|
const oldValue2 = this.deepClone(arr);
|
|
86060
|
-
|
|
86093
|
+
const [removedRow] = arr.splice(storageIndex, 1);
|
|
86094
|
+
removedRow.deleted_ = true;
|
|
86095
|
+
arr.push(removedRow);
|
|
86096
|
+
this.shiftFieldRuntimeConfigAfterRowRemove(path, storageIndex);
|
|
86097
|
+
this.shiftDependencyGraphAfterRowRemove(path, storageIndex);
|
|
86098
|
+
this.shiftSubFieldConfigAfterRowRemove(path, storageIndex);
|
|
86061
86099
|
this.emit(path, arr, oldValue2);
|
|
86062
|
-
return
|
|
86100
|
+
return removedRow;
|
|
86063
86101
|
}
|
|
86064
86102
|
const oldValue = [...arr];
|
|
86065
86103
|
const removedValue = arr.splice(storageIndex, 1)[0];
|
|
86066
86104
|
this.emit(path, arr, oldValue);
|
|
86067
86105
|
this.shiftFieldRuntimeConfigAfterRowRemove(path, storageIndex);
|
|
86068
86106
|
this.shiftDependencyGraphAfterRowRemove(path, storageIndex);
|
|
86107
|
+
this.shiftSubFieldConfigAfterRowRemove(path, storageIndex);
|
|
86069
86108
|
if (axisInfo) {
|
|
86070
86109
|
const uidField = axisInfo.axis === "y" ? "__gw_y_uid" : "__gw_x_uid";
|
|
86071
86110
|
this.cleanupCrossByAxisUid(tableKey, axisInfo.axis, removedValue?.[uidField]);
|
|
@@ -87333,21 +87372,33 @@ class TableRuntimeContext {
|
|
|
87333
87372
|
get arrayPath() {
|
|
87334
87373
|
return `$.${this.subFieldKey}`;
|
|
87335
87374
|
}
|
|
87336
|
-
/** 指定行路径 $.subFieldKey[rowIndex] */
|
|
87375
|
+
/** 指定行路径 $.subFieldKey[rowIndex];rowIndex 为存储下标 */
|
|
87337
87376
|
rowPath(rowIndex) {
|
|
87338
87377
|
return `${this.arrayPath}[${rowIndex}]`;
|
|
87339
87378
|
}
|
|
87340
|
-
/**
|
|
87379
|
+
/** 读取指定行数据;rowIndex 为存储下标 */
|
|
87341
87380
|
getRow(rowIndex) {
|
|
87342
87381
|
return this.doc.dataManager.get(this.rowPath(rowIndex));
|
|
87343
87382
|
}
|
|
87344
|
-
/**
|
|
87383
|
+
/**
|
|
87384
|
+
* 子表存储行数(含软删),无数据默认返回 1
|
|
87385
|
+
*/
|
|
87345
87386
|
getRowCount() {
|
|
87346
87387
|
const rows = this.doc.dataManager.getRawData()[this.subFieldKey];
|
|
87347
87388
|
if (Array.isArray(rows) && rows.length > 0) return rows.length;
|
|
87348
87389
|
return 1;
|
|
87349
87390
|
}
|
|
87350
|
-
/**
|
|
87391
|
+
/**
|
|
87392
|
+
* 未软删行的存储下标。无数据时返回 [0](与版面默认空行一致);
|
|
87393
|
+
* 仅剩软删行时返回 []。
|
|
87394
|
+
*/
|
|
87395
|
+
getActiveRowIndexes() {
|
|
87396
|
+
const rows = this.doc.dataManager.getRawData()[this.subFieldKey];
|
|
87397
|
+
if (!Array.isArray(rows) || rows.length === 0) return [0];
|
|
87398
|
+
const count = countActiveSubtableRows(rows);
|
|
87399
|
+
return Array.from({ length: count }, (_2, index2) => index2);
|
|
87400
|
+
}
|
|
87401
|
+
/** 构建单行规则执行上下文;rowIndex 为存储下标 */
|
|
87351
87402
|
buildRuleContext(rowIndex, changedFieldKey) {
|
|
87352
87403
|
const rowPath = this.rowPath(rowIndex);
|
|
87353
87404
|
const rowData = this.getRow(rowIndex) ?? {};
|
|
@@ -87361,9 +87412,12 @@ class TableRuntimeContext {
|
|
|
87361
87412
|
paramsConfig: this.doc.paramsConfig ?? {}
|
|
87362
87413
|
};
|
|
87363
87414
|
}
|
|
87364
|
-
/**
|
|
87415
|
+
/**
|
|
87416
|
+
* 遍历子表数据行,支持指定单行或全量遍历,逐行注入 RuleContext。
|
|
87417
|
+
* rowIndex / 全量遍历均使用存储下标;全量时跳过 deleted_ 行。
|
|
87418
|
+
*/
|
|
87365
87419
|
eachRow(options, iteratee) {
|
|
87366
|
-
const rowIndexes = options.rowIndex !== void 0 ? [options.rowIndex] :
|
|
87420
|
+
const rowIndexes = options.rowIndex !== void 0 ? [options.rowIndex] : this.getActiveRowIndexes();
|
|
87367
87421
|
for (const rowIndex of rowIndexes) {
|
|
87368
87422
|
iteratee(this.buildRuleContext(rowIndex, options.changedFieldKey));
|
|
87369
87423
|
}
|
|
@@ -88027,8 +88081,7 @@ class RemoteSyncEngine {
|
|
|
88027
88081
|
const config = ctx.profile.remoteSync;
|
|
88028
88082
|
const missingKeys = config?.resyncOnInitWhenMissing;
|
|
88029
88083
|
if (!config || !missingKeys?.length) return;
|
|
88030
|
-
const
|
|
88031
|
-
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
88084
|
+
for (const rowIndex of ctx.getActiveRowIndexes()) {
|
|
88032
88085
|
const row = ctx.getRow(rowIndex);
|
|
88033
88086
|
if (!row) continue;
|
|
88034
88087
|
if (config.requireAllOf?.some((key) => !isPresent(row[key]))) continue;
|
|
@@ -88210,11 +88263,10 @@ class RowRuntimeEngine {
|
|
|
88210
88263
|
runRowHandler(ctx.profile.type, handler.handler, this.doc, ctx.subFieldKey, rowIndex);
|
|
88211
88264
|
}
|
|
88212
88265
|
}
|
|
88213
|
-
/**
|
|
88266
|
+
/** 初始化时对所有未软删行执行行初始化 */
|
|
88214
88267
|
applyRowInitForAllRows(ctx) {
|
|
88215
88268
|
if (!this.hasRowInit(ctx)) return;
|
|
88216
|
-
const
|
|
88217
|
-
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
88269
|
+
for (const rowIndex of ctx.getActiveRowIndexes()) {
|
|
88218
88270
|
this.applyRowInit(ctx, rowIndex);
|
|
88219
88271
|
}
|
|
88220
88272
|
}
|
|
@@ -88897,7 +88949,14 @@ const profile$3 = {
|
|
|
88897
88949
|
fieldType: "master_slave",
|
|
88898
88950
|
refModelType: "MATERIAL_CONSUME"
|
|
88899
88951
|
},
|
|
88900
|
-
rowHandlers: [{ when: "onFieldChange", watch: ["qty_"], handler: "on-qty-change" }],
|
|
88952
|
+
rowHandlers: [{ when: "onFieldChange", watch: ["qty_", "product_id_", "material_no_"], handler: "on-qty-change" }],
|
|
88953
|
+
runtimeRules: [
|
|
88954
|
+
{
|
|
88955
|
+
when: "always",
|
|
88956
|
+
fields: ["qty_consumed_"],
|
|
88957
|
+
effect: { disabled: true }
|
|
88958
|
+
}
|
|
88959
|
+
],
|
|
88901
88960
|
theme: {
|
|
88902
88961
|
color: "#4891B3",
|
|
88903
88962
|
background: "rgba(72,145,179,0.2)",
|
|
@@ -99439,22 +99498,6 @@ class LayoutContext {
|
|
|
99439
99498
|
this.paragraph?.addChild(run);
|
|
99440
99499
|
this.layoutRun = run;
|
|
99441
99500
|
}
|
|
99442
|
-
/** 子表可见行下标 → rawData 存储下标(跳过 deleted_ 行) */
|
|
99443
|
-
mapSubtableVisibleIndex(templatePath, visibleIndex, axis) {
|
|
99444
|
-
if (visibleIndex === void 0) return void 0;
|
|
99445
|
-
const parsed = parseValuePath(templatePath);
|
|
99446
|
-
const dm = this.doc.dataManager;
|
|
99447
|
-
if (axis === "n_y" && parsed.parentFieldPath) {
|
|
99448
|
-
return dm.resolveSubtableVisibleIndex(parsed.parentFieldPath, visibleIndex);
|
|
99449
|
-
}
|
|
99450
|
-
if (axis === "n_x" && parsed.linkFieldPath) {
|
|
99451
|
-
return dm.resolveSubtableVisibleIndex(parsed.linkFieldPath, visibleIndex);
|
|
99452
|
-
}
|
|
99453
|
-
if (parsed.isSubTable && parsed.parentFieldPath) {
|
|
99454
|
-
return dm.resolveSubtableVisibleIndex(parsed.parentFieldPath, visibleIndex);
|
|
99455
|
-
}
|
|
99456
|
-
return visibleIndex;
|
|
99457
|
-
}
|
|
99458
99501
|
/**
|
|
99459
99502
|
* 根据 dataIndex 替换 path 中的 [n] 为实际值
|
|
99460
99503
|
* @param path 包含 [n] 的路径,如 "$.items[n].name"
|
|
@@ -99465,8 +99508,8 @@ class LayoutContext {
|
|
|
99465
99508
|
const { type: type4, dataIndex, xDataIndex, yDataIndex, cellZone } = this.cell?.subRenderer || {};
|
|
99466
99509
|
if (isLinkSubTableType(type4) && cellZone === "cross") {
|
|
99467
99510
|
return replacePathIndexPlaceholders({
|
|
99468
|
-
x:
|
|
99469
|
-
y:
|
|
99511
|
+
x: xDataIndex,
|
|
99512
|
+
y: yDataIndex,
|
|
99470
99513
|
templatePath: path
|
|
99471
99514
|
});
|
|
99472
99515
|
}
|
|
@@ -99476,10 +99519,6 @@ class LayoutContext {
|
|
|
99476
99519
|
let n = dataIndex;
|
|
99477
99520
|
if (isLinkSubTableType(type4)) {
|
|
99478
99521
|
n = cellZone === "horizontal" ? yDataIndex : xDataIndex;
|
|
99479
|
-
const axis = cellZone === "horizontal" ? "n_y" : "n_x";
|
|
99480
|
-
n = this.mapSubtableVisibleIndex(path, n, axis);
|
|
99481
|
-
} else {
|
|
99482
|
-
n = this.mapSubtableVisibleIndex(path, n, "n");
|
|
99483
99522
|
}
|
|
99484
99523
|
if (n === void 0) return path;
|
|
99485
99524
|
return replacePathIndexPlaceholder(n, path);
|
|
@@ -108450,6 +108489,9 @@ class BomEntriesValidator {
|
|
|
108450
108489
|
* @param row 单行的数据
|
|
108451
108490
|
*/
|
|
108452
108491
|
validateInBom(row) {
|
|
108492
|
+
if (this.mcPattern === MaterialConsumptionPatternEnum.RECORD) {
|
|
108493
|
+
return;
|
|
108494
|
+
}
|
|
108453
108495
|
if (!row.product_id_) {
|
|
108454
108496
|
throw new Error(
|
|
108455
108497
|
"物料不能为空"
|
|
@@ -108578,9 +108620,7 @@ class BomEntriesValidator {
|
|
|
108578
108620
|
* @return {*}
|
|
108579
108621
|
*/
|
|
108580
108622
|
mergeRowInArr(row, arr) {
|
|
108581
|
-
|
|
108582
|
-
this.validateInBom(row);
|
|
108583
|
-
}
|
|
108623
|
+
this.validateInBom(row);
|
|
108584
108624
|
const newArr = cloneDeep(arr).filter((i) => i.product_id_);
|
|
108585
108625
|
const util = this.findUtilByProductId(row.product_id_);
|
|
108586
108626
|
const sameIndex = findLastIndex(newArr, (i) => {
|
|
@@ -108732,12 +108772,12 @@ class MCDataUtil {
|
|
|
108732
108772
|
});
|
|
108733
108773
|
}
|
|
108734
108774
|
/**
|
|
108735
|
-
* [
|
|
108775
|
+
* 物料消耗模式 BOM 模式需要禁用[需求数量]
|
|
108736
108776
|
* 参顶部[物料消耗表字段控制]
|
|
108737
108777
|
* @param rowPath $.f_sub[n] n 必须为数字
|
|
108738
108778
|
*/
|
|
108739
|
-
static
|
|
108740
|
-
const fields2 = ["
|
|
108779
|
+
static disableQtyRequired(dataManager, rowPath) {
|
|
108780
|
+
const fields2 = ["qty_required_"];
|
|
108741
108781
|
this._updateDisablement({ dataManager, rowPath, fields: fields2, disabled: true });
|
|
108742
108782
|
}
|
|
108743
108783
|
/**
|
|
@@ -108775,6 +108815,7 @@ class MCDataUtil {
|
|
|
108775
108815
|
const { dataManager, subFieldKey, rowIndex } = option;
|
|
108776
108816
|
const rows = dataManager.getRawData()[subFieldKey] ?? [];
|
|
108777
108817
|
const row = rows[rowIndex];
|
|
108818
|
+
if (!row) return;
|
|
108778
108819
|
row.is_confirmed_ = isConfirmed;
|
|
108779
108820
|
rows[rowIndex] = row;
|
|
108780
108821
|
dataManager.set(subFieldKey, rows, "user");
|
|
@@ -108865,7 +108906,7 @@ class MaterialConsumeTableController {
|
|
|
108865
108906
|
return this.tableDataRef.value.filter((i) => !i.deleted_);
|
|
108866
108907
|
}
|
|
108867
108908
|
/**
|
|
108868
|
-
*
|
|
108909
|
+
* 修改表格数据(保留软删行在后缀)
|
|
108869
108910
|
*/
|
|
108870
108911
|
set actualTableData(value) {
|
|
108871
108912
|
const deletedArr = this.tableDataRef.value.filter((i) => i.deleted_);
|
|
@@ -108979,9 +109020,9 @@ class MaterialConsumeTableController {
|
|
|
108979
109020
|
qty_: data.qty,
|
|
108980
109021
|
validate_: data.expiration,
|
|
108981
109022
|
// 记录模式传null,后台就不校验了
|
|
108982
|
-
|
|
109023
|
+
bom_entries_: isRecordPattern ? null : this.actualBomEntries,
|
|
108983
109024
|
operation_id_: this.tmplBomController.operationId
|
|
108984
|
-
});
|
|
109025
|
+
}) || (isRecordPattern ? [{ productionIdentificationName: data.lot }] : null);
|
|
108985
109026
|
if (!arr) {
|
|
108986
109027
|
this.error(
|
|
108987
109028
|
"扫描的物料不存在或不在bom中"
|
|
@@ -108990,7 +109031,7 @@ class MaterialConsumeTableController {
|
|
|
108990
109031
|
return;
|
|
108991
109032
|
}
|
|
108992
109033
|
let materialData = arr[0];
|
|
108993
|
-
if (arr.length > 1) {
|
|
109034
|
+
if (arr.length > 1 && !isRecordPattern) {
|
|
108994
109035
|
const ids = this.actualTableData.map((i) => i.product_id_);
|
|
108995
109036
|
const find = arr.find((j2) => ids.includes(j2.materialId));
|
|
108996
109037
|
if (!find) {
|
|
@@ -109006,6 +109047,9 @@ class MaterialConsumeTableController {
|
|
|
109006
109047
|
qty_: data.qty,
|
|
109007
109048
|
is_confirmed_: false
|
|
109008
109049
|
};
|
|
109050
|
+
if (isRecordPattern && !row.product_id_) {
|
|
109051
|
+
row._scanFallback = true;
|
|
109052
|
+
}
|
|
109009
109053
|
if (this.scanRuleProps?.fillMapArr?.length) {
|
|
109010
109054
|
const fillData = calcFillData(data, this.scanRuleProps.fillMapArr);
|
|
109011
109055
|
console.log("fillData", fillData);
|
|
@@ -109018,14 +109062,14 @@ class MaterialConsumeTableController {
|
|
|
109018
109062
|
try {
|
|
109019
109063
|
const newArr = this.bomEntriesValidator.mergeRowInArr(row, this.actualTableData);
|
|
109020
109064
|
await this.bomEntriesValidator.validateScanCanInsert(newArr);
|
|
109021
|
-
this.
|
|
109065
|
+
this.actualTableData = newArr;
|
|
109022
109066
|
setTimeout(async () => {
|
|
109023
109067
|
const row2 = this.actualTableData.find((i) => !i.is_confirmed_);
|
|
109024
109068
|
const rowIndex = this.actualTableData.findIndex((i) => !i.is_confirmed_);
|
|
109025
109069
|
const { doc, subFieldKey, subModelKey } = option;
|
|
109026
109070
|
await doc.dataManager.whenEmitSettled();
|
|
109027
109071
|
await hydrateSubtableRowLabels(doc, subFieldKey, [rowIndex]);
|
|
109028
|
-
if (row2) {
|
|
109072
|
+
if (row2 && row2.product_id_) {
|
|
109029
109073
|
this.confirm({ dataManager: doc.dataManager, subFieldKey, rowIndex }, subModelKey, doc);
|
|
109030
109074
|
}
|
|
109031
109075
|
});
|
|
@@ -109109,6 +109153,9 @@ class MaterialConsumeTableController {
|
|
|
109109
109153
|
const { dataManager, rowIndex, subFieldKey } = option;
|
|
109110
109154
|
const rows = dataManager.getRawData()[subFieldKey] ?? [];
|
|
109111
109155
|
const row = rows[rowIndex];
|
|
109156
|
+
if (!row.product_id_) {
|
|
109157
|
+
throw new Error("物料不能为空");
|
|
109158
|
+
}
|
|
109112
109159
|
this.validateExpiration(row);
|
|
109113
109160
|
} else {
|
|
109114
109161
|
await this.bomEntriesValidator.validate(this.actualTableData);
|
|
@@ -109226,15 +109273,15 @@ class MaterialConsumeTableController {
|
|
|
109226
109273
|
* - 删除行
|
|
109227
109274
|
*/
|
|
109228
109275
|
updateRowConsumed(doc) {
|
|
109229
|
-
const modifySingleRow = (
|
|
109230
|
-
const
|
|
109276
|
+
const modifySingleRow = (row, rowIndex) => {
|
|
109277
|
+
const fieldKey = `${this.subTableInfo.valuePath}[${rowIndex}].qty_consumed_`;
|
|
109231
109278
|
if (!row.product_id_) {
|
|
109232
|
-
row.
|
|
109279
|
+
doc.dataManager.set(fieldKey, row.qty_ ? Number(row.qty_) : "", "user");
|
|
109233
109280
|
return;
|
|
109234
109281
|
}
|
|
109235
109282
|
let total = 0;
|
|
109236
109283
|
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
109237
|
-
const beforeArr = this.actualTableData.slice(0,
|
|
109284
|
+
const beforeArr = this.actualTableData.slice(0, rowIndex + 1);
|
|
109238
109285
|
if (util) {
|
|
109239
109286
|
total += util.hasConsumed;
|
|
109240
109287
|
console.log("total", total);
|
|
@@ -109242,14 +109289,13 @@ class MaterialConsumeTableController {
|
|
|
109242
109289
|
filterGroupData.forEach((i) => {
|
|
109243
109290
|
total += Number(i.qty_ || 0) ?? 0;
|
|
109244
109291
|
});
|
|
109245
|
-
const fieldKey = `${this.subTableInfo.valuePath}[${index2}].qty_consumed_`;
|
|
109246
109292
|
doc.dataManager.set(fieldKey, total, "user");
|
|
109247
109293
|
}
|
|
109248
109294
|
};
|
|
109249
109295
|
setTimeout(() => {
|
|
109250
|
-
|
|
109251
|
-
modifySingleRow(
|
|
109252
|
-
}
|
|
109296
|
+
this.actualTableData.forEach((row, rowIndex) => {
|
|
109297
|
+
modifySingleRow(row, rowIndex);
|
|
109298
|
+
});
|
|
109253
109299
|
});
|
|
109254
109300
|
}
|
|
109255
109301
|
/**
|
|
@@ -109299,6 +109345,10 @@ class MaterialConsumeTableController {
|
|
|
109299
109345
|
if (["product_id_", "material_no_"].includes(fieldKey)) {
|
|
109300
109346
|
const rowPath = `${parentFieldPath}[${dataIndex}]`;
|
|
109301
109347
|
if (fieldKey === "product_id_") {
|
|
109348
|
+
const row = doc.dataManager.get(rowPath);
|
|
109349
|
+
if (row._scanFallback) {
|
|
109350
|
+
return;
|
|
109351
|
+
}
|
|
109302
109352
|
const product_id_ = changedData[`${rowPath}.product_id_`];
|
|
109303
109353
|
const versionId = product_id_?.split(":").pop();
|
|
109304
109354
|
if (versionId) {
|
|
@@ -109492,6 +109542,9 @@ const initMaterialConsumeTableConfig = (doc, subConfig, tmplBomC) => {
|
|
|
109492
109542
|
({ personal_bom_enabled_, entries_, table_key_ }) => {
|
|
109493
109543
|
const tableController = tmplBomC?.findTableControllerByField(table_key_);
|
|
109494
109544
|
const useBomMode = tableController?.mcPattern === MaterialConsumptionPatternEnum.BOM;
|
|
109545
|
+
const subFieldKey = table_key_.replace("$.", "");
|
|
109546
|
+
const rows = doc.dataManager.getRawData()[subFieldKey] || [];
|
|
109547
|
+
const activeCount = rows.filter((row) => !row?.deleted_).length;
|
|
109495
109548
|
if (useBomMode) {
|
|
109496
109549
|
const entries = personal_bom_enabled_ ? entries_ : tmplBomC.bomEntries;
|
|
109497
109550
|
const includedIds = [];
|
|
@@ -109502,14 +109555,12 @@ const initMaterialConsumeTableConfig = (doc, subConfig, tmplBomC) => {
|
|
|
109502
109555
|
});
|
|
109503
109556
|
});
|
|
109504
109557
|
subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
|
|
109558
|
+
repeat(activeCount || 1, (index2) => {
|
|
109559
|
+
MCDataUtil.disableQtyRequired(doc.dataManager, `${table_key_}[${index2}]`);
|
|
109560
|
+
});
|
|
109505
109561
|
}
|
|
109506
|
-
const subFieldKey = table_key_.replace("$.", "");
|
|
109507
|
-
const rows = doc.dataManager.getRawData()[subFieldKey] || [];
|
|
109508
|
-
const rowCount = rows.length;
|
|
109509
|
-
repeat(rowCount || 1, (index2) => {
|
|
109510
|
-
MCDataUtil.disableQtyFields(doc.dataManager, `${table_key_}[${index2}]`);
|
|
109511
|
-
});
|
|
109512
109562
|
rows.forEach((row, rowIndex) => {
|
|
109563
|
+
if (row?.deleted_) return;
|
|
109513
109564
|
const rowPath = `${table_key_}[${rowIndex}]`;
|
|
109514
109565
|
if (row.product_id_) {
|
|
109515
109566
|
const versionId = row.product_id_.split(":").pop();
|
|
@@ -110128,7 +110179,8 @@ class InitLoadEngine {
|
|
|
110128
110179
|
if (config.rowPatch) {
|
|
110129
110180
|
rows = rows.map((row) => ({ ...row, ...config.rowPatch }));
|
|
110130
110181
|
}
|
|
110131
|
-
this.
|
|
110182
|
+
const deletedRows = this.readExistingRows(subFieldKey).filter((row) => row.deleted_);
|
|
110183
|
+
this.doc.dataManager.set(subFieldKey, [...rows, ...deletedRows], "hydrate");
|
|
110132
110184
|
}
|
|
110133
110185
|
isEnabled(config, regionProps) {
|
|
110134
110186
|
if (config.enabled === true) return true;
|
|
@@ -110144,7 +110196,7 @@ class InitLoadEngine {
|
|
|
110144
110196
|
* @returns true-跳过,false-不跳过
|
|
110145
110197
|
*/
|
|
110146
110198
|
shouldSkip(subFieldKey, config) {
|
|
110147
|
-
const existingRows = this.readExistingRows(subFieldKey);
|
|
110199
|
+
const existingRows = this.readExistingRows(subFieldKey).filter((row) => !row.deleted_);
|
|
110148
110200
|
if (existingRows.length === 0) return false;
|
|
110149
110201
|
if (config.skipWhenNonemptyRows && this.hasNonemptyRow(existingRows)) {
|
|
110150
110202
|
return true;
|
|
@@ -116347,18 +116399,15 @@ const _sfc_main$2T = /* @__PURE__ */ defineComponent({
|
|
|
116347
116399
|
};
|
|
116348
116400
|
const getTableRows = (subFieldKey, visible) => {
|
|
116349
116401
|
const rows = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
|
|
116350
|
-
|
|
116402
|
+
{
|
|
116351
116403
|
return rows.filter((row) => !row.deleted_);
|
|
116352
116404
|
}
|
|
116353
|
-
return rows;
|
|
116354
116405
|
};
|
|
116355
116406
|
const checkTargetRowThen = (cb) => {
|
|
116356
116407
|
const { dataManager } = docInst.value;
|
|
116357
|
-
const {
|
|
116358
|
-
|
|
116359
|
-
|
|
116360
|
-
allRows.splice(index2, 0, {});
|
|
116361
|
-
dataManager.set(subFieldKey, allRows, "user");
|
|
116408
|
+
const { path, index: index2 } = getCtx();
|
|
116409
|
+
if (!dataManager.get(`${path}[${index2}]`)) {
|
|
116410
|
+
dataManager.insertAt(path, index2, {});
|
|
116362
116411
|
}
|
|
116363
116412
|
setTimeout(cb);
|
|
116364
116413
|
};
|
|
@@ -116383,7 +116432,7 @@ const _sfc_main$2T = /* @__PURE__ */ defineComponent({
|
|
|
116383
116432
|
});
|
|
116384
116433
|
const actionInfo = computed(() => {
|
|
116385
116434
|
const { subFieldKey, index: index2 } = getCtx();
|
|
116386
|
-
const visibleRows = getTableRows(subFieldKey
|
|
116435
|
+
const visibleRows = getTableRows(subFieldKey);
|
|
116387
116436
|
const { isMaterialConsume, isWarehouseInventory, isWarehouseAllocate } = subTableType.value;
|
|
116388
116437
|
const canCopy = !isWarehouseInventory && !isWarehouseAllocate;
|
|
116389
116438
|
const canInsertMulti = !isMaterialConsume && !isWarehouseInventory && !isWarehouseAllocate;
|
|
@@ -116438,10 +116487,10 @@ const _sfc_main$2T = /* @__PURE__ */ defineComponent({
|
|
|
116438
116487
|
await changeWarehouseInventoryParseRule({ doc, subRenderer, subModelKey });
|
|
116439
116488
|
}
|
|
116440
116489
|
};
|
|
116441
|
-
const
|
|
116490
|
+
const getIsIncreasable = () => {
|
|
116442
116491
|
if (subTableType.value.isMaterialConsume) {
|
|
116443
116492
|
const { subFieldKey } = getCtx();
|
|
116444
|
-
const visibleRows = getTableRows(subFieldKey
|
|
116493
|
+
const visibleRows = getTableRows(subFieldKey);
|
|
116445
116494
|
const isAllConfirmed = visibleRows.length && visibleRows.every((row) => row.is_confirmed_);
|
|
116446
116495
|
if (!isAllConfirmed) {
|
|
116447
116496
|
GctMessage.error("同时只能有一条数据开启编辑状态");
|
|
@@ -116450,34 +116499,35 @@ const _sfc_main$2T = /* @__PURE__ */ defineComponent({
|
|
|
116450
116499
|
}
|
|
116451
116500
|
return true;
|
|
116452
116501
|
};
|
|
116453
|
-
const
|
|
116502
|
+
const handleRowIncreased = (subFieldKey, rowIndex) => {
|
|
116454
116503
|
if (subTableType.value.isMaterialConsume) {
|
|
116455
|
-
|
|
116504
|
+
mcTableCtrl.value?.updateRowConsumed(props.doc);
|
|
116505
|
+
if (mcTableCtrl.value?.mcPattern === MaterialConsumptionPatternEnum.BOM) {
|
|
116506
|
+
MCDataUtil.disableQtyRequired(props.doc.dataManager, `$.${subFieldKey}[${rowIndex}]`);
|
|
116507
|
+
}
|
|
116456
116508
|
}
|
|
116457
116509
|
new TableRuntime(props.doc).onRowInit(subFieldKey, rowIndex);
|
|
116458
116510
|
};
|
|
116459
116511
|
const insertRows = (index2, count = 1) => {
|
|
116460
|
-
if (!
|
|
116512
|
+
if (!getIsIncreasable()) return;
|
|
116461
116513
|
const { path, subFieldKey } = getCtx();
|
|
116462
116514
|
props.doc.dataManager.insertAt(path, index2, ...Array.from({ length: count }, () => ({})));
|
|
116463
|
-
|
|
116464
|
-
};
|
|
116465
|
-
const removeRow = () => {
|
|
116466
|
-
const { path, index: index2 } = getCtx();
|
|
116467
|
-
props.doc.dataManager.removeAt(path, index2);
|
|
116468
|
-
mcTableCtrl.value?.updateRowConsumed(props.doc);
|
|
116515
|
+
handleRowIncreased(subFieldKey, index2);
|
|
116469
116516
|
};
|
|
116470
116517
|
const copyRow = () => {
|
|
116471
|
-
if (!
|
|
116518
|
+
if (!getIsIncreasable()) return;
|
|
116472
116519
|
const { path, index: index2, subFieldKey } = getCtx();
|
|
116473
|
-
|
|
116474
|
-
let data = props.doc.dataManager.get(`${path}[${storageIndex}]`) || {};
|
|
116520
|
+
let data = props.doc.dataManager.get(`${path}[${index2}]`) || {};
|
|
116475
116521
|
data = omit(data, "id_");
|
|
116476
116522
|
if (subTableType.value.isMaterialConsume) {
|
|
116477
116523
|
data = omit(data, "is_confirmed_");
|
|
116478
116524
|
}
|
|
116479
116525
|
props.doc.dataManager.insertAt(path, index2 + 1, data);
|
|
116480
|
-
|
|
116526
|
+
handleRowIncreased(subFieldKey, index2 + 1);
|
|
116527
|
+
};
|
|
116528
|
+
const removeRow = () => {
|
|
116529
|
+
const { path, index: index2 } = getCtx();
|
|
116530
|
+
props.doc.dataManager.removeAt(path, index2);
|
|
116481
116531
|
mcTableCtrl.value?.updateRowConsumed(props.doc);
|
|
116482
116532
|
};
|
|
116483
116533
|
const actionHandlers = {
|
|
@@ -116697,7 +116747,7 @@ const _sfc_main$2T = /* @__PURE__ */ defineComponent({
|
|
|
116697
116747
|
};
|
|
116698
116748
|
}
|
|
116699
116749
|
});
|
|
116700
|
-
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2T, [["__scopeId", "data-v-
|
|
116750
|
+
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2T, [["__scopeId", "data-v-923a27bd"]]);
|
|
116701
116751
|
const _sfc_main$2S = /* @__PURE__ */ defineComponent({
|
|
116702
116752
|
__name: "index",
|
|
116703
116753
|
props: {
|
|
@@ -140658,11 +140708,8 @@ function useTableDropdown(props, searchFilters) {
|
|
|
140658
140708
|
const valuePath = fieldMeta.value?.valuePath;
|
|
140659
140709
|
const subFieldConfig = getSubFieldConfig(docInst.value.paramsConfig);
|
|
140660
140710
|
const extraParams = subFieldConfig.get(valuePath);
|
|
140661
|
-
|
|
140662
|
-
|
|
140663
|
-
const _valuePath = valuePath.replace("[n]", `[${dataIndex}]`);
|
|
140664
|
-
const subParams = subFieldConfig.get(_valuePath);
|
|
140665
|
-
Object.assign(extraParams, subParams);
|
|
140711
|
+
if (runtimeValuePath.value) {
|
|
140712
|
+
Object.assign(extraParams, subFieldConfig.get(runtimeValuePath.value));
|
|
140666
140713
|
}
|
|
140667
140714
|
const { queryData = {}, exp = "" } = buildQuery?.({
|
|
140668
140715
|
keyword,
|
package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface UpdateRowOption {
|
|
|
22
22
|
* - [有效期、唯一标识、自定义字段] 始终可填(不做控制)
|
|
23
23
|
* - 选择的物料类型是[查看物料]时 [批次、上料数量、工序] 只读
|
|
24
24
|
* - 单行校验通过后(包括暂存后再次编辑)[物料、批次、上料数量、工序、需求数量单位、数量单位、转换后数量、转换数量单位ID、单位转化公式] 只读
|
|
25
|
+
* v2026.7.30
|
|
26
|
+
* - [物料消耗模式]是[记录模式]时,可以填写[需求数量](BOM 模式禁用 需求数量)
|
|
25
27
|
*/
|
|
26
28
|
export declare class MCDataUtil {
|
|
27
29
|
/**
|
|
@@ -37,11 +39,11 @@ export declare class MCDataUtil {
|
|
|
37
39
|
*/
|
|
38
40
|
private static _updateDisablement;
|
|
39
41
|
/**
|
|
40
|
-
* [
|
|
42
|
+
* 物料消耗模式 BOM 模式需要禁用[需求数量]
|
|
41
43
|
* 参顶部[物料消耗表字段控制]
|
|
42
44
|
* @param rowPath $.f_sub[n] n 必须为数字
|
|
43
45
|
*/
|
|
44
|
-
static
|
|
46
|
+
static disableQtyRequired(dataManager: DataManager, rowPath: string): void;
|
|
45
47
|
/**
|
|
46
48
|
* 物料类型 是否选择[查看物料]时,需要更新指定字段是否禁用
|
|
47
49
|
* 参顶部[物料消耗表字段控制]
|
|
@@ -112,7 +114,7 @@ export declare class MaterialConsumeTableController {
|
|
|
112
114
|
*/
|
|
113
115
|
get actualTableData(): IMaterialConsumeData[];
|
|
114
116
|
/**
|
|
115
|
-
*
|
|
117
|
+
* 修改表格数据(保留软删行在后缀)
|
|
116
118
|
*/
|
|
117
119
|
set actualTableData(value: IMaterialConsumeData[]);
|
|
118
120
|
constructor(tmplBomController: FormTmplBomController, tmplBom: IFormTmplBom);
|
|
@@ -10,6 +10,8 @@ type AutofillApplyOptions = {
|
|
|
10
10
|
rowIndexes?: number[];
|
|
11
11
|
};
|
|
12
12
|
export declare function applyAutofillRules(record: Record<string, unknown>, autofillRules: AutofillRule[], opts?: AutofillApplyOptions): Record<string, unknown>;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* 子表插行 / 行初始化:从主表规则补默认值
|
|
15
|
+
*/
|
|
14
16
|
export declare function applyAutofillOnSubTableRowInit(doc: Doc, subFieldKey: string, rowIndex: number, fetchSource?: (field: FieldDataBindingMeta, context: Record<string, unknown>) => Promise<unknown>): Promise<void>;
|
|
15
17
|
export {};
|
package/dist/word.css
CHANGED
|
@@ -9124,20 +9124,20 @@ textarea[data-v-2de31883]::placeholder {
|
|
|
9124
9124
|
.table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
|
|
9125
9125
|
transform: translateY(-100%);
|
|
9126
9126
|
}
|
|
9127
|
-
.sub-table-action-container[data-v-
|
|
9127
|
+
.sub-table-action-container[data-v-923a27bd] {
|
|
9128
9128
|
position: absolute;
|
|
9129
9129
|
z-index: 999;
|
|
9130
9130
|
}
|
|
9131
|
-
.sub-table-action-bar[data-v-
|
|
9132
|
-
.sub-table-action-popper[data-v-
|
|
9131
|
+
.sub-table-action-bar[data-v-923a27bd],
|
|
9132
|
+
.sub-table-action-popper[data-v-923a27bd] {
|
|
9133
9133
|
pointer-events: auto;
|
|
9134
9134
|
user-select: none;
|
|
9135
9135
|
}
|
|
9136
|
-
.sub-table-action-bar[data-v-
|
|
9136
|
+
.sub-table-action-bar[data-v-923a27bd] {
|
|
9137
9137
|
display: flex;
|
|
9138
9138
|
}
|
|
9139
|
-
.sub-table-action-bar .more-btn[data-v-
|
|
9140
|
-
.sub-table-action-bar .confirm-btn[data-v-
|
|
9139
|
+
.sub-table-action-bar .more-btn[data-v-923a27bd],
|
|
9140
|
+
.sub-table-action-bar .confirm-btn[data-v-923a27bd] {
|
|
9141
9141
|
display: flex;
|
|
9142
9142
|
justify-content: center;
|
|
9143
9143
|
align-items: center;
|
|
@@ -9146,44 +9146,44 @@ textarea[data-v-2de31883]::placeholder {
|
|
|
9146
9146
|
cursor: pointer;
|
|
9147
9147
|
box-sizing: border-box;
|
|
9148
9148
|
}
|
|
9149
|
-
.sub-table-action-bar .more-btn[data-v-
|
|
9149
|
+
.sub-table-action-bar .more-btn[data-v-923a27bd] {
|
|
9150
9150
|
width: 10px;
|
|
9151
9151
|
background: #026ac8;
|
|
9152
9152
|
border-radius: 0 4px 4px 0;
|
|
9153
9153
|
}
|
|
9154
|
-
.sub-table-action-bar .confirm-btn[data-v-
|
|
9154
|
+
.sub-table-action-bar .confirm-btn[data-v-923a27bd] {
|
|
9155
9155
|
margin-left: 4px;
|
|
9156
9156
|
border-radius: 4px;
|
|
9157
9157
|
border: 1px solid #4ec262;
|
|
9158
9158
|
}
|
|
9159
|
-
.sub-table-action-popper[data-v-
|
|
9159
|
+
.sub-table-action-popper[data-v-923a27bd] {
|
|
9160
9160
|
padding: 2px 8px;
|
|
9161
9161
|
}
|
|
9162
|
-
.sub-table-action-popper .action-menu[data-v-
|
|
9162
|
+
.sub-table-action-popper .action-menu[data-v-923a27bd] {
|
|
9163
9163
|
padding: 4px 0;
|
|
9164
9164
|
width: 220px;
|
|
9165
9165
|
user-select: none;
|
|
9166
9166
|
}
|
|
9167
|
-
.sub-table-action-popper .action-menu + .action-menu[data-v-
|
|
9167
|
+
.sub-table-action-popper .action-menu + .action-menu[data-v-923a27bd] {
|
|
9168
9168
|
margin-top: 4px;
|
|
9169
9169
|
padding-top: 4px;
|
|
9170
9170
|
border-top: 1px solid #efefef;
|
|
9171
9171
|
}
|
|
9172
|
-
.sub-table-action-popper .action-menu .menu-title[data-v-
|
|
9172
|
+
.sub-table-action-popper .action-menu .menu-title[data-v-923a27bd] {
|
|
9173
9173
|
color: #bcbcbc;
|
|
9174
9174
|
margin: 4px 0;
|
|
9175
9175
|
}
|
|
9176
|
-
.sub-table-action-popper .action-menu .menu-item[data-v-
|
|
9176
|
+
.sub-table-action-popper .action-menu .menu-item[data-v-923a27bd] {
|
|
9177
9177
|
display: flex;
|
|
9178
9178
|
align-items: center;
|
|
9179
9179
|
padding: 8px 10px;
|
|
9180
9180
|
border-radius: 4px;
|
|
9181
9181
|
}
|
|
9182
|
-
.sub-table-action-popper .action-menu .menu-item[data-v-
|
|
9182
|
+
.sub-table-action-popper .action-menu .menu-item[data-v-923a27bd]:hover {
|
|
9183
9183
|
cursor: pointer;
|
|
9184
9184
|
background-color: #f2f5f8;
|
|
9185
9185
|
}
|
|
9186
|
-
.sub-table-action-popper .action-menu .menu-item .item-icon[data-v-
|
|
9186
|
+
.sub-table-action-popper .action-menu .menu-item .item-icon[data-v-923a27bd] {
|
|
9187
9187
|
display: flex;
|
|
9188
9188
|
align-items: center;
|
|
9189
9189
|
justify-content: start;
|
|
@@ -9191,14 +9191,14 @@ textarea[data-v-2de31883]::placeholder {
|
|
|
9191
9191
|
width: 20px;
|
|
9192
9192
|
height: 20px;
|
|
9193
9193
|
}
|
|
9194
|
-
.sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-
|
|
9194
|
+
.sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-923a27bd] {
|
|
9195
9195
|
transform: scale(1.5);
|
|
9196
9196
|
}
|
|
9197
|
-
.sub-table-action-popper .action-menu .menu-item .item-label[data-v-
|
|
9197
|
+
.sub-table-action-popper .action-menu .menu-item .item-label[data-v-923a27bd] {
|
|
9198
9198
|
flex-grow: 1;
|
|
9199
9199
|
margin-left: 8px;
|
|
9200
9200
|
}
|
|
9201
|
-
.sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-
|
|
9201
|
+
.sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-923a27bd] {
|
|
9202
9202
|
display: flex;
|
|
9203
9203
|
justify-content: space-between;
|
|
9204
9204
|
align-items: center;
|