From 48e955517950b0c09a33944caabf30b05ac2d66a Mon Sep 17 00:00:00 2001 From: Aoi_Tori <2547614904@qq.com> Date: Tue, 5 Aug 2025 18:04:36 +0800 Subject: [PATCH] 2025/8/5 --- src/api/part/partInformation.js | 2 + .../projectInfo/com_project_info_part.vue | 129 +++++ .../technicalSpecificationList.vue | 2 + src/views/modules/todo/todoList.vue | 525 ++++++++++++++++++ 4 files changed, 658 insertions(+) create mode 100644 src/views/modules/todo/todoList.vue diff --git a/src/api/part/partInformation.js b/src/api/part/partInformation.js index 8bcf8ad..ba2608a 100644 --- a/src/api/part/partInformation.js +++ b/src/api/part/partInformation.js @@ -219,6 +219,8 @@ export const uploadProjectPartExcel = data => createAPI(`/plm/partInformation/up // 查询文件ID export const queryFileId = data => createAPI(`/plm/partInformation/queryFileId`,'post',data) +export const readPartFromFile = data => createAPI(`/plm/partInformation/readPartFromFile`,'post',data) + // 下载文件 export const downLoadFile = data => createAPI(`/plm/partInformation/downLoadFile?id=`+data.id,'post','download') diff --git a/src/views/modules/project/projectInfo/com_project_info_part.vue b/src/views/modules/project/projectInfo/com_project_info_part.vue index f0cf96f..d447be5 100644 --- a/src/views/modules/project/projectInfo/com_project_info_part.vue +++ b/src/views/modules/project/projectInfo/com_project_info_part.vue @@ -792,6 +792,7 @@
添加>> 删除<< + 上传
@@ -877,6 +878,27 @@ + + + + 下载文件模板 + + + + + +
将文件拖到此处,或点击上传
+
+
+
+
+ + 确定 + 关闭 + +
+ @@ -923,6 +945,7 @@ import { import Chooselist from '@/views/modules/common/Chooselist' import DictDataSelect from "../../sys/dict-data-select.vue" import ProjectPartUpload from "./project_part_upload.vue"; +import {downLoadFile, queryFileId, readPartFromFile} from "../../../../api/part/partInformation"; export default { components: { @@ -991,6 +1014,7 @@ import { pageSize2: 20, totalPage2: 0, visible: false, + isLoading: false, currentRow: '', columnList:[ { @@ -1194,6 +1218,13 @@ import { exportName: '项目物料'+this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["项目物料"], exportFooter: [], + fileList: [], + pageData: { + projectId: '', + createBy: '', + site: '', + customerNo: '' + }, // 导出 end //工具属性 itemModalData:{ @@ -1611,6 +1642,7 @@ import { partDesc: '' }, partModelFlag: false, + uploadVisible: false, buList: [], unitCostList: [], characteristicList: [], @@ -3486,6 +3518,103 @@ import { }) }, + async downloadFile () { + let file = { + id: 0, + fileName: '' + } + let tempData = { + orderRef1: this.pageData.site, + orderRef2: 'projectPart' + } + await queryFileId(tempData).then(({data}) => { + if (data && data.code === 0) { + file.id = data.data.id + file.fileName = data.data.fileName + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + await downLoadFile(file).then(({data}) => { + // 不限制文件下载类型 + const blob = new Blob([data], {type: "application/octet-stream"}) + // 下载文件名称 + const fileName = file.fileName + // a标签下载 + const linkNode = document.createElement('a') + // a标签的download属性规定下载文件的名称 + linkNode.download = fileName + linkNode.style.display = 'none' + // 生成一个Blob URL + linkNode.href = URL.createObjectURL(blob) + document.body.appendChild(linkNode) + // 模拟在按钮上的一次鼠标单击 + linkNode.click() + // 释放URL 对象 + URL.revokeObjectURL(linkNode.href) + document.body.removeChild(linkNode) + }) + }, + + beforeUploadHandle(file) { + let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase() + if (!(extName === '.xlsx' || extName === '.xls')) { + this.$message.error('数据导入失败,请选择正确的xlsx模板文件') + return false + } + }, + + // 选择上传文件时 + onRemove(file, fileList){ + this.fileList = fileList + }, + onChange(file, fileList){ + this.fileList = fileList + }, + + closeUploadDialog () { + this.fileList = [] + // 清空文件上传记录 + this.$refs.uploadFile.clearFiles() + // 关闭当前的页面 + this.uploadVisible = false + }, + + saveUploadFile () { + // 判断文件是否上传 + if (null == this.fileList || 0 === this.fileList.length) { + this.$message.error("请先上传文件!") + return false + } + let partNos = this.partList2.map(part => part.partNo) + this.searchData.partNos = partNos.join(",") + const formData = new FormData() + formData.append("file", this.fileList[0].raw) + formData.append("createBy", this.$store.state.user.name) + formData.append("orderRef1", this.searchData.site) + formData.append("orderRef2", this.searchData.projectId) + formData.append("orderRef3", this.searchData.customerId) + formData.append("searchType", this.searchData.searchType) + formData.append("partNos", this.searchData.partNos) + formData.append("limit", this.searchData.limit) + formData.append("page", this.searchData.page) + this.isLoading = true + readPartFromFile(formData).then(({data}) => { + if (data && data.code === 0) { + data.rows.list.forEach(item => { + item.partNo = item.plmPartNo + this.partList2.push(item) + }) + this.isLoading = false + this.uploadVisible = false + } else { + this.isLoading = false + this.$message.warning(data.msg) + } + }) + }, }, } diff --git a/src/views/modules/sampleManagement/technicalSpecificationList.vue b/src/views/modules/sampleManagement/technicalSpecificationList.vue index fe08f4c..e46f461 100644 --- a/src/views/modules/sampleManagement/technicalSpecificationList.vue +++ b/src/views/modules/sampleManagement/technicalSpecificationList.vue @@ -1492,6 +1492,7 @@ type: 'warning' }).then(() => { row.username = this.$store.state.user.name + row.nodeConclusion = 'B' bmStatusToDead(row).then(({data}) => { if (data && data.code === 0) { this.$message.success( '操作成功') @@ -1530,6 +1531,7 @@ type: 'warning' }).then(() => { row.username = this.$store.state.user.name + row.nodeConclusion = 'A' bmStatusToFinish(row).then(({data}) => { if (data && data.code === 0) { this.$message.success( '操作成功') diff --git a/src/views/modules/todo/todoList.vue b/src/views/modules/todo/todoList.vue new file mode 100644 index 0000000..f37be2d --- /dev/null +++ b/src/views/modules/todo/todoList.vue @@ -0,0 +1,525 @@ + + + + + +