From 73d112ddc9bdfeb7eaaf3b7308cfb4dbeb470c89 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 07 八月 2026 17:28:10 +0800
Subject: [PATCH] 天津_意博凯信 1.备件管理-新增独立备件出库功能入口,支持直接完成备件领用出库操作。 2.设备保养-支持按日期分组折叠展示,分组条目可展开查看明细;单条明细行末尾增加【保养完成】操作按钮,可单独办结单条保养任务;折叠汇总状态下,新增【一键保养完成】批量操作按钮,快速办结当前分组全部保养项。 3.设备巡检-按日期分组折叠展示,分组支持展开查看明细;每条巡检明细后增设【巡检完成】按钮,支持单独办结单条巡检记录;分组折叠未展开状态下,提供【一键巡检完成】批量操作,统一办结该分组下所有巡检任务。 4.增值税对比-优化数据展示逻辑,列表展示各订单增值税明细;页面右侧新增柱状可视化图表,直观对比进销项增值税数据。 5.管理驾驶舱-指标修改:将顶部「销售产品数」调整为「销售订单数」;时间筛选:页面左上角新增日期范围下拉筛选控件,所有统计指标标注当前筛选时段;
---
src/views/equipmentManagement/inspectionManagement/index.vue | 741 +++++++++++++++++++++++++-------------------------------
1 files changed, 329 insertions(+), 412 deletions(-)
diff --git a/src/views/equipmentManagement/inspectionManagement/index.vue b/src/views/equipmentManagement/inspectionManagement/index.vue
index 8c0d52c..e67f497 100644
--- a/src/views/equipmentManagement/inspectionManagement/index.vue
+++ b/src/views/equipmentManagement/inspectionManagement/index.vue
@@ -1,449 +1,366 @@
<template>
- <div class="app-container">
- <el-form :inline="true"
- :model="queryParams"
- class="search-form">
- <el-form-item label="宸℃浠诲姟鍚嶇О">
- <el-input v-model="queryParams.taskName"
- placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О"
- clearable
- style="width: 200px " />
- </el-form-item>
- <el-form-item>
- <el-button type="primary"
- @click="handleQuery">鏌ヨ</el-button>
- <el-button @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
- <el-card>
- <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"
- :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 @click="handleOut">瀵煎嚭</el-button>
- </el-space>
- <el-space v-else>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- </el-space>
- </div>
- <div>
- <PIMTable :table-loading="tableLoading"
- :table-data="tableData"
- :column="tableColumns"
- @selection-change="handleSelectionChange"
- @pagination="handlePagination"
- :is-selection="true"
- :border="true"
- :page="{
+ <div class="app-container">
+ <el-form :inline="true"
+ :model="queryParams"
+ class="search-form">
+ <el-form-item label="宸℃浠诲姟鍚嶇О">
+ <el-input v-model="queryParams.taskName"
+ placeholder="璇疯緭鍏ュ贰妫�浠诲姟鍚嶇О"
+ clearable
+ style="width: 200px " />
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleQuery">鏌ヨ</el-button>
+ <el-button @click="resetQuery">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+ <el-card>
+ <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"
+ :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 @click="handleOut">瀵煎嚭</el-button>
+ </el-space>
+ <el-space v-else>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </el-space>
+ </div>
+
+ <!-- 宸℃浠诲姟 -->
+ <div v-show="activeRadio === 'taskManage'">
+ <PIMTable :table-loading="tableLoading"
+ :table-data="tableData"
+ :column="tableColumns"
+ @selection-change="handleSelectionChange"
+ @pagination="handlePagination"
+ :is-selection="true"
+ :border="true"
+ :page="{
current: pageNum,
size: pageSize,
total: total,
layout: 'total, sizes, prev, pager, next, jumper'
}"
- height="calc(100vh - 23em)"
- :table-style="{ width: '100%' }">
- <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>
- <template #isEnabled="{ row }">
- <el-tag :type="row.isEnabled === 1 ? 'success' : 'danger'"
- size="small">
- {{ row.isEnabled == 1 ? '鏄�' : '鍚�' }}
- </el-tag>
- </template>
- </PIMTable>
- </div>
- </el-card>
- <form-dia ref="formDia"
- @closeDia="handleQuery"></form-dia>
- <view-files ref="viewFiles"></view-files>
- <upload-files ref="uploadFiles"
- @success="handleQuery"
- @closeDia="handleQuery"></upload-files>
- </div>
+ height="calc(100vh - 23em)"
+ :table-style="{ width: '100%' }">
+ <template #inspector="{ row }">
+ <div class="person-tags">
+ <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>
+ <template #isEnabled="{ row }">
+ <el-tag :type="row.isEnabled === 1 ? 'success' : 'danger'"
+ size="small">
+ {{ row.isEnabled == 1 ? '鏄�' : '鍚�' }}
+ </el-tag>
+ </template>
+ </PIMTable>
+ </div>
+
+ <!-- 宸℃璁板綍 - 鏃ユ湡鍒嗙粍鎶樺彔 -->
+ <div v-show="activeRadio === 'task'">
+ <el-table
+ :data="groupedInspectionList"
+ border
+ v-loading="tableLoading"
+ :expand-row-keys="inspectionExpandedRowKeys"
+ :row-key="(row) => row.date"
+ @expand-change="onInspectionExpandChange"
+ height="calc(100vh - 23em)"
+ >
+ <el-table-column type="expand">
+ <template #default="props">
+ <el-table :data="props.row.children" border row-key="id">
+ <el-table-column label="宸℃浠诲姟鍚嶇О" prop="taskName" align="center" min-width="180" />
+ <el-table-column label="宸℃椤圭洰" prop="inspectionProject" align="center" min-width="160" />
+ <el-table-column label="宸℃浜�" align="center" min-width="150">
+ <template #default="{ row }">
+ <template v-if="row.inspector && row.inspector.length > 0">
+ <el-tag v-for="(p, i) in row.inspector" :key="i" size="small" type="primary" class="person-tag">{{ p }}</el-tag>
+ </template>
+ <span v-else>--</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="宸℃鐘舵��" align="center" width="100">
+ <template #default="{ row }">
+ <el-tag :type="row.status === 1 ? 'success' : 'warning'" size="small">
+ {{ row.status === 1 ? '宸插畬鎴�' : '寰呭贰妫�' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="宸℃缁撴灉" prop="inspectionResult" align="center" min-width="120" />
+ <el-table-column label="澶囨敞" prop="remarks" align="center" min-width="150" />
+ <el-table-column label="寮傚父鎻忚堪" prop="abnormalDescription" align="center" min-width="150" />
+ <el-table-column label="鎿嶄綔" align="center" width="200">
+ <template #default="{ row }">
+ <el-button type="primary" link @click="openUploadDialog(row)">涓婁紶</el-button>
+ <el-button type="success" link @click="viewFile(row)">鏌ョ湅闄勪欢</el-button>
+ <el-button type="warning" link v-if="row.status === 0" @click="handleSingleComplete(row)">宸℃瀹屾垚</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </template>
+ </el-table-column>
+ <el-table-column label="宸℃鏃ユ湡" prop="date" align="center" />
+ <el-table-column label="宸℃璁板綍鏁�" prop="count" align="center" />
+ <el-table-column label="寰呭贰妫�鏁�" align="center" width="120">
+ <template #default="{ row }">
+ {{ row.children.filter(c => c.status === 0).length }}
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" align="center" width="200">
+ <template #default="{ row }">
+ <el-button
+ type="primary"
+ size="small"
+ :disabled="!row.children.some(c => c.status === 0)"
+ @click="handleBatchInspection(row.date)"
+ >
+ 涓�閿贰妫�瀹屾垚
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <Pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="pageNum"
+ :limit="pageSize"
+ @pagination="handlePagination"
+ />
+ </div>
+ </el-card>
+ <form-dia ref="formDia"
+ @closeDia="handleQuery"></form-dia>
+ <view-files ref="viewFiles"></view-files>
+ <upload-files ref="uploadFiles"
+ @success="handleQuery"
+ @closeDia="handleQuery"></upload-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 dayjs from "dayjs";
+import { Delete, Plus } from "@element-plus/icons-vue";
+import { onMounted, ref, reactive, getCurrentInstance, nextTick, computed } from "vue";
+import { ElMessage, ElMessageBox } from "element-plus";
+import dayjs from "dayjs";
- // 缁勪欢寮曞叆
- import PIMTable from "@/components/PIMTable/PIMTable.vue";
- import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
- import UploadFiles from "@/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue";
- import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
+import PIMTable from "@/components/PIMTable/PIMTable.vue";
+import FormDia from "@/views/equipmentManagement/inspectionManagement/components/formDia.vue";
+import UploadFiles from "@/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue";
+import ViewFiles from "@/views/equipmentManagement/inspectionManagement/components/viewFiles.vue";
- // 鎺ュ彛寮曞叆
- import {
- delTimingTask,
- inspectionTaskList,
- timingTaskList,
- } from "@/api/inspectionManagement/index.js";
+import {
+ delTimingTask,
+ inspectionTaskList,
+ timingTaskList,
+ completeInspection,
+ batchCompleteInspection,
+} from "@/api/inspectionManagement/index.js";
+import Pagination from "@/components/PIMTable/Pagination.vue";
- // 鍏ㄥ眬鍙橀噺
- const { proxy } = getCurrentInstance();
- const formDia = ref();
- const viewFiles = ref();
- const uploadFiles = ref();
+const { proxy } = getCurrentInstance();
+const formDia = ref();
+const viewFiles = ref();
+const uploadFiles = ref();
- // 鏌ヨ鍙傛暟
- const queryParams = reactive({
- taskName: "",
- });
+const queryParams = reactive({ taskName: "" });
- // 鍗曢�夋閰嶇疆
- const activeRadio = ref("taskManage");
- const radios = reactive([
- { name: "taskManage", label: "宸℃浠诲姟" },
- { name: "task", label: "宸℃璁板綍" },
- ]);
+const activeRadio = ref("taskManage");
+const radios = reactive([
+ { name: "taskManage", label: "宸℃浠诲姟" },
+ { name: "task", 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 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(100);
- // 鍒楅厤缃�
- const columns = ref([
- { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 200 },
- { prop: "inspectionProject", label: "宸℃椤圭洰", minWidth: 180 },
- { prop: "remarks", label: "澶囨敞", minWidth: 180 },
- { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 180, slot: "inspector" },
- {
- prop: "isEnabled",
- label: "鏄惁鍚敤",
- minWidth: 100,
- dataType: "slot",
- slot: "isEnabled",
- },
- {
- prop: "frequencyType",
- label: "棰戞",
- minWidth: 120,
- formatData: params => {
- return params === "DAILY"
- ? "姣忔棩"
- : params === "WEEKLY"
- ? "姣忓懆"
- : params === "MONTHLY"
- ? "姣忔湀"
- : params === "QUARTERLY"
- ? "瀛e害"
- : "";
- },
- },
- {
- prop: "frequencyDetail",
- label: "寮�濮嬫棩鏈熶笌鏃堕棿",
- minWidth: 200,
- 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: 120 },
- {
- prop: "createTime",
- label: "鐧昏鏃ユ湡",
- minWidth: 180,
- formatData: cell => {
- if (!cell) return "-";
- try {
- return dayjs(cell).format("YYYY-MM-DD HH:mm:ss");
- } catch {
- return cell;
- }
- },
- },
- // {
- // prop: "inspectionResult",
- // label: "宸℃缁撴灉",
- // minWidth: 100,
- // dataType: "tag",
- // formatData: val => {
- // return val == 1 ? "姝e父" : "寮傚父";
- // },
- // formatType: val => {
- // return val == 1 ? "success" : "danger";
- // },
- // },
- { prop: "abnormalDescription", label: "寮傚父鎻忚堪", minWidth: 150 },
- ]);
+const columns = ref([
+ { prop: "taskName", label: "宸℃浠诲姟鍚嶇О", minWidth: 200 },
+ { prop: "inspectionProject", label: "宸℃椤圭洰", minWidth: 180 },
+ { prop: "remarks", label: "澶囨敞", minWidth: 180 },
+ { prop: "inspector", label: "鎵ц宸℃浜�", minWidth: 180, slot: "inspector" },
+ { prop: "isEnabled", label: "鏄惁鍚敤", minWidth: 100, dataType: "slot", slot: "isEnabled" },
+ {
+ prop: "frequencyType", label: "棰戞", minWidth: 120,
+ formatData: params => ({ DAILY: "姣忔棩", WEEKLY: "姣忓懆", MONTHLY: "姣忔湀", QUARTERLY: "瀛e害" }[params] || ""),
+ },
+ {
+ prop: "frequencyDetail", label: "寮�濮嬫棩鏈熶笌鏃堕棿", minWidth: 200,
+ formatter: (row, column, cellValue) => {
+ if (typeof cellValue !== "string") return "";
+ return cellValue.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => ({ MON: "鍛ㄤ竴", TUE: "鍛ㄤ簩", WED: "鍛ㄤ笁", THU: "鍛ㄥ洓", FRI: "鍛ㄤ簲", SAT: "鍛ㄥ叚", SUN: "鍛ㄦ棩" }[match]));
+ },
+ },
+ { prop: "registrant", label: "鐧昏浜�", minWidth: 120 },
+ {
+ prop: "createTime", label: "鐧昏鏃ユ湡", minWidth: 180,
+ formatData: cell => { if (!cell) return "-"; try { return dayjs(cell).format("YYYY-MM-DD HH:mm:ss"); } catch { return cell; } },
+ },
+ { prop: "abnormalDescription", label: "寮傚父鎻忚堪", minWidth: 150 },
+]);
- // 鎿嶄綔鍒楅厤缃�
- const getOperationColumn = operations => {
- if (!operations || operations.length === 0) return null;
+const getOperationColumn = operations => {
+ if (!operations || operations.length === 0) return null;
+ return {
+ label: "鎿嶄綔", width: operations.length > 1 ? 180 : 130, fixed: "right", align: "center", dataType: "action",
+ operation: operations.map(op => {
+ switch (op) {
+ case "edit": return { name: "缂栬緫", clickFun: handleAdd, color: "#409EFF" };
+ case "upload": return { name: "涓婁紶", clickFun: openUploadDialog, color: "#409EFF" };
+ case "viewFile": return { name: "鏌ョ湅闄勪欢", clickFun: viewFile, color: "#67C23A" };
+ default: return null;
+ }
+ }).filter(Boolean),
+ };
+};
- const operationConfig = {
- label: "鎿嶄綔",
- width: operations.length > 1 ? 180 : 130,
- fixed: "right",
- align: "center",
- dataType: "action",
- operation: operations
- .map(op => {
- switch (op) {
- case "edit":
- return {
- name: "缂栬緫",
- clickFun: handleAdd,
- color: "#409EFF",
- };
- case "upload":
- return {
- name: "涓婁紶",
- clickFun: openUploadDialog,
- color: "#409EFF",
- };
- case "viewFile":
- return {
- name: "鏌ョ湅闄勪欢",
- clickFun: viewFile,
- color: "#67C23A",
- };
- default:
- return null;
- }
- })
- .filter(Boolean),
- };
+// 宸℃璁板綍 - 鏃ユ湡鍒嗙粍
+const inspectionExpandedRowKeys = ref([]);
- return operationConfig;
- };
+const groupInspectionByDate = (list) => {
+ const map = {};
+ list.forEach(item => {
+ const date = item.dateStr || (item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD') : '鏈煡鏃ユ湡');
+ if (!map[date]) map[date] = [];
+ map[date].push(item);
+ });
+ return Object.entries(map).map(([date, children]) => ({ date, children, count: children.length }));
+};
- onMounted(() => {
- radioChange("taskManage");
- });
+const groupedInspectionList = computed(() => groupInspectionByDate(tableData.value));
- // 鍗曢�夊彉鍖�
- const radioChange = value => {
- if (value === "taskManage") {
- const operationColumn = getOperationColumn(["edit"]);
- tableColumns.value = [
- ...columns.value,
- ...(operationColumn ? [operationColumn] : []),
- ];
- operationsArr.value = ["edit"];
- } else if (value === "task") {
- const operationColumn = getOperationColumn(["upload", "viewFile"]);
- // 宸℃璁板綍涓嶅睍绀�"鏄惁鍚敤"鍒�
- const taskColumns = columns.value.filter(col => col.prop !== "isEnabled");
- tableColumns.value = [
- ...taskColumns,
- ...(operationColumn ? [operationColumn] : []),
- ];
- operationsArr.value = ["upload", "viewFile"];
- }
- pageNum.value = 1;
- pageSize.value = 10;
- getList();
- };
+const onInspectionExpandChange = (row, expandedRows) => {
+ inspectionExpandedRowKeys.value = expandedRows.map(r => r.date);
+};
- // 鏌ヨ鎿嶄綔
- const handleQuery = () => {
- pageNum.value = 1;
- pageSize.value = 10;
- getList();
- };
- // 鍒嗛〉澶勭悊
- const handlePagination = val => {
- pageNum.value = val.page;
- pageSize.value = val.limit;
- getList();
- };
- // 鑾峰彇鍒楄〃鏁版嵁
- const getList = () => {
- tableLoading.value = true;
+// 鍗曟潯宸℃瀹屾垚
+const handleSingleComplete = async (row) => {
+ try {
+ await ElMessageBox.confirm('纭灏嗚宸℃璁板綍鏍囪涓哄畬鎴愶紵', '鎻愮ず', { type: 'warning' });
+ const res = await completeInspection(row.id);
+ if (res.code === 200) {
+ ElMessage.success('宸℃瀹屾垚');
+ getList();
+ } else {
+ ElMessage.error(res.msg || '鎿嶄綔澶辫触');
+ }
+ } catch { /* 鍙栨秷 */ }
+};
- const params = {
- ...queryParams,
- size: pageSize.value,
- current: pageNum.value,
- };
+// 涓�閿贰妫�瀹屾垚
+const handleBatchInspection = async (dateStr) => {
+ try {
+ await ElMessageBox.confirm(`纭灏� ${dateStr} 鐨勬墍鏈夊緟宸℃璁板綍鏍囪涓哄畬鎴愶紵`, '鎻愮ず', { type: 'warning' });
+ const res = await batchCompleteInspection(dateStr);
+ if (res.code === 200) {
+ ElMessage.success(res.msg || '鎵归噺瀹屾垚鎴愬姛');
+ getList();
+ } else {
+ ElMessage.error(res.msg || '鎿嶄綔澶辫触');
+ }
+ } catch { /* 鍙栨秷 */ }
+};
- let apiCall;
- if (activeRadio.value === "task") {
- apiCall = inspectionTaskList(params);
- } else {
- apiCall = timingTaskList(params);
- }
+onMounted(() => { radioChange("taskManage"); });
- apiCall
- .then(res => {
- const rawData = res.data.records || [];
- // 澶勭悊 inspector 瀛楁锛屽皢瀛楃涓茶浆鎹负鏁扮粍锛堥�傜敤浜庢墍鏈夋儏鍐碉級
- tableData.value = rawData.map(item => {
- const processedItem = { ...item };
- processedItem.__raw = { ...item };
+const radioChange = value => {
+ inspectionExpandedRowKeys.value = [];
+ if (value === "taskManage") {
+ const operationColumn = getOperationColumn(["edit"]);
+ tableColumns.value = [...columns.value, ...(operationColumn ? [operationColumn] : [])];
+ operationsArr.value = ["edit"];
+ } else if (value === "task") {
+ const operationColumn = getOperationColumn(["upload", "viewFile"]);
+ const taskColumns = columns.value.filter(col => col.prop !== "isEnabled");
+ tableColumns.value = [...taskColumns, ...(operationColumn ? [operationColumn] : [])];
+ operationsArr.value = ["upload", "viewFile"];
+ }
+ pageNum.value = 1;
+ getList();
+};
- // 澶勭悊 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 = [];
- }
+const handleQuery = () => { pageNum.value = 1; getList(); };
- return processedItem;
- });
- total.value = res.data.total || 0;
- })
- .finally(() => {
- tableLoading.value = false;
- });
- };
+const handlePagination = val => { pageNum.value = val.page; pageSize.value = val.limit; getList(); };
- // 閲嶇疆鏌ヨ
- const resetQuery = () => {
- for (const key in queryParams) {
- if (!["pageNum", "pageSize"].includes(key)) {
- queryParams[key] = "";
- }
- }
- handleQuery();
- };
+const getList = () => {
+ tableLoading.value = true;
+ const params = { ...queryParams, size: pageSize.value, current: pageNum.value };
+ const apiCall = activeRadio.value === "task" ? inspectionTaskList(params) : timingTaskList(params);
+ apiCall.then(res => {
+ const rawData = res.data.records || [];
+ tableData.value = rawData.map(item => {
+ const processedItem = { ...item };
+ 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; });
+};
- // 鏂板 / 缂栬緫
- const handleAdd = row => {
- const type = row ? "edit" : "add";
- nextTick(() => {
- formDia.value?.openDialog(type, row);
- });
- };
+const resetQuery = () => { queryParams.taskName = ""; handleQuery(); };
- // 鏌ョ湅闄勪欢
- const viewFile = row => {
- nextTick(() => {
- viewFiles.value?.openDialog(row);
- });
- };
+const handleAdd = row => { nextTick(() => { formDia.value?.openDialog(row ? "edit" : "add", row); }); };
+const viewFile = row => { nextTick(() => { viewFiles.value?.openDialog(row); }); };
+const openUploadDialog = row => { nextTick(() => { uploadFiles.value?.openDialog(row); }); };
- const openUploadDialog = row => {
- nextTick(() => {
- uploadFiles.value?.openDialog(row);
- });
- };
+const handleDelete = () => {
+ if (!selectedRows.value.length) { proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁"); return; }
+ proxy.$modal.confirm("鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�").then(() => delTimingTask(selectedRows.value.map(item => item.id)))
+ .then(() => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); handleQuery(); }).catch(() => {});
+};
- // 鍒犻櫎鎿嶄綔
- const handleDelete = () => {
- if (!selectedRows.value.length) {
- proxy.$modal.msgWarning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
- return;
- }
+const handleSelectionChange = selection => { selectedRows.value = selection; };
- const deleteIds = selectedRows.value.map(item => item.id);
-
- proxy.$modal
- .confirm("鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�")
- .then(() => {
- return delTimingTask(deleteIds);
- })
- .then(() => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- handleQuery();
- })
- .catch(() => {});
- };
-
- // 澶氶�夊彉鏇�
- 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("宸插彇娑�");
- });
- };
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { confirmButtonText: "纭", cancelButtonText: "鍙栨秷", type: "warning" })
+ .then(() => {
+ if (activeRadio.value === "taskManage") proxy.download("/timingTask/export", {}, "宸℃浠诲姟.xlsx");
+ else proxy.download("/inspectionTask/export", {}, "宸℃璁板綍.xlsx");
+ }).catch(() => { proxy.$modal.msg("宸插彇娑�"); });
+};
</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;
- }
+.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>
--
Gitblit v1.9.3