FlowNodeCusersSelector.vue
9.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<template>
<div>
<el-dialog
title="用户选择"
:visible.sync="dialogVisible"
v-if="dialogVisible"
width="50%"
appendToBody
:close-on-click-modal="false"
top="8vh"
>
<form v-form>
<el-container style="height: 520px">
<table
class="table table-bordered"
style="border-spacing: 0; width: 100%"
>
<tbody>
<tr>
<th style="width: 15%">用户</th>
<td>
<el-radio v-model="data.source" label="currentUser"
>当前登录用户</el-radio
>
<el-radio v-model="data.source" label="start"
>发起人</el-radio
>
<el-radio v-model="data.source" label="prev"
>上一步执行人</el-radio
>
<el-radio v-model="data.source" label="var">变量</el-radio>
<el-radio v-model="data.source" label="spec"
>指定用户</el-radio
>
<el-radio v-model="data.source" label="startSuper"
>发起人直接上级</el-radio
>
</td>
</tr>
<tr v-if="data.source == 'var'">
<th>变量选择</th>
<td>
<FlowVarSelector
:defId="parentParam.defId"
@node-click="varTreeOnConfirm"
:removeSub="false"
/>
<span>注意这里需要绑定用户的账号</span>
<el-input
type="textarea"
:rows="4"
v-model="data.var.name"
:disabled="true"
></el-input>
</td>
</tr>
<tr v-show="data.source == 'spec'">
<th>指定用户</th>
<td>
<ht-user-selector-input
class="spec-user-selector"
:appendToBody="true"
v-model="user.name"
:config="{id: 'user.userId', account: 'user.account'}"
/>
</td>
</tr>
<tr v-show="data.source == 'startSuper'">
<th>指定维度</th>
<td>
<el-select v-model="demId" @change="demChange">
<el-option
v-for="(item, i) in demList"
:key="i"
:value="item.id"
:label="
item.isDefault === 1
? item.demName + '(默认维度)'
: item.demName
"
></el-option>
</el-select>
</td>
</tr>
</tbody>
</table>
</el-container>
</form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" size="medium"
>取 消</el-button
>
<el-button type="primary" @click="handleClose" size="medium"
>确 定</el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import flow from '@/api/flow.js'
import req from '@/request.js'
import {mapState, mapActions} from 'vuex'
const FlowVarSelector = () => import('@/components/flow/FlowVarSelector.vue')
import utils from '@/hotent-ui-util.js'
export default {
components: {FlowVarSelector},
data() {
return {
userConditionTab: 'first',
dialogVisible: false,
data: {},
user: {list: [], name: ''},
parentParam: {},
demList: [],
demId: '',
demName: ''
}
},
watch: {
'data.source': function(newVal, oldVal) {
if (newVal == 'var' && !this.data.var) {
this.data.var = {}
}
}
},
methods: {
showDialog: function(param) {
this.dialogVisible = true
this.parentParam = param
if (param.calc) {
this.data = JSON.parse(JSON.stringify(param.calc))
}
// 指定人员
if (this.data.source == 'spec' && this.data.userName != '') {
this.user.name = this.data.userName
this.user.account = this.data.account
this.user.userId = this.data.userId
if (this.user.name) {
let arrName = this.user.name.split(',')
let arrAccount = this.user.account.split(',')
let arruserId = this.user.account.split(',')
for (let i = 0; i < arrName.length; i++) {
var item = {
fullname: arrName[i],
account: arrAccount[i],
userId: arruserId[i]
}
this.user.list.push(item)
}
}
} else {
this.user = {list: []}
}
if (this.data.source === 'startSuper') {
if (this.data.dem && this.data.dem.id) {
this.demId = this.data.dem.id
this.demName = this.data.dem.name
}
}
this.getAllDem()
},
getAllDem() {
req.get('${uc}/api/demension/v1/dems/getAll').then(resp => {
this.demList = resp.data
if (!this.demId) {
for (let i = 0; i < this.demList.length; i++) {
let item = this.demList[i]
if (item.isDefault === 1) {
this.demId = item.id
this.demName = item.demName
break
}
}
}
})
},
handleClose: function() {
//指定人员
if (this.data.source == 'spec') {
this.data.userName = this.user.name
this.data.account = this.user.account
this.data.userId = this.user.userId
}
//处理描述
if (this.data.source == 'currentUser') {
this.data.description = '当前登录用户'
} else if (this.data.source == 'start') {
this.data.description = '发起人'
} else if (this.data.source == 'prev') {
this.data.description = '上一步执行人'
} else if (this.data.source == 'var') {
this.data.description = this.data['var']
? '[变量]' + this.data['var'].name
: '[变量]'
} else if (this.data.source == 'spec') {
if (this.user.name) {
this.data.description = '[指定用户]' + this.user.name
} else {
this.data.description = ''
}
} else if (this.data.source == 'startSuper') {
this.data.dem = {}
this.data.dem.id = this.demId
this.data.dem.name = this.demName
this.data.description = '[发起人直接上级]【维度:' + this.demName + '】'
}
this.$emit('cuserSelectorConfirm', this.data)
this.dialogVisible = false
},
varTreeOnConfirm(node) {
let keyStr = node.name
let source = 'BO'
// 子表情况做提示
// if (
// node.nodeType == "sub" ||
// (node.path && node.path.indexOf(".sub_") != -1)
// ) {
// keyStr = "";
// this.$message.warn("提示信息", "不支持子表");
// } // 主表bo
// else
if (node.nodeType == 'var') {
keyStr = node.name
source = 'flowVar'
} else {
keyStr = node.path + '.' + node.name
}
let json = {
source: source,
name: keyStr,
executorType: 'user',
userValType: 'account'
}
this.data.vars = JSON.stringify(json)
this.data['var'] = json
this.$forceUpdate()
},
demChange(val) {
for (let i = 0; i < this.demList.length; i++) {
let item = this.demList[i]
if (item.id === val) {
this.demName = item.demName
break
}
}
}
}
}
</script>
<style lang="scss" scoped>
div >>> .el-dialog__body {
padding: 10px;
}
.table > thead > tr > th,
.table > thead > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
border-top: 1px solid #e7eaec;
border-left: 1px solid #e7eaec;
line-height: 1.42857;
padding: 8px;
vertical-align: middle;
}
.table {
border-bottom: 1px solid #e7eaec;
border-right: 1px solid #e7eaec;
}
.table >>> .el-button {
padding: 6px 8px;
margin-left: 0px;
margin-right: 5px;
}
div >>> .el-tabs__content {
height: 450px;
overflow: auto;
}
.table-bordered {
height: 50px;
}
.spec-user-selector {
::v-deep {
.el-select__tags {
max-height: 190px !important;
overflow: auto;
}
.el-select {
max-height: 200px;
overflow: hidden;
::-webkit-scrollbar {
width: 4px;
height: 1px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
// background-color: rgba(0, 0, 0, 0.4);
}
::-webkit-scrollbar-track {
border-radius: 10px;
background-color: transparent;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.5);
}
::-webkit-scrollbar-track:hover {
background-color: #f8fafc;
}
}
.el-input__inner {
max-height: 200px;
}
}
}
</style>