导入套料图PDF文件夹

master
xiaoning 12 months ago
parent ecd06dce78
commit 1df77b54dd

@ -1,5 +1,13 @@
import request from '@/utils/request'
export function uploadPDF(data) {
return request({
url: '/dmBom/uploadPDF',
method: 'post',
headers: { 'Content-Type': 'multipart/form-data' },
data: data
})
}
export function getList(data) {return request({url: '/dmCbxxp/getList', method: 'post', data})}
export function del(data) {return request({url: '/dmCbxxp/del', method: 'post', data})}
export function edit(data) {return request({url: '/dmCbxxp/edit', method: 'post', data})}

@ -57,14 +57,9 @@
<script>
import { getCzxx} from '@/api/jhzx/qfxq'
import { getYdjhList,generateMx} from '@/api/jhzx/sygd'
import { mapGetters } from 'vuex'
import XEUtils from 'xe-utils'
import {null2str} from "@/utils/rpkj";
import { getToken } from '@/utils/auth'
import { startLoading, endLoading } from '@/utils'
import { Message } from 'element-ui'
export default {
name:'sygd',
data() {
@ -283,13 +278,13 @@ export default {
this.height = window.innerHeight - 150
},
sygdPC() {
generateMx().then((res) => {
console.log(res.data)
if (res.success){
this.$message.warning('中日程中没有下月信息!')
}
this.$message.warning('成功!')
})
// generateMx().then((res) => {
// console.log(res.data)
// if (res.success){
// this.$message.warning('!')
// }
// this.$message.warning('!')
// })
}
}
}

@ -66,19 +66,22 @@
</el-row>
<el-row>
<el-col :span="5" :offset="19" >
<el-form-item style="float: left;margin-left: 13%">
<el-form-item style="float: left;width: 45%;padding-left: 10%">
<el-upload
:action="uploadAction"
ref="upload2"
action=""
:file-list="fileList2"
:auto-upload="false"
:multiple="true"
:on-change="handleChange2"
:on-success="sucessChange2"
:directory="true"
:show-file-list="false"
:before-upload="beforeAvatarUploadPDF"
:data="filePDFList"
:on-success="handleAvatarSuccessPDF"
:headers="heads"
>
<el-button type="success" @click="toUploadPDF">PDF</el-button>
<el-button type="primary" @click="handleAddFolder2"></el-button>
</el-upload>
</el-form-item>
<el-form-item style="float: right" >
<el-form-item style="float: right;width:45%;padding-left: 10%" >
<!-- <el-button-->
<!-- type="success"-->
<!-- @click="tjClick"-->
@ -87,12 +90,8 @@
<!-- type="success"-->
<!-- @click="bomClick"-->
<!-- >生成bom</el-button>-->
<div style="float: right;" >
<el-upload
ref="upload"
action=""
:file-list="fileList"
@ -268,6 +267,28 @@
</div>
</template>
</vxe-modal>
<vxe-modal v-model="dialogVisible2" width="1200" title="导入文件">
<template #default>
<el-row class="query_wrapper">
<el-row>
<el-button style="margin-right: 10px;" size="small" type="success" @click="submitUpload2"></el-button>
</el-row>
</el-row>
<div class="mytable">
<vxe-table
border
show-header-overflow
show-overflow
height="500px"
align="center"
:data="tableupload2">
<vxe-column type="seq" width="50"></vxe-column>
<vxe-column field="tzmc" title="图纸名称" width="300"></vxe-column>
</vxe-table>
</div>
</template>
</vxe-modal>
</el-container>
</template>
@ -276,7 +297,7 @@ import {
getCzplBase,
getListBom,
saveListBom,
addListBom, uploadBom,
addListBom, uploadBom,uploadPDF
} from '@/api/sjzx/jcsj'
import { mapGetters } from 'vuex'
import XEUtils from 'xe-utils'
@ -307,19 +328,18 @@ export default {
},
tableData: [],
isupload:'02',
isuploadPDF:'02',
filedis:true,
filedis2:true,
uploadData:{
},
uploadPDF:{
},
tableupload:[],
tableupload2:[],
dialogVisible:false,
dialogVisible2:false,
heads: { token: getToken() },
fileList: [],
filePDFList: {},
fileList2: [],
dictData:{},
height: '500px',
bclqList:[],
@ -327,6 +347,8 @@ export default {
bctjList:[],
xctjList:[],
tltList:[],
tltList2:[],
tltNameList:[],
ljList:[],
title:'',
czbhu:'',
@ -978,46 +1000,8 @@ export default {
window.addEventListener('resize', this.getHeight)
this.getHeight()
this.initBase()
},
methods: {
// pdf
beforeAvatarUploadPDF(file) {
console.log(file.name)
//
// const isType = file.type === 'application/vnd.ms-excel'
// const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
// const fileType = isType || isTypeComputer
var isType = file.name.substring(file.name.lastIndexOf('.') + 1)
const fileType = isType === 'pdf'
console.log(fileType)
if (!fileType) {
this.$message.error('上传文件只能是pdf格式')
return fileType
}
startLoading()
return fileType
},
handleAvatarSuccessPDF(res, file) {
endLoading()
if (res.success) {
this.$message({ message: '导入成功', type: 'success' })
// this.list = res.data;
// this.checkedList = [];
} else {
Message({
message: res.message || 'Error',
type: 'error',
duration: 5 * 1000
})
}
},
toUploadPDF() {
this.uploadPDF.isupload = this.isuploadPDF
},
uploadExcel() {
// if (this.queryParam.cbbm === '') {
@ -1046,6 +1030,14 @@ export default {
// this.filedis=false
// }
},
handleAddFolder2 () {
this.tableupload2=[],
this.$nextTick(() => {
this.filedis2=false
this.$refs.upload2.$children[0].$refs.input.webkitdirectory = true
})
},
handleAddFolder () {
// this.fileList=[]
@ -1073,7 +1065,20 @@ export default {
uploadpre(name){
},
handleChange2(file, fileList) {
this.fileList2 = fileList
let folderName = file.name;
let format = folderName .substring(folderName .lastIndexOf('.') + 1).toLowerCase();
if (folderName.includes("数控套料图")&& format==='pdf' &&!this.tltNameList.includes(folderName)) {
this.tltNameList.push(folderName)
this.tltList2.push(file)
let a={tzmc:folderName}
this.tableupload2.push(a);
}
//
this.dialogVisible2=true;
},
handleChange(file, fileList) {
this.fileList = fileList
console.log(file)
@ -1153,6 +1158,31 @@ export default {
this.fileList = fileList
},
sucessChange2(file,fileList){
alert(1)
},
submitUpload2() {
//
if (this.fileList2.length === 0) {
return this.$message.warning('请选取文件后再上传')
}
//
if(this.tltList2.length ==0){
return this.$message.warning('缺少套料图PDF数据')
}
// FormData:
const formData = new FormData()
this.tltList2.forEach((file) => {
formData.append('file', file.raw)
})
uploadPDF(formData).then(res=>{
this.tltNameList=[]
this.tableupload2=[]
this.dialogVisible2=false;
return this.$message.success('上传成功')
})
},
sucessChange(file,fileList){
alert(1)
},
@ -1169,7 +1199,6 @@ export default {
if(this.xclqList.length ==0){
return this.$message.warning('缺少型材领取数据')
}
if(this.bctjList.length ==0){
return this.$message.warning('缺少板材统计数据')
}

Loading…
Cancel
Save