vue2-client 1.6.39 → 1.6.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,131 +1,132 @@
1
- <template>
2
- <a-modal
3
- title="数据导入"
4
- :visible="open"
5
- :confirm-loading="uploading"
6
- @cancel="importExcelHandleCancel"
7
- @ok="importExcelHandleChange"
8
- >
9
- <a-spin tip="上传中..." :spinning="uploading">
10
- <a-upload-dragger
11
- name="file"
12
- accept=".xlsx, .xls"
13
- :file-list="fileList"
14
- :multiple="false"
15
- :remove="handleRemove"
16
- :before-upload="beforeUpload"
17
- >
18
- <p class="ant-upload-drag-icon">
19
- <a-icon type="inbox" />
20
- </p>
21
- <p class="ant-upload-text">
22
- 请将文件拖拽到此处上传
23
- </p>
24
- <p class="ant-upload-hint">
25
- 支持单个上传,也可以点击后选择文件上传
26
- </p>
27
- </a-upload-dragger>
28
- <a-divider/>
29
- <a-checkbox @change="handleCheckedUpdateSupport" :checked="updateSupport !== 0">
30
- 是否更新已经存在的数据
31
- </a-checkbox>
32
- <a v-if="queryParamsName !== 'none'" @click="importTemplate">下载导入模板</a>
33
- </a-spin>
34
- </a-modal>
35
- </template>
36
-
37
- <script>
38
-
39
- import { importData, download } from '@vue2-client/services/api/common'
40
-
41
- export default {
42
- name: 'XImportExcel',
43
- props: {
44
- serviceName: {
45
- type: String,
46
- default: 'af-system'
47
- },
48
- queryParamsName: {
49
- type: String,
50
- default: 'none'
51
- },
52
- // 业务名称
53
- title: {
54
- type: String,
55
- default: ''
56
- }
57
- },
58
- components: {
59
- },
60
- data () {
61
- return {
62
- open: false,
63
- uploadStatus: '',
64
- fileList: [],
65
- // 是否禁用上传
66
- uploading: false,
67
- updateSupport: 0
68
- }
69
- },
70
- filters: {
71
- },
72
- created () {
73
- },
74
- computed: {
75
- },
76
- watch: {
77
- },
78
- methods: {
79
- /** 导入excel窗体关闭 */
80
- importExcelHandleCancel (e) {
81
- this.open = false
82
- this.fileList = []
83
- // 关闭后刷新列表
84
- this.$emit('ok')
85
- },
86
- /** 下载模板操作 */
87
- importTemplate () {
88
- const params = {
89
- queryParamsName: this.queryParamsName,
90
- type: 'template'
91
- }
92
- download(params, this.title + `数据模板_${new Date().toLocaleString()}.xlsx`, this.serviceName)
93
- },
94
- /** 导入excel窗体开启 */
95
- importExcelHandleOpen (e) {
96
- this.open = true
97
- },
98
- beforeUpload (file) {
99
- this.fileList = [file]
100
- return false
101
- },
102
- /** 导入excel */
103
- importExcelHandleChange () {
104
- const { fileList } = this
105
- const formData = new FormData()
106
- if (!fileList[0]) {
107
- this.$message.warn('请选择需要上传的文件')
108
- return
109
- }
110
- this.uploading = true
111
- formData.append('file', fileList[0])
112
- formData.append('updateSupport', this.updateSupport)
113
- importData(formData).then(response => {
114
- this.fileList = []
115
- this.$message.success(response.msg)
116
- this.open = false
117
- this.$emit('ok')
118
- }).finally(() => {
119
- this.uploading = false
120
- })
121
- },
122
- handleCheckedUpdateSupport () {
123
- this.updateSupport = this.updateSupport === 0 ? 1 : 0
124
- },
125
- handleRemove () {
126
- this.fileList = []
127
- this.uploading = false
128
- }
129
- }
130
- }
131
- </script>
1
+ <template>
2
+ <a-modal
3
+ title="数据导入"
4
+ :visible="open"
5
+ :zIndex="1001"
6
+ :confirm-loading="uploading"
7
+ @cancel="importExcelHandleCancel"
8
+ @ok="importExcelHandleChange"
9
+ >
10
+ <a-spin tip="上传中..." :spinning="uploading">
11
+ <a-upload-dragger
12
+ name="file"
13
+ accept=".xlsx, .xls"
14
+ :file-list="fileList"
15
+ :multiple="false"
16
+ :remove="handleRemove"
17
+ :before-upload="beforeUpload"
18
+ >
19
+ <p class="ant-upload-drag-icon">
20
+ <a-icon type="inbox" />
21
+ </p>
22
+ <p class="ant-upload-text">
23
+ 请将文件拖拽到此处上传
24
+ </p>
25
+ <p class="ant-upload-hint">
26
+ 支持单个上传,也可以点击后选择文件上传
27
+ </p>
28
+ </a-upload-dragger>
29
+ <a-divider/>
30
+ <a-checkbox @change="handleCheckedUpdateSupport" :checked="updateSupport !== 0">
31
+ 是否更新已经存在的数据
32
+ </a-checkbox>
33
+ <a v-if="queryParamsName !== 'none'" @click="importTemplate">下载导入模板</a>
34
+ </a-spin>
35
+ </a-modal>
36
+ </template>
37
+
38
+ <script>
39
+
40
+ import { importData, download } from '@vue2-client/services/api/common'
41
+
42
+ export default {
43
+ name: 'XImportExcel',
44
+ props: {
45
+ serviceName: {
46
+ type: String,
47
+ default: 'af-system'
48
+ },
49
+ queryParamsName: {
50
+ type: String,
51
+ default: 'none'
52
+ },
53
+ // 业务名称
54
+ title: {
55
+ type: String,
56
+ default: ''
57
+ }
58
+ },
59
+ components: {
60
+ },
61
+ data () {
62
+ return {
63
+ open: false,
64
+ uploadStatus: '',
65
+ fileList: [],
66
+ // 是否禁用上传
67
+ uploading: false,
68
+ updateSupport: 0
69
+ }
70
+ },
71
+ filters: {
72
+ },
73
+ created () {
74
+ },
75
+ computed: {
76
+ },
77
+ watch: {
78
+ },
79
+ methods: {
80
+ /** 导入excel窗体关闭 */
81
+ importExcelHandleCancel (e) {
82
+ this.open = false
83
+ this.fileList = []
84
+ // 关闭后刷新列表
85
+ this.$emit('ok')
86
+ },
87
+ /** 下载模板操作 */
88
+ importTemplate () {
89
+ const params = {
90
+ queryParamsName: this.queryParamsName,
91
+ type: 'template'
92
+ }
93
+ download(params, this.title + `数据模板_${new Date().toLocaleString()}.xlsx`, this.serviceName)
94
+ },
95
+ /** 导入excel窗体开启 */
96
+ importExcelHandleOpen (e) {
97
+ this.open = true
98
+ },
99
+ beforeUpload (file) {
100
+ this.fileList = [file]
101
+ return false
102
+ },
103
+ /** 导入excel */
104
+ importExcelHandleChange () {
105
+ const { fileList } = this
106
+ const formData = new FormData()
107
+ if (!fileList[0]) {
108
+ this.$message.warn('请选择需要上传的文件')
109
+ return
110
+ }
111
+ this.uploading = true
112
+ formData.append('file', fileList[0])
113
+ formData.append('updateSupport', this.updateSupport)
114
+ importData(formData).then(response => {
115
+ this.fileList = []
116
+ this.$message.success(response.msg)
117
+ this.open = false
118
+ this.$emit('ok')
119
+ }).finally(() => {
120
+ this.uploading = false
121
+ })
122
+ },
123
+ handleCheckedUpdateSupport () {
124
+ this.updateSupport = this.updateSupport === 0 ? 1 : 0
125
+ },
126
+ handleRemove () {
127
+ this.fileList = []
128
+ this.uploading = false
129
+ }
130
+ }
131
+ }
132
+ </script>