qidian-vue-ui 1.0.83 → 1.0.84

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.
@@ -12332,6 +12332,11 @@ async function suspectedWrapperPromise(p) {
12332
12332
  return [null, p];
12333
12333
  }
12334
12334
  }
12335
+ function camelize(str) {
12336
+ return str.replace(/-|_(\w)/g, (_, c) => {
12337
+ return c ? c.toUpperCase() : "";
12338
+ });
12339
+ }
12335
12340
  function useServiceLoadMore({
12336
12341
  service,
12337
12342
  manual,
@@ -12727,8 +12732,8 @@ const QdConfigProvider = defineComponent({
12727
12732
  watchEffect(async () => {
12728
12733
  const localeMap = {
12729
12734
  "zh-CN": () => Promise.resolve().then(() => zhCN$1),
12730
- "zh-TW": () => import("./zh-TW-BAgPvkPl.mjs"),
12731
- "en-US": () => import("./en-US-Cz46iefS.mjs")
12735
+ "zh-TW": () => import("./zh-TW-Su06dbjv.mjs"),
12736
+ "en-US": () => import("./en-US-CsYwtG6d.mjs")
12732
12737
  };
12733
12738
  const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
12734
12739
  const [err, res] = await to(
@@ -15015,6 +15020,16 @@ const zhCN = {
15015
15020
  fileSizeExceedsLimit: "文件大小超出限制,已自动过滤",
15016
15021
  fileUploadFailed: "文件上传失败",
15017
15022
  viewFileText: "查看文件"
15023
+ },
15024
+ chat: {
15025
+ ...zhCn.chat,
15026
+ failedObtainSessionIdMessage: "未能获取会话 ID",
15027
+ failedObtainUrlMessage: "未能获取会话地址",
15028
+ failedObtainAgentInfoMessage: "未能获取智能体 ID、API Key",
15029
+ apiUnknownErrorMessage: "未知错误",
15030
+ failedParseContentMessage: "解析内容失败",
15031
+ parsedContentEmptyMessage: "解析内容为空。",
15032
+ agentProcessingTimeoutMessage: "智能体处理超时,请稍后再试。"
15018
15033
  }
15019
15034
  };
15020
15035
  const zhCN$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -15022,7 +15037,7 @@ const zhCN$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
15022
15037
  default: zhCN
15023
15038
  }, Symbol.toStringTag, { value: "Module" }));
15024
15039
  function useConfig(key, componentLocale) {
15025
- const injectGlobalConfig = getCurrentInstance?.() ? inject(PROVIDE_GLOBAL_CONFIG, null) : void 0;
15040
+ const injectGlobalConfig = getCurrentInstance?.() ? inject(PROVIDE_GLOBAL_CONFIG, void 0) : void 0;
15026
15041
  const mergedGlobalConfig = computed(() => injectGlobalConfig?.value || zhCN);
15027
15042
  const globalConfig = computed(
15028
15043
  () => Object.assign(
@@ -16501,7 +16516,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16501
16516
  },
16502
16517
  setup(__props) {
16503
16518
  const props = __props;
16504
- const defaultProps = inject(PROVIDE_GRID_ITEM_PROPS_KEY);
16519
+ const defaultProps = inject(PROVIDE_GRID_ITEM_PROPS_KEY, void 0);
16505
16520
  const gridWidth = inject(PROVIDE_GRID_WIDTH_KEY, ref(DEFAULT_GRID_WIDTH));
16506
16521
  const reProps = computed(() => {
16507
16522
  const mergeGutterValue = (prop, defaultProp) => {
@@ -16556,7 +16571,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16556
16571
  };
16557
16572
  }
16558
16573
  });
16559
- const QdGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-274b234a"]]);
16574
+ const QdGridItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-f8a13f89"]]);
16560
16575
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
16561
16576
  ...{
16562
16577
  name: "QdFormItem"
@@ -17390,2072 +17405,2145 @@ function defaultOnOpen(response) {
17390
17405
  throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
17391
17406
  }
17392
17407
  }
17393
- const csl = useCsl("useAgentChat");
17394
- function useAgentChat(options) {
17395
- const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
17396
- const mergeOpt = { ...globalOpt, ...options };
17397
- const loading = ref(false);
17398
- const agentId = ref(mergeOpt.agentId);
17399
- const apiKey = ref(mergeOpt.apiKey);
17400
- const sessionId = ref("");
17401
- let abortController;
17402
- async function send({
17403
- prompt,
17404
- files,
17405
- reSend,
17406
- extParams,
17407
- refreshSessionId,
17408
- onOpen,
17409
- onMessage,
17410
- onClose,
17411
- onError
17412
- }) {
17413
- const allData = { content: "", reasoning: "" };
17414
- if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
17415
- loading.value = true;
17416
- const agInfo = await getAgentInfo();
17417
- if (!agInfo) {
17418
- loading.value = false;
17419
- return allData;
17420
- }
17421
- const sId = await getSessionId({ ...agInfo, refreshSessionId });
17422
- if (!sId) {
17423
- loading.value = false;
17424
- return allData;
17425
- }
17426
- const getUrl = mergeOpt.getUrl;
17427
- if (!getUrl) {
17428
- loading.value = false;
17429
- console.error("[useAgentChat.getUrl] 必须配置 getUrl 函数");
17430
- return allData;
17431
- }
17432
- abortController = new AbortController();
17433
- csl.log.dev("send", { ...agInfo, sessionId: sId });
17434
- return new Promise((resolve, reject) => {
17435
- fetchEventSource(getUrl(agInfo.agentId, sId), {
17436
- method: "POST",
17437
- headers: {
17438
- "Content-Type": "application/json;charset=UTF-8",
17439
- Authorization: `Bearer ${agInfo.apiKey}`
17440
- },
17441
- signal: abortController?.signal,
17442
- openWhenHidden: true,
17443
- body: JSON.stringify({
17444
- message: prompt || "",
17445
- re_chat: reSend ?? false,
17446
- document_list: files,
17447
- client_id: agInfo.apiKey,
17448
- client_type: "API_KEY",
17449
- ...extParams
17450
- }),
17451
- onopen: async (res) => {
17452
- csl.log.dev("onOpen", res);
17453
- await onOpen?.(res);
17454
- },
17455
- onmessage: (res) => {
17456
- const { data } = res;
17457
- let reData = { content: "", reasoning: "" };
17458
- try {
17459
- reData = parseRelaxedJSON(data);
17460
- if (reData.content) allData.content += reData.content;
17461
- if (reData.reasoning) allData.reasoning += reData.reasoning;
17462
- } catch (err) {
17463
- console.warn("[useAgentChat.send.onMessage]", err);
17464
- }
17465
- csl.log.dev("onMessage", reData);
17466
- onMessage?.({ data: reData, allData });
17467
- },
17468
- onclose: () => {
17469
- csl.log.dev("onClose", allData);
17470
- loading.value = false;
17471
- onClose?.(allData);
17472
- resolve(allData);
17473
- },
17474
- onerror: (err) => {
17475
- csl.log.dev("onError", err);
17476
- loading.value = false;
17477
- onError?.(err);
17478
- reject(err);
17479
- throw err;
17480
- }
17481
- });
17482
- });
17483
- }
17484
- function stop() {
17485
- abortController?.abort();
17486
- }
17487
- async function getAgentInfo() {
17488
- if (agentId.value && apiKey.value) {
17489
- return { agentId: agentId.value, apiKey: apiKey.value };
17490
- }
17491
- const getFn = mergeOpt.getAgentInfo;
17492
- if (!getFn) {
17493
- console.warn("[useAgentChat.getAgentInfo] 必须配置 agentId、apiKey 或者 getAgentInfo 函数");
17494
- return;
17495
- }
17496
- const [err, res] = await suspectedWrapperPromise(getFn());
17497
- if (err) return;
17498
- if (!res?.agentId || !res.apiKey) {
17499
- console.warn("[useAgentChat.getAgentInfo] 未获取到 agentId、apiKey", res);
17500
- return;
17501
- }
17502
- return res;
17503
- }
17504
- async function getSessionId({
17505
- agentId: agentId2,
17506
- apiKey: apiKey2,
17507
- refreshSessionId
17508
- }) {
17509
- if (sessionId.value && !refreshSessionId) return sessionId.value;
17510
- const getFn = mergeOpt.getSessionId;
17511
- if (!getFn) {
17512
- console.warn("[useAgentChat.getSessionId] 必须配置 getSessionId 函数");
17513
- return;
17514
- }
17515
- const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
17516
- if (err) return;
17517
- sessionId.value = res;
17518
- return res;
17519
- }
17520
- return {
17521
- loading,
17522
- agentId,
17523
- apiKey,
17524
- sessionId,
17525
- send,
17526
- stop
17527
- };
17528
- }
17529
- const dictCache = /* @__PURE__ */ new Map();
17530
- const dictPromiseCache = /* @__PURE__ */ new Map();
17531
- function useDict(...args) {
17532
- const res = ref({});
17533
- const loadingMap = ref({});
17534
- args.forEach(async (dictType) => {
17535
- res.value[dictType] = [];
17536
- const loadKey = `${dictType}Load`;
17537
- loadingMap.value[loadKey] = false;
17538
- if (dictCache.has(dictType)) {
17539
- res.value[dictType] = dictCache.get(dictType);
17540
- } else {
17541
- loadingMap.value[loadKey] = true;
17542
- let dictPromise;
17543
- if (dictPromiseCache.has(dictType)) {
17544
- dictPromise = dictPromiseCache.get(dictType);
17545
- } else {
17546
- dictPromise = getDict(dictType);
17547
- dictPromiseCache.set(dictType, dictPromise);
17548
- }
17549
- const [dictErr, dictRes] = await to(dictPromise);
17550
- if (dictErr) {
17551
- loadingMap.value[loadKey] = false;
17552
- dictPromiseCache.delete(dictType);
17553
- return;
17554
- }
17555
- dictCache.set(dictType, dictRes);
17556
- res.value[dictType] = dictRes;
17557
- loadingMap.value[loadKey] = false;
17558
- dictPromiseCache.delete(dictType);
17559
- }
17560
- });
17561
- const result = toRefs(res.value);
17562
- const loadingRefs = toRefs(loadingMap.value);
17563
- return { ...result, ...loadingRefs };
17564
- }
17565
- function useDictDynamic(dictType, hookOptions) {
17566
- const dictOptions = ref([]);
17567
- const loading = ref(false);
17568
- async function loadDict(type) {
17569
- if (!type) {
17570
- dictOptions.value = [];
17571
- hookOptions?.onInit?.([]);
17572
- return;
17573
- }
17574
- if (dictCache.has(type)) {
17575
- dictOptions.value = dictCache.get(type);
17576
- hookOptions?.onInit?.(dictOptions.value);
17577
- return;
17578
- }
17579
- loading.value = true;
17580
- let dictPromise;
17581
- if (dictPromiseCache.has(type)) {
17582
- dictPromise = dictPromiseCache.get(type);
17583
- } else {
17584
- dictPromise = getDict(type);
17585
- dictPromiseCache.set(type, dictPromise);
17586
- }
17587
- const [dictErr, dictRes] = await to(dictPromise);
17588
- if (dictErr) {
17589
- dictOptions.value = [];
17590
- loading.value = false;
17591
- dictPromiseCache.delete(type);
17592
- hookOptions?.onInit?.([]);
17593
- return;
17594
- }
17595
- dictCache.set(type, dictRes);
17596
- dictOptions.value = dictRes;
17597
- loading.value = false;
17598
- dictPromiseCache.delete(type);
17599
- hookOptions?.onInit?.(dictOptions.value);
17600
- }
17601
- watchEffect(() => {
17602
- loadDict(dictType.value);
17603
- });
17604
- return {
17605
- options: dictOptions,
17606
- loading
17607
- };
17608
- }
17609
- async function getDict(dictType) {
17610
- const dictOptions = window.__QIDIAN_DICT__;
17611
- if (!dictOptions) {
17612
- const msg = "[useDict] 字典服务未提供,请确保使用了 QdConfigProvider";
17613
- console.warn(msg);
17614
- throw new Error(msg);
17615
- }
17616
- const { service, transformParams, transformRes } = dictOptions;
17617
- let currentParams = dictType;
17618
- if (transformParams) {
17619
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
17620
- if (tpErr) throw tpErr;
17621
- currentParams = tpRes;
17622
- }
17623
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
17624
- if (serviceErr) throw serviceErr;
17625
- let res;
17626
- if (transformRes) {
17627
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
17628
- if (trErr) throw trErr;
17629
- res = trRes;
17630
- } else {
17631
- res = serviceRes;
17632
- }
17633
- return res;
17634
- }
17635
- function useReadonly(context) {
17636
- const currentInstance = getCurrentInstance();
17637
- const componentReadonly = computed(() => currentInstance.props.Readonly);
17638
- const formReadonly = inject("formReadonly", /* @__PURE__ */ Object.create(null));
17639
- return computed(() => {
17640
- if (isBoolean(context?.beforeReadonly?.value)) return context.beforeReadonly.value;
17641
- if (isBoolean(componentReadonly.value)) return componentReadonly.value;
17642
- if (isBoolean(context?.afterReadonly?.value)) return context.afterReadonly.value;
17643
- if (isBoolean(formReadonly.readonly?.value)) return formReadonly.readonly.value;
17644
- return false;
17645
- });
17646
- }
17647
- function useDisabled(context) {
17648
- const currentInstance = getCurrentInstance();
17649
- const componentDisabled = computed(() => currentInstance.props.disabled);
17650
- const formDisabled = inject("formDisabled", /* @__PURE__ */ Object.create(null));
17651
- return computed(() => {
17652
- if (isBoolean(context?.beforeDisabled?.value)) return context.beforeDisabled.value;
17653
- if (isBoolean(componentDisabled.value)) return componentDisabled.value;
17654
- if (isBoolean(context?.afterDisabled?.value)) return context.afterDisabled.value;
17655
- if (isBoolean(formDisabled.disabled?.value)) return formDisabled.disabled.value;
17656
- return false;
17657
- });
17408
+ function getDefaultExportFromCjs(x) {
17409
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
17658
17410
  }
17659
- const _hoisted_1$2 = {
17660
- class: "qd-crud-table"
17661
- };
17662
- const _hoisted_2$1 = {
17663
- class: "qd-crud-table__toolbar"
17664
- };
17665
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
17666
- ...{
17667
- name: "QdCrudTable"
17668
- },
17669
- __name: "table",
17670
- props: /* @__PURE__ */ mergeDefaults({
17671
- title: {},
17672
- permiPrefix: {},
17673
- search: {},
17674
- searchData: {},
17675
- form: {},
17676
- detail: {},
17677
- add: {
17678
- type: [Boolean, Object]
17679
- },
17680
- actions: {},
17681
- edit: {
17682
- type: [Boolean, Object]
17683
- },
17684
- view: {
17685
- type: [Boolean, Object]
17686
- },
17687
- del: {
17688
- type: [Boolean, Object]
17689
- },
17690
- rowActions: {},
17691
- rowKey: {},
17692
- selectType: {},
17693
- tree: {},
17694
- beforeDragSort: {
17695
- type: Function
17696
- },
17697
- expandedTreeNodes: {},
17698
- defaultExpandedTreeNodes: {},
17699
- treeExpandAndFoldIcon: {},
17700
- onAbnormalDragSort: {
17701
- type: Function
17702
- },
17703
- onExpandedTreeNodesChange: {
17704
- type: Function
17705
- },
17706
- onTreeExpandChange: {
17707
- type: Function
17708
- },
17709
- asyncLoading: {},
17710
- columnController: {},
17711
- columnControllerVisible: {
17712
- type: Boolean
17713
- },
17714
- defaultColumnControllerVisible: {
17715
- type: Boolean
17716
- },
17717
- columns: {},
17718
- displayColumns: {},
17719
- defaultDisplayColumns: {},
17720
- dragSort: {},
17721
- dragSortOptions: {},
17722
- editableCellState: {
17723
- type: Function
17724
- },
17725
- editableRowKeys: {},
17726
- expandIcon: {
17727
- type: Boolean
17728
- },
17729
- expandOnRowClick: {
17730
- type: Boolean
17731
- },
17732
- expandedRow: {},
17733
- expandedRowKeys: {},
17734
- defaultExpandedRowKeys: {},
17735
- filterIcon: {},
17736
- filterRow: {},
17737
- filterValue: {},
17738
- defaultFilterValue: {},
17739
- hideSortTips: {
17740
- type: Boolean
17741
- },
17742
- indeterminateSelectedRowKeys: {},
17743
- multipleSort: {
17744
- type: Boolean
17745
- },
17746
- reserveSelectedRowOnPaginate: {
17747
- type: Boolean
17748
- },
17749
- rowSelectionAllowUncheck: {
17750
- type: Boolean
17751
- },
17752
- rowSelectionType: {},
17753
- selectOnRowClick: {
17754
- type: Boolean
17755
- },
17756
- selectedRowKeys: {},
17757
- defaultSelectedRowKeys: {},
17758
- showSortColumnBgColor: {
17759
- type: Boolean
17760
- },
17761
- sort: {},
17762
- defaultSort: {},
17763
- sortIcon: {},
17764
- sortOnRowDraggable: {
17765
- type: Boolean
17766
- },
17767
- onAsyncLoadingClick: {
17768
- type: Function
17769
- },
17770
- onCellClick: {
17771
- type: Function
17772
- },
17773
- onChange: {
17774
- type: Function
17775
- },
17776
- onColumnChange: {
17777
- type: Function
17778
- },
17779
- onColumnControllerVisibleChange: {
17780
- type: Function
17781
- },
17782
- onDataChange: {
17783
- type: Function
17784
- },
17785
- onDisplayColumnsChange: {
17786
- type: Function
17787
- },
17788
- onDragSort: {
17789
- type: Function
17790
- },
17791
- onExpandChange: {
17792
- type: Function
17793
- },
17794
- onFilterChange: {
17795
- type: Function
17796
- },
17797
- onRowEdit: {
17798
- type: Function
17799
- },
17800
- onRowValidate: {
17801
- type: Function
17802
- },
17803
- onSelectChange: {
17804
- type: Function
17805
- },
17806
- onSortChange: {
17807
- type: Function
17808
- },
17809
- onValidate: {
17810
- type: Function
17811
- },
17812
- activeRowKeys: {},
17813
- defaultActiveRowKeys: {},
17814
- activeRowType: {},
17815
- allowResizeColumnWidth: {
17816
- type: Boolean
17817
- },
17818
- attach: {
17819
- type: [String, Function]
17820
- },
17821
- bordered: {
17822
- type: Boolean
17823
- },
17824
- bottomContent: {},
17825
- cellEmptyContent: {},
17826
- data: {},
17827
- disableDataPage: {
17828
- type: Boolean
17829
- },
17830
- disableSpaceInactiveRow: {
17831
- type: Boolean
17832
- },
17833
- empty: {},
17834
- firstFullRow: {},
17835
- fixedRows: {},
17836
- footData: {},
17837
- footerAffixProps: {},
17838
- footerAffixedBottom: {
17839
- type: [Boolean, Object]
17840
- },
17841
- footerSummary: {},
17842
- headerAffixProps: {},
17843
- headerAffixedTop: {
17844
- type: [Boolean, Object]
17845
- },
17846
- height: {},
17847
- horizontalScrollAffixedBottom: {
17848
- type: [Boolean, Object]
17849
- },
17850
- hover: {
17851
- type: Boolean
17852
- },
17853
- keyboardRowHover: {
17854
- type: Boolean
17855
- },
17856
- lastFullRow: {},
17857
- lazyLoad: {
17858
- type: Boolean
17859
- },
17860
- loading: {
17861
- type: Boolean
17862
- },
17863
- loadingProps: {},
17864
- locale: {},
17865
- maxHeight: {},
17866
- paginationAffixedBottom: {
17867
- type: [Boolean, Object]
17868
- },
17869
- resizable: {
17870
- type: Boolean
17871
- },
17872
- rowAttributes: {
17873
- type: [Object, Function, Array]
17874
- },
17875
- rowClassName: {
17876
- type: [Object, Array, String, Function]
17877
- },
17878
- rowspanAndColspan: {
17879
- type: Function
17880
- },
17881
- rowspanAndColspanInFooter: {
17882
- type: Function
17883
- },
17884
- scroll: {},
17885
- showHeader: {
17886
- type: Boolean
17887
- },
17888
- size: {},
17889
- stripe: {
17890
- type: Boolean
17891
- },
17892
- tableContentWidth: {},
17893
- tableLayout: {},
17894
- topContent: {},
17895
- verticalAlign: {},
17896
- onActiveChange: {
17897
- type: Function
17898
- },
17899
- onActiveRowAction: {
17900
- type: Function
17901
- },
17902
- onColumnResizeChange: {
17903
- type: Function
17904
- },
17905
- onPageChange: {
17906
- type: Function
17907
- },
17908
- onRowClick: {
17909
- type: Function
17910
- },
17911
- onRowDblclick: {
17912
- type: Function
17913
- },
17914
- onRowMousedown: {
17915
- type: Function
17916
- },
17917
- onRowMouseenter: {
17918
- type: Function
17919
- },
17920
- onRowMouseleave: {
17921
- type: Function
17922
- },
17923
- onRowMouseover: {
17924
- type: Function
17925
- },
17926
- onRowMouseup: {
17927
- type: Function
17928
- },
17929
- onScroll: {
17930
- type: Function
17931
- },
17932
- onScrollX: {
17933
- type: Function
17934
- },
17935
- onScrollY: {
17936
- type: Function
17937
- },
17938
- cacheKey: {
17939
- type: [String, Function]
17940
- },
17941
- cacheTime: {},
17942
- pollingInterval: {},
17943
- onBefore: {
17944
- type: Function
17945
- },
17946
- onAfter: {
17947
- type: Function
17948
- },
17949
- onSuccess: {
17950
- type: Function
17951
- },
17952
- onError: {
17953
- type: Function
17954
- },
17955
- service: {
17956
- type: Function
17957
- },
17958
- manual: {
17959
- type: Boolean
17960
- },
17961
- transformParams: {
17962
- type: Function
17963
- },
17964
- transformRes: {
17965
- type: Function
17966
- },
17967
- pagination: {}
17968
- }, qdCrudTableProps),
17969
- emits: ["update:searchData", "update:data", "update:selectedRowKeys", "update:activeRowKeys", "update:columnControllerVisible", "update:displayColumns", "update:expandedRowKeys", "update:filterValue", "update:sort", "update:expandedTreeNodes"],
17970
- setup(__props, {
17971
- expose: __expose,
17972
- emit: __emit
17973
- }) {
17974
- const vHasPermi = hasPermiDirective;
17975
- const props = __props;
17976
- const emit = __emit;
17977
- const {
17978
- searchData,
17979
- data,
17980
- selectedRowKeys,
17981
- activeRowKeys,
17982
- columnControllerVisible,
17983
- displayColumns,
17984
- expandedRowKeys,
17985
- filterValue,
17986
- sort,
17987
- expandedTreeNodes
17988
- } = /* @__PURE__ */ useVModels(props, emit, {
17989
- passive: true
17990
- });
17991
- const {
17992
- t
17993
- } = useConfig("crud");
17994
- const {
17995
- msgError,
17996
- msgSuccess,
17997
- alertWarning,
17998
- confirm
17999
- } = useModal();
18000
- const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
18001
- const dialogFormMap = reactive({});
18002
- const reProps = computed(() => {
18003
- const {
18004
- data: data2,
18005
- searchData: inSearchData,
18006
- selectedRowKeys: selectedRowKeys2,
18007
- activeRowKeys: activeRowKeys2,
18008
- columnControllerVisible: columnControllerVisible2,
18009
- displayColumns: displayColumns2,
18010
- expandedRowKeys: expandedRowKeys2,
18011
- filterValue: filterValue2,
18012
- sort: sort2,
18013
- expandedTreeNodes: expandedTreeNodes2,
18014
- transformParams,
18015
- search,
18016
- form,
18017
- detail,
18018
- add,
18019
- actions,
18020
- edit,
18021
- view,
18022
- del,
18023
- rowActions,
18024
- title,
18025
- columns,
18026
- selectType,
18027
- ...serviceTableOptions
18028
- } = props;
18029
- const mergedTransformParams = (params) => {
18030
- const merged = {
18031
- ...params,
18032
- ...searchData.value
18033
- };
18034
- if (transformParams) return transformParams(merged);
18035
- return merged;
18036
- };
18037
- const reAdd = mergeAction({
18038
- crudMode: "add",
18039
- permiID: "add",
18040
- content: t("addText"),
18041
- icon: () => createVNode(AddIcon, null, null)
18042
- }, add, form);
18043
- const reActions = [reAdd, ...buildActions(actions, form)].filter(Boolean);
18044
- const reEdit = mergeAction({
18045
- crudMode: "edit",
18046
- permiID: "edit",
18047
- content: t("editText"),
18048
- theme: "primary",
18049
- hover: "color"
18050
- }, edit, form);
18051
- const reView = mergeAction({
18052
- crudMode: "view",
18053
- permiID: "query",
18054
- content: t("viewText"),
18055
- theme: "primary",
18056
- hover: "color"
18057
- }, view, form);
18058
- const reDel = mergeAction({
18059
- crudMode: "del",
18060
- permiID: "remove",
18061
- content: t("deleteText"),
18062
- theme: "danger",
18063
- hover: "color",
18064
- selectType: "multiple"
18065
- }, del, form);
18066
- const reRowActions = [reEdit, reView, reDel, ...buildActions(rowActions, form)].filter(Boolean);
18067
- let reSelectType = selectType;
18068
- if (reDel?.selectType === "multiple") {
18069
- if (!reSelectType) reSelectType = "multiple";
18070
- const batchDel = mergeAction({
18071
- crudMode: "del",
18072
- permiID: "remove",
18073
- content: t("deleteText"),
18074
- theme: "danger",
18075
- variant: "outline",
18076
- selectType: "multiple"
18077
- }, del, form);
18078
- reActions.splice(reAdd ? 1 : 0, 0, batchDel);
18079
- }
18080
- const reColumns = columns || [];
18081
- const operationLength = reRowActions.length;
18082
- if (operationLength) {
18083
- const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
18084
- const defaultOperation = {
18085
- title: t("operationText"),
18086
- colKey: "operation",
18087
- align: "center",
18088
- fixed: "right",
18089
- width: 28 * operationLength + 25 * operationLength - 1 + 32
18090
- };
18091
- if (operationIdx > -1) {
18092
- reColumns[operationIdx] = {
18093
- ...defaultOperation,
18094
- ...reColumns[operationIdx]
18095
- };
18096
- } else {
18097
- reColumns.push(defaultOperation);
18098
- }
18099
- }
18100
- return {
18101
- title,
18102
- searchOptions: search,
18103
- serviceTableOptions: {
18104
- ...serviceTableOptions,
18105
- selectType: reSelectType,
18106
- columns: reColumns,
18107
- transformParams: mergedTransformParams
18108
- },
18109
- formOptions: form,
18110
- detailOptions: detail,
18111
- actions: reActions,
18112
- rowActions: reRowActions,
18113
- models: {
18114
- data: data2,
18115
- searchData: inSearchData,
18116
- selectedRowKeys: selectedRowKeys2,
18117
- activeRowKeys: activeRowKeys2,
18118
- columnControllerVisible: columnControllerVisible2,
18119
- displayColumns: displayColumns2,
18120
- expandedRowKeys: expandedRowKeys2,
18121
- filterValue: filterValue2,
18122
- sort: sort2,
18123
- expandedTreeNodes: expandedTreeNodes2
18124
- }
18125
- };
18126
- });
18127
- const tableRef = useTemplateRef("table");
18128
- const searchVisible = ref(true);
18129
- const searchRef = useTemplateRef("search");
18130
- let searchMode = "refresh";
18131
- function handleSearch() {
18132
- searchMode = "changeCurrent";
18133
- }
18134
- function handleResetSearch() {
18135
- searchMode = "changeCurrent";
18136
- searchRef.value?.reset();
18137
- searchRef.value?.submit();
18138
- }
18139
- function triggerSearch({
18140
- validateResult
18141
- }) {
18142
- if (validateResult !== true) return;
18143
- switch (searchMode) {
18144
- case "changeCurrent":
18145
- tableRef.value?.changeCurrent(1);
18146
- break;
18147
- default:
18148
- tableRef.value?.refresh();
18149
- break;
18150
- }
18151
- }
18152
- function handleRefresh() {
18153
- searchMode = "refresh";
18154
- handleSearch();
18155
- }
18156
- function toggleSearchVisible() {
18157
- searchVisible.value = !searchVisible.value;
18158
- }
18159
- function toggleTreeExpandAll() {
18160
- if (treeIsExpand.value) tableRef.value?.foldAll();
18161
- else tableRef.value?.expandAll();
18162
- }
18163
- function openColumnController() {
18164
- columnControllerVisible.value = true;
18165
- }
18166
- function buildActions(actions, crudForm) {
18167
- if (!actions) return [];
18168
- return actions.map((item) => mergeAction({
18169
- variant: "outline",
18170
- theme: "primary",
18171
- hover: "color"
18172
- }, item, crudForm));
18173
- }
18174
- function mergeAction(defaultOptions, currentOptions, crudForm) {
18175
- if (currentOptions === false || !currentOptions) return;
18176
- const mergeOptions = merge(defaultOptions, currentOptions);
18177
- mergeOptions.permi = buildActionPermi(mergeOptions);
18178
- if (mergeOptions.crudMode !== "del") {
18179
- mergeOptions.form = buildActionForm(mergeOptions, crudForm);
18180
- }
18181
- return mergeOptions;
18182
- }
18183
- function getConfigRendererCtx(self2, other) {
18184
- return {
18185
- tableData: data.value,
18186
- searchData: searchData.value,
18187
- selectedRowKeys: selectedRowKeys.value,
18188
- activeRowKeys: activeRowKeys.value,
18189
- self: self2,
18190
- ...other
18191
- };
18192
- }
18193
- function actionIsCRU(crudMode) {
18194
- return crudMode && ["add", "edit", "view"].includes(crudMode);
18195
- }
18196
- function buildActionPermi(action) {
18197
- if (action.permi) return action.permi;
18198
- if (!props.permiPrefix || !action.permiID) return [];
18199
- return [`${props.permiPrefix}.${action.permiID}`];
18200
- }
18201
- function buildActionForm(action, crudForm) {
18202
- const IsCRU = actionIsCRU(action.crudMode);
18203
- if (!action.form && IsCRU) {
18204
- action.form = cloneDeep(crudForm);
18205
- }
18206
- const {
18207
- form
18208
- } = action;
18209
- if (form) {
18210
- if (action.crudMode === "view") form.readonly = true;
18211
- if (!form.onSubmit && IsCRU) {
18212
- form.onSubmit = async (context) => {
18213
- const {
18214
- uid,
18215
- service,
18216
- transformParams,
18217
- transformRes,
18218
- crudMode
18219
- } = action;
18220
- if (context.validateResult !== true || !service || !uid || !dialogFormMap[uid]) return false;
18221
- let currentParams = easyCopy(context.formData);
18222
- if (transformParams) {
18223
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
18224
- if (tpErr) throw tpErr;
18225
- currentParams = tpRes;
18226
- }
18227
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18228
- if (serviceErr) throw serviceErr;
18229
- let res;
18230
- if (transformRes) {
18231
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18232
- if (trErr) throw trErr;
18233
- res = trRes;
18234
- } else {
18235
- res = serviceRes;
18236
- }
18237
- if (typeof res === "boolean") {
18238
- res = {
18239
- success: res,
18240
- message: ""
18241
- };
18242
- }
18243
- if (!res) {
18244
- res = {
18245
- success: true,
18246
- message: ""
18247
- };
18248
- }
18249
- const message = res.message;
18250
- if (res.success === false) {
18251
- if (message) msgError(message);
18252
- return false;
18253
- }
18254
- msgSuccess(message || t("operationSuccessText"));
18255
- if (crudMode === "add") {
18256
- tableRef.value?.changeCurrent(1);
18257
- } else {
18258
- tableRef.value?.refresh();
18259
- }
18260
- };
17411
+ var dayjs_min$1 = { exports: {} };
17412
+ var dayjs_min = dayjs_min$1.exports;
17413
+ var hasRequiredDayjs_min;
17414
+ function requireDayjs_min() {
17415
+ if (hasRequiredDayjs_min) return dayjs_min$1.exports;
17416
+ hasRequiredDayjs_min = 1;
17417
+ (function(module2, exports2) {
17418
+ !(function(t, e) {
17419
+ module2.exports = e();
17420
+ })(dayjs_min, (function() {
17421
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h2 = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
17422
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
17423
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
17424
+ } }, m = function(t2, e2, n2) {
17425
+ var r2 = String(t2);
17426
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
17427
+ }, v = { s: m, z: function(t2) {
17428
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
17429
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
17430
+ }, m: function t2(e2, n2) {
17431
+ if (e2.date() < n2.date()) return -t2(n2, e2);
17432
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
17433
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
17434
+ }, a: function(t2) {
17435
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
17436
+ }, p: function(t2) {
17437
+ return { M: c, y: h2, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
17438
+ }, u: function(t2) {
17439
+ return void 0 === t2;
17440
+ } }, g = "en", D = {};
17441
+ D[g] = M;
17442
+ var p = "$isDayjsObject", S = function(t2) {
17443
+ return t2 instanceof _ || !(!t2 || !t2[p]);
17444
+ }, w = function t2(e2, n2, r2) {
17445
+ var i2;
17446
+ if (!e2) return g;
17447
+ if ("string" == typeof e2) {
17448
+ var s2 = e2.toLowerCase();
17449
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
17450
+ var u2 = e2.split("-");
17451
+ if (!i2 && u2.length > 1) return t2(u2[0]);
17452
+ } else {
17453
+ var a2 = e2.name;
17454
+ D[a2] = e2, i2 = a2;
18261
17455
  }
18262
- const {
18263
- title
18264
- } = props;
18265
- form.wrapper = merge({}, {
18266
- header: `${action.content}${title ? ` ${title}` : ""}`
18267
- }, form.wrapper);
18268
- }
18269
- return action.form;
18270
- }
18271
- function buildActionOnClick(action, originalParams) {
18272
- if (action.onClick) return action.onClick;
18273
- if (action.crudMode === "del") {
18274
- const onClick2 = async () => {
18275
- const {
18276
- service,
18277
- transformParams,
18278
- transformRes
18279
- } = action;
18280
- const row = originalParams?.row;
18281
- if (!service || !row && action.selectType !== "multiple" || !row && !selectedRowKeys.value.length && action.selectType === "multiple") {
18282
- return;
18283
- }
18284
- const childrenKey = reProps.value.serviceTableOptions.tree?.childrenKey || qdServiceTableTreeConfig.childrenKey;
18285
- let delHasChild = false;
18286
- if (!row) {
18287
- const rowKey = reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey;
18288
- delHasChild = selectedRowKeys.value.some((item) => {
18289
- const data2 = tableRef.value?.getData(item);
18290
- if (!data2) return false;
18291
- const children = data2.row[childrenKey];
18292
- if (isEmpty(children)) return false;
18293
- if (children === true) return true;
18294
- return children.some((child) => !selectedRowKeys.value.includes(child[rowKey]));
18295
- });
18296
- } else if (!isEmpty(row[childrenKey])) {
18297
- delHasChild = true;
17456
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
17457
+ }, O = function(t2, e2) {
17458
+ if (S(t2)) return t2.clone();
17459
+ var n2 = "object" == typeof e2 ? e2 : {};
17460
+ return n2.date = t2, n2.args = arguments, new _(n2);
17461
+ }, b = v;
17462
+ b.l = w, b.i = S, b.w = function(t2, e2) {
17463
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
17464
+ };
17465
+ var _ = (function() {
17466
+ function M2(t2) {
17467
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
17468
+ }
17469
+ var m2 = M2.prototype;
17470
+ return m2.parse = function(t2) {
17471
+ this.$d = (function(t3) {
17472
+ var e2 = t3.date, n2 = t3.utc;
17473
+ if (null === e2) return /* @__PURE__ */ new Date(NaN);
17474
+ if (b.u(e2)) return /* @__PURE__ */ new Date();
17475
+ if (e2 instanceof Date) return new Date(e2);
17476
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
17477
+ var r2 = e2.match($);
17478
+ if (r2) {
17479
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
17480
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
17481
+ }
17482
+ }
17483
+ return new Date(e2);
17484
+ })(t2), this.init();
17485
+ }, m2.init = function() {
17486
+ var t2 = this.$d;
17487
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
17488
+ }, m2.$utils = function() {
17489
+ return b;
17490
+ }, m2.isValid = function() {
17491
+ return !(this.$d.toString() === l);
17492
+ }, m2.isSame = function(t2, e2) {
17493
+ var n2 = O(t2);
17494
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
17495
+ }, m2.isAfter = function(t2, e2) {
17496
+ return O(t2) < this.startOf(e2);
17497
+ }, m2.isBefore = function(t2, e2) {
17498
+ return this.endOf(e2) < O(t2);
17499
+ }, m2.$g = function(t2, e2, n2) {
17500
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
17501
+ }, m2.unix = function() {
17502
+ return Math.floor(this.valueOf() / 1e3);
17503
+ }, m2.valueOf = function() {
17504
+ return this.$d.getTime();
17505
+ }, m2.startOf = function(t2, e2) {
17506
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
17507
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
17508
+ return r2 ? i2 : i2.endOf(a);
17509
+ }, $2 = function(t3, e3) {
17510
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
17511
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
17512
+ switch (f2) {
17513
+ case h2:
17514
+ return r2 ? l2(1, 0) : l2(31, 11);
17515
+ case c:
17516
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
17517
+ case o:
17518
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
17519
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
17520
+ case a:
17521
+ case d:
17522
+ return $2(v2 + "Hours", 0);
17523
+ case u:
17524
+ return $2(v2 + "Minutes", 1);
17525
+ case s:
17526
+ return $2(v2 + "Seconds", 2);
17527
+ case i:
17528
+ return $2(v2 + "Milliseconds", 3);
17529
+ default:
17530
+ return this.clone();
18298
17531
  }
18299
- if (delHasChild) {
18300
- alertWarning(t("deleteHasChildrenText"));
18301
- return;
17532
+ }, m2.endOf = function(t2) {
17533
+ return this.startOf(t2, false);
17534
+ }, m2.$set = function(t2, e2) {
17535
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h2] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
17536
+ if (o2 === c || o2 === h2) {
17537
+ var y2 = this.clone().set(d, 1);
17538
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
17539
+ } else l2 && this.$d[l2]($2);
17540
+ return this.init(), this;
17541
+ }, m2.set = function(t2, e2) {
17542
+ return this.clone().$set(t2, e2);
17543
+ }, m2.get = function(t2) {
17544
+ return this[b.p(t2)]();
17545
+ }, m2.add = function(r2, f2) {
17546
+ var d2, l2 = this;
17547
+ r2 = Number(r2);
17548
+ var $2 = b.p(f2), y2 = function(t2) {
17549
+ var e2 = O(l2);
17550
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
17551
+ };
17552
+ if ($2 === c) return this.set(c, this.$M + r2);
17553
+ if ($2 === h2) return this.set(h2, this.$y + r2);
17554
+ if ($2 === a) return y2(1);
17555
+ if ($2 === o) return y2(7);
17556
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
17557
+ return b.w(m3, this);
17558
+ }, m2.subtract = function(t2, e2) {
17559
+ return this.add(-1 * t2, e2);
17560
+ }, m2.format = function(t2) {
17561
+ var e2 = this, n2 = this.$locale();
17562
+ if (!this.isValid()) return n2.invalidDate || l;
17563
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h3 = function(t3, n3, i3, s3) {
17564
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
17565
+ }, d2 = function(t3) {
17566
+ return b.s(s2 % 12 || 12, t3, "0");
17567
+ }, $2 = f2 || function(t3, e3, n3) {
17568
+ var r3 = t3 < 12 ? "AM" : "PM";
17569
+ return n3 ? r3.toLowerCase() : r3;
17570
+ };
17571
+ return r2.replace(y, (function(t3, r3) {
17572
+ return r3 || (function(t4) {
17573
+ switch (t4) {
17574
+ case "YY":
17575
+ return String(e2.$y).slice(-2);
17576
+ case "YYYY":
17577
+ return b.s(e2.$y, 4, "0");
17578
+ case "M":
17579
+ return a2 + 1;
17580
+ case "MM":
17581
+ return b.s(a2 + 1, 2, "0");
17582
+ case "MMM":
17583
+ return h3(n2.monthsShort, a2, c2, 3);
17584
+ case "MMMM":
17585
+ return h3(c2, a2);
17586
+ case "D":
17587
+ return e2.$D;
17588
+ case "DD":
17589
+ return b.s(e2.$D, 2, "0");
17590
+ case "d":
17591
+ return String(e2.$W);
17592
+ case "dd":
17593
+ return h3(n2.weekdaysMin, e2.$W, o2, 2);
17594
+ case "ddd":
17595
+ return h3(n2.weekdaysShort, e2.$W, o2, 3);
17596
+ case "dddd":
17597
+ return o2[e2.$W];
17598
+ case "H":
17599
+ return String(s2);
17600
+ case "HH":
17601
+ return b.s(s2, 2, "0");
17602
+ case "h":
17603
+ return d2(1);
17604
+ case "hh":
17605
+ return d2(2);
17606
+ case "a":
17607
+ return $2(s2, u2, true);
17608
+ case "A":
17609
+ return $2(s2, u2, false);
17610
+ case "m":
17611
+ return String(u2);
17612
+ case "mm":
17613
+ return b.s(u2, 2, "0");
17614
+ case "s":
17615
+ return String(e2.$s);
17616
+ case "ss":
17617
+ return b.s(e2.$s, 2, "0");
17618
+ case "SSS":
17619
+ return b.s(e2.$ms, 3, "0");
17620
+ case "Z":
17621
+ return i2;
17622
+ }
17623
+ return null;
17624
+ })(t3) || i2.replace(":", "");
17625
+ }));
17626
+ }, m2.utcOffset = function() {
17627
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
17628
+ }, m2.diff = function(r2, d2, l2) {
17629
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
17630
+ return b.m(y2, m3);
17631
+ };
17632
+ switch (M3) {
17633
+ case h2:
17634
+ $2 = D2() / 12;
17635
+ break;
17636
+ case c:
17637
+ $2 = D2();
17638
+ break;
17639
+ case f:
17640
+ $2 = D2() / 3;
17641
+ break;
17642
+ case o:
17643
+ $2 = (g2 - v2) / 6048e5;
17644
+ break;
17645
+ case a:
17646
+ $2 = (g2 - v2) / 864e5;
17647
+ break;
17648
+ case u:
17649
+ $2 = g2 / n;
17650
+ break;
17651
+ case s:
17652
+ $2 = g2 / e;
17653
+ break;
17654
+ case i:
17655
+ $2 = g2 / t;
17656
+ break;
17657
+ default:
17658
+ $2 = g2;
18302
17659
  }
18303
- confirm({
18304
- body: t("deleteWrapperBodyText"),
18305
- ...action.wrapper
18306
- }, async () => {
18307
- const params = row || selectedRowKeys.value;
18308
- let currentParams = row ? params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey] : selectedRowKeys.value;
18309
- if (transformParams) {
18310
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18311
- if (tpErr) throw tpErr;
18312
- currentParams = tpRes;
18313
- }
18314
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18315
- if (serviceErr) throw serviceErr;
18316
- let res;
18317
- if (transformRes) {
18318
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18319
- if (trErr) throw trErr;
18320
- res = trRes;
18321
- } else {
18322
- res = serviceRes;
18323
- }
18324
- if (typeof res === "boolean") {
18325
- res = {
18326
- success: res,
18327
- message: ""
18328
- };
17660
+ return l2 ? $2 : b.a($2);
17661
+ }, m2.daysInMonth = function() {
17662
+ return this.endOf(c).$D;
17663
+ }, m2.$locale = function() {
17664
+ return D[this.$L];
17665
+ }, m2.locale = function(t2, e2) {
17666
+ if (!t2) return this.$L;
17667
+ var n2 = this.clone(), r2 = w(t2, e2, true);
17668
+ return r2 && (n2.$L = r2), n2;
17669
+ }, m2.clone = function() {
17670
+ return b.w(this.$d, this);
17671
+ }, m2.toDate = function() {
17672
+ return new Date(this.valueOf());
17673
+ }, m2.toJSON = function() {
17674
+ return this.isValid() ? this.toISOString() : null;
17675
+ }, m2.toISOString = function() {
17676
+ return this.$d.toISOString();
17677
+ }, m2.toString = function() {
17678
+ return this.$d.toUTCString();
17679
+ }, M2;
17680
+ })(), k = _.prototype;
17681
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h2], ["$D", d]].forEach((function(t2) {
17682
+ k[t2[1]] = function(e2) {
17683
+ return this.$g(e2, t2[0], t2[1]);
17684
+ };
17685
+ })), O.extend = function(t2, e2) {
17686
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
17687
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
17688
+ return O(1e3 * t2);
17689
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
17690
+ }));
17691
+ })(dayjs_min$1);
17692
+ return dayjs_min$1.exports;
17693
+ }
17694
+ var dayjs_minExports = requireDayjs_min();
17695
+ const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
17696
+ const csl = useCsl("useAgentChat");
17697
+ function useAgentChat(options) {
17698
+ const { t } = useConfig("chat");
17699
+ const { msgError, alertError, alertWarning } = useModal();
17700
+ const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
17701
+ const mergeOpt = { ...globalOpt, ...options };
17702
+ const loading = ref(false);
17703
+ const agentId = ref(mergeOpt.agentId);
17704
+ const apiKey = ref(mergeOpt.apiKey);
17705
+ const sessionId = ref("");
17706
+ let abortController;
17707
+ async function send({
17708
+ prompt,
17709
+ files,
17710
+ reSend,
17711
+ extParams,
17712
+ refreshSessionId,
17713
+ parseContent,
17714
+ onOpen,
17715
+ onMessage,
17716
+ onClose,
17717
+ onError
17718
+ }) {
17719
+ const allData = { content: "", reasoning: "", parsedContent: void 0, useTime: 0 };
17720
+ if (!prompt && isEmpty(files) && isEmpty(extParams)) return allData;
17721
+ loading.value = true;
17722
+ const [agInfoErr, agInfo] = await to(getAgentInfo());
17723
+ if (agInfoErr) {
17724
+ loading.value = false;
17725
+ msgError(agInfoErr.message);
17726
+ throw agInfoErr;
17727
+ }
17728
+ const [sIdErr, sId] = await to(getSessionId({ ...agInfo, refreshSessionId }));
17729
+ if (sIdErr) {
17730
+ loading.value = false;
17731
+ msgError(sIdErr.message);
17732
+ throw sIdErr;
17733
+ }
17734
+ const getUrl = mergeOpt.getUrl;
17735
+ if (!getUrl) {
17736
+ loading.value = false;
17737
+ const msg = t("failedObtainUrlMessage");
17738
+ msgError(msg);
17739
+ throw new Error(msg);
17740
+ }
17741
+ abortController = new AbortController();
17742
+ const sendTime = Date.now();
17743
+ csl.log.dev(`send.${sId}`, agInfo);
17744
+ return new Promise((resolve, reject) => {
17745
+ let timeoutId;
17746
+ let isFirstMessage = true;
17747
+ function triggerError(err) {
17748
+ allData.useTime = Date.now() - sendTime;
17749
+ csl.log.dev(`onError.${sId}`, err);
17750
+ loading.value = false;
17751
+ if (timeoutId) clearTimeout(timeoutId);
17752
+ onError?.(err);
17753
+ reject(err);
17754
+ }
17755
+ function setTimeoutHandler() {
17756
+ if (timeoutId) clearTimeout(timeoutId);
17757
+ timeoutId = setTimeout(() => {
17758
+ triggerError(new Error(t("agentProcessingTimeoutMessage")));
17759
+ stop();
17760
+ }, 20 * 1e3);
17761
+ }
17762
+ fetchEventSource(getUrl(agInfo.agentId, sId), {
17763
+ method: "POST",
17764
+ headers: {
17765
+ "Content-Type": "application/json;charset=UTF-8",
17766
+ Authorization: `Bearer ${agInfo.apiKey}`
17767
+ },
17768
+ signal: abortController?.signal,
17769
+ openWhenHidden: true,
17770
+ body: JSON.stringify({
17771
+ message: prompt || "",
17772
+ re_chat: reSend ?? false,
17773
+ document_list: files,
17774
+ client_id: agInfo.apiKey,
17775
+ client_type: "API_KEY",
17776
+ ...extParams
17777
+ }),
17778
+ onopen: async (res) => {
17779
+ csl.log.dev(`onOpen.${sId}`, res);
17780
+ await onOpen?.(res);
17781
+ },
17782
+ onmessage: (res) => {
17783
+ const { data } = res;
17784
+ let reData = { content: "", reasoning: "" };
17785
+ try {
17786
+ reData = parseRelaxedJSON(data);
17787
+ if (reData.content) allData.content += reData.content;
17788
+ if (reData.reasoning) allData.reasoning += reData.reasoning;
17789
+ if (isFirstMessage && reData.content || !isFirstMessage) {
17790
+ isFirstMessage = false;
17791
+ setTimeoutHandler();
18329
17792
  }
18330
- if (!res) {
18331
- res = {
18332
- success: true,
18333
- message: ""
18334
- };
17793
+ } catch (err) {
17794
+ console.warn("[useAgentChat.send.onMessage]", err);
17795
+ }
17796
+ csl.log.dev(`onMessage.${sId}`, dayjs().format("HH:mm:ss"), reData);
17797
+ onMessage?.({ data: reData, allData });
17798
+ },
17799
+ onclose: () => {
17800
+ if (parseContent) {
17801
+ try {
17802
+ if (timeoutId) clearTimeout(timeoutId);
17803
+ allData.parsedContent = parseRelaxedJSON(allData.content);
17804
+ } catch (err) {
17805
+ alertError({
17806
+ header: t("failedParseContentMessage"),
17807
+ body: err.message
17808
+ });
17809
+ triggerError(err);
17810
+ return;
18335
17811
  }
18336
- const message = res.message;
18337
- if (res.success === false) {
18338
- if (message) msgError(message);
18339
- return false;
17812
+ if (isEmpty(allData.parsedContent)) {
17813
+ const err = new Error(t("parsedContentEmptyMessage"));
17814
+ alertWarning({
17815
+ header: t("failedParseContentMessage"),
17816
+ body: err.message
17817
+ });
17818
+ triggerError(err);
17819
+ return;
18340
17820
  }
18341
- msgSuccess(message || t("deleteSuccessText"));
18342
- if (!row) selectedRowKeys.value = [];
18343
- tableRef.value?.refresh();
18344
- return true;
18345
- });
18346
- };
18347
- return onClick2;
18348
- }
18349
- if (isEmpty(action.form) || !actionIsCRU(action.crudMode)) return;
18350
- const onClick = async () => {
18351
- if (!action.uid) action.uid = generateRandomString(16);
18352
- const uid = action.uid;
18353
- const form = shallowRef(action.form);
18354
- if (!dialogFormMap[uid]) {
18355
- dialogFormMap[uid] = {
18356
- visible: false,
18357
- data: {},
18358
- crudMode: action.crudMode,
18359
- form
18360
- };
18361
- }
18362
- await nextTick();
18363
- dialogFormMap[uid].visible = true;
18364
- if (!action.crudMode || !["edit", "view"].includes(action.crudMode) || !originalParams) {
18365
- return;
18366
- }
18367
- form.value.loading = true;
18368
- triggerRef(form);
18369
- const [err, res] = await to(getDetail(originalParams.row));
18370
- form.value.loading = false;
18371
- triggerRef(form);
18372
- if (err) {
18373
- dialogFormMap[uid].data = originalParams.row;
18374
- return;
17821
+ }
17822
+ if (timeoutId) clearTimeout(timeoutId);
17823
+ allData.useTime = Date.now() - sendTime;
17824
+ csl.log.dev(`onClose.${sId}`, allData);
17825
+ loading.value = false;
17826
+ onClose?.(allData);
17827
+ resolve(allData);
17828
+ },
17829
+ onerror: (err) => {
17830
+ const reErr = err ? err : new Error(t("apiUnknownErrorMessage"));
17831
+ msgError(reErr.message);
17832
+ triggerError(reErr);
17833
+ throw reErr;
18375
17834
  }
18376
- dialogFormMap[uid].data = res;
18377
- };
18378
- return onClick;
17835
+ });
17836
+ });
17837
+ }
17838
+ function stop() {
17839
+ if (!abortController) return;
17840
+ csl.log.dev(`stop.${sessionId.value}`);
17841
+ abortController.abort();
17842
+ }
17843
+ async function getAgentInfo() {
17844
+ if (agentId.value && apiKey.value) {
17845
+ return { agentId: agentId.value, apiKey: apiKey.value };
18379
17846
  }
18380
- function buildActionDisabled(action) {
18381
- if (action.disabled) return action.disabled;
18382
- switch (action.selectType) {
18383
- case "single":
18384
- return selectedRowKeys.value.length !== 1;
18385
- case "multiple":
18386
- return selectedRowKeys.value.length === 0;
18387
- default:
18388
- return false;
18389
- }
17847
+ const getFn = mergeOpt.getAgentInfo;
17848
+ if (!getFn) throw new Error(t("failedObtainAgentInfoMessage"));
17849
+ const [err, res] = await suspectedWrapperPromise(getFn());
17850
+ if (err) throw err;
17851
+ if (!res?.agentId || !res.apiKey) {
17852
+ if (!getFn) throw new Error(t("failedObtainAgentInfoMessage"));
18390
17853
  }
18391
- async function getDetail(params) {
18392
- const {
18393
- detailOptions
18394
- } = reProps.value;
18395
- if (!detailOptions) return easyCopy(params);
18396
- const {
18397
- service,
18398
- transformParams,
18399
- transformRes
18400
- } = detailOptions;
18401
- if (!service) return easyCopy(params);
18402
- let currentParams = params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey];
18403
- if (transformParams) {
18404
- const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18405
- if (tpErr) throw tpErr;
18406
- currentParams = tpRes;
18407
- }
18408
- const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18409
- if (serviceErr) throw serviceErr;
18410
- let res;
18411
- if (transformRes) {
18412
- const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18413
- if (trErr) throw trErr;
18414
- res = trRes;
17854
+ return res;
17855
+ }
17856
+ async function getSessionId({
17857
+ agentId: agentId2,
17858
+ apiKey: apiKey2,
17859
+ refreshSessionId
17860
+ }) {
17861
+ if (sessionId.value && !refreshSessionId) return sessionId.value;
17862
+ const getFn = mergeOpt.getSessionId;
17863
+ if (!getFn) throw new Error(t("failedObtainSessionIdMessage"));
17864
+ const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
17865
+ if (err) throw err;
17866
+ sessionId.value = res;
17867
+ return res;
17868
+ }
17869
+ onBeforeUnmount(() => {
17870
+ stop();
17871
+ });
17872
+ return {
17873
+ loading,
17874
+ agentId,
17875
+ apiKey,
17876
+ sessionId,
17877
+ send,
17878
+ stop
17879
+ };
17880
+ }
17881
+ const dictCache = /* @__PURE__ */ new Map();
17882
+ const dictPromiseCache = /* @__PURE__ */ new Map();
17883
+ function useDict(...args) {
17884
+ const res = ref({});
17885
+ const loadingMap = ref({});
17886
+ args.forEach(async (dictType) => {
17887
+ const camelKey = camelize(dictType);
17888
+ res.value[camelKey] = [];
17889
+ const loadKey = `${camelKey}Load`;
17890
+ loadingMap.value[loadKey] = false;
17891
+ if (dictCache.has(camelKey)) {
17892
+ res.value[camelKey] = dictCache.get(camelKey);
17893
+ } else {
17894
+ loadingMap.value[loadKey] = true;
17895
+ let dictPromise;
17896
+ if (dictPromiseCache.has(camelKey)) {
17897
+ dictPromise = dictPromiseCache.get(camelKey);
18415
17898
  } else {
18416
- res = serviceRes;
17899
+ dictPromise = getDict(dictType);
17900
+ dictPromiseCache.set(camelKey, dictPromise);
18417
17901
  }
18418
- return res;
17902
+ const [dictErr, dictRes] = await to(dictPromise);
17903
+ if (dictErr) {
17904
+ loadingMap.value[loadKey] = false;
17905
+ dictPromiseCache.delete(camelKey);
17906
+ return;
17907
+ }
17908
+ dictCache.set(camelKey, dictRes);
17909
+ res.value[camelKey] = dictRes;
17910
+ loadingMap.value[loadKey] = false;
17911
+ dictPromiseCache.delete(camelKey);
18419
17912
  }
18420
- const expose = {};
18421
- onMounted(() => {
18422
- Object.assign(expose, tableRef.value);
18423
- });
18424
- __expose(expose);
18425
- return (_ctx, _cache) => {
18426
- return openBlock(), createElementBlock("div", _hoisted_1$2, [reProps.value.searchOptions?.items?.length ? withDirectives((openBlock(), createBlock(QdCrudSearch, mergeProps({
18427
- key: 0,
18428
- ref: "search",
18429
- data: unref(searchData),
18430
- "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null),
18431
- class: [!searchVisible.value ? "qd-crud-search--hide" : ""]
18432
- }, reProps.value.searchOptions, {
18433
- "on-submit": triggerSearch
18434
- }), {
18435
- footer: withCtx(() => [createVNode(unref(Space), {
18436
- align: "center",
18437
- size: "small"
18438
- }, {
18439
- default: withCtx(() => [createVNode(unref(Button), {
18440
- type: "submit",
18441
- onClick: handleSearch
18442
- }, {
18443
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18444
- _: 1
18445
- }), createVNode(unref(Button), {
18446
- variant: "outline",
18447
- onClick: handleResetSearch
18448
- }, {
18449
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18450
- _: 1
18451
- })]),
18452
- _: 1
18453
- })]),
18454
- _: 1
18455
- }, 16, ["data", "class"])), [[vShow, searchVisible.value]]) : createCommentVNode("", true), createVNode(unref(_sfc_main$i), {
18456
- class: "qd-crud-table__body"
18457
- }, {
18458
- default: withCtx(() => [createElementVNode("div", _hoisted_2$1, [createVNode(unref(Space), {
18459
- align: "center",
18460
- size: "small"
18461
- }, {
18462
- default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.actions, (item, index2) => {
18463
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18464
- key: item.uid || index2,
18465
- context: getConfigRendererCtx(item),
18466
- config: {
18467
- is: unref(Button),
18468
- ...item,
18469
- form: void 0,
18470
- onClick: buildActionOnClick(item),
18471
- disabled: buildActionDisabled(item)
18472
- }
18473
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18474
- }), 128))], true)]),
18475
- _: 3
18476
- }), createVNode(unref(Space), {
18477
- align: "center",
18478
- size: "small"
18479
- }, {
18480
- default: withCtx(() => [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(unref(Tooltip), {
18481
- key: 0,
18482
- content: searchVisible.value ? unref(t)("collapseSearchText") : unref(t)("expandSearchText")
18483
- }, {
18484
- default: withCtx(() => [createVNode(unref(Button), {
18485
- variant: "text",
18486
- shape: "square",
18487
- onClick: toggleSearchVisible
18488
- }, {
18489
- icon: withCtx(() => [createVNode(unref(SearchIcon))]),
18490
- _: 1
18491
- })]),
18492
- _: 1
18493
- }, 8, ["content"])) : createCommentVNode("", true), createVNode(unref(Tooltip), {
18494
- content: unref(t)("refreshText")
18495
- }, {
18496
- default: withCtx(() => [createVNode(unref(Button), {
18497
- variant: "text",
18498
- shape: "square",
18499
- onClick: handleRefresh
18500
- }, {
18501
- icon: withCtx(() => [createVNode(unref(RefreshIcon))]),
18502
- _: 1
18503
- })]),
18504
- _: 1
18505
- }, 8, ["content"]), !unref(isEmpty)(reProps.value.serviceTableOptions.tree) && !reProps.value.serviceTableOptions.tree.lazyLoad ? (openBlock(), createBlock(unref(Tooltip), {
18506
- key: 1,
18507
- content: treeIsExpand.value ? unref(t)("collapseTreeText") : unref(t)("expandTreeText")
18508
- }, {
18509
- default: withCtx(() => [createVNode(unref(Button), {
18510
- variant: "text",
18511
- shape: "square",
18512
- onClick: toggleTreeExpandAll
18513
- }, {
18514
- icon: withCtx(() => [treeIsExpand.value ? (openBlock(), createBlock(unref(UnfoldLessIcon), {
18515
- key: 0
18516
- })) : (openBlock(), createBlock(unref(UnfoldMoreIcon), {
18517
- key: 1
18518
- }))]),
18519
- _: 1
18520
- })]),
18521
- _: 1
18522
- }, 8, ["content"])) : createCommentVNode("", true), reProps.value.serviceTableOptions.columnController?.hideTriggerButton !== true ? (openBlock(), createBlock(unref(Tooltip), {
18523
- key: 2,
18524
- content: unref(t)("columnControllerText")
18525
- }, {
18526
- default: withCtx(() => [createVNode(unref(Button), {
18527
- variant: "text",
18528
- shape: "square",
18529
- onClick: openColumnController
18530
- }, {
18531
- icon: withCtx(() => [createVNode(unref(SettingIcon))]),
18532
- _: 1
18533
- })]),
18534
- _: 1
18535
- }, 8, ["content"])) : createCommentVNode("", true)]),
18536
- _: 1
18537
- })]), createVNode(unref(QdServiceTable), mergeProps({
18538
- ref: "table",
18539
- data: unref(data),
18540
- "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
18541
- "selected-row-keys": unref(selectedRowKeys),
18542
- "onUpdate:selectedRowKeys": _cache[3] || (_cache[3] = ($event) => isRef(selectedRowKeys) ? selectedRowKeys.value = $event : null),
18543
- "active-row-keys": unref(activeRowKeys),
18544
- "onUpdate:activeRowKeys": _cache[4] || (_cache[4] = ($event) => isRef(activeRowKeys) ? activeRowKeys.value = $event : null),
18545
- "column-controller-visible": unref(columnControllerVisible),
18546
- "onUpdate:columnControllerVisible": _cache[5] || (_cache[5] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
18547
- "display-columns": unref(displayColumns),
18548
- "onUpdate:displayColumns": _cache[6] || (_cache[6] = ($event) => isRef(displayColumns) ? displayColumns.value = $event : null),
18549
- "expanded-row-keys": unref(expandedRowKeys),
18550
- "onUpdate:expandedRowKeys": _cache[7] || (_cache[7] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
18551
- "filter-value": unref(filterValue),
18552
- "onUpdate:filterValue": _cache[8] || (_cache[8] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
18553
- sort: unref(sort),
18554
- "onUpdate:sort": _cache[9] || (_cache[9] = ($event) => isRef(sort) ? sort.value = $event : null),
18555
- "expanded-tree-nodes": unref(expandedTreeNodes),
18556
- "onUpdate:expandedTreeNodes": _cache[10] || (_cache[10] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null)
18557
- }, reProps.value.serviceTableOptions), createSlots({
18558
- operation: withCtx((slotProps) => [renderSlot(_ctx.$slots, "table-operation", normalizeProps(guardReactiveProps(slotProps)), () => [reProps.value.rowActions?.length ? (openBlock(), createBlock(unref(Space), {
18559
- key: 0,
18560
- align: "center",
18561
- size: 0,
18562
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
18563
- }, ["stop"]))
18564
- }, {
18565
- separator: withCtx(() => [createVNode(unref(Divider), {
18566
- layout: "vertical"
18567
- })]),
18568
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.rowActions, (item, index2) => {
18569
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18570
- key: item.uid || index2,
18571
- context: getConfigRendererCtx(item, slotProps),
18572
- config: {
18573
- is: unref(Link),
18574
- ...item,
18575
- onClick: buildActionOnClick(item, slotProps)
18576
- }
18577
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18578
- }), 128))]),
18579
- _: 2
18580
- }, 1024)) : createCommentVNode("", true)], true)]),
18581
- _: 2
18582
- }, [renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "table"), (item) => {
18583
- return {
18584
- name: item.filterName,
18585
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
18586
- };
18587
- })]), 1040, ["data", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes"])]),
18588
- _: 3
18589
- }), (openBlock(true), createElementBlock(Fragment, null, renderList(dialogFormMap, (dialogForm, uid) => {
18590
- return openBlock(), createBlock(unref(_sfc_main$h), {
18591
- key: uid,
18592
- config: {
18593
- is: unref(_sfc_main$8),
18594
- ...dialogForm.form,
18595
- vModelVisible: "self.visible",
18596
- vModelData: "self.data",
18597
- crudMode: dialogForm.crudMode
18598
- },
18599
- context: getConfigRendererCtx(dialogForm)
18600
- }, null, 8, ["config", "context"]);
18601
- }), 128))]);
17913
+ });
17914
+ const result = toRefs(res.value);
17915
+ const loadingRefs = toRefs(loadingMap.value);
17916
+ const readyMethods = {};
17917
+ args.forEach((dictType) => {
17918
+ const camelKey = camelize(dictType);
17919
+ const loadKey = `${camelKey}Load`;
17920
+ readyMethods[`${camelKey}Ready`] = async (callback) => {
17921
+ if (dictCache.has(camelKey)) {
17922
+ const data2 = dictCache.get(camelKey);
17923
+ callback?.(data2);
17924
+ return data2;
17925
+ }
17926
+ while (loadingMap.value[loadKey]) {
17927
+ await new Promise((resolve) => setTimeout(resolve, 10));
17928
+ }
17929
+ const data = dictCache.get(camelKey) || [];
17930
+ callback?.(data);
17931
+ return data;
18602
17932
  };
17933
+ });
17934
+ return {
17935
+ ...result,
17936
+ ...loadingRefs,
17937
+ ...readyMethods
17938
+ };
17939
+ }
17940
+ function useDictDynamic(dictType, hookOptions) {
17941
+ const dictOptions = ref([]);
17942
+ const loading = ref(false);
17943
+ async function loadDict(type) {
17944
+ if (!type) {
17945
+ dictOptions.value = [];
17946
+ hookOptions?.onInit?.([]);
17947
+ return;
17948
+ }
17949
+ const camelKey = type ? camelize(type) : type;
17950
+ if (dictCache.has(camelKey)) {
17951
+ dictOptions.value = dictCache.get(camelKey);
17952
+ hookOptions?.onInit?.(dictOptions.value);
17953
+ return;
17954
+ }
17955
+ loading.value = true;
17956
+ let dictPromise;
17957
+ if (dictPromiseCache.has(camelKey)) {
17958
+ dictPromise = dictPromiseCache.get(camelKey);
17959
+ } else {
17960
+ dictPromise = getDict(type);
17961
+ dictPromiseCache.set(camelKey, dictPromise);
17962
+ }
17963
+ const [dictErr, dictRes] = await to(dictPromise);
17964
+ if (dictErr) {
17965
+ dictOptions.value = [];
17966
+ loading.value = false;
17967
+ dictPromiseCache.delete(camelKey);
17968
+ hookOptions?.onInit?.([]);
17969
+ return;
17970
+ }
17971
+ dictCache.set(camelKey, dictRes);
17972
+ dictOptions.value = dictRes;
17973
+ loading.value = false;
17974
+ dictPromiseCache.delete(camelKey);
17975
+ hookOptions?.onInit?.(dictOptions.value);
17976
+ }
17977
+ watchEffect(() => {
17978
+ loadDict(dictType.value);
17979
+ });
17980
+ return {
17981
+ options: dictOptions,
17982
+ loading
17983
+ };
17984
+ }
17985
+ async function getDict(dictType) {
17986
+ const dictOptions = window.__QIDIAN_DICT__;
17987
+ if (!dictOptions) {
17988
+ const msg = "[useDict] 字典服务未提供,请确保使用了 QdConfigProvider";
17989
+ console.warn(msg);
17990
+ throw new Error(msg);
17991
+ }
17992
+ const { service, transformParams, transformRes } = dictOptions;
17993
+ let currentParams = dictType;
17994
+ if (transformParams) {
17995
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
17996
+ if (tpErr) throw tpErr;
17997
+ currentParams = tpRes;
18603
17998
  }
18604
- });
18605
- const table = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-bdb9c97a"]]);
18606
- const _hoisted_1$1 = {
18607
- key: 0,
18608
- class: "qd-crud-list__header"
17999
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18000
+ if (serviceErr) throw serviceErr;
18001
+ let res;
18002
+ if (transformRes) {
18003
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18004
+ if (trErr) throw trErr;
18005
+ res = trRes;
18006
+ } else {
18007
+ res = serviceRes;
18008
+ }
18009
+ return res;
18010
+ }
18011
+ function useReadonly(context) {
18012
+ const currentInstance = getCurrentInstance();
18013
+ const componentReadonly = computed(() => currentInstance.props.Readonly);
18014
+ const formReadonly = inject("formReadonly", /* @__PURE__ */ Object.create(null));
18015
+ return computed(() => {
18016
+ if (isBoolean(context?.beforeReadonly?.value)) return context.beforeReadonly.value;
18017
+ if (isBoolean(componentReadonly.value)) return componentReadonly.value;
18018
+ if (isBoolean(context?.afterReadonly?.value)) return context.afterReadonly.value;
18019
+ if (isBoolean(formReadonly.readonly?.value)) return formReadonly.readonly.value;
18020
+ return false;
18021
+ });
18022
+ }
18023
+ function useDisabled(context) {
18024
+ const currentInstance = getCurrentInstance();
18025
+ const componentDisabled = computed(() => currentInstance.props.disabled);
18026
+ const formDisabled = inject("formDisabled", /* @__PURE__ */ Object.create(null));
18027
+ return computed(() => {
18028
+ if (isBoolean(context?.beforeDisabled?.value)) return context.beforeDisabled.value;
18029
+ if (isBoolean(componentDisabled.value)) return componentDisabled.value;
18030
+ if (isBoolean(context?.afterDisabled?.value)) return context.afterDisabled.value;
18031
+ if (isBoolean(formDisabled.disabled?.value)) return formDisabled.disabled.value;
18032
+ return false;
18033
+ });
18034
+ }
18035
+ const _hoisted_1$2 = {
18036
+ class: "qd-crud-table"
18609
18037
  };
