From 09c5667700fb6da21d29c41e51fa5482a4b40bc9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 24 十月 2025 11:22:22 +0800
Subject: [PATCH] 新公司部署相关配置修改
---
src/views/inspectionManagement/index.vue | 343 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 271 insertions(+), 72 deletions(-)
diff --git a/src/views/inspectionManagement/index.vue b/src/views/inspectionManagement/index.vue
index 64bc036..7e5edc0 100644
--- a/src/views/inspectionManagement/index.vue
+++ b/src/views/inspectionManagement/index.vue
@@ -1,18 +1,10 @@
<template>
<div class="app-container">
<el-form :inline="true" :model="queryParams" class="search-form">
- <el-form-item label="渚涘簲鍟嗗悕绉�">
+ <el-form-item label="鎼滅储">
<el-input
- v-model="queryParams.supplierName"
- placeholder="璇疯緭鍏�"
- clearable
- :style="{ width: '100%' }"
- />
- </el-form-item>
- <el-form-item label="鐓ょ">
- <el-input
- v-model="queryParams.coal"
- placeholder="璇疯緭鍏�"
+ v-model="queryParams.searchAll"
+ placeholder="璇疯緭鍏ュ叧閿瓧"
clearable
:style="{ width: '100%' }"
/>
@@ -36,33 +28,81 @@
:name="tab.name"
/>
</el-tabs>
- <!-- 鎿嶄綔鎸夐挳鍖� -->
- <el-space>
- <el-button type="primary" :icon="Plus" @click="handleAdd">鏂板缓</el-button>
- <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
- <el-button type="info" plain :icon="Download">瀵煎嚭</el-button>
- </el-space>
+ <div style="display: flex;flex-direction: row;justify-content: space-between;" v-if="tabName === 'task'">
+ <el-radio-group v-model="activeRadio" @change="radioChange">
+ <el-radio-button v-for="tab in radios"
+ :key="tab.name"
+ :label="tab.label"
+ :value="tab.name"/>
+ </el-radio-group>
+ <!-- 鎿嶄綔鎸夐挳鍖� -->
+ <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-space>
+ </div>
<div>
<div>
<ETable :loading="tableLoading"
:table-data="tableData"
- :columns="columns"
+ :columns="tableColumns"
@selection-change="handleSelectionChange"
:show-selection="true"
:border="true"
- :maxHeight="480"
+ style="width: 100%;height: calc(100vh - 30em)"
operationsWidth="130"
- :operations="['edit', 'viewFile']"
+ :operations="operationsArr"
@edit="handleAdd"
@viewFile="viewFile"
- ></ETable>
+ v-if="tabName === 'task'"
+ >
+ <template #inspector="{ row }">
+ <div class="person-tags">
+ <!-- 璋冭瘯淇℃伅锛屼笂绾挎椂鍒犻櫎 -->
+ <!-- {{ console.log('inspector data:', row.inspector) }} -->
+ <template v-if="row.inspector && row.inspector.length > 0">
+ <el-tag
+ v-for="(person, index) in row.inspector"
+ :key="index"
+ size="small"
+ type="primary"
+ class="person-tag"
+ >
+ {{ person }}
+ </el-tag>
+ </template>
+ <span v-else class="no-data">--</span>
+ </div>
+ </template>
+ </ETable>
+ <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>
</div>
<pagination
v-if="total>0"
- :page-num="pageNum"
- :page-size="pageSize"
+ :page="pageNum"
+ :limit="pageSize"
:total="total"
- @pagination="handleQuery"
+ @pagination="handlePagination"
:layout="'total, prev, pager, next, jumper'"
/>
</div>
@@ -70,123 +110,282 @@
<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 {Download, Delete, Plus} from "@element-plus/icons-vue";
-import {onMounted, ref} from "vue";
-const { proxy } = getCurrentInstance()
+import { Delete, Plus } from "@element-plus/icons-vue";
+import { onMounted, ref, reactive, getCurrentInstance, nextTick } from "vue";
+
+// 缁勪欢寮曞叆
import Pagination from "@/components/Pagination/index.vue";
import ETable from "@/components/Table/ETable.vue";
import FormDia from "@/views/inspectionManagement/components/formDia.vue";
import QrCodeDia from "@/views/inspectionManagement/components/qrCodeDia.vue";
-import {delInspectionTask, inspectionTaskList} from "@/api/inspectionManagement/index.js";
import ViewFiles from "@/views/inspectionManagement/components/viewFiles.vue";
+import ViewQrCodeFiles from "@/views/inspectionManagement/components/viewQrCodeFiles.vue";
-const formDia = ref()
-const qrCodeDia = ref()
-const viewFiles = ref()
+// 鎺ュ彛寮曞叆
+import {
+ delTimingTask,
+ 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({
- supplierName: "",
- coal: "",
-})
-// 褰撳墠鏍囩
+ searchAll: "",
+});
+
+// 鏍囩椤甸厤缃�
const activeTab = ref("task");
const tabName = ref("task");
-// 鏍囩椤垫暟鎹�
const tabs = reactive([
- { name: "task", label: "浠诲姟涓嬪彂" },
+ { name: "task", label: "鐢熶骇宸℃" },
+ { name: "qrCodeScanRecord", label: "鐜板満宸℃璁板綍" },
+]);
+
+// 鍗曢�夋閰嶇疆
+const activeRadio = ref("taskManage");
+const radios = reactive([
+ { name: "taskManage", label: "瀹氭椂浠诲姟绠$悊" },
+ { name: "task", label: "瀹氭椂浠诲姟璁板綍" },
{ name: "qrCode", label: "浜岀淮鐮佺鐞�" },
]);
-// 琛ㄦ牸
+
+// 琛ㄦ牸鏁版嵁
const selectedRows = ref([]);
const tableData = ref([]);
+const operationsArr = ref([]);
+const tableColumns = ref([]);
const tableLoading = ref(false);
const total = ref(0);
const pageNum = ref(1);
const pageSize = ref(10);
+
+// 鍒楅厤缃�
const columns = ref([
{ prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 160 },
- { prop: "port", label: "鍦扮偣", minWidth: 120 },
+ { prop: "inspectionLocation", label: "鍦扮偣", minWidth: 120 },
{ prop: "remarks", label: "澶囨敞", minWidth: 150 },
- { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150 },
+ { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 150, slot: "inspector" },
+ {
+ prop: "frequencyType",
+ label: "棰戞",
+ minWidth: 150,
+ formatter: (_, __, val) => ({
+ DAILY: "姣忔棩",
+ WEEKLY: "姣忓懆",
+ MONTHLY: "姣忔湀",
+ QUARTERLY: "瀛e害"
+ }[val] || "")
+ },
+ {
+ prop: "frequencyDetail",
+ label: "寮�濮嬫棩鏈熶笌鏃堕棿",
+ minWidth: 150,
+ formatter: (row, column, cellValue) => {
+ // 鍏堝垽鏂槸鍚︽槸瀛楃涓�
+ if (typeof cellValue !== 'string') return '';
+ let val = cellValue;
+ const replacements = {
+ MON: '鍛ㄤ竴',
+ TUE: '鍛ㄤ簩',
+ WED: '鍛ㄤ笁',
+ THU: '鍛ㄥ洓',
+ FRI: '鍛ㄤ簲',
+ SAT: '鍛ㄥ叚',
+ SUN: '鍛ㄦ棩'
+ };
+ // 浣跨敤姝e垯涓�娆℃�ф浛鎹㈡墍鏈夊尮閰嶉」
+ return val.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => replacements[match]);
+ }
+ },
{ prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
{ prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 100 },
]);
+const columns1 = ref([
+ { prop: "deviceName", label: "璁惧鍚嶇О", minWidth: 160 },
+ { prop: "location", label: "鎵�鍦ㄤ綅缃弿杩�", minWidth: 120 },
+ { prop: "createBy", label: "鍒涘缓鑰�", minWidth: 100 },
+ { prop: "createTime", label: "鍒涘缓鏃堕棿", minWidth: 100 },
+]);
+
onMounted(() => {
- handleTabClick({ props: { name: "task" } });
+ radioChange('taskManage');
});
-// 鏍囩椤电偣鍑�
+
+// 鏍囩椤电偣鍑讳簨浠�
const handleTabClick = (tab) => {
tabName.value = tab.props.name;
tableData.value = [];
getList();
};
-// 鐐瑰嚮鏌ヨ
+
+// 鍗曢�夊彉鍖�
+const radioChange = (value) => {
+ if (value === "taskManage") {
+ tableColumns.value = columns.value;
+ operationsArr.value = ['edit'];
+ } else if (value === "task") {
+ tableColumns.value = columns.value;
+ operationsArr.value = ['viewFile'];
+ } else {
+ tableColumns.value = columns1.value;
+ operationsArr.value = ['edit'];
+ }
+ pageNum.value = 1;
+ pageSize.value = 10;
+ getList();
+};
+
+// 鏌ヨ鎿嶄綔
const handleQuery = () => {
- pageNum.value = 1
- pageSize.value = 10
- getList()
-}
+ pageNum.value = 1;
+ pageSize.value = 10;
+ getList();
+};
+// 鍒嗛〉澶勭悊
+const handlePagination = (val) => {
+ pageNum.value = val.page;
+ pageSize.value = val.limit;
+ getList();
+};
+// 鑾峰彇鍒楄〃鏁版嵁
const getList = () => {
tableLoading.value = true;
- inspectionTaskList({...queryParams, size: pageSize.value, current: pageNum.value}).then(res => {
- console.log(res)
+
+ 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);
+ }
+ } else {
+ apiCall = qrCodeScanRecordList(params);
+ }
+
+ apiCall.then(res => {
+ const rawData = res.data.records || [];
+ // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級
+ tableData.value = rawData.map(item => {
+ const processedItem = { ...item };
+
+ // 澶勭悊 inspector 瀛楁
+ if (processedItem.inspector) {
+ if (typeof processedItem.inspector === 'string') {
+ // 瀛楃涓叉寜閫楀彿鍒嗗壊
+ processedItem.inspector = processedItem.inspector.split(',').map(s => s.trim()).filter(s => s);
+ } else if (!Array.isArray(processedItem.inspector)) {
+ // 闈炴暟缁勮浆涓烘暟缁�
+ processedItem.inspector = [processedItem.inspector];
+ }
+ } else {
+ // 绌哄�艰涓虹┖鏁扮粍
+ processedItem.inspector = [];
+ }
+
+ return processedItem;
+ });
+ total.value = res.data.total || 0;
+ }).finally(() => {
tableLoading.value = false;
- tableData.value = res.data.records;
- total.value = res.data.total;
- })
+ });
};
+
// 閲嶇疆鏌ヨ
const resetQuery = () => {
- Object.keys(queryParams).forEach((key) => {
- if (key !== "pageNum" && key !== "pageSize") {
+ for (const key in queryParams) {
+ if (!["pageNum", "pageSize"].includes(key)) {
queryParams[key] = "";
}
- });
+ }
handleQuery();
};
-// 鏂板銆佺紪杈�
+// 鏂板 / 缂栬緫
const handleAdd = (row) => {
- const type = row === undefined ? 'add' : 'edit'
+ const type = row ? 'edit' : 'add';
nextTick(() => {
- if (tabName.value === "task") {
- formDia.value?.openDialog(type, row)
+ if (tabName.value === 'task') {
+ if (activeRadio.value === "taskManage") {
+ formDia.value?.openDialog(type, row);
+ } else if (activeRadio.value === "qrCode") {
+ qrCodeDia.value?.openDialog(type, row);
+ }
} else {
- qrCodeDia.value?.openDialog(type, row)
+ viewQrCodeFiles.value?.openDialog(row);
}
- })
+ });
};
+
// 鏌ョ湅闄勪欢
const viewFile = (row) => {
nextTick(() => {
- viewFiles.value?.openDialog(row)
- })
-}
-// 鍒犻櫎浠诲姟
+ viewFiles.value?.openDialog(row);
+ });
+};
+
+// 鍒犻櫎鎿嶄綔
const handleDelete = () => {
- if (selectedRows.value.length === 0) {
+ if (!selectedRows.value.length) {
proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
return;
}
+
const deleteIds = selectedRows.value.map(item => item.id);
- proxy.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() {
- return delInspectionTask(deleteIds)
+ const api = activeRadio.value === "taskManage" ? delTimingTask : delQrCode;
+
+ proxy.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(() => {
+ return api(deleteIds);
}).then(() => {
- handleQuery()
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- }).catch(() => {})
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ handleQuery();
+ }).catch(() => {});
};
-// 閫夋嫨琛�
+
+// 澶氶�夊彉鏇�
const handleSelectionChange = (selection) => {
selectedRows.value = selection;
};
</script>
<style scoped>
+.person-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px;
+}
+.person-tag {
+ margin-right: 4px;
+ margin-bottom: 2px;
+}
+
+.no-data {
+ color: #909399;
+ font-size: 14px;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3