From c7b4b9a2f4c0f05aeb60a9e3f5fba5d9a3676f3f Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期一, 18 八月 2025 16:22:42 +0800 Subject: [PATCH] 中强恒兴设备管理页面添加 --- src/views/procurementManagement/qualityInspection/index.vue | 285 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 285 insertions(+), 0 deletions(-) diff --git a/src/views/procurementManagement/qualityInspection/index.vue b/src/views/procurementManagement/qualityInspection/index.vue new file mode 100644 index 0000000..7225795 --- /dev/null +++ b/src/views/procurementManagement/qualityInspection/index.vue @@ -0,0 +1,285 @@ +<template> + <div class="app-container"> + <el-card class="search-card" shadow="never"> + <el-form :model="searchForm" :inline="true"> + <el-form-item label="璐ㄦ鍗曞彿锛�" style="width: 300px;"> + <el-input v-model="searchForm.inspectionNo" placeholder="璇疯緭鍏ヨ川妫�鍗曞彿" clearable /> + </el-form-item> + <el-form-item label="璐ㄦ鐘舵�侊細" style="width: 300px;"> + <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" clearable> + <el-option label="寰呰川妫�" value="pending" /> + <el-option label="璐ㄦ涓�" value="inspecting" /> + <el-option label="宸插畬鎴�" value="completed" /> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="handleSearch">鎼滅储</el-button> + <el-button @click="resetSearch">閲嶇疆</el-button> + </el-form-item> + </el-form> + </el-card> + + <el-card class="table-card" shadow="never"> + <div class="table-header"> + <el-button type="primary" @click="openDialog('add')">鏂板璐ㄦ鍗�</el-button> + <el-button type="success" @click="handleBatchComplete">鎵归噺瀹屾垚</el-button> + <el-button type="danger" @click="handleBatchDelete">鎵归噺鍒犻櫎</el-button> + </div> + + <el-table :data="tableData" border v-loading="loading" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="璐ㄦ鍗曞彿" prop="inspectionNo" width="180" /> + <el-table-column label="鍒拌揣鍗曞彿" prop="arrivalNo" width="180" /> + <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" /> + <el-table-column label="璐ㄦ鐘舵��" prop="status" width="100"> + <template #default="{ row }"> + <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> + </template> + </el-table-column> + <el-table-column label="鍚堟牸鏁伴噺" prop="qualifiedQuantity" width="100" /> + <el-table-column label="涓嶅悎鏍兼暟閲�" prop="unqualifiedQuantity" width="100" /> + <el-table-column label="璐ㄦ鏃堕棿" prop="inspectionTime" width="180" /> + <el-table-column label="鎿嶄綔" width="200" align="center"> + <template #default="{ row }"> + <el-button type="primary" link @click="openDialog('edit', row)">缂栬緫</el-button> + <el-button type="success" link @click="handleComplete(row)" v-if="row.status !== 'completed'">瀹屾垚</el-button> + <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + </el-card> + + <el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '鏂板璐ㄦ鍗�' : '缂栬緫璐ㄦ鍗�'" width="1000px"> + <el-form :model="formData" label-width="120px"> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="鍒拌揣鍗曞彿"> + <el-select v-model="formData.arrivalNo" placeholder="璇烽�夋嫨鍒拌揣鍗�" style="width: 100%"> + <el-option label="AR20241201001" value="AR20241201001" /> + <el-option label="AR20241201002" value="AR20241201002" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="渚涘簲鍟嗗悕绉�"> + <el-input v-model="formData.supplierName" placeholder="渚涘簲鍟嗗悕绉�" readonly /> + </el-form-item> + </el-col> + </el-row> + + <el-form-item label="璐ㄦ鍟嗗搧"> + <div class="product-list" style="width: 100%;"> + <el-table :data="formData.products" border width="100%"> + <el-table-column label="鍟嗗搧鍚嶇О" width="150"> + <template #default="{ row }"> + <el-input v-model="row.productName" placeholder="璇疯緭鍏ュ晢鍝佸悕绉�" /> + </template> + </el-table-column> + <el-table-column label="瑙勬牸鍨嬪彿" width="150"> + <template #default="{ row }"> + <el-input v-model="row.specification" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" /> + </template> + </el-table-column> + <el-table-column label="鍒拌揣鏁伴噺" width="150"> + <template #default="{ row }"> + <el-input-number v-model="row.arrivalQuantity" :min="0" placeholder="鏁伴噺" style="width: 100%;"/> + </template> + </el-table-column> + <el-table-column label="鍚堟牸鏁伴噺" width="150"> + <template #default="{ row }"> + <el-input-number v-model="row.qualifiedQuantity" :min="0" placeholder="鏁伴噺" style="width: 100%;"/> + </template> + </el-table-column> + <el-table-column label="涓嶅悎鏍兼暟閲�" width="150"> + <template #default="{ row }"> + <el-input-number v-model="row.unqualifiedQuantity" :min="0" placeholder="鏁伴噺" style="width: 100%;"/> + </template> + </el-table-column> + <el-table-column label="涓嶅悎鏍煎師鍥�" width="200"> + <template #default="{ row }"> + <el-input v-model="row.unqualifiedReason" placeholder="璇疯緭鍏ヤ笉鍚堟牸鍘熷洜" /> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" width="100"> + <template #default="{ $index }"> + <el-button type="danger" link @click="removeProduct($index)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <div class="add-product-btn"> + <el-button type="primary" @click="addProduct">娣诲姞鍟嗗搧</el-button> + </div> + </div> + </el-form-item> + + <el-form-item label="璐ㄦ鍛�"> + <el-input v-model="formData.inspector" placeholder="璇疯緭鍏ヨ川妫�鍛樺鍚�" /> + </el-form-item> + + <el-form-item label="澶囨敞"> + <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" /> + </el-form-item> + </el-form> + <template #footer> + <el-button @click="dialogVisible = false">鍙栨秷</el-button> + <el-button type="primary" @click="handleSubmit">纭畾</el-button> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import { ref, reactive } from 'vue' +import { ElMessage, ElMessageBox } from 'element-plus' + +const loading = ref(false) +const dialogVisible = ref(false) +const dialogType = ref('add') +const selectedRows = ref([]) + +const searchForm = reactive({ + inspectionNo: '', + status: '' +}) + +const formData = reactive({ + arrivalNo: '', + supplierName: '', + products: [], + inspector: '', + remark: '' +}) + +const mockData = [ + { + id: 1, + inspectionNo: 'QI20241201001', + arrivalNo: 'AR20241201001', + supplierName: '渚涘簲鍟咥', + status: 'completed', + qualifiedQuantity: 240, + unqualifiedQuantity: 10, + inspectionTime: '2024-12-01 16:30:00', + inspector: '寮犱笁', + remark: '璐ㄦ瀹屾垚' + } +] + +const tableData = ref([...mockData]) + +const getStatusType = (status) => { + const statusMap = { pending: 'info', inspecting: 'warning', completed: 'success' } + return statusMap[status] || 'info' +} + +const getStatusText = (status) => { + const statusMap = { pending: '寰呰川妫�', inspecting: '璐ㄦ涓�', completed: '宸插畬鎴�' } + return statusMap[status] || '鏈煡' +} + +const handleSearch = () => { + loading.value = true + setTimeout(() => { loading.value = false }, 500) +} + +const resetSearch = () => { + Object.assign(searchForm, { inspectionNo: '', status: '' }) +} + +const openDialog = (type, row = {}) => { + dialogType.value = type + if (type === 'edit' && row.id) { + Object.assign(formData, { + arrivalNo: row.arrivalNo, + supplierName: row.supplierName, + inspector: row.inspector, + remark: row.remark + }) + } else { + Object.assign(formData, { + arrivalNo: '', + supplierName: '', + products: [], + inspector: '', + remark: '' + }) + } + dialogVisible.value = true +} + +const handleSubmit = () => { + if (dialogType.value === 'add') { + const newInspection = { + id: Date.now(), + inspectionNo: `QI${Date.now()}`, + arrivalNo: formData.arrivalNo, + supplierName: formData.supplierName, + status: 'pending', + qualifiedQuantity: 0, + unqualifiedQuantity: 0, + inspectionTime: new Date().toLocaleString(), + inspector: formData.inspector, + remark: formData.remark + } + tableData.value.unshift(newInspection) + ElMessage.success('鏂板鎴愬姛') + } + dialogVisible.value = false +} + +const handleComplete = (row) => { + row.status = 'completed' + ElMessage.success('璐ㄦ瀹屾垚') +} + +const handleDelete = (row) => { + ElMessageBox.confirm('纭畾瑕佸垹闄よ繖鏉¤褰曞悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const index = tableData.value.findIndex(item => item.id === row.id) + if (index !== -1) { + tableData.value.splice(index, 1) + ElMessage.success('鍒犻櫎鎴愬姛') + } + }) +} + +const handleBatchComplete = () => { + ElMessage.success('鎵归噺瀹屾垚鎴愬姛') +} + +const handleBatchDelete = () => { + ElMessage.success('鎵归噺鍒犻櫎鎴愬姛') +} + +const handleSelectionChange = (rows) => { + selectedRows.value = rows +} + +const addProduct = () => { + formData.products.push({ + productName: '', + specification: '', + arrivalQuantity: 0, + qualifiedQuantity: 0, + unqualifiedQuantity: 0, + unqualifiedReason: '' + }) +} + +const removeProduct = (index) => { + formData.products.splice(index, 1) +} +</script> + +<style scoped> +.app-container { padding: 20px; } +.search-card { margin-bottom: 20px; } +.table-card { margin-bottom: 20px; } +.table-header { margin-bottom: 20px; } +.product-list { border: 1px solid #dcdfe6; border-radius: 4px; padding: 15px; } +.product-item { margin-bottom: 15px; padding: 10px; background-color: #f5f7fa; border-radius: 4px; } +.add-product-btn { margin-top: 15px; text-align: center; } +</style> -- Gitblit v1.9.3