18610
- const _hoisted_2 = {
18611
- key: 1,
18612
- class: "qd-crud-list__toolbar"
18038
+ const _hoisted_2$1 = {
18039
+ class: "qd-crud-table__toolbar"
18613
18040
  };
18614
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
18615
- __name: "list",
18041
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
18042
+ ...{
18043
+ name: "QdCrudTable"
18044
+ },
18045
+ __name: "table",
18616
18046
  props: /* @__PURE__ */ mergeDefaults({
18047
+ title: {},
18048
+ permiPrefix: {},
18617
18049
  search: {},
18618
18050
  searchData: {},
18051
+ form: {},
18052
+ detail: {},
18053
+ add: {
18054
+ type: [Boolean, Object]
18055
+ },
18056
+ actions: {},
18057
+ edit: {
18058
+ type: [Boolean, Object]
18059
+ },
18060
+ view: {
18061
+ type: [Boolean, Object]
18062
+ },
18063
+ del: {
18064
+ type: [Boolean, Object]
18065
+ },
18066
+ rowActions: {},
18067
+ rowKey: {},
18068
+ selectType: {},
18069
+ tree: {},
18070
+ beforeDragSort: {
18071
+ type: Function
18072
+ },
18073
+ expandedTreeNodes: {},
18074
+ defaultExpandedTreeNodes: {},
18075
+ treeExpandAndFoldIcon: {},
18076
+ onAbnormalDragSort: {
18077
+ type: Function
18078
+ },
18079
+ onExpandedTreeNodesChange: {
18080
+ type: Function
18081
+ },
18082
+ onTreeExpandChange: {
18083
+ type: Function
18084
+ },
18085
+ asyncLoading: {},
18086
+ columnController: {},
18087
+ columnControllerVisible: {
18088
+ type: Boolean
18089
+ },
18090
+ defaultColumnControllerVisible: {
18091
+ type: Boolean
18092
+ },
18093
+ columns: {},
18094
+ displayColumns: {},
18095
+ defaultDisplayColumns: {},
18096
+ dragSort: {},
18097
+ dragSortOptions: {},
18098
+ editableCellState: {
18099
+ type: Function
18100
+ },
18101
+ editableRowKeys: {},
18102
+ expandIcon: {
18103
+ type: Boolean
18104
+ },
18105
+ expandOnRowClick: {
18106
+ type: Boolean
18107
+ },
18108
+ expandedRow: {},
18109
+ expandedRowKeys: {},
18110
+ defaultExpandedRowKeys: {},
18111
+ filterIcon: {},
18112
+ filterRow: {},
18113
+ filterValue: {},
18114
+ defaultFilterValue: {},
18115
+ hideSortTips: {
18116
+ type: Boolean
18117
+ },
18118
+ indeterminateSelectedRowKeys: {},
18119
+ multipleSort: {
18120
+ type: Boolean
18121
+ },
18122
+ reserveSelectedRowOnPaginate: {
18123
+ type: Boolean
18124
+ },
18125
+ rowSelectionAllowUncheck: {
18126
+ type: Boolean
18127
+ },
18128
+ rowSelectionType: {},
18129
+ selectOnRowClick: {
18130
+ type: Boolean
18131
+ },
18132
+ selectedRowKeys: {},
18133
+ defaultSelectedRowKeys: {},
18134
+ showSortColumnBgColor: {
18135
+ type: Boolean
18136
+ },
18137
+ sort: {},
18138
+ defaultSort: {},
18139
+ sortIcon: {},
18140
+ sortOnRowDraggable: {
18141
+ type: Boolean
18142
+ },
18143
+ onAsyncLoadingClick: {
18144
+ type: Function
18145
+ },
18146
+ onCellClick: {
18147
+ type: Function
18148
+ },
18149
+ onChange: {
18150
+ type: Function
18151
+ },
18152
+ onColumnChange: {
18153
+ type: Function
18154
+ },
18155
+ onColumnControllerVisibleChange: {
18156
+ type: Function
18157
+ },
18158
+ onDataChange: {
18159
+ type: Function
18160
+ },
18161
+ onDisplayColumnsChange: {
18162
+ type: Function
18163
+ },
18164
+ onDragSort: {
18165
+ type: Function
18166
+ },
18167
+ onExpandChange: {
18168
+ type: Function
18169
+ },
18170
+ onFilterChange: {
18171
+ type: Function
18172
+ },
18173
+ onRowEdit: {
18174
+ type: Function
18175
+ },
18176
+ onRowValidate: {
18177
+ type: Function
18178
+ },
18179
+ onSelectChange: {
18180
+ type: Function
18181
+ },
18182
+ onSortChange: {
18183
+ type: Function
18184
+ },
18185
+ onValidate: {
18186
+ type: Function
18187
+ },
18188
+ activeRowKeys: {},
18189
+ defaultActiveRowKeys: {},
18190
+ activeRowType: {},
18191
+ allowResizeColumnWidth: {
18192
+ type: Boolean
18193
+ },
18194
+ attach: {
18195
+ type: [String, Function]
18196
+ },
18197
+ bordered: {
18198
+ type: Boolean
18199
+ },
18200
+ bottomContent: {},
18201
+ cellEmptyContent: {},
18619
18202
  data: {},
18203
+ disableDataPage: {
18204
+ type: Boolean
18205
+ },
18206
+ disableSpaceInactiveRow: {
18207
+ type: Boolean
18208
+ },
18209
+ empty: {},
18210
+ firstFullRow: {},
18211
+ fixedRows: {},
18212
+ footData: {},
18213
+ footerAffixProps: {},
18214
+ footerAffixedBottom: {
18215
+ type: [Boolean, Object]
18216
+ },
18217
+ footerSummary: {},
18218
+ headerAffixProps: {},
18219
+ headerAffixedTop: {
18220
+ type: [Boolean, Object]
18221
+ },
18222
+ height: {},
18223
+ horizontalScrollAffixedBottom: {
18224
+ type: [Boolean, Object]
18225
+ },
18226
+ hover: {
18227
+ type: Boolean
18228
+ },
18229
+ keyboardRowHover: {
18230
+ type: Boolean
18231
+ },
18232
+ lastFullRow: {},
18233
+ lazyLoad: {
18234
+ type: Boolean
18235
+ },
18620
18236
  loading: {
18621
18237
  type: Boolean
18622
18238
  },
18623
- loadingProps: {},
18239
+ loadingProps: {},
18240
+ locale: {},
18241
+ maxHeight: {},
18242
+ paginationAffixedBottom: {
18243
+ type: [Boolean, Object]
18244
+ },
18245
+ resizable: {
18246
+ type: Boolean
18247
+ },
18248
+ rowAttributes: {
18249
+ type: [Object, Function, Array]
18250
+ },
18251
+ rowClassName: {
18252
+ type: [Object, Array, String, Function]
18253
+ },
18254
+ rowspanAndColspan: {
18255
+ type: Function
18256
+ },
18257
+ rowspanAndColspanInFooter: {
18258
+ type: Function
18259
+ },
18624
18260
  scroll: {},
18625
- asyncLoading: {},
18626
- footer: {},
18627
- header: {},
18628
- layout: {},
18629
- size: {},
18630
- split: {
18261
+ showHeader: {
18631
18262
  type: Boolean
18632
18263
  },
18264
+ size: {},
18633
18265
  stripe: {
18634
18266
  type: Boolean
18635
18267
  },
18636
- onBefore: {
18268
+ tableContentWidth: {},
18269
+ tableLayout: {},
18270
+ topContent: {},
18271
+ verticalAlign: {},
18272
+ onActiveChange: {
18637
18273
  type: Function
18638
18274
  },
18639
- onAfter: {
18275
+ onActiveRowAction: {
18640
18276
  type: Function
18641
18277
  },
18642
- onSuccess: {
18278
+ onColumnResizeChange: {
18643
18279
  type: Function
18644
18280
  },
18645
- onError: {
18281
+ onPageChange: {
18646
18282
  type: Function
18647
18283
  },
18648
- service: {
18284
+ onRowClick: {
18649
18285
  type: Function
18650
18286
  },
18651
- manual: {
18652
- type: Boolean
18287
+ onRowDblclick: {
18288
+ type: Function
18653
18289
  },
18654
- transformParams: {
18290
+ onRowMousedown: {
18655
18291
  type: Function
18656
18292
  },
18657
- transformRes: {
18293
+ onRowMouseenter: {
18658
18294
  type: Function
18659
18295
  },
18660
- pagination: {}
18661
- }, qdCrudListProps),
18662
- emits: ["update:searchData", "update:data"],
18663
- setup(__props, {
18664
- expose: __expose,
18665
- emit: __emit
18666
- }) {
18667
- const props = __props;
18668
- const emit = __emit;
18669
- const {
18670
- data,
18671
- searchData
18672
- } = /* @__PURE__ */ useVModels(props, emit, {
18673
- passive: true
18674
- });
18675
- const {
18676
- t
18677
- } = useConfig("crud");
18678
- const reProps = computed(() => {
18679
- const {
18680
- data: data2,
18681
- searchData: inSearchData,
18682
- search,
18683
- transformParams,
18684
- ...serviceListOptions
18685
- } = props;
18686
- const mergedTransformParams = (params) => {
18687
- const merged = {
18688
- ...params,
18689
- ...searchData.value
18690
- };
18691
- if (transformParams) return transformParams(merged);
18692
- return merged;
18693
- };
18694
- return {
18695
- searchOptions: search,
18696
- serviceListOptions: {
18697
- ...serviceListOptions,
18698
- transformParams: mergedTransformParams
18699
- },
18700
- models: {
18701
- data: data2,
18702
- searchData: inSearchData
18703
- }
18704
- };
18705
- });
18706
- const searchRef = useTemplateRef("search");
18707
- const listRef = useTemplateRef("list");
18708
- function handleSearch() {
18709
- }
18710
- function handleResetSearch() {
18711
- searchRef.value?.reset();
18712
- searchRef.value?.submit();
18713
- }
18714
- function triggerSearch({
18715
- validateResult
18716
- }) {
18717
- if (validateResult !== true) return;
18718
- listRef.value?.refresh();
18719
- }
18720
- const expose = {};
18721
- onMounted(() => {
18722
- Object.assign(expose, listRef.value);
18723
- });
18724
- __expose(expose);
18725
- return (_ctx, _cache) => {
18726
- return openBlock(), createElementBlock("div", {
18727
- class: normalizeClass(["qd-crud-list", reProps.value.serviceListOptions.scroll?.target ? "qd-crud-list--has-scroll-target" : ""])
18728
- }, [reProps.value.searchOptions?.items?.length || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_1$1, [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(QdCrudSearch, mergeProps({
18729
- key: 0,
18730
- ref: "search",
18731
- data: unref(searchData),
18732
- "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null)
18733
- }, reProps.value.searchOptions, {
18734
- "on-submit": triggerSearch
18735
- }), {
18736
- footer: withCtx(() => [createVNode(unref(Space), {
18737
- align: "center",
18738
- size: "small"
18739
- }, {
18740
- default: withCtx(() => [createVNode(unref(Button), {
18741
- type: "submit",
18742
- onClick: handleSearch
18743
- }, {
18744
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18745
- _: 1
18746
- }), createVNode(unref(Button), {
18747
- variant: "outline",
18748
- onClick: handleResetSearch
18749
- }, {
18750
- default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18751
- _: 1
18752
- })]),
18753
- _: 1
18754
- })]),
18755
- _: 1
18756
- }, 16, ["data"])) : createCommentVNode("", true), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Space), {
18757
- align: "center",
18758
- size: "small"
18759
- }, {
18760
- default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, void 0, true)]),
18761
- _: 3
18762
- })])) : createCommentVNode("", true)])) : createCommentVNode("", true), createVNode(unref(QdServiceList), mergeProps({
18763
- ref: "list",
18764
- data: unref(data),
18765
- "onUpdate:data": _cache[1] || (_cache[1] = ($event) => isRef(data) ? data.value = $event : null)
18766
- }, reProps.value.serviceListOptions), createSlots({
18767
- _: 2
18768
- }, [_ctx.$slots.default ? {
18769
- name: "default",
18770
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)), void 0, true)]),
18771
- key: "0"
18772
- } : void 0, renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "list"), (item) => {
18773
- return {
18774
- name: item.filterName,
18775
- fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
18776
- };
18777
- })]), 1040, ["data"])], 2);
18778
- };
18779
- }
18780
- });
18781
- const list = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c15e270f"]]);
18782
- function defineQdCrudTable(config) {
18783
- return config;
18784
- }
18785
- function defineQdCrudList(config) {
18786
- return config;
18787
- }
18788
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
18789
- ...{
18790
- name: "QdDictSelect"
18791
- },
18792
- __name: "select",
18793
- props: /* @__PURE__ */ mergeDefaults({
18794
- dictType: {},
18795
- defaultSelectFirst: { type: Boolean },
18796
- convStr: { type: [Boolean, String] },
18797
- autoWidth: { type: Boolean },
18798
- autofocus: { type: Boolean },
18799
- borderless: { type: Boolean },
18800
- clearable: { type: Boolean },
18801
- collapsedItems: {},
18802
- creatable: { type: Boolean },
18803
- disabled: { type: Boolean },
18804
- empty: {},
18805
- filter: { type: Function },
18806
- filterable: { type: Boolean },
18807
- inputProps: {},
18808
- inputValue: {},
18809
- defaultInputValue: {},
18810
- keys: {},
18811
- label: {},
18812
- loading: { type: Boolean },
18813
- loadingText: {},
18814
- max: {},
18815
- minCollapsedNum: {},
18816
- multiple: { type: Boolean },
18817
- panelBottomContent: {},
18818
- panelTopContent: {},
18819
- placeholder: {},
18820
- popupProps: {},
18821
- popupVisible: { type: Boolean },
18822
- defaultPopupVisible: { type: Boolean },
18823
- prefixIcon: {},
18824
- readonly: { type: Boolean },
18825
- reserveKeyword: { type: Boolean },
18826
- scroll: {},
18827
- selectInputProps: {},
18828
- showArrow: { type: Boolean },
18829
- size: {},
18830
- status: {},
18831
- suffix: {},
18832
- suffixIcon: {},
18833
- tagInputProps: {},
18834
- tagProps: {},
18835
- tips: {},
18836
- value: {},
18837
- defaultValue: {},
18838
- modelValue: {},
18839
- valueDisplay: {},
18840
- valueType: {},
18841
- onBlur: { type: Function },
18842
- onChange: { type: Function },
18843
- onClear: { type: Function },
18844
- onCreate: { type: Function },
18845
- onEnter: { type: Function },
18846
- onFocus: { type: Function },
18847
- onInputChange: { type: Function },
18848
- onPopupVisibleChange: { type: Function },
18849
- onRemove: { type: Function },
18850
- onSearch: { type: Function }
18851
- }, qdDictSelectProps),
18852
- emits: ["update:modelValue", "update:inputValue", "update:popupVisible"],
18853
- setup(__props, { emit: __emit }) {
18296
+ onRowMouseleave: {
18297
+ type: Function
18298
+ },
18299
+ onRowMouseover: {
18300
+ type: Function
18301
+ },
18302
+ onRowMouseup: {
18303
+ type: Function
18304
+ },
18305
+ onScroll: {
18306
+ type: Function
18307
+ },
18308
+ onScrollX: {
18309
+ type: Function
18310
+ },
18311
+ onScrollY: {
18312
+ type: Function
18313
+ },
18314
+ cacheKey: {
18315
+ type: [String, Function]
18316
+ },
18317
+ cacheTime: {},
18318
+ pollingInterval: {},
18319
+ onBefore: {
18320
+ type: Function
18321
+ },
18322
+ onAfter: {
18323
+ type: Function
18324
+ },
18325
+ onSuccess: {
18326
+ type: Function
18327
+ },
18328
+ onError: {
18329
+ type: Function
18330
+ },
18331
+ service: {
18332
+ type: Function
18333
+ },
18334
+ manual: {
18335
+ type: Boolean
18336
+ },
18337
+ transformParams: {
18338
+ type: Function
18339
+ },
18340
+ transformRes: {
18341
+ type: Function
18342
+ },
18343
+ pagination: {}
18344
+ }, qdCrudTableProps),
18345
+ emits: ["update:searchData", "update:data", "update:selectedRowKeys", "update:activeRowKeys", "update:columnControllerVisible", "update:displayColumns", "update:expandedRowKeys", "update:filterValue", "update:sort", "update:expandedTreeNodes"],
18346
+ setup(__props, {
18347
+ expose: __expose,
18348
+ emit: __emit
18349
+ }) {
18350
+ const vHasPermi = hasPermiDirective;
18854
18351
  const props = __props;
18855
18352
  const emit = __emit;
18856
- const { modelValue, inputValue, popupVisible } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
18857
- const reModelValue = computed({
18858
- get: () => {
18859
- const { convStr, selectOptions } = reProps.value;
18860
- const { multiple, valueType } = selectOptions;
18861
- if (!multiple || valueType === "object") return modelValue.value;
18862
- if (isEmpty(modelValue.value)) return [];
18863
- if (typeof modelValue.value === "string") {
18864
- return modelValue.value.split(
18865
- (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
18866
- );
18867
- }
18868
- return modelValue.value;
18869
- },
18870
- set: (val) => {
18871
- const { convStr, selectOptions } = reProps.value;
18872
- const { multiple, valueType } = selectOptions;
18873
- if (!multiple || valueType === "object") {
18874
- modelValue.value = val;
18875
- return;
18876
- }
18877
- if (convStr && Array.isArray(val)) {
18878
- modelValue.value = val.join(
18879
- (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
18880
- );
18881
- } else {
18882
- modelValue.value = val;
18883
- }
18884
- }
18353
+ const {
18354
+ searchData,
18355
+ data,
18356
+ selectedRowKeys,
18357
+ activeRowKeys,
18358
+ columnControllerVisible,
18359
+ displayColumns,
18360
+ expandedRowKeys,
18361
+ filterValue,
18362
+ sort,
18363
+ expandedTreeNodes
18364
+ } = /* @__PURE__ */ useVModels(props, emit, {
18365
+ passive: true
18885
18366
  });
18886
- const dictType = toRef(props, "dictType");
18367
+ const {
18368
+ t
18369
+ } = useConfig("crud");
18370
+ const {
18371
+ msgError,
18372
+ msgSuccess,
18373
+ alertWarning,
18374
+ confirm
18375
+ } = useModal();
18376
+ const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
18377
+ const dialogFormMap = reactive({});
18887
18378
  const reProps = computed(() => {
18888
18379
  const {
18889
- convStr,
18890
- modelValue: modelValue2,
18891
- inputValue: inputValue2,
18892
- popupVisible: popupVisible2,
18893
- dictType: dictType2,
18894
- loading,
18895
- defaultSelectFirst,
18896
- ...selectOptions
18380
+ data: data2,
18381
+ searchData: inSearchData,
18382
+ selectedRowKeys: selectedRowKeys2,
18383
+ activeRowKeys: activeRowKeys2,
18384
+ columnControllerVisible: columnControllerVisible2,
18385
+ displayColumns: displayColumns2,
18386
+ expandedRowKeys: expandedRowKeys2,
18387
+ filterValue: filterValue2,
18388
+ sort: sort2,
18389
+ expandedTreeNodes: expandedTreeNodes2,
18390
+ transformParams,
18391
+ search,
18392
+ form,
18393
+ detail,
18394
+ add,
18395
+ actions,
18396
+ edit,
18397
+ view,
18398
+ del,
18399
+ rowActions,
18400
+ title,
18401
+ columns,
18402
+ selectType,
18403
+ ...serviceTableOptions
18897
18404
  } = props;
18898
- return {
18899
- convStr,
18900
- dictType: dictType2,
18901
- loading,
18902
- defaultSelectFirst,
18903
- selectOptions,
18904
- models: {
18905
- modelValue: modelValue2,
18906
- inputValue: inputValue2,
18907
- popupVisible: popupVisible2
18908
- }
18909
- };
18910
- });
18911
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType, {
18912
- onInit: (options) => {
18913
- if (reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && options.length) {
18914
- reModelValue.value = options[0]?.value;
18915
- }
18916
- }
18917
- });
18918
- return (_ctx, _cache) => {
18919
- return openBlock(), createBlock(unref(Select), mergeProps({
18920
- modelValue: reModelValue.value,
18921
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
18922
- "input-value": unref(inputValue),
18923
- "onUpdate:inputValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
18924
- "popup-visible": unref(popupVisible),
18925
- "onUpdate:popupVisible": _cache[2] || (_cache[2] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : null)
18926
- }, reProps.value.selectOptions, {
18927
- options: unref(dictOptions),
18928
- loading: unref(dictLoading) || reProps.value.loading
18929
- }), createSlots({ _: 2 }, [
18930
- renderList(_ctx.$slots, (_, name) => {
18931
- return {
18932
- name,
18933
- fn: withCtx((slotProps) => [
18934
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
18935
- ])
18936
- };
18937
- })
18938
- ]), 1040, ["modelValue", "input-value", "popup-visible", "options", "loading"]);
18939
- };
18940
- }
18941
- });
18942
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
18943
- ...{
18944
- name: "QdDictRadioGroup"
18945
- },
18946
- __name: "radio-group",
18947
- props: /* @__PURE__ */ mergeDefaults({
18948
- dictType: {},
18949
- allowUncheck: { type: Boolean },
18950
- disabled: { type: Boolean },
18951
- name: {},
18952
- readonly: { type: Boolean },
18953
- size: {},
18954
- theme: {},
18955
- value: {},
18956
- defaultValue: {},
18957
- modelValue: {},
18958
- variant: {},
18959
- onChange: { type: Function }
18960
- }, qdDictRadioGroupProps),
18961
- emits: ["update:modelValue"],
18962
- setup(__props, { emit: __emit }) {
18963
- const vLoading = LoadingDirective;
18964
- const props = __props;
18965
- const emit = __emit;
18966
- const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
18967
- const dictType = toRef(props, "dictType");
18968
- const reProps = computed(() => {
18969
- const { modelValue: modelValue2, dictType: dictType2, ...radioOptions } = props;
18970
- return {
18971
- dictType: dictType2,
18972
- radioOptions,
18973
- models: {
18974
- modelValue: modelValue2
18975
- }
18405
+ const mergedTransformParams = (params) => {
18406
+ const merged = {
18407
+ ...params,
18408
+ ...searchData.value
18409
+ };
18410
+ if (transformParams) return transformParams(merged);
18411
+ return merged;
18976
18412
  };
18977
- });
18978
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
18979
- return (_ctx, _cache) => {
18980
- return withDirectives((openBlock(), createBlock(unref(RadioGroup), mergeProps({
18981
- modelValue: unref(modelValue),
18982
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
18983
- class: "qd-dict-radio-group"
18984
- }, reProps.value.radioOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
18985
- [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
18986
- ]);
18987
- };
18988
- }
18989
- });
18990
- const radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e97fb1f0"]]);
18991
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
18992
- ...{
18993
- name: "QdDictCheckboxGroup"
18994
- },
18995
- __name: "checkbox-group",
18996
- props: /* @__PURE__ */ mergeDefaults({
18997
- dictType: {},
18998
- convStr: { type: [Boolean, String] },
18999
- modelValue: {},
19000
- disabled: { type: Boolean },
19001
- lazyLoad: { type: Boolean },
19002
- max: {},
19003
- name: {},
19004
- readonly: { type: Boolean },
19005
- value: {},
19006
- defaultValue: {},
19007
- onChange: { type: Function }
19008
- }, qdDictCheckboxGroupProps),
19009
- emits: ["update:modelValue"],
19010
- setup(__props, { emit: __emit }) {
19011
- const vLoading = LoadingDirective;
19012
- const props = __props;
19013
- const emit = __emit;
19014
- const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19015
- const reModelValue = computed({
19016
- get: () => {
19017
- if (isEmpty(modelValue.value)) return [];
19018
- if (typeof modelValue.value === "string") {
19019
- const { convStr } = reProps.value;
19020
- return modelValue.value.split((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
19021
- }
19022
- return modelValue.value;
19023
- },
19024
- set: (val) => {
19025
- const { convStr } = reProps.value;
19026
- if (convStr) {
19027
- modelValue.value = val.join((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
18413
+ const reAdd = mergeAction({
18414
+ crudMode: "add",
18415
+ permiID: "add",
18416
+ content: t("addText"),
18417
+ icon: () => createVNode(AddIcon, null, null)
18418
+ }, add, form);
18419
+ const reActions = [reAdd, ...buildActions(actions, form)].filter(Boolean);
18420
+ const reEdit = mergeAction({
18421
+ crudMode: "edit",
18422
+ permiID: "edit",
18423
+ content: t("editText"),
18424
+ theme: "primary",
18425
+ hover: "color"
18426
+ }, edit, form);
18427
+ const reView = mergeAction({
18428
+ crudMode: "view",
18429
+ permiID: "query",
18430
+ content: t("viewText"),
18431
+ theme: "primary",
18432
+ hover: "color"
18433
+ }, view, form);
18434
+ const reDel = mergeAction({
18435
+ crudMode: "del",
18436
+ permiID: "remove",
18437
+ content: t("deleteText"),
18438
+ theme: "danger",
18439
+ hover: "color",
18440
+ selectType: "multiple"
18441
+ }, del, form);
18442
+ const reRowActions = [reEdit, reView, reDel, ...buildActions(rowActions, form)].filter(Boolean);
18443
+ let reSelectType = selectType;
18444
+ if (reDel?.selectType === "multiple") {
18445
+ if (!reSelectType) reSelectType = "multiple";
18446
+ const batchDel = mergeAction({
18447
+ crudMode: "del",
18448
+ permiID: "remove",
18449
+ content: t("deleteText"),
18450
+ theme: "danger",
18451
+ variant: "outline",
18452
+ selectType: "multiple"
18453
+ }, del, form);
18454
+ reActions.splice(reAdd ? 1 : 0, 0, batchDel);
18455
+ }
18456
+ const reColumns = columns || [];
18457
+ const operationLength = reRowActions.length;
18458
+ if (operationLength) {
18459
+ const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
18460
+ const defaultOperation = {
18461
+ title: t("operationText"),
18462
+ colKey: "operation",
18463
+ align: "center",
18464
+ fixed: "right",
18465
+ width: 28 * operationLength + 25 * operationLength - 1 + 32
18466
+ };
18467
+ if (operationIdx > -1) {
18468
+ reColumns[operationIdx] = {
18469
+ ...defaultOperation,
18470
+ ...reColumns[operationIdx]
18471
+ };
19028
18472
  } else {
19029
- modelValue.value = val;
18473
+ reColumns.push(defaultOperation);
19030
18474
  }
19031
18475
  }
19032
- });
19033
- const dictType = toRef(props, "dictType");
19034
- const reProps = computed(() => {
19035
- const { modelValue: modelValue2, dictType: dictType2, convStr, ...checkboxOptions } = props;
19036
18476
  return {
19037
- dictType: dictType2,
19038
- convStr,
19039
- checkboxOptions,
18477
+ title,
18478
+ searchOptions: search,
18479
+ serviceTableOptions: {
18480
+ ...serviceTableOptions,
18481
+ selectType: reSelectType,
18482
+ columns: reColumns,
18483
+ transformParams: mergedTransformParams
18484
+ },
18485
+ formOptions: form,
18486
+ detailOptions: detail,
18487
+ actions: reActions,
18488
+ rowActions: reRowActions,
19040
18489
  models: {
19041
- modelValue: modelValue2
19042
- }
19043
- };
19044
- });
19045
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19046
- return (_ctx, _cache) => {
19047
- return withDirectives((openBlock(), createBlock(unref(CheckboxGroup), mergeProps({
19048
- modelValue: reModelValue.value,
19049
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19050
- class: "qd-dict-checkbox-group"
19051
- }, reProps.value.checkboxOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19052
- [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19053
- ]);
19054
- };
19055
- }
19056
- });
19057
- const checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ef427474"]]);
19058
- const _hoisted_1 = { class: "qd-dict-tag" };
19059
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
19060
- ...{
19061
- name: "QdDictTag"
19062
- },
19063
- __name: "tag",
19064
- props: /* @__PURE__ */ mergeDefaults({
19065
- value: {},
19066
- strict: { type: Boolean },
19067
- separator: {},
19068
- options: {},
19069
- dictType: {},
19070
- size: {},
19071
- shape: {},
19072
- theme: {},
19073
- variant: {}
19074
- }, qdDictTagProps),
19075
- setup(__props) {
19076
- const props = __props;
19077
- const dictType = toRef(props, "dictType");
19078
- const reProps = computed(() => {
19079
- const { options, ...otherOptions } = props;
19080
- return {
19081
- ...otherOptions,
19082
- options: options || dictOptions.value || []
19083
- };
19084
- });
19085
- const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19086
- const reValue = computed(() => {
19087
- const { value, strict } = reProps.value;
19088
- if (isEmpty(value)) return [];
19089
- if (Array.isArray(value)) return value.map((item) => strict ? item : item.toString());
19090
- if (isNumber(value)) {
19091
- return strict ? [value] : [value.toString()];
19092
- }
19093
- return String(value).split(",");
19094
- });
19095
- const matchOptions = computed(() => {
19096
- const { options, strict } = reProps.value;
19097
- return options.filter((option) => {
19098
- return reValue.value.includes(strict ? option.value : option.value.toString());
19099
- });
19100
- });
19101
- return (_ctx, _cache) => {
19102
- const _directive_loading = resolveDirective("loading");
19103
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
19104
- (openBlock(true), createElementBlock(Fragment, null, renderList(matchOptions.value, (item, index2) => {
19105
- return openBlock(), createElementBlock(Fragment, null, [
19106
- (!reProps.value.theme || reProps.value.theme === "text") && !__props.variant && (item.theme === "text" || !item.theme) ? (openBlock(), createElementBlock("span", {
19107
- key: item.value,
19108
- class: normalizeClass(item.class)
19109
- }, [
19110
- renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19111
- renderSlot(_ctx.$slots, "default", { item }, () => [
19112
- createTextVNode(toDisplayString(item.label), 1)
19113
- ], true),
19114
- renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19115
- ], 2)) : (openBlock(), createBlock(unref(Tag), {
19116
- key: item.value + "",
19117
- index: index2,
19118
- size: reProps.value.size,
19119
- shape: reProps.value.shape,
19120
- theme: reProps.value.theme || item.theme || "default",
19121
- variant: reProps.value.variant || item.variant || "light",
19122
- class: normalizeClass(item.class)
19123
- }, {
19124
- default: withCtx(() => [
19125
- renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19126
- renderSlot(_ctx.$slots, "default", { item }, () => [
19127
- createTextVNode(toDisplayString(item.label), 1)
19128
- ], true),
19129
- renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19130
- ]),
19131
- _: 2
19132
- }, 1032, ["index", "size", "shape", "theme", "variant", "class"])),
19133
- (_ctx.$slots.separator || __props.separator) && matchOptions.value.length - 1 !== index2 ? renderSlot(_ctx.$slots, "separator", { key: 2 }, () => [
19134
- createTextVNode(toDisplayString(__props.separator), 1)
19135
- ], true) : createCommentVNode("", true)
19136
- ], 64);
19137
- }), 256))
19138
- ])), [
19139
- [_directive_loading, { loading: unref(dictLoading), size: "small" }]
19140
- ]);
19141
- };
19142
- }
19143
- });
19144
- const tag = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cab615cf"]]);
19145
- const qdUploadProps = {
19146
- modelValue: () => [],
19147
- files: () => [],
19148
- convStr: false,
19149
- valueMode: "ossId",
19150
- theme: "file",
19151
- draggable: void 0,
19152
- autoUpload: false,
19153
- allowUploadDuplicateFile: true,
19154
- isBatchUpload: false,
19155
- uploadAllFilesInOneRequest: false,
19156
- method: "POST",
19157
- multiple: void 0,
19158
- name: "file",
19159
- disabled: void 0,
19160
- showImageFileName: true,
19161
- showThumbnail: true,
19162
- showUploadProgress: true,
19163
- uploadPastedFiles: true,
19164
- useMockProgress: true,
19165
- withCredentials: false,
19166
- del: void 0
19167
- };
19168
- const qdUploadSizeLimit = {
19169
- unit: "MB"
19170
- };
19171
- function getDefaultExportFromCjs(x) {
19172
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
19173
- }
19174
- var dayjs_min$1 = { exports: {} };
19175
- var dayjs_min = dayjs_min$1.exports;
19176
- var hasRequiredDayjs_min;
19177
- function requireDayjs_min() {
19178
- if (hasRequiredDayjs_min) return dayjs_min$1.exports;
19179
- hasRequiredDayjs_min = 1;
19180
- (function(module2, exports2) {
19181
- !(function(t, e) {
19182
- module2.exports = e();
19183
- })(dayjs_min, (function() {
19184
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h2 = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
19185
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
19186
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
19187
- } }, m = function(t2, e2, n2) {
19188
- var r2 = String(t2);
19189
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
19190
- }, v = { s: m, z: function(t2) {
19191
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
19192
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
19193
- }, m: function t2(e2, n2) {
19194
- if (e2.date() < n2.date()) return -t2(n2, e2);
19195
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
19196
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
19197
- }, a: function(t2) {
19198
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
19199
- }, p: function(t2) {
19200
- return { M: c, y: h2, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
19201
- }, u: function(t2) {
19202
- return void 0 === t2;
19203
- } }, g = "en", D = {};
19204
- D[g] = M;
19205
- var p = "$isDayjsObject", S = function(t2) {
19206
- return t2 instanceof _ || !(!t2 || !t2[p]);
19207
- }, w = function t2(e2, n2, r2) {
19208
- var i2;
19209
- if (!e2) return g;
19210
- if ("string" == typeof e2) {
19211
- var s2 = e2.toLowerCase();
19212
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
19213
- var u2 = e2.split("-");
19214
- if (!i2 && u2.length > 1) return t2(u2[0]);
19215
- } else {
19216
- var a2 = e2.name;
19217
- D[a2] = e2, i2 = a2;
18490
+ data: data2,
18491
+ searchData: inSearchData,
18492
+ selectedRowKeys: selectedRowKeys2,
18493
+ activeRowKeys: activeRowKeys2,
18494
+ columnControllerVisible: columnControllerVisible2,
18495
+ displayColumns: displayColumns2,
18496
+ expandedRowKeys: expandedRowKeys2,
18497
+ filterValue: filterValue2,
18498
+ sort: sort2,
18499
+ expandedTreeNodes: expandedTreeNodes2
19218
18500
  }
19219
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
19220
- }, O = function(t2, e2) {
19221
- if (S(t2)) return t2.clone();
19222
- var n2 = "object" == typeof e2 ? e2 : {};
19223
- return n2.date = t2, n2.args = arguments, new _(n2);
19224
- }, b = v;
19225
- b.l = w, b.i = S, b.w = function(t2, e2) {
19226
- return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
19227
18501
  };
19228
- var _ = (function() {
19229
- function M2(t2) {
19230
- this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
19231
- }
19232
- var m2 = M2.prototype;
19233
- return m2.parse = function(t2) {
19234
- this.$d = (function(t3) {
19235
- var e2 = t3.date, n2 = t3.utc;
19236
- if (null === e2) return /* @__PURE__ */ new Date(NaN);
19237
- if (b.u(e2)) return /* @__PURE__ */ new Date();
19238
- if (e2 instanceof Date) return new Date(e2);
19239
- if ("string" == typeof e2 && !/Z$/i.test(e2)) {
19240
- var r2 = e2.match($);
19241
- if (r2) {
19242
- var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
19243
- return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
19244
- }
18502
+ });
18503
+ const tableRef = useTemplateRef("table");
18504
+ const searchVisible = ref(true);
18505
+ const searchRef = useTemplateRef("search");
18506
+ let searchMode = "refresh";
18507
+ function handleSearch() {
18508
+ searchMode = "changeCurrent";
18509
+ }
18510
+ function handleResetSearch() {
18511
+ searchMode = "changeCurrent";
18512
+ searchRef.value?.reset();
18513
+ searchRef.value?.submit();
18514
+ }
18515
+ function triggerSearch({
18516
+ validateResult
18517
+ }) {
18518
+ if (validateResult !== true) return;
18519
+ switch (searchMode) {
18520
+ case "changeCurrent":
18521
+ tableRef.value?.changeCurrent(1);
18522
+ break;
18523
+ default:
18524
+ tableRef.value?.refresh();
18525
+ break;
18526
+ }
18527
+ }
18528
+ function handleRefresh() {
18529
+ searchMode = "refresh";
18530
+ handleSearch();
18531
+ }
18532
+ function toggleSearchVisible() {
18533
+ searchVisible.value = !searchVisible.value;
18534
+ }
18535
+ function toggleTreeExpandAll() {
18536
+ if (treeIsExpand.value) tableRef.value?.foldAll();
18537
+ else tableRef.value?.expandAll();
18538
+ }
18539
+ function openColumnController() {
18540
+ columnControllerVisible.value = true;
18541
+ }
18542
+ function buildActions(actions, crudForm) {
18543
+ if (!actions) return [];
18544
+ return actions.map((item) => mergeAction({
18545
+ variant: "outline",
18546
+ theme: "primary",
18547
+ hover: "color"
18548
+ }, item, crudForm));
18549
+ }
18550
+ function mergeAction(defaultOptions, currentOptions, crudForm) {
18551
+ if (currentOptions === false || !currentOptions) return;
18552
+ const mergeOptions = merge(defaultOptions, currentOptions);
18553
+ mergeOptions.permi = buildActionPermi(mergeOptions);
18554
+ if (mergeOptions.crudMode !== "del") {
18555
+ mergeOptions.form = buildActionForm(mergeOptions, crudForm);
18556
+ }
18557
+ return mergeOptions;
18558
+ }
18559
+ function getConfigRendererCtx(self2, other) {
18560
+ return {
18561
+ tableData: data.value,
18562
+ searchData: searchData.value,
18563
+ selectedRowKeys: selectedRowKeys.value,
18564
+ activeRowKeys: activeRowKeys.value,
18565
+ self: self2,
18566
+ ...other
18567
+ };
18568
+ }
18569
+ function actionIsCRU(crudMode) {
18570
+ return crudMode && ["add", "edit", "view"].includes(crudMode);
18571
+ }
18572
+ function buildActionPermi(action) {
18573
+ if (action.permi) return action.permi;
18574
+ if (!props.permiPrefix || !action.permiID) return [];
18575
+ return [`${props.permiPrefix}.${action.permiID}`];
18576
+ }
18577
+ function buildActionForm(action, crudForm) {
18578
+ const IsCRU = actionIsCRU(action.crudMode);
18579
+ if (!action.form && IsCRU) {
18580
+ action.form = cloneDeep(crudForm);
18581
+ }
18582
+ const {
18583
+ form
18584
+ } = action;
18585
+ if (form) {
18586
+ if (action.crudMode === "view") form.readonly = true;
18587
+ if (!form.onSubmit && IsCRU) {
18588
+ form.onSubmit = async (context) => {
18589
+ const {
18590
+ uid,
18591
+ service,
18592
+ transformParams,
18593
+ transformRes,
18594
+ crudMode
18595
+ } = action;
18596
+ if (context.validateResult !== true || !service || !uid || !dialogFormMap[uid]) return false;
18597
+ let currentParams = easyCopy(context.formData);
18598
+ if (transformParams) {
18599
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(currentParams));
18600
+ if (tpErr) throw tpErr;
18601
+ currentParams = tpRes;
19245
18602
  }
19246
- return new Date(e2);
19247
- })(t2), this.init();
19248
- }, m2.init = function() {
19249
- var t2 = this.$d;
19250
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
19251
- }, m2.$utils = function() {
19252
- return b;
19253
- }, m2.isValid = function() {
19254
- return !(this.$d.toString() === l);
19255
- }, m2.isSame = function(t2, e2) {
19256
- var n2 = O(t2);
19257
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
19258
- }, m2.isAfter = function(t2, e2) {
19259
- return O(t2) < this.startOf(e2);
19260
- }, m2.isBefore = function(t2, e2) {
19261
- return this.endOf(e2) < O(t2);
19262
- }, m2.$g = function(t2, e2, n2) {
19263
- return b.u(t2) ? this[e2] : this.set(n2, t2);
19264
- }, m2.unix = function() {
19265
- return Math.floor(this.valueOf() / 1e3);
19266
- }, m2.valueOf = function() {
19267
- return this.$d.getTime();
19268
- }, m2.startOf = function(t2, e2) {
19269
- var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
19270
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
19271
- return r2 ? i2 : i2.endOf(a);
19272
- }, $2 = function(t3, e3) {
19273
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
19274
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
19275
- switch (f2) {
19276
- case h2:
19277
- return r2 ? l2(1, 0) : l2(31, 11);
19278
- case c:
19279
- return r2 ? l2(1, M3) : l2(0, M3 + 1);
19280
- case o:
19281
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
19282
- return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
19283
- case a:
19284
- case d:
19285
- return $2(v2 + "Hours", 0);
19286
- case u:
19287
- return $2(v2 + "Minutes", 1);
19288
- case s:
19289
- return $2(v2 + "Seconds", 2);
19290
- case i:
19291
- return $2(v2 + "Milliseconds", 3);
19292
- default:
19293
- return this.clone();
18603
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18604
+ if (serviceErr) throw serviceErr;
18605
+ let res;
18606
+ if (transformRes) {
18607
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18608
+ if (trErr) throw trErr;
18609
+ res = trRes;
18610
+ } else {
18611
+ res = serviceRes;
18612
+ }
18613
+ if (typeof res === "boolean") {
18614
+ res = {
18615
+ success: res,
18616
+ message: ""
18617
+ };
18618
+ }
18619
+ if (!res) {
18620
+ res = {
18621
+ success: true,
18622
+ message: ""
18623
+ };
18624
+ }
18625
+ const message = res.message;
18626
+ if (res.success === false) {
18627
+ if (message) msgError(message);
18628
+ return false;
18629
+ }
18630
+ msgSuccess(message || t("operationSuccessText"));
18631
+ if (crudMode === "add") {
18632
+ tableRef.value?.changeCurrent(1);
18633
+ } else {
18634
+ tableRef.value?.refresh();
18635
+ }
18636
+ };
18637
+ }
18638
+ const {
18639
+ title
18640
+ } = props;
18641
+ form.wrapper = merge({}, {
18642
+ header: `${action.content}${title ? ` ${title}` : ""}`
18643
+ }, form.wrapper);
18644
+ }
18645
+ return action.form;
18646
+ }
18647
+ function buildActionOnClick(action, originalParams) {
18648
+ if (action.onClick) return action.onClick;
18649
+ if (action.crudMode === "del") {
18650
+ const onClick2 = async () => {
18651
+ const {
18652
+ service,
18653
+ transformParams,
18654
+ transformRes
18655
+ } = action;
18656
+ const row = originalParams?.row;
18657
+ if (!service || !row && action.selectType !== "multiple" || !row && !selectedRowKeys.value.length && action.selectType === "multiple") {
18658
+ return;
18659
+ }
18660
+ const childrenKey = reProps.value.serviceTableOptions.tree?.childrenKey || qdServiceTableTreeConfig.childrenKey;
18661
+ let delHasChild = false;
18662
+ if (!row) {
18663
+ const rowKey = reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey;
18664
+ delHasChild = selectedRowKeys.value.some((item) => {
18665
+ const data2 = tableRef.value?.getData(item);
18666
+ if (!data2) return false;
18667
+ const children = data2.row[childrenKey];
18668
+ if (isEmpty(children)) return false;
18669
+ if (children === true) return true;
18670
+ return children.some((child) => !selectedRowKeys.value.includes(child[rowKey]));
18671
+ });
18672
+ } else if (!isEmpty(row[childrenKey])) {
18673
+ delHasChild = true;
18674
+ }
18675
+ if (delHasChild) {
18676
+ alertWarning(t("deleteHasChildrenText"));
18677
+ return;
19294
18678
  }
19295
- }, m2.endOf = function(t2) {
19296
- return this.startOf(t2, false);
19297
- }, m2.$set = function(t2, e2) {
19298
- var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h2] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
19299
- if (o2 === c || o2 === h2) {
19300
- var y2 = this.clone().set(d, 1);
19301
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
19302
- } else l2 && this.$d[l2]($2);
19303
- return this.init(), this;
19304
- }, m2.set = function(t2, e2) {
19305
- return this.clone().$set(t2, e2);
19306
- }, m2.get = function(t2) {
19307
- return this[b.p(t2)]();
19308
- }, m2.add = function(r2, f2) {
19309
- var d2, l2 = this;
19310
- r2 = Number(r2);
19311
- var $2 = b.p(f2), y2 = function(t2) {
19312
- var e2 = O(l2);
19313
- return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
19314
- };
19315
- if ($2 === c) return this.set(c, this.$M + r2);
19316
- if ($2 === h2) return this.set(h2, this.$y + r2);
19317
- if ($2 === a) return y2(1);
19318
- if ($2 === o) return y2(7);
19319
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
19320
- return b.w(m3, this);
19321
- }, m2.subtract = function(t2, e2) {
19322
- return this.add(-1 * t2, e2);
19323
- }, m2.format = function(t2) {
19324
- var e2 = this, n2 = this.$locale();
19325
- if (!this.isValid()) return n2.invalidDate || l;
19326
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h3 = function(t3, n3, i3, s3) {
19327
- return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
19328
- }, d2 = function(t3) {
19329
- return b.s(s2 % 12 || 12, t3, "0");
19330
- }, $2 = f2 || function(t3, e3, n3) {
19331
- var r3 = t3 < 12 ? "AM" : "PM";
19332
- return n3 ? r3.toLowerCase() : r3;
18679
+ confirm({
18680
+ body: t("deleteWrapperBodyText"),
18681
+ ...action.wrapper
18682
+ }, async () => {
18683
+ const params = row || selectedRowKeys.value;
18684
+ let currentParams = row ? params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey] : selectedRowKeys.value;
18685
+ if (transformParams) {
18686
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18687
+ if (tpErr) throw tpErr;
18688
+ currentParams = tpRes;
18689
+ }
18690
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18691
+ if (serviceErr) throw serviceErr;
18692
+ let res;
18693
+ if (transformRes) {
18694
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18695
+ if (trErr) throw trErr;
18696
+ res = trRes;
18697
+ } else {
18698
+ res = serviceRes;
18699
+ }
18700
+ if (typeof res === "boolean") {
18701
+ res = {
18702
+ success: res,
18703
+ message: ""
18704
+ };
18705
+ }
18706
+ if (!res) {
18707
+ res = {
18708
+ success: true,
18709
+ message: ""
18710
+ };
18711
+ }
18712
+ const message = res.message;
18713
+ if (res.success === false) {
18714
+ if (message) msgError(message);
18715
+ return false;
18716
+ }
18717
+ msgSuccess(message || t("deleteSuccessText"));
18718
+ if (!row) selectedRowKeys.value = [];
18719
+ tableRef.value?.refresh();
18720
+ return true;
18721
+ });
18722
+ };
18723
+ return onClick2;
18724
+ }
18725
+ if (isEmpty(action.form) || !actionIsCRU(action.crudMode)) return;
18726
+ const onClick = async () => {
18727
+ if (!action.uid) action.uid = generateRandomString(16);
18728
+ const uid = action.uid;
18729
+ const form = shallowRef(action.form);
18730
+ if (!dialogFormMap[uid]) {
18731
+ dialogFormMap[uid] = {
18732
+ visible: false,
18733
+ data: {},
18734
+ crudMode: action.crudMode,
18735
+ form
19333
18736
  };
19334
- return r2.replace(y, (function(t3, r3) {
19335
- return r3 || (function(t4) {
19336
- switch (t4) {
19337
- case "YY":
19338
- return String(e2.$y).slice(-2);
19339
- case "YYYY":
19340
- return b.s(e2.$y, 4, "0");
19341
- case "M":
19342
- return a2 + 1;
19343
- case "MM":
19344
- return b.s(a2 + 1, 2, "0");
19345
- case "MMM":
19346
- return h3(n2.monthsShort, a2, c2, 3);
19347
- case "MMMM":
19348
- return h3(c2, a2);
19349
- case "D":
19350
- return e2.$D;
19351
- case "DD":
19352
- return b.s(e2.$D, 2, "0");
19353
- case "d":
19354
- return String(e2.$W);
19355
- case "dd":
19356
- return h3(n2.weekdaysMin, e2.$W, o2, 2);
19357
- case "ddd":
19358
- return h3(n2.weekdaysShort, e2.$W, o2, 3);
19359
- case "dddd":
19360
- return o2[e2.$W];
19361
- case "H":
19362
- return String(s2);
19363
- case "HH":
19364
- return b.s(s2, 2, "0");
19365
- case "h":
19366
- return d2(1);
19367
- case "hh":
19368
- return d2(2);
19369
- case "a":
19370
- return $2(s2, u2, true);
19371
- case "A":
19372
- return $2(s2, u2, false);
19373
- case "m":
19374
- return String(u2);
19375
- case "mm":
19376
- return b.s(u2, 2, "0");
19377
- case "s":
19378
- return String(e2.$s);
19379
- case "ss":
19380
- return b.s(e2.$s, 2, "0");
19381
- case "SSS":
19382
- return b.s(e2.$ms, 3, "0");
19383
- case "Z":
19384
- return i2;
18737
+ }
18738
+ await nextTick();
18739
+ dialogFormMap[uid].visible = true;
18740
+ if (!action.crudMode || !["edit", "view"].includes(action.crudMode) || !originalParams) {
18741
+ return;
18742
+ }
18743
+ form.value.loading = true;
18744
+ triggerRef(form);
18745
+ const [err, res] = await to(getDetail(originalParams.row));
18746
+ form.value.loading = false;
18747
+ triggerRef(form);
18748
+ if (err) {
18749
+ dialogFormMap[uid].data = originalParams.row;
18750
+ return;
18751
+ }
18752
+ dialogFormMap[uid].data = res;
18753
+ };
18754
+ return onClick;
18755
+ }
18756
+ function buildActionDisabled(action) {
18757
+ if (action.disabled) return action.disabled;
18758
+ switch (action.selectType) {
18759
+ case "single":
18760
+ return selectedRowKeys.value.length !== 1;
18761
+ case "multiple":
18762
+ return selectedRowKeys.value.length === 0;
18763
+ default:
18764
+ return false;
18765
+ }
18766
+ }
18767
+ async function getDetail(params) {
18768
+ const {
18769
+ detailOptions
18770
+ } = reProps.value;
18771
+ if (!detailOptions) return easyCopy(params);
18772
+ const {
18773
+ service,
18774
+ transformParams,
18775
+ transformRes
18776
+ } = detailOptions;
18777
+ if (!service) return easyCopy(params);
18778
+ let currentParams = params[reProps.value.serviceTableOptions.rowKey || qdCrudTableProps.rowKey];
18779
+ if (transformParams) {
18780
+ const [tpErr, tpRes] = await suspectedWrapperPromise(transformParams(easyCopy(params)));
18781
+ if (tpErr) throw tpErr;
18782
+ currentParams = tpRes;
18783
+ }
18784
+ const [serviceErr, serviceRes] = await suspectedWrapperPromise(service(currentParams));
18785
+ if (serviceErr) throw serviceErr;
18786
+ let res;
18787
+ if (transformRes) {
18788
+ const [trErr, trRes] = await suspectedWrapperPromise(transformRes(serviceRes));
18789
+ if (trErr) throw trErr;
18790
+ res = trRes;
18791
+ } else {
18792
+ res = serviceRes;
18793
+ }
18794
+ return res;
18795
+ }
18796
+ const expose = {};
18797
+ onMounted(() => {
18798
+ Object.assign(expose, tableRef.value);
18799
+ });
18800
+ __expose(expose);
18801
+ return (_ctx, _cache) => {
18802
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [reProps.value.searchOptions?.items?.length ? withDirectives((openBlock(), createBlock(QdCrudSearch, mergeProps({
18803
+ key: 0,
18804
+ ref: "search",
18805
+ data: unref(searchData),
18806
+ "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null),
18807
+ class: [!searchVisible.value ? "qd-crud-search--hide" : ""]
18808
+ }, reProps.value.searchOptions, {
18809
+ "on-submit": triggerSearch
18810
+ }), {
18811
+ footer: withCtx(() => [createVNode(unref(Space), {
18812
+ align: "center",
18813
+ size: "small"
18814
+ }, {
18815
+ default: withCtx(() => [createVNode(unref(Button), {
18816
+ type: "submit",
18817
+ onClick: handleSearch
18818
+ }, {
18819
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
18820
+ _: 1
18821
+ }), createVNode(unref(Button), {
18822
+ variant: "outline",
18823
+ onClick: handleResetSearch
18824
+ }, {
18825
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
18826
+ _: 1
18827
+ })]),
18828
+ _: 1
18829
+ })]),
18830
+ _: 1
18831
+ }, 16, ["data", "class"])), [[vShow, searchVisible.value]]) : createCommentVNode("", true), createVNode(unref(_sfc_main$i), {
18832
+ class: "qd-crud-table__body"
18833
+ }, {
18834
+ default: withCtx(() => [createElementVNode("div", _hoisted_2$1, [createVNode(unref(Space), {
18835
+ align: "center",
18836
+ size: "small"
18837
+ }, {
18838
+ default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.actions, (item, index2) => {
18839
+ return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18840
+ key: item.uid || index2,
18841
+ context: getConfigRendererCtx(item),
18842
+ config: {
18843
+ is: unref(Button),
18844
+ ...item,
18845
+ form: void 0,
18846
+ onClick: buildActionOnClick(item),
18847
+ disabled: buildActionDisabled(item)
19385
18848
  }
19386
- return null;
19387
- })(t3) || i2.replace(":", "");
19388
- }));
19389
- }, m2.utcOffset = function() {
19390
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
19391
- }, m2.diff = function(r2, d2, l2) {
19392
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
19393
- return b.m(y2, m3);
18849
+ }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18850
+ }), 128))], true)]),
18851
+ _: 3
18852
+ }), createVNode(unref(Space), {
18853
+ align: "center",
18854
+ size: "small"
18855
+ }, {
18856
+ default: withCtx(() => [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(unref(Tooltip), {
18857
+ key: 0,
18858
+ content: searchVisible.value ? unref(t)("collapseSearchText") : unref(t)("expandSearchText")
18859
+ }, {
18860
+ default: withCtx(() => [createVNode(unref(Button), {
18861
+ variant: "text",
18862
+ shape: "square",
18863
+ onClick: toggleSearchVisible
18864
+ }, {
18865
+ icon: withCtx(() => [createVNode(unref(SearchIcon))]),
18866
+ _: 1
18867
+ })]),
18868
+ _: 1
18869
+ }, 8, ["content"])) : createCommentVNode("", true), createVNode(unref(Tooltip), {
18870
+ content: unref(t)("refreshText")
18871
+ }, {
18872
+ default: withCtx(() => [createVNode(unref(Button), {
18873
+ variant: "text",
18874
+ shape: "square",
18875
+ onClick: handleRefresh
18876
+ }, {
18877
+ icon: withCtx(() => [createVNode(unref(RefreshIcon))]),
18878
+ _: 1
18879
+ })]),
18880
+ _: 1
18881
+ }, 8, ["content"]), !unref(isEmpty)(reProps.value.serviceTableOptions.tree) && !reProps.value.serviceTableOptions.tree.lazyLoad ? (openBlock(), createBlock(unref(Tooltip), {
18882
+ key: 1,
18883
+ content: treeIsExpand.value ? unref(t)("collapseTreeText") : unref(t)("expandTreeText")
18884
+ }, {
18885
+ default: withCtx(() => [createVNode(unref(Button), {
18886
+ variant: "text",
18887
+ shape: "square",
18888
+ onClick: toggleTreeExpandAll
18889
+ }, {
18890
+ icon: withCtx(() => [treeIsExpand.value ? (openBlock(), createBlock(unref(UnfoldLessIcon), {
18891
+ key: 0
18892
+ })) : (openBlock(), createBlock(unref(UnfoldMoreIcon), {
18893
+ key: 1
18894
+ }))]),
18895
+ _: 1
18896
+ })]),
18897
+ _: 1
18898
+ }, 8, ["content"])) : createCommentVNode("", true), reProps.value.serviceTableOptions.columnController?.hideTriggerButton !== true ? (openBlock(), createBlock(unref(Tooltip), {
18899
+ key: 2,
18900
+ content: unref(t)("columnControllerText")
18901
+ }, {
18902
+ default: withCtx(() => [createVNode(unref(Button), {
18903
+ variant: "text",
18904
+ shape: "square",
18905
+ onClick: openColumnController
18906
+ }, {
18907
+ icon: withCtx(() => [createVNode(unref(SettingIcon))]),
18908
+ _: 1
18909
+ })]),
18910
+ _: 1
18911
+ }, 8, ["content"])) : createCommentVNode("", true)]),
18912
+ _: 1
18913
+ })]), createVNode(unref(QdServiceTable), mergeProps({
18914
+ ref: "table",
18915
+ data: unref(data),
18916
+ "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
18917
+ "selected-row-keys": unref(selectedRowKeys),
18918
+ "onUpdate:selectedRowKeys": _cache[3] || (_cache[3] = ($event) => isRef(selectedRowKeys) ? selectedRowKeys.value = $event : null),
18919
+ "active-row-keys": unref(activeRowKeys),
18920
+ "onUpdate:activeRowKeys": _cache[4] || (_cache[4] = ($event) => isRef(activeRowKeys) ? activeRowKeys.value = $event : null),
18921
+ "column-controller-visible": unref(columnControllerVisible),
18922
+ "onUpdate:columnControllerVisible": _cache[5] || (_cache[5] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
18923
+ "display-columns": unref(displayColumns),
18924
+ "onUpdate:displayColumns": _cache[6] || (_cache[6] = ($event) => isRef(displayColumns) ? displayColumns.value = $event : null),
18925
+ "expanded-row-keys": unref(expandedRowKeys),
18926
+ "onUpdate:expandedRowKeys": _cache[7] || (_cache[7] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
18927
+ "filter-value": unref(filterValue),
18928
+ "onUpdate:filterValue": _cache[8] || (_cache[8] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
18929
+ sort: unref(sort),
18930
+ "onUpdate:sort": _cache[9] || (_cache[9] = ($event) => isRef(sort) ? sort.value = $event : null),
18931
+ "expanded-tree-nodes": unref(expandedTreeNodes),
18932
+ "onUpdate:expandedTreeNodes": _cache[10] || (_cache[10] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null)
18933
+ }, reProps.value.serviceTableOptions), createSlots({
18934
+ operation: withCtx((slotProps) => [renderSlot(_ctx.$slots, "table-operation", normalizeProps(guardReactiveProps(slotProps)), () => [reProps.value.rowActions?.length ? (openBlock(), createBlock(unref(Space), {
18935
+ key: 0,
18936
+ align: "center",
18937
+ size: 0,
18938
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
18939
+ }, ["stop"]))
18940
+ }, {
18941
+ separator: withCtx(() => [createVNode(unref(Divider), {
18942
+ layout: "vertical"
18943
+ })]),
18944
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.rowActions, (item, index2) => {
18945
+ return withDirectives((openBlock(), createBlock(unref(_sfc_main$h), {
18946
+ key: item.uid || index2,
18947
+ context: getConfigRendererCtx(item, slotProps),
18948
+ config: {
18949
+ is: unref(Link),
18950
+ ...item,
18951
+ onClick: buildActionOnClick(item, slotProps)
18952
+ }
18953
+ }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18954
+ }), 128))]),
18955
+ _: 2
18956
+ }, 1024)) : createCommentVNode("", true)], true)]),
18957
+ _: 2
18958
+ }, [renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "table"), (item) => {
18959
+ return {
18960
+ name: item.filterName,
18961
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
19394
18962
  };
19395
- switch (M3) {
19396
- case h2:
19397
- $2 = D2() / 12;
19398
- break;
19399
- case c:
19400
- $2 = D2();
19401
- break;
19402
- case f:
19403
- $2 = D2() / 3;
19404
- break;
19405
- case o:
19406
- $2 = (g2 - v2) / 6048e5;
19407
- break;
19408
- case a:
19409
- $2 = (g2 - v2) / 864e5;
19410
- break;
19411
- case u:
19412
- $2 = g2 / n;
19413
- break;
19414
- case s:
19415
- $2 = g2 / e;
19416
- break;
19417
- case i:
19418
- $2 = g2 / t;
19419
- break;
19420
- default:
19421
- $2 = g2;
19422
- }
19423
- return l2 ? $2 : b.a($2);
19424
- }, m2.daysInMonth = function() {
19425
- return this.endOf(c).$D;
19426
- }, m2.$locale = function() {
19427
- return D[this.$L];
19428
- }, m2.locale = function(t2, e2) {
19429
- if (!t2) return this.$L;
19430
- var n2 = this.clone(), r2 = w(t2, e2, true);
19431
- return r2 && (n2.$L = r2), n2;
19432
- }, m2.clone = function() {
19433
- return b.w(this.$d, this);
19434
- }, m2.toDate = function() {
19435
- return new Date(this.valueOf());
19436
- }, m2.toJSON = function() {
19437
- return this.isValid() ? this.toISOString() : null;
19438
- }, m2.toISOString = function() {
19439
- return this.$d.toISOString();
19440
- }, m2.toString = function() {
19441
- return this.$d.toUTCString();
19442
- }, M2;
19443
- })(), k = _.prototype;
19444
- return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h2], ["$D", d]].forEach((function(t2) {
19445
- k[t2[1]] = function(e2) {
19446
- return this.$g(e2, t2[0], t2[1]);
18963
+ })]), 1040, ["data", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes"])]),
18964
+ _: 3
18965
+ }), (openBlock(true), createElementBlock(Fragment, null, renderList(dialogFormMap, (dialogForm, uid) => {
18966
+ return openBlock(), createBlock(unref(_sfc_main$h), {
18967
+ key: uid,
18968
+ config: {
18969
+ is: unref(_sfc_main$8),
18970
+ ...dialogForm.form,
18971
+ vModelVisible: "self.visible",
18972
+ vModelData: "self.data",
18973
+ crudMode: dialogForm.crudMode
18974
+ },
18975
+ context: getConfigRendererCtx(dialogForm)
18976
+ }, null, 8, ["config", "context"]);
18977
+ }), 128))]);
18978
+ };
18979
+ }
18980
+ });
18981
+ const table = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-bdb9c97a"]]);
18982
+ const _hoisted_1$1 = {
18983
+ key: 0,
18984
+ class: "qd-crud-list__header"
18985
+ };
18986
+ const _hoisted_2 = {
18987
+ key: 1,
18988
+ class: "qd-crud-list__toolbar"
18989
+ };
18990
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
18991
+ __name: "list",
18992
+ props: /* @__PURE__ */ mergeDefaults({
18993
+ search: {},
18994
+ searchData: {},
18995
+ data: {},
18996
+ loading: {
18997
+ type: Boolean
18998
+ },
18999
+ loadingProps: {},
19000
+ scroll: {},
19001
+ asyncLoading: {},
19002
+ footer: {},
19003
+ header: {},
19004
+ layout: {},
19005
+ size: {},
19006
+ split: {
19007
+ type: Boolean
19008
+ },
19009
+ stripe: {
19010
+ type: Boolean
19011
+ },
19012
+ onBefore: {
19013
+ type: Function
19014
+ },
19015
+ onAfter: {
19016
+ type: Function
19017
+ },
19018
+ onSuccess: {
19019
+ type: Function
19020
+ },
19021
+ onError: {
19022
+ type: Function
19023
+ },
19024
+ service: {
19025
+ type: Function
19026
+ },
19027
+ manual: {
19028
+ type: Boolean
19029
+ },
19030
+ transformParams: {
19031
+ type: Function
19032
+ },
19033
+ transformRes: {
19034
+ type: Function
19035
+ },
19036
+ pagination: {}
19037
+ }, qdCrudListProps),
19038
+ emits: ["update:searchData", "update:data"],
19039
+ setup(__props, {
19040
+ expose: __expose,
19041
+ emit: __emit
19042
+ }) {
19043
+ const props = __props;
19044
+ const emit = __emit;
19045
+ const {
19046
+ data,
19047
+ searchData
19048
+ } = /* @__PURE__ */ useVModels(props, emit, {
19049
+ passive: true
19050
+ });
19051
+ const {
19052
+ t
19053
+ } = useConfig("crud");
19054
+ const reProps = computed(() => {
19055
+ const {
19056
+ data: data2,
19057
+ searchData: inSearchData,
19058
+ search,
19059
+ transformParams,
19060
+ ...serviceListOptions
19061
+ } = props;
19062
+ const mergedTransformParams = (params) => {
19063
+ const merged = {
19064
+ ...params,
19065
+ ...searchData.value
19447
19066
  };
19448
- })), O.extend = function(t2, e2) {
19449
- return t2.$i || (t2(e2, _, O), t2.$i = true), O;
19450
- }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
19451
- return O(1e3 * t2);
19452
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
19453
- }));
19454
- })(dayjs_min$1);
19455
- return dayjs_min$1.exports;
19067
+ if (transformParams) return transformParams(merged);
19068
+ return merged;
19069
+ };
19070
+ return {
19071
+ searchOptions: search,
19072
+ serviceListOptions: {
19073
+ ...serviceListOptions,
19074
+ transformParams: mergedTransformParams
19075
+ },
19076
+ models: {
19077
+ data: data2,
19078
+ searchData: inSearchData
19079
+ }
19080
+ };
19081
+ });
19082
+ const searchRef = useTemplateRef("search");
19083
+ const listRef = useTemplateRef("list");
19084
+ function handleSearch() {
19085
+ }
19086
+ function handleResetSearch() {
19087
+ searchRef.value?.reset();
19088
+ searchRef.value?.submit();
19089
+ }
19090
+ function triggerSearch({
19091
+ validateResult
19092
+ }) {
19093
+ if (validateResult !== true) return;
19094
+ listRef.value?.refresh();
19095
+ }
19096
+ const expose = {};
19097
+ onMounted(() => {
19098
+ Object.assign(expose, listRef.value);
19099
+ });
19100
+ __expose(expose);
19101
+ return (_ctx, _cache) => {
19102
+ return openBlock(), createElementBlock("div", {
19103
+ class: normalizeClass(["qd-crud-list", reProps.value.serviceListOptions.scroll?.target ? "qd-crud-list--has-scroll-target" : ""])
19104
+ }, [reProps.value.searchOptions?.items?.length || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_1$1, [reProps.value.searchOptions?.items?.length ? (openBlock(), createBlock(QdCrudSearch, mergeProps({
19105
+ key: 0,
19106
+ ref: "search",
19107
+ data: unref(searchData),
19108
+ "onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(searchData) ? searchData.value = $event : null)
19109
+ }, reProps.value.searchOptions, {
19110
+ "on-submit": triggerSearch
19111
+ }), {
19112
+ footer: withCtx(() => [createVNode(unref(Space), {
19113
+ align: "center",
19114
+ size: "small"
19115
+ }, {
19116
+ default: withCtx(() => [createVNode(unref(Button), {
19117
+ type: "submit",
19118
+ onClick: handleSearch
19119
+ }, {
19120
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("searchText")), 1)]),
19121
+ _: 1
19122
+ }), createVNode(unref(Button), {
19123
+ variant: "outline",
19124
+ onClick: handleResetSearch
19125
+ }, {
19126
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("resetText")), 1)]),
19127
+ _: 1
19128
+ })]),
19129
+ _: 1
19130
+ })]),
19131
+ _: 1
19132
+ }, 16, ["data"])) : createCommentVNode("", true), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Space), {
19133
+ align: "center",
19134
+ size: "small"
19135
+ }, {
19136
+ default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, void 0, true)]),
19137
+ _: 3
19138
+ })])) : createCommentVNode("", true)])) : createCommentVNode("", true), createVNode(unref(QdServiceList), mergeProps({
19139
+ ref: "list",
19140
+ data: unref(data),
19141
+ "onUpdate:data": _cache[1] || (_cache[1] = ($event) => isRef(data) ? data.value = $event : null)
19142
+ }, reProps.value.serviceListOptions), createSlots({
19143
+ _: 2
19144
+ }, [_ctx.$slots.default ? {
19145
+ name: "default",
19146
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)), void 0, true)]),
19147
+ key: "0"
19148
+ } : void 0, renderList(unref(extractSlotsWithPrefix)(_ctx.$slots, "list"), (item) => {
19149
+ return {
19150
+ name: item.filterName,
19151
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, item.originalName, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
19152
+ };
19153
+ })]), 1040, ["data"])], 2);
19154
+ };
19155
+ }
19156
+ });
19157
+ const list = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c15e270f"]]);
19158
+ function defineQdCrudTable(config) {
19159
+ return config;
19456
19160
  }
