From 06bdd4c6c598f5d5c4696bfebab8d8fd0eda25b6 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 03 七月 2025 17:09:11 +0800 Subject: [PATCH] 指标维护页面开发联调、原材料检验开发联调 --- src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 162 insertions(+), 1 deletions(-) diff --git a/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue index e573db8..efed304 100644 --- a/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue +++ b/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue @@ -1,9 +1,170 @@ <template> - <div></div> + <div> + <el-dialog + v-model="dialogFormVisible" + title="涓婁紶闄勪欢" + width="70%" + @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: "unit", + }, + { + label: "涓婁紶鏃堕棿", + prop: "standardValue", + }, + { + dataType: "action", + label: "鎿嶄綔", + align: "center", + operation: [ + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + openForm("edit", 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 + "/common/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 + +// 鎵撳紑寮规 +const openDialog = (row) => { + dialogFormVisible.value = true; + currentId.value = row.id; + getList() +} +const getList = () => { + qualityInspectFileListPage(currentId.value).then(res => { + tableData.value = res.data.records; + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection; +}; + +// 鍏抽棴寮规 +const closeDia = () => { + dialogFormVisible.value = false; + emit('close') +}; +// 涓婁紶鎴愬姛澶勭悊 +function handleUploadSuccess(res, file) { + // 濡傛灉涓婁紶鎴愬姛 + if (res.code == 200) { + uploadFile(res) + } 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> -- Gitblit v1.9.3