@gct-paas/word 0.2.40-beta.0 → 0.2.40-beta.1
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/domain/table/business/material/material-consume/profile/product-fields.d.ts +6 -0
- package/dist/domain/table/design/hooks/on-field-attach.d.ts +3 -0
- package/dist/index.es.js +597 -258
- package/dist/runtime/canvas/table/render/material-consume/bom-validator.d.ts +8 -3
- package/dist/runtime/canvas/table/render/material-consume/initial-product-autofill.d.ts +6 -0
- package/dist/runtime/canvas/table/render/material-consume/material-consume-table-controller.d.ts +11 -7
- package/dist/runtime/canvas/table/render/material-consume/product-autofill.d.ts +7 -0
- package/dist/runtime/canvas/table/render/material-consume/product-source.d.ts +4 -0
- package/dist/runtime/canvas/table/render/material-consume/scan-fill.d.ts +7 -2
- package/dist/runtime/factories/createDesignWidgetFactory.d.ts +2 -0
- package/dist/suites/shared/panel/config/editor/ref-autofill-editor/autofill-runtime.d.ts +2 -0
- package/dist/utils/func/number-util.d.ts +9 -0
- package/dist/word.css +15 -15
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @gct-paas/word v0.2.40-beta.
|
|
1
|
+
/*! @gct-paas/word v0.2.40-beta.1 */
|
|
2
2
|
import { Fragment, Suspense, Teleport, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toHandlers, toRaw, toRef, toValue, unref, useAttrs, useCssVars, useModel, useSlots, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
3
3
|
import fa, { PopperWrapper } from "floating-vue";
|
|
4
4
|
import VueKonva from "vue-konva";
|
|
@@ -115127,7 +115127,7 @@ function collectAttachFieldItems(props) {
|
|
|
115127
115127
|
return items;
|
|
115128
115128
|
}
|
|
115129
115129
|
async function resolveFieldDefaults(params) {
|
|
115130
|
-
const { props, field, ctx, context, instances, isInvalidDesignerDefault } = params;
|
|
115130
|
+
const { props, field, ctx, context, instances, isInvalidDesignerDefault, masterSlaveList } = params;
|
|
115131
115131
|
const manifest = ctx.getFieldManifest(field.fieldType);
|
|
115132
115132
|
if (!(manifest === null || manifest === void 0 ? void 0 : manifest.computed)) return;
|
|
115133
115133
|
const { defaultValueRule } = manifest.computed;
|
|
@@ -115146,7 +115146,8 @@ async function resolveFieldDefaults(params) {
|
|
|
115146
115146
|
...defaults,
|
|
115147
115147
|
[field.valuePath]: void 0
|
|
115148
115148
|
};
|
|
115149
|
-
const
|
|
115149
|
+
const subKey = parseValuePath(field.valuePath).parentFieldKey;
|
|
115150
|
+
const autofillDefaultValues = field.fieldType === FIELD_TYPE.PRODUCT && !field.isLinkedModelField && !!subKey && masterSlaveList.some((item) => item.key === subKey && item.refModelType === "MATERIAL_CONSUME") ? {} : await loadDefaultValueByAutofillRules(instances, props.autofillRules, field, context, props.autofillEnabled);
|
|
115150
115151
|
return Object.assign(defaults ?? {}, autofillDefaultValues);
|
|
115151
115152
|
}
|
|
115152
115153
|
function mergeDefaultsIntoMap(defaultDataMap, defaults) {
|
|
@@ -115166,7 +115167,8 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
|
|
|
115166
115167
|
ctx,
|
|
115167
115168
|
context,
|
|
115168
115169
|
instances,
|
|
115169
|
-
isInvalidDesignerDefault
|
|
115170
|
+
isInvalidDesignerDefault,
|
|
115171
|
+
masterSlaveList
|
|
115170
115172
|
}));
|
|
115171
115173
|
for (const item of collectAttachFieldItems(props)) {
|
|
115172
115174
|
var _item$fieldData;
|
|
@@ -115177,7 +115179,8 @@ async function loadDefaultValuesByFields(instances, ctx, context, masterSlaveLis
|
|
|
115177
115179
|
ctx,
|
|
115178
115180
|
context,
|
|
115179
115181
|
instances,
|
|
115180
|
-
isInvalidDesignerDefault
|
|
115182
|
+
isInvalidDesignerDefault,
|
|
115183
|
+
masterSlaveList
|
|
115181
115184
|
}));
|
|
115182
115185
|
}
|
|
115183
115186
|
});
|
|
@@ -119066,6 +119069,18 @@ function resolveAutofillRuntimeValuePaths(templatePath, rule, opts) {
|
|
|
119066
119069
|
const targetRowIndexes = subFieldKey ? resolveSubTableRowIndexes(opts.doc, subFieldKey, opts.rawData ?? {}, opts.rowIndexes) : opts.rowIndexes;
|
|
119067
119070
|
return expandAutofillSubTablePaths(templatePath, opts.rawData ?? {}, targetRowIndexes, opts.doc);
|
|
119068
119071
|
}
|
|
119072
|
+
/** 只解析目标路径,不执行来源取值或填充。 */
|
|
119073
|
+
function getAutofillTargetPaths(autofillRules, opts) {
|
|
119074
|
+
const paths = /* @__PURE__ */ new Set();
|
|
119075
|
+
for (const rule of autofillRules) {
|
|
119076
|
+
if (!rule.fromField) continue;
|
|
119077
|
+
const normalized = normalizeAutofillRule(rule, opts);
|
|
119078
|
+
const template = buildAutofillTargetTemplatePath(normalized);
|
|
119079
|
+
if (!template) continue;
|
|
119080
|
+
for (const path of resolveAutofillRuntimeValuePaths(template, normalized, opts)) paths.add(path);
|
|
119081
|
+
}
|
|
119082
|
+
return [...paths];
|
|
119083
|
+
}
|
|
119069
119084
|
function applyAutofillRules(record, autofillRules, opts) {
|
|
119070
119085
|
const result = {};
|
|
119071
119086
|
for (const ruleItem of autofillRules) {
|
|
@@ -125624,10 +125639,71 @@ var init_types$5 = __esmMin((() => {
|
|
|
125624
125639
|
}({});
|
|
125625
125640
|
}));
|
|
125626
125641
|
//#endregion
|
|
125642
|
+
//#region src/domain/table/business/material/material-consume/profile/product-fields.ts
|
|
125643
|
+
/** 对象字段的后缀独立生成,从同模型、同对象中读取真实 key。 */
|
|
125644
|
+
function getMaterialConsumeObjectFieldProfile(field, modelFields) {
|
|
125645
|
+
if (!field.belongingObject) return void 0;
|
|
125646
|
+
const fields = modelFields.filter((item) => item.modelKey === field.modelKey);
|
|
125647
|
+
const owner = fields.find((item) => item.key === field.belongingObject);
|
|
125648
|
+
if (!owner || resolveFieldManifestType(owner) !== FIELD_TYPE.MATERIAL_CONSUME) return;
|
|
125649
|
+
if (DETAILS.some(({ fieldKey }) => field.key.startsWith(fieldKey))) return {
|
|
125650
|
+
match: { fieldKey: field.key },
|
|
125651
|
+
defaultProps: { ...detailProps }
|
|
125652
|
+
};
|
|
125653
|
+
if (resolveFieldManifestType(field) !== FIELD_TYPE.PRODUCT) return void 0;
|
|
125654
|
+
const siblings = fields.filter((item) => item.belongingObject === field.belongingObject);
|
|
125655
|
+
const autofillTemplates = DETAILS.flatMap(({ fromField, fieldKey }) => {
|
|
125656
|
+
const targets = siblings.filter((item) => item.key.startsWith(fieldKey));
|
|
125657
|
+
if (targets.length !== 1) return [];
|
|
125658
|
+
return [{
|
|
125659
|
+
fromField,
|
|
125660
|
+
toField: targets[0].key
|
|
125661
|
+
}];
|
|
125662
|
+
});
|
|
125663
|
+
return autofillTemplates.length ? {
|
|
125664
|
+
match: { fieldKey: field.key },
|
|
125665
|
+
autofillTemplates
|
|
125666
|
+
} : void 0;
|
|
125667
|
+
}
|
|
125668
|
+
var DETAILS, detailProps, materialConsumeProductFields;
|
|
125669
|
+
var init_product_fields = __esmMin((() => {
|
|
125670
|
+
init_field_type();
|
|
125671
|
+
DETAILS = [
|
|
125672
|
+
{
|
|
125673
|
+
fromField: "name_",
|
|
125674
|
+
fieldKey: "product_id_name_"
|
|
125675
|
+
},
|
|
125676
|
+
{
|
|
125677
|
+
fromField: "code_",
|
|
125678
|
+
fieldKey: "product_id_code_"
|
|
125679
|
+
},
|
|
125680
|
+
{
|
|
125681
|
+
fromField: "spec_",
|
|
125682
|
+
fieldKey: "product_id_spec_"
|
|
125683
|
+
}
|
|
125684
|
+
];
|
|
125685
|
+
detailProps = {
|
|
125686
|
+
disabled: true,
|
|
125687
|
+
required: false,
|
|
125688
|
+
modelRequiredOverride: false
|
|
125689
|
+
};
|
|
125690
|
+
materialConsumeProductFields = [{
|
|
125691
|
+
match: { fieldKey: "product_id_" },
|
|
125692
|
+
autofillTemplates: DETAILS.map(({ fromField, fieldKey }) => ({
|
|
125693
|
+
fromField,
|
|
125694
|
+
toField: fieldKey
|
|
125695
|
+
}))
|
|
125696
|
+
}, {
|
|
125697
|
+
match: { fieldKey: DETAILS.map(({ fieldKey }) => fieldKey) },
|
|
125698
|
+
defaultProps: { ...detailProps }
|
|
125699
|
+
}];
|
|
125700
|
+
}));
|
|
125701
|
+
//#endregion
|
|
125627
125702
|
//#region src/domain/table/business/material/material-consume/profile/fields.ts
|
|
125628
125703
|
var fields$8;
|
|
125629
125704
|
var init_fields$9 = __esmMin((() => {
|
|
125630
125705
|
init_enum();
|
|
125706
|
+
init_product_fields();
|
|
125631
125707
|
fields$8 = [{
|
|
125632
125708
|
match: { fieldKey: ["qty_", "qty_required_"] },
|
|
125633
125709
|
defaultProps: {
|
|
@@ -125635,7 +125711,7 @@ var init_fields$9 = __esmMin((() => {
|
|
|
125635
125711
|
minValidateMode: RangeValidateModeTypeConst.Fixed_Number,
|
|
125636
125712
|
minValue: 0
|
|
125637
125713
|
}
|
|
125638
|
-
}];
|
|
125714
|
+
}, ...materialConsumeProductFields];
|
|
125639
125715
|
}));
|
|
125640
125716
|
//#endregion
|
|
125641
125717
|
//#region src/domain/table/business/material/material-consume/profile/index.ts
|
|
@@ -138009,8 +138085,7 @@ function applyLockedProps(props, locked) {
|
|
|
138009
138085
|
*/
|
|
138010
138086
|
function applyFieldProfileOnAttach(widget, field, options = {}) {
|
|
138011
138087
|
var _fieldProfile$autofil;
|
|
138012
|
-
|
|
138013
|
-
const fieldProfile = getBusinessFieldProfileByRefModelType(options.refModelType, field);
|
|
138088
|
+
const fieldProfile = options.fieldProfile !== void 0 ? options.fieldProfile : options.parentFieldKey && options.refModelType ? getBusinessFieldProfileByRefModelType(options.refModelType, field) : void 0;
|
|
138014
138089
|
if (!fieldProfile) return widget;
|
|
138015
138090
|
const props = {
|
|
138016
138091
|
...widget.props,
|
|
@@ -138021,8 +138096,8 @@ function applyFieldProfileOnAttach(widget, field, options = {}) {
|
|
|
138021
138096
|
const inSubTable = Boolean(options.parentFieldKey);
|
|
138022
138097
|
props.autofillRules = expandAutofillTemplates(fieldProfile.autofillTemplates, {
|
|
138023
138098
|
sourceFieldKey: field.key,
|
|
138024
|
-
toModelKey:
|
|
138025
|
-
toSubModel: inSubTable ? 1 :
|
|
138099
|
+
toModelKey: field.modelKey,
|
|
138100
|
+
toSubModel: inSubTable ? 1 : 0,
|
|
138026
138101
|
toSubFieldKey: inSubTable ? options.parentFieldKey : void 0
|
|
138027
138102
|
});
|
|
138028
138103
|
props.autofillEnabled = true;
|
|
@@ -148443,6 +148518,24 @@ var init_service$6 = __esmMin((() => {
|
|
|
148443
148518
|
postApi = getApi().apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey;
|
|
148444
148519
|
}));
|
|
148445
148520
|
//#endregion
|
|
148521
|
+
//#region src/utils/func/number-util.ts
|
|
148522
|
+
function plus(a, b) {
|
|
148523
|
+
return new BigNumber(a).plus(b);
|
|
148524
|
+
}
|
|
148525
|
+
function minus(a, b) {
|
|
148526
|
+
return new BigNumber(a).minus(b);
|
|
148527
|
+
}
|
|
148528
|
+
function multiply(a, b) {
|
|
148529
|
+
return new BigNumber(a).times(b);
|
|
148530
|
+
}
|
|
148531
|
+
function sum(values, initial = 0) {
|
|
148532
|
+
return values.reduce((total, value) => total.plus(value), new BigNumber(initial));
|
|
148533
|
+
}
|
|
148534
|
+
function compare(a, b) {
|
|
148535
|
+
return new BigNumber(a).comparedTo(b);
|
|
148536
|
+
}
|
|
148537
|
+
var init_number_util = __esmMin((() => {}));
|
|
148538
|
+
//#endregion
|
|
148446
148539
|
//#region src/runtime/canvas/table/render/material-consume/bom-validator.ts
|
|
148447
148540
|
function findLastIndex(array, predicate) {
|
|
148448
148541
|
if (!Array.isArray(array)) throw new TypeError("Expected an array");
|
|
@@ -148463,6 +148556,7 @@ function setGroupEditState(table, util, editing) {
|
|
|
148463
148556
|
var McRowValidateError, BomEntryValidator, BomEntriesValidator;
|
|
148464
148557
|
var init_bom_validator$1 = __esmMin((() => {
|
|
148465
148558
|
init_service$6();
|
|
148559
|
+
init_number_util();
|
|
148466
148560
|
init_defineProperty();
|
|
148467
148561
|
McRowValidateError = class extends Error {
|
|
148468
148562
|
constructor(message, targetFieldId, row) {
|
|
@@ -148474,17 +148568,26 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148474
148568
|
}
|
|
148475
148569
|
};
|
|
148476
148570
|
BomEntryValidator = class {
|
|
148571
|
+
get hasConsumed() {
|
|
148572
|
+
return this.historyQty.toNumber();
|
|
148573
|
+
}
|
|
148574
|
+
get remainingQty() {
|
|
148575
|
+
return minus(this.totalQty, this.historyQty);
|
|
148576
|
+
}
|
|
148477
148577
|
/** 剩于可消耗数量 */
|
|
148478
148578
|
get remainingNum() {
|
|
148479
|
-
return this.
|
|
148579
|
+
return this.remainingQty.toNumber();
|
|
148480
148580
|
}
|
|
148481
148581
|
/** 批次/生产数量(用时读取,避免构造快照过期) */
|
|
148482
148582
|
get materialNoNum() {
|
|
148483
148583
|
return Number(this.getMaterialNoNum()) || 0;
|
|
148484
148584
|
}
|
|
148485
148585
|
/** 需求总量 = 数量倍数 × BOM 单位用量 */
|
|
148586
|
+
get totalQty() {
|
|
148587
|
+
return multiply(Number(this.bomEntry.qty_required_), this.materialNoNum);
|
|
148588
|
+
}
|
|
148486
148589
|
get total() {
|
|
148487
|
-
return this.
|
|
148590
|
+
return this.totalQty.toNumber();
|
|
148488
148591
|
}
|
|
148489
148592
|
constructor(bomEntry, enableSequenceLoading, getMaterialNoNum, historyData, mainMaterialNo, noBomMode, isCustomRequiredQty = false) {
|
|
148490
148593
|
_defineProperty(this, "bomEntry", void 0);
|
|
@@ -148509,8 +148612,8 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148509
148612
|
_defineProperty(
|
|
148510
148613
|
this,
|
|
148511
148614
|
/** 历史数据中已经消耗的 */
|
|
148512
|
-
"
|
|
148513
|
-
0
|
|
148615
|
+
"historyQty",
|
|
148616
|
+
void 0
|
|
148514
148617
|
);
|
|
148515
148618
|
this.bomEntry = bomEntry;
|
|
148516
148619
|
this.enableSequenceLoading = enableSequenceLoading;
|
|
@@ -148525,7 +148628,7 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148525
148628
|
this.productIds.push(i.product_id_);
|
|
148526
148629
|
this.productCodes[i.product_id_] = i.product_code_;
|
|
148527
148630
|
});
|
|
148528
|
-
this.
|
|
148631
|
+
this.historyQty = this.calcQtyConsumed(this.historyData, "history");
|
|
148529
148632
|
}
|
|
148530
148633
|
/**
|
|
148531
148634
|
* 翻译物料的code
|
|
@@ -148640,13 +148743,13 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148640
148743
|
if (!this.bomEntry.qty_validation_enabled_) return;
|
|
148641
148744
|
if (this.bomEntry.type_ === "view") return;
|
|
148642
148745
|
const consumeNum = this.calcQtyConsumed(arr);
|
|
148643
|
-
if (consumeNum === 0) return;
|
|
148644
|
-
if (["eq", "lte"].includes(this.bomEntry.qty_validation_rule_) && consumeNum
|
|
148746
|
+
if (compare(consumeNum, 0) === 0) return;
|
|
148747
|
+
if (["eq", "lte"].includes(this.bomEntry.qty_validation_rule_) && compare(consumeNum, this.remainingQty) === 1) throw new Error("当前物料上料总消耗不能大于需求数量");
|
|
148645
148748
|
if (this.bomEntry.qty_validation_rule_ === "bounds") {
|
|
148646
148749
|
const groupData = this.filterGroupData(arr);
|
|
148647
|
-
const consumeSum = this.
|
|
148750
|
+
const consumeSum = this.calcTotalForBounds(arr);
|
|
148648
148751
|
const { max } = await this.calcCustomNumberLimit(groupData[0]);
|
|
148649
|
-
if (consumeSum
|
|
148752
|
+
if (max !== void 0 && compare(consumeSum, max) === 1) throw new Error(`当前物料的上料总消耗不能大于 ${max}`);
|
|
148650
148753
|
}
|
|
148651
148754
|
}
|
|
148652
148755
|
/**
|
|
@@ -148666,11 +148769,17 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148666
148769
|
* @return {*}
|
|
148667
148770
|
*/
|
|
148668
148771
|
calcQtyConsumed(arr, source = "current") {
|
|
148669
|
-
return this.filterGroupData(arr, source).
|
|
148772
|
+
return sum(this.filterGroupData(arr, source).map((row) => Number(row.qty_ ?? 0)));
|
|
148670
148773
|
}
|
|
148671
148774
|
/** 上下限校验优先使用单位转换后的数量,历史数据未转换时兼容原数量。 */
|
|
148672
148775
|
calcQtyForBounds(arr, source = "current") {
|
|
148673
|
-
return this.filterGroupData(arr, source).
|
|
148776
|
+
return sum(this.filterGroupData(arr, source).map((row) => Number(row.qty_transfer_ ?? row.qty_ ?? 0)));
|
|
148777
|
+
}
|
|
148778
|
+
calcTotalForBounds(arr) {
|
|
148779
|
+
return plus(this.calcQtyForBounds(arr), this.calcQtyForBounds(this.historyData, "history"));
|
|
148780
|
+
}
|
|
148781
|
+
calcRunningQtyConsumed(arr) {
|
|
148782
|
+
return sum(this.filterGroupData(arr).map((row) => Number(row.qty_ || 0)), this.historyQty).toNumber();
|
|
148674
148783
|
}
|
|
148675
148784
|
/**
|
|
148676
148785
|
* 计算自定义的数量校验的最大值和最小值
|
|
@@ -148704,14 +148813,14 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148704
148813
|
if (!entry.qty_validation_enabled_ || entry.type_ === "view") return;
|
|
148705
148814
|
const groupData = this.filterGroupData(arr);
|
|
148706
148815
|
const loaded = this.calcQtyConsumed(arr);
|
|
148707
|
-
let required = this.
|
|
148816
|
+
let required = this.remainingQty;
|
|
148708
148817
|
if (this.isCustomRequiredQty) {
|
|
148709
148818
|
var _groupData$;
|
|
148710
148819
|
const currentQty = (_groupData$ = groupData[0]) === null || _groupData$ === void 0 ? void 0 : _groupData$.qty_required_;
|
|
148711
148820
|
if (typeof currentQty !== "number" || !Number.isFinite(currentQty) || currentQty <= 0) throw new Error(groupNo != null && groupNo > 0 ? `序号${groupNo},需求数量必须大于 0` : "需求数量必须大于 0");
|
|
148712
|
-
required = currentQty
|
|
148821
|
+
required = minus(currentQty, this.historyQty);
|
|
148713
148822
|
}
|
|
148714
|
-
const diff = loaded
|
|
148823
|
+
const diff = compare(minus(loaded, required), 0);
|
|
148715
148824
|
const rule = entry.qty_validation_rule_;
|
|
148716
148825
|
const fail = (msg) => {
|
|
148717
148826
|
const prefix = groupNo != null && groupNo > 0 ? `序号: ${groupNo}` : "";
|
|
@@ -148721,19 +148830,19 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148721
148830
|
case "eq":
|
|
148722
148831
|
if (sequential) {
|
|
148723
148832
|
if (diff !== 0) fail("上料数量必须等于需求数量");
|
|
148724
|
-
} else if (loaded
|
|
148833
|
+
} else if (compare(loaded, required) === 1) fail("本次上料汇总数量必须小于等于需求数量");
|
|
148725
148834
|
break;
|
|
148726
148835
|
case "gte":
|
|
148727
|
-
if (diff
|
|
148836
|
+
if (diff === -1) fail("上料数量必须大于等于需求数量");
|
|
148728
148837
|
break;
|
|
148729
148838
|
case "lte":
|
|
148730
|
-
if (diff
|
|
148839
|
+
if (diff === 1) fail("上料数量必须小于等于需求数量");
|
|
148731
148840
|
break;
|
|
148732
148841
|
case "bounds": {
|
|
148733
148842
|
const groupData = this.filterGroupData(arr);
|
|
148734
|
-
const consumeSum = this.
|
|
148843
|
+
const consumeSum = this.calcTotalForBounds(arr);
|
|
148735
148844
|
const { min, max } = await this.calcCustomNumberLimit(groupData[0]);
|
|
148736
|
-
if (min !== void 0 && consumeSum
|
|
148845
|
+
if (min !== void 0 && compare(consumeSum, min) === -1 || max !== void 0 && compare(consumeSum, max) === 1) fail(`上料数量必须在[${min}, ${max}]范围内`);
|
|
148737
148846
|
break;
|
|
148738
148847
|
}
|
|
148739
148848
|
}
|
|
@@ -148753,21 +148862,22 @@ var init_bom_validator$1 = __esmMin((() => {
|
|
|
148753
148862
|
}
|
|
148754
148863
|
if (this.bomEntry.type_ === "view") return;
|
|
148755
148864
|
const consumeNum = this.calcQtyConsumed(groupData);
|
|
148756
|
-
|
|
148865
|
+
const zeroComparison = compare(consumeNum, 0);
|
|
148866
|
+
if (!this.bomEntry.qty_validation_enabled_ && zeroComparison !== null && zeroComparison !== 0) return;
|
|
148757
148867
|
switch (this.bomEntry.qty_validation_rule_) {
|
|
148758
148868
|
case "eq":
|
|
148759
|
-
if (consumeNum
|
|
148869
|
+
if (compare(consumeNum, this.remainingQty) === -1) throw new Error(message);
|
|
148760
148870
|
break;
|
|
148761
148871
|
case "gte":
|
|
148762
|
-
if (consumeNum
|
|
148872
|
+
if (compare(consumeNum, this.remainingQty) === -1) throw new Error(message);
|
|
148763
148873
|
break;
|
|
148764
148874
|
case "lte":
|
|
148765
|
-
if (
|
|
148875
|
+
if (zeroComparison === -1 || zeroComparison === 0) throw new Error(message);
|
|
148766
148876
|
break;
|
|
148767
148877
|
case "bounds":
|
|
148768
|
-
const consumeSum = consumeNum
|
|
148878
|
+
const consumeSum = plus(consumeNum, this.historyQty);
|
|
148769
148879
|
const { min } = await this.calcCustomNumberLimit(groupData[0]);
|
|
148770
|
-
if (consumeSum
|
|
148880
|
+
if (min !== void 0 && compare(consumeSum, min) === -1) throw new Error(message);
|
|
148771
148881
|
}
|
|
148772
148882
|
}
|
|
148773
148883
|
};
|
|
@@ -149412,23 +149522,26 @@ var init_uom_convert_runtime = __esmMin((() => {
|
|
|
149412
149522
|
//#endregion
|
|
149413
149523
|
//#region src/runtime/canvas/table/render/material-consume/scan-fill.ts
|
|
149414
149524
|
/**
|
|
149415
|
-
* 按 ScanFillPlan 切组 / 建组 /
|
|
149525
|
+
* 按 ScanFillPlan 切组 / 建组 / 填充,返回新表及本次写入行的身份(不改入参 arr)。
|
|
149416
149526
|
* needSwitch 时通过 options.validateCurrentGroupForSwitch 先校验当前组。
|
|
149417
149527
|
*/
|
|
149418
149528
|
async function applyScanFillPlan(arr, scanRow, plan, options) {
|
|
149419
149529
|
const table = cloneDeep(arr);
|
|
149420
|
-
|
|
149421
|
-
|
|
149422
|
-
|
|
149423
|
-
|
|
149424
|
-
|
|
149425
|
-
|
|
149426
|
-
|
|
149530
|
+
let filledIndex;
|
|
149531
|
+
if (!plan) filledIndex = fillNoBomRow(table, scanRow);
|
|
149532
|
+
else {
|
|
149533
|
+
if (plan.needSwitch) {
|
|
149534
|
+
var _options$validateCurr;
|
|
149535
|
+
await (options === null || options === void 0 || (_options$validateCurr = options.validateCurrentGroupForSwitch) === null || _options$validateCurr === void 0 ? void 0 : _options$validateCurr.call(options, table, plan.current));
|
|
149536
|
+
}
|
|
149537
|
+
const fillAt = plan.needInsert ? insertEmptyGroupRow(table, plan) : void 0;
|
|
149538
|
+
if (plan.needSwitch) applyGroupEditState(table, plan);
|
|
149539
|
+
filledIndex = fillTargetGroup(table, scanRow, plan, fillAt);
|
|
149427
149540
|
}
|
|
149428
|
-
|
|
149429
|
-
|
|
149430
|
-
|
|
149431
|
-
|
|
149541
|
+
return {
|
|
149542
|
+
rows: table,
|
|
149543
|
+
filledRowKey: ensureFrontRowKey(table[filledIndex])
|
|
149544
|
+
};
|
|
149432
149545
|
}
|
|
149433
149546
|
/**
|
|
149434
149547
|
* 将扫码行完整写入目标行(含 transformedData / qty_required_ 等扩展字段)。
|
|
@@ -149449,7 +149562,7 @@ function fillNoBomRow(table, scanRow) {
|
|
|
149449
149562
|
const emptyIdx = table.findIndex((r) => !r.deleted_ && !r.product_id_);
|
|
149450
149563
|
if (emptyIdx >= 0) {
|
|
149451
149564
|
writeScanFields(table[emptyIdx], scanRow);
|
|
149452
|
-
return;
|
|
149565
|
+
return emptyIdx;
|
|
149453
149566
|
}
|
|
149454
149567
|
const row = {
|
|
149455
149568
|
is_confirmed_: false,
|
|
@@ -149458,6 +149571,7 @@ function fillNoBomRow(table, scanRow) {
|
|
|
149458
149571
|
ensureFrontRowKey(row);
|
|
149459
149572
|
writeScanFields(row, scanRow);
|
|
149460
149573
|
table.push(row);
|
|
149574
|
+
return table.length - 1;
|
|
149461
149575
|
}
|
|
149462
149576
|
/** 在 groupInsertIndex 插占位,返回该下标 */
|
|
149463
149577
|
function insertEmptyGroupRow(table, plan) {
|
|
@@ -149480,16 +149594,16 @@ function fillTargetGroup(table, scanRow, plan, fillAt) {
|
|
|
149480
149594
|
const bomId = plan.target.bomEntry.id_;
|
|
149481
149595
|
if (fillAt !== void 0) {
|
|
149482
149596
|
writeScanFields(table[fillAt], scanRow, bomId);
|
|
149483
|
-
return;
|
|
149597
|
+
return fillAt;
|
|
149484
149598
|
}
|
|
149485
149599
|
if (plan.emptyProductIndexes.length) {
|
|
149486
149600
|
writeScanFields(table[plan.emptyProductIndexes[0]], scanRow, bomId);
|
|
149487
|
-
return;
|
|
149601
|
+
return plan.emptyProductIndexes[0];
|
|
149488
149602
|
}
|
|
149489
149603
|
const action = resolveInGroupFill(scanRow, table, plan);
|
|
149490
149604
|
if (action.type === "fill") {
|
|
149491
149605
|
writeScanFields(table[action.index], scanRow, bomId);
|
|
149492
|
-
return;
|
|
149606
|
+
return action.index;
|
|
149493
149607
|
}
|
|
149494
149608
|
const nr = {
|
|
149495
149609
|
is_confirmed_: false,
|
|
@@ -149498,6 +149612,7 @@ function fillTargetGroup(table, scanRow, plan, fillAt) {
|
|
|
149498
149612
|
ensureFrontRowKey(nr);
|
|
149499
149613
|
writeScanFields(nr, scanRow, bomId);
|
|
149500
149614
|
table.splice(plan.appendIndex, 0, nr);
|
|
149615
|
+
return plan.appendIndex;
|
|
149501
149616
|
}
|
|
149502
149617
|
/** 文档填充逻辑 2~4(物料相同 / 混用替代 / 未命中) */
|
|
149503
149618
|
function resolveInGroupFill(scanRow, table, plan) {
|
|
@@ -149721,9 +149836,7 @@ function withGroupSerialNumber(cell, groupOrderIndex) {
|
|
|
149721
149836
|
/** 计算某一 BOM 组的总上料数量 */
|
|
149722
149837
|
function calcGroupQtyConsumedTotal(entryIdx, tableData, validator) {
|
|
149723
149838
|
if (entryIdx < 0) return 0;
|
|
149724
|
-
return tableData.
|
|
149725
|
-
return validator.resolveEntryIndex(row) === entryIdx ? sum + Number(row.qty_ ?? 0) : sum;
|
|
149726
|
-
}, 0);
|
|
149839
|
+
return sum(tableData.filter((row) => validator.resolveEntryIndex(row) === entryIdx).map((row) => Number(row.qty_ ?? 0))).toNumber();
|
|
149727
149840
|
}
|
|
149728
149841
|
/** 回写全表 qty_consumed_total_(组内每行写相同值,便于提交) */
|
|
149729
149842
|
function syncGroupQtyConsumedTotals(tableData, validator) {
|
|
@@ -149741,6 +149854,7 @@ function syncGroupQtyConsumedTotals(tableData, validator) {
|
|
|
149741
149854
|
var getRowId, GROUP_MERGE_FIELDS;
|
|
149742
149855
|
var init_material_consume_group_merge = __esmMin((() => {
|
|
149743
149856
|
init_data();
|
|
149857
|
+
init_number_util();
|
|
149744
149858
|
getRowId = (row) => {
|
|
149745
149859
|
if (!row) return "";
|
|
149746
149860
|
if (row["front_row_key_"] != null && String(row["front_row_key_"]).trim() !== "") return String(row[FRONT_ROW_KEY]);
|
|
@@ -149794,6 +149908,220 @@ function resolveConsumedQtyWithoutProduct(value) {
|
|
|
149794
149908
|
}
|
|
149795
149909
|
var init_derived_qty = __esmMin((() => {}));
|
|
149796
149910
|
//#endregion
|
|
149911
|
+
//#region src/runtime/canvas/table/render/material-consume/product-source.ts
|
|
149912
|
+
function productVersionId(value) {
|
|
149913
|
+
return typeof value === "string" ? parseFormTmplRefId(value.trim()).id ?? "" : "";
|
|
149914
|
+
}
|
|
149915
|
+
/** 初始化专用:单次批量查询,失败不抛错、不逐条补查。 */
|
|
149916
|
+
async function loadConsumeInitialProducts(productRefs) {
|
|
149917
|
+
const ids = [...new Set(productRefs.map(productVersionId).filter(Boolean))];
|
|
149918
|
+
const records = /* @__PURE__ */ new Map();
|
|
149919
|
+
if (!ids.length) return records;
|
|
149920
|
+
try {
|
|
149921
|
+
const result = await callBizService({
|
|
149922
|
+
modelCategory: "entity",
|
|
149923
|
+
modelKey: "em_product",
|
|
149924
|
+
bsKey: "rdoListAllVersion",
|
|
149925
|
+
method: "post"
|
|
149926
|
+
}, {
|
|
149927
|
+
query: { "id_.in": ids },
|
|
149928
|
+
exp: ""
|
|
149929
|
+
}, { __useWordMessage: false });
|
|
149930
|
+
if (isBizServiceFailure(result)) {
|
|
149931
|
+
console.warn("[material-consume] 初始化物料详情查询失败,跳过填充");
|
|
149932
|
+
return records;
|
|
149933
|
+
}
|
|
149934
|
+
const requested = new Set(ids);
|
|
149935
|
+
for (const record of unwrapBizServiceList(result)) {
|
|
149936
|
+
if (!record || typeof record !== "object") continue;
|
|
149937
|
+
const id = productVersionId(record.id_);
|
|
149938
|
+
if (requested.has(id)) records.set(id, record);
|
|
149939
|
+
}
|
|
149940
|
+
const missing = ids.filter((id) => !records.has(id));
|
|
149941
|
+
if (missing.length) console.warn("[material-consume] 部分物料详情缺失,跳过对应物料", missing);
|
|
149942
|
+
return records;
|
|
149943
|
+
} catch (error) {
|
|
149944
|
+
console.warn("[material-consume] 初始化物料详情查询异常,跳过填充", error);
|
|
149945
|
+
return /* @__PURE__ */ new Map();
|
|
149946
|
+
}
|
|
149947
|
+
}
|
|
149948
|
+
var init_product_source = __esmMin((() => {
|
|
149949
|
+
init_biz_service_api();
|
|
149950
|
+
init_core$1();
|
|
149951
|
+
}));
|
|
149952
|
+
//#endregion
|
|
149953
|
+
//#region src/runtime/canvas/table/render/material-consume/initial-product-autofill.ts
|
|
149954
|
+
/** 初值仅填 undefined,详情或规则错误均不阻断基础行初始化。 */
|
|
149955
|
+
async function prepareConsumeInitialWrite(doc, subFieldKey, rows) {
|
|
149956
|
+
const tableKey = subFieldKey.replace(/^\$\./, "");
|
|
149957
|
+
const tablePath = `$.${tableKey}`;
|
|
149958
|
+
const baseRows = cloneDeep(rows);
|
|
149959
|
+
const baseWrite = { [tablePath]: baseRows };
|
|
149960
|
+
try {
|
|
149961
|
+
var _doc$model, _props$autofillRules;
|
|
149962
|
+
const source = (((_doc$model = doc.model) === null || _doc$model === void 0 ? void 0 : _doc$model.getWidgetInstances()) ?? []).flatMap((instance) => "widgetMeta" in instance ? [instance.widgetMeta] : []).find((meta) => {
|
|
149963
|
+
const field = meta === null || meta === void 0 ? void 0 : meta.field;
|
|
149964
|
+
return !!field && field.fieldType === FIELD_TYPE.PRODUCT && !field.isLinkedModelField && !field.belongingObject && getLastSegment$1(field.fieldLink) === "product_id_" && parseValuePath(field.valuePath).parentFieldKey === tableKey;
|
|
149965
|
+
});
|
|
149966
|
+
const props = source === null || source === void 0 ? void 0 : source.props;
|
|
149967
|
+
if (!props || !resolveAutofillEnabled(props) || !((_props$autofillRules = props.autofillRules) === null || _props$autofillRules === void 0 ? void 0 : _props$autofillRules.length)) return baseWrite;
|
|
149968
|
+
const records = await loadConsumeInitialProducts(baseRows.filter((row) => !row.deleted_).map((row) => row.product_id_));
|
|
149969
|
+
const raw = {
|
|
149970
|
+
...doc.dataManager.getRawData(),
|
|
149971
|
+
[tableKey]: baseRows
|
|
149972
|
+
};
|
|
149973
|
+
const additions = {};
|
|
149974
|
+
const current = (path) => Object.prototype.hasOwnProperty.call(additions, path) ? additions[path] : get(raw, path.replace(/^\$\./, ""));
|
|
149975
|
+
baseRows.forEach((row, index) => {
|
|
149976
|
+
if (row.deleted_) return;
|
|
149977
|
+
const record = records.get(productVersionId(row.product_id_));
|
|
149978
|
+
if (!record) return;
|
|
149979
|
+
const sourcePath = `${tablePath}[${index}].product_id_`;
|
|
149980
|
+
try {
|
|
149981
|
+
const filled = applyAutofillRules(record, props.autofillRules, {
|
|
149982
|
+
doc,
|
|
149983
|
+
rawData: raw,
|
|
149984
|
+
sourceValuePath: sourcePath,
|
|
149985
|
+
needReplacePathIndexPlaceholder: true
|
|
149986
|
+
});
|
|
149987
|
+
if (Object.prototype.hasOwnProperty.call(filled, sourcePath)) throw new Error("物料填充规则不能回写自身");
|
|
149988
|
+
const rowUpdates = Object.fromEntries(Object.entries(filled).filter(([path]) => current(path) === void 0));
|
|
149989
|
+
const label = record.__SHOW_LABEL__ || record.__LABEL__ || record.name_;
|
|
149990
|
+
const labelPath = getLabelPath(sourcePath);
|
|
149991
|
+
if (current(labelPath) === void 0 && typeof label === "string" && label !== "") rowUpdates[labelPath] = label;
|
|
149992
|
+
Object.assign(additions, rowUpdates);
|
|
149993
|
+
} catch (error) {
|
|
149994
|
+
console.warn("[material-consume] 初始化行填充失败,跳过该行", index, error);
|
|
149995
|
+
}
|
|
149996
|
+
});
|
|
149997
|
+
const writes = { ...baseWrite };
|
|
149998
|
+
for (const [path, value] of Object.entries(additions)) if (path.startsWith(`${tablePath}[`)) set(baseRows, path.slice(tablePath.length), value);
|
|
149999
|
+
else writes[path] = value;
|
|
150000
|
+
return writes;
|
|
150001
|
+
} catch (error) {
|
|
150002
|
+
console.warn("[material-consume] 初始化填充异常,保留基础行", error);
|
|
150003
|
+
return { [tablePath]: cloneDeep(rows) };
|
|
150004
|
+
}
|
|
150005
|
+
}
|
|
150006
|
+
var init_initial_product_autofill = __esmMin((() => {
|
|
150007
|
+
init_field_paths();
|
|
150008
|
+
init_field_type();
|
|
150009
|
+
init_core$1();
|
|
150010
|
+
init_autofill_runtime();
|
|
150011
|
+
init_types$8();
|
|
150012
|
+
init_product_source();
|
|
150013
|
+
}));
|
|
150014
|
+
//#endregion
|
|
150015
|
+
//#region src/runtime/canvas/table/render/material-consume/product-autofill.ts
|
|
150016
|
+
function isConsumeProduct(doc, field) {
|
|
150017
|
+
if (field.fieldType !== FIELD_TYPE.PRODUCT || field.isLinkedModelField) return false;
|
|
150018
|
+
if (field.belongingObject) {
|
|
150019
|
+
const owner = doc.fieldModelQuery.getFieldList(getLastSegment$1(field.modelLink)).find((item) => item.key === field.belongingObject);
|
|
150020
|
+
return !!owner && resolveFieldManifestType(owner) === FIELD_TYPE.MATERIAL_CONSUME;
|
|
150021
|
+
}
|
|
150022
|
+
const subKey = parseValuePath(field.valuePath).parentFieldKey;
|
|
150023
|
+
return !!subKey && doc.fieldModelQuery.getFieldList(doc.mainModelKey).some((item) => item.key === subKey && item.refModelType === "MATERIAL_CONSUME");
|
|
150024
|
+
}
|
|
150025
|
+
/** 仅对指定来源生成填充更新;详情查询失败时保留业务更新。 */
|
|
150026
|
+
async function prepareConsumeWrite(doc, pending, sourcePaths) {
|
|
150027
|
+
var _doc$model;
|
|
150028
|
+
const raw = doc.dataManager.getRawData();
|
|
150029
|
+
const input = Object.fromEntries(Object.entries(pending).map(([path, value]) => [canonical(path), value]));
|
|
150030
|
+
const changedPaths = Object.keys(input);
|
|
150031
|
+
const requestedSources = [...new Set(sourcePaths.map(canonical))].filter((path) => changedPaths.some((changed) => under(path, changed)));
|
|
150032
|
+
if (!requestedSources.length) return input;
|
|
150033
|
+
const failedProducts = /* @__PURE__ */ new Set();
|
|
150034
|
+
const projected = { ...raw };
|
|
150035
|
+
const clonedRoots = /* @__PURE__ */ new Set();
|
|
150036
|
+
const put = (path, value) => {
|
|
150037
|
+
const key = keyOf(path);
|
|
150038
|
+
const root = key.split(/[.[]/, 1)[0];
|
|
150039
|
+
if (!clonedRoots.has(root)) {
|
|
150040
|
+
projected[root] = cloneDeep(raw[root]);
|
|
150041
|
+
clonedRoots.add(root);
|
|
150042
|
+
}
|
|
150043
|
+
set(projected, key, cloneDeep(value));
|
|
150044
|
+
};
|
|
150045
|
+
for (const path of [...changedPaths].sort((a, b) => a.length - b.length)) put(path, input[path]);
|
|
150046
|
+
const additions = {};
|
|
150047
|
+
const seen = /* @__PURE__ */ new Set();
|
|
150048
|
+
for (const instance of ((_doc$model = doc.model) === null || _doc$model === void 0 ? void 0 : _doc$model.getWidgetInstances()) ?? []) {
|
|
150049
|
+
var _instance$widgetMeta, _instance$widgetMeta2;
|
|
150050
|
+
if (!("widgetMeta" in instance)) continue;
|
|
150051
|
+
const field = (_instance$widgetMeta = instance.widgetMeta) === null || _instance$widgetMeta === void 0 ? void 0 : _instance$widgetMeta.field;
|
|
150052
|
+
const props = (_instance$widgetMeta2 = instance.widgetMeta) === null || _instance$widgetMeta2 === void 0 ? void 0 : _instance$widgetMeta2.props;
|
|
150053
|
+
if (!field || !props || !isConsumeProduct(doc, field) || !resolveAutofillEnabled(props) || seen.has(field.valuePath)) continue;
|
|
150054
|
+
const rules = props.autofillRules;
|
|
150055
|
+
if (!(rules === null || rules === void 0 ? void 0 : rules.length)) continue;
|
|
150056
|
+
seen.add(field.valuePath);
|
|
150057
|
+
for (const path of requestedSources) {
|
|
150058
|
+
if (replacePathIndexPlaceholders({
|
|
150059
|
+
refPath: path,
|
|
150060
|
+
templatePath: canonical(field.valuePath)
|
|
150061
|
+
}) !== path) continue;
|
|
150062
|
+
const rowPath = parseValuePath(path).isSubTable ? path.slice(0, path.lastIndexOf(".")) : void 0;
|
|
150063
|
+
const row = rowPath ? get(projected, keyOf(rowPath)) : void 0;
|
|
150064
|
+
if (row === null || row === void 0 ? void 0 : row.deleted_) continue;
|
|
150065
|
+
const value = get(projected, keyOf(path));
|
|
150066
|
+
const applyOptions = {
|
|
150067
|
+
doc,
|
|
150068
|
+
rawData: projected,
|
|
150069
|
+
sourceValuePath: path,
|
|
150070
|
+
needReplacePathIndexPlaceholder: true
|
|
150071
|
+
};
|
|
150072
|
+
if (!getAutofillTargetPaths(rules, applyOptions).length) continue;
|
|
150073
|
+
let record = {};
|
|
150074
|
+
if (value != null && value !== "") {
|
|
150075
|
+
if (failedProducts.has(value)) continue;
|
|
150076
|
+
try {
|
|
150077
|
+
record = await withRequestCache.handleRequest("material-consume-product", {
|
|
150078
|
+
model: field.modelLink,
|
|
150079
|
+
value
|
|
150080
|
+
}, async () => {
|
|
150081
|
+
const fetched = await fetchAutofillSource(field, {
|
|
150082
|
+
...doc.paramsConfig,
|
|
150083
|
+
[FIELD_TYPE.PRODUCT]: value
|
|
150084
|
+
});
|
|
150085
|
+
if (!fetched || typeof fetched !== "object" || Array.isArray(fetched) || !Object.keys(fetched).length) throw new Error(`物料 ${value} 的填充详情获取失败`);
|
|
150086
|
+
return fetched;
|
|
150087
|
+
}, 3e4);
|
|
150088
|
+
} catch (error) {
|
|
150089
|
+
failedProducts.add(value);
|
|
150090
|
+
console.warn("[material-consume] 物料详情查询失败,跳过填充", value, error);
|
|
150091
|
+
continue;
|
|
150092
|
+
}
|
|
150093
|
+
}
|
|
150094
|
+
const filled = applyAutofillRules(record, rules, applyOptions);
|
|
150095
|
+
if (Object.prototype.hasOwnProperty.call(filled, path)) throw new Error("物料填充规则不能回写自身");
|
|
150096
|
+
for (const [target, value] of Object.entries(filled)) {
|
|
150097
|
+
additions[target] = value;
|
|
150098
|
+
put(target, value);
|
|
150099
|
+
}
|
|
150100
|
+
}
|
|
150101
|
+
}
|
|
150102
|
+
const result = {
|
|
150103
|
+
...input,
|
|
150104
|
+
...additions
|
|
150105
|
+
};
|
|
150106
|
+
for (const root of changedPaths.filter((path) => !/[.[]/.test(keyOf(path)))) {
|
|
150107
|
+
result[root] = get(projected, keyOf(root));
|
|
150108
|
+
for (const path of Object.keys(result)) if (path !== root && under(path, root)) delete result[path];
|
|
150109
|
+
}
|
|
150110
|
+
return result;
|
|
150111
|
+
}
|
|
150112
|
+
var canonical, keyOf, under;
|
|
150113
|
+
var init_product_autofill = __esmMin((() => {
|
|
150114
|
+
init_field_type();
|
|
150115
|
+
init_core$1();
|
|
150116
|
+
init_withRequestCache();
|
|
150117
|
+
init_computed();
|
|
150118
|
+
init_autofill_runtime();
|
|
150119
|
+
init_types$8();
|
|
150120
|
+
canonical = (path) => path.startsWith("$.") ? path : `$.${path}`;
|
|
150121
|
+
keyOf = (path) => canonical(path).slice(2);
|
|
150122
|
+
under = (path, parent) => path === parent || path.startsWith(`${parent}.`) || path.startsWith(`${parent}[`);
|
|
150123
|
+
}));
|
|
150124
|
+
//#endregion
|
|
149797
150125
|
//#region src/runtime/canvas/table/render/material-consume/material-consume-table-controller.ts
|
|
149798
150126
|
/**
|
|
149799
150127
|
* 解析规则配置字符串解析成对象
|
|
@@ -149826,6 +150154,9 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
149826
150154
|
init_index_es();
|
|
149827
150155
|
init_transform();
|
|
149828
150156
|
init_derived_qty();
|
|
150157
|
+
init_initial_product_autofill();
|
|
150158
|
+
init_product_autofill();
|
|
150159
|
+
init_number_util();
|
|
149829
150160
|
init_defineProperty();
|
|
149830
150161
|
MCDataUtil = class MCDataUtil {
|
|
149831
150162
|
/**
|
|
@@ -150168,7 +150499,7 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150168
150499
|
return {
|
|
150169
150500
|
product_id_: i.product_id_,
|
|
150170
150501
|
qty_required_uom_id_: i.uom_id_,
|
|
150171
|
-
...materialNoNum === void 0 ? {} : { qty_required_: Number(i.qty_required_)
|
|
150502
|
+
...materialNoNum === void 0 ? {} : { qty_required_: multiply(Number(i.qty_required_), materialNoNum).toNumber() },
|
|
150172
150503
|
bom_entry_id_: i.id_
|
|
150173
150504
|
};
|
|
150174
150505
|
});
|
|
@@ -150178,10 +150509,15 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150178
150509
|
* 未填报时初始化消耗表行数据
|
|
150179
150510
|
* @param defaultData 子表行默认值(含工序等)
|
|
150180
150511
|
*/
|
|
150181
|
-
initTableData(
|
|
150512
|
+
async initTableData(doc, subFieldKey, defaultData) {
|
|
150513
|
+
const dataManager = doc.dataManager;
|
|
150182
150514
|
if (this.isDataProcessed) return [];
|
|
150183
150515
|
const existingRows = dataManager.getRawData()[subFieldKey];
|
|
150184
|
-
if (Array.isArray(existingRows) && existingRows.some((row) => row && !row.deleted_ && !row.__gw_default))
|
|
150516
|
+
if (Array.isArray(existingRows) && existingRows.some((row) => row && !row.deleted_ && !row.__gw_default)) {
|
|
150517
|
+
const writes = await prepareConsumeInitialWrite(doc, subFieldKey, existingRows);
|
|
150518
|
+
dataManager.setMultiple(writes, "hydrate");
|
|
150519
|
+
return existingRows.flatMap((row, index) => row && !row.deleted_ ? [index] : []);
|
|
150520
|
+
}
|
|
150185
150521
|
const rows = this.calcFormState();
|
|
150186
150522
|
if (!(rows === null || rows === void 0 ? void 0 : rows.length)) return [];
|
|
150187
150523
|
const tableRows = transformUtils.transformSourceData2SubTable(rows, {}, defaultData);
|
|
@@ -150190,7 +150526,9 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150190
150526
|
if (!row.routing_operation_id_) row.routing_operation_id_ = this.tmplBomController.operationId;
|
|
150191
150527
|
row.is_confirmed_ = i > 0 && this.enableSequenceLoading;
|
|
150192
150528
|
});
|
|
150193
|
-
|
|
150529
|
+
const deletedRows = Array.isArray(existingRows) ? existingRows.filter((row) => row === null || row === void 0 ? void 0 : row.deleted_) : [];
|
|
150530
|
+
const writes = await prepareConsumeInitialWrite(doc, subFieldKey, [...tableRows, ...deletedRows]);
|
|
150531
|
+
dataManager.setMultiple(writes, "hydrate");
|
|
150194
150532
|
tableRows.forEach((row, i) => {
|
|
150195
150533
|
const rowPath = `$.${subFieldKey}[${i}]`;
|
|
150196
150534
|
if (row.is_confirmed_) MCDataUtil.updateConfirmableFieldsDisablement({
|
|
@@ -150356,19 +150694,23 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150356
150694
|
};
|
|
150357
150695
|
if (isRecordPattern && !row.product_id_) row._scanFallback = true;
|
|
150358
150696
|
Object.assign(row, transformedData);
|
|
150359
|
-
|
|
150697
|
+
Object.assign(row, this.getDefaultValue(row));
|
|
150360
150698
|
try {
|
|
150361
|
-
var _this$actualTableData3;
|
|
150699
|
+
var _this$actualTableData3, _nextRows$filledIndex;
|
|
150362
150700
|
const plan = await this.bomEntriesValidator.validateScanCanInsert(row, this.actualTableData);
|
|
150363
150701
|
const existingRequiredQty = this.isCustomRequiredQty && plan ? (_this$actualTableData3 = this.actualTableData.find((item) => plan.target.isRowInGroup(item) && item.qty_required_ != null)) === null || _this$actualTableData3 === void 0 ? void 0 : _this$actualTableData3.qty_required_ : void 0;
|
|
150364
|
-
const
|
|
150702
|
+
const { rows: nextRows, filledRowKey } = await applyScanFillPlan(this.actualTableData, row, plan, { validateCurrentGroupForSwitch: (table, current) => this.bomEntriesValidator.validateCurrentGroupForSwitch(table, current) });
|
|
150365
150703
|
if (this.isCustomRequiredQty && plan) {
|
|
150366
150704
|
const requiredQty = existingRequiredQty ?? row.qty_required_;
|
|
150367
|
-
|
|
150705
|
+
nextRows.forEach((item) => {
|
|
150368
150706
|
if (plan.target.isRowInGroup(item)) item.qty_required_ = requiredQty;
|
|
150369
150707
|
});
|
|
150370
150708
|
}
|
|
150371
|
-
this.tableDataRef.value
|
|
150709
|
+
const deletedRows = this.tableDataRef.value.filter((item) => item.deleted_);
|
|
150710
|
+
const filledIndex = nextRows.findIndex((item) => getFrontRowKey(item) === filledRowKey);
|
|
150711
|
+
const sourcePaths = ((_nextRows$filledIndex = nextRows[filledIndex]) === null || _nextRows$filledIndex === void 0 ? void 0 : _nextRows$filledIndex.product_id_) ? [`${this.subTableInfo.valuePath}[${filledIndex}].product_id_`] : [];
|
|
150712
|
+
const writes = await prepareConsumeWrite(doc, { [this.subTableInfo.valuePath]: [...nextRows, ...deletedRows] }, sourcePaths);
|
|
150713
|
+
doc.dataManager.setMultiple(writes, "user");
|
|
150372
150714
|
this.updateDerivedQtyFields(doc);
|
|
150373
150715
|
} catch (e) {
|
|
150374
150716
|
console.error(e);
|
|
@@ -150418,7 +150760,7 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150418
150760
|
(_this$setupUomUnsubsc = this.setupUomUnsubscribe) === null || _this$setupUomUnsubsc === void 0 || _this$setupUomUnsubsc.call(this);
|
|
150419
150761
|
this.setupDoc = opts.doc;
|
|
150420
150762
|
this.unitConversionRules = getUnitConversionRulesFromDoc(opts.doc);
|
|
150421
|
-
const initializedRowIndexes = shouldInitializeDocumentData(opts.doc) ? this.initTableData(opts.doc
|
|
150763
|
+
const initializedRowIndexes = shouldInitializeDocumentData(opts.doc) ? await this.initTableData(opts.doc, opts.subTableInfo.subFieldKey, opts.defaultRowData) : [];
|
|
150422
150764
|
await hydrateSubtableRowLabels(opts.doc, opts.subTableInfo.subFieldKey, initializedRowIndexes);
|
|
150423
150765
|
let materialNoNum = this.materialNoNum;
|
|
150424
150766
|
if (this.dataStatus !== "SUBMIT") this.syncQtyRequiredFromBom(opts.doc);
|
|
@@ -150829,16 +151171,10 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150829
151171
|
doc.dataManager.set(fieldKey, resolveConsumedQtyWithoutProduct(row.qty_), "user");
|
|
150830
151172
|
return;
|
|
150831
151173
|
}
|
|
150832
|
-
let total = 0;
|
|
150833
151174
|
const util = this.bomEntriesValidator.findUtilByProductId(row.product_id_);
|
|
150834
|
-
const beforeArr = this.actualTableData.slice(0, rowIndex + 1);
|
|
150835
151175
|
if (util) {
|
|
150836
|
-
|
|
150837
|
-
|
|
150838
|
-
util.filterGroupData(beforeArr).forEach((i) => {
|
|
150839
|
-
total += Number(i.qty_ || 0);
|
|
150840
|
-
});
|
|
150841
|
-
doc.dataManager.set(fieldKey, total, "user");
|
|
151176
|
+
const rows = this.actualTableData.slice(0, rowIndex + 1);
|
|
151177
|
+
doc.dataManager.set(fieldKey, util.calcRunningQtyConsumed(rows), "user");
|
|
150842
151178
|
}
|
|
150843
151179
|
};
|
|
150844
151180
|
setTimeout(() => {
|
|
@@ -150895,96 +151231,73 @@ var init_material_consume_table_controller = __esmMin((() => {
|
|
|
150895
151231
|
}
|
|
150896
151232
|
return value;
|
|
150897
151233
|
}
|
|
150898
|
-
/**
|
|
150899
|
-
|
|
150900
|
-
|
|
150901
|
-
|
|
150902
|
-
const
|
|
150903
|
-
|
|
150904
|
-
|
|
150905
|
-
|
|
150906
|
-
|
|
150907
|
-
|
|
150908
|
-
|
|
150909
|
-
|
|
150910
|
-
|
|
150911
|
-
|
|
150912
|
-
|
|
150913
|
-
|
|
150914
|
-
|
|
150915
|
-
|
|
150916
|
-
|
|
150917
|
-
|
|
150918
|
-
|
|
150919
|
-
|
|
150920
|
-
|
|
150921
|
-
|
|
150922
|
-
|
|
150923
|
-
|
|
150924
|
-
|
|
150925
|
-
|
|
150926
|
-
|
|
150927
|
-
|
|
150928
|
-
|
|
150929
|
-
|
|
150930
|
-
|
|
150931
|
-
|
|
150932
|
-
|
|
150933
|
-
|
|
150934
|
-
|
|
150935
|
-
|
|
150936
|
-
|
|
150937
|
-
|
|
150938
|
-
}, "user");
|
|
150939
|
-
const nextRow = (_doc$dataManager$getR = doc.dataManager.getRawData()[parentFieldKey]) === null || _doc$dataManager$getR === void 0 ? void 0 : _doc$dataManager$getR[dataIndex];
|
|
150940
|
-
if (nextRow) this.syncEditingRowDisablement(doc.dataManager, rowPath, nextRow);
|
|
150941
|
-
} else if (fieldKey === "material_no_") {
|
|
150942
|
-
if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.is_locked_) {
|
|
150943
|
-
doc.dataManager.setMultiple({
|
|
150944
|
-
[`${rowPath}.material_no_`]: void 0,
|
|
150945
|
-
[`${rowPath}.material_no__id_`]: void 0,
|
|
150946
|
-
[`${rowPath}.material_no__lb_`]: void 0
|
|
150947
|
-
}, "user");
|
|
150948
|
-
const msg = await getLotLockedReason(selectedOption.id_);
|
|
150949
|
-
this.error(msg);
|
|
150950
|
-
return;
|
|
150951
|
-
}
|
|
150952
|
-
const row = doc.dataManager.get(rowPath);
|
|
150953
|
-
const materialNo = changedData[`${rowPath}.material_no_`] ?? row.material_no_;
|
|
150954
|
-
if (!materialNo) return;
|
|
150955
|
-
try {
|
|
150956
|
-
await this.validateReinspectionDate({
|
|
150957
|
-
product_id_: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.product_id_) ?? row.product_id_,
|
|
150958
|
-
material_no_: materialNo,
|
|
150959
|
-
material_no_id_: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id_
|
|
150960
|
-
});
|
|
150961
|
-
} catch (e) {
|
|
150962
|
-
doc.dataManager.setMultiple({
|
|
150963
|
-
[`${rowPath}.material_no_`]: void 0,
|
|
150964
|
-
[`${rowPath}.material_no__id_`]: void 0,
|
|
150965
|
-
[`${rowPath}.material_no__lb_`]: void 0
|
|
150966
|
-
}, "user");
|
|
150967
|
-
this.error(e.message);
|
|
150968
|
-
return;
|
|
150969
|
-
}
|
|
150970
|
-
if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.product_id_) doc.dataManager.setMultiple({ [`${rowPath}.product_id_`]: selectedOption.product_id_ }, "user");
|
|
150971
|
-
}
|
|
150972
|
-
const rowData = doc.dataManager.getRawData()[parentFieldKey][dataIndex];
|
|
150973
|
-
const value = this.getDefaultValue(rowData);
|
|
150974
|
-
if (this.isCustomRequiredQty) {
|
|
150975
|
-
var _this$actualTableData4;
|
|
150976
|
-
const nextGroupId = value.bom_entry_id_ ?? rowData.bom_entry_id_;
|
|
150977
|
-
const group = this.bomEntriesValidator.bomEntryValidators.find((util) => util.bomEntry.id_ === nextGroupId);
|
|
150978
|
-
const otherRequiredQty = group ? (_this$actualTableData4 = this.actualTableData.find((item) => item !== rowData && group.isRowInGroup(item) && item.qty_required_ != null)) === null || _this$actualTableData4 === void 0 ? void 0 : _this$actualTableData4.qty_required_ : void 0;
|
|
150979
|
-
value.qty_required_ = nextGroupId === rowData.bom_entry_id_ ? otherRequiredQty ?? rowData.qty_required_ : otherRequiredQty;
|
|
150980
|
-
}
|
|
150981
|
-
const wordValue = Object.entries(value).reduce((data, [key, value]) => {
|
|
150982
|
-
data[`${rowPath}.${key}`] = value;
|
|
150983
|
-
return data;
|
|
150984
|
-
}, {});
|
|
150985
|
-
doc.dataManager.setMultiple(wordValue, "user");
|
|
150986
|
-
this.updateDerivedQtyFields(doc);
|
|
151234
|
+
/** 下拉写入前校验,只生成更新,不修改当前行。 */
|
|
151235
|
+
async prepareSelectChange({ pending, selectedOption, doc, parsed, dataIndex }) {
|
|
151236
|
+
const { fieldKey, parentFieldPath } = parsed;
|
|
151237
|
+
if (!["product_id_", "material_no_"].includes(fieldKey)) return {};
|
|
151238
|
+
const rowPath = `${parentFieldPath}[${dataIndex}]`;
|
|
151239
|
+
const row = { ...doc.dataManager.get(rowPath) ?? {} };
|
|
151240
|
+
const updates = {};
|
|
151241
|
+
for (const [path, value] of Object.entries(pending)) if (path.startsWith(`${rowPath}.`)) row[path.slice(rowPath.length + 1)] = value;
|
|
151242
|
+
const put = (key, value) => {
|
|
151243
|
+
row[key] = value;
|
|
151244
|
+
updates[`${rowPath}.${key}`] = value;
|
|
151245
|
+
};
|
|
151246
|
+
if (fieldKey === "product_id_") {
|
|
151247
|
+
if (!row.product_id_) {
|
|
151248
|
+
put("qty_required_uom_id_", null);
|
|
151249
|
+
put("qty_required_uom_id__lb_", null);
|
|
151250
|
+
}
|
|
151251
|
+
if (row._scanFallback) {
|
|
151252
|
+
await this.validateReinspectionDate({
|
|
151253
|
+
product_id_: row.product_id_,
|
|
151254
|
+
material_no_: row.material_no_,
|
|
151255
|
+
material_no_id_: row.material_no__id_
|
|
151256
|
+
});
|
|
151257
|
+
return updates;
|
|
151258
|
+
}
|
|
151259
|
+
for (const key of [
|
|
151260
|
+
"material_no_",
|
|
151261
|
+
"material_no__id_",
|
|
151262
|
+
"material_no__lb_",
|
|
151263
|
+
"expiration_date_"
|
|
151264
|
+
]) put(key, null);
|
|
151265
|
+
} else {
|
|
151266
|
+
if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.is_locked_) throw new Error(await getLotLockedReason(selectedOption.id_));
|
|
151267
|
+
if (!row.material_no_) return updates;
|
|
151268
|
+
await this.validateReinspectionDate({
|
|
151269
|
+
product_id_: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.product_id_) ?? row.product_id_,
|
|
151270
|
+
material_no_: row.material_no_,
|
|
151271
|
+
material_no_id_: row.material_no__id_
|
|
151272
|
+
});
|
|
151273
|
+
if (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.product_id_) put("product_id_", selectedOption.product_id_);
|
|
150987
151274
|
}
|
|
151275
|
+
const defaults = this.getDefaultValue(row);
|
|
151276
|
+
if (this.isCustomRequiredQty) {
|
|
151277
|
+
var _this$tableDataRef$va;
|
|
151278
|
+
const nextGroupId = defaults.bom_entry_id_ ?? row.bom_entry_id_;
|
|
151279
|
+
const group = this.bomEntriesValidator.bomEntryValidators.find((util) => util.bomEntry.id_ === nextGroupId);
|
|
151280
|
+
const otherRequiredQty = group ? (_this$tableDataRef$va = this.tableDataRef.value.find((item, index) => index !== dataIndex && group.isRowInGroup(item) && item.qty_required_ != null)) === null || _this$tableDataRef$va === void 0 ? void 0 : _this$tableDataRef$va.qty_required_ : void 0;
|
|
151281
|
+
defaults.qty_required_ = nextGroupId === row.bom_entry_id_ ? otherRequiredQty ?? row.qty_required_ : otherRequiredQty;
|
|
151282
|
+
}
|
|
151283
|
+
for (const [key, value] of Object.entries(defaults)) put(key, value);
|
|
151284
|
+
return updates;
|
|
151285
|
+
}
|
|
151286
|
+
/** 提交成功后刷新查询条件、禁用状态及派生数量。 */
|
|
151287
|
+
afterSelectChange({ doc, parsed, dataIndex }) {
|
|
151288
|
+
const { fieldKey, parentFieldPath } = parsed;
|
|
151289
|
+
if (!["product_id_", "material_no_"].includes(fieldKey)) return;
|
|
151290
|
+
const rowPath = `${parentFieldPath}[${dataIndex}]`;
|
|
151291
|
+
const row = doc.dataManager.get(rowPath);
|
|
151292
|
+
if (!row) return;
|
|
151293
|
+
if (fieldKey === "product_id_" && row._scanFallback) return;
|
|
151294
|
+
if (fieldKey === "product_id_") {
|
|
151295
|
+
var _row$product_id_;
|
|
151296
|
+
const versionId = (_row$product_id_ = row.product_id_) === null || _row$product_id_ === void 0 ? void 0 : _row$product_id_.split(":").pop();
|
|
151297
|
+
if (versionId) getSubFieldConfig(doc.paramsConfig).set(`${rowPath}.material_no_`, { "product_id_.versionIn": [versionId] });
|
|
151298
|
+
this.syncEditingRowDisablement(doc.dataManager, rowPath, row);
|
|
151299
|
+
}
|
|
151300
|
+
this.updateDerivedQtyFields(doc);
|
|
150988
151301
|
}
|
|
150989
151302
|
};
|
|
150990
151303
|
}));
|
|
@@ -160732,6 +161045,7 @@ async function prepareObjectProductAutofills({ enabled, instances, objectInitial
|
|
|
160732
161045
|
const pending = [];
|
|
160733
161046
|
if (!enabled || !objectInitialValues.length) return pending;
|
|
160734
161047
|
const productRecords = /* @__PURE__ */ new Map();
|
|
161048
|
+
const failedProducts = /* @__PURE__ */ new Set();
|
|
160735
161049
|
for (const instance of instances) {
|
|
160736
161050
|
var _instance$widgetMeta, _instance$widgetMeta2;
|
|
160737
161051
|
const field = (_instance$widgetMeta = instance.widgetMeta) === null || _instance$widgetMeta === void 0 ? void 0 : _instance$widgetMeta.field;
|
|
@@ -160744,15 +161058,20 @@ async function prepareObjectProductAutofills({ enabled, instances, objectInitial
|
|
|
160744
161058
|
if (!(configured === null || configured === void 0 ? void 0 : configured.values) || !Object.prototype.hasOwnProperty.call(configured.values, fieldKey)) continue;
|
|
160745
161059
|
const value = configured.values[fieldKey];
|
|
160746
161060
|
if (typeof value !== "string" || value === "" || rawData[fieldKey] !== value) continue;
|
|
161061
|
+
if (failedProducts.has(value)) continue;
|
|
160747
161062
|
let sourceData = productRecords.get(value);
|
|
160748
|
-
if (!sourceData) {
|
|
161063
|
+
if (!sourceData) try {
|
|
160749
161064
|
const fetched = await fetchAutofillSource(field, {
|
|
160750
161065
|
...context,
|
|
160751
161066
|
[FIELD_TYPE.PRODUCT]: value
|
|
160752
161067
|
});
|
|
160753
|
-
if (!fetched || typeof fetched !== "object" || Array.isArray(fetched) || Object.keys(fetched).length === 0) throw new Error(
|
|
161068
|
+
if (!fetched || typeof fetched !== "object" || Array.isArray(fetched) || Object.keys(fetched).length === 0) throw new Error(`未获取到物料 ${value} 的详情`);
|
|
160754
161069
|
sourceData = fetched;
|
|
160755
161070
|
productRecords.set(value, sourceData);
|
|
161071
|
+
} catch (error) {
|
|
161072
|
+
failedProducts.add(value);
|
|
161073
|
+
console.warn("[material-consume] 对象初值详情查询失败,跳过填充", fieldKey, error);
|
|
161074
|
+
continue;
|
|
160756
161075
|
}
|
|
160757
161076
|
defaultDataMap[field.valuePath] = value;
|
|
160758
161077
|
pending.push({
|
|
@@ -160768,14 +161087,18 @@ async function prepareObjectProductAutofills({ enabled, instances, objectInitial
|
|
|
160768
161087
|
function applyObjectProductAutofills(doc, pending) {
|
|
160769
161088
|
for (const item of pending) {
|
|
160770
161089
|
if (doc.dataManager.get(item.field.valuePath) !== item.value) continue;
|
|
160771
|
-
|
|
160772
|
-
|
|
160773
|
-
|
|
160774
|
-
|
|
160775
|
-
|
|
160776
|
-
|
|
160777
|
-
|
|
160778
|
-
|
|
161090
|
+
try {
|
|
161091
|
+
const updates = applyAutofillRules(item.sourceData, item.rules, {
|
|
161092
|
+
needReplacePathIndexPlaceholder: true,
|
|
161093
|
+
sourceValuePath: item.field.valuePath,
|
|
161094
|
+
rawData: doc.dataManager.getRawData(),
|
|
161095
|
+
doc
|
|
161096
|
+
});
|
|
161097
|
+
const initialUpdates = Object.fromEntries(Object.entries(updates).filter(([path]) => doc.dataManager.getStoredValue(path) === void 0));
|
|
161098
|
+
if (Object.keys(initialUpdates).length) doc.dataManager.setMultiple(initialUpdates, "hydrate");
|
|
161099
|
+
} catch (error) {
|
|
161100
|
+
console.warn("[material-consume] 对象初值规则执行失败,跳过填充", item.field.valuePath, error);
|
|
161101
|
+
}
|
|
160779
161102
|
}
|
|
160780
161103
|
}
|
|
160781
161104
|
//#endregion
|
|
@@ -169207,6 +169530,7 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169207
169530
|
init_dialog_container();
|
|
169208
169531
|
init_useWidgetRenderData();
|
|
169209
169532
|
init_computed();
|
|
169533
|
+
init_product_autofill();
|
|
169210
169534
|
init__register_();
|
|
169211
169535
|
init_useDependency();
|
|
169212
169536
|
init_useWidgetInitializer();
|
|
@@ -169507,10 +169831,10 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169507
169831
|
if (isMaterialObjectScanOpen) return;
|
|
169508
169832
|
isMaterialObjectScanOpen = true;
|
|
169509
169833
|
try {
|
|
169510
|
-
var _fieldMeta$value5, _tmplBomCRef$value
|
|
169834
|
+
var _fieldMeta$value5, _tmplBomCRef$value;
|
|
169511
169835
|
const belongingObject = (_fieldMeta$value5 = fieldMeta.value) === null || _fieldMeta$value5 === void 0 ? void 0 : _fieldMeta$value5.belongingObject;
|
|
169512
169836
|
const objectBom = tmplBomCRef === null || tmplBomCRef === void 0 || (_tmplBomCRef$value = tmplBomCRef.value) === null || _tmplBomCRef$value === void 0 || (_tmplBomCRef$value = _tmplBomCRef$value.formInstBom) === null || _tmplBomCRef$value === void 0 || (_tmplBomCRef$value = _tmplBomCRef$value.formTmplObjectBomList) === null || _tmplBomCRef$value === void 0 ? void 0 : _tmplBomCRef$value.find((item) => item.object_key_ === belongingObject);
|
|
169513
|
-
const scanRules = !!(
|
|
169837
|
+
const scanRules = !!(objectBom === null || objectBom === void 0 ? void 0 : objectBom.disable_barcode_parsing_) ? void 0 : toParseRuleConfig(objectBom === null || objectBom === void 0 ? void 0 : objectBom.barcode_parsing_rules_id_);
|
|
169514
169838
|
const objectFields = fieldList.value.filter((item) => item.belongingObject === belongingObject);
|
|
169515
169839
|
await G2("COMMON_SCAN", {
|
|
169516
169840
|
title: "扫码录入",
|
|
@@ -169590,7 +169914,8 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169590
169914
|
}
|
|
169591
169915
|
if (transformedData && typeof transformedData === "object") Object.assign(updates, Object.fromEntries(Object.entries(transformedData).map(([key, value]) => [rootPath(key), value])));
|
|
169592
169916
|
if (updates[runtimeValuePath.value] !== material.productionIdentificationName) updates[getIdPath(runtimeValuePath.value)] = null;
|
|
169593
|
-
props.doc
|
|
169917
|
+
const writes = await prepareConsumeWrite(props.doc, updates);
|
|
169918
|
+
props.doc.dataManager.setMultiple(writes, "user");
|
|
169594
169919
|
await props.doc.dataManager.whenEmitSettled();
|
|
169595
169920
|
return true;
|
|
169596
169921
|
} catch (e) {
|
|
@@ -169651,16 +169976,21 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169651
169976
|
});
|
|
169652
169977
|
}
|
|
169653
169978
|
async function onChange(data, record) {
|
|
169654
|
-
var _widgetProps$value2, _widgetProps$value3, _props$widget$widgetM, _props$widget$dataSlo,
|
|
169979
|
+
var _widgetProps$value2, _widgetProps$value3, _props$widget$widgetM, _props$widget$dataSlo, _tmplBomCRef$value6;
|
|
169980
|
+
const field = fieldMeta.value;
|
|
169655
169981
|
const dataValues = loadDataValuesByAutofillRules(record, (_widgetProps$value2 = widgetProps.value) === null || _widgetProps$value2 === void 0 ? void 0 : _widgetProps$value2.autofillRules, runtimeValuePath.value, (_widgetProps$value3 = widgetProps.value) === null || _widgetProps$value3 === void 0 ? void 0 : _widgetProps$value3.autofillEnabled, props.doc, data);
|
|
169656
169982
|
const subFieldValuePath = (_props$widget$widgetM = props.widget.widgetMeta) === null || _props$widget$widgetM === void 0 || (_props$widget$widgetM = _props$widget$widgetM.field) === null || _props$widget$widgetM === void 0 ? void 0 : _props$widget$widgetM.valuePath;
|
|
169657
169983
|
const dataIndex = (_props$widget$dataSlo = props.widget.dataSlotIndex) === null || _props$widget$dataSlo === void 0 ? void 0 : _props$widget$dataSlo.dataIndex;
|
|
169984
|
+
const parsed = subFieldValuePath && isNumber(dataIndex) ? parseValuePath(subFieldValuePath) : void 0;
|
|
169985
|
+
const consumeController = (parsed === null || parsed === void 0 ? void 0 : parsed.parentFieldPath) ? tmplBomCRef === null || tmplBomCRef === void 0 || (_tmplBomCRef$value6 = tmplBomCRef.value) === null || _tmplBomCRef$value6 === void 0 ? void 0 : _tmplBomCRef$value6.tableControllers[parsed.parentFieldPath] : void 0;
|
|
169986
|
+
const owner = (field === null || field === void 0 ? void 0 : field.belongingObject) ? fieldList.value.find((item) => item.key === field.belongingObject) : void 0;
|
|
169987
|
+
const isConsumeObject = !!owner && resolveFieldManifestType(owner) === FIELD_TYPE.MATERIAL_CONSUME;
|
|
169658
169988
|
const tableRuntime = new TableRuntime(props.doc);
|
|
169659
169989
|
let reverseFill = {};
|
|
169660
169990
|
let optionFill = {};
|
|
169661
169991
|
let optionFillSource = "user";
|
|
169662
|
-
if (
|
|
169663
|
-
const { parentFieldKey, fieldKey } =
|
|
169992
|
+
if (parsed && isNumber(dataIndex) && record) {
|
|
169993
|
+
const { parentFieldKey, fieldKey } = parsed;
|
|
169664
169994
|
if (parentFieldKey && fieldKey) {
|
|
169665
169995
|
reverseFill = tableRuntime.buildSelectReverseFill({
|
|
169666
169996
|
subFieldKey: parentFieldKey,
|
|
@@ -169682,13 +170012,13 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169682
170012
|
}
|
|
169683
170013
|
const dateObjectRuntime = new DateObjectRuntime(props.doc);
|
|
169684
170014
|
const dateObjectFill = dateObjectRuntime.buildFillFromOption({
|
|
169685
|
-
belongingObject:
|
|
169686
|
-
bizType:
|
|
170015
|
+
belongingObject: field === null || field === void 0 ? void 0 : field.belongingObject,
|
|
170016
|
+
bizType: field === null || field === void 0 ? void 0 : field.fieldType,
|
|
169687
170017
|
selectedOption: record
|
|
169688
170018
|
});
|
|
169689
170019
|
const dateObjectClears = dateObjectRuntime.buildDownstreamClears({
|
|
169690
|
-
belongingObject:
|
|
169691
|
-
bizType:
|
|
170020
|
+
belongingObject: field === null || field === void 0 ? void 0 : field.belongingObject,
|
|
170021
|
+
bizType: field === null || field === void 0 ? void 0 : field.fieldType,
|
|
169692
170022
|
pending: data
|
|
169693
170023
|
});
|
|
169694
170024
|
const pending = {
|
|
@@ -169699,55 +170029,46 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169699
170029
|
...dateObjectFill
|
|
169700
170030
|
};
|
|
169701
170031
|
const linkageClears = tableRuntime.buildDownstreamClears(pending);
|
|
169702
|
-
let consumeUpdates = {};
|
|
169703
170032
|
try {
|
|
169704
|
-
var
|
|
169705
|
-
consumeUpdates = await buildConsumeObjectSelectUpdates({
|
|
170033
|
+
var _tmplBomCRef$value7;
|
|
170034
|
+
const consumeUpdates = await buildConsumeObjectSelectUpdates({
|
|
169706
170035
|
doc: props.doc,
|
|
169707
|
-
belongingObject:
|
|
169708
|
-
fieldType:
|
|
170036
|
+
belongingObject: field === null || field === void 0 ? void 0 : field.belongingObject,
|
|
170037
|
+
fieldType: field === null || field === void 0 ? void 0 : field.fieldType,
|
|
169709
170038
|
selectedOption: record,
|
|
169710
170039
|
pending: data,
|
|
169711
|
-
formInstBom: tmplBomCRef === null || tmplBomCRef === void 0 || (_tmplBomCRef$
|
|
170040
|
+
formInstBom: tmplBomCRef === null || tmplBomCRef === void 0 || (_tmplBomCRef$value7 = tmplBomCRef.value) === null || _tmplBomCRef$value7 === void 0 ? void 0 : _tmplBomCRef$value7.formInstBom
|
|
169712
170041
|
});
|
|
169713
|
-
|
|
169714
|
-
|
|
169715
|
-
|
|
169716
|
-
|
|
169717
|
-
|
|
169718
|
-
|
|
169719
|
-
|
|
169720
|
-
|
|
169721
|
-
|
|
169722
|
-
|
|
169723
|
-
|
|
169724
|
-
|
|
169725
|
-
|
|
169726
|
-
|
|
169727
|
-
|
|
169728
|
-
|
|
169729
|
-
|
|
169730
|
-
|
|
169731
|
-
|
|
169732
|
-
|
|
169733
|
-
|
|
169734
|
-
|
|
169735
|
-
|
|
169736
|
-
|
|
169737
|
-
|
|
169738
|
-
|
|
169739
|
-
|
|
169740
|
-
|
|
169741
|
-
|
|
169742
|
-
|
|
169743
|
-
tableController === null || tableController === void 0 || tableController.handleSelectChange({
|
|
169744
|
-
changedData: data,
|
|
169745
|
-
selectedOption: record,
|
|
169746
|
-
doc: props.doc,
|
|
169747
|
-
parsed,
|
|
169748
|
-
dataIndex
|
|
169749
|
-
});
|
|
169750
|
-
}
|
|
170042
|
+
const nextValues = {
|
|
170043
|
+
...pending,
|
|
170044
|
+
...linkageClears,
|
|
170045
|
+
...dateObjectClears,
|
|
170046
|
+
...consumeUpdates
|
|
170047
|
+
};
|
|
170048
|
+
if (consumeController && parsed && isNumber(dataIndex)) Object.assign(nextValues, await consumeController.prepareSelectChange({
|
|
170049
|
+
pending: nextValues,
|
|
170050
|
+
selectedOption: record,
|
|
170051
|
+
doc: props.doc,
|
|
170052
|
+
parsed,
|
|
170053
|
+
dataIndex
|
|
170054
|
+
}));
|
|
170055
|
+
applyOptionFillUpdates(props.doc.dataManager, nextValues, optionFill, data, optionFillSource);
|
|
170056
|
+
const reinspection = getConsumeObjectReinspectionParams({
|
|
170057
|
+
doc: props.doc,
|
|
170058
|
+
belongingObject: field === null || field === void 0 ? void 0 : field.belongingObject,
|
|
170059
|
+
fieldType: field === null || field === void 0 ? void 0 : field.fieldType,
|
|
170060
|
+
nextValues
|
|
170061
|
+
});
|
|
170062
|
+
if (reinspection) await assertReinspectionDate(reinspection);
|
|
170063
|
+
const writes = (field === null || field === void 0 ? void 0 : field.fieldType) === FIELD_TYPE.MATERIAL_NO && (consumeController || isConsumeObject) ? await prepareConsumeWrite(props.doc, nextValues) : nextValues;
|
|
170064
|
+
props.doc.dataManager.setMultiple(writes, "user");
|
|
170065
|
+
if (consumeController && parsed && isNumber(dataIndex)) consumeController.afterSelectChange({
|
|
170066
|
+
doc: props.doc,
|
|
170067
|
+
parsed,
|
|
170068
|
+
dataIndex
|
|
170069
|
+
});
|
|
170070
|
+
} catch (error) {
|
|
170071
|
+
GctMessage.error(error instanceof Error ? error.message : String(error));
|
|
169751
170072
|
}
|
|
169752
170073
|
}
|
|
169753
170074
|
return (_ctx, _cache) => {
|
|
@@ -169865,8 +170186,8 @@ var init_overlay_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
169865
170186
|
//#region src/runtime/canvas/__common__/widget-container/overlay-render.vue?vue&type=style&index=0&lang.less
|
|
169866
170187
|
var init_overlay_render_vue_vue_type_style_index_0_lang = __esmMin((() => {}));
|
|
169867
170188
|
//#endregion
|
|
169868
|
-
//#region src/runtime/canvas/__common__/widget-container/overlay-render.vue?vue&type=style&index=1&scoped=
|
|
169869
|
-
var
|
|
170189
|
+
//#region src/runtime/canvas/__common__/widget-container/overlay-render.vue?vue&type=style&index=1&scoped=f4ff350c&lang.less
|
|
170190
|
+
var init_overlay_render_vue_vue_type_style_index_1_scoped_f4ff350c_lang = __esmMin((() => {}));
|
|
169870
170191
|
//#endregion
|
|
169871
170192
|
//#region src/runtime/canvas/__common__/widget-container/overlay-render.vue
|
|
169872
170193
|
var overlay_render_default;
|
|
@@ -169874,9 +170195,9 @@ var init_overlay_render = __esmMin((() => {
|
|
|
169874
170195
|
init_overlay_render_vue_vue_type_script_setup_true_lang();
|
|
169875
170196
|
init_overlay_render_vue_vue_type_script_setup_true_lang();
|
|
169876
170197
|
init_overlay_render_vue_vue_type_style_index_0_lang();
|
|
169877
|
-
|
|
170198
|
+
init_overlay_render_vue_vue_type_style_index_1_scoped_f4ff350c_lang();
|
|
169878
170199
|
init__plugin_vue_export_helper();
|
|
169879
|
-
overlay_render_default = /*#__PURE__*/ _plugin_vue_export_helper_default(overlay_render_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
170200
|
+
overlay_render_default = /*#__PURE__*/ _plugin_vue_export_helper_default(overlay_render_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-f4ff350c"]]);
|
|
169880
170201
|
}));
|
|
169881
170202
|
//#endregion
|
|
169882
170203
|
//#region src/utils/composables/useHoverDelay.ts
|
|
@@ -174562,6 +174883,8 @@ var init_table_render_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
174562
174883
|
tableDataRef,
|
|
174563
174884
|
subTableInfo,
|
|
174564
174885
|
mainFormState
|
|
174886
|
+
}).catch((error) => {
|
|
174887
|
+
console.warn("[material-consume] 表格初始化异常,跳过后续处理", error);
|
|
174565
174888
|
});
|
|
174566
174889
|
});
|
|
174567
174890
|
});
|
|
@@ -178725,6 +179048,7 @@ function useDragdrop(allowTypes, callbacks = {}) {
|
|
|
178725
179048
|
init_core$1();
|
|
178726
179049
|
init_computed();
|
|
178727
179050
|
init_on_field_attach();
|
|
179051
|
+
init_product_fields();
|
|
178728
179052
|
init_quick_search_util();
|
|
178729
179053
|
init_field_config_visibility();
|
|
178730
179054
|
init_field_type();
|
|
@@ -178823,7 +179147,8 @@ function createDesignFieldToWidgetFactory(getFieldManifestForField) {
|
|
|
178823
179147
|
extra: buildPaletteExtra(manifest, field.name, opts)
|
|
178824
179148
|
}, field, {
|
|
178825
179149
|
parentFieldKey: opts.parentFieldKey,
|
|
178826
|
-
refModelType: opts.refModelType
|
|
179150
|
+
refModelType: opts.refModelType,
|
|
179151
|
+
fieldProfile: field.belongingObject ? getMaterialConsumeObjectFieldProfile(field, opts.modelFields ?? []) ?? null : void 0
|
|
178827
179152
|
}), field, manifest);
|
|
178828
179153
|
};
|
|
178829
179154
|
}
|
|
@@ -178968,6 +179293,7 @@ init__plugin_vue_export_helper();
|
|
|
178968
179293
|
var field_palette_default = /*#__PURE__*/ _plugin_vue_export_helper_default(field_palette_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b61f4e94"]]);
|
|
178969
179294
|
//#endregion
|
|
178970
179295
|
//#region src/runtime/designer/toolkit/renderer/toolkit-content-fields.vue?vue&type=script&setup=true&lang.ts
|
|
179296
|
+
init_base$2();
|
|
178971
179297
|
init__register_();
|
|
178972
179298
|
init_field_type();
|
|
178973
179299
|
init_core$1();
|
|
@@ -179057,15 +179383,21 @@ var toolkit_content_fields_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
179057
179383
|
}
|
|
179058
179384
|
};
|
|
179059
179385
|
const handleDragStart = (field, e) => {
|
|
179060
|
-
|
|
179061
|
-
|
|
179062
|
-
|
|
179063
|
-
|
|
179064
|
-
|
|
179065
|
-
|
|
179066
|
-
|
|
179067
|
-
|
|
179068
|
-
|
|
179386
|
+
try {
|
|
179387
|
+
var _data$data$behavior;
|
|
179388
|
+
const data = {
|
|
179389
|
+
type: DndTransferTypeConst.Field,
|
|
179390
|
+
data: createFieldToWidget(field, {
|
|
179391
|
+
parentFieldKey: subFieldKey.value,
|
|
179392
|
+
refModelType: refModelType.value,
|
|
179393
|
+
modelFields: fields.value
|
|
179394
|
+
})
|
|
179395
|
+
};
|
|
179396
|
+
setDndTransferData(e, data, !!((_data$data$behavior = data.data.behavior) === null || _data$data$behavior === void 0 ? void 0 : _data$data$behavior.outOfFlow));
|
|
179397
|
+
} catch (error) {
|
|
179398
|
+
e.preventDefault();
|
|
179399
|
+
GctMessage.error(error instanceof Error ? error.message : String(error));
|
|
179400
|
+
}
|
|
179069
179401
|
};
|
|
179070
179402
|
return (_ctx, _cache) => {
|
|
179071
179403
|
return openBlock(), createElementBlock("div", _hoisted_1$124, [(openBlock(true), createElementBlock(Fragment, null, renderList(palletteFieldsList.value, (fields, colIndex) => {
|
|
@@ -179087,7 +179419,7 @@ var toolkit_content_fields_vue_vue_type_script_setup_true_lang_default = /*@__PU
|
|
|
179087
179419
|
//#endregion
|
|
179088
179420
|
//#region src/runtime/designer/toolkit/renderer/toolkit-content-fields.vue
|
|
179089
179421
|
init__plugin_vue_export_helper();
|
|
179090
|
-
var toolkit_content_fields_default = /*#__PURE__*/ _plugin_vue_export_helper_default(toolkit_content_fields_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
179422
|
+
var toolkit_content_fields_default = /*#__PURE__*/ _plugin_vue_export_helper_default(toolkit_content_fields_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b473340e"]]);
|
|
179091
179423
|
//#endregion
|
|
179092
179424
|
//#region src/runtime/designer/toolkit/renderer/toolkit-content-widgets.vue?vue&type=script&setup=true&lang.ts
|
|
179093
179425
|
init_base$2();
|
|
@@ -197571,7 +197903,8 @@ var input_prop_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
197571
197903
|
required: { type: Boolean },
|
|
197572
197904
|
disabled: { type: Boolean },
|
|
197573
197905
|
fieldDisabled: { type: Boolean },
|
|
197574
|
-
fieldInfo: {}
|
|
197906
|
+
fieldInfo: {},
|
|
197907
|
+
modelRequiredOverride: { type: Boolean }
|
|
197575
197908
|
},
|
|
197576
197909
|
emits: ["update:required", "update:disabled"],
|
|
197577
197910
|
setup(__props, { emit: __emit }) {
|
|
@@ -197580,7 +197913,7 @@ var input_prop_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
197580
197913
|
/** 模型元数据强制必填 */
|
|
197581
197914
|
const fieldRequired = computed(() => {
|
|
197582
197915
|
var _props$fieldInfo;
|
|
197583
|
-
return Boolean((_props$fieldInfo = props.fieldInfo) === null || _props$fieldInfo === void 0 ? void 0 : _props$fieldInfo.required);
|
|
197916
|
+
return props.modelRequiredOverride ?? Boolean((_props$fieldInfo = props.fieldInfo) === null || _props$fieldInfo === void 0 ? void 0 : _props$fieldInfo.required);
|
|
197584
197917
|
});
|
|
197585
197918
|
/**
|
|
197586
197919
|
* 必填勾选锁定:模型强制必填,或业务表固定禁用(fieldDisabled)时都不允许切换
|
|
@@ -197634,7 +197967,7 @@ var input_prop_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
197634
197967
|
//#endregion
|
|
197635
197968
|
//#region src/suites/shared/panel/config/editor/input-prop-editor.vue
|
|
197636
197969
|
init__plugin_vue_export_helper();
|
|
197637
|
-
var input_prop_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(input_prop_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
197970
|
+
var input_prop_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(input_prop_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-aefdaa0c"]]);
|
|
197638
197971
|
//#endregion
|
|
197639
197972
|
//#region src/suites/shared/panel/config/editor/keep-exception-highlight-editor.vue?vue&type=script&setup=true&name=keep-exception-highlight-editor&lang.ts
|
|
197640
197973
|
init_base$2();
|
|
@@ -199112,6 +199445,7 @@ init__register_();
|
|
|
199112
199445
|
init_core();
|
|
199113
199446
|
init_field_type();
|
|
199114
199447
|
init_table$1();
|
|
199448
|
+
init_product_fields();
|
|
199115
199449
|
init_table_runtime_context();
|
|
199116
199450
|
var _hoisted_1$46 = { class: "ref-autofill-editor__extra" };
|
|
199117
199451
|
var ref_autofill_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -199125,6 +199459,7 @@ var ref_autofill_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
199125
199459
|
},
|
|
199126
199460
|
emits: ["update:autofillEnabled", "update:autofillRules"],
|
|
199127
199461
|
setup(__props, { emit: __emit }) {
|
|
199462
|
+
const { runtime } = useDesignSuiteContext();
|
|
199128
199463
|
const { loadFieldList, loadModelInfo } = useModelLoader();
|
|
199129
199464
|
const { docInst } = useDocPubApiContext();
|
|
199130
199465
|
const { open: openDesignModal } = useOpenDesignModal();
|
|
@@ -199143,18 +199478,20 @@ var ref_autofill_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
199143
199478
|
});
|
|
199144
199479
|
const modelKey = computed(() => props.currentField.modelKey);
|
|
199145
199480
|
const refModelKey = computed(() => props.currentField.bindInfo);
|
|
199146
|
-
|
|
199147
|
-
var _props$subFieldKey, _TableRuntimeContext
|
|
199481
|
+
function getBuiltInRules() {
|
|
199482
|
+
var _props$subFieldKey, _TableRuntimeContext$;
|
|
199483
|
+
const field = props.currentField;
|
|
199148
199484
|
const subFieldKey = (_props$subFieldKey = props.subFieldKey) === null || _props$subFieldKey === void 0 ? void 0 : _props$subFieldKey.replace(/^\$\./, "");
|
|
199149
|
-
|
|
199150
|
-
|
|
199151
|
-
|
|
199152
|
-
|
|
199153
|
-
|
|
199154
|
-
|
|
199155
|
-
|
|
199485
|
+
const refModelType = subFieldKey && docInst.value ? (_TableRuntimeContext$ = TableRuntimeContext.find(docInst.value, subFieldKey)) === null || _TableRuntimeContext$ === void 0 ? void 0 : _TableRuntimeContext$.refModelType : void 0;
|
|
199486
|
+
const profile = field.belongingObject ? getMaterialConsumeObjectFieldProfile(field, runtime.getFieldList(field.modelKey)) : getBusinessFieldProfileByRefModelType(refModelType, field);
|
|
199487
|
+
return ((profile === null || profile === void 0 ? void 0 : profile.autofillTemplates) ?? []).map(({ fromField, toField }) => ({
|
|
199488
|
+
fromField,
|
|
199489
|
+
toField: typeof toField === "function" ? toField({ sourceFieldKey: field.key }) : toField,
|
|
199490
|
+
toModelKey: field.modelKey,
|
|
199491
|
+
toSubModel: subFieldKey ? 1 : 0,
|
|
199492
|
+
toSubFieldKey: subFieldKey || void 0
|
|
199156
199493
|
}));
|
|
199157
|
-
}
|
|
199494
|
+
}
|
|
199158
199495
|
function filterNonSystemFields(fields) {
|
|
199159
199496
|
return fields.filter((d) => d.createType !== "SYSTEM");
|
|
199160
199497
|
}
|
|
@@ -199257,7 +199594,7 @@ var ref_autofill_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
199257
199594
|
toSubTables,
|
|
199258
199595
|
toModelInfo,
|
|
199259
199596
|
rules: _autofillRules.value,
|
|
199260
|
-
builtInRules:
|
|
199597
|
+
builtInRules: getBuiltInRules()
|
|
199261
199598
|
},
|
|
199262
199599
|
onConfirm: async ({ bodyRef, close }) => {
|
|
199263
199600
|
var _bodyRef$value2, _bodyRef$value2$onSav;
|
|
@@ -199296,7 +199633,7 @@ var ref_autofill_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
199296
199633
|
//#endregion
|
|
199297
199634
|
//#region src/suites/shared/panel/config/editor/ref-autofill-editor/ref-autofill-editor.vue
|
|
199298
199635
|
init__plugin_vue_export_helper();
|
|
199299
|
-
var ref_autofill_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ref_autofill_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
199636
|
+
var ref_autofill_editor_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ref_autofill_editor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-18682fe2"]]);
|
|
199300
199637
|
//#endregion
|
|
199301
199638
|
//#region src/suites/shared/panel/modules/online-form-tmpl-module/online-form-tmpl-utils.ts
|
|
199302
199639
|
var ONLINE_FORM_TMPL_MODULE_TYPE = "online_form_module";
|
|
@@ -203652,12 +203989,14 @@ var field_text_config_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
203652
203989
|
required: formState.value.required,
|
|
203653
203990
|
"onUpdate:required": _cache[2] || (_cache[2] = ($event) => formState.value.required = $event),
|
|
203654
203991
|
fieldDisabled: formState.value.fieldDisabled,
|
|
203655
|
-
fieldInfo: __props.fieldInfo
|
|
203992
|
+
fieldInfo: __props.fieldInfo,
|
|
203993
|
+
modelRequiredOverride: formState.value.modelRequiredOverride
|
|
203656
203994
|
}, null, 8, [
|
|
203657
203995
|
"disabled",
|
|
203658
203996
|
"required",
|
|
203659
203997
|
"fieldDisabled",
|
|
203660
|
-
"fieldInfo"
|
|
203998
|
+
"fieldInfo",
|
|
203999
|
+
"modelRequiredOverride"
|
|
203661
204000
|
]),
|
|
203662
204001
|
createVNode(FormSegmentEditor_default, {
|
|
203663
204002
|
label: "查看时渲染方式",
|
|
@@ -203720,7 +204059,7 @@ var field_text_config_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
|
|
|
203720
204059
|
//#region src/suites/edhr/panel-config/field/text/field-text-config.vue
|
|
203721
204060
|
var field_text_config_exports = /* @__PURE__ */ __exportAll({ default: () => field_text_config_default });
|
|
203722
204061
|
init__plugin_vue_export_helper();
|
|
203723
|
-
var field_text_config_default = /*#__PURE__*/ _plugin_vue_export_helper_default(field_text_config_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
204062
|
+
var field_text_config_default = /*#__PURE__*/ _plugin_vue_export_helper_default(field_text_config_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7ccc38ed"]]);
|
|
203724
204063
|
//#endregion
|
|
203725
204064
|
//#region src/suites/shared/panel/config/editor/assoc-filter-editor/utils.ts
|
|
203726
204065
|
init_field_type();
|