Commit eccf2fcf authored by xioln's avatar xioln

采购入库模版下载

parent 97d2e6b8
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
import { post, del, get } from '@/utils/http' import { post, del, get } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom' import StorageDetails from './component/storageDetailsCreateCom'
import ImportFile from './component/importFile' import ImportFile from './component/importFile'
import { downloadFile } from '@/utils/http'
export default { export default {
componentName: '采购入库申请创建编辑', componentName: '采购入库申请创建编辑',
name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填 name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填
...@@ -225,25 +227,39 @@ export default { ...@@ -225,25 +227,39 @@ export default {
}) })
} }
} }
} },
// { {
// name: '模版下载', name: '模版下载',
// icon: '/icons/c-down.png', icon: '/icons/c-down.png',
// handler: { handler: {
// click: () => { click: () => {
// this.$utils.downLoadFileUrl('/download/template/器材导入模板.xlsx', '器材导入模板.xlsx') 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) { if (fileName) {
// // 校验通过 downloadFile(`/download/template/${fileName}`, 'get').then(res => {
// // this.$utils.downLoadFileUrl('/download/template/器材导入模板.xlsx', '器材导入模板.xlsx') this.$utils.downLoadFile(res, fileName)
// } else { })
// this.$utils.showMessageWarning('请填写基本信息!') }
// } } else {
// }) this.$utils.showMessageWarning('请填写基本信息!')
// } }
// } })
// } }
}
}
], ],
topTools: [ 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