@dt-frames/ui 1.0.6 → 1.0.9

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 (46) hide show
  1. package/es/components/curd/src/components/dialog.d.ts +1 -0
  2. package/es/components/forms/src/components/formIcon.d.ts +3 -1
  3. package/es/components/icons/src/pick-icon.d.ts +1 -0
  4. package/es/components/modal/src/components/modal-wrap.d.ts +1 -0
  5. package/es/components/modal/src/index.d.ts +1 -0
  6. package/es/components/modal/src/types/modal.type.d.ts +3 -3
  7. package/es/components/source/src/hooks/useFetch.d.ts +1 -2
  8. package/es/components/source/src/hooks/useSource.d.ts +10 -0
  9. package/es/components/source/src/types/source.type.d.ts +9 -8
  10. package/es/components/table/src/components/TableActions.d.ts +2 -2
  11. package/es/components/table/src/components/setting/Column.d.ts +1 -1
  12. package/es/components/table/src/components/setting/Download.d.ts +2 -2
  13. package/es/components/table/src/components/setting/Size.d.ts +2 -2
  14. package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -2
  15. package/es/components/table/src/index.d.ts +23 -20
  16. package/es/components/table/src/props.d.ts +5 -4
  17. package/es/components/table/src/types/table.type.d.ts +2 -2
  18. package/es/index.js +937 -906
  19. package/es/style/components/icons/index.less +5 -1
  20. package/es/theme/sider/components/basic-menu/basic-menu.d.ts +3 -3
  21. package/es/theme/tabs/components/TabContent.d.ts +2 -2
  22. package/package.json +3 -3
  23. package/src/components/forms/src/components/formIcon.vue +3 -2
  24. package/src/components/forms/src/index.vue +14 -10
  25. package/src/components/icons/index.less +5 -1
  26. package/src/components/icons/src/pick-icon.vue +3 -1
  27. package/src/components/modal/src/components/modal-wrap.vue +49 -39
  28. package/src/components/modal/src/components/modal.tsx +1 -1
  29. package/src/components/modal/src/hooks/useFullScreen.ts +3 -1
  30. package/src/components/modal/src/hooks/useModal.ts +23 -7
  31. package/src/components/modal/src/index.vue +1 -1
  32. package/src/components/modal/src/types/modal.type.ts +3 -3
  33. package/src/components/source/src/hooks/useFetch.ts +11 -42
  34. package/src/components/source/src/hooks/useSource.ts +18 -4
  35. package/src/components/source/src/types/source.type.ts +10 -20
  36. package/src/components/table/src/components/TableHeader.vue +1 -0
  37. package/src/components/table/src/components/TableRender.vue +7 -7
  38. package/src/components/table/src/components/setting/Fullscreen.vue +1 -1
  39. package/src/components/table/src/components/setting/index.vue +2 -2
  40. package/src/components/table/src/hooks/useDataSource.ts +24 -13
  41. package/src/components/table/src/hooks/useHeaderCode.ts +9 -2
  42. package/src/components/table/src/hooks/useTable.ts +5 -4
  43. package/src/components/table/src/hooks/useTableHeader.ts +2 -2
  44. package/src/components/table/src/index.vue +0 -2
  45. package/src/components/table/src/props.ts +3 -3
  46. package/src/components/table/src/types/table.type.ts +2 -2
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, resolveComponent, openBlock, createBlock, computed, unref, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, ref, watch, Fragment, renderList, createTextVNode, toDisplayString, KeepAlive, createVNode, withCtx, reactive, toRaw, getCurrentInstance, watchEffect, nextTick, onUnmounted, toRefs, isVNode, inject, h, provide, onMounted, onBeforeUnmount, resolveDynamicComponent, renderSlot, createCommentVNode, mergeProps, readonly, isRef, withDirectives, resolveDirective, render, normalizeProps, guardReactiveProps, createSlots, useAttrs as useAttrs$1, vShow, toRef, withModifiers, Transition } from "vue";
2
- import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, dateFormat, http, getDynamicProps, isNullAndUnDef, getPopupContainer, getDictValueByCode, formatNumber, isVnode, useMessage, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
3
- import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Popover, CheckboxGroup, Dropdown, Menu, MenuItem, Table, message, Spin, BackTop, Breadcrumb, Avatar, Drawer, Empty, SubMenu, LayoutHeader, LayoutSider, MenuDivider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
2
+ import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, dispatchResize, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, dateFormat, http, getDynamicProps, getDictValueByCode, formatNumber, isVnode, getPopupContainer, isNullAndUnDef, useMessage, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
3
+ import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Dropdown, Menu, MenuItem, Popover, CheckboxGroup, Table, Spin, BackTop, Breadcrumb, Avatar, Drawer, Empty, SubMenu, LayoutHeader, LayoutSider, MenuDivider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
4
4
  import { isEqual, cloneDeep, upperFirst, set, uniqBy, omit, trim } from "lodash-es";
5
5
  import { tryOnUnmounted, isFunction as isFunction$1, useFullscreen, useDebounceFn, useThrottleFn } from "@vueuse/core";
6
6
  import Sortablejs from "sortablejs";
@@ -1884,6 +1884,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
1884
1884
  const activeIndex = ref(1);
1885
1885
  const filter = ref(null);
1886
1886
  const currentIcons = ref([]);
1887
+ const activeIcon = ref(null);
1887
1888
  const iconMenus = computed(() => {
1888
1889
  let total = 0;
1889
1890
  let menus = [];
@@ -1922,6 +1923,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
1922
1923
  currentIcons.value = getIcons().filter((it) => it.indexOf(unref(filter)) !== -1);
1923
1924
  }
1924
1925
  function selectIcon(icon) {
1926
+ activeIcon.value = icon;
1925
1927
  emits("chooseIcon", icon);
1926
1928
  }
1927
1929
  return (_ctx, _cache) => {
@@ -1961,7 +1963,8 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
1961
1963
  (openBlock(true), createElementBlock(Fragment, null, renderList(currentIcons.value, (icon) => {
1962
1964
  return openBlock(), createElementBlock("a", {
1963
1965
  key: icon,
1964
- onClick: ($event) => selectIcon(icon)
1966
+ onClick: ($event) => selectIcon(icon),
1967
+ class: normalizeClass(activeIcon.value === icon && "active-icon")
1965
1968
  }, [
1966
1969
  createVNode(unref(Tooltip), {
1967
1970
  placement: "bottom",
@@ -1977,7 +1980,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
1977
1980
  ]),
1978
1981
  _: 2
1979
1982
  }, 1024)
1980
- ], 8, _hoisted_2$i);
1983
+ ], 10, _hoisted_2$i);
1981
1984
  }), 128))
1982
1985
  ], 2)
1983
1986
  ], 1024))
@@ -1987,6 +1990,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
1987
1990
  }
1988
1991
  });
1989
1992
  const dataTransfer = reactive({});
1993
+ const cbTransfer = reactive({});
1990
1994
  const visibleData = reactive({});
1991
1995
  function useModalOut() {
1992
1996
  const modal = ref(null);
@@ -2001,6 +2005,8 @@ function useModalOut() {
2001
2005
  modal.value = null;
2002
2006
  loaded.value = false;
2003
2007
  dataTransfer[unref(uid)] = null;
2008
+ cbTransfer[unref(uid)] = (rsp) => {
2009
+ };
2004
2010
  });
2005
2011
  if (unref(loaded) && modalMethod === unref(modal))
2006
2012
  return;
@@ -2029,14 +2035,20 @@ function useModalOut() {
2029
2035
  var _a, _b;
2030
2036
  (_b = (_a = getInstance()) == null ? void 0 : _a.redoModalHeight) == null ? void 0 : _b.call(_a);
2031
2037
  },
