@gct-paas/word 0.1.63-beta.1 → 0.1.63-beta.2

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.
@@ -253,6 +253,8 @@ export interface FieldOptionFillDef {
253
253
  optionLabelField?: string;
254
254
  /** 目标行 label 字段 key */
255
255
  toLabelField?: string;
256
+ /** 写入前对 option 值做转换(如日期时间 → 日期) */
257
+ transform?: (value: unknown) => unknown;
256
258
  }
257
259
  /**
258
260
  * 业务下拉列表取数自定义接口绑定
package/dist/index.es.js CHANGED
@@ -33597,6 +33597,11 @@ function resolveFinalFieldFormat(props) {
33597
33597
  }
33598
33598
  const DATE_STORAGE_FORMAT_FALLBACK = "YYYY-MM-DD";
33599
33599
  const DATETIME_STORAGE_FORMAT_FALLBACK = "YYYY-MM-DD HH:mm:ss";
33600
+ function toDateOnly(value) {
33601
+ if (value == null || value === "") return value;
33602
+ const d = dayjs(value);
33603
+ return d.isValid() ? d.format(DATE_STORAGE_FORMAT_FALLBACK) : value;
33604
+ }
33600
33605
  function resolveDateTimeStorageFormat(props, isDateTime) {
33601
33606
  const format2 = resolveFinalFieldFormat(props);
33602
33607
  if (format2) return format2;
@@ -87871,8 +87876,14 @@ class LinkageEngine {
87871
87876
  }
87872
87877
  /** 将单条 FieldOptionFillDef 映射写入 updates */
87873
87878
  applyOptionFillDef(updates, rowPath, def, option) {
87874
- const value = option[def.optionField];
87875
- updates[`${rowPath}.${def.toField}`] = isBlank(value) ? null : value;
87879
+ const key = `${rowPath}.${def.toField}`;
87880
+ const rawValue = option[def.optionField];
87881
+ if (isBlank(rawValue)) {
87882
+ updates[key] = null;
87883
+ return;
87884
+ }
87885
+ const value = def.transform?.(rawValue) ?? rawValue;
87886
+ updates[key] = isBlank(value) ? null : value;
87876
87887
  }
87877
87888
  }
87878
87889
  const pendingRowSyncTriggerByDoc = /* @__PURE__ */ new WeakMap();
@@ -89139,7 +89150,8 @@ const fields$1 = [
89139
89150
  },
89140
89151
  {
89141
89152
  optionField: "real_start_date_",
89142
- toField: F$2.productionDate
89153
+ toField: F$2.productionDate,
89154
+ transform: toDateOnly
89143
89155
  }
89144
89156
  ]
89145
89157
  },
@@ -89183,7 +89195,8 @@ const fields$1 = [
89183
89195
  },
89184
89196
  {
89185
89197
  optionField: "real_start_date_",
89186
- toField: F$2.productionDate
89198
+ toField: F$2.productionDate,
89199
+ transform: toDateOnly
89187
89200
  }
89188
89201
  ]
89189
89202
  },
@@ -89228,7 +89241,8 @@ const fields$1 = [
89228
89241
  },
89229
89242
  {
89230
89243
  optionField: "real_start_date_",
89231
- toField: F$2.productionDate
89244
+ toField: F$2.productionDate,
89245
+ transform: toDateOnly
89232
89246
  }
89233
89247
  ]
89234
89248
  },
@@ -89392,7 +89406,7 @@ function resolvePretreatmentListRemoteSync(records, ctx) {
89392
89406
  apply: {
89393
89407
  [F$2.materialContainer]: record.name_,
89394
89408
  [MATERIAL_CONTAINER_ID]: record.id_,
89395
- [F$2.productionDate]: record.real_start_date_,
89409
+ [F$2.productionDate]: toDateOnly(record.real_start_date_),
89396
89410
  ...ctx.row,
89397
89411
  ...pickDefinedFields(record, INVENTORY_INFO_APPLY_FIELDS$1)
89398
89412
  }
@@ -89555,7 +89569,8 @@ const fields = [
89555
89569
  },
89556
89570
  {
89557
89571
  optionField: "real_start_date_",
89558
- toField: F$1.productionDate
89572
+ toField: F$1.productionDate,
89573
+ transform: toDateOnly
89559
89574
  }
89560
89575
  ]
89561
89576
  },
@@ -89630,7 +89645,7 @@ function resolveEntrustSterilBatchListRemoteSync(records, ctx) {
89630
89645
  return {
89631
89646
  apply: {
89632
89647
  [F$1.productionContainer]: record.id_,
89633
- [F$1.productionDate]: record.real_start_date_,
89648
+ [F$1.productionDate]: toDateOnly(record.real_start_date_),
89634
89649
  ...ctx.row,
89635
89650
  ...pickDefinedFields(record, INVENTORY_INFO_APPLY_FIELDS)
89636
89651
  }
@@ -109029,7 +109044,7 @@ class MaterialConsumeTableController {
109029
109044
  Object.assign(row, fillData);
109030
109045
  }
109031
109046
  if (data.expiration) {
109032
- row.expiration_date_ = dayjs(data.expiration).format("YYYY-MM-DD");
109047
+ row.expiration_date_ = toDateOnly(data.expiration);
109033
109048
  }
109034
109049
  this.setDefaultValue(row);
109035
109050
  try {
@@ -109726,6 +109741,7 @@ const CONTEXT_DEFAULT_RESOLVERS = {
109726
109741
  const first = p.paramsConfig?.sopList ?? [];
109727
109742
  return first?.[0]?.version;
109728
109743
  },
109744
+ [FIELD_TYPE.STERILIZATION_CONTAINER]: (p) => p.paramsConfig?.sterilizationLot,
109729
109745
  [FIELD_TYPE.USER]: (p) => p.defaultUserId,
109730
109746
  [FIELD_TYPE.USER_MULTI]: (p) => p.defaultUserId,
109731
109747
  [FIELD_TYPE.ORG]: (p) => p.defaultOrgId,
@@ -2,9 +2,9 @@ import { MaterialConsumptionPatternEnum, IFormTmplBom, IMaterialConsumeData, Par
2
2
  import { FormTmplBomController } from './tmpl-bom-controller';
3
3
  import { Ref } from 'vue';
4
4
  import { BomEntriesValidator } from './bom-validator';
5
- import { DataManager } from '../../../../../core/data';
6
5
  import { Doc } from '../../../../../core';
7
6
  import { ParsedValuePath } from '../../../../../utils/func/core';
7
+ import { DataManager } from '../../../../../core/data';
8
8
  export interface ISubTableInfo {
9
9
  valuePath: string;
10
10
  subFieldKey: string;
@@ -36,6 +36,8 @@ export type DateTimeFieldFormatProps = {
36
36
  };
37
37
  /** 解析字段最终 dayjs 格式(含分隔符替换) */
38
38
  export declare function resolveFinalFieldFormat(props: DateTimeFieldFormatProps): string;
39
+ /** 日期时间 → 日期(YYYY-MM-DD);无效值原样返回 */
40
+ export declare function toDateOnly(value: unknown): unknown;
39
41
  /** 日期/日期时间字段写入 DataManager 的存储格式 */
40
42
  export declare function resolveDateTimeStorageFormat(props: DateTimeFieldFormatProps, isDateTime: boolean): string;
41
43
  /** 日期时间面板时间列 format(与 GctTimer 一致) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.63-beta.1",
3
+ "version": "0.1.63-beta.2",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",