yc-vep-ui 0.3.82 → 0.3.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.
@@ -2590,60 +2590,60 @@ 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;
2612
- }
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;
2603
+ u?.onSuccess?.(e), a.total = e[r?.replaceAttrs?.total] || 0, i.value = e[r?.replaceAttrs?.table] || [];
2617
2604
  }
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
@@ -2673,53 +2673,69 @@ function useComTable(e, n) {
2673
2673
  ...n?.ignoreAttrs || []
2674
2674
  ]
2675
2675
  });
2676
- function s(e = {}) {
2677
- Object.assign(a.value, e, {
2676
+ function s(e) {
2677
+ let n = [
2678
+ "tableId",
2679
+ "page",
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), o.execute(r);
2685
+ }
2686
+ function c(e = {}) {
2687
+ let { tableId: n } = toValue(a);
2688
+ a.value = {
2689
+ tableId: n,
2678
2690
  page: 1,
2679
- pageSize: 10
2680
- });
2691
+ pageSize: 10,
2692
+ ...e
2693
+ }, o.reset();
2681
2694
  }
2682
- async function c(e) {
2695
+ async function l(e) {
2683
2696
  let n = toValue(a);
2684
2697
  return request_default.post("/common/insert", {
2685
2698
  params: { ...e },
2686
2699
  tableId: n?.tableId
2687
2700
  });
2688
2701
  }
2689
- async function l(e) {
2702
+ async function u(e) {
2690
2703
  let n = toValue(a);
2691
2704
  return request_default.post("/common/update", {
2692
2705
  params: { ...e },
2693
2706
  tableId: n?.tableId
2694
2707
  });
2695
2708
  }
2696
- async function u(e) {
2709
+ async function d(e) {
2697
2710
  let n = toValue(a);
2698
2711
  return request_default.post("/common/delete", {
2699
2712
  idList: e,
2700
2713
  tableId: n?.tableId
2701
2714
  });
2702
2715
  }
2703
- async function d(e) {
2716
+ async function f(e) {
2704
2717
  let { title: n = "export" } = e || {}, r = toValue(a), i = await request_default.blob(e?.url ?? "/common/exportExcel", {
2705
2718
  tableId: r?.tableId,
2706
2719
  type: e?.type || "all"
2707
2720
  }), o = new Blob([i]), s = document.createElement("a");
2708
2721
  s.href = window.URL.createObjectURL(o), s.download = `${n}.xlsx`, s.click(), VepMessage.success("导出成功"), window.URL.revokeObjectURL(s.href);
2709
2722
  }
2710
- let f = reactive({
2723
+ let p = reactive({
2711
2724
  loading: !1,
2712
2725
  data: [],
2713
2726
  selection: [],
2714
- insert: c,
2715
- update: l,
2716
- remove: u,
2717
- delete: u,
2718
- exportData: d
2727
+ insert: l,
2728
+ update: u,
2729
+ remove: d,
2730
+ delete: d,
2731
+ exportData: f
2719
2732
  });
2720
2733
  return watchEffect(() => {
2721
- Object.assign(f, o, { reset: s });
2722
- }, { flush: "sync" }), f;
2734
+ Object.assign(p, o, {
2735
+ reset: c,
2736
+ execute: s
2737
+ });
2738
+ }, { flush: "sync" }), p;
2723
2739
  }
2724
2740
  //#endregion
2725
2741
  //#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-BRrSAEKi.js";
1
+ import { c as e, d as t, f as n, l as r, s as i, u as a } from "../entry-jocUh0jK.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-BRrSAEKi.js";
1
+ import { O as e, _ as t, b as n, v as r, y as i } from "../entry-jocUh0jK.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-BRrSAEKi.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-jocUh0jK.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.82",
3
+ "version": "0.3.84",
4
4
  "type": "module",
5
5
  "description": "基于 Vue 3 + Element Plus 的企业级 UI 组件库",
6
6
  "keywords": [