jmash-region 0.0.3 → 0.0.6

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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as i, ref as s, resolveComponent as n, openBlock as _, createElementBlock as c, createVNode as o, withCtx as l, createTextVNode as d, toDisplayString as m } from "vue";
2
- import { _ as f, a as p } from "./index-C1Hml01a.mjs";
1
+ import { defineComponent as i, ref as s, resolveComponent as n, createElementBlock as _, openBlock as c, createVNode as o, withCtx as l, createTextVNode as d, toDisplayString as m } from "vue";
2
+ import { _ as f, a as p } from "./index-BJooawLh.mjs";
3
3
  const C = { class: "app-container" }, x = /* @__PURE__ */ i({
4
4
  __name: "index",
5
5
  setup(g) {
@@ -9,12 +9,18 @@ const C = { class: "app-container" }, x = /* @__PURE__ */ i({
9
9
  });
10
10
  return (v, a) => {
11
11
  const r = n("el-form-item"), u = n("el-form");
12
- return _(), c("div", C, [
12
+ return c(), _("div", C, [
13
13
  o(u, {
14
14
  ref: "queryFormRef",
15
15
  model: e.value
16
16
  }, {
17
17
  default: l(() => [
18
+ o(r, { label: "树形控件地区编码" }, {
19
+ default: l(() => [
20
+ d(m(e.value.regionCodeTree), 1)
21
+ ]),
22
+ _: 1
23
+ }),
18
24
  o(r, { label: "树形控件" }, {
19
25
  default: l(() => [
20
26
  o(f, {
@@ -26,9 +32,9 @@ const C = { class: "app-container" }, x = /* @__PURE__ */ i({
26
32
  ]),
27
33
  _: 1
28
34
  }),
29
- o(r, { label: "树形控件地区编码" }, {
35
+ o(r, { label: "级联控件地区编码" }, {
30
36
  default: l(() => [
31
- d(m(e.value.regionCodeTree), 1)
37
+ d(m(e.value.regionCodeCascader), 1)
32
38
  ]),
33
39
  _: 1
34
40
  }),
@@ -43,12 +49,6 @@ const C = { class: "app-container" }, x = /* @__PURE__ */ i({
43
49
  }, null, 8, ["modelValue"])
44
50
  ]),
45
51
  _: 1
46
- }),
47
- o(r, { label: "级联控件地区编码" }, {
48
- default: l(() => [
49
- d(m(e.value.regionCodeCascader), 1)
50
- ]),
51
- _: 1
52
52
  })
53
53
  ]),
54
54
  _: 1
@@ -0,0 +1,422 @@
1
+ import { defineComponent as de, ref as _, resolveComponent as a, resolveDirective as se, createElementBlock as R, openBlock as m, createElementVNode as T, createVNode as l, createBlock as C, createCommentVNode as U, withCtx as n, withKeys as me, unref as i, createTextVNode as f, toDisplayString as u, withDirectives as h, isRef as ue } from "vue";
2
+ import { useTableHooks as pe } from "jmash-core";
3
+ import { d as V } from "./index-BJooawLh.mjs";
4
+ import { D as j, _ as ce, C as ge } from "./edit.vue_vue_type_script_setup_true_lang-BaawD1DB.mjs";
5
+ import { useI18n as fe } from "vue-i18n";
6
+ import { ElMessageBox as ve, ElMessage as ye } from "element-plus";
7
+ const be = { class: "app-container" }, _e = { class: "search-container" }, Ce = ["onClick"], he = ["onClick"], ke = ["onClick"], De = /* @__PURE__ */ de({
8
+ __name: "index",
9
+ setup(we) {
10
+ const { t: d } = fe(), s = _({
11
+ likeRegionName: void 0,
12
+ enable: void 0,
13
+ parentId: void 0
14
+ }), I = _([
15
+ {
16
+ label: "dictRegion.regionName",
17
+ prop: "regionName",
18
+ isColumn: !0,
19
+ minWidth: "300"
20
+ },
21
+ {
22
+ label: "dictRegion.regionCode",
23
+ prop: "regionCode",
24
+ width: "100",
25
+ isColumn: !0
26
+ },
27
+ {
28
+ label: "dictRegion.regionType",
29
+ prop: "regionType",
30
+ slotName: "regionType",
31
+ columnType: "slot",
32
+ width: "100",
33
+ isColumn: !0
34
+ },
35
+ {
36
+ label: "dictRegion.regionCategory",
37
+ prop: "regionCategory",
38
+ slotName: "regionCategory",
39
+ columnType: "slot",
40
+ width: "100",
41
+ isColumn: !0
42
+ },
43
+ {
44
+ label: "dictRegion.enable",
45
+ prop: "enable",
46
+ slotName: "enable",
47
+ width: "100",
48
+ columnType: "slot",
49
+ isColumn: !0
50
+ },
51
+ {
52
+ label: "dictRegion.orderBy",
53
+ prop: "orderBy",
54
+ slotName: "orderBy",
55
+ columnType: "slot",
56
+ width: "70",
57
+ isColumn: !0
58
+ },
59
+ {
60
+ label: "common.operate",
61
+ width: "200",
62
+ slotName: "operation",
63
+ columnType: "slot",
64
+ fixed: "right",
65
+ isColumn: !0
66
+ }
67
+ ]), {
68
+ tableHooks: r,
69
+ multipleTableRef: z,
70
+ queryFormRef: q,
71
+ listLoading: A,
72
+ tableData: F,
73
+ total: $
74
+ } = pe(d, V, s), p = _({
75
+ title: d("common.edit"),
76
+ visible: !1
77
+ }), N = _({}), D = _(""), L = (e) => {
78
+ N.value = {}, D.value = e, p.value.title = d("common.add"), p.value.visible = !0;
79
+ }, K = (e) => {
80
+ D.value = "", N.value = e, p.value.title = d("common.edit"), p.value.visible = !0;
81
+ }, k = _(!1), H = (e) => {
82
+ e.updateMask = "", r.importExcel(e).then((o) => {
83
+ k.value = !1;
84
+ });
85
+ }, W = () => {
86
+ k.value = !1;
87
+ }, G = (e) => {
88
+ r.handleSort(e.prop, e.order);
89
+ };
90
+ r.getList();
91
+ const E = /* @__PURE__ */ new Map(), P = (e, o, c) => {
92
+ E.set(e.regionId, { row: e, treeNode: o, resolve: c }), V.findList({ ...s.value, parentId: e.regionId }).then(({ data: g }) => {
93
+ if (c(g.results), !g.results.length) {
94
+ const { store: v } = z.value.refs();
95
+ v.states.lazyTreeNodeMap.value[e.regionId] = [];
96
+ }
97
+ });
98
+ }, J = (e) => {
99
+ e && r.getList();
100
+ }, S = (e, o) => {
101
+ V.move({ regionId: e.regionId }, o).then((c) => {
102
+ c.status === 200 && !B(e.parentId) && r.getList();
103
+ });
104
+ }, O = (e) => {
105
+ ve.confirm(d("common.confirmDelete"), d("common.delete"), {
106
+ cancelButtonText: d("common.cancel"),
107
+ confirmButtonText: d("common.confirm"),
108
+ type: "warning"
109
+ }).then(() => V.delete({ regionId: e.regionId })).then((o) => {
110
+ o.status === 200 && (ye({
111
+ message: d("common.deleteSuccess"),
112
+ type: "success"
113
+ }), !B(e.parentId) && r.handleQuery());
114
+ });
115
+ }, X = (e) => {
116
+ if (!e.parentId || e.parentId === ge.DEFAULT_ID) {
117
+ r.getList();
118
+ return;
119
+ }
120
+ B(e.parentId);
121
+ }, B = (e) => {
122
+ if (!E.has(e) || !e) return !1;
123
+ const { row: o, treeNode: c, resolve: g } = E.get(e);
124
+ return P(o, c, g), !0;
125
+ };
126
+ return (e, o) => {
127
+ const c = a("el-input"), g = a("el-form-item"), v = a("el-col"), Y = a("jmash-select"), w = a("el-button"), x = a("el-row"), Z = a("el-form"), ee = a("jmash-column-select"), oe = a("el-switch"), te = a("Bottom"), M = a("el-icon"), Q = a("el-tooltip"), ne = a("Top"), le = a("jmash-table"), ae = a("jmash-pagination"), ie = a("el-card"), re = a("jmash-import-upload"), b = se("hasPerm");
128
+ return m(), R("div", be, [
129
+ T("div", _e, [
130
+ l(Z, {
131
+ ref_key: "queryFormRef",
132
+ ref: q,
133
+ model: s.value,
134
+ inline: !0
135
+ }, {
136
+ default: n(() => [
137
+ l(x, null, {
138
+ default: n(() => [
139
+ l(v, { span: 6 }, {
140
+ default: n(() => [
141
+ l(g, {
142
+ label: e.$t("dictRegion.regionName"),
143
+ prop: "likeRegionName"
144
+ }, {
145
+ default: n(() => [
146
+ l(c, {
147
+ modelValue: s.value.likeRegionName,
148
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => s.value.likeRegionName = t),
149
+ placeholder: e.$t("dictRegion.regionNamePlaceholder"),
150
+ onKeyup: o[1] || (o[1] = me((t) => i(r).handleQuery(), ["enter"])),
151
+ class: "!w-[203px]"
152
+ }, null, 8, ["modelValue", "placeholder"])
153
+ ]),
154
+ _: 1
155
+ }, 8, ["label"])
156
+ ]),
157
+ _: 1
158
+ }),
159
+ l(v, { span: 6 }, {
160
+ default: n(() => [
161
+ l(g, {
162
+ label: e.$t("dictRegion.enable"),
163
+ prop: "enable"
164
+ }, {
165
+ default: n(() => [
166
+ l(Y, {
167
+ modelValue: s.value.enable,
168
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => s.value.enable = t),
169
+ placeholder: e.$t("dictRegion.enablePlaceholder"),
170
+ data: i(j).enableDict.values,
171
+ clearable: "",
172
+ class: "!w-[203px]",
173
+ onChange: o[3] || (o[3] = (t) => i(r).handleQuery())
174
+ }, null, 8, ["modelValue", "placeholder", "data"])
175
+ ]),
176
+ _: 1
177
+ }, 8, ["label"])
178
+ ]),
179
+ _: 1
180
+ }),
181
+ l(v, {
182
+ span: 6,
183
+ style: { "margin-left": "auto" }
184
+ }, {
185
+ default: n(() => [
186
+ l(g, { class: "search-btn" }, {
187
+ default: n(() => [
188
+ l(w, {
189
+ type: "primary",
190
+ onClick: o[4] || (o[4] = (t) => i(r).handleQuery())
191
+ }, {
192
+ default: n(() => [
193
+ f(u(e.$t("common.search")), 1)
194
+ ]),
195
+ _: 1
196
+ }),
197
+ l(w, {
198
+ onClick: o[5] || (o[5] = (t) => i(r).resetQuery())
199
+ }, {
200
+ default: n(() => [
201
+ f(u(e.$t("common.reset")), 1)
202
+ ]),
203
+ _: 1
204
+ })
205
+ ]),
206
+ _: 1
207
+ })
208
+ ]),
209
+ _: 1
210
+ })
211
+ ]),
212
+ _: 1
213
+ })
214
+ ]),
215
+ _: 1
216
+ }, 8, ["model"]),
217
+ o[16] || (o[16] = T("div", { class: "clear" }, null, -1))
218
+ ]),
219
+ l(ie, {
220
+ shadow: "never",
221
+ class: "table-container"
222
+ }, {
223
+ header: n(() => [
224
+ l(x, null, {
225
+ default: n(() => [
226
+ l(v, { span: 17 }, {
227
+ default: n(() => [
228
+ h((m(), C(w, {
229
+ type: "primary",
230
+ onClick: o[6] || (o[6] = (t) => L())
231
+ }, {
232
+ default: n(() => [
233
+ f(u(e.$t("common.add")), 1)
234
+ ]),
235
+ _: 1
236
+ })), [
237
+ [b, ["region:dict_region:add"]]
238
+ ])
239
+ ]),
240
+ _: 1
241
+ }),
242
+ l(v, {
243
+ span: 7,
244
+ class: "container-float"
245
+ }, {
246
+ default: n(() => [
247
+ h((m(), C(w, {
248
+ plain: "",
249
+ type: "primary",
250
+ onClick: o[7] || (o[7] = (t) => k.value = !0)
251
+ }, {
252
+ default: n(() => [
253
+ f(u(e.$t("common.import")), 1)
254
+ ]),
255
+ _: 1
256
+ })), [
257
+ [b, ["region:dict_region:import"]]
258
+ ]),
259
+ h((m(), C(w, {
260
+ plain: "",
261
+ type: "primary",
262
+ onClick: o[8] || (o[8] = (t) => i(r).handleExport(i(d)("dictRegion.name")))
263
+ }, {
264
+ default: n(() => [
265
+ f(u(e.$t("common.export")), 1)
266
+ ]),
267
+ _: 1
268
+ })), [
269
+ [b, ["region:dict_region:export"]]
270
+ ]),
271
+ l(ee, {
272
+ modelValue: I.value,
273
+ "onUpdate:modelValue": o[9] || (o[9] = (t) => I.value = t),
274
+ "label-name": "region/os-dict-region"
275
+ }, null, 8, ["modelValue"])
276
+ ]),
277
+ _: 1
278
+ })
279
+ ]),
280
+ _: 1
281
+ })
282
+ ]),
283
+ footer: n(() => [
284
+ i($) > 0 ? (m(), C(ae, {
285
+ key: 0,
286
+ total: i($),
287
+ "onUpdate:total": o[10] || (o[10] = (t) => ue($) ? $.value = t : null),
288
+ "current-page": s.value.curPage,
289
+ "onUpdate:currentPage": o[11] || (o[11] = (t) => s.value.curPage = t),
290
+ "page-size": s.value.pageSize,
291
+ "onUpdate:pageSize": o[12] || (o[12] = (t) => s.value.pageSize = t),
292
+ onPagination: o[13] || (o[13] = (t) => i(r).getList())
293
+ }, null, 8, ["total", "current-page", "page-size"])) : U("", !0)
294
+ ]),
295
+ default: n(() => [
296
+ l(le, {
297
+ ref_key: "multipleTableRef",
298
+ ref: z,
299
+ "row-key": "regionId",
300
+ lazy: "",
301
+ "list-loading": i(A),
302
+ data: i(F),
303
+ "table-label": I.value,
304
+ "tree-props": { children: "children", hasChildren: "hasChildren" },
305
+ "is-selection": !1,
306
+ load: P,
307
+ onSortChange: G
308
+ }, {
309
+ regionType: n((t) => [
310
+ T("span", null, u(i(j).regionTypeEnum.getEnumValue(t.data.row.regionType)), 1)
311
+ ]),
312
+ regionCategory: n((t) => [
313
+ T("span", null, u(i(j).regionCategoryEnum.getEnumValue(
314
+ t.data.row.regionCategory
315
+ )), 1)
316
+ ]),
317
+ enable: n((t) => [
318
+ l(oe, {
319
+ modelValue: t.data.row.enable,
320
+ "onUpdate:modelValue": (y) => t.data.row.enable = y,
321
+ onChange: (y) => i(r).enableRecord(t.data.row, t.data.row.enable)
322
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
323
+ ]),
324
+ orderBy: n((t) => [
325
+ l(Q, {
326
+ class: "box-item",
327
+ effect: "dark",
328
+ content: "下移",
329
+ placement: "top"
330
+ }, {
331
+ default: n(() => [
332
+ l(M, {
333
+ style: { cursor: "pointer" },
334
+ size: "16",
335
+ onClick: (y) => S(t.data.row, !1)
336
+ }, {
337
+ default: n(() => [
338
+ l(te)
339
+ ]),
340
+ _: 2
341
+ }, 1032, ["onClick"])
342
+ ]),
343
+ _: 2
344
+ }, 1024),
345
+ l(Q, {
346
+ class: "box-item",
347
+ effect: "dark",
348
+ content: "上移",
349
+ placement: "top"
350
+ }, {
351
+ default: n(() => [
352
+ l(M, {
353
+ style: { cursor: "pointer" },
354
+ size: "16",
355
+ onClick: (y) => S(t.data.row, !0)
356
+ }, {
357
+ default: n(() => [
358
+ l(ne)
359
+ ]),
360
+ _: 2
361
+ }, 1032, ["onClick"])
362
+ ]),
363
+ _: 2
364
+ }, 1024)
365
+ ]),
366
+ operation: n((t) => [
367
+ h((m(), R("span", {
368
+ class: "el-button-color",
369
+ onClick: (y) => L(t.data.row.regionId)
370
+ }, [
371
+ f(u(e.$t("dictRegion.addChild")), 1)
372
+ ], 8, Ce)), [
373
+ [b, ["region:dict_region:add"]]
374
+ ]),
375
+ h((m(), R("span", {
376
+ class: "el-button-color dropdown-left",
377
+ onClick: (y) => K(t.data.row)
378
+ }, [
379
+ f(u(e.$t("common.edit")), 1)
380
+ ], 8, he)), [
381
+ [b, ["region:dict_region:update"]]
382
+ ]),
383
+ h((m(), R("span", {
384
+ class: "el-button-color dropdown-left",
385
+ onClick: (y) => O(t.data.row)
386
+ }, [
387
+ f(u(e.$t("common.delete")), 1)
388
+ ], 8, ke)), [
389
+ [b, ["region:dict_region:delete"]]
390
+ ])
391
+ ]),
392
+ _: 1
393
+ }, 8, ["list-loading", "data", "table-label"])
394
+ ]),
395
+ _: 1
396
+ }),
397
+ p.value.visible ? (m(), C(ce, {
398
+ key: 0,
399
+ modelValue: p.value.visible,
400
+ "onUpdate:modelValue": o[14] || (o[14] = (t) => p.value.visible = t),
401
+ title: p.value.title,
402
+ "entity-key": N.value,
403
+ "parent-id": D.value,
404
+ onRefresh: J,
405
+ onReload: X,
406
+ width: "900px"
407
+ }, null, 8, ["modelValue", "title", "entity-key", "parent-id"])) : U("", !0),
408
+ k.value ? (m(), C(re, {
409
+ key: 1,
410
+ "upload-visible": k.value,
411
+ "template-title": e.$t("sysUser.templateDownload"),
412
+ onTemplateDown: o[15] || (o[15] = (t) => i(r).downloadTemplate(i(d)("dictRegion.name"))),
413
+ onImportEvents: H,
414
+ onUploadClosed: W
415
+ }, null, 8, ["upload-visible", "template-title"])) : U("", !0)
416
+ ]);
417
+ };
418
+ }
419
+ });
420
+ export {
421
+ De as default
422
+ };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "jmash-core";
2
- import { a as i, _ as o, b as r, d } from "./index-C1Hml01a.mjs";
2
+ import { a as i, _ as o, b as r, d } from "./index-BJooawLh.mjs";
3
3
  export {
4
4
  i as JmashRegionCascader,
5
5
  o as JmashRegionTree,
@@ -1,5 +1,4 @@
1
1
  import type { DictRegionModel } from "@/api/region/os-dict-region/types";
2
- export declare const findParentRegions: (regionId: string, regions: DictRegionModel[]) => string[];
3
2
  export interface ExtractIdsOrCodes {
4
3
  regionIds: string[];
5
4
  regionCodes: string[];
package/package.json CHANGED
@@ -1,58 +1,59 @@
1
- {
2
- "name": "jmash-region",
3
- "version": "0.0.3",
4
- "private": false,
5
- "module": "dist/index.mjs",
6
- "types": "dts/src/index.d.ts",
7
- "files": [
8
- "dist",
9
- "dts/src"
10
- ],
11
- "scripts": {
12
- "dev": "vite",
13
- "build": "vite build && pnpm build:dts",
14
- "build:dts": "vue-tsc --declaration --emitDeclarationOnly",
15
- "preview": "vite preview",
16
- "build-only": "vite build",
17
- "type-check": "vue-tsc --build --force",
18
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
19
- "format": "prettier --write src/"
20
- },
21
- "peerDependencies": {
22
- "axios": "^1.6.7",
23
- "element-plus": "^2.7.5",
24
- "jmash-core": "^0.0.95",
25
- "jmash-dict": "^0.0.41",
26
- "jmash-rbac": "^0.0.30",
27
- "pinia": "^2.1.7",
28
- "vue": "^3.4.21",
29
- "vue-i18n": "^9.10.1",
30
- "vue-router": "^4.3.0"
31
- },
32
- "devDependencies": {
33
- "@eslint/js": "^9.14.0",
34
- "@tsconfig/node20": "^20.1.2",
35
- "@types/node": "^20.11.10",
36
- "@vitejs/plugin-vue": "^5.0.3",
37
- "@vue/tsconfig": "^0.5.1",
38
- "eslint": "^9.14.0",
39
- "eslint-plugin-vue": "^9.30.0",
40
- "globals": "^15.12.0",
41
- "npm-run-all2": "^6.1.1",
42
- "prettier": "^3.0.3",
43
- "sass": "^1.72.0",
44
- "typescript": "~5.3.0",
45
- "typescript-eslint": "^8.13.0",
46
- "unplugin-auto-import": "^0.17.5",
47
- "unplugin-vue-components": "^0.26.0",
48
- "vite": "^5.0.11",
49
- "vue-tsc": "^1.8.27"
50
- },
51
- "dependencies": {
52
- "@vueuse/core": "^10.9.0",
53
- "file-saver": "^2.0.5",
54
- "nprogress": "^0.2.0",
55
- "pinyin-pro": "^3.25.0",
56
- "qs": "^6.12.0"
57
- }
58
- }
1
+ {
2
+ "name": "jmash-region",
3
+ "version": "0.0.6",
4
+ "private": false,
5
+ "module": "dist/index.mjs",
6
+ "types": "dts/src/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "dts/src"
10
+ ],
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build && pnpm build:dts",
14
+ "build:dts": "vue-tsc --declaration --emitDeclarationOnly",
15
+ "preview": "vite preview",
16
+ "build-only": "vite build",
17
+ "type-check": "vue-tsc --build --force",
18
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
19
+ "format": "prettier --write src/"
20
+ },
21
+ "peerDependencies": {
22
+ "axios": "^1.6.7",
23
+ "element-plus": "^2.7.5",
24
+ "jmash-core": "^0.0.133",
25
+ "jmash-dict": "^0.0.47",
26
+ "jmash-rbac": "^0.0.46",
27
+ "pinia": "^2.1.7",
28
+ "vue": "^3.4.21",
29
+ "vue-i18n": "^9.10.1",
30
+ "vue-router": "^4.3.0"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/js": "^9.14.0",
34
+ "@tsconfig/node20": "^20.1.2",
35
+ "@types/node": "^20.11.10",
36
+ "@vitejs/plugin-vue": "^5.0.3",
37
+ "@vue/tsconfig": "^0.5.1",
38
+ "eslint": "^9.14.0",
39
+ "eslint-plugin-vue": "^9.30.0",
40
+ "globals": "^15.12.0",
41
+ "npm-run-all2": "^6.1.1",
42
+ "prettier": "^3.0.3",
43
+ "sass": "^1.72.0",
44
+ "typescript": "~5.3.0",
45
+ "typescript-eslint": "^8.13.0",
46
+ "unplugin-auto-import": "^0.17.5",
47
+ "unplugin-vue-components": "^0.26.0",
48
+ "vite": "^5.0.11",
49
+ "vue-tsc": "^1.8.27"
50
+ },
51
+ "dependencies": {
52
+ "@vueuse/core": "^10.9.0",
53
+ "file-saver": "^2.0.5",
54
+ "jmash-region": "link:",
55
+ "nprogress": "^0.2.0",
56
+ "pinyin-pro": "^3.25.0",
57
+ "qs": "^6.12.0"
58
+ }
59
+ }