Browse Source

填报页单个上报、检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)

iZaiZaiA 2 years ago
parent
commit
2e997de9fa

+ 2 - 2
package.json

@@ -15,7 +15,7 @@
         "js-base64": "^3.7.2",
         "js-cookie": "^3.0.1",
         "js-md5": "^0.7.3",
-        "js-web-screen-shot": "^1.7.4",
+        "js-web-screen-shot": "^1.7.5",
         "nprogress": "^0.2.0",
         "pinia": "^2.0.23",
         "remixicon": "^2.5.0",
@@ -35,6 +35,6 @@
         "unplugin-auto-import": "^0.11.2",
         "unplugin-vue-components": "^0.22.8",
         "vfonts": "^0.0.3",
-        "vite": "^3.1.6"
+        "vite": "^3.1.7"
     }
 }

+ 7 - 0
src/api/modules/other.js

@@ -89,3 +89,10 @@ export const queryFixedFlow = (form, msg = true) => httpApi({
     method: 'post',
     data: form
 }, msg);
+
+//检查所选的流程环节处理人是否具有审批权限(三大填报页、日志列表的批量上报、首件列表的批量上报)
+export const checkCustomFlowUserIsEVisaPermissions = (form, msg = true) => httpApi({
+    url: '/api/blade-business/eVisaTaskCheck/checkCustomFlowUserIsEVisaPermissions',
+    method: 'post',
+    data: form
+}, msg);

+ 44 - 16
src/global/components/hc-report-modal/index.vue

@@ -4,24 +4,24 @@
             <el-form-item label="任务名称" prop="taskName">
                 <el-input v-model="formModel.taskName" disabled/>
             </el-form-item>
-            <el-form-item label="任务描述" path="taskContent">
+            <el-form-item label="任务描述" prop="taskContent">
                 <el-input type="textarea" v-model="formModel.taskContent" placeholder="请输入任务描述" :autosize="{ minRows: 3, maxRows: 5 }"/>
             </el-form-item>
-            <el-form-item label="任务流程" path="fixedFlowId">
+            <el-form-item label="任务流程" prop="fixedFlowId">
                 <el-select v-model="formModel.fixedFlowId" block @change="handleProcessValue">
                     <el-option v-for="item in processData" :label="item.fixedFlowName" :disabled="item.disabled" :value="item.id"/>
                 </el-select>
             </el-form-item>
-            <el-form-item label="任务人" path="user" v-if="false">
-                <HcTasksUser ui="w-full"/>
+            <el-form-item label="任务人" prop="user" v-if="diyProcessUser">
+                <HcTasksUser ui="w-full" :projectId="projectId" :contractId="contractId" :type="type" :typeData="typeData" @change="diyProcessUserChange"/>
             </el-form-item>
-            <el-form-item label="任务人">
+            <el-form-item label="任务人" v-else>
                 <div class="form-item-div">{{linkUserJoinString}}</div>
             </el-form-item>
-            <el-form-item label="上报批次" path="batch">
+            <el-form-item label="上报批次">
                 <HcCounter v-model:value="formModel.batch" @update:modelValue="batchUpdateValue"/>
             </el-form-item>
-            <el-form-item label="限定审批时间" path="restrictDay">
+            <el-form-item label="限定审批时间">
                 <HcCounter v-model:value="formModel.restrictDay" text="(天)" @update:modelValue="restrictDayUpdateValue"/>
             </el-form-item>
         </el-form>
@@ -150,6 +150,7 @@ onMounted(() => {
     getProcessDatasApi()
 })
 
+const processDefaultData = [{ id: 0, fixedFlowName: '自定义流程', disabled: false}]
 const getProcessDatasApi = () => {
     if (isShow.value) {
         const type = isTypes.value
@@ -171,9 +172,10 @@ const getProcessData = async () => {
         current: 1, size: 100
     })
     if (!error && code === 200) {
-        processData.value = getArrValue(data['records'])
+        const arr = getArrValue(data['records'])
+        processData.value = [...processDefaultData, ...arr]
     } else {
-        processData.value = []
+        processData.value = processDefaultData
     }
 }
 
@@ -195,18 +197,31 @@ const queryFixedFlowApi = async (type, datas) => {
         ...flowJson
     })
     if (!error && code === 200) {
-        processData.value = getArrValue(data['records'])
+        const arr = getArrValue(data['records'])
+        processData.value = [...processDefaultData, ...arr]
     } else {
-        processData.value = []
+        processData.value = processDefaultData
     }
 }
 
-
 //流程数据切换
+const diyProcessUser = ref(false)
 const handleProcessValue = (val) => {
-    const list = processData.value
-    const index = getIndex(list, 'id', val)
-    linkUserJoinString.value = list[index]?.linkUserJoinString
+    if (val > 0) {
+        diyProcessUser.value = false
+        const list = processData.value
+        const index = getIndex(list, 'id', val)
+        linkUserJoinString.value = list[index]?.linkUserJoinString
+    } else {
+        linkUserJoinString.value = ''
+        diyProcessUser.value = true
+    }
+}
+
+//自定义流程任务人选择完毕
+const userTasks = ref([])
+const diyProcessUserChange = (user, userId, users) => {
+    userTasks.value = user
 }
 
 //上报批次改变
