@gct-paas/word 0.1.60 → 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
@@ -106415,7 +106415,7 @@ class BomEntriesValidator {
106415
106415
  }
106416
106416
  const util = this.findUtilByProductId(row.product_id_);
106417
106417
  if (!util) {
106418
- const name2 = row.product_id__lb_ ? JSON.parse(row.product_id__lb_).join(",") : "";
106418
+ const name2 = row.product_id__lb_ || "";
106419
106419
  throw new Error(
106420
106420
  // $t('sys.edhr.mcTable.productNotDefine', {
106421
106421
  // product: name,
@@ -106954,7 +106954,7 @@ class MaterialConsumeTableController {
106954
106954
  /** 校验有效期 */
106955
106955
  validateExpiration(row) {
106956
106956
  if (row.expiration_date_) {
106957
- if (dayjs(row.expiration_date_).isBefore(dayjs())) {
106957
+ if (dayjs(row.expiration_date_).isBefore(dayjs().subtract(1, "day").endOf("day"))) {
106958
106958
  throw new Error("有效期不能早于当前日期");
106959
106959
  }
106960
106960
  }
@@ -114598,7 +114598,7 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114598
114598
  const { isMaterialConsume, isWarehouseInventory, isWarehouseAllocate } = subTableType.value;
114599
114599
  const canCopy = !isWarehouseInventory && !isWarehouseAllocate;
114600
114600
  const canInsertMulti = !isMaterialConsume && !isWarehouseInventory && !isWarehouseAllocate;
114601
- const canDelete = visibleRows.length > 1;
114601
+ const canDelete = visibleRows.length > 1 && (isMaterialConsume ? props.isLastRow : true);
114602
114602
  const isConfirmed = !!visibleRows[index2]?.is_confirmed_;
114603
114603
  return {
114604
114604
  canCopy,
@@ -114890,7 +114890,7 @@ const _sfc_main$2G = /* @__PURE__ */ defineComponent({
114890
114890
  };
114891
114891
  }
114892
114892
  });
114893
- 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"]]);
114894
114894
  const _sfc_main$2F = /* @__PURE__ */ defineComponent({
114895
114895
  __name: "index",
114896
114896
  props: {
@@ -133513,13 +133513,6 @@ function toQuickSearchFieldKey(field) {
133513
133513
  if (!exp) return field.key;
133514
133514
  return field.key.includes(".") ? field.key : `${field.key}.${exp}`;
133515
133515
  }
133516
- function getQuickQueryDataByKeyword(quickSearchField, keyword) {
133517
- return quickSearchField.reduce((total, fieldKey) => {
133518
- const expKey = fieldKey.split(".").length > 1 ? fieldKey : `${fieldKey}.iLike`;
133519
- total[expKey] = keyword;
133520
- return total;
133521
- }, {});
133522
- }
133523
133516
  function fillDefaultSearchField(fields2 = []) {
133524
133517
  return Array.from(/* @__PURE__ */ new Set([...DEFAULT_QUICK_SEARCH_FIELDS, ...fields2]));
133525
133518
  }
@@ -133531,6 +133524,42 @@ function buildQuickSearchFieldOptions(fields2 = []) {
133531
133524
  value: toQuickSearchFieldKey(item)
133532
133525
  }));
133533
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
+ }
133534
133563
  function buildDeviceBaseQuery(extraQuery) {
133535
133564
  const queryData = {
133536
133565
  operating_state_: true,
@@ -133543,35 +133572,21 @@ function buildDeviceBaseQuery(extraQuery) {
133543
133572
  return queryData;
133544
133573
  }
133545
133574
  function buildDeviceQuickSearchQuery(quickSearchField, keyword, extraQuery) {
133546
- const baseQuery = buildDeviceBaseQuery(extraQuery);
133547
- if (!keyword?.trim()) {
133548
- return { queryData: baseQuery, exp: "" };
133549
- }
133550
- const fields2 = fillDefaultSearchField(quickSearchField);
133551
- return {
133552
- queryData: {
133553
- ...getQuickQueryDataByKeyword(fields2, keyword),
133554
- ...baseQuery
133555
- },
133556
- exp: `OR(${fields2.join(",")})`
133557
- };
133575
+ return buildLikeQuery(
133576
+ fillDefaultSearchField(quickSearchField),
133577
+ keyword,
133578
+ buildDeviceBaseQuery(extraQuery)
133579
+ );
133558
133580
  }
133559
- function buildRefQuickSearchQuery(searchField, keyword, extraQuery) {
133560
- const baseQuery = {
133561
- operating_state_: true,
133562
- ...extraQuery
133563
- };
133564
- if (!keyword?.trim()) {
133565
- return { queryData: baseQuery, exp: "" };
133566
- }
133567
- const fields2 = searchField?.length ? searchField : ["code_.iLike", "name_.iLike"];
133568
- return {
133569
- queryData: {
133570
- ...getQuickQueryDataByKeyword(fields2, keyword),
133571
- ...baseQuery
133572
- },
133573
- exp: `OR(${fields2.join(",")})`
133574
- };
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
+ );
133575
133590
  }
133576
133591
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
133577
133592
  __name: "quick-search-editor",
@@ -136509,62 +136524,28 @@ function shouldEnableLinkage(doc, clickedFieldType, clickedKey) {
136509
136524
  return key === clickedKey && fieldMeta.fieldType === targetLinkedFieldType;
136510
136525
  });
136511
136526
  }
136512
- function buildLikeQuery(fields2, keyword, query = {}) {
136513
- const resultQuery = {
136514
- ...query
136515
- };
136516
- const queryExp = Object.keys(query);
136517
- let likeExp = "";
136518
- if (keyword?.trim()) {
136519
- fields2.forEach((field) => {
136520
- const key = field.includes(".") ? field : `${field}.iLike`;
136521
- resultQuery[key] = keyword;
136522
- });
136523
- likeExp = `OR(${fields2.map((field) => field.includes(".") ? field : `${field}.iLike`).join(",")})`;
136524
- }
136525
- const baseExp = queryExp.length ? `OR(${queryExp.join(",")})` : "";
136526
- let exp = "";
136527
- if (baseExp && likeExp) {
136528
- exp = `AND(${baseExp},${likeExp})`;
136529
- } else {
136530
- exp = baseExp || likeExp;
136531
- }
136532
- return {
136533
- queryData: resultQuery,
136534
- exp
136535
- };
136536
- }
136537
- const selectStrategyMap = {
136538
- [FIELD_TYPE.MATERIAL_NO]: {
136539
- columnsKey: "lot-sn",
136540
- fetcher: "lot2sn",
136541
- allowManualInput: true,
136542
- persistOptionId: true,
136543
- buildQuery({ keyword, extraParams }) {
136544
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136545
- },
136546
- 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 });
136547
136534
  },
136548
- [FIELD_TYPE.SCRAP_MATERIAL_NO]: {
136549
- columnsKey: "lot-sn",
136550
- fetcher: "lot2sn",
136551
- allowManualInput: true,
136552
- persistOptionId: true,
136553
- buildQuery({ keyword, extraParams }) {
136554
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136555
- },
136556
- transform: transformLotData
136557
- },
136558
- [FIELD_TYPE.RELATED_LOT_NO]: {
136559
- columnsKey: "lot-sn",
136560
- fetcher: "lot2sn",
136561
- allowManualInput: true,
136562
- persistOptionId: true,
136563
- buildQuery({ keyword, extraParams }) {
136564
- return buildLikeQuery(["name_"], keyword, { "product_id_.isNotNull": null, ...extraParams });
136565
- },
136566
- 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);
136567
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,
136568
136549
  [FIELD_TYPE.MFG_ORDER]: {
136569
136550
  columnsKey: "mfg-order",
136570
136551
  fetcher: "ref",
@@ -136720,6 +136701,9 @@ const selectStrategyMap = {
136720
136701
  },
136721
136702
  transform: transformTreeData
136722
136703
  },
136704
+ [FIELD_TYPE.WAREHOUSE]: REF_STRATEGY,
136705
+ [FIELD_TYPE.LOCATION]: REF_STRATEGY,
136706
+ [FIELD_TYPE.REF]: REF_STRATEGY,
136723
136707
  [FIELD_TYPE.PRODUCTION_IDENTIFIER]: {
136724
136708
  columnsKey: "lot-sn",
136725
136709
  fetcher: "ref2lot2sn",
@@ -136730,30 +136714,6 @@ const selectStrategyMap = {
136730
136714
  });
136731
136715
  },
136732
136716
  transform: transformLotData
136733
- },
136734
- [FIELD_TYPE.WAREHOUSE]: {
136735
- columnsKey: "ref",
136736
- fetcher: "ref",
136737
- buildQuery({ keyword, searchField, extraParams }) {
136738
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136739
- },
136740
- transform: transformLotData
136741
- },
136742
- [FIELD_TYPE.LOCATION]: {
136743
- columnsKey: "ref",
136744
- fetcher: "ref",
136745
- buildQuery({ keyword, searchField, extraParams }) {
136746
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136747
- },
136748
- transform: transformLotData
136749
- },
136750
- [FIELD_TYPE.REF]: {
136751
- columnsKey: "ref",
136752
- fetcher: "ref",
136753
- buildQuery({ keyword, searchField, extraParams }) {
136754
- return buildRefQuickSearchQuery(searchField, keyword, extraParams);
136755
- },
136756
- transform: transformLotData
136757
136717
  }
136758
136718
  };
136759
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.60",
3
+ "version": "0.1.61",
4
4
  "description": "GCT 在线 word",
5
5
  "keywords": [
6
6
  "vue",