2032
- openModal: (visable = true, data, openOnSet = true) => {
2038
+ openModal: (params, openOnSet = true) => {
2033
2039
  var _a;
2034
2040
  (_a = getInstance()) == null ? void 0 : _a.setModalProps({
2035
- visible: visable
2041
+ visible: true
2036
2042
  });
2043
+ const { data, afterClose } = params || {};
2044
+ const id = unref(uid);
2045
+ cbTransfer[unref(uid)] = (rsp) => {
2046
+ if (afterClose && isFunction(afterClose)) {
2047
+ afterClose(rsp);
2048
+ }
2049
+ };
2037
2050
  if (!data)
2038
2051
  return;
2039
- const id = unref(uid);
2040
2052
  if (openOnSet) {
2041
2053
  dataTransfer[id] = toRaw(data);
2042
2054
  return;
@@ -2092,8 +2104,9 @@ function useModal(props, callbackFn) {
2092
2104
  (_a = getInstance()) == null ? void 0 : _a.setModalProps({ loading });
2093
2105
  },
2094
2106
  getVisible: computed(() => visibleData[~~unref(uidRef)]),
2095
- closeModal: () => {
2107
+ closeModal: (rsp) => {
2096
2108
  var _a;
2109
+ cbTransfer[unref(uidRef)](rsp);
2097
2110
  (_a = getInstance()) == null ? void 0 : _a.setModalProps({ visible: false });
2098
2111
  },
2099
2112
  openModal: (visable = true, data, openOnSet = true) => {
@@ -2269,7 +2282,8 @@ var Modal = defineComponent({
2269
2282
  let _slot;
2270
2283
  const propsData = {
2271
2284
  ...unref(attrs),
2272
- ...props
2285
+ ...props,
2286
+ destroyOnClose: true
2273
2287
  };
2274
2288
  return createVNode(Modal$1, propsData, _isSlot$1(_slot = extendSlots(slots)) ? _slot : {
2275
2289
  default: () => [_slot]
@@ -2286,6 +2300,7 @@ function useFullScreen(options) {
2286
2300
  function toggleFullScreen(e) {
2287
2301
  e && e.stopPropagation();
2288
2302
  fullScreenRef.value = !unref(fullScreenRef);
2303
+ dispatchResize();
2289
2304
  }
2290
2305
  return {
2291
2306
  fullScreenRef,
@@ -2531,9 +2546,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
2531
2546
  const { modalHeaderHeight, modalFooterHeight } = props;
2532
2547
  emits("ext-height", modalHeaderHeight + modalFooterHeight);
2533
2548
  });
2534
- async function setModalHeight() {
2535
- if (!props.visible)
2536
- return;
2549
+ async function getModalDom() {
2537
2550
  const wrapperRefDom = unref(wrapperRef);
2538
2551
  if (!wrapperRefDom)
2539
2552
  return;
@@ -2542,13 +2555,19 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
2542
2555
  return;
2543
2556
  bodyDom.style.padding = "0";
2544
2557
  await nextTick();
2558
+ const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
2559
+ return modalDom;
2560
+ }
2561
+ async function setModalHeight() {
2562
+ if (!props.visible)
2563
+ return;
2545
2564
  try {
2546
- const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
2565
+ const modalDom = await getModalDom();
2547
2566
  if (!modalDom)
2548
2567
  return;
2549
2568
  const modalRect = getComputedStyle(modalDom).top;
2550
2569
  const modalTop = Number.parseInt(modalRect);
2551
- let maxHeight = window.innerHeight - modalTop * 2 + (props.footerOffset || 0) - props.modalFooterHeight - props.modalHeaderHeight;
2570
+ let maxHeight = window.innerHeight - (props.footerOffset || 0) - props.modalFooterHeight - props.modalHeaderHeight - 100;
2552
2571
  if (modalTop < 40) {
2553
2572
  maxHeight -= 26;
2554
2573
  }
@@ -2559,12 +2578,13 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
2559
2578
  await nextTick();
2560
2579
  realHeight = spinEl.scrollHeight;
2561
2580
  if (props.fullScreen) {
2562
- console.log(props.modalFooterHeight, props.modalHeaderHeight);
2563
2581
  realHeightRef.value = window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight;
2564
2582
  } else {
2565
2583
  realHeightRef.value = props.height ? props.height : realHeight > maxHeight ? maxHeight : realHeight;
2566
2584
  }
2567
2585
  emits("height-change", unref(realHeightRef));
2586
+ const _modalDom = await getModalDom();
2587
+ _modalDom.style.top = (window.innerHeight - _modalDom.offsetHeight) / 2 + "px";
2568
2588
  } catch (error2) {
2569
2589
  console.log(error2);
2570
2590
  }
@@ -2740,12 +2760,13 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
2740
2760
  title: "\u9009\u62E9\u5B57\u4F53\u56FE\u6807",
2741
2761
  width: "70%",
2742
2762
  showSave: false,
2743
- centered: true
2763
+ centered: true,
2764
+ wrapClassName: "dt-icon-dialog"
2744
2765
  });
2745
2766
  let [state, setState] = useFormValue(props);
2746
2767
  function chooseIcon(icon) {
2747
2768
  setState(icon);
2748
- closeModal();
2769
+ closeModal(icon);
2749
2770
  }
2750
2771
  return (_ctx, _cache) => {
2751
2772
  return openBlock(), createElementBlock("div", null, [
@@ -4055,16 +4076,18 @@ const _sfc_main$J = defineComponent({
4055
4076
  immediate: true
4056
4077
  });
4057
4078
  watch(() => unref(getProps).schemas, (schemas) => resetSchema(schemas != null ? schemas : []));
4058
- onMounted(() => {
4059
- setFormValues(null);
4060
- emit("register", formActionMethods);
4061
- initDefault();
4079
+ watch(() => unref(getProps).onSearch, () => {
4062
4080
  useTimeoutFn(() => {
4063
4081
  const { onSearch, autoFetch } = unref(getProps);
4064
4082
  if (autoFetch && onSearch && isFunction(onSearch)) {
4065
4083
  onSearch(toRaw(defaultValue.value));
4066
4084
  }
4067
- }, 20);
4085
+ }, 1);
4086
+ });
4087
+ onMounted(() => {
4088
+ setFormValues(null);
4089
+ emit("register", formActionMethods);
4090
+ initDefault();
4068
4091
  });
4069
4092
  const getActionsProps = computed(() => {
4070
4093
  const {
@@ -4361,7 +4384,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4361
4384
  }
4362
4385
  };
4363
4386
  const { getWrapClassName, toggleFullScreen, fullScreenRef } = useFullScreen({
4364
- wrapClassName: computed(() => props.wrapClassName),
4387
+ wrapClassName: computed(() => unref(propsRef).wrapClassName),
4365
4388
  extHeightRef,
4366
4389
  modalWrapperRef
4367
4390
  });
@@ -4511,6 +4534,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
4511
4534
  };
4512
4535
  }
4513
4536
  });
4537
+ const codeMap = /* @__PURE__ */ new Map();
4514
4538
  function useHeaderCode(code, templates = {}, changeColumns) {
4515
4539
  const { appConf } = useAppStore();
4516
4540
  if (!appConf.pages.queryColumnApi) {
@@ -4539,6 +4563,10 @@ function useHeaderCode(code, templates = {}, changeColumns) {
4539
4563
  }
4540
4564
  };
4541
4565
  function getColumns() {
4566
+ if (codeMap.get(code)) {
4567
+ changeColumns(codeMap.get(code));
4568
+ return;
4569
+ }
4542
4570
  http.post(appConf.pages.queryColumnApi, { tableCode: code }).then((rsp) => {
4543
4571
  handleData(rsp);
4544
4572
  });
@@ -4560,6 +4588,7 @@ function useHeaderCode(code, templates = {}, changeColumns) {
4560
4588
  obj.width = Number(it.width);
4561
4589
  rows.push(obj);
4562
4590
  });
4591
+ codeMap.set(code, rows);
4563
4592
  changeColumns(rows);
4564
4593
  }
4565
4594
  getColumns();
@@ -4578,9 +4607,9 @@ function useTable(tableProps) {
4578
4607
  if (tableProps.columnCode) {
4579
4608
  useHeaderCode(tableProps.columnCode, tableProps.templates, (columns) => {
4580
4609
  tableProps.columns = columns;
4610
+ instance.setProps(getDynamicProps(tableProps));
4581
4611
  });
4582
4612
  }
4583
- tableProps && instance.setProps(getDynamicProps(tableProps));
4584
4613
  watch(() => tableProps, () => {
4585
4614
  tableProps && instance.setProps(getDynamicProps(tableProps));
4586
4615
  }, {
@@ -4638,7 +4667,7 @@ const TABLE_SIZE_HEIGHT = {
4638
4667
  };
4639
4668
  const TableProps = {
4640
4669
  clickRowSelect: { type: Boolean, default: false },
4641
- tableSetting: { type: Array, default: ["redo", "size", "setting", "fullscreen"] },
4670
+ tableSetting: { type: Object, default: () => ({}) },
4642
4671
  striped: { type: Boolean, default: true },
4643
4672
  canColDrag: { type: Boolean, default: true },
4644
4673
  resizable: { type: Boolean, default: true },
@@ -4658,7 +4687,7 @@ const TableProps = {
4658
4687
  },
4659
4688
  defSort: { type: Object, default: null },
4660
4689
  columnCode: { type: String },
4661
- templates: { type: Object },
4690
+ templates: { type: Object, default: {} },
4662
4691
  columns: { type: [Array], default: () => [] },
4663
4692
  ellipsis: { type: Boolean, default: true },
4664
4693
  dataSource: { type: Array, default: null },
@@ -4819,9 +4848,9 @@ function useDataSource(propsRef, {
4819
4848
  return unref(dataSourceRef);
4820
4849
  });
4821
4850
  function handleTableChange(pagination, filters, sorter) {
4822
- const { sortFn, filterFn, onTableChange } = unref(propsRef);
4823
- const { appConf } = useAppStore();
4824
- const { current = 1, pageSize = appConf.ui.table.defaultPageSize } = pagination;
4851
+ const { sortFn, filterFn, onTableChange: onTableChange2 } = unref(propsRef);
4852
+ const { appConf: appConf2 } = useAppStore();
4853
+ const { current = 1, pageSize = appConf2.ui.table.defaultPageSize } = pagination;
4825
4854
  setPagination(pagination);
4826
4855
  const params = {};
4827
4856
  if (sorter && isFunction(sortFn)) {
@@ -4830,7 +4859,7 @@ function useDataSource(propsRef, {
4830
4859
  if (filters && isFunction(filterFn)) {
4831
4860
  params.filterInfo = filterFn(filters);
4832
4861
  }
4833
- return onTableChange({
4862
+ return onTableChange2({
4834
4863
  pagination: {
4835
4864
  current,
4836
4865
  pageSize
@@ -4840,19 +4869,17 @@ function useDataSource(propsRef, {
4840
4869
  showBtnLoading: false
4841
4870
  });
4842
4871
  }
4843
- onMounted(() => {
4844
- const { defSort, onTableChange } = unref(propsRef);
4845
- const { appConf } = useAppStore();
4846
- onTableChange({
4847
- pagination: {
4848
- current: 1,
4849
- pageSize: appConf.ui.table.defaultPageSize
4850
- },
4851
- sort: defSort,
4852
- filter: null,
4853
- showBtnLoading: false
4854
- }, false);
4855
- });
4872
+ const { defSort, onTableChange } = unref(propsRef);
4873
+ const { appConf } = useAppStore();
4874
+ onTableChange({
4875
+ pagination: {
4876
+ current: 1,
4877
+ pageSize: appConf.ui.table.defaultPageSize
4878
+ },
4879
+ sort: defSort,
4880
+ filter: null,
4881
+ showBtnLoading: false
4882
+ }, false);
4856
4883
  return {
4857
4884
  getDataSourceRef,
4858
4885
  handleTableChange
@@ -4944,6 +4971,71 @@ function useRowSelection(propsRef, emit) {
4944
4971
  setSelectedRowKeys
4945
4972
  };
4946
4973
  }
4974
+ var _sfc_main$F = defineComponent({
4975
+ name: "TableFormat",
4976
+ props: {
4977
+ column: {
4978
+ type: Object
4979
+ },
4980
+ record: {
4981
+ type: Object
4982
+ },
4983
+ index: {
4984
+ type: Number
4985
+ }
4986
+ },
4987
+ setup(props) {
4988
+ let renderText = ref();
4989
+ function renderCell() {
4990
+ const {
4991
+ column,
4992
+ record,
4993
+ index: index2
4994
+ } = props;
4995
+ const {
4996
+ render: render2,
4997
+ dataIndex
4998
+ } = column;
4999
+ const text = record[dataIndex.toString()];
5000
+ if (isObject(render2)) {
5001
+ const {
5002
+ dict,
5003
+ date,
5004
+ number,
5005
+ percent
5006
+ } = render2;
5007
+ if (dict) {
5008
+ renderText = getDictValueByCode(text, dict);
5009
+ }
5010
+ if (date) {
5011
+ renderText.value = dayjs(text).format(date || "YYYY-MM-DD");
5012
+ }
5013
+ if (number) {
5014
+ renderText.value = formatNumber(text, number);
5015
+ }
5016
+ if (percent) {
5017
+ renderText.value = formatNumber((text || 0) * 100, percent) + "%";
5018
+ }
5019
+ if (isVnode(render2)) {
5020
+ renderText.value = createVNode(Fragment, null, [createTextVNode(" "), render2, createTextVNode(" ")]);
5021
+ }
5022
+ if (render2["setup"]) {
5023
+ renderText.value = createVNode(render2, {
5024
+ text
5025
+ });
5026
+ }
5027
+ } else {
5028
+ renderText.value = text;
5029
+ }
5030
+ if (isFunction(render2)) {
5031
+ let afterRenderData = render2(record, index2, text);
5032
+ renderText.value = isVnode(afterRenderData) ? createVNode(Fragment, null, [afterRenderData]) : afterRenderData;
5033
+ }
5034
+ }
5035
+ renderCell();
5036
+ return () => createVNode("span", null, [unref(renderText)]);
5037
+ }
5038
+ });
4947
5039
  const tableKey = Symbol("dt-page");
4948
5040
  function createTableInstance(instance) {
4949
5041
  provide(tableKey, instance);
@@ -4951,124 +5043,462 @@ function createTableInstance(instance) {
4951
5043
  function getTableInstance() {
4952
5044
  return inject(tableKey);
4953
5045
  }
4954
- const _hoisted_1$n = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u63A7\u5236", -1);
4955
- const _hoisted_2$g = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
4956
- const _hoisted_3$9 = /* @__PURE__ */ createTextVNode(" \u5E8F\u5217\u53F7 ");
4957
- const _hoisted_4$6 = /* @__PURE__ */ createTextVNode(" \u590D\u9009\u6846 ");
4958
- const _hoisted_5$3 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
4959
- const _hoisted_6$2 = {
4960
- size: 16,
4961
- className: "drag-icon"
4962
- };
4963
- const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u5DE6\u4FA7");
4964
- const _hoisted_8$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u53F3\u4FA7");
4965
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
4966
- __name: "Column",
4967
- emits: [
4968
- "columns-change"
4969
- ],
4970
- setup(__props, { emit: emits }) {
4971
- const attrs = useAttrs$1();
4972
- const prefixCls = "column-setting";
4973
- const table = getTableInstance();
4974
- const defaultRowSelection = omit(table.getRowSelection(), "selectedRowKeys");
4975
- let inited = false;
4976
- const cachePlainOptions = ref([]);
4977
- const plainOptions = ref([]);
4978
- const plainSortOptions = ref([]);
4979
- const columnListRef = ref(null);
4980
- const checkIndex = ref(false);
4981
- const checkSelect = ref(false);
4982
- const getValues = computed(() => {
4983
- return unref(table == null ? void 0 : table.getBind);
4984
- });
4985
- let sortable;
4986
- let sortableOrder = [];
4987
- const state = reactive({
4988
- checkAll: true,
4989
- checkedList: [],
4990
- defaultCheckList: []
4991
- });
4992
- const indeterminate = computed(() => {
4993
- let len = plainOptions.value.length;
4994
- let checkedLen = state.checkedList.length;
4995
- unref(checkIndex) && checkedLen--;
4996
- return checkedLen > 0 && checkedLen < len;
4997
- });
4998
- watchEffect(() => {
4999
- const columns = table.getColumns();
5000
- if (columns && columns.length) {
5001
- init();
5002
- }
5003
- });
5004
- watchEffect(() => {
5005
- const values = unref(getValues);
5006
- checkIndex.value = !!values.showIndexColumn;
5007
- checkSelect.value = !!values.rowSelection;
5046
+ const _hoisted_1$n = { class: "dt-table-action-btn" };
5047
+ const _hoisted_2$g = ["color", "onClick"];
5048
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5049
+ __name: "TableActions",
5050
+ props: {
5051
+ fixed: {
5052
+ type: String,
5053
+ default: "right"
5054
+ },
5055
+ title: {
5056
+ type: String
5057
+ },
5058
+ expand: {
5059
+ type: Boolean,
5060
+ default: false
5061
+ },
5062
+ width: {
5063
+ type: String,
5064
+ default: "70px"
5065
+ },
5066
+ btns: {
5067
+ type: Array,
5068
+ default: []
5069
+ },
5070
+ flag: {
5071
+ type: String
5072
+ },
5073
+ record: {
5074
+ default: {}
5075
+ },
5076
+ index: {
5077
+ type: Number
5078
+ }
5079
+ },
5080
+ setup(__props) {
5081
+ const props = __props;
5082
+ watch(() => props.btns, (btns) => {
5083
+ btns.map((it) => {
5084
+ it.ifShow = isBoolean(it.ifShow) ? it.ifShow : isFunction(it.ifShow) ? it.ifShow(props.record) : true;
5085
+ });
5086
+ }, {
5087
+ immediate: true
5008
5088
  });
5009
- function handleVisibleChange() {
5010
- if (inited)
5011
- return;
5012
- nextTick(() => {
5013
- const columnListEl = unref(columnListRef);
5014
- if (!columnListEl)
5015
- return;
5016
- const el = columnListEl.$el;
5017
- if (!el)
5018
- return;
5019
- sortable = Sortablejs.create(unref(el), {
5020
- animation: 500,
5021
- delay: 400,
5022
- delayOnTouchOnly: true,
5023
- handle: ".drag-icon ",
5024
- onEnd: (evt) => {
5025
- const { oldIndex, newIndex } = evt;
5026
- if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
5027
- return;
5028
- }
5029
- const columns = cloneDeep(plainSortOptions.value);
5030
- if (oldIndex > newIndex) {
5031
- columns.splice(newIndex, 0, columns[oldIndex]);
5032
- columns.splice(oldIndex + 1, 1);
5033
- } else {
5034
- columns.splice(newIndex + 1, 0, columns[oldIndex]);
5035
- columns.splice(oldIndex, 1);
5036
- }
5037
- plainSortOptions.value = columns;
5038
- setColumns(columns);
5039
- }
5089
+ function handleAction(it) {
5090
+ if (isFunction(it.action)) {
5091
+ it.action({
5092
+ row: props.record,
5093
+ index: props.index
5040
5094
  });
5041
- sortableOrder = sortable.toArray();
5042
- inited = true;
5043
- });
5044
- }
5045
- function onCheckAllChange(e) {
5046
- const checkList = plainOptions.value.map((item) => item.value);
5047
- if (e.target.checked) {
5048
- state.checkedList = checkList;
5049
- setColumns(checkList);
5050
- } else {
5051
- state.checkedList = [];
5052
- setColumns([]);
5053
5095
  }
5054
5096
  }
5055
- function handleIndexCheckChange(e) {
5056
- table.setProps({
5057
- showIndexColumn: e.target.checked
5058
- });
5059
- }
5060
- function handleSelectCheckChange(e) {
5061
- table.setProps({
5062
- rowSelection: e.target.checked ? defaultRowSelection : null
5063
- });
5097
+ const attrs = useAttrs$1();
5098
+ function getPopupContainer$1() {
5099
+ return isFunction(attrs.getPopupContainer) ? attrs.getPopupContainer() : getPopupContainer();
5064
5100
  }
5065
- function onChange(checkedList) {
5066
- const len = plainSortOptions.value.length;
5067
- state.checkAll = checkedList.length === len;
5068
- const sortList = unref(plainSortOptions).map((item) => item.value);
5069
- checkedList.sort((prev, next) => {
5070
- return sortList.indexOf(prev) - sortList.indexOf(next);
5071
- });
5101
+ return (_ctx, _cache) => {
5102
+ const _directive_icon = resolveDirective("icon");
5103
+ return props.expand ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.btns, (item) => {
5104
+ return openBlock(), createElementBlock("span", _hoisted_1$n, [
5105
+ item.ifShow ? (openBlock(), createBlock(unref(Tooltip), {
5106
+ key: 0,
5107
+ placement: "bottom"
5108
+ }, {
5109
+ title: withCtx(() => [
5110
+ createTextVNode(toDisplayString(item.title), 1)
5111
+ ]),
5112
+ default: withCtx(() => [
5113
+ withDirectives(createElementVNode("span", {
5114
+ color: item.color,
5115
+ onClick: ($event) => handleAction(item)
5116
+ }, null, 8, _hoisted_2$g), [
5117
+ [_directive_icon, item.icon]
5118
+ ])
5119
+ ]),
5120
+ _: 2
5121
+ }, 1024)) : createCommentVNode("", true)
5122
+ ]);
5123
+ }), 256)) : (openBlock(), createBlock(unref(Dropdown), {
5124
+ key: 1,
5125
+ getPopupContainer: getPopupContainer$1,
5126
+ trigger: ["click"]
5127
+ }, {
5128
+ overlay: withCtx(() => [
5129
+ createVNode(unref(Menu), { class: "dt-action-select" }, {
5130
+ default: withCtx(() => [
5131
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.btns, (item) => {
5132
+ return openBlock(), createElementBlock(Fragment, null, [
5133
+ item.ifShow ? (openBlock(), createBlock(unref(MenuItem), {
5134
+ key: 0,
5135
+ onClick: ($event) => handleAction(item)
5136
+ }, {
5137
+ default: withCtx(() => [
5138
+ createVNode(unref(DtIcon), {
5139
+ "icon-class": item.icon,
5140
+ color: item.color,
5141
+ size: 16
5142
+ }, null, 8, ["icon-class", "color"]),
5143
+ createElementVNode("span", null, toDisplayString(item.title), 1)
5144
+ ]),
5145
+ _: 2
5146
+ }, 1032, ["onClick"])) : createCommentVNode("", true)
5147
+ ], 64);
5148
+ }), 256))
5149
+ ]),
5150
+ _: 1
5151
+ })
5152
+ ]),
5153
+ default: withCtx(() => [
5154
+ createVNode(unref(DtIcon), {
5155
+ "icon-class": "ic:baseline-settings",
5156
+ "class-name": "dt-table-action-dropdown"
5157
+ })
5158
+ ]),
5159
+ _: 1
5160
+ }));
5161
+ };
5162
+ }
5163
+ });
5164
+ const INDEX_FLAG = "INDEX";
5165
+ const ACTION_COLUMN = "ACTION";
5166
+ function handleItem(item, ellipsis) {
5167
+ const { appConf } = useAppStore();
5168
+ const { align } = appConf.ui.table;
5169
+ const { key, dataIndex, children } = item;
5170
+ item.align = item.align || align;
5171
+ if (ellipsis) {
5172
+ if (!key)
5173
+ item.key = dataIndex && dataIndex.toString();
5174
+ if (!isBoolean(item.ellipsis)) {
5175
+ item = Object.assign(item, {
5176
+ ellipsis
5177
+ });
5178
+ }
5179
+ }
5180
+ if (children && children.length) {
5181
+ handleChildren(children, !!ellipsis);
5182
+ }
5183
+ }
5184
+ function handleChildren(children, ellipsis) {
5185
+ if (!children)
5186
+ return;
5187
+ children.forEach((item) => {
5188
+ const { children: children2 } = item;
5189
+ handleItem(item, ellipsis);
5190
+ handleChildren(children2, ellipsis);
5191
+ });
5192
+ }
5193
+ function sortFixedColumn(columns) {
5194
+ const fixedLeftColumn = [];
5195
+ const fixedRightColumn = [];
5196
+ const defaultColumn = [];
5197
+ for (let column of columns) {
5198
+ if (column.defaultHidden)
5199
+ continue;
5200
+ if (column.fixed === "left") {
5201
+ fixedLeftColumn.push(column);
5202
+ continue;
5203
+ }
5204
+ if (column.fixed === "right") {
5205
+ fixedRightColumn.push(column);
5206
+ continue;
5207
+ }
5208
+ defaultColumn.push(column);
5209
+ }
5210
+ return [
5211
+ ...fixedLeftColumn,
5212
+ ...defaultColumn,
5213
+ ...fixedRightColumn
5214
+ ];
5215
+ }
5216
+ function handleIndexColumn(propsRef, getPaginationRef, columns) {
5217
+ const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef);
5218
+ let pushIndexColumns = false;
5219
+ if (unref(isTreeTable)) {
5220
+ return;
5221
+ }
5222
+ columns.forEach(() => {
5223
+ const indIndex = columns.findIndex((column) => column.flag === INDEX_FLAG);
5224
+ if (showIndexColumn) {
5225
+ pushIndexColumns = indIndex === -1;
5226
+ } else if (!showIndexColumn && indIndex !== -1) {
5227
+ columns.splice(indIndex, 1);
5228
+ }
5229
+ });
5230
+ if (!pushIndexColumns)
5231
+ return;
5232
+ const isFixedLeft = columns.some((item) => item.fixed === "left");
5233
+ columns.unshift({
5234
+ flag: INDEX_FLAG,
5235
+ width: 50,
5236
+ title: "\u5E8F\u53F7",
5237
+ align: "center",
5238
+ customRender: ({ index: index2 }) => {
5239
+ const getPagination = unref(getPaginationRef);
5240
+ const { appConf } = useAppStore();
5241
+ const { defaultPageSize } = appConf.ui.table;
5242
+ if (isBoolean(getPagination)) {
5243
+ return `${index2 + 1}`;
5244
+ }
5245
+ const { current = 1, pageSize = defaultPageSize } = getPagination;
5246
+ return ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1;
5247
+ },
5248
+ ...isFixedLeft ? {
5249
+ fixed: "left"
5250
+ } : {},
5251
+ ...indexColumnProps
5252
+ });
5253
+ }
5254
+ function handleActionColumn(propsRef, columns) {
5255
+ const { operations } = unref(propsRef);
5256
+ if (!operations || isObject(operations) && !(operations == null ? void 0 : operations.btns) || isArray$1(operations) && !operations)
5257
+ return;
5258
+ const hasIndex = columns.findIndex((column) => column.flag === ACTION_COLUMN);
5259
+ if (hasIndex === -1) {
5260
+ let column = isObject(operations) ? operations : isArray$1(operations) ? { btns: operations } : {};
5261
+ let expand = column.expand ? column.expand : false;
5262
+ let columnObj = {
5263
+ fixed: "right",
5264
+ title: "\u64CD\u4F5C",
5265
+ align: "center",
5266
+ expand,
5267
+ width: `${expand ? column.btns.length * 30 + 40 : 70}px`,
5268
+ ...column,
5269
+ flag: ACTION_COLUMN
5270
+ };
5271
+ columns.push({
5272
+ ...columnObj,
5273
+ customRender: ({ record, index: index2 }) => {
5274
+ return h(_sfc_main$E, {
5275
+ ...columnObj,
5276
+ record,
5277
+ align: null,
5278
+ index: index2
5279
+ });
5280
+ }
5281
+ });
5282
+ }
5283
+ }
5284
+ function useColumns(propsRef, getPaginationRef) {
5285
+ const columnsRef = ref(unref(propsRef).columns);
5286
+ let cacheColumns = unref(propsRef).columns;
5287
+ const getColumnsRef = computed(() => {
5288
+ const columns = cloneDeep(unref(columnsRef));
5289
+ if (!columns)
5290
+ return [];
5291
+ const { ellipsis, resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
5292
+ columns.forEach((it, index2) => {
5293
+ const { slots } = it;
5294
+ it.width = it.width || (index2 === columns.length - 1 ? 119.9 : 120);
5295
+ if (Reflect.has(it, "resizable") ? !!it.resizable : resizable) {
5296
+ it.resizable = true;
5297
+ it.minWidth = it.minWidth || minWidth;
5298
+ it.maxWidth = it.maxWidth || maxWidth;
5299
+ }
5300
+ handleItem(it, Reflect.has(it, "ellipsis") ? !!it.ellipsis : !!ellipsis && !slots);
5301
+ });
5302
+ handleIndexColumn(propsRef, getPaginationRef, columns);
5303
+ handleActionColumn(propsRef, columns);
5304
+ return columns;
5305
+ });
5306
+ const getViewColumns = computed(() => {
5307
+ const viewColumns = sortFixedColumn(unref(getColumnsRef));
5308
+ const columns = cloneDeep(viewColumns);
5309
+ return columns.filter((column) => isIfShow(column));
5310
+ });
5311
+ function isIfShow(column) {
5312
+ const ifShow = column.ifShow;
5313
+ return isBoolean(ifShow) ? ifShow : isFunction(ifShow) ? ifShow(column) : true;
5314
+ }
5315
+ watch(() => unref(propsRef).columns, (columns) => {
5316
+ var _a;
5317
+ columnsRef.value = columns;
5318
+ cacheColumns = (_a = columns.filter((it) => !it.flag)) != null ? _a : [];
5319
+ });
5320
+ function getColumns(opt) {
5321
+ const { ignoreIndex, ignoreAction, sort } = opt || {};
5322
+ let columns = toRaw(unref(getColumnsRef));
5323
+ if (ignoreIndex) {
5324
+ columns = columns.filter((it) => it.flag !== INDEX_FLAG);
5325
+ }
5326
+ if (ignoreAction) {
5327
+ columns = columns.filter((it) => it.flag !== ACTION_COLUMN);
5328
+ }
5329
+ if (sort) {
5330
+ columns = sortFixedColumn(columns);
5331
+ }
5332
+ return columns;
5333
+ }
5334
+ function setColumns(columnList = []) {
5335
+ const columns = cloneDeep(columnList);
5336
+ if (!isArray$1(columns))
5337
+ return;
5338
+ if (!columns.length) {
5339
+ columnsRef.value = [];
5340
+ return;
5341
+ }
5342
+ const cacheKeys = cacheColumns.map((item) => item.dataIndex);
5343
+ if (!isString(columns[0])) {
5344
+ columnsRef.value = columns;
5345
+ } else {
5346
+ const columnKeys = columns;
5347
+ const newColumns = [];
5348
+ cacheColumns.forEach((it) => {
5349
+ newColumns.push({
5350
+ ...it,
5351
+ defaultHidden: !columnKeys.includes(it.dataIndex || it.key)
5352
+ });
5353
+ });
5354
+ if (!isEqual(cacheKeys, columns)) {
5355
+ newColumns.sort((prev, next) => {
5356
+ return columnKeys.indexOf(prev.dataIndex) - columnKeys.indexOf(next.dataIndex);
5357
+ });
5358
+ }
5359
+ columnsRef.value = newColumns;
5360
+ }
5361
+ }
5362
+ function setCacheColumnsByField(dataIndex, value) {
5363
+ if (!dataIndex || !value)
5364
+ return;
5365
+ cacheColumns.forEach((item) => {
5366
+ if (item.dataIndex === dataIndex) {
5367
+ Object.assign(item, value);
5368
+ return;
5369
+ }
5370
+ });
5371
+ }
5372
+ function getCacheColumns() {
5373
+ return cacheColumns;
5374
+ }
5375
+ return {
5376
+ getViewColumns,
5377
+ getColumnsRef,
5378
+ getColumns,
5379
+ setColumns,
5380
+ setCacheColumnsByField,
5381
+ getCacheColumns
5382
+ };
5383
+ }
5384
+ const _hoisted_1$m = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u63A7\u5236", -1);
5385
+ const _hoisted_2$f = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
5386
+ const _hoisted_3$9 = /* @__PURE__ */ createTextVNode(" \u5E8F\u5217\u53F7 ");
5387
+ const _hoisted_4$6 = /* @__PURE__ */ createTextVNode(" \u590D\u9009\u6846 ");
5388
+ const _hoisted_5$3 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
5389
+ const _hoisted_6$2 = {
5390
+ size: 16,
5391
+ className: "drag-icon"
5392
+ };
5393
+ const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u5DE6\u4FA7");
5394
+ const _hoisted_8$1 = /* @__PURE__ */ createTextVNode("\u56FA\u5B9A\u5230\u53F3\u4FA7");
5395
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
5396
+ __name: "Column",
5397
+ emits: [
5398
+ "columns-change"
5399
+ ],
5400
+ setup(__props, { emit: emits }) {
5401
+ const attrs = useAttrs$1();
5402
+ const prefixCls = "column-setting";
5403
+ const table = getTableInstance();
5404
+ const defaultRowSelection = omit(table.getRowSelection(), "selectedRowKeys");
5405
+ let inited = false;
5406
+ const cachePlainOptions = ref([]);
5407
+ const plainOptions = ref([]);
5408
+ const plainSortOptions = ref([]);
5409
+ const columnListRef = ref(null);
5410
+ const checkIndex = ref(false);
5411
+ const checkSelect = ref(false);
5412
+ const getValues = computed(() => {
5413
+ return unref(table == null ? void 0 : table.getBind);
5414
+ });
5415
+ let sortable;
5416
+ let sortableOrder = [];
5417
+ const state = reactive({
5418
+ checkAll: true,
5419
+ checkedList: [],
5420
+ defaultCheckList: []
5421
+ });
5422
+ const indeterminate = computed(() => {
5423
+ let len = plainOptions.value.length;
5424
+ let checkedLen = state.checkedList.length;
5425
+ unref(checkIndex) && checkedLen--;
5426
+ return checkedLen > 0 && checkedLen < len;
5427
+ });
5428
+ watchEffect(() => {
5429
+ const columns = table.getColumns();
5430
+ if (columns && columns.length) {
5431
+ init();
5432
+ }
5433
+ });
5434
+ watchEffect(() => {
5435
+ const values = unref(getValues);
5436
+ checkIndex.value = !!values.showIndexColumn;
5437
+ checkSelect.value = !!values.rowSelection;
5438
+ });
5439
+ function handleVisibleChange() {
5440
+ if (inited)
5441
+ return;
5442
+ nextTick(() => {
5443
+ const columnListEl = unref(columnListRef);
5444
+ if (!columnListEl)
5445
+ return;
5446
+ const el = columnListEl.$el;
5447
+ if (!el)
5448
+ return;
5449
+ sortable = Sortablejs.create(unref(el), {
5450
+ animation: 500,
5451
+ delay: 400,
5452
+ delayOnTouchOnly: true,
5453
+ handle: ".drag-icon ",
5454
+ onEnd: (evt) => {
5455
+ const { oldIndex, newIndex } = evt;
5456
+ if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
5457
+ return;
5458
+ }
5459
+ const columns = cloneDeep(plainSortOptions.value);
5460
+ if (oldIndex > newIndex) {
5461
+ columns.splice(newIndex, 0, columns[oldIndex]);
5462
+ columns.splice(oldIndex + 1, 1);
5463
+ } else {
5464
+ columns.splice(newIndex + 1, 0, columns[oldIndex]);
5465
+ columns.splice(oldIndex, 1);
5466
+ }
5467
+ plainSortOptions.value = columns;
5468
+ setColumns(columns);
5469
+ }
5470
+ });
5471
+ sortableOrder = sortable.toArray();
5472
+ inited = true;
5473
+ });
5474
+ }
5475
+ function onCheckAllChange(e) {
5476
+ const checkList = plainOptions.value.map((item) => item.value);
5477
+ if (e.target.checked) {
5478
+ state.checkedList = checkList;
5479
+ setColumns(checkList);
5480
+ } else {
5481
+ state.checkedList = [];
5482
+ setColumns([]);
5483
+ }
5484
+ }
5485
+ function handleIndexCheckChange(e) {
5486
+ table.setProps({
5487
+ showIndexColumn: e.target.checked
5488
+ });
5489
+ }
5490
+ function handleSelectCheckChange(e) {
5491
+ table.setProps({
5492
+ rowSelection: e.target.checked ? defaultRowSelection : null
5493
+ });
5494
+ }
5495
+ function onChange(checkedList) {
5496
+ const len = plainSortOptions.value.length;
5497
+ state.checkAll = checkedList.length === len;
5498
+ const sortList = unref(plainSortOptions).map((item) => item.value);
5499
+ checkedList.sort((prev, next) => {
5500
+ return sortList.indexOf(prev) - sortList.indexOf(next);
5501
+ });
5072
5502
  setColumns(checkedList);
5073
5503
  }
5074
5504
  function reset() {
@@ -5141,7 +5571,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5141
5571
  const _directive_icon = resolveDirective("icon");
5142
5572
  return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5143
5573
  title: withCtx(() => [
5144
- _hoisted_1$n
5574
+ _hoisted_1$m
5145
5575
  ]),
5146
5576
  default: withCtx(() => [
5147
5577
  createVNode(unref(Popover), {
@@ -5162,7 +5592,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5162
5592
  onChange: onCheckAllChange
5163
5593
  }, {
5164
5594
  default: withCtx(() => [
5165
- _hoisted_2$g
5595
+ _hoisted_2$f
5166
5596
  ]),
5167
5597
  _: 1
5168
5598
  }, 8, ["indeterminate", "checked"]),
@@ -5228,779 +5658,380 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
5228
5658
  placement: "bottomLeft",
5229
5659
  mouseLeaveDelay: 0.4,
5230
5660
  getPopupContainer: getPopupContainer$1
5231
- }, {
5232
- title: withCtx(() => [
5233
- _hoisted_7$1
5234
- ]),
5235
- default: withCtx(() => [
5236
- createElementVNode("span", {
5237
- class: normalizeClass({
5238
- disabled: !state.checkedList.includes(item.value),
5239
- active: item.fixed === "left"
5240
- })
5241
- }, [
5242
- createVNode(unref(DtIcon), {
5243
- "icon-class": "mdi:arrow-collapse-left",
5244
- className: `${prefixCls}__fixed-left`,
5245
- onClick: ($event) => handleColumnFixed(item, "left"),
5246
- size: 16
5247
- }, null, 8, ["className", "onClick"])
5248
- ], 2)
5249
- ]),
5250
- _: 2
5251
- }, 1032, ["mouseLeaveDelay"]),
5252
- createVNode(unref(Divider), { type: "vertical" }),
5253
- createVNode(unref(Tooltip), {
5254
- placement: "bottomLeft",
5255
- mouseLeaveDelay: 0.4,
5256
- getPopupContainer: getPopupContainer$1
5257
- }, {
5258
- title: withCtx(() => [
5259
- _hoisted_8$1
5260
- ]),
5261
- default: withCtx(() => [
5262
- createElementVNode("span", {
5263
- class: normalizeClass({
5264
- disabled: !state.checkedList.includes(item.value),
5265
- active: item.fixed === "right"
5266
- })
5267
- }, [
5268
- createVNode(unref(DtIcon), {
5269
- "icon-class": "mdi:arrow-collapse-right",
5270
- className: `${prefixCls}__fixed-right`,
5271
- onClick: ($event) => handleColumnFixed(item, "right"),
5272
- size: 16
5273
- }, null, 8, ["className", "onClick"])
5274
- ], 2)
5275
- ]),
5276
- _: 2
5277
- }, 1032, ["mouseLeaveDelay"])
5278
- ], 2);
5279
- }), 128))
5280
- ]),
5281
- _: 1
5282
- }, 8, ["value"])
5283
- ]),
5284
- default: withCtx(() => [
5285
- withDirectives(createElementVNode("span", null, null, 512), [
5286
- [_directive_icon, "ant-design:setting-outlined"]
5287
- ])
5288
- ]),
5289
- _: 1
5290
- }, 8, ["overlayClassName"])
5291
- ]),
5292
- _: 1
5293
- });
5294
- };
5295
- }
5296
- });
5297
- const _hoisted_1$m = { key: 0 };
5298
- const _hoisted_2$f = { key: 0 };
5299
- const _hoisted_3$8 = { key: 1 };
5300
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
5301
- __name: "Fullscreen",
5302
- setup(__props) {
5303
- const table = getTableInstance();
5304
- const wrapEl = ref(null);
5305
- const { toggle, isFullscreen } = useFullscreen(wrapEl);
5306
- watch(() => table.tableElRef.value, (v) => {
5307
- const getParent = (el) => {
5308
- if (!el || !el.parentNode)
5309
- return null;
5310
- if (el.parentNode.className.indexOf("dt-layout-content") !== -1) {
5311
- wrapEl.value = el.parentNode;
5312
- } else {
5313
- getParent(el.parentNode);
5314
- }
5315
- };
5316
- getParent(v.$el);
5317
- });
5318
- return (_ctx, _cache) => {
5319
- const _directive_icon = resolveDirective("icon");
5320
- return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5321
- title: withCtx(() => [
5322
- !unref(isFullscreen) ? (openBlock(), createElementBlock("span", _hoisted_1$m, "\u5168\u5C4F")) : createCommentVNode("", true)
5323
- ]),
5324
- default: withCtx(() => [
5325
- createElementVNode("span", {
5326
- onClick: _cache[0] || (_cache[0] = (...args) => unref(toggle) && unref(toggle)(...args))
5327
- }, [
5328
- !unref(isFullscreen) ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$f, null, 512)), [
5329
- [_directive_icon, "ic:baseline-fullscreen"]
5330
- ]) : withDirectives((openBlock(), createElementBlock("span", _hoisted_3$8, null, 512)), [
5331
- [_directive_icon, "ic:baseline-fullscreen-exit"]
5332
- ])
5333
- ])
5334
- ]),
5335
- _: 1
5336
- });
5337
- };
5338
- }
5339
- });
5340
- const _hoisted_1$l = /* @__PURE__ */ createTextVNode("\u5BC6\u5EA6");
5341
- const _hoisted_2$e = /* @__PURE__ */ createElementVNode("span", null, "\u9ED8\u8BA4", -1);
5342
- const _hoisted_3$7 = /* @__PURE__ */ createElementVNode("span", null, "\u4E2D\u7B49", -1);
5343
- const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("span", null, "\u7D27\u51D1", -1);
5344
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
5345
- __name: "Size",
5346
- setup(__props) {
5347
- const table = getTableInstance();
5348
- const selectedKeysRef = ref([table.getSize()]);
5349
- function handleTitleClick({ key }) {
5350
- selectedKeysRef.value = [key];
5351
- table.setProps({ size: key });
5352
- }
5353
- return (_ctx, _cache) => {
5354
- const _directive_icon = resolveDirective("icon");
5355
- return openBlock(), createBlock(unref(Tooltip), null, {
5356
- title: withCtx(() => [
5357
- _hoisted_1$l
5358
- ]),
5359
- default: withCtx(() => [
5360
- createVNode(unref(Dropdown), {
5361
- placement: "bottom",
5362
- trigger: ["click"],
5363
- getPopupContainer: unref(getPopupContainer)
5364
- }, {
5365
- overlay: withCtx(() => [
5366
- createVNode(unref(Menu), {
5367
- onClick: handleTitleClick,
5368
- selectable: "",
5369
- selectedKeys: selectedKeysRef.value,
5370
- "onUpdate:selectedKeys": _cache[0] || (_cache[0] = ($event) => selectedKeysRef.value = $event)
5371
- }, {
5372
- default: withCtx(() => [
5373
- createVNode(unref(MenuItem), { key: "default" }, {
5374
- default: withCtx(() => [
5375
- _hoisted_2$e
5376
- ]),
5377
- _: 1
5378
- }),
5379
- createVNode(unref(MenuItem), { key: "middle" }, {
5380
- default: withCtx(() => [
5381
- _hoisted_3$7
5382
- ]),
5383
- _: 1
5384
- }),
5385
- createVNode(unref(MenuItem), { key: "small" }, {
5386
- default: withCtx(() => [
5387
- _hoisted_4$5
5388
- ]),
5389
- _: 1
5390
- })
5391
- ]),
5392
- _: 1
5393
- }, 8, ["selectedKeys"])
5394
- ]),
5395
- default: withCtx(() => [
5396
- withDirectives(createElementVNode("span", null, null, 512), [
5397
- [_directive_icon, "ant-design:column-height-outlined"]
5398
- ])
5399
- ]),
5400
- _: 1
5401
- }, 8, ["getPopupContainer"])
5402
- ]),
5403
- _: 1
5404
- });
5405
- };
5406
- }
5407
- });
5408
- const _hoisted_1$k = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA", -1);
5409
- const _hoisted_2$d = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u5F53\u524D\u9875", -1);
5410
- const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u9009\u4E2D\u5217", -1);
5411
- const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u6240\u6709\u5217", -1);
5412
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
5413
- __name: "Download",
5414
- setup(__props) {
5415
- const table = getTableInstance();
5416
- function handleTitleClick({ key }) {
5417
- const { onDownload, columns: allColumns, dataSource, rowSelection } = unref(table.getBind);
5418
- const excludesFlag = ["ACTION", "CHECKBOX", "RADIO"];
5419
- const columns = allColumns.filter((it) => !excludesFlag.includes(it.flag));
5420
- onDownload({
5421
- type: key,
5422
- columns,
5423
- rows: key === "select" ? table.getSelectRows() : key === "current" ? dataSource : []
5424
- });
5425
- }
5426
- return (_ctx, _cache) => {
5427
- const _directive_icon = resolveDirective("icon");
5428
- return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5429
- title: withCtx(() => [
5430
- _hoisted_1$k
5431
- ]),
5432
- default: withCtx(() => [
5433
- createVNode(unref(Dropdown), {
5434
- placement: "bottom",
5435
- trigger: ["click"],
5436
- getPopupContainer: unref(getPopupContainer)
5437
- }, {
5438
- overlay: withCtx(() => [
5439
- createVNode(unref(Menu), { onClick: handleTitleClick }, {
5440
- default: withCtx(() => [
5441
- createVNode(unref(MenuItem), { key: "current" }, {
5442
- default: withCtx(() => [
5443
- _hoisted_2$d
5444
- ]),
5445
- _: 1
5446
- }),
5447
- createVNode(unref(MenuItem), { key: "select" }, {
5448
- default: withCtx(() => [
5449
- _hoisted_3$6
5450
- ]),
5451
- _: 1
5452
- }),
5453
- createVNode(unref(MenuItem), { key: "all" }, {
5454
- default: withCtx(() => [
5455
- _hoisted_4$4
5456
- ]),
5457
- _: 1
5458
- })
5661
+ }, {
5662
+ title: withCtx(() => [
5663
+ _hoisted_7$1
5664
+ ]),
5665
+ default: withCtx(() => [
5666
+ createElementVNode("span", {
5667
+ class: normalizeClass({
5668
+ disabled: !state.checkedList.includes(item.value),
5669
+ active: item.fixed === "left"
5670
+ })
5671
+ }, [
5672
+ createVNode(unref(DtIcon), {
5673
+ "icon-class": "mdi:arrow-collapse-left",
5674
+ className: `${prefixCls}__fixed-left`,
5675
+ onClick: ($event) => handleColumnFixed(item, "left"),
5676
+ size: 16
5677
+ }, null, 8, ["className", "onClick"])
5678
+ ], 2)
5679
+ ]),
5680
+ _: 2
5681
+ }, 1032, ["mouseLeaveDelay"]),
5682
+ createVNode(unref(Divider), { type: "vertical" }),
5683
+ createVNode(unref(Tooltip), {
5684
+ placement: "bottomLeft",
5685
+ mouseLeaveDelay: 0.4,
5686
+ getPopupContainer: getPopupContainer$1
5687
+ }, {
5688
+ title: withCtx(() => [
5689
+ _hoisted_8$1
5690
+ ]),
5691
+ default: withCtx(() => [
5692
+ createElementVNode("span", {
5693
+ class: normalizeClass({
5694
+ disabled: !state.checkedList.includes(item.value),
5695
+ active: item.fixed === "right"
5696
+ })
5697
+ }, [
5698
+ createVNode(unref(DtIcon), {
5699
+ "icon-class": "mdi:arrow-collapse-right",
5700
+ className: `${prefixCls}__fixed-right`,
5701
+ onClick: ($event) => handleColumnFixed(item, "right"),
5702
+ size: 16
5703
+ }, null, 8, ["className", "onClick"])
5704
+ ], 2)
5705
+ ]),
5706
+ _: 2
5707
+ }, 1032, ["mouseLeaveDelay"])
5708
+ ], 2);
5709
+ }), 128))
5459
5710
  ]),
5460
5711
  _: 1
5461
- })
5712
+ }, 8, ["value"])
5462
5713
  ]),
