|
@@ -54,8 +54,14 @@
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button size="large" @click="showModal = false">取消</el-button>
|
|
|
- <el-button type="primary" hc-btn @click="sureSignUserClick">确定</el-button>
|
|
|
+ <el-button size="large" @click="showModal = false">
|
|
|
+ <HcIcon name="close"/>
|
|
|
+ <span>取消</span>
|
|
|
+ </el-button>
|
|
|
+ <el-button hc-btn type="primary" :loading="sureSignUserLoading" @click="sureSignUserClick">
|
|
|
+ <HcIcon name="check"/>
|
|
|
+ <span>确定</span>
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
@@ -98,15 +104,11 @@
|
|
|
|
|
|
<script setup>
|
|
|
import {ref, watch, onMounted} from "vue";
|
|
|
-import {useAppStore} from "~src/store";
|
|
|
import tasksFlowApi from '~api/tasks/flow';
|
|
|
-import {getArrValue} from "vue-utils-plus"
|
|
|
+import {getArrValue,deepClone} from "vue-utils-plus"
|
|
|
+import {checkCustomFlowUserIsEVisaPermissions} from '~api/other';
|
|
|
import Draggable from "vuedraggable";
|
|
|
|
|
|
-//初始变量
|
|
|
-const userStore = useAppStore()
|
|
|
-const contractId = ref(userStore.getContractId);
|
|
|
-
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
ui: {
|
|
@@ -117,7 +119,23 @@ const props = defineProps({
|
|
|
users: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ projectId: {
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ contractId: {
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ type: { //first,log,wbs
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ typeData: {
|
|
|
+ type: [String, Number, Array, Object],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//变量
|
|
@@ -125,6 +143,10 @@ const showModal = ref(false)
|
|
|
const sequenceModal = ref(false)
|
|
|
const checkboxUserList = ref([])
|
|
|
const UserDataList = ref([])
|
|
|
+const projectId = ref(props.projectId)
|
|
|
+const contractId = ref(props.contractId)
|
|
|
+const isTypes = ref(props.type)
|
|
|
+const typeDatas = ref(props.typeData)
|
|
|
|
|
|
//树数据
|
|
|
const ElTreeProps = {children: 'childRoleList', label: 'roleName'}
|
|
@@ -137,10 +159,16 @@ const ElTreeData = ref([{
|
|
|
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
- userStore.getContractId,
|
|
|
- props.users
|
|
|
-], ([UserContractId,users]) => {
|
|
|
- contractId.value = UserContractId
|
|
|
+ props.users,
|
|
|
+ props.projectId,
|
|
|
+ props.contractId,
|
|
|
+ props.type,
|
|
|
+ props.typeData
|
|
|
+], ([users, pid, cid, type, data]) => {
|
|
|
+ projectId.value = pid
|
|
|
+ contractId.value = cid
|
|
|
+ isTypes.value = type
|
|
|
+ typeDatas.value = data
|
|
|
setUserDataList(users)
|
|
|
})
|
|
|
|
|
@@ -239,27 +267,65 @@ const upSortClick = (index) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//事件
|
|
|
const emit = defineEmits(['change'])
|
|
|
|
|
|
//确认选择
|
|
|
+const sureSignUserLoading = ref(false)
|
|
|
const sureSignUserClick = () => {
|
|
|
- const dataList = JSON.parse(JSON.stringify(checkboxUserList.value))
|
|
|
+ let type = isTypes.value, flowJson = {}, newUser = [], newUserId = [], users = '';
|
|
|
+ const dataList = deepClone(checkboxUserList.value)
|
|
|
UserDataList.value = dataList
|
|
|
- showModal.value = false
|
|
|
- //处理数据格式
|
|
|
- let users = ''
|
|
|
if (dataList.length > 0) {
|
|
|
+ sureSignUserLoading.value = true
|
|
|
+ //判断类型
|
|
|
+ if (type === 'first') {
|
|
|
+ flowJson['firstId'] = typeDatas.value
|
|
|
+ } else if (type === 'log') {
|
|
|
+ flowJson['theLogPrimaryKeyId'] = typeDatas.value
|
|
|
+ } else if (type === 'wbs') {
|
|
|
+ flowJson['privatePKeyId'] = typeDatas.value
|
|
|
+ }
|
|
|
+ //封装数据
|
|
|
dataList.forEach(item => {
|
|
|
- if (users) {
|
|
|
- users += ',' + item
|
|
|
- } else {
|
|
|
- users = item
|
|
|
+ const itemArr = item.split('-')
|
|
|
+ if (itemArr.length > 0 && itemArr[0]) {
|
|
|
+ users = users ? `${users},item` : item
|
|
|
+ newUser.push({
|
|
|
+ userId: itemArr[1],
|
|
|
+ userName: itemArr[0],
|
|
|
+ })
|
|
|
+ newUserId.push(itemArr[1])
|
|
|
}
|
|
|
})
|
|
|
+ //效验人员
|
|
|
+ if (type === 'first' || type === 'log' || type === 'wbs') {
|
|
|
+ getCheckCustomFlowUserIsEVisaPermissions(flowJson, newUser, newUserId, users)
|
|
|
+ } else {
|
|
|
+ sureSignUserLoading.value = false
|
|
|
+ emit('change', [], [], '')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('请先选择任务人员,或点击取消')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
|
|
|
+const getCheckCustomFlowUserIsEVisaPermissions = async (flowJson, newUser, newUserId, users) => {
|
|
|
+ const { error, code, data } = await checkCustomFlowUserIsEVisaPermissions({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ customFlowUserList: newUserId,
|
|
|
+ ...flowJson
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ sureSignUserLoading.value = false
|
|
|
+ if (!error && code === 200 && data === true) {
|
|
|
+ showModal.value = false
|
|
|
+ emit('change', newUser, newUserId, users)
|
|
|
+ } else {
|
|
|
+ emit('change', [], [], '')
|
|
|
}
|
|
|
- emit('change', users)
|
|
|
}
|
|
|
</script>
|
|
|
|