From 0a6a18524ea5c03ea03898ebd1945bc81153db45 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 15:15:25 +0800
Subject: [PATCH] 设备管理-添加导出功能
---
src/views/equipmentManagement/inspectionManagement/index.vue | 137 ++++++++++++---------------------------------
1 files changed, 36 insertions(+), 101 deletions(-)
diff --git a/src/views/equipmentManagement/inspectionManagement/index.vue b/src/views/equipmentManagement/inspectionManagement/index.vue
index f0196b9..3e4e31e 100644
--- a/src/views/equipmentManagement/inspectionManagement/index.vue
+++ b/src/views/equipmentManagement/inspectionManagement/index.vue
@@ -15,20 +15,7 @@
</el-form-item>
</el-form>
<el-card>
- <!-- 鏍囩椤� -->
- <el-tabs
- v-model="activeTab"
- class="info-tabs"
- @tab-click="handleTabClick"
- >
- <el-tab-pane
- v-for="tab in tabs"
- :key="tab.name"
- :label="tab.label"
- :name="tab.name"
- />
- </el-tabs>
- <div style="display: flex;flex-direction: row;justify-content: space-between;" v-if="tabName === 'task'">
+ <div style="display: flex;flex-direction: row;justify-content: space-between;margin-bottom: 10px;">
<el-radio-group v-model="activeRadio" @change="radioChange">
<el-radio-button v-for="tab in radios"
:key="tab.name"
@@ -39,7 +26,10 @@
<el-space v-if="activeRadio !== 'task'">
<el-button type="primary" :icon="Plus" @click="handleAdd(undefined)">鏂板缓</el-button>
<el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
- <!-- <el-button type="info" plain :icon="Download">瀵煎嚭</el-button> -->
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </el-space>
+ <el-space v-else>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
</el-space>
</div>
<div>
@@ -50,8 +40,7 @@
@selection-change="handleSelectionChange"
:is-selection="true"
:border="true"
- :table-style="{ width: '100%', height: 'calc(100vh - 30em)' }"
- v-if="tabName === 'task'"
+ :table-style="{ width: '100%', height: 'calc(100vh - 23em)' }"
>
<template #inspector="{ row }">
<div class="person-tags">
@@ -71,27 +60,7 @@
<span v-else class="no-data">--</span>
</div>
</template>
- </PIMTable>
- <el-table ref="table" :data="tableData" height="480" v-loading="tableLoading" border v-else style="width: 100%;height: calc(100vh - 25em)">
- <el-table-column label="搴忓彿" type="index" width="60" align="center" />
- <el-table-column prop="deviceName" label="璁惧鍚嶇О" :show-overflow-tooltip="true">
- <template #default="scope">
- {{scope.row.qrCode.deviceName}}
- </template>
- </el-table-column>
- <el-table-column prop="location" label="鎵�鍦ㄤ綅缃弿杩�" :show-overflow-tooltip="true">
- <template #default="scope">
- {{scope.row.qrCode.location}}
- </template>
- </el-table-column>
- <el-table-column prop="scanner" label="宸℃浜�"></el-table-column>
- <el-table-column prop="scanTime" label="宸℃鏃堕棿"></el-table-column>
- <el-table-column fixed="right" label="鎿嶄綔">
- <template #default="scope">
- <el-button link type="primary" @click="handleAdd(scope.row)">鏌ョ湅闄勪欢</el-button>
- </template>
- </el-table-column>
- </el-table>
+ </PIMTable>
</div>
<pagination
v-if="total>0"
@@ -104,23 +73,20 @@
</div>
</el-card>
<form-dia ref="formDia" @closeDia="handleQuery"></form-dia>
- <qr-code-dia ref="qrCodeDia" @closeDia="handleQuery"></qr-code-dia>
<view-files ref="viewFiles"></view-files>
- <view-qr-code-files ref="viewQrCodeFiles"></view-qr-code-files>
</div>
</template>
<script setup>
import { Delete, Plus } from "@element-plus/icons-vue";
import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
+import { ElMessageBox } from "element-plus";
// 缁勪欢寮曞叆
import Pagination from "@/components/Pagination/index.vue";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
-import QrCodeDia from "@/views/equipmentManagement/inspectionManagement/components/qrCodeDia.vue";
import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
-import ViewQrCodeFiles from "@/views/equipmentManagement/inspectionManagement/components/viewQrCodeFiles.vue";
// 鎺ュ彛寮曞叆
import {
@@ -128,38 +94,22 @@
inspectionTaskList,
timingTaskList
} from "@/api/inspectionManagement/index.js";
-import {
- delQrCode,
- qrCodeList,
- qrCodeScanRecordList
-} from "@/api/inspectionUpload/index.js";
// 鍏ㄥ眬鍙橀噺
const { proxy } = getCurrentInstance();
const formDia = ref();
-const qrCodeDia = ref();
const viewFiles = ref();
-const viewQrCodeFiles = ref();
// 鏌ヨ鍙傛暟
const queryParams = reactive({
searchAll: "",
});
-// 鏍囩椤甸厤缃�
-const activeTab = ref("task");
-const tabName = ref("task");
-const tabs = reactive([
- { name: "task", label: "鐢熶骇宸℃" },
- { name: "qrCodeScanRecord", label: "鐜板満宸℃璁板綍" },
-]);
-
// 鍗曢�夋閰嶇疆
const activeRadio = ref("taskManage");
const radios = reactive([
{ name: "taskManage", label: "瀹氭椂浠诲姟绠$悊" },
{ name: "task", label: "瀹氭椂浠诲姟璁板綍" },
- { name: "qrCode", label: "浜岀淮鐮佺鐞�" },
]);
// 琛ㄦ牸鏁版嵁
@@ -175,7 +125,6 @@
// 鍒楅厤缃�
const columns = ref([
{ prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 },
- { prop: "inspectionLocation", label: "鍦扮偣", minWidth: 120 },
{ prop: "remarks", label: "澶囨敞", minWidth: 150 },
{ prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" },
{
@@ -246,23 +195,9 @@
return operationConfig;
};
-const columns1 = ref([
- { prop: "deviceName", label: "璁惧鍚嶇О", minWidth: 160 },
- { prop: "location", label: "鎵�鍦ㄤ綅缃弿杩�", minWidth: 120 },
- { prop: "createBy", label: "鍒涘缓鑰�", minWidth: 100 },
- { prop: "createTime", label: "鍒涘缓鏃堕棿", minWidth: 100 },
-]);
-
onMounted(() => {
radioChange('taskManage');
});
-
-// 鏍囩椤电偣鍑讳簨浠�
-const handleTabClick = (tab) => {
- tabName.value = tab.props.name;
- tableData.value = [];
- getList();
-};
// 鍗曢�夊彉鍖�
const radioChange = (value) => {
@@ -274,10 +209,6 @@
const operationColumn = getOperationColumn(['viewFile']);
tableColumns.value = [...columns.value, ...(operationColumn ? [operationColumn] : [])];
operationsArr.value = ['viewFile'];
- } else {
- const operationColumn = getOperationColumn(['edit']);
- tableColumns.value = [...columns1.value, ...(operationColumn ? [operationColumn] : [])];
- operationsArr.value = ['edit'];
}
pageNum.value = 1;
pageSize.value = 10;
@@ -293,7 +224,7 @@
// 鍒嗛〉澶勭悊
const handlePagination = (val) => {
pageNum.value = val.page;
- pageSize.value = val.limit;
+ pageSize.value = val.size;
getList();
};
// 鑾峰彇鍒楄〃鏁版嵁
@@ -303,19 +234,10 @@
const params = { ...queryParams, size: pageSize.value, current: pageNum.value };
let apiCall;
- if (tabName.value === 'task') {
- switch (activeRadio.value) {
- case "task":
- apiCall = inspectionTaskList(params);
- break;
- case "qrCode":
- apiCall = qrCodeList(params);
- break;
- default:
- apiCall = timingTaskList(params);
- }
+ if (activeRadio.value === "task") {
+ apiCall = inspectionTaskList(params);
} else {
- apiCall = qrCodeScanRecordList(params);
+ apiCall = timingTaskList(params);
}
apiCall.then(res => {
@@ -360,15 +282,7 @@
const handleAdd = (row) => {
const type = row ? 'edit' : 'add';
nextTick(() => {
- if (tabName.value === 'task') {
- if (activeRadio.value === "taskManage") {
- formDia.value?.openDialog(type, row);
- } else if (activeRadio.value === "qrCode") {
- qrCodeDia.value?.openDialog(type, row);
- }
- } else {
- viewQrCodeFiles.value?.openDialog(row);
- }
+ formDia.value?.openDialog(type, row);
});
};
@@ -387,10 +301,9 @@
}
const deleteIds = selectedRows.value.map(item => item.id);
- const api = activeRadio.value === "taskManage" ? delTimingTask : delQrCode;
proxy.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(() => {
- return api(deleteIds);
+ return delTimingTask(deleteIds);
}).then(() => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
handleQuery();
@@ -401,6 +314,28 @@
const handleSelectionChange = (selection) => {
selectedRows.value = selection;
};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏍规嵁褰撳墠閫変腑鐨勬爣绛鹃〉璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ if (activeRadio.value === "taskManage") {
+ // 瀹氭椂浠诲姟绠$悊
+ proxy.download("/timingTask/export", {}, "瀹氭椂浠诲姟绠$悊.xlsx");
+ } else if (activeRadio.value === "task") {
+ // 瀹氭椂浠诲姟璁板綍
+ proxy.download("/inspectionTask/export", {}, "瀹氭椂浠诲姟璁板綍.xlsx");
+ }
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
</script>
<style scoped>
--
Gitblit v1.9.3