5463
5714
  default: withCtx(() => [
5464
5715
  withDirectives(createElementVNode("span", null, null, 512), [
5465
- [_directive_icon, "ic:baseline-file-download"]
5716
+ [_directive_icon, "ant-design:setting-outlined"]
5466
5717
  ])
5467
5718
  ]),
5468
5719
  _: 1
5469
- }, 8, ["getPopupContainer"])
5720
+ }, 8, ["overlayClassName"])
5470
5721
  ]),
5471
5722
  _: 1
5472
5723
  });
5473
5724
  };
5474
5725
  }
5475
5726
  });
5476
- const _sfc_main$B = defineComponent({
5477
- name: "table-setting",
5478
- components: {
5479
- ColumnSetting: _sfc_main$F,
5480
- FullscreenSetting: _sfc_main$E,
5481
- SizeSetting: _sfc_main$D,
5482
- Download: _sfc_main$C
5483
- },
5484
- props: {
5485
- setting: {
5486
- type: Object,
5487
- default: () => ({})
5488
- }
5489
- },
5490
- emits: ["columns-change"],
5491
- setup(props, { emit }) {
5492
- const getSetting = computed(() => {
5493
- return {
5494
- redo: true,
5495
- size: true,
5496
- setting: true,
5497
- fullscreen: true,
5498
- ...props.setting
5499
- };
5500
- });
5501
- function handleColumnChange(data) {
5502
- emit("columns-change", data);
5503
- }
5504
- return {
5505
- getSetting,
5506
- handleColumnChange
5507
- };
5508
- }
5509
- });
5510
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
5511
- const _component_Download = resolveComponent("Download");
5512
- const _component_SizeSetting = resolveComponent("SizeSetting");
5513
- const _component_ColumnSetting = resolveComponent("ColumnSetting");
5514
- const _component_FullscreenSetting = resolveComponent("FullscreenSetting");
5515
- return openBlock(), createElementBlock(Fragment, null, [
5516
- createVNode(_component_Download),
5517
- _ctx.getSetting.size ? (openBlock(), createBlock(_component_SizeSetting, { key: 0 })) : createCommentVNode("", true),
5518
- _ctx.getSetting.setting ? (openBlock(), createBlock(_component_ColumnSetting, {
5519
- key: 1,
5520
- onColumnsChange: _ctx.handleColumnChange
5521
- }, null, 8, ["onColumnsChange"])) : createCommentVNode("", true),
5522
- _ctx.getSetting.fullscreen ? (openBlock(), createBlock(_component_FullscreenSetting, { key: 2 })) : createCommentVNode("", true)
5523
- ], 64);
5524
- }
5525
- var TableSettinCom = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$2]]);
5526
- const _sfc_main$A = defineComponent({
5527
- name: "table-header",
5528
- components: {
5529
- TableSettinCom,
5530
- Button,
5531
- DtIcon,
5532
- FormButtons
5533
- },
5534
- props: {
5535
- tableTools: {
5536
- type: Object
5537
- },
5538
- toolbar: {
5539
- type: Array,
5540
- default: []
5541
- }
5542
- },
5543
- emits: ["columns-change"],
5544
- setup(props, { emit }) {
5545
- function handleColumnChange(data) {
5546
- emit("columns-change", data);
5547
- }
5548
- function handleMethod(e) {
5549
- if (isFunction(e.onClick)) {
5550
- e.onClick();
5551
- }
5552
- }
5553
- const getActionsProps = {
5554
- mode: null,
5555
- showAdvancedButton: false,
5556
- show: true,
5557
- buttonList: props.toolbar
5558
- };
5559
- return {
5560
- getActionsProps,
5561
- handleColumnChange,
5562
- handleMethod
5563
- };
5564
- }
5565
- });
5566
- const _hoisted_1$j = { class: "dt-table-header" };
5567
- const _hoisted_2$c = { class: "dt-table-header-actions" };
5568
- const _hoisted_3$5 = { class: "dt-table-header-actions__left" };
5569
- const _hoisted_4$3 = { class: "dt-table-header-actions__right" };
5570
- const _hoisted_5$2 = {
5571
- key: 0,
5572
- style: { "margin": "5px" }
5573
- };
5574
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
5575
- const _component_FormButtons = resolveComponent("FormButtons");
5576
- const _component_TableSettinCom = resolveComponent("TableSettinCom");
5577
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
5578
- createElementVNode("div", _hoisted_2$c, [
5579
- createElementVNode("div", _hoisted_3$5, [
5580
- createVNode(_component_FormButtons, mergeProps(_ctx.getActionsProps, { onHandleMethod: _ctx.handleMethod }), null, 16, ["onHandleMethod"]),
5581
- renderSlot(_ctx.$slots, "toolbar")
5582
- ]),
5583
- createElementVNode("div", _hoisted_4$3, [
5584
- createVNode(_component_TableSettinCom, { onColumnsChange: _ctx.handleColumnChange }, null, 8, ["onColumnsChange"])
5585
- ])
5586
- ]),
5587
- _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
5588
- renderSlot(_ctx.$slots, "headerTop")
5589
- ])) : createCommentVNode("", true)
5590
- ]);
5591
- }
5592
- var TableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$1]]);
5593
- var _sfc_main$z = defineComponent({
5594
- name: "TableFormat",
5595
- props: {
5596
- column: {
5597
- type: Object
5598
- },
5599
- record: {
5600
- type: Object
5601
- },
5602
- index: {
5603
- type: Number
5604
- }
5605
- },
5606
- setup(props) {
5607
- let renderText = ref();
5608
- function renderCell() {
5609
- const {
5610
- column,
5611
- record,
5612
- index: index2
5613
- } = props;
5614
- const {
5615
- render: render2,
5616
- dataIndex
5617
- } = column;
5618
- const text = record[dataIndex.toString()];
5619
- if (isFunction(render2)) {
5620
- renderText.value = render2(text, record, index2);
5621
- }
5622
- if (isObject(render2)) {
5623
- const {
5624
- dict,
5625
- date,
5626
- number,
5627
- percent
5628
- } = render2;
5629
- if (dict) {
5630
- renderText = getDictValueByCode(text, dict);
5631
- }
5632
- if (date) {
5633
- renderText.value = dayjs(text).format(date || "YYYY-MM-DD");
5634
- }
5635
- if (number) {
5636
- renderText.value = formatNumber(text, number);
5637
- }
5638
- if (percent) {
5639
- renderText.value = formatNumber((text || 0) * 100, percent) + "%";
5640
- }
5641
- if (isVnode(render2)) {
5642
- renderText.value = render2;
5643
- }
5644
- if (render2["setup"]) {
5645
- renderText.value = createVNode(render2, {
5646
- text
5647
- });
5648
- }
5649
- } else {
5650
- console.log(text);
5651
- renderText.value = text;
5652
- }
5653
- }
5654
- renderCell();
5655
- return () => createVNode("span", null, [unref(renderText)]);
5656
- }
5657
- });
5658
- const _hoisted_1$i = { class: "dt-table-action-btn" };
5659
- const _hoisted_2$b = ["color", "onClick"];
5660
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
5661
- __name: "TableActions",
5662
- props: {
5663
- fixed: {
5664
- type: String,
5665
- default: "right"
5666
- },
5667
- title: {
5668
- type: String
5669
- },
5670
- expand: {
5671
- type: Boolean,
5672
- default: false
5673
- },
5674
- width: {
5675
- type: String,
5676
- default: "70px"
5677
- },
5678
- btns: {
5679
- type: Array,
5680
- default: []
5681
- },
5682
- flag: {
5683
- type: String
5684
- },
5685
- record: {
5686
- default: {}
5687
- },
5688
- index: {
5689
- type: Number
5690
- }
5691
- },
5727
+ const _hoisted_1$l = { key: 0 };
5728
+ const _hoisted_2$e = { key: 0 };
5729
+ const _hoisted_3$8 = { key: 1 };
5730
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
5731
+ __name: "Fullscreen",
5692
5732
  setup(__props) {
5693
- const props = __props;
5694
- watch(() => props.btns, (btns) => {
5695
- btns.map((it) => {
5696
- it.ifShow = isBoolean(it.ifShow) ? it.ifShow : isFunction(it.ifShow) ? it.ifShow(props.record) : true;
5697
- });
5698
- }, {
5699
- immediate: true
5733
+ const table = getTableInstance();
5734
+ const wrapEl = ref(null);
5735
+ const { toggle, isFullscreen } = useFullscreen(wrapEl);
5736
+ watch(() => table.tableElRef.value, (v) => {
5737
+ const getParent = (el) => {
5738
+ var _a;
5739
+ if (!el || !el.parentNode)
5740
+ return null;
5741
+ if (((_a = el.parentNode.className) == null ? void 0 : _a.indexOf("dt-layout-content")) !== -1) {
5742
+ wrapEl.value = el.parentNode;
5743
+ } else {
5744
+ getParent(el.parentNode);
5745
+ }
5746
+ };
5747
+ getParent(v.$el);
5700
5748
  });
5701
- function handleAction(it) {
5702
- if (isFunction(it.action)) {
5703
- it.action({
5704
- row: props.record,
5705
- index: props.index
5706
- });
5707
- }
5708
- }
5709
- const attrs = useAttrs$1();
5710
- function getPopupContainer$1() {
5711
- return isFunction(attrs.getPopupContainer) ? attrs.getPopupContainer() : getPopupContainer();
5749
+ return (_ctx, _cache) => {
5750
+ const _directive_icon = resolveDirective("icon");
5751
+ return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5752
+ title: withCtx(() => [
5753
+ !unref(isFullscreen) ? (openBlock(), createElementBlock("span", _hoisted_1$l, "\u5168\u5C4F")) : createCommentVNode("", true)
5754
+ ]),
5755
+ default: withCtx(() => [
5756
+ createElementVNode("span", {
5757
+ onClick: _cache[0] || (_cache[0] = (...args) => unref(toggle) && unref(toggle)(...args))
5758
+ }, [
5759
+ !unref(isFullscreen) ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$e, null, 512)), [
5760
+ [_directive_icon, "ic:baseline-fullscreen"]
5761
+ ]) : withDirectives((openBlock(), createElementBlock("span", _hoisted_3$8, null, 512)), [
5762
+ [_directive_icon, "ic:baseline-fullscreen-exit"]
5763
+ ])
5764
+ ])
5765
+ ]),
5766
+ _: 1
5767
+ });
5768
+ };
5769
+ }
5770
+ });
5771
+ const _hoisted_1$k = /* @__PURE__ */ createTextVNode("\u5BC6\u5EA6");
5772
+ const _hoisted_2$d = /* @__PURE__ */ createElementVNode("span", null, "\u9ED8\u8BA4", -1);
5773
+ const _hoisted_3$7 = /* @__PURE__ */ createElementVNode("span", null, "\u4E2D\u7B49", -1);
5774
+ const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("span", null, "\u7D27\u51D1", -1);
5775
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5776
+ __name: "Size",
5777
+ setup(__props) {
5778
+ const table = getTableInstance();
5779
+ const selectedKeysRef = ref([table.getSize()]);
5780
+ function handleTitleClick({ key }) {
5781
+ selectedKeysRef.value = [key];
5782
+ table.setProps({ size: key });
5712
5783
  }
5713
5784
  return (_ctx, _cache) => {
5714
5785
  const _directive_icon = resolveDirective("icon");
5715
- return props.expand ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.btns, (item) => {
5716
- return openBlock(), createElementBlock("span", _hoisted_1$i, [
5717
- item.ifShow ? (openBlock(), createBlock(unref(Tooltip), {
5718
- key: 0,
5719
- placement: "bottom"
5786
+ return openBlock(), createBlock(unref(Tooltip), null, {
5787
+ title: withCtx(() => [
5788
+ _hoisted_1$k
5789
+ ]),
5790
+ default: withCtx(() => [
5791
+ createVNode(unref(Dropdown), {
5792
+ placement: "bottom",
5793
+ trigger: ["click"],
5794
+ getPopupContainer: unref(getPopupContainer)
5720
5795
  }, {
5721
- title: withCtx(() => [
5722
- createTextVNode(toDisplayString(item.title), 1)
5796
+ overlay: withCtx(() => [
5797
+ createVNode(unref(Menu), {
5798
+ onClick: handleTitleClick,
5799
+ selectable: "",
5800
+ selectedKeys: selectedKeysRef.value,
5801
+ "onUpdate:selectedKeys": _cache[0] || (_cache[0] = ($event) => selectedKeysRef.value = $event)
5802
+ }, {
5803
+ default: withCtx(() => [
5804
+ createVNode(unref(MenuItem), { key: "default" }, {
5805
+ default: withCtx(() => [
5806
+ _hoisted_2$d
5807
+ ]),
5808
+ _: 1
5809
+ }),
5810
+ createVNode(unref(MenuItem), { key: "middle" }, {
5811
+ default: withCtx(() => [
5812
+ _hoisted_3$7
5813
+ ]),
5814
+ _: 1
5815
+ }),
5816
+ createVNode(unref(MenuItem), { key: "small" }, {
5817
+ default: withCtx(() => [
5818
+ _hoisted_4$5
5819
+ ]),
5820
+ _: 1
5821
+ })
5822
+ ]),
5823
+ _: 1
5824
+ }, 8, ["selectedKeys"])
5723
5825
  ]),
5724
5826
  default: withCtx(() => [
5725
- withDirectives(createElementVNode("span", {
5726
- color: item.color,
5727
- onClick: ($event) => handleAction(item)
5728
- }, null, 8, _hoisted_2$b), [
5729
- [_directive_icon, item.icon]
5827
+ withDirectives(createElementVNode("span", null, null, 512), [
5828
+ [_directive_icon, "ant-design:column-height-outlined"]
5730
5829
  ])
5731
5830
  ]),
5732
- _: 2
5733
- }, 1024)) : createCommentVNode("", true)
5734
- ]);
5735
- }), 256)) : (openBlock(), createBlock(unref(Dropdown), {
5736
- key: 1,
5737
- getPopupContainer: getPopupContainer$1,
5738
- trigger: ["click"]
5739
- }, {
5740
- overlay: withCtx(() => [
5741
- createVNode(unref(Menu), { class: "dt-action-select" }, {
5742
- default: withCtx(() => [
5743
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.btns, (item) => {
5744
- return openBlock(), createElementBlock(Fragment, null, [
5745
- item.ifShow ? (openBlock(), createBlock(unref(MenuItem), {
5746
- key: 0,
5747
- onClick: ($event) => handleAction(item)
5748
- }, {
5749
- default: withCtx(() => [
5750
- createVNode(unref(DtIcon), {
5751
- "icon-class": item.icon,
5752
- color: item.color,
5753
- size: 16
5754
- }, null, 8, ["icon-class", "color"]),
5755
- createElementVNode("span", null, toDisplayString(item.title), 1)
5756
- ]),
5757
- _: 2
5758
- }, 1032, ["onClick"])) : createCommentVNode("", true)
5759
- ], 64);
5760
- }), 256))
5761
- ]),
5762
5831
  _: 1
5763
- })
5764
- ]),
5765
- default: withCtx(() => [
5766
- createVNode(unref(DtIcon), {
5767
- "icon-class": "ic:baseline-settings",
5768
- "class-name": "dt-table-action-dropdown"
5769
- })
5832
+ }, 8, ["getPopupContainer"])
5770
5833
  ]),
5771
5834
  _: 1
5772
- }));
5835
+ });
5773
5836
  };
5774
5837
  }