19457
- var dayjs_minExports = requireDayjs_min();
19458
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
19161
+ function defineQdCrudList(config) {
19162
+ return config;
19163
+ }
19164
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19165
+ ...{
19166
+ name: "QdDictSelect"
19167
+ },
19168
+ __name: "select",
19169
+ props: /* @__PURE__ */ mergeDefaults({
19170
+ dictType: {},
19171
+ defaultSelectFirst: { type: Boolean },
19172
+ convStr: { type: [Boolean, String] },
19173
+ autoWidth: { type: Boolean },
19174
+ autofocus: { type: Boolean },
19175
+ borderless: { type: Boolean },
19176
+ clearable: { type: Boolean },
19177
+ collapsedItems: {},
19178
+ creatable: { type: Boolean },
19179
+ disabled: { type: Boolean },
19180
+ empty: {},
19181
+ filter: { type: Function },
19182
+ filterable: { type: Boolean },
19183
+ inputProps: {},
19184
+ inputValue: {},
19185
+ defaultInputValue: {},
19186
+ keys: {},
19187
+ label: {},
19188
+ loading: { type: Boolean },
19189
+ loadingText: {},
19190
+ max: {},
19191
+ minCollapsedNum: {},
19192
+ multiple: { type: Boolean },
19193
+ panelBottomContent: {},
19194
+ panelTopContent: {},
19195
+ placeholder: {},
19196
+ popupProps: {},
19197
+ popupVisible: { type: Boolean },
19198
+ defaultPopupVisible: { type: Boolean },
19199
+ prefixIcon: {},
19200
+ readonly: { type: Boolean },
19201
+ reserveKeyword: { type: Boolean },
19202
+ scroll: {},
19203
+ selectInputProps: {},
19204
+ showArrow: { type: Boolean },
19205
+ size: {},
19206
+ status: {},
19207
+ suffix: {},
19208
+ suffixIcon: {},
19209
+ tagInputProps: {},
19210
+ tagProps: {},
19211
+ tips: {},
19212
+ value: {},
19213
+ defaultValue: {},
19214
+ modelValue: {},
19215
+ valueDisplay: {},
19216
+ valueType: {},
19217
+ onBlur: { type: Function },
19218
+ onChange: { type: Function },
19219
+ onClear: { type: Function },
19220
+ onCreate: { type: Function },
19221
+ onEnter: { type: Function },
19222
+ onFocus: { type: Function },
19223
+ onInputChange: { type: Function },
19224
+ onPopupVisibleChange: { type: Function },
19225
+ onRemove: { type: Function },
19226
+ onSearch: { type: Function }
19227
+ }, qdDictSelectProps),
19228
+ emits: ["update:modelValue", "update:inputValue", "update:popupVisible"],
19229
+ setup(__props, { emit: __emit }) {
19230
+ const props = __props;
19231
+ const emit = __emit;
19232
+ const { modelValue, inputValue, popupVisible } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19233
+ const reModelValue = computed({
19234
+ get: () => {
19235
+ const { convStr, selectOptions } = reProps.value;
19236
+ const { multiple, valueType } = selectOptions;
19237
+ if (!multiple || valueType === "object") return modelValue.value;
19238
+ if (isEmpty(modelValue.value)) return [];
19239
+ if (typeof modelValue.value === "string") {
19240
+ return modelValue.value.split(
19241
+ (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
19242
+ );
19243
+ }
19244
+ return modelValue.value;
19245
+ },
19246
+ set: (val) => {
19247
+ const { convStr, selectOptions } = reProps.value;
19248
+ const { multiple, valueType } = selectOptions;
19249
+ if (!multiple || valueType === "object") {
19250
+ modelValue.value = val;
19251
+ return;
19252
+ }
19253
+ if (convStr && Array.isArray(val)) {
19254
+ modelValue.value = val.join(
19255
+ (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
19256
+ );
19257
+ } else {
19258
+ modelValue.value = val;
19259
+ }
19260
+ }
19261
+ });
19262
+ const dictType = toRef(props, "dictType");
19263
+ const reProps = computed(() => {
19264
+ const {
19265
+ convStr,
19266
+ modelValue: modelValue2,
19267
+ inputValue: inputValue2,
19268
+ popupVisible: popupVisible2,
19269
+ dictType: dictType2,
19270
+ loading,
19271
+ defaultSelectFirst,
19272
+ ...selectOptions
19273
+ } = props;
19274
+ return {
19275
+ convStr,
19276
+ dictType: dictType2,
19277
+ loading,
19278
+ defaultSelectFirst,
19279
+ selectOptions,
19280
+ models: {
19281
+ modelValue: modelValue2,
19282
+ inputValue: inputValue2,
19283
+ popupVisible: popupVisible2
19284
+ }
19285
+ };
19286
+ });
19287
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType, {
19288
+ onInit: (options) => {
19289
+ if (reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && options.length) {
19290
+ reModelValue.value = options[0]?.value;
19291
+ }
19292
+ }
19293
+ });
19294
+ return (_ctx, _cache) => {
19295
+ return openBlock(), createBlock(unref(Select), mergeProps({
19296
+ modelValue: reModelValue.value,
19297
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19298
+ "input-value": unref(inputValue),
19299
+ "onUpdate:inputValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
19300
+ "popup-visible": unref(popupVisible),
19301
+ "onUpdate:popupVisible": _cache[2] || (_cache[2] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : null)
19302
+ }, reProps.value.selectOptions, {
19303
+ options: unref(dictOptions),
19304
+ loading: unref(dictLoading) || reProps.value.loading
19305
+ }), createSlots({ _: 2 }, [
19306
+ renderList(_ctx.$slots, (_, name) => {
19307
+ return {
19308
+ name,
19309
+ fn: withCtx((slotProps) => [
19310
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
19311
+ ])
19312
+ };
19313
+ })
19314
+ ]), 1040, ["modelValue", "input-value", "popup-visible", "options", "loading"]);
19315
+ };
19316
+ }
19317
+ });
19318
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
19319
+ ...{
19320
+ name: "QdDictRadioGroup"
19321
+ },
19322
+ __name: "radio-group",
19323
+ props: /* @__PURE__ */ mergeDefaults({
19324
+ dictType: {},
19325
+ allowUncheck: { type: Boolean },
19326
+ disabled: { type: Boolean },
19327
+ name: {},
19328
+ readonly: { type: Boolean },
19329
+ size: {},
19330
+ theme: {},
19331
+ value: {},
19332
+ defaultValue: {},
19333
+ modelValue: {},
19334
+ variant: {},
19335
+ onChange: { type: Function }
19336
+ }, qdDictRadioGroupProps),
19337
+ emits: ["update:modelValue"],
19338
+ setup(__props, { emit: __emit }) {
19339
+ const vLoading = LoadingDirective;
19340
+ const props = __props;
19341
+ const emit = __emit;
19342
+ const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19343
+ const dictType = toRef(props, "dictType");
19344
+ const reProps = computed(() => {
19345
+ const { modelValue: modelValue2, dictType: dictType2, ...radioOptions } = props;
19346
+ return {
19347
+ dictType: dictType2,
19348
+ radioOptions,
19349
+ models: {
19350
+ modelValue: modelValue2
19351
+ }
19352
+ };
19353
+ });
19354
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19355
+ return (_ctx, _cache) => {
19356
+ return withDirectives((openBlock(), createBlock(unref(RadioGroup), mergeProps({
19357
+ modelValue: unref(modelValue),
19358
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
19359
+ class: "qd-dict-radio-group"
19360
+ }, reProps.value.radioOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19361
+ [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19362
+ ]);
19363
+ };
19364
+ }
19365
+ });
19366
+ const radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e97fb1f0"]]);
19367
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
19368
+ ...{
19369
+ name: "QdDictCheckboxGroup"
19370
+ },
19371
+ __name: "checkbox-group",
19372
+ props: /* @__PURE__ */ mergeDefaults({
19373
+ dictType: {},
19374
+ convStr: { type: [Boolean, String] },
19375
+ modelValue: {},
19376
+ disabled: { type: Boolean },
19377
+ lazyLoad: { type: Boolean },
19378
+ max: {},
19379
+ name: {},
19380
+ readonly: { type: Boolean },
19381
+ value: {},
19382
+ defaultValue: {},
19383
+ onChange: { type: Function }
19384
+ }, qdDictCheckboxGroupProps),
19385
+ emits: ["update:modelValue"],
19386
+ setup(__props, { emit: __emit }) {
19387
+ const vLoading = LoadingDirective;
19388
+ const props = __props;
19389
+ const emit = __emit;
19390
+ const { modelValue } = /* @__PURE__ */ useVModels(props, emit, { passive: true });
19391
+ const reModelValue = computed({
19392
+ get: () => {
19393
+ if (isEmpty(modelValue.value)) return [];
19394
+ if (typeof modelValue.value === "string") {
19395
+ const { convStr } = reProps.value;
19396
+ return modelValue.value.split((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
19397
+ }
19398
+ return modelValue.value;
19399
+ },
19400
+ set: (val) => {
19401
+ const { convStr } = reProps.value;
19402
+ if (convStr) {
19403
+ modelValue.value = val.join((typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator);
19404
+ } else {
19405
+ modelValue.value = val;
19406
+ }
19407
+ }
19408
+ });
19409
+ const dictType = toRef(props, "dictType");
19410
+ const reProps = computed(() => {
19411
+ const { modelValue: modelValue2, dictType: dictType2, convStr, ...checkboxOptions } = props;
19412
+ return {
19413
+ dictType: dictType2,
19414
+ convStr,
19415
+ checkboxOptions,
19416
+ models: {
19417
+ modelValue: modelValue2
19418
+ }
19419
+ };
19420
+ });
19421
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19422
+ return (_ctx, _cache) => {
19423
+ return withDirectives((openBlock(), createBlock(unref(CheckboxGroup), mergeProps({
19424
+ modelValue: reModelValue.value,
19425
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
19426
+ class: "qd-dict-checkbox-group"
19427
+ }, reProps.value.checkboxOptions, { options: unref(dictOptions) }), null, 16, ["modelValue", "options"])), [
19428
+ [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
19429
+ ]);
19430
+ };
19431
+ }
19432
+ });
19433
+ const checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ef427474"]]);
19434
+ const _hoisted_1 = { class: "qd-dict-tag" };
19435
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
19436
+ ...{
19437
+ name: "QdDictTag"
19438
+ },
19439
+ __name: "tag",
19440
+ props: /* @__PURE__ */ mergeDefaults({
19441
+ value: {},
19442
+ strict: { type: Boolean },
19443
+ separator: {},
19444
+ options: {},
19445
+ dictType: {},
19446
+ size: {},
19447
+ shape: {},
19448
+ theme: {},
19449
+ variant: {}
19450
+ }, qdDictTagProps),
19451
+ setup(__props) {
19452
+ const props = __props;
19453
+ const dictType = toRef(props, "dictType");
19454
+ const reProps = computed(() => {
19455
+ const { options, ...otherOptions } = props;
19456
+ return {
19457
+ ...otherOptions,
19458
+ options: options || dictOptions.value || []
19459
+ };
19460
+ });
19461
+ const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
19462
+ const reValue = computed(() => {
19463
+ const { value, strict } = reProps.value;
19464
+ if (isEmpty(value)) return [];
19465
+ if (Array.isArray(value)) return value.map((item) => strict ? item : item.toString());
19466
+ if (isNumber(value)) {
19467
+ return strict ? [value] : [value.toString()];
19468
+ }
19469
+ return String(value).split(",");
19470
+ });
19471
+ const matchOptions = computed(() => {
19472
+ const { options, strict } = reProps.value;
19473
+ return options.filter((option) => {
19474
+ return reValue.value.includes(strict ? option.value : option.value.toString());
19475
+ });
19476
+ });
19477
+ return (_ctx, _cache) => {
19478
+ const _directive_loading = resolveDirective("loading");
19479
+ return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
19480
+ (openBlock(true), createElementBlock(Fragment, null, renderList(matchOptions.value, (item, index2) => {
19481
+ return openBlock(), createElementBlock(Fragment, null, [
19482
+ (!reProps.value.theme || reProps.value.theme === "text") && !__props.variant && (item.theme === "text" || !item.theme) ? (openBlock(), createElementBlock("span", {
19483
+ key: item.value,
19484
+ class: normalizeClass(item.class)
19485
+ }, [
19486
+ renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19487
+ renderSlot(_ctx.$slots, "default", { item }, () => [
19488
+ createTextVNode(toDisplayString(item.label), 1)
19489
+ ], true),
19490
+ renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19491
+ ], 2)) : (openBlock(), createBlock(unref(Tag), {
19492
+ key: item.value + "",
19493
+ index: index2,
19494
+ size: reProps.value.size,
19495
+ shape: reProps.value.shape,
19496
+ theme: reProps.value.theme || item.theme || "default",
19497
+ variant: reProps.value.variant || item.variant || "light",
19498
+ class: normalizeClass(item.class)
19499
+ }, {
19500
+ default: withCtx(() => [
19501
+ renderSlot(_ctx.$slots, "prefix", { item }, void 0, true),
19502
+ renderSlot(_ctx.$slots, "default", { item }, () => [
19503
+ createTextVNode(toDisplayString(item.label), 1)
19504
+ ], true),
19505
+ renderSlot(_ctx.$slots, "suffix", { item }, void 0, true)
19506
+ ]),
19507
+ _: 2
19508
+ }, 1032, ["index", "size", "shape", "theme", "variant", "class"])),
19509
+ (_ctx.$slots.separator || __props.separator) && matchOptions.value.length - 1 !== index2 ? renderSlot(_ctx.$slots, "separator", { key: 2 }, () => [
19510
+ createTextVNode(toDisplayString(__props.separator), 1)
19511
+ ], true) : createCommentVNode("", true)
19512
+ ], 64);
19513
+ }), 256))
19514
+ ])), [
19515
+ [_directive_loading, { loading: unref(dictLoading), size: "small" }]
19516
+ ]);
19517
+ };
19518
+ }
19519
+ });
19520
+ const tag = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cab615cf"]]);
19521
+ const qdUploadProps = {
19522
+ modelValue: () => [],
19523
+ files: () => [],
19524
+ convStr: false,
19525
+ valueMode: "ossId",
19526
+ theme: "file",
19527
+ draggable: void 0,
19528
+ autoUpload: false,
19529
+ allowUploadDuplicateFile: true,
19530
+ isBatchUpload: false,
19531
+ uploadAllFilesInOneRequest: false,
19532
+ method: "POST",
19533
+ multiple: void 0,
19534
+ name: "file",
19535
+ disabled: void 0,
19536
+ showImageFileName: true,
19537
+ showThumbnail: true,
19538
+ showUploadProgress: true,
19539
+ uploadPastedFiles: true,
19540
+ useMockProgress: true,
19541
+ withCredentials: false,
19542
+ del: void 0
19543
+ };
19544
+ const qdUploadSizeLimit = {
19545
+ unit: "MB"
19546
+ };
19459
19547
  const acceptMap = {
19460
19548
  default: [
19461
19549
  ".doc",
@@ -19590,7 +19678,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19590
19678
  modelValue.value = val;
19591
19679
  }
19592
19680
  });
