diff --git a/src/views/plan/order/index.vue b/src/views/plan/order/index.vue index 1dd5cb1..829d599 100644 --- a/src/views/plan/order/index.vue +++ b/src/views/plan/order/index.vue @@ -103,7 +103,16 @@ >SAP同步 - + + 导入 + + + + + + 将文件拖到此处,或点击上传 + + + + + 仅允许导入xls、xlsx格式文件。 + 下载模板 + + + + + @@ -410,6 +449,7 @@ import { import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' import moment from 'moment' +import { getToken } from "@/utils/auth" export default { name: 'Order', @@ -419,6 +459,21 @@ export default { }, data() { return { + // 导入数据 + upload: { + // 是否显示弹出层(用户导入) + open: false, + // 弹出层标题(用户导入) + title: "", + // 是否禁用上传 + isUploading: false, + // 是否更新已经存在的用户数据 + updateSupport: 0, + // 设置上传的请求头部 + headers: {poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"), Authorization: "Bearer " + getToken() }, + // 上传的地址 + url: process.env.VUE_APP_BASE_API + "/plan/order/importData" + }, // 工艺list routes: [], // 表单参数 @@ -514,6 +569,32 @@ export default { }) }, methods: { + /** 导入按钮操作 */ + handleImport() { + this.upload.title = "订单信息导入"; // todo + this.upload.open = true; + }, + /** 下载模板操作 */ + importTemplate() { + this.download('/plan/order/importTemplate', { + }, `stu_base_template_${new Date().getTime()}.xlsx`) // todo + }, + // 文件上传中处理 + handleFileUploadProgress(event, file, fileList) { + this.upload.isUploading = true; + }, + // 文件上传成功处理 + handleFileSuccess(response, file, fileList) { + this.upload.open = false; + this.upload.isUploading = false; + this.$refs.upload.clearFiles(); + this.$alert("" + response.msg + "", "导入结果", { dangerouslyUseHTMLString: true }); + this.getList(); + }, + // 提交上传文件 + submitFileForm() { + this.$refs.upload.submit(); + }, /** 导出按钮操作 */ handleExport() { this.download('/plan/order/export', {