5775
5838
  });
5776
- const INDEX_FLAG = "INDEX";
5777
- const ACTION_COLUMN = "ACTION";
5778
- function handleItem(item, ellipsis) {
5779
- const { appConf } = useAppStore();
5780
- const { align } = appConf.ui.table;
5781
- const { key, dataIndex, children } = item;
5782
- item.align = item.align || align;
5783
- if (ellipsis) {
5784
- if (!key)
5785
- item.key = dataIndex && dataIndex.toString();
5786
- if (!isBoolean(item.ellipsis)) {
5787
- item = Object.assign(item, {
5788
- ellipsis
5839
+ const _hoisted_1$j = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA", -1);
5840
+ const _hoisted_2$c = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u5F53\u524D\u9875", -1);
5841
+ const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u9009\u4E2D\u5217", -1);
5842
+ const _hoisted_4$4 = /* @__PURE__ */ createElementVNode("span", null, "\u5BFC\u51FA\u6240\u6709\u5217", -1);
5843
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5844
+ __name: "Download",
5845
+ setup(__props) {
5846
+ const table = getTableInstance();
5847
+ function handleTitleClick({ key }) {
5848
+ const { onDownload, columns: allColumns, dataSource, rowSelection } = unref(table.getBind);
5849
+ const excludesFlag = ["ACTION", "CHECKBOX", "RADIO"];
5850
+ const columns = allColumns.filter((it) => !excludesFlag.includes(it.flag));
5851
+ onDownload({
5852
+ type: key,
5853
+ columns,
5854
+ rows: key === "select" ? table.getSelectRows() : key === "current" ? dataSource : []
5789
5855
  });
5790
5856
  }
5857
+ return (_ctx, _cache) => {
5858
+ const _directive_icon = resolveDirective("icon");
5859
+ return openBlock(), createBlock(unref(Tooltip), { placement: "top" }, {
5860
+ title: withCtx(() => [
5861
+ _hoisted_1$j
5862
+ ]),
5863
+ default: withCtx(() => [
5864
+ createVNode(unref(Dropdown), {
5865
+ placement: "bottom",
5866
+ trigger: ["click"],
5867
+ getPopupContainer: unref(getPopupContainer)
5868
+ }, {
5869
+ overlay: withCtx(() => [
5870
+ createVNode(unref(Menu), { onClick: handleTitleClick }, {
5871
+ default: withCtx(() => [
5872
+ createVNode(unref(MenuItem), { key: "current" }, {
5873
+ default: withCtx(() => [
5874
+ _hoisted_2$c
5875
+ ]),
5876
+ _: 1
5877
+ }),
5878
+ createVNode(unref(MenuItem), { key: "select" }, {
5879
+ default: withCtx(() => [
5880
+ _hoisted_3$6
5881
+ ]),
5882
+ _: 1
5883
+ }),
5884
+ createVNode(unref(MenuItem), { key: "all" }, {
5885
+ default: withCtx(() => [
5886
+ _hoisted_4$4
5887
+ ]),
5888
+ _: 1
5889
+ })
5890
+ ]),
5891
+ _: 1
5892
+ })
5893
+ ]),
5894
+ default: withCtx(() => [
5895
+ withDirectives(createElementVNode("span", null, null, 512), [
5896
+ [_directive_icon, "ic:baseline-file-download"]
5897
+ ])
5898
+ ]),
5899
+ _: 1
5900
+ }, 8, ["getPopupContainer"])
5901
+ ]),
5902
+ _: 1
5903
+ });
5904
+ };
5791
5905
  }
5792
- if (children && children.length) {
5793
- handleChildren(children, !!ellipsis);
5794
- }
5795
- }
5796
- function handleChildren(children, ellipsis) {
5797
- if (!children)
5798
- return;
5799
- children.forEach((item) => {
5800
- const { children: children2 } = item;
5801
- handleItem(item, ellipsis);
5802
- handleChildren(children2, ellipsis);
5803
- });
5804
- }
5805
- function sortFixedColumn(columns) {
5806
- const fixedLeftColumn = [];
5807
- const fixedRightColumn = [];
5808
- const defaultColumn = [];
5809
- for (let column of columns) {
5810
- if (column.defaultHidden)
5811
- continue;
5812
- if (column.fixed === "left") {
5813
- fixedLeftColumn.push(column);
5814
- continue;
5815
- }
5816
- if (column.fixed === "right") {
5817
- fixedRightColumn.push(column);
5818
- continue;
5819
- }
5820
- defaultColumn.push(column);
5821
- }
5822
- return [
5823
- ...fixedLeftColumn,
5824
- ...defaultColumn,
5825
- ...fixedRightColumn
5826
- ];
5827
- }
5828
- function handleIndexColumn(propsRef, getPaginationRef, columns) {
5829
- const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef);
5830
- let pushIndexColumns = false;
5831
- if (unref(isTreeTable)) {
5832
- return;
5833
- }
5834
- columns.forEach(() => {
5835
- const indIndex = columns.findIndex((column) => column.flag === INDEX_FLAG);
5836
- if (showIndexColumn) {
5837
- pushIndexColumns = indIndex === -1;
5838
- } else if (!showIndexColumn && indIndex !== -1) {
5839
- columns.splice(indIndex, 1);
5906
+ });
5907
+ const _sfc_main$z = defineComponent({
5908
+ name: "table-setting",
5909
+ components: {
5910
+ ColumnSetting: _sfc_main$D,
5911
+ FullscreenSetting: _sfc_main$C,
5912
+ SizeSetting: _sfc_main$B,
5913
+ Download: _sfc_main$A
5914
+ },
5915
+ props: {
5916
+ setting: {
5917
+ type: Object,
5918
+ default: () => ({})
5840
5919
  }
5841
- });
5842
- if (!pushIndexColumns)
5843
- return;
5844
- const isFixedLeft = columns.some((item) => item.fixed === "left");
5845
- columns.unshift({
5846
- flag: INDEX_FLAG,
5847
- width: 50,
5848
- title: "\u5E8F\u53F7",
5849
- align: "center",
5850
- customRender: ({ index: index2 }) => {
5851
- const getPagination = unref(getPaginationRef);
5852
- const { appConf } = useAppStore();
5853
- const { defaultPageSize } = appConf.ui.table;
5854
- if (isBoolean(getPagination)) {
5855
- return `${index2 + 1}`;
5856
- }
5857
- const { current = 1, pageSize = defaultPageSize } = getPagination;
5858
- return ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1;
5859
- },
5860
- ...isFixedLeft ? {
5861
- fixed: "left"
5862
- } : {},
5863
- ...indexColumnProps
5864
- });
5865
- }
5866
- function handleActionColumn(propsRef, columns) {
5867
- const { operations } = unref(propsRef);
5868
- if (!operations || isObject(operations) && !(operations == null ? void 0 : operations.btns) || isArray$1(operations) && !operations)
5869
- return;
5870
- const hasIndex = columns.findIndex((column) => column.flag === ACTION_COLUMN);
5871
- if (hasIndex === -1) {
5872
- let column = isObject(operations) ? operations : isArray$1(operations) ? { btns: operations } : {};
5873
- let expand = column.expand ? column.expand : false;
5874
- let columnObj = {
5875
- fixed: "right",
5876
- title: "\u64CD\u4F5C",
5877
- align: "center",
5878
- expand,
5879
- width: `${expand ? column.btns.length * 30 + 40 : 70}px`,
5880
- ...column,
5881
- flag: ACTION_COLUMN
5882
- };
5883
- columns.push({
5884
- ...columnObj,
5885
- customRender: ({ record, index: index2 }) => {
5886
- return h(_sfc_main$y, {
5887
- ...columnObj,
5888
- record,
5889
- align: null,
5890
- index: index2
5891
- });
5892
- }
5920
+ },
5921
+ emits: ["columns-change"],
5922
+ setup(props, { emit }) {
5923
+ const getSetting = computed(() => {
5924
+ return {
5925
+ download: true,
5926
+ size: true,
5927
+ setting: true,
5928
+ fullscreen: true,
5929
+ ...props.setting
5930
+ };
5893
5931
  });
5932
+ function handleColumnChange(data) {
5933
+ emit("columns-change", data);
5934
+ }
5935
+ return {
5936
+ getSetting,
5937
+ handleColumnChange
5938
+ };
5894
5939
  }
5940
+ });
5941
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
5942
+ const _component_Download = resolveComponent("Download");
5943
+ const _component_SizeSetting = resolveComponent("SizeSetting");
5944
+ const _component_ColumnSetting = resolveComponent("ColumnSetting");
5945
+ const _component_FullscreenSetting = resolveComponent("FullscreenSetting");
5946
+ return openBlock(), createElementBlock(Fragment, null, [
5947
+ _ctx.getSetting.download ? (openBlock(), createBlock(_component_Download, { key: 0 })) : createCommentVNode("", true),
5948
+ _ctx.getSetting.size ? (openBlock(), createBlock(_component_SizeSetting, { key: 1 })) : createCommentVNode("", true),
5949
+ _ctx.getSetting.setting ? (openBlock(), createBlock(_component_ColumnSetting, {
5950
+ key: 2,
5951
+ onColumnsChange: _ctx.handleColumnChange
5952
+ }, null, 8, ["onColumnsChange"])) : createCommentVNode("", true),
5953
+ _ctx.getSetting.fullscreen ? (openBlock(), createBlock(_component_FullscreenSetting, { key: 3 })) : createCommentVNode("", true)
5954
+ ], 64);
5895
5955
  }
5896
- function useColumns(propsRef, getPaginationRef) {
5897
- const columnsRef = ref(unref(propsRef).columns);
5898
- let cacheColumns = unref(propsRef).columns;
5899
- const getColumnsRef = computed(() => {
5900
- const columns = cloneDeep(unref(columnsRef));
5901
- if (!columns)
5902
- return [];
5903
- const { ellipsis, resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
5904
- columns.forEach((it, index2) => {
5905
- const { slots } = it;
5906
- it.width = it.width || (index2 === columns.length - 1 ? 119.9 : 120);
5907
- if (Reflect.has(it, "resizable") ? !!it.resizable : resizable) {
5908
- it.resizable = true;
5909
- it.minWidth = it.minWidth || minWidth;
5910
- it.maxWidth = it.maxWidth || maxWidth;
5911
- }
5912
- handleItem(it, Reflect.has(it, "ellipsis") ? !!it.ellipsis : !!ellipsis && !slots);
5913
- });
5914
- handleIndexColumn(propsRef, getPaginationRef, columns);
5915
- handleActionColumn(propsRef, columns);
5916
- return columns;
5917
- });
5918
- const getViewColumns = computed(() => {
5919
- const viewColumns = sortFixedColumn(unref(getColumnsRef));
5920
- const columns = cloneDeep(viewColumns);
5921
- return columns.filter((column) => isIfShow(column));
5922
- });
5923
- function isIfShow(column) {
5924
- const ifShow = column.ifShow;
5925
- return isBoolean(ifShow) ? ifShow : isFunction(ifShow) ? ifShow(column) : true;
5926
- }
5927
- watch(() => unref(propsRef).columns, (columns) => {
5928
- var _a;
5929
- columnsRef.value = columns;
5930
- cacheColumns = (_a = columns.filter((it) => !it.flag)) != null ? _a : [];
5931
- });
5932
- function getColumns(opt) {
5933
- const { ignoreIndex, ignoreAction, sort } = opt || {};
5934
- let columns = toRaw(unref(getColumnsRef));
5935
- if (ignoreIndex) {
5936
- columns = columns.filter((it) => it.flag !== INDEX_FLAG);
5937
- }
5938
- if (ignoreAction) {
5939
- columns = columns.filter((it) => it.flag !== ACTION_COLUMN);
5940
- }
5941
- if (sort) {
5942
- columns = sortFixedColumn(columns);
5956
+ var TableSettinCom = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$2]]);
5957
+ const _sfc_main$y = defineComponent({
5958
+ name: "table-header",
5959
+ components: {
5960
+ TableSettinCom,
5961
+ Button,
5962
+ DtIcon,
5963
+ FormButtons
5964
+ },
5965
+ props: {
5966
+ tableTools: {
5967
+ type: Object
5968
+ },
5969
+ toolbar: {
5970
+ type: Array,
5971
+ default: []
5943
5972
  }
5944
- return columns;
5945
- }
5946
- function setColumns(columnList = []) {
5947
- const columns = cloneDeep(columnList);
5948
- if (!isArray$1(columns))
5949
- return;
5950
- if (!columns.length) {
5951
- columnsRef.value = [];
5952
- return;
5973
+ },
5974
+ emits: ["columns-change"],
5975
+ setup(props, { emit }) {
5976
+ function handleColumnChange(data) {
5977
+ emit("columns-change", data);
5953
5978
  }
5954
- const cacheKeys = cacheColumns.map((item) => item.dataIndex);
5955
- if (!isString(columns[0])) {
5956
- columnsRef.value = columns;
5957
- } else {
5958
- const columnKeys = columns;
5959
- const newColumns = [];
5960
- cacheColumns.forEach((it) => {
5961
- newColumns.push({
5962
- ...it,
5963
- defaultHidden: !columnKeys.includes(it.dataIndex || it.key)
5964
- });
5965
- });
5966
- if (!isEqual(cacheKeys, columns)) {
5967
- newColumns.sort((prev, next) => {
5968
- return columnKeys.indexOf(prev.dataIndex) - columnKeys.indexOf(next.dataIndex);
5969
- });
5979
+ function handleMethod(e) {
5980
+ if (isFunction(e.onClick)) {
5981
+ e.onClick();
5970
5982
  }
5971
- columnsRef.value = newColumns;
5972
5983
  }
5984
+ const getActionsProps = {
5985
+ mode: null,
5986
+ showAdvancedButton: false,
5987
+ show: true,
5988
+ buttonList: props.toolbar
5989
+ };
5990
+ return {
5991
+ getActionsProps,
5992
+ handleColumnChange,
5993
+ handleMethod
5994
+ };
5973
5995
  }
5974
- function setCacheColumnsByField(dataIndex, value) {
5975
- if (!dataIndex || !value)
5976
- return;
5977
- cacheColumns.forEach((item) => {
5978
- if (item.dataIndex === dataIndex) {
5979
- Object.assign(item, value);
5980
- return;
5981
- }
5982
- });
5983
- }
5984
- function getCacheColumns() {
5985
- return cacheColumns;
5986
- }
5987
- return {
5988
- getViewColumns,
5989
- getColumnsRef,
5990
- getColumns,
5991
- setColumns,
5992
- setCacheColumnsByField,
5993
- getCacheColumns
5994
- };
5996
+ });
5997
+ const _hoisted_1$i = { class: "dt-table-header" };
5998
+ const _hoisted_2$b = { class: "dt-table-header-actions" };
5999
+ const _hoisted_3$5 = { class: "dt-table-header-actions__left" };
6000
+ const _hoisted_4$3 = { class: "dt-table-header-actions__right" };
6001
+ const _hoisted_5$2 = {
6002
+ key: 0,
6003
+ style: { "margin": "5px" }
6004
+ };
6005
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6006
+ const _component_FormButtons = resolveComponent("FormButtons");
6007
+ const _component_TableSettinCom = resolveComponent("TableSettinCom");
6008
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
6009
+ createElementVNode("div", _hoisted_2$b, [
6010
+ createElementVNode("div", _hoisted_3$5, [
6011
+ createVNode(_component_FormButtons, mergeProps(_ctx.getActionsProps, { onHandleMethod: _ctx.handleMethod }), null, 16, ["onHandleMethod"]),
6012
+ renderSlot(_ctx.$slots, "toolbar")
6013
+ ]),
6014
+ createElementVNode("div", _hoisted_4$3, [
6015
+ createVNode(_component_TableSettinCom, {
6016
+ setting: _ctx.tableTools,
6017
+ onColumnsChange: _ctx.handleColumnChange
6018
+ }, null, 8, ["setting", "onColumnsChange"])
6019
+ ])
6020
+ ]),
6021
+ _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
6022
+ renderSlot(_ctx.$slots, "headerTop")
6023
+ ])) : createCommentVNode("", true)
6024
+ ]);
5995
6025
  }
6026
+ var TableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$1]]);
5996
6027
  function useTableHeader(propsRef, slots, handlers) {
5997
6028
  const getHeaderProps = computed(() => {
5998
6029
  const { tableSetting, toolbar } = unref(propsRef);
5999
6030
  const { getSlot } = useSlots();
6000
- const hideTitle = !slots.toolbar && !slots.headerTop && (!tableSetting || !tableSetting.length);
6031
+ const hideTitle = !slots.toolbar && !slots.headerTop && !tableSetting;
6001
6032
  return {
6002
6033
  title: hideTitle ? null : () => h(TableHeader, {
6003
- tableSetting,
6034
+ tableTools: tableSetting,
6004
6035
  toolbar,
6005
6036
  onColumnsChange: handlers.onColumnsChange
6006
6037
  }, {
@@ -6177,8 +6208,7 @@ const _sfc_main$x = defineComponent({
6177
6208
  props: TableProps,
6178
6209
  components: {
6179
6210
  Table,
6180
- TableHeader,
6181
- TableRender: _sfc_main$z
6211
+ TableRender: _sfc_main$F
6182
6212
  },
6183
6213
  emits: [
6184
6214
  "register",
@@ -6308,33 +6338,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6308
6338
  }
6309
6339
  var index = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render]]);
6310
6340
  function useFetch(api, baseUrl = "") {
6311
- const getApiObj = () => {
6341
+ function fetch(params = {}) {
6342
+ let type, header = {}, model = {}, _api = "";
6312
6343
  if (isString(api)) {
6313
- return { api };
6314
- }
6315
- return { ...api };
6316
- };
6317
- const getParams = (params = {}) => {
6318
- const { model, beforeFetch } = getApiObj();
6319
- if (!api) {
6320
- message.error("\u8BF7\u6C42\u7684url\u4E0D\u80FD\u4E3A\u7A7A");
6321
- return false;
6344
+ _api = baseUrl + api;
6345
+ } else {
6346
+ type = api.type;
6347
+ _api = baseUrl + api.api;
6348
+ header = api.header;
6349
+ model = api.model;
6322
6350
  }
6323
- return beforeFetch && isFunction(beforeFetch) ? beforeFetch(Object.assign({}, model, params)) : params;
6324
- };
6325
- function fetch(params = {}) {
6326
- const handleParams = getParams(params);
6327
- if (isBoolean(handleParams) && handleParams === false)
6328
- return Promise.resolve();
6329
- const { api: _api, type = "post", header = {}, afterFetch } = getApiObj();
6330
6351
  return new Promise((resolve, reject) => {
6331
- http[type](`${baseUrl}${_api}`, handleParams, {
6352
+ http[type || "post"](_api, Object.assign({}, model, params), {
6332
6353
  ...header,
6333
6354
  ...{ onlyData: false }
6334
6355
  }).then((data) => {
6335
- if (afterFetch && isFunction(afterFetch)) {
6336
- data = afterFetch(data);
6337
- }
6338
6356
  resolve(data == null ? void 0 : data.data);
6339
6357
  }, (error2) => {
6340
6358
  reject(error2);
@@ -6376,8 +6394,11 @@ function useSource(opt) {
6376
6394
  };
6377
6395
  const { baseUrl = "", api = {}, exportName = "" } = opt;
6378
6396
  const { add, deletes, update, queryById, queryPage } = api;
6397
+ const { message } = useMessage();
6398
+ const apiFul = {};
6379
6399
  for (let it in api) {
6380
6400
  loading["on" + it.slice(0, 1).toUpperCase() + it.slice(1).toLowerCase()] = ref(false);
6401
+ apiFul[it] = baseUrl + (isString(api[it]) ? api[it] : api[it].api);
6381
6402
  }
6382
6403
  const { appConf } = useAppStore();
6383
6404
  const pagination = ref({
@@ -6392,7 +6413,7 @@ function useSource(opt) {
6392
6413
  pageNo: 0,
6393
6414
  pageSize: 10
6394
6415
  },
6395
- orderDTOs: {}
6416
+ orderDTOs: []
6396
6417
  });
6397
6418
  function onSearch(model) {
6398
6419
  baseData.entityDTO = { ...model };
@@ -6437,6 +6458,7 @@ function useSource(opt) {
6437
6458
  function onAdd(model) {
6438
6459
  const { fetch } = useFetch(add, baseUrl);
6439
6460
  fetch(model).then((rsp) => {
6461
+ message.success("\u65B0\u589E\u6210\u529F");
6440
6462
  search();
6441
6463
  });
6442
6464
  }
@@ -6447,6 +6469,7 @@ function useSource(opt) {
6447
6469
  function onUpdate(model) {
6448
6470
  const { fetch } = useFetch(update, baseUrl);
6449
6471
  fetch(model).then((rsp) => {
6472
+ message.success("\u66F4\u65B0\u6570\u636E\u6210\u529F");
6450
6473
  search();
6451
6474
  });
6452
6475
  }
@@ -6479,9 +6502,17 @@ function useSource(opt) {
6479
6502
  };
6480
6503
  return {
6481
6504
  api,
6505
+ apiFul,
6482
6506
  form,
6483
6507
  table,
6484
6508
  curd,
6509
+ loading,
6510
+ onAdd,
6511
+ onQueryById,
6512
+ onDeletes,
6513
+ onUpdate,
6514
+ onTableChange,
6515
+ onDownload,
6485
6516
  onSearch
6486
6517
  };
6487
6518
  }