|
@@ -20,10 +20,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 选择任务人 -->
|
|
|
- <el-dialog
|
|
|
- v-model="showModal" title="选择任务人" width="62rem" class="hc-modal-border hc-modal-nop" draggable
|
|
|
- destroy-on-close
|
|
|
- >
|
|
|
+ <el-dialog v-model="showModal" title="选择任务人" width="62rem" class="hc-modal-border hc-modal-nop" draggable destroy-on-close>
|
|
|
<div class="hc-tasks-user-modal-content-box">
|
|
|
<div v-if="isShowTaskName" class="tasks-name-box">
|
|
|
<p class="mb-2">创建任务人流程</p>
|
|
@@ -32,18 +29,12 @@
|
|
|
<el-button type="primary" size="default" @click="addTaskName">添加</el-button>
|
|
|
</div>
|
|
|
<div class="task-list-box">
|
|
|
- <div v-for="(item, index) in fixedBranchList" class="task-list-box-item">
|
|
|
+ <div v-for="(item, index) in fixedBranchList" :key="index" class="task-list-box-item">
|
|
|
<el-tooltip :content="item.type === 1 ? '流程审批' : '平行审批'" placement="right">
|
|
|
- <el-button
|
|
|
- size="default" :color="curItem?.name === item.name ? 'orange' : ''"
|
|
|
- @click="chekckTask(item)"
|
|
|
- >
|
|
|
+ <el-button size="default" :color="curItem?.name === item.name ? 'orange' : ''" @click="chekckTask(item)">
|
|
|
{{ item.name }}
|
|
|
<HcIcon v-if="item.type === 2" name="links" class="ml-2" @click="item.type = 1" />
|
|
|
- <HcIcon
|
|
|
- v-if="item.type === 1" name="exchange-2" class="ml-2"
|
|
|
- @click="item.type = 2"
|
|
|
- />
|
|
|
+ <HcIcon v-if="item.type === 1" name="exchange-2" class="ml-2" @click="item.type = 2" />
|
|
|
<HcIcon name="close" class="ml-2" @click="delTask(item, index)" />
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
@@ -68,10 +59,7 @@
|
|
|
<el-checkbox-group v-model="checkboxUserList">
|
|
|
<template v-for="item in signUserList" :key="item.certificateUserId">
|
|
|
<div class="user-item checkbox-li">
|
|
|
- <el-checkbox
|
|
|
- :value="`${item.certificateUserName}-${item.certificateUserId}`"
|
|
|
- :disabled="item.isDisa"
|
|
|
- >
|
|
|
+ <el-checkbox :value="`${item.certificateUserName}-${item.certificateUserId}`" :disabled="item.isDisa">
|
|
|
<div class="item-user-name">{{ item.certificateUserName }}</div>
|
|
|
</el-checkbox>
|
|
|
</div>
|
|
@@ -88,11 +76,7 @@
|
|
|
<div class="user-list">
|
|
|
<el-scrollbar>
|
|
|
<template v-for="(item, index) in checkboxUserList" :key="index">
|
|
|
- <el-tag closable @close="delCheckboxUser(item, index)">
|
|
|
- {{
|
|
|
- setCheckboxUserName(item)
|
|
|
- }}
|
|
|
- </el-tag>
|
|
|
+ <el-tag closable @close="delCheckboxUser(item, index)">{{ setCheckboxUserName(item) }}</el-tag>
|
|
|
</template>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -101,10 +85,7 @@
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button
|
|
|
- hc-btn style="border: 1px solid var(--el-button-border-color);"
|
|
|
- @click="showModal = false"
|
|
|
- >
|
|
|
+ <el-button hc-btn style="border: 1px solid var(--el-button-border-color);" @click="showModal = false">
|
|
|
<HcIcon name="close" />
|
|
|
<span>取消</span>
|
|
|
</el-button>
|
|
@@ -117,10 +98,7 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 调整顺序 -->
|
|
|
- <el-dialog
|
|
|
- v-model="sequenceModal" title="调整顺序" width="38rem" class="hc-modal-border" draggable
|
|
|
- destroy-on-close append-to-body
|
|
|
- >
|
|
|
+ <el-dialog v-model="sequenceModal" title="调整顺序" width="38rem" class="hc-modal-border" draggable destroy-on-close append-to-body>
|
|
|
<el-alert title="可拖动排序,也可在后面点击图标,切换排序" type="warning" :closable="false" />
|
|
|
<div class="sort-node-body-box list-group header">
|
|
|
<div class="list-group-item">
|
|
@@ -159,11 +137,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, onMounted, ref, watch } from 'vue'
|
|
|
+import { onMounted, ref, watch } from 'vue'
|
|
|
import tasksFlowApi from '~api/tasks/flow'
|
|
|
-import { arrIndex, arrToKey, deepClone, getArrValue } from 'js-fast-way'
|
|
|
+import { arrToKey, deepClone, getArrValue } from 'js-fast-way'
|
|
|
import Draggable from 'vuedraggable'
|
|
|
-import { hasDuplicates } from '~uti/tools'
|
|
|
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
@@ -196,7 +173,6 @@ const props = defineProps({
|
|
|
type: Array,
|
|
|
default: () => ([]),
|
|
|
},
|
|
|
-
|
|
|
})
|
|
|
//事件
|
|
|
const emit = defineEmits(['change'])
|
|
@@ -237,8 +213,7 @@ watch(() => [
|
|
|
fixedBranchList.value = list
|
|
|
fixedBranchList.value.forEach((ele) => {
|
|
|
let userList = getArrValue(ele.userList)
|
|
|
- let userIds = arrToKey(userList, 'userId', ',') // '1,2,3'
|
|
|
- ele.userIds = userIds
|
|
|
+ ele.userIds = arrToKey(userList, 'userId', ',') // '1,2,3'
|
|
|
let users = ''
|
|
|
for (let index = 0; index < userList.length; index++) {
|
|
|
const element = userList[index]
|
|
@@ -251,24 +226,18 @@ watch(() => [
|
|
|
ele.users = users
|
|
|
delete ele.userList
|
|
|
})
|
|
|
- console.log(fixedBranchList.value, 'fixedBranchList.value')
|
|
|
if (fixedBranchList.value.length > 0) {
|
|
|
curItem.value = fixedBranchList.value[0]
|
|
|
-
|
|
|
chekckTask(curItem.value)
|
|
|
}
|
|
|
})
|
|
|
-//监听
|
|
|
-watch(() => [
|
|
|
- checkboxUserList.value,
|
|
|
-], ([list]) => {
|
|
|
-
|
|
|
|
|
|
+//监听
|
|
|
+watch(() => checkboxUserList.value, (list) => {
|
|
|
let newUser = [], newUserId = [], users = ''
|
|
|
const dataList = deepClone(checkboxUserList.value)
|
|
|
UserDataList.value = dataList
|
|
|
if (dataList.length > 0) {
|
|
|
-
|
|
|
//封装数据
|
|
|
dataList.forEach(item => {
|
|
|
const itemArr = item.split('-')
|
|
@@ -281,27 +250,21 @@ watch(() => [
|
|
|
newUserId.push(itemArr[1])
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
if (curItem.value) {
|
|
|
curItem.value.userIds = newUserId.join(',')
|
|
|
curItem.value.users = users
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
|
setUserDataList(props.users)
|
|
|
queryAllRoleList()
|
|
|
-
|
|
|
})
|
|
|
|
|
|
//处理用户数据
|
|
|
const setUserDataList = (users) => {
|
|
|
-
|
|
|
if (users) {
|
|
|
const usersArr = users.split(',')
|
|
|
UserDataList.value = usersArr
|
|
@@ -402,13 +365,11 @@ const downSortClick = (index, elemnt) => {
|
|
|
userIdsarr.push(ele.split('-')[1])
|
|
|
})
|
|
|
curItem.value.userIds = userIdsarr.join(',')
|
|
|
-
|
|
|
} else {
|
|
|
window?.$message?.warning('已经处于置底,无法下移')
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
//向上
|
|
|
const upSortClick = (index, elemnt) => {
|
|
|
const data = checkboxUserList.value || []
|
|
@@ -421,13 +382,11 @@ const upSortClick = (index, elemnt) => {
|
|
|
userIdsarr.push(ele.split('-')[1])
|
|
|
})
|
|
|
curItem.value.userIds = userIdsarr.join(',')
|
|
|
-
|
|
|
} else {
|
|
|
window?.$message?.warning('已经处于置顶,无法上移')
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
//
|
|
|
const saveSort = () => {
|
|
|
sequenceModal.value = false
|
|
@@ -442,14 +401,11 @@ const saveSort = () => {
|
|
|
//确认选择
|
|
|
const sureSignUserLoading = ref(false)
|
|
|
const sureSignUserClick = () => {
|
|
|
- console.log(fixedBranchList.value, 'fixedBranchList.value3333333')
|
|
|
let isEmptyuserIds = fixedBranchList.value.some(obj => obj.userIds === '')
|
|
|
if (isEmptyuserIds && isShowTaskName) {
|
|
|
window.$message.warning('请选择对应的任务人员和名称')
|
|
|
- return
|
|
|
} else if (fixedBranchList.value.length === 0 && isShowTaskName.value) {
|
|
|
window.$message.warning('请选择对应的任务人员和任务名称')
|
|
|
- return
|
|
|
} else {
|
|
|
let newUser = [], newUserId = [], users = ''
|
|
|
const dataList = deepClone(checkboxUserList.value)
|
|
@@ -473,18 +429,11 @@ const sureSignUserClick = () => {
|
|
|
})
|
|
|
showModal.value = false
|
|
|
sureSignUserLoading.value = false
|
|
|
-
|
|
|
-
|
|
|
- console.log(fixedBranchList.value, fixedBranchList.value)
|
|
|
-
|
|
|
emit('change', newUser, newUserId, fixedBranchList.value)
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-const taskNameinput = ref('')
|
|
|
|
|
|
+const taskNameinput = ref('')
|
|
|
const addTaskName = () => {
|
|
|
if (taskNameinput.value) {
|
|
|
fixedBranchList.value.push({
|
|
@@ -493,7 +442,6 @@ const addTaskName = () => {
|
|
|
userIds: '',
|
|
|
})
|
|
|
taskNameinput.value = ''
|
|
|
-
|
|
|
} else {
|
|
|
window.$message.warning('请输入任务名称')
|
|
|
}
|
|
@@ -502,25 +450,14 @@ const addTaskName = () => {
|
|
|
}
|
|
|
|
|
|
const delTask = async (item, index) => {
|
|
|
- console.log(index, 'index')
|
|
|
fixedBranchList.value.splice(index, 1)
|
|
|
checkboxUserList.value = []
|
|
|
}
|
|
|
const curItem = ref(null)
|
|
|
-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>
|
|
|
|