yc-project-template 1.0.0

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.
@@ -0,0 +1,149 @@
1
+ import { _ as B, a as F } from "./YcSearchForm-BWweEnqG.js";
2
+ import { b as V, f as L, _ as N } from "./globalComponents-NGC1jMmM.js";
3
+ import { defineComponent as O, reactive as h, ref as n, onMounted as M, createElementBlock as j, openBlock as H, createVNode as _, unref as t, isRef as S } from "vue";
4
+ import { q as J, p as R, d as U, m as Y, e as Q } from "./index-Cc-Qq-qP.js";
5
+ import { ElMessage as r, ElMessageBox as G } from "element-plus";
6
+ const K = { class: "page-template" }, W = /* @__PURE__ */ O({
7
+ name: "PageTemplate",
8
+ __name: "PageTemplate",
9
+ setup(X) {
10
+ const i = V(), s = h({
11
+ page: 1,
12
+ pageSize: 10,
13
+ tableId: i.query.menuId,
14
+ params: {}
15
+ }), c = n(!1), u = h({
16
+ loading: !1
17
+ }), b = n([]), g = n(!1), p = n({}), o = n({
18
+ pageSize: 10,
19
+ currentPage: 1,
20
+ total: 0
21
+ }), v = n(""), y = n([]), f = n([]);
22
+ async function I() {
23
+ const e = await J({ formId: i.query.menuId });
24
+ if (e.code !== "ok") {
25
+ r.error(e.message || "请求失败");
26
+ return;
27
+ }
28
+ if (!e.data) {
29
+ r.error("未获取到表单配置数据");
30
+ return;
31
+ }
32
+ v.value = e.data.menuName || "页面模板", y.value = e.data.formComponentList.filter((a) => a.show), f.value = e.data.formComponentList.filter((a) => a.query), l();
33
+ }
34
+ function D(e) {
35
+ l(e);
36
+ }
37
+ const l = async (e = s) => {
38
+ try {
39
+ Object.assign(s, {
40
+ pageSize: o.value.pageSize,
41
+ page: o.value.currentPage,
42
+ params: e
43
+ }), u.loading = !0;
44
+ const a = await R(s);
45
+ b.value = a.table || [], o.value.total = a.total || 0, u.loading = !1;
46
+ } catch {
47
+ u.loading = !1;
48
+ } finally {
49
+ u.loading = !1;
50
+ }
51
+ };
52
+ function q(e) {
53
+ o.value.pageSize = e, l();
54
+ }
55
+ function x(e) {
56
+ o.value.currentPage = e, l();
57
+ }
58
+ const C = (e) => {
59
+ c.value = !0, p.value = e ? JSON.parse(JSON.stringify(e)) : {};
60
+ }, z = async (e) => {
61
+ const a = e.id;
62
+ G.confirm("确定要删除这条数据吗?", "警告", {
63
+ confirmButtonText: "确定",
64
+ cancelButtonText: "取消",
65
+ type: "warning"
66
+ }).then(() => {
67
+ U({
68
+ tableId: i.query.menuId,
69
+ idList: [a]
70
+ }).then((m) => {
71
+ if (m.code !== "ok") {
72
+ r.error(m.message || "删除失败");
73
+ return;
74
+ }
75
+ r.success("删除成功"), l();
76
+ }).catch((m) => {
77
+ r.error("删除失败");
78
+ });
79
+ }).catch(() => {
80
+ });
81
+ }, P = async (e) => {
82
+ g.value = !0;
83
+ try {
84
+ const a = await Y({
85
+ tableId: i.query.menuId,
86
+ params: {
87
+ formId: i.query.menuId,
88
+ ...e
89
+ }
90
+ });
91
+ if (a.code !== "ok") {
92
+ r.error(a.message || "请求失败");
93
+ return;
94
+ }
95
+ r.success("操作成功"), l(), c.value = !1;
96
+ } catch {
97
+ } finally {
98
+ g.value = !1;
99
+ }
100
+ }, T = n([]), k = (e) => {
101
+ T.value = e;
102
+ }, A = (e = s) => {
103
+ Object.assign(s, {
104
+ pageSize: o.value.pageSize,
105
+ page: o.value.currentPage,
106
+ tableId: i.query.menuId,
107
+ params: e
108
+ }), Q(s);
109
+ };
110
+ return M(() => {
111
+ I();
112
+ }), (e, a) => {
113
+ const m = B, E = L, w = F;
114
+ return H(), j("div", K, [
115
+ _(m, {
116
+ config: t(f),
117
+ onSearch: D,
118
+ onAddData: C,
119
+ onExport: A
120
+ }, null, 8, ["config"]),
121
+ _(E, {
122
+ "table-config": t(u),
123
+ "table-data": t(b),
124
+ tableColumn: t(y),
125
+ seqType: "checkbox",
126
+ paginationConfig: t(o),
127
+ onHandleEdit: C,
128
+ onHandleDelete: z,
129
+ onPageSizeChange: q,
130
+ onCurrentChange: x,
131
+ onSelectionChange: k
132
+ }, null, 8, ["table-config", "table-data", "tableColumn", "paginationConfig"]),
133
+ _(w, {
134
+ title: t(v),
135
+ loading: t(g),
136
+ formData: t(p),
137
+ "onUpdate:formData": a[0] || (a[0] = (d) => S(p) ? p.value = d : null),
138
+ editVisible: t(c),
139
+ "onUpdate:editVisible": a[1] || (a[1] = (d) => S(c) ? c.value = d : null),
140
+ config: t(f),
141
+ onConfirm: P
142
+ }, null, 8, ["title", "loading", "formData", "editVisible", "config"])
143
+ ]);
144
+ };
145
+ }
146
+ }), ne = /* @__PURE__ */ N(W, [["__scopeId", "data-v-f338d41e"]]);
147
+ export {
148
+ ne as default
149
+ };
@@ -0,0 +1,126 @@
1
+ import { r as q, g as B, E as D, d as F, v as j } from "./globalComponents-NGC1jMmM.js";
2
+ import { E as I, a as M } from "./el-form-item-DGYKf4A6.js";
3
+ import { defineComponent as N, ref as i, reactive as O, createBlock as v, openBlock as g, withCtx as l, createVNode as t, withDirectives as T, createTextVNode as V } from "vue";
4
+ const A = (c) => q.post("/role/mergeRole", c), G = /* @__PURE__ */ N({
5
+ name: "RoleModal",
6
+ __name: "RoleModal",
7
+ emits: ["confirm"],
8
+ setup(c, { expose: b, emit: k }) {
9
+ const s = i(!1), r = i(!1), f = i("新增角色"), m = i(), o = O({
10
+ name: "",
11
+ code: "",
12
+ description: ""
13
+ }), x = {
14
+ code: [{ required: !0, message: "请输入角色编码", trigger: "blur" }],
15
+ name: [{ required: !0, message: "请输入角色名称", trigger: "blur" }]
16
+ }, E = k, w = (d, e = "新增角色") => {
17
+ r.value = !1, s.value = !0, f.value = e, Object.keys(o).forEach((n) => {
18
+ delete o[n];
19
+ }), Object.assign(o, {
20
+ name: "",
21
+ code: "",
22
+ description: "",
23
+ ...d
24
+ });
25
+ }, u = () => {
26
+ s.value = !1, m.value?.resetFields();
27
+ }, y = async () => {
28
+ try {
29
+ await m.value?.validate(), r.value = !0, (await A(o)).code === "ok" ? (E("confirm", { ...o }), u()) : r.value = !1;
30
+ } catch {
31
+ r.value = !1;
32
+ }
33
+ };
34
+ return b({
35
+ open: w
36
+ }), (d, e) => {
37
+ const n = D, p = M, C = I, _ = F, R = B, U = j;
38
+ return g(), v(R, {
39
+ modelValue: s.value,
40
+ "onUpdate:modelValue": e[3] || (e[3] = (a) => s.value = a),
41
+ title: f.value,
42
+ width: "500px",
43
+ "close-on-click-modal": !1,
44
+ onClose: u
45
+ }, {
46
+ footer: l(() => [
47
+ t(_, { onClick: u }, {
48
+ default: l(() => [...e[4] || (e[4] = [
49
+ V("取消", -1)
50
+ ])]),
51
+ _: 1
52
+ }),
53
+ T((g(), v(_, {
54
+ type: "primary",
55
+ onClick: y
56
+ }, {
57
+ default: l(() => [...e[5] || (e[5] = [
58
+ V("确定", -1)
59
+ ])]),
60
+ _: 1
61
+ })), [
62
+ [U, r.value]
63
+ ])
64
+ ]),
65
+ default: l(() => [
66
+ t(C, {
67
+ ref_key: "formRef",
68
+ ref: m,
69
+ model: o,
70
+ rules: x,
71
+ "label-width": "100px"
72
+ }, {
73
+ default: l(() => [
74
+ t(p, {
75
+ label: "角色编码",
76
+ prop: "code"
77
+ }, {
78
+ default: l(() => [
79
+ t(n, {
80
+ modelValue: o.code,
81
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => o.code = a),
82
+ placeholder: "请输入角色编码"
83
+ }, null, 8, ["modelValue"])
84
+ ]),
85
+ _: 1
86
+ }),
87
+ t(p, {
88
+ label: "角色名称",
89
+ prop: "name"
90
+ }, {
91
+ default: l(() => [
92
+ t(n, {
93
+ modelValue: o.name,
94
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => o.name = a),
95
+ placeholder: "请输入角色名称"
96
+ }, null, 8, ["modelValue"])
97
+ ]),
98
+ _: 1
99
+ }),
100
+ t(p, {
101
+ label: "角色描述",
102
+ prop: "description"
103
+ }, {
104
+ default: l(() => [
105
+ t(n, {
106
+ modelValue: o.description,
107
+ "onUpdate:modelValue": e[2] || (e[2] = (a) => o.description = a),
108
+ placeholder: "请输入角色描述",
109
+ type: "textarea",
110
+ rows: 3
111
+ }, null, 8, ["modelValue"])
112
+ ]),
113
+ _: 1
114
+ })
115
+ ]),
116
+ _: 1
117
+ }, 8, ["model"])
118
+ ]),
119
+ _: 1
120
+ }, 8, ["modelValue", "title"]);
121
+ };
122
+ }
123
+ });
124
+ export {
125
+ G as default
126
+ };
@@ -0,0 +1,200 @@
1
+ import { g as w, E as F, p as B, q as M, h as R, i as I, d as O, _ as j } from "./globalComponents-NGC1jMmM.js";
2
+ import { E as D, a as L } from "./el-form-item-DGYKf4A6.js";
3
+ /* empty css */
4
+ import { defineComponent as T, ref as u, reactive as G, createBlock as V, openBlock as f, withCtx as a, createVNode as o, createElementBlock as S, Fragment as $, renderList as h, createTextVNode as m } from "vue";
5
+ const z = /* @__PURE__ */ T({
6
+ name: "UserModal",
7
+ __name: "UserModal",
8
+ setup(A, { expose: c }) {
9
+ const d = u(!1), g = u("用户"), s = u(), v = u([]), t = G({
10
+ name: "",
11
+ userNumber: "",
12
+ phone: "",
13
+ email: "",
14
+ departmentCode: "",
15
+ gender: ""
16
+ }), E = {
17
+ name: [{ required: !0, message: "请输入姓名", trigger: "blur" }],
18
+ userNumber: [{ required: !0, message: "请输入工号", trigger: "blur" }],
19
+ phone: [
20
+ { required: !0, message: "请输入手机号", trigger: "blur" },
21
+ {
22
+ pattern: /^1[3-9]\d{9}$/,
23
+ message: "请输入正确的手机号码",
24
+ trigger: "blur"
25
+ }
26
+ ],
27
+ email: [
28
+ { required: !0, message: "请输入邮箱", trigger: "blur" },
29
+ { type: "email", message: "请输入正确的邮箱地址", trigger: "blur" }
30
+ ],
31
+ departmentCode: [
32
+ { required: !0, message: "请选择部门", trigger: "change" }
33
+ ],
34
+ gender: [{ required: !0, message: "请选择性别", trigger: "change" }]
35
+ }, C = (i, e = "新增用户") => {
36
+ d.value = !0, g.value = e, Object.keys(t).forEach((r) => {
37
+ delete t[r];
38
+ }), Object.assign(t, i);
39
+ }, p = () => {
40
+ d.value = !1, s.value?.resetFields();
41
+ }, U = async () => {
42
+ try {
43
+ await s.value?.validate(), p();
44
+ } catch {
45
+ }
46
+ };
47
+ return c({
48
+ open: C
49
+ }), (i, e) => {
50
+ const r = F, n = L, k = M, y = B, _ = I, x = R, q = D, b = O, N = w;
51
+ return f(), V(N, {
52
+ modelValue: d.value,
53
+ "onUpdate:modelValue": e[6] || (e[6] = (l) => d.value = l),
54
+ title: g.value,
55
+ width: "600px",
56
+ "close-on-click-modal": !1,
57
+ onClose: p
58
+ }, {
59
+ footer: a(() => [
60
+ o(b, { onClick: p }, {
61
+ default: a(() => [...e[9] || (e[9] = [
62
+ m("取消", -1)
63
+ ])]),
64
+ _: 1
65
+ }),
66
+ o(b, {
67
+ type: "primary",
68
+ onClick: U
69
+ }, {
70
+ default: a(() => [...e[10] || (e[10] = [
71
+ m("确定", -1)
72
+ ])]),
73
+ _: 1
74
+ })
75
+ ]),
76
+ default: a(() => [
77
+ o(q, {
78
+ ref_key: "formRef",
79
+ ref: s,
80
+ model: t,
81
+ rules: E,
82
+ "label-width": "80px"
83
+ }, {
84
+ default: a(() => [
85
+ o(n, {
86
+ label: "姓名",
87
+ prop: "name"
88
+ }, {
89
+ default: a(() => [
90
+ o(r, {
91
+ modelValue: t.name,
92
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => t.name = l),
93
+ placeholder: "请输入姓名"
94
+ }, null, 8, ["modelValue"])
95
+ ]),
96
+ _: 1
97
+ }),
98
+ o(n, {
99
+ label: "工号",
100
+ prop: "userNumber"
101
+ }, {
102
+ default: a(() => [
103
+ o(r, {
104
+ modelValue: t.userNumber,
105
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => t.userNumber = l),
106
+ placeholder: "请输入工号"
107
+ }, null, 8, ["modelValue"])
108
+ ]),
109
+ _: 1
110
+ }),
111
+ o(n, {
112
+ label: "手机号",
113
+ prop: "phone"
114
+ }, {
115
+ default: a(() => [
116
+ o(r, {
117
+ modelValue: t.phone,
118
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => t.phone = l),
119
+ placeholder: "请输入手机号"
120
+ }, null, 8, ["modelValue"])
121
+ ]),
122
+ _: 1
123
+ }),
124
+ o(n, {
125
+ label: "邮箱",
126
+ prop: "email"
127
+ }, {
128
+ default: a(() => [
129
+ o(r, {
130
+ modelValue: t.email,
131
+ "onUpdate:modelValue": e[3] || (e[3] = (l) => t.email = l),
132
+ placeholder: "请输入邮箱"
133
+ }, null, 8, ["modelValue"])
134
+ ]),
135
+ _: 1
136
+ }),
137
+ o(n, {
138
+ label: "部门",
139
+ prop: "departmentCode"
140
+ }, {
141
+ default: a(() => [
142
+ o(y, {
143
+ modelValue: t.departmentCode,
144
+ "onUpdate:modelValue": e[4] || (e[4] = (l) => t.departmentCode = l),
145
+ placeholder: "请选择部门",
146
+ filterable: "",
147
+ style: { width: "100%" }
148
+ }, {
149
+ default: a(() => [
150
+ (f(!0), S($, null, h(v.value, (l) => (f(), V(k, {
151
+ key: l.code,
152
+ label: l.name,
153
+ value: l.code
154
+ }, null, 8, ["label", "value"]))), 128))
155
+ ]),
156
+ _: 1
157
+ }, 8, ["modelValue"])
158
+ ]),
159
+ _: 1
160
+ }),
161
+ o(n, {
162
+ label: "性别",
163
+ prop: "gender"
164
+ }, {
165
+ default: a(() => [
166
+ o(x, {
167
+ modelValue: t.gender,
168
+ "onUpdate:modelValue": e[5] || (e[5] = (l) => t.gender = l)
169
+ }, {
170
+ default: a(() => [
171
+ o(_, { label: "M" }, {
172
+ default: a(() => [...e[7] || (e[7] = [
173
+ m("男", -1)
174
+ ])]),
175
+ _: 1
176
+ }),
177
+ o(_, { label: "F" }, {
178
+ default: a(() => [...e[8] || (e[8] = [
179
+ m("女", -1)
180
+ ])]),
181
+ _: 1
182
+ })
183
+ ]),
184
+ _: 1
185
+ }, 8, ["modelValue"])
186
+ ]),
187
+ _: 1
188
+ })
189
+ ]),
190
+ _: 1
191
+ }, 8, ["model"])
192
+ ]),
193
+ _: 1
194
+ }, 8, ["modelValue", "title"]);
195
+ };
196
+ }
197
+ }), Q = /* @__PURE__ */ j(z, [["__scopeId", "data-v-4e9cafbf"]]);
198
+ export {
199
+ Q as default
200
+ };