@@ -219,6 +234,7 @@ const restrictDayUpdateValue = (val) => {
     formModel.value.restrictDay = val
 }
 
+
 const emit = defineEmits(['hide','finish'])
 //取消
 const cancelReportClick = () => {
@@ -235,11 +251,23 @@ const formReportClick = async () => {
 //上报请求
 const formReportLoading = ref(false)
 const batchApprovalApi = async () => {
+    const type = isTypes.value
     formReportLoading.value = true
+    //处理数据
+    let flowJson = {}
+    if (type === 'first') {
+        //flowJson['firstId'] = datas
+    } else if (type === 'log') {
+        //flowJson['theLogPrimaryKeyId'] = datas
+    } else if (type === 'wbs') {
+        flowJson['userTasks'] = userTasks.value
+    }
+    //发起请求
     const { error, code, data } = await ApprovalApi(ApiUrl.value, {
         projectId: projectId.value,
         contractId: contractId.value,
-        ...formModel.value
+        ...formModel.value,
+        ...flowJson
     })
     linkUserJoinString.value = ''
     formReportLoading.value = false

+ 89 - 23
src/global/components/hc-tasks-user/index.vue

@@ -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>
 

+ 1 - 1
src/views/other-file/project-scanning.vue

@@ -184,7 +184,7 @@
                     </HcTable>
                 </div>
                 <div class="flex-iframe" v-if="CertPdf">
-                    <iframe width='100%' height='100%' frameborder='1' :src="CertPdf"></iframe>
+                    <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="CertPdf"></iframe>
                 </div>
                 <div class="flex-iframe hc-no-table-form" v-else>
                     <div class="table-form-no">

+ 1 - 1
src/views/tasks/hc-data.vue

@@ -25,7 +25,7 @@
             </template>
             <div class="hc-card-body-flex">
                 <div class="flex-iframe" v-if="batchPdfUrl">
-                    <iframe width='100%' height='100%' frameborder='1' :src="batchPdfUrl"></iframe>
+                    <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="batchPdfUrl"></iframe>
                 </div>
                 <div class="flex-iframe hc-no-table-form" v-else>
                     <div class="table-form-no">

+ 8 - 8
yarn.lock

@@ -761,10 +761,10 @@ js-md5@^0.7.3:
   resolved "https://registry.yarnpkg.com/js-md5/-/js-md5-0.7.3.tgz#b4f2fbb0b327455f598d6727e38ec272cd09c3f2"
   integrity sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==
 
-js-web-screen-shot@^1.7.4:
-  version "1.7.4"
-  resolved "https://registry.yarnpkg.com/js-web-screen-shot/-/js-web-screen-shot-1.7.4.tgz#f664efd0011b31f73ca2f0db8a434723d7f594db"
-  integrity sha512-Q/RbCPqzhTVIgayj9sRDpzys9klsX14qs++izrRUnmf0HYbFwKnWUyX1+zhlnE4Qo8pJI8XL4uPK2YCYqZJV6w==
+js-web-screen-shot@^1.7.5:
+  version "1.7.5"
+  resolved "https://registry.yarnpkg.com/js-web-screen-shot/-/js-web-screen-shot-1.7.5.tgz#8d634c932ec38edb4202be3fb0fe91f089ef1a57"
+  integrity sha512-mNc3AGi0NERewRIacyoIrBGAsOpI82WYANoUTXDLciPc2EuC9Hx88DAbq1NkKmT5xzEAkA2kdsHN1z9dliX/Lg==
   dependencies:
     html2canvas "^1.0.0-rc.7"
 
@@ -1264,10 +1264,10 @@ vfonts@^0.0.3:
   resolved "https://registry.yarnpkg.com/vfonts/-/vfonts-0.0.3.tgz#999d66fecea18efee3f2b966c81101ae8ce01a29"
   integrity sha512-nguyw8L6Un8eelg1vQ31vIU2ESxqid7EYmy8V+MDeMaHBqaRSkg3dTBToC1PR00D89UzS/SLkfYPnx0Wf23IQQ==
 
-vite@^3.1.6:
-  version "3.1.6"
-  resolved "https://registry.yarnpkg.com/vite/-/vite-3.1.6.tgz#4c6db3000326342c918204a42a130fb3ffed2414"
-  integrity sha512-qMXIwnehvvcK5XfJiXQUiTxoYAEMKhM+jqCY6ZSTKFBKu1hJnAKEzP3AOcnTerI0cMZYAaJ4wpW1wiXLMDt4mA==
+vite@^3.1.7:
+  version "3.1.7"
+  resolved "https://registry.yarnpkg.com/vite/-/vite-3.1.7.tgz#9fc2b57a395f79175d38fa3cffd15080b0d9cbfc"
+  integrity sha512-5vCAmU4S8lyVdFCInu9M54f/g8qbOMakVw5xJ4pjoaDy5wgy9sLLZkGdSLN52dlsBqh0tBqxjaqqa8LgPqwRAA==
   dependencies:
     esbuild "^0.15.9"
     postcss "^8.4.16"