Browse Source

任务流程

ZaiZai 1 year ago
parent
commit
3c352412d5

+ 85 - 0
src/api/modules/tasks/flow.js

@@ -0,0 +1,85 @@
+import { HcApi } from '../../request/index'
+
+export default {
+    //分页数据
+    async getPageData(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/page',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //获取系统所有角色划分
+    async queryAllRoleList(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/queryAllRoleList',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //详情
+    async queryFixedFlowDetail(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/detail',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //新增
+    async addFixedFlowData(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/save',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //修改
+    async updateFixedFlowData(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/update',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //删除
+    async removeFixedFlowData(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/fixedFlow/remove',
+            method: 'post',
+            params: form,
+        }, msg)
+    },
+    //检查任务人是否存在签字证书信息
+    async checkTaskUserCertificateInfo(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-archive/archiveTask/checkTaskUserCertificateInfo',
+            method: 'post',
+            params: form,
+        }, msg)
+    },
+    //批量上报
+    async batchReportTaskArchive(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/task/batch-report-task-archive',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+    //批量认证
+    async batchCertification(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-archive/archiveTask/batchCertification',
+            method: 'post',
+            params: form,
+        }, msg)
+    },
+    //批量撤销 //数据类型,=1表示档案文件收集处的废除;=2时表示任务审批处的废除
+    async batchRepealTaskArchive(form, msg = true) {
+        return HcApi({
+            url: '/api/blade-business/task/batch-repeal-task-archive',
+            method: 'post',
+            data: form,
+        }, msg)
+    },
+
+}

+ 32 - 172
src/components/hc-tasks-user/index.vue

@@ -11,36 +11,25 @@
         </div>
 
         <!-- 选择任务人 -->
-        <hc-new-dialog v-model="showModal" ui="hc-modal-border hc-modal-nop" title="选择任务人" widths="62rem">
+        <el-dialog v-model="showModal" title="选择任务人" width="62rem" class="hc-modal-border hc-modal-nop" draggable destroy-on-close append-to-body>
             <div class="hc-tasks-user-modal-content-box">
                 <div class="tree-box">
                     <el-scrollbar>
-                        <ElTree
-                            v-if="isShowTree"
-                            :data="ElTreeData" :default-expanded-keys="[0]" :props="ElTreeProps" accordion
-                            class="hc-tree-node-box" highlight-current node-key="roleId"
-                            @node-click="ElTreeNodeClick"
-                        />
+                        <ElTree class="hc-tree-node-box" :props="ElTreeProps" :data="ElTreeData" node-key="roleId" highlight-current accordion :default-expanded-keys="[0]" @node-click="ElTreeNodeClick" />
                     </el-scrollbar>
                 </div>
                 <div class="user-box">
                     <div class="y-user-list-box">
                         <div class="title-box">
-                            <div class="title">
-                                可选择
-                            </div>
+                            <div class="title">可选择</div>
                         </div>
                         <div class="user-list">
                             <el-scrollbar>
                                 <el-checkbox-group v-model="checkboxUserList">
-                                    <template v-for="item in signUserList">
+                                    <template v-for="item in signUserList" :key="item.certificateUserId">
                                         <div class="user-item checkbox-li">
-                                            <el-checkbox
-                                                :label="`${item.certificateUserName}-${item.certificateUserId}`"
-                                            >
-                                                <div class="item-user-name">
-                                                    {{ item.certificateUserName }}
-                                                </div>
+                                            <el-checkbox :label="`${item.certificateUserName}-${item.certificateUserId}`">
+                                                <div class="item-user-name">{{ item.certificateUserName }}</div>
                                             </el-checkbox>
                                         </div>
                                     </template>
@@ -50,19 +39,13 @@
                     </div>
                     <div class="s-user-list-box">
                         <div class="title-box">
-                            <div class="title">
-                                已选择({{ checkboxUserList.length }})
-                            </div>
-                            <el-button plain size="small" @click="sequenceModal = true">
-                                调整顺序
-                            </el-button>
+                            <div class="title">已选择({{ checkboxUserList.length }})</div>
+                            <el-button plain size="small" @click="sequenceModal = true">调整顺序</el-button>
                         </div>
                         <div class="user-list">
                             <el-scrollbar>
                                 <template v-for="(item, index) in checkboxUserList" :key="index">
