duy 1 жил өмнө
parent
commit
bef2cc5aac

+ 46 - 5
src/components/hc-tasks-user/index.vue

@@ -110,10 +110,10 @@
                         <div class="index-box">{{ index + 1 }}</div>
                         <div class="title-box">{{ setCheckboxUserName(element) }}</div>
                         <div class="icon-box">
-                            <span class="icon" @click="downSortClick(index)">
+                            <span class="icon" @click="downSortClick(index, element)">
                                 <HcIcon name="arrow-down" ui="text-lg" />
                             </span>
-                            <span class="icon" @click="upSortClick(index)">
+                            <span class="icon" @click="upSortClick(index, element)">
                                 <HcIcon name="arrow-up" ui="text-lg" />
                             </span>
                         </div>
@@ -133,7 +133,7 @@
 <script setup>
 import { onMounted, ref, watch } from 'vue'
 import tasksFlowApi from '~api/tasks/flow'
-import { arrToKey, deepClone, getArrValue } from 'js-fast-way'
+import { arrIndex, arrToKey, deepClone, getArrValue } from 'js-fast-way'
 import Draggable from 'vuedraggable'
 import { hasDuplicates } from '~uti/tools'
 
@@ -375,7 +375,7 @@ const delCheckboxUser = (item, index) => {
 //排序
 const sortNodeDrag = ref(false)
 //向下
-const downSortClick = (index) => {
+const downSortClick = (index, elemnt) => {
     const indexs = index + 1
     const data = checkboxUserList.value
     if (indexs !== data.length) {
@@ -384,9 +384,30 @@ const downSortClick = (index) => {
     } else {
         window?.$message?.warning('已经处于置底,无法下移')
     }
+
+   
+
+    let curUser = curItem.value.users.split(',')
+    let curUserIds = curItem.value.userIds.split(',')
+    let userIndex = arrIndex(curUser, elemnt) // 1
+    let userIdsIndex = arrIndex(curUserIds, elemnt.split('-')[1]) // 1
+    const userIndexs = userIndex + 1
+    if (userIndexs !== curUser.length) {
+        const tmp = curUser.splice(userIndexs, 1)
+        curUser.splice(userIndex, 0, tmp[0])
+        curItem.value.users = curUser.join(',')
+    } 
+    const userIdsIndexs = userIdsIndex + 1
+    if (userIdsIndexs !== curUserIds.length) {
+        const tmp = curUserIds.splice(userIdsIndexs, 1)
+        curUserIds.splice(userIdsIndex, 0, tmp[0])
+        curItem.value.userIds = curUserIds.join(',')
+       
+    } 
+   
 }
 //向上
-const upSortClick = (index) => {
+const upSortClick = (index, elemnt) => {
     const data = checkboxUserList.value || []
     if (index !== 0) {
         const tmp = data.splice(index - 1, 1)
@@ -394,6 +415,26 @@ const upSortClick = (index) => {
     } else {
         window?.$message?.warning('已经处于置顶,无法上移')
     }
+
+    let curUser = curItem.value.users.split(',')
+    let curUserIds = curItem.value.userIds.split(',')
+    let userIndex = arrIndex(curUser, elemnt) // 1
+    let userIdsIndex = arrIndex(curUserIds, elemnt.split('-')[1]) // 1
+    const userIndexs = userIndex - 1
+    if (userIndexs !== curUser.length) {
+        const tmp = curUser.splice(userIndexs, 1)
+        curUser.splice(userIndex, 0, tmp[0])
+        curItem.value.users = curUser.join(',')
+    } 
+    const userIdsIndexs = userIdsIndex - 1
+    if (userIdsIndexs !== curUserIds.length) {
+        const tmp = curUserIds.splice(userIdsIndexs, 1)
+        curUserIds.splice(userIdsIndex, 0, tmp[0])
+        curItem.value.userIds = curUserIds.join(',')
+       
+    } 
+
+    
 }
 
 //确认选择

+ 7 - 2
src/views/tasks/flow.vue

@@ -103,7 +103,11 @@ const handleTableEdit = async (row) => {
     changeId.value = row.id
   
     showEditModal.value = true
-    const { error, code, data } = await tasksFlowApi.queryFixedFlowDetail({ id: row?.id })
+    getFlowDetail()
+
+}
+const getFlowDetail = async ()=>{
+    const { error, code, data } = await tasksFlowApi.queryFixedFlowDetail({ id: changeId.value })
     if (!error && code === 200) {
         let users = '', res = getObjValue(data)
         const list = getArrValue(res['fixedBranchVOList'])
@@ -120,7 +124,7 @@ const handleTableEdit = async (row) => {
       
             console.log(users, 'users')
         }
-        flowFormData.value = { id: row.id, fixedName: res.fixedFlowName, fixedBranchList:res.fixedBranchVOList }
+        flowFormData.value = { id: changeId.value, fixedName: res.fixedFlowName, fixedBranchList:res.fixedBranchVOList }
         linkUserJoinString.value = users
     } else {
         flowFormData.value = { id: '', fixedName: '', fixedBranchList: [] }
@@ -192,6 +196,7 @@ const saveFormClick = async () => {
             getTableData().then()
         } else {
             window?.$message?.error(msg)
+            getFlowDetail()
         }
     }
 }