From 8fc09566cc3ee8d0dae10992de31d0f09f257bb4 Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期二, 08 七月 2025 17:58:04 +0800 Subject: [PATCH] 1、删除通过审核进入正式库存的采购记录,页面弹出报错信息 2、开发首页模块 3、开发设备领用记录 4、调整生产明细不能为负数 5、修复采购登记人匹配问题 --- src/views/inspectionManagement/index.vue | 280 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 217 insertions(+), 63 deletions(-) diff --git a/src/views/inspectionManagement/index.vue b/src/views/inspectionManagement/index.vue index bb313fd..e95753e 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,22 +28,55 @@ :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" - @edit="handleAdd"></ETable> + style="width: 100%;height: calc(100vh - 30em)" + operationsWidth="130" + :operations="operationsArr" + @edit="handleAdd" + @viewFile="viewFile" + v-if="tabName === 'task'" + ></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" @@ -65,110 +90,239 @@ </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 {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() +// 鎺ュ彛寮曞叆 +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: "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 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 => { + tableData.value = res.data.records || []; + 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); + }); +}; + +// 鍒犻櫎鎿嶄綔 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; }; -- Gitblit v1.9.3