bm-admin-ui 1.0.54-alpha → 1.0.56-alpha

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.
Files changed (47) hide show
  1. package/es/components/button/index.d.ts +1 -1
  2. package/es/components/button/src/button.vue.d.ts +1 -1
  3. package/es/components/editor/index.d.ts +1 -1
  4. package/es/components/editor/src/editor.vue.d.ts +1 -1
  5. package/es/components/form-create/index.js +167 -86
  6. package/es/components/form-designer/index.js +11 -0
  7. package/es/components/search-filter/index.d.ts +1 -1
  8. package/es/components/search-filter/src/search-filter.vue.d.ts +1 -1
  9. package/es/components/select-all/index.d.ts +1 -1
  10. package/es/components/select-all/src/selectAll.vue.d.ts +1 -1
  11. package/es/components/staffs-selector/index.d.ts +2 -1
  12. package/es/components/staffs-selector/index.js +4 -1
  13. package/es/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
  14. package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +2 -1
  15. package/es/utils/isNull.d.ts +1 -0
  16. package/es/utils/isNull.js +5 -0
  17. package/lib/components/button/index.d.ts +1 -1
  18. package/lib/components/button/src/button.vue.d.ts +1 -1
  19. package/lib/components/editor/index.d.ts +1 -1
  20. package/lib/components/editor/src/editor.vue.d.ts +1 -1
  21. package/lib/components/form-create/index.js +165 -84
  22. package/lib/components/form-designer/index.js +11 -0
  23. package/lib/components/search-filter/index.d.ts +1 -1
  24. package/lib/components/search-filter/src/search-filter.vue.d.ts +1 -1
  25. package/lib/components/select-all/index.d.ts +1 -1
  26. package/lib/components/select-all/src/selectAll.vue.d.ts +1 -1
  27. package/lib/components/staffs-selector/index.d.ts +2 -1
  28. package/lib/components/staffs-selector/index.js +4 -1
  29. package/lib/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
  30. package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +2 -1
  31. package/lib/utils/isNull.d.ts +1 -0
  32. package/lib/utils/isNull.js +9 -0
  33. package/package.json +1 -1
  34. package/theme-chalk/form-create.css +1 -1
  35. package/theme-chalk/index.css +1 -1
  36. package/types/components/button/index.d.ts +1 -1
  37. package/types/components/button/src/button.vue.d.ts +1 -1
  38. package/types/components/editor/index.d.ts +1 -1
  39. package/types/components/editor/src/editor.vue.d.ts +1 -1
  40. package/types/components/search-filter/index.d.ts +1 -1
  41. package/types/components/search-filter/src/search-filter.vue.d.ts +1 -1
  42. package/types/components/select-all/index.d.ts +1 -1
  43. package/types/components/select-all/src/selectAll.vue.d.ts +1 -1
  44. package/types/components/staffs-selector/index.d.ts +2 -1
  45. package/types/components/staffs-selector/src/multipleCmp.vue.d.ts +1 -0
  46. package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +2 -1
  47. package/types/utils/isNull.d.ts +1 -0
@@ -156,7 +156,9 @@ const _sfc_main$3 = defineComponent({
156
156
  },
157
157
  { deep: true }
158
158
  );
159
+ const departmentSelect = ref([]);
159
160
  function changeTreeCheck(checkedKeys) {
161
+ departmentSelect.value = checkedKeys;
160
162
  let flatMap = selectState.dataMap;
161
163
  let curlistKeys = selectState.curlistKeys;
162
164
  let hadselected = new Set(selectState.multipDepartment);
@@ -181,6 +183,7 @@ const _sfc_main$3 = defineComponent({
181
183
  }
182
184
  return {
183
185
  changeTreeCheck,
186
+ departmentSelect,
184
187
  ...toRefs(state),
185
188
  ...toRefs(selectState),
186
189
  list,
@@ -261,7 +264,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
261
264
  }), 128))
