ZaiZai 3 месяцев назад
Родитель
Сommit
57e41a2630
1 измененных файлов с 208 добавлено и 219 удалено
  1. 208 219
      src/views/ledger/components/table-list.vue

+ 208 - 219
src/views/ledger/components/table-list.vue

@@ -3,24 +3,11 @@
         <HcNewCard>
             <template #header>
                 <div class="w-64">
-                    <HcDatePicker
-                        :dates="betweenTime"
-                        clearable
-                        @change="betweenTimeUpdate"
-                    />
+                    <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
                 </div>
-                <div class="w-40 ml-3">
-                    <el-select
-                        v-model="searchForm.createUser"
-                        block
-                        clearable
-                        placeholder="请选择记录人"
-                    >
-                        <el-option
-                            v-for="item in recordData"
-                            :label="item.userName"
-                            :value="item.userId"
-                        />
+                <div class="ml-3 w-40">
+                    <el-select v-model="searchForm.createUser" clearable block placeholder="请选择记录人">
+                        <el-option v-for="item in recordData" :key="item.userId" :label="item.userName" :value="item.userId" />
                     </el-select>
                 </div>
                 <div class="ml-2">
@@ -86,8 +73,9 @@
                     hc-btn
                     type="primary"
                     @click="resignClick"
-                    >re-sign</el-button
                 >
+                    re-sign
+                </el-button>
             </template>
             <HcTable
                 ref="tableListRef"
@@ -100,15 +88,21 @@
                 :check-style="{ width: 29 }"
                 @selection-change="tableSelectionChange"
             >
+                <template #taskApproveUserNamesList="{ row }">
+                    <template v-for="item in row.taskApproveUserNamesList">
+                        <el-tag
+                            v-if="item.taskUserName"
+                            :type="`${item.evisaStatus === 2 ? 'success' : item.evisaStatus === 3 ? 'warning' : item.evisaStatus === 999 ? 'danger' : 'info'}`" class="mx-1" effect="dark"
+                        >
+                            {{ item.taskUserName }}
+                        </el-tag>
+                    </template>
+                </template>
                 <template #action="{ row }">
                     <HcTooltip keys="ledger_query_table_query">
-                        <el-button
-                            plain
-                            size="small"
-                            type="primary"
-                            @click="handleTableQuery(row)"
-                            >查询</el-button
-                        >
+                        <el-button plain size="small" type="primary" @click="handleTableQuery(row)">
+                            查询
+                        </el-button>
                     </HcTooltip>
                     <HcTooltip keys="ledger_query_table_del">
                         <el-button
@@ -166,393 +160,388 @@
 </template>
 
 <script setup>
-import { nextTick, ref, watch } from "vue";
-import queryApi from "~api/ledger/query";
-import { eVisaTaskCheckApi } from "~api/other";
-import {
-    arrToId,
-    getArrValue,
-    getObjValue,
-    isString,
-    arrToKey,
-} from "js-fast-way";
-import { toPdfPage } from "~uti/btn-auth";
+import { nextTick, ref, watch } from 'vue'
+import queryApi from '~api/ledger/query'
+import { eVisaTaskCheckApi } from '~api/other'
+import { arrToId, arrToKey, getArrValue, getObjValue, isString } from 'js-fast-way'
+import { toPdfPage } from '~uti/btn-auth'
 
 //参数
 const props = defineProps({
     projectId: {
         type: [String, Number],
-        default: "",
+        default: '',
     },
     contractId: {
         type: [String, Number],
-        default: "",
+        default: '',
     },
     items: {
         type: Object,
         default: () => ({}),
     },
-});
+})
 
 //变量
-const projectId = ref(props.projectId);
-const contractId = ref(props.contractId);
-const menuItem = ref(props.items);
+const projectId = ref(props.projectId)
+const contractId = ref(props.contractId)
+const menuItem = ref(props.items)
 
 //监听
 watch(
     () => [props.projectId, props.contractId, props.items],
     ([pid, cid, item]) => {
-        projectId.value = pid;
-        contractId.value = cid;
-        menuItem.value = item;
-        getQueryData();
-    }
-);
+        projectId.value = pid
+        contractId.value = cid
+        menuItem.value = item
+        getQueryData()
+    },
+)
 
 //渲染完成
 nextTick(() => {
-    getQueryData();
-});
+    getQueryData()
+})
 
 //获取相关数据
 const getQueryData = () => {
-    searchClick();
-    queryFillUser();
-};
+    searchClick()
+    queryFillUser()
+}
 
 //获取记录人数据
