1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| <template>
| <el-dialog :title="title" :visible="visible" append-to-body>
| <Divider text="导入提示" left="30px"></Divider>
| <ul>
| <li v-for="(item, index) in tipInfo" :key="index">
| {{ item }}
| </li>
| </ul>
| <div class="radio_box">
| <span>分类的路径使用的属性:</span>
| <el-radio-group v-model="classifyAttr">
| <el-radio label="id">分类编号</el-radio>
| <el-radio label="name">分类名称</el-radio>
| </el-radio-group>
| </div>
| <Divider text="excel文件,选择文件后会自动上传" left="30px"></Divider>
| <el-upload
| class="upload"
| :accept="accept"
| :action="action"
| :before-upload="beforeUpload"
| :on-exceed="handleExceed"
| >
| <el-button size="small" type="primary"><i class="el-icon-upload"></i> 点击上传</el-button>
| </el-upload>
| <template #footer>
| <el-button type="primary" size="small" @click="downloadTemplateFun">下载导入模板</el-button>
| <el-button size="small">关闭</el-button>
| </template>
| </el-dialog>
| </template>
|
| <script>
| import { downloadTemplate } from '../../api/batchImport/index'
| export default {
| name: "",
| props: {
| title: {
| type: String,
| default: "批量申请编码",
| },
| tipInfo: {
| type: Array,
| default: () => [],
| },
| visible: {
| type: Boolean,
| default: false,
| },
| accept: {
| type: String,
| default: '.xlsx, .xls'
| },
| codeClassifyOid: {
| type: String,
| default: ''
| },
| downloadTemplateFun: {
| type: Function
| }
| },
| data() {
| return {
| classType: "classCode",
| };
| },
| computed: {
| action() {
| console.log(process, 'process');
| return '/api/ubcs-code/mdmEngineController/mdmEngineController/batchTopImportCode'
| }
| },
| methods: {
| beforeUpload(file) {
| const fileType = file.name.split('.').pop()
| if (fileType !== 'xlsx' && fileType !== 'xls') {
| // 上传格式不符合要求,提示错误信息并取消上传
| this.$message.error('只允许上传xlsx、xls格式的文件');
| return false;
| }
| return true;
| },
| },
| };
| </script>
|
| <style lang="scss" scoped>
| ul {
| color: rgb(188, 188, 188);
| margin: 20px 0 0 0;
| padding: 0;
| padding-left: 30px;
| list-style: none;
| li {
| margin-bottom: 5px;
| font-size: 12px;
| }
| }
| .radio_box {
| padding-left: 30px;
| margin: 20px 0 25px 0;
| display: flex;
| align-items: center;
| span {
| margin-right: 20px;
| }
| }
| .upload {
| padding-left: 30px;
| margin-top: 30px;
| }
| </style>
|
|