vue2-client 1.3.24 → 1.4.0
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.
- package/CHANGELOG.md +12 -1
- package/package.json +78 -76
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +543 -551
- package/src/base-client/components/common/Upload/Upload.vue +168 -167
- package/src/base-client/components/common/XFormTable/XFormTable.vue +113 -76
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -0
- package/src/base-client/components/common/XImportExcel/index.js +3 -0
- package/src/base-client/components/common/XImportExcel/index.md +38 -0
- package/src/base-client/components/common/XTable/XTable.vue +259 -278
- package/src/components/TableSetting/TableSetting.vue +143 -0
- package/src/components/TableSetting/index.js +3 -0
- package/src/pages/login/Login.vue +360 -361
- package/src/pages/system/ticket/index.vue +1 -1
- package/src/services/api/common.js +123 -58
- package/src/utils/common.js +10 -0
- package/src/utils/errorCode.js +6 -0
- package/src/base-client/components/common/CustomColumnsDrawer/CustomColumnsDrawer.vue +0 -109
- package/src/base-client/components/common/CustomColumnsDrawer/index.js +0 -3
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +0 -46
|
@@ -0,0 +1,131 @@
|
|
|
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>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# XImportExcel
|
|
2
|
+
|
|
3
|
+
通用表格导入组件
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 何时使用
|
|
7
|
+
|
|
8
|
+
当需要表入导出时
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
引用方式:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import XImportExcel from '@vue2-client/base-client/components/XImportExcel/XImportExcel'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
XImportExcel
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 代码演示
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<x-import-excel
|
|
29
|
+
ref="importExcel"
|
|
30
|
+
@ok="refreshTable"
|
|
31
|
+
/>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
37
|
+
|-----|---------|-------|-----|
|
|
38
|
+
| @ok | 导入完成后事件 | event | - |
|