@billtaofbj/questionnaire 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.
- package/LICENSE +21 -0
- package/dist/index.cjs.js +248 -0
- package/dist/index.es.js +3137 -0
- package/dist/questionnaire.css +2 -0
- package/package.json +26 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,3137 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, h as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, onUnmounted as h, openBlock as g, reactive as _, ref as v, renderList as y, resolveComponent as b, toDisplayString as x, unref as S, watch as C, withCtx as w, withKeys as T, withModifiers as E } from "vue";
|
|
2
|
+
import { BrandWatermark as D } from "@billtaofbj/core";
|
|
3
|
+
import { useRoute as O, useRouter as k } from "vue-router";
|
|
4
|
+
import { ElMessage as A, ElMessageBox as ee } from "element-plus";
|
|
5
|
+
import * as te from "yjs";
|
|
6
|
+
import { HocuspocusProvider as ne } from "@hocuspocus/provider";
|
|
7
|
+
import { Bell as j, Clock as M, Close as re, Delete as N, Loading as ie, Monitor as P, Promotion as ae } from "@element-plus/icons-vue";
|
|
8
|
+
import F from "axios";
|
|
9
|
+
//#region \0plugin-vue:export-helper
|
|
10
|
+
var I = (e, t) => {
|
|
11
|
+
let n = e.__vccOpts || e;
|
|
12
|
+
for (let [e, r] of t) n[e] = r;
|
|
13
|
+
return n;
|
|
14
|
+
}, L = { class: "chat-header" }, oe = { class: "chat-header-left" }, R = { class: "chat-title" }, se = { class: "online-users-list" }, ce = { class: "online-user-item" }, le = { class: "online-user-name" }, ue = { key: 1 }, de = { class: "online-user-name" }, fe = { class: "chat-header-right" }, pe = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "chat-empty"
|
|
17
|
+
}, z = { class: "chat-empty-hint" }, me = { key: 1 }, he = { class: "message-content" }, ge = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "message-meta"
|
|
20
|
+
}, _e = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "message-mention"
|
|
23
|
+
}, ve = ["innerHTML"], ye = { class: "message-time" }, be = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "chat-message chat-message-ai"
|
|
26
|
+
}, xe = { class: "message-avatar ai" }, Se = { class: "chat-input-area" }, Ce = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "mention-popup"
|
|
29
|
+
}, we = ["onClick", "onMouseenter"], Te = { key: 1 }, Ee = /*#__PURE__*/ I({
|
|
30
|
+
__name: "AiChatPanel",
|
|
31
|
+
props: {
|
|
32
|
+
visible: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
messages: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
loading: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
panelWidth: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 360
|
|
47
|
+
},
|
|
48
|
+
isCollab: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
collabUsers: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => []
|
|
55
|
+
},
|
|
56
|
+
currentUser: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => ({
|
|
59
|
+
id: "",
|
|
60
|
+
name: "",
|
|
61
|
+
color: ""
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
isOwner: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !0
|
|
67
|
+
},
|
|
68
|
+
unreadMention: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
emits: [
|
|
74
|
+
"send",
|
|
75
|
+
"close",
|
|
76
|
+
"clear",
|
|
77
|
+
"clear-unread"
|
|
78
|
+
],
|
|
79
|
+
setup(c, { emit: l }) {
|
|
80
|
+
let p = c, m = l, h = v(""), _ = v(null), D = v(null), O = v(!1), k = v([]), A = v(0), ee = "", te = -1, ne = {
|
|
81
|
+
id: "ai-assistant",
|
|
82
|
+
name: "AI助手",
|
|
83
|
+
color: "#409EFF",
|
|
84
|
+
isAi: !0
|
|
85
|
+
}, M = t(() => {
|
|
86
|
+
let e = p.currentUser.id, t = /* @__PURE__ */ new Set();
|
|
87
|
+
return [ne, ...p.collabUsers.filter((n) => {
|
|
88
|
+
let r = n.clientId || n.id || "";
|
|
89
|
+
if (r && r === e) return !1;
|
|
90
|
+
let i = String(r || n.name || "");
|
|
91
|
+
return t.has(i) ? !1 : (t.add(i), !0);
|
|
92
|
+
})];
|
|
93
|
+
}), ie = t(() => M.value.length + 1), F = (e) => e.role === "ai" ? "chat-message-ai" : p.isCollab && e.user_id && e.user_id !== p.currentUser.id ? "chat-message-other" : "chat-message-user", I = (e) => e.role === "ai" ? { background: "linear-gradient(135deg, #409EFF, #337ECC)" } : { background: e.user_color || "#67C23A" }, Ee = (e) => (e.user_name || "U").charAt(0), De = (e) => {
|
|
94
|
+
if (!p.isCollab) return;
|
|
95
|
+
let t = typeof e == "string" ? e : e.target?.value || h.value, n = t.length, r = t.lastIndexOf("@", n);
|
|
96
|
+
if (r !== -1 && r < n) {
|
|
97
|
+
let e = t.slice(r + 1, n);
|
|
98
|
+
if (!e.includes(" ") && !e.includes("\n")) {
|
|
99
|
+
ee = e, te = r, k.value = M.value.filter((t) => t.name && t.name.toLowerCase().includes(e.toLowerCase())), O.value = k.value.length > 0, A.value = 0;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
O.value = !1;
|
|
104
|
+
}, B = () => {
|
|
105
|
+
O.value && (A.value = Math.min(A.value + 1, k.value.length - 1));
|
|
106
|
+
}, Oe = () => {
|
|
107
|
+
O.value && (A.value = Math.max(A.value - 1, 0));
|
|
108
|
+
}, V = (e) => {
|
|
109
|
+
let t = h.value.slice(0, te), n = h.value.slice(te + ee.length + 1);
|
|
110
|
+
h.value = `${t}@${e.name} ${n}`, O.value = !1;
|
|
111
|
+
}, H = (e) => {
|
|
112
|
+
if (e) {
|
|
113
|
+
if (e.shiftKey) return;
|
|
114
|
+
if (O.value) {
|
|
115
|
+
let t = k.value[A.value];
|
|
116
|
+
if (t) {
|
|
117
|
+
e.preventDefault(), V(t);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
}
|
|
123
|
+
let t = h.value.trim();
|
|
124
|
+
if (!t || p.loading) return;
|
|
125
|
+
let n = null;
|
|
126
|
+
if (p.isCollab) {
|
|
127
|
+
let e = t.match(/@(\S+)/);
|
|
128
|
+
e && (n = e[1]);
|
|
129
|
+
}
|
|
130
|
+
m("send", t, { mentionedUser: n }), h.value = "", O.value = !1;
|
|
131
|
+
}, ke = () => {
|
|
132
|
+
u(() => {
|
|
133
|
+
_.value && (_.value.scrollTop = _.value.scrollHeight);
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
return C(() => p.messages.length, ke), C(() => p.messages, ke, { deep: !0 }), (t, l) => {
|
|
137
|
+
let u = b("el-icon"), p = b("el-tag"), v = b("el-popover"), C = b("el-button"), ee = b("el-input");
|
|
138
|
+
return c.visible ? (g(), i("div", {
|
|
139
|
+
key: 0,
|
|
140
|
+
class: "ai-chat-panel",
|
|
141
|
+
style: f({ width: c.panelWidth + "px" })
|
|
142
|
+
}, [
|
|
143
|
+
a("div", L, [a("div", oe, [
|
|
144
|
+
s(u, {
|
|
145
|
+
size: 18,
|
|
146
|
+
color: "#409EFF"
|
|
147
|
+
}, {
|
|
148
|
+
default: w(() => [s(S(P))]),
|
|
149
|
+
_: 1
|
|
150
|
+
}),
|
|
151
|
+
a("span", R, x(c.isCollab ? "协作聊天" : "AI 助手"), 1),
|
|
152
|
+
c.isCollab ? (g(), n(v, {
|
|
153
|
+
key: 0,
|
|
154
|
+
width: 200,
|
|
155
|
+
placement: "bottom-start",
|
|
156
|
+
trigger: "click"
|
|
157
|
+
}, {
|
|
158
|
+
reference: w(() => [s(p, {
|
|
159
|
+
size: "small",
|
|
160
|
+
type: "success",
|
|
161
|
+
effect: "plain",
|
|
162
|
+
class: "online-tag"
|
|
163
|
+
}, {
|
|
164
|
+
default: w(() => [o(x(ie.value) + "人在线 ", 1)]),
|
|
165
|
+
_: 1
|
|
166
|
+
})]),
|
|
167
|
+
default: w(() => [a("div", se, [a("div", ce, [
|
|
168
|
+
a("div", {
|
|
169
|
+
class: "online-user-avatar",
|
|
170
|
+
style: f({ background: c.currentUser.color || "#409EFF" })
|
|
171
|
+
}, x((c.currentUser.name || "U").charAt(0)), 5),
|
|
172
|
+
a("span", le, x(c.currentUser.name || "我"), 1),
|
|
173
|
+
s(p, {
|
|
174
|
+
size: "small",
|
|
175
|
+
type: c.isOwner ? "warning" : "success",
|
|
176
|
+
effect: "plain",
|
|
177
|
+
class: "role-tag"
|
|
178
|
+
}, {
|
|
179
|
+
default: w(() => [o(x(c.isOwner ? "发起人" : "协作人"), 1)]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, ["type"]),
|
|
182
|
+
l[4] ||= a("span", { class: "self-tag" }, "(我)", -1)
|
|
183
|
+
]), (g(!0), i(e, null, y(M.value, (e) => (g(), i("div", {
|
|
184
|
+
key: e.id || e.clientId,
|
|
185
|
+
class: "online-user-item"
|
|
186
|
+
}, [
|
|
187
|
+
a("div", {
|
|
188
|
+
class: "online-user-avatar",
|
|
189
|
+
style: f({ background: e.color || "#909399" })
|
|
190
|
+
}, [e.isAi ? (g(), n(u, {
|
|
191
|
+
key: 0,
|
|
192
|
+
size: 14
|
|
193
|
+
}, {
|
|
194
|
+
default: w(() => [s(S(P))]),
|
|
195
|
+
_: 1
|
|
196
|
+
})) : (g(), i("span", ue, x((e.name || "U").charAt(0)), 1))], 4),
|
|
197
|
+
a("span", de, x(e.name || "未知用户"), 1),
|
|
198
|
+
e.isAi ? (g(), n(p, {
|
|
199
|
+
key: 0,
|
|
200
|
+
size: "small",
|
|
201
|
+
type: "primary",
|
|
202
|
+
effect: "plain",
|
|
203
|
+
class: "role-tag"
|
|
204
|
+
}, {
|
|
205
|
+
default: w(() => [...l[5] ||= [o("AI助手", -1)]]),
|
|
206
|
+
_: 1
|
|
207
|
+
})) : (g(), n(p, {
|
|
208
|
+
key: 1,
|
|
209
|
+
size: "small",
|
|
210
|
+
type: "success",
|
|
211
|
+
effect: "plain",
|
|
212
|
+
class: "role-tag"
|
|
213
|
+
}, {
|
|
214
|
+
default: w(() => [...l[6] ||= [o("协作人", -1)]]),
|
|
215
|
+
_: 1
|
|
216
|
+
}))
|
|
217
|
+
]))), 128))])]),
|
|
218
|
+
_: 1
|
|
219
|
+
})) : r("", !0)
|
|
220
|
+
]), a("div", fe, [
|
|
221
|
+
c.isCollab && c.unreadMention ? (g(), i("div", {
|
|
222
|
+
key: 0,
|
|
223
|
+
class: "mention-bell",
|
|
224
|
+
title: "有新消息",
|
|
225
|
+
onClick: l[0] ||= (e) => m("clear-unread")
|
|
226
|
+
}, [s(u, {
|
|
227
|
+
size: 18,
|
|
228
|
+
color: "#F56C6C"
|
|
229
|
+
}, {
|
|
230
|
+
default: w(() => [s(S(j))]),
|
|
231
|
+
_: 1
|
|
232
|
+
})])) : r("", !0),
|
|
233
|
+
s(C, {
|
|
234
|
+
text: "",
|
|
235
|
+
circle: "",
|
|
236
|
+
size: "small",
|
|
237
|
+
onClick: l[1] ||= (e) => t.$emit("clear"),
|
|
238
|
+
title: "清空对话"
|
|
239
|
+
}, {
|
|
240
|
+
default: w(() => [s(u, null, {
|
|
241
|
+
default: w(() => [s(S(N))]),
|
|
242
|
+
_: 1
|
|
243
|
+
})]),
|
|
244
|
+
_: 1
|
|
245
|
+
}),
|
|
246
|
+
s(C, {
|
|
247
|
+
text: "",
|
|
248
|
+
circle: "",
|
|
249
|
+
size: "small",
|
|
250
|
+
onClick: l[2] ||= (e) => t.$emit("close"),
|
|
251
|
+
title: "关闭"
|
|
252
|
+
}, {
|
|
253
|
+
default: w(() => [s(u, null, {
|
|
254
|
+
default: w(() => [s(S(re))]),
|
|
255
|
+
_: 1
|
|
256
|
+
})]),
|
|
257
|
+
_: 1
|
|
258
|
+
})
|
|
259
|
+
])]),
|
|
260
|
+
a("div", {
|
|
261
|
+
class: "chat-messages",
|
|
262
|
+
ref_key: "messagesRef",
|
|
263
|
+
ref: _
|
|
264
|
+
}, [
|
|
265
|
+
c.messages.length === 0 ? (g(), i("div", pe, [
|
|
266
|
+
s(u, {
|
|
267
|
+
size: 40,
|
|
268
|
+
color: "#c0c4cc"
|
|
269
|
+
}, {
|
|
270
|
+
default: w(() => [s(S(P))]),
|
|
271
|
+
_: 1
|
|
272
|
+
}),
|
|
273
|
+
a("p", null, x(c.isCollab ? "协作聊天室" : "你好!我是 AI 助手"), 1),
|
|
274
|
+
a("p", z, x(c.isCollab ? "与团队成员和AI助手实时聊天" : "可以问我任何关于文档编辑的问题"), 1)
|
|
275
|
+
])) : r("", !0),
|
|
276
|
+
(g(!0), i(e, null, y(c.messages, (e) => (g(), i("div", {
|
|
277
|
+
key: e._msgId || e.time + e.content,
|
|
278
|
+
class: d(["chat-message", F(e)])
|
|
279
|
+
}, [a("div", {
|
|
280
|
+
class: "message-avatar",
|
|
281
|
+
style: f(I(e))
|
|
282
|
+
}, [e.role === "ai" ? (g(), n(u, {
|
|
283
|
+
key: 0,
|
|
284
|
+
size: 16
|
|
285
|
+
}, {
|
|
286
|
+
default: w(() => [s(S(P))]),
|
|
287
|
+
_: 1
|
|
288
|
+
})) : (g(), i("span", me, x(Ee(e)), 1))], 4), a("div", he, [
|
|
289
|
+
c.isCollab && e.role === "user" ? (g(), i("div", ge, [a("span", {
|
|
290
|
+
class: "message-sender",
|
|
291
|
+
style: f({ color: e.user_color || "#67C23A" })
|
|
292
|
+
}, x(e.user_name || "用户"), 5), e.mentioned_user ? (g(), i("span", _e, "@" + x(e.mentioned_user), 1)) : r("", !0)])) : r("", !0),
|
|
293
|
+
a("div", {
|
|
294
|
+
class: "message-text",
|
|
295
|
+
innerHTML: e.content
|
|
296
|
+
}, null, 8, ve),
|
|
297
|
+
a("div", ye, x(e.time), 1)
|
|
298
|
+
])], 2))), 128)),
|
|
299
|
+
c.loading ? (g(), i("div", be, [a("div", xe, [s(u, { size: 16 }, {
|
|
300
|
+
default: w(() => [s(S(P))]),
|
|
301
|
+
_: 1
|
|
302
|
+
})]), l[7] ||= a("div", { class: "message-content" }, [a("div", { class: "message-text typing-indicator" }, [
|
|
303
|
+
a("span"),
|
|
304
|
+
a("span"),
|
|
305
|
+
a("span")
|
|
306
|
+
])], -1)])) : r("", !0)
|
|
307
|
+
], 512),
|
|
308
|
+
a("div", Se, [a("div", {
|
|
309
|
+
class: "chat-input-wrapper",
|
|
310
|
+
ref_key: "inputWrapperRef",
|
|
311
|
+
ref: D
|
|
312
|
+
}, [
|
|
313
|
+
s(ee, {
|
|
314
|
+
modelValue: h.value,
|
|
315
|
+
"onUpdate:modelValue": l[3] ||= (e) => h.value = e,
|
|
316
|
+
type: "textarea",
|
|
317
|
+
autosize: {
|
|
318
|
+
minRows: 1,
|
|
319
|
+
maxRows: 4
|
|
320
|
+
},
|
|
321
|
+
placeholder: c.isCollab ? "输入消息... @提及成员" : "输入消息...",
|
|
322
|
+
onKeydown: [
|
|
323
|
+
T(E(H, ["exact"]), ["enter"]),
|
|
324
|
+
T(E(B, ["prevent"]), ["down"]),
|
|
325
|
+
T(E(Oe, ["prevent"]), ["up"])
|
|
326
|
+
],
|
|
327
|
+
onInput: De,
|
|
328
|
+
resize: "none"
|
|
329
|
+
}, null, 8, [
|
|
330
|
+
"modelValue",
|
|
331
|
+
"placeholder",
|
|
332
|
+
"onKeydown"
|
|
333
|
+
]),
|
|
334
|
+
O.value ? (g(), i("div", Ce, [(g(!0), i(e, null, y(k.value, (e, t) => (g(), i("div", {
|
|
335
|
+
key: e.id || e.clientId,
|
|
336
|
+
class: d(["mention-item", { active: t === A.value }]),
|
|
337
|
+
onClick: (t) => V(e),
|
|
338
|
+
onMouseenter: (e) => A.value = t
|
|
339
|
+
}, [a("div", {
|
|
340
|
+
class: "mention-avatar",
|
|
341
|
+
style: f({ background: e.color || "#909399" })
|
|
342
|
+
}, [e.isAi ? (g(), n(u, {
|
|
343
|
+
key: 0,
|
|
344
|
+
size: 12
|
|
345
|
+
}, {
|
|
346
|
+
default: w(() => [s(S(P))]),
|
|
347
|
+
_: 1
|
|
348
|
+
})) : (g(), i("span", Te, x((e.name || "U").charAt(0)), 1))], 4), a("span", null, x(e.name), 1)], 42, we))), 128))])) : r("", !0),
|
|
349
|
+
s(C, {
|
|
350
|
+
class: "send-btn",
|
|
351
|
+
type: "primary",
|
|
352
|
+
circle: "",
|
|
353
|
+
disabled: !h.value.trim() || c.loading,
|
|
354
|
+
onClick: H
|
|
355
|
+
}, {
|
|
356
|
+
default: w(() => [s(u, null, {
|
|
357
|
+
default: w(() => [s(S(ae))]),
|
|
358
|
+
_: 1
|
|
359
|
+
})]),
|
|
360
|
+
_: 1
|
|
361
|
+
}, 8, ["disabled"])
|
|
362
|
+
], 512)])
|
|
363
|
+
], 4)) : r("", !0);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}, [["__scopeId", "data-v-01960100"]]), De = "/api/document-versions", B = 5e3, Oe = () => {
|
|
367
|
+
let e = v([]), t = v(!1);
|
|
368
|
+
return {
|
|
369
|
+
versions: e,
|
|
370
|
+
loading: t,
|
|
371
|
+
saveVersion: async ({ documentId: e, docType: t, content: n, userId: r, userName: i }) => {
|
|
372
|
+
if (!e || !t || !n) return null;
|
|
373
|
+
try {
|
|
374
|
+
let { data: a } = await F.post(De, {
|
|
375
|
+
document_id: e,
|
|
376
|
+
doc_type: t,
|
|
377
|
+
content: typeof n == "string" ? n : JSON.stringify(n),
|
|
378
|
+
user_id: r || null,
|
|
379
|
+
user_name: i || null
|
|
380
|
+
}, { timeout: B });
|
|
381
|
+
return a;
|
|
382
|
+
} catch (e) {
|
|
383
|
+
return console.warn("[useVersionHistory] Failed to save version:", e), null;
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
loadVersions: async (n) => {
|
|
387
|
+
if (!n) return [];
|
|
388
|
+
t.value = !0;
|
|
389
|
+
try {
|
|
390
|
+
let { data: t } = await F.get(De, {
|
|
391
|
+
params: { document_id: n },
|
|
392
|
+
timeout: B
|
|
393
|
+
});
|
|
394
|
+
return e.value = t, t;
|
|
395
|
+
} catch (t) {
|
|
396
|
+
return console.warn("[useVersionHistory] Failed to load versions:", t), e.value = [], [];
|
|
397
|
+
} finally {
|
|
398
|
+
t.value = !1;
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
getVersionContent: async (e) => {
|
|
402
|
+
try {
|
|
403
|
+
let { data: t } = await F.get(`${De}/${e}`, { timeout: B });
|
|
404
|
+
return t;
|
|
405
|
+
} catch (e) {
|
|
406
|
+
return console.warn("[useVersionHistory] Failed to get version content:", e), null;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
}, V = { class: "version-history-panel" }, H = {
|
|
411
|
+
key: 0,
|
|
412
|
+
class: "loading-state"
|
|
413
|
+
}, ke = {
|
|
414
|
+
key: 1,
|
|
415
|
+
class: "empty-state"
|
|
416
|
+
}, U = {
|
|
417
|
+
key: 2,
|
|
418
|
+
class: "version-list"
|
|
419
|
+
}, W = {
|
|
420
|
+
key: 0,
|
|
421
|
+
class: "current-version"
|
|
422
|
+
}, G = { class: "current-version-header" }, K = { class: "version-number" }, q = ["onClick"], J = { class: "version-number" }, Y = { class: "version-user" }, X = { class: "panel-footer" }, Ae = /*#__PURE__*/ I({
|
|
423
|
+
__name: "VersionHistoryPanel",
|
|
424
|
+
props: {
|
|
425
|
+
modelValue: {
|
|
426
|
+
type: Boolean,
|
|
427
|
+
default: !1
|
|
428
|
+
},
|
|
429
|
+
documentId: {
|
|
430
|
+
type: [Number, String],
|
|
431
|
+
default: null
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
emits: ["update:modelValue", "apply"],
|
|
435
|
+
setup(t, { expose: c, emit: l }) {
|
|
436
|
+
let u = t, f = l, { versions: p, loading: m, loadVersions: h, getVersionContent: _ } = Oe(), T = v(!1), E = v(null), D = v(!1), O = v(null);
|
|
437
|
+
C(() => u.modelValue, (e) => {
|
|
438
|
+
T.value = e, e && u.documentId && (E.value = null, h(u.documentId).then((e) => {
|
|
439
|
+
e && e.length > 0 && (O.value = e[0]);
|
|
440
|
+
}));
|
|
441
|
+
}), C(T, (e) => {
|
|
442
|
+
f("update:modelValue", e);
|
|
443
|
+
});
|
|
444
|
+
let k = (e) => {
|
|
445
|
+
E.value = e;
|
|
446
|
+
}, ee = async () => {
|
|
447
|
+
if (E.value) {
|
|
448
|
+
D.value = !0;
|
|
449
|
+
try {
|
|
450
|
+
let e = await _(E.value.id);
|
|
451
|
+
e && e.content ? (O.value = E.value, E.value = null, f("apply", e.content), A.success("已切换到版本 v" + O.value.version_number)) : A.error("获取版本内容失败");
|
|
452
|
+
} finally {
|
|
453
|
+
D.value = !1;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}, te = () => {
|
|
457
|
+
T.value = !1;
|
|
458
|
+
}, ne = (e) => {
|
|
459
|
+
if (!e) return "";
|
|
460
|
+
let t = new Date(e), n = (e) => String(e).padStart(2, "0");
|
|
461
|
+
return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;
|
|
462
|
+
};
|
|
463
|
+
return c({ currentVersion: O }), (t, c) => {
|
|
464
|
+
let l = b("el-icon"), u = b("el-tag"), f = b("el-timeline-item"), h = b("el-timeline"), _ = b("el-button"), v = b("el-drawer");
|
|
465
|
+
return g(), n(v, {
|
|
466
|
+
modelValue: T.value,
|
|
467
|
+
"onUpdate:modelValue": c[0] ||= (e) => T.value = e,
|
|
468
|
+
title: "更新履历",
|
|
469
|
+
direction: "rtl",
|
|
470
|
+
size: "420px",
|
|
471
|
+
"before-close": te
|
|
472
|
+
}, {
|
|
473
|
+
footer: w(() => [a("div", X, [s(_, {
|
|
474
|
+
type: "primary",
|
|
475
|
+
disabled: !E.value,
|
|
476
|
+
loading: D.value,
|
|
477
|
+
onClick: ee
|
|
478
|
+
}, {
|
|
479
|
+
default: w(() => [...c[4] ||= [o(" 切换到此版本 ", -1)]]),
|
|
480
|
+
_: 1
|
|
481
|
+
}, 8, ["disabled", "loading"])])]),
|
|
482
|
+
default: w(() => [a("div", V, [S(m) ? (g(), i("div", H, [s(l, { class: "is-loading" }, {
|
|
483
|
+
default: w(() => [s(S(ie))]),
|
|
484
|
+
_: 1
|
|
485
|
+
}), c[1] ||= a("span", null, "加载中...", -1)])) : S(p).length === 0 ? (g(), i("div", ke, [s(l, {
|
|
486
|
+
size: 48,
|
|
487
|
+
color: "#c0c4cc"
|
|
488
|
+
}, {
|
|
489
|
+
default: w(() => [s(S(M))]),
|
|
490
|
+
_: 1
|
|
491
|
+
}), c[2] ||= a("p", null, "暂无历史版本", -1)])) : (g(), i("div", U, [O.value ? (g(), i("div", W, [a("div", G, [s(u, {
|
|
492
|
+
type: "success",
|
|
493
|
+
size: "small"
|
|
494
|
+
}, {
|
|
495
|
+
default: w(() => [...c[3] ||= [o("当前版本", -1)]]),
|
|
496
|
+
_: 1
|
|
497
|
+
}), a("span", K, "v" + x(O.value.version_number), 1)])])) : r("", !0), s(h, null, {
|
|
498
|
+
default: w(() => [(g(!0), i(e, null, y(S(p), (e) => (g(), n(f, {
|
|
499
|
+
key: e.id,
|
|
500
|
+
timestamp: ne(e.created_at),
|
|
501
|
+
placement: "top",
|
|
502
|
+
type: E.value?.id === e.id ? "primary" : "",
|
|
503
|
+
hollow: E.value?.id !== e.id
|
|
504
|
+
}, {
|
|
505
|
+
default: w(() => [a("div", {
|
|
506
|
+
class: d(["version-item", { active: E.value?.id === e.id }]),
|
|
507
|
+
onClick: (t) => k(e)
|
|
508
|
+
}, [a("span", J, "版本号:v" + x(e.version_number), 1), a("span", Y, "提交人:" + x(e.user_name || "未知用户"), 1)], 10, q)]),
|
|
509
|
+
_: 2
|
|
510
|
+
}, 1032, [
|
|
511
|
+
"timestamp",
|
|
512
|
+
"type",
|
|
513
|
+
"hollow"
|
|
514
|
+
]))), 128))]),
|
|
515
|
+
_: 1
|
|
516
|
+
})]))])]),
|
|
517
|
+
_: 1
|
|
518
|
+
}, 8, ["modelValue"]);
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
}, [["__scopeId", "data-v-87924b7c"]]);
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region ../../src/composables/useChat.js
|
|
524
|
+
function je() {
|
|
525
|
+
let e = v([]), t = v(!1), n = v(!1), r = v([]), i = v({
|
|
526
|
+
id: "",
|
|
527
|
+
name: "",
|
|
528
|
+
color: ""
|
|
529
|
+
}), a = v(!1), o = null, s = null, c = null, l = /* @__PURE__ */ new Set(), u = "/api/chat", d = null, f = ({ ydoc: t, provider: s, onlineUsers: u }) => {
|
|
530
|
+
if (t) {
|
|
531
|
+
n.value = !0, c = u, d && d(), d = C(c, (e) => {
|
|
532
|
+
r.value = Array.isArray(e) ? e : [];
|
|
533
|
+
}, {
|
|
534
|
+
immediate: !0,
|
|
535
|
+
deep: !0
|
|
536
|
+
});
|
|
537
|
+
try {
|
|
538
|
+
o = t.getArray("chat-messages"), o.observe((t) => {
|
|
539
|
+
try {
|
|
540
|
+
t.changes.added.forEach((t) => {
|
|
541
|
+
t.content.getContent().forEach((t) => {
|
|
542
|
+
t && t._msgId && !l.has(t._msgId) && (l.add(t._msgId), e.value = [...e.value, t], t.mentioned_user && t.user_id !== i.value.id && (a.value = !0));
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
} catch (e) {
|
|
546
|
+
console.warn("[useChat] Y.Array observer error:", e);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
} catch (e) {
|
|
550
|
+
console.warn("[useChat] Failed to create Y.Array:", e);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}, p = (e) => {
|
|
554
|
+
i.value = {
|
|
555
|
+
...i.value,
|
|
556
|
+
...e
|
|
557
|
+
};
|
|
558
|
+
}, m = (e) => {
|
|
559
|
+
r.value = e || [];
|
|
560
|
+
}, g = () => {
|
|
561
|
+
let e = /* @__PURE__ */ new Date();
|
|
562
|
+
return `${e.getHours().toString().padStart(2, "0")}:${e.getMinutes().toString().padStart(2, "0")}`;
|
|
563
|
+
}, _ = async (t, r = {}) => {
|
|
564
|
+
let a = {
|
|
565
|
+
_msgId: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
566
|
+
role: "user",
|
|
567
|
+
content: t,
|
|
568
|
+
time: g(),
|
|
569
|
+
user_id: i.value.id,
|
|
570
|
+
user_name: i.value.name,
|
|
571
|
+
user_color: i.value.color,
|
|
572
|
+
mentioned_user: r.mentionedUser || null
|
|
573
|
+
};
|
|
574
|
+
if (l.add(a._msgId), e.value = [...e.value, a], o && S(n)) try {
|
|
575
|
+
o.push([a]);
|
|
576
|
+
} catch (e) {
|
|
577
|
+
console.warn("[useChat] Failed to push to Y.Array:", e);
|
|
578
|
+
}
|
|
579
|
+
if (r.roomId) try {
|
|
580
|
+
await F.post(u, {
|
|
581
|
+
room_id: r.roomId,
|
|
582
|
+
role: "user",
|
|
583
|
+
content: t,
|
|
584
|
+
user_id: i.value.id,
|
|
585
|
+
user_name: i.value.name,
|
|
586
|
+
mentioned_user: r.mentionedUser || null
|
|
587
|
+
});
|
|
588
|
+
} catch (e) {
|
|
589
|
+
console.warn("[useChat] Failed to persist message:", e);
|
|
590
|
+
}
|
|
591
|
+
}, y = async (t, r) => {
|
|
592
|
+
let i = {
|
|
593
|
+
_msgId: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
594
|
+
role: "ai",
|
|
595
|
+
content: t,
|
|
596
|
+
time: g(),
|
|
597
|
+
user_id: "ai-assistant",
|
|
598
|
+
user_name: "AI助手"
|
|
599
|
+
};
|
|
600
|
+
if (l.add(i._msgId), e.value = [...e.value, i], o && S(n)) try {
|
|
601
|
+
o.push([i]);
|
|
602
|
+
} catch (e) {
|
|
603
|
+
console.warn("[useChat] Failed to push AI message to Y.Array:", e);
|
|
604
|
+
}
|
|
605
|
+
if (r) try {
|
|
606
|
+
await F.post(u, {
|
|
607
|
+
room_id: r,
|
|
608
|
+
role: "ai",
|
|
609
|
+
content: t,
|
|
610
|
+
user_id: "ai-assistant",
|
|
611
|
+
user_name: "AI助手"
|
|
612
|
+
});
|
|
613
|
+
} catch (e) {
|
|
614
|
+
console.warn("[useChat] Failed to persist AI message:", e);
|
|
615
|
+
}
|
|
616
|
+
}, b = async (t) => {
|
|
617
|
+
if (t) try {
|
|
618
|
+
let n = await F.get(u, { params: { room_id: t } });
|
|
619
|
+
if (Array.isArray(n.data)) {
|
|
620
|
+
let t = n.data.map((e) => ({
|
|
621
|
+
_msgId: e._msgId || `hist-${e.id || Date.now()}`,
|
|
622
|
+
role: e.role,
|
|
623
|
+
content: e.content,
|
|
624
|
+
time: e.time || g(),
|
|
625
|
+
user_id: e.user_id || "",
|
|
626
|
+
user_name: e.user_name || "",
|
|
627
|
+
user_color: e.user_color || "",
|
|
628
|
+
mentioned_user: e.mentioned_user || null
|
|
629
|
+
}));
|
|
630
|
+
t.forEach((e) => l.add(e._msgId)), e.value = [...t, ...e.value];
|
|
631
|
+
}
|
|
632
|
+
} catch (e) {
|
|
633
|
+
console.warn("[useChat] Failed to load history:", e);
|
|
634
|
+
}
|
|
635
|
+
}, x = async (t) => {
|
|
636
|
+
if (e.value = [], l.clear(), t) try {
|
|
637
|
+
await F.delete(u, { params: { room_id: t } });
|
|
638
|
+
} catch (e) {
|
|
639
|
+
console.warn("[useChat] Failed to clear messages on server:", e);
|
|
640
|
+
}
|
|
641
|
+
}, w = () => {
|
|
642
|
+
a.value = !1;
|
|
643
|
+
}, T = () => {
|
|
644
|
+
if (d &&= (d(), null), o && s) {
|
|
645
|
+
try {
|
|
646
|
+
o.unobserve(s);
|
|
647
|
+
} catch {}
|
|
648
|
+
s = null;
|
|
649
|
+
}
|
|
650
|
+
o = null, c = null, l.clear();
|
|
651
|
+
};
|
|
652
|
+
return h(() => T()), {
|
|
653
|
+
messages: e,
|
|
654
|
+
loading: t,
|
|
655
|
+
isCollabMode: n,
|
|
656
|
+
collabUsers: r,
|
|
657
|
+
currentUser: i,
|
|
658
|
+
unreadMention: a,
|
|
659
|
+
setCollabContext: f,
|
|
660
|
+
setCurrentUser: p,
|
|
661
|
+
updateCollabUsers: m,
|
|
662
|
+
sendMessage: _,
|
|
663
|
+
sendAiMessage: y,
|
|
664
|
+
loadHistory: b,
|
|
665
|
+
clearMessages: x,
|
|
666
|
+
clearUnreadMention: w,
|
|
667
|
+
destroy: T
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region ../../src/views/QuestionnaireEditor.vue
|
|
672
|
+
var Me = { class: "q-editor" }, Ne = { class: "editor-header" }, Pe = { class: "header-left" }, Fe = { class: "header-right" }, Ie = { class: "editor-main" }, Le = {
|
|
673
|
+
class: "q-canvas",
|
|
674
|
+
ref: "canvasRef"
|
|
675
|
+
}, Re = { class: "q-header-top" }, ze = { class: "q-header-settings-panel" }, Be = { class: "q-settings-section" }, Ve = { class: "q-settings-row" }, He = { class: "q-settings-row" }, Ue = { class: "q-settings-row" }, We = { class: "q-settings-row" }, Ge = { class: "q-settings-row" }, Ke = { class: "q-settings-row" }, qe = { class: "q-settings-row" }, Je = { class: "q-settings-row" }, Ye = { class: "q-settings-row" }, Xe = { class: "q-settings-row" }, Ze = { class: "q-settings-row" }, Qe = { class: "q-settings-row" }, $e = { class: "q-settings-row" }, et = { class: "q-settings-row" }, tt = { class: "q-header-settings" }, nt = { class: "q-pass-score" }, rt = { class: "q-total-score" }, it = { class: "q-show-score" }, at = {
|
|
676
|
+
class: "q-questions",
|
|
677
|
+
ref: "questionsRef"
|
|
678
|
+
}, ot = [
|
|
679
|
+
"onClick",
|
|
680
|
+
"onDragstart",
|
|
681
|
+
"onDragover",
|
|
682
|
+
"onDrop"
|
|
683
|
+
], st = { class: "q-card-toolbar" }, ct = { class: "q-card-header" }, lt = { class: "q-num" }, ut = { class: "q-card-actions" }, dt = { class: "q-card-body" }, ft = { class: "q-desc-row" }, pt = { class: "q-image-row" }, mt = {
|
|
684
|
+
key: 0,
|
|
685
|
+
class: "q-image-preview"
|
|
686
|
+
}, ht = ["src"], gt = {
|
|
687
|
+
key: 0,
|
|
688
|
+
class: "q-options-area"
|
|
689
|
+
}, _t = {
|
|
690
|
+
key: 1,
|
|
691
|
+
class: "q-options-area"
|
|
692
|
+
}, vt = {
|
|
693
|
+
key: 2,
|
|
694
|
+
class: "q-options-area"
|
|
695
|
+
}, yt = {
|
|
696
|
+
key: 3,
|
|
697
|
+
class: "q-options-area"
|
|
698
|
+
}, bt = {
|
|
699
|
+
key: 4,
|
|
700
|
+
class: "q-options-area"
|
|
701
|
+
}, xt = { class: "rating-config" }, St = { class: "rating-preview" }, Ct = ["onClick"], wt = {
|
|
702
|
+
key: 5,
|
|
703
|
+
class: "q-options-area"
|
|
704
|
+
}, Tt = { class: "scale-config" }, Et = { class: "scale-preview" }, Dt = { class: "label" }, Ot = {
|
|
705
|
+
key: 6,
|
|
706
|
+
class: "q-options-area"
|
|
707
|
+
}, kt = { class: "matrix-config" }, At = { class: "matrix-rows" }, jt = { class: "matrix-cols" }, Mt = {
|
|
708
|
+
key: 0,
|
|
709
|
+
class: "matrix-preview"
|
|
710
|
+
}, Nt = { class: "matrix-table" }, Pt = {
|
|
711
|
+
key: 7,
|
|
712
|
+
class: "q-options-area"
|
|
713
|
+
}, Ft = { class: "q-skip-config" }, It = { class: "skip-header" }, Lt = { class: "skip-row" }, Rt = {
|
|
714
|
+
key: 0,
|
|
715
|
+
class: "skip-rules"
|
|
716
|
+
}, zt = { class: "opt-name" }, Bt = { class: "q-score-config" }, Vt = { class: "score-header" }, Ht = { class: "score-row" }, Ut = {
|
|
717
|
+
key: 0,
|
|
718
|
+
class: "score-options"
|
|
719
|
+
}, Wt = { class: "opt-name" }, Gt = {
|
|
720
|
+
key: 1,
|
|
721
|
+
class: "score-row"
|
|
722
|
+
}, Kt = {
|
|
723
|
+
key: 2,
|
|
724
|
+
class: "score-row"
|
|
725
|
+
}, qt = { class: "q-scoring-guide" }, Jt = { class: "scoring-guide-header" }, Yt = { class: "scoring-guide-item" }, Xt = { class: "scoring-guide-item" }, Zt = {
|
|
726
|
+
key: 0,
|
|
727
|
+
class: "scoring-guide-error"
|
|
728
|
+
}, Qt = { class: "q-add-bottom" }, $t = { class: "q-add-trigger" }, en = { class: "ai-generate-content" }, tn = { class: "ai-gen-form-item" }, nn = { class: "ai-gen-type" }, rn = { class: "ai-gen-form-item" }, an = { class: "ai-gen-form-item" }, on = { class: "ai-analysis-content" }, sn = {
|
|
729
|
+
key: 0,
|
|
730
|
+
class: "ai-loading"
|
|
731
|
+
}, cn = {
|
|
732
|
+
key: 1,
|
|
733
|
+
class: "ai-result"
|
|
734
|
+
}, ln = { class: "ai-result-header" }, un = ["innerHTML"], dn = {
|
|
735
|
+
key: 2,
|
|
736
|
+
class: "ai-placeholder"
|
|
737
|
+
}, fn = { class: "distribute-content" }, pn = { class: "distribute-input" }, mn = { class: "distribute-actions" }, hn = {
|
|
738
|
+
key: 0,
|
|
739
|
+
class: "distribute-results"
|
|
740
|
+
}, gn = { class: "results-header" }, _n = "questionnaire", Z = /*#__PURE__*/ I({
|
|
741
|
+
__name: "QuestionnaireEditor",
|
|
742
|
+
setup(c) {
|
|
743
|
+
let l = O(), u = k(), h = v("新建问卷"), T = v(""), D = v(""), j = v("draft"), M = v(null), re = v(null), N = v([]), ie = v(0), P = v(!1), ae = v(null), F = v(!1), I = v(null), L = v(null), oe = v(null);
|
|
744
|
+
v(!1);
|
|
745
|
+
let R = _({
|
|
746
|
+
backgroundColor: "#ffffff",
|
|
747
|
+
headerFont: "inherit",
|
|
748
|
+
headerFontSize: 14,
|
|
749
|
+
headerFontStyle: "normal",
|
|
750
|
+
headerColor: "#303133",
|
|
751
|
+
titleAlign: "center",
|
|
752
|
+
titleFont: "inherit",
|
|
753
|
+
titleFontStyle: "normal",
|
|
754
|
+
titleFontSize: 20,
|
|
755
|
+
titleColor: "#303133",
|
|
756
|
+
descAlign: "left",
|
|
757
|
+
descFont: "inherit",
|
|
758
|
+
descFontStyle: "normal",
|
|
759
|
+
descFontSize: 14,
|
|
760
|
+
descColor: "#606266"
|
|
761
|
+
}), se = v(!1), ce = v(""), le = v([]), ue = v(!1), de = v(!1), fe = v(""), pe = v(!1), z = je(), me = v(!1), { saveVersion: he } = Oe(), ge = v(!1), _e = v(!1), ve = v(""), ye = v([]), be = v(-1), xe = v(""), Se = v(null), Ce = (e) => ({
|
|
762
|
+
text: "文本题",
|
|
763
|
+
radio: "单选题",
|
|
764
|
+
checkbox: "多选题",
|
|
765
|
+
select: "下拉题",
|
|
766
|
+
rating: "评分题",
|
|
767
|
+
scale: "量表题",
|
|
768
|
+
matrix: "矩阵题",
|
|
769
|
+
image: "图片题"
|
|
770
|
+
})[e] || e, we = t(() => N.value.reduce((e, t) => e + (t.score || 0), 0)), Te = 0, De = () => {
|
|
771
|
+
Te = N.value.reduce((e, t) => {
|
|
772
|
+
let n = parseInt(t.id?.replace("q-", "") || "0");
|
|
773
|
+
return n > e ? n : e;
|
|
774
|
+
}, 0);
|
|
775
|
+
}, B = v(!1), V = v(!1), H = v(!1), ke = v([]), U = null, W = null, G = null, K = null, q = null, J = null, Y = null, X = !1, Z = !1, Q = !1, vn = null, yn = () => JSON.stringify({
|
|
776
|
+
title: h.value,
|
|
777
|
+
description: T.value,
|
|
778
|
+
questions: N.value.map((e) => {
|
|
779
|
+
let { _preview: t, ...n } = e;
|
|
780
|
+
return n;
|
|
781
|
+
}),
|
|
782
|
+
status: j.value
|
|
783
|
+
}), bn = () => {
|
|
784
|
+
if (!L.value || W) return;
|
|
785
|
+
U = new te.Doc(), W = new ne({
|
|
786
|
+
url: `ws://${window.location.hostname || "localhost"}:1234`,
|
|
787
|
+
name: `questionnaire-${L.value}`,
|
|
788
|
+
document: U,
|
|
789
|
+
connect: !1,
|
|
790
|
+
reconnect: !1,
|
|
791
|
+
onConnect: () => {
|
|
792
|
+
xn();
|
|
793
|
+
},
|
|
794
|
+
onClose: () => {},
|
|
795
|
+
onSynced: ({ state: e }) => {
|
|
796
|
+
X = !0, !G?.toString() && !K?.toString() && (!q?.toArray() || q.length === 0) ? On() : kn(), Y = yn();
|
|
797
|
+
}
|
|
798
|
+
}), G = U.getText("title"), K = U.getText("description"), q = U.getArray("questions"), J = U.getMap("meta");
|
|
799
|
+
let e = U.getMap("_meta");
|
|
800
|
+
e.observe((t) => {
|
|
801
|
+
t.keysChanged.has("_closed") && (H.value = e.get("_closed") === !0, H.value && (B.value = !1, W?.disconnect(), A.warning("协作已被创建者关闭")));
|
|
802
|
+
}), G.observe(() => {
|
|
803
|
+
X && !Z && !Q && kn();
|
|
804
|
+
}), K.observe(() => {
|
|
805
|
+
X && !Z && !Q && kn();
|
|
806
|
+
}), q.observe(() => {
|
|
807
|
+
X && !Z && !Q && kn();
|
|
808
|
+
}), J.observe(() => {
|
|
809
|
+
X && !Z && !Q && kn();
|
|
810
|
+
}), W.awareness.on("change", () => {
|
|
811
|
+
ke.value = Array.from(W.awareness.getStates().entries()).filter(([e, t]) => t.user).map(([e, t]) => ({
|
|
812
|
+
clientId: e,
|
|
813
|
+
...t.user
|
|
814
|
+
}));
|
|
815
|
+
});
|
|
816
|
+
}, xn = () => {
|
|
817
|
+
Sn(), vn = setInterval(() => {
|
|
818
|
+
if (W?.connection?.ws?.readyState === WebSocket.CLOSED) try {
|
|
819
|
+
W.connect();
|
|
820
|
+
} catch {}
|
|
821
|
+
}, 3e4);
|
|
822
|
+
}, Sn = () => {
|
|
823
|
+
vn &&= (clearInterval(vn), null);
|
|
824
|
+
}, Cn = async () => {
|
|
825
|
+
if (!L.value && (await _r(), !L.value)) {
|
|
826
|
+
A.warning("请先保存问卷后再开启协作");
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
if (W || bn(), W) {
|
|
830
|
+
H.value = !1, B.value = !0;
|
|
831
|
+
try {
|
|
832
|
+
await fetch(`/api/questionnaires/${L.value}`, {
|
|
833
|
+
method: "PUT",
|
|
834
|
+
headers: { "Content-Type": "application/json" },
|
|
835
|
+
body: JSON.stringify({ collab_closed: !1 })
|
|
836
|
+
});
|
|
837
|
+
} catch (e) {
|
|
838
|
+
console.warn("Failed to reset collab_closed:", e);
|
|
839
|
+
}
|
|
840
|
+
let e = `用户${Math.floor(Math.random() * 1e3)}`, t = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
841
|
+
W.awareness.setLocalStateField("user", {
|
|
842
|
+
name: e,
|
|
843
|
+
color: t
|
|
844
|
+
}), z.setCollabContext({
|
|
845
|
+
ydoc: U,
|
|
846
|
+
provider: W,
|
|
847
|
+
onlineUsers: ke
|
|
848
|
+
}), z.setCurrentUser({
|
|
849
|
+
id: W.awareness.clientID,
|
|
850
|
+
name: e,
|
|
851
|
+
color: t
|
|
852
|
+
}), W.connect(), setTimeout(() => {
|
|
853
|
+
X && !G?.toString() && !K?.toString() && (!q?.toArray() || q.length === 0) && (On(), Y = yn());
|
|
854
|
+
}, 1e3), A.success("协作已开启");
|
|
855
|
+
}
|
|
856
|
+
}, wn = () => {
|
|
857
|
+
W && (W.disconnect(), B.value = !1, A.info("协作已关闭"));
|
|
858
|
+
}, Tn = async () => {
|
|
859
|
+
H.value = !0;
|
|
860
|
+
let e = U?.getMap("_meta");
|
|
861
|
+
if (e && U.transact(() => {
|
|
862
|
+
e.set("_closed", !0);
|
|
863
|
+
}), L.value) try {
|
|
864
|
+
await fetch(`/api/questionnaires/${L.value}`, {
|
|
865
|
+
method: "PUT",
|
|
866
|
+
headers: { "Content-Type": "application/json" },
|
|
867
|
+
body: JSON.stringify({ collab_closed: !0 })
|
|
868
|
+
});
|
|
869
|
+
} catch (e) {
|
|
870
|
+
console.warn("Failed to persist collab_closed:", e);
|
|
871
|
+
}
|
|
872
|
+
wn();
|
|
873
|
+
}, En = () => {
|
|
874
|
+
B.value ? Tn() : Cn();
|
|
875
|
+
}, Dn = async () => {
|
|
876
|
+
if (L.value && !V.value && (W || bn(), W)) {
|
|
877
|
+
H.value = !1, B.value = !0, V.value = !0;
|
|
878
|
+
try {
|
|
879
|
+
await fetch(`/api/questionnaires/${L.value}`, {
|
|
880
|
+
method: "PUT",
|
|
881
|
+
headers: { "Content-Type": "application/json" },
|
|
882
|
+
body: JSON.stringify({ collab_closed: !1 })
|
|
883
|
+
});
|
|
884
|
+
} catch {}
|
|
885
|
+
let e = `协作人${Math.floor(Math.random() * 1e3)}`, t = `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")}`;
|
|
886
|
+
W.awareness.setLocalStateField("user", {
|
|
887
|
+
name: e,
|
|
888
|
+
color: t
|
|
889
|
+
}), z.setCollabContext({
|
|
890
|
+
ydoc: U,
|
|
891
|
+
provider: W,
|
|
892
|
+
onlineUsers: ke
|
|
893
|
+
}), z.setCurrentUser({
|
|
894
|
+
id: W.awareness.clientID,
|
|
895
|
+
name: e,
|
|
896
|
+
color: t
|
|
897
|
+
}), W.connect(), setTimeout(() => {
|
|
898
|
+
X && (!G?.toString() && !K?.toString() && (!q?.toArray() || q.length === 0) || (kn(), Y = yn()));
|
|
899
|
+
}, 1e3);
|
|
900
|
+
}
|
|
901
|
+
}, On = () => {
|
|
902
|
+
!U || !X || (Q = !0, U.transact(() => {
|
|
903
|
+
G.toString() !== h.value && (G.delete(0, G.length), G.insert(0, h.value)), K.toString() !== T.value && (K.delete(0, K.length), K.insert(0, T.value));
|
|
904
|
+
let e = N.value.map((e) => {
|
|
905
|
+
let { _preview: t, ...n } = e;
|
|
906
|
+
return n;
|
|
907
|
+
});
|
|
908
|
+
JSON.stringify(e) !== JSON.stringify(q.toArray()) && (q.delete(0, q.length), q.push(e)), J.set("status", j.value), J.set("updatedAt", (/* @__PURE__ */ new Date()).toISOString());
|
|
909
|
+
}), Q = !1);
|
|
910
|
+
}, $ = () => {
|
|
911
|
+
if (!B.value) return;
|
|
912
|
+
let e = yn();
|
|
913
|
+
e !== Y && (Y = e, On());
|
|
914
|
+
}, kn = () => {
|
|
915
|
+
if (!U || !X || !G?.toString() && !K?.toString() && (!q?.toArray() || q.length === 0)) return;
|
|
916
|
+
let e = JSON.stringify({
|
|
917
|
+
title: G?.toString() || "",
|
|
918
|
+
description: K?.toString() || "",
|
|
919
|
+
questions: q?.toArray() || [],
|
|
920
|
+
status: J?.get("status") || "draft"
|
|
921
|
+
});
|
|
922
|
+
if (e === Y) return;
|
|
923
|
+
Y = e, Z = !0;
|
|
924
|
+
let t = G?.toString();
|
|
925
|
+
t !== void 0 && (h.value = t);
|
|
926
|
+
let n = K?.toString();
|
|
927
|
+
n !== void 0 && (T.value = n);
|
|
928
|
+
let r = q?.toArray();
|
|
929
|
+
r && (N.value = r.map((e) => ({
|
|
930
|
+
...e,
|
|
931
|
+
_preview: 0
|
|
932
|
+
})), De());
|
|
933
|
+
let i = J?.get("status");
|
|
934
|
+
i && (j.value = i), Z = !1;
|
|
935
|
+
}, An = null, jn = () => {
|
|
936
|
+
Z || (An && clearTimeout(An), An = setTimeout(() => {
|
|
937
|
+
$();
|
|
938
|
+
}, 100));
|
|
939
|
+
};
|
|
940
|
+
C(h, jn), C(T, jn), C(N, jn, { deep: !0 });
|
|
941
|
+
let Mn = (e) => {
|
|
942
|
+
Te++;
|
|
943
|
+
let t = {
|
|
944
|
+
id: `q-${Te}`,
|
|
945
|
+
type: e,
|
|
946
|
+
title: "",
|
|
947
|
+
description: "",
|
|
948
|
+
required: !1,
|
|
949
|
+
image: "",
|
|
950
|
+
skipTo: "",
|
|
951
|
+
optionSkipTo: {},
|
|
952
|
+
score: 0,
|
|
953
|
+
optionScore: {},
|
|
954
|
+
referenceAnswer: "",
|
|
955
|
+
scoringCriteria: ""
|
|
956
|
+
};
|
|
957
|
+
return e === "text" ? {
|
|
958
|
+
...t,
|
|
959
|
+
placeholder: "",
|
|
960
|
+
textType: "single"
|
|
961
|
+
} : e === "radio" || e === "checkbox" || e === "select" ? {
|
|
962
|
+
...t,
|
|
963
|
+
options: ["选项1", "选项2"],
|
|
964
|
+
optionSkipTo: {
|
|
965
|
+
0: "",
|
|
966
|
+
1: ""
|
|
967
|
+
},
|
|
968
|
+
optionScore: {
|
|
969
|
+
0: 0,
|
|
970
|
+
1: 0
|
|
971
|
+
}
|
|
972
|
+
} : e === "rating" ? {
|
|
973
|
+
...t,
|
|
974
|
+
maxRating: 5,
|
|
975
|
+
ratingIcon: "star",
|
|
976
|
+
_preview: 0,
|
|
977
|
+
ratingAsScore: !0
|
|
978
|
+
} : e === "scale" ? {
|
|
979
|
+
...t,
|
|
980
|
+
scaleMinLabel: "非常不满意",
|
|
981
|
+
scaleMaxLabel: "非常满意",
|
|
982
|
+
scaleCount: 7,
|
|
983
|
+
scaleAsScore: !0
|
|
984
|
+
} : e === "matrix" ? {
|
|
985
|
+
...t,
|
|
986
|
+
matrixRows: ["行1", "行2"],
|
|
987
|
+
matrixCols: [
|
|
988
|
+
"列1",
|
|
989
|
+
"列2",
|
|
990
|
+
"列3"
|
|
991
|
+
]
|
|
992
|
+
} : e === "image" ? {
|
|
993
|
+
...t,
|
|
994
|
+
imageQuestionText: ""
|
|
995
|
+
} : t;
|
|
996
|
+
}, Nn = (e) => {
|
|
997
|
+
N.value.push(Mn(e)), F.value = !1, B.value && $();
|
|
998
|
+
}, Pn = (e) => {
|
|
999
|
+
ee.confirm("确定删除该题目?", "提示", { type: "warning" }).then(() => {
|
|
1000
|
+
N.value.splice(e, 1), B.value && $();
|
|
1001
|
+
}).catch(() => {});
|
|
1002
|
+
}, Fn = (e, t) => {
|
|
1003
|
+
let n = N.value, r = e + t;
|
|
1004
|
+
r < 0 || r >= n.length || ([n[e], n[r]] = [n[r], n[e]], B.value && $());
|
|
1005
|
+
}, In = (e) => {
|
|
1006
|
+
let t = e.options.length;
|
|
1007
|
+
e.options.push(`选项${t + 1}`), e.optionSkipTo ||= {}, e.optionSkipTo[t] = "", e.optionScore ||= {}, e.optionScore[t] = 0, B.value && $();
|
|
1008
|
+
}, Ln = (e, t) => {
|
|
1009
|
+
e.options.splice(t, 1);
|
|
1010
|
+
let n = {}, r = {};
|
|
1011
|
+
Object.entries(e.optionSkipTo || {}).forEach(([e, r]) => {
|
|
1012
|
+
let i = parseInt(e);
|
|
1013
|
+
i < t ? n[i] = r : i > t && (n[i - 1] = r);
|
|
1014
|
+
}), Object.entries(e.optionScore || {}).forEach(([e, n]) => {
|
|
1015
|
+
let i = parseInt(e);
|
|
1016
|
+
i < t ? r[i] = n : i > t && (r[i - 1] = n);
|
|
1017
|
+
}), e.optionSkipTo = n, e.optionScore = r, B.value && $();
|
|
1018
|
+
}, Rn = (e, t) => {
|
|
1019
|
+
let n = new FileReader();
|
|
1020
|
+
return n.onload = (t) => {
|
|
1021
|
+
e.image = t.target.result, B.value && $();
|
|
1022
|
+
}, n.readAsDataURL(t), !1;
|
|
1023
|
+
}, zn = (e, t) => {
|
|
1024
|
+
I.value = e, t.dataTransfer.effectAllowed = "move";
|
|
1025
|
+
}, Bn = (e, t) => {
|
|
1026
|
+
t.dataTransfer.dropEffect = "move";
|
|
1027
|
+
}, Vn = (e, t) => {
|
|
1028
|
+
if (t?.preventDefault(), I.value === null || I.value === e) return;
|
|
1029
|
+
let n = N.value, r = n.splice(I.value, 1)[0];
|
|
1030
|
+
n.splice(e, 0, r), I.value = null, B.value && $();
|
|
1031
|
+
}, Hn = () => JSON.stringify({
|
|
1032
|
+
title: h.value,
|
|
1033
|
+
description: T.value,
|
|
1034
|
+
author: D.value,
|
|
1035
|
+
status: j.value,
|
|
1036
|
+
beginTime: M.value,
|
|
1037
|
+
endTime: re.value,
|
|
1038
|
+
passScore: ie.value,
|
|
1039
|
+
showScore: P.value,
|
|
1040
|
+
totalScore: we.value,
|
|
1041
|
+
questions: N.value.map((e) => {
|
|
1042
|
+
let { _preview: t, ...n } = e;
|
|
1043
|
+
return n;
|
|
1044
|
+
})
|
|
1045
|
+
}), Un = (e) => {
|
|
1046
|
+
try {
|
|
1047
|
+
let t = JSON.parse(e);
|
|
1048
|
+
h.value = t.title || "新建问卷", T.value = t.description || "", j.value = t.status || "draft", M.value = t.beginTime ? new Date(t.beginTime) : null, re.value = t.endTime ? new Date(t.endTime) : null, ie.value = t.passScore || 0, P.value = t.showScore !== !1, N.value = (t.questions || []).map((e) => (e._preview = 0, e)), De();
|
|
1049
|
+
} catch (e) {
|
|
1050
|
+
console.error("Failed to parse questionnaire config", e);
|
|
1051
|
+
}
|
|
1052
|
+
}, Wn = () => {
|
|
1053
|
+
let e = Hn(), t = new Blob([e], { type: "application/json" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
1054
|
+
r.href = n, r.download = `${h.value || "问卷"}.json`, r.click(), URL.revokeObjectURL(n), A.success("JSON已导出");
|
|
1055
|
+
}, Gn = () => {
|
|
1056
|
+
oe.value?.click();
|
|
1057
|
+
}, Kn = (e) => {
|
|
1058
|
+
let t = e.target.files?.[0];
|
|
1059
|
+
if (!t) return;
|
|
1060
|
+
let n = new FileReader();
|
|
1061
|
+
n.onload = (e) => {
|
|
1062
|
+
try {
|
|
1063
|
+
Un(e.target.result), A.success("JSON导入成功"), B.value && $();
|
|
1064
|
+
} catch {
|
|
1065
|
+
A.error("JSON格式错误");
|
|
1066
|
+
}
|
|
1067
|
+
}, n.readAsText(t), e.target.value = "";
|
|
1068
|
+
}, qn = async (e) => {
|
|
1069
|
+
if (!L.value) {
|
|
1070
|
+
A.warning("请先保存问卷");
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
if (e === "standalone") {
|
|
1074
|
+
Jn();
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
try {
|
|
1078
|
+
let t = await fetch(`/api/questionnaires/export/${L.value}/${e}`, { method: "POST" });
|
|
1079
|
+
if (!t.ok) throw Error("导出失败");
|
|
1080
|
+
let n = await t.blob(), r = e === "word" ? "docx" : e, i = URL.createObjectURL(n), a = document.createElement("a");
|
|
1081
|
+
a.href = i, a.download = `${h.value}.${r}`, a.click(), URL.revokeObjectURL(i), A.success("导出成功");
|
|
1082
|
+
} catch (e) {
|
|
1083
|
+
A.error("导出失败: " + e.message);
|
|
1084
|
+
}
|
|
1085
|
+
}, Jn = () => {
|
|
1086
|
+
let e = JSON.parse(Hn()), t = Yn(e), n = new Blob([t], { type: "text/html" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
1087
|
+
i.href = r, i.download = `${e.title || "问卷"}.html`, i.click(), URL.revokeObjectURL(r), A.success("独立HTML表单已导出");
|
|
1088
|
+
}, Yn = (e) => {
|
|
1089
|
+
let t = `<div class="question" style="background:#f0f9ff; border-radius:6px; padding:16px; margin-bottom:16px;">
|
|
1090
|
+
<p class="q-title" style="color:#409eff;">您的邮箱 <span style="color:red">*</span></p>
|
|
1091
|
+
<p class="desc">请填写您的邮箱地址,用于追踪反馈来源</p>
|
|
1092
|
+
<div class="q-input"><input type="email" name="_email" required placeholder="请输入您的邮箱" /></div>
|
|
1093
|
+
<input type="hidden" name="_token" value="${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}" />
|
|
1094
|
+
</div>`, n = e.questions.map((e, t) => {
|
|
1095
|
+
let n = "", r = e.required ? "<span style=\"color:red\">*</span>" : "", i = e.description ? `<p class="desc">${e.description}</p>` : "", a = e.image ? `<img src="${e.image}" class="q-img" />` : "";
|
|
1096
|
+
if (e.type === "text") n = e.textType === "multi" ? `<textarea name="${e.id}" ${e.required ? "required" : ""} placeholder="${e.placeholder || ""}" rows="3"></textarea>` : `<input type="text" name="${e.id}" ${e.required ? "required" : ""} placeholder="${e.placeholder || ""}" />`;
|
|
1097
|
+
else if (e.type === "radio") n = (e.options || []).map((t) => `<label class="option"><input type="radio" name="${e.id}" value="${t}" ${e.required ? "required" : ""} /> ${t}</label>`).join("\n");
|
|
1098
|
+
else if (e.type === "checkbox") n = (e.options || []).map((t) => `<label class="option"><input type="checkbox" name="${e.id}" value="${t}" /> ${t}</label>`).join("\n");
|
|
1099
|
+
else if (e.type === "select") {
|
|
1100
|
+
let t = (e.options || []).map((e) => `<option value="${e}">${e}</option>`).join("");
|
|
1101
|
+
n = `<select name="${e.id}" ${e.required ? "required" : ""}><option value="">请选择</option>${t}</select>`;
|
|
1102
|
+
} else if (e.type === "rating") {
|
|
1103
|
+
let t = e.maxRating || 5;
|
|
1104
|
+
n = `<div class="rating-group">${Array.from({ length: t }, (t, n) => `<label class="rating-item"><input type="radio" name="${e.id}" value="${n + 1}" ${e.required ? "required" : ""} /><span>${n + 1}★</span></label>`).join("")}</div>`;
|
|
1105
|
+
} else if (e.type === "scale") {
|
|
1106
|
+
let t = e.scaleCount || 7;
|
|
1107
|
+
n = `<div class="scale-group"><span class="scale-label">${e.scaleMinLabel || ""}</span>${Array.from({ length: t }, (t, n) => `<label class="scale-item"><input type="radio" name="${e.id}" value="${n + 1}" ${e.required ? "required" : ""} /><span>${n + 1}</span></label>`).join("")}<span class="scale-label">${e.scaleMaxLabel || ""}</span></div>`;
|
|
1108
|
+
} else if (e.type === "matrix") {
|
|
1109
|
+
let t = e.matrixRows || [], r = e.matrixCols || [];
|
|
1110
|
+
n = `<table class="matrix-table"><thead><tr><th></th>${r.map((e) => `<th>${e}</th>`).join("")}</tr></thead><tbody>${t.map((t, n) => `<tr><td>${t}</td>${r.map((t, r) => `<td><input type="radio" name="${e.id}_row${n}" value="${t}" ${e.required ? "required" : ""} /></td>`).join("")}</tr>`).join("")}</tbody></table>`;
|
|
1111
|
+
} else e.type === "image" && (n = `<textarea name="${e.id}" ${e.required ? "required" : ""} placeholder="${e.imageQuestionText || "请输入"}" rows="3"></textarea>`);
|
|
1112
|
+
return `<div class="question"><p class="q-title">${t + 1}. ${e.title} ${r}</p>${i}${a}<div class="q-input">${n}</div></div>`;
|
|
1113
|
+
}).join("\n");
|
|
1114
|
+
return `<!DOCTYPE html>
|
|
1115
|
+
<html lang="zh-CN">
|
|
1116
|
+
<head>
|
|
1117
|
+
<meta charset="UTF-8" />
|
|
1118
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
1119
|
+
<title>${e.title || "问卷"}</title>
|
|
1120
|
+
<style>
|
|
1121
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1122
|
+
body { font-family: 'Microsoft YaHei', sans-serif; background: #f5f7fa; padding: 20px; color: #333; }
|
|
1123
|
+
.form-wrapper { max-width: 720px; margin: 0 auto; }
|
|
1124
|
+
.form-header { background: #409eff; color: #fff; padding: 32px; border-radius: 8px 8px 0 0; text-align: center; }
|
|
1125
|
+
.form-header h1 { font-size: 24px; margin-bottom: 8px; }
|
|
1126
|
+
.form-header p { opacity: 0.9; font-size: 14px; }
|
|
1127
|
+
.form-body { background: #fff; padding: 24px; border-radius: 0 0 8px 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
|
|
1128
|
+
.question { padding: 16px 0; border-bottom: 1px solid #ebeef5; }
|
|
1129
|
+
.question:last-child { border-bottom: none; }
|
|
1130
|
+
.q-title { font-weight: bold; margin-bottom: 8px; }
|
|
1131
|
+
.desc { color: #909399; font-size: 13px; margin-bottom: 8px; }
|
|
1132
|
+
.q-img { max-width: 100%; border-radius: 4px; margin-bottom: 8px; }
|
|
1133
|
+
.q-input { padding-left: 16px; }
|
|
1134
|
+
input[type="text"], input[type="email"], textarea, select { width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px; }
|
|
1135
|
+
textarea { resize: vertical; }
|
|
1136
|
+
select { background: #fff; }
|
|
1137
|
+
.option, .rating-item, .scale-item { display: inline-flex; align-items: center; gap: 4px; margin-right: 16px; margin-bottom: 8px; cursor: pointer; }
|
|
1138
|
+
.rating-group, .scale-group { display: flex; align-items: center; gap: 8px; }
|
|
1139
|
+
.scale-label { font-size: 12px; color: #909399; }
|
|
1140
|
+
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-left: 16px; }
|
|
1141
|
+
.matrix-table th, .matrix-table td { border: 1px solid #ebeef5; padding: 8px; text-align: center; }
|
|
1142
|
+
.matrix-table th { background: #f5f7fa; }
|
|
1143
|
+
.submit-btn { display: block; width: 100%; padding: 12px; background: #409eff; color: #fff; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; margin-top: 16px; }
|
|
1144
|
+
.submit-btn:hover { background: #66b1ff; }
|
|
1145
|
+
.success-msg { display: none; text-align: center; padding: 40px; color: #67c23a; font-size: 18px; }
|
|
1146
|
+
.score-result { margin-top: 16px; }
|
|
1147
|
+
.score-result .score-label { color: #909399; }
|
|
1148
|
+
.score-result .score-value { font-size: 36px; font-weight: bold; color: #f56c6c; }
|
|
1149
|
+
.score-result .score-value.pass { color: #67c23a; }
|
|
1150
|
+
.score-result .score-sep { color: #c0c4cc; margin: 0 4px; }
|
|
1151
|
+
.score-result .score-total { font-size: 18px; color: #606266; }
|
|
1152
|
+
</style>
|
|
1153
|
+
</head>
|
|
1154
|
+
<body>
|
|
1155
|
+
<div class="form-wrapper">
|
|
1156
|
+
<div class="form-header"><h1>${e.title || ""}</h1><p>${e.description || ""}</p></div>
|
|
1157
|
+
<div class="form-body">
|
|
1158
|
+
<form id="qform">
|
|
1159
|
+
${t}
|
|
1160
|
+
${n}
|
|
1161
|
+
<button type="submit" class="submit-btn">提 交</button>
|
|
1162
|
+
</form>
|
|
1163
|
+
<div class="success-msg" id="successMsg">
|
|
1164
|
+
<p>✓ 提交成功,感谢您的填写!</p>
|
|
1165
|
+
${e.showScore ? "<div id=\"scoreResult\" style=\"margin-top:16px; display:none;\"><p style=\"font-size:14px; color:#909399;\">得分:<span id=\"scoreValue\" style=\"font-size:36px; font-weight:bold;\"></span> / <span id=\"scoreTotal\"></span></p></div>" : ""}
|
|
1166
|
+
</div>
|
|
1167
|
+
</div>
|
|
1168
|
+
</div>
|
|
1169
|
+
<script>
|
|
1170
|
+
var questions = ${JSON.stringify(e.questions || [])};
|
|
1171
|
+
var passScore = ${e.passScore || 0};
|
|
1172
|
+
var showScore = ${e.showScore !== !1};
|
|
1173
|
+
var totalScore = ${e.totalScore || 0};
|
|
1174
|
+
|
|
1175
|
+
function calcScore(data) {
|
|
1176
|
+
var score = 0;
|
|
1177
|
+
questions.forEach(function(q) {
|
|
1178
|
+
var val = data[q.id];
|
|
1179
|
+
if (val === undefined || val === null || val === '') return;
|
|
1180
|
+
if (q.type === 'radio' || q.type === 'select') {
|
|
1181
|
+
var idx = (q.options || []).indexOf(val);
|
|
1182
|
+
if (idx >= 0) score += (q.optionScore && q.optionScore[idx] !== undefined ? q.optionScore[idx] : q.score || 0);
|
|
1183
|
+
} else if (q.type === 'checkbox') {
|
|
1184
|
+
var vals = Array.isArray(val) ? val : [val];
|
|
1185
|
+
vals.forEach(function(v) {
|
|
1186
|
+
var idx = (q.options || []).indexOf(v);
|
|
1187
|
+
if (idx >= 0) score += (q.optionScore && q.optionScore[idx] !== undefined ? q.optionScore[idx] : q.score || 0);
|
|
1188
|
+
});
|
|
1189
|
+
} else if (q.type === 'rating') {
|
|
1190
|
+
score += q.ratingAsScore ? parseInt(val) : 0;
|
|
1191
|
+
} else if (q.type === 'scale') {
|
|
1192
|
+
score += q.scaleAsScore ? parseInt(val) : 0;
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
return score;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
document.getElementById('qform').addEventListener('submit', function(e) {
|
|
1199
|
+
e.preventDefault();
|
|
1200
|
+
var fd = new FormData(this);
|
|
1201
|
+
var data = {};
|
|
1202
|
+
fd.forEach(function(v, k) { data[k] = v; });
|
|
1203
|
+
document.getElementById('qform').style.display = 'none';
|
|
1204
|
+
document.getElementById('successMsg').style.display = 'block';
|
|
1205
|
+
if (showScore) {
|
|
1206
|
+
var score = calcScore(data);
|
|
1207
|
+
document.getElementById('scoreValue').textContent = score;
|
|
1208
|
+
document.getElementById('scoreTotal').textContent = totalScore;
|
|
1209
|
+
document.getElementById('scoreResult').style.display = 'block';
|
|
1210
|
+
}
|
|
1211
|
+
console.log('提交数据:', JSON.stringify(data));
|
|
1212
|
+
});
|
|
1213
|
+
<\/script>
|
|
1214
|
+
</body>
|
|
1215
|
+
</html>`;
|
|
1216
|
+
}, Xn = async () => {
|
|
1217
|
+
if (!L.value) return;
|
|
1218
|
+
let e = `${window.location.origin}/questionnaire-editor/${L.value}?collab=1`;
|
|
1219
|
+
try {
|
|
1220
|
+
await navigator.clipboard.writeText(e), A.success("协作编辑链接已复制到剪贴板,发送给他人即可共同编辑");
|
|
1221
|
+
} catch {
|
|
1222
|
+
A.info(`协作编辑链接: ${e}`);
|
|
1223
|
+
}
|
|
1224
|
+
}, Zn = async () => {
|
|
1225
|
+
if (!L.value) return;
|
|
1226
|
+
let e = prompt("请输入填写者邮箱(用于追踪反馈来源):");
|
|
1227
|
+
if (e === null) return;
|
|
1228
|
+
let t = e ? `?uid=${encodeURIComponent(e)}` : "", n = `${window.location.origin}/questionnaire-view/${L.value}${t}`;
|
|
1229
|
+
try {
|
|
1230
|
+
await navigator.clipboard.writeText(n), A.success("填写链接已复制到剪贴板");
|
|
1231
|
+
} catch {
|
|
1232
|
+
A.info(`填写链接: ${n}`);
|
|
1233
|
+
}
|
|
1234
|
+
}, Qn = (e) => e.split(/[\n,;,;\s]+/).map((e) => e.trim().toLowerCase()).filter((e) => e && e.includes("@") && e.includes(".")), $n = (e) => {
|
|
1235
|
+
let t = new FileReader();
|
|
1236
|
+
return t.onload = (e) => {
|
|
1237
|
+
try {
|
|
1238
|
+
let t = e.target.result.split("\n").filter((e) => e.trim()), n = [];
|
|
1239
|
+
if (t.forEach((e, t) => {
|
|
1240
|
+
if (t === 0 && e.includes("email")) return;
|
|
1241
|
+
let r = (e.split(/[,\t]/)[0] || "").trim().toLowerCase();
|
|
1242
|
+
r && r.includes("@") && r.includes(".") && n.push(r);
|
|
1243
|
+
}), n.length > 0) {
|
|
1244
|
+
let e = Qn(ce.value);
|
|
1245
|
+
ce.value = [.../* @__PURE__ */ new Set([...e, ...n])].join("\n"), A.success(`导入了 ${n.length} 个邮箱`);
|
|
1246
|
+
} else A.warning("未找到有效邮箱");
|
|
1247
|
+
} catch {
|
|
1248
|
+
A.error("文件解析失败");
|
|
1249
|
+
}
|
|
1250
|
+
}, t.readAsText(e), !1;
|
|
1251
|
+
}, er = () => {
|
|
1252
|
+
let e = Qn(ce.value);
|
|
1253
|
+
if (e.length === 0) {
|
|
1254
|
+
A.warning("请先输入至少一个邮箱");
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
if (!L.value) {
|
|
1258
|
+
A.warning("请先保存问卷");
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
le.value = e.map((e) => {
|
|
1262
|
+
let t = crypto.randomUUID().replace(/-/g, "").slice(0, 16);
|
|
1263
|
+
return {
|
|
1264
|
+
email: e,
|
|
1265
|
+
url: `${window.location.origin}/questionnaire-view/${L.value}?uid=${encodeURIComponent(e)}&t=${t}`,
|
|
1266
|
+
token: t
|
|
1267
|
+
};
|
|
1268
|
+
}), A.success(`已生成 ${e.length} 条唯一链接`);
|
|
1269
|
+
}, tr = async (e) => {
|
|
1270
|
+
try {
|
|
1271
|
+
await navigator.clipboard.writeText(e), A.success("已复制");
|
|
1272
|
+
} catch {
|
|
1273
|
+
A.info(e);
|
|
1274
|
+
}
|
|
1275
|
+
}, nr = () => {
|
|
1276
|
+
if (le.value.length === 0) return;
|
|
1277
|
+
let e = "邮箱,问卷链接,Token\n" + le.value.map((e) => `${e.email},${e.url},${e.token}`).join("\n"), t = new Blob([e], { type: "text/csv;charset=utf-8" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
1278
|
+
r.href = n, r.download = `${h.value || "问卷"}_分发列表.csv`, r.click(), URL.revokeObjectURL(n), A.success("已下载分发列表");
|
|
1279
|
+
}, rr = () => {
|
|
1280
|
+
L.value && u.push(`/questionnaire-stats/${L.value}`);
|
|
1281
|
+
}, ir = () => {
|
|
1282
|
+
L.value && u.push(`/questionnaire-responses/${L.value}`);
|
|
1283
|
+
}, ar = (e) => {
|
|
1284
|
+
be.value = e, xe.value = N.value[e].type, ve.value = "", ye.value = [], ge.value = !0;
|
|
1285
|
+
}, or = (e, t) => {
|
|
1286
|
+
ye.value = t;
|
|
1287
|
+
}, sr = async () => {
|
|
1288
|
+
if (!ve.value.trim()) {
|
|
1289
|
+
A.warning("请输入生成要求");
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
_e.value = !0;
|
|
1293
|
+
try {
|
|
1294
|
+
await new Promise((e) => setTimeout(e, 1500));
|
|
1295
|
+
let e = xe.value, t = ve.value, n = cr(e, t), r = N.value[be.value];
|
|
1296
|
+
r && (r.title = n.title, r.referenceAnswer = n.referenceAnswer, r.scoringCriteria = n.scoringCriteria, n.options && r.options && (r.options = n.options), n.placeholder !== void 0 && (r.placeholder = n.placeholder), n.description && (r.description = n.description)), ge.value = !1, A.success("题目已生成");
|
|
1297
|
+
} catch (e) {
|
|
1298
|
+
A.error("生成失败: " + e.message);
|
|
1299
|
+
} finally {
|
|
1300
|
+
_e.value = !1;
|
|
1301
|
+
}
|
|
1302
|
+
}, cr = (e, t) => {
|
|
1303
|
+
let n = {
|
|
1304
|
+
text: {
|
|
1305
|
+
title: "请简述JavaScript中let和const的区别",
|
|
1306
|
+
description: "考察ES6变量声明方式的理解",
|
|
1307
|
+
placeholder: "请输入您的答案...",
|
|
1308
|
+
referenceAnswer: "1. let声明的变量可以重新赋值,const声明的变量不能重新赋值\n2. let和const都有块级作用域,var没有\n3. const声明时必须初始化,let不需要\n4. 两者都存在暂时性死区(TDZ)",
|
|
1309
|
+
scoringCriteria: "评分标准:\n- 完整回答以上4点得满分\n- 回答3点得80%分数\n- 回答2点得60%分数\n- 回答1点得40%分数\n- 回答不完整或有错误酌情给分"
|
|
1310
|
+
},
|
|
1311
|
+
radio: {
|
|
1312
|
+
title: "以下哪个不是JavaScript的基本数据类型?",
|
|
1313
|
+
description: "考察JavaScript数据类型基础知识",
|
|
1314
|
+
options: [
|
|
1315
|
+
"String",
|
|
1316
|
+
"Boolean",
|
|
1317
|
+
"Array",
|
|
1318
|
+
"Number"
|
|
1319
|
+
],
|
|
1320
|
+
referenceAnswer: "C (Array)\n\nJavaScript的基本数据类型包括:String、Number、Boolean、null、undefined、Symbol、BigInt。Array是引用类型(对象),不是基本数据类型。",
|
|
1321
|
+
scoringCriteria: "评分标准:\n- 选择正确得满分\n- 选择错误不得分"
|
|
1322
|
+
},
|
|
1323
|
+
checkbox: {
|
|
1324
|
+
title: "以下哪些是JavaScript的异步编程方式?(多选)",
|
|
1325
|
+
description: "考察异步编程概念的理解",
|
|
1326
|
+
options: [
|
|
1327
|
+
"Promise",
|
|
1328
|
+
"async/await",
|
|
1329
|
+
"callback",
|
|
1330
|
+
"for循环"
|
|
1331
|
+
],
|
|
1332
|
+
referenceAnswer: "A、B、C (Promise, async/await, callback)\n\nPromise、async/await和callback都是JavaScript中处理异步操作的方式。for循环是同步的迭代结构。",
|
|
1333
|
+
scoringCriteria: "评分标准:\n- 全部选对得满分\n- 少选一个扣25%\n- 多选一个扣25%\n- 全部选错不得分"
|
|
1334
|
+
},
|
|
1335
|
+
select: {
|
|
1336
|
+
title: "在Vue3中,哪个API用于创建响应式对象?",
|
|
1337
|
+
description: "考察Vue3响应式系统",
|
|
1338
|
+
options: [
|
|
1339
|
+
"ref",
|
|
1340
|
+
"reactive",
|
|
1341
|
+
"computed",
|
|
1342
|
+
"watch"
|
|
1343
|
+
],
|
|
1344
|
+
referenceAnswer: "B (reactive)\n\nreactive用于创建响应式的复杂对象。ref用于创建响应式的基本类型值。computed用于计算属性,watch用于侦听器。",
|
|
1345
|
+
scoringCriteria: "评分标准:\n- 选择正确得满分\n- 选择错误不得分"
|
|
1346
|
+
},
|
|
1347
|
+
rating: {
|
|
1348
|
+
title: "请对本次培训的整体满意度进行评分",
|
|
1349
|
+
description: "1-5星,5星为非常满意",
|
|
1350
|
+
referenceAnswer: "评分说明:\n- 5星:非常满意,培训内容充实,讲师专业\n- 4星:满意,培训有帮助\n- 3星:一般,部分有帮助\n- 2星:不满意,帮助不大\n- 1星:非常不满意",
|
|
1351
|
+
scoringCriteria: "统计方式:\n- 计算平均分\n- 4星及以上为满意\n- 3星及以下为需改进"
|
|
1352
|
+
},
|
|
1353
|
+
scale: {
|
|
1354
|
+
title: "您对该产品的推荐程度如何?",
|
|
1355
|
+
description: "量表评分,1为完全不推荐,10为非常推荐",
|
|
1356
|
+
referenceAnswer: "量表说明:\n- 1-3分:不推荐\n- 4-6分:中立\n- 7-8分:推荐\n- 9-10分:强烈推荐",
|
|
1357
|
+
scoringCriteria: "统计方式:\n- 计算NPS净推荐值\n- 推荐者(9-10分)占比\n- 贬损者(1-6分)占比\n- NPS = 推荐者占比 - 贬损者占比"
|
|
1358
|
+
},
|
|
1359
|
+
matrix: {
|
|
1360
|
+
title: "请评价以下各方面的表现",
|
|
1361
|
+
description: "对每个维度进行1-5分评价",
|
|
1362
|
+
referenceAnswer: "评分说明:\n维度1(服务质量):5分=非常专业,3分=一般,1分=很差\n维度2(响应速度):5分=非常及时,3分=一般,1分=很慢\n维度3(问题解决能力):5分=快速准确,3分=基本能解决,1分=无法解决",
|
|
1363
|
+
scoringCriteria: "统计方式:\n- 分别计算各维度平均分\n- 总体平均分 = 各维度平均分之和 / 维度数"
|
|
1364
|
+
},
|
|
1365
|
+
image: {
|
|
1366
|
+
title: "请描述这张图片中展示的问题",
|
|
1367
|
+
description: "根据图片内容进行详细描述",
|
|
1368
|
+
referenceAnswer: "参考答案要点:\n1. 识别图片中的主要问题\n2. 描述问题的具体表现\n3. 分析可能的原因\n4. 提出解决方案",
|
|
1369
|
+
scoringCriteria: "评分标准:\n- 准确识别问题(25%)\n- 描述详细准确(25%)\n- 原因分析合理(25%)\n- 方案可行有效(25%)"
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
return n[e] || n.text;
|
|
1373
|
+
}, lr = () => {
|
|
1374
|
+
ue.value = !0, fe.value = "";
|
|
1375
|
+
}, ur = async () => {
|
|
1376
|
+
de.value = !0, fe.value = "";
|
|
1377
|
+
try {
|
|
1378
|
+
let e = await fetch(`/api/questionnaires/responses/${L.value}`);
|
|
1379
|
+
if (!e.ok) throw Error("获取回答数据失败");
|
|
1380
|
+
let t = await e.json(), n = {
|
|
1381
|
+
questionnaire: {
|
|
1382
|
+
id: L.value,
|
|
1383
|
+
title: h.value,
|
|
1384
|
+
description: T.value,
|
|
1385
|
+
questions: N.value.map((e) => ({
|
|
1386
|
+
id: e.id,
|
|
1387
|
+
title: e.title,
|
|
1388
|
+
type: e.type,
|
|
1389
|
+
options: e.options || [],
|
|
1390
|
+
required: e.required
|
|
1391
|
+
}))
|
|
1392
|
+
},
|
|
1393
|
+
responses: t.responses || [],
|
|
1394
|
+
totalResponses: t.total || 0
|
|
1395
|
+
};
|
|
1396
|
+
await new Promise((e) => setTimeout(e, 2e3)), fe.value = dr(n);
|
|
1397
|
+
} catch (e) {
|
|
1398
|
+
A.error("分析失败: " + e.message);
|
|
1399
|
+
} finally {
|
|
1400
|
+
de.value = !1;
|
|
1401
|
+
}
|
|
1402
|
+
}, dr = (e) => {
|
|
1403
|
+
let { questionnaire: t, responses: n, totalResponses: r } = e, i = t.questions.map((e) => {
|
|
1404
|
+
let t = n.map((t) => {
|
|
1405
|
+
try {
|
|
1406
|
+
return JSON.parse(t.answer_data || "{}")[e.id];
|
|
1407
|
+
} catch {
|
|
1408
|
+
return null;
|
|
1409
|
+
}
|
|
1410
|
+
}).filter((e) => e != null), r = { total: t.length };
|
|
1411
|
+
if (e.type === "radio" || e.type === "select") {
|
|
1412
|
+
let n = {};
|
|
1413
|
+
e.options.forEach((e) => {
|
|
1414
|
+
n[e] = 0;
|
|
1415
|
+
}), t.forEach((e) => {
|
|
1416
|
+
n[e] !== void 0 && n[e]++;
|
|
1417
|
+
}), r.options = n;
|
|
1418
|
+
} else if (e.type === "checkbox") {
|
|
1419
|
+
let n = {};
|
|
1420
|
+
e.options.forEach((e) => {
|
|
1421
|
+
n[e] = 0;
|
|
1422
|
+
}), t.forEach((e) => {
|
|
1423
|
+
Array.isArray(e) && e.forEach((e) => {
|
|
1424
|
+
n[e] !== void 0 && n[e]++;
|
|
1425
|
+
});
|
|
1426
|
+
}), r.options = n;
|
|
1427
|
+
} else if (e.type === "rating") {
|
|
1428
|
+
let e = {};
|
|
1429
|
+
t.forEach((t) => {
|
|
1430
|
+
let n = String(t);
|
|
1431
|
+
e[n] = (e[n] || 0) + 1;
|
|
1432
|
+
}), r.ratings = e, r.average = t.length > 0 ? (t.reduce((e, t) => e + Number(t), 0) / t.length).toFixed(1) : 0;
|
|
1433
|
+
} else e.type === "text" && (r.sampleAnswers = t.slice(0, 5));
|
|
1434
|
+
return {
|
|
1435
|
+
question: e,
|
|
1436
|
+
stats: r
|
|
1437
|
+
};
|
|
1438
|
+
}), a = `
|
|
1439
|
+
<div style="font-family: 'Microsoft YaHei', sans-serif; padding: 20px;">
|
|
1440
|
+
<h2 style="color: #409eff; border-bottom: 2px solid #409eff; padding-bottom: 10px;">📊 问卷智能分析报告</h2>
|
|
1441
|
+
<div style="background: #f5f7fa; padding: 15px; border-radius: 8px; margin: 15px 0;">
|
|
1442
|
+
<p><strong>问卷标题:</strong>${t.title}</p>
|
|
1443
|
+
<p><strong>总回答数:</strong>${r} 份</p>
|
|
1444
|
+
<p><strong>分析时间:</strong>${(/* @__PURE__ */ new Date()).toLocaleString("zh-CN")}</p>
|
|
1445
|
+
</div>
|
|
1446
|
+
|
|
1447
|
+
<h3 style="color: #606266; margin-top: 20px;">📈 数据概览</h3>
|
|
1448
|
+
<div style="display: flex; gap: 20px; margin: 15px 0;">
|
|
1449
|
+
<div style="flex: 1; background: #e6f7ff; padding: 15px; border-radius: 8px; text-align: center;">
|
|
1450
|
+
<div style="font-size: 28px; font-weight: bold; color: #1890ff;">${r}</div>
|
|
1451
|
+
<div style="color: #666;">总回答数</div>
|
|
1452
|
+
</div>
|
|
1453
|
+
<div style="flex: 1; background: #f6ffed; padding: 15px; border-radius: 8px; text-align: center;">
|
|
1454
|
+
<div style="font-size: 28px; font-weight: bold; color: #52c41a;">${t.questions.length}</div>
|
|
1455
|
+
<div style="color: #666;">题目数量</div>
|
|
1456
|
+
</div>
|
|
1457
|
+
<div style="flex: 1; background: #fff7e6; padding: 15px; border-radius: 8px; text-align: center;">
|
|
1458
|
+
<div style="font-size: 28px; font-weight: bold; color: #fa8c16;">${n.filter((e) => e.is_valid).length}</div>
|
|
1459
|
+
<div style="color: #666;">有效回答</div>
|
|
1460
|
+
</div>
|
|
1461
|
+
</div>
|
|
1462
|
+
|
|
1463
|
+
<h3 style="color: #606266; margin-top: 20px;">📝 各题目详细分析</h3>
|
|
1464
|
+
`;
|
|
1465
|
+
return i.forEach((e, t) => {
|
|
1466
|
+
let { question: n, stats: r } = e;
|
|
1467
|
+
if (a += `
|
|
1468
|
+
<div style="background: #fff; border: 1px solid #ebeef5; border-radius: 8px; padding: 15px; margin: 10px 0;">
|
|
1469
|
+
<h4 style="color: #303133; margin-bottom: 10px;">${t + 1}. ${n.title || "未命名题目"}</h4>
|
|
1470
|
+
<p style="color: #909399; font-size: 12px; margin-bottom: 10px;">类型:${fr(n.type)} | 回答数:${r.total}</p>
|
|
1471
|
+
`, n.type === "radio" || n.type === "select" || n.type === "checkbox") {
|
|
1472
|
+
if (r.options) {
|
|
1473
|
+
a += "<div style=\"margin-top: 10px;\">";
|
|
1474
|
+
let e = Math.max(...Object.values(r.options), 1);
|
|
1475
|
+
Object.entries(r.options).forEach(([t, n]) => {
|
|
1476
|
+
let i = r.total > 0 ? (n / r.total * 100).toFixed(1) : 0, o = (n / e * 100).toFixed(0);
|
|
1477
|
+
a += `
|
|
1478
|
+
<div style="margin: 8px 0;">
|
|
1479
|
+
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
1480
|
+
<span>${t}</span>
|
|
1481
|
+
<span style="color: #909399;">${n}票 (${i}%)</span>
|
|
1482
|
+
</div>
|
|
1483
|
+
<div style="background: #f0f0f0; height: 20px; border-radius: 4px; overflow: hidden;">
|
|
1484
|
+
<div style="background: linear-gradient(90deg, #409eff, #66b1ff); height: 100%; width: ${o}%; transition: width 0.3s;"></div>
|
|
1485
|
+
</div>
|
|
1486
|
+
</div>
|
|
1487
|
+
`;
|
|
1488
|
+
}), a += "</div>";
|
|
1489
|
+
}
|
|
1490
|
+
} else n.type === "rating" ? a += `
|
|
1491
|
+
<div style="text-align: center; padding: 15px; background: #fdf6ec; border-radius: 8px; margin-top: 10px;">
|
|
1492
|
+
<div style="font-size: 36px; font-weight: bold; color: #e6a23c;">⭐ ${r.average || "-"}</div>
|
|
1493
|
+
<div style="color: #909399; margin-top: 5px;">平均评分</div>
|
|
1494
|
+
</div>
|
|
1495
|
+
` : n.type === "text" && r.sampleAnswers && r.sampleAnswers.length > 0 && (a += "<div style=\"margin-top: 10px;\">", r.sampleAnswers.forEach((e, t) => {
|
|
1496
|
+
a += `<div style="background: #f5f7fa; padding: 8px 12px; border-radius: 4px; margin: 5px 0; font-style: italic;">"${e}"</div>`;
|
|
1497
|
+
}), a += "</div>");
|
|
1498
|
+
a += "</div>";
|
|
1499
|
+
}), a += `
|
|
1500
|
+
<div style="background: #f0f9ff; border-left: 4px solid #409eff; padding: 15px; margin-top: 20px; border-radius: 0 8px 8px 0;">
|
|
1501
|
+
<h4 style="color: #409eff; margin-bottom: 10px;">💡 AI建议</h4>
|
|
1502
|
+
<ul style="color: #606266; margin: 0; padding-left: 20px;">
|
|
1503
|
+
<li>建议增加更多选择题以提高数据的可分析性</li>
|
|
1504
|
+
<li>对于评分题,可以考虑增加分值范围以获得更精细的反馈</li>
|
|
1505
|
+
<li>建议在问卷末尾添加开放性问题收集定性反馈</li>
|
|
1506
|
+
<li>当前问卷完成率为 ${r > 0 ? "100%" : "0%"},建议优化问卷长度提高完成率</li>
|
|
1507
|
+
</ul>
|
|
1508
|
+
</div>
|
|
1509
|
+
</div>
|
|
1510
|
+
`, a;
|
|
1511
|
+
}, fr = (e) => ({
|
|
1512
|
+
text: "文本题",
|
|
1513
|
+
radio: "单选题",
|
|
1514
|
+
checkbox: "多选题",
|
|
1515
|
+
select: "下拉题",
|
|
1516
|
+
rating: "评分题",
|
|
1517
|
+
scale: "量表题",
|
|
1518
|
+
matrix: "矩阵题",
|
|
1519
|
+
image: "图片题"
|
|
1520
|
+
})[e] || e, pr = () => {
|
|
1521
|
+
if (!fe.value) return;
|
|
1522
|
+
let e = `<!DOCTYPE html>
|
|
1523
|
+
<html lang="zh-CN">
|
|
1524
|
+
<head>
|
|
1525
|
+
<meta charset="UTF-8">
|
|
1526
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1527
|
+
<title>${h.value} - AI分析报告</title>
|
|
1528
|
+
<style>
|
|
1529
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1530
|
+
body { font-family: 'Microsoft YaHei', sans-serif; background: #f5f7fa; padding: 20px; }
|
|
1531
|
+
.container { max-width: 900px; margin: 0 auto; background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
|
|
1532
|
+
h2 { color: #409eff; border-bottom: 2px solid #409eff; padding-bottom: 10px; }
|
|
1533
|
+
h3 { color: #606266; margin-top: 20px; }
|
|
1534
|
+
h4 { color: #303133; margin-bottom: 10px; }
|
|
1535
|
+
p { line-height: 1.6; }
|
|
1536
|
+
ul { padding-left: 20px; }
|
|
1537
|
+
li { margin: 5px 0; }
|
|
1538
|
+
</style>
|
|
1539
|
+
</head>
|
|
1540
|
+
<body>
|
|
1541
|
+
<div class="container">
|
|
1542
|
+
${fe.value}
|
|
1543
|
+
</div>
|
|
1544
|
+
</body>
|
|
1545
|
+
</html>`, t = new Blob([e], { type: "text/html;charset=utf-8" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
1546
|
+
r.href = n, r.download = `${h.value || "问卷"}_AI分析报告.html`, r.click(), URL.revokeObjectURL(n), A.success("AI分析报告已下载");
|
|
1547
|
+
}, mr = async () => {
|
|
1548
|
+
if (l.params.id) {
|
|
1549
|
+
L.value = Number(l.params.id);
|
|
1550
|
+
try {
|
|
1551
|
+
let e = await fetch(`/api/questionnaires/${L.value}`);
|
|
1552
|
+
if (!e.ok) throw Error("加载失败");
|
|
1553
|
+
let t = await e.json();
|
|
1554
|
+
h.value = t.title, T.value = t.description || "", D.value = t.author || "", j.value = t.status || "draft", M.value = t.begin_time ? new Date(t.begin_time) : null, re.value = t.end_time ? new Date(t.end_time) : null, t.collab_closed && (H.value = !0), t.config && Un(t.config);
|
|
1555
|
+
} catch (e) {
|
|
1556
|
+
A.error("加载问卷失败: " + e.message);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}, hr = () => {
|
|
1560
|
+
if (!L.value) {
|
|
1561
|
+
A.warning("请先保存问卷");
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
me.value = !0;
|
|
1565
|
+
}, gr = (e) => {
|
|
1566
|
+
try {
|
|
1567
|
+
let t = JSON.parse(e);
|
|
1568
|
+
t.title && (h.value = t.title), t.description && (T.value = t.description), t.author && (D.value = t.author), t.questions && (N.value = t.questions), t.settings && t.settings.showScore !== void 0 && (P.value = t.settings.showScore);
|
|
1569
|
+
} catch (e) {
|
|
1570
|
+
console.error("Version apply error:", e);
|
|
1571
|
+
}
|
|
1572
|
+
}, _r = async () => {
|
|
1573
|
+
if (V.value) {
|
|
1574
|
+
let e = U?.getMap("_meta");
|
|
1575
|
+
if (H.value || e?.get("_closed") === !0) {
|
|
1576
|
+
H.value = !0, A.error("协作已关闭,无法保存更新");
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
if (N.value.length > 0 && N.value.find((e) => !e.referenceAnswer || e.referenceAnswer.trim() === "" || !e.scoringCriteria || e.scoringCriteria.trim() === "")) {
|
|
1581
|
+
A.error("请为所有题目填写参考答案和评分标准说明");
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
let e = {
|
|
1585
|
+
title: h.value,
|
|
1586
|
+
description: T.value,
|
|
1587
|
+
author: D.value || "user",
|
|
1588
|
+
config: Hn(),
|
|
1589
|
+
status: j.value,
|
|
1590
|
+
begin_time: M.value,
|
|
1591
|
+
end_time: re.value,
|
|
1592
|
+
...V.value ? { is_collab_user: !0 } : {}
|
|
1593
|
+
};
|
|
1594
|
+
try {
|
|
1595
|
+
let t;
|
|
1596
|
+
if (t = L.value ? await fetch(`/api/questionnaires/${L.value}`, {
|
|
1597
|
+
method: "PUT",
|
|
1598
|
+
headers: { "Content-Type": "application/json" },
|
|
1599
|
+
body: JSON.stringify(e)
|
|
1600
|
+
}) : await fetch("/api/questionnaires/", {
|
|
1601
|
+
method: "POST",
|
|
1602
|
+
headers: { "Content-Type": "application/json" },
|
|
1603
|
+
body: JSON.stringify(e)
|
|
1604
|
+
}), t.status === 403) {
|
|
1605
|
+
H.value = !0, A.error("协作已关闭,无法保存更新");
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
if (!t.ok) throw Error("保存失败");
|
|
1609
|
+
let n = await t.json();
|
|
1610
|
+
L.value || (L.value = n.id, u.replace(`/questionnaire-editor/${n.id}`)), A.success("保存成功"), he({
|
|
1611
|
+
documentId: L.value,
|
|
1612
|
+
docType: "questionnaire",
|
|
1613
|
+
content: JSON.stringify({
|
|
1614
|
+
title: h.value,
|
|
1615
|
+
description: T.value,
|
|
1616
|
+
author: D.value || "user",
|
|
1617
|
+
questions: N.value,
|
|
1618
|
+
settings: { showScore: P.value }
|
|
1619
|
+
}),
|
|
1620
|
+
userId: String(z.currentUser.value?.id || ""),
|
|
1621
|
+
userName: z.currentUser.value?.name || D.value || "未知"
|
|
1622
|
+
});
|
|
1623
|
+
} catch (e) {
|
|
1624
|
+
A.error("保存失败: " + e.message);
|
|
1625
|
+
}
|
|
1626
|
+
}, vr = () => u.push("/"), yr = [
|
|
1627
|
+
"我可以帮您设计问卷结构、优化题目表述,或者提供调查方案建议。请问有什么需要帮助的?",
|
|
1628
|
+
"这份问卷的结构很合理。建议检查题目顺序是否符合逻辑,是否从易到难排列。",
|
|
1629
|
+
"根据问卷主题,我建议添加一些开放式问题,收集更详细的用户反馈。",
|
|
1630
|
+
"我可以帮您检查问卷中是否存在引导性问题或歧义表述。需要我逐题分析吗?",
|
|
1631
|
+
"建议为每个题目添加选项\"其他\"和\"不确定\",提高数据的完整性。",
|
|
1632
|
+
"问卷的题量适中。如果题目较多,建议分页展示,减少受访者的疲劳感。",
|
|
1633
|
+
"我可以帮您分析问卷的逻辑跳转设置是否合理,确保不同分支的题目正确显示。",
|
|
1634
|
+
"建议在问卷开头添加简短的说明文字,告知受访者问卷的目的和预计填写时间。"
|
|
1635
|
+
], br = async (e, t = {}) => {
|
|
1636
|
+
let n = L.value ? `${_n}-${L.value}` : null;
|
|
1637
|
+
await z.sendMessage(e, {
|
|
1638
|
+
...t,
|
|
1639
|
+
roomId: n
|
|
1640
|
+
});
|
|
1641
|
+
let r = t.mentionedUser, i = r && r.toLowerCase().includes("ai"), a = z.collabUsers.value.filter((e) => e.name !== z.currentUser.value.name);
|
|
1642
|
+
(!r || i || a.length === 0) && (z.loading.value = !0, setTimeout(() => {
|
|
1643
|
+
z.sendAiMessage(yr[Math.floor(Math.random() * yr.length)], n), z.loading.value = !1;
|
|
1644
|
+
}, 800 + Math.random() * 1200));
|
|
1645
|
+
}, xr = () => {
|
|
1646
|
+
let e = L.value ? `${_n}-${L.value}` : null;
|
|
1647
|
+
z.clearMessages(e);
|
|
1648
|
+
};
|
|
1649
|
+
return m(() => {
|
|
1650
|
+
mr().then(() => {
|
|
1651
|
+
if (L.value) {
|
|
1652
|
+
bn();
|
|
1653
|
+
let e = new URLSearchParams(window.location.search);
|
|
1654
|
+
e.get("collab") === "1" && Dn(), e.get("ai") === "1" && (ue.value = !0);
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
}), p(() => {
|
|
1658
|
+
Sn(), W && (W.disconnect(), W.destroy()), U && U.destroy();
|
|
1659
|
+
}), (t, c) => {
|
|
1660
|
+
let l = b("ArrowLeft"), u = b("el-icon"), p = b("el-button"), m = b("el-input"), _ = b("el-option"), v = b("el-select"), C = b("el-date-picker"), O = b("el-divider"), k = b("Download"), A = b("Upload"), ee = b("Printer"), te = b("ArrowDown"), ne = b("el-dropdown-item"), I = b("el-dropdown-menu"), he = b("el-dropdown"), be = b("Share"), Te = b("Link"), De = b("Promotion"), Oe = b("Message"), H = b("Cpu"), ke = b("DataAnalysis"), U = b("List"), W = b("Monitor"), G = b("Check"), K = b("Clock"), q = b("Setting"), J = b("el-color-picker"), Y = b("el-slider"), X = b("el-radio-button"), je = b("el-radio-group"), _n = b("el-popover"), Z = b("el-input-number"), Q = b("el-switch"), vn = b("Delete"), yn = b("Top"), bn = b("Bottom"), xn = b("PictureFilled"), Sn = b("el-upload"), Cn = b("Close"), wn = b("el-radio"), Tn = b("Plus"), Dn = b("el-checkbox"), On = b("el-tag"), $ = b("StarFilled"), kn = b("Switch"), An = b("ArrowRight"), jn = b("Trophy"), Mn = b("Document"), Hn = b("Edit"), Un = b("Select"), Jn = b("Finished"), Yn = b("Histogram"), Qn = b("Grid"), cr = b("el-dialog"), dr = b("Loading"), fr = b("el-table-column"), mr = b("el-link"), yr = b("el-table");
|
|
1661
|
+
return g(), i(e, null, [
|
|
1662
|
+
a("div", Me, [a("div", Ne, [a("div", Pe, [
|
|
1663
|
+
s(p, {
|
|
1664
|
+
onClick: vr,
|
|
1665
|
+
size: "small",
|
|
1666
|
+
circle: ""
|
|
1667
|
+
}, {
|
|
1668
|
+
default: w(() => [s(u, null, {
|
|
1669
|
+
default: w(() => [s(l)]),
|
|
1670
|
+
_: 1
|
|
1671
|
+
})]),
|
|
1672
|
+
_: 1
|
|
1673
|
+
}),
|
|
1674
|
+
s(m, {
|
|
1675
|
+
modelValue: h.value,
|
|
1676
|
+
"onUpdate:modelValue": c[0] ||= (e) => h.value = e,
|
|
1677
|
+
class: "title-input",
|
|
1678
|
+
placeholder: "问卷标题 *",
|
|
1679
|
+
size: "small",
|
|
1680
|
+
style: { width: "200px" },
|
|
1681
|
+
disabled: V.value
|
|
1682
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
1683
|
+
s(m, {
|
|
1684
|
+
modelValue: D.value,
|
|
1685
|
+
"onUpdate:modelValue": c[1] ||= (e) => D.value = e,
|
|
1686
|
+
class: "author-input",
|
|
1687
|
+
placeholder: "作者 *",
|
|
1688
|
+
size: "small",
|
|
1689
|
+
style: { width: "140px" }
|
|
1690
|
+
}, null, 8, ["modelValue"])
|
|
1691
|
+
]), a("div", Fe, [
|
|
1692
|
+
V.value ? r("", !0) : (g(), n(v, {
|
|
1693
|
+
key: 0,
|
|
1694
|
+
modelValue: j.value,
|
|
1695
|
+
"onUpdate:modelValue": c[2] ||= (e) => j.value = e,
|
|
1696
|
+
size: "small",
|
|
1697
|
+
style: { width: "90px" }
|
|
1698
|
+
}, {
|
|
1699
|
+
default: w(() => [
|
|
1700
|
+
s(_, {
|
|
1701
|
+
label: "草稿",
|
|
1702
|
+
value: "draft"
|
|
1703
|
+
}),
|
|
1704
|
+
s(_, {
|
|
1705
|
+
label: "已发布",
|
|
1706
|
+
value: "published"
|
|
1707
|
+
}),
|
|
1708
|
+
s(_, {
|
|
1709
|
+
label: "已关闭",
|
|
1710
|
+
value: "closed"
|
|
1711
|
+
})
|
|
1712
|
+
]),
|
|
1713
|
+
_: 1
|
|
1714
|
+
}, 8, ["modelValue"])),
|
|
1715
|
+
V.value ? r("", !0) : (g(), n(C, {
|
|
1716
|
+
key: 1,
|
|
1717
|
+
modelValue: M.value,
|
|
1718
|
+
"onUpdate:modelValue": c[3] ||= (e) => M.value = e,
|
|
1719
|
+
type: "datetime",
|
|
1720
|
+
size: "small",
|
|
1721
|
+
placeholder: "开始时间",
|
|
1722
|
+
style: { width: "170px" }
|
|
1723
|
+
}, null, 8, ["modelValue"])),
|
|
1724
|
+
V.value ? r("", !0) : (g(), n(C, {
|
|
1725
|
+
key: 2,
|
|
1726
|
+
modelValue: re.value,
|
|
1727
|
+
"onUpdate:modelValue": c[4] ||= (e) => re.value = e,
|
|
1728
|
+
type: "datetime",
|
|
1729
|
+
size: "small",
|
|
1730
|
+
placeholder: "结束时间",
|
|
1731
|
+
style: { width: "170px" }
|
|
1732
|
+
}, null, 8, ["modelValue"])),
|
|
1733
|
+
s(O, { direction: "vertical" }),
|
|
1734
|
+
V.value ? r("", !0) : (g(), n(p, {
|
|
1735
|
+
key: 3,
|
|
1736
|
+
size: "small",
|
|
1737
|
+
onClick: Wn,
|
|
1738
|
+
title: "导出JSON"
|
|
1739
|
+
}, {
|
|
1740
|
+
default: w(() => [s(u, null, {
|
|
1741
|
+
default: w(() => [s(k)]),
|
|
1742
|
+
_: 1
|
|
1743
|
+
})]),
|
|
1744
|
+
_: 1
|
|
1745
|
+
})),
|
|
1746
|
+
V.value ? r("", !0) : (g(), n(p, {
|
|
1747
|
+
key: 4,
|
|
1748
|
+
size: "small",
|
|
1749
|
+
onClick: Gn,
|
|
1750
|
+
title: "导入JSON"
|
|
1751
|
+
}, {
|
|
1752
|
+
default: w(() => [s(u, null, {
|
|
1753
|
+
default: w(() => [s(A)]),
|
|
1754
|
+
_: 1
|
|
1755
|
+
})]),
|
|
1756
|
+
_: 1
|
|
1757
|
+
})),
|
|
1758
|
+
a("input", {
|
|
1759
|
+
ref_key: "importInputRef",
|
|
1760
|
+
ref: oe,
|
|
1761
|
+
type: "file",
|
|
1762
|
+
accept: ".json",
|
|
1763
|
+
style: { display: "none" },
|
|
1764
|
+
onChange: Kn
|
|
1765
|
+
}, null, 544),
|
|
1766
|
+
V.value ? r("", !0) : (g(), n(O, {
|
|
1767
|
+
key: 5,
|
|
1768
|
+
direction: "vertical"
|
|
1769
|
+
})),
|
|
1770
|
+
V.value ? r("", !0) : (g(), n(he, {
|
|
1771
|
+
key: 6,
|
|
1772
|
+
trigger: "click",
|
|
1773
|
+
onCommand: qn
|
|
1774
|
+
}, {
|
|
1775
|
+
dropdown: w(() => [s(I, null, {
|
|
1776
|
+
default: w(() => [
|
|
1777
|
+
s(ne, { command: "pdf" }, {
|
|
1778
|
+
default: w(() => [...c[47] ||= [o("导出 PDF", -1)]]),
|
|
1779
|
+
_: 1
|
|
1780
|
+
}),
|
|
1781
|
+
s(ne, { command: "word" }, {
|
|
1782
|
+
default: w(() => [...c[48] ||= [o("导出 Word", -1)]]),
|
|
1783
|
+
_: 1
|
|
1784
|
+
}),
|
|
1785
|
+
s(ne, { command: "html" }, {
|
|
1786
|
+
default: w(() => [...c[49] ||= [o("导出 HTML", -1)]]),
|
|
1787
|
+
_: 1
|
|
1788
|
+
}),
|
|
1789
|
+
s(ne, { command: "standalone" }, {
|
|
1790
|
+
default: w(() => [...c[50] ||= [o("独立 HTML 表单", -1)]]),
|
|
1791
|
+
_: 1
|
|
1792
|
+
})
|
|
1793
|
+
]),
|
|
1794
|
+
_: 1
|
|
1795
|
+
})]),
|
|
1796
|
+
default: w(() => [s(p, { size: "small" }, {
|
|
1797
|
+
default: w(() => [
|
|
1798
|
+
s(u, null, {
|
|
1799
|
+
default: w(() => [s(ee)]),
|
|
1800
|
+
_: 1
|
|
1801
|
+
}),
|
|
1802
|
+
c[46] ||= o(" 导出 ", -1),
|
|
1803
|
+
s(u, { class: "el-icon--right" }, {
|
|
1804
|
+
default: w(() => [s(te)]),
|
|
1805
|
+
_: 1
|
|
1806
|
+
})
|
|
1807
|
+
]),
|
|
1808
|
+
_: 1
|
|
1809
|
+
})]),
|
|
1810
|
+
_: 1
|
|
1811
|
+
})),
|
|
1812
|
+
V.value ? r("", !0) : (g(), n(O, {
|
|
1813
|
+
key: 7,
|
|
1814
|
+
direction: "vertical"
|
|
1815
|
+
})),
|
|
1816
|
+
V.value ? r("", !0) : (g(), n(p, {
|
|
1817
|
+
key: 8,
|
|
1818
|
+
size: "small",
|
|
1819
|
+
type: B.value ? "success" : "default",
|
|
1820
|
+
onClick: En
|
|
1821
|
+
}, {
|
|
1822
|
+
default: w(() => [s(u, null, {
|
|
1823
|
+
default: w(() => [s(be)]),
|
|
1824
|
+
_: 1
|
|
1825
|
+
}), a("span", null, x(B.value ? "协作中" : "协作"), 1)]),
|
|
1826
|
+
_: 1
|
|
1827
|
+
}, 8, ["type"])),
|
|
1828
|
+
L.value && B.value && !V.value ? (g(), n(p, {
|
|
1829
|
+
key: 9,
|
|
1830
|
+
size: "small",
|
|
1831
|
+
circle: "",
|
|
1832
|
+
onClick: Xn,
|
|
1833
|
+
title: "分享协作编辑链接"
|
|
1834
|
+
}, {
|
|
1835
|
+
default: w(() => [s(u, null, {
|
|
1836
|
+
default: w(() => [s(Te)]),
|
|
1837
|
+
_: 1
|
|
1838
|
+
})]),
|
|
1839
|
+
_: 1
|
|
1840
|
+
})) : r("", !0),
|
|
1841
|
+
L.value && !V.value ? (g(), n(p, {
|
|
1842
|
+
key: 10,
|
|
1843
|
+
size: "small",
|
|
1844
|
+
circle: "",
|
|
1845
|
+
onClick: Zn,
|
|
1846
|
+
title: "分享填写链接"
|
|
1847
|
+
}, {
|
|
1848
|
+
default: w(() => [s(u, null, {
|
|
1849
|
+
default: w(() => [s(De)]),
|
|
1850
|
+
_: 1
|
|
1851
|
+
})]),
|
|
1852
|
+
_: 1
|
|
1853
|
+
})) : r("", !0),
|
|
1854
|
+
L.value && !V.value ? (g(), n(p, {
|
|
1855
|
+
key: 11,
|
|
1856
|
+
size: "small",
|
|
1857
|
+
type: "warning",
|
|
1858
|
+
onClick: c[5] ||= (e) => se.value = !0,
|
|
1859
|
+
title: "问卷分发"
|
|
1860
|
+
}, {
|
|
1861
|
+
default: w(() => [s(u, null, {
|
|
1862
|
+
default: w(() => [s(Oe)]),
|
|
1863
|
+
_: 1
|
|
1864
|
+
}), c[51] ||= o(" 分发 ", -1)]),
|
|
1865
|
+
_: 1
|
|
1866
|
+
})) : r("", !0),
|
|
1867
|
+
L.value && !V.value ? (g(), n(p, {
|
|
1868
|
+
key: 12,
|
|
1869
|
+
size: "small",
|
|
1870
|
+
onClick: lr,
|
|
1871
|
+
title: "AI分析"
|
|
1872
|
+
}, {
|
|
1873
|
+
default: w(() => [s(u, null, {
|
|
1874
|
+
default: w(() => [s(H)]),
|
|
1875
|
+
_: 1
|
|
1876
|
+
}), c[52] ||= a("span", null, "AI", -1)]),
|
|
1877
|
+
_: 1
|
|
1878
|
+
})) : r("", !0),
|
|
1879
|
+
L.value && !V.value ? (g(), n(p, {
|
|
1880
|
+
key: 13,
|
|
1881
|
+
size: "small",
|
|
1882
|
+
onClick: rr,
|
|
1883
|
+
title: "查看统计"
|
|
1884
|
+
}, {
|
|
1885
|
+
default: w(() => [s(u, null, {
|
|
1886
|
+
default: w(() => [s(ke)]),
|
|
1887
|
+
_: 1
|
|
1888
|
+
})]),
|
|
1889
|
+
_: 1
|
|
1890
|
+
})) : r("", !0),
|
|
1891
|
+
L.value && !V.value ? (g(), n(p, {
|
|
1892
|
+
key: 14,
|
|
1893
|
+
size: "small",
|
|
1894
|
+
onClick: ir,
|
|
1895
|
+
title: "反馈列表"
|
|
1896
|
+
}, {
|
|
1897
|
+
default: w(() => [s(u, null, {
|
|
1898
|
+
default: w(() => [s(U)]),
|
|
1899
|
+
_: 1
|
|
1900
|
+
})]),
|
|
1901
|
+
_: 1
|
|
1902
|
+
})) : r("", !0),
|
|
1903
|
+
s(p, {
|
|
1904
|
+
size: "small",
|
|
1905
|
+
circle: "",
|
|
1906
|
+
type: pe.value ? "primary" : "default",
|
|
1907
|
+
onClick: c[6] ||= (e) => pe.value = !pe.value,
|
|
1908
|
+
title: "AI助手"
|
|
1909
|
+
}, {
|
|
1910
|
+
default: w(() => [s(u, null, {
|
|
1911
|
+
default: w(() => [s(W)]),
|
|
1912
|
+
_: 1
|
|
1913
|
+
})]),
|
|
1914
|
+
_: 1
|
|
1915
|
+
}, 8, ["type"]),
|
|
1916
|
+
s(p, {
|
|
1917
|
+
size: "small",
|
|
1918
|
+
type: "primary",
|
|
1919
|
+
onClick: _r
|
|
1920
|
+
}, {
|
|
1921
|
+
default: w(() => [s(u, null, {
|
|
1922
|
+
default: w(() => [s(G)]),
|
|
1923
|
+
_: 1
|
|
1924
|
+
}), c[53] ||= o(" 保存", -1)]),
|
|
1925
|
+
_: 1
|
|
1926
|
+
}),
|
|
1927
|
+
L.value ? (g(), n(p, {
|
|
1928
|
+
key: 15,
|
|
1929
|
+
size: "small",
|
|
1930
|
+
circle: "",
|
|
1931
|
+
title: "更新履历",
|
|
1932
|
+
onClick: hr
|
|
1933
|
+
}, {
|
|
1934
|
+
default: w(() => [s(u, null, {
|
|
1935
|
+
default: w(() => [s(K)]),
|
|
1936
|
+
_: 1
|
|
1937
|
+
})]),
|
|
1938
|
+
_: 1
|
|
1939
|
+
})) : r("", !0)
|
|
1940
|
+
])]), a("div", Ie, [a("div", Le, [
|
|
1941
|
+
a("div", {
|
|
1942
|
+
class: "q-header-card",
|
|
1943
|
+
style: f({
|
|
1944
|
+
background: R.backgroundColor,
|
|
1945
|
+
"--header-font": R.headerFont,
|
|
1946
|
+
"--header-font-size": R.headerFontSize + "px",
|
|
1947
|
+
"--header-font-style": R.headerFontStyle,
|
|
1948
|
+
"--header-color": R.headerColor,
|
|
1949
|
+
"--title-align": R.titleAlign,
|
|
1950
|
+
"--title-font": R.titleFont,
|
|
1951
|
+
"--title-font-style": R.titleFontStyle,
|
|
1952
|
+
"--title-font-size": R.titleFontSize + "px",
|
|
1953
|
+
"--title-color": R.titleColor,
|
|
1954
|
+
"--desc-align": R.descAlign,
|
|
1955
|
+
"--desc-font": R.descFont,
|
|
1956
|
+
"--desc-font-style": R.descFontStyle,
|
|
1957
|
+
"--desc-font-size": R.descFontSize + "px",
|
|
1958
|
+
"--desc-color": R.descColor
|
|
1959
|
+
})
|
|
1960
|
+
}, [
|
|
1961
|
+
a("div", Re, [s(m, {
|
|
1962
|
+
modelValue: h.value,
|
|
1963
|
+
"onUpdate:modelValue": c[7] ||= (e) => h.value = e,
|
|
1964
|
+
placeholder: "请输入问卷标题",
|
|
1965
|
+
class: "q-title-input"
|
|
1966
|
+
}, null, 8, ["modelValue"]), s(_n, {
|
|
1967
|
+
placement: "right",
|
|
1968
|
+
width: 320,
|
|
1969
|
+
trigger: "click"
|
|
1970
|
+
}, {
|
|
1971
|
+
reference: w(() => [s(p, {
|
|
1972
|
+
size: "small",
|
|
1973
|
+
circle: "",
|
|
1974
|
+
class: "q-header-setting-btn"
|
|
1975
|
+
}, {
|
|
1976
|
+
default: w(() => [s(u, null, {
|
|
1977
|
+
default: w(() => [s(q)]),
|
|
1978
|
+
_: 1
|
|
1979
|
+
})]),
|
|
1980
|
+
_: 1
|
|
1981
|
+
})]),
|
|
1982
|
+
default: w(() => [a("div", ze, [
|
|
1983
|
+
a("div", Be, [c[54] ||= a("span", { class: "q-settings-label" }, "背景颜色", -1), s(J, {
|
|
1984
|
+
modelValue: R.backgroundColor,
|
|
1985
|
+
"onUpdate:modelValue": c[8] ||= (e) => R.backgroundColor = e,
|
|
1986
|
+
size: "small"
|
|
1987
|
+
}, null, 8, ["modelValue"])]),
|
|
1988
|
+
a("div", Ve, [c[55] ||= a("span", { class: "q-settings-label" }, "字体", -1), s(v, {
|
|
1989
|
+
modelValue: R.headerFont,
|
|
1990
|
+
"onUpdate:modelValue": c[9] ||= (e) => R.headerFont = e,
|
|
1991
|
+
size: "small",
|
|
1992
|
+
style: { width: "120px" }
|
|
1993
|
+
}, {
|
|
1994
|
+
default: w(() => [
|
|
1995
|
+
s(_, {
|
|
1996
|
+
label: "默认",
|
|
1997
|
+
value: "inherit"
|
|
1998
|
+
}),
|
|
1999
|
+
s(_, {
|
|
2000
|
+
label: "宋体",
|
|
2001
|
+
value: "SimSun, serif"
|
|
2002
|
+
}),
|
|
2003
|
+
s(_, {
|
|
2004
|
+
label: "黑体",
|
|
2005
|
+
value: "SimHei, sans-serif"
|
|
2006
|
+
}),
|
|
2007
|
+
s(_, {
|
|
2008
|
+
label: "微软雅黑",
|
|
2009
|
+
value: "Microsoft YaHei, sans-serif"
|
|
2010
|
+
}),
|
|
2011
|
+
s(_, {
|
|
2012
|
+
label: "楷体",
|
|
2013
|
+
value: "KaiTi, serif"
|
|
2014
|
+
}),
|
|
2015
|
+
s(_, {
|
|
2016
|
+
label: "Arial",
|
|
2017
|
+
value: "Arial, sans-serif"
|
|
2018
|
+
}),
|
|
2019
|
+
s(_, {
|
|
2020
|
+
label: "Times New Roman",
|
|
2021
|
+
value: "Times New Roman, serif"
|
|
2022
|
+
})
|
|
2023
|
+
]),
|
|
2024
|
+
_: 1
|
|
2025
|
+
}, 8, ["modelValue"])]),
|
|
2026
|
+
a("div", He, [c[56] ||= a("span", { class: "q-settings-label" }, "字号", -1), s(Y, {
|
|
2027
|
+
modelValue: R.headerFontSize,
|
|
2028
|
+
"onUpdate:modelValue": c[10] ||= (e) => R.headerFontSize = e,
|
|
2029
|
+
min: 10,
|
|
2030
|
+
max: 24,
|
|
2031
|
+
step: 1,
|
|
2032
|
+
"show-input": "",
|
|
2033
|
+
size: "small"
|
|
2034
|
+
}, null, 8, ["modelValue"])]),
|
|
2035
|
+
a("div", Ue, [c[59] ||= a("span", { class: "q-settings-label" }, "样式", -1), s(je, {
|
|
2036
|
+
modelValue: R.headerFontStyle,
|
|
2037
|
+
"onUpdate:modelValue": c[11] ||= (e) => R.headerFontStyle = e,
|
|
2038
|
+
size: "small"
|
|
2039
|
+
}, {
|
|
2040
|
+
default: w(() => [s(X, { value: "normal" }, {
|
|
2041
|
+
default: w(() => [...c[57] ||= [o("常规", -1)]]),
|
|
2042
|
+
_: 1
|
|
2043
|
+
}), s(X, { value: "italic" }, {
|
|
2044
|
+
default: w(() => [...c[58] ||= [o("斜体", -1)]]),
|
|
2045
|
+
_: 1
|
|
2046
|
+
})]),
|
|
2047
|
+
_: 1
|
|
2048
|
+
}, 8, ["modelValue"])]),
|
|
2049
|
+
a("div", We, [c[60] ||= a("span", { class: "q-settings-label" }, "颜色", -1), s(J, {
|
|
2050
|
+
modelValue: R.headerColor,
|
|
2051
|
+
"onUpdate:modelValue": c[12] ||= (e) => R.headerColor = e,
|
|
2052
|
+
size: "small"
|
|
2053
|
+
}, null, 8, ["modelValue"])]),
|
|
2054
|
+
s(O),
|
|
2055
|
+
c[81] ||= a("div", { class: "q-settings-section-title" }, "标题样式", -1),
|
|
2056
|
+
a("div", Ge, [c[64] ||= a("span", { class: "q-settings-label" }, "对齐", -1), s(je, {
|
|
2057
|
+
modelValue: R.titleAlign,
|
|
2058
|
+
"onUpdate:modelValue": c[13] ||= (e) => R.titleAlign = e,
|
|
2059
|
+
size: "small"
|
|
2060
|
+
}, {
|
|
2061
|
+
default: w(() => [
|
|
2062
|
+
s(X, { value: "left" }, {
|
|
2063
|
+
default: w(() => [...c[61] ||= [o("左", -1)]]),
|
|
2064
|
+
_: 1
|
|
2065
|
+
}),
|
|
2066
|
+
s(X, { value: "center" }, {
|
|
2067
|
+
default: w(() => [...c[62] ||= [o("中", -1)]]),
|
|
2068
|
+
_: 1
|
|
2069
|
+
}),
|
|
2070
|
+
s(X, { value: "right" }, {
|
|
2071
|
+
default: w(() => [...c[63] ||= [o("右", -1)]]),
|
|
2072
|
+
_: 1
|
|
2073
|
+
})
|
|
2074
|
+
]),
|
|
2075
|
+
_: 1
|
|
2076
|
+
}, 8, ["modelValue"])]),
|
|
2077
|
+
a("div", Ke, [c[65] ||= a("span", { class: "q-settings-label" }, "字体", -1), s(v, {
|
|
2078
|
+
modelValue: R.titleFont,
|
|
2079
|
+
"onUpdate:modelValue": c[14] ||= (e) => R.titleFont = e,
|
|
2080
|
+
size: "small",
|
|
2081
|
+
style: { width: "120px" }
|
|
2082
|
+
}, {
|
|
2083
|
+
default: w(() => [
|
|
2084
|
+
s(_, {
|
|
2085
|
+
label: "默认",
|
|
2086
|
+
value: "inherit"
|
|
2087
|
+
}),
|
|
2088
|
+
s(_, {
|
|
2089
|
+
label: "宋体",
|
|
2090
|
+
value: "SimSun, serif"
|
|
2091
|
+
}),
|
|
2092
|
+
s(_, {
|
|
2093
|
+
label: "黑体",
|
|
2094
|
+
value: "SimHei, sans-serif"
|
|
2095
|
+
}),
|
|
2096
|
+
s(_, {
|
|
2097
|
+
label: "微软雅黑",
|
|
2098
|
+
value: "Microsoft YaHei, sans-serif"
|
|
2099
|
+
}),
|
|
2100
|
+
s(_, {
|
|
2101
|
+
label: "楷体",
|
|
2102
|
+
value: "KaiTi, serif"
|
|
2103
|
+
}),
|
|
2104
|
+
s(_, {
|
|
2105
|
+
label: "Arial",
|
|
2106
|
+
value: "Arial, sans-serif"
|
|
2107
|
+
}),
|
|
2108
|
+
s(_, {
|
|
2109
|
+
label: "Times New Roman",
|
|
2110
|
+
value: "Times New Roman, serif"
|
|
2111
|
+
})
|
|
2112
|
+
]),
|
|
2113
|
+
_: 1
|
|
2114
|
+
}, 8, ["modelValue"])]),
|
|
2115
|
+
a("div", qe, [c[68] ||= a("span", { class: "q-settings-label" }, "样式", -1), s(je, {
|
|
2116
|
+
modelValue: R.titleFontStyle,
|
|
2117
|
+
"onUpdate:modelValue": c[15] ||= (e) => R.titleFontStyle = e,
|
|
2118
|
+
size: "small"
|
|
2119
|
+
}, {
|
|
2120
|
+
default: w(() => [s(X, { value: "normal" }, {
|
|
2121
|
+
default: w(() => [...c[66] ||= [o("常规", -1)]]),
|
|
2122
|
+
_: 1
|
|
2123
|
+
}), s(X, { value: "italic" }, {
|
|
2124
|
+
default: w(() => [...c[67] ||= [o("斜体", -1)]]),
|
|
2125
|
+
_: 1
|
|
2126
|
+
})]),
|
|
2127
|
+
_: 1
|
|
2128
|
+
}, 8, ["modelValue"])]),
|
|
2129
|
+
a("div", Je, [c[69] ||= a("span", { class: "q-settings-label" }, "字号", -1), s(Y, {
|
|
2130
|
+
modelValue: R.titleFontSize,
|
|
2131
|
+
"onUpdate:modelValue": c[16] ||= (e) => R.titleFontSize = e,
|
|
2132
|
+
min: 12,
|
|
2133
|
+
max: 40,
|
|
2134
|
+
step: 1,
|
|
2135
|
+
"show-input": "",
|
|
2136
|
+
size: "small"
|
|
2137
|
+
}, null, 8, ["modelValue"])]),
|
|
2138
|
+
a("div", Ye, [c[70] ||= a("span", { class: "q-settings-label" }, "颜色", -1), s(J, {
|
|
2139
|
+
modelValue: R.titleColor,
|
|
2140
|
+
"onUpdate:modelValue": c[17] ||= (e) => R.titleColor = e,
|
|
2141
|
+
size: "small"
|
|
2142
|
+
}, null, 8, ["modelValue"])]),
|
|
2143
|
+
s(O),
|
|
2144
|
+
c[82] ||= a("div", { class: "q-settings-section-title" }, "说明样式", -1),
|
|
2145
|
+
a("div", Xe, [c[74] ||= a("span", { class: "q-settings-label" }, "对齐", -1), s(je, {
|
|
2146
|
+
modelValue: R.descAlign,
|
|
2147
|
+
"onUpdate:modelValue": c[18] ||= (e) => R.descAlign = e,
|
|
2148
|
+
size: "small"
|
|
2149
|
+
}, {
|
|
2150
|
+
default: w(() => [
|
|
2151
|
+
s(X, { value: "left" }, {
|
|
2152
|
+
default: w(() => [...c[71] ||= [o("左", -1)]]),
|
|
2153
|
+
_: 1
|
|
2154
|
+
}),
|
|
2155
|
+
s(X, { value: "center" }, {
|
|
2156
|
+
default: w(() => [...c[72] ||= [o("中", -1)]]),
|
|
2157
|
+
_: 1
|
|
2158
|
+
}),
|
|
2159
|
+
s(X, { value: "right" }, {
|
|
2160
|
+
default: w(() => [...c[73] ||= [o("右", -1)]]),
|
|
2161
|
+
_: 1
|
|
2162
|
+
})
|
|
2163
|
+
]),
|
|
2164
|
+
_: 1
|
|
2165
|
+
}, 8, ["modelValue"])]),
|
|
2166
|
+
a("div", Ze, [c[75] ||= a("span", { class: "q-settings-label" }, "字体", -1), s(v, {
|
|
2167
|
+
modelValue: R.descFont,
|
|
2168
|
+
"onUpdate:modelValue": c[19] ||= (e) => R.descFont = e,
|
|
2169
|
+
size: "small",
|
|
2170
|
+
style: { width: "120px" }
|
|
2171
|
+
}, {
|
|
2172
|
+
default: w(() => [
|
|
2173
|
+
s(_, {
|
|
2174
|
+
label: "默认",
|
|
2175
|
+
value: "inherit"
|
|
2176
|
+
}),
|
|
2177
|
+
s(_, {
|
|
2178
|
+
label: "宋体",
|
|
2179
|
+
value: "SimSun, serif"
|
|
2180
|
+
}),
|
|
2181
|
+
s(_, {
|
|
2182
|
+
label: "黑体",
|
|
2183
|
+
value: "SimHei, sans-serif"
|
|
2184
|
+
}),
|
|
2185
|
+
s(_, {
|
|
2186
|
+
label: "微软雅黑",
|
|
2187
|
+
value: "Microsoft YaHei, sans-serif"
|
|
2188
|
+
}),
|
|
2189
|
+
s(_, {
|
|
2190
|
+
label: "楷体",
|
|
2191
|
+
value: "KaiTi, serif"
|
|
2192
|
+
}),
|
|
2193
|
+
s(_, {
|
|
2194
|
+
label: "Arial",
|
|
2195
|
+
value: "Arial, sans-serif"
|
|
2196
|
+
}),
|
|
2197
|
+
s(_, {
|
|
2198
|
+
label: "Times New Roman",
|
|
2199
|
+
value: "Times New Roman, serif"
|
|
2200
|
+
})
|
|
2201
|
+
]),
|
|
2202
|
+
_: 1
|
|
2203
|
+
}, 8, ["modelValue"])]),
|
|
2204
|
+
a("div", Qe, [c[78] ||= a("span", { class: "q-settings-label" }, "样式", -1), s(je, {
|
|
2205
|
+
modelValue: R.descFontStyle,
|
|
2206
|
+
"onUpdate:modelValue": c[20] ||= (e) => R.descFontStyle = e,
|
|
2207
|
+
size: "small"
|
|
2208
|
+
}, {
|
|
2209
|
+
default: w(() => [s(X, { value: "normal" }, {
|
|
2210
|
+
default: w(() => [...c[76] ||= [o("常规", -1)]]),
|
|
2211
|
+
_: 1
|
|
2212
|
+
}), s(X, { value: "italic" }, {
|
|
2213
|
+
default: w(() => [...c[77] ||= [o("斜体", -1)]]),
|
|
2214
|
+
_: 1
|
|
2215
|
+
})]),
|
|
2216
|
+
_: 1
|
|
2217
|
+
}, 8, ["modelValue"])]),
|
|
2218
|
+
a("div", $e, [c[79] ||= a("span", { class: "q-settings-label" }, "字号", -1), s(Y, {
|
|
2219
|
+
modelValue: R.descFontSize,
|
|
2220
|
+
"onUpdate:modelValue": c[21] ||= (e) => R.descFontSize = e,
|
|
2221
|
+
min: 10,
|
|
2222
|
+
max: 24,
|
|
2223
|
+
step: 1,
|
|
2224
|
+
"show-input": "",
|
|
2225
|
+
size: "small"
|
|
2226
|
+
}, null, 8, ["modelValue"])]),
|
|
2227
|
+
a("div", et, [c[80] ||= a("span", { class: "q-settings-label" }, "颜色", -1), s(J, {
|
|
2228
|
+
modelValue: R.descColor,
|
|
2229
|
+
"onUpdate:modelValue": c[22] ||= (e) => R.descColor = e,
|
|
2230
|
+
size: "small"
|
|
2231
|
+
}, null, 8, ["modelValue"])])
|
|
2232
|
+
])]),
|
|
2233
|
+
_: 1
|
|
2234
|
+
})]),
|
|
2235
|
+
s(m, {
|
|
2236
|
+
modelValue: T.value,
|
|
2237
|
+
"onUpdate:modelValue": c[23] ||= (e) => T.value = e,
|
|
2238
|
+
type: "textarea",
|
|
2239
|
+
rows: 2,
|
|
2240
|
+
placeholder: "问卷说明(选填)",
|
|
2241
|
+
class: "q-desc-input"
|
|
2242
|
+
}, null, 8, ["modelValue"]),
|
|
2243
|
+
a("div", tt, [a("div", nt, [
|
|
2244
|
+
c[83] ||= a("span", null, "及格分:", -1),
|
|
2245
|
+
s(Z, {
|
|
2246
|
+
modelValue: ie.value,
|
|
2247
|
+
"onUpdate:modelValue": c[24] ||= (e) => ie.value = e,
|
|
2248
|
+
min: 0,
|
|
2249
|
+
size: "small"
|
|
2250
|
+
}, null, 8, ["modelValue"]),
|
|
2251
|
+
a("span", rt, "总分:" + x(we.value) + "分", 1)
|
|
2252
|
+
]), a("div", it, [
|
|
2253
|
+
c[84] ||= a("span", null, "立刻给出评分:", -1),
|
|
2254
|
+
s(Q, {
|
|
2255
|
+
modelValue: P.value,
|
|
2256
|
+
"onUpdate:modelValue": c[25] ||= (e) => P.value = e,
|
|
2257
|
+
size: "small",
|
|
2258
|
+
"active-text": "是",
|
|
2259
|
+
"inactive-text": "否"
|
|
2260
|
+
}, null, 8, ["modelValue"]),
|
|
2261
|
+
c[85] ||= a("span", { class: "q-show-score-tip" }, "(选\"否\"则提交时不显示得分)", -1)
|
|
2262
|
+
])])
|
|
2263
|
+
], 4),
|
|
2264
|
+
a("div", at, [(g(!0), i(e, null, y(N.value, (t, l) => (g(), i("div", {
|
|
2265
|
+
key: t.id,
|
|
2266
|
+
class: d(["q-card", { active: ae.value === t.id }]),
|
|
2267
|
+
onClick: (e) => ae.value = t.id,
|
|
2268
|
+
draggable: "true",
|
|
2269
|
+
onDragstart: (e) => zn(l, e),
|
|
2270
|
+
onDragover: E((e) => Bn(l, e), ["prevent"]),
|
|
2271
|
+
onDrop: (e) => Vn(l, e)
|
|
2272
|
+
}, [
|
|
2273
|
+
a("div", st, [s(p, {
|
|
2274
|
+
size: "small",
|
|
2275
|
+
circle: "",
|
|
2276
|
+
onClick: E((e) => ar(l), ["stop"]),
|
|
2277
|
+
title: "AI生成题目",
|
|
2278
|
+
class: "ai-gen-btn"
|
|
2279
|
+
}, {
|
|
2280
|
+
default: w(() => [s(u, null, {
|
|
2281
|
+
default: w(() => [s(H)]),
|
|
2282
|
+
_: 1
|
|
2283
|
+
})]),
|
|
2284
|
+
_: 1
|
|
2285
|
+
}, 8, ["onClick"]), s(p, {
|
|
2286
|
+
size: "small",
|
|
2287
|
+
circle: "",
|
|
2288
|
+
type: "danger",
|
|
2289
|
+
onClick: E((e) => Pn(l), ["stop"]),
|
|
2290
|
+
title: "删除"
|
|
2291
|
+
}, {
|
|
2292
|
+
default: w(() => [s(u, null, {
|
|
2293
|
+
default: w(() => [s(vn)]),
|
|
2294
|
+
_: 1
|
|
2295
|
+
})]),
|
|
2296
|
+
_: 1
|
|
2297
|
+
}, 8, ["onClick"])]),
|
|
2298
|
+
a("div", ct, [
|
|
2299
|
+
a("span", lt, x(l + 1) + ".", 1),
|
|
2300
|
+
s(m, {
|
|
2301
|
+
modelValue: t.title,
|
|
2302
|
+
"onUpdate:modelValue": (e) => t.title = e,
|
|
2303
|
+
placeholder: "请输入题目标题",
|
|
2304
|
+
size: "small",
|
|
2305
|
+
class: "q-title"
|
|
2306
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2307
|
+
a("div", ut, [
|
|
2308
|
+
s(p, {
|
|
2309
|
+
size: "small",
|
|
2310
|
+
circle: "",
|
|
2311
|
+
onClick: E((e) => Fn(l, -1), ["stop"]),
|
|
2312
|
+
disabled: l === 0,
|
|
2313
|
+
title: "上移"
|
|
2314
|
+
}, {
|
|
2315
|
+
default: w(() => [s(u, null, {
|
|
2316
|
+
default: w(() => [s(yn)]),
|
|
2317
|
+
_: 1
|
|
2318
|
+
})]),
|
|
2319
|
+
_: 1
|
|
2320
|
+
}, 8, ["onClick", "disabled"]),
|
|
2321
|
+
s(p, {
|
|
2322
|
+
size: "small",
|
|
2323
|
+
circle: "",
|
|
2324
|
+
onClick: E((e) => Fn(l, 1), ["stop"]),
|
|
2325
|
+
disabled: l === N.value.length - 1,
|
|
2326
|
+
title: "下移"
|
|
2327
|
+
}, {
|
|
2328
|
+
default: w(() => [s(u, null, {
|
|
2329
|
+
default: w(() => [s(bn)]),
|
|
2330
|
+
_: 1
|
|
2331
|
+
})]),
|
|
2332
|
+
_: 1
|
|
2333
|
+
}, 8, ["onClick", "disabled"]),
|
|
2334
|
+
s(Q, {
|
|
2335
|
+
modelValue: t.required,
|
|
2336
|
+
"onUpdate:modelValue": (e) => t.required = e,
|
|
2337
|
+
size: "small",
|
|
2338
|
+
"active-text": "必填",
|
|
2339
|
+
onClick: c[26] ||= E(() => {}, ["stop"]),
|
|
2340
|
+
style: { "margin-left": "8px" }
|
|
2341
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
2342
|
+
])
|
|
2343
|
+
]),
|
|
2344
|
+
a("div", dt, [
|
|
2345
|
+
a("div", ft, [s(m, {
|
|
2346
|
+
modelValue: t.description,
|
|
2347
|
+
"onUpdate:modelValue": (e) => t.description = e,
|
|
2348
|
+
placeholder: "题目说明(选填)",
|
|
2349
|
+
size: "small"
|
|
2350
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])]),
|
|
2351
|
+
a("div", pt, [s(Sn, {
|
|
2352
|
+
"show-file-list": !1,
|
|
2353
|
+
"before-upload": (e) => Rn(t, e),
|
|
2354
|
+
accept: "image/*",
|
|
2355
|
+
class: "q-img-upload"
|
|
2356
|
+
}, {
|
|
2357
|
+
default: w(() => [s(p, {
|
|
2358
|
+
size: "small",
|
|
2359
|
+
circle: ""
|
|
2360
|
+
}, {
|
|
2361
|
+
default: w(() => [s(u, null, {
|
|
2362
|
+
default: w(() => [s(xn)]),
|
|
2363
|
+
_: 1
|
|
2364
|
+
})]),
|
|
2365
|
+
_: 1
|
|
2366
|
+
})]),
|
|
2367
|
+
_: 1
|
|
2368
|
+
}, 8, ["before-upload"]), t.image ? (g(), i("div", mt, [a("img", { src: t.image }, null, 8, ht), s(p, {
|
|
2369
|
+
size: "small",
|
|
2370
|
+
circle: "",
|
|
2371
|
+
type: "danger",
|
|
2372
|
+
class: "q-img-remove",
|
|
2373
|
+
onClick: (e) => t.image = ""
|
|
2374
|
+
}, {
|
|
2375
|
+
default: w(() => [s(u, null, {
|
|
2376
|
+
default: w(() => [s(Cn)]),
|
|
2377
|
+
_: 1
|
|
2378
|
+
})]),
|
|
2379
|
+
_: 1
|
|
2380
|
+
}, 8, ["onClick"])])) : r("", !0)]),
|
|
2381
|
+
t.type === "text" ? (g(), i("div", gt, [s(m, {
|
|
2382
|
+
modelValue: t.placeholder,
|
|
2383
|
+
"onUpdate:modelValue": (e) => t.placeholder = e,
|
|
2384
|
+
placeholder: "回答提示文字",
|
|
2385
|
+
size: "small"
|
|
2386
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]), s(v, {
|
|
2387
|
+
modelValue: t.textType,
|
|
2388
|
+
"onUpdate:modelValue": (e) => t.textType = e,
|
|
2389
|
+
size: "small",
|
|
2390
|
+
style: {
|
|
2391
|
+
width: "120px",
|
|
2392
|
+
"margin-left": "8px"
|
|
2393
|
+
}
|
|
2394
|
+
}, {
|
|
2395
|
+
default: w(() => [s(_, {
|
|
2396
|
+
label: "单行文本",
|
|
2397
|
+
value: "single"
|
|
2398
|
+
}), s(_, {
|
|
2399
|
+
label: "多行文本",
|
|
2400
|
+
value: "multi"
|
|
2401
|
+
})]),
|
|
2402
|
+
_: 1
|
|
2403
|
+
}, 8, ["modelValue", "onUpdate:modelValue"])])) : r("", !0),
|
|
2404
|
+
t.type === "radio" ? (g(), i("div", _t, [(g(!0), i(e, null, y(t.options, (e, n) => (g(), i("div", {
|
|
2405
|
+
key: n,
|
|
2406
|
+
class: "q-option-item"
|
|
2407
|
+
}, [
|
|
2408
|
+
s(wn, {
|
|
2409
|
+
"model-value": 0,
|
|
2410
|
+
disabled: ""
|
|
2411
|
+
}),
|
|
2412
|
+
s(m, {
|
|
2413
|
+
modelValue: t.options[n],
|
|
2414
|
+
"onUpdate:modelValue": (e) => t.options[n] = e,
|
|
2415
|
+
size: "small",
|
|
2416
|
+
placeholder: "选项",
|
|
2417
|
+
style: { flex: "1" }
|
|
2418
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2419
|
+
s(p, {
|
|
2420
|
+
size: "small",
|
|
2421
|
+
circle: "",
|
|
2422
|
+
type: "danger",
|
|
2423
|
+
onClick: (e) => Ln(t, n)
|
|
2424
|
+
}, {
|
|
2425
|
+
default: w(() => [s(u, null, {
|
|
2426
|
+
default: w(() => [s(Cn)]),
|
|
2427
|
+
_: 1
|
|
2428
|
+
})]),
|
|
2429
|
+
_: 1
|
|
2430
|
+
}, 8, ["onClick"])
|
|
2431
|
+
]))), 128)), s(p, {
|
|
2432
|
+
size: "small",
|
|
2433
|
+
onClick: (e) => In(t)
|
|
2434
|
+
}, {
|
|
2435
|
+
default: w(() => [s(u, null, {
|
|
2436
|
+
default: w(() => [s(Tn)]),
|
|
2437
|
+
_: 1
|
|
2438
|
+
}), c[86] ||= o(" 添加选项", -1)]),
|
|
2439
|
+
_: 1
|
|
2440
|
+
}, 8, ["onClick"])])) : r("", !0),
|
|
2441
|
+
t.type === "checkbox" ? (g(), i("div", vt, [(g(!0), i(e, null, y(t.options, (e, n) => (g(), i("div", {
|
|
2442
|
+
key: n,
|
|
2443
|
+
class: "q-option-item"
|
|
2444
|
+
}, [
|
|
2445
|
+
s(Dn, { disabled: "" }),
|
|
2446
|
+
s(m, {
|
|
2447
|
+
modelValue: t.options[n],
|
|
2448
|
+
"onUpdate:modelValue": (e) => t.options[n] = e,
|
|
2449
|
+
size: "small",
|
|
2450
|
+
placeholder: "选项",
|
|
2451
|
+
style: { flex: "1" }
|
|
2452
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2453
|
+
s(p, {
|
|
2454
|
+
size: "small",
|
|
2455
|
+
circle: "",
|
|
2456
|
+
type: "danger",
|
|
2457
|
+
onClick: (e) => Ln(t, n)
|
|
2458
|
+
}, {
|
|
2459
|
+
default: w(() => [s(u, null, {
|
|
2460
|
+
default: w(() => [s(Cn)]),
|
|
2461
|
+
_: 1
|
|
2462
|
+
})]),
|
|
2463
|
+
_: 1
|
|
2464
|
+
}, 8, ["onClick"])
|
|
2465
|
+
]))), 128)), s(p, {
|
|
2466
|
+
size: "small",
|
|
2467
|
+
onClick: (e) => In(t)
|
|
2468
|
+
}, {
|
|
2469
|
+
default: w(() => [s(u, null, {
|
|
2470
|
+
default: w(() => [s(Tn)]),
|
|
2471
|
+
_: 1
|
|
2472
|
+
}), c[87] ||= o(" 添加选项", -1)]),
|
|
2473
|
+
_: 1
|
|
2474
|
+
}, 8, ["onClick"])])) : r("", !0),
|
|
2475
|
+
t.type === "select" ? (g(), i("div", yt, [(g(!0), i(e, null, y(t.options, (e, n) => (g(), i("div", {
|
|
2476
|
+
key: n,
|
|
2477
|
+
class: "q-option-item"
|
|
2478
|
+
}, [
|
|
2479
|
+
s(On, {
|
|
2480
|
+
size: "small",
|
|
2481
|
+
type: "info"
|
|
2482
|
+
}, {
|
|
2483
|
+
default: w(() => [o(x(n + 1), 1)]),
|
|
2484
|
+
_: 2
|
|
2485
|
+
}, 1024),
|
|
2486
|
+
s(m, {
|
|
2487
|
+
modelValue: t.options[n],
|
|
2488
|
+
"onUpdate:modelValue": (e) => t.options[n] = e,
|
|
2489
|
+
size: "small",
|
|
2490
|
+
placeholder: "选项",
|
|
2491
|
+
style: { flex: "1" }
|
|
2492
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2493
|
+
s(p, {
|
|
2494
|
+
size: "small",
|
|
2495
|
+
circle: "",
|
|
2496
|
+
type: "danger",
|
|
2497
|
+
onClick: (e) => Ln(t, n)
|
|
2498
|
+
}, {
|
|
2499
|
+
default: w(() => [s(u, null, {
|
|
2500
|
+
default: w(() => [s(Cn)]),
|
|
2501
|
+
_: 1
|
|
2502
|
+
})]),
|
|
2503
|
+
_: 1
|
|
2504
|
+
}, 8, ["onClick"])
|
|
2505
|
+
]))), 128)), s(p, {
|
|
2506
|
+
size: "small",
|
|
2507
|
+
onClick: (e) => In(t)
|
|
2508
|
+
}, {
|
|
2509
|
+
default: w(() => [s(u, null, {
|
|
2510
|
+
default: w(() => [s(Tn)]),
|
|
2511
|
+
_: 1
|
|
2512
|
+
}), c[88] ||= o(" 添加选项", -1)]),
|
|
2513
|
+
_: 1
|
|
2514
|
+
}, 8, ["onClick"])])) : r("", !0),
|
|
2515
|
+
t.type === "rating" ? (g(), i("div", bt, [a("div", xt, [
|
|
2516
|
+
c[91] ||= a("span", null, "最大分值:", -1),
|
|
2517
|
+
s(Z, {
|
|
2518
|
+
modelValue: t.maxRating,
|
|
2519
|
+
"onUpdate:modelValue": (e) => t.maxRating = e,
|
|
2520
|
+
min: 3,
|
|
2521
|
+
max: 10,
|
|
2522
|
+
size: "small"
|
|
2523
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2524
|
+
c[92] ||= a("span", { style: { "margin-left": "16px" } }, "图标:", -1),
|
|
2525
|
+
s(je, {
|
|
2526
|
+
modelValue: t.ratingIcon,
|
|
2527
|
+
"onUpdate:modelValue": (e) => t.ratingIcon = e,
|
|
2528
|
+
size: "small"
|
|
2529
|
+
}, {
|
|
2530
|
+
default: w(() => [s(X, { label: "star" }, {
|
|
2531
|
+
default: w(() => [...c[89] ||= [o("星形", -1)]]),
|
|
2532
|
+
_: 1
|
|
2533
|
+
}), s(X, { label: "heart" }, {
|
|
2534
|
+
default: w(() => [...c[90] ||= [o("心形", -1)]]),
|
|
2535
|
+
_: 1
|
|
2536
|
+
})]),
|
|
2537
|
+
_: 1
|
|
2538
|
+
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
2539
|
+
]), a("div", St, [(g(!0), i(e, null, y(t.maxRating || 5, (e) => (g(), i("span", {
|
|
2540
|
+
key: e,
|
|
2541
|
+
class: "rating-icon",
|
|
2542
|
+
onClick: (n) => t._preview = e
|
|
2543
|
+
}, [s(u, {
|
|
2544
|
+
size: 20,
|
|
2545
|
+
class: d({ active: e <= (t._preview || 0) })
|
|
2546
|
+
}, {
|
|
2547
|
+
default: w(() => [s($)]),
|
|
2548
|
+
_: 1
|
|
2549
|
+
}, 8, ["class"])], 8, Ct))), 128))])])) : r("", !0),
|
|
2550
|
+
t.type === "scale" ? (g(), i("div", wt, [a("div", Tt, [
|
|
2551
|
+
s(m, {
|
|
2552
|
+
modelValue: t.scaleMinLabel,
|
|
2553
|
+
"onUpdate:modelValue": (e) => t.scaleMinLabel = e,
|
|
2554
|
+
size: "small",
|
|
2555
|
+
placeholder: "最低标签",
|
|
2556
|
+
style: { width: "120px" }
|
|
2557
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2558
|
+
c[93] ||= a("span", null, "← 量表 →", -1),
|
|
2559
|
+
s(m, {
|
|
2560
|
+
modelValue: t.scaleMaxLabel,
|
|
2561
|
+
"onUpdate:modelValue": (e) => t.scaleMaxLabel = e,
|
|
2562
|
+
size: "small",
|
|
2563
|
+
placeholder: "最高标签",
|
|
2564
|
+
style: { width: "120px" }
|
|
2565
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
2566
|
+
c[94] ||= a("span", { style: { "margin-left": "12px" } }, "刻度数:", -1),
|
|
2567
|
+
s(Z, {
|
|
2568
|
+
modelValue: t.scaleCount,
|
|
2569
|
+
"onUpdate:modelValue": (e) => t.scaleCount = e,
|
|
2570
|
+
min: 5,
|
|
2571
|
+
max: 10,
|
|
2572
|
+
size: "small"
|
|
2573
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
2574
|
+
]), a("div", Et, [(g(!0), i(e, null, y(t.scaleCount || 7, (e) => (g(), i("div", {
|
|
2575
|
+
key: e,
|
|
2576
|
+
class: "scale-dot"
|
|
2577
|
+
}, [c[95] ||= a("div", { class: "dot" }, null, -1), a("span", Dt, x(e), 1)]))), 128))])])) : r("", !0),
|
|
2578
|
+
t.type === "matrix" ? (g(), i("div", Ot, [a("div", kt, [a("div", At, [
|
|
2579
|
+
c[97] ||= a("span", { class: "label" }, "行标题:", -1),
|
|
2580
|
+
(g(!0), i(e, null, y(t.matrixRows, (e, n) => (g(), i("div", {
|
|
2581
|
+
key: n,
|
|
2582
|
+
class: "q-option-item"
|
|
2583
|
+
}, [s(m, {
|
|
2584
|
+
modelValue: t.matrixRows[n],
|
|
2585
|
+
"onUpdate:modelValue": (e) => t.matrixRows[n] = e,
|
|
2586
|
+
size: "small",
|
|
2587
|
+
placeholder: "行标题",
|
|
2588
|
+
style: { flex: "1" }
|
|
2589
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]), s(p, {
|
|
2590
|
+
size: "small",
|
|
2591
|
+
circle: "",
|
|
2592
|
+
type: "danger",
|
|
2593
|
+
onClick: (e) => t.matrixRows.splice(n, 1)
|
|
2594
|
+
}, {
|
|
2595
|
+
default: w(() => [s(u, null, {
|
|
2596
|
+
default: w(() => [s(Cn)]),
|
|
2597
|
+
_: 1
|
|
2598
|
+
})]),
|
|
2599
|
+
_: 1
|
|
2600
|
+
}, 8, ["onClick"])]))), 128)),
|
|
2601
|
+
s(p, {
|
|
2602
|
+
size: "small",
|
|
2603
|
+
onClick: (e) => t.matrixRows.push("")
|
|
2604
|
+
}, {
|
|
2605
|
+
default: w(() => [s(u, null, {
|
|
2606
|
+
default: w(() => [s(Tn)]),
|
|
2607
|
+
_: 1
|
|
2608
|
+
}), c[96] ||= o(" 添加行", -1)]),
|
|
2609
|
+
_: 1
|
|
2610
|
+
}, 8, ["onClick"])
|
|
2611
|
+
]), a("div", jt, [
|
|
2612
|
+
c[99] ||= a("span", { class: "label" }, "列标题:", -1),
|
|
2613
|
+
(g(!0), i(e, null, y(t.matrixCols, (e, n) => (g(), i("div", {
|
|
2614
|
+
key: n,
|
|
2615
|
+
class: "q-option-item"
|
|
2616
|
+
}, [s(m, {
|
|
2617
|
+
modelValue: t.matrixCols[n],
|
|
2618
|
+
"onUpdate:modelValue": (e) => t.matrixCols[n] = e,
|
|
2619
|
+
size: "small",
|
|
2620
|
+
placeholder: "列标题",
|
|
2621
|
+
style: { flex: "1" }
|
|
2622
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]), s(p, {
|
|
2623
|
+
size: "small",
|
|
2624
|
+
circle: "",
|
|
2625
|
+
type: "danger",
|
|
2626
|
+
onClick: (e) => t.matrixCols.splice(n, 1)
|
|
2627
|
+
}, {
|
|
2628
|
+
default: w(() => [s(u, null, {
|
|
2629
|
+
default: w(() => [s(Cn)]),
|
|
2630
|
+
_: 1
|
|
2631
|
+
})]),
|
|
2632
|
+
_: 1
|
|
2633
|
+
}, 8, ["onClick"])]))), 128)),
|
|
2634
|
+
s(p, {
|
|
2635
|
+
size: "small",
|
|
2636
|
+
onClick: (e) => t.matrixCols.push("")
|
|
2637
|
+
}, {
|
|
2638
|
+
default: w(() => [s(u, null, {
|
|
2639
|
+
default: w(() => [s(Tn)]),
|
|
2640
|
+
_: 1
|
|
2641
|
+
}), c[98] ||= o(" 添加列", -1)]),
|
|
2642
|
+
_: 1
|
|
2643
|
+
}, 8, ["onClick"])
|
|
2644
|
+
])]), t.matrixRows.length && t.matrixCols.length ? (g(), i("div", Mt, [a("table", Nt, [a("thead", null, [a("tr", null, [c[100] ||= a("th", null, null, -1), (g(!0), i(e, null, y(t.matrixCols, (e, t) => (g(), i("th", { key: t }, x(e || `列${t + 1}`), 1))), 128))])]), a("tbody", null, [(g(!0), i(e, null, y(t.matrixRows, (n, r) => (g(), i("tr", { key: r }, [a("td", null, x(n || `行${r + 1}`), 1), (g(!0), i(e, null, y(t.matrixCols, (e, t) => (g(), i("td", { key: t }, [s(wn, { disabled: "" })]))), 128))]))), 128))])])])) : r("", !0)])) : r("", !0),
|
|
2645
|
+
t.type === "image" ? (g(), i("div", Pt, [s(m, {
|
|
2646
|
+
modelValue: t.imageQuestionText,
|
|
2647
|
+
"onUpdate:modelValue": (e) => t.imageQuestionText = e,
|
|
2648
|
+
placeholder: "请输入图片相关说明文字",
|
|
2649
|
+
size: "small"
|
|
2650
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])])) : r("", !0),
|
|
2651
|
+
a("div", Ft, [
|
|
2652
|
+
a("div", It, [s(u, null, {
|
|
2653
|
+
default: w(() => [s(kn)]),
|
|
2654
|
+
_: 1
|
|
2655
|
+
}), c[101] ||= a("span", null, "跳转逻辑", -1)]),
|
|
2656
|
+
a("div", Lt, [c[102] ||= a("span", { class: "skip-label" }, "默认跳转:", -1), s(v, {
|
|
2657
|
+
modelValue: t.skipTo,
|
|
2658
|
+
"onUpdate:modelValue": (e) => t.skipTo = e,
|
|
2659
|
+
size: "small",
|
|
2660
|
+
clearable: "",
|
|
2661
|
+
placeholder: "下一题(默认)",
|
|
2662
|
+
style: { width: "200px" }
|
|
2663
|
+
}, {
|
|
2664
|
+
default: w(() => [
|
|
2665
|
+
s(_, {
|
|
2666
|
+
label: "下一题(默认)",
|
|
2667
|
+
value: ""
|
|
2668
|
+
}),
|
|
2669
|
+
(g(!0), i(e, null, y(N.value, (e, t) => (g(), n(_, {
|
|
2670
|
+
key: e.id,
|
|
2671
|
+
label: `${t + 1}. ${e.title || "未命名"}`,
|
|
2672
|
+
value: e.id
|
|
2673
|
+
}, null, 8, ["label", "value"]))), 128)),
|
|
2674
|
+
s(_, {
|
|
2675
|
+
label: "结束问卷",
|
|
2676
|
+
value: "__END__"
|
|
2677
|
+
})
|
|
2678
|
+
]),
|
|
2679
|
+
_: 1
|
|
2680
|
+
}, 8, ["modelValue", "onUpdate:modelValue"])]),
|
|
2681
|
+
[
|
|
2682
|
+
"radio",
|
|
2683
|
+
"checkbox",
|
|
2684
|
+
"select"
|
|
2685
|
+
].includes(t.type) ? (g(), i("div", Rt, [c[103] ||= a("div", { class: "skip-rules-title" }, "按选项跳转:", -1), (g(!0), i(e, null, y(t.options || [], (r, o) => (g(), i("div", {
|
|
2686
|
+
key: o,
|
|
2687
|
+
class: "skip-rule-row"
|
|
2688
|
+
}, [
|
|
2689
|
+
a("span", zt, x(r), 1),
|
|
2690
|
+
s(u, null, {
|
|
2691
|
+
default: w(() => [s(An)]),
|
|
2692
|
+
_: 1
|
|
2693
|
+
}),
|
|
2694
|
+
s(v, {
|
|
2695
|
+
modelValue: t.optionSkipTo[o],
|
|
2696
|
+
"onUpdate:modelValue": (e) => t.optionSkipTo[o] = e,
|
|
2697
|
+
size: "small",
|
|
2698
|
+
clearable: "",
|
|
2699
|
+
placeholder: "默认",
|
|
2700
|
+
style: { width: "180px" }
|
|
2701
|
+
}, {
|
|
2702
|
+
default: w(() => [
|
|
2703
|
+
s(_, {
|
|
2704
|
+
label: "默认(下一题)",
|
|
2705
|
+
value: ""
|
|
2706
|
+
}),
|
|
2707
|
+
(g(!0), i(e, null, y(N.value, (e, t) => (g(), n(_, {
|
|
2708
|
+
key: e.id,
|
|
2709
|
+
label: `${t + 1}. ${e.title || "未命名"}`,
|
|
2710
|
+
value: e.id
|
|
2711
|
+
}, null, 8, ["label", "value"]))), 128)),
|
|
2712
|
+
s(_, {
|
|
2713
|
+
label: "结束问卷",
|
|
2714
|
+
value: "__END__"
|
|
2715
|
+
})
|
|
2716
|
+
]),
|
|
2717
|
+
_: 1
|
|
2718
|
+
}, 8, ["modelValue", "onUpdate:modelValue"])
|
|
2719
|
+
]))), 128))])) : r("", !0)
|
|
2720
|
+
]),
|
|
2721
|
+
a("div", Bt, [
|
|
2722
|
+
a("div", Vt, [s(u, null, {
|
|
2723
|
+
default: w(() => [s(jn)]),
|
|
2724
|
+
_: 1
|
|
2725
|
+
}), c[104] ||= a("span", null, "计分设置", -1)]),
|
|
2726
|
+
a("div", Ht, [c[105] ||= a("span", { class: "score-label" }, "本题分值:", -1), s(Z, {
|
|
2727
|
+
modelValue: t.score,
|
|
2728
|
+
"onUpdate:modelValue": (e) => t.score = e,
|
|
2729
|
+
min: 0,
|
|
2730
|
+
max: 100,
|
|
2731
|
+
size: "small"
|
|
2732
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])]),
|
|
2733
|
+
[
|
|
2734
|
+
"radio",
|
|
2735
|
+
"checkbox",
|
|
2736
|
+
"select"
|
|
2737
|
+
].includes(t.type) ? (g(), i("div", Ut, [c[106] ||= a("div", { class: "score-options-title" }, "各选项分值(-1表示不计分):", -1), (g(!0), i(e, null, y(t.options || [], (e, n) => (g(), i("div", {
|
|
2738
|
+
key: n,
|
|
2739
|
+
class: "score-option-row"
|
|
2740
|
+
}, [a("span", Wt, x(e), 1), s(Z, {
|
|
2741
|
+
modelValue: t.optionScore[n],
|
|
2742
|
+
"onUpdate:modelValue": (e) => t.optionScore[n] = e,
|
|
2743
|
+
min: -1,
|
|
2744
|
+
max: 100,
|
|
2745
|
+
size: "small",
|
|
2746
|
+
style: { width: "120px" }
|
|
2747
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])]))), 128))])) : r("", !0),
|
|
2748
|
+
t.type === "rating" ? (g(), i("div", Gt, [c[107] ||= a("span", { class: "score-label" }, "评分即得分:", -1), s(Q, {
|
|
2749
|
+
modelValue: t.ratingAsScore,
|
|
2750
|
+
"onUpdate:modelValue": (e) => t.ratingAsScore = e,
|
|
2751
|
+
size: "small",
|
|
2752
|
+
"active-text": "是",
|
|
2753
|
+
"inactive-text": "否"
|
|
2754
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])])) : r("", !0),
|
|
2755
|
+
t.type === "scale" ? (g(), i("div", Kt, [c[108] ||= a("span", { class: "score-label" }, "量表即得分:", -1), s(Q, {
|
|
2756
|
+
modelValue: t.scaleAsScore,
|
|
2757
|
+
"onUpdate:modelValue": (e) => t.scaleAsScore = e,
|
|
2758
|
+
size: "small",
|
|
2759
|
+
"active-text": "是",
|
|
2760
|
+
"inactive-text": "否"
|
|
2761
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])])) : r("", !0)
|
|
2762
|
+
]),
|
|
2763
|
+
a("div", qt, [
|
|
2764
|
+
a("div", Jt, [
|
|
2765
|
+
s(u, null, {
|
|
2766
|
+
default: w(() => [s(Mn)]),
|
|
2767
|
+
_: 1
|
|
2768
|
+
}),
|
|
2769
|
+
c[109] ||= a("span", null, "评分说明", -1),
|
|
2770
|
+
c[110] ||= a("span", { class: "required-mark" }, "*", -1)
|
|
2771
|
+
]),
|
|
2772
|
+
a("div", Yt, [c[111] ||= a("label", { class: "scoring-guide-label" }, "参考答案", -1), s(m, {
|
|
2773
|
+
modelValue: t.referenceAnswer,
|
|
2774
|
+
"onUpdate:modelValue": (e) => t.referenceAnswer = e,
|
|
2775
|
+
type: "textarea",
|
|
2776
|
+
rows: 3,
|
|
2777
|
+
placeholder: "请输入本题的参考答案(必填)",
|
|
2778
|
+
class: d({ "is-error": !t.referenceAnswer })
|
|
2779
|
+
}, null, 8, [
|
|
2780
|
+
"modelValue",
|
|
2781
|
+
"onUpdate:modelValue",
|
|
2782
|
+
"class"
|
|
2783
|
+
])]),
|
|
2784
|
+
a("div", Xt, [c[112] ||= a("label", { class: "scoring-guide-label" }, "评分标准说明", -1), s(m, {
|
|
2785
|
+
modelValue: t.scoringCriteria,
|
|
2786
|
+
"onUpdate:modelValue": (e) => t.scoringCriteria = e,
|
|
2787
|
+
type: "textarea",
|
|
2788
|
+
rows: 3,
|
|
2789
|
+
placeholder: "请输入评分标准和扣分规则(必填)",
|
|
2790
|
+
class: d({ "is-error": !t.scoringCriteria })
|
|
2791
|
+
}, null, 8, [
|
|
2792
|
+
"modelValue",
|
|
2793
|
+
"onUpdate:modelValue",
|
|
2794
|
+
"class"
|
|
2795
|
+
])]),
|
|
2796
|
+
!t.referenceAnswer || !t.scoringCriteria ? (g(), i("div", Zt, "参考答案和评分标准说明均为必填项")) : r("", !0)
|
|
2797
|
+
])
|
|
2798
|
+
])
|
|
2799
|
+
], 42, ot))), 128))], 512),
|
|
2800
|
+
a("div", Qt, [a("div", $t, [
|
|
2801
|
+
s(p, {
|
|
2802
|
+
type: "primary",
|
|
2803
|
+
plain: "",
|
|
2804
|
+
onClick: c[27] ||= (e) => F.value = !F.value
|
|
2805
|
+
}, {
|
|
2806
|
+
default: w(() => [s(u, null, {
|
|
2807
|
+
default: w(() => [s(Tn)]),
|
|
2808
|
+
_: 1
|
|
2809
|
+
}), c[113] ||= o(" 添加题目 ", -1)]),
|
|
2810
|
+
_: 1
|
|
2811
|
+
}),
|
|
2812
|
+
F.value ? (g(), i("div", {
|
|
2813
|
+
key: 0,
|
|
2814
|
+
class: "q-add-overlay",
|
|
2815
|
+
onClick: c[28] ||= (e) => F.value = !1
|
|
2816
|
+
})) : r("", !0),
|
|
2817
|
+
F.value ? (g(), i("div", {
|
|
2818
|
+
key: 1,
|
|
2819
|
+
class: d(["q-add-menu", N.value.length === 0 ? "menu-right" : "menu-top"])
|
|
2820
|
+
}, [
|
|
2821
|
+
a("div", {
|
|
2822
|
+
class: "menu-item",
|
|
2823
|
+
onClick: c[29] ||= (e) => Nn("text")
|
|
2824
|
+
}, [s(u, null, {
|
|
2825
|
+
default: w(() => [s(Hn)]),
|
|
2826
|
+
_: 1
|
|
2827
|
+
}), c[114] ||= o(" 文本题", -1)]),
|
|
2828
|
+
a("div", {
|
|
2829
|
+
class: "menu-item",
|
|
2830
|
+
onClick: c[30] ||= (e) => Nn("radio")
|
|
2831
|
+
}, [s(u, null, {
|
|
2832
|
+
default: w(() => [s(Un)]),
|
|
2833
|
+
_: 1
|
|
2834
|
+
}), c[115] ||= o(" 单选题", -1)]),
|
|
2835
|
+
a("div", {
|
|
2836
|
+
class: "menu-item",
|
|
2837
|
+
onClick: c[31] ||= (e) => Nn("checkbox")
|
|
2838
|
+
}, [s(u, null, {
|
|
2839
|
+
default: w(() => [s(Jn)]),
|
|
2840
|
+
_: 1
|
|
2841
|
+
}), c[116] ||= o(" 多选题", -1)]),
|
|
2842
|
+
a("div", {
|
|
2843
|
+
class: "menu-item",
|
|
2844
|
+
onClick: c[32] ||= (e) => Nn("select")
|
|
2845
|
+
}, [s(u, null, {
|
|
2846
|
+
default: w(() => [s(te)]),
|
|
2847
|
+
_: 1
|
|
2848
|
+
}), c[117] ||= o(" 下拉题", -1)]),
|
|
2849
|
+
a("div", {
|
|
2850
|
+
class: "menu-item",
|
|
2851
|
+
onClick: c[33] ||= (e) => Nn("rating")
|
|
2852
|
+
}, [s(u, null, {
|
|
2853
|
+
default: w(() => [s($)]),
|
|
2854
|
+
_: 1
|
|
2855
|
+
}), c[118] ||= o(" 评分题", -1)]),
|
|
2856
|
+
a("div", {
|
|
2857
|
+
class: "menu-item",
|
|
2858
|
+
onClick: c[34] ||= (e) => Nn("scale")
|
|
2859
|
+
}, [s(u, null, {
|
|
2860
|
+
default: w(() => [s(Yn)]),
|
|
2861
|
+
_: 1
|
|
2862
|
+
}), c[119] ||= o(" 量表题", -1)]),
|
|
2863
|
+
a("div", {
|
|
2864
|
+
class: "menu-item",
|
|
2865
|
+
onClick: c[35] ||= (e) => Nn("matrix")
|
|
2866
|
+
}, [s(u, null, {
|
|
2867
|
+
default: w(() => [s(Qn)]),
|
|
2868
|
+
_: 1
|
|
2869
|
+
}), c[120] ||= o(" 矩阵题", -1)])
|
|
2870
|
+
], 2)) : r("", !0)
|
|
2871
|
+
])])
|
|
2872
|
+
], 512)])]),
|
|
2873
|
+
s(cr, {
|
|
2874
|
+
modelValue: ge.value,
|
|
2875
|
+
"onUpdate:modelValue": c[38] ||= (e) => ge.value = e,
|
|
2876
|
+
title: "AI生成题目",
|
|
2877
|
+
width: "600px",
|
|
2878
|
+
top: "10vh"
|
|
2879
|
+
}, {
|
|
2880
|
+
footer: w(() => [s(p, { onClick: c[37] ||= (e) => ge.value = !1 }, {
|
|
2881
|
+
default: w(() => [...c[126] ||= [o("取消", -1)]]),
|
|
2882
|
+
_: 1
|
|
2883
|
+
}), s(p, {
|
|
2884
|
+
type: "primary",
|
|
2885
|
+
onClick: sr,
|
|
2886
|
+
loading: _e.value
|
|
2887
|
+
}, {
|
|
2888
|
+
default: w(() => [s(u, null, {
|
|
2889
|
+
default: w(() => [s(H)]),
|
|
2890
|
+
_: 1
|
|
2891
|
+
}), c[127] ||= o(" 生成题目 ", -1)]),
|
|
2892
|
+
_: 1
|
|
2893
|
+
}, 8, ["loading"])]),
|
|
2894
|
+
default: w(() => [a("div", en, [
|
|
2895
|
+
a("div", tn, [a("label", null, [c[121] ||= o("当前题型:", -1), a("span", nn, x(Ce(xe.value)), 1)])]),
|
|
2896
|
+
a("div", rn, [c[122] ||= a("label", null, "请输入生成要求:", -1), s(m, {
|
|
2897
|
+
modelValue: ve.value,
|
|
2898
|
+
"onUpdate:modelValue": c[36] ||= (e) => ve.value = e,
|
|
2899
|
+
type: "textarea",
|
|
2900
|
+
rows: 4,
|
|
2901
|
+
placeholder: "例如:请生成一道关于JavaScript基础的单选题,考察变量声明的概念"
|
|
2902
|
+
}, null, 8, ["modelValue"])]),
|
|
2903
|
+
a("div", an, [c[125] ||= a("label", null, "上传参考附件(可选):", -1), s(Sn, {
|
|
2904
|
+
ref_key: "aiGenUploadRef",
|
|
2905
|
+
ref: Se,
|
|
2906
|
+
"auto-upload": !1,
|
|
2907
|
+
"on-change": or,
|
|
2908
|
+
"file-list": ye.value,
|
|
2909
|
+
accept: ".txt,.pdf,.doc,.docx,.md",
|
|
2910
|
+
limit: 5
|
|
2911
|
+
}, {
|
|
2912
|
+
tip: w(() => [...c[124] ||= [a("div", { class: "el-upload__tip" }, "支持 txt/pdf/doc/docx/md 格式,最多5个文件", -1)]]),
|
|
2913
|
+
default: w(() => [s(p, {
|
|
2914
|
+
size: "small",
|
|
2915
|
+
type: "primary"
|
|
2916
|
+
}, {
|
|
2917
|
+
default: w(() => [s(u, null, {
|
|
2918
|
+
default: w(() => [s(A)]),
|
|
2919
|
+
_: 1
|
|
2920
|
+
}), c[123] ||= o(" 选择文件 ", -1)]),
|
|
2921
|
+
_: 1
|
|
2922
|
+
})]),
|
|
2923
|
+
_: 1
|
|
2924
|
+
}, 8, ["file-list"])])
|
|
2925
|
+
])]),
|
|
2926
|
+
_: 1
|
|
2927
|
+
}, 8, ["modelValue"]),
|
|
2928
|
+
s(cr, {
|
|
2929
|
+
modelValue: ue.value,
|
|
2930
|
+
"onUpdate:modelValue": c[40] ||= (e) => ue.value = e,
|
|
2931
|
+
title: "AI智能分析",
|
|
2932
|
+
width: "800px",
|
|
2933
|
+
top: "5vh"
|
|
2934
|
+
}, {
|
|
2935
|
+
footer: w(() => [s(p, { onClick: c[39] ||= (e) => ue.value = !1 }, {
|
|
2936
|
+
default: w(() => [...c[132] ||= [o("关闭", -1)]]),
|
|
2937
|
+
_: 1
|
|
2938
|
+
}), s(p, {
|
|
2939
|
+
type: "primary",
|
|
2940
|
+
onClick: ur,
|
|
2941
|
+
loading: de.value
|
|
2942
|
+
}, {
|
|
2943
|
+
default: w(() => [s(u, null, {
|
|
2944
|
+
default: w(() => [s(H)]),
|
|
2945
|
+
_: 1
|
|
2946
|
+
}), c[133] ||= o(" 开始分析 ", -1)]),
|
|
2947
|
+
_: 1
|
|
2948
|
+
}, 8, ["loading"])]),
|
|
2949
|
+
default: w(() => [a("div", on, [de.value ? (g(), i("div", sn, [s(u, {
|
|
2950
|
+
class: "is-loading",
|
|
2951
|
+
size: 40
|
|
2952
|
+
}, {
|
|
2953
|
+
default: w(() => [s(dr)]),
|
|
2954
|
+
_: 1
|
|
2955
|
+
}), c[128] ||= a("p", null, "正在分析问卷数据...", -1)])) : fe.value ? (g(), i("div", cn, [a("div", ln, [c[130] ||= a("h3", null, "分析结果", -1), s(p, {
|
|
2956
|
+
size: "small",
|
|
2957
|
+
type: "primary",
|
|
2958
|
+
onClick: pr
|
|
2959
|
+
}, {
|
|
2960
|
+
default: w(() => [s(u, null, {
|
|
2961
|
+
default: w(() => [s(k)]),
|
|
2962
|
+
_: 1
|
|
2963
|
+
}), c[129] ||= o(" 下载HTML报告 ", -1)]),
|
|
2964
|
+
_: 1
|
|
2965
|
+
})]), a("div", {
|
|
2966
|
+
class: "ai-result-content",
|
|
2967
|
+
innerHTML: fe.value
|
|
2968
|
+
}, null, 8, un)])) : (g(), i("div", dn, [...c[131] ||= [a("p", null, "点击\"开始分析\"按钮,AI将对问卷数据进行智能分析", -1)]]))])]),
|
|
2969
|
+
_: 1
|
|
2970
|
+
}, 8, ["modelValue"]),
|
|
2971
|
+
s(cr, {
|
|
2972
|
+
modelValue: se.value,
|
|
2973
|
+
"onUpdate:modelValue": c[42] ||= (e) => se.value = e,
|
|
2974
|
+
title: "问卷分发",
|
|
2975
|
+
width: "680px",
|
|
2976
|
+
top: "5vh"
|
|
2977
|
+
}, {
|
|
2978
|
+
default: w(() => [a("div", fn, [
|
|
2979
|
+
c[138] ||= a("p", { class: "distribute-desc" }, "输入邮箱地址,系统将为每个邮箱生成唯一填写链接。支持手动输入或导入Excel。", -1),
|
|
2980
|
+
a("div", pn, [s(m, {
|
|
2981
|
+
modelValue: ce.value,
|
|
2982
|
+
"onUpdate:modelValue": c[41] ||= (e) => ce.value = e,
|
|
2983
|
+
type: "textarea",
|
|
2984
|
+
rows: 6,
|
|
2985
|
+
placeholder: "请输入邮箱地址,每行一个,支持逗号分隔\n例:\nuser1@example.com\nuser2@example.com"
|
|
2986
|
+
}, null, 8, ["modelValue"])]),
|
|
2987
|
+
a("div", mn, [s(Sn, {
|
|
2988
|
+
"show-file-list": !1,
|
|
2989
|
+
"before-upload": $n,
|
|
2990
|
+
accept: ".xlsx,.xls,.csv"
|
|
2991
|
+
}, {
|
|
2992
|
+
default: w(() => [s(p, { size: "small" }, {
|
|
2993
|
+
default: w(() => [s(u, null, {
|
|
2994
|
+
default: w(() => [s(A)]),
|
|
2995
|
+
_: 1
|
|
2996
|
+
}), c[134] ||= o(" 导入Excel/CSV", -1)]),
|
|
2997
|
+
_: 1
|
|
2998
|
+
})]),
|
|
2999
|
+
_: 1
|
|
3000
|
+
}), s(p, {
|
|
3001
|
+
size: "small",
|
|
3002
|
+
type: "primary",
|
|
3003
|
+
onClick: er
|
|
3004
|
+
}, {
|
|
3005
|
+
default: w(() => [s(u, null, {
|
|
3006
|
+
default: w(() => [s(Te)]),
|
|
3007
|
+
_: 1
|
|
3008
|
+
}), c[135] ||= o(" 生成链接 ", -1)]),
|
|
3009
|
+
_: 1
|
|
3010
|
+
})]),
|
|
3011
|
+
le.value.length > 0 ? (g(), i("div", hn, [a("div", gn, [a("span", null, "已生成 " + x(le.value.length) + " 条链接", 1), s(p, {
|
|
3012
|
+
size: "small",
|
|
3013
|
+
type: "success",
|
|
3014
|
+
onClick: nr
|
|
3015
|
+
}, {
|
|
3016
|
+
default: w(() => [s(u, null, {
|
|
3017
|
+
default: w(() => [s(k)]),
|
|
3018
|
+
_: 1
|
|
3019
|
+
}), c[136] ||= o(" 下载Excel ", -1)]),
|
|
3020
|
+
_: 1
|
|
3021
|
+
})]), s(yr, {
|
|
3022
|
+
data: le.value,
|
|
3023
|
+
size: "small",
|
|
3024
|
+
"max-height": "300",
|
|
3025
|
+
stripe: ""
|
|
3026
|
+
}, {
|
|
3027
|
+
default: w(() => [
|
|
3028
|
+
s(fr, {
|
|
3029
|
+
prop: "email",
|
|
3030
|
+
label: "邮箱",
|
|
3031
|
+
"min-width": "200"
|
|
3032
|
+
}),
|
|
3033
|
+
s(fr, {
|
|
3034
|
+
label: "填写链接",
|
|
3035
|
+
"min-width": "300"
|
|
3036
|
+
}, {
|
|
3037
|
+
default: w(({ row: e }) => [s(mr, {
|
|
3038
|
+
type: "primary",
|
|
3039
|
+
underline: !1,
|
|
3040
|
+
onClick: (t) => tr(e.url)
|
|
3041
|
+
}, {
|
|
3042
|
+
default: w(() => [o(x(e.url), 1)]),
|
|
3043
|
+
_: 2
|
|
3044
|
+
}, 1032, ["onClick"])]),
|
|
3045
|
+
_: 1
|
|
3046
|
+
}),
|
|
3047
|
+
s(fr, {
|
|
3048
|
+
label: "操作",
|
|
3049
|
+
width: "70",
|
|
3050
|
+
align: "center"
|
|
3051
|
+
}, {
|
|
3052
|
+
default: w(({ row: e }) => [s(p, {
|
|
3053
|
+
size: "small",
|
|
3054
|
+
type: "primary",
|
|
3055
|
+
link: "",
|
|
3056
|
+
onClick: (t) => tr(e.url)
|
|
3057
|
+
}, {
|
|
3058
|
+
default: w(() => [...c[137] ||= [o("复制", -1)]]),
|
|
3059
|
+
_: 1
|
|
3060
|
+
}, 8, ["onClick"])]),
|
|
3061
|
+
_: 1
|
|
3062
|
+
})
|
|
3063
|
+
]),
|
|
3064
|
+
_: 1
|
|
3065
|
+
}, 8, ["data"])])) : r("", !0)
|
|
3066
|
+
])]),
|
|
3067
|
+
_: 1
|
|
3068
|
+
}, 8, ["modelValue"]),
|
|
3069
|
+
s(Ee, {
|
|
3070
|
+
visible: pe.value,
|
|
3071
|
+
messages: S(z).messages.value,
|
|
3072
|
+
loading: S(z).loading.value,
|
|
3073
|
+
"is-collab": S(z).isCollabMode.value,
|
|
3074
|
+
"collab-users": S(z).collabUsers.value,
|
|
3075
|
+
"current-user": S(z).currentUser.value,
|
|
3076
|
+
"is-owner": !V.value,
|
|
3077
|
+
onSend: br,
|
|
3078
|
+
onClose: c[43] ||= (e) => pe.value = !1,
|
|
3079
|
+
"unread-mention": S(z).unreadMention.value,
|
|
3080
|
+
onClearUnread: c[44] ||= (e) => S(z).clearUnreadMention(),
|
|
3081
|
+
onClear: xr
|
|
3082
|
+
}, null, 8, [
|
|
3083
|
+
"visible",
|
|
3084
|
+
"messages",
|
|
3085
|
+
"loading",
|
|
3086
|
+
"is-collab",
|
|
3087
|
+
"collab-users",
|
|
3088
|
+
"current-user",
|
|
3089
|
+
"is-owner",
|
|
3090
|
+
"unread-mention"
|
|
3091
|
+
]),
|
|
3092
|
+
s(Ae, {
|
|
3093
|
+
modelValue: me.value,
|
|
3094
|
+
"onUpdate:modelValue": c[45] ||= (e) => me.value = e,
|
|
3095
|
+
"document-id": L.value,
|
|
3096
|
+
onApply: gr
|
|
3097
|
+
}, null, 8, ["modelValue", "document-id"])
|
|
3098
|
+
], 64);
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
3101
|
+
}, [["__scopeId", "data-v-edacd7c2"]]), Q = c({
|
|
3102
|
+
name: "YourCompanyQuestionnaire",
|
|
3103
|
+
props: {
|
|
3104
|
+
docId: {
|
|
3105
|
+
type: [Number, String],
|
|
3106
|
+
default: null
|
|
3107
|
+
},
|
|
3108
|
+
apiBase: {
|
|
3109
|
+
type: String,
|
|
3110
|
+
default: "/api"
|
|
3111
|
+
},
|
|
3112
|
+
wsUrl: {
|
|
3113
|
+
type: String,
|
|
3114
|
+
default: ""
|
|
3115
|
+
},
|
|
3116
|
+
user: {
|
|
3117
|
+
type: Object,
|
|
3118
|
+
default: () => ({
|
|
3119
|
+
id: "",
|
|
3120
|
+
name: "",
|
|
3121
|
+
color: ""
|
|
3122
|
+
})
|
|
3123
|
+
},
|
|
3124
|
+
roomId: {
|
|
3125
|
+
type: String,
|
|
3126
|
+
default: ""
|
|
3127
|
+
}
|
|
3128
|
+
},
|
|
3129
|
+
setup(e, { slots: t }) {
|
|
3130
|
+
return () => l("div", {
|
|
3131
|
+
class: "yourcompany-questionnaire-wrapper",
|
|
3132
|
+
style: "position:relative"
|
|
3133
|
+
}, [l(Z, { ...e }), l(D)]);
|
|
3134
|
+
}
|
|
3135
|
+
});
|
|
3136
|
+
//#endregion
|
|
3137
|
+
export { Q as default };
|