yc-vep-ui 0.3.83 → 0.3.85

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.
@@ -2590,66 +2590,66 @@ function useDefaultTable(e, n) {
2590
2590
  }), o = ref([]), s = reactive({
2591
2591
  page: 1,
2592
2592
  pageSize: 10
2593
- }), c = null;
2594
- if (n?.onBefore?.(s) === !1) return {
2593
+ }), { defaultParams: c, immediate: l = !0, ...u } = n;
2594
+ if (u?.onBefore?.(s) === !1) return {
2595
2595
  loading: ref(!1),
2596
2596
  data: i,
2597
2597
  pagination: a
2598
2598
  };
2599
- let l = useFetch(e, {
2600
- ...n,
2601
- defaultParams: s,
2599
+ let d = useFetch(e, {
2600
+ ...u,
2602
2601
  immediate: !1,
2603
2602
  onSuccess: (e) => {
2604
- n?.onSuccess?.(e), a.total = e[r?.replaceAttrs?.total] || 0, i.value = e[r?.replaceAttrs?.table] || [];
2605
- }
2606
- });
2607
- watchEffect(() => {
2608
- let e = toValue(n.ready) ?? !0, r = toValue(n.defaultParams || {});
2609
- if (console.log("=== watchEffect triggered ==="), console.log("ready ->>", e), console.log("tempParams ->>", JSON.parse(JSON.stringify(r))), console.log("requestParams ->>", JSON.parse(JSON.stringify(s))), a.page = 1, a.pageSize = 10, !e) {
2610
- console.log("ready is false, caching pendingParams"), c = { ...r }, console.log("pendingParams ->>", JSON.parse(JSON.stringify(c)));
2611
- return;
2603
+ u?.onSuccess?.(e), a.total = e[r?.replaceAttrs?.total] || 0, i.value = e[r?.replaceAttrs?.table] || [];
2612
2604
  }
2613
- if (c) {
2614
- console.log("applying pendingParams ->>", JSON.parse(JSON.stringify(c)));
2615
- for (let e in c) e !== "page" && e !== "pageSize" && (s[e] = c[e]);
2616
- c = null;
2617
- }
2618
- for (let e in r) e !== "page" && e !== "pageSize" && (s[e] = r[e]);
2619
- console.log("executing request with ->>", JSON.parse(JSON.stringify(s))), l.execute({ ...s });
2605
+ }), f = !1;
2606
+ l && watchEffect(() => {
2607
+ (toValue(n.ready) ?? !0) && !f && (f = !0, p());
2620
2608
  });
2621
- function u(e = {}) {
2622
- console.log("=== reset called ==="), console.log("data input ->>", JSON.parse(JSON.stringify(e))), console.log("requestParams before ->>", JSON.parse(JSON.stringify(s))), a.page = 1, a.pageSize = 10, Object.keys(s).forEach((n) => {
2623
- n !== "tableId" && (r.ignoreAttrs?.includes(n) || n in e || (console.log(`deleting key: ${n}, value:`, s[n]), delete s[n]));
2624
- }), c = null, Object.assign(s, {
2609
+ function p(e) {
2610
+ if (!(toValue(n.ready) ?? !0)) return;
2611
+ let r = {
2612
+ ...toValue(n.defaultParams) || {},
2613
+ ...s,
2614
+ ...e
2615
+ };
2616
+ return Object.keys(r).forEach((e) => {
2617
+ e !== "page" && e !== "pageSize" && (s[e] = r[e]);
2618
+ }), d.execute(r);
2619
+ }
2620
+ function m(e = {}) {
2621
+ a.page = 1, a.pageSize = 10, e && (Object.keys(s).forEach((n) => {
2622
+ r.ignoreAttrs?.includes(n) || Object.keys(e).includes(n) || delete s[n];
2623
+ }), Object.assign(s, {
2625
2624
  ...e,
2626
2625
  page: 1,
2627
2626
  pageSize: 10
2628
- }), console.log("requestParams after ->>", JSON.parse(JSON.stringify(s))), console.log("=== reset done ===");
2627
+ })), p();
2629
2628
  }
2630
- function d({ page: e, pageSize: n }) {
2631
- a.page = e, a.pageSize = n, Object.assign(s, {
2629
+ function g({ page: e, pageSize: n }) {
2630
+ a.page = e, a.pageSize = n, p({
2632
2631
  page: e,
2633
2632
  pageSize: n
2634
2633
  });
2635
2634
  }
2636
- function f(e) {
2635
+ function _(e) {
2637
2636
  o.value = e;
2638
2637
  }
2639
2638
  return reactive({
2640
- ...l,
2639
+ ...d,
2641
2640
  data: i,
2642
2641
  pagination: a,
2643
2642
  selection: o,
2644
- reset: u,
2645
- updatePagination: d,
2646
- selectionChange: f
2643
+ reset: m,
2644
+ updatePagination: g,
2645
+ selectionChange: _,
2646
+ execute: p
2647
2647
  });
2648
2648
  }
2649
2649
  //#endregion
2650
2650
  //#region src/hooks/useTable/common.ts
2651
2651
  function useComTable(e, n) {
2652
- let { defaultParams: r, ...i } = n, a = isRef(r) ? r : isReactive(r) ? toRef(r) : ref(r || {}), o = useDefaultTable(e, {
2652
+ let { defaultParams: r, ...i } = n, a = isRef(r) ? r : isReactive(r) ? toRef(r) : ref(r || {}), o = toValue(a)?.sort, s = useDefaultTable(e, {
2653
2653
  ...i,
2654
2654
  ready: computed(() => {
2655
2655
  let e = isRef(n.ready) ? n.ready.value : n.ready, r = !!a.value?.tableId;
@@ -2673,62 +2673,70 @@ function useComTable(e, n) {
2673
2673
  ...n?.ignoreAttrs || []
2674
2674
  ]
2675
2675
  });
2676
- function s(e = {}) {
2677
- console.log("=== useComTable reset called ==="), console.log("paramsRef.value before ->>", JSON.parse(JSON.stringify(a.value))), console.log("data input ->>", JSON.parse(JSON.stringify(e)));
2676
+ function c(e) {
2678
2677
  let n = [
2679
2678
  "tableId",
2680
2679
  "page",
2681
- "pageSize",
2682
- "sort"
2683
- ];
2684
- Object.keys(a.value).forEach((r) => {
2685
- !n.includes(r) && !(r in e) && (console.log(`deleting from paramsRef: ${r}`), delete a.value[r]);
2686
- }), Object.assign(a.value, e, {
2680
+ "pageSize"
2681
+ ], r = {}, i = {};
2682
+ return Object.keys(e || {}).forEach((a) => {
2683
+ n.includes(a) ? r[a] = e[a] : i[a] = e[a];
2684
+ }), Object.keys(i).length > 0 && (r.params = i), s.execute(r);
2685
+ }
2686
+ function l(e = {}) {
2687
+ let { tableId: n } = toValue(a);
2688
+ a.value = {
2689
+ tableId: n,
2687
2690
  page: 1,
2688
- pageSize: 10
2689
- }), console.log("paramsRef.value after ->>", JSON.parse(JSON.stringify(a.value)));
2691
+ pageSize: 10,
2692
+ sort: o,
2693
+ ...e
2694
+ }, s.reset();
2690
2695
  }
2691
- async function c(e) {
2696
+ async function u(e) {
2692
2697
  let n = toValue(a);
2693
2698
  return request_default.post("/common/insert", {
2694
2699
  params: { ...e },
2695
2700
  tableId: n?.tableId
2696
2701
  });
2697
2702
  }
2698
- async function l(e) {
2703
+ async function d(e) {
2699
2704
  let n = toValue(a);
2700
2705
  return request_default.post("/common/update", {
2701
2706
  params: { ...e },
2702
2707
  tableId: n?.tableId
2703
2708
  });
2704
2709
  }
2705
- async function u(e) {
2710
+ async function f(e) {
2706
2711
  let n = toValue(a);
2707
2712
  return request_default.post("/common/delete", {
2708
2713
  idList: e,
2709
2714
  tableId: n?.tableId
2710
2715
  });
2711
2716
  }
2712
- async function d(e) {
2717
+ async function p(e) {
2713
2718
  let { title: n = "export" } = e || {}, r = toValue(a), i = await request_default.blob(e?.url ?? "/common/exportExcel", {
2714
2719
  tableId: r?.tableId,
2715
2720
  type: e?.type || "all"
2716
2721
  }), o = new Blob([i]), s = document.createElement("a");
2717
2722
  s.href = window.URL.createObjectURL(o), s.download = `${n}.xlsx`, s.click(), VepMessage.success("导出成功"), window.URL.revokeObjectURL(s.href);
2718
2723
  }
2719
- let f = reactive({
2724
+ let m = reactive({
2720
2725
  loading: !1,
2721
2726
  data: [],
2722
2727
  selection: [],
2723
- insert: c,
2724
- update: l,
2725
- remove: u,
2726
- delete: u,
2727
- exportData: d
2728
+ insert: u,
2729
+ update: d,
2730
+ remove: f,
2731
+ delete: f,
2732
+ exportData: p
2728
2733
  });
2729
2734
  return watchEffect(() => {
2730
- Object.assign(f, o, { reset: s });
2731
- }, { flush: "sync" }), f;
2735
+ Object.assign(m, s, {
2736
+ reset: l,
2737
+ execute: c
2738
+ });
2739
+ }, { flush: "sync" }), m;
2732
2740
  }
2733
2741
  //#endregion
2734
2742
  //#region src/hooks/useTable/index.ts
@@ -1,2 +1,2 @@
1
- import { c as e, d as t, f as n, l as r, s as i, u as a } from "../entry-B0UFeX-p.js";
1
+ import { c as e, d as t, f as n, l as r, s as i, u as a } from "../entry-BQSBoqVF.js";
2
2
  export { e as useDictionary, n as useFetch, r as useRoute, a as useRouter, t as useTable, i as useUser };
@@ -1,2 +1,2 @@
1
- import { O as e, _ as t, b as n, v as r, y as i } from "../entry-B0UFeX-p.js";
1
+ import { O as e, _ as t, b as n, v as r, y as i } from "../entry-BQSBoqVF.js";
2
2
  export { t as baseUrl, n as request, e as tempToRender, r as uniq, i as uniqBy };
package/dist/vep-ui.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, S as i, T as a, a as o, g as s, h as c, i as l, k as u, m as d, n as f, o as p, p as m, r as h, t as g, w as _, x as v } from "./entry-B0UFeX-p.js";
1
+ import { A as e, C as t, D as n, E as r, S as i, T as a, a as o, g as s, h as c, i as l, k as u, m as d, n as f, o as p, p as m, r as h, t as g, w as _, x as v } from "./entry-BQSBoqVF.js";
2
2
  export { e as UiCard, i as UiDescriptions, v as UiDialog, a as UiEditor, n as UiFilter, r as UiForm, t as UiInfiniteScroll, d as UiStaffSelect, u as UiTable, _ as UiTree, m as UiUpload, s as WcUtils, o as YcApproval, c as YcMessage, l as YcPageAgent, h as default, h as ycPlugin, g as getHostVue, p as hooks, f as setHostVue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yc-vep-ui",
3
- "version": "0.3.83",
3
+ "version": "0.3.85",
4
4
  "type": "module",
5
5
  "description": "基于 Vue 3 + Element Plus 的企业级 UI 组件库",
6
6
  "keywords": [