Эх сурвалжийг харах

首件,预览打印接口调整

iZaiZaiA 2 жил өмнө
parent
commit
410059aec8

+ 8 - 0
src/api/modules/other/first-item.js

@@ -56,4 +56,12 @@ export default {
             params: form
         }, msg);
     },
+    //批量打印
+    async batchPrint(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/informationWriteQuery/batchPrint',
+            method: 'post',
+            params: form
+        }, msg)
+    },
 }

+ 1 - 5
src/views/data-fill/query.vue

@@ -519,11 +519,7 @@ const batchPrint = async () => {
     //处理数据
     printLoading.value = false
     if (!error && code === 200) {
-        if (isObjNull(data)) {
-            window.$message?.error('数据异常')
-        } else {
-            //待写
-        }
+        console.log(data)
     }
 }
 

+ 20 - 1
src/views/other/first-item.vue

@@ -40,7 +40,7 @@
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="other-first-item-down-print">
-                        <el-button hc-btn :disabled="tableSelectionKeys.length <= 0">
+                        <el-button hc-btn :disabled="tableSelectionKeys.length <= 0" :loading="printLoading" @click="batchPrint">
                             <HcIcon name="printer"/>
                             <span>预览/打印</span>
                         </el-button>
@@ -655,6 +655,25 @@ const showReportFinish = () => {
     showReportModal.value = false
 }
 
+
+//打印
+const printLoading = ref(false)
+const batchPrint = async () => {
+    const rows = tableSelectionKeys.value;
+    const ids = rowsToId(rows)
+    //批量下载
+    printLoading.value = true
+    const { error, code, data } = await firstApi.batchPrint({
+        ids: ids
+    })
+    //处理数据
+    printLoading.value = false
+    if (!error && code === 200) {
+        console.log(data)
+    }
+}
+
+
 //拼接ID
 const rowsToId = (rows) => {
     return rows.map((obj) => {