bom 上传文件

master
xhj 8 months ago
parent 4d320617aa
commit 807c823946

@ -267,28 +267,28 @@
</div> </div>
</template> </template>
</vxe-modal> </vxe-modal>
<vxe-modal v-model="dialogVisible2" width="1200" title="导入文件"> <!-- <vxe-modal v-model="dialogVisible2" width="1200" title="导入文件">-->
<template #default> <!-- <template #default>-->
<el-row class="query_wrapper"> <!-- <el-row class="query_wrapper">-->
<el-row> <!-- <el-row>-->
<el-button style="margin-right: 10px;" size="small" type="success" @click="submitUpload2"></el-button> <!-- <el-button style="margin-right: 10px;" size="small" type="success" @click="submitUpload2"></el-button>-->
</el-row> <!-- </el-row>-->
</el-row> <!-- </el-row>-->
<div class="mytable"> <!-- <div class="mytable">-->
<vxe-table <!-- <vxe-table-->
border <!-- border-->
show-header-overflow <!-- show-header-overflow-->
show-overflow <!-- show-overflow-->
height="500px" <!-- height="500px"-->
align="center" <!-- align="center"-->
:data="tableupload2"> <!-- :data="tableupload2">-->
<vxe-column type="seq" width="50"></vxe-column> <!-- <vxe-column type="seq" width="50"></vxe-column>-->
<vxe-column field="tzmc" title="图纸名称" width="300"></vxe-column> <!-- <vxe-column field="tzmc" title="图纸名称" width="300"></vxe-column>-->
</vxe-table> <!-- </vxe-table>-->
</div> <!-- </div>-->
</template> <!-- </template>-->
</vxe-modal> <!-- </vxe-modal>-->
</el-container> </el-container>
</template> </template>
@ -1057,7 +1057,7 @@ export default {
handleChange(file, fileList) { handleChange(file, fileList) {
this.fileList = fileList this.fileList = fileList
const bcph="" const bcph=""
if (file.name.includes(".BC")||file.name.includes(".LST")||file.name.includes(".XC")){ if (file.name.includes(".BC")||file.name.includes(".LST")||file.name.includes(".XC") || file.name.includes(".txt") ){
if (file.name.includes("板材领取表")) { if (file.name.includes("板材领取表")) {
this.czbhu= file.name.split("_")[0] this.czbhu= file.name.split("_")[0]
var underscoreIndex = file.name.indexOf("_"); var underscoreIndex = file.name.indexOf("_");
@ -1105,7 +1105,8 @@ export default {
this.tableupload.push(a); this.tableupload.push(a);
} }
// console.log(file.name) // console.log(file.name)
if((file.name.match(/-/g)).length ===3){ // if((file.name.match(/-/g)).length ===3){
if(file.name.includes(".txt")){
this.ljList.push(file.name); this.ljList.push(file.name);
var parts = file.name.split('-') var parts = file.name.split('-')
var result = parts.slice(0, 3).join('-') var result = parts.slice(0, 3).join('-')
@ -1117,25 +1118,34 @@ export default {
this.tableupload.push(a); this.tableupload.push(a);
} }
//this.title=this.czbhu+" "+this.phu+"" //this.title=this.czbhu+" "+this.phu+""
//
}
// else
// //pdf 20240530
//
if ( file.name.includes('.pdf') ) {
this.tltList2.push(file)
let a={czbh:this.czbhu,ph:this.phu,type:"",stype:"数控套料图",name:file.name,sort:7}
this.tableupload.push(a);
this.tableupload.sort((a,b)=>{ this.tableupload.sort((a,b)=>{
//return( a[age] - b[age])
return( a.sort - b.sort) return( a.sort - b.sort)
}) })
this.queryParam.dcch=this.czbhu
this.queryParam.dcpl=this.phu
//
} }
//pdf 20240530 if ( file.name.includes('.QG') ) {
if ( file.name.includes("数控套料图")&&file.name.includes('.pdf') ) {
this.tltList2.push(file) this.tltList2.push(file)
let a={czbh:this.czbhu,ph:this.phu,type:"",stype:"数控套料图",name:file.name,sort:6} let a={czbh:this.czbhu,ph:this.phu,type:"",stype:"切割文件",name:file.name,sort:8}
this.tableupload.push(a); this.tableupload.push(a);
this.tableupload.sort((a,b)=>{ this.tableupload.sort((a,b)=>{
return( a.sort - b.sort) return( a.sort - b.sort)
}) })
} }
this.tableupload.sort((a,b)=>{
//return( a[age] - b[age])
return( a.sort - b.sort)
})
this.queryParam.dcch=this.czbhu
this.queryParam.dcpl=this.phu
this.dialogVisible=true; this.dialogVisible=true;
}, },
// false Promise rejectfunction(file, fileList) // false Promise rejectfunction(file, fileList)
@ -1173,6 +1183,7 @@ export default {
}, },
// //
submitUpload() { submitUpload() {
console.log(this.fileList2.length) console.log(this.fileList2.length)
// //
if (this.fileList.length === 0) { if (this.fileList.length === 0) {
@ -1196,11 +1207,12 @@ export default {
const formData = new FormData() const formData = new FormData()
// 使FormData.append/ // 使FormData.append/
this.fileList.forEach((file) => { this.fileList.forEach((file) => {
if (!file.name.includes(".PDF")&&!file.name.includes('.pdf')){ if ((!file.name.includes(".PDF")&&!file.name.includes('.pdf')) || !file.name.includes('.QG')){
formData.append('file', file.raw) formData.append('file', file.raw)
} }
}) })
console.log(this.fileList)
this.tltList2.forEach((file) => { this.tltList2.forEach((file) => {
formData.append('tltList', file.raw) formData.append('tltList', file.raw)
}) })
@ -1208,6 +1220,7 @@ export default {
formData.append('czbh', this.queryParam.dcch) formData.append('czbh', this.queryParam.dcch)
formData.append('pl', this.queryParam.dcpl) formData.append('pl', this.queryParam.dcpl)
formData.append('isupload', '01') formData.append('isupload', '01')
uploadBom(formData).then(res=>{ uploadBom(formData).then(res=>{
if (res.data.zt == "01") { if (res.data.zt == "01") {

Loading…
Cancel
Save