diff --git a/src/api/TechnologyCenter/ImportParts.js b/src/api/TechnologyCenter/ImportParts.js index 63672b54..85eb72c7 100644 --- a/src/api/TechnologyCenter/ImportParts.js +++ b/src/api/TechnologyCenter/ImportParts.js @@ -400,3 +400,36 @@ export function getMachineNames(num) { } }) } +export function machineSelect(projectValue) { + return request({ + url: '', + method: 'post', + data: { + type: '1', + name: 'PDM_机床名称_查询数据2', + param: `项目流水号=${projectValue}` + } + }) +} +export function getFileData(MachineDrawValue) { + return request({ + url: '', + method: 'post', + data: { + type: '1', + name: 'PDM_机床总图_查询数据', + param: `机床流水号=${MachineDrawValue}` + } + }) +} +export function deleteFileData(id) { + return request({ + url: '', + method: 'post', + data: { + type: '2', + name: 'PDM_机床总图_删除数据', + param: `文件标识=${id}` + } + }) +} diff --git a/src/icons/svg/doc.svg b/src/icons/svg/doc.svg new file mode 100644 index 00000000..04117746 --- /dev/null +++ b/src/icons/svg/doc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/excel.svg b/src/icons/svg/excel.svg new file mode 100644 index 00000000..efbf9848 --- /dev/null +++ b/src/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/file.svg b/src/icons/svg/file.svg new file mode 100644 index 00000000..a36bf667 --- /dev/null +++ b/src/icons/svg/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/pdf.svg b/src/icons/svg/pdf.svg new file mode 100644 index 00000000..b2117fb9 --- /dev/null +++ b/src/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/pic.svg b/src/icons/svg/pic.svg new file mode 100644 index 00000000..ca2f133a --- /dev/null +++ b/src/icons/svg/pic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/ppt.svg b/src/icons/svg/ppt.svg new file mode 100644 index 00000000..27dcc3e8 --- /dev/null +++ b/src/icons/svg/ppt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 873cd097..750f3023 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -11,11 +11,14 @@ export const name1 = `OP1000` export const readFile = `http://192.168.1.231:8411/webpage/file/` // invoice export const readImg = `http://192.168.1.231:8411/webpage/img/` // delivery/MS/performancebond export const upload = `http://192.168.1.231:8411/submit/uploadFile.ashx` // ContractInformationManagement +export const uploadFileMachine = `http://192.168.1.231:8411/submit/uploadFileMachine.ashx` // 机床总图 发布时改成0.231 export const upload2 = `http://192.168.1.231:8411/submit/upload2.ashx` // delivery export const upload3 = `http://192.168.1.231:8411/submit/upload3.ashx` // performancebond export const uploadInvoiceScan = `http://192.168.1.231:8411/submit/uploadInvoiceScan.ashx` // invoice export const uploadInvoiceScan1 = `http://192.168.1.231:8411/submit/uploadInvoiceScan1.ashx` // invoice(workshop) export const download = `http://192.168.1.231:8411/submit/downloadFile.ashx` // ContractInformationManagement +export const downloadFileMachine = `http://192.168.1.231:8411/submit/downloadFileMachine.ashx` // 机床总图 发布时改成0.231 + const service = axios.create({ baseURL: `http://localhost:8411/submit/MESCommonBase.ashx`, timeout: 1500000 // 请求超时时间 diff --git a/src/views/TechnologyCenter/ImportParts/index.vue b/src/views/TechnologyCenter/ImportParts/index.vue index c7a33ef5..cc88ac11 100644 --- a/src/views/TechnologyCenter/ImportParts/index.vue +++ b/src/views/TechnologyCenter/ImportParts/index.vue @@ -20,6 +20,7 @@ :label="item.label" :value="item.value"/> + 上传总图 @@ -44,6 +45,51 @@ + + + + + + + +
+ + 点击上传 + +
+
+ +
+
+
+
+ 删除 +
+
+
+
+
+
+
+
{{ file.name }}
+
+
+
+
+
@@ -51,13 +97,22 @@ import UploadExcelComponent from './UploadExcel/index.vue' import specificationData from './specificationData' import { sleep } from '../../../utils/tool' -import { initProject, isExit, isExit1, importBasics, importPurcharse, searchMachine, searchGroupNum } from '../../../api/TechnologyCenter/ImportParts' - +import { initProject, isExit, isExit1, importBasics, importPurcharse, searchMachine, searchGroupNum, machineSelect, getFileData, deleteFileData } from '../../../api/TechnologyCenter/ImportParts' +import { uploadFileMachine, downloadFileMachine } from '@/utils/request' export default { name: 'UploadExcel', components: { UploadExcelComponent, specificationData }, data() { return { + fileList: [], + hadFile: [], + showFileList: true, + projectId: '', + action: '', + disabledMachine: true, + machineDrawValue: '', + machineDraw: [], + dialogVisibleMachine: false, project: [], projectValue: '', worksheet: [], @@ -108,6 +163,57 @@ export default { this.fetchData() }, methods: { + opendialogVisibleMachine() { + this.machineDraw = [] + this.machineDrawValue = '' + this.dialogVisibleMachine = true + this.machineDrawValue === '' ? this.disabledMachine = true : this.disabledMachine = false + this.getSelect(machineSelect, ['机床图号', '机床流水号'], 'machineDraw', this.projectValue) + }, + changeMachine() { + this.machineDrawValue === '' ? this.disabledMachine = true : this.disabledMachine = false + this.action = `${uploadFileMachine}?&MachineNum=${this.machineDrawValue}` + this.getFileData(this.machineDrawValue) + console.log(this.action) + }, + uploadSuccess(res, file, fileList) { + if (res[0].result === '1') { + const index = fileList.indexOf(file) + fileList.splice(index, 1) + } else { + this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`) + } + if (fileList.length === 0) { + this.$message.success('文件上传成功') + this.getFileData(this.machineDrawValue) + } + }, + uploadFailure(a, file, fileList) { + fileList.map(file => { + this.$message.error(`${file.name}文件上传失败,请检查上传文件是否正确!`) + }) + }, + // 在什么情况下需要查询上传的附件,调用this.getFileData()即可根据 + getFileData(machineDrawValue) { + console.log(machineDrawValue, 88) + this.hadFile = [] + getFileData(machineDrawValue).then(res => { + console.log(res) + if (res.data.length > 0) { + res.data.map(item => { + this.hadFile.push({ + url: `${downloadFileMachine}?id=${item.文件标识}.${item.文件后缀}&name=${item.文件名称}.${item.文件后缀}`, + name: `${item.文件名称}.${item.文件后缀}`, + suffix: item.文件后缀, + id: item.文件标识 + }) + }) + } + }) + }, + deleteFileData(id) { + this.deleteRow(deleteFileData, id, function() { this.getFileData(this.machineDrawValue) }) + }, async test() { await sleep(10000) console.log(1) @@ -339,8 +445,52 @@ export default { } +.content{ + position: relative; + padding: 8px 8px 0 8px; +} +.action{ + position: absolute; + top: 4px; + right: 8px; +} +.delete{ + padding: 0 5px; + border-radius: 3px; + color: #0f84b0; + font-size: 12px; +} +.delete:hover{ + background: -webkit-linear-gradient(top,#0ba9e3,#0099d3); + color: #fff; +} +a{ + text-decoration: none; +} +.icon{ + width: 30px; + height: 30px; + display: inline-block; + margin-right: 7px; + margin-top: 2px; + font-size: 26px; +} +.info{ + position: absolute; + left: 44px; + line-height: 30px; + display: inline-block; + color: #999; +}