-const recordData = ref([]);
+const recordData = ref([])
 const queryFillUser = async () => {
-    const { primaryKeyId } = menuItem.value;
+    const { primaryKeyId } = menuItem.value
     const { data } = await queryApi.queryFillUser({
         contractId: contractId.value,
         primaryKeyId: primaryKeyId,
-    });
-    recordData.value = getArrValue(data);
-};
+    })
+    recordData.value = getArrValue(data)
+}
 
 //搜索表单
 const searchForm = ref({
-    queryTime: "",
+    queryTime: '',
     createUser: null,
     current: 1,
     size: 20,
     total: 0,
-});
+})
 
 //日期时间被选择
-const betweenTime = ref(null);
+const betweenTime = ref(null)
 const betweenTimeUpdate = ({ arr, query }) => {
-    betweenTime.value = arr;
-    searchForm.value.queryTime = query;
-};
+    betweenTime.value = arr
+    searchForm.value.queryTime = query
+}
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
-    getTableData();
-};
+    searchForm.value.current = 1
+    getTableData()
+}
 
 //分页被点击
 const pageChange = ({ current, size }) => {
-    searchForm.value.current = current;
-    searchForm.value.size = size;
-    getTableData();
-};
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
 
 //获取数据
-const tableLoading = ref(false);
+const tableLoading = ref(false)
 const tableListColumn = ref([
-    { key: "recordTime", name: "记录日期" },
-    { key: "statusValue", name: "流程状态" },
-    { key: "createUserName", name: "记录人员" },
-    { key: "action", name: "操作", width: 200 },
-]);
-const tableListData = ref([]);
+    { key: 'recordTime', name: '记录日期' },
+    { key: 'statusValue', name: '流程状态' },
+    { key: 'createUserName', name: '记录人员' },
+    { key: 'taskApproveUserNamesList', name: '电签任务人' },
+    { key: 'action', name: '操作', width: 200 },
+])
+const tableListData = ref([])
 const getTableData = async () => {
     //初始数据处理
-    tableLoading.value = true;
-    const { primaryKeyId } = menuItem.value;
-    tableListRef.value?.clearSelection();
-    tableCheckedKeys.value = [];
+    tableLoading.value = true
+    const { primaryKeyId } = menuItem.value
+    tableListRef.value?.clearSelection()
+    tableCheckedKeys.value = []
     //请求数据
     const { error, code, data } = await queryApi.constructionLogPage({
         ...searchForm.value,
         wbsNodeId: primaryKeyId,
         projectId: projectId.value,
         contractId: contractId.value,
-    });
-    console.log(data);
+    })
+    console.log(data)
     //处理数据
-    tableLoading.value = false;
+    tableLoading.value = false
     if (!error && code === 200) {
-        tableListData.value = getArrValue(data["records"]);
-        searchForm.value.total = data.total || 0;
+        tableListData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
     } else {
-        tableListData.value = [];
-        searchForm.value.total = 0;
+        tableListData.value = []
+        searchForm.value.total = 0
     }
-};
+}
 
 //多选
-const tableListRef = ref(null);
-const tableCheckedKeys = ref([]);
+const tableListRef = ref(null)
+const tableCheckedKeys = ref([])
 const tableSelectionChange = (rows) => {
     tableCheckedKeys.value = rows.filter((item) => {
-        return (item ?? "") !== "";
-    });
-};
+        return (item ?? '') !== ''
+    })
+}
 
 //批量上报
-const reportIds = ref("");
-const reportTaskName = ref("");
-const reportDatas = ref([]);
-const reportLoading = ref(false);
-const showReportModal = ref(false);
+const reportIds = ref('')
+const reportTaskName = ref('')
+const reportDatas = ref([])
+const reportLoading = ref(false)
+const showReportModal = ref(false)
 const reportModalClick = async () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     //判断是否满足条件
     const result = rows.every(({ status }) => {
-        return status !== 1 && status !== 2;
-    });
+        return status !== 1 && status !== 2
+    })
     //判断状态
     if (result) {
-        reportLoading.value = true;
+        reportLoading.value = true
         const taskCheck = await eVisaTaskCheckApi({
             projectId: projectId.value,
             contractId: contractId.value,
-        });
+        })
         if (taskCheck) {
             //初始ID
-            const row = getObjValue(rows[0]);
-            reportIds.value = arrToId(rows);
+            const row = getObjValue(rows[0])
+            reportIds.value = arrToId(rows)
             //设置任务数据
-            let reportDataArr = [];
+            let reportDataArr = []
             rows.forEach((item) => {
                 reportDataArr.push({
                     id: item?.id,
                     name: item?.fileName,
-                });
-            });
-            reportDatas.value = reportDataArr;
+                })
+            })
+            reportDatas.value = reportDataArr
             //设置任务名称
-            reportTaskName.value =
-                rows.length > 1
+            reportTaskName.value
+                = rows.length > 1
                     ? `${row.fileName}等${rows.length}个文件`
