@bytenew/bn-bus-ui 1.1.464 → 1.1.465
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/dist/{assocTableSearch-Bfe96864.js → assocTableSearch-BsLq8li6.js} +1 -1
- package/dist/bn-bus-ui.es.js +1 -1
- package/dist/bn-bus-ui.umd.js +13 -45
- package/dist/{chooseIPaasData-COrrvQKZ.js → chooseIPaasData-DUfjjEr2.js} +1 -1
- package/dist/{defaultSet-CzN1ec_d.js → defaultSet-CR0AVrl6.js} +1 -1
- package/dist/{formItemFooter-BvptZj_u.js → formItemFooter-CN8bMSJS.js} +1 -1
- package/dist/{funcExprDialog-BguNs9fl.js → funcExprDialog-OOejhToM.js} +1 -1
- package/dist/{index-C5LQ0OSs.js → index-B-VEGqoB.js} +2 -2
- package/dist/{index-BdklTJtF.js → index-BDLkgkeO.js} +2 -2
- package/dist/{index-hsSIY2FP.js → index-BK-KXSCO.js} +3 -3
- package/dist/{index-DCv51EXX.js → index-BwDhrvPs.js} +1 -1
- package/dist/{index-DUSI6MuC.js → index-CKX6Ga7g.js} +3 -3
- package/dist/{index-wUl5aPUD.js → index-CYrbjge7.js} +2 -2
- package/dist/{index-COuPCIzB.js → index-CpTMfPTm.js} +2 -2
- package/dist/{index-Dd4b8zNb.js → index-D94SlRAW.js} +2 -2
- package/dist/{index-Md-ZlkCW.js → index-DGQrmPZ8.js} +2 -2
- package/dist/{index-BxWx5kpG.js → index-D_Gjzn2Y.js} +3 -3
- package/dist/{index-n13-H3_Y.js → index-DbTkT_Pc.js} +1 -1
- package/dist/{index-DVzxs2vR.js → index-Dp6qwgSk.js} +2 -2
- package/dist/{index-69fRP0M8.js → index-GqIlg6mb.js} +1 -1
- package/dist/{index-0oB7QocU.js → index-MYgF6eap.js} +2 -2
- package/dist/{index-CSvVyjxx.js → index-btmDCgbT.js} +2 -2
- package/dist/{index-C8YhrrUN.js → index-die9_Xdx.js} +2 -2
- package/dist/{index-Bu3jHlby.js → index-x2GgSFZY.js} +2 -2
- package/dist/install-D9fhAvpu.js +16424 -0
- package/dist/install.css +1 -1
- package/dist/{setOption-CXOifQcx.js → setOption-aixerIsi.js} +1 -1
- package/dist/setRelationOption-AZZQd-2m.js +775 -0
- package/package.json +4 -3
- package/dist/install-CNjs0u5x.js +0 -23299
- package/dist/setRelationOption-C7VDhej7.js +0 -5217
|
@@ -0,0 +1,775 @@
|
|
|
1
|
+
import { cloneDeep as I } from "lodash";
|
|
2
|
+
import O from "vuedraggable";
|
|
3
|
+
import { resolveComponent as f, openBlock as c, createElementBlock as w, createTextVNode as h, createVNode as p, withCtx as m, createCommentVNode as b, createBlock as L, createElementVNode as d, normalizeClass as V, withModifiers as D, Fragment as A, renderList as B } from "vue";
|
|
4
|
+
import { _ as k } from "./install-D9fhAvpu.js";
|
|
5
|
+
const U = {
|
|
6
|
+
name: "ConditionList",
|
|
7
|
+
components: {
|
|
8
|
+
draggable: O
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
// 选项列表数据
|
|
12
|
+
options: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => []
|
|
15
|
+
},
|
|
16
|
+
// 当前选中的选项
|
|
17
|
+
selectedOption: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
// 当前级别(0表示第一级)
|
|
22
|
+
level: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: !0
|
|
25
|
+
},
|
|
26
|
+
// 是否为第一级
|
|
27
|
+
isFirstLevel: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !1
|
|
30
|
+
},
|
|
31
|
+
// 父级是否已选中(仅非第一级需要)
|
|
32
|
+
hasParentSelected: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !0
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["select", "add", "delete", "update:options"],
|
|
38
|
+
computed: {
|
|
39
|
+
// 本地选项列表(用于v-model)
|
|
40
|
+
localOptions: {
|
|
41
|
+
get() {
|
|
42
|
+
return this.options || [];
|
|
43
|
+
},
|
|
44
|
+
set(t) {
|
|
45
|
+
this.$emit("update:options", t);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
// 是否显示提示信息(仅非第一级且未选中父级时显示)
|
|
49
|
+
showTip() {
|
|
50
|
+
return !this.isFirstLevel && !this.hasParentSelected;
|
|
51
|
+
},
|
|
52
|
+
// 是否显示空状态(有父级选中或是第一级,且列表为空时显示)
|
|
53
|
+
showEmpty() {
|
|
54
|
+
return (this.isFirstLevel || this.hasParentSelected) && this.localOptions.length === 0;
|
|
55
|
+
},
|
|
56
|
+
// 是否显示列表
|
|
57
|
+
showList() {
|
|
58
|
+
return this.localOptions.length > 0;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
/**
|
|
63
|
+
* 判断是否为当前选中项
|
|
64
|
+
*/
|
|
65
|
+
isActive(t) {
|
|
66
|
+
var e;
|
|
67
|
+
return ((e = this.selectedOption) == null ? void 0 : e.id) === t.id;
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* 处理添加操作
|
|
71
|
+
*/
|
|
72
|
+
handleAdd(t) {
|
|
73
|
+
this.$emit("add", t !== void 0 ? t : -1);
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* 处理拖拽结束
|
|
77
|
+
*/
|
|
78
|
+
handleDragEnd() {
|
|
79
|
+
this.localOptions.forEach((t, e) => {
|
|
80
|
+
t.sequence = e;
|
|
81
|
+
}), this.$emit("update:options", this.localOptions);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, S = { class: "condition-list" }, x = {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: "condition-list__empty"
|
|
87
|
+
}, E = {
|
|
88
|
+
key: 1,
|
|
89
|
+
class: "condition-list__tip"
|
|
90
|
+
}, W = ["onClick"], N = { class: "condition-item__input" }, $ = { class: "condition-item__actions" }, F = ["onClick"], q = ["onClick"];
|
|
91
|
+
function R(t, e, o, l, i, n) {
|
|
92
|
+
const s = f("el-button"), u = f("el-input"), v = f("el-switch"), r = f("draggable");
|
|
93
|
+
return c(), w("div", S, [
|
|
94
|
+
n.showEmpty ? (c(), w("div", x, [
|
|
95
|
+
e[4] || (e[4] = h(" 没有设置条件, ", -1)),
|
|
96
|
+
p(s, {
|
|
97
|
+
type: "text",
|
|
98
|
+
onClick: e[0] || (e[0] = (g) => n.handleAdd())
|
|
99
|
+
}, {
|
|
100
|
+
default: m(() => [...e[3] || (e[3] = [
|
|
101
|
+
h("新增条件", -1)
|
|
102
|
+
])]),
|
|
103
|
+
_: 1
|
|
104
|
+
})
|
|
105
|
+
])) : b("", !0),
|
|
106
|
+
n.showTip ? (c(), w("div", E, " 选中父级菜单,才能设置子级选项 ")) : b("", !0),
|
|
107
|
+
n.showList ? (c(), L(r, {
|
|
108
|
+
key: 2,
|
|
109
|
+
modelValue: n.localOptions,
|
|
110
|
+
"onUpdate:modelValue": e[2] || (e[2] = (g) => n.localOptions = g),
|
|
111
|
+
"item-key": "id",
|
|
112
|
+
handle: ".drag-handle",
|
|
113
|
+
"ghost-class": "ghost-item",
|
|
114
|
+
"chosen-class": "chosen-item",
|
|
115
|
+
animation: "300",
|
|
116
|
+
onEnd: n.handleDragEnd
|
|
117
|
+
}, {
|
|
118
|
+
item: m(({ element: g, index: y }) => [
|
|
119
|
+
d("div", {
|
|
120
|
+
class: V(["condition-item", { "condition-item--active": n.isActive(g) }]),
|
|
121
|
+
onClick: (a) => t.$emit("select", g)
|
|
122
|
+
}, [
|
|
123
|
+
e[5] || (e[5] = d("div", { class: "condition-item__drag drag-handle" }, [
|
|
124
|
+
d("span", { class: "bnUIcon bnUIcon-move" })
|
|
125
|
+
], -1)),
|
|
126
|
+
d("div", N, [
|
|
127
|
+
p(u, {
|
|
128
|
+
modelValue: g.title,
|
|
129
|
+
"onUpdate:modelValue": (a) => g.title = a,
|
|
130
|
+
placeholder: "设置名称"
|
|
131
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
132
|
+
]),
|
|
133
|
+
d("div", $, [
|
|
134
|
+
d("span", {
|
|
135
|
+
class: "condition-item__action-icon bnUIcon bnUIcon-add",
|
|
136
|
+
onClick: D((a) => n.handleAdd(y), ["stop"]),
|
|
137
|
+
title: "添加"
|
|
138
|
+
}, null, 8, F),
|
|
139
|
+
p(v, {
|
|
140
|
+
modelValue: g.columnStatus,
|
|
141
|
+
"onUpdate:modelValue": (a) => g.columnStatus = a,
|
|
142
|
+
"active-value": "1",
|
|
143
|
+
"inactive-value": "0",
|
|
144
|
+
onClick: e[1] || (e[1] = D(() => {
|
|
145
|
+
}, ["stop"]))
|
|
146
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
147
|
+
d("span", {
|
|
148
|
+
class: "condition-item__action-icon bnUIcon bnUIcon-delete",
|
|
149
|
+
onClick: D((a) => t.$emit("delete", y), ["stop"]),
|
|
150
|
+
title: "删除"
|
|
151
|
+
}, null, 8, q)
|
|
152
|
+
])
|
|
153
|
+
], 10, W)
|
|
154
|
+
]),
|
|
155
|
+
_: 1
|
|
156
|
+
}, 8, ["modelValue", "onEnd"])) : b("", !0)
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
const T = /* @__PURE__ */ k(U, [["render", R], ["__scopeId", "data-v-f37bbb16"]]), j = {
|
|
160
|
+
name: "LevelHeader",
|
|
161
|
+
props: {
|
|
162
|
+
// 标题
|
|
163
|
+
title: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: ""
|
|
166
|
+
},
|
|
167
|
+
// 当前级别
|
|
168
|
+
level: {
|
|
169
|
+
type: Number,
|
|
170
|
+
required: !0
|
|
171
|
+
},
|
|
172
|
+
// 是否可以添加下一级
|
|
173
|
+
canAddNext: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: !1
|
|
176
|
+
},
|
|
177
|
+
// 是否可以删除
|
|
178
|
+
canDelete: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: !1
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
emits: ["update:title", "add-level", "delete-level"],
|
|
184
|
+
data() {
|
|
185
|
+
return {
|
|
186
|
+
showDeleteConfirm: !1
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
|
+
computed: {
|
|
190
|
+
localTitle: {
|
|
191
|
+
get() {
|
|
192
|
+
return this.title;
|
|
193
|
+
},
|
|
194
|
+
set(t) {
|
|
195
|
+
this.$emit("update:title", t);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
methods: {
|
|
200
|
+
handleDelete() {
|
|
201
|
+
this.$emit("delete-level"), this.showDeleteConfirm = !1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, P = { class: "level-header" }, M = { class: "level-header__input" }, z = { class: "level-header__actions" };
|
|
205
|
+
function H(t, e, o, l, i, n) {
|
|
206
|
+
const s = f("el-input"), u = f("el-button"), v = f("el-popover");
|
|
207
|
+
return c(), w("div", P, [
|
|
208
|
+
d("div", M, [
|
|
209
|
+
p(s, {
|
|
210
|
+
modelValue: n.localTitle,
|
|
211
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => n.localTitle = r),
|
|
212
|
+
placeholder: "输入标题"
|
|
213
|
+
}, null, 8, ["modelValue"])
|
|
214
|
+
]),
|
|
215
|
+
d("div", z, [
|
|
216
|
+
o.canAddNext ? (c(), L(u, {
|
|
217
|
+
key: 0,
|
|
218
|
+
type: "text",
|
|
219
|
+
size: "small",
|
|
220
|
+
onClick: e[1] || (e[1] = (r) => t.$emit("add-level"))
|
|
221
|
+
}, {
|
|
222
|
+
default: m(() => [...e[4] || (e[4] = [
|
|
223
|
+
h(" 增加下一级 ", -1)
|
|
224
|
+
])]),
|
|
225
|
+
_: 1
|
|
226
|
+
})) : b("", !0),
|
|
227
|
+
o.canDelete ? (c(), L(v, {
|
|
228
|
+
key: 1,
|
|
229
|
+
modelValue: i.showDeleteConfirm,
|
|
230
|
+
"onUpdate:modelValue": e[3] || (e[3] = (r) => i.showDeleteConfirm = r),
|
|
231
|
+
content: "删除联动标题将同时删除该标题层级下的所有选项,谨慎操作",
|
|
232
|
+
placement: "top",
|
|
233
|
+
width: "220",
|
|
234
|
+
transition: ""
|
|
235
|
+
}, {
|
|
236
|
+
reference: m(() => [
|
|
237
|
+
d("span", {
|
|
238
|
+
class: "bnUIcon bnUIcon-delete level-header__delete-icon",
|
|
239
|
+
onClick: e[2] || (e[2] = (...r) => n.handleDelete && n.handleDelete(...r))
|
|
240
|
+
})
|
|
241
|
+
]),
|
|
242
|
+
_: 1
|
|
243
|
+
}, 8, ["modelValue"])) : b("", !0)
|
|
244
|
+
])
|
|
245
|
+
]);
|
|
246
|
+
}
|
|
247
|
+
const G = /* @__PURE__ */ k(j, [["render", H], ["__scopeId", "data-v-5664ea69"]]), J = {
|
|
248
|
+
name: "SetRelationOption",
|
|
249
|
+
components: {
|
|
250
|
+
ConditionList: T,
|
|
251
|
+
LevelHeader: G
|
|
252
|
+
},
|
|
253
|
+
props: {
|
|
254
|
+
// API请求函数
|
|
255
|
+
postFunc: {
|
|
256
|
+
type: Function,
|
|
257
|
+
required: !0
|
|
258
|
+
},
|
|
259
|
+
// 额外的请求参数
|
|
260
|
+
extendPost: {
|
|
261
|
+
type: Object,
|
|
262
|
+
required: !0
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
data() {
|
|
266
|
+
return {
|
|
267
|
+
show: !1,
|
|
268
|
+
showBatch: !1,
|
|
269
|
+
fullscreen: !1,
|
|
270
|
+
columnInfo: {},
|
|
271
|
+
maxLevel: 5,
|
|
272
|
+
// 最多5级联动
|
|
273
|
+
loading: !1,
|
|
274
|
+
// 加载状态
|
|
275
|
+
selectedConditions: [],
|
|
276
|
+
// 各级选中的条件
|
|
277
|
+
batchAddContent: "",
|
|
278
|
+
// 批量添加内容
|
|
279
|
+
batchIds: [],
|
|
280
|
+
// 批量添加的ID列表
|
|
281
|
+
batchIdIndex: 0
|
|
282
|
+
// 批量添加ID的索引
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
computed: {
|
|
286
|
+
// 模块定义
|
|
287
|
+
moduleDefinition() {
|
|
288
|
+
return this.columnInfo.moduleDefinition || {};
|
|
289
|
+
},
|
|
290
|
+
// 是否有级别
|
|
291
|
+
hasLevels() {
|
|
292
|
+
var t;
|
|
293
|
+
return ((t = this.moduleDefinition.header) == null ? void 0 : t.length) > 0;
|
|
294
|
+
},
|
|
295
|
+
// 选项列表
|
|
296
|
+
optionList() {
|
|
297
|
+
return this.moduleDefinition.optionList || [];
|
|
298
|
+
},
|
|
299
|
+
/**
|
|
300
|
+
* 计算对话框宽度
|
|
301
|
+
* 根据级别数量动态调整:基础宽度 + (级别数 × (列宽 + 间距))
|
|
302
|
+
*/
|
|
303
|
+
dialogWidth() {
|
|
304
|
+
var r;
|
|
305
|
+
const t = ((r = this.moduleDefinition.header) == null ? void 0 : r.length) || 0;
|
|
306
|
+
if (t <= 3)
|
|
307
|
+
return "860px";
|
|
308
|
+
const e = 40, o = 240, l = 12, i = o + l, n = e + t * i - l;
|
|
309
|
+
return `${Math.min(Math.max(n, 600), 1400)}px`;
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
methods: {
|
|
313
|
+
/**
|
|
314
|
+
* 打开对话框
|
|
315
|
+
*/
|
|
316
|
+
open(t) {
|
|
317
|
+
this.columnInfo = I(t), this.show = !0, this.fullscreen = !1, this.selectedConditions = [], this.optionList.length > 0 && this.selectCondition(this.optionList[0], 0);
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* 判断是否可以添加下一级
|
|
321
|
+
*/
|
|
322
|
+
canAddNextLevel(t) {
|
|
323
|
+
return t.level < this.maxLevel && t.level === this.moduleDefinition.header.length;
|
|
324
|
+
},
|
|
325
|
+
/**
|
|
326
|
+
* 判断是否为最后一级
|
|
327
|
+
*/
|
|
328
|
+
isLastLevel(t) {
|
|
329
|
+
return t.level === this.moduleDefinition.header.length;
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* 获取指定级别的选项列表
|
|
333
|
+
*/
|
|
334
|
+
getOptions(t) {
|
|
335
|
+
var e;
|
|
336
|
+
return t === 0 ? this.optionList : ((e = this.selectedConditions[t - 1]) == null ? void 0 : e.children) || [];
|
|
337
|
+
},
|
|
338
|
+
/**
|
|
339
|
+
* 更新选项列表
|
|
340
|
+
*/
|
|
341
|
+
updateOptions(t, e) {
|
|
342
|
+
t === 0 ? this.moduleDefinition.optionList = e : this.selectedConditions[t - 1] && (this.selectedConditions[t - 1].children = e);
|
|
343
|
+
},
|
|
344
|
+
/**
|
|
345
|
+
* 选中条件
|
|
346
|
+
*/
|
|
347
|
+
selectCondition(t, e) {
|
|
348
|
+
this.selectedConditions.splice(e, this.maxLevel, t), this.autoSelectChildren(t, e);
|
|
349
|
+
},
|
|
350
|
+
/**
|
|
351
|
+
* 自动选中子级的第一个选项
|
|
352
|
+
*/
|
|
353
|
+
autoSelectChildren(t, e) {
|
|
354
|
+
var o;
|
|
355
|
+
((o = t == null ? void 0 : t.children) == null ? void 0 : o.length) > 0 && (this.selectedConditions.splice(e + 1, 1, t.children[0]), this.autoSelectChildren(t.children[0], e + 1));
|
|
356
|
+
},
|
|
357
|
+
/**
|
|
358
|
+
* 添加级别
|
|
359
|
+
*/
|
|
360
|
+
async addLevel(t) {
|
|
361
|
+
if (!this.loading) {
|
|
362
|
+
this.loading = !0;
|
|
363
|
+
try {
|
|
364
|
+
const e = await this.fetchIds(1);
|
|
365
|
+
if (!(e != null && e.length)) return;
|
|
366
|
+
this.moduleDefinition.header.push({
|
|
367
|
+
id: e[0],
|
|
368
|
+
code: e[0] + "",
|
|
369
|
+
title: `${t + 1}级选项`,
|
|
370
|
+
level: t + 1,
|
|
371
|
+
parentId: -1,
|
|
372
|
+
parentCode: "-1",
|
|
373
|
+
sequence: 0,
|
|
374
|
+
color: "#666666",
|
|
375
|
+
columnStatus: "1"
|
|
376
|
+
});
|
|
377
|
+
} finally {
|
|
378
|
+
this.loading = !1;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
/**
|
|
383
|
+
* 删除级别
|
|
384
|
+
*/
|
|
385
|
+
async deleteLevel(t) {
|
|
386
|
+
const e = this.collectLevelIds(t);
|
|
387
|
+
if (!this.columnInfo.id) {
|
|
388
|
+
this.removeLevelData(t);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
try {
|
|
392
|
+
await this.checkCanDelete(e) ? this.removeLevelData(t) : this.$message.warning("有选项已关联工单数据,无法删除");
|
|
393
|
+
} catch (o) {
|
|
394
|
+
console.error("删除级别失败:", o);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* 移除级别数据
|
|
399
|
+
*/
|
|
400
|
+
removeLevelData(t) {
|
|
401
|
+
this.moduleDefinition.header.splice(t, 1), t === 0 ? this.moduleDefinition.optionList = [] : this.removeChildrenAtLevel(this.optionList, 1, t), this.selectedConditions = [];
|
|
402
|
+
},
|
|
403
|
+
/**
|
|
404
|
+
* 收集指定级别的所有选项ID
|
|
405
|
+
*/
|
|
406
|
+
collectLevelIds(t) {
|
|
407
|
+
const e = [];
|
|
408
|
+
if (t === 0)
|
|
409
|
+
this.optionList.forEach((o) => e.push(o.id));
|
|
410
|
+
else {
|
|
411
|
+
const o = (l, i) => {
|
|
412
|
+
l.forEach((n) => {
|
|
413
|
+
i === t && n.children ? n.children.forEach((s) => e.push(s.id)) : n.children && o(n.children, i + 1);
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
o(this.optionList, 1);
|
|
417
|
+
}
|
|
418
|
+
return e;
|
|
419
|
+
},
|
|
420
|
+
/**
|
|
421
|
+
* 递归移除指定级别的子选项
|
|
422
|
+
*/
|
|
423
|
+
removeChildrenAtLevel(t, e, o) {
|
|
424
|
+
t.forEach((l) => {
|
|
425
|
+
e === o ? l.children = [] : l.children && this.removeChildrenAtLevel(l.children, e + 1, o);
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* 添加条件
|
|
430
|
+
*/
|
|
431
|
+
async addCondition(t, e) {
|
|
432
|
+
var o;
|
|
433
|
+
if (!this.loading) {
|
|
434
|
+
this.loading = !0;
|
|
435
|
+
try {
|
|
436
|
+
const l = await this.fetchIds(1);
|
|
437
|
+
if (!(l != null && l.length)) return;
|
|
438
|
+
const i = t === 0, n = i ? this.optionList : (o = this.selectedConditions[t - 1]) == null ? void 0 : o.children;
|
|
439
|
+
if (!n) return;
|
|
440
|
+
const s = {
|
|
441
|
+
id: l[0],
|
|
442
|
+
code: l[0] + "",
|
|
443
|
+
title: `选项${n.length + 1}`,
|
|
444
|
+
level: t + 1,
|
|
445
|
+
parentId: i ? 0 : this.selectedConditions[t - 1].id,
|
|
446
|
+
parentCode: (i ? 0 : this.selectedConditions[t - 1].id) + "",
|
|
447
|
+
sequence: e + 1,
|
|
448
|
+
color: "#666666",
|
|
449
|
+
columnStatus: "1",
|
|
450
|
+
children: []
|
|
451
|
+
};
|
|
452
|
+
n.splice(e + 1, 0, s);
|
|
453
|
+
} finally {
|
|
454
|
+
this.loading = !1;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
/**
|
|
459
|
+
* 删除条件
|
|
460
|
+
*/
|
|
461
|
+
async deleteCondition(t, e) {
|
|
462
|
+
const o = this.getOptions(t), l = o[e];
|
|
463
|
+
if (!this.columnInfo.id) {
|
|
464
|
+
o.splice(e, 1);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
console.log(l);
|
|
468
|
+
try {
|
|
469
|
+
await this.checkCanDelete([l.id]) ? o.splice(e, 1) : this.$message.warning("该选项已关联工单数据,无法删除");
|
|
470
|
+
} catch (i) {
|
|
471
|
+
console.error("删除条件失败:", i);
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
/**
|
|
475
|
+
* 批量添加
|
|
476
|
+
*/
|
|
477
|
+
async handleBatchAdd() {
|
|
478
|
+
if (!(this.loading || !this.batchAddContent)) {
|
|
479
|
+
this.loading = !0;
|
|
480
|
+
try {
|
|
481
|
+
const t = this.parseBatchContent(this.batchAddContent);
|
|
482
|
+
if (!t.conditions.length) {
|
|
483
|
+
this.$message.warning("没有有效的选项数据");
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const e = await this.fetchIds(t.totalCount);
|
|
487
|
+
if (!e) return;
|
|
488
|
+
this.batchIds = e, this.batchIdIndex = 0, this.addLevelsIfNeeded(t.maxLevel), t.conditions.forEach((o) => {
|
|
489
|
+
this.insertBatchCondition(o, this.optionList);
|
|
490
|
+
}), this.$message.success("批量添加成功");
|
|
491
|
+
} finally {
|
|
492
|
+
this.loading = !1;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
/**
|
|
497
|
+
* 解析批量添加的内容
|
|
498
|
+
*/
|
|
499
|
+
parseBatchContent(t) {
|
|
500
|
+
const e = t.split(`
|
|
501
|
+
`).map((u) => u.trim()).filter((u) => u).slice(0, 2e3), o = [];
|
|
502
|
+
let l = 0, i = 0;
|
|
503
|
+
e.forEach((u) => {
|
|
504
|
+
const v = u.split("+").map((r) => r.trim()).filter((r) => r).slice(0, this.maxLevel);
|
|
505
|
+
v.length > 0 && (o.push(v), l = Math.max(l, v.length), i += v.length);
|
|
506
|
+
});
|
|
507
|
+
const n = this.moduleDefinition.header.length, s = Math.max(0, l - n);
|
|
508
|
+
return {
|
|
509
|
+
conditions: o,
|
|
510
|
+
maxLevel: l,
|
|
511
|
+
totalCount: i + s
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
/**
|
|
515
|
+
* 添加需要的级别
|
|
516
|
+
*/
|
|
517
|
+
addLevelsIfNeeded(t) {
|
|
518
|
+
const e = this.moduleDefinition.header.length;
|
|
519
|
+
for (let o = e; o < t; o++)
|
|
520
|
+
this.moduleDefinition.header.push({
|
|
521
|
+
id: this.batchIds[this.batchIdIndex++],
|
|
522
|
+
title: `选项${o + 1}级标题`,
|
|
523
|
+
level: o + 1,
|
|
524
|
+
parentId: -1,
|
|
525
|
+
sequence: 0,
|
|
526
|
+
color: "#666666",
|
|
527
|
+
columnStatus: "1"
|
|
528
|
+
});
|
|
529
|
+
},
|
|
530
|
+
/**
|
|
531
|
+
* 递归插入批量条件
|
|
532
|
+
*/
|
|
533
|
+
insertBatchCondition(t, e, o = 0, l = 0) {
|
|
534
|
+
if (t.length === 0) return e;
|
|
535
|
+
const i = t[0], n = e.findIndex((s) => s.title === i);
|
|
536
|
+
if (n > -1)
|
|
537
|
+
this.insertBatchCondition(
|
|
538
|
+
t.slice(1),
|
|
539
|
+
e[n].children,
|
|
540
|
+
o + 1,
|
|
541
|
+
e[n].id
|
|
542
|
+
);
|
|
543
|
+
else {
|
|
544
|
+
const s = this.createBatchOption(t, o, l, e.length);
|
|
545
|
+
s && e.push(s);
|
|
546
|
+
}
|
|
547
|
+
return e;
|
|
548
|
+
},
|
|
549
|
+
/**
|
|
550
|
+
* 创建批量选项(含子级)
|
|
551
|
+
*/
|
|
552
|
+
createBatchOption(t, e, o, l) {
|
|
553
|
+
if (t.length === 0 || this.batchIdIndex >= this.batchIds.length)
|
|
554
|
+
return null;
|
|
555
|
+
const i = this.batchIds[this.batchIdIndex++], n = {
|
|
556
|
+
id: i,
|
|
557
|
+
code: i + "",
|
|
558
|
+
parentId: o,
|
|
559
|
+
parentCode: o + "",
|
|
560
|
+
title: t[0],
|
|
561
|
+
level: e + 1,
|
|
562
|
+
color: "#666666",
|
|
563
|
+
columnStatus: "1",
|
|
564
|
+
sequence: l,
|
|
565
|
+
children: []
|
|
566
|
+
};
|
|
567
|
+
if (t.length > 1) {
|
|
568
|
+
const s = this.createBatchOption(t.slice(1), e + 1, n.id, 0);
|
|
569
|
+
s && n.children.push(s);
|
|
570
|
+
}
|
|
571
|
+
return n;
|
|
572
|
+
},
|
|
573
|
+
/**
|
|
574
|
+
* 获取新ID
|
|
575
|
+
*/
|
|
576
|
+
async fetchIds(t) {
|
|
577
|
+
try {
|
|
578
|
+
const e = await this.postFunc(
|
|
579
|
+
`/v2/projects/customId/${t}/${this.extendPost.appId}`,
|
|
580
|
+
null,
|
|
581
|
+
"get"
|
|
582
|
+
);
|
|
583
|
+
return e.code === 0 && e.data ? e.data : (this.$message.error("获取ID失败"), null);
|
|
584
|
+
} catch (e) {
|
|
585
|
+
return console.error("获取ID失败:", e), this.$message.error("获取ID失败"), null;
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
/**
|
|
589
|
+
* 检查是否可以删除
|
|
590
|
+
*/
|
|
591
|
+
async checkCanDelete(t) {
|
|
592
|
+
try {
|
|
593
|
+
const e = await this.postFunc("/v2/project/column/canDelRelationOption", {
|
|
594
|
+
projectId: this.extendPost.tableId,
|
|
595
|
+
columnId: this.columnInfo.id,
|
|
596
|
+
optionId: t.join(",")
|
|
597
|
+
});
|
|
598
|
+
return e.code === 0 && e.data;
|
|
599
|
+
} catch (e) {
|
|
600
|
+
return console.error("检查删除权限失败:", e), !1;
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
/**
|
|
604
|
+
* 确认保存
|
|
605
|
+
*/
|
|
606
|
+
handleConfirm() {
|
|
607
|
+
this.$emit("confirm", this.columnInfo), this.show = !1;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}, K = {
|
|
611
|
+
key: 0,
|
|
612
|
+
class: "setRelationOpt"
|
|
613
|
+
}, Q = {
|
|
614
|
+
key: 0,
|
|
615
|
+
class: "setRelationOpt-header"
|
|
616
|
+
}, X = {
|
|
617
|
+
key: 1,
|
|
618
|
+
class: "w-flex-between"
|
|
619
|
+
}, Y = { style: { width: "calc(100% - 330px)" } }, Z = { class: "setRelationOpt-tip" }, ee = { class: "setRelationOpt-levels" }, te = {
|
|
620
|
+
key: 2,
|
|
621
|
+
class: "w-empty"
|
|
622
|
+
}, ne = { class: "w-flex-right" };
|
|
623
|
+
function oe(t, e, o, l, i, n) {
|
|
624
|
+
const s = f("el-button"), u = f("el-input"), v = f("level-header"), r = f("condition-list"), g = f("el-dialog");
|
|
625
|
+
return c(), L(g, {
|
|
626
|
+
modelValue: i.show,
|
|
627
|
+
"onUpdate:modelValue": e[5] || (e[5] = (y) => i.show = y),
|
|
628
|
+
title: "联动组件选项配置",
|
|
629
|
+
top: "5vh",
|
|
630
|
+
width: n.dialogWidth,
|
|
631
|
+
"close-on-click-modal": !1,
|
|
632
|
+
"destroy-on-close": !0,
|
|
633
|
+
fullscreen: i.fullscreen,
|
|
634
|
+
"append-to-body": ""
|
|
635
|
+
}, {
|
|
636
|
+
footer: m(() => [
|
|
637
|
+
d("div", ne, [
|
|
638
|
+
p(s, {
|
|
639
|
+
onClick: e[4] || (e[4] = (y) => i.show = !1)
|
|
640
|
+
}, {
|
|
641
|
+
default: m(() => [...e[14] || (e[14] = [
|
|
642
|
+
h("取消", -1)
|
|
643
|
+
])]),
|
|
644
|
+
_: 1
|
|
645
|
+
}),
|
|
646
|
+
p(s, {
|
|
647
|
+
type: "primary",
|
|
648
|
+
onClick: n.handleConfirm
|
|
649
|
+
}, {
|
|
650
|
+
default: m(() => [...e[15] || (e[15] = [
|
|
651
|
+
h("确认", -1)
|
|
652
|
+
])]),
|
|
653
|
+
_: 1
|
|
654
|
+
}, 8, ["onClick"])
|
|
655
|
+
])
|
|
656
|
+
]),
|
|
657
|
+
default: m(() => {
|
|
658
|
+
var y;
|
|
659
|
+
return [
|
|
660
|
+
(y = n.moduleDefinition) != null && y.header ? (c(), w("div", K, [
|
|
661
|
+
i.showBatch ? (c(), w("div", X, [
|
|
662
|
+
d("div", Y, [
|
|
663
|
+
p(u, {
|
|
664
|
+
type: "textarea",
|
|
665
|
+
rows: 5,
|
|
666
|
+
resize: "none",
|
|
667
|
+
modelValue: i.batchAddContent,
|
|
668
|
+
"onUpdate:modelValue": e[2] || (e[2] = (a) => i.batchAddContent = a),
|
|
669
|
+
placeholder: `示例:
|
|
670
|
+
质量问题+上衣
|
|
671
|
+
服务问题+处理速度
|
|
672
|
+
质量问题+上衣+褪色
|
|
673
|
+
服务问题+态度+恶劣`
|
|
674
|
+
}, null, 8, ["modelValue"])
|
|
675
|
+
]),
|
|
676
|
+
d("div", Z, [
|
|
677
|
+
e[10] || (e[10] = d("div", { class: "w-margin-bottom4" }, [
|
|
678
|
+
d("span", { class: "w-font-weight w-font16 w-color-blue" }, "1. "),
|
|
679
|
+
h("每行代表一条选项,每一级通过+分隔 ")
|
|
680
|
+
], -1)),
|
|
681
|
+
e[11] || (e[11] = d("div", { class: "w-margin-bottom4" }, [
|
|
682
|
+
d("span", { class: "w-font-weight w-font16 w-color-blue" }, "2. "),
|
|
683
|
+
h('选项名称中请不要使用"+ - , "诸如此类特殊符号 ')
|
|
684
|
+
], -1)),
|
|
685
|
+
e[12] || (e[12] = d("div", { class: "w-margin-bottom4" }, [
|
|
686
|
+
d("span", { class: "w-font-weight w-font16 w-color-blue" }, "3. "),
|
|
687
|
+
h("对于重复的名字我们将帮您去重合并 ")
|
|
688
|
+
], -1)),
|
|
689
|
+
e[13] || (e[13] = d("div", { class: "w-margin-bottom4" }, [
|
|
690
|
+
d("span", { class: "w-font-weight w-font16 w-color-blue" }, "4. "),
|
|
691
|
+
d("span", { class: "w-color-orange" }, "请注意"),
|
|
692
|
+
h(",批量操作每次最多添加2000行,超出自动忽略 ")
|
|
693
|
+
], -1)),
|
|
694
|
+
d("div", null, [
|
|
695
|
+
p(s, {
|
|
696
|
+
type: "text",
|
|
697
|
+
onClick: e[3] || (e[3] = (a) => i.showBatch = !1)
|
|
698
|
+
}, {
|
|
699
|
+
default: m(() => [...e[8] || (e[8] = [
|
|
700
|
+
h("收起", -1)
|
|
701
|
+
])]),
|
|
702
|
+
_: 1
|
|
703
|
+
}),
|
|
704
|
+
p(s, {
|
|
705
|
+
type: "text",
|
|
706
|
+
loading: i.loading,
|
|
707
|
+
disabled: i.loading,
|
|
708
|
+
onClick: n.handleBatchAdd
|
|
709
|
+
}, {
|
|
710
|
+
default: m(() => [...e[9] || (e[9] = [
|
|
711
|
+
h("确定", -1)
|
|
712
|
+
])]),
|
|
713
|
+
_: 1
|
|
714
|
+
}, 8, ["loading", "disabled", "onClick"])
|
|
715
|
+
])
|
|
716
|
+
])
|
|
717
|
+
])) : (c(), w("div", Q, [
|
|
718
|
+
n.hasLevels ? b("", !0) : (c(), L(s, {
|
|
719
|
+
key: 0,
|
|
720
|
+
type: "text",
|
|
721
|
+
onClick: e[0] || (e[0] = (a) => n.addLevel(0))
|
|
722
|
+
}, {
|
|
723
|
+
default: m(() => [...e[6] || (e[6] = [
|
|
724
|
+
h("添加选项", -1)
|
|
725
|
+
])]),
|
|
726
|
+
_: 1
|
|
727
|
+
})),
|
|
728
|
+
p(s, {
|
|
729
|
+
type: "text",
|
|
730
|
+
onClick: e[1] || (e[1] = (a) => i.showBatch = !0)
|
|
731
|
+
}, {
|
|
732
|
+
default: m(() => [...e[7] || (e[7] = [
|
|
733
|
+
h("批量添加", -1)
|
|
734
|
+
])]),
|
|
735
|
+
_: 1
|
|
736
|
+
})
|
|
737
|
+
])),
|
|
738
|
+
d("div", ee, [
|
|
739
|
+
(c(!0), w(A, null, B(n.moduleDefinition.header, (a, C) => (c(), w("div", {
|
|
740
|
+
key: a.id,
|
|
741
|
+
class: "setRelationOpt-levels-column"
|
|
742
|
+
}, [
|
|
743
|
+
p(v, {
|
|
744
|
+
title: a.title,
|
|
745
|
+
level: a.level,
|
|
746
|
+
"can-add-next": n.canAddNextLevel(a),
|
|
747
|
+
"can-delete": n.isLastLevel(a),
|
|
748
|
+
"onUpdate:title": (_) => a.title = _,
|
|
749
|
+
onAddLevel: (_) => n.addLevel(a.level),
|
|
750
|
+
onDeleteLevel: (_) => n.deleteLevel(C)
|
|
751
|
+
}, null, 8, ["title", "level", "can-add-next", "can-delete", "onUpdate:title", "onAddLevel", "onDeleteLevel"]),
|
|
752
|
+
p(r, {
|
|
753
|
+
options: n.getOptions(C),
|
|
754
|
+
"selected-option": i.selectedConditions[C],
|
|
755
|
+
level: C,
|
|
756
|
+
"is-first-level": C === 0,
|
|
757
|
+
"has-parent-selected": C === 0 || !!i.selectedConditions[C - 1],
|
|
758
|
+
"onUpdate:options": (_) => n.updateOptions(C, _),
|
|
759
|
+
onSelect: (_) => n.selectCondition(_, C),
|
|
760
|
+
onAdd: (_) => n.addCondition(C, _),
|
|
761
|
+
onDelete: (_) => n.deleteCondition(C, _)
|
|
762
|
+
}, null, 8, ["options", "selected-option", "level", "is-first-level", "has-parent-selected", "onUpdate:options", "onSelect", "onAdd", "onDelete"])
|
|
763
|
+
]))), 128))
|
|
764
|
+
]),
|
|
765
|
+
!n.moduleDefinition.header || n.moduleDefinition.header.length == 0 ? (c(), w("div", te, "还未设置选项")) : b("", !0)
|
|
766
|
+
])) : b("", !0)
|
|
767
|
+
];
|
|
768
|
+
}),
|
|
769
|
+
_: 1
|
|
770
|
+
}, 8, ["modelValue", "width", "fullscreen"]);
|
|
771
|
+
}
|
|
772
|
+
const ae = /* @__PURE__ */ k(J, [["render", oe], ["__scopeId", "data-v-147b197f"]]);
|
|
773
|
+
export {
|
|
774
|
+
ae as default
|
|
775
|
+
};
|