From 0192a021f8ed1f149ac74a10d144b530e54fb967 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Tue, 20 Jan 2026 17:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E5=85=A5=E5=BA=93=EF=BC=8C?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E5=85=A5=E5=BA=93=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/purchase/goodsEntry.js | 6 +- .../material/purchase/goodsEntry/detail.vue | 931 ++++++++---------- 2 files changed, 411 insertions(+), 526 deletions(-) diff --git a/src/api/purchase/goodsEntry.js b/src/api/purchase/goodsEntry.js index e4e3d0cf..88ac27fb 100644 --- a/src/api/purchase/goodsEntry.js +++ b/src/api/purchase/goodsEntry.js @@ -30,10 +30,10 @@ export function rejectPurchaseWarehouse(data) { // 查询入库编码列表 -export function getMachineById(data) { +export function getMachineById(query) { return request({ url: '/material/purchase/storage/getMachineById', - method: 'post', - data: data + method: 'get', + params: query }) } diff --git a/src/views/material/purchase/goodsEntry/detail.vue b/src/views/material/purchase/goodsEntry/detail.vue index 0941c60c..762ca91b 100644 --- a/src/views/material/purchase/goodsEntry/detail.vue +++ b/src/views/material/purchase/goodsEntry/detail.vue @@ -11,26 +11,14 @@ /> - - - + + - - 查询 重置 @@ -39,46 +27,28 @@ - 新购到货入库 - - - 导出 - - - + 新购到货入库 + + + 导出 + + - - - - + @@ -87,22 +57,20 @@ - - {{scope.row.manageType === 0 ? scope.row.bindNum - scope.row.inputNum : scope.row.checkNum - scope.row.inputNum }} - - + + {{scope.row.manageType === 0 ? scope.row.bindNum - scope.row.inputNum : scope.row.checkNum - scope.row.inputNum }} + + - - - - 编码管理 - 数量管理 - + + 编码管理 + 数量管理 + @@ -120,119 +88,92 @@ - - - 入库 - - - + + + 入库 + + - - - - - - - - {{this.rowData.maTypeName}} - - - - - {{this.rowData.typeName}} - - - - + + + + + + {{this.rowData.maTypeName}} + + + + + {{this.rowData.typeName}} + + + - 上传 + 上传 - 查看 + 查看 - - - + - + - - - - - - - - - 查看 - - - - - + + + + + + + + + 查看 + + + + + - - - - - - - - - - - - - - - - 入库 - + - + + + {{ (codeQueryParams.pageNum - 1) * codeQueryParams.pageSize + scope.$index + 1 }} + + {{ codeRowData.maTypeName }} @@ -245,18 +186,16 @@ - - + - - @@ -277,6 +216,8 @@ export default { // 遮罩层 loading: false, dialogLoading: false, + // 编码入库表格loading + codeLoading: false, isView: false, // 非单个禁用 single: true, @@ -307,15 +248,13 @@ export default { ], // 查询参数 queryParams: { - // pageNum: 1, - // pageSize: 10, typeId:undefined, supplierId:undefined, productionTime:undefined, }, fileListInfo: [], fileId: '', - //图片查看弹窗 + //图片查看弹窗 dialogImageUrl: '', dialogVisible: false, dialogVisibleFile: false, @@ -332,399 +271,345 @@ export default { codeTableData:[], inPutList:[], purchaseCheckInfo: null, - // 分页相关 + // 编码入库分页参数 codeQueryParams: { pageNum: 1, - pageSize: 10 + pageSize: 10, + taskId: '', + typeId: '' }, - codeTotal: 0, + // 编码入库总条数 + codeTotal: 0 }; }, mounted() { - - const taskId = this.$route.query && this.$route.query.taskId - const Id = this.$route.query && this.$route.query.Id - const isView = this.$route.query && this.$route.query.isView - this.taskId = taskId; - this.Id = Id; - if(isView=='true'){ - this.isView=true; - }else{ - this.isView=false; - } - this.getDeviceType() - this.getSupplierList() - - console.log(this.isView) - this.getList() + const taskId = this.$route.query && this.$route.query.taskId + const Id = this.$route.query && this.$route.query.Id + const isView = this.$route.query && this.$route.query.isView + this.taskId = taskId; + this.Id = Id; + if(isView=='true'){ + this.isView=true; + }else{ + this.isView=false; + } + this.getDeviceType() + this.getSupplierList() + console.log(this.isView) + this.getList() }, methods: { - // 返回列表页 - jumpList() { - const obj = { path: '/purchase/goodsEntry' } - this.$tab.closeOpenPage(obj) - }, - getDeviceType(){ - getDeviceType({level:4,skipPermission:1}).then(response => { - let matModelRes = response.data; - this.materialModelList = matModelRes.map((item) => { - return { - label: item.typeName, - value: item.typeId, - }; - }); - }); - }, - getSupplierList(){ - getManufacturerSelect().then(response => { - let arrRes = response.rows; - this.supplierList = arrRes.map((item) => { - return { - label: item.supplier, - value: item.supplierId, - }; - }); - }); - }, - /** 查询列表 */ - getList() { - this.loading = true; - this.queryParams.id=this.Id - this.queryParams.taskId=this.taskId - this.queryParams.taskStage=4 - // this.queryParams.statusList=[3,13,4,14,19] - getPurchaseDetailsList(this.queryParams).then(response => { - this.tableList = response.data.purchaseCheckDetailsList; - this.purchaseCheckInfo = response.data.purchaseCheckInfo - this.tableList.forEach((item) => { - item.fixCodeStr = this.fixCodeList[Number(item.fixCode)] - }) - console.log(this.tableList) - // this.total = response.total; - this.loading = false; - }); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm("queryForm"); - this.queryParams.keyWord=null; - this.handleQuery(); - }, - /** 搜索按钮操作 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.id) - this.single = selection.length != 1 - this.multiple = !selection.length - }, - //入库 - pass(row) { - if(row.manageType==0){//编码 - this.codeRowData=row - // let param={ - // taskId:this.taskId, - // typeId:this.codeRowData.typeId - // } - // getMachineById(param).then((res)=>{ - // console.log("11111",res.data) - // this.codeTableData=res.data - // this.inPutList=[] - // this.openCode=true - // }) - // 重置分页参数 - this.codeQueryParams = { - pageNum: 1, - pageSize: 10, - maCode: undefined - } - this.getCodeList() - this.openCode = true - }else{ - const inputNum = Number(row.checkNum) - Number(row.inputNum) - let obj = { - taskId: this.taskId, - typeId:row.typeId, - purchaseId: row.id, - typeName: row.maTypeName, - typeModelName: row.typeName, - manageType: row.manageType, - isRs: row.isRs, - code: this.purchaseCheckInfo.code, - maCode: row.maCode, - maTypeName: row.maTypeName, - unitName: row.unitName, - inputNum - }; - console.log('🚀 ~ obj:', obj) - this.$modal.confirm('是否确认新购入库该物资类型?') - .then(function() { - console.log(obj) - return purchaseWarehouse(obj) - }).then(() => { - this.$modal.msgSuccess('入库成功') - this.getList() - }).catch(() => {}); + // 返回列表页 + jumpList() { + const obj = { path: '/purchase/goodsEntry' } + this.$tab.closeOpenPage(obj) + }, + getDeviceType(){ + getDeviceType({level:4,skipPermission:1}).then(response => { + let matModelRes = response.data; + this.materialModelList = matModelRes.map((item) => { + return { + label: item.typeName, + value: item.typeId, + }; + }); + }); + }, + getSupplierList(){ + getManufacturerSelect().then(response => { + let arrRes = response.rows; + this.supplierList = arrRes.map((item) => { + return { + label: item.supplier, + value: item.supplierId, + }; + }); + }); + }, + /** 查询列表 */ + getList() { + this.loading = true; + this.queryParams.id=this.Id + this.queryParams.taskId=this.taskId + this.queryParams.taskStage=4 + getPurchaseDetailsList(this.queryParams).then(response => { + this.tableList = response.data.purchaseCheckDetailsList; + this.purchaseCheckInfo = response.data.purchaseCheckInfo + this.tableList.forEach((item) => { + item.fixCodeStr = this.fixCodeList[Number(item.fixCode)] + }) + console.log(this.tableList) + this.loading = false; + }); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.queryParams.keyWord=null; + this.handleQuery(); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.getList(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + this.single = selection.length != 1 + this.multiple = !selection.length + }, + //入库 + pass(row) { + if(row.manageType==0){//编码 + this.codeRowData=row + // 初始化编码分页参数 + this.codeQueryParams = { + pageNum: 1, + pageSize: 10, + taskId: this.taskId, + typeId: row.typeId } - }, - // 获取编码列表(分页) - getCodeList() { - this.codeLoading = true - let param = { - taskId: this.taskId, - typeId: this.codeRowData.typeId, - pageNum: this.codeQueryParams.pageNum, - pageSize: this.codeQueryParams.pageSize, - maCode: this.codeQueryParams.maCode + // 调用分页查询编码列表方法 + this.getMachineCodeList() + }else{ + const inputNum = Number(row.checkNum) - Number(row.inputNum) + let obj = { + taskId: this.taskId, + typeId:row.typeId, + purchaseId: row.id, + typeName: row.maTypeName, + typeModelName: row.typeName, + manageType: row.manageType, + isRs: row.isRs, + code: this.purchaseCheckInfo.code, + maCode: row.maCode, + maTypeName: row.maTypeName, + unitName: row.unitName, + inputNum + }; + console.log('🚀 ~ obj:', obj) + this.$modal.confirm('是否确认新购入库该物资类型?') + .then(function() { + console.log(obj) + return purchaseWarehouse(obj) + }).then(() => { + this.$modal.msgSuccess('入库成功') + this.getList() + }).catch(() => {}); } - - getMachineById(param).then((res) => { - if (res.data.code === 200) { - this.codeTableData = res.data.rows || [] - this.codeTotal = res.data.total || 0 - } else { - this.codeTableData = [] - this.codeTotal = 0 - } + }, + // 获取编码列表(分页版) + getMachineCodeList() { + this.codeLoading = true + // 组合分页查询参数 + let param = { + ...this.codeQueryParams, // 包含pageNum, pageSize, taskId, typeId + // 可以添加其他需要的参数 + } + getMachineById(param).then((res)=>{ + console.log("编码列表分页数据:", res.data) + // 假设接口返回格式:{data: [], total: 0} + this.codeTableData = res.data.rows + this.codeTotal = res.data.total + this.inPutList = [] + this.openCode = true this.codeLoading = false }).catch(() => { this.codeLoading = false - this.codeTableData = [] - this.codeTotal = 0 + this.$modal.msgError('获取编码列表失败') }) }, - // 编码查询 - handleCodeQuery() { - this.codeQueryParams.pageNum = 1 - this.getCodeList() + //编码勾选 + codeSelection(selection){ + console.log(selection) + this.inPutList = selection.map(item => {return {'maCode':item.maCode}}) }, - -// 重置编码查询 - resetCodeQuery() { - this.resetForm("codeQueryForm") - this.codeQueryParams = { - pageNum: 1, - pageSize: 10, - maCode: undefined - } - this.getCodeList() - }, - //编码勾选 - codeSelection(selection){ - console.log(selection) - this.inPutList = selection.map(item => {return {'maCode':item.maCode}}) - }, - //编码入库 - codeWarehouse(){ - if(this.inPutList.length>0){ - let obj = { - taskId: this.taskId, - typeId:this.codeRowData.typeId, - purchaseId: this.codeRowData.id, - inPutList: this.inPutList, - typeName: this.codeRowData.maTypeName, - typeModelName: this.codeRowData.typeName, - manageType: this.codeRowData.manageType, - isRs: this.codeRowData.isRs, - code: this.purchaseCheckInfo.code, - maCode: this.codeRowData.maCode, - maTypeName: this.codeRowData.maTypeName, - unitName: this.codeRowData.unitName, - }; - console.log(obj) - this.$modal.confirm('是否确认新购入库勾选的编码?') - .then(() => { - return purchaseWarehouse(obj) - }).then(() => { - this.openCode = false - this.getList() - this.$modal.msgSuccess('入库成功') - }).catch(() => {}); - } else { - this.$modal.msgError('请先勾选入库编码!') - } - - }, - //驳回 - reject(row) { + //编码入库 + codeWarehouse(){ + if(this.inPutList.length>0){ let obj = { - taskId: this.taskId, - typeId:row.typeId, - purchaseId: row.id + taskId: this.taskId, + typeId:this.codeRowData.typeId, + purchaseId: this.codeRowData.id, + inPutList: this.inPutList, + typeName: this.codeRowData.maTypeName, + typeModelName: this.codeRowData.typeName, + manageType: this.codeRowData.manageType, + isRs: this.codeRowData.isRs, + code: this.purchaseCheckInfo.code, + maCode: this.codeRowData.maCode, + maTypeName: this.codeRowData.maTypeName, + unitName: this.codeRowData.unitName, }; - this.$modal.confirm('是否确认驳回该物资类型?') + console.log(obj) + this.$modal.confirm('是否确认新购入库勾选的编码?') + .then(function() { + return purchaseWarehouse(obj) + }).then(() => { + this.openCode=false + this.getList() + this.$modal.msgSuccess('入库成功') + }).catch(() => {}); + }else{ + this.$modal.msgError('请先勾选入库编码!') + } + }, + //驳回 + reject(row) { + let obj = { + taskId: this.taskId, + typeId:row.typeId, + purchaseId: row.id + }; + this.$modal.confirm('是否确认驳回该物资类型?') .then(function() { console.log(obj) return rejectPurchaseWarehouse(obj) }).then(() => { - this.$modal.msgSuccess('驳回成功') - this.getList() - }).catch(() => {}); - }, - //文件管理 - async openFileDialog(row){ - this.rowData=row; - this.fileDataList = [ - { dictLabel: '合格证', fileType: '0', name: '', url: '', fileList: [], fileListTemp: [] }, - { dictLabel: '型式试验报告', fileType: '1', name: '', url: '', fileList: [], fileListTemp: [] }, - { dictLabel: '出厂检测报告', fileType: '2', name: '', url: '', fileList: [], fileListTemp: [] }, - { dictLabel: '第三方检测报告', fileType: '3', name: '', url: '', fileList: [], fileListTemp: [] }, - { dictLabel: '其他', fileType: '4', name: '', url: '', fileList: [], fileListTemp: [] } - ] - if (this.rowData.bmFileInfos == null) { - await this.getFileData() - - if (this.rowData.bmFileInfos.length > 0) { - this.rowData.bmFileInfos.forEach(item => { - let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) - this.fileDataList[index].name = item.name - this.fileDataList[index].url = item.url - this.fileDataList[index].fileList.push({ - name: item.name, - url: item.url - }) - this.fileDataList[index].fileListTemp.push({ - name: item.name, - url: item.url - }) - }) - } - } else { - if (this.rowData.bmFileInfos.length > 0) { - this.rowData.bmFileInfos.forEach(item => { - let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) - this.fileDataList[index].name = item.name - this.fileDataList[index].url = item.url - this.fileDataList[index].fileList.push({ - name: item.name, - url: item.url - }) - this.fileDataList[index].fileListTemp.push({ - name: item.name, - url: item.url - }) - }) - } - } - // this.fileDataList = [{dictLabel:"合格证",fileType:"0",name:"",url:""}, - // {dictLabel:"型式试验报告",fileType:"1",name:"",url:""}, - // {dictLabel:"出厂检测报告",fileType:"2",name:"",url:""}, - // {dictLabel:"第三方检测报告",fileType:"3",name:"",url:""}, - // {dictLabel:"其他报告",fileType:"4",name:"",url:""}] - // this.getFileData() - this.open=true - }, - async getFileData(){ - let param = { - modelId:this.rowData.typeId, - taskType:0, - taskId:this.rowData.taskId - } - this.rowData.bmFileInfos = [] - await getPurchaseFileList(param) - .then(response => { - if (response.rows.length > 0) { - response.rows.forEach(item => { - let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) - item.fileDetailList.forEach(item2 => { - // this.fileDataList[index].fileList.push({ - // name:item2.name, - // url:item2.url - // }) - // this.fileDataList[index].fileListTemp.push({ - // name:item2.name, - // url:item2.url - // }) - const obj = { - taskId: this.taskId, - taskType: '0', - name: item2.name, - url: item2.url, - modelId: this.rowData.partId, - fileType: item2.fileType - } - this.rowData.bmFileInfos.push(obj) - console.log('77777777', this.rowData) - }) - }) - } + this.$modal.msgSuccess('驳回成功') + this.getList() + }).catch(() => {}); + }, + //文件管理 + async openFileDialog(row){ + this.rowData=row; + this.fileDataList = [ + { dictLabel: '合格证', fileType: '0', name: '', url: '', fileList: [], fileListTemp: [] }, + { dictLabel: '型式试验报告', fileType: '1', name: '', url: '', fileList: [], fileListTemp: [] }, + { dictLabel: '出厂检测报告', fileType: '2', name: '', url: '', fileList: [], fileListTemp: [] }, + { dictLabel: '第三方检测报告', fileType: '3', name: '', url: '', fileList: [], fileListTemp: [] }, + { dictLabel: '其他', fileType: '4', name: '', url: '', fileList: [], fileListTemp: [] } + ] + if (this.rowData.bmFileInfos == null) { + await this.getFileData() + if (this.rowData.bmFileInfos.length > 0) { + this.rowData.bmFileInfos.forEach(item => { + let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) + this.fileDataList[index].name = item.name + this.fileDataList[index].url = item.url + this.fileDataList[index].fileList.push({ + name: item.name, + url: item.url + }) + this.fileDataList[index].fileListTemp.push({ + name: item.name, + url: item.url }) - .catch(() => {}) - }, - beforeFileUpload(row){ - this.rowData.fileType=row.fileType; - // this.rowData.dictLabel=row.dictLabel; - }, - // 文件上传成功处理 - handleFileSuccess(response, file, fileList) { - if(response.code==200){ - let param = { - "taskId": this.taskId, - "taskType": "0", - "name": response.data.name, - "url": response.data.url, - "modelId": this.rowData.typeId, - "fileType": this.rowData.fileType, - } - console.log(param) - uploadPurchaseFile(param).then((response) => { - this.$modal.msgSuccess('上传成功') - this.getFileData() - }).catch(() => { - this.$modal.msgError('上传失败') }) } - }, - - picturePreviewFile(row) { - row.fileList = [] - row.fileListTemp.forEach(item => { - row.fileList.push({ - name: item.name, - url: item.url + } else { + if (this.rowData.bmFileInfos.length > 0) { + this.rowData.bmFileInfos.forEach(item => { + let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) + this.fileDataList[index].name = item.name + this.fileDataList[index].url = item.url + this.fileDataList[index].fileList.push({ + name: item.name, + url: item.url + }) + this.fileDataList[index].fileListTemp.push({ + name: item.name, + url: item.url + }) + }) + } + } + this.open=true + }, + async getFileData(){ + let param = { + modelId:this.rowData.typeId, + taskType:0, + taskId:this.rowData.taskId + } + this.rowData.bmFileInfos = [] + await getPurchaseFileList(param) + .then(response => { + if (response.rows.length > 0) { + response.rows.forEach(item => { + let index = this.fileDataList.findIndex(v => v.fileType == item.fileType) + item.fileDetailList.forEach(item2 => { + const obj = { + taskId: this.taskId, + taskType: '0', + name: item2.name, + url: item2.url, + modelId: this.rowData.partId, + fileType: item2.fileType + } + this.rowData.bmFileInfos.push(obj) + console.log('77777777', this.rowData) }) - }) - this.fileId = row.fileType - this.fileListInfo = row.fileListTemp - - this.dialogVisibleFile = true - }, - - //图片查看 - picturePreview(file) { - this.dialogImageUrl = file.url.replaceAll('#','%23'); - const parts = file.name.split('.'); - const extension = parts.pop(); - if(extension === 'doc' || extension === 'DOC' || extension === 'docx' || extension === 'DOCX' || extension === 'pdf' || extension === 'PDF'){ - const windowName = file.name; - window.open(file.url,windowName) - }else{ - this.dialogVisible = true + }) + } + }) + .catch(() => {}) + }, + beforeFileUpload(row){ + this.rowData.fileType=row.fileType; + }, + // 文件上传成功处理 + handleFileSuccess(response, file, fileList) { + if(response.code==200){ + let param = { + "taskId": this.taskId, + "taskType": "0", + "name": response.data.name, + "url": response.data.url, + "modelId": this.rowData.typeId, + "fileType": this.rowData.fileType, } - }, - /** 导出按钮操作 */ - handleExport() { - const formatTime = (date) => { - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - const seconds = String(date.getSeconds()).padStart(2, '0'); - return `${year}${month}${day}_${hours}${minutes}${seconds}`; - }; - - const currentTime = formatTime(new Date()); - this.download( - "/material/purchase_check_info/exportDetails", - { taskId: this.taskId,taskStage:4,id:this.Id }, - `新购入库详情_${currentTime}.xlsx` - ); - }, - + console.log(param) + uploadPurchaseFile(param).then((response) => { + this.$modal.msgSuccess('上传成功') + this.getFileData() + }).catch(() => { + this.$modal.msgError('上传失败') + }) + } + }, + picturePreviewFile(row) { + row.fileList = [] + row.fileListTemp.forEach(item => { + row.fileList.push({ + name: item.name, + url: item.url + }) + }) + this.fileId = row.fileType + this.fileListInfo = row.fileListTemp + this.dialogVisibleFile = true + }, + //图片查看 + picturePreview(file) { + this.dialogImageUrl = file.url.replaceAll('#','%23'); + const parts = file.name.split('.'); + const extension = parts.pop(); + if(extension === 'doc' || extension === 'DOC' || extension === 'docx' || extension === 'DOCX' || extension === 'pdf' || extension === 'PDF'){ + const windowName = file.name; + window.open(file.url,windowName) + }else{ + this.dialogVisible = true + } + }, + /** 导出按钮操作 */ + handleExport() { + const formatTime = (date) => { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + return `${year}${month}${day}_${hours}${minutes}${seconds}`; + }; + const currentTime = formatTime(new Date()); + this.download( + "/material/purchase_check_info/exportDetails", + { taskId: this.taskId,taskStage:4,id:this.Id }, + `新购入库详情_${currentTime}.xlsx` + ); + }, } }; @@ -736,18 +621,18 @@ export default { justify-content: center; } .deviceCode { - margin-top: 10px; - padding-bottom: 20px; - font-size: 18px; + margin-top: 10px; + padding-bottom: 20px; + font-size: 18px; } ::v-deep.el-table .fixed-width .el-button--mini { - width: 60px !important; - margin-bottom: 10px; + width: 60px !important; + margin-bottom: 10px; } //隐藏图片上传框的css ::v-deep.disabled { - .el-upload--picture-card { - display: none; - } + .el-upload--picture-card { + display: none; + } }