xyvcard-npc 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # pnpm publish --no-git-checks
2
+ npm config set registry https://registry.npmjs.org/
3
+
4
+ # pnpm install
5
+ npm config set registry https://registry.npmmirror.com/
6
+
7
+
8
+ This template should help get you started developing with Vue 3 in Vite.
9
+
10
+ ## Recommended IDE Setup
11
+
12
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
13
+
14
+ ## Type Support for `.vue` Imports in TS
15
+
16
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
17
+
18
+ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
19
+
20
+ 1. Disable the built-in TypeScript Extension
21
+ 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
22
+ 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
23
+ 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
24
+
25
+ ## Customize configuration
26
+
27
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
28
+
29
+ ## Project Setup
30
+
31
+ ```sh
32
+ pnpm install
33
+ ```
34
+
35
+ ### Compile and Hot-Reload for Development
36
+
37
+ ```sh
38
+ pnpm dev
39
+ ```
40
+
41
+ ### Type-Check, Compile and Minify for Production
42
+
43
+ ```sh
44
+ pnpm build
45
+ ```
46
+
47
+ ### Lint with [ESLint](https://eslint.org/)
48
+
49
+ ```sh
50
+ pnpm lint
51
+ ```
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./edit.vue_vue_type_script_setup_true_lang-DY3AI0IZ.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,467 @@
1
+ import { defineComponent as D, createElementBlock as E, openBlock as h, createElementVNode as K, ref as y, toRefs as Q, watchEffect as X, computed as Y, resolveComponent as b, createBlock as U, withCtx as r, createVNode as n, unref as _, mergeModels as z, reactive as O, useModel as Z, Fragment as ee, renderList as te, createTextVNode as j, toDisplayString as A } from "vue";
2
+ import { ElMessage as B } from "element-plus";
3
+ import { useI18n as oe } from "vue-i18n";
4
+ import { useUserStore as c, clearEmpty as d, request as i, fileApi as $ } from "jmash-core";
5
+ import { q as H, U as ae, D as le } from "./index-Cnbbw65d.mjs";
6
+ import { useRoute as ne } from "vue-router";
7
+ class re {
8
+ getKey(e) {
9
+ return {
10
+ robotId: e.robotId
11
+ };
12
+ }
13
+ // 查询翻页信息话题机器人
14
+ findPage(e) {
15
+ const o = c().user.tenant;
16
+ return d(e), i({
17
+ url: "/v1/npc/topic_robot/page/" + o,
18
+ method: "get",
19
+ params: e
20
+ });
21
+ }
22
+ // 查询列表信息话题机器人
23
+ findList(e) {
24
+ const o = c().user.tenant;
25
+ return d(e), i({
26
+ url: "/v1/npc/topic_robot/list/" + o,
27
+ method: "get",
28
+ params: e
29
+ });
30
+ }
31
+ // 查询话题机器人
32
+ findById(e) {
33
+ const o = c().user.tenant;
34
+ return d(e), i({
35
+ url: "/v1/npc/topic_robot/id/" + o + "/" + e.robotId,
36
+ method: "get"
37
+ });
38
+ }
39
+ // 创建实体话题机器人
40
+ create(e) {
41
+ return e.tenant = c().user.tenant, d(e), i({
42
+ url: "/v1/npc/topic_robot",
43
+ method: "post",
44
+ data: e
45
+ });
46
+ }
47
+ // 修改实体话题机器人
48
+ update(e) {
49
+ return e.tenant = c().user.tenant, d(e), i({
50
+ url: "/v1/npc/topic_robot",
51
+ method: "patch",
52
+ data: e
53
+ });
54
+ }
55
+ // 上移下移
56
+ move(e, o) {
57
+ let t = { ...e };
58
+ return t.tenant = c().user.tenant, t.up = o, d(t), i({
59
+ url: "/v1/npc/topic_robot/move",
60
+ method: "put",
61
+ data: t
62
+ });
63
+ }
64
+ // 启用/禁用
65
+ enable(e, o) {
66
+ let t = { ...e };
67
+ return t.tenant = c().user.tenant, t.enable = o, d(t), i({
68
+ url: "/v1/npc/topic_robot/enable",
69
+ method: "put",
70
+ data: t
71
+ });
72
+ }
73
+ // 删除话题机器人
74
+ delete(e) {
75
+ return e.tenant = c().user.tenant, d(e), i({
76
+ url: "/v1/npc/topic_robot/id",
77
+ method: "delete",
78
+ params: e
79
+ });
80
+ }
81
+ // 批量删除话题机器人
82
+ batchDelete(e) {
83
+ const o = e.map((u) => u.robotId), t = {
84
+ tenant: c().user.tenant,
85
+ robotId: o
86
+ };
87
+ return d(t), i({
88
+ url: "/v1/npc/topic_robot/batch",
89
+ method: "put",
90
+ data: t
91
+ });
92
+ }
93
+ // 下载导入模板话题机器人
94
+ downloadTemplate() {
95
+ const e = c().user.tenant;
96
+ return i({
97
+ url: "/v1/npc/topic_robot/" + e + "/template.xlsx",
98
+ method: "get",
99
+ responseType: "blob",
100
+ params: {
101
+ tenant: c().user.tenant
102
+ }
103
+ });
104
+ }
105
+ // 导入话题机器人
106
+ importExcel(e) {
107
+ return e.tenant = c().user.tenant, d(e), i({
108
+ url: "/v1/npc/topic_robot/import",
109
+ method: "patch",
110
+ data: e
111
+ });
112
+ }
113
+ // 导出话题机器人Excel文件
114
+ exportExcel(e) {
115
+ const o = c().user.tenant;
116
+ d(e);
117
+ const t = H.stringify(e, {
118
+ arrayFormat: "brackets",
119
+ allowDots: !0
120
+ });
121
+ return i({
122
+ url: "/v1/npc/topic_robot/" + o + "/topic_robots.xlsx?" + t,
123
+ method: "get",
124
+ responseType: "blob"
125
+ });
126
+ }
127
+ // 打印话题机器人PDF文件
128
+ exportPdf(e) {
129
+ const o = c().user.tenant;
130
+ d(e);
131
+ const t = H.stringify(e, {
132
+ arrayFormat: "brackets",
133
+ allowDots: !0
134
+ });
135
+ return i({
136
+ url: "/v1/npc/topic_robot/" + o + "/topic_robots.pdf?" + t,
137
+ method: "get",
138
+ responseType: "blob"
139
+ });
140
+ }
141
+ }
142
+ const q = new re();
143
+ /*! Element Plus Icons Vue v2.3.2 */
144
+ var se = /* @__PURE__ */ D({
145
+ name: "Plus",
146
+ __name: "plus",
147
+ setup(g) {
148
+ return (e, o) => (h(), E("svg", {
149
+ xmlns: "http://www.w3.org/2000/svg",
150
+ viewBox: "0 0 1024 1024"
151
+ }, [
152
+ K("path", {
153
+ fill: "currentColor",
154
+ d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
155
+ })
156
+ ]));
157
+ }
158
+ }), ce = se;
159
+ const ue = ["src"], ie = /* @__PURE__ */ D({
160
+ __name: "index",
161
+ props: {
162
+ pictureUrl: {
163
+ type: String,
164
+ default: ""
165
+ },
166
+ // 宽
167
+ width: {
168
+ type: Number,
169
+ default: 80
170
+ },
171
+ // 高
172
+ height: {
173
+ type: Number,
174
+ default: 80
175
+ },
176
+ // 类型
177
+ type: {
178
+ type: String,
179
+ default: "resize"
180
+ }
181
+ },
182
+ emits: ["imageSrc", "imageUrl"],
183
+ setup(g, { emit: e }) {
184
+ const o = y($.uploadUrl()), t = y($.authHeader()), u = g, { pictureUrl: I } = Q(u), a = y("");
185
+ a.value = I.value;
186
+ const k = e, C = (p, v) => {
187
+ p.fileSrc && (B({
188
+ message: "上传成功",
189
+ type: "success"
190
+ }), a.value = p.fileSrc, k("imageSrc", v), k("imageUrl", a.value));
191
+ };
192
+ X(() => {
193
+ a.value = u.pictureUrl;
194
+ });
195
+ const S = Y(() => u.pictureUrl.startsWith("http://") || u.pictureUrl.startsWith("https://") ? a.value : $.imageUrl(
196
+ a.value,
197
+ u.width,
198
+ u.height,
199
+ u.type
200
+ ));
201
+ return (p, v) => {
202
+ const R = b("el-icon"), N = b("el-upload");
203
+ return h(), U(N, {
204
+ class: "avatar-uploader",
205
+ action: o.value,
206
+ headers: t.value,
207
+ "show-file-list": !1,
208
+ "on-success": C
209
+ }, {
210
+ default: r(() => [
211
+ a.value ? (h(), E("img", {
212
+ key: 0,
213
+ src: S.value,
214
+ class: "avatar",
215
+ alt: ""
216
+ }, null, 8, ue)) : (h(), U(R, {
217
+ key: 1,
218
+ class: "avatar-uploader-icon"
219
+ }, {
220
+ default: r(() => [
221
+ n(_(ce))
222
+ ]),
223
+ _: 1
224
+ }))
225
+ ]),
226
+ _: 1
227
+ }, 8, ["action", "headers"]);
228
+ };
229
+ }
230
+ }), pe = { class: "dialog-footer" }, de = /* @__PURE__ */ D({
231
+ __name: "edit",
232
+ props: /* @__PURE__ */ z({
233
+ entityKey: {
234
+ type: Object,
235
+ default: () => {
236
+ }
237
+ }
238
+ }, {
239
+ modelValue: { type: Boolean },
240
+ modelModifiers: {}
241
+ }),
242
+ emits: /* @__PURE__ */ z(["refresh"], ["update:modelValue"]),
243
+ setup(g, { emit: e }) {
244
+ const o = new ae({
245
+ roleCode: "npc"
246
+ });
247
+ o.useValues();
248
+ const { t } = oe(), u = ne(), I = y();
249
+ console.log(le.userListBizDict.values, "=> userListBizDict");
250
+ let a = O({
251
+ requestId: Math.random() * 10 + "",
252
+ updateMask: "userId,robotContent,nickName,headImage",
253
+ topicId: u.query.topicId
254
+ });
255
+ const k = O({
256
+ nickName: [
257
+ {
258
+ required: !0,
259
+ message: t("topicRobot.nickNameRequired"),
260
+ trigger: "change"
261
+ }
262
+ ],
263
+ headImage: [
264
+ {
265
+ required: !0,
266
+ message: t("topicRobot.headImageRequired"),
267
+ trigger: "change"
268
+ }
269
+ ],
270
+ robotContent: [
271
+ {
272
+ required: !0,
273
+ message: t("topicRobot.robotContentRequired"),
274
+ trigger: "change"
275
+ }
276
+ ]
277
+ });
278
+ function C(l) {
279
+ a.headImage = l.response.fileSrc, console.log(a.headImage, "=>data.response.fileSrc ");
280
+ }
281
+ function S(l) {
282
+ if (!l) {
283
+ a.nickName = "", a.headImage = "";
284
+ return;
285
+ }
286
+ const s = o.values.find((x) => x.key === l);
287
+ console.log("Found selectUser:", s), s && (a.nickName = s.label || "", a.headImage = s.avatar);
288
+ }
289
+ const p = Z(g, "modelValue"), v = g, R = e, N = Object.keys(v.entityKey), F = y(N.length >= 1);
290
+ F.value && q.findById(v.entityKey).then(({ data: l }) => {
291
+ Object.assign(a, l);
292
+ });
293
+ const P = async () => {
294
+ var l;
295
+ await ((l = I.value) == null ? void 0 : l.validate((m) => {
296
+ m && (F.value ? q.update(a).then((s) => {
297
+ console.log(s), s.status === 200 && (B({
298
+ message: t("common.submitSuccess"),
299
+ type: "success"
300
+ }), p.value && (p.value = !1), R("refresh", s.status === 200));
301
+ }) : q.create(a).then((s) => {
302
+ console.log(s), s.status === 200 && (B({
303
+ message: t("common.submitSuccess"),
304
+ type: "success"
305
+ }), p.value && (p.value = !1), R("refresh", s.status === 200));
306
+ }));
307
+ }));
308
+ };
309
+ function L() {
310
+ p.value && (p.value = !1);
311
+ }
312
+ return (l, m) => {
313
+ const s = b("el-option"), x = b("el-select"), w = b("el-form-item"), V = b("el-col"), M = b("el-input"), W = b("el-row"), G = b("el-form"), T = b("el-button"), J = b("el-dialog");
314
+ return h(), U(J, {
315
+ modelValue: p.value,
316
+ "onUpdate:modelValue": m[3] || (m[3] = (f) => p.value = f),
317
+ onClose: L
318
+ }, {
319
+ footer: r(() => [
320
+ K("div", pe, [
321
+ n(T, { onClick: L }, {
322
+ default: r(() => [
323
+ j(A(l.$t("common.cancel")), 1)
324
+ ]),
325
+ _: 1
326
+ }),
327
+ n(T, {
328
+ type: "primary",
329
+ onClick: P
330
+ }, {
331
+ default: r(() => [
332
+ j(A(l.$t("common.confirm")), 1)
333
+ ]),
334
+ _: 1
335
+ })
336
+ ])
337
+ ]),
338
+ default: r(() => [
339
+ n(G, {
340
+ ref_key: "topicRobotFormRef",
341
+ ref: I,
342
+ model: _(a),
343
+ "label-width": "120px",
344
+ rules: k
345
+ }, {
346
+ default: r(() => [
347
+ n(W, null, {
348
+ default: r(() => [
349
+ n(V, { span: 24 }, {
350
+ default: r(() => [
351
+ n(w, {
352
+ label: l.$t("topicRobot.userId"),
353
+ prop: "userId"
354
+ }, {
355
+ default: r(() => [
356
+ n(x, {
357
+ modelValue: _(a).userId,
358
+ "onUpdate:modelValue": m[0] || (m[0] = (f) => _(a).userId = f),
359
+ placeholder: l.$t("topicRobot.userIdRequired"),
360
+ clearable: "",
361
+ filterable: "",
362
+ "check-strictly": "",
363
+ "render-after-expand": !1,
364
+ "allow-create": "",
365
+ onChange: S
366
+ }, {
367
+ default: r(() => [
368
+ (h(!0), E(ee, null, te(_(o).values, (f) => (h(), U(s, {
369
+ key: f.key,
370
+ label: f.value,
371
+ value: f.key
372
+ }, null, 8, ["label", "value"]))), 128))
373
+ ]),
374
+ _: 1
375
+ }, 8, ["modelValue", "placeholder"])
376
+ ]),
377
+ _: 1
378
+ }, 8, ["label"])
379
+ ]),
380
+ _: 1
381
+ }),
382
+ n(V, { span: 24 }, {
383
+ default: r(() => [
384
+ n(w, {
385
+ label: l.$t("topicRobot.nickName"),
386
+ prop: "nickName"
387
+ }, {
388
+ default: r(() => [
389
+ n(M, {
390
+ modelValue: _(a).nickName,
391
+ "onUpdate:modelValue": m[1] || (m[1] = (f) => _(a).nickName = f),
392
+ placeholder: l.$t("topicRobot.nickNameRequired"),
393
+ clearable: ""
394
+ }, null, 8, ["modelValue", "placeholder"])
395
+ ]),
396
+ _: 1
397
+ }, 8, ["label"])
398
+ ]),
399
+ _: 1
400
+ }),
401
+ n(V, { span: 24 }, {
402
+ default: r(() => [
403
+ n(w, {
404
+ label: l.$t("topicRobot.headImage"),
405
+ prop: "headImage"
406
+ }, {
407
+ default: r(() => [
408
+ n(ie, {
409
+ "picture-url": _(a).headImage,
410
+ placeholder: l.$t("liveVideo.headImageRequired"),
411
+ onImageSrc: C,
412
+ width: 80,
413
+ type: "trans"
414
+ }, null, 8, ["picture-url", "placeholder"])
415
+ ]),
416
+ _: 1
417
+ }, 8, ["label"])
418
+ ]),
419
+ _: 1
420
+ }),
421
+ n(V, { span: 24 }, {
422
+ default: r(() => [
423
+ n(w, {
424
+ label: l.$t("topicRobot.robotContent"),
425
+ prop: "robotContent"
426
+ }, {
427
+ default: r(() => [
428
+ n(M, {
429
+ modelValue: _(a).robotContent,
430
+ "onUpdate:modelValue": m[2] || (m[2] = (f) => _(a).robotContent = f),
431
+ placeholder: l.$t("topicRobot.robotContentRequired"),
432
+ maxlength: "120",
433
+ "show-word-limit": "",
434
+ type: "textarea",
435
+ clearable: ""
436
+ }, null, 8, ["modelValue", "placeholder"])
437
+ ]),
438
+ _: 1
439
+ }, 8, ["label"])
440
+ ]),
441
+ _: 1
442
+ })
443
+ ]),
444
+ _: 1
445
+ })
446
+ ]),
447
+ _: 1
448
+ }, 8, ["model", "rules"])
449
+ ]),
450
+ _: 1
451
+ }, 8, ["modelValue"]);
452
+ };
453
+ }
454
+ }), me = (g, e) => {
455
+ const o = g.__vccOpts || g;
456
+ for (const [t, u] of e)
457
+ o[t] = u;
458
+ return o;
459
+ }, fe = /* @__PURE__ */ me(de, [["__scopeId", "data-v-ceaa8460"]]), Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
460
+ __proto__: null,
461
+ default: fe
462
+ }, Symbol.toStringTag, { value: "Module" }));
463
+ export {
464
+ fe as a,
465
+ Ie as e,
466
+ q as t
467
+ };