-                                    <el-tag closable @close="delCheckboxUser(index)">
-                                        {{ setCheckboxUserName(item) }}
-                                    </el-tag>
+                                    <el-tag closable @close="delCheckboxUser(index)">{{ setCheckboxUserName(item) }}</el-tag>
                                 </template>
                             </el-scrollbar>
                         </div>
@@ -71,46 +54,33 @@
             </div>
             <template #footer>
                 <div class="dialog-footer">
-                    <el-button size="large" @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>
-                    <el-button :loading="sureSignUserLoading" hc-btn type="primary" @click="sureSignUserClick">
+                    <el-button hc-btn type="primary" :loading="sureSignUserLoading" @click="sureSignUserClick">
                         <HcIcon name="check" />
                         <span>确定</span>
                     </el-button>
                 </div>
             </template>
-        </hc-new-dialog>
+        </el-dialog>
 
         <!-- 调整顺序 -->
-        <hc-new-dialog v-model="sequenceModal" ui="hc-modal-border" title="调整顺序" widths="38rem">
-            <el-alert :closable="false" title="可拖动排序,也可在后面点击图标,切换排序" type="warning" />
+        <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">
-                    <div class="index-box">
-                        序号
-                    </div>
-                    <div class="title-box">
-                        任务人
-                    </div>
-                    <div class="icon-box">
-                        排序
-                    </div>
+                    <div class="index-box">序号</div>
+                    <div class="title-box">任务人</div>
+                    <div class="icon-box">排序</div>
                 </div>
             </div>
-            <Draggable
-                :list="checkboxUserList" class="sort-node-body-box list-group" ghost-class="ghost" item-key="id"
-                @end="sortNodeDrag = false" @start="sortNodeDrag = true"
-            >
+            <Draggable class="sort-node-body-box list-group" ghost-class="ghost" :list="checkboxUserList" item-key="id" @start="sortNodeDrag = true" @end="sortNodeDrag = false">
                 <template #item="{ element, index }">
                     <div class="list-group-item">
-                        <div class="index-box">
-                            {{ index + 1 }}
-                        </div>
-                        <div class="title-box">
-                            {{ setCheckboxUserName(element) }}
-                        </div>
+                        <div class="index-box">{{ index + 1 }}</div>
+                        <div class="title-box">{{ setCheckboxUserName(element) }}</div>
                         <div class="icon-box">
                             <span class="icon" @click="downSortClick(index)">
                                 <HcIcon name="arrow-down" ui="text-lg" />
@@ -124,23 +94,18 @@
             </Draggable>
             <template #footer>
                 <div class="dialog-footer">
-                    <el-button size="large" @click="sequenceModal = false">
-                        取消
-                    </el-button>
-                    <el-button hc-btn type="primary" @click="sequenceModal = false">
-                        确认
-                    </el-button>
+                    <el-button size="large" @click="sequenceModal = false">取消</el-button>
+                    <el-button type="primary" hc-btn @click="sequenceModal = false">确认</el-button>
                 </div>
             </template>
-        </hc-new-dialog>
+        </el-dialog>
     </div>
 </template>
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
-//import tasksFlowApi from '~api/tasks/flow'
+import tasksFlowApi from '~api/tasks/flow'
 import { deepClone, getArrValue } from 'js-fast-way'
-//import { checkCustomFlowUserIsEVisaPermissions, checkCustomFlowUserIsEVisaPermissionsquery } from '~api/other'
 import Draggable from 'vuedraggable'
 
 //参数
@@ -162,31 +127,6 @@ const props = defineProps({
         type: [String, Number],
         default: '',
     },
-    type: { //first,log,wbs
-        type: [String, Number],
-        default: '',
-    },
-    typeData: {
-        type: [String, Number, Array, Object],
-        default: '',
-    },
-    classifyType: {
-        type: [String, Number],
-        default: '',
-    },
-    tableOwner: {
-        type: [String, Number],
-        default: '',
-    },
-    nodeId: {
-        type: [String, Number],
-        default: '', //选中节点nodeid
-    },
-    infoIds:{
-        type: [String, Number],
-        default: '', //上报任务ID
-    },
-
 })
 
 //事件
@@ -198,12 +138,6 @@ 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 classifyType = ref(props.classifyType)
-const tableOwner = ref(props.tableOwner)
-const nodeId = ref(props.nodeId)
-const infoIds = ref(props.infoIds)
 
 //树数据
 const ElTreeProps = { children: 'childRoleList', label: 'roleName' }
