导入套料图PDF文件夹

master
xiaoning 12 months ago
parent ecd06dce78
commit 1df77b54dd

@ -1,5 +1,13 @@
import request from '@/utils/request' 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 getList(data) {return request({url: '/dmCbxxp/getList', method: 'post', data})}
export function del(data) {return request({url: '/dmCbxxp/del', 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})} export function edit(data) {return request({url: '/dmCbxxp/edit', method: 'post', data})}

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

@ -66,19 +66,22 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="5" :offset="19" > <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 <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" :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-upload>
</el-form-item> </el-form-item>
<el-form-item style="float: right" > <el-form-item style="float: right;width:45%;padding-left: 10%" >
<!-- <el-button--> <!-- <el-button-->
<!-- type="success"--> <!-- type="success"-->
<!-- @click="tjClick"--> <!-- @click="tjClick"-->
@ -87,12 +90,8 @@
<!-- type="success"--> <!-- type="success"-->
<!-- @click="bomClick"--> <!-- @click="bomClick"-->
<!-- >生成bom</el-button>--> <!-- >生成bom</el-button>-->
<div style="float: right;" > <div style="float: right;" >
<el-upload <el-upload
ref="upload" ref="upload"
action="" action=""
:file-list="fileList" :file-list="fileList"
@ -268,6 +267,28 @@
</div> </div>
</template> </template>
</vxe-modal> </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> </el-container>
</template> </template>
@ -276,7 +297,7 @@ import {
getCzplBase, getCzplBase,
getListBom, getListBom,
saveListBom, saveListBom,
addListBom, uploadBom, addListBom, uploadBom,uploadPDF
} from '@/api/sjzx/jcsj' } from '@/api/sjzx/jcsj'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import XEUtils from 'xe-utils' import XEUtils from 'xe-utils'
@ -307,19 +328,18 @@ export default {
}, },
tableData: [], tableData: [],
isupload:'02', isupload:'02',
isuploadPDF:'02',
filedis:true, filedis:true,
filedis2:true,
uploadData:{ uploadData:{
},
uploadPDF:{
}, },
tableupload:[], tableupload:[],
tableupload2:[],
dialogVisible:false, dialogVisible:false,
dialogVisible2:false,
heads: { token: getToken() }, heads: { token: getToken() },
fileList: [], fileList: [],
filePDFList: {}, fileList2: [],
dictData:{}, dictData:{},
height: '500px', height: '500px',
bclqList:[], bclqList:[],
@ -327,6 +347,8 @@ export default {
bctjList:[], bctjList:[],
xctjList:[], xctjList:[],
tltList:[], tltList:[],
tltList2:[],
tltNameList:[],
ljList:[], ljList:[],
title:'', title:'',
czbhu:'', czbhu:'',
@ -978,46 +1000,8 @@ export default {
window.addEventListener('resize', this.getHeight) window.addEventListener('resize', this.getHeight)
this.getHeight() this.getHeight()
this.initBase() this.initBase()
}, },
methods: { 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() { uploadExcel() {
// if (this.queryParam.cbbm === '') { // if (this.queryParam.cbbm === '') {
@ -1046,6 +1030,14 @@ export default {
// this.filedis=false // this.filedis=false
// } // }
}, },
handleAddFolder2 () {
this.tableupload2=[],
this.$nextTick(() => {
this.filedis2=false
this.$refs.upload2.$children[0].$refs.input.webkitdirectory = true
})
},
handleAddFolder () { handleAddFolder () {
// this.fileList=[] // this.fileList=[]
@ -1073,7 +1065,20 @@ export default {
uploadpre(name){ 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) { handleChange(file, fileList) {
this.fileList = fileList this.fileList = fileList
console.log(file) console.log(file)
@ -1153,6 +1158,31 @@ export default {
this.fileList = fileList 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){ sucessChange(file,fileList){
alert(1) alert(1)
}, },
@ -1169,7 +1199,6 @@ export default {
if(this.xclqList.length ==0){ if(this.xclqList.length ==0){
return this.$message.warning('缺少型材领取数据') return this.$message.warning('缺少型材领取数据')
} }
if(this.bctjList.length ==0){ if(this.bctjList.length ==0){
return this.$message.warning('缺少板材统计数据') return this.$message.warning('缺少板材统计数据')
} }

Loading…
Cancel
Save