ZaiZai 1 жил өмнө
parent
commit
14ff14be46

+ 49 - 8
src/views/debit-pay/admin/certificate.vue

@@ -2,19 +2,25 @@
     <div class="relative h-full">
         <hc-new-card title="中期支付证书列表">
             <template #extra>
+                <hc-tooltip keys="debit_pay_admin_certificate_recalculate_btn">
+                    <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="warning" :loading="recalculateLoading" @click="recalculateClick">重新计算</el-button>
+                </hc-tooltip>
                 <el-button hc-btn type="primary" @click="addModalClick">
                     <hc-icon name="add" />
                     <span>新增</span>
                 </el-button>
             </template>
-            <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
+            <hc-table
+                :column="tableColumn" :datas="tableData" :loading="tableLoading" :index-style="{ width: 60 }"
+                is-check :check-style="{ width: 29 }" @selection-change="tableSelectionChange"
+            >
                 <template #action="{ row }">
                     <el-link type="primary" :disabled="!row.rawUrl" @click="rowViewRawPdf(row)">查看电签报表</el-link>
                     <el-link type="primary" @click="rowViewPdf(row)">查看报表</el-link>
                     <el-link type="primary" :disabled="row.approveStatus === 0" @click="eVisaRowClick(row)">查看电签流程</el-link>
                     <el-link type="success" :disabled="row.isLock === 1" @click="rowEditClick(row)">修改</el-link>
                     <el-link type="danger" :disabled="row.isLock === 1" @click="rowDelClick(row)">删除</el-link>
-                    <el-link v-loading="row?.recalculateLoading" :disabled="row.isLock === 1" @click="rowRecalculateClick(row)">重新计算</el-link>
+                    <el-link v-loading="row?.recalculateLoading" :disabled="row.isLock === 1 || row.approveStatus !== 0" @click="rowRecalculateClick(row)">重新计算</el-link>
                     <el-link type="warning" @click="rowLockingClick(row)">{{ row.isLock === 1 ? '取消锁定' : '锁定' }}</el-link>
                 </template>
             </hc-table>
@@ -114,6 +120,11 @@ const addModalFinish = () => {
     getTableData()
 }
 
+//多选
+const tableCheckedKeys = ref([])
+const tableSelectionChange = (rows) => {
+    tableCheckedKeys.value = rows
+}
 
 //修改
 const editModalShow = ref(false)
@@ -154,22 +165,52 @@ const rowLockingClick = async (row) => {
         window.$message.error(msg ?? '操作失败')
     }
 }
-//重新计算报表
 
+//重新计算
+const recalculateLoading = ref(false)
+const recalculateClick = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length <= 0) {
+        window.$message.warning('请先勾选一条数据')
+        return
+    }
+    if (rows.length > 1) {
+        window.$message.warning('目前仅支持选择一条数据')
+        return
+    }
+    recalculateLoading.value = true
+    const isRes = await postRecalculateApi(rows[0])
+    recalculateLoading.value = false
+    if (isRes) {
+        editModalIds.value = false
+        getTableData().then()
+    }
+}
+
+//重新计算报表
 const rowRecalculateClick = async (row) => {
     row.recalculateLoading = true
+    const isRes = await postRecalculateApi(row)
+    row.recalculateLoading = false
+    if (isRes) {
+        editModalIds.value = false
+        getTableData().then()
+    }
+}
+
+//发起重新计算请求
+const postRecalculateApi = async ({ id }) => {
     const { error, code, msg } = await mainApi.recalculate({
-        reportId: row.id,
-        type:0,
+        reportId: id,
+        type: 0,
         taskType: 1,
     })
-    row.recalculateLoading = false
     if (!error && code === 200) {
         window.$message.success('操作成功')
-        editModalIds.value = false
-        getTableData().then()
+        return true
     } else {
         window.$message.error(msg ?? '操作失败')
+        return false
     }
 }
 

+ 50 - 8
src/views/debit-pay/material/book.vue

@@ -1,19 +1,25 @@
 <template>
     <hc-new-card title="材料预付款报表手册">
         <template #extra>
+            <hc-tooltip keys="debit_pay_material_book_recalculate_btn">
+                <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="warning" :loading="recalculateLoading" @click="recalculateClick">重新计算</el-button>
+            </hc-tooltip>
             <el-button hc-btn type="primary" @click="addModalClick">
                 <HcIcon name="add" />
                 <span>新增</span>
             </el-button>
         </template>
-        <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
+        <hc-table
+            :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }"
+            is-check :check-style="{ width: 29 }" @selection-change="tableSelectionChange"
+        >
             <template #action="{ row }">
                 <el-link type="primary" :disabled="!row.rawUrl" @click="rowViewRawPdf(row)">查看电签报表</el-link>
                 <el-link type="primary" @click="viewPdf(row)">查看报表</el-link>
                 <el-link type="primary" :disabled="row.approveStatus === 0" @click="eVisaRowClick(row)">查看电签流程</el-link>
                 <el-link type="success" @click="editRow(row)">修改</el-link>
                 <el-link type="danger" @click="delCilck(row)">删除</el-link>
