Browse Source

试验,设备进场,接口调试

iZaiZaiA 2 years ago
parent
commit
74d74a0948

+ 1 - 1
src/api/modules/tentative/device/approach.js

@@ -45,7 +45,7 @@ export default {
     async removeData(form, msg = true) {
         return httpApi({
             url: '/api/blade-business/device/mobilization/remove',
-            method: 'post',
+            method: 'get',
             params: form
         }, msg);
     },

+ 58 - 2
src/views/tentative/device/approach.vue

@@ -33,13 +33,13 @@
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_device_approach_del">
-                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="delNodeModalClick">
+                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="delTableModalClick">
                             <HcIcon name="delete-bin-2"/>
                             <span>删除</span>
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_device_approach_printer">
-                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
+                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="printerLoading" @click="printerClick">
                             <HcIcon name="printer"/>
                             <span>打印</span>
                         </el-button>
@@ -453,6 +453,62 @@ const setClassRemove = async (id) => {
     }
 }
 
+//删除表格数据
+const delTableModalClick = () => {
+    window?.$messageBox?.alert('请谨慎考虑后,确认是否需要删除?', '删除提醒', {
+        showCancelButton: true,
+        confirmButtonText: '确认删除',
+        cancelButtonText: '取消',
+        type: 'warning',
+        callback: (action) => {
+            if (action === 'confirm') {
+                tableRemoveData()
+            }
+        }
+    })
+}
+
+//批量删除
+const tableRemoveData = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length > 0 ) {
+        const ids = rowsToId(rows)
+        //删除请求
+        const { error, code } = await approachApi.removeData({
+            contractId: contractId.value,
+            ids: ids,
+        })
+        //处理数据
+        if (!error && code === 200) {
+            window?.$message?.success('操作成功')
+            searchClick()
+        }
+    }
+}
+
+
+//打印
+const printerLoading = ref(false)
+const printerClick = async () => {
+    const rows = tableCheckedKeys.value
+    if (rows.length > 0 ) {
+        printerLoading.value = true
+        const ids = rowsToId(rows)
+        //删除请求
+        const { error, code, data } = await approachApi.exportPdf({
+            projectId: projectId.value,
+            contractId: contractId.value,
+            ids: ids,
+        })
+        //处理数据
+        printerLoading.value = false
+        if (!error && code === 200) {
+            window.open(data,'_blank')
+        }
+    }
+}
+
+
 //导入
 const importModal = ref(false)
 const importModalClick = () => {