Procházet zdrojové kódy

任务流程不能选择重复任务人

duy před 1 rokem
rodič
revize
c38c9dcb74
1 změnil soubory, kde provedl 35 přidání a 21 odebrání
  1. 35 21
      src/components/hc-tasks-user/index.vue

+ 35 - 21
src/components/hc-tasks-user/index.vue

@@ -56,7 +56,7 @@
                                 <el-checkbox-group v-model="checkboxUserList">
                                     <template v-for="item in signUserList" :key="item.certificateUserId">
                                         <div class="user-item checkbox-li">
-                                            <el-checkbox :label="`${item.certificateUserName}-${item.certificateUserId}`">
+                                            <el-checkbox :label="`${item.certificateUserName}-${item.certificateUserId}`" :disabled="item.isDisa">
                                                 <div class="item-user-name">{{ item.certificateUserName }}</div>
                                             </el-checkbox>
                                         </div>
@@ -131,7 +131,7 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from 'vue'
+import { nextTick, onMounted, ref, watch } from 'vue'
 import tasksFlowApi from '~api/tasks/flow'
 import { arrIndex, arrToKey, deepClone, getArrValue } from 'js-fast-way'
 import Draggable from 'vuedraggable'
@@ -226,6 +226,8 @@ watch(() => [
     console.log(fixedBranchList.value, 'fixedBranchList.value')
     if ( fixedBranchList.value.length > 0) {
         curItem.value = fixedBranchList.value[0]
+  
+        chekckTask( curItem.value)
     }
 })
 //监听
@@ -260,26 +262,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)
-            }
-        })
-    }
+// 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,
-},
-)
+// }, {
+//     deep:true,
+// },
+// )
 
 //渲染完成
 onMounted(() => {
@@ -510,9 +512,21 @@ const delTask = async (item, index)=>{
   checkboxUserList.value = []
 }
 const curItem = ref(null)
-const chekckTask = (item)=>{
+const selectUserIds = ref([])
+const chekckTask = async (item)=>{
+    await queryAllRoleList()
     curItem.value = item
     setUserDataList(item.users)
+    //设置已选择过的用户置灰
+     selectUserIds.value = arrToKey(fixedBranchList.value, 'userIds', ',').split(',')
+ signUserList.value.forEach((ele)=>{
+    selectUserIds.value.forEach((ele1)=>{
+        if (ele.certificateUserId === ele1) {
+                ele.isDisa = true
+        }
+    })
+ })
+
 
 }
 </script>