Browse Source

改单导入

master
han\hanst 2 weeks ago
parent
commit
ba6537b096
  1. 1
      src/api/ecss/ecss.js
  2. 13
      src/views/modules/ecss/codelnotifyTX.vue
  3. 188
      src/views/modules/ecss/del_detail_upload_excel_tx.vue

1
src/api/ecss/ecss.js

@ -8,6 +8,7 @@ export const saveEcssCoDelNotifyByExcel = data => createAPI(`/ecss/coDel/saveEcs
export const saveEcssCoDelNotifyByExcelTX = data => createAPI(`/ecss/coDel/saveEcssCoDelNotifyByExcelTX`,'post',data)
export const modifyNotifyDetailByExcel = data => createAPI(`/ecss/coDel/modifyNotifyDetailByExcel`,'post',data)
export const modifyNotifyDetailByExcelTX = data => createAPI(`/ecss/coDel/modifyNotifyDetailByExcelTX`,'post',data)
export const searchEcssCoDelNotifyHeader = data => createAPI(`/ecss/coDel/searchEcssCoDelNotifyHeader`,'post',data)
export const searchEcssCoDelNotifyDetail = data => createAPI(`/ecss/coDel/searchEcssCoDelNotifyDetail`,'post',data)

13
src/views/modules/ecss/codelnotifyTX.vue

@ -104,10 +104,7 @@
</el-pagination>
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick" >
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" name="detail">
<el-button v-show="currentRow.notifyStatus!=='订单取消' && (currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID')" @click="openCreateDetailModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消' && (currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID')" @click="importDetailModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'改单导入'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消' && (currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID')" @click="importUpcModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'UPC导入'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消' && (currentRow.buNo==='01-Label' || currentRow.buNo==='03-RFID')" @click="fixTtlAmountHandle()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'TTL Amount修正'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="importDetailModel()" type="warning" style="margin-left: 2px;margin-top: -10px">{{'改单导入'}}</el-button>
<el-table ref="detailTable"
:height="height"
:data="dataList2" :cell-style="cellStyleDetail"
@ -484,7 +481,7 @@
<!-- 天线/硬标导入 -->
<del-upload-excel-tx ref="delUploadExcelTx" @refreshTable="searchTable" v-drag></del-upload-excel-tx>
<!-- 导入 -->
<del-detail-upload-excel ref="delDetailUploadExcel" @refreshTable="searchTable" v-drag></del-detail-upload-excel>
<del-detail-upload-excel-tx ref="delDetailUploadExcelTx" @refreshTable="searchTable" v-drag></del-detail-upload-excel-tx>
<!-- UPC导入 -->
<upc-upload-excel ref="upcUploadExcel" @refreshTable="searchTable" v-drag></upc-upload-excel>
<!--列表的组件-->
@ -830,7 +827,7 @@
import Chooselist from '@/views/modules/common/Chooselist_eam'
import delUploadExcel from "./del_upload_excel.vue";
import delUploadExcelTx from "./del_upload_excel_tx.vue";
import delDetailUploadExcel from "./del_detail_upload_excel.vue";
import delDetailUploadExcelTx from "./del_detail_upload_excel_tx.vue";
import upcUploadExcel from "./upc_upload_excel.vue";
import PackingDetailTab from "./components/PackingDetailTab.vue";
import PackingDetailTabPallet from "./components/PackingDetailTabPallet.vue";
@ -870,7 +867,7 @@
OssComponents,
delUploadExcel,
delUploadExcelTx,
delDetailUploadExcel,
delDetailUploadExcelTx,
upcUploadExcel,
Chooselist,
PackingDetailTab,
@ -2101,7 +2098,7 @@
},
importDetailModel(){
this.$nextTick(() => {
this.$refs.delDetailUploadExcel.init(this.currentRow)
this.$refs.delDetailUploadExcelTx.init(this.currentRow, 'txRebuild')
})
},
/**

188
src/views/modules/ecss/del_detail_upload_excel_tx.vue

@ -0,0 +1,188 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog" @close="deleteFile">
<el-form :inline="true" label-position="top" label-width="80px">
<el-row>
<el-form-item label=" ">
</el-form-item>
</el-row>
<el-row>
<el-col :span="24">
<el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls"
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" style="text-align: left;">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="saveLoading" :disabled="saveLoading" @click="saveUploadFile">保存</el-button>
<el-button type="primary" @click="closeDialog">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {queryFileId} from "@/api/qc/qc.js"
import {modifyNotifyDetailByExcel, modifyNotifyDetailByExcelTX} from '@/api/ecss/ecss.js'
import {downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {getBuList}from '@/api/factory/site.js'
export default {
name: 'bomComponentUpload',
data() {
return {
buList: [],
titleCon: '文件导入',
visible: false,
fileList: [],
saveLoading: false,
pageData: {
site: '',
buNo: '',
delNo: '',
cmcInvoice: '',
importMode: 'normal',
createBy: this.$store.state.user.name,
},
}
},
methods: {
//
init (inData, importMode = 'normal') {
this.fileList = []
let tempData = {
username: this.$store.state.user.name,
}
this.pageData.site = inData.site
this.pageData.delNo = inData.delNo
this.pageData.buNo=inData.buNo
this.pageData.cmcInvoice=inData.cmcInvoice
this.pageData.importMode = importMode || 'normal'
getBuList(tempData).then(({data}) => {
if (data.code === 0) {
this.buList = data.row2
if(data.row2.length===1 && this.pageData.importMode !== 'txRebuild'){
this.pageData.buNo=data.row2[0].buNo
}
}
})
//
this.visible = true
},
//
beforeUploadHandle (file) {
let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase()
if (!(extName === '.xlsx' || extName === '.xls')) {
this.$message.error('数据导入失败,请选择正确的xlsx模板文件')
return false
}
},
//
onChange (file) {
this.fileList.push(file)
},
// modal
closeDialog () {
this.deleteFile()
//
this.visible = false
},
deleteFile(){
this.fileList = []
//
this.$refs.uploadFile.clearFiles()
//
this.$emit('refreshTable')
},
//
saveUploadFile () {
//
if (null == this.fileList || 0 === this.fileList.length) {
this.$message.error("请先上传文件!")
return false
}
this.saveLoading = true
const formData = new FormData()
formData.append("site",this.pageData.site)
formData.append("delNo",this.pageData.delNo)
formData.append("buNo",this.pageData.buNo)
formData.append("cmcInvoice",this.pageData.cmcInvoice)
formData.append("username",this.$store.state.user.name)
formData.append("file", this.fileList[0].raw)
// formData.append("createBy", this.pageData.createBy)
const saveApi = this.pageData.importMode === 'txRebuild'
? modifyNotifyDetailByExcelTX
: modifyNotifyDetailByExcel
saveApi(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg || '导入成功')
//
this.closeDialog()
} else {
//this.$message.error(data.msg)
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
}).catch((error) => {
console.error('保存失败:', error)
this.$message.error('保存失败,请重试')
}).finally(() => {
this.saveLoading = false
})
},
//
async downloadFile () {
let file = {
id: 0,
fileName: ''
}
let tempData = {
orderRef1: 'ecss',
orderRef2: 'upLoadDel'
}
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 downLoadObjectFile(file).then(({data}) => {
//
const blob = new Blob([data], {type: "application/octet-stream"})
//
const fileName = file.fileName
// a
const linkNode = document.createElement('a')
// adownload
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)
})
},
}
}
</script>
Loading…
Cancel
Save