Browse Source

upc+另存为

master
han\hanst 1 month ago
parent
commit
748de51aff
  1. 11
      src/api/ecss/ecss.js
  2. 412
      src/views/modules/ecss/codelnotify.vue
  3. 221
      src/views/modules/ecss/upc_upload_excel.vue

11
src/api/ecss/ecss.js

@ -11,6 +11,8 @@ export const searchEcssCoDelNotifyDetail = data => createAPI(`/ecss/coDel/search
export const updateEcssDelHeader = data => createAPI(`/ecss/coDel/updateEcssDelHeader`,'post',data) export const updateEcssDelHeader = data => createAPI(`/ecss/coDel/updateEcssDelHeader`,'post',data)
export const updateCustomerInfo = data => createAPI(`/ecss/coDel/updateCustomerInfo`,'post',data)
export const deleteEcssDelHeader = data => createAPI(`/ecss/coDel/deleteEcssDelHeader`,'post',data) export const deleteEcssDelHeader = data => createAPI(`/ecss/coDel/deleteEcssDelHeader`,'post',data)
export const cancelEcssDelHeader = data => createAPI(`/ecss/coDel/cancelEcssDelHeader`,'post',data) export const cancelEcssDelHeader = data => createAPI(`/ecss/coDel/cancelEcssDelHeader`,'post',data)
@ -162,4 +164,13 @@ export const importPartPackageProperties = data => createAPI(`/ecss/coDel/import
// 合箱接口 // 合箱接口
export const mergeBox = data => createAPI(`/ecss/coDel/mergeBox`,'post',data) export const mergeBox = data => createAPI(`/ecss/coDel/mergeBox`,'post',data)
// UPC导入接口
export const importUpcData = data => createAPI(`/ecss/coDel/importUpcData`,'post',data)
// 查询UPC数据列表
export const searchUpcImportData = data => createAPI(`/ecss/coDel/searchUpcImportData`,'post',data)
// 删除UPC数据
export const deleteUpcImportData = data => createAPI(`/ecss/coDel/deleteUpcImportData`,'post',data)

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

@ -73,6 +73,9 @@
<el-form-item label=" "> <el-form-item label=" ">
<el-button @click="exportGoodsList()" type="primary" style="margin-left: 2px">{{'导出出口货物委托书'}}</el-button> <el-button @click="exportGoodsList()" type="primary" style="margin-left: 2px">{{'导出出口货物委托书'}}</el-button>
</el-form-item> </el-form-item>
<el-form-item label=" ">
<el-button @click="openCustomerInfoDialog()" type="primary" style="margin-left: 2px">{{'客户信息'}}</el-button>
</el-form-item>
</el-form> </el-form>
<el-table <el-table
@ -130,6 +133,7 @@
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" 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="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-button v-show="currentRow.notifyStatus!=='订单取消'" @click="importDetailModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'改单导入'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="importUpcModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'UPC导入'}}</el-button>
<el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="fixTtlAmountHandle()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'TTL Amount修正'}}</el-button> <el-button v-show="currentRow.notifyStatus!=='订单取消'" @click="fixTtlAmountHandle()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'TTL Amount修正'}}</el-button>
<el-table ref="detailTable" <el-table ref="detailTable"
:height="height" :height="height"
@ -192,6 +196,64 @@
:show-actions="false"> :show-actions="false">
</packing-detail-tab> </packing-detail-tab>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="UPC明细" name="upcDetail" v-if="dataList3.length > 0">
<el-button
@click="deleteAllUpcData()"
type="danger"
style="margin-bottom: 2px;">
一键删除
</el-button>
<el-table
ref="upcTable"
:height="height"
:data="dataList3"
:span-method="arraySpanMethod"
border
style="width: 100%;">
<el-table-column
prop="cartonNo"
label="箱号"
width="120"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="so"
label="SO"
width="120"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="pn"
label="P/N"
min-width="150"
align="left"
header-align="center">
</el-table-column>
<el-table-column
prop="description"
label="Description"
min-width="200"
align="left"
header-align="center">
</el-table-column>
<el-table-column
prop="upc"
label="UPC"
width="150"
align="center"
header-align="center">
</el-table-column>
<el-table-column
prop="qty"
label="Qty"
width="100"
align="center"
header-align="center">
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="相关文档" name="codelnotifyDocument"> <el-tab-pane label="相关文档" name="codelnotifyDocument">
<oss-components label="申请单号" style="margin-top: 5px" height="44vh" :columns="ossColumns" <oss-components label="申请单号" style="margin-top: 5px" height="44vh" :columns="ossColumns"
:order-ref1="currentRow.site" :order-ref2="currentRow.delNo" :codelnotifyFlag="'1'" :order-ref1="currentRow.site" :order-ref2="currentRow.delNo" :codelnotifyFlag="'1'"
@ -440,6 +502,8 @@
<del-upload-excel ref="delUploadExcel" @refreshTable="searchTable" v-drag></del-upload-excel> <del-upload-excel ref="delUploadExcel" @refreshTable="searchTable" v-drag></del-upload-excel>
<!-- 导入 --> <!-- 导入 -->
<del-detail-upload-excel ref="delDetailUploadExcel" @refreshTable="searchTable" v-drag></del-detail-upload-excel> <del-detail-upload-excel ref="delDetailUploadExcel" @refreshTable="searchTable" v-drag></del-detail-upload-excel>
<!-- UPC导入 -->
<upc-upload-excel ref="upcUploadExcel" @refreshTable="searchTable" v-drag></upc-upload-excel>
<!--列表的组件--> <!--列表的组件-->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px"> <el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px">
@ -704,6 +768,77 @@
<el-button @click="templateFlag = false">关闭</el-button> <el-button @click="templateFlag = false">关闭</el-button>
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<!-- 客户信息编辑对话框 -->
<el-dialog title="编辑客户信息" :close-on-click-modal="false" v-drag :visible.sync="customerInfoDialogFlag" width="600px">
<el-form label-position="top" style="margin-left: 7px; margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="客户名称(Customer Name)">
<el-input
v-model="customerInfoModel.customerName"
style="cursor: pointer;">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="贸易国(Sales Area)">
<el-input v-model="customerInfoModel.salesArea" placeholder="请输入贸易国"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="客户地址(Local Ship Address)">
<el-input v-model="customerInfoModel.localShipAddress"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="收货单位(Overseas Shipper)">
<el-input v-model="customerInfoModel.overseasShipper"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运抵国(Cnative)">
<el-input v-model="customerInfoModel.cnative" placeholder="请输入运抵国"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="收货单位地址(Overseas Address)">
<el-input v-model="customerInfoModel.overseasAddress">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="模板名称">
<el-input
v-model="customerInfoModel.templateName"
placeholder="请输入模板名称(用于另存为新的客户模版)">
<el-button
slot="append"
type="success"
:disabled="!customerInfoModel.templateName || !customerInfoModel.templateName.trim()"
:class="{ 'fake-disabled': !customerInfoModel.templateName }"
@click="saveAsTemplate">
另存为
</el-button>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="height:40px; margin-top: 10px; text-align:center">
<el-button type="primary" @click="updateCustomerInfo()">保存</el-button>
<el-button @click="customerInfoDialogFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
</div> </div>
</template> </template>
@ -711,6 +846,7 @@
import Chooselist from '@/views/modules/common/Chooselist_eam' import Chooselist from '@/views/modules/common/Chooselist_eam'
import delUploadExcel from "./del_upload_excel.vue"; import delUploadExcel from "./del_upload_excel.vue";
import delDetailUploadExcel from "./del_detail_upload_excel.vue"; import delDetailUploadExcel from "./del_detail_upload_excel.vue";
import upcUploadExcel from "./upc_upload_excel.vue";
import PackingDetailTab from "./components/PackingDetailTab.vue"; import PackingDetailTab from "./components/PackingDetailTab.vue";
import {} from "@/api/sysLanguage.js" import {} from "@/api/sysLanguage.js"
import { getTableUserListLanguage} from "@/api/table.js" import { getTableUserListLanguage} from "@/api/table.js"
@ -720,6 +856,7 @@
searchEcssCoDelNotifyHeader, searchEcssCoDelNotifyHeader,
searchEcssCoDelNotifyDetail, searchEcssCoDelNotifyDetail,
updateEcssDelHeader, updateEcssDelHeader,
updateCustomerInfo,
deleteEcssDelHeader, deleteEcssDelHeader,
cancelEcssDelHeader, cancelEcssDelHeader,
recoverEcssDelHeader, recoverEcssDelHeader,
@ -729,10 +866,14 @@
searchCoDelPalletDataNew, searchCoDelPalletDataNew,
queryPartListAll, queryPartListAll,
searchTemplateList, searchTemplateList,
getCustomerList,
getCustomers, getCustomers,
getCustomerAdd, getCustomerAdd,
getNotifyPartDetail, getNotifyPartDetail,
fixTtlAmount
fixTtlAmount,
searchUpcImportData,
deleteUpcImportData,
updateCustomerTemplate
}from "@/api/ecss/ecss.js" }from "@/api/ecss/ecss.js"
import {getBuList}from '@/api/factory/site.js' import {getBuList}from '@/api/factory/site.js'
import ExportUtil from "@/utils/export"; import ExportUtil from "@/utils/export";
@ -743,6 +884,7 @@
OssComponents, OssComponents,
delUploadExcel, delUploadExcel,
delDetailUploadExcel, delDetailUploadExcel,
upcUploadExcel,
Chooselist, Chooselist,
PackingDetailTab, PackingDetailTab,
}, },
@ -811,6 +953,7 @@
buList:[], buList:[],
dataList:[], dataList:[],
dataList2:[], dataList2:[],
dataList3:[], // UPC
dataListLoading: false, dataListLoading: false,
xiadaLoading: false, // xiadaLoading: false, //
updateDetailLoading: false, // / updateDetailLoading: false, // /
@ -1814,6 +1957,25 @@
templateList:[], templateList:[],
customerData:{}, customerData:{},
customerAddData:{}, customerAddData:{},
//
customerInfoDialogFlag: false,
customerInfoModel: {
customerName: '',
localShipAddress: '',
overseasShipper: '',
overseasAddress: '',
salesArea: '',
cnative: '',
templateName: ''
},
//
customerSelectFlag: false,
addressSelectFlag: false,
shipperSelectFlag: false,
overseasAddressSelectFlag: false,
customerListForEdit: [],
customerAddrsForEdit: [],
customSearchData: {},
} }
}, },
mounted() { mounted() {
@ -1988,6 +2150,9 @@
this.saveSelectedRowToStorage(); this.saveSelectedRowToStorage();
} }
// UPCUPC tab
this.getUpcDataList();
this.refreshCurrentTabTable (); this.refreshCurrentTabTable ();
}, },
importModel(){ importModel(){
@ -2000,6 +2165,18 @@
this.$refs.delDetailUploadExcel.init(this.currentRow) this.$refs.delDetailUploadExcel.init(this.currentRow)
}) })
}, },
/**
* UPC导入
*/
importUpcModel(){
if (!this.currentRow || !this.currentRow.cmcInvoice) {
this.$message.warning('请先选择一个发货通知单')
return
}
this.$nextTick(() => {
this.$refs.upcUploadExcel.init(this.currentRow)
})
},
// TTL Amount // TTL Amount
fixTtlAmountHandle(){ fixTtlAmountHandle(){
if (!this.currentRow || !this.currentRow.delNo) { if (!this.currentRow || !this.currentRow.delNo) {
@ -2055,6 +2232,126 @@
this.$refs.packingDetailTab.refresh(); this.$refs.packingDetailTab.refresh();
} }
} }
if(this.activeName==='upcDetail'){
// UPC
this.getUpcDataList()
}
},
/**
* 获取UPC数据列表
*/
getUpcDataList(){
if(!this.currentRow || !this.currentRow.cmcInvoice){
this.dataList3 = []
return
}
const params = {
site: this.currentRow.site,
cmcInvoice: this.currentRow.cmcInvoice
}
searchUpcImportData(params).then(({data}) => {
if (data && data.code === 0) {
this.dataList3 = data.rows || []
} else {
this.dataList3 = []
}
}).catch((error) => {
console.error('查询UPC数据失败:', error)
this.dataList3 = []
})
},
/**
* 删除发货通知单的全部UPC数据
*/
deleteAllUpcData(){
if (!this.currentRow || !this.currentRow.cmcInvoice) {
this.$message.warning('请先选择一个发货通知单')
return
}
//
this.$confirm(`确定要删除发票号 ${this.currentRow.cmcInvoice} 的全部UPC数据吗?`, '删除确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const params = {
site: this.currentRow.site,
cmcInvoice: this.currentRow.cmcInvoice
}
deleteUpcImportData(params).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('UPC数据删除成功')
//
this.dataList3 = []
// tab
this.activeName = 'detail'
} else {
this.$alert(data.msg || 'UPC数据删除失败', '错误', {
confirmButtonText: '确定'
})
}
}).catch((error) => {
console.error('删除UPC数据失败:', error)
this.$alert('删除UPC数据失败: ' + error, '错误', {
confirmButtonText: '确定'
})
})
}).catch(() => {
//
})
},
/**
* 合并表格单元格方法
* 用于合并相同cartonNo的行
*/
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 0) {
//
if (!this.dataList3 || this.dataList3.length === 0) {
return {
rowspan: 1,
colspan: 1
}
}
//
const currentCartonNo = row.cartonNo
//
if (rowIndex === 0 || this.dataList3[rowIndex - 1].cartonNo !== currentCartonNo) {
//
let rowspan = 1
for (let i = rowIndex + 1; i < this.dataList3.length; i++) {
if (this.dataList3[i].cartonNo === currentCartonNo) {
rowspan++
} else {
break
}
}
return {
rowspan: rowspan,
colspan: 1
}
} else {
//
return {
rowspan: 0,
colspan: 0
}
}
}
//
return {
rowspan: 1,
colspan: 1
}
}, },
tabClick (tab, event) { tabClick (tab, event) {
// //
@ -2699,6 +2996,114 @@
this.exportGoods.shippingDate = '' this.exportGoods.shippingDate = ''
this.exportGoodsFlag = true this.exportGoodsFlag = true
}, },
/**
* 打开客户信息编辑对话框
*/
openCustomerInfoDialog() {
if (!this.currentRow || !this.currentRow.cmcInvoice) {
this.$message.warning('请选择发货通知单!')
return
}
if (this.currentRow.notifyStatus === '订单取消') {
this.$message.warning('该发货通知单已取消!')
return
}
//
this.customerInfoModel = {
customerName: this.currentRow.customerName || '',
localShipAddress: this.currentRow.localShipAddress || '',
overseasShipper: this.currentRow.overseasShipper || '',
overseasAddress: this.currentRow.overseasAddress || '',
salesArea: this.currentRow.salesArea || '',
cnative: this.currentRow.cnative || '',
templateName: ''
}
this.customerInfoDialogFlag = true
},
/**
* 更新客户信息
*/
updateCustomerInfo() {
//
if (!this.customerInfoModel.customerName) {
this.$message.warning('请填写客户名称')
return
}
//
const updateData = {
site: this.currentRow.site,
delNo: this.currentRow.delNo,
customerName: this.customerInfoModel.customerName,
localShipAddress: this.customerInfoModel.localShipAddress,
overseasShipper: this.customerInfoModel.overseasShipper,
overseasAddress: this.customerInfoModel.overseasAddress,
salesArea: this.customerInfoModel.salesArea,
cnative: this.customerInfoModel.cnative
}
//
updateCustomerInfo(updateData).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('客户信息更新成功')
this.customerInfoDialogFlag = false
//
this.searchTable()
} else {
this.$message.error(data.msg || '更新失败')
}
}).catch(error => {
this.$message.error('更新失败:' + (error.message || '网络异常'))
})
},
/**
* 另存为模板
*/
async saveAsTemplate() {
//
if (!this.customerInfoModel.templateName) {
this.$message.warning('请输入模板名称')
return
}
if (!this.customerInfoModel.customerName) {
this.$message.warning('请填写客户名称')
return
}
//
const templateData = {
templateName: this.customerInfoModel.templateName,
originalTemplateName: '', //
ccuscode: '', //
ccusname: this.customerInfoModel.customerName,
localShipAddress: this.customerInfoModel.localShipAddress || '',
overseasShipper: this.customerInfoModel.overseasShipper || '',
overseasAddress: this.customerInfoModel.overseasAddress || '',
cnative: this.customerInfoModel.cnative || '',
salesArea: this.customerInfoModel.salesArea || ''
}
try {
const {data} = await updateCustomerTemplate(templateData)
if (data && data.code === 0) {
this.$message.success(`模板"${this.customerInfoModel.templateName}"保存成功!`)
//
this.customerInfoModel.templateName = ''
} else {
this.$message.error(data.msg || '保存模板失败')
}
} catch (error) {
console.error('保存模板失败:', error)
this.$message.error('保存模板失败:' + (error.message || '网络异常'))
}
},
// //
downloadInvoice() { downloadInvoice() {
if (!this.currentRow || !this.currentRow.buNo) { if (!this.currentRow || !this.currentRow.buNo) {
@ -2907,4 +3312,9 @@
.clickable-pn:hover { .clickable-pn:hover {
opacity: 0.8; opacity: 0.8;
} }
.fake-disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style> </style>

221
src/views/modules/ecss/upc_upload_excel.vue

@ -0,0 +1,221 @@
<template>
<div class="customer-css">
<el-dialog title="UPC导入" :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-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-row style="margin-top: 10px;">
<el-col :span="24">
<el-alert
title="导入说明"
type="info"
description="发票号需与当前选中的发货通知单发票号一致"
:closable="false"
show-icon>
</el-alert>
</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 {importUpcData} from '@/api/ecss/ecss.js'
import {downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {getBuList}from '@/api/factory/site.js'
export default {
name: 'upcUploadExcel',
data() {
return {
buList: [],
visible: false,
fileList: [],
saveLoading: false,
pageData: {
site: '',
buNo: '',
cmcInvoice: '',
createBy: this.$store.state.user.name,
},
}
},
methods: {
/**
* 初始化组件参数
* @param {Object} inData - 当前行数据包含 cmcInvoice 等信息
*/
init (inData) {
this.fileList = []
let tempData = {
username: this.$store.state.user.name,
}
this.pageData.buNo = inData.buNo
this.pageData.cmcInvoice = inData.cmcInvoice
this.pageData.site = inData.site || this.$store.state.user.site
getBuList(tempData).then(({data}) => {
if (data.code === 0) {
this.buList = data.row2
if(data.row2.length === 1){
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)
},
/**
* 关闭对话框
*/
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
}
//
if (!this.pageData.cmcInvoice) {
this.$message.error("请先选择一个发货通知单!")
return false
}
this.saveLoading = true
const formData = new FormData()
formData.append("site", this.pageData.site)
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)
importUpcData(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg || 'UPC数据导入成功')
//
this.closeDialog()
} else {
this.$alert(data.msg || '导入失败', '错误', {
confirmButtonText: '确定'
})
}
}).catch((error) => {
console.error('UPC导入失败:', error)
this.$message.error('导入失败,请重试')
}).finally(() => {
this.saveLoading = false
})
},
/**
* 下载UPC导入模板
*/
async downloadFile () {
let file = {
id: 0,
fileName: ''
}
let tempData = {
orderRef1: 'ecss',
orderRef2: 'upcImportTemplate'
}
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: '确定'
})
return
}
})
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)
}).catch(() => {
this.$message.error('模板下载失败')
})
},
}
}
</script>
<style scoped>
.customer-css {
/* 自定义样式 */
}
.el-alert {
font-size: 12px;
}
</style>
Loading…
Cancel
Save