|
@@ -16,6 +16,13 @@
|
|
|
<a-button> <a-icon type="upload" />选择上传文件</a-button>
|
|
|
</a-upload>
|
|
|
</a-form-item>
|
|
|
+<!-- <a-form-item
|
|
|
+ label="下载导入模板"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-button type="primary" @click="downloadExcel">点击下载</a-button>
|
|
|
+ </a-form-item>-->
|
|
|
</a-form>
|
|
|
<title-divider title="导入结果" width="90px"></title-divider>
|
|
|
<a-table
|
|
@@ -38,13 +45,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { importCheckStandard, importCheckStandardOldVersion, importCheckStandardByUpdate } from '@/api/check/checkstandard'
|
|
|
+import { importCheckStandard, importCheckStandardOldVersion, importCheckStandardByUpdate, downLoad } from '@/api/check/checkstandard'
|
|
|
|
|
|
export default {
|
|
|
name: 'SbModelBomImportForm',
|
|
|
data () {
|
|
|
return {
|
|
|
confirmLoading: false,
|
|
|
+ downloadType: 1,
|
|
|
modalTitle: null,
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
@@ -79,6 +87,21 @@ export default {
|
|
|
this.modalTitle = '维护标准导入'
|
|
|
this.type = type
|
|
|
},
|
|
|
+ downloadExcel () {
|
|
|
+ downLoad('http://localhost:8000/api/excel/download?downloadType=2').then(res => {
|
|
|
+ // 判断是否是IE浏览器,是的话返回true
|
|
|
+ if ('msSaveOrOpenBlob' in navigator) { // 兼容ie浏览器下载报传递给系统调用的数据区域太小.
|
|
|
+ var data = res.data
|
|
|
+ var blob = new Blob([data], { type: 'application/vnd.ms-excel' })
|
|
|
+ window.navigator.msSaveOrOpenBlob(blob, '模板.xls')
|
|
|
+ } else {
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.href = 'http://127.0.0.1:8000/api/excel/download?downloadType=2'
|
|
|
+ a.target = '_blank'
|
|
|
+ a.click()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
handleRemove (file) {
|
|
|
const index = this.fileList.indexOf(file)
|
|
|
const newFileList = this.fileList.slice()
|