|
@@ -73,7 +73,7 @@
|
|
|
<div class="user-list">
|
|
|
<el-scrollbar>
|
|
|
<template v-for="(item, index) in checkboxUserList" :key="index">
|
|
|
- <el-tag closable @close="delCheckboxUser(index)">{{ setCheckboxUserName(item) }}</el-tag>
|
|
|
+ <el-tag closable @close="delCheckboxUser(item, index)">{{ setCheckboxUserName(item) }}</el-tag>
|
|
|
</template>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -135,7 +135,7 @@ import { onMounted, ref, watch } from 'vue'
|
|
|
import tasksFlowApi from '~api/tasks/flow'
|
|
|
import { arrToKey, deepClone, getArrValue } from 'js-fast-way'
|
|
|
import Draggable from 'vuedraggable'
|
|
|
-import { delMessage } from '~uti/tools'
|
|
|
+import { hasDuplicates } from '~uti/tools'
|
|
|
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
@@ -260,6 +260,26 @@ watch(() => [
|
|
|
|
|
|
}
|
|
|
})
|
|
|
+watch(() => [
|
|
|
+fixedBranchList.value,
|
|
|
+], ([list]) => {
|
|
|
+ fixedBranchList.value = list
|
|
|
+ const userIdList = arrToKey(fixedBranchList.value, 'userIds', ',')
|
|
|
+ const { isWarn, element } = hasDuplicates(userIdList.split(','))
|
|
|
+ if (isWarn) {
|
|
|
+ checkboxUserList.value.forEach((ele, index)=>{
|
|
|
+ if (ele.split('-')[1] === element) {
|
|
|
+ window.$message.warning('不能选择重复的任务人员' + ele.split('-')[0])
|
|
|
+ checkboxUserList.value.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}, {
|
|
|
+ deep:true,
|
|
|
+},
|
|
|
+)
|
|
|
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
@@ -330,8 +350,26 @@ const setCheckboxUserName = (item) => {
|
|
|
}
|
|
|
|
|
|
//删除已选择的用户
|
|
|
-const delCheckboxUser = (index) => {
|
|
|
+const delCheckboxUser = (item, index) => {
|
|
|
checkboxUserList.value.splice(index, 1)
|
|
|
+ let delId = item.split('-')[1]
|
|
|
+ fixedBranchList.value.forEach((ele)=>{
|
|
|
+ let arr = ele.userIds.split(',')
|
|
|
+ arr.forEach((ele1, index1)=>{
|
|
|
+ if (ele1 === delId) {
|
|
|
+ arr.splice(index1, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let arr1 = ele.users.split(',')
|
|
|
+ arr1.forEach((ele2, index2)=>{
|
|
|
+ if (ele2.split('-')[1] === delId) {
|
|
|
+ arr1.splice(index2, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ele.userIds = arr.join(',')
|
|
|
+ ele.users = arr1.join(',')
|
|
|
+ })
|
|
|
+ console.log( fixedBranchList.value, ' fixedBranchList.value')
|
|
|
}
|
|
|
|
|
|
//排序
|
|
@@ -432,10 +470,9 @@ const delTask = async (item, index)=>{
|
|
|
}
|
|
|
const curItem = ref(null)
|
|
|
const chekckTask = (item)=>{
|
|
|
- console.log(item)
|
|
|
curItem.value = item
|
|
|
setUserDataList(item.users)
|
|
|
- console.log(checkboxUserList.value, 'checkboxUserList.value')
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
|