@gct-paas/word 0.1.47-beta.13 → 0.1.47-beta.15
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/index.es.js +301 -130
- package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts +15 -0
- package/dist/runtime/factories/createValidateFactory.d.ts +2 -0
- package/dist/runtime/factories/useFormValidator.d.ts +13 -1
- package/dist/sdk/doc-runtime/composables/useValidationFullSync.d.ts +1 -1
- package/dist/sdk/doc-runtime/factories/useDocumentFactory.d.ts +2 -0
- package/dist/sdk/doc-runtime/utils/sub-field-config.d.ts +1 -0
- package/dist/word.css +25 -25
- package/package.json +1 -1
- package/dist/runtime/factories/validation-refresh-scheduler.d.ts +0 -7
package/dist/index.es.js
CHANGED
|
@@ -49743,11 +49743,7 @@ class DataManager {
|
|
|
49743
49743
|
}
|
|
49744
49744
|
/** 收集与字段绑定相关的路径(含 value / label / href 及通配符变体) */
|
|
49745
49745
|
collectFieldBindingPaths(designValuePath) {
|
|
49746
|
-
const bases = [
|
|
49747
|
-
designValuePath,
|
|
49748
|
-
getLabelPath(designValuePath),
|
|
49749
|
-
getHrefPath(designValuePath)
|
|
49750
|
-
];
|
|
49746
|
+
const bases = [designValuePath, getLabelPath(designValuePath), getHrefPath(designValuePath)];
|
|
49751
49747
|
const wildcardKeys = new Set(bases.map((path) => this.convertPathToWildcard(path)));
|
|
49752
49748
|
const result = new Set(bases);
|
|
49753
49749
|
const scanTargets = [
|
|
@@ -53409,7 +53405,7 @@ class BomEntryValidator {
|
|
|
53409
53405
|
*/
|
|
53410
53406
|
calcQtyConsumed(arr = this.historyData) {
|
|
53411
53407
|
const groupData = this.filterGroupData(arr);
|
|
53412
|
-
return groupData.reduce((acc, cur) => acc + (cur.qty_ ?? 0), 0);
|
|
53408
|
+
return groupData.reduce((acc, cur) => acc + (Number(cur.qty_) ?? 0), 0);
|
|
53413
53409
|
}
|
|
53414
53410
|
/**
|
|
53415
53411
|
* 计算自定义的数量校验的最大值和最小值
|
|
@@ -53861,20 +53857,20 @@ class McWebRender extends MCRender {
|
|
|
53861
53857
|
});
|
|
53862
53858
|
}
|
|
53863
53859
|
}
|
|
53864
|
-
const
|
|
53860
|
+
const SUB_FIELD_CONFIG_KEY = "_subFieldConfig";
|
|
53865
53861
|
const getSubFieldConfig = (paramsConfig) => {
|
|
53866
53862
|
return {
|
|
53867
53863
|
init(subConfig) {
|
|
53868
53864
|
if (!paramsConfig) return;
|
|
53869
|
-
paramsConfig[
|
|
53865
|
+
paramsConfig[SUB_FIELD_CONFIG_KEY] = subConfig;
|
|
53870
53866
|
},
|
|
53871
53867
|
get(valuePath) {
|
|
53872
|
-
if (!valuePath || !paramsConfig?.[
|
|
53873
|
-
return paramsConfig[
|
|
53868
|
+
if (!valuePath || !paramsConfig?.[SUB_FIELD_CONFIG_KEY]) return {};
|
|
53869
|
+
return paramsConfig[SUB_FIELD_CONFIG_KEY][valuePath] || {};
|
|
53874
53870
|
},
|
|
53875
53871
|
set(valuePath, subConfig) {
|
|
53876
|
-
if (!valuePath || !paramsConfig?.[
|
|
53877
|
-
paramsConfig[
|
|
53872
|
+
if (!valuePath || !paramsConfig?.[SUB_FIELD_CONFIG_KEY]) return;
|
|
53873
|
+
paramsConfig[SUB_FIELD_CONFIG_KEY][valuePath] = subConfig;
|
|
53878
53874
|
}
|
|
53879
53875
|
};
|
|
53880
53876
|
};
|
|
@@ -53915,6 +53911,26 @@ class MCDataUtil {
|
|
|
53915
53911
|
const { row, keys: keys2 = this.allFields, disabled = true } = opts;
|
|
53916
53912
|
this.editMCTable(row, { fieldDisabled: this.arrToObj(keys2, disabled) });
|
|
53917
53913
|
}
|
|
53914
|
+
/**
|
|
53915
|
+
* 物料消耗表 需求数量、已消耗数量 不可修改
|
|
53916
|
+
* @param rowPath $.f_sub[n] n 必须为数字
|
|
53917
|
+
*/
|
|
53918
|
+
static disableQtyFields(dataManager, rowPath) {
|
|
53919
|
+
const config = { newDisabled: true };
|
|
53920
|
+
dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_required_`, config);
|
|
53921
|
+
dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_consumed_`, config);
|
|
53922
|
+
}
|
|
53923
|
+
/**
|
|
53924
|
+
* 物料消耗表 更新[需求数量、已消耗数量]以外字段是否禁用
|
|
53925
|
+
* @param rowPath $.f_sub[n] n 必须为数字
|
|
53926
|
+
*/
|
|
53927
|
+
static updateOtherFieldsDisabled(option) {
|
|
53928
|
+
const { dataManager, rowPath, row, disabled } = option;
|
|
53929
|
+
const config = { newDisabled: disabled };
|
|
53930
|
+
Object.keys(row).filter((key) => !["qty_required_", "qty_consumed_"].includes(key)).forEach((key) => {
|
|
53931
|
+
dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.${key}`, config);
|
|
53932
|
+
});
|
|
53933
|
+
}
|
|
53918
53934
|
/**
|
|
53919
53935
|
* 设置行数据的编辑状态
|
|
53920
53936
|
*/
|
|
@@ -53929,13 +53945,11 @@ class MCDataUtil {
|
|
|
53929
53945
|
const rows = dataManager.getRawData()[subFieldKey] ?? [];
|
|
53930
53946
|
rows[rowIndex] = row;
|
|
53931
53947
|
dataManager.set(subFieldKey, rows);
|
|
53932
|
-
|
|
53933
|
-
|
|
53934
|
-
|
|
53935
|
-
|
|
53936
|
-
|
|
53937
|
-
dataManager.setFieldRuntimeSpecificConfig(key, { newDisabled: true });
|
|
53938
|
-
}
|
|
53948
|
+
MCDataUtil.updateOtherFieldsDisabled({
|
|
53949
|
+
dataManager,
|
|
53950
|
+
rowPath: `$.${subFieldKey}[${rowIndex}]`,
|
|
53951
|
+
row,
|
|
53952
|
+
disabled: isConfirmed
|
|
53939
53953
|
});
|
|
53940
53954
|
}
|
|
53941
53955
|
}
|
|
@@ -54321,7 +54335,7 @@ class MaterialConsumeTableController {
|
|
|
54321
54335
|
if (this.hasEditingRow()) {
|
|
54322
54336
|
return;
|
|
54323
54337
|
}
|
|
54324
|
-
const isLast =
|
|
54338
|
+
const isLast = option.rowIndex === this.actualTableData.length - 1;
|
|
54325
54339
|
if (this.enableSequenceLoading && !isLast) {
|
|
54326
54340
|
this.error(
|
|
54327
54341
|
"顺序投料时只能最后一条数据开启编辑状态"
|
|
@@ -54398,8 +54412,7 @@ class MaterialConsumeTableController {
|
|
|
54398
54412
|
return data;
|
|
54399
54413
|
}, {});
|
|
54400
54414
|
doc.dataManager.setMultiple(wordValue);
|
|
54401
|
-
doc.dataManager
|
|
54402
|
-
doc.dataManager.setFieldRuntimeSpecificConfig(`${rowPath}.qty_consumed_`, { newDisabled: true });
|
|
54415
|
+
MCDataUtil.disableQtyFields(doc.dataManager, rowPath);
|
|
54403
54416
|
}
|
|
54404
54417
|
}
|
|
54405
54418
|
}
|
|
@@ -55132,6 +55145,7 @@ const apiFetchers = {
|
|
|
55132
55145
|
const result = await api.apaas.designerCommon.getGetCanBeUsedOrgUser({
|
|
55133
55146
|
modelKey,
|
|
55134
55147
|
fieldKey,
|
|
55148
|
+
onlyHasSeat: true,
|
|
55135
55149
|
pageSize: API_CONFIG.USER_PAGE_SIZE
|
|
55136
55150
|
});
|
|
55137
55151
|
const { data = [], totalCount, totalPage } = result || {};
|
|
@@ -103437,14 +103451,6 @@ async function initializeDocumentEngine(props, payload, result) {
|
|
|
103437
103451
|
r.widgetMeta.props = matchedBom;
|
|
103438
103452
|
});
|
|
103439
103453
|
}
|
|
103440
|
-
if (paramsConfig && tmplBomC?.formInstBom?.formTmplBomList) {
|
|
103441
|
-
const subConfig = {};
|
|
103442
|
-
tmplBomC.formInstBom.formTmplBomList.forEach(({ table_key_, entries_ }) => {
|
|
103443
|
-
const includedIds = (entries_ || []).map((e) => e.product_id_.split(":").pop());
|
|
103444
|
-
subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
|
|
103445
|
-
});
|
|
103446
|
-
getSubFieldConfig(paramsConfig).init(subConfig);
|
|
103447
|
-
}
|
|
103448
103454
|
const instances = docModel.getWidgetInstances();
|
|
103449
103455
|
if (fillModeType !== DocModeTypeConst.Edit) {
|
|
103450
103456
|
instances.forEach((instance2) => {
|
|
@@ -103516,6 +103522,30 @@ async function initializeDocumentEngine(props, payload, result) {
|
|
|
103516
103522
|
});
|
|
103517
103523
|
doc.dataManager.setRawData(rawData, defaultDataMap);
|
|
103518
103524
|
doc.dataManager.applyInitData({ ...paramMap, ...dsMap });
|
|
103525
|
+
if (tmplBomC?.formInstBom?.formTmplBomList) {
|
|
103526
|
+
const subConfig = {};
|
|
103527
|
+
tmplBomC.formInstBom.formTmplBomList.forEach(({ table_key_, entries_ }) => {
|
|
103528
|
+
const includedIds = (entries_ || []).map((e) => e.product_id_.split(":").pop());
|
|
103529
|
+
subConfig[`${table_key_}[n].product_id_`] = { "id_.in": includedIds };
|
|
103530
|
+
const subFieldKey = table_key_.replace("$.", "");
|
|
103531
|
+
const rows = doc.dataManager.getRawData()[subFieldKey] || [];
|
|
103532
|
+
const rowCount = rows.length;
|
|
103533
|
+
repeat(rowCount || 1, (index2) => {
|
|
103534
|
+
MCDataUtil.disableQtyFields(doc.dataManager, `${table_key_}[${index2}]`);
|
|
103535
|
+
});
|
|
103536
|
+
rows.forEach((row, rowIndex) => {
|
|
103537
|
+
if (row.is_confirmed_) {
|
|
103538
|
+
MCDataUtil.updateOtherFieldsDisabled({
|
|
103539
|
+
dataManager: doc.dataManager,
|
|
103540
|
+
rowPath: `$.${subFieldKey}[${rowIndex}]`,
|
|
103541
|
+
row,
|
|
103542
|
+
disabled: true
|
|
103543
|
+
});
|
|
103544
|
+
}
|
|
103545
|
+
});
|
|
103546
|
+
});
|
|
103547
|
+
getSubFieldConfig(doc.paramsConfig).init(subConfig);
|
|
103548
|
+
}
|
|
103519
103549
|
await runDocumentPostLoadEnrichFlush(doc);
|
|
103520
103550
|
await waitForDataManagerSettle();
|
|
103521
103551
|
syncInitRawDataSnapshot(doc);
|
|
@@ -103617,6 +103647,7 @@ function useDocumentFactory(props, payload) {
|
|
|
103617
103647
|
}
|
|
103618
103648
|
async function refreshData() {
|
|
103619
103649
|
const doc = docIns.value;
|
|
103650
|
+
const subFieldConfigCache = docIns.value?.paramsConfig?.[SUB_FIELD_CONFIG_KEY];
|
|
103620
103651
|
const execute = lastExecute.value;
|
|
103621
103652
|
const requestId = unref(props.requestId) ?? execute?.id;
|
|
103622
103653
|
if (!doc || !execute || !requestId) return;
|
|
@@ -103649,6 +103680,7 @@ function useDocumentFactory(props, payload) {
|
|
|
103649
103680
|
initDocModelJson
|
|
103650
103681
|
};
|
|
103651
103682
|
doc.paramsConfig = paramsConfig ?? {};
|
|
103683
|
+
doc.paramsConfig[SUB_FIELD_CONFIG_KEY] = subFieldConfigCache;
|
|
103652
103684
|
if (doc.mode !== fillModeType) {
|
|
103653
103685
|
doc.setMode(fillModeType);
|
|
103654
103686
|
}
|
|
@@ -106364,16 +106396,21 @@ Schema.warning = warning;
|
|
|
106364
106396
|
Schema.messages = messages;
|
|
106365
106397
|
Schema.validators = validators;
|
|
106366
106398
|
const buildError = (validatorInfo, message) => JSON.stringify({ ...validatorInfo, message });
|
|
106367
|
-
const createRule = (validator2, message) => ({
|
|
106399
|
+
const createRule = (validator2, message, trigger = "change") => ({
|
|
106368
106400
|
required: true,
|
|
106369
106401
|
validator: validator2,
|
|
106370
|
-
message
|
|
106402
|
+
message,
|
|
106403
|
+
trigger
|
|
106371
106404
|
});
|
|
106372
106405
|
const requiredRule = (ctx) => {
|
|
106373
106406
|
if (!ctx.showRequired) return null;
|
|
106374
|
-
return createRule(
|
|
106375
|
-
|
|
106376
|
-
|
|
106407
|
+
return createRule(
|
|
106408
|
+
(_rule, value, _callback, _source, _options) => {
|
|
106409
|
+
return !isEmptyValue$1(value);
|
|
106410
|
+
},
|
|
106411
|
+
buildError(ctx.validatorInfo, "字段为必填项!"),
|
|
106412
|
+
"manual"
|
|
106413
|
+
);
|
|
106377
106414
|
};
|
|
106378
106415
|
const minNumberRule = (ctx) => {
|
|
106379
106416
|
if (ctx.enableRangeValidate && ctx.minValidateMode === RangeValidateModeTypeConst.Fixed_Number) {
|
|
@@ -106403,6 +106440,7 @@ const minNumberFormulaRule = (ctx) => {
|
|
|
106403
106440
|
if (ctx.enableRangeValidate && ctx.minValidateMode === RangeValidateModeTypeConst.Variable_Validate && ctx.minFormulaExpr) {
|
|
106404
106441
|
return {
|
|
106405
106442
|
required: true,
|
|
106443
|
+
trigger: "change",
|
|
106406
106444
|
async validator(_rule, value, _callback, _source, _options) {
|
|
106407
106445
|
const rawData = ctx.getRawData();
|
|
106408
106446
|
const subRowData = ctx.getSubRowFormData(ctx.validatorInfo.runtimeValuePath);
|
|
@@ -106425,6 +106463,7 @@ const maxNumberFormulaRule = (ctx) => {
|
|
|
106425
106463
|
if (ctx.enableRangeValidate && ctx.maxValidateMode === RangeValidateModeTypeConst.Variable_Validate && ctx.maxFormulaExpr) {
|
|
106426
106464
|
return {
|
|
106427
106465
|
required: true,
|
|
106466
|
+
trigger: "change",
|
|
106428
106467
|
async validator(_rule, value, _callback, _source, _options) {
|
|
106429
106468
|
const rawData = ctx.getRawData();
|
|
106430
106469
|
const subRowData = ctx.getSubRowFormData(ctx.validatorInfo.runtimeValuePath);
|
|
@@ -106475,6 +106514,7 @@ const minTimeFormulaRule = (ctx) => {
|
|
|
106475
106514
|
if (ctx.enableRangeValidate && ctx.minDateValidateMode === RangeValidateModeTypeConst.Variable_Validate && ctx.minDateFormulaExpr) {
|
|
106476
106515
|
return {
|
|
106477
106516
|
required: true,
|
|
106517
|
+
trigger: "change",
|
|
106478
106518
|
async validator(_rule, value, _callback, _source, _options) {
|
|
106479
106519
|
const rawData = ctx.getRawData();
|
|
106480
106520
|
const subRowData = ctx.getSubRowFormData(ctx.validatorInfo.runtimeValuePath);
|
|
@@ -106504,6 +106544,7 @@ const maxTimeFormulaRule = (ctx) => {
|
|
|
106504
106544
|
if (ctx.enableRangeValidate && ctx.maxDateValidateMode === RangeValidateModeTypeConst.Variable_Validate && ctx.maxDateFormulaExpr) {
|
|
106505
106545
|
return {
|
|
106506
106546
|
required: true,
|
|
106547
|
+
trigger: "change",
|
|
106507
106548
|
async validator(_rule, value, _callback, _source, _options) {
|
|
106508
106549
|
const rawData = ctx.getRawData();
|
|
106509
106550
|
const subRowData = ctx.getSubRowFormData(ctx.validatorInfo.runtimeValuePath);
|
|
@@ -106529,6 +106570,17 @@ const maxTimeFormulaRule = (ctx) => {
|
|
|
106529
106570
|
}
|
|
106530
106571
|
return null;
|
|
106531
106572
|
};
|
|
106573
|
+
function filterRulesByTrigger(rules2, trigger) {
|
|
106574
|
+
if (trigger === "all") return rules2;
|
|
106575
|
+
return rules2.filter((rule) => {
|
|
106576
|
+
const ruleTrigger = rule.trigger;
|
|
106577
|
+
if (!ruleTrigger) return trigger === "change";
|
|
106578
|
+
if (trigger === "blur") {
|
|
106579
|
+
return ruleTrigger === "blur" || ruleTrigger === "change";
|
|
106580
|
+
}
|
|
106581
|
+
return ruleTrigger === trigger;
|
|
106582
|
+
});
|
|
106583
|
+
}
|
|
106532
106584
|
const assembleRules = (ctx) => {
|
|
106533
106585
|
const rules2 = [
|
|
106534
106586
|
requiredRule(ctx),
|
|
@@ -106569,13 +106621,49 @@ function createValidateAll() {
|
|
|
106569
106621
|
}
|
|
106570
106622
|
};
|
|
106571
106623
|
}
|
|
106624
|
+
async function waitForDataSettle() {
|
|
106625
|
+
await nextTick();
|
|
106626
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
106627
|
+
}
|
|
106628
|
+
const DEBOUNCE_MS$1 = 300;
|
|
106629
|
+
const schedulersByDocId = /* @__PURE__ */ new Map();
|
|
106630
|
+
function getScheduler(doc) {
|
|
106631
|
+
let scheduler = schedulersByDocId.get(doc.id);
|
|
106632
|
+
if (!scheduler) {
|
|
106633
|
+
scheduler = { debounceTimer: null, running: false, pendingTrigger: "change" };
|
|
106634
|
+
schedulersByDocId.set(doc.id, scheduler);
|
|
106635
|
+
}
|
|
106636
|
+
return scheduler;
|
|
106637
|
+
}
|
|
106638
|
+
function clearScheduler(doc) {
|
|
106639
|
+
const scheduler = schedulersByDocId.get(doc.id);
|
|
106640
|
+
if (!scheduler) return;
|
|
106641
|
+
if (scheduler.debounceTimer) {
|
|
106642
|
+
clearTimeout(scheduler.debounceTimer);
|
|
106643
|
+
scheduler.debounceTimer = null;
|
|
106644
|
+
}
|
|
106645
|
+
schedulersByDocId.delete(doc.id);
|
|
106646
|
+
}
|
|
106647
|
+
function pruneStaleValidationComments(doc, map) {
|
|
106648
|
+
if (!map) return null;
|
|
106649
|
+
const validPaths = new Set(listWidgetValuePaths(doc));
|
|
106650
|
+
const next = {};
|
|
106651
|
+
for (const [path, errors] of Object.entries(map)) {
|
|
106652
|
+
if (validPaths.has(path)) {
|
|
106653
|
+
next[path] = errors;
|
|
106654
|
+
}
|
|
106655
|
+
}
|
|
106656
|
+
return Object.keys(next).length ? next : null;
|
|
106657
|
+
}
|
|
106572
106658
|
function showValidationComments(doc, map) {
|
|
106573
|
-
doc.eventManager.dispatchCustom(
|
|
106659
|
+
doc.eventManager.dispatchCustom(
|
|
106660
|
+
"inter:show-validation-comment",
|
|
106661
|
+
pruneStaleValidationComments(doc, map)
|
|
106662
|
+
);
|
|
106574
106663
|
}
|
|
106575
|
-
function
|
|
106576
|
-
|
|
106577
|
-
|
|
106578
|
-
return !!map && Object.keys(map).length > 0;
|
|
106664
|
+
function pruneValidationComments(doc) {
|
|
106665
|
+
const current = doc.interactionManager.get("validationCommentMap");
|
|
106666
|
+
showValidationComments(doc, current);
|
|
106579
106667
|
}
|
|
106580
106668
|
function findLayoutNodeByValuePath(doc, runtimeValuePath) {
|
|
106581
106669
|
let found;
|
|
@@ -106656,72 +106744,113 @@ function buildWidgetValidationPayload(doc, widget) {
|
|
|
106656
106744
|
rules: rules2
|
|
106657
106745
|
};
|
|
106658
106746
|
}
|
|
106659
|
-
|
|
106747
|
+
function clearResolvedManualErrors(doc, map) {
|
|
106748
|
+
if (!map) return map;
|
|
106749
|
+
const next = { ...map };
|
|
106750
|
+
for (const path of Object.keys(next)) {
|
|
106751
|
+
const widget = findLayoutNodeByValuePath(doc, path);
|
|
106752
|
+
const payload = widget ? buildWidgetValidationPayload(doc, widget) : null;
|
|
106753
|
+
if (!payload) continue;
|
|
106754
|
+
const hasManual = filterRulesByTrigger(payload.rules, "manual").length > 0;
|
|
106755
|
+
const hasLive = filterRulesByTrigger(payload.rules, "change").length > 0;
|
|
106756
|
+
if (hasManual && !hasLive && !isEmptyValue$1(payload.value)) {
|
|
106757
|
+
delete next[path];
|
|
106758
|
+
}
|
|
106759
|
+
}
|
|
106760
|
+
return Object.keys(next).length ? next : null;
|
|
106761
|
+
}
|
|
106762
|
+
function mergeLiveValidation(doc, liveResult, livePaths) {
|
|
106763
|
+
const current = doc.interactionManager.get("validationCommentMap");
|
|
106764
|
+
const base = current && Object.keys(current).length ? { ...current } : {};
|
|
106765
|
+
for (const path of livePaths) {
|
|
106766
|
+
if (liveResult?.[path]) {
|
|
106767
|
+
base[path] = liveResult[path];
|
|
106768
|
+
} else {
|
|
106769
|
+
delete base[path];
|
|
106770
|
+
}
|
|
106771
|
+
}
|
|
106772
|
+
const merged = Object.keys(base).length ? base : liveResult;
|
|
106773
|
+
return clearResolvedManualErrors(doc, merged);
|
|
106774
|
+
}
|
|
106775
|
+
async function runValidation(doc, mode) {
|
|
106660
106776
|
const formState = {};
|
|
106661
106777
|
const formRules = {};
|
|
106778
|
+
const livePaths = [];
|
|
106662
106779
|
for (const runtimeValuePath of listWidgetValuePaths(doc)) {
|
|
106663
106780
|
const widget = findLayoutNodeByValuePath(doc, runtimeValuePath);
|
|
106664
106781
|
if (!widget) continue;
|
|
106665
106782
|
const payload = buildWidgetValidationPayload(doc, widget);
|
|
106666
106783
|
if (!payload) continue;
|
|
106784
|
+
const activeRules = filterRulesByTrigger(payload.rules, mode);
|
|
106785
|
+
if (!activeRules.length) continue;
|
|
106667
106786
|
formState[payload.runtimeValuePath] = payload.value;
|
|
106668
|
-
formRules[payload.runtimeValuePath] =
|
|
106787
|
+
formRules[payload.runtimeValuePath] = activeRules;
|
|
106788
|
+
if (mode !== "all") {
|
|
106789
|
+
livePaths.push(payload.runtimeValuePath);
|
|
106790
|
+
}
|
|
106791
|
+
}
|
|
106792
|
+
if (!Object.keys(formRules).length) {
|
|
106793
|
+
if (mode === "all") {
|
|
106794
|
+
showValidationComments(doc, null);
|
|
106795
|
+
}
|
|
106796
|
+
return null;
|
|
106669
106797
|
}
|
|
106670
106798
|
const validateAll = createValidateAll();
|
|
106671
106799
|
const result = await validateAll(formRules, formState);
|
|
106672
106800
|
console.log("validateAllFields", result);
|
|
106673
|
-
|
|
106801
|
+
if (mode === "all") {
|
|
106802
|
+
showValidationComments(doc, result);
|
|
106803
|
+
} else {
|
|
106804
|
+
showValidationComments(doc, mergeLiveValidation(doc, result, livePaths));
|
|
106805
|
+
}
|
|
106674
106806
|
return result;
|
|
106675
|
-
}
|
|
106676
|
-
|
|
106677
|
-
const
|
|
106678
|
-
|
|
106679
|
-
|
|
106680
|
-
|
|
106681
|
-
|
|
106682
|
-
|
|
106683
|
-
|
|
106684
|
-
|
|
106685
|
-
|
|
106686
|
-
|
|
106687
|
-
|
|
106688
|
-
|
|
106689
|
-
|
|
106690
|
-
if (running || options.isSuppressed()) return;
|
|
106691
|
-
running = true;
|
|
106692
|
-
try {
|
|
106693
|
-
await waitForDataManagerSettle();
|
|
106694
|
-
if (!hasValidationComments(doc)) return;
|
|
106695
|
-
await validateAllFields(doc);
|
|
106696
|
-
} finally {
|
|
106697
|
-
running = false;
|
|
106698
|
-
}
|
|
106699
|
-
};
|
|
106700
|
-
if (opts?.immediate) {
|
|
106701
|
-
void run();
|
|
106702
|
-
return;
|
|
106703
|
-
}
|
|
106704
|
-
debounceTimer = setTimeout(() => {
|
|
106705
|
-
debounceTimer = null;
|
|
106706
|
-
void run();
|
|
106707
|
-
}, DEBOUNCE_MS$1);
|
|
106708
|
-
},
|
|
106709
|
-
dispose() {
|
|
106710
|
-
if (debounceTimer) {
|
|
106711
|
-
clearTimeout(debounceTimer);
|
|
106712
|
-
debounceTimer = null;
|
|
106713
|
-
}
|
|
106807
|
+
}
|
|
106808
|
+
async function executeValidation(doc, trigger) {
|
|
106809
|
+
const scheduler = getScheduler(doc);
|
|
106810
|
+
if (scheduler.running) {
|
|
106811
|
+
scheduler.pendingTrigger = trigger === "all" ? "all" : trigger;
|
|
106812
|
+
return;
|
|
106813
|
+
}
|
|
106814
|
+
scheduler.running = true;
|
|
106815
|
+
try {
|
|
106816
|
+
await waitForDataSettle();
|
|
106817
|
+
await runValidation(doc, trigger);
|
|
106818
|
+
const pending = scheduler.pendingTrigger;
|
|
106819
|
+
scheduler.pendingTrigger = "change";
|
|
106820
|
+
if (pending !== trigger) {
|
|
106821
|
+
await runValidation(doc, pending);
|
|
106714
106822
|
}
|
|
106715
|
-
}
|
|
106716
|
-
|
|
106717
|
-
|
|
106718
|
-
scheduler.dispose();
|
|
106719
|
-
schedulers.delete(doc);
|
|
106720
|
-
};
|
|
106823
|
+
} finally {
|
|
106824
|
+
scheduler.running = false;
|
|
106825
|
+
}
|
|
106721
106826
|
}
|
|
106722
|
-
function
|
|
106723
|
-
|
|
106827
|
+
function requestFullValidation(doc, options = {}) {
|
|
106828
|
+
const { immediate = false, trigger = "change" } = options;
|
|
106829
|
+
const scheduler = getScheduler(doc);
|
|
106830
|
+
if (immediate) {
|
|
106831
|
+
if (scheduler.debounceTimer) {
|
|
106832
|
+
clearTimeout(scheduler.debounceTimer);
|
|
106833
|
+
scheduler.debounceTimer = null;
|
|
106834
|
+
}
|
|
106835
|
+
void executeValidation(doc, trigger);
|
|
106836
|
+
return;
|
|
106837
|
+
}
|
|
106838
|
+
scheduler.pendingTrigger = trigger;
|
|
106839
|
+
if (scheduler.debounceTimer) {
|
|
106840
|
+
clearTimeout(scheduler.debounceTimer);
|
|
106841
|
+
}
|
|
106842
|
+
scheduler.debounceTimer = setTimeout(() => {
|
|
106843
|
+
scheduler.debounceTimer = null;
|
|
106844
|
+
void executeValidation(doc, scheduler.pendingTrigger);
|
|
106845
|
+
}, DEBOUNCE_MS$1);
|
|
106724
106846
|
}
|
|
106847
|
+
function disposeDocValidationScheduler(doc) {
|
|
106848
|
+
clearScheduler(doc);
|
|
106849
|
+
}
|
|
106850
|
+
const validateAllFields = async (doc) => {
|
|
106851
|
+
await waitForDataSettle();
|
|
106852
|
+
return runValidation(doc, "all");
|
|
106853
|
+
};
|
|
106725
106854
|
const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
106726
106855
|
__name: "overlay-render",
|
|
106727
106856
|
props: {
|
|
@@ -106809,16 +106938,21 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
106809
106938
|
const showActionIcon = computed(() => !!actionConfig.value.icon);
|
|
106810
106939
|
watch(
|
|
106811
106940
|
() => [interCtx.focusModelId, interCtx.focusTick],
|
|
106812
|
-
([modelId], [oldModelId]) => {
|
|
106941
|
+
async ([modelId], [oldModelId]) => {
|
|
106813
106942
|
const isCurrent = modelId === props.modelId;
|
|
106814
106943
|
const wasCurrent = oldModelId === props.modelId;
|
|
106815
106944
|
if (wasCurrent && !isCurrent) {
|
|
106816
106945
|
console.log("blur");
|
|
106817
|
-
props.doc.eventManager.dispatchCustom(
|
|
106818
|
-
|
|
106819
|
-
|
|
106820
|
-
|
|
106821
|
-
|
|
106946
|
+
const commitTasks = props.doc.eventManager.dispatchCustom(
|
|
106947
|
+
"ime:commit-validate",
|
|
106948
|
+
{
|
|
106949
|
+
valuePath: runtimeValuePath.value,
|
|
106950
|
+
formats: buildNumberFormats(widgetProps.value, widgetType.value)
|
|
106951
|
+
}
|
|
106952
|
+
);
|
|
106953
|
+
await Promise.all(commitTasks);
|
|
106954
|
+
await waitForDataManagerSettle();
|
|
106955
|
+
requestFullValidation(props.doc, { immediate: true, trigger: "blur" });
|
|
106822
106956
|
}
|
|
106823
106957
|
if (isCurrent) {
|
|
106824
106958
|
console.log("focus");
|
|
@@ -106867,7 +107001,6 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
106867
107001
|
designCtx.runtime.getMasterSlaveFieldList(props.doc.mainModelKey)
|
|
106868
107002
|
);
|
|
106869
107003
|
props.doc.dataManager.setMultiple({ ...payload, ...dataValues });
|
|
106870
|
-
requestValidationRefresh(props.doc, true);
|
|
106871
107004
|
}
|
|
106872
107005
|
}
|
|
106873
107006
|
});
|
|
@@ -106924,7 +107057,6 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
106924
107057
|
const savedValue = await bodyRef?.value?.onSave?.();
|
|
106925
107058
|
if (!savedValue) return;
|
|
106926
107059
|
props.doc.dataManager.setMultiple(savedValue);
|
|
106927
|
-
requestValidationRefresh(props.doc, true);
|
|
106928
107060
|
close();
|
|
106929
107061
|
} catch (error) {
|
|
106930
107062
|
GctMessage.warning("业务处理失败,请联系管理员");
|
|
@@ -106947,7 +107079,9 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
106947
107079
|
if (subFieldValuePath && isNumber(dataIndex)) {
|
|
106948
107080
|
const parsed = parseValuePath(subFieldValuePath);
|
|
106949
107081
|
const { parentFieldPath } = parsed;
|
|
106950
|
-
const allRegions = props.doc.model?.document.body.children.flatMap(
|
|
107082
|
+
const allRegions = props.doc.model?.document.body.children.flatMap(
|
|
107083
|
+
(w2) => w2.name === "w:tbl" ? w2.regions : []
|
|
107084
|
+
);
|
|
106951
107085
|
const isMaterialConsumeTable = allRegions?.find((r) => r.valuePath === parentFieldPath)?.type === "material-consume-table";
|
|
106952
107086
|
if (isMaterialConsumeTable && tmplBomCRef?.value) {
|
|
106953
107087
|
const tableController = tmplBomCRef.value.tableControllers[parentFieldPath];
|
|
@@ -106960,7 +107094,6 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
106960
107094
|
});
|
|
106961
107095
|
}
|
|
106962
107096
|
}
|
|
106963
|
-
requestValidationRefresh(props.doc, true);
|
|
106964
107097
|
}
|
|
106965
107098
|
return (_ctx, _cache) => {
|
|
106966
107099
|
return isTargetReady.value ? (openBlock(), createBlock(Teleport, {
|
|
@@ -107024,7 +107157,7 @@ const _sfc_main$2O = /* @__PURE__ */ defineComponent({
|
|
|
107024
107157
|
};
|
|
107025
107158
|
}
|
|
107026
107159
|
});
|
|
107027
|
-
const OverlayRender = /* @__PURE__ */ _export_sfc(_sfc_main$2O, [["__scopeId", "data-v-
|
|
107160
|
+
const OverlayRender = /* @__PURE__ */ _export_sfc(_sfc_main$2O, [["__scopeId", "data-v-4da4215f"]]);
|
|
107028
107161
|
let activeHoverId = 0;
|
|
107029
107162
|
function useHoverDelay(callback, delay = 120) {
|
|
107030
107163
|
let timer = null;
|
|
@@ -109325,7 +109458,10 @@ const _hoisted_9$a = { class: "item-icon scale-large" };
|
|
|
109325
109458
|
const _hoisted_10$7 = { class: "item-label flex-between-center" };
|
|
109326
109459
|
const _hoisted_11$5 = { class: "item-icon scale-large" };
|
|
109327
109460
|
const _hoisted_12$4 = { class: "item-label flex-between-center" };
|
|
109328
|
-
const _hoisted_13$3 = {
|
|
109461
|
+
const _hoisted_13$3 = {
|
|
109462
|
+
key: 1,
|
|
109463
|
+
class: "action-menu"
|
|
109464
|
+
};
|
|
109329
109465
|
const _hoisted_14$3 = { class: "item-icon" };
|
|
109330
109466
|
const _hoisted_15$2 = { class: "more-btn" };
|
|
109331
109467
|
const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
@@ -109372,15 +109508,19 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109372
109508
|
const isMaterialConsumeTable = computed(() => {
|
|
109373
109509
|
return props.cell?.subRenderer?.type === "material-consume-table";
|
|
109374
109510
|
});
|
|
109375
|
-
const
|
|
109376
|
-
const { subFieldKey } = getCtx();
|
|
109377
|
-
const { dataIndex: rowIndex } = props.cell.subRenderer;
|
|
109511
|
+
const computedInfo = computed(() => {
|
|
109512
|
+
const { index: rowIndex, subFieldKey } = getCtx();
|
|
109378
109513
|
const tableData = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
|
|
109379
|
-
|
|
109514
|
+
const isDeleteBtnVisible = tableData.length >= 2;
|
|
109515
|
+
const isRowConfirmed = !!tableData[rowIndex]?.is_confirmed_;
|
|
109516
|
+
return {
|
|
109517
|
+
isDeleteBtnVisible,
|
|
109518
|
+
isRowConfirmed
|
|
109519
|
+
};
|
|
109380
109520
|
});
|
|
109381
109521
|
const materialMenuList = computed(() => {
|
|
109382
109522
|
return [
|
|
109383
|
-
{ icon: "icon-bianji", label: "编辑行", value: "edit", visible:
|
|
109523
|
+
{ icon: "icon-bianji", label: "编辑行", value: "edit", visible: computedInfo.value.isRowConfirmed },
|
|
109384
109524
|
{ icon: "icon-saoyisao", label: "条码扫描", value: "scan", visible: props.isLastGroup },
|
|
109385
109525
|
{ icon: "icon-a-bom11", label: "BOM", value: "bom", visible: props.isLastGroup },
|
|
109386
109526
|
{ icon: "icon-tiaomajiexi", label: "条码解析规则变更", value: "change", visible: props.isLastGroup }
|
|
@@ -109390,11 +109530,11 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109390
109530
|
if (!tmplBomCRef?.value?.tableControllers || !props.cell?.subRenderer?.valuePath) return;
|
|
109391
109531
|
const tableController = tmplBomCRef.value.tableControllers[props.cell.subRenderer.valuePath];
|
|
109392
109532
|
if (!tableController) return;
|
|
109393
|
-
const { subFieldKey } = getCtx();
|
|
109533
|
+
const { index: rowIndex, subFieldKey } = getCtx();
|
|
109394
109534
|
if (!subFieldKey) return;
|
|
109395
109535
|
const { dataManager } = docInst.value;
|
|
109396
109536
|
const tableData = dataManager.getRawData()[subFieldKey] ?? [];
|
|
109397
|
-
const {
|
|
109537
|
+
const { tableName } = props.cell.subRenderer;
|
|
109398
109538
|
let row = tableData[rowIndex];
|
|
109399
109539
|
const insertEmptyRow = (row2, rowIndex2, cb) => {
|
|
109400
109540
|
if (!row2) {
|
|
@@ -109421,19 +109561,44 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109421
109561
|
tableController.changeScanRule(props.doc.mainModelKey, subModelKey);
|
|
109422
109562
|
}
|
|
109423
109563
|
};
|
|
109564
|
+
const getIsAddable = () => {
|
|
109565
|
+
if (isMaterialConsumeTable.value) {
|
|
109566
|
+
const { subFieldKey } = getCtx();
|
|
109567
|
+
const tableData = docInst.value.dataManager.getRawData()[subFieldKey] ?? [];
|
|
109568
|
+
const isAllConfirmed = tableData.every((row) => row.is_confirmed_);
|
|
109569
|
+
if (!isAllConfirmed) {
|
|
109570
|
+
GctMessage.error("同时只能有一条数据开启编辑状态");
|
|
109571
|
+
}
|
|
109572
|
+
return isAllConfirmed;
|
|
109573
|
+
}
|
|
109574
|
+
return true;
|
|
109575
|
+
};
|
|
109576
|
+
const handleAddRowAfter = (subFieldKey, rowIndex) => {
|
|
109577
|
+
if (isMaterialConsumeTable.value) {
|
|
109578
|
+
MCDataUtil.disableQtyFields(props.doc.dataManager, `$.${subFieldKey}[${rowIndex}]`);
|
|
109579
|
+
}
|
|
109580
|
+
};
|
|
109424
109581
|
const insertRows = (index2, count = 1) => {
|
|
109425
|
-
|
|
109582
|
+
if (!getIsAddable()) return;
|
|
109583
|
+
const { path, subFieldKey } = getCtx();
|
|
109426
109584
|
props.doc.dataManager.insertAt(path, index2, ...Array.from({ length: count }, () => ({})));
|
|
109585
|
+
handleAddRowAfter(subFieldKey, index2);
|
|
109427
109586
|
};
|
|
109428
109587
|
const removeRow = () => {
|
|
109429
109588
|
const { path, index: index2 } = getCtx();
|
|
109430
109589
|
props.doc.dataManager.removeAt(path, index2);
|
|
109431
109590
|
};
|
|
109432
109591
|
const copyRow = () => {
|
|
109433
|
-
|
|
109592
|
+
if (!getIsAddable()) return;
|
|
109593
|
+
const { path, index: index2, subFieldKey } = getCtx();
|
|
109434
109594
|
const storageIndex = props.doc.dataManager.resolveSubtableVisibleIndex(path, index2);
|
|
109435
|
-
|
|
109436
|
-
|
|
109595
|
+
let data = props.doc.dataManager.get(`${path}[${storageIndex}]`) || {};
|
|
109596
|
+
data = omit(data, "id_");
|
|
109597
|
+
if (isMaterialConsumeTable.value) {
|
|
109598
|
+
data = omit(data, "is_confirmed_");
|
|
109599
|
+
}
|
|
109600
|
+
props.doc.dataManager.insertAt(path, index2 + 1, data);
|
|
109601
|
+
handleAddRowAfter(subFieldKey, index2 + 1);
|
|
109437
109602
|
};
|
|
109438
109603
|
const actionHandlers = {
|
|
109439
109604
|
insertRowAfter() {
|
|
@@ -109468,8 +109633,8 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109468
109633
|
createElementVNode("div", _hoisted_1$1K, [
|
|
109469
109634
|
createVNode(unref(_sfc_main$3q), {
|
|
109470
109635
|
placement: "bottom-end",
|
|
109471
|
-
triggers: ["
|
|
109472
|
-
popperTriggers: ["
|
|
109636
|
+
triggers: ["click"],
|
|
109637
|
+
popperTriggers: ["click"],
|
|
109473
109638
|
delay: HOVER_DELAY,
|
|
109474
109639
|
"instant-move": ""
|
|
109475
109640
|
}, {
|
|
@@ -109514,7 +109679,8 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109514
109679
|
]),
|
|
109515
109680
|
_cache[12] || (_cache[12] = createElementVNode("div", { class: "item-label" }, " 复制行 ", -1))
|
|
109516
109681
|
]),
|
|
109517
|
-
|
|
109682
|
+
!isMaterialConsumeTable.value ? (openBlock(), createElementBlock("div", {
|
|
109683
|
+
key: 0,
|
|
109518
109684
|
class: "menu-item",
|
|
109519
109685
|
onClick: _cache[4] || (_cache[4] = ($event) => handleAction("insertRowBeforeMore"))
|
|
109520
109686
|
}, [
|
|
@@ -109533,8 +109699,9 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109533
109699
|
}, ["stop"]))
|
|
109534
109700
|
}, null, 8, ["modelValue"])
|
|
109535
109701
|
])
|
|
109536
|
-
]),
|
|
109537
|
-
|
|
109702
|
+
])) : createCommentVNode("", true),
|
|
109703
|
+
!isMaterialConsumeTable.value ? (openBlock(), createElementBlock("div", {
|
|
109704
|
+
key: 1,
|
|
109538
109705
|
class: "menu-item",
|
|
109539
109706
|
onClick: _cache[7] || (_cache[7] = ($event) => handleAction("insertRowAfterMore"))
|
|
109540
109707
|
}, [
|
|
@@ -109553,9 +109720,9 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109553
109720
|
}, ["stop"]))
|
|
109554
109721
|
}, null, 8, ["modelValue"])
|
|
109555
109722
|
])
|
|
109556
|
-
])
|
|
109723
|
+
])) : createCommentVNode("", true)
|
|
109557
109724
|
]),
|
|
109558
|
-
|
|
109725
|
+
computedInfo.value.isDeleteBtnVisible ? (openBlock(), createElementBlock("div", _hoisted_13$3, [
|
|
109559
109726
|
createElementVNode("div", {
|
|
109560
109727
|
class: "menu-item",
|
|
109561
109728
|
onClick: _cache[8] || (_cache[8] = ($event) => handleAction("deleteRowCurrent"))
|
|
@@ -109565,7 +109732,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109565
109732
|
]),
|
|
109566
109733
|
_cache[16] || (_cache[16] = createElementVNode("div", { class: "item-label" }, " 删除行 ", -1))
|
|
109567
109734
|
])
|
|
109568
|
-
])
|
|
109735
|
+
])) : createCommentVNode("", true)
|
|
109569
109736
|
])
|
|
109570
109737
|
]),
|
|
109571
109738
|
default: withCtx(() => [
|
|
@@ -109578,7 +109745,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109578
109745
|
]),
|
|
109579
109746
|
_: 1
|
|
109580
109747
|
}),
|
|
109581
|
-
isMaterialConsumeTable.value && __props.isLastGroup && !
|
|
109748
|
+
isMaterialConsumeTable.value && __props.isLastGroup && !computedInfo.value.isRowConfirmed ? (openBlock(), createElementBlock("div", {
|
|
109582
109749
|
key: 0,
|
|
109583
109750
|
class: "confirm-btn",
|
|
109584
109751
|
onClick: _cache[9] || (_cache[9] = ($event) => handleMaterialConsumeAction("confirm"))
|
|
@@ -109594,7 +109761,7 @@ const _sfc_main$2w = /* @__PURE__ */ defineComponent({
|
|
|
109594
109761
|
};
|
|
109595
109762
|
}
|
|
109596
109763
|
});
|
|
109597
|
-
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-
|
|
109764
|
+
const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__scopeId", "data-v-59412dfb"]]);
|
|
109598
109765
|
const _sfc_main$2v = /* @__PURE__ */ defineComponent({
|
|
109599
109766
|
__name: "index",
|
|
109600
109767
|
props: {
|
|
@@ -110493,10 +110660,10 @@ function useDocLooperAutoSaveNotify(factory2, ops, options) {
|
|
|
110493
110660
|
function useValidationFullSync(factory2, options) {
|
|
110494
110661
|
let suppress = true;
|
|
110495
110662
|
let unsubscribeData = null;
|
|
110496
|
-
let unregisterRefresh = null;
|
|
110497
110663
|
let stopWatchDoc = null;
|
|
110498
110664
|
let stopWatchTick = null;
|
|
110499
110665
|
let knownWidgetPaths = /* @__PURE__ */ new Set();
|
|
110666
|
+
let boundDoc = null;
|
|
110500
110667
|
function isSuppressed() {
|
|
110501
110668
|
return suppress || !!options?.suppressSignal?.value;
|
|
110502
110669
|
}
|
|
@@ -110506,30 +110673,34 @@ function useValidationFullSync(factory2, options) {
|
|
|
110506
110673
|
function disposeSubscriptions() {
|
|
110507
110674
|
unsubscribeData?.();
|
|
110508
110675
|
unsubscribeData = null;
|
|
110509
|
-
unregisterRefresh?.();
|
|
110510
|
-
unregisterRefresh = null;
|
|
110511
110676
|
stopWatchTick?.();
|
|
110512
110677
|
stopWatchTick = null;
|
|
110678
|
+
if (boundDoc) {
|
|
110679
|
+
disposeDocValidationScheduler(boundDoc);
|
|
110680
|
+
}
|
|
110681
|
+
boundDoc = null;
|
|
110513
110682
|
}
|
|
110514
110683
|
function bindDoc() {
|
|
110515
110684
|
disposeSubscriptions();
|
|
110516
110685
|
const doc = factory2.docIns.value;
|
|
110517
110686
|
if (!doc) return;
|
|
110687
|
+
boundDoc = doc;
|
|
110518
110688
|
snapshotWidgetPaths(doc);
|
|
110519
|
-
unregisterRefresh = registerDocValidationRefresh(doc, { isSuppressed });
|
|
110520
110689
|
unsubscribeData = doc.dataManager.subscribe("$", () => {
|
|
110521
|
-
|
|
110690
|
+
if (isSuppressed()) return;
|
|
110691
|
+
requestFullValidation(doc, { trigger: "change" });
|
|
110522
110692
|
});
|
|
110523
110693
|
stopWatchTick = watch(
|
|
110524
110694
|
() => factory2.docInfo.value.updateTick,
|
|
110525
110695
|
() => {
|
|
110526
110696
|
const currentDoc = factory2.docIns.value;
|
|
110527
|
-
if (!currentDoc ||
|
|
110697
|
+
if (!currentDoc || isSuppressed()) return;
|
|
110528
110698
|
const currentPaths = new Set(listWidgetValuePaths(currentDoc));
|
|
110529
110699
|
const hasRowStructureChange = [...currentPaths].some((path) => !knownWidgetPaths.has(path)) || [...knownWidgetPaths].some((path) => !currentPaths.has(path));
|
|
110530
110700
|
if (!hasRowStructureChange) return;
|
|
110531
110701
|
snapshotWidgetPaths(currentDoc);
|
|
110532
|
-
|
|
110702
|
+
pruneValidationComments(currentDoc);
|
|
110703
|
+
requestFullValidation(currentDoc, { immediate: true, trigger: "change" });
|
|
110533
110704
|
}
|
|
110534
110705
|
);
|
|
110535
110706
|
}
|
package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts
CHANGED
|
@@ -42,6 +42,21 @@ export declare class MCDataUtil {
|
|
|
42
42
|
/** 设置的值(不给则true) */
|
|
43
43
|
disabled?: boolean;
|
|
44
44
|
}): void;
|
|
45
|
+
/**
|
|
46
|
+
* 物料消耗表 需求数量、已消耗数量 不可修改
|
|
47
|
+
* @param rowPath $.f_sub[n] n 必须为数字
|
|
48
|
+
*/
|
|
49
|
+
static disableQtyFields(dataManager: DataManager, rowPath: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* 物料消耗表 更新[需求数量、已消耗数量]以外字段是否禁用
|
|
52
|
+
* @param rowPath $.f_sub[n] n 必须为数字
|
|
53
|
+
*/
|
|
54
|
+
static updateOtherFieldsDisabled(option: {
|
|
55
|
+
dataManager: DataManager;
|
|
56
|
+
rowPath: string;
|
|
57
|
+
row: any;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
}): void;
|
|
45
60
|
/**
|
|
46
61
|
* 设置行数据的编辑状态
|
|
47
62
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Doc } from '../../core';
|
|
2
2
|
export type ValidateTrigger = 'change' | 'blur' | 'focus' | 'manual';
|
|
3
|
+
/** 按触发时机过滤规则(manual=仅提交,change/blur=编辑时) */
|
|
4
|
+
export declare function filterRulesByTrigger(rules: any[], trigger: ValidateTrigger | 'all'): any[];
|
|
3
5
|
/** 组装校验 */
|
|
4
6
|
export declare const assembleRules: (ctx: any) => any;
|
|
5
7
|
export declare const createValidatorContext: (doc: Doc, ctx: any) => any;
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import { ValidateTrigger } from './createValidateFactory';
|
|
1
2
|
import { Doc } from '../../core';
|
|
2
3
|
export type ValidationCommentMap = Record<string, Array<{
|
|
3
4
|
field: string;
|
|
4
5
|
fieldValue: any;
|
|
5
6
|
message: string;
|
|
6
7
|
}>> | null;
|
|
8
|
+
export type ValidationRunMode = ValidateTrigger | 'all';
|
|
9
|
+
/** 移除布局中已不存在字段的批注(子表删行等场景) */
|
|
10
|
+
export declare function pruneStaleValidationComments(doc: Doc, map: ValidationCommentMap): ValidationCommentMap;
|
|
7
11
|
/** 更新校验批注面板 */
|
|
8
12
|
export declare function showValidationComments(doc: Doc, map: ValidationCommentMap): void;
|
|
13
|
+
/** 立即清理失效批注并刷新面板(子表删行等) */
|
|
14
|
+
export declare function pruneValidationComments(doc: Doc): void;
|
|
9
15
|
export declare function hasValidationComments(doc: Doc | null | undefined): boolean;
|
|
10
16
|
/** 按运行时 valuePath 在布局树中查找对应 widget 节点(子表每行 path 唯一) */
|
|
11
17
|
export declare function findLayoutNodeByValuePath(doc: Doc, runtimeValuePath: string): any;
|
|
12
18
|
/** 校验批注连线坐标:优先按 valuePath 存取,兼容旧版 modelId */
|
|
13
19
|
export declare function getValidationCommentPoints(widgetMeta: any, runtimeValuePath: string, modelId?: string): any;
|
|
14
20
|
export declare function listWidgetValuePaths(doc: Doc): string[];
|
|
15
|
-
/**
|
|
21
|
+
/** 请求全量校验(编辑时按 trigger 过滤规则;按钮提交用 mode=all) */
|
|
22
|
+
export declare function requestFullValidation(doc: Doc, options?: {
|
|
23
|
+
immediate?: boolean;
|
|
24
|
+
trigger?: ValidationRunMode;
|
|
25
|
+
}): void;
|
|
26
|
+
export declare function disposeDocValidationScheduler(doc: Doc): void;
|
|
27
|
+
/** 提交校验:执行全部规则(含必填 manual) */
|
|
16
28
|
export declare const validateAllFields: (doc: Doc) => Promise<any>;
|
|
@@ -4,6 +4,6 @@ export interface UseValidationFullSyncOptions {
|
|
|
4
4
|
suppressSignal?: ShallowRef<boolean>;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 文档加载完成后,监听全局数据变更($)并防抖全量重校验;子表增删行后立即全量重校验。
|
|
8
8
|
*/
|
|
9
9
|
export declare function useValidationFullSync(factory: DocumentFactory, options?: UseValidationFullSyncOptions): () => void;
|
|
@@ -19,6 +19,8 @@ interface IDeviceConfig {
|
|
|
19
19
|
defaultOrgId: string | undefined;
|
|
20
20
|
/** 默认的物料查询条件 */
|
|
21
21
|
defaultProductSearchFields: string;
|
|
22
|
+
/** 是否启用人员字段 false: 不使用 true: 使用;先留着扩展,后续如果需要在字段列表过滤才使用 */
|
|
23
|
+
enableUserField: boolean;
|
|
22
24
|
}
|
|
23
25
|
export interface IDocTemplatePayload {
|
|
24
26
|
/** 渲染模式类型 */
|
package/dist/word.css
CHANGED
|
@@ -8195,7 +8195,7 @@ textarea[data-v-57fe54a3]::placeholder {
|
|
|
8195
8195
|
width: 100%;
|
|
8196
8196
|
height: 100%;
|
|
8197
8197
|
}
|
|
8198
|
-
.widget-container-action[data-v-
|
|
8198
|
+
.widget-container-action[data-v-4da4215f] {
|
|
8199
8199
|
position: absolute;
|
|
8200
8200
|
inset: 0;
|
|
8201
8201
|
z-index: 999;
|
|
@@ -8203,7 +8203,7 @@ textarea[data-v-57fe54a3]::placeholder {
|
|
|
8203
8203
|
height: 0;
|
|
8204
8204
|
pointer-events: all;
|
|
8205
8205
|
}
|
|
8206
|
-
.picker-trigger[data-v-
|
|
8206
|
+
.picker-trigger[data-v-4da4215f] {
|
|
8207
8207
|
width: 100%;
|
|
8208
8208
|
height: 100%;
|
|
8209
8209
|
display: flex;
|
|
@@ -8215,14 +8215,14 @@ textarea[data-v-57fe54a3]::placeholder {
|
|
|
8215
8215
|
border-radius: 2px;
|
|
8216
8216
|
outline: none;
|
|
8217
8217
|
}
|
|
8218
|
-
.picker-trigger.disabled[data-v-
|
|
8218
|
+
.picker-trigger.disabled[data-v-4da4215f] {
|
|
8219
8219
|
cursor: not-allowed;
|
|
8220
8220
|
border: 1px solid rgba(13, 13, 13, 0.12);
|
|
8221
8221
|
}
|
|
8222
|
-
.picker-trigger.disabled .gct-icon[data-v-
|
|
8222
|
+
.picker-trigger.disabled .gct-icon[data-v-4da4215f] {
|
|
8223
8223
|
color: rgba(0, 0, 0, 0.25);
|
|
8224
8224
|
}
|
|
8225
|
-
.picker-trigger.readonly[data-v-
|
|
8225
|
+
.picker-trigger.readonly[data-v-4da4215f] {
|
|
8226
8226
|
cursor: default;
|
|
8227
8227
|
}
|
|
8228
8228
|
.resize-box[data-v-788ab62c] {
|
|
@@ -8680,66 +8680,66 @@ textarea[data-v-57fe54a3]::placeholder {
|
|
|
8680
8680
|
.table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
|
|
8681
8681
|
transform: translateY(-100%);
|
|
8682
8682
|
}
|
|
8683
|
-
.sub-table-action-container[data-v-
|
|
8683
|
+
.sub-table-action-container[data-v-59412dfb] {
|
|
8684
8684
|
position: absolute;
|
|
8685
8685
|
z-index: 999;
|
|
8686
8686
|
}
|
|
8687
|
-
.sub-table-action-bar[data-v-
|
|
8688
|
-
.sub-table-action-popper[data-v-
|
|
8687
|
+
.sub-table-action-bar[data-v-59412dfb],
|
|
8688
|
+
.sub-table-action-popper[data-v-59412dfb] {
|
|
8689
8689
|
pointer-events: auto;
|
|
8690
8690
|
user-select: none;
|
|
8691
8691
|
}
|
|
8692
|
-
.sub-table-action-bar[data-v-
|
|
8692
|
+
.sub-table-action-bar[data-v-59412dfb] {
|
|
8693
8693
|
display: flex;
|
|
8694
8694
|
}
|
|
8695
|
-
.sub-table-action-bar .more-btn[data-v-
|
|
8696
|
-
.sub-table-action-bar .confirm-btn[data-v-
|
|
8695
|
+
.sub-table-action-bar .more-btn[data-v-59412dfb],
|
|
8696
|
+
.sub-table-action-bar .confirm-btn[data-v-59412dfb] {
|
|
8697
8697
|
display: flex;
|
|
8698
8698
|
justify-content: center;
|
|
8699
8699
|
align-items: center;
|
|
8700
|
-
width:
|
|
8701
|
-
height:
|
|
8700
|
+
width: 24px;
|
|
8701
|
+
height: 24px;
|
|
8702
8702
|
cursor: pointer;
|
|
8703
8703
|
box-sizing: border-box;
|
|
8704
8704
|
}
|
|
8705
|
-
.sub-table-action-bar .more-btn[data-v-
|
|
8705
|
+
.sub-table-action-bar .more-btn[data-v-59412dfb] {
|
|
8706
8706
|
width: 10px;
|
|
8707
8707
|
background: #026ac8;
|
|
8708
8708
|
border-radius: 0 4px 4px 0;
|
|
8709
8709
|
}
|
|
8710
|
-
.sub-table-action-bar .confirm-btn[data-v-
|
|
8710
|
+
.sub-table-action-bar .confirm-btn[data-v-59412dfb] {
|
|
8711
8711
|
margin-left: 4px;
|
|
8712
8712
|
border-radius: 4px;
|
|
8713
8713
|
border: 1px solid #4ec262;
|
|
8714
8714
|
}
|
|
8715
|
-
.sub-table-action-popper[data-v-
|
|
8715
|
+
.sub-table-action-popper[data-v-59412dfb] {
|
|
8716
8716
|
padding: 2px 8px;
|
|
8717
8717
|
}
|
|
8718
|
-
.sub-table-action-popper .action-menu[data-v-
|
|
8718
|
+
.sub-table-action-popper .action-menu[data-v-59412dfb] {
|
|
8719
8719
|
padding: 4px 0;
|
|
8720
8720
|
width: 220px;
|
|
8721
8721
|
user-select: none;
|
|
8722
8722
|
}
|
|
8723
|
-
.sub-table-action-popper .action-menu + .action-menu[data-v-
|
|
8723
|
+
.sub-table-action-popper .action-menu + .action-menu[data-v-59412dfb] {
|
|
8724
8724
|
margin-top: 4px;
|
|
8725
8725
|
padding-top: 4px;
|
|
8726
8726
|
border-top: 1px solid #efefef;
|
|
8727
8727
|
}
|
|
8728
|
-
.sub-table-action-popper .action-menu .menu-title[data-v-
|
|
8728
|
+
.sub-table-action-popper .action-menu .menu-title[data-v-59412dfb] {
|
|
8729
8729
|
color: #bcbcbc;
|
|
8730
8730
|
margin: 4px 0;
|
|
8731
8731
|
}
|
|
8732
|
-
.sub-table-action-popper .action-menu .menu-item[data-v-
|
|
8732
|
+
.sub-table-action-popper .action-menu .menu-item[data-v-59412dfb] {
|
|
8733
8733
|
display: flex;
|
|
8734
8734
|
align-items: center;
|
|
8735
8735
|
padding: 8px 10px;
|
|
8736
8736
|
border-radius: 4px;
|
|
8737
8737
|
}
|
|
8738
|
-
.sub-table-action-popper .action-menu .menu-item[data-v-
|
|
8738
|
+
.sub-table-action-popper .action-menu .menu-item[data-v-59412dfb]:hover {
|
|
8739
8739
|
cursor: pointer;
|
|
8740
8740
|
background-color: #f2f5f8;
|
|
8741
8741
|
}
|
|
8742
|
-
.sub-table-action-popper .action-menu .menu-item .item-icon[data-v-
|
|
8742
|
+
.sub-table-action-popper .action-menu .menu-item .item-icon[data-v-59412dfb] {
|
|
8743
8743
|
display: flex;
|
|
8744
8744
|
align-items: center;
|
|
8745
8745
|
justify-content: start;
|
|
@@ -8747,14 +8747,14 @@ textarea[data-v-57fe54a3]::placeholder {
|
|
|
8747
8747
|
width: 20px;
|
|
8748
8748
|
height: 20px;
|
|
8749
8749
|
}
|
|
8750
|
-
.sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-
|
|
8750
|
+
.sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-59412dfb] {
|
|
8751
8751
|
transform: scale(1.5);
|
|
8752
8752
|
}
|
|
8753
|
-
.sub-table-action-popper .action-menu .menu-item .item-label[data-v-
|
|
8753
|
+
.sub-table-action-popper .action-menu .menu-item .item-label[data-v-59412dfb] {
|
|
8754
8754
|
flex-grow: 1;
|
|
8755
8755
|
margin-left: 8px;
|
|
8756
8756
|
}
|
|
8757
|
-
.sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-
|
|
8757
|
+
.sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-59412dfb] {
|
|
8758
8758
|
display: flex;
|
|
8759
8759
|
justify-content: space-between;
|
|
8760
8760
|
align-items: center;
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Doc } from '../../core';
|
|
2
|
-
/** 注册文档级防抖全量校验刷新(批注面板已展示时才执行) */
|
|
3
|
-
export declare function registerDocValidationRefresh(doc: Doc, options: {
|
|
4
|
-
isSuppressed: () => boolean;
|
|
5
|
-
}): () => void;
|
|
6
|
-
/** 请求在数据/选择/行列变更后刷新全量校验批注 */
|
|
7
|
-
export declare function requestValidationRefresh(doc: Doc, immediate?: boolean): void;
|