iZaiZaiA 2 gadi atpakaļ
vecāks
revīzija
459d870705
2 mainītis faili ar 66 papildinājumiem un 3 dzēšanām
  1. 1 1
      src/config/index.js
  2. 65 2
      src/views/ledger/components/table-list.vue

+ 1 - 1
src/config/index.js

@@ -17,7 +17,7 @@ export default {
     statusWhiteList: [],    //http的status默认放行列表
     ossUrl: 'https://bladex-test-info.oss-cn-chengdu.aliyuncs.com', //oss地址
     smsPhone: '',  //测试接受短信验证码的手机号
-    dev_version: '202209161750',    //开发版本号
+    dev_version: '202209191158',    //开发版本号
     prod_host: 'http://47.110.251.215:8090',  //线上
     dev_host: 'http://192.168.4.6', //黄键楠
     //dev_host: 'http://192.168.3.13', //祝炜

+ 65 - 2
src/views/ledger/components/table-list.vue

@@ -43,13 +43,16 @@
             </template>
         </HcCard>
 
+        <!--批量上报审批-->
+        <HcReportModal  title="批量上报审批" url="contractLog/batchTask" :show="showReportModal" :projectId="projectId" :contractId="contractId"
+                        :taskName="reportTaskName" :ids="reportIds" @hide="showReportModal = false" @finish="showReportFinish"/>
     </div>
 </template>
 
 <script setup>
 import {ref, watch, nextTick} from "vue";
 import queryApi from '~api/ledger/query';
-import {getArrValue} from "vue-utils-plus"
+import {getArrValue,getObjValue} from "vue-utils-plus"
 
 //参数
 const props = defineProps({
@@ -173,13 +176,73 @@ const tableSelectionChange = (rows) => {
 }
 
 //批量上报
+const showReportModal = ref(false)
+const reportIds = ref('')
+const reportTaskName = ref('')
 const reportModalClick = () => {
-
+    const rows = tableCheckedKeys.value;
+    //判断是否满足条件
+    const result = rows.every(({status})=> {
+        return status !== 1 && status !== 2
+    })
+    //判断状态
+    if (result) {
+        const row = getObjValue(rows[0])
+        reportIds.value = rowsToId(rows)
+        reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
+        showReportModal.value = true
+    } else {
+        window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
+    }
+}
+//上报完成
+const showReportFinish = () => {
+    showReportModal.value = false
+    getTableData()
 }
 
 //批量废除
 const batchAbolishClick = () => {
+    const rows = tableCheckedKeys.value;
+    //判断是否满足条件
+    const result = rows.every(({status})=> {
+        return status !== 0 && status !== 3
+    })
+    //判断状态
+    if (result) {
+        //拼接ID
+        const ids = rowsToId(rows)
+        window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
+            showCancelButton: true,
+            confirmButtonText: '确定废除',
+            cancelButtonText: '取消',
+            callback: (action) => {
+                if (action === 'confirm') {
+                    batchAbolishSave(ids)
+                }
+            }
+        })
+    } else {
+        window.$message?.warning('未上报的文件不能废除')
+    }
+}
+
+//废除勾选的已上报文件
+const batchAbolishSave = async (ids) => {
+    const { error, code } = await queryApi.batchAbolish({ids: ids})
+    //处理数据
+    if (!error && code === 200) {
+        window.$message?.success('批量废除成功')
+        tableCheckedKeys.value = []
+        getTableData()
+    }
+}
 
+//拼接ID
+const rowsToId = (rows) => {
+    return rows.map((obj) => {
+        return obj.id;
+    }).join(",")
 }
 </script>