-                    : row.fileName;
-            reportLoading.value = false;
-            showReportModal.value = true;
+                    : row.fileName
+            reportLoading.value = false
+            showReportModal.value = true
         } else {
-            reportLoading.value = false;
+            reportLoading.value = false
         }
     } else {
         window.$message?.warning(
-            "已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报"
-        );
+            '已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报',
+        )
     }
-};
+}
 
 //上报的审批内容移除
 const reportTaskTagClose = (index) => {
-    const row = tableCheckedKeys.value[index];
-    tableListRef.value?.toggleRowSelection(row, false);
-};
+    const row = tableCheckedKeys.value[index]
+    tableListRef.value?.toggleRowSelection(row, false)
+}
 
 //上报完成
 const showReportFinish = () => {
-    showReportModal.value = false;
-    getTableData();
-};
+    showReportModal.value = false
+    getTableData()
+}
 
 //批量废除
-const abolishLoading = ref(false);
+const abolishLoading = ref(false)
 const batchAbolishClick = () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     //判断是否满足条件
     const result = rows.every(({ status, operation }) => {
-        return status !== 0 && status !== 3 && operation;
-    });
+        return status !== 0 && status !== 3 && operation
+    })
     //判断状态
     if (result) {
         //拼接ID
-        const ids = arrToId(rows);
-        window?.$messageBox?.alert("是否废除勾选的已上报文件?", "废除文件", {
+        const ids = arrToId(rows)
+        window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
             showCancelButton: true,
-            confirmButtonText: "确定废除",
-            cancelButtonText: "取消",
+            confirmButtonText: '确定废除',
+            cancelButtonText: '取消',
             callback: (action) => {
-                if (action === "confirm") {
-                    batchAbolishSave(ids);
+                if (action === 'confirm') {
+                    batchAbolishSave(ids)
                 }
             },
-        });
+        })
     } else {
-        window.$message?.warning("未上报的文件,和不是自己的文件,不能废除");
+        window.$message?.warning('未上报的文件,和不是自己的文件,不能废除')
     }
-};
+}
 
 //废除勾选的已上报文件
 const batchAbolishSave = async (ids) => {
-    abolishLoading.value = true;
+    abolishLoading.value = true
     const { error, code } = await queryApi.batchAbolish({
         ids: ids,
         projectId: projectId.value,
         contractId: contractId.value,
-    });
+    })
     //处理数据
-    abolishLoading.value = false;
+    abolishLoading.value = false
     if (!error && code === 200) {
-        window.$message?.success("批量废除成功");
-        tableCheckedKeys.value = [];
-        getTableData();
+        window.$message?.success('批量废除成功')
+        tableCheckedKeys.value = []
+        getTableData()
     }
-};
+}
 
 //批量删除
 const batchDeleteClick = () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     //判断是否满足条件
     const result = rows.every(({ status, operation }) => {
-        return status === 0 && operation;
-    });
+        return status === 0 && operation
+    })
     //判断状态
     if (result) {
-        const ids = arrToId(rows);
-        window?.$messageBox?.alert("是否删除勾选的日志文件?", "删除文件", {
+        const ids = arrToId(rows)
+        window?.$messageBox?.alert('是否删除勾选的日志文件?', '删除文件', {
             showCancelButton: true,
-            confirmButtonText: "确定删除",
-            cancelButtonText: "取消",
+            confirmButtonText: '确定删除',
+            cancelButtonText: '取消',
             callback: (action) => {
-                if (action === "confirm") {
-                    theLogRemoveByIds(ids);
+                if (action === 'confirm') {
+                    theLogRemoveByIds(ids)
                 }
             },
-        });
+        })
     } else {
-        window.$message?.warning("只能删除自己的未上报日志文件");
+        window.$message?.warning('只能删除自己的未上报日志文件')
     }
-};
+}
 
 //预览、打印
-const previewPrintLoading = ref(false);
+const previewPrintLoading = ref(false)
 const previewAndPrintClick = async () => {
-    previewPrintLoading.value = true;
-    const rows = tableCheckedKeys.value;
-    const rowsIds = arrToId(rows);
-    const ids = rowsIds.split(",");
+    previewPrintLoading.value = true
+    const rows = tableCheckedKeys.value
+    const rowsIds = arrToId(rows)
+    const ids = rowsIds.split(',')
     const { error, code, data } = await queryApi.theLogPreviewAndPrint({
         ids: ids,
-    });
+    })
     //处理数据
-    previewPrintLoading.value = false;
-    const res = isString(data) ? data || "" : "";
+    previewPrintLoading.value = false
+    const res = isString(data) ? data || '' : ''
     if (!error && code === 200 && res) {
-        toPdfPage(res);
+        toPdfPage(res)
         //window.open(res, '_blank')
     }
