UserSelectDialog.vue
4.62 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
<template>
<el-dialog width="60%" title="用户选择" :visible.sync="dialogFormVisible" :before-close="close">
<el-form>
<el-row style="width: 93%;margin: 0 auto">
<el-col :span="6">
<el-form-item label="账户:" >
<el-input v-model="searchData.account" style="width:80%" ></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="昵称:">
<el-input v-model="searchData.name" style="width:80%" ></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-button type="primary">查询</el-button>
<el-button >重置</el-button>
</el-col>
</el-row>
<el-form-item>
<el-table v-show="type === 'assignee'"
border :data="options"
style="width: 93%;margin: 0 auto">
<el-table-column align="center" prop="account"
label="账户">
</el-table-column>
<el-table-column align="center" prop="name" :show-overflow-tooltip="true"
label="昵称">
</el-table-column>
<el-table-column align="center"
label="操作">
<template slot-scope="scope">
<div>
<el-button type="primary" @click="commitForm(scope.$index)">选择</el-button>
</div>
</template>
</el-table-column>
</el-table>
<el-table v-show="type === 'candidateUsers'"
border :data="options" @selection-change="handleSelectionChange"
style="width: 93%;margin: 0 auto">
<!--批量选择用户的时候需要复选框-->
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column align="center" prop="account"
label="账户">
</el-table-column>
<el-table-column align="center" prop="name" :show-overflow-tooltip="true"
label="昵称">
</el-table-column>
</el-table>
<el-pagination style="float: right;margin:20px 2.7% 0 0"
background
layout="prev, pager, next"
:total="1000">
</el-pagination>
</el-form-item>
</el-form>
<!--批量选择用户的时候需要确认按钮-->
<div slot="footer" class="dialog-footer" v-if="type === 'candidateUsers'">
<el-button type="primary" @click="commitForm()">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: "UserSelectDialog",
data() {
return {
activeNames: ['1'],
formLabelWidth: "200px",
value: "类",
searchData: {},
multipleSelection: [],
options: [
{
name: "张三",
account: "admin1"
},
{
name: "李四",
account: "admin2"
},
{
name: "王五",
account: "admin3"
}
]
}
},
props: {
formData:{
type: Object,
required: true
},
type: {
type: String,
required: false
},
dialogFormVisibleBool:{
type: Boolean,
required: false
},
modeler: {
type: Object,
required: false
},
nodeElement:{
type: Object,
required: false
}
},
computed:{
form:{
get(){
return this.formData;
}
},
dialogFormVisible:{
get(){
return this.dialogFormVisibleBool
}
}
},
watch:{
type:{
handler(){
console.log(this.type)
}
}
},
mounted() {
},
methods: {
updateProperties(properties){
this.modeler.get("modeling").updateProperties(this.nodeElement, properties);
},
commitForm(index){
if (this.type === 'assignee') {
this.modeler.get("modeling").updateProperties(this.nodeElement, {
assignee: this.options[index].account
});
this.$emit('commitUserForm', this.options[index]);
} else if(this.type === 'candidateUsers'){
let updateStr = null
let candidateUsersStr = this.multipleSelection.map(item => item.account);
if (candidateUsersStr.length > 0) {
updateStr = candidateUsersStr.join(",")
}
this.modeler.get("modeling").updateProperties(this.nodeElement, {
candidateUsers: updateStr
});
this.$emit('commitUserForm', null);
}
},
close(){
this.$emit('commitUserForm', null);
},
handleSelectionChange(val) {
this.multipleSelection = val;
}
}
}
</script>
<style scoped>
</style>