eoss-mobiles 0.2.97 → 0.2.99
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/lib/checkbox.js +28 -26
- package/lib/config/api.js +3 -2
- package/lib/eoss-mobile.common.js +616 -80
- package/lib/flow-btn.js +29 -27
- package/lib/flow-list.js +29 -27
- package/lib/flow.js +617 -81
- package/lib/index.js +1 -1
- package/lib/picker.js +28 -26
- package/lib/radio.js +28 -26
- package/lib/retrial-auth.js +30 -28
- package/lib/selector.js +91 -88
- package/lib/table-column.js +28 -26
- package/lib/theme-chalk/flow.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/package.json +1 -1
- package/packages/flow/src/components/Handle.vue +64 -38
- package/packages/flow/src/components/Message.vue +90 -37
- package/packages/flow/src/components/ProcessSettings.vue +319 -0
- package/packages/flow/src/components/TaskRead.vue +0 -3
- package/packages/selector/src/main.vue +169 -169
- package/packages/selector/src/selector-field.vue +257 -256
- package/packages/selector/src/selector-tree.vue +3 -8
- package/packages/theme-chalk/lib/flow.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/src/flow.scss +5 -0
- package/src/config/api.js +2 -1
- package/src/index.js +1 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="em-flow-setting">
|
|
3
|
+
<van-collapse v-model="active">
|
|
4
|
+
<van-collapse-item title="预设自定义节点信息(折叠不作处理)" name="1">
|
|
5
|
+
<div
|
|
6
|
+
class="em-flow-setting-item"
|
|
7
|
+
v-for="(item, index) in flowList"
|
|
8
|
+
:key="index"
|
|
9
|
+
>
|
|
10
|
+
<!-- <em-input v-model="name" :label="`节点${index + 1}`" /> -->
|
|
11
|
+
<em-picker
|
|
12
|
+
:title="`节点${index + 1}`"
|
|
13
|
+
:label="`节点${index + 1}`"
|
|
14
|
+
show-toolbar
|
|
15
|
+
v-model="item.nodeId"
|
|
16
|
+
:columns="item.nodeList"
|
|
17
|
+
value-key="nodeId"
|
|
18
|
+
label-key="nodeName"
|
|
19
|
+
@confirm="onConfirmNextNode($event, index)"
|
|
20
|
+
/>
|
|
21
|
+
<em-selector
|
|
22
|
+
:multiple="!item.isRadio"
|
|
23
|
+
v-show="item.showSelectUser"
|
|
24
|
+
:nextUserList="item.nextUserList"
|
|
25
|
+
v-model="item.nextUserSelectList"
|
|
26
|
+
label="办理人"
|
|
27
|
+
:objType="item.objType"
|
|
28
|
+
:param="{
|
|
29
|
+
pid: item.pid
|
|
30
|
+
}"
|
|
31
|
+
:required="item.nodeId != ''"
|
|
32
|
+
tabs="employee,persongroup"
|
|
33
|
+
:baseUrl="apiBaseUrl"
|
|
34
|
+
:paddingTop="paddingTop"
|
|
35
|
+
/>
|
|
36
|
+
<van-icon
|
|
37
|
+
name="down"
|
|
38
|
+
v-show="index + 1 != flowList.length"
|
|
39
|
+
style="margin-top: 10px"
|
|
40
|
+
/></div></van-collapse-item
|
|
41
|
+
></van-collapse>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import {
|
|
47
|
+
getPresetCustomInfo,
|
|
48
|
+
getNodeInfoHtml
|
|
49
|
+
} from '../../../../src/config/api.js';
|
|
50
|
+
import request from '../../../../src/utils/http.js';
|
|
51
|
+
export default {
|
|
52
|
+
props: {
|
|
53
|
+
processDefinitionId: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
nodeId: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ''
|
|
60
|
+
},
|
|
61
|
+
businessId: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ''
|
|
64
|
+
},
|
|
65
|
+
taskId: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: ''
|
|
68
|
+
},
|
|
69
|
+
pendingId: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ''
|
|
72
|
+
},
|
|
73
|
+
apiBaseUrl: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
},
|
|
77
|
+
paddingTop: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
choiceOrgId: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: ''
|
|
84
|
+
},
|
|
85
|
+
pOrgId: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: ''
|
|
88
|
+
},
|
|
89
|
+
choiceDeptId: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: ''
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
data() {
|
|
95
|
+
return {
|
|
96
|
+
name: '',
|
|
97
|
+
pid: 'root',
|
|
98
|
+
objType: 'enterprise',
|
|
99
|
+
selectType: 'employee',
|
|
100
|
+
active: ['1'],
|
|
101
|
+
flowList: [],
|
|
102
|
+
selectList: [],
|
|
103
|
+
isRadio: true,
|
|
104
|
+
nodeList: []
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
watch: {
|
|
108
|
+
nodeId: {
|
|
109
|
+
handler(val) {
|
|
110
|
+
if (val) {
|
|
111
|
+
// this.getProList(val);
|
|
112
|
+
this.getNodeInfo(val);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
immediate: true,
|
|
116
|
+
deep: true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
methods: {
|
|
120
|
+
getValue() {
|
|
121
|
+
let pass = true;
|
|
122
|
+
let PresetData = [];
|
|
123
|
+
let newFlowList = this.flowList.filter((x) => x.nodeId);
|
|
124
|
+
for (let i = 0; i < newFlowList.length; i++) {
|
|
125
|
+
if (newFlowList[i].nextUserSelectList.length == 0 && newFlowList[i].showSelectUser) {
|
|
126
|
+
pass = false;
|
|
127
|
+
this.$toast(`请选择节点${i + 1}的办理人`);
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (pass) {
|
|
132
|
+
newFlowList.map((x, i) => {
|
|
133
|
+
PresetData.push({
|
|
134
|
+
name: typeof x.nodeId == 'object'? x.nodeId.nodeId : x.nodeId,
|
|
135
|
+
value: x.nextUserSelectList
|
|
136
|
+
.map((y) => {
|
|
137
|
+
return y.showid;
|
|
138
|
+
})
|
|
139
|
+
.join(','),
|
|
140
|
+
lastName: i == 0 ? this.nodeId : PresetData[i - 1].name,
|
|
141
|
+
sequence: i + 1 +''
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return JSON.stringify(PresetData);
|
|
146
|
+
},
|
|
147
|
+
// 根据返回的办理人类型来判断 选择人员树的范围
|
|
148
|
+
changePidObjtype(val, choiceOrgId, choiceDeptId, pOrgId, obj) {
|
|
149
|
+
if (val === 1 || val === 2) {
|
|
150
|
+
obj.pid = choiceOrgId || this.orgId;
|
|
151
|
+
obj.objType = 'enterprise';
|
|
152
|
+
obj.selectType = 'employee';
|
|
153
|
+
} else if (val === 3 || val === 4) {
|
|
154
|
+
obj.pid = 'root';
|
|
155
|
+
obj.objType = 'employee';
|
|
156
|
+
} else if (val === 5 || val === 6) {
|
|
157
|
+
obj.pid = choiceDeptId || this.depId;
|
|
158
|
+
obj.objType = 'department';
|
|
159
|
+
} else if (val === 11 || val === 12) {
|
|
160
|
+
obj.selectType = 'employee';
|
|
161
|
+
obj.objType = 'enterprise';
|
|
162
|
+
} else if (val === 13) {
|
|
163
|
+
obj.pid = choiceDeptId || this.depId;
|
|
164
|
+
obj.selectType = 'employee';
|
|
165
|
+
obj.objType = 'department';
|
|
166
|
+
} else if (val === 14) {
|
|
167
|
+
obj.pid = pOrgId || this.orgId;
|
|
168
|
+
obj.selectType = 'employee';
|
|
169
|
+
} else if (val === 15 || val === 16) {
|
|
170
|
+
obj.pid = pOrgId || this.orgId;
|
|
171
|
+
obj.selectType = 'employee';
|
|
172
|
+
}
|
|
173
|
+
// userSelectionType 机构内单选人1,机构内多选人2,所有机构单选人3,所有部门多选人4,本部门单选人5,本部门多选人6,本单位单选部门7,本单位多选部门8,单选单位9,多选单位10,单选机构11,多选机构12,本部门角色13,本单位角色14
|
|
174
|
+
val == 2 ||
|
|
175
|
+
val == 4 ||
|
|
176
|
+
val == 6 ||
|
|
177
|
+
val == 8 ||
|
|
178
|
+
val == 10 ||
|
|
179
|
+
val == 11 ||
|
|
180
|
+
val == 12
|
|
181
|
+
? (obj.isRadio = false)
|
|
182
|
+
: (obj.isRadio = true); //判断办理人单选多选
|
|
183
|
+
},
|
|
184
|
+
// 修改默认办理人
|
|
185
|
+
changeDefPeople(def, all, data) {
|
|
186
|
+
data.nextUserSelectList = [];
|
|
187
|
+
if ((def == 1 && all == 1) || (def == 0 && all == 1)) {
|
|
188
|
+
let ids = '';
|
|
189
|
+
data.nextUserList.map((r, i) => {
|
|
190
|
+
r.showid = r.userId;
|
|
191
|
+
r.showname = r.username;
|
|
192
|
+
this.$set(r, 'checked', true);
|
|
193
|
+
data.nextUserSelectList.push(r);
|
|
194
|
+
ids += r.userId + (i === data.nextUserList.length - 1 ? '' : ',');
|
|
195
|
+
});
|
|
196
|
+
// this.form.nextUserId = ids;
|
|
197
|
+
} else if (
|
|
198
|
+
def == 1 &&
|
|
199
|
+
(!all || all == 0) &&
|
|
200
|
+
data.nextUserList.length > 0
|
|
201
|
+
) {
|
|
202
|
+
data.nextUserList[0].showid = data.nextUserList[0].userId;
|
|
203
|
+
data.nextUserList[0].showname = data.nextUserList[0].username;
|
|
204
|
+
this.$set(data.nextUserList[0], 'checked', true);
|
|
205
|
+
data.nextUserSelectList.push(data.nextUserList[0]);
|
|
206
|
+
// this.form.nextUserId = this.nextUserSelectList[0].userId;
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
onConfirmNextNode(val, i) {
|
|
210
|
+
this.flowList = this.flowList.splice(0, i + 1);
|
|
211
|
+
if (val.nodeId == '-2') {
|
|
212
|
+
this.flowList[i].nextUserList = [];
|
|
213
|
+
this.flowList[i].nextUserSelectList = [];
|
|
214
|
+
} else {
|
|
215
|
+
this.getNodeInfo(val.nodeId, i);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
getNodeInfo(nodeId, i) {
|
|
219
|
+
this.$toast.loading({
|
|
220
|
+
message: '加载中...',
|
|
221
|
+
forbidClick: true,
|
|
222
|
+
loadingType: 'spinner',
|
|
223
|
+
overlay: true,
|
|
224
|
+
duration: 0
|
|
225
|
+
});
|
|
226
|
+
request({
|
|
227
|
+
url: getNodeInfoHtml,
|
|
228
|
+
params: {
|
|
229
|
+
processDefinitionId: this.processDefinitionId,
|
|
230
|
+
nextNodeId: nodeId,
|
|
231
|
+
businessId: this.businessId,
|
|
232
|
+
taskId: this.taskId,
|
|
233
|
+
pendingId: this.pendingId
|
|
234
|
+
}
|
|
235
|
+
}).then((res) => {
|
|
236
|
+
if (res.status == 'success') {
|
|
237
|
+
// this.nodeList = res.data.taskNodeMap;
|
|
238
|
+
let obj = {};
|
|
239
|
+
if (i != undefined) {
|
|
240
|
+
res.data.nextUserList.map((res) => {
|
|
241
|
+
res.checked = false;
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
this.flowList[i].nextUserList = res.data.nextUserList || [];
|
|
245
|
+
this.flowList[i].nextUserSelectList = res.data.nextUserList || [];
|
|
246
|
+
this.changeDefPeople(
|
|
247
|
+
res.data.nodeExtAttr.isDefSelectedObj,
|
|
248
|
+
res.data.nodeExtAttr.isSelectedAllObj,
|
|
249
|
+
this.flowList[i]
|
|
250
|
+
);
|
|
251
|
+
this.changePidObjtype(
|
|
252
|
+
res.data.nodeExtAttr.userSelectionType,
|
|
253
|
+
this.choiceOrgId,
|
|
254
|
+
this.choiceDeptId,
|
|
255
|
+
this.pOrgId,
|
|
256
|
+
this.flowList[i]
|
|
257
|
+
);
|
|
258
|
+
} else {
|
|
259
|
+
obj.nextUserList = res.data.nextUserList || [];
|
|
260
|
+
obj.nextUserSelectList = res.data.nextUserList || [];
|
|
261
|
+
this.changeDefPeople(
|
|
262
|
+
res.data.nodeExtAttr.isDefSelectedObj,
|
|
263
|
+
res.data.nodeExtAttr.isSelectedAllObj,
|
|
264
|
+
obj
|
|
265
|
+
);
|
|
266
|
+
this.changePidObjtype(
|
|
267
|
+
res.data.nodeExtAttr.userSelectionType,
|
|
268
|
+
this.choiceOrgId,
|
|
269
|
+
this.choiceDeptId,
|
|
270
|
+
this.pOrgId,
|
|
271
|
+
obj
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
this.getProList(nodeId, obj);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
getProList(nodeId, obj) {
|
|
279
|
+
request({
|
|
280
|
+
url: getPresetCustomInfo,
|
|
281
|
+
params: {
|
|
282
|
+
processDefinitionId: this.processDefinitionId,
|
|
283
|
+
nodeId: nodeId,
|
|
284
|
+
taskAction: 'withExtendData'
|
|
285
|
+
}
|
|
286
|
+
}).then((res) => {
|
|
287
|
+
this.$toast.clear();
|
|
288
|
+
if (res.status == 'success') {
|
|
289
|
+
let arr = [{ nodeId: '-2', nodeName: '请选择' }];
|
|
290
|
+
let isEnd = false;
|
|
291
|
+
if (res.data.taskNodeMap) {
|
|
292
|
+
for (let i in res.data.taskNodeMap || res.data || {}) {
|
|
293
|
+
let obj = {
|
|
294
|
+
nodeId: i,
|
|
295
|
+
nodeName: res.data.taskNodeMap[i]
|
|
296
|
+
};
|
|
297
|
+
isEnd = i == 'endEvent';
|
|
298
|
+
arr.push(obj);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (isEnd) {
|
|
302
|
+
arr = arr.slice(1);
|
|
303
|
+
}
|
|
304
|
+
obj = {
|
|
305
|
+
...obj,
|
|
306
|
+
nodeList: arr,
|
|
307
|
+
nodeId: '',
|
|
308
|
+
nodeId: isEnd ? arr[0].nodeId : '',
|
|
309
|
+
showSelectUser: !isEnd
|
|
310
|
+
};
|
|
311
|
+
this.flowList.push(obj);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
</script>
|
|
318
|
+
|
|
319
|
+
<style></style>
|
|
@@ -286,7 +286,6 @@ export default {
|
|
|
286
286
|
})
|
|
287
287
|
.then((res) => {
|
|
288
288
|
const { status, message, data } = res;
|
|
289
|
-
this.loading = false;
|
|
290
289
|
if (status === 'success') {
|
|
291
290
|
this.form.notificationMsgType = message.split(',');
|
|
292
291
|
this.defaultNotificationType = message.split(',');
|
|
@@ -313,7 +312,6 @@ export default {
|
|
|
313
312
|
}
|
|
314
313
|
})
|
|
315
314
|
.catch((err) => {
|
|
316
|
-
this.loading = false;
|
|
317
315
|
if (err.message && err.message !== 'canceled') {
|
|
318
316
|
this.$message.error(err.message);
|
|
319
317
|
}
|
|
@@ -365,7 +363,6 @@ export default {
|
|
|
365
363
|
}
|
|
366
364
|
})
|
|
367
365
|
.catch((err) => {
|
|
368
|
-
this.loading = false;
|
|
369
366
|
if (err.message && err.message !== 'canceled') {
|
|
370
367
|
this.$toast(err.message);
|
|
371
368
|
}
|
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="em-selector" @click="handleClick">
|
|
3
|
-
<selector-field
|
|
4
|
-
v-if="!this.$scopedSlots.input && !this.$slots.input && !showTree"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
:input-value="inputValue"
|
|
7
|
-
:data="selectList"
|
|
8
|
-
@change="handleChangeSel"
|
|
9
|
-
@click="handleSelector"
|
|
10
|
-
/>
|
|
11
|
-
<slot v-else name="input" :click="handleSelector" />
|
|
12
|
-
<em-selector-tree
|
|
13
|
-
v-if="(showSelectorTree || showTree) && typeof value !== 'string'"
|
|
14
|
-
v-bind="$attrs"
|
|
15
|
-
v-on="$listeners"
|
|
16
|
-
:showTree="showTree"
|
|
17
|
-
:showMore="$listeners['left-icon'] == undefined"
|
|
18
|
-
:isTreeIcon="$scopedSlots['tree-icon'] != undefined"
|
|
19
|
-
:selectList="selectList"
|
|
20
|
-
@dispose="handleDispose"
|
|
21
|
-
@close="handleDispose()"
|
|
22
|
-
>
|
|
23
|
-
<template
|
|
24
|
-
v-if="$scopedSlots['tree-icon']"
|
|
25
|
-
slot="tree-icon"
|
|
26
|
-
slot-scope="{ value }"
|
|
27
|
-
>
|
|
28
|
-
<slot
|
|
29
|
-
v-if="$scopedSlots['tree-icon']"
|
|
30
|
-
name="tree-icon"
|
|
31
|
-
:value="value"
|
|
32
|
-
></slot>
|
|
33
|
-
</template>
|
|
34
|
-
</em-selector-tree>
|
|
35
|
-
<div v-if="typeof value === 'string'">
|
|
36
|
-
<em-selector-tree
|
|
37
|
-
v-show="showSelectorTree || showTree"
|
|
38
|
-
v-bind="$attrs"
|
|
39
|
-
v-on="$listeners"
|
|
40
|
-
:showTree="showTree"
|
|
41
|
-
:showMore="$listeners['left-icon'] == undefined"
|
|
42
|
-
:isTreeIcon="$scopedSlots['tree-icon'] != undefined"
|
|
43
|
-
:selectList.sync="selectList"
|
|
44
|
-
@dispose="handleDispose"
|
|
45
|
-
@close="handleDispose()"
|
|
46
|
-
>
|
|
47
|
-
<template
|
|
48
|
-
v-if="$scopedSlots['tree-icon']"
|
|
49
|
-
slot="tree-icon"
|
|
50
|
-
slot-scope="{ value }"
|
|
51
|
-
>
|
|
52
|
-
<slot
|
|
53
|
-
v-if="$scopedSlots['tree-icon']"
|
|
54
|
-
name="tree-icon"
|
|
55
|
-
:value="value"
|
|
56
|
-
></slot>
|
|
57
|
-
</template>
|
|
58
|
-
</em-selector-tree>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script>
|
|
64
|
-
import EmSelectorTree from './selector-tree.vue';
|
|
65
|
-
import selectorField from './selector-field.vue';
|
|
66
|
-
export default {
|
|
67
|
-
components: { EmSelectorTree, selectorField },
|
|
68
|
-
name: 'EmSelector',
|
|
69
|
-
inheritAttrs: false,
|
|
70
|
-
props: {
|
|
71
|
-
value: { type: [Array, String], default: () => [] },
|
|
72
|
-
showTree: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: false
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
data() {
|
|
78
|
-
return {
|
|
79
|
-
showSelectorTree: false,
|
|
80
|
-
inputValue: ''
|
|
81
|
-
// newSelectList:[]
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
watch: {
|
|
85
|
-
value: {
|
|
86
|
-
handler(val) {
|
|
87
|
-
this.selectList = val;
|
|
88
|
-
if (this.selectList.length > 0) {
|
|
89
|
-
this.inputValue = this.selectList[0][
|
|
90
|
-
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
91
|
-
];
|
|
92
|
-
} else {
|
|
93
|
-
this.inputValue = '';
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
deep: true,
|
|
97
|
-
immediate: true
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
computed: {
|
|
101
|
-
selectList: {
|
|
102
|
-
get() {
|
|
103
|
-
return this.value;
|
|
104
|
-
},
|
|
105
|
-
set(val) {
|
|
106
|
-
this.$emit('input', val);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
mounted() {
|
|
111
|
-
// this.selectList = this.value
|
|
112
|
-
// console.log(this)
|
|
113
|
-
},
|
|
114
|
-
methods: {
|
|
115
|
-
handleClick() {
|
|
116
|
-
this.$emit('click');
|
|
117
|
-
},
|
|
118
|
-
handleSelector() {
|
|
119
|
-
if (this.$attrs.disabled || this.$attrs.readonly) return;
|
|
120
|
-
this.showSelectorTree = !this.showSelectorTree;
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* handleDispose
|
|
124
|
-
* @desc:确认选人
|
|
125
|
-
* @date 2023年3月6日
|
|
126
|
-
* @author liufan
|
|
127
|
-
* @param {Object} val 选中的人员/单位
|
|
128
|
-
*/
|
|
129
|
-
handleDispose(val) {
|
|
130
|
-
this.inputValue = '';
|
|
131
|
-
if (val) {
|
|
132
|
-
const { list } = val;
|
|
133
|
-
this.selectList = list;
|
|
134
|
-
if (val.list.length > 0) {
|
|
135
|
-
this.inputValue =
|
|
136
|
-
list[0][
|
|
137
|
-
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
138
|
-
];
|
|
139
|
-
} else {
|
|
140
|
-
this.inputValue = '';
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.showSelectorTree = false;
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* handleChangeSel
|
|
147
|
-
* @desc:输入框数据发生变化时
|
|
148
|
-
* @date 2023年3月6日
|
|
149
|
-
* @author liufan
|
|
150
|
-
* @param {Array} val 变化后的选中数据
|
|
151
|
-
*/
|
|
152
|
-
handleChangeSel(val) {
|
|
153
|
-
if (val) {
|
|
154
|
-
const { list } = val;
|
|
155
|
-
this.selectList = list;
|
|
156
|
-
if (val.list.length > 0) {
|
|
157
|
-
this.inputValue =
|
|
158
|
-
list[0][
|
|
159
|
-
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
160
|
-
];
|
|
161
|
-
} else {
|
|
162
|
-
this.inputValue = '';
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
this.$emit('input', val.list);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="em-selector" @click="handleClick">
|
|
3
|
+
<selector-field
|
|
4
|
+
v-if="!this.$scopedSlots.input && !this.$slots.input && !showTree"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
:input-value="inputValue"
|
|
7
|
+
:data="selectList"
|
|
8
|
+
@change="handleChangeSel"
|
|
9
|
+
@click="handleSelector"
|
|
10
|
+
/>
|
|
11
|
+
<slot v-else name="input" :click="handleSelector" />
|
|
12
|
+
<em-selector-tree
|
|
13
|
+
v-if="(showSelectorTree || showTree) && typeof value !== 'string'"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
v-on="$listeners"
|
|
16
|
+
:showTree="showTree"
|
|
17
|
+
:showMore="$listeners['left-icon'] == undefined"
|
|
18
|
+
:isTreeIcon="$scopedSlots['tree-icon'] != undefined"
|
|
19
|
+
:selectList="selectList"
|
|
20
|
+
@dispose="handleDispose"
|
|
21
|
+
@close="handleDispose()"
|
|
22
|
+
>
|
|
23
|
+
<template
|
|
24
|
+
v-if="$scopedSlots['tree-icon']"
|
|
25
|
+
slot="tree-icon"
|
|
26
|
+
slot-scope="{ value }"
|
|
27
|
+
>
|
|
28
|
+
<slot
|
|
29
|
+
v-if="$scopedSlots['tree-icon']"
|
|
30
|
+
name="tree-icon"
|
|
31
|
+
:value="value"
|
|
32
|
+
></slot>
|
|
33
|
+
</template>
|
|
34
|
+
</em-selector-tree>
|
|
35
|
+
<div v-if="typeof value === 'string'">
|
|
36
|
+
<em-selector-tree
|
|
37
|
+
v-show="showSelectorTree || showTree"
|
|
38
|
+
v-bind="$attrs"
|
|
39
|
+
v-on="$listeners"
|
|
40
|
+
:showTree="showTree"
|
|
41
|
+
:showMore="$listeners['left-icon'] == undefined"
|
|
42
|
+
:isTreeIcon="$scopedSlots['tree-icon'] != undefined"
|
|
43
|
+
:selectList.sync="selectList"
|
|
44
|
+
@dispose="handleDispose"
|
|
45
|
+
@close="handleDispose()"
|
|
46
|
+
>
|
|
47
|
+
<template
|
|
48
|
+
v-if="$scopedSlots['tree-icon']"
|
|
49
|
+
slot="tree-icon"
|
|
50
|
+
slot-scope="{ value }"
|
|
51
|
+
>
|
|
52
|
+
<slot
|
|
53
|
+
v-if="$scopedSlots['tree-icon']"
|
|
54
|
+
name="tree-icon"
|
|
55
|
+
:value="value"
|
|
56
|
+
></slot>
|
|
57
|
+
</template>
|
|
58
|
+
</em-selector-tree>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script>
|
|
64
|
+
import EmSelectorTree from './selector-tree.vue';
|
|
65
|
+
import selectorField from './selector-field.vue';
|
|
66
|
+
export default {
|
|
67
|
+
components: { EmSelectorTree, selectorField },
|
|
68
|
+
name: 'EmSelector',
|
|
69
|
+
inheritAttrs: false,
|
|
70
|
+
props: {
|
|
71
|
+
value: { type: [Array, String], default: () => [] },
|
|
72
|
+
showTree: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
showSelectorTree: false,
|
|
80
|
+
inputValue: ''
|
|
81
|
+
// newSelectList:[]
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
watch: {
|
|
85
|
+
value: {
|
|
86
|
+
handler(val) {
|
|
87
|
+
this.selectList = val;
|
|
88
|
+
if (this.selectList.length > 0) {
|
|
89
|
+
this.inputValue = this.selectList[0][
|
|
90
|
+
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
91
|
+
];
|
|
92
|
+
} else {
|
|
93
|
+
this.inputValue = '';
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
deep: true,
|
|
97
|
+
immediate: true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
selectList: {
|
|
102
|
+
get() {
|
|
103
|
+
return this.value;
|
|
104
|
+
},
|
|
105
|
+
set(val) {
|
|
106
|
+
this.$emit('input', val);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
mounted() {
|
|
111
|
+
// this.selectList = this.value
|
|
112
|
+
// console.log(this)
|
|
113
|
+
},
|
|
114
|
+
methods: {
|
|
115
|
+
handleClick() {
|
|
116
|
+
this.$emit('click');
|
|
117
|
+
},
|
|
118
|
+
handleSelector() {
|
|
119
|
+
if (this.$attrs.disabled || this.$attrs.readonly) return;
|
|
120
|
+
this.showSelectorTree = !this.showSelectorTree;
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* handleDispose
|
|
124
|
+
* @desc:确认选人
|
|
125
|
+
* @date 2023年3月6日
|
|
126
|
+
* @author liufan
|
|
127
|
+
* @param {Object} val 选中的人员/单位
|
|
128
|
+
*/
|
|
129
|
+
handleDispose(val) {
|
|
130
|
+
this.inputValue = '';
|
|
131
|
+
if (val) {
|
|
132
|
+
const { list } = val;
|
|
133
|
+
this.selectList = list;
|
|
134
|
+
if (val.list.length > 0) {
|
|
135
|
+
this.inputValue =
|
|
136
|
+
list[0][
|
|
137
|
+
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
138
|
+
];
|
|
139
|
+
} else {
|
|
140
|
+
this.inputValue = '';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
this.showSelectorTree = false;
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* handleChangeSel
|
|
147
|
+
* @desc:输入框数据发生变化时
|
|
148
|
+
* @date 2023年3月6日
|
|
149
|
+
* @author liufan
|
|
150
|
+
* @param {Array} val 变化后的选中数据
|
|
151
|
+
*/
|
|
152
|
+
handleChangeSel(val) {
|
|
153
|
+
if (val) {
|
|
154
|
+
const { list } = val;
|
|
155
|
+
this.selectList = list;
|
|
156
|
+
if (val.list.length > 0) {
|
|
157
|
+
this.inputValue =
|
|
158
|
+
list[0][
|
|
159
|
+
this.$attrs.labelKey || this.$attrs['label-key'] || 'showname'
|
|
160
|
+
];
|
|
161
|
+
} else {
|
|
162
|
+
this.inputValue = '';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
this.$emit('input', val.list);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
</script>
|