262
265
  ], 64)) : _ctx.isTree ? (openBlock(), createBlock(_component_ATree, {
263
266
  key: 1,
264
- "checked-keys": _ctx.multipDepartment,
267
+ "checked-keys": _ctx.departmentSelect,
265
268
  checkable: "",
266
269
  "tree-data": _ctx.list,
267
270
  onCheck: _ctx.changeTreeCheck
@@ -35,6 +35,7 @@ declare const _default: import("vue").DefineComponent<{
35
35
  }> | null | undefined)[]>;
36
36
  isFulfill: import("vue").Ref<boolean>;
37
37
  changeTreeCheck: (checkedKeys: any) => void;
38
+ departmentSelect: import("vue").Ref<never[]>;
38
39
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:selected" | "fetchList")[], "update:selected" | "fetchList", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
39
40
  limit: {
40
41
  type: NumberConstructor;
@@ -917,6 +917,7 @@ declare const _default: import("vue").DefineComponent<{
917
917
  }> | null | undefined)[]>;
918
918
  isFulfill: import("vue").Ref<boolean>;
919
919
  changeTreeCheck: (checkedKeys: any) => void;
920
+ departmentSelect: import("vue").Ref<never[]>;
920
921
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:selected" | "fetchList")[], "update:selected" | "fetchList", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
921
922
  limit: {
922
923
  type: NumberConstructor;
@@ -1083,9 +1084,9 @@ declare const _default: import("vue").DefineComponent<{
1083
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1084
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1085
1086
  }, {
1086
- title: string;
1087
1087
  mode: string;
1088
1088
  showCount: boolean;
1089
+ title: string;
1089
1090
  visible: boolean;
1090
1091
  unitStr: string;
1091
1092
  limit: number;
@@ -0,0 +1 @@
1
+ export declare function isNull(value: any): boolean;
@@ -0,0 +1,5 @@
1
+ export function isNull(value) {
2
+ return (!value ||
3
+ (Array.isArray(value) && !value.length) ||
4
+ (value.constructor === Object && !Object.keys(value).length));
5
+ }
@@ -78,7 +78,7 @@ declare const BmButton: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
78
78
  onMousedown: {
79
79
  type: import("vue").PropType<(event: MouseEvent) => void>;
80
80
  };
81
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
81
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
82
82
  $attrs: {
83
83
  [x: string]: unknown;
84
84
  };
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  onMousedown: {
81
81
  type: import("vue").PropType<(event: MouseEvent) => void>;
82
82
  };
83
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
83
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
84
84
  $attrs: {
85
85
  [x: string]: unknown;
86
86
  };
@@ -294,8 +294,8 @@ declare const BmEditor: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -294,8 +294,8 @@ declare const _default: import("vue").DefineComponent<{
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -12,6 +12,7 @@ var components = require('bm-admin-ui/lib/components');
12
12
  var iconsVue = require('@ant-design/icons-vue');
13
13
  var lodashEs = require('lodash-es');
14
14
  var customParseFormat = require('dayjs/plugin/customParseFormat');
15
+ var isNull = require('bm-admin-ui/lib/utils/isNull');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -822,6 +823,9 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
822
823
  function handleAdd() {
823
824
  visible.value = true;
824
825
  }
826
+ function getPopupContainer() {
827
+ return document.body;
828
+ }
825
829
  vue.watch(
826
830
  () => props.defaultSelected,
827
831
  (val) => {
@@ -841,9 +845,12 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
841
845
  "onUpdate:list": _cache[0] || (_cache[0] = ($event) => selected.value = $event),
842
846
  "show-empty-btn": false,
843
847
  disabled: __props.disabled,
848
+ "tool-tip-props": {
849
+ getPopupContainer
850
+ },
844
851
  "show-empty": "",
845
852
  onAddClick: handleAdd
846
- }, null, 8, ["list", "disabled"]),
853
+ }, null, 8, ["list", "disabled", "tool-tip-props"]),
847
854
  vue.createVNode(vue.unref(BmStaffsSelector__default["default"]), {
848
855
  select: selected.value,
849
856
  "onUpdate:select": _cache[1] || (_cache[1] = ($event) => selected.value = $event),
@@ -1289,7 +1296,8 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1289
1296
  "extraConfig",
1290
1297
  "disabled",
1291
1298
  "disabledTable",
1292
- "hidden"
1299
+ "hidden",
1300
+ "formCreateInject"
1293
1301
  ],
1294
1302
  emits: ["change"],
1295
1303
  setup(__props, { emit: emits }) {
@@ -1314,6 +1322,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1314
1322
  const config = vue.computed(() => ({
1315
1323
  columns: [...columns],
1316
1324
  data: [...data],
1325
+ columnConfig: {
1326
+ resizable: true
1327
+ },
1317
1328
  checkboxConfig: {
1318
1329
  trigger: "cell",
1319
1330
  checkMethod() {
@@ -1352,12 +1363,16 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1352
1363
  return result;
1353
1364
  }, {}) || {}
1354
1365
  );
1366
+ const productInputSlots = vue.reactive([]);
1367
+ const formData = vue.computed(() => props.formCreateInject.api.bind());
1368
+ const queryProductInfoDebounce = lodashEs.debounce(handlePressEnter, 300);
1355
1369
  function isShow(key) {
1356
1370
  return props.rule.config.tableAdvancedFeatures.includes(key);
1357
1371
  }
1358
1372
  function initConfig() {
1359
1373
  columns.splice(0, columns.length);
1360
1374
  data.splice(0, data.length);
1375
+ productInputSlots.splice(0, productInputSlots.length);
1361
1376
  const childRules = lodashEs.cloneDeep(props.rule.config.childRules);
1362
1377
  const value = props.rule.value;
1363
1378
  if (deleteFeature.value && !props.hidden) {
@@ -1411,6 +1426,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1411
1426
  const productName = `\u5546\u54C1${String(++productIndex).padStart(2, "0")}`;
1412
1427
  const field = rule.field;
1413
1428
  const associatedFields = rule.config.associatedFields;
1429
+ productInputSlots.push(rule);
1414
1430
  const columns2 = [
1415
1431
  {
1416
1432
  field,
@@ -1418,19 +1434,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1418
1434
  headerClassName: rule.effect.required ? "is-required" : "",
1419
1435
  minWidth: "138px",
1420
1436
  slots: {
1421
- default({ row }) {
1422
- return vue.h(antDesignVue.Input, {
1423
- value: row[field],
1424
- placeholder: "\u8BF7\u8F93\u5165",
1425
- disabled: rule.disabled,
1426
- "onUpdate:value": (value) => {
1427
- row[field] = value;
1428
- },
1429
- onPressEnter() {
1430
- queryProductInfo(rule, row);
1431
- }
1432
- });
1433
- }
1437
+ default: rule.field
1434
1438
  }
1435
1439
  }
1436
1440
  ];
@@ -1445,7 +1449,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1445
1449
  default({ row }) {
1446
1450
  if (item.value === "\u5546\u54C1\u56FE\u7247" && row[childField]) {
1447
1451
  return vue.h("img", {
1448
- src: "/cloudStorage/read/read?p=" + row[childField],
1452
+ src: props.extraConfig.common.previewImg(row[childField]),
1449
1453
  style: {
1450
1454
  width: "86px",
1451
1455
  height: "86px",
@@ -1506,9 +1510,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1506
1510
  const field = rule.field;
1507
1511
  const associatedFields = rule?.config?.associatedFields;
1508
1512
  return await props.extraConfig.product.fetch({ productCode: row[field] }).then((data2) => {
1509
- if (data2 && associatedFields.length)
1513
+ if (associatedFields.length)
1510
1514
  associatedFields.forEach((item) => {
1511
- row[field + item.value] = data2[productInfoKeyMap[item.value]];
1515
+ row[field + item.value] = data2 ? data2[productInfoKeyMap[item.value]] : void 0;
1512
1516
  });
1513
1517
  return data2;
1514
1518
  });
@@ -1666,6 +1670,21 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1666
1670
  return Promise.resolve(rowData);
1667
1671
  }
1668
1672
  }
1673
+ function pruductInputDisabled(shopField) {
1674
+ if (!shopField)
1675
+ return false;
1676
+ return !formData.value[shopField];
1677
+ }
1678
+ function handlePressEnter(rule, row) {
1679
+ queryProductInfo(rule, row).then((data2) => {
1680
+ if (!data2) {
1681
+ row[rule.field] = "";
1682
+ }
1683
+ });
1684
+ }
1685
+ function handleProductInputChange(rule, row) {
1686
+ queryProductInfoDebounce(rule, row);
1687
+ }
1669
1688
  vue.watch(
1670
1689
  () => props.rule,
1671
1690
  () => {
@@ -1748,7 +1767,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1748
1767
  ref_key: "bmFloatTableRef",
1749
1768
  ref: bmFloatTableRef,
1750
1769
  config: vue.unref(config)
1751
- }, {
1770
+ }, vue.createSlots({
1752
1771
  floatHandle: vue.withCtx(({ row, rowIndex }) => [
1753
1772
  vue.unref(copyFeature) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
1754
1773
  vue.createVNode(vue.unref(antDesignVue.Button), {
@@ -1776,8 +1795,24 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1776
1795
  _: 2
1777
1796
  }, 1032, ["disabled", "onClick"])
1778
1797
  ]),
1779
- _: 1
1780
- }, 8, ["config"])
1798
+ _: 2
1799
+ }, [
1800
+ vue.renderList(productInputSlots, (item) => {
1801
+ return {
1802
+ name: item.field,
1803
+ fn: vue.withCtx(({ row }) => [
1804
+ vue.createVNode(vue.unref(antDesignVue.Input), {
1805
+ value: row[item.field],
1806
+ "onUpdate:value": ($event) => row[item.field] = $event,
1807
+ placeholder: "\u8BF7\u8F93\u5165",
1808
+ disabled: item.disabled || pruductInputDisabled(item.config?.dataFiltering),
1809
+ onPressEnter: ($event) => handlePressEnter(item, row),
1810
+ onChange: ($event) => handleProductInputChange(item, row)
1811
+ }, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter", "onChange"])
1812
+ ])
1813
+ };
1814
+ })
1815
+ ]), 1032, ["config"])
1781
1816
  ]),
1782
1817
  _: 1
1783
1818
  })
@@ -1982,7 +2017,8 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1982
2017
  return void 0;
1983
2018
  }
1984
2019
  function handleTableDataChange(value) {
1985
- getAcitvePane().tableData = value;
2020
+ const activePane2 = getAcitvePane();
2021
+ activePane2.tableData = value;
1986
2022
  }
1987
2023
  function emitChange() {
1988
2024
  emits("change", {
@@ -1993,7 +2029,8 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1993
2029
  tempIdSelected: pane.tempSelected.templateCode || pane.tempIdSelected,
1994
2030
  templateName: pane.tempSelected?.templateName || pane.templateName,
1995
2031
  tableData: pane.tableData,
1996
- uploadList: pane.uploadList
2032
+ uploadList: pane.uploadList,
2033
+ tableRequiredFields: pane.tableRule?.config?.childRules?.filter((rule) => rule.effect?.required).map((rule) => rule.field)
1997
2034
  }))
1998
2035
  });
1999
2036
  }
@@ -2331,6 +2368,30 @@ var materialTemp = {
2331
2368
  inject.self.value = value;
2332
2369
  },
2333
2370
  },
2371
+ validate: [
2372
+ {
2373
+ validator(rule, value) {
2374
+ if (isNull.isNull(value)) {
2375
+ return Promise.reject();
2376
+ }
2377
+ const panes = value.panes;
2378
+ for (const pane of panes) {
2379
+ if (!pane.tempIdSelected) {
2380
+ return Promise.reject();
2381
+ }
2382
+ if (pane.tableRequiredFields) {
2383
+ for (const field of pane.tableRequiredFields) {
2384
+ if (pane.tableData.some((row) => isNull.isNull(row[field]))) {
2385
+ return Promise.reject();
2386
+ }
2387
+ }
2388
+ }
2389
+ }
2390
+ return Promise.resolve();
2391
+ },
2392
+ message: '请检查必填项',
2393
+ },
2394
+ ],
2334
2395
  },
2335
2396
  ],