19593
- const formAddBeforeSubmitQueue = inject(PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE);
19681
+ const formAddBeforeSubmitQueue = inject(PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE, void 0);
19594
19682
  const { t } = useConfig("upload");
19595
19683
  const tdReadonly = useReadonly();
19596
19684
  const tdDisabled = useDisabled();
@@ -19599,7 +19687,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19599
19687
  const { timer: uploadTimer, clearTimer: clearUploadTimer } = useTimer("interval");
19600
19688
  const delList = ref([]);
19601
19689
  const popupFileList = computed(() => [...fileList.value]);
19602
- const globalUploadProps = inject(PROVIDE_UPLOAD);
19690
+ const globalUploadProps = inject(PROVIDE_UPLOAD, void 0);
19603
19691
  const reProps = computed(() => {
19604
19692
  const {
19605
19693
  modelValue: modelValue2,
@@ -19982,7 +20070,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19982
20070
  };
19983
20071
  }
19984
20072
  });
19985
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e8a4e0"]]);
20073
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-91a0c8d5"]]);
19986
20074
  export {
19987
20075
  QdGrid as A,
19988
20076
  QdGridItem as B,
@@ -20033,4 +20121,4 @@ export {
20033
20121
  qdFormGutter as y,
20034
20122
  qdFormGrid as z
20035
20123
  };
20036
- //# sourceMappingURL=index-BII9oZal.mjs.map
20124
+ //# sourceMappingURL=index-Coh5ZgRv.mjs.map