Commit eccf2fcf authored by xioln's avatar xioln

采购入库模版下载

parent 97d2e6b8
......@@ -38,6 +38,8 @@
import { post, del, get } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom'
import ImportFile from './component/importFile'
import { downloadFile } from '@/utils/http'
export default {
componentName: '采购入库申请创建编辑',
name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填
......@@ -225,25 +227,39 @@ export default {
})
}
}
}
// {
// name: '模版下载',
// icon: '/icons/c-down.png',
// handler: {
// click: () => {
// this.$utils.downLoadFileUrl('/download/template/器材导入模板.xlsx', '器材导入模板.xlsx')
},
{
name: '模版下载',
icon: '/icons/c-down.png',
handler: {
click: () => {
this.$refs.form.validate((isok) => {
if (isok) {
let fileName = ''
// 使用一个映射来将不同的billType映射到对应的文件名
const billTypeToFileNameMap = {
'Material': '器材导入模板.xlsx',
'AirEquipment': '机载设备导入模板.xlsx',
'OutSource': '外包产品导入模板.xlsx'
}
if (billTypeToFileNameMap[this.form.billType]) {
fileName = billTypeToFileNameMap[this.form.billType]
}
// this.$refs.form.validate((isok) => {
// if (isok) {
// // 校验通过
// // this.$utils.downLoadFileUrl('/download/template/器材导入模板.xlsx', '器材导入模板.xlsx')
// } else {
// this.$utils.showMessageWarning('请填写基本信息!')
// }
// })
// }
// }
// }
// 然后下载文件
if (fileName) {
downloadFile(`/download/template/${fileName}`, 'get').then(res => {
this.$utils.downLoadFile(res, fileName)
})
}
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
}
],
topTools: [
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment