From 901cd45f087ffd434feda0070b174966cc37c8f3 Mon Sep 17 00:00:00 2001 From: 曹睿 <360930172@qq.com> Date: 星期一, 07 七月 2025 13:59:58 +0800 Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/product-inventory-management into dev --- src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue | 140 + src/api/qualityManagement/qualityInspectParam.js | 27 src/views/qualityManagement/finalInspection/components/inspectionFormDia.vue | 140 + src/views/qualityManagement/rawMaterialInspection/index.vue | 85 src/api/inventoryManagement/stockIn.js | 59 src/views/qualityManagement/finalInspection/index.vue | 236 +++ src/views/qualityManagement/processInspection/index.vue | 241 +++ src/api/inventoryManagement/stockManage.js | 58 src/views/inventoryManagement/receiptManagement/index.vue | 580 ++++--- src/api/qualityManagement/rawMaterialInspection.js | 34 src/views/inventoryManagement/stockManagement/index.vue | 182 +- src/views/qualityManagement/metricMaintenance/index.vue | 167 + vite.config.js | 2 src/views/qualityManagement/nonconformingManagement/components/inspectionFormDia.vue | 257 +++ src/views/inventoryManagement/dispatchLog/index.vue | 322 --- src/views/qualityManagement/processInspection/components/inspectionFormDia.vue | 140 + src/views/qualityManagement/processInspection/components/formDia.vue | 216 ++ src/views/qualityManagement/finalInspection/components/formDia.vue | 209 ++ src/views/inventoryManagement/issueManagement/index.vue | 161 - src/api/qualityManagement/metricMaintenance.js | 34 src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue | 170 ++ src/views/qualityManagement/finalInspection/components/filesDia.vue | 178 ++ src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 249 +++ src/api/inventoryManagement/stockOut.js | 47 src/views/qualityManagement/rawMaterialInspection/components/formDia.vue | 208 ++ src/views/qualityManagement/processInspection/components/filesDia.vue | 178 ++ src/api/qualityManagement/nonconformingManagement.js | 42 src/api/qualityManagement/qualityInspectFile.js | 26 src/views/qualityManagement/nonconformingManagement/index.vue | 285 +++ 29 files changed, 3,849 insertions(+), 824 deletions(-) diff --git a/src/api/inventoryManagement/stockIn.js b/src/api/inventoryManagement/stockIn.js new file mode 100644 index 0000000..b03b60b --- /dev/null +++ b/src/api/inventoryManagement/stockIn.js @@ -0,0 +1,59 @@ +import request from "@/utils/request"; + +// 鏌ヨ鍏ュ簱淇℃伅鍒楄〃 +export const getStockInPage = (params) => { + return request({ + url: "/stockin/listPage", + method: "get", + params, + }); +}; + +// 淇敼搴撳瓨淇℃伅 +export const updateStockIn = (data) => { + return request({ + url: "/stockin/update", + method: "put", + data, + }); +}; + +// 鏂板鍟嗗搧鍏ュ簱淇℃伅 +export function addSutockIn(data) { + return request({ + url: '/stockin/add', + method: 'post', + data: data + }) +} + +// 鍒犻櫎鍏ュ簱淇℃伅 +export function delStockIn(ids) { + return request({ + url: '/stockin/del', + method: 'delete', + data: ids + }) +} + +// 瀵煎嚭鍏ュ簱淇℃伅 +export function exportStockIn(query) { + return request({ + url: '/stockin/export', + method: 'get', + params: query, + responseType: 'blob' + }) +} + +export function selectProductRecordListByPuechaserId(query) { + return request({ + url: '/stockin/productlist', + method: 'get', + params: query + }) +} + + +// + diff --git a/src/api/inventoryManagement/stockManage.js b/src/api/inventoryManagement/stockManage.js new file mode 100644 index 0000000..e309241 --- /dev/null +++ b/src/api/inventoryManagement/stockManage.js @@ -0,0 +1,58 @@ +import request from "@/utils/request"; + +// 鏌ヨ搴撳瓨淇℃伅鍒楄〃 +export const getStockManagePage = (params) => { + return request({ + url: "/stockmanagement/page", + method: "get", + params, + }); +}; + + +// 淇敼搴撳瓨淇℃伅 +export const updateStockManage = (data) => { + return request({ + url: "/stockmanagement/update", + method: "put", + data, + }); +}; + +// 鍒犻櫎搴撳瓨淇℃伅 +export function delStockManage(ids) { + return request({ + url: '/stockmanagement/del', + method: 'delete', + data: ids + }) +} + +// 瀵煎嚭搴撳瓨淇℃伅 +export function exportStockManage(query) { + return request({ + url: '/stockmanagement/export', + method: 'get', + params: query, + responseType: 'blob' + }) +} + +//鍑哄簱鎺ュ彛 +export const stockOut = (data) => { + return request({ + url: '/stockmanagement/stockout', + method: 'post', + data: data + }) +} + +//鏍规嵁id鑾峰彇搴撳瓨淇℃伅 +export function getStockManageById(id) { + return request({ + url: '/stockmanagement/' + id, + method: 'get' + }) +} + +// \ No newline at end of file diff --git a/src/api/inventoryManagement/stockOut.js b/src/api/inventoryManagement/stockOut.js new file mode 100644 index 0000000..51ad1a8 --- /dev/null +++ b/src/api/inventoryManagement/stockOut.js @@ -0,0 +1,47 @@ +import request from "@/utils/request"; + +//鏌ヨ鍑哄簱鍒楄〃 +export const getStockOutPage = (params) => { + return request({ + url: "/stockout/page", + method: "get", + params, + }); +}; + +//鏂板鍑哄簱淇℃伅 +export const addStockOut = (data) => { + return request({ + url: '/stockout/add', + method: 'post', + data: data + }) +} + +//淇敼鍑哄簱淇℃伅 +export const updateStockOut = (data) => { + return request({ + url: "/stockout/update", + method: "put", + data, + }); +} + +//鍒犻櫎鍑哄簱淇℃伅 +export const delStockOut = (ids) => { + return request({ + url: '/stockout/del', + method: 'delete', + data: ids + }) +} + +//瀵煎嚭鍑哄簱淇℃伅 +export const exportStockOut = (query) => { + return request({ + url: '/stockout/export', + method: 'get', + params: query, + responseType: 'blob' + }) +} \ No newline at end of file diff --git a/src/api/qualityManagement/metricMaintenance.js b/src/api/qualityManagement/metricMaintenance.js new file mode 100644 index 0000000..8857387 --- /dev/null +++ b/src/api/qualityManagement/metricMaintenance.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' + +// 鏌ヨ鎸囨爣鍒楄〃 +export function qualityTestStandardListPage(query) { + return request({ + url: '/quality/qualityTestStandard/listPage', + method: 'get', + params: query, + }) +} +// 鏂板鎸囨爣鍒楄〃 +export function qualityTestStandardAdd(query) { + return request({ + url: '/quality/qualityTestStandard/add', + method: 'post', + data: query, + }) +} +// 淇敼鎸囨爣鍒楄〃 +export function qualityTestStandardUpdate(query) { + return request({ + url: '/quality/qualityTestStandard/update', + method: 'post', + data: query, + }) +} +// 鍒犻櫎鎸囨爣鍒楄〃 +export function qualityTestStandardDel(query) { + return request({ + url: '/quality/qualityTestStandard/del', + method: 'delete', + data: query, + }) +} \ No newline at end of file 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/api/qualityManagement/qualityInspectFile.js b/src/api/qualityManagement/qualityInspectFile.js new file mode 100644 index 0000000..1039755 --- /dev/null +++ b/src/api/qualityManagement/qualityInspectFile.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 鏌ヨ闄勪欢鍒楄〃 +export function qualityInspectFileListPage(query) { + return request({ + url: '/quality/qualityInspectFile/listPage', + method: 'get', + params: query, + }) +} +// 鏌ヨ闄勪欢鍒楄〃 +export function qualityInspectFileAdd(query) { + return request({ + url: '/quality/qualityInspectFile/add', + method: 'post', + data: query, + }) +} +// 鏌ヨ闄勪欢鍒楄〃 +export function qualityInspectFileDel(query) { + return request({ + url: '/quality/qualityInspectFile/del', + method: 'delete', + data: query, + }) +} \ No newline at end of file diff --git a/src/api/qualityManagement/qualityInspectParam.js b/src/api/qualityManagement/qualityInspectParam.js new file mode 100644 index 0000000..4618820 --- /dev/null +++ b/src/api/qualityManagement/qualityInspectParam.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +// 鏌ヨ妫�楠屾寚鏍� +export function qualityInspectParamInfo(query) { + return request({ + url: '/quality/qualityInspectParam/' + query, + method: 'get', + data: query, + }) +} +// 鎻愪氦妫�楠� +export function qualityInspectParamUpdate(query) { + return request({ + url: '/quality/qualityInspectParam/update', + method: 'post', + data: query, + }) +} + +// 鍒犻櫎妫�楠岃褰� +export function qualityInspectParamDel(query) { + return request({ + url: '/quality/qualityInspectParam/del', + method: 'delete', + data: query, + }) +} \ No newline at end of file diff --git a/src/api/qualityManagement/rawMaterialInspection.js b/src/api/qualityManagement/rawMaterialInspection.js new file mode 100644 index 0000000..e909d1a --- /dev/null +++ b/src/api/qualityManagement/rawMaterialInspection.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' + +// 鏌ヨ鍘熸潗鏂欐楠屽垪琛� +export function qualityInspectListPage(query) { + return request({ + url: '/quality/qualityInspect/listPage', + method: 'get', + params: query, + }) +} +// 鏂板鍘熸潗鏂欐楠� +export function qualityInspectAdd(query) { + return request({ + url: '/quality/qualityInspect/add', + method: 'post', + data: query, + }) +} +// 淇敼鍘熸潗鏂欐楠� +export function qualityInspectUpdate(query) { + return request({ + url: '/quality/qualityInspect/update', + method: 'post', + data: query, + }) +} +// 鍒犻櫎鍘熸潗鏂欐楠� +export function qualityInspectDel(query) { + return request({ + url: '/quality/qualityInspect/del', + method: 'delete', + data: query, + }) +} diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue index 7ad8196..81eff0b 100644 --- a/src/views/inventoryManagement/dispatchLog/index.vue +++ b/src/views/inventoryManagement/dispatchLog/index.vue @@ -4,7 +4,7 @@ <div> <span class="search_title">渚涘簲鍟嗗悕绉帮細</span> <el-input - v-model="searchForm.customerName" + v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery" @@ -16,7 +16,7 @@ > </div> <div> - <el-button type="primary" @click="openForm('add')">鏂板</el-button> + <!-- <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> @@ -38,71 +38,71 @@ <el-table-column align="center" label="搴忓彿" type="index" width="60" /> <el-table-column label="鍑哄簱鏃ユ湡" - prop="salesContractNo" + prop="inboundTime" width="100" show-overflow-tooltip /> <el-table-column label="渚涘簲鍟嗗悕绉�" - prop="customerName" + prop="supplierName" width="160" show-overflow-tooltip /> <el-table-column label="浜у搧澶х被" - prop="salesman" + prop="productCategory" width="100" show-overflow-tooltip /> <el-table-column label="瑙勬牸鍨嬪彿" - prop="projectName" + prop="specificationModel" width="100" show-overflow-tooltip /> <el-table-column label="鍗曚綅" - prop="contractAmount" + prop="unit" width="80" show-overflow-tooltip /> <el-table-column label="鍑哄簱鏁伴噺" - prop="entryPersonName" + prop="inboundQuantity" width="100" show-overflow-tooltip /> <el-table-column - label="鍚◣鍗曚环" + label="鍚◣鍗曚环(鍏�)" prop="entryDate" width="100" show-overflow-tooltip /> <el-table-column - label="鍚◣鎬讳环" + label="鍚◣鎬讳环(鍏�)" prop="executionDate" width="100" show-overflow-tooltip /> <el-table-column - label="绋庣巼" + label="绋庣巼(%)" prop="executionDate" width="100" show-overflow-tooltip /> <el-table-column - label="涓嶅惈绋庢�讳环" + label="涓嶅惈绋庢�讳环(鍏�)" prop="executionDate" - width="100" + width="180" show-overflow-tooltip /> <el-table-column label="鍑哄簱浜�" - prop="executionDate" + prop="nickname" width="80" show-overflow-tooltip /> - <el-table-column + <!-- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" @@ -117,7 +117,7 @@ >缂栬緫</el-button > </template> - </el-table-column> + </el-table-column> --> </el-table> <pagination v-show="total > 0" @@ -128,152 +128,6 @@ @pagination="paginationChange" /> </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="salesContractNo"> - <el-input - v-model="form.salesContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="浜у搧澶х被锛�" prop="salesman"> - <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable> - <el-option - v-for="item in userList" - :key="item.nickName" - :label="item.nickName" - :value="item.nickName" - /> - </el-select> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="customerContractNo"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍗曚綅锛�" prop="customerId"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍑哄簱鏃堕棿锛�" prop="projectName"> - <el-date-picker - style="width: 100%" - v-model="form.entryDate" - value-format="YYYY-MM-DD" - format="YYYY-MM-DD" - type="date" - placeholder="璇烽�夋嫨" - clearable - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍑哄簱鏁伴噺锛�" prop="customerContractNo"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍚◣鍗曚环锛�" prop="customerId"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍚◣鎬讳环锛�" prop="customerContractNo"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="绋庣巼锛�" prop="customerId"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="涓嶅惈绋庢�讳环锛�" prop="entryDate"> - <el-input - v-model="form.customerContractNo" - placeholder="璇疯緭鍏�" - clearable - /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍑哄簱浜猴細" prop="entryPerson"> - <el-select - v-model="form.entryPerson" - placeholder="璇烽�夋嫨" - clearable - > - <el-option - v-for="item in userList" - :key="item.userId" - :label="item.nickName" - :value="item.userId" - /> - </el-select> - </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> @@ -284,20 +138,17 @@ import useUserStore from "@/store/modules/user"; import { userListNoPage } from "@/api/system/user.js"; import { - ledgerListPage, - customerList, - addOrUpdateSalesLedger, - getSalesLedgerWithProducts, - delLedger, -} from "@/api/salesManagement/salesLedger.js"; + getStockOutPage, + delStockOut, +} from "@/api/inventoryManagement/stockOut.js"; + const userStore = useUserStore(); const { proxy } = getCurrentInstance(); const tableData = ref([]); -const productData = ref([]); const selectedRows = ref([]); const userList = ref([]); -const customerOption = ref([]); const tableLoading = ref(false); +const productList = ref([]) const page = reactive({ current: 1, size: 100, @@ -310,33 +161,29 @@ const dialogFormVisible = ref(false); const data = reactive({ searchForm: { - customerName: "", + supplierName: "", }, form: { - salesContractNo: "", - salesman: "", - customerContractNo: "", - customerId: "", - projectName: "", - entryPerson: "", - entryDate: "", - maintenanceTime: "", - productData: [], - executionDate: "", - }, - rules: { - salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - customerContractNo: [ - { required: true, message: "璇疯緭鍏�", trigger: "blur" }, - ], - customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + supplierId: null, + supplierName: '', + productId: null, + productName: '', + userId: userStore.userId, + nickname: '', + model: '', + productModelId: null, + unit: '', + productrecordId: null, + taxInclusiveUnitPrice: '', + taxInclusiveTotalPrice: '', + taxRate: '', + taxExclusiveTotalPrice: '', + inboundTime: '', + inboundBatch: '', + inboundQuantity: '' }, }); -const { searchForm, form, rules } = toRefs(data); +const { searchForm } = toRefs(data); // 鏌ヨ鍒楄〃 /** 鎼滅储鎸夐挳鎿嶄綔 */ @@ -351,10 +198,10 @@ }; const getList = () => { tableLoading.value = true; - ledgerListPage({ ...searchForm.value, ...page }) + getStockOutPage({ ...searchForm.value, ...page }) .then((res) => { tableLoading.value = false; - tableData.value = res.records; + tableData.value = res.data.records; tableData.value.map((item) => { item.children = []; }); @@ -364,24 +211,11 @@ tableLoading.value = false; }); }; -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.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� - } - } - } - return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull -}; + // 琛ㄦ牸閫夋嫨鏁版嵁 const handleSelectionChange = (selection) => { // 杩囨护鎺夊瓙鏁版嵁 - selectedRows.value = selection.filter((item) => item.children !== undefined); + selectedRows.value = selection.filter((item) => item.id); console.log("selection", selectedRows.value); }; const expandedRowKeys = ref([]); @@ -395,81 +229,21 @@ ]); }; -// 鎵撳紑寮规 -const openForm = async (type, row) => { - operationType.value = type; - form.value = {}; - productData.value = []; - let userLists = await userListNoPage(); - userList.value = userLists.data; - customerList().then((res) => { - customerOption.value = res; - }); - console.log("userStore.id", userStore.id); - form.value.entryPerson = userStore.id; - if (type === "edit") { - currentId.value = row.id; - getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => { - form.value = { ...res }; - form.value.entryPerson = Number(res.entryPerson); - productData.value = form.value.productData; - fileList.value = form.value.salesLedgerFiles; - }); - } - // let userAll = await userStore.getInfo() - // userList.value.forEach(element => { - // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) { - // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛 - // } - // }); - form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈� - dialogFormVisible.value = true; -}; - -// 鎻愪氦琛ㄥ崟 -const submitForm = () => { - proxy.$refs["formRef"].validate((valid) => { - if (valid) { - if (productData.value.length > 0) { - form.value.productData = proxy.HaveJson(productData.value); - } else { - proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�"); - return; - } - let tempFileIds = []; - if (fileList.value.length > 0) { - tempFileIds = fileList.value.map((item) => item.tempId); - } - form.value.tempFileIds = tempFileIds; - form.value.type = 1; - addOrUpdateSalesLedger(form.value).then((res) => { - proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); - closeDia(); - getList(); - }); - } - }); -}; -// 鍏抽棴寮规 -const closeDia = () => { - proxy.resetForm("formRef"); - dialogFormVisible.value = false; -}; - // 瀵煎嚭 const handleOut = () => { - ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { + ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { confirmButtonText: "纭", cancelButtonText: "鍙栨秷", type: "warning", }) .then(() => { - proxy.download("/sales/ledger/export", {}, "鍑哄簱鍙拌处.xlsx"); + proxy.download("/stockmanagement/export", {}, "鍑哄簱鍙拌处.xlsx"); }) .catch(() => { proxy.$modal.msg("宸插彇娑�"); }); }; + // 鍒犻櫎 const handleDelete = () => { let ids = []; @@ -485,7 +259,7 @@ type: "warning", }) .then(() => { - delLedger(ids).then((res) => { + delStockOut(ids).then((res) => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); getList(); }); diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue index 5b1088a..7ed1f68 100644 --- a/src/views/inventoryManagement/issueManagement/index.vue +++ b/src/views/inventoryManagement/issueManagement/index.vue @@ -3,14 +3,14 @@ <div class="search_form"> <div> <span class="search_title">渚涘簲鍟嗗悕绉帮細</span> - <el-input v-model="searchForm.customerName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery" + <el-input v-model="searchForm.supplierName" 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> + <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> --> </div> </div> <div class="table_list"> @@ -19,21 +19,21 @@ :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> <el-table-column align="center" type="selection" width="55" /> <el-table-column align="center" label="搴忓彿" type="index" width="60" /> - <el-table-column label="鍏ュ簱鏃堕棿" prop="salesContractNo" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱鎵规" prop="customerContractNo" width="160" show-overflow-tooltip /> - <el-table-column label="渚涘簲鍟嗗悕绉�" prop="customerName" width="160" show-overflow-tooltip /> - <el-table-column label="浜у搧澶х被" prop="salesman" width="100" show-overflow-tooltip /> - <el-table-column label="瑙勬牸鍨嬪彿" prop="projectName" width="160" show-overflow-tooltip /> - <el-table-column label="鍗曚綅" prop="contractAmount" width="70" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱鏁伴噺" prop="entryPersonName" width="90" show-overflow-tooltip /> - <el-table-column label="鍚◣鍗曚环" prop="entryDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍚◣鎬讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="绋庣巼(%)" prop="executionDate" width="80" show-overflow-tooltip /> - <el-table-column label="涓嶅惈绋庢�讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱浜�" prop="executionDate" width="80" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鏃堕棿" prop="inboundTime" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鎵规" prop="inboundBatch" width="160" show-overflow-tooltip /> + <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip /> + <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip /> + <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="160" show-overflow-tooltip /> + <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鏁伴噺" prop="stockQuantity" width="90" show-overflow-tooltip /> + <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip /> + <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱浜�" prop="nickName" width="80" show-overflow-tooltip /> <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center"> <template #default="scope"> - <el-button link type="primary" size="small" @click="openForm(scope.row);">鍑哄簱</el-button> + <el-button link type="primary" size="small" @click="openForm(scope.row);">棰嗙敤</el-button> </template> </el-table-column> </el-table> @@ -43,14 +43,14 @@ <el-dialog v-model="dialogFormVisible" :title="'鏂板鍑哄簱'" width="40%" @close="closeDia"> <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> <el-form-item label="鍑哄簱鏁伴噺锛�" prop="salesContractNo"> - <el-input v-model="form.salesContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable /> </el-form-item> <el-form-item label="鍑哄簱鏃ユ湡锛�" prop="projectName"> - <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" + <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="璇烽�夋嫨" clearable /> </el-form-item> <el-form-item label="鍑哄簱浜猴細" prop="entryPerson"> - <el-select v-model="form.entryPerson" placeholder="璇烽�夋嫨" clearable> + <el-select v-model="form.nickName" placeholder="璇烽�夋嫨" clearable> <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> </el-select> </el-form-item> @@ -72,18 +72,16 @@ import useUserStore from '@/store/modules/user' import { userListNoPage } from "@/api/system/user.js"; import { - ledgerListPage, - customerList, - addOrUpdateSalesLedger, - getSalesLedgerWithProducts, delLedger -} from "@/api/salesManagement/salesLedger.js"; + getStockManagePage, + delStockManage, + stockOut, +} from "@/api/inventoryManagement/stockManage.js"; + const userStore = useUserStore() const { proxy } = getCurrentInstance() const tableData = ref([]) -const productData = ref([]) const selectedRows = ref([]) const userList = ref([]) -const customerOption = ref([]) const tableLoading = ref(false) const page = reactive({ current: 1, @@ -96,28 +94,19 @@ const dialogFormVisible = ref(false) const data = reactive({ searchForm: { - customerName: '', + supplierName: '', + inboundQuantity:'', + inboundTime:'', + nickName: '', + userId: '', }, form: { - salesContractNo: '', - salesman: '', - customerContractNo: '', - customerId: '', - projectName: '', - entryPerson: '', - entryDate: '', - maintenanceTime: '', - productData: [], - executionDate: '' + productrecordId: '', }, rules: { - salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }] } }) const { searchForm, form, rules } = toRefs(data) @@ -135,17 +124,15 @@ } const getList = () => { tableLoading.value = true - ledgerListPage({ ...searchForm.value, ...page }).then(res => { + getStockManagePage({ ...searchForm.value, ...page }).then(res => { tableLoading.value = false - tableData.value = res.records - tableData.value.map(item => { - item.children = [] - }) - total.value = res.total + tableData.value = res.data.records + console.log('res', res.data.records) }).catch(() => { tableLoading.value = false }) } + const findNodeById = (nodes, productId) => { for (let i = 0; i < nodes.length; i++) { if (nodes[i].value === productId) { @@ -162,9 +149,8 @@ }; // 琛ㄦ牸閫夋嫨鏁版嵁 const handleSelectionChange = (selection) => { - // 杩囨护鎺夊瓙鏁版嵁 - selectedRows.value = selection.filter(item => item.children !== undefined); + selectedRows.value = selection.filter(item => item.id); console.log('selection', selectedRows.value) } const expandedRowKeys = ref([]) @@ -173,57 +159,48 @@ const summarizeMainTable = (param) => { return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); }; +const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D // 鎵撳紑寮规 const openForm = async (row) => { - // form.value = {} - // productData.value = [] - // let userLists = await userListNoPage() - // userList.value = userLists.data - // customerList().then(res => { - // customerOption.value = res - // }) - // console.log('userStore.id', userStore.id) - // form.value.entryPerson = userStore.id - // if (type === 'edit') { - // currentId.value = row.id; - // getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => { - // form.value = { ...res } - // form.value.entryPerson = Number(res.entryPerson) - // productData.value = form.value.productData - // fileList.value = form.value.salesLedgerFiles - // }) - // } - // let userAll = await userStore.getInfo() - // userList.value.forEach(element => { - // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) { - // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛 - // } - // }); - // form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈� dialogFormVisible.value = true + currentRowId.value = row.id + form.value = {} + // 鍒濆鍖栬〃鍗曟暟鎹� + form.value = { + productrecordId: '', + inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖ + inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡 + nickName: '', // 榛樿褰撳墠鐢ㄦ埛 + } + console.log('form',form.value) + // 鍔犺浇鐢ㄦ埛鍒楄〃 + try { + const userLists = await userListNoPage() + userList.value = userLists.data + } catch (error) { + console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error) + } } // 鎻愪氦琛ㄥ崟 const submitForm = () => { proxy.$refs["formRef"].validate(valid => { - if (valid) { - if (productData.value.length > 0) { - form.value.productData = proxy.HaveJson(productData.value) - } else { - proxy.$modal.msgWarning('璇锋坊鍔犱骇鍝佷俊鎭�') - return + if (valid && currentRowId.value) { + const outData = { + id: currentRowId.value, // 鍘熷璁板綍ID + Quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺 + Time: form.value.inboundTime, // 鍑哄簱鏃堕棿 + userId: form.value.userId // 鎿嶄綔浜� } - let tempFileIds = [] - if (fileList.value.length > 0) { - tempFileIds = fileList.value.map(item => item.tempId) - } - form.value.tempFileIds = tempFileIds - form.value.type = 1 - addOrUpdateSalesLedger(form.value).then(res => { + console.log(outData) + + stockOut(outData).then(res => { proxy.$modal.msgSuccess("鎻愪氦鎴愬姛") closeDia() getList() + }).catch(err => { + proxy.$modal.msgError("鍑哄簱澶辫触") }) } }) @@ -237,14 +214,14 @@ // 瀵煎嚭 const handleOut = () => { ElMessageBox.confirm( - '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�', + '鏄惁纭瀵煎嚭锛�', '瀵煎嚭', { confirmButtonText: '纭', cancelButtonText: '鍙栨秷', type: 'warning', } ).then(() => { - proxy.download("/sales/ledger/export", {}, '鍏ュ簱鍙拌处.xlsx') + proxy.download("/stockmanagement/export", {}, '鍏ュ簱鍙拌处.xlsx') }).catch(() => { proxy.$modal.msg("宸插彇娑�") }) @@ -266,7 +243,7 @@ type: 'warning', } ).then(() => { - delLedger(ids).then(res => { + delStockManage(ids).then(res => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") getList() }) diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue index 7d5caec..734d9e7 100644 --- a/src/views/inventoryManagement/receiptManagement/index.vue +++ b/src/views/inventoryManagement/receiptManagement/index.vue @@ -3,7 +3,7 @@ <div class="search_form"> <div> <span class="search_title">渚涘簲鍟嗗悕绉帮細</span> - <el-input v-model="searchForm.customerName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery" + <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery" clearable prefix-icon="Search" /> <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button> </div> @@ -19,18 +19,18 @@ :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> <el-table-column align="center" type="selection" width="55" /> <el-table-column align="center" label="搴忓彿" type="index" width="60" /> - <el-table-column label="鍏ュ簱鏃堕棿" prop="salesContractNo" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱鎵规" prop="customerContractNo" width="160" show-overflow-tooltip /> - <el-table-column label="渚涘簲鍟嗗悕绉�" prop="customerName" width="160" show-overflow-tooltip /> - <el-table-column label="浜у搧澶х被" prop="salesman" width="100" show-overflow-tooltip /> - <el-table-column label="瑙勬牸鍨嬪彿" prop="projectName" width="160" show-overflow-tooltip /> - <el-table-column label="鍗曚綅" prop="contractAmount" width="70" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱鏁伴噺" prop="entryPersonName" width="90" show-overflow-tooltip /> - <el-table-column label="鍚◣鍗曚环" prop="entryDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍚◣鎬讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="绋庣巼(%)" prop="executionDate" width="80" show-overflow-tooltip /> - <el-table-column label="涓嶅惈绋庢�讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱浜�" prop="executionDate" width="80" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鏃堕棿" prop="inboundTime" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鎵规" prop="inboundBatch" width="160" show-overflow-tooltip /> + <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip /> + <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip /> + <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="160" show-overflow-tooltip /> + <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundQuantity" width="90" show-overflow-tooltip /> + <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip /> + <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱浜�" prop="nickName" width="80" show-overflow-tooltip /> <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center"> <template #default="scope"> <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">缂栬緫</el-button> @@ -40,87 +40,71 @@ <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current" :limit="page.size" @pagination="paginationChange" /> </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="salesContractNo"> - <el-input v-model="form.salesContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-form-item label="閲囪喘璁㈠崟鍙�" prop="salesContractNo"> + <el-input + v-model="form.purchaseContractNumber" + placeholder="璇疯緭鍏ュ悎鍚屽彿" + clearable + @change="searchByContractNo" + :disabled="operationType === 'edit'" + > + <template #append> + <el-button + icon="Search" + @click="searchByContractNo" + :loading="loadingProducts" + /> + </template> + </el-input> </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="浜у搧澶х被锛�" prop="salesman"> - <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable> - <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" - :value="item.nickName" /> - </el-select> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍗曚綅锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="projectName"> - <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" - type="date" placeholder="璇烽�夋嫨" clearable /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍏ュ簱鎵规锛�" prop="entryPerson"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍏ュ簱鏁伴噺锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍚◣鍗曚环锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="鍚◣鎬讳环锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="绋庣巼锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - </el-row> - <el-row :gutter="30"> - <el-col :span="12"> - <el-form-item label="涓嶅惈绋庢�讳环锛�" prop="entryDate"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="鍏ュ簱浜猴細" prop="entryPerson"> - <el-select v-model="form.entryPerson" placeholder="璇烽�夋嫨" clearable> - <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> - </el-select> - </el-form-item> - </el-col> - </el-row> + <el-table + :data="productList" + border + v-loading="loadingProducts" + @selection-change="handleSelectionChange" + > + <el-table-column align="center" type="selection" width="55" /> + <el-table-column + align="center" + label="搴忓彿" + type="index" + width="60" + /> + <el-table-column label="浜у搧澶х被" prop="productCategory" /> + <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" /> + <el-table-column label="鍗曚綅" prop="unit" width="70" /> + <el-table-column label="渚涘簲鍟�" prop="supplierName" width="100" /> + <el-table-column label="閲囪喘鏁伴噺" prop="quantity" width="100" /> + <el-table-column label="寰呭叆搴撴暟閲�" prop="quantity0" width="100" /> + <el-table-column label="鏈鍏ュ簱鏁伴噺" prop="quantityStock" width="120"> + <template #default="scope"> + <el-input v-model="scope.row.quantityStock" type="number" :min="0" :max="scope.row.quantity0" /> + </template> + </el-table-column> + <el-table-column label="绋庣巼(%)" prop="taxRate" width="120" /> + <el-table-column + label="鍚◣鍗曚环(鍏�)" + prop="taxInclusiveUnitPrice" + :formatter="formattedNumber" + width="150" + /> + <el-table-column + label="鍚◣鎬讳环(鍏�)" + prop="taxInclusiveTotalPrice" + :formatter="formattedNumber" + width="150" + /> + <el-table-column + label="涓嶅惈绋庢�讳环(鍏�)" + prop="taxExclusiveTotalPrice" + :formatter="formattedNumber" + width="150" + /> + </el-table> </el-form> <template #footer> <div class="dialog-footer"> @@ -137,55 +121,58 @@ import { ref } from 'vue' import { ElMessageBox } from "element-plus"; import useUserStore from '@/store/modules/user' -import { userListNoPage } from "@/api/system/user.js"; import { - ledgerListPage, - customerList, - addOrUpdateSalesLedger, - getSalesLedgerWithProducts, delLedger -} from "@/api/salesManagement/salesLedger.js"; + getStockInPage, + updateStockIn, + addSutockIn, + delStockIn, + selectProductRecordListByPuechaserId +} from "@/api/inventoryManagement/stockIn.js"; + const userStore = useUserStore() const { proxy } = getCurrentInstance() + const tableData = ref([]) -const productData = ref([]) const selectedRows = ref([]) const userList = ref([]) -const customerOption = ref([]) + + +const loading = ref(false); const tableLoading = ref(false) + const page = reactive({ current: 1, size: 100, }) const total = ref(0) -const fileList = ref([]) // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁 -const operationType = ref('') -const dialogFormVisible = ref(false) +const operationType = ref('')// 鎿嶄綔绫诲瀷: 'add' 鎴� 'edit' +const dialogFormVisible = ref(false)// 寮规鏄剧ず鐘舵�� +const productList = ref([]);// 浜у搧鍒楄〃鏁版嵁 +const loadingProducts = ref(false);// 浜у搧鍔犺浇鐘舵�� +const productSelectedRows = ref([]) // 浜у搧琛ㄦ牸閫変腑琛� const data = reactive({ searchForm: { - customerName: '', + supplierName: '', }, form: { - salesContractNo: '', - salesman: '', - customerContractNo: '', - customerId: '', - projectName: '', - entryPerson: '', - entryDate: '', - maintenanceTime: '', - productData: [], - executionDate: '' + id: null, + purchaseContractNumber: '', // 閲囪喘璁㈠崟鍙� + supplierId: null, // 渚涘簲鍟咺D + supplierName: '', // 渚涘簲鍟嗗悕绉� + inboundTime: '', // 鍏ュ簱鏃堕棿 + inboundBatch: '', // 鍏ュ簱鎵规 + recorderId: userStore.userId, // 褰曞叆浜篒D + recorderName: userStore.name, // 褰曞叆浜哄鍚� + entryDate: getCurrentDate(), // 褰曞叆鏃ユ湡 + remark: '', // 澶囨敞 }, rules: { - salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + purchaseContractNumber: [{ required: true, message: "璇疯緭鍏ラ噰璐悎鍚屽彿", trigger: "blur" }], + supplierId: [{ required: true, message: "璇烽�夋嫨渚涘簲鍟�", trigger: "change" }], + inboundTime: [{ required: true, message: "璇烽�夋嫨鍏ュ簱鏃堕棿", trigger: "change" }], + inboundBatch: [{ required: true, message: "璇疯緭鍏ュ叆搴撴壒娆�", trigger: "blur" }] } }) const { searchForm, form, rules } = toRefs(data) @@ -203,157 +190,236 @@ } const getList = () => { tableLoading.value = true - ledgerListPage({ ...searchForm.value, ...page }).then(res => { + getStockInPage({ ...searchForm.value, ...page }).then(res => { tableLoading.value = false - tableData.value = res.records - tableData.value.map(item => { - item.children = [] - }) - total.value = res.total + tableData.value = res.data.records + total.value = res.data.total + console.log('tableData:', tableData.value) }).catch(() => { tableLoading.value = false }) } -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.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� - } - } - } - return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull -}; -// 琛ㄦ牸閫夋嫨鏁版嵁 -const handleSelectionChange = (selection) => { - // 杩囨护鎺夊瓙鏁版嵁 - selectedRows.value = selection.filter(item => item.children !== undefined); - console.log('selection', selectedRows.value) -} -const expandedRowKeys = ref([]) -// 涓昏〃鍚堣鏂规硶 -const summarizeMainTable = (param) => { - return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); -}; - -// 鎵撳紑寮规 -const openForm = async (type, row) => { - operationType.value = type - form.value = {} - productData.value = [] - let userLists = await userListNoPage() - userList.value = userLists.data - customerList().then(res => { - customerOption.value = res - }) - console.log('userStore.id', userStore.id) - form.value.entryPerson = userStore.id - if (type === 'edit') { - currentId.value = row.id; - getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => { - form.value = { ...res } - form.value.entryPerson = Number(res.entryPerson) - productData.value = form.value.productData - fileList.value = form.value.salesLedgerFiles - }) - } - // let userAll = await userStore.getInfo() - // userList.value.forEach(element => { - // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) { - // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛 - // } - // }); - form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈� - dialogFormVisible.value = true -} - -// 鎻愪氦琛ㄥ崟 -const submitForm = () => { - proxy.$refs["formRef"].validate(valid => { - if (valid) { - if (productData.value.length > 0) { - form.value.productData = proxy.HaveJson(productData.value) - } else { - proxy.$modal.msgWarning('璇锋坊鍔犱骇鍝佷俊鎭�') - return - } - let tempFileIds = [] - if (fileList.value.length > 0) { - tempFileIds = fileList.value.map(item => item.tempId) - } - form.value.tempFileIds = tempFileIds - form.value.type = 1 - addOrUpdateSalesLedger(form.value).then(res => { - proxy.$modal.msgSuccess("鎻愪氦鎴愬姛") - closeDia() - getList() - }) - } - }) -} -// 鍏抽棴寮规 -const closeDia = () => { - proxy.resetForm("formRef") - dialogFormVisible.value = false -} - -// 瀵煎嚭 -const handleOut = () => { - ElMessageBox.confirm( - '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�', - '瀵煎嚭', { - confirmButtonText: '纭', - cancelButtonText: '鍙栨秷', - type: 'warning', - } - ).then(() => { - proxy.download("/sales/ledger/export", {}, '鍏ュ簱鍙拌处.xlsx') - }).catch(() => { - proxy.$modal.msg("宸插彇娑�") - }) -} -// 鍒犻櫎 -const handleDelete = () => { - let ids = [] - if (selectedRows.value.length > 0) { - ids = selectedRows.value.map(item => item.id); - } else { - proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁') +// 璋冪敤selectProductRecordListByPuechaserId杩欎釜鏂规硶鏍规嵁鍚堝悓鏌ヨ鍒癷d锛屽啀璋冪敤getProductRecordByhetong杩欎釜鏂规硶鏍规嵁id鏌ヨ鍒颁骇鍝佽鍗曡褰� +// 鏂板鏍规嵁鍚堝悓鍙锋煡璇骇鍝佽褰曠殑鏂规硶 +const searchByContractNo = async () => +{ + if (!form.value.purchaseContractNumber) { + proxy.$modal.msgWarning('璇疯緭鍏ュ悎鍚屽彿') return } - ElMessageBox.confirm( - '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', - '瀵煎嚭', { - confirmButtonText: '纭', - cancelButtonText: '鍙栨秷', - type: 'warning', + try { + loadingProducts.value = true + // 鏍规嵁鍚堝悓鏌ヨ浜у搧璁板綍 + const productRes = await selectProductRecordListByPuechaserId({ + purchaseContractNumber: form.value.purchaseContractNumber + }); + console.log('productRes:', productRes) + if (!productRes.data || productRes.data.length === 0) { + proxy.$modal.msgWarning('璇ュ悎鍚屼笅娌℃湁浜у搧璁板綍') + productList.value = []; + return + } + // 澶勭悊浜у搧鏁版嵁锛屾坊鍔犳湰娆″叆搴撴暟閲忓瓧娈� + productList.value = productRes.data.map(item => ({ + ...item, + quantityStock: 0 // 鍒濆鍖栨湰娆″叆搴撴暟閲忎负0 + })) + } catch (error) { + console.error('鏌ヨ浜у搧璁板綍澶辫触:', error) + proxy.$modal.msgError('鏌ヨ浜у搧璁板綍澶辫触') + productList.value = []; + } finally { + loadingProducts.value = false } - ).then(() => { - delLedger(ids).then(res => { - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") - getList() +} + + +// 鎵撳紑寮规 + const openForm = async (type, row) => { + operationType.value = type + dialogFormVisible.value = true + + if (type === 'add') { + // 鏂板鏃跺垵濮嬪寲琛ㄥ崟 + form.value = { + id: null, + purchaseContractNumber: '', + supplierId: null, + supplierName: '', + inboundTime: '', + inboundBatch: '', + recorderId: userStore.userId, + recorderName: userStore.name, + entryDate: getCurrentDate(), + remark: '' + } + productList.value = [] // 娓呯┖浜у搧鍒楄〃 + } else { + form.value = JSON.parse(JSON.stringify(row)) + try { + loadingProducts.value = true + // 鏍规嵁鍚堝悓鍙峰姞杞藉搴旂殑浜у搧鍒楄〃锛堝亣璁� getProductByContract 鏄彲鐢ㄦ帴鍙o級 + const res = await getProductRecordByhetong(form.value.purchaseContractNumber) + productList.value = res.data.map(item => ({ + ...item, + quantityStock: item.quantityStock || 0 // 濡傛灉宸叉湁鍏ュ簱鏁伴噺鍒欎繚鐣� + })) + } catch (error) { + proxy.$modal.msgError('鍔犺浇浜у搧澶辫触') + productList.value = [] + } finally { + loadingProducts.value = false + } + } + } + + +// 鎻愪氦琛ㄥ崟 + const submitForm = async () => { + try { + await proxy.$refs.formRef.validate() + + // 楠岃瘉鑷冲皯閫夋嫨浜嗕竴涓骇鍝� + if (selectedRows.value.length === 0) { + proxy.$modal.msgError('璇峰厛鏌ヨ骞堕�夋嫨浜у搧') + return + } + + // 楠岃瘉鍏ュ簱鏁伴噺 + const invalidProducts = selectedRows.value.filter( + product => product.quantityStock <= 0 || product.quantityStock > product.quantity0 + ) + + if (invalidProducts.length > 0) { + proxy.$modal.msgError('璇蜂负鎵�鏈変骇鍝佽緭鍏ユ湁鏁堢殑鍏ュ簱鏁伴噺') + return + } + + // 鍑嗗鎻愪氦鏁版嵁 + // 鍑嗗鎻愪氦鏁版嵁 - 淇敼涓哄悗绔渶瑕佺殑鏍煎紡 + const stockInData = { + // 鍏ュ簱鍗曞熀鏈俊鎭� + ...form.value, + inboundTime: formatDateTime(form.value.inboundTime), + nickName: userStore.nickName,// 浣跨敤鏂版牸寮忓寲鍑芥暟 + details: selectedRows.value.map(product => ({ + id: product.id, + inboundQuantity: Number(product.quantityStock) + })), + }; + console.log('鍑嗗鎻愪氦鐨勬暟鎹�:', JSON.parse(JSON.stringify(stockInData))); + // 璋冪敤API + loading.value = true + await addSutockIn(stockInData) + + proxy.$modal.msgSuccess('鏂板鍏ュ簱鎴愬姛') + closeDia() + getList() // 鍒锋柊鍒楄〃 + + } catch (error) { + console.error('鎻愪氦澶辫触:', error) + if (!error.errors) { + proxy.$modal.msgError('鎿嶄綔澶辫触锛岃閲嶈瘯') + } + } finally { + loading.value = false + } + } + +// 鍏抽棴寮规 + const closeDia = () => { + proxy.$refs.formRef.resetFields() + dialogFormVisible.value = false + + } +// 琛ㄦ牸閫夋嫨鏁版嵁 + const handleSelectionChange = (selection) => { + // 杩囨护鎺夊瓙鏁版嵁 + selectedRows.value = selection.filter(item => item.id); + console.log('selection', selectedRows.value) + } + + const expandedRowKeys = ref([]) + +// 涓昏〃鍚堣鏂规硶 + const summarizeMainTable = (param) => { + return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); + }; + +// 瀵煎嚭 + const handleOut = () => { + ElMessageBox.confirm( + '鏄惁纭瀵煎嚭锛�', + '瀵煎嚭', { + confirmButtonText: '纭', + cancelButtonText: '鍙栨秷', + type: 'warning', + } + ).then(() => { + proxy.download("/stockin/export", {}, '鍏ュ簱鍙拌处.xlsx') + }).catch(() => { + proxy.$modal.msg("宸插彇娑�") }) - }).catch(() => { - proxy.$modal.msg("宸插彇娑�") - }) -} + } +// 鍒犻櫎 + 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(() => { + delStockIn(ids).then(res => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + getList() + }) + }).catch(() => { + proxy.$modal.msg("宸插彇娑�") + }) + } + // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD -function getCurrentDate() { - const today = new Date(); - const year = today.getFullYear(); - const month = String(today.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮� - const day = String(today.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; +// 淇敼涓烘洿閫氱敤鐨勬棩鏈熸椂闂存牸寮忓寲鍑芥暟 +function formatDateTime(date = new Date(), includeTime = true) { + const d = new Date(date); + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + + if (!includeTime) { + return `${year}-${month}-${day}`; // 淇濇寔鍘熸湁 getCurrentDate 鍔熻兘 + } + + // 鏂板鏃堕棿閮ㄥ垎鏍煎紡鍖� + const hours = String(d.getHours()).padStart(2, '0'); + const minutes = String(d.getMinutes()).padStart(2, '0'); + const seconds = String(d.getSeconds()).padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } -onMounted(() => { - getList() -}) + +// 淇濇寔鍘熸湁 getCurrentDate 鐨勫吋瀹规�� +function getCurrentDate() { + return formatDateTime(new Date(), false); +} + + + + + onMounted(() => { + getList() + }) </script> <style scoped lang="scss"></style> diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue index cc7df7d..b5181d2 100644 --- a/src/views/inventoryManagement/stockManagement/index.vue +++ b/src/views/inventoryManagement/stockManagement/index.vue @@ -3,12 +3,12 @@ <div class="search_form"> <div> <span class="search_title">渚涘簲鍟嗗悕绉帮細</span> - <el-input v-model="searchForm.customerName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery" + <el-input v-model="searchForm.supplierName" 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 type="primary" @click="openForm('add')">鏂板</el-button> --> <el-button @click="handleOut">瀵煎嚭</el-button> <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> </div> @@ -19,18 +19,18 @@ :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)"> <el-table-column align="center" type="selection" width="55" /> <el-table-column align="center" label="搴忓彿" type="index" width="60" /> - <el-table-column label="搴撳瓨鏃ユ湡" prop="salesContractNo" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱鏃ユ湡" prop="salesContractNo" width="100" show-overflow-tooltip /> - <el-table-column label="渚涘簲鍟嗗悕绉�" prop="customerName" width="160" show-overflow-tooltip /> - <el-table-column label="浜у搧澶х被" prop="salesman" width="100" show-overflow-tooltip /> - <el-table-column label="瑙勬牸鍨嬪彿" prop="projectName" width="100" show-overflow-tooltip /> - <el-table-column label="鍗曚綅" prop="contractAmount" width="80" show-overflow-tooltip /> - <el-table-column label="鍑哄簱鏁伴噺" prop="entryPersonName" width="100" show-overflow-tooltip /> - <el-table-column label="鍚◣鍗曚环" prop="entryDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍚◣鎬讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="绋庣巼(%)" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="涓嶅惈绋庢�讳环" prop="executionDate" width="100" show-overflow-tooltip /> - <el-table-column label="鍏ュ簱浜�" prop="executionDate" width="80" show-overflow-tooltip /> + <el-table-column label="搴撳瓨鏃ユ湡" prop="boundTime" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱鏃ユ湡" prop="inboundTime" width="100" show-overflow-tooltip /> + <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip /> + <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip /> + <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="100" show-overflow-tooltip /> + <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip /> + <el-table-column label="鍑哄簱鏁伴噺" prop="stockQuantity" width="100" show-overflow-tooltip /> + <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="绋庣巼(%)" prop="taxRate" width="100" show-overflow-tooltip /> + <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> + <el-table-column label="鍏ュ簱浜�" prop="nickName" width="80" show-overflow-tooltip /> <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center"> <template #default="scope"> <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">缂栬緫</el-button> @@ -45,41 +45,46 @@ <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="salesContractNo"> - <el-input v-model="form.salesContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierName"> + <el-input v-model="form.supplierName" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="浜у搧澶х被锛�" prop="salesman"> - <el-select v-model="form.salesman" placeholder="璇烽�夋嫨" clearable> - <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" - :value="item.nickName" /> + <el-form-item label="浜у搧澶х被锛�" prop="productId"> + <el-select v-model="form.productId" placeholder="璇烽�夋嫨" clearable filterable @change="handleProductChange"> + <el-option v-for="item in productList" :key="item.id" :label="item.productName" + :value="item.id" /> </el-select> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> - <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productManageId"> + <el-select v-model="form.productModelId" placeholder="璇峰厛閫夋嫨浜у搧澶х被" clearable filterable :disabled="!form.productId" + @change="handleModelChange"> + <el-option v-for="item in productModelList" :key="item.id" :label="item.model" + :value="item.id" /> + </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="鍗曚綅锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.unit" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> </el-row> <el-row :gutter="30"> <el-col :span="12"> - <el-form-item label="鍑哄簱鏃堕棿锛�" prop="projectName"> - <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" + <el-form-item label="搴撳瓨鏃堕棿锛�" prop="projectName"> + <el-date-picker style="width: 100%" v-model="form.boundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" placeholder="璇烽�夋嫨" clearable /> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍑哄簱鏁伴噺锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="projectName"> + <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" + type="date" placeholder="璇烽�夋嫨" clearable /> </el-form-item> </el-col> </el-row> @@ -87,12 +92,12 @@ <el-col :span="12"> <el-form-item label="鍚◣鍗曚环锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="鍚◣鎬讳环锛�" prop="customerContractNo"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.taxInclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> </el-row> @@ -100,12 +105,12 @@ <el-col :span="12"> <el-form-item label="绋庣巼锛�" prop="customerId"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.taxRate" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="涓嶅惈绋庢�讳环锛�" prop="entryDate"> - <el-input v-model="form.customerContractNo" placeholder="璇疯緭鍏�" clearable /> + <el-input v-model="form.taxExclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable /> </el-form-item> </el-col> </el-row> @@ -113,7 +118,7 @@ <el-col :span="12"> <el-form-item label="鍑哄簱浜猴細" prop="entryPerson"> - <el-select v-model="form.entryPerson" placeholder="璇烽�夋嫨" clearable> + <el-select v-model="form.nickName" placeholder="璇烽�夋嫨" clearable> <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> </el-select> </el-form-item> @@ -137,18 +142,18 @@ import useUserStore from '@/store/modules/user' import { userListNoPage } from "@/api/system/user.js"; import { - ledgerListPage, - customerList, - addOrUpdateSalesLedger, - getSalesLedgerWithProducts, delLedger -} from "@/api/salesManagement/salesLedger.js"; + getStockManagePage , + updateStockManage, + delStockManage, + exportStockManage +} from "@/api/inventoryManagement/stockManage.js"; const userStore = useUserStore() const { proxy } = getCurrentInstance() const tableData = ref([]) const productData = ref([]) const selectedRows = ref([]) const userList = ref([]) -const customerOption = ref([]) +// const customerOption = ref([]) const tableLoading = ref(false) const page = reactive({ current: 1, @@ -162,28 +167,41 @@ const dialogFormVisible = ref(false) const data = reactive({ searchForm: { - customerName: '', + supplierName: '', }, form: { - salesContractNo: '', - salesman: '', - customerContractNo: '', - customerId: '', - projectName: '', - entryPerson: '', - entryDate: '', - maintenanceTime: '', - productData: [], - executionDate: '' + supplierId: null, + supplierName: '', + productId: null, + productName: '', + userId: userStore.userId, + nickName: '', + productModelId: null, + model: '', + unit: '', + productrecordId: null, + taxInclusiveUnitPrice: '', + taxInclusiveTotalPrice: '', + taxRate: '', + taxExclusiveTotalPrice: '', + inboundTime: '', + inboundBatch: '', + stockQuantity: '', + boundTime: '', }, rules: { - salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - customerContractNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], - executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + supplierName: [{ required: true, message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', trigger: 'blur' }], + productCategory: [{ required: true, message: '璇烽�夋嫨浜у搧澶х被', trigger: 'change' }], + specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }], + unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }], + stockQuantity: [{ required: true, message: '璇疯緭鍏ュ嚭搴撴暟閲�', trigger: 'blur' }], + taxInclusiveUnitPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' }], + taxInclusiveTotalPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庢�讳环', trigger: 'blur' }], + taxRate: [{ required: true, message: '璇疯緭鍏ョ◣鐜�', trigger: 'blur' }], + taxExclusiveTotalPrice: [{ required: true, message: '璇疯緭鍏ヤ笉鍚◣鎬讳环', trigger: 'blur' }], + boundTime: [{ required: true, message: '璇烽�夋嫨搴撳瓨鏃堕棿', trigger: 'change' }], + inboundTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }], + inboundPerson: [{ required: true, message: '璇烽�夋嫨鍑哄簱浜�', trigger: 'change' }] } }) const { searchForm, form, rules } = toRefs(data) @@ -201,36 +219,24 @@ } const getList = () => { tableLoading.value = true - ledgerListPage({ ...searchForm.value, ...page }).then(res => { + getStockManagePage({ ...searchForm.value, ...page }).then(res => { tableLoading.value = false - tableData.value = res.records - tableData.value.map(item => { - item.children = [] - }) - total.value = res.total + tableData.value = res.data.records + console.log('res', res) + // tableData.value.map(item => { + // item.children = [] + // }) + // total.value = res.total }).catch(() => { tableLoading.value = false }) } -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.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐� - } - } - } - return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull -}; + // 琛ㄦ牸閫夋嫨鏁版嵁 const handleSelectionChange = (selection) => { // 杩囨护鎺夊瓙鏁版嵁 - selectedRows.value = selection.filter(item => item.children !== undefined); + selectedRows.value = selection.filter(item => item.id); console.log('selection', selectedRows.value) } const expandedRowKeys = ref([]) @@ -247,11 +253,11 @@ productData.value = [] let userLists = await userListNoPage() userList.value = userLists.data - customerList().then(res => { - customerOption.value = res - }) - console.log('userStore.id', userStore.id) - form.value.entryPerson = userStore.id + // customerList().then(res => { + // customerOption.value = res + // }) + // console.log('userStore.id', userStore.id) + // form.value.entryPerson = userStore.id if (type === 'edit') { currentId.value = row.id; getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => { @@ -261,12 +267,6 @@ fileList.value = form.value.salesLedgerFiles }) } - // let userAll = await userStore.getInfo() - // userList.value.forEach(element => { - // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) { - // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛 - // } - // }); form.value.entryDate = getCurrentDate() // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈� dialogFormVisible.value = true } @@ -304,14 +304,14 @@ // 瀵煎嚭 const handleOut = () => { ElMessageBox.confirm( - '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�', + '鏄惁纭瀵煎嚭锛�', '瀵煎嚭', { confirmButtonText: '纭', cancelButtonText: '鍙栨秷', type: 'warning', } ).then(() => { - proxy.download("/sales/ledger/export", {}, '鍑哄簱鍙拌处.xlsx') + proxy.download("/stockmanagement/export", {}, '搴撳瓨淇℃伅.xlsx') }).catch(() => { proxy.$modal.msg("宸插彇娑�") }) @@ -333,7 +333,7 @@ type: 'warning', } ).then(() => { - delLedger(ids).then(res => { + delStockManage(ids).then(res => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") getList() }) 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/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue index 908c37e..016a4c1 100644 --- a/src/views/qualityManagement/metricMaintenance/index.vue +++ b/src/views/qualityManagement/metricMaintenance/index.vue @@ -51,7 +51,7 @@ <el-button type="primary" @click="openModelDia('add')"> 鏂板妫�娴嬫寚鏍� </el-button> - <ImportExcel @uploadSuccess="getModelList" /> + <el-button @click="handleOut">瀵煎嚭</el-button> <el-button type="danger" @click="handleDelete" @@ -73,15 +73,85 @@ :total="page.total" ></PIMTable> </div> + <el-dialog + v-model="modelDia" + title="妫�娴嬫寚鏍�" + width="400px" + @close="closeModelDia" + > + <el-form + :model="modelForm" + label-width="140px" + label-position="top" + :rules="modelRules" + ref="modelFormRef" + > + <el-row> + <el-col :span="24"> + <el-form-item label="鎸囨爣锛�" prop="parameterItem"> + <el-input + v-model="modelForm.parameterItem" + placeholder="璇疯緭鍏ユ寚鏍�" + clearable + /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="24"> + <el-form-item label="鍗曚綅锛�" prop="unit"> + <el-input + v-model="modelForm.unit" + placeholder="璇疯緭鍏ュ崟浣�" + clearable + /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="24"> + <el-form-item label="鏍囧噯鍊硷細" prop="standardValue"> + <el-input + v-model="modelForm.standardValue" + placeholder="璇疯緭鍏ユ爣鍑嗗��" + clearable + /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="24"> + <el-form-item label="鍐呮帶鍊硷細" prop="controlValue"> + <el-input + v-model="modelForm.controlValue" + placeholder="璇疯緭鍏ュ唴鎺у��" + clearable + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitModelForm">纭</el-button> + <el-button @click="closeModelDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> </div> </template> <script setup> import {ref} from "vue"; -import {delProductModel, modelListPage, productTreeList} from "@/api/basicData/product.js"; +import {addOrEditProductModel, delProductModel, modelListPage, productTreeList} from "@/api/basicData/product.js"; import ImportExcel from "@/views/basicData/product/ImportExcel/index.vue"; import {ElMessageBox} from "element-plus"; - +import { + qualityTestStandardAdd, qualityTestStandardDel, + qualityTestStandardListPage, + qualityTestStandardUpdate +} from "@/api/qualityManagement/metricMaintenance.js"; +const { proxy } = getCurrentInstance(); // 鏍� const search = ref(""); const treeLoad = ref(false); @@ -107,11 +177,11 @@ }, { label: "鏍囧噯鍊�", - prop: "unit", + prop: "standardValue", }, { label: "鍐呮帶鍊�", - prop: "unit", + prop: "controlValue", }, { dataType: "action", @@ -128,41 +198,38 @@ ], }, ]); +const selectedRows = ref([]); // 鎸囨爣寮规 const modelDia = ref(false); const modelOperationType = ref(""); const data = reactive({ - form: { - productName: "", - }, - rules: { - productName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], - }, modelForm: { - model: "", + parameterItem: "", unit: "", + standardValue: "", + controlValue: "", }, modelRules: { - model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + parameterItem: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + standardValue: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + controlValue: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], }, }); -const { form, rules, modelForm, modelRules } = toRefs(data); +const { modelForm, modelRules } = toRefs(data); // 鏌ヨ浜у搧鏍� const getProductTreeList = () => { treeLoad.value = true; - productTreeList() - .then((res) => { - list.value = res; - list.value.forEach((a) => { - expandedKeys.value.push(a.label); - }); - treeLoad.value = false; - }) - .catch((err) => { - treeLoad.value = false; - }); + productTreeList().then((res) => { + list.value = res; + list.value.forEach((a) => { + expandedKeys.value.push(a.label); + }); + treeLoad.value = false; + }).catch((err) => { + treeLoad.value = false; + }); }; // 杩囨护浜у搧鏍� const searchFilter = () => { @@ -187,13 +254,13 @@ }; const getModelList = () => { tableLoading.value = true; - modelListPage({ - id: currentId.value, + qualityTestStandardListPage({ + productId: currentId.value, current: page.current, size: page.size, }).then((res) => { - tableData.value = res.records; - page.total = res.total; + tableData.value = res.data.records; + page.total = res.data.total; tableLoading.value = false; }); }; @@ -244,6 +311,19 @@ modelForm.value = { ...data }; } }; +// 瀵煎嚭 +const handleOut = () => { + ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", { + confirmButtonText: "纭", + cancelButtonText: "鍙栨秷", + type: "warning", + }).then(() => { + proxy.download("/quality/qualityTestStandard/export", {}, "妫�娴嬫寚鏍�.xlsx"); + }).catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); +}; + // 鍒犻櫎鎸囨爣 const handleDelete = () => { let ids = []; @@ -259,7 +339,7 @@ type: "warning", }).then(() => { tableLoading.value = true; - delProductModel(ids).then((res) => { + qualityTestStandardDel(ids).then((res) => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); getModelList(); }).finally(() => { @@ -269,6 +349,33 @@ proxy.$modal.msg("宸插彇娑�"); }); }; + +// 鎻愪氦瑙勬牸鍨嬪彿淇敼 +const submitModelForm = () => { + proxy.$refs.modelFormRef.validate((valid) => { + if (valid) { + modelForm.value.productId = Number(currentId.value); + if(modelOperationType.value === 'add') { + qualityTestStandardAdd(modelForm.value).then((res) => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeModelDia(); + getModelList(); + }); + } else { + qualityTestStandardUpdate(modelForm.value).then((res) => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); + closeModelDia(); + getModelList(); + }); + } + } + }); +}; +// 鍏抽棴鍨嬪彿寮规 +const closeModelDia = () => { + proxy.$refs.modelFormRef.resetFields(); + modelDia.value = false; +}; getProductTreeList(); </script> 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 e573db8..cdce2c5 100644 --- a/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue +++ b/src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue @@ -1,9 +1,177 @@ <template> - <div></div> + <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 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 downLoadFile = (row) => { + proxy.$download.name(row.url); +} +// 鍒犻櫎 +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> diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue index 5d2bcbc..32192c0 100644 --- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue +++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue @@ -2,21 +2,99 @@ <div> <el-dialog v-model="dialogFormVisible" - :title="operationType === 'add' ? '鏂板鍏ヨ亴' : '缂栬緫浜哄憳'" + :title="operationType === 'add' ? '鏂板鍘熸潗鏂欐楠�' : '缂栬緫鍘熸潗鏂欐楠�'" width="70%" @close="closeDia" > - <PIMTable - rowKey="id" - :column="tableColumn" - :tableData="tableData" - :tableLoading="tableLoading" - height="600" - > - <template #slot="{ row }"> - <el-input v-model="row.staffName" clearable/> - </template> - </PIMTable> + <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="supplier"> + <el-select + v-model="form.supplier" + placeholder="璇烽�夋嫨" + clearable + > + <el-option + v-for="item in supplierList" + :key="item.id" + :label="item.supplierName" + :value="item.supplierName" + /> + </el-select> + </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> @@ -29,62 +107,103 @@ <script setup> import {ref} from "vue"; -import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; -import {Search} from "@element-plus/icons-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 tableColumn = ref([ - { - label: "鎸囨爣", - prop: "contractTerm", +const data = reactive({ + form: { + checkTime: "", + supplier: "", + checkName: "", + productName: "", + productId: "", + model: "", + unit: "", + quantity: "", + checkCompany: "", + checkResult: "", }, - { - label: "鍗曚綅", - prop: "contractStartTime", + rules: { + checkTime: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" },], + supplier: [{ 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" }], }, - { - label: "鏍囧噯鍊�", - prop: "contractEndTime", - }, - { - label: "鍐呮帶鍊�", - prop: "contractEndTime", - }, - { - label: "妫�楠屽��", - prop: "contractEndTime", - dataType: 'slot', - slot: 'slot', - }, -]); -const tableData = ref([]); -const tableLoading = ref(false); +}); +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') { - getStaffJoinInfo(row.id).then(res => { - // tableData.value = res.data - }) + 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.staffState = 0 + form.value.inspectType = 0 if (operationType.value === "add") { - staffJoinAdd(form.value).then(res => { + qualityInspectAdd(form.value).then(res => { proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); closeDia(); }) } else { - staffJoinUpdate(form.value).then(res => { + qualityInspectUpdate(form.value).then(res => { proxy.$modal.msgSuccess("鎻愪氦鎴愬姛"); closeDia(); }) @@ -94,6 +213,7 @@ } // 鍏抽棴寮规 const closeDia = () => { + proxy.resetForm("formRef"); dialogFormVisible.value = false; emit('close') }; diff --git a/src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue new file mode 100644 index 0000000..32a36fa --- /dev/null +++ b/src/views/qualityManagement/rawMaterialInspection/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/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue index 29e52df..9732bc9 100644 --- a/src/views/qualityManagement/rawMaterialInspection/index.vue +++ b/src/views/qualityManagement/rawMaterialInspection/index.vue @@ -2,11 +2,11 @@ <div class="app-container"> <div class="search_form"> <div> - <span class="search_title">濮撳悕锛�</span> + <span class="search_title">渚涘簲鍟嗭細</span> <el-input - v-model="searchForm.staffName" + v-model="searchForm.supplier" style="width: 240px" - placeholder="璇疯緭鍏ュ鍚嶆悳绱�" + placeholder="璇疯緭鍏ヤ緵搴斿晢鎼滅储" @change="handleQuery" clearable :prefix-icon="Search" @@ -34,76 +34,73 @@ :total="page.total" ></PIMTable> </div> - <form-dia ref="formDia" @close="handleQuery"></form-dia> + <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/rawMaterialInspection/components/inspectionFormDia.vue"; import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue"; -import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; import {ElMessageBox} from "element-plus"; +import {qualityInspectDel, qualityInspectListPage} from "@/api/qualityManagement/rawMaterialInspection.js"; +import FilesDia from "@/views/qualityManagement/rawMaterialInspection/components/filesDia.vue"; const data = reactive({ searchForm: { - staffName: "", + supplier: "", }, }); const { searchForm } = toRefs(data); const tableColumn = ref([ { label: "妫�娴嬫棩鏈�", - prop: "staffNo", + prop: "checkTime", + width: 120 }, { label: "渚涘簲鍟�", - prop: "staffName", + prop: "supplier", + width: 230 }, { label: "妫�楠屽憳", - prop: "sex", + prop: "checkName", }, { label: "浜у搧鍚嶇О", - prop: "nativePlace", + prop: "productName", }, { label: "瑙勬牸鍨嬪彿", - prop: "nativePlace", + prop: "model", }, { label: "鍗曚綅", - prop: "nativePlace", + prop: "unit", }, { label: "鏁伴噺", - prop: "contractStartTime", + prop: "quantity", width: 120 }, { label: "妫�娴嬪崟浣�", - prop: "contractEndTime", + prop: "checkCompany", width: 120 }, { label: "妫�娴嬬粨鏋�", - prop: "staffState", + prop: "checkResult", dataType: "tag", - formatData: (params) => { - if (params == 0) { - return "绂昏亴"; - } else if (params == 1) { - return "鍦ㄨ亴"; - } else { - return null; - } - }, formatType: (params) => { - if (params == 0) { + if (params == '涓嶅悎鏍�') { return "danger"; - } else if (params == 1) { - return "primary"; + } else if (params == '鍚堟牸') { + return "success"; } else { return null; } @@ -114,20 +111,27 @@ label: "鎿嶄綔", align: "center", fixed: "right", - width: 160, + width: 190, operation: [ { - name: "鏂板妫�楠岃褰�", + name: "缂栬緫", type: "text", clickFun: (row) => { openForm("edit", row); }, }, { + name: "鏂板妫�楠岃褰�", + type: "text", + clickFun: (row) => { + openInspectionForm("edit", row); + }, + }, + { name: "闄勪欢", type: "text", clickFun: (row) => { - openForm("edit", row); + openFilesFormDia(row); }, }, ], @@ -142,6 +146,8 @@ total: 0 }); const formDia = ref() +const filesDia = ref() +const inspectionFormDia = ref() const { proxy } = getCurrentInstance() // 鏌ヨ鍒楄〃 @@ -157,11 +163,10 @@ }; const getList = () => { tableLoading.value = true; - staffJoinListPage({...page, ...searchForm.value, staffState: 0}).then(res => { + qualityInspectListPage({...page, ...searchForm.value, inspectType: 0}).then(res => { tableLoading.value = false; tableData.value = res.data.records page.total = res.data.total; - console.log(page) }).catch(err => { tableLoading.value = false; }) @@ -175,6 +180,18 @@ 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) }) }; @@ -193,7 +210,7 @@ type: "warning", }) .then(() => { - staffJoinDel(ids).then((res) => { + qualityInspectDel(ids).then((res) => { proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); getList(); }); @@ -210,7 +227,7 @@ type: "warning", }) .then(() => { - proxy.download("/staff/staffJoinLeaveRecord/export", {staffState: 0}, "浜哄憳绂昏亴.xlsx"); + proxy.download("/quality/qualityInspect/export", {inspectType: 0}, "鍘熸潗鏂欐楠�.xlsx"); }) .catch(() => { proxy.$modal.msg("宸插彇娑�"); diff --git a/vite.config.js b/vite.config.js index 0100f5c..2f9c048 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,7 +8,7 @@ const { VITE_APP_ENV } = env; const baseUrl = VITE_APP_ENV == "development" - ? "http://192.168.10.2:7003" // 寮�鍙戠幆澧冨悗绔帴鍙� + ? "http://127.0.0.1:7005" // 寮�鍙戠幆澧冨悗绔帴鍙� : "http://114.132.189.42:7003"; // 鐢熶骇鐜鍚庣鎺ュ彛 return { -- Gitblit v1.9.3