-};
+}
 
 //查询
 const handleTableQuery = ({ evisaPdfUrl, pdfUrl }) => {
     if (evisaPdfUrl) {
-        toPdfPage(evisaPdfUrl);
+        toPdfPage(evisaPdfUrl)
         //window.open(evisaPdfUrl, '_blank')
     } else if (pdfUrl) {
-        toPdfPage(pdfUrl);
+        toPdfPage(pdfUrl)
         //window.open(pdfUrl, '_blank')
     } else {
-        window.$message?.warning("该数据暂无PDF");
+        window.$message?.warning('该数据暂无PDF')
     }
-};
+}
 
 //删除
 const handleTableDel = ({ id, status, operation }) => {
     //判断是否满足条件
     if (status === 0 && operation) {
-        window?.$messageBox?.alert("是否删除勾选的日志文件?", "删除文件", {
+        window?.$messageBox?.alert('是否删除勾选的日志文件?', '删除文件', {
             showCancelButton: true,
-            confirmButtonText: "确定删除",
-            cancelButtonText: "取消",
+            confirmButtonText: '确定删除',
+            cancelButtonText: '取消',
             callback: (action) => {
-                if (action === "confirm") {
-                    theLogRemoveByIds([id]);
+                if (action === 'confirm') {
+                    theLogRemoveByIds([id])
                 }
             },
-        });
+        })
     } else {
-        window.$message?.warning("只能删除自己的未上报日志文件");
+        window.$message?.warning('只能删除自己的未上报日志文件')
     }
-};
+}
 
 //删除
-const deleteLoading = ref(false);
+const deleteLoading = ref(false)
 const theLogRemoveByIds = async (ids) => {
-    deleteLoading.value = true;
+    deleteLoading.value = true
     const { error, code } = await queryApi.theLogRemoveByIds({
         ids: ids,
-    });
-    deleteLoading.value = false;
+    })
+    deleteLoading.value = false
     if (!error && code === 200) {
-        window.$message?.success("删除成功");
-        tableCheckedKeys.value = [];
-        getTableData();
+        window.$message?.success('删除成功')
+        tableCheckedKeys.value = []
+        getTableData()
     }
-};
+}
 
 //一键重签
-const signLoading = ref(false);
-const resignModal = ref(false);
-const resignModalRadio = ref(0);
+const signLoading = ref(false)
+const resignModal = ref(false)
+const resignModalRadio = ref(0)
 const resignClick = async () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     if (rows.length <= 0) {
-        window.$message?.warning("请先勾选已审批的数据");
-        return;
+        window.$message?.warning('请先勾选已审批的数据')
+        return
     }
-    resignModal.value = true;
-};
-const excelIdVal = ref("");
+    resignModal.value = true
+}
+const excelIdVal = ref('')
 const signClick = async () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     //获取任务id
-    const taskIds = arrToKey(rows, "id");
-    const idsArr = taskIds.split(",");
-    let isCan = idsArr.some((ele) => ele === "" || ele == -1);
-    console.log(isCan, "isCan");
+    const taskIds = arrToKey(rows, 'id')
+    const idsArr = taskIds.split(',')
+    let isCan = idsArr.some((ele) => ele === '' || ele == -1)
+    console.log(isCan, 'isCan')
     if (isCan) {
-        window.$message?.warning("参数异常,暂不支持该操作");
-        return;
+        window.$message?.warning('参数异常,暂不支持该操作')
+        return
     }
     //发起请求
-    signLoading.value = true;
-    const { primaryKeyId } = menuItem.value;
-    const { excelId } = menuItem.value;
-    excelIdVal.value = excelId > 0 ? excelId + "" : "";
+    signLoading.value = true
+    const { primaryKeyId } = menuItem.value
+    const { excelId } = menuItem.value
+    excelIdVal.value = excelId > 0 ? excelId + '' : ''
     const { error, code, msg } = await queryApi.logReSigningEVisa({
         nodePrimaryKeyId: primaryKeyId,
         logPkeyId: excelIdVal.value,
         type: resignModalRadio.value,
         logIds: taskIds,
         contractId: contractId.value,
-    });
+    })
     //处理数据
-    signLoading.value = false;
+    signLoading.value = false
 
     if (!error && code === 200) {
         window.$message?.success(
-            msg ?? "提交成功,请请耐心等待重签,可继续操作其它的功能。"
-        );
-        getTableData().then();
+            msg ?? '提交成功,请请耐心等待重签,可继续操作其它的功能。',
+        )
+        getTableData().then()
     } else {
-        window.$message?.error(msg ?? "操作失败");
+        window.$message?.error(msg ?? '操作失败')
     }
-    resignModal.value = false;
-};
+    resignModal.value = false
+}
 const cancelresign = () => {
-    resignModalRadio.value = 0;
-    resignModal.value = false;
-};
+    resignModalRadio.value = 0
+    resignModal.value = false
+}
 </script>
 
 <style lang="scss" scoped>