From d06209888a283de13d27a0513237a42b28524785 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Mon, 15 Jan 2024 11:21:19 +0800
Subject: [PATCH] 级别人员设置
---
src/views/evaluate/components/selectionDialog.vue | 77 +++++++++++++++++++++++++-------------
1 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/src/views/evaluate/components/selectionDialog.vue b/src/views/evaluate/components/selectionDialog.vue
index 31a9a76..c28153f 100644
--- a/src/views/evaluate/components/selectionDialog.vue
+++ b/src/views/evaluate/components/selectionDialog.vue
@@ -1,7 +1,7 @@
<template>
- <el-dialog v-model="params.visible" :title="params.data?.dictValue || '人员选择'" @close="dialogClose">
+ <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="data" filterable filter-placeholder="请输入人员姓名"
+ <el-transfer v-model="value" :data="userList" :props="{ label: 'realName', key: 'id' }" filterable filter-placeholder="请输入人员姓名"
:titles="['参与投票人员', '不参与投票人员']" />
</div>
<template #footer>
@@ -12,6 +12,9 @@
</template>
<script>
+import { getEmployeeLevelList } from '@/api/evaluate/evaluateTask'
+import _ from 'lodash'
+
export default {
props: {
params: {
@@ -19,44 +22,66 @@
default: () => {
return {
visible: false,
- data: {}
+ data: {},
+ values: {}
}
}
}
},
data() {
return {
+ userList: [],
value: [],
- data: [
- {
- label: '张三',
- key: '1'
- },
- {
- label: '李四',
- key: '2'
- },
- {
- label: '王五',
- key: '3'
- },
- {
- label: '赵六',
- key: '4'
- },
- {
- label: '刘七',
- key: '5'
- }
- ]
+ notParticipateIn: [],
+ participateIn: []
+ }
+ },
+ watch: {
+ value: {
+ handler(newVal) {
+ this.notParticipateIn = []
+ newVal.forEach(item => {
+ const is = this.userList.find(user => user.id === item)
+ this.notParticipateIn.push(is)
+ })
+ }
+ },
+ '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() {
- console.log(this.value, this.data);
+ this.userList.forEach(item => {
+ const is = this.notParticipateIn.find(user => user.id === item.id)
+ if (!is) {
+ this.participateIn.push(item)
+ }
+ })
+ const params = {
+ employeeType: this.params.data.dictKey,
+ participateIn: this.participateIn,
+ notParticipateIn: this.notParticipateIn
+ }
+ this.$emit('addEvaluateParams', params)
+ this.params.visible = false
}
},
--
Gitblit v1.9.3