Browse Source

批量导入发货通知单

java8
han\hanst 4 months ago
parent
commit
6478c3449a
  1. 3
      src/api/ecss/ecss.js
  2. 6
      src/views/modules/ecss/codelnotify.vue
  3. 2
      src/views/modules/ecss/codelnotifyConfirm.vue
  4. 2
      src/views/modules/ecss/createDeclaration.vue
  5. 20
      src/views/modules/ecss/declaration.vue
  6. 569
      src/views/modules/ecss/del_upload_excel.vue

3
src/api/ecss/ecss.js

@ -2,6 +2,7 @@
import { createAPI } from "@/utils/httpRequest.js";
export const previewExcel = data => createAPI(`/ecss/coDel/previewExcel`,'post',data)
export const saveEcssCoDelNotifyByExcel = data => createAPI(`/ecss/coDel/saveEcssCoDelNotifyByExcel`,'post',data)
export const modifyNotifyDetailByExcel = data => createAPI(`/ecss/coDel/modifyNotifyDetailByExcel`,'post',data)
@ -129,5 +130,7 @@ export const getCustomers = data => createAPI(`/select/ecssMapper/getCustomerInf
export const getCustomerAdd = data => createAPI(`/select/ecssMapper/getCustomerAdd/list`,'post',data)
export const getCustomerTemplateList = data => createAPI(`/ecss/coDel/getCustomerTemplateList`,'post',data)

6
src/views/modules/ecss/codelnotify.vue

@ -117,7 +117,7 @@
layout="total, sizes, prev, pager, next, jumper">
</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="明细" name="detail">
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" name="detail">
<el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="openCreateDetailModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="importDetailModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'改单导入'}}</el-button>
<el-table ref="detailTable"
@ -1696,7 +1696,7 @@
exportGoods:{
salesMethod:'EXW',
currency: 'USD',
madeArea: 'Shanghai, China',
madeArea: 'Nantong, China',
sendPort:'Shanghai, China',
deliveryGoodsDate:'',
voyage :'',
@ -2325,7 +2325,7 @@
this.exportGoods.hsCodeDescType = 'N'
this.exportGoods.salesMethod = 'EXW'
this.exportGoods.currency = this.currentRow.currency?this.currentRow.currency:this.dataList2.length>0?this.dataList2[0].currency:'USD'
this.exportGoods.madeArea = 'Shanghai, China'
this.exportGoods.madeArea = 'Nantong, China'
this.exportGoods.sendPort = 'Shanghai, China'
this.exportGoods.deliveryGoodsDate = ''
this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:''

2
src/views/modules/ecss/codelnotifyConfirm.vue

@ -109,7 +109,7 @@
layout="total, sizes, prev, pager, next, jumper">
</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="明细" name="detail">
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" name="detail">
<el-table
:height="height"
:data="dataList2"

2
src/views/modules/ecss/createDeclaration.vue

@ -103,7 +103,7 @@
layout="total, sizes, prev, pager, next, jumper">
</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="明细" name="detail">
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" name="detail">
<el-table
:height="height"
:data="dataList2"

20
src/views/modules/ecss/declaration.vue

@ -814,7 +814,7 @@
exportGoods:{
salesMethod:'EXW',
currency: 'USD',
madeArea: 'Shanghai, China',
madeArea: 'Nantong, China',
sendPort:'Shanghai, China',
deliveryGoodsDate:'',
voyage :'',
@ -2006,7 +2006,7 @@
this.exportGoods.hsCodeDescType = 'N'
this.exportGoods.salesMethod = 'EXW'
this.exportGoods.currency = this.currentRow.currency?this.currentRow.currency:this.dataList2.length>0?this.dataList2[0].currency:'USD'
this.exportGoods.madeArea = 'Shanghai, China'
this.exportGoods.madeArea = 'Nantong, China'
this.exportGoods.sendPort = 'Shanghai, China'
this.exportGoods.deliveryGoodsDate = ''
this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:''
@ -2033,7 +2033,7 @@
let error;
ExportUtil.export(
"/ecss/coDel/downloadDeclarationElements",
exportParam, this.currentRow.declarationNo+"报关要素.xlsx"
exportParam, this.currentRow.cmcInvoice+"报关要素.xlsx"
);
this.brandTypeFlag = false
},
@ -2055,7 +2055,7 @@
exportParam.declarationWeight = this.declarationWeight
ExportUtil.export(
"/ecss/coDel/downloadDeclaration",
exportParam, this.currentRow.declarationNo+"报关单.xlsx"
exportParam, this.currentRow.cmcInvoice+"报关单.xlsx"
);
this.declarationFlag = false
},
@ -2071,7 +2071,7 @@
exportParam.notifyPartDetailList = this.notifyPartDetailList
ExportUtil.export(
"/ecss/coDel/downloadInvoice",
exportParam, this.currentRow.declarationNo+"发票.xlsx"
exportParam, this.currentRow.cmcInvoice+"发票.xlsx"
);
this.exportInvoiceFlag=false
this.searchTable()
@ -2106,7 +2106,7 @@
exportParam.notifyPartDetailList = this.notifyPartDetailList
ExportUtil.export(
"/ecss/coDel/downloadPackingList",
exportParam, this.currentRow.declarationNo+"箱单.xlsx"
exportParam, this.currentRow.cmcInvoice+"箱单.xlsx"
);
this.exportPakingFlag = false;
this.searchTable()
@ -2122,7 +2122,7 @@
exportParam.delNo = this.currentRow.delNo
ExportUtil.export(
"/ecss/coDel/downloadExportGoods",
exportParam, this.currentRow.declarationNo+"出口货物委托书.xlsx"
exportParam, this.currentRow.cmcInvoice+"出口货物委托书.xlsx"
);
this.exportGoodsFlag = false;
this.searchTable()
@ -2138,7 +2138,7 @@
exportParam.delNo = this.currentRow.delNo
ExportUtil.export(
"/ecss/coDel/downloadContract",
exportParam, this.currentRow.declarationNo+"合同.xlsx"
exportParam, this.currentRow.cmcInvoice+"合同.xlsx"
);
this.searchTable()
},
@ -2181,7 +2181,7 @@
exportParam.notifyPartDetailList = this.notifyPartDetailList
ExportUtil.export(
"/ecss/coDel/downloadAll",
exportParam, this.currentRow.declarationNo+"单证信息.xlsx"
exportParam, this.currentRow.cmcInvoice+"单证信息.xlsx"
);
this.exportAllFlag = false
this.searchTable()
@ -2307,7 +2307,7 @@
})
this.exportGoods.salesMethod = 'EXW'
this.exportGoods.currency = this.currentRow.currency?this.currentRow.currency:this.dataList2.length>0?this.dataList2[0].currency:'USD'
this.exportGoods.madeArea = 'Shanghai, China'
this.exportGoods.madeArea = 'Nantong, China'
this.exportGoods.sendPort = 'Shanghai, China'
this.exportGoods.deliveryGoodsDate = ''
this.exportGoods.voyage = this.currentRow.buNo==='01-Label' || this.currentRow.buNo==='03-RFID'?this.currentRow.cmcInvoice:''

569
src/views/modules/ecss/del_upload_excel.vue

@ -1,74 +1,19 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible"
width="600px" class="customer-dialog" @close="deleteFile">
<el-form label-position="top" >
:width="showPreview ? '1200px' : '600px'" class="customer-dialog" @close="deleteFile">
<el-form label-position="top">
<el-row :gutter="16">
<el-col :span="12">
<el-form-item label="BU">
<el-select v-model="pageData.buNo" placeholder="请选择" style="width: 100%">
<el-option v-for = "i in buList" :key = "i.buNo" :label = "i.buDesc" :value = "i.buNo"></el-option>
<el-select v-model="pageData.buNo" placeholder="请选择" style="width: 100%">
<el-option v-for="i in buList" :key="i.buNo" :label="i.buDesc" :value="i.buNo"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-col :span="12">
<el-form-item label=" ">
<el-button type="primary" @click="downloadFile()">下载文件模板</el-button>
</el-form-item> </el-col>
<el-col :span="12">
<el-form-item :label="''" >
<template #label>
<span slot="label" style="" class="big-label">
<a href="#" @click="customFlag=true">客户</a>
</span>
</template>
<el-input type="textarea"
:rows="2" v-model="pageData.customerName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="''" >
<template #label>
<span slot="label" style="" class="big-label">
<a href="#" @click="overseasShipperFlag=true">收货单位</a>
</span>
</template>
<el-input type="textarea"
:rows="2" v-model="pageData.overseasShipper"></el-input>
</el-form-item>
</el-col>
<el-col :span="12" style="margin-top: 30px">
<el-form-item :label="''" >
<template #label>
<span slot="label" style="" class="big-label">
<a href="#" @click="localShipAddressFlag=true">客户地址</a>
</span>
</template>
<el-input type="textarea"
:rows="3" v-model="pageData.localShipAddress"></el-input>
</el-form-item>
</el-col>
<el-col :span="12" style="margin-top: 30px">
<el-form-item :label="''" >
<template #label>
<span slot="label" style="" class="big-label">
<a href="#" @click="overseasAddressFlag=true">收货单位地址</a>
</span>
</template>
<el-input type="textarea"
:rows="3" v-model="pageData.overseasAddress"></el-input>
</el-form-item>
</el-col>
<el-col :span="12" style="margin-top: 60px">
<el-form-item :label="'贸易国'" >
<el-input v-model="pageData.salesArea" ></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="'运抵国'" style="margin-top: 60px">
<el-input v-model="pageData.cnative" ></el-input>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-top: 10px">
@ -80,13 +25,169 @@
</el-col>
</el-row>
</el-form>
<!-- 预览数据表格 -->
<!-- 加载状态 -->
<div v-if="previewLoading" style="margin-top: 20px; text-align: center; padding: 40px;">
<i class="el-icon-loading" style="font-size: 24px; color: #409EFF;"></i>
<p style="margin-top: 10px; color: #666;">正在解析文件请稍候...</p>
</div>
<div v-if="showPreview" style="margin-top: 20px; margin-bottom: 30px;">
<h4>文件预览 - 按发票号汇总 ({{ previewData.length }}个发票)</h4>
<el-table :data="previewData" border style="width: 100%" max-height="400" :show-overflow-tooltip="true">
<el-table-column prop="cmcInvoice" label="发票号" width="120" fixed="left">
<template slot-scope="scope">
<span :style="scope.row.exists ? 'color: red; font-weight: bold;' : ''">
{{ scope.row.cmcInvoice }}
<el-tag v-if="scope.row.exists" type="danger" size="mini">已存在</el-tag>
</span>
</template>
</el-table-column>
<el-table-column prop="destination" label="目的地" width="100"></el-table-column>
<el-table-column label="客户模板" width="150">
<template slot-scope="scope">
<el-input
v-model="scope.row.selectedTemplate"
placeholder="请选择客户模板"
@dblclick.native="selectTemplateForRow(scope.row)"
size="small"
style="cursor: pointer;">
</el-input>
</template>
</el-table-column>
<el-table-column label="客户" width="150">
<template slot-scope="scope">
<el-input
v-model="scope.row.selectedCustomer"
placeholder="请选择客户"
@dblclick.native="selectCustomerForRow(scope.row)"
size="small"
style="cursor: pointer;">
</el-input>
</template>
</el-table-column>
<el-table-column label="客户地址" width="160">
<template slot-scope="scope">
<el-input
v-model="scope.row.selectedLocalAddress"
placeholder="请选择客户地址"
@dblclick.native="selectLocalAddressForRow(scope.row)"
size="small"
style="cursor: pointer;">
</el-input>
</template>
</el-table-column>
<el-table-column label="收货单位" width="150">
<template slot-scope="scope">
<el-input
v-model="scope.row.selectedOverseasShipper"
placeholder="请选择收货单位"
@dblclick.native="selectOverseasShipperForRow(scope.row)"
size="small"
style="cursor: pointer;">
</el-input>
</template>
</el-table-column>
<el-table-column label="收货单位地址" width="160">
<template slot-scope="scope">
<el-input
v-model="scope.row.selectedOverseasAddress"
placeholder="请选择收货单位地址"
@dblclick.native="selectOverseasAddressForRow(scope.row)"
size="small"
style="cursor: pointer;">
</el-input>
</template>
</el-table-column>
<el-table-column label="运抵国" width="90">
<template slot-scope="scope">
<el-input v-model="scope.row.selectedCnative" placeholder="运抵国" size="small"></el-input>
</template>
</el-table-column>
<el-table-column label="贸易国" min-width="90">
<template slot-scope="scope">
<el-input v-model="scope.row.selectedSalesArea" placeholder="贸易国" size="small"></el-input>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer" style="margin-top: 10px">
<el-button type="primary" @click="saveUploadFile">保存</el-button>
<el-button type="primary" @click="closeDialog">关闭</el-button>
<el-button v-if="!showPreview" type="primary" @click="saveUploadFile">保存</el-button>
<el-button v-if="showPreview" type="primary" @click="saveFromPreview">确认保存</el-button>
<el-button v-if="showPreview" @click="cancelPreview">取消预览</el-button>
<el-button v-if="!showPreview" type="primary" @click="closeDialog">关闭</el-button>
</span>
</el-dialog>
<el-dialog title="客户" @close="closeCustomDialog" :visible.sync="customFlag" width="500px" v-drag>
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择客户模板` : '客户模板'"
@close="templateFlag = false; currentRow = null" :visible.sync="templateFlag" width="850px" v-drag>
<el-table
:height="400"
:data="customerTemplateList"
stripe
highlight-current-row
border
@row-dblclick="rowDblclickTemplate"
style="width: 100%;">
<el-table-column
prop="template_name"
header-align="center"
align="left"
width="150"
label="模板名称">
</el-table-column>
<el-table-column
prop="ccusname"
header-align="center"
align="left"
width="150"
label="客户名称">
</el-table-column>
<el-table-column
prop="localShipAddress"
header-align="center"
align="left"
width="120"
label="客户地址">
</el-table-column>
<el-table-column
prop="overseasShipper"
header-align="center"
align="left"
width="120"
label="收货单位">
</el-table-column>
<el-table-column
prop="overseasAddress"
header-align="center"
align="left"
width="120"
label="收货地址">
</el-table-column>
<el-table-column
prop="salesArea"
header-align="center"
align="left"
width="80"
label="贸易国">
</el-table-column>
<el-table-column
prop="cnative"
header-align="center"
align="left"
width="80"
label="运抵国">
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button @click="templateFlag = false; currentRow = null">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择客户` : '客户'" @close="closeCustomDialog" :visible.sync="customFlag" width="500px" v-drag>
<el-form inline="inline" label-position="top" :model="customSearchData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="客户名称">
<el-input v-model="customSearchData.ccusname" clearable style="width: 150px"></el-input>
@ -122,7 +223,7 @@
</el-footer>
</el-dialog>
<el-dialog title="客户地址" @close="localShipAddressFlag = false" :visible.sync="localShipAddressFlag" width="500px" v-drag>
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择客户地址` : '客户地址'" @close="localShipAddressFlag = false; currentRow = null" :visible.sync="localShipAddressFlag" width="500px" v-drag>
<el-table
:height="400"
:data="customerAddrs"
@ -139,11 +240,11 @@
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button @click="localShipAddressFlag = false">关闭</el-button>
<el-button @click="localShipAddressFlag = false; currentRow = null">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="收货单位地址" @close="overseasAddressFlag = false" :visible.sync="overseasAddressFlag" width="500px" v-drag>
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择收货单位地址` : '收货单位地址'" @close="overseasAddressFlag = false; currentRow = null" :visible.sync="overseasAddressFlag" width="500px" v-drag>
<el-table
:height="400"
:data="customerAddrs"
@ -160,11 +261,11 @@
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button @click="overseasAddressFlag = false">关闭</el-button>
<el-button @click="overseasAddressFlag = false; currentRow = null">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="收货单位" @close="overseasShipperFlag = false" :visible.sync="overseasShipperFlag" width="500px" v-drag>
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择收货单位` : '收货单位'" @close="overseasShipperFlag = false; currentRow = null" :visible.sync="overseasShipperFlag" width="500px" v-drag>
<el-table
:height="400"
:data="customerAddrs"
@ -188,7 +289,7 @@
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button @click="overseasShipperFlag = false">关闭</el-button>
<el-button @click="overseasShipperFlag = false; currentRow = null">关闭</el-button>
</el-footer>
</el-dialog>
</div>
@ -196,7 +297,7 @@
<script>
import {queryFileId} from "@/api/qc/qc.js"
import {saveEcssCoDelNotifyByExcel,getCustomerList,getCustomers,getCustomerAdd} from '@/api/ecss/ecss.js'
import {previewExcel,saveEcssCoDelNotifyByExcel,getCustomerList,getCustomers,getCustomerAdd,getCustomerTemplateList} from '@/api/ecss/ecss.js'
import {downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {getBuList}from '@/api/factory/site.js'
export default {
@ -218,6 +319,10 @@
cnative:'',
salesArea:'',
},
previewData: [], //
showPreview: false, //
selectedFile: null, //
previewLoading: false, //
customSearchData: {},
customerList : [],//
customerAddrs : [],//
@ -227,8 +332,11 @@
localShipAddressFlag:false,
overseasShipperFlag:false,
overseasAddressFlag:false,
templateFlag:false,
customerTemplateList: [],//
cacheKey: '', //
cacheTimer: null, //
currentRow: null, //
}
},
watch: {
@ -314,6 +422,10 @@
//
init () {
this.fileList = []
this.previewData = []
this.showPreview = false
this.selectedFile = null
this.previewLoading = false
this.cacheKey = this.generateCacheKey();
let tempData = {
@ -385,29 +497,79 @@
},
closeCustomDialog () {
this.customFlag = false
this.currentRow = null
},
rowDblclickTemplate(row) {
console.log(row)
if (this.currentRow) {
// 使
this.currentRow.selectedTemplate = row.template_name
this.currentRow.selectedCustomer = row.ccusname || ''
this.currentRow.selectedLocalAddress = row.localShipAddress || ''
this.currentRow.selectedOverseasShipper = row.overseasShipper || ''
this.currentRow.selectedOverseasAddress = row.overseasAddress || ''
this.currentRow.selectedCnative = row.cnative || ''
this.currentRow.selectedSalesArea = row.salesArea || ''
//
if (row.ccusname) {
this.getCusPersonsForRow(row.ccusname)
}
}
this.templateFlag = false
this.currentRow = null
},
rowDblclick (row) {
this.pageData.customerName=row.ccusname
this.pageData.cnative='',
this.pageData.localShipAddress='',
this.pageData.overseasShipper='',
this.pageData.overseasAddress='',
this.pageData.salesArea = row.country
this.getCusPersons()
if (this.currentRow) {
//
this.currentRow.selectedCustomer = row.ccusname
this.currentRow.selectedSalesArea = row.country
this.currentRow.selectedLocalAddress = ''
this.currentRow.selectedOverseasShipper = ''
this.currentRow.selectedOverseasAddress = ''
this.currentRow.selectedCnative = ''
this.getCusPersonsForRow(row.ccusname)
} else {
//
this.pageData.customerName=row.ccusname
this.pageData.cnative='',
this.pageData.localShipAddress='',
this.pageData.overseasShipper='',
this.pageData.overseasAddress='',
this.pageData.salesArea = row.country
this.getCusPersons()
}
this.customFlag = false
},
rowDblclick2 (row) {
this.pageData.localShipAddress=row.cDeliverAdd
if (this.currentRow) {
this.currentRow.selectedLocalAddress = row.cDeliverAdd
} else {
this.pageData.localShipAddress = row.cDeliverAdd
}
this.localShipAddressFlag = false
this.currentRow = null
},
rowDblclick3 (row) {
this.pageData.overseasAddress=row.cDeliverAdd
if (this.currentRow) {
this.currentRow.selectedOverseasAddress = row.cDeliverAdd
} else {
this.pageData.overseasAddress = row.cDeliverAdd
}
this.overseasAddressFlag = false
this.currentRow = null
},
rowDblclick4 (row) {
this.pageData.overseasShipper=row.cDeliverUnit
this.pageData.cnative=row.deliverycountry
if (this.currentRow) {
this.currentRow.selectedOverseasShipper = row.cDeliverUnit
this.currentRow.selectedCnative = row.deliverycountry
} else {
this.pageData.overseasShipper = row.cDeliverUnit
this.pageData.cnative = row.deliverycountry
}
this.overseasShipperFlag = false
this.currentRow = null
},
//
@ -422,6 +584,8 @@
//
onChange (file) {
this.fileList.push(file)
this.selectedFile = file
this.previewFile(file)
},
// modal
@ -529,6 +693,7 @@
if (successList.length > 0){
this.clearCache();
}
this.clearPreviewData();
this.closeDialog();
}
});
@ -542,6 +707,248 @@
},
//
async previewFile(file) {
if (!file || !file.raw) {
return
}
if (!this.pageData.buNo) {
this.$message.error('请先选择BU!')
this.fileList = []
this.$refs.uploadFile.clearFiles()
return
}
this.previewLoading = true //
const formData = new FormData()
formData.append("file", file.raw)
formData.append("buNo", this.pageData.buNo)
try {
const { data } = await previewExcel(formData)
if (data.code === 0) {
this.previewData = data.data || []
this.showPreview = true
//
this.previewData.forEach(item => {
this.$set(item, 'selectedTemplate', '')
this.$set(item, 'selectedCustomer', '')
this.$set(item, 'selectedLocalAddress', '')
this.$set(item, 'selectedOverseasShipper', '')
this.$set(item, 'selectedOverseasAddress', '')
this.$set(item, 'selectedCnative', '')
this.$set(item, 'selectedSalesArea','')
})
} else {
this.$message.error(data.msg || '文件预览失败')
}
} catch (error) {
this.$message.error('文件预览失败:' + error.message)
} finally {
this.previewLoading = false //
}
},
//
saveFromPreview() {
//
for (let item of this.previewData) {
if (!item.selectedCustomer) {
this.$message.error(`发票号 ${item.cmcInvoice} 请选择客户`)
return false
}
if (!item.selectedLocalAddress) {
this.$message.error(`发票号 ${item.cmcInvoice} 请填写客户地址`)
return false
}
if (!item.selectedOverseasShipper) {
this.$message.error(`发票号 ${item.cmcInvoice} 请填写收货单位`)
return false
}
if (!item.selectedOverseasAddress) {
this.$message.error(`发票号 ${item.cmcInvoice} 请填写收货单位地址`)
return false
}
if (!item.selectedCnative) {
this.$message.error(`发票号 ${item.cmcInvoice} 请填写运抵国`)
return false
}
}
//
const formData = new FormData()
formData.append("buNo", this.pageData.buNo)
formData.append("username", this.$store.state.user.name)
formData.append("file", this.selectedFile.raw)
//
this.previewData.forEach((item, index) => {
formData.append(`customerName_${item.cmcInvoice}`, item.selectedCustomer)
formData.append(`localShipAddress_${item.cmcInvoice}`, item.selectedLocalAddress)
formData.append(`overseasShipper_${item.cmcInvoice}`, item.selectedOverseasShipper)
formData.append(`overseasAddress_${item.cmcInvoice}`, item.selectedOverseasAddress)
formData.append(`cnative_${item.cmcInvoice}`, item.selectedCnative)
formData.append(`salesArea_${item.cmcInvoice}`, item.selectedSalesArea)
})
saveEcssCoDelNotifyByExcel(formData).then(({ data }) => {
if (data.code === 0) {
const { resultMap } = data;
const successList = resultMap.success || [];
const failList = resultMap.fail || [];
//
let html = `
<div style="max-height:380px;overflow:auto;font-size:12px;line-height:1.4;">
`;
if (successList.length > 0) {
html += `<div style="margin-bottom:6px;">
<div style="color:green;font-weight:bold;margin-bottom:3px;">
成功${successList.length}
</div>
<table border="1" cellspacing="0" cellpadding="2"
style="border-collapse:collapse;width:100%;">
`;
successList.forEach(item => {
html += `<tr><td style="color:green;padding:2px 4px;">${item}</td></tr>`;
});
html += `</table></div>`;
}
if (failList.length > 0) {
html += `<div>
<div style="color:red;font-weight:bold;margin-bottom:3px;">
失败${failList.length}
</div>
<table border="1" cellspacing="0" cellpadding="2"
style="border-collapse:collapse;width:100%;">
`;
failList.forEach(item => {
html += `<tr><td style="color:red;padding:2px 4px;">${item}</td></tr>`;
});
html += `</table></div>`;
}
html += `</div>`;
this.$alert(html, '导入结果', {
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
callback: () => {
if (successList.length > 0){
this.clearCache();
this.clearPreviewData();
this.closeDialog();
}
}
});
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
});
}
});
},
//
cancelPreview() {
this.showPreview = false
this.previewData = []
this.fileList = []
this.$refs.uploadFile.clearFiles()
},
//
clearPreviewData() {
this.previewData = []
this.showPreview = false
this.selectedFile = null
this.fileList = []
this.previewLoading = false
this.$refs.uploadFile.clearFiles()
},
//
selectTemplateForRow(row) {
this.currentRow = row
this.getCustomerTemplateList()
this.templateFlag = true
},
//
selectCustomerForRow(row) {
this.currentRow = row
this.customFlag = true
},
//
selectLocalAddressForRow(row) {
if (!row.selectedCustomer) {
this.$message.warning('请先选择客户')
return
}
this.currentRow = row
this.getCusPersonsForRow(row.selectedCustomer)
this.localShipAddressFlag = true
},
//
selectOverseasShipperForRow(row) {
if (!row.selectedCustomer) {
this.$message.warning('请先选择客户')
return
}
this.currentRow = row
this.getCusPersonsForRow(row.selectedCustomer)
this.overseasShipperFlag = true
},
//
selectOverseasAddressForRow(row) {
if (!row.selectedCustomer) {
this.$message.warning('请先选择客户')
return
}
this.currentRow = row
this.getCusPersonsForRow(row.selectedCustomer)
this.overseasAddressFlag = true
},
//
async getCustomerTemplateList() {
try {
const { data } = await getCustomerTemplateList({})
if (data && data.code === 0) {
this.customerTemplateList = data.rows || []
}
} catch (error) {
console.error('获取客户模板列表失败:', error)
this.customerTemplateList = []
}
},
//
getCusPersonsForRow(customerName) {
let cusData = {ccusname: customerName}
getCustomers(cusData).then(({data}) => {
if (data && data.code === 0) {
this.customerPersons = data.rows
this.customerPersons.forEach(o => {
if (!this.customerMap.has(o.ccontactname)) {
this.customerMap.set(o.ccontactname, o.cnative);
}
});
}
});
getCustomerAdd(cusData).then(({data}) => {
if (data && data.code === 0) {
this.customerAddrs = data.rows
}
});
},
//
async downloadFile () {
let file = {

Loading…
Cancel
Save