diff --git a/src/views/modules/part/partInformation.vue b/src/views/modules/part/partInformation.vue index 870fbf8..7324b66 100644 --- a/src/views/modules/part/partInformation.vue +++ b/src/views/modules/part/partInformation.vue @@ -2718,7 +2718,6 @@ }) }, - /** * 物料信息编辑模态框 * @param row diff --git a/src/views/modules/part/part_create.vue b/src/views/modules/part/part_create.vue index 946b9a1..f1a7ebb 100644 --- a/src/views/modules/part/part_create.vue +++ b/src/views/modules/part/part_create.vue @@ -19,7 +19,7 @@ - + + + 复制属性({{previousPartNo}}) + + @@ -89,12 +93,11 @@ - + + - - 新增 - {{ attributeDialog?'编辑':'保存' }} - + 新增 + {{ attributeDialog?'编辑':'保存' }}
+ + + + 新增 + + + + + + + + + + + + + + 新增 + + + + + + + + + + + + + + 新增 + + + + + + + + + + + + + + 上传文件 + + + + + + + + + +
@@ -194,7 +347,7 @@ - 可选属性: + 可选属性 - 已有属性: + 已有属性 + + +
+ + + + + + + + + 查询 + + +
+ + + 可选代理商 + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有代理商 + + + + + + + + + +
+ + 关闭 + +
+ + + +
+ + + + + + + + + 查询 + + +
+ + + 可选制造商 + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有制造商 + + + + + + + + + +
+ + 关闭 + +
+ + + +
+ + + + + + + + + 查询 + + +
+ + + 可选库位 + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有库位 + + + + + + + + + +
+ + 关闭 + +
+ + + + @@ -311,16 +755,21 @@ import { copyPart, // 复制物料 getProjectPartNo, // 获取物料编码 verifyData, // 校验参数 + getPreviousPartNo, // 获取上一个物料编码 } from '@/api/part/partInformation.js' import { savePartInfo } from "@/api/part/quicklyCreateBom.js" +import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js' import {getSiteAndBuByUserName} from "@/api/qc/qc.js" +import {deleteObjectFile} from '@/api/eam/eam.js' import Chooselist from '@/views/modules/common/Chooselist_eam' +import partUploadFile from "./part_upload_file" export default { name: 'partCreate', components: { Chooselist, + partUploadFile }, watch: { modalData: { @@ -926,22 +1375,6 @@ export default { fixed: '', columnWidth: 100, }, - // { - // userId: this.$store.state.user.name, - // functionId: 601001, - // serialNumber: '601001Table2ValueChooseFlag', - // tableId: "601001Table2", - // tableName: "物料属性表", - // columnProp: 'numValue', - // headerAlign: "center", - // align: "center", - // columnLabel: '数字值', - // columnHidden: false, - // columnImage: false, - // status: true, - // fixed: '', - // columnWidth: 70, - // }, ], updateColumnItemList: [ { @@ -1547,6 +1980,24 @@ export default { this.inventoryPartTable = 'General' this.modalDisableFlag = false this.modalFlag = true + this.getPreviousPartNo() + }, + + // 获取上一个物料编码 + getPreviousPartNo () { + let tempData = { + site: this.modalData.bu.split('_')[0], + type: 'thePreviousPartItem', + thirdType: this.modalData.bu.split('_')[1], + secondType: this.$store.state.user.name + } + getPreviousPartNo(tempData).then(({data}) => { + if (data && data.code === 0) { + this.previousPartNo = data.previousPartNo + } else { + this.previousPartNo = '' + } + }) }, // 获取用户的bu @@ -1612,6 +2063,53 @@ export default { }) }, + // 列表表格选择替换 + tabClick (tab, event) { + this.refreshCurrentTabTable() + }, + + // 刷新页签的table数据 + refreshCurrentTabTable () { + if (this.inventoryPartTable === 'part_item') { + this.getPartItem() + } else if (this.inventoryPartTable === 'part_agent') { + this.getPartAgent() + } else if (this.inventoryPartTable === 'part_file') { + this.getFileContentData() + } else if (this.inventoryPartTable === 'part_manufacturer') { + this.getPartManufacturer() + } else if (this.inventoryPartTable === 'default_locations') { + this.getDefaultLocation() + } + }, + + // 关闭模态框后刷新列表 + refreshDetailList () { + this.getPartAgent() + this.getPartManufacturer() + this.getDefaultLocation() + }, + + // ======== 属性 ======== + // 查询物料属性 + getPartItem () { + let tempData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + codeNo: this.modalData.codeNo, + recordType: 'IP' + } + getPartItem(tempData).then(({data}) => { + if (data && data.code === 0) { + this.partItemList = data.rows + } else { + this.partItemList = [] + } + }) + }, + + // 保存属性 clickSave () { if (!this.attributeDialog) { // 保存 this.updateItemValue() @@ -1621,9 +2119,7 @@ export default { } }, - /** - * 编辑物料属性 - */ + // 编辑物料属性 updateItemValue () { this.loading = true let tempData = { @@ -1651,9 +2147,7 @@ export default { }) }, - /** - * 新增/删除物料属性 - */ + // 新增/删除物料属性 addOrDelItem () { if (!this.attributeDialog) { this.$message.warning('请保存更改!') @@ -1677,7 +2171,7 @@ export default { this.fastAddFlag = true }, - // 查询物料项目 + // 查询物料属性 queryPartItem () { this.itemData.codeNo = this.modalData.codeNo this.itemData.partNo = this.modalData.partNo @@ -1700,10 +2194,12 @@ export default { this.$refs.itemTable2.toggleRowSelection(row) }, + // 复选属性 selectionItem1 (val) { this.itemSelections1 = val }, + // 复选属性 selectionItem2 (val) { this.itemSelections2 = val }, @@ -1772,51 +2268,518 @@ export default { }) }, - /** - * 列表表格选择替换 - */ - tabClick (tab, event) { - // 刷新列表数据 - this.refreshCurrentTabTable() + // ======== 代理商 ======== + // 选择代理商 + getAgentList () { + // 查询所有代理商 + getAgentListBy(this.agentData).then(({data}) => { + if (data && data.code === 0) { + this.agentList1 = data.rows + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) }, - /** - * 刷新页签的table数据 - */ - refreshCurrentTabTable () { - if (this.inventoryPartTable === 'part_item') { - this.getPartItem() - } else if (this.inventoryPartTable === 'part_agent') { - this.getPartAgent() - } else if (this.inventoryPartTable === 'part_file') { - this.getFileContentData() - } else if (this.inventoryPartTable === 'part_manufacturer') { - this.getPartManufacturer() - } else if (this.inventoryPartTable === 'default_locations') { - this.getDefaultLocation() + // 新增代理商模态框 + savePartAgent () { + this.agentSelections1 = null + this.agentSelections2 = null + getAgentList(this.modalData).then(({data}) => { + this.agentList1 = data.row1 + this.agentList2 = data.row2 + }) + this.agentData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + agentId: '', + agentName: '', } + this.agentModelFlag = true }, - /** - * 查询物料属性 - */ - getPartItem () { - let tempData = { + // 可选代理商 + agentClickRow1 (row) { + this.$refs.agentTable1.toggleRowSelection(row) + }, + + // 已有代理商 + agentClickRow2 (row) { + this.$refs.agentTable2.toggleRowSelection(row) + }, + + // 代理商复选 + selectionAgent1 (val) { + this.agentSelections1 = val + }, + + // 代理商复选 + selectionAgent2 (val) { + this.agentSelections2 = val + }, + + // 添加代理商 + addAgent () { + if (this.agentSelections1 == null || this.agentSelections1.length === 0) { + this.$message.warning('请选择可选代理商!') + return + } + let inData = { site: this.modalData.site, buNo: this.modalData.buNo, partNo: this.modalData.partNo, - codeNo: this.modalData.codeNo, - recordType: 'IP' + agentList: this.agentSelections1 } - getPartItem(tempData).then(({data}) => { + addPartAgent(inData).then(({data}) => { if (data && data.code === 0) { - this.partItemList = data.rows + getAgentList(this.modalData).then(({data}) => { + this.agentList1 = data.row1 + this.agentList2 = data.row2 + }) + this.agentSelections1 = [] } else { - this.partItemList = [] + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 删除物料代理商 + deleteAgent () { + if(this.agentSelections2 == null || this.agentSelections2.length === 0){ + this.$message.warning('请选择已有代理商!') + return + } + let inData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + agentList: this.agentSelections2 + } + deletePartAgent(inData).then(({data}) => { + if (data && data.code === 0) { + getAgentList(this.modalData).then(({data}) => { + this.agentList1 = data.row1 + this.agentList2 = data.row2 + }) + this.agentSelections2 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 单删 + deleteAgent2 (row) { + this.$confirm(`是否删除该代理商?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + deleteAgent(row).then(({data}) => { + if (data && data.code === 0) { + this.getPartAgent() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }) + }, + + // ======== 制造商 ======== + // 选择制造商 + getManufacturerList () { + // 查询所有代理商 + getManufacturerListBy(this.manufacturerData).then(({data}) => { + if (data && data.code === 0) { + this.manufacturerList1 = data.rows + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 新增制造商模态框 + savePartManufacturer () { + this.manufacturerSelections1 = null + this.manufacturerSelections2 = null + getManufacturerList(this.modalData).then(({data}) => { + this.manufacturerList1 = data.row1 + this.manufacturerList2 = data.row2 + }) + this.manufacturerData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + manufacturerId: '', + manufacturerName: '', + } + this.manufacturerModelFlag = true + }, + + // 可选制造商 + manufacturerClickRow1 (row) { + this.$refs.manufacturerTable1.toggleRowSelection(row) + }, + + // 已有制造商 + manufacturerClickRow2 (row) { + this.$refs.manufacturerTable2.toggleRowSelection(row) + }, + + // 制造商复选 + selectionManufacturer1 (val) { + this.manufacturerSelections1 = val + }, + + // 制造商复选 + selectionManufacturer2 (val) { + this.manufacturerSelections2 = val + }, + + // 添加制造商 + addManufacturer () { + if (this.manufacturerSelections1 == null || this.manufacturerSelections1.length === 0) { + this.$message.warning('请选择可选制造商!') + return + } + let inData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + manufacturerList: this.manufacturerSelections1 + } + addPartManufacturer(inData).then(({data}) => { + if (data && data.code === 0) { + getManufacturerList(this.modalData).then(({data}) => { + this.manufacturerList1 = data.row1 + this.manufacturerList2 = data.row2 + }) + this.manufacturerSelections1 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 删除物料制造商 + deleteManufacturer () { + if (this.manufacturerSelections2 == null || this.manufacturerSelections2.length === 0) { + this.$message.warning('请选择已有制造商!') + return + } + let inData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + manufacturerList: this.manufacturerSelections2 + } + deletePartManufacturer(inData).then(({data}) => { + if (data && data.code === 0) { + getManufacturerList(this.modalData).then(({data}) => { + this.manufacturerList1 = data.row1 + this.manufacturerList2 = data.row2 + }) + this.manufacturerSelections2 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 单删 + deleteManufacturer2 (row) { + this.$confirm(`是否删除该制造商?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + deleteManufacturer(row).then(({data}) => { + if (data && data.code === 0) { + this.getPartManufacturer() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }) + }, + + // ======== 库位 ======== + // 选择默认库位 + getLocationList () { + // 查询所有库位 + getLocationListBy(this.locationData).then(({data}) => { + if (data && data.code === 0) { + this.locationList1 = data.rows + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 新增库位模态框 + saveDefaultLocation () { + this.locationSelections1 = null + this.locationSelections2 = null + getLocationList(this.modalData).then(({data}) => { + this.locationList1 = data.row1 + this.locationList2 = data.row2 + }) + this.locationData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + locationId: '', + locationName: '', + } + this.locationModelFlag = true + }, + + // 可选库位 + locationClickRow1 (row) { + this.$refs.locationTable1.toggleRowSelection(row) + }, + + // 已有库位 + locationClickRow2 (row) { + this.$refs.locationTable2.toggleRowSelection(row) + }, + + // 库位复选 + selectionLocation1 (val) { + this.locationSelections1 = val + }, + + // 库位复选 + selectionLocation2 (val) { + this.locationSelections2 = val + }, + + // 添加库位 + addLocation () { + if (this.locationSelections1 == null || this.locationSelections1.length === 0) { + this.$message.warning('请选择可选库位!') + return + } + let inData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + locationList: this.locationSelections1 + } + addDefaultLocation(inData).then(({data}) => { + if (data && data.code === 0) { + getLocationList(this.modalData).then(({data}) => { + this.locationList1 = data.row1 + this.locationList2 = data.row2 + }) + this.locationSelections1 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) } }) }, + // 删除库位 + deleteLocation () { + if (this.locationSelections2 == null || this.locationSelections2.length === 0) { + this.$message.warning('请选择已有库位!') + return + } + let inData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + locationList: this.locationSelections2 + } + deleteDefaultLocation(inData).then(({data}) => { + if (data && data.code === 0) { + getLocationList(this.modalData).then(({data}) => { + this.locationList1 = data.row1 + this.locationList2 = data.row2 + }) + this.locationSelections2 = [] + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // 单删 + deleteLocation2 (row) { + this.$confirm(`是否删除该库位?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + deleteLocation(row).then(({data}) => { + if (data && data.code === 0) { + this.getDefaultLocation() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }) + }, + + // ======== 附件的相关方法 ======== + // 获取物料附件列表 + getFileContentData () { + let currentData = { + orderRef1: this.modalData.site, + orderRef2: this.modalData.partNo, + orderRef3: 'part', + orderRef4: this.modalData.buNo, + } + getFileContentList(currentData).then(({data}) => { + if (data && data.code === 200) { + this.fileContentList = data.rows + } else { + this.fileContentList = [] + } + }) + }, + + // 上传文件 + uploadFile () { + let currentData = { + titleCon: '物料附件上传', + site: this.modalData.site, + buNo: this.modalData.buNo, + createBy: this.$store.state.user.name, + partNo: this.modalData.partNo, + folder: 'part' + } + this.uploadDialog = true + // 打开组件去做新增业务 + this.$nextTick(() => { + this.$refs.partUploadFile.init(currentData); + }) + }, + + // 文件删除 + deleteFile (row) { + this.$confirm('确定要删除此文件?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + deleteObjectFile(row).then(({data}) => { + if (data && data.code === 0) { + this.getFileContentData() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }).catch(() => { + }) + }, + + // 文件下载 + downloadFile (row) { + downLoadObjectFile(row).then(({data}) => { + // 不限制文件下载类型 + const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'}) + // 下载文件名称 + const fileName = row.fileName + // a标签下载 + const linkNode = document.createElement('a') + linkNode.download = fileName // a标签的download属性规定下载文件的名称 + linkNode.style.display = 'none' + linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL + document.body.appendChild(linkNode) + linkNode.click() // 模拟在按钮上的一次鼠标单击 + URL.revokeObjectURL(linkNode.href) // 释放URL 对象 + document.body.removeChild(linkNode) + }) + }, + + // 预览 + previewFile (row) { + // 预览文件 + let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] + let type = '' + if (image.includes(row.fileType.toLowerCase())) { + type = 'image/' + row.fileType + } + let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] + if (video.includes(row.fileType.toLowerCase())) { + type = 'video/' + row.fileType + } + let txt = ['txt'] + if (txt.includes(row.fileType.toLowerCase())) { + type = 'text/plain' + } + let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] + if (office.includes(row.fileType.toLowerCase())) { + this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) + return + } + let pdf = ['pdf'] + if (pdf.includes(row.fileType.toLowerCase())) { + type = 'application/pdf' + } + if (type === ''){ + this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) + return; + } + downLoadObjectFile(row).then(({data}) => { + const blob = new Blob([data], { type: type }); + // 创建URL来生成预览 + const fileURL = URL.createObjectURL(blob); + // 在新标签页中打开文件预览 + const newTab = window.open(fileURL, '_blank') + }) + }, + + // ======== 基础数据失焦事件 ======== // 计量单位输入校验 umIdBlur (tagNo) { if (this.modalData.umId2 != null && this.modalData.umId2 !== '') { @@ -1938,11 +2901,7 @@ export default { }, // ======== chooseList相关方法 ======== - /** - * 获取基础数据列表S - * @param val - * @param type - */ + // 获取基础数据列表S getBaseList (val, type) { this.tagNo = val this.tempCodeNo = this.modalData.codeNo @@ -1972,10 +2931,7 @@ export default { this.$refs.baseList.init(val, strVal, conSql) }) }, - /** - * 列表方法的回调 - * @param val - */ + // 列表方法的回调 getBaseData (val) { if (this.tagNo === 510) { this.modalData.umId2 = val.UMID diff --git a/src/views/modules/part/quicklyCreateBom.vue b/src/views/modules/part/quicklyCreateBom.vue index 9600a5f..c639aaa 100644 --- a/src/views/modules/part/quicklyCreateBom.vue +++ b/src/views/modules/part/quicklyCreateBom.vue @@ -5,10 +5,10 @@
- 添加 - 刷新 - 批量Build - 重置物料 + 添加 + 刷新 + 批量Build + 重置物料