@gct-paas/word 0.1.59 → 0.1.61

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 CHANGED
@@ -94495,12 +94495,14 @@ class SetMaterialConsumeTable extends CommandBase {
94495
94495
  row: endCell.parent?.getCurrentIndex(),
94496
94496
  col: endCell.getCurrentIndex()
94497
94497
  };
94498
+ const { name: name2, valuePath } = this.payload;
94499
+ const props = { table_key_: valuePath };
94498
94500
  this.output = startCell.table.setMaterialConsumeTable({
94499
94501
  start,
94500
94502
  end,
94501
- name: this.payload.name,
94502
- valuePath: this.payload.valuePath,
94503
- widgetMeta: { props: { table_key_: "" } }
94503
+ name: name2,
94504
+ valuePath,
94505
+ widgetMeta: { props }
94504
94506
  });
94505
94507
  return null;
94506
94508
  }
@@ -106413,7 +106415,7 @@ class BomEntriesValidator {
106413
106415
  }
106414
106416
  const util = this.findUtilByProductId(row.product_id_);
106415
106417
  if (!util) {
106416
- const name2 = row.product_id__lb_ ? JSON.parse(row.product_id__lb_).join(",") : "";
106418
+ const name2 = row.product_id__lb_ || "";
106417
106419
  throw new Error(
106418
106420
  // $t('sys.edhr.mcTable.productNotDefine', {
106419
106421
  // product: name,
@@ -106952,7 +106954,7 @@ class MaterialConsumeTableController {
106952
106954
  /** 校验有效期 */
106953
106955
  validateExpiration(row) {
106954
106956
  if (row.expiration_date_) {
106955
- if (dayjs(row.expiration_date_).isBefore(dayjs())) {
106957
+ if (dayjs(row.expiration_date_).isBefore(dayjs().subtract(1, "day").endOf("day"))) {
106956
106958
  throw new Error("有效期不能早于当前日期");
106957
106959
  }
106958
106960
  }
@@ -114596,7 +114598,7 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114596
114598
  const { isMaterialConsume, isWarehouseInventory, isWarehouseAllocate } = subTableType.value;
114597
114599
  const canCopy = !isWarehouseInventory && !isWarehouseAllocate;
114598
114600
  const canInsertMulti = !isMaterialConsume && !isWarehouseInventory && !isWarehouseAllocate;
114599
- const canDelete = visibleRows.length > 1;
114601
+ const canDelete = visibleRows.length > 1 && (isMaterialConsume ? props.isLastRow : true);
114600
114602
  const isConfirmed = !!visibleRows[index2]?.is_confirmed_;
114601
114603
  return {
114602
114604
  canCopy,
@@ -114888,7 +114890,7 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114888
114890
  };
114889
114891
  }
114890
114892
  });
114891
- const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2G, [["__scopeId", "data-v-2b5fa953"]]);
114893
+ const SubTableAction = /* @__PURE__ */ _export_sfc(_sfc_main$2G, [["__scopeId", "data-v-2ebdf814"]]);
114892
114894
  const _sfc_main$2F = /* @__PURE__ */ defineComponent({
114893
114895
  __name: "index",
114894
114896
  props: {
@@ -133511,13 +133513,6 @@ function toQuickSearchFieldKey(field) {
133511
133513
  if (!exp) return field.key;
133512
133514
  return field.key.includes(".") ? field.key : `${field.key}.${exp}`;
133513
133515
  }
133514
- function getQuickQueryDataByKeyword(quickSearchField, keyword) {
133515
- return quickSearchField.reduce((total, fieldKey) => {
133516
- const expKey = fieldKey.split(".").length > 1 ? fieldKey : `${fieldKey}.iLike`;
133517
- total[expKey] = keyword;
133518
- return total;
133519
- }, {});
133520
- }
133521
133516
  function fillDefaultSearchField(fields2 = []) {
133522
133517
  return Array.from(/* @__PURE__ */ new Set([...DEFAULT_QUICK_SEARCH_FIELDS, ...fields2]));
133523
133518
  }
@@ -133529,6 +133524,42 @@ function buildQuickSearchFieldOptions(fields2 = []) {
133529
133524
  value: toQuickSearchFieldKey(item)
133530
133525
  }));
133531
133526
  }
133527
+ function normalizeSearchFieldKey(field) {
133528
+ return field.includes(".") ? field : `${field}.iLike`;
133529
+ }
133530
+ function joinAnd(keys2) {
133531
+ if (keys2.length === 0) return "";
133532
+ if (keys2.length === 1) return keys2[0];
133533
+ return `AND(${keys2.join(",")})`;
133534
+ }
133535
+ function joinOr(keys2) {
133536
+ if (keys2.length === 0) return "";
133537
+ if (keys2.length === 1) return keys2[0];
133538
+ return `OR(${keys2.join(",")})`;
133539
+ }
133540
+ function buildLikeQuery(searchFields, keyword, extraQuery = {}, options) {
133541
+ const queryData = {
133542
+ ...extraQuery
133543
+ };
133544
+ const filterKeys = Object.keys(extraQuery);
133545
+ const searchKeys = [];
133546
+ if (keyword?.trim()) {
133547
+ searchFields.forEach((field) => {
133548
+ const key = normalizeSearchFieldKey(field);
133549
+ queryData[key] = keyword;
133550
+ searchKeys.push(key);
133551
+ });
133552
+ }
133553
+ const filterExp = joinAnd(filterKeys);
133554
+ const likeExp = joinOr(searchKeys);
133555
+ let exp = "";
133556
+ if (filterExp && likeExp) {
133557
+ exp = `AND(${filterExp},${likeExp})`;
133558
+ } else {
133559
+ exp = filterExp || likeExp;
133560
+ }
133561
+ return { queryData, exp };
133562
+ }
133532
133563
  function buildDeviceBaseQuery(extraQuery) {
133533
133564
  const queryData = {
133534
133565
  operating_state_: true,
@@ -133541,35 +133572,21 @@ function buildDeviceBaseQuery(extraQuery) {
133541
133572
  return queryData;
133542
133573
  }
133543
133574
  function buildDeviceQuickSearchQuery(quickSearchField, keyword, extraQuery) {
133544
- const baseQuery = buildDeviceBaseQuery(extraQuery);
133545
- if (!keyword?.trim()) {
133546
- return { queryData: baseQuery, exp: "" };
133547
- }
133548
- const fields2 = fillDefaultSearchField(quickSearchField);
133549
- return {
133550
- queryData: {
133551
- ...getQuickQueryDataByKeyword(fields2, keyword),
133552
- ...baseQuery
133553
- },
133554
- exp: `OR(${fields2.join(",")})`
133555
- };
133575
+ return buildLikeQuery(
133576
+ fillDefaultSearchField(quickSearchField),
133577
+ keyword,
133578
+ buildDeviceBaseQuery(extraQuery)
133579
+ );
133556
133580
  }
133557
- function buildRefQuickSearchQuery(searchField, keyword, extraQuery) {
133558
- const baseQuery = {
133559
- operating_state_: true,
133560
- ...extraQuery
133561
- };
133562
- if (!keyword?.trim()) {
133563
- return { queryData: baseQuery, exp: "" };
133564
- }
133565
- const fields2 = searchField?.length ? searchField : ["code_.iLike", "name_.iLike"];
133566
- return {
133567
- queryData: {
133568
- ...getQuickQueryDataByKeyword(fields2, keyword),
133569
- ...baseQuery
133570
- },
133571
- exp: `OR(${fields2.join(",")})`
133572
- };
133581
+ function buildRefQuickSearchQuery(searchField, keyword, extraQuery, options) {
133582
+ const fields2 = searchField?.length ? searchField : ["code_", "name_"];
133583
+ return buildLikeQuery(
133584
+ fields2,
133585
+ keyword,
133586
+ {
133587
+ ...extraQuery
133588
+ }
133589
+ );
133573
133590
  }
133574
133591
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
133575
133592
  __name: "quick-search-editor",
@@ -136507,62 +136524,28 @@ function shouldEnableLinkage(doc, clickedFieldType, clickedKey) {
136507
136524
  return key === clickedKey && fieldMeta.fieldType === targetLinkedFieldType;
136508
136525
  });
136509
136526
  }
136510
- function buildLikeQuery(fields2, keyword, query = {}) {
136511
- const resultQuery = {
136512
- ...query
136513
- };
136514
- const queryExp = Object.keys(query);
136515
- let likeExp = "";
136516
- if (keyword?.trim()) {
136517
- fields2.forEach((field) => {
136518
- const key = field.includes(".") ? field : `${field}.iLike`;
136519
- resultQuery[key] = keyword;
136520
- });
136521
- likeExp = `OR(${fields2.map((field) => field.includes(".") ? field : `${field}.iLike`).join(",")})`;
136522
- }
136523
- const baseExp = queryExp.length ? `OR(${queryExp.join(",")})` : "";
136524
- let exp = "";
136525
- if (baseExp && likeExp) {
136526
- exp = `AND(${baseExp},${likeExp})`;
136527
- } else {
136528
- exp = baseExp || likeExp;
136529
- }
136530
- return {
136531
- queryData: resultQuery,
136532
- exp
136533
- };
136534
- }
136535
- const selectStrategyMap = {
136536
- [FIELD_TYPE.MATERIAL_NO]: {
136537
- columnsKey: "lot-sn",
136538
- fetcher: "lot2sn",
136539
- allowManualInput: true,
136540
- persistOptionId: true,
136541
- buildQuery({ keyword, extraParams }) {
136542
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136543
- },
136544
- transform: transformLotData
136527
+ const LOT2SN_STRATEGY = {
136528
+ columnsKey: "lot-sn",
136529
+ fetcher: "lot2sn",
136530
+ allowManualInput: true,
136531
+ persistOptionId: true,
136532
+ buildQuery({ keyword, extraParams }) {
136533
+ return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136545
136534
  },
136546
- [FIELD_TYPE.SCRAP_MATERIAL_NO]: {
136547
- columnsKey: "lot-sn",
136548
- fetcher: "lot2sn",
136549
- allowManualInput: true,
136550
- persistOptionId: true,
136551
- buildQuery({ keyword, extraParams }) {
136552
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136553
- },
136554
- transform: transformLotData
136555
- },
136556
- [FIELD_TYPE.RELATED_LOT_NO]: {
136557
- columnsKey: "lot-sn",
136558
- fetcher: "lot2sn",
136559
- allowManualInput: true,
136560
- persistOptionId: true,
136561
- buildQuery({ keyword, extraParams }) {
136562
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136563
- },
136564
- transform: transformLotData
136535
+ transform: transformLotData
136536
+ };
136537
+ const REF_STRATEGY = {
136538
+ columnsKey: "ref",
136539
+ fetcher: "ref",
136540
+ buildQuery({ keyword, searchField, extraParams }) {
136541
+ return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136565
136542
  },
136543
+ transform: transformLotData
136544
+ };
136545
+ const selectStrategyMap = {
136546
+ [FIELD_TYPE.MATERIAL_NO]: LOT2SN_STRATEGY,
136547
+ [FIELD_TYPE.SCRAP_MATERIAL_NO]: LOT2SN_STRATEGY,
136548
+ [FIELD_TYPE.RELATED_LOT_NO]: LOT2SN_STRATEGY,
136566
136549
  [FIELD_TYPE.MFG_ORDER]: {
136567
136550
  columnsKey: "mfg-order",
136568
136551
  fetcher: "ref",
@@ -136718,6 +136701,9 @@ const selectStrategyMap = {
136718
136701
  },
136719
136702
  transform: transformTreeData
136720
136703
  },
136704
+ [FIELD_TYPE.WAREHOUSE]: REF_STRATEGY,
136705
+ [FIELD_TYPE.LOCATION]: REF_STRATEGY,
136706
+ [FIELD_TYPE.REF]: REF_STRATEGY,
136721
136707
  [FIELD_TYPE.PRODUCTION_IDENTIFIER]: {
136722
136708
  columnsKey: "lot-sn",
136723
136709
  fetcher: "ref2lot2sn",
@@ -136728,30 +136714,6 @@ const selectStrategyMap = {
136728
136714
  });
136729
136715
  },
136730
136716
  transform: transformLotData
136731
- },
136732
- [FIELD_TYPE.WAREHOUSE]: {
136733
- columnsKey: "ref",
136734
- fetcher: "ref",
136735
- buildQuery({ keyword, searchField, extraParams }) {
136736
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136737
- },
136738
- transform: transformLotData
136739
- },
136740
- [FIELD_TYPE.LOCATION]: {
136741
- columnsKey: "ref",
136742
- fetcher: "ref",
136743
- buildQuery({ keyword, searchField, extraParams }) {
136744
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136745
- },
136746
- transform: transformLotData
136747
- },
136748
- [FIELD_TYPE.REF]: {
136749
- columnsKey: "ref",
136750
- fetcher: "ref",
136751
- buildQuery({ keyword, searchField, extraParams }) {
136752
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136753
- },
136754
- transform: transformLotData
136755
136717
  }
136756
136718
  };
136757
136719
  function getSelectStrategy(widgetProps, fieldType) {
@@ -1,4 +1,5 @@
1
1
  import { FIELD_TYPE } from '../../../../../../domain/field/field-type';
2
+ import { SelectApiBinding } from '../../../../../../domain/table/types';
2
3
  import { Doc } from '../../../../../../core';
3
4
  export interface SelectQueryContext {
4
5
  keyword: string;
@@ -11,6 +12,10 @@ export interface SelectQueryContext {
11
12
  deviceTypeId?: string;
12
13
  /** 目前用于 子表字段(带[n]) 额外参数配置 */
13
14
  extraParams: any;
15
+ optionMapping?: {
16
+ value?: string;
17
+ label?: string;
18
+ };
14
19
  }
15
20
  export interface SelectQueryResult {
16
21
  queryData?: Record<string, any>;
@@ -30,6 +35,13 @@ export interface SelectStrategy {
30
35
  persistOptionId?: boolean;
31
36
  buildQuery?: (ctx: SelectQueryContext) => SelectQueryResult;
32
37
  transform: (options: any[], value?: string, currentId?: string) => any;
38
+ /** 如下拉 value/label 与 fetcher 默认不同 */
39
+ optionMapping?: {
40
+ value?: string;
41
+ label?: string;
42
+ };
43
+ /** fetcher 为 biz 时声明业务接口 */
44
+ api?: SelectApiBinding;
33
45
  }
34
46
  /**
35
47
  * 判断指定字段是否需要开启【报废/不良】分类 ->原因单向数据联动
@@ -4,11 +4,27 @@ export declare function buildQuickSearchFieldOptions(fields?: FieldMeta[]): {
4
4
  label: string;
5
5
  value: string;
6
6
  }[];
7
+ /**
8
+ * 统一下拉查询拼装:
9
+ * - searchFields + keyword → queryData 写入搜索键,exp 为 OR(搜索键)
10
+ * - extraQuery(过滤条件)→ 原样并入 queryData;默认 AND(过滤键),可改为 OR
11
+ * - 两者皆有 → AND(过滤, OR(搜索))
12
+ */
13
+ export declare function buildLikeQuery(searchFields: string[], keyword: string, extraQuery?: Record<string, any>, options?: {
14
+ filterCombine?: 'and' | 'or';
15
+ }): {
16
+ queryData: Record<string, any>;
17
+ exp: string;
18
+ };
19
+ /** 设备下拉:默认搜 code/name + 设备类型过滤 */
7
20
  export declare function buildDeviceQuickSearchQuery(quickSearchField: string[] | undefined, keyword: string, extraQuery?: Record<string, any>): {
8
21
  queryData: Record<string, any>;
9
22
  exp: string;
10
23
  };
11
- export declare function buildRefQuickSearchQuery(searchField: string[] | undefined, keyword: string, extraQuery?: Record<string, unknown>): {
12
- queryData: Record<string, unknown>;
24
+ /** 关联下拉:默认搜 code/name,并带 operating_state_ */
25
+ export declare function buildRefQuickSearchQuery(searchField: string[] | undefined, keyword: string, extraQuery?: Record<string, unknown>, options?: {
26
+ filterCombine?: 'and' | 'or';
27
+ }): {
28
+ queryData: Record<string, any>;
13
29
  exp: string;
14
30
  };
package/dist/word.css CHANGED
@@ -8849,20 +8849,20 @@ textarea[data-v-e709484b]::placeholder {
8849
8849
  .table-action .row-headers .row-header:last-child .row-add-btn[data-v-c40eef9f] .gct-icon.bottom {
8850
8850
  transform: translateY(-100%);
8851
8851
  }
8852
- .sub-table-action-container[data-v-2b5fa953] {
8852
+ .sub-table-action-container[data-v-2ebdf814] {
8853
8853
  position: absolute;
8854
8854
  z-index: 999;
8855
8855
  }
8856
- .sub-table-action-bar[data-v-2b5fa953],
8857
- .sub-table-action-popper[data-v-2b5fa953] {
8856
+ .sub-table-action-bar[data-v-2ebdf814],
8857
+ .sub-table-action-popper[data-v-2ebdf814] {
8858
8858
  pointer-events: auto;
8859
8859
  user-select: none;
8860
8860
  }
8861
- .sub-table-action-bar[data-v-2b5fa953] {
8861
+ .sub-table-action-bar[data-v-2ebdf814] {
8862
8862
  display: flex;
8863
8863
  }
8864
- .sub-table-action-bar .more-btn[data-v-2b5fa953],
8865
- .sub-table-action-bar .confirm-btn[data-v-2b5fa953] {
8864
+ .sub-table-action-bar .more-btn[data-v-2ebdf814],
8865
+ .sub-table-action-bar .confirm-btn[data-v-2ebdf814] {
8866
8866
  display: flex;
8867
8867
  justify-content: center;
8868
8868
  align-items: center;
@@ -8871,44 +8871,44 @@ textarea[data-v-e709484b]::placeholder {
8871
8871
  cursor: pointer;
8872
8872
  box-sizing: border-box;
8873
8873
  }
8874
- .sub-table-action-bar .more-btn[data-v-2b5fa953] {
8874
+ .sub-table-action-bar .more-btn[data-v-2ebdf814] {
8875
8875
  width: 10px;
8876
8876
  background: #026ac8;
8877
8877
  border-radius: 0 4px 4px 0;
8878
8878
  }
8879
- .sub-table-action-bar .confirm-btn[data-v-2b5fa953] {
8879
+ .sub-table-action-bar .confirm-btn[data-v-2ebdf814] {
8880
8880
  margin-left: 4px;
8881
8881
  border-radius: 4px;
8882
8882
  border: 1px solid #4ec262;
8883
8883
  }
8884
- .sub-table-action-popper[data-v-2b5fa953] {
8884
+ .sub-table-action-popper[data-v-2ebdf814] {
8885
8885
  padding: 2px 8px;
8886
8886
  }
8887
- .sub-table-action-popper .action-menu[data-v-2b5fa953] {
8887
+ .sub-table-action-popper .action-menu[data-v-2ebdf814] {
8888
8888
  padding: 4px 0;
8889
8889
  width: 220px;
8890
8890
  user-select: none;
8891
8891
  }
8892
- .sub-table-action-popper .action-menu + .action-menu[data-v-2b5fa953] {
8892
+ .sub-table-action-popper .action-menu + .action-menu[data-v-2ebdf814] {
8893
8893
  margin-top: 4px;
8894
8894
  padding-top: 4px;
8895
8895
  border-top: 1px solid #efefef;
8896
8896
  }
8897
- .sub-table-action-popper .action-menu .menu-title[data-v-2b5fa953] {
8897
+ .sub-table-action-popper .action-menu .menu-title[data-v-2ebdf814] {
8898
8898
  color: #bcbcbc;
8899
8899
  margin: 4px 0;
8900
8900
  }
8901
- .sub-table-action-popper .action-menu .menu-item[data-v-2b5fa953] {
8901
+ .sub-table-action-popper .action-menu .menu-item[data-v-2ebdf814] {
8902
8902
  display: flex;
8903
8903
  align-items: center;
8904
8904
  padding: 8px 10px;
8905
8905
  border-radius: 4px;
8906
8906
  }
8907
- .sub-table-action-popper .action-menu .menu-item[data-v-2b5fa953]:hover {
8907
+ .sub-table-action-popper .action-menu .menu-item[data-v-2ebdf814]:hover {
8908
8908
  cursor: pointer;
8909
8909
  background-color: #f2f5f8;
8910
8910
  }
8911
- .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-2b5fa953] {
8911
+ .sub-table-action-popper .action-menu .menu-item .item-icon[data-v-2ebdf814] {
8912
8912
  display: flex;
8913
8913
  align-items: center;
8914
8914
  justify-content: start;
@@ -8916,14 +8916,14 @@ textarea[data-v-e709484b]::placeholder {
8916
8916
  width: 20px;
8917
8917
  height: 20px;
8918
8918
  }
8919
- .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-2b5fa953] {
8919
+ .sub-table-action-popper .action-menu .menu-item .item-icon.scale-large[data-v-2ebdf814] {
8920
8920
  transform: scale(1.5);
8921
8921
  }
8922
- .sub-table-action-popper .action-menu .menu-item .item-label[data-v-2b5fa953] {
8922
+ .sub-table-action-popper .action-menu .menu-item .item-label[data-v-2ebdf814] {
8923
8923
  flex-grow: 1;
8924
8924
  margin-left: 8px;
8925
8925
  }
8926
- .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-2b5fa953] {
8926
+ .sub-table-action-popper .action-menu .menu-item .item-label.flex-between-center[data-v-2ebdf814] {
8927
8927
  display: flex;
8928
8928
  justify-content: space-between;
8929
8929
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/word",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",