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
| <template>
| <el-dialog v-model="params.visible" :title="params.data?.dictValue || '人员选择'" destroy-on-close @close="dialogClose" @open="dialogOpen">
| <div class="container">
| <el-transfer v-model="value" :data="userList" :props="{ label: 'realName', key: 'id' }" filterable filter-placeholder="请输入人员姓名"
| :titles="['参与投票人员', '不参与投票人员']" />
| </div>
| <template #footer>
| <el-button @click="params.visible = false">取消</el-button>
| <el-button type="primary" @click="submit">确认选择</el-button>
| </template>
| </el-dialog>
| </template>
|
| <script>
| import { getEmployeeLevelList } from '@/api/evaluate/evaluateTask'
| import _ from 'lodash'
|
| export default {
| props: {
| params: {
| type: Object,
| default: () => {
| return {
| visible: false,
| data: {},
| values: {}
| }
| }
| }
| },
| data() {
| return {
| userList: [],
| value: [],
| notParticipateIn: [],
| participateIn: []
| }
| },
| watch: {
| value: {
| handler(newVal) {
| this.notParticipateIn = []
| newVal.forEach(item => {
| const is = this.userList.find(user => user.id === item)
| const { id, name, deptId, deptName, postId, postName } = is
| this.notParticipateIn.push({ id, name, deptId, deptName, postId, postName })
| })
| }
| },
| 'params.visible': {
| handler(newVal) {
| if (!newVal) return
| const notParticipateIn = _.cloneDeep(this.params.values.notParticipateIn)
| if (!notParticipateIn) return
| notParticipateIn.forEach(user => {
| this.value.push(user.id)
| })
| },
| deep: true
| }
| },
| methods: {
| dialogClose() {
| this.value = []
| },
| dialogOpen() {
| const { dictKey } = this.params.data
| getEmployeeLevelList(dictKey).then(res => {
| this.userList = res.data.data
| })
| },
| submit() {
| this.participateIn = []
| this.userList.forEach(item => {
| const is = this.notParticipateIn.find(user => user.id === item.id)
| if (!is) {
| const { id, name, deptId, deptName, postId, postName } = item
| this.participateIn.push({ id, name, deptId, deptName, postId, postName })
| }
| })
| const params = {
| employeeType: this.params.data.dictKey,
| participateIn: this.participateIn,
| notParticipateIn: this.notParticipateIn
| }
| this.$emit('addEvaluateParams', params)
| this.params.visible = false
| }
| },
|
| }
| </script>
|
| <style lang="scss" scoped>
| .container {
| display: flex;
| justify-content: center;
| align-items: center;
| }
| :deep() {
| .el-transfer-panel {
| width: 250px;
| }
| }
| </style>
|
|