From 752ea7df5717c3d54887c85d84a541efb53fa4c7 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 04 七月 2025 13:17:26 +0800 Subject: [PATCH] 过程检验页面开发联调、出厂检验开发联调、不合格管理开发联调 --- src/views/qualityManagement/processInspection/components/formDia.vue | 216 +++++ src/views/qualityManagement/finalInspection/components/formDia.vue | 209 +++++ src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue | 140 +++ src/views/qualityManagement/rawMaterialInspection/index.vue | 2 src/views/qualityManagement/finalInspection/index.vue | 236 +++++ src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue | 33 src/views/qualityManagement/processInspection/index.vue | 241 +++++ src/views/qualityManagement/finalInspection/components/filesDia.vue | 178 ++++ src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 249 ++++++ src/views/qualityManagement/processInspection/components/filesDia.vue | 178 ++++ src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue | 257 ++++++ src/api/qualityManagement/nonconformingManagement.js | 42 + src/views/qualityManagement/nonconformingManagement/index.vue | 285 ++++++ src/views/qualityManagement/processInspection/components/inspectionFormDia.vue | 140 +++ 14 files changed, 2,392 insertions(+), 14 deletions(-) diff --git a/src/api/qualityManagement/nonconformingManagement.js b/src/api/qualityManagement/nonconformingManagement.js new file mode 100644 index 0000000..cf6ebe0 --- /dev/null +++ b/src/api/qualityManagement/nonconformingManagement.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +// 鏌ヨ涓嶅悎鏍肩鐞嗗垪琛� +export function qualityUnqualifiedListPage(query) { + return request({ + url: '/quality/qualityUnqualified/listPage', + method: 'get', + params: query, + }) +} +// 鏂板涓嶅悎鏍肩鐞嗗垪琛� +export function qualityUnqualifiedAdd(query) { + return request({ + url: '/quality/qualityUnqualified/add', + method: 'post', + data: query, + }) +} +// 淇敼涓嶅悎鏍肩鐞嗗垪琛� +export function qualityUnqualifiedUpdate(query) { + return request({ + url: '/quality/qualityUnqualified/update', + method: 'post', + data: query, + }) +} +// 鍒犻櫎涓嶅悎鏍肩鐞嗗垪琛� +export function qualityUnqualifiedDel(query) { + return request({ + url: '/quality/qualityUnqualified/del', + method: 'delete', + data: query, + }) +} +// 鏌ヨ涓嶅悎鏍肩鐞嗕俊鎭� +export function getQualityUnqualifiedInfo(query) { + return request({ + url: '/quality/qualityUnqualified/' + query, + method: 'get', + data: query, + }) +} \ No newline at end of file diff --git a/src/views/qualityManagement/finalInspection/components/filesDia.vue b/src/views/qualityManagement/finalInspection/components/filesDia.vue new file mode 100644 index 0000000..008479c --- /dev/null +++ b/src/views/qualityManagement/finalInspection/components/filesDia.vue @@ -0,0 +1,178 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + title="涓婁紶闄勪欢" + width="50%" + @close="closeDia" + > + <div style="margin-bottom: 10px;text-align: right"> + <el-upload + v-model:file-list="fileList" + class="upload-demo" + :action="uploadUrl" + :on-success="handleUploadSuccess" + :on-error="handleUploadError" + name="file" + :show-file-list="false" + :headers="headers" + style="display: inline;margin-right: 10px" + > + <el-button type="primary">涓婁紶闄勪欢</el-button> + </el-upload> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :tableLoading="tableLoading" + :isSelection="true" + @selection-change="handleSelectionChange" + height="600" + > + </PIMTable> + <template #footer> + <div class="dialog-footer"> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; +import {Search} from "@element-plus/icons-vue"; +import { + qualityInspectParamDel, + qualityInspectParamInfo, + qualityInspectParamUpdate +} from "@/api/qualityManagement/qualityInspectParam.js"; +import {ElMessageBox} from "element-plus"; +import {getToken} from "@/utils/auth.js"; +import { + qualityInspectFileAdd, + qualityInspectFileDel, + qualityInspectFileListPage +} from "@/api/qualityManagement/qualityInspectFile.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const currentId = ref('') +const selectedRows = ref([]); +const tableColumn = ref([ + { + label: "鏂囦欢鍚嶇О", + prop: "name", + }, + // { + // label: "涓婁紶浜�", + // prop: "createUser", + // }, + // { + // label: "涓婁紶鏃堕棿", + // prop: "createTime", + // }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + operation: [ + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + downLoadFile(row); + }, + } + ], + }, +]); +const tableData = ref([]); +const fileList = ref([]); +const tableLoading = ref(false); +const headers = ref({ + Authorization: "Bearer " + getToken(), +}); +const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 + +// 鎵撳紑寮规 +const openDialog = (row) => { + dialogFormVisible.value = true; + currentId.value = row.id; + getList() +} +const getList = () => { + qualityInspectFileListPage({inspectId: currentId.value}).then(res => { + tableData.value = res.data.records; + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; +// 涓嬭浇闄勪欢 +const downLoadFile = (row) => { + proxy.$download.name(row.url); +} +// 鍏抽棴寮规 +const closeDia = () => { + dialogFormVisible.value = false; + emit('close') +}; +// 涓婁紶鎴愬姛澶勭悊 +function handleUploadSuccess(res, file) { + // 濡傛灉涓婁紶鎴愬姛 + if (res.code == 200) { + const fileRow = {} + fileRow.name = res.data.originalName + fileRow.url = res.data.tempPath + uploadFile(fileRow) + } else { + proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); + } +} +function uploadFile(file) { + file.inspectId = currentId.value; + qualityInspectFileAdd(file).then(res => { + proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛"); + getList() + }) +} +// 涓婁紶澶辫触澶勭悊 +function handleUploadError() { + proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); +} +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }).then(() => { + qualityInspectFileDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }).catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue new file mode 100644 index 0000000..adeb393 --- /dev/null +++ b/src/views/qualityManagement/finalInspection/components/formDia.vue @@ -0,0 +1,209 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + :title="operationType === 'add' ? '鏂板鍘熸潗鏂欐楠�' : '缂栬緫鍘熸潗鏂欐楠�'" + width="70%" + @close="closeDia" + > + <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="浜у搧鍚嶇О锛�" prop="productId"> + <el-tree-select + v-model="form.productId" + placeholder="璇烽�夋嫨" + clearable + check-strictly + @change="getModels" + :data="productOptions" + :render-after-expand="false" + style="width: 100%" + /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model"> + <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鍗曚綅锛�" prop="unit"> + <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏁伴噺锛�" prop="quantity"> + <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany"> + <el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult"> + <el-select v-model="form.checkResult"> + <el-option label="鍚堟牸" value="鍚堟牸" /> + <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�楠屽憳锛�" prop="checkName"> + <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable/> + + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime"> + <el-date-picker + v-model="form.checkTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getOptions} from "@/api/procurementManagement/procurementLedger.js"; +import {productTreeList} from "@/api/basicData/product.js"; +import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const data = reactive({ + form: { + checkTime: "", + process: "", + checkName: "", + productName: "", + productId: "", + model: "", + unit: "", + quantity: "", + checkCompany: "", + checkResult: "", + }, + rules: { + checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },], + process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + }, +}); +const { form, rules } = toRefs(data); +const supplierList = ref([]); +const productOptions = ref([]); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + getOptions().then((res) => { + supplierList.value = res.data; + }); + getProductOptions(); + if (operationType.value === 'edit') { + form.value = {...row} + } +} +const getProductOptions = () => { + productTreeList().then((res) => { + productOptions.value = convertIdToValue(res); + }); +}; +const getModels = (value) => { + form.value.productName = findNodeById(productOptions.value, value); +}; +const findNodeById = (nodes, productId) => { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].value === productId) { + return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣 + } + if (nodes[i].children && nodes[i].children.length > 0) { + const foundNode = findNodeById(nodes[i].children, productId); + if (foundNode) { + return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� + } + } + } + return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull +}; +function convertIdToValue(data) { + return data.map((item) => { + const { id, children, ...rest } = item; + const newItem = { + ...rest, + value: id, // 灏� id 鏀逛负 value + }; + if (children && children.length > 0) { + newItem.children = convertIdToValue(children); + } + + return newItem; + }); +} +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + proxy.$refs.formRef.validate(valid => { + if (valid) { + form.value.inspectType = 2 + if (operationType.value === "add") { + qualityInspectAdd(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } else { + qualityInspectUpdate(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } + } + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + proxy.resetForm("formRef"); + dialogFormVisible.value = false; + emit('close') +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue b/src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue new file mode 100644 index 0000000..32a36fa --- /dev/null +++ b/src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue @@ -0,0 +1,140 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + title="濉啓妫�楠岃褰�" + width="70%" + @close="closeDia" + > + <div style="margin-bottom: 10px;text-align: right"> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :tableLoading="tableLoading" + :isSelection="true" + @selection-change="handleSelectionChange" + height="600" + > + <template #slot="{ row }"> + <el-input v-model="row.testValue" clearable/> + </template> + </PIMTable> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; +import {Search} from "@element-plus/icons-vue"; +import { + qualityInspectParamDel, + qualityInspectParamInfo, + qualityInspectParamUpdate +} from "@/api/qualityManagement/qualityInspectParam.js"; +import {ElMessageBox} from "element-plus"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const currentId = ref('') +const selectedRows = ref([]); +const tableColumn = ref([ + { + label: "鎸囨爣", + prop: "parameterItem", + }, + { + label: "鍗曚綅", + prop: "unit", + }, + { + label: "鏍囧噯鍊�", + prop: "standardValue", + }, + { + label: "鍐呮帶鍊�", + prop: "controlValue", + }, + { + label: "妫�楠屽��", + prop: "testValue", + dataType: 'slot', + slot: 'slot', + }, +]); +const tableData = ref([]); +const tableLoading = ref(false); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + if (operationType.value === 'edit') { + currentId.value = row.id; + getList() + } +} +const getList = () => { + qualityInspectParamInfo(currentId.value).then(res => { + tableData.value = res.data; + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + qualityInspectParamUpdate(tableData.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + dialogFormVisible.value = false; + emit('close') +}; +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + qualityInspectParamDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue new file mode 100644 index 0000000..5af2fbb --- /dev/null +++ b/src/views/qualityManagement/finalInspection/index.vue @@ -0,0 +1,236 @@ +<template> + <div class="app-container"> + <div class="search_form"> + <div> + <span class="search_title">浜у搧鍚嶇О锛�</span> + <el-input + v-model="searchForm.productName" + style="width: 240px" + placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�" + @change="handleQuery" + clearable + :prefix-icon="Search" + /> + <el-button type="primary" @click="handleQuery" style="margin-left: 10px" + >鎼滅储</el-button + > + </div> + <div> + <el-button type="primary" @click="openForm('add')">鏂板</el-button> + <el-button @click="handleOut">瀵煎嚭</el-button> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + </div> + <div class="table_list"> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :page="page" + :isSelection="true" + @selection-change="handleSelectionChange" + :tableLoading="tableLoading" + @pagination="pagination" + :total="page.total" + ></PIMTable> + </div> + <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia> + <FormDia ref="formDia" @close="handleQuery"></FormDia> + <files-dia ref="filesDia" @close="handleQuery"></files-dia> + </div> +</template> + +<script setup> +import { Search } from "@element-plus/icons-vue"; +import {onMounted, ref} from "vue"; +import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue"; +import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue"; +import {ElMessageBox} from "element-plus"; +import {qualityInspectDel, qualityInspectListPage} from "@/api/qualityManagement/rawMaterialInspection.js"; +import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue"; + +const data = reactive({ + searchForm: { + productName: "", + }, +}); +const { searchForm } = toRefs(data); +const tableColumn = ref([ + { + label: "妫�娴嬫棩鏈�", + prop: "checkTime", + width: 120 + }, + { + label: "妫�楠屽憳", + prop: "checkName", + }, + { + label: "浜у搧鍚嶇О", + prop: "productName", + }, + { + label: "瑙勬牸鍨嬪彿", + prop: "model", + }, + { + label: "鍗曚綅", + prop: "unit", + }, + { + label: "鏁伴噺", + prop: "quantity", + width: 100 + }, + { + label: "妫�娴嬪崟浣�", + prop: "checkCompany", + width: 120 + }, + { + label: "妫�娴嬬粨鏋�", + prop: "checkResult", + dataType: "tag", + formatType: (params) => { + if (params == '涓嶅悎鏍�') { + return "danger"; + } else if (params == '鍚堟牸') { + return "success"; + } else { + return null; + } + }, + }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + fixed: "right", + width: 190, + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + openForm("edit", row); + }, + }, + { + name: "鏂板妫�楠岃褰�", + type: "text", + clickFun: (row) => { + openInspectionForm("edit", row); + }, + }, + { + name: "闄勪欢", + type: "text", + clickFun: (row) => { + openFilesFormDia(row); + }, + }, + ], + }, +]); +const tableData = ref([]); +const selectedRows = ref([]); +const tableLoading = ref(false); +const page = reactive({ + current: 1, + size: 100, + total: 0 +}); +const formDia = ref() +const filesDia = ref() +const inspectionFormDia = ref() +const { proxy } = getCurrentInstance() + +// 鏌ヨ鍒楄〃 +/** 鎼滅储鎸夐挳鎿嶄綔 */ +const handleQuery = () => { + page.current = 1; + getList(); +}; +const pagination = (obj) => { + page.current = obj.page; + page.size = obj.limit; + getList(); +}; +const getList = () => { + tableLoading.value = true; + qualityInspectListPage({...page, ...searchForm.value, inspectType: 2}).then(res => { + tableLoading.value = false; + tableData.value = res.data.records + page.total = res.data.total; + }).catch(err => { + tableLoading.value = false; + }) +}; +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; + +// 鎵撳紑寮规 +const openForm = (type, row) => { + nextTick(() => { + formDia.value?.openDialog(type, row) + }) +}; +// 鎵撳紑鏂板妫�楠屽脊妗� +const openInspectionForm = (type, row) => { + nextTick(() => { + inspectionFormDia.value?.openDialog(type, row) + }) +}; +// 鎵撳紑闄勪欢寮规 +const openFilesFormDia = (type, row) => { + nextTick(() => { + filesDia.value?.openDialog(type, row) + }) +}; + +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + qualityInspectDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +// 瀵煎嚭 +const handleOut = () => { + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + proxy.download("/quality/qualityInspect/export", {inspectType: 2}, "杩囩▼妫�楠�.xlsx"); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +onMounted(() => { + getList(); +}); +</script> + +<style scoped></style> diff --git a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue new file mode 100644 index 0000000..a6bfbd6 --- /dev/null +++ b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue @@ -0,0 +1,249 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + :title="operationType === 'add' ? '鏂板鍘熸潗鏂欐楠�' : '缂栬緫鍘熸潗鏂欐楠�'" + width="70%" + @close="closeDia" + > + <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鐘舵�侊細" prop="inspectState"> + <el-select v-model="form.inspectState"> + <el-option label="寰呭鐞�" :value="0" /> + <el-option label="宸插鐞�" :value="1" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绫诲埆锛�" prop="inspectType"> + <el-select v-model="form.inspectType"> + <el-option label="鍘熸潗鏂欐楠�" :value="0" /> + <el-option label="杩囩▼妫�楠�" :value="1" /> + <el-option label="鍑哄巶妫�楠�" :value="2" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="浜у搧鍚嶇О锛�" prop="productId"> + <el-tree-select + v-model="form.productId" + placeholder="璇烽�夋嫨" + clearable + check-strictly + @change="getModels" + :data="productOptions" + :render-after-expand="false" + style="width: 100%" + /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model"> + <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鍗曚綅锛�" prop="unit"> + <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏁伴噺锛�" prop="quantity"> + <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�楠屽憳锛�" prop="checkName"> + <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime"> + <el-date-picker + v-model="form.checkTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="涓嶅悎鏍肩幇璞★細" prop="defectivePhenomena"> + <el-input v-model="form.defectivePhenomena" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶勭悊缁撴灉锛�" prop="dealResult"> + <el-input v-model="form.dealResult" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="澶勭悊浜猴細" prop="dealName"> + <el-input v-model="form.dealName" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶勭悊鏃ユ湡锛�" prop="dealTime"> + <el-date-picker + v-model="form.dealTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {productTreeList} from "@/api/basicData/product.js"; +import { + getQualityUnqualifiedInfo, + qualityUnqualifiedAdd, + qualityUnqualifiedUpdate +} from "@/api/qualityManagement/nonconformingManagement.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const data = reactive({ + form: { + checkTime: "", + process: "", + checkName: "", + productName: "", + productId: "", + model: "", + unit: "", + quantity: "", + checkCompany: "", + checkResult: "", + inspectState: '', + inspectType: '', + defectivePhenomena: '', + dealResult: '', + }, + rules: { + checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },], + process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + }, +}); +const { form, rules } = toRefs(data); +const productOptions = ref([]); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + form.value = {} + getProductOptions(); + if (operationType.value === 'edit') { + getQualityUnqualifiedInfo(row.id).then(res => { + form.value = {...res.data} + }) + } +} +const getProductOptions = () => { + productTreeList().then((res) => { + productOptions.value = convertIdToValue(res); + }); +}; +const getModels = (value) => { + form.value.productName = findNodeById(productOptions.value, value); +}; +const findNodeById = (nodes, productId) => { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].value === productId) { + return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣 + } + if (nodes[i].children && nodes[i].children.length > 0) { + const foundNode = findNodeById(nodes[i].children, productId); + if (foundNode) { + return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� + } + } + } + return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull +}; +function convertIdToValue(data) { + return data.map((item) => { + const { id, children, ...rest } = item; + const newItem = { + ...rest, + value: id, // 灏� id 鏀逛负 value + }; + if (children && children.length > 0) { + newItem.children = convertIdToValue(children); + } + + return newItem; + }); +} +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + proxy.$refs.formRef.validate(valid => { + if (valid) { + if (operationType.value === "add") { + qualityUnqualifiedAdd(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } else { + qualityUnqualifiedUpdate(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } + } + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + proxy.resetForm("formRef"); + dialogFormVisible.value = false; + emit('close') +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue new file mode 100644 index 0000000..308d960 --- /dev/null +++ b/src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue @@ -0,0 +1,257 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + :title="operationType === 'add' ? '鏂板鍘熸潗鏂欐楠�' : '缂栬緫鍘熸潗鏂欐楠�'" + width="70%" + @close="closeDia" + > + <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鐘舵�侊細" prop="inspectState"> + <el-select v-model="form.inspectState"> + <el-option label="寰呭鐞�" :value="0" /> + <el-option label="宸插鐞�" :value="1" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绫诲埆锛�" prop="inspectType"> + <el-select v-model="form.inspectType" disabled> + <el-option label="鍘熸潗鏂欐楠�" :value="0" /> + <el-option label="杩囩▼妫�楠�" :value="1" /> + <el-option label="鍑哄巶妫�楠�" :value="2" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="浜у搧鍚嶇О锛�" prop="productId"> + <el-tree-select + v-model="form.productId" + placeholder="璇烽�夋嫨" + clearable + disabled + check-strictly + @change="getModels" + :data="productOptions" + :render-after-expand="false" + style="width: 100%" + /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model"> + <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable disabled/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鍗曚綅锛�" prop="unit"> + <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable disabled/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏁伴噺锛�" prop="quantity"> + <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable disabled/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�楠屽憳锛�" prop="checkName"> + <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable disabled/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime"> + <el-date-picker + v-model="form.checkTime" + type="date" + disabled + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="涓嶅悎鏍肩幇璞★細" prop="defectivePhenomena"> + <el-input v-model="form.defectivePhenomena" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶勭悊缁撴灉锛�" prop="dealResult"> + <el-input v-model="form.dealResult" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="澶勭悊浜猴細" prop="dealName"> + <el-input v-model="form.dealName" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="澶勭悊鏃ユ湡锛�" prop="dealTime"> + <el-date-picker + v-model="form.dealTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {productTreeList} from "@/api/basicData/product.js"; +import { + getQualityUnqualifiedInfo, + qualityUnqualifiedAdd, + qualityUnqualifiedUpdate +} from "@/api/qualityManagement/nonconformingManagement.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const data = reactive({ + form: { + checkTime: "", + process: "", + checkName: "", + productName: "", + productId: "", + model: "", + unit: "", + quantity: "", + checkCompany: "", + checkResult: "", + inspectState: '', + inspectType: '', + defectivePhenomena: '', + dealResult: '', + dealName: '', + dealTime: '', + }, + rules: { + checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },], + process: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + productId: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + quantity: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + defectivePhenomena: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + dealResult: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + dealName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + dealTime: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }], + }, +}); +const { form, rules } = toRefs(data); +const productOptions = ref([]); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + form.value = {} + getProductOptions(); + if (operationType.value === 'edit') { + getQualityUnqualifiedInfo(row.id).then(res => { + form.value = {...res.data} + }) + } +} +const getProductOptions = () => { + productTreeList().then((res) => { + productOptions.value = convertIdToValue(res); + }); +}; +const getModels = (value) => { + form.value.productName = findNodeById(productOptions.value, value); +}; +const findNodeById = (nodes, productId) => { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].value === productId) { + return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣 + } + if (nodes[i].children && nodes[i].children.length > 0) { + const foundNode = findNodeById(nodes[i].children, productId); + if (foundNode) { + return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� + } + } + } + return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull +}; +function convertIdToValue(data) { + return data.map((item) => { + const { id, children, ...rest } = item; + const newItem = { + ...rest, + value: id, // 灏� id 鏀逛负 value + }; + if (children && children.length > 0) { + newItem.children = convertIdToValue(children); + } + + return newItem; + }); +} +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + proxy.$refs.formRef.validate(valid => { + if (valid) { + if (operationType.value === "add") { + qualityUnqualifiedAdd(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } else { + qualityUnqualifiedUpdate(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } + } + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + proxy.resetForm("formRef"); + dialogFormVisible.value = false; + emit('close') +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/nonconformingManagement/index.vue b/src/views/qualityManagement/nonconformingManagement/index.vue new file mode 100644 index 0000000..319cfd5 --- /dev/null +++ b/src/views/qualityManagement/nonconformingManagement/index.vue @@ -0,0 +1,285 @@ +<template> + <div class="app-container"> + <div class="search_form"> + <div style="display: flex;flex-direction: row;align-items: center;"> + <div> + <span class="search_title">绫诲瀷锛�</span> + <el-select v-model="searchForm.inspectType" clearable style="width: 240px" @change="handleQuery"> + <el-option label="鍘熸潗鏂欐楠�" :value="0" /> + <el-option label="杩囩▼妫�楠�" :value="1" /> + <el-option label="鍑哄巶妫�楠�" :value="2" /> + </el-select> + </div> + <div style="margin-left: 10px"> + <span class="search_title">鐘舵�侊細</span> + <el-select v-model="searchForm.inspectState" clearable style="width: 240px" @change="handleQuery"> + <el-option label="寰呭鐞�" :value="0" /> + <el-option label="宸插鐞�" :value="1" /> + </el-select> + </div> + <div style="margin-left: 10px"> + <span class="search_title">浜у搧鍚嶇О锛�</span> + <el-input + v-model="searchForm.productName" + style="width: 240px" + placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�" + @change="handleQuery" + clearable + :prefix-icon="Search" + /> + </div> + <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button> + </div> + <div> + <el-button type="primary" @click="openForm('add')">鏂板</el-button> + <el-button @click="handleOut">瀵煎嚭</el-button> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + </div> + <div class="table_list"> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :page="page" + :isSelection="true" + @selection-change="handleSelectionChange" + :tableLoading="tableLoading" + @pagination="pagination" + :total="page.total" + ></PIMTable> + </div> + <FormDia ref="formDia" @close="handleQuery"></FormDia> + <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia> + </div> +</template> + +<script setup> +import { Search } from "@element-plus/icons-vue"; +import {onMounted, ref} from "vue"; +import FormDia from "@/views/qualityManagement/nonconformingManagement/components/formDia.vue"; +import {ElMessageBox} from "element-plus"; +import {qualityUnqualifiedDel, qualityUnqualifiedListPage} from "@/api/qualityManagement/nonconformingManagement.js"; +import InspectionFormDia from "@/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue"; + +const data = reactive({ + searchForm: { + inspectType: "", + inspectState: "", + productName: "", + }, +}); +const { searchForm } = toRefs(data); +const tableColumn = ref([ + { + label: "鐘舵��", + prop: "inspectState", + dataType: "tag", + formatData: (params) => { + if (params == 0) { + return "寰呭鐞�"; + } else if (params == 1) { + return "宸插鐞�"; + } else { + return null; + } + }, + formatType: (params) => { + if (params == '涓嶅悎鏍�') { + return "danger"; + } else if (params == '鍚堟牸') { + return "success"; + } else { + return null; + } + }, + }, + { + label: "妫�娴嬫棩鏈�", + prop: "checkTime", + width: 120 + }, + { + label: "绫诲埆", + prop: "inspectType", + dataType: "tag", + width: 120, + formatData: (params) => { + if (params == 0) { + return "鍘熸潗鏂欐楠�"; + } else if (params == 1) { + return "杩囩▼妫�楠�"; + } else { + return '鍑哄巶妫�楠�'; + } + }, + formatType: (params) => { + if (params == '涓嶅悎鏍�') { + return "info"; + } else if (params == '鍚堟牸') { + return "success"; + } else { + return 'primary'; + } + }, + }, + { + label: "妫�楠屽憳", + prop: "checkName", + }, + { + label: "浜у搧鍚嶇О", + prop: "productName", + }, + { + label: "瑙勬牸鍨嬪彿", + prop: "model", + }, + { + label: "鍗曚綅", + prop: "unit", + }, + { + label: "鏁伴噺", + prop: "quantity", + width: 100 + }, + { + label: "涓嶅悎鏍肩幇璞�", + prop: "defectivePhenomena", + width: 120 + }, + { + label: "澶勭悊缁撴灉", + prop: "dealResult", + width: 120 + }, + { + label: "澶勭悊浜�", + prop: "dealName", + width: 120 + }, + { + label: "澶勭悊鏃ユ湡", + prop: "dealTime", + width: 120 + }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + fixed: "right", + width: 120, + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + openForm("edit", row); + }, + }, + { + name: "澶勭悊", + type: "text", + clickFun: (row) => { + openInspectionForm("edit", row); + }, + }, + ], + }, +]); +const tableData = ref([]); +const selectedRows = ref([]); +const tableLoading = ref(false); +const page = reactive({ + current: 1, + size: 100, + total: 0 +}); +const formDia = ref() +const inspectionFormDia = ref() +const { proxy } = getCurrentInstance() + +// 鏌ヨ鍒楄〃 +/** 鎼滅储鎸夐挳鎿嶄綔 */ +const handleQuery = () => { + page.current = 1; + getList(); +}; +const pagination = (obj) => { + page.current = obj.page; + page.size = obj.limit; + getList(); +}; +const getList = () => { + tableLoading.value = true; + qualityUnqualifiedListPage({...page, ...searchForm.value}).then(res => { + tableLoading.value = false; + tableData.value = res.data.records + page.total = res.data.total; + }).catch(err => { + tableLoading.value = false; + }) +}; +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; + +// 鎵撳紑寮规 +const openForm = (type, row) => { + nextTick(() => { + formDia.value?.openDialog(type, row) + }) +}; +// 鎵撳紑澶勭悊寮规 +const openInspectionForm = (type, row) => { + nextTick(() => { + inspectionFormDia.value?.openDialog(type, row) + }) +}; + +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + qualityUnqualifiedDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +// 瀵煎嚭 +const handleOut = () => { + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + proxy.download("/quality/qualityUnqualified/export", {}, "涓嶅悎鏍肩鐞�.xlsx"); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +onMounted(() => { + getList(); +}); +</script> + +<style scoped></style> diff --git a/src/views/qualityManagement/processInspection/components/filesDia.vue b/src/views/qualityManagement/processInspection/components/filesDia.vue new file mode 100644 index 0000000..008479c --- /dev/null +++ b/src/views/qualityManagement/processInspection/components/filesDia.vue @@ -0,0 +1,178 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + title="涓婁紶闄勪欢" + width="50%" + @close="closeDia" + > + <div style="margin-bottom: 10px;text-align: right"> + <el-upload + v-model:file-list="fileList" + class="upload-demo" + :action="uploadUrl" + :on-success="handleUploadSuccess" + :on-error="handleUploadError" + name="file" + :show-file-list="false" + :headers="headers" + style="display: inline;margin-right: 10px" + > + <el-button type="primary">涓婁紶闄勪欢</el-button> + </el-upload> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :tableLoading="tableLoading" + :isSelection="true" + @selection-change="handleSelectionChange" + height="600" + > + </PIMTable> + <template #footer> + <div class="dialog-footer"> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; +import {Search} from "@element-plus/icons-vue"; +import { + qualityInspectParamDel, + qualityInspectParamInfo, + qualityInspectParamUpdate +} from "@/api/qualityManagement/qualityInspectParam.js"; +import {ElMessageBox} from "element-plus"; +import {getToken} from "@/utils/auth.js"; +import { + qualityInspectFileAdd, + qualityInspectFileDel, + qualityInspectFileListPage +} from "@/api/qualityManagement/qualityInspectFile.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const currentId = ref('') +const selectedRows = ref([]); +const tableColumn = ref([ + { + label: "鏂囦欢鍚嶇О", + prop: "name", + }, + // { + // label: "涓婁紶浜�", + // prop: "createUser", + // }, + // { + // label: "涓婁紶鏃堕棿", + // prop: "createTime", + // }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + operation: [ + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + downLoadFile(row); + }, + } + ], + }, +]); +const tableData = ref([]); +const fileList = ref([]); +const tableLoading = ref(false); +const headers = ref({ + Authorization: "Bearer " + getToken(), +}); +const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 + +// 鎵撳紑寮规 +const openDialog = (row) => { + dialogFormVisible.value = true; + currentId.value = row.id; + getList() +} +const getList = () => { + qualityInspectFileListPage({inspectId: currentId.value}).then(res => { + tableData.value = res.data.records; + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; +// 涓嬭浇闄勪欢 +const downLoadFile = (row) => { + proxy.$download.name(row.url); +} +// 鍏抽棴寮规 +const closeDia = () => { + dialogFormVisible.value = false; + emit('close') +}; +// 涓婁紶鎴愬姛澶勭悊 +function handleUploadSuccess(res, file) { + // 濡傛灉涓婁紶鎴愬姛 + if (res.code == 200) { + const fileRow = {} + fileRow.name = res.data.originalName + fileRow.url = res.data.tempPath + uploadFile(fileRow) + } else { + proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); + } +} +function uploadFile(file) { + file.inspectId = currentId.value; + qualityInspectFileAdd(file).then(res => { + proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛"); + getList() + }) +} +// 涓婁紶澶辫触澶勭悊 +function handleUploadError() { + proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); +} +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }).then(() => { + qualityInspectFileDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }).catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue new file mode 100644 index 0000000..8e6466a --- /dev/null +++ b/src/views/qualityManagement/processInspection/components/formDia.vue @@ -0,0 +1,216 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + :title="operationType === 'add' ? '鏂板鍘熸潗鏂欐楠�' : '缂栬緫鍘熸潗鏂欐楠�'" + width="70%" + @close="closeDia" + > + <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="宸ュ簭锛�" prop="process"> + <el-input v-model="form.process" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="浜у搧鍚嶇О锛�" prop="productId"> + <el-tree-select + v-model="form.productId" + placeholder="璇烽�夋嫨" + clearable + check-strictly + @change="getModels" + :data="productOptions" + :render-after-expand="false" + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model"> + <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鍗曚綅锛�" prop="unit"> + <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏁伴噺锛�" prop="quantity"> + <el-input v-model="form.quantity" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany"> + <el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult"> + <el-select v-model="form.checkResult"> + <el-option label="鍚堟牸" value="鍚堟牸" /> + <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="妫�楠屽憳锛�" prop="checkName"> + <el-input v-model="form.checkName" placeholder="璇疯緭鍏�" clearable/> + + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime"> + <el-date-picker + v-model="form.checkTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + clearable + style="width: 100%" + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getOptions} from "@/api/procurementManagement/procurementLedger.js"; +import {productTreeList} from "@/api/basicData/product.js"; +import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const data = reactive({ + form: { + checkTime: "", + process: "", + checkName: "", + productName: "", + productId: "", + model: "", + unit: "", + quantity: "", + checkCompany: "", + checkResult: "", + }, + rules: { + checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },], + process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }], + }, +}); +const { form, rules } = toRefs(data); +const supplierList = ref([]); +const productOptions = ref([]); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + getOptions().then((res) => { + supplierList.value = res.data; + }); + getProductOptions(); + if (operationType.value === 'edit') { + form.value = {...row} + } +} +const getProductOptions = () => { + productTreeList().then((res) => { + productOptions.value = convertIdToValue(res); + }); +}; +const getModels = (value) => { + form.value.productName = findNodeById(productOptions.value, value); +}; +const findNodeById = (nodes, productId) => { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].value === productId) { + return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣 + } + if (nodes[i].children && nodes[i].children.length > 0) { + const foundNode = findNodeById(nodes[i].children, productId); + if (foundNode) { + return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� + } + } + } + return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull +}; +function convertIdToValue(data) { + return data.map((item) => { + const { id, children, ...rest } = item; + const newItem = { + ...rest, + value: id, // 灏� id 鏀逛负 value + }; + if (children && children.length > 0) { + newItem.children = convertIdToValue(children); + } + + return newItem; + }); +} +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + proxy.$refs.formRef.validate(valid => { + if (valid) { + form.value.inspectType = 1 + if (operationType.value === "add") { + qualityInspectAdd(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } else { + qualityInspectUpdate(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) + } + } + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + proxy.resetForm("formRef"); + dialogFormVisible.value = false; + emit('close') +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/processInspection/components/inspectionFormDia.vue b/src/views/qualityManagement/processInspection/components/inspectionFormDia.vue new file mode 100644 index 0000000..32a36fa --- /dev/null +++ b/src/views/qualityManagement/processInspection/components/inspectionFormDia.vue @@ -0,0 +1,140 @@ +<template> + <div> + <el-dialog + v-model="dialogFormVisible" + title="濉啓妫�楠岃褰�" + width="70%" + @close="closeDia" + > + <div style="margin-bottom: 10px;text-align: right"> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :tableLoading="tableLoading" + :isSelection="true" + @selection-change="handleSelectionChange" + height="600" + > + <template #slot="{ row }"> + <el-input v-model="row.testValue" clearable/> + </template> + </PIMTable> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import {ref} from "vue"; +import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; +import {Search} from "@element-plus/icons-vue"; +import { + qualityInspectParamDel, + qualityInspectParamInfo, + qualityInspectParamUpdate +} from "@/api/qualityManagement/qualityInspectParam.js"; +import {ElMessageBox} from "element-plus"; +const { proxy } = getCurrentInstance() +const emit = defineEmits(['close']) + +const dialogFormVisible = ref(false); +const operationType = ref('') +const currentId = ref('') +const selectedRows = ref([]); +const tableColumn = ref([ + { + label: "鎸囨爣", + prop: "parameterItem", + }, + { + label: "鍗曚綅", + prop: "unit", + }, + { + label: "鏍囧噯鍊�", + prop: "standardValue", + }, + { + label: "鍐呮帶鍊�", + prop: "controlValue", + }, + { + label: "妫�楠屽��", + prop: "testValue", + dataType: 'slot', + slot: 'slot', + }, +]); +const tableData = ref([]); +const tableLoading = ref(false); + +// 鎵撳紑寮规 +const openDialog = (type, row) => { + operationType.value = type; + dialogFormVisible.value = true; + if (operationType.value === 'edit') { + currentId.value = row.id; + getList() + } +} +const getList = () => { + qualityInspectParamInfo(currentId.value).then(res => { + tableData.value = res.data; + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; +// 鎻愪氦浜у搧琛ㄥ崟 +const submitForm = () => { + qualityInspectParamUpdate(tableData.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeDia(); + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + dialogFormVisible.value = false; + emit('close') +}; +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + qualityInspectParamDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +defineExpose({ + openDialog, +}); +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue new file mode 100644 index 0000000..c8a0ddd --- /dev/null +++ b/src/views/qualityManagement/processInspection/index.vue @@ -0,0 +1,241 @@ +<template> + <div class="app-container"> + <div class="search_form"> + <div> + <span class="search_title">宸ュ簭锛�</span> + <el-input + v-model="searchForm.process" + style="width: 240px" + placeholder="璇疯緭鍏ュ伐搴忔悳绱�" + @change="handleQuery" + clearable + :prefix-icon="Search" + /> + <el-button type="primary" @click="handleQuery" style="margin-left: 10px" + >鎼滅储</el-button + > + </div> + <div> + <el-button type="primary" @click="openForm('add')">鏂板</el-button> + <el-button @click="handleOut">瀵煎嚭</el-button> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + </div> + <div class="table_list"> + <PIMTable + rowKey="id" + :column="tableColumn" + :tableData="tableData" + :page="page" + :isSelection="true" + @selection-change="handleSelectionChange" + :tableLoading="tableLoading" + @pagination="pagination" + :total="page.total" + ></PIMTable> + </div> + <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia> + <FormDia ref="formDia" @close="handleQuery"></FormDia> + <files-dia ref="filesDia" @close="handleQuery"></files-dia> + </div> +</template> + +<script setup> +import { Search } from "@element-plus/icons-vue"; +import {onMounted, ref} from "vue"; +import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue"; +import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue"; +import {ElMessageBox} from "element-plus"; +import {qualityInspectDel, qualityInspectListPage} from "@/api/qualityManagement/rawMaterialInspection.js"; +import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue"; + +const data = reactive({ + searchForm: { + process: "", + }, +}); +const { searchForm } = toRefs(data); +const tableColumn = ref([ + { + label: "妫�娴嬫棩鏈�", + prop: "checkTime", + width: 120 + }, + { + label: "宸ュ簭", + prop: "process", + width: 230 + }, + { + label: "妫�楠屽憳", + prop: "checkName", + }, + { + label: "浜у搧鍚嶇О", + prop: "productName", + }, + { + label: "瑙勬牸鍨嬪彿", + prop: "model", + }, + { + label: "鍗曚綅", + prop: "unit", + }, + { + label: "鏁伴噺", + prop: "quantity", + width: 100 + }, + { + label: "妫�娴嬪崟浣�", + prop: "checkCompany", + width: 120 + }, + { + label: "妫�娴嬬粨鏋�", + prop: "checkResult", + dataType: "tag", + formatType: (params) => { + if (params == '涓嶅悎鏍�') { + return "danger"; + } else if (params == '鍚堟牸') { + return "success"; + } else { + return null; + } + }, + }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + fixed: "right", + width: 190, + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + openForm("edit", row); + }, + }, + { + name: "鏂板妫�楠岃褰�", + type: "text", + clickFun: (row) => { + openInspectionForm("edit", row); + }, + }, + { + name: "闄勪欢", + type: "text", + clickFun: (row) => { + openFilesFormDia(row); + }, + }, + ], + }, +]); +const tableData = ref([]); +const selectedRows = ref([]); +const tableLoading = ref(false); +const page = reactive({ + current: 1, + size: 100, + total: 0 +}); +const formDia = ref() +const filesDia = ref() +const inspectionFormDia = ref() +const { proxy } = getCurrentInstance() + +// 鏌ヨ鍒楄〃 +/** 鎼滅储鎸夐挳鎿嶄綔 */ +const handleQuery = () => { + page.current = 1; + getList(); +}; +const pagination = (obj) => { + page.current = obj.page; + page.size = obj.limit; + getList(); +}; +const getList = () => { + tableLoading.value = true; + qualityInspectListPage({...page, ...searchForm.value, inspectType: 1}).then(res => { + tableLoading.value = false; + tableData.value = res.data.records + page.total = res.data.total; + }).catch(err => { + tableLoading.value = false; + }) +}; +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; + +// 鎵撳紑寮规 +const openForm = (type, row) => { + nextTick(() => { + formDia.value?.openDialog(type, row) + }) +}; +// 鎵撳紑鏂板妫�楠屽脊妗� +const openInspectionForm = (type, row) => { + nextTick(() => { + inspectionFormDia.value?.openDialog(type, row) + }) +}; +// 鎵撳紑闄勪欢寮规 +const openFilesFormDia = (type, row) => { + nextTick(() => { + filesDia.value?.openDialog(type, row) + }) +}; + +// 鍒犻櫎 +const handleDelete = () => { + let ids = []; + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map((item) => item.id); + } else { + proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁"); + return; + } + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + qualityInspectDel(ids).then((res) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +// 瀵煎嚭 +const handleOut = () => { + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + proxy.download("/quality/qualityInspect/export", {inspectType: 1}, "杩囩▼妫�楠�.xlsx"); + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; +onMounted(() => { + getList(); +}); +</script> + +<style scoped></style> diff --git a/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue index efed304..cdce2c5 100644 --- a/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue +++ b/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue @@ -3,7 +3,7 @@ <el-dialog v-model="dialogFormVisible" title="涓婁紶闄勪欢" - width="70%" + width="50%" @close="closeDia" > <div style="margin-bottom: 10px;text-align: right"> @@ -68,14 +68,14 @@ label: "鏂囦欢鍚嶇О", prop: "name", }, - { - label: "涓婁紶浜�", - prop: "unit", - }, - { - label: "涓婁紶鏃堕棿", - prop: "standardValue", - }, + // { + // label: "涓婁紶浜�", + // prop: "createUser", + // }, + // { + // label: "涓婁紶鏃堕棿", + // prop: "createTime", + // }, { dataType: "action", label: "鎿嶄綔", @@ -85,7 +85,7 @@ name: "涓嬭浇", type: "text", clickFun: (row) => { - openForm("edit", row); + downLoadFile(row); }, } ], @@ -97,7 +97,7 @@ const headers = ref({ Authorization: "Bearer " + getToken(), }); -const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 // 鎵撳紑寮规 const openDialog = (row) => { @@ -106,7 +106,7 @@ getList() } const getList = () => { - qualityInspectFileListPage(currentId.value).then(res => { + qualityInspectFileListPage({inspectId: currentId.value}).then(res => { tableData.value = res.data.records; }) } @@ -124,7 +124,10 @@ function handleUploadSuccess(res, file) { // 濡傛灉涓婁紶鎴愬姛 if (res.code == 200) { - uploadFile(res) + const fileRow = {} + fileRow.name = res.data.originalName + fileRow.url = res.data.tempPath + uploadFile(fileRow) } else { proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); } @@ -140,6 +143,10 @@ function handleUploadError() { proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触"); } +// 涓嬭浇闄勪欢 +const downLoadFile = (row) => { + proxy.$download.name(row.url); +} // 鍒犻櫎 const handleDelete = () => { let ids = []; diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue index 78d09b8..9732bc9 100644 --- a/src/views/qualityManagement/rawMaterialInspection/index.vue +++ b/src/views/qualityManagement/rawMaterialInspection/index.vue @@ -6,7 +6,7 @@ <el-input v-model="searchForm.supplier" style="width: 240px" - placeholder="璇疯緭鍏ュ鍚嶆悳绱�" + placeholder="璇疯緭鍏ヤ緵搴斿晢鎼滅储" @change="handleQuery" clearable :prefix-icon="Search" -- Gitblit v1.9.3