-                <el-link v-loading="row?.recalculateLoading" @click="recalculate(row)">重新计算</el-link>
+                <el-link v-loading="row?.recalculateLoading" :disabled="row.approveStatus !== 0" @click="recalculate(row)">重新计算</el-link>
             </template>
         </hc-table>
         <template #action>
@@ -72,7 +78,6 @@ onActivated(() => {
     getKey1Data()
 })
 
-
 //计量期
 const periodData = ref([])
 //未被引用的
@@ -177,23 +182,60 @@ const delCilck = (row)=>{
 const viewPdf = (row)=>{
     toPdfPage(row.rawUrl)
 }
+
+//多选
+const tableCheckedKeys = ref([])
+const tableSelectionChange = (rows) => {
+    tableCheckedKeys.value = rows
+}
+
 //重新计算
+const recalculateLoading = ref(false)
+const recalculateClick = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length <= 0) {
+        window.$message.warning('请先勾选一条数据')
+        return
+    }
+    if (rows.length > 1) {
+        window.$message.warning('目前仅支持选择一条数据')
+        return
+    }
+    recalculateLoading.value = true
+    const isRes = await postRecalculateApi(rows[0])
+    recalculateLoading.value = false
+    if (isRes) {
+        getTableData().then()
+    }
+}
 
+//重新计算
 const recalculate = async (row)=>{
     row.recalculateLoading = true
+    const isRes = await postRecalculateApi(row)
+    row.recalculateLoading = false
+    if (isRes) {
+        getTableData().then()
+    }
+}
+
+//发起重新计算请求
+const postRecalculateApi = async ({ id }) => {
     const { error, code, msg } = await bookApi.meterPdfInfo({
-        reportId:row.id,
-        type:1,
-        taskType:1,
+        reportId: id,
+        type: 1,
+        taskType: 1,
     })
-    row.recalculateLoading = false
     if (!error && code === 200) {
         window.$message.success('计算成功')
-        getTableData()
+        return true
     } else {
         window.$message.error(msg ?? '操作失败')
+        return false
     }
 }
+
+
 const removeProPay = async (id) => {
     const { error, code, msg } = await bookApi.remove({
         ids: id,

+ 49 - 7
src/views/debit-pay/start-work/book.vue

@@ -1,19 +1,25 @@
 <template>
     <hc-new-card title="开工预付款报表手册">
         <template #extra>
+            <hc-tooltip keys="debit_pay_start_work_book_recalculate_btn">
+                <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="warning" :loading="recalculateLoading" @click="recalculateClick">重新计算</el-button>
+            </hc-tooltip>
             <el-button hc-btn type="primary" @click="addModalClick">
                 <HcIcon name="add" />
                 <span>新增</span>
             </el-button>
         </template>
-        <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
+        <hc-table
+            :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }"
+            is-check :check-style="{ width: 29 }" @selection-change="tableSelectionChange"
+        >
             <template #action="{ row }">
                 <el-link type="primary" :disabled="!row.rawUrl" @click="rowViewRawPdf(row)">查看电签报表</el-link>
                 <el-link type="primary" @click="viewPdf(row)">查看报表</el-link>
                 <el-link type="primary" :disabled="row.approveStatus === 0" @click="eVisaRowClick(row)">查看电签流程</el-link>
                 <el-link type="success" @click="editRow(row)">修改</el-link>
                 <el-link type="danger" @click="delCilck(row)">删除</el-link>
-                <el-link v-loading="row?.recalculateLoading" @click="recalculate(row)">重新计算</el-link>
+                <el-link v-loading="row?.recalculateLoading" :disabled="row.approveStatus !== 0" @click="recalculate(row)">重新计算</el-link>
             </template>
         </hc-table>
         <template #action>
@@ -178,22 +184,58 @@ const delCilck = (row)=>{
     })
 }
 
+//多选
+const tableCheckedKeys = ref([])
+const tableSelectionChange = (rows) => {
+    tableCheckedKeys.value = rows
+}
+
+//重新计算
+const recalculateLoading = ref(false)
+const recalculateClick = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length <= 0) {
+        window.$message.warning('请先勾选一条数据')
+        return
+    }
+    if (rows.length > 1) {
+        window.$message.warning('目前仅支持选择一条数据')
+        return
+    }
+    recalculateLoading.value = true
+    const isRes = await postRecalculateApi(rows[0])
+    recalculateLoading.value = false
+    if (isRes) {
+        getTableData().then()
+    }
+}
+
 //重新计算
 const recalculate = async (row)=>{
     row.recalculateLoading = true
+    const isRes = await postRecalculateApi(row)
+    row.recalculateLoading = false
+    if (isRes) {
+        getTableData().then()
+    }
+}
+
+//发起重新计算请求
+const postRecalculateApi = async ({ id }) => {
     const { error, code, msg } = await bookApi.meterPdfInfo({
-        reportId:row.id,
-        type:2,
-        taskType:1,
+        reportId: id,
+        type: 2,
+        taskType: 1,
     })
-    row.recalculateLoading = false
     if (!error && code === 200) {
         window.$message.success('计算成功')
-        getTableData()
+        return true
     } else {
         window.$message.error(msg ?? '操作失败')
+        return false
     }
 }
+
 const removeProPay = async (id) => {
     const { error, code, msg } = await bookApi.remove({
         ids: id,