@@ -213,28 +147,16 @@ const ElTreeData = ref([{
     childRoleList: [],
     signPfxFileList: [],
 }])
-const isShowTree = ref(true)
+
 //监听
 watch(() => [
     props.users,
     props.projectId,
     props.contractId,
-    props.type,
-    props.typeData,
-    props.classifyType,
-    props.tableOwner,
-    props.nodeId,
-    props.infoIds,
-], ([users, pid, cid, type, data, cla, tab, noid, infoid]) => {
+], ([users, pid, cid]) => {
     projectId.value = pid
     contractId.value = cid
-    isTypes.value = type
-    typeDatas.value = data
     setUserDataList(users)
-    classifyType.value = cla
-    tableOwner.value = tab
-    nodeId.value = noid
-    infoIds.value = infoid
 })
 
 //渲染完成
@@ -263,11 +185,9 @@ const showModalClick = () => {
 //获取系统所有角色划分
 const signUserList = ref([])
 const queryAllRoleList = async () => {
-    isShowTree.value = false
-    /*const { error, code, data } = await tasksFlowApi.queryAllRoleList({
+    const { error, code, data } = await tasksFlowApi.queryAllRoleList({
         contractId: contractId.value,
     })
-    isShowTree.value = true
     //处理数据
     if (!error && code === 200) {
         let signList = [], dataArr = getArrValue(data)
@@ -283,7 +203,7 @@ const queryAllRoleList = async () => {
         signUserList.value = []
         ElTreeData.value[0].childRoleList = []
         ElTreeData.value[0].signPfxFileList = []
-    }*/
+    }
 }
 
 //树被点击
@@ -337,21 +257,11 @@ const upSortClick = (index) => {
 //确认选择
 const sureSignUserLoading = ref(false)
 const sureSignUserClick = () => {
-    let type = isTypes.value, flowJson = {}, newUser = [], newUserId = [], users = ''
+    let newUser = [], newUserId = [], users = ''
     const dataList = deepClone(checkboxUserList.value)
     UserDataList.value = dataList
     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
-        } else if (type === 'query') {
-            flowJson['privatePKeyId'] = typeDatas.value
-        }
         //封装数据
         dataList.forEach(item => {
             const itemArr = item.split('-')
@@ -364,62 +274,12 @@ const sureSignUserClick = () => {
                 newUserId.push(itemArr[1])
             }
         })
-        //效验人员
-        if (type === 'first' || type === 'log' || type === 'wbs') {
-            getCheckCustomFlowUserIsEVisaPermissions(flowJson, newUser, newUserId, users)
-        } else if (type === 'query') {
-            getCheckCustomFlowUserIsEVisaPermissionsquery(flowJson, newUser, newUserId, users)
-        } else {
-            showModal.value = false
-            sureSignUserLoading.value = false
-            emit('change', newUser, newUserId, users)
-        }
-    } 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,
-        classifyType:classifyType.value,
-        tableOwner:tableOwner.value,
-        nodeId:nodeId.value,
-
-    })
-    //处理数据
-    sureSignUserLoading.value = false
-    if (!error && code === 200 && data === true) {
         showModal.value = false
+        sureSignUserLoading.value = false
         emit('change', newUser, newUserId, users)
     } else {
-        emit('change', [], [], '')
-    }*/
-}
-//资料查询页面
-const getCheckCustomFlowUserIsEVisaPermissionsquery = async (flowJson, newUser, newUserId, users) => {
-    /*const { error, code, data } = await checkCustomFlowUserIsEVisaPermissionsquery({
-        projectId: projectId.value,
-        contractId: contractId.value,
-        customFlowUserList: newUserId,
-        ...flowJson,
-        nodeId:nodeId.value,
-        classifyType:classifyType.value,
-        tableOwner:tableOwner.value,
-        infoIds:infoIds.value,
-    })
-    //处理数据
-    sureSignUserLoading.value = false
-    if (!error && code === 200 && data === true) {
-        showModal.value = false
-        emit('change', newUser, newUserId, users)
-    } else {
-        emit('change', [], [], '')
-    }*/
+        window.$message?.warning('请先选择任务人员,或点击取消')
+    }
 }
 </script>
 

+ 6 - 0
src/components/hc-tasks-user/style.scss