2336
2397
  class: 'bm-fc-module-widget',
@@ -2348,7 +2409,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2348
2409
  "required",
2349
2410
  "extraConfig",
2350
2411
  "defalutValue",
2351
- "disabled"
2412
+ "disabled",
2413
+ "formCreateInject"
2352
2414
  ],
2353
2415
  emits: ["change"],
2354
2416
  setup(__props, { emit: emits }) {
@@ -2363,16 +2425,28 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2363
2425
  \u5546\u54C1\u5355\u4F4D: "unit"
2364
2426
  };
2365
2427
  const unitMap = ["\u652F", "\u74F6", "\u5957", "\u7EC4", "\u7BB1", "\u4E2A", "\u5F20"];
2428
+ const formData = vue.computed(() => props.formCreateInject.api.bind());
2429
+ const debounceFn = lodashEs.debounce(handleBlur, 300);
2430
+ const inputValue = vue.ref(props.defalutValue);
2366
2431
  async function fetch(value) {
2367
- productInfo.value = await props.extraConfig.fetch({
2432
+ return productInfo.value = await props.extraConfig.product.fetch({
2368
2433
  productCode: value,
2369
2434
  filterByShopcode: props.dataFiltering
2370
2435
  }) || {};
2371
2436
  }
2372
2437
  function handleBlur(evt) {
2373
2438
  const value = evt.target.value;
2374
- emitChange(value);
2375
- fetch(value);
2439
+ fetch(value).then((result) => {
2440
+ if (Object.keys(result).length) {
2441
+ emitChange(value);
2442
+ } else {
2443
+ emitChange();
2444
+ inputValue.value = "";
2445
+ }
2446
+ });
2447
+ }
2448
+ function handleChange(evt) {
2449
+ debounceFn(evt);
2376
2450
  }
2377
2451
  function getValue(value) {
2378
2452
  return productInfo.value[productInfoKeyMap[value]];
@@ -2380,6 +2454,9 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2380
2454
  function emitChange(value) {
2381
2455
  emits("change", value);
2382
2456
  }
2457
+ function inputDisbale(shopField) {
2458
+ return shopField && !formData.value[shopField];
2459
+ }
2383
2460
  vue.watch(
2384
2461
  () => props.defalutValue,
2385
2462
  (val) => {
@@ -2410,10 +2487,12 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2410
2487
  vue.createVNode(vue.unref(antDesignVue.Col), { flex: 1 }, {
2411
2488
  default: vue.withCtx(() => [
2412
2489
  vue.createVNode(vue.unref(antDesignVue.Input), {
2490
+ value: inputValue.value,
2491
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
2413
2492
  placeholder: "\u8BF7\u8F93\u5165",
2414
- value: __props.defalutValue,
2415
- disabled: __props.disabled,
2416
- onPressEnter: handleBlur
2493
+ disabled: __props.disabled || inputDisbale(__props.dataFiltering),
2494
+ onPressEnter: handleBlur,
2495
+ onChange: handleChange
2417
2496
  }, null, 8, ["value", "disabled"])
2418
2497
  ]),
2419
2498
  _: 1
@@ -2446,7 +2525,8 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2446
2525
  getValue(field.value) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
2447
2526
  field.value === "\u5546\u54C1\u56FE\u7247" ? (vue.openBlock(), vue.createElementBlock("img", {
2448
2527
  key: 0,
2449
- src: getValue(field.value)
2528
+ class: "bm-fc-form-item__img",
2529
+ src: __props.extraConfig.common.previewImg(getValue(field.value))
2450
2530
  }, null, 8, _hoisted_2$2)) : field.value === "\u5546\u54C1\u5355\u4F4D" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
2451
2531
  vue.createTextVNode(vue.toDisplayString(unitMap[getValue(field.value)]), 1)
2452
2532
  ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
@@ -2487,7 +2567,7 @@ var product = {
2487
2567
  required: data.effect.required,
2488
2568
  associatedFields: data.config.associatedFields,
2489
2569
  dataFiltering: data.config.dataFiltering,
2490
- extraConfig: extraConfig.product,
2570
+ extraConfig: extraConfig,
2491
2571
  defalutValue: data.value,
2492
2572
  },
2493
2573
  inject: true,
@@ -2501,7 +2581,7 @@ var product = {
2501
2581
  },
2502
2582
  };
2503
2583
  },
2504
- rowRule(data) {
2584
+ rowRule(data, extraConfig) {
2505
2585
  return {
2506
2586
  type: 'ProductInfo',
2507
2587
  component: ProductInfo,
@@ -2514,6 +2594,7 @@ var product = {
2514
2594
  associatedFields: data.config.associatedFields,
2515
2595
  dataFiltering: data.config.dataFiltering,
2516
2596
  defalutValue: data.value,
2597
+ extraConfig: extraConfig,
2517
2598
  },
2518
2599
  inject: true,
2519
2600
  on: {
@@ -2688,45 +2769,27 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2688
2769
  const props = __props;
2689
2770
  const options = vue.ref([]);
2690
2771
  function initOptions() {
2691
- props.config.fetch({ level: 1, relationCode: "" }).then((result) => {
2692
- result.forEach((item) => {
2693
- item.isLeaf = props.format === 1;
2694
- });
2772
+ props.config.fetch().then((result) => {
2773
+ processOptions(result, 1);
2695
2774
  options.value = result;
2696
- return options.value;
2697
- }).then((options2) => {
2698
- if (props.value?.length) {
2699
- if (props.multiple) {
2700
- props.value.forEach((item) => loadValueOptions(item, options2));
2701
- } else {
2702
- loadValueOptions(props.value, options2);
2703
- }
2704
- }
2705
2775
  });
2706
2776
  }
2707
- async function loadData(selectedOptions) {
2708
- const optionLength = selectedOptions.length;
2709
- const targetOption = selectedOptions[optionLength - 1];
2710
- targetOption.loading = true;
2711
- return await props.config.fetch({
2712
- level: optionLength + 1,
2713
- relationCode: targetOption.value
2714
- }).then((result) => {
2715
- result.forEach((item) => {
2716
- item.isLeaf = props.format === optionLength + 1;
2717
- });
2718
- if (result.length) {
2719
- targetOption.children = result;
2720
- } else {
2721
- targetOption.isLeaf = true;
2777
+ function processOptions(options2, level) {
2778
+ options2.forEach((option) => {
2779
+ option.value = option[props.config.fieldNames.value];
2780
+ option.label = option[props.config.fieldNames.label];
2781
+ option.children = option[props.config.fieldNames.children];
2782
+ if (level === props.format) {
2783
+ delete option.children;
2784
+ }
2785
+ if (option.children?.length) {
2786
+ processOptions(option.children, level + 1);
2722
2787
  }
2723
- }).finally(() => {
2724
- targetOption.loading = false;
2725
2788
  });
2726
2789
  }
2727
2790
  function handleChange(value, selectedOptions) {
2728
2791
  const result = lodashEs.cloneDeep(selectedOptions);
2729
- processValue(result);
2792
+ result && processValue(result);
2730
2793
  emits("change", result);
2731
2794
  }
2732
2795
  function processValue(selectedOptions) {
@@ -2752,23 +2815,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2752
2815
  return pre;
2753
2816
  }, []);
2754
2817
  }
2755
- async function loadValueOptions(value, options2) {
2756
- const selectedOptions = [];
2757
- for (const option of value) {
2758
- let cur;
2759
- if (selectedOptions.length) {
2760
- cur = selectedOptions[selectedOptions.length - 1].children.find(
2761
- (item) => item.value === option.value
2762
- );
2763
- } else {
2764
- cur = options2.find((item) => item.value === option.value);
2765
- }
2766
- if (!cur.isLeaf) {
2767
- selectedOptions.push(cur);
2768
- await loadData(selectedOptions);
2769
- }
2770
- }
2771
- }
2772
2818
  initOptions();
2773
2819
  return (_ctx, _cache) => {
2774
2820
  return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Cascader), {
@@ -2776,7 +2822,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2776
2822
  placeholder: "\u8BF7\u8F93\u5165",
2777
2823
  multiple: __props.multiple,
2778
2824
  options: options.value,
2779
- "load-data": loadData,
2780
2825
  "change-on-select": "",
2781
2826
  "get-popup-container": vue.unref(getContainer),
2782
2827
  onChange: handleChange
@@ -2815,6 +2860,7 @@ var materialType = {
2815
2860
  const rule = inject.self;
2816
2861
  rule.value = list;
2817
2862
  rule.props.value = list;
2863
+ inject.api.emit('value-change', inject.api.bind());
2818
2864
  vue.nextTick(() => {
2819
2865
  setTimeout(() => {
2820
2866
  inject.api.validateField(rule.field);
@@ -2852,6 +2898,7 @@ var materialType = {
2852
2898
  const rule = inject.self;
2853
2899
  rule.value = list;
2854
2900
  rule.props.value = list;
2901
+ inject.api.emit('value-change', inject.api.bind());
2855
2902
  vue.nextTick(() => {
2856
2903
  setTimeout(() => {
2857
2904
  inject.api.validateField(rule.field);
@@ -3041,6 +3088,20 @@ var department = {
3041
3088
  },
3042
3089
  };
3043
3090
 
3091
+ function validator(rule, value) {
3092
+ var _a;
3093
+ const childRules = ((_a = rule.config) === null || _a === void 0 ? void 0 : _a.childRules) || [];
3094
+ const requiredRules = childRules.filter((rule) => { var _a; return (_a = rule === null || rule === void 0 ? void 0 : rule.effect) === null || _a === void 0 ? void 0 : _a.required; });
3095
+ if (requiredRules.length && isNull.isNull(value)) {
3096
+ return Promise.reject();
3097
+ }
3098
+ for (const rule of requiredRules) {
3099
+ if (value.some((item) => isNull.isNull(item[rule.field]))) {
3100
+ return Promise.reject();
3101
+ }
3102
+ }
3103
+ return Promise.resolve();
3104
+ }
3044
3105
  var table = {
3045
3106
  name: 'table',
3046
3107
  rule(data, extraConfig) {
@@ -3055,9 +3116,19 @@ var table = {
3055
3116
  inject: true,
3056
3117
  on: {
3057
3118
  change(inject, value) {
3058
- inject.self.value = value;
3119
+ const rule = inject.self;
3120
+ rule.value = value;
3121
+ inject.api.emit('value-change', inject.api.bind());
3059
3122
  },
3060
3123
  },
3124
+ validate: [
3125
+ {
3126
+ validator(rule, value) {
3127
+ return validator(data, value);
3128
+ },
3129
+ message: '请检查必填项',
3130
+ },
3131
+ ],
3061
3132
  };
3062
3133
  },
3063
3134
  rowRule(data, extraConfig) {
@@ -3073,8 +3144,17 @@ var table = {
3073
3144
  on: {
3074
3145
  change(inject, value) {
3075
3146
  inject.self.value = value;
3147
+ inject.api.emit('value-change', inject.api.bind());
3076
3148
  },
3077
3149
  },
3150
+ validate: [
3151
+ {
3152
+ validator(rule, value) {
3153
+ return validator(data, value);
3154
+ },
3155
+ message: '请检查必填项',
3156
+ },
3157
+ ],
3078
3158
  col: {
3079
3159
  span: 24,
3080
3160
  },
@@ -3395,7 +3475,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3395
3475
  "model-value": __props.value,
3396
3476
  option,
3397
3477
  rule: rule.value,
3398
- "onUpdate:modelValue": handleValue
3478
+ "onUpdate:modelValue": handleValue,
3479
+ onValueChange: handleValue
3399
3480
  }, null, 8, ["api", "model-value", "rule"])
3400
3481
  ], 64);
3401
3482
  };
@@ -1274,6 +1274,9 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
1274
1274
  dateValue.value = date;
1275
1275
  emitChange(date);
1276
1276
  }
1277
+ function getPopupContainer() {
1278
+ return document.body;
1279
+ }
1277
1280
  vue.watch(format, () => {
1278
1281
  handleDateChange("");
1279
1282
  });
@@ -1319,6 +1322,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
1319
1322
  picker: vue.unref(extraProps).picker,
1320
1323
  "show-time": vue.unref(extraProps).showTime,
1321
1324
  placeholder: "\u8BF7\u9009\u62E9",
1325
+ "get-popup-container": getPopupContainer,
1322
1326
  onChange: handleDateChange
1323
1327
  }, null, 8, ["value", "format", "value-format", "picker", "show-time"])) : vue.createCommentVNode("v-if", true)
1324
1328
  ]),
@@ -1364,6 +1368,7 @@ var date = {
1364
1368
  props: {
1365
1369
  placeholder: '请选择',
1366
1370
  format: 'YYYY-MM',
1371
+ valueFormat: 'YYYY-MM',
1367
1372
  },
1368
1373
  config: {
1369
1374
  propsFields: Object.values(fieldsMap$b),
@@ -1414,6 +1419,12 @@ var date = {
1414
1419
  },
1415
1420
  ],
1416
1421
  value: rule.props.format,
1422
+ inject: true,
1423
+ on: {
1424
+ change({ api, self }, format) {
1425
+ api.emit('props.valueFormat', format.value);
1426
+ },
1427
+ },
1417
1428
  },
1418
1429
  {
1419
1430
  type: 'input',
@@ -217,9 +217,9 @@ declare const BmSearchFilter: import("bm-admin-ui/es/utils/with-install").SFCWit
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -217,9 +217,9 @@ declare const _default: import("vue").DefineComponent<{
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";