@@ -145,3 +145,9 @@
         }
     }
 }
+
+html.dark {
+    .hc-tasks-user .tasks-user-box {
+        border-color: var(--el-color-primary);
+    }
+}

+ 87 - 9
src/views/tasks/flow.vue

@@ -9,7 +9,7 @@
         <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
             <template #action="{ row }">
                 <el-link type="success" @click="handleTableEdit(row)">修改</el-link>
-                <el-link type="danger">删除</el-link>
+                <el-link type="danger" @click="handleTableDel(row)">删除</el-link>
             </template>
         </hc-table>
         <template #action>
@@ -38,6 +38,9 @@
 <script setup>
 import { onMounted, ref } from 'vue'
 import { useAppStore } from '~src/store'
+import { getArrValue, getObjValue } from 'js-fast-way'
+import tasksFlowApi from '~api/tasks/flow'
+import { delMessage } from '~uti/tools'
 
 //变量
 const store = useAppStore()
@@ -46,13 +49,11 @@ const contractId = ref(store.getContractId)
 
 //渲染完成
 onMounted(() => {
-
+    getTableData()
 })
 
 //搜索表单
-const searchForm = ref({
-    key1: null, current: 1, size: 10, total: 0,
-})
+const searchForm = ref({ current: 1, size: 10, total: 0 })
 
 //分页
 const pageChange = ({ current, size }) => {
@@ -67,9 +68,25 @@ const tableColumn = ref([
     { key: 'linkUserJoinString', name: '流程详情' },
     { key: 'action', name: '操作', width: 94 },
 ])
-const tableData = ref([
-    { fixedFlowName: '1111' },
-])
+const tableData = ref([])
+
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await tasksFlowApi.getPageData({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        ...searchForm.value,
+    })
+    //处理数据
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
+}
 
 //新建流程
 const addFlowData = () => {
@@ -77,10 +94,27 @@ const addFlowData = () => {
     showEditModal.value = true
 }
 
+
 //编辑流程
 const handleTableEdit = async (row) => {
     flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
     showEditModal.value = true
+    const { error, code, data } = await tasksFlowApi.queryFixedFlowDetail({ id: row?.id })
+    if (!error && code === 200) {
+        let users = '', res = getObjValue(data)
+        const list = getArrValue(res['fixedFlowLinkList'])
+        for (let i = 0; i < list.length; i++) {
+            const item = getObjValue(list[i])
+            if (users) {
+                users += `,${item['fixedFlowLinkUserName']}-${item['fixedFlowLinkUser']}`
+            } else {
+                users = `${item['fixedFlowLinkUserName']}-${item['fixedFlowLinkUser']}`
+            }
+        }
+        flowFormData.value = { id: res.id, fixedFlowName: res.fixedFlowName, linkUserJoinString: users }
+    } else {
+        flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
+    }
 }
 
 //新增编辑数据
@@ -109,6 +143,50 @@ const tasksUserChange = (a, b, users) => {
 const sevaLoading = ref(false)
 const saveFormClick = async () => {
     const form = flowFormData.value
-    console.log(form)
+    if (!form.id) {
+        sevaLoading.value = true
+        const { error, code } = await tasksFlowApi.addFixedFlowData({
+            ...form,
+            projectId: projectId.value,
+            contractId: contractId.value,
+        })
+        //处理数据
+        sevaLoading.value = false
+        if (!error && code === 200) {
+            showEditModal.value = false
+            window?.$message?.success('保存成功')
+            getTableData().then()
+        }
+    } else {
+        sevaLoading.value = true
+        const { error, code } = await tasksFlowApi.updateFixedFlowData({
+            ...form,
+            projectId: projectId.value,
+            contractId: contractId.value,
+        })
+        //处理数据
+        sevaLoading.value = false
+        if (!error && code === 200) {
+            showEditModal.value = false
+            window?.$message?.success('保存成功')
+            getTableData().then()
+        }
+    }
+}
+
+//删除
+const handleTableDel = (row) => {
+    delMessage(async () => {
+        const { error, code } = await tasksFlowApi.removeFixedFlowData({
+            ids: row?.id || '',
+            projectId: projectId.value,
+            contractId: contractId.value,
+        })
+        //处理数据
+        if (!error && code === 200) {
+            window.$message?.success('删除成功')
+            getTableData().then()
+        }
+    })
 }
 </script>