kz-ui-base 1.0.170 → 1.0.171
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,5 +1,4 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<!-- 用户导入对话框 -->
|
|
3
2
|
<el-dialog
|
|
4
3
|
:title="setting.title"
|
|
5
4
|
:visible.sync="setting.isShow"
|
|
@@ -7,9 +6,10 @@
|
|
|
7
6
|
append-to-body
|
|
8
7
|
v-dialogDrag
|
|
9
8
|
v-dialogDragHeight
|
|
9
|
+
@close="handleClose"
|
|
10
10
|
>
|
|
11
11
|
<el-upload
|
|
12
|
-
ref="
|
|
12
|
+
ref="upload"
|
|
13
13
|
:limit="1"
|
|
14
14
|
accept=".xlsx, .xls"
|
|
15
15
|
:headers="setting.headers"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
:disabled="setting.isUploading"
|
|
18
18
|
:on-progress="handleFileUploadProgress"
|
|
19
19
|
:on-success="handleFileSuccess"
|
|
20
|
+
:on-error="handleFileError"
|
|
20
21
|
:auto-upload="false"
|
|
21
22
|
drag
|
|
22
23
|
>
|
|
@@ -61,14 +62,30 @@ export default class uploadDialog extends Vue {
|
|
|
61
62
|
serviceName;
|
|
62
63
|
public submitLoading = false;
|
|
63
64
|
public open = false;
|
|
65
|
+
|
|
64
66
|
show() {
|
|
65
67
|
this.setting.isShow = true;
|
|
68
|
+
this.submitLoading = false;
|
|
69
|
+
this.setting.isUploading = false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
handleClose() {
|
|
73
|
+
this.resetUpload();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resetUpload() {
|
|
77
|
+
this.submitLoading = false;
|
|
78
|
+
this.setting.isUploading = false;
|
|
79
|
+
if (this.$refs.upload) {
|
|
80
|
+
(this.$refs.upload as any).clearFiles();
|
|
81
|
+
}
|
|
66
82
|
}
|
|
83
|
+
|
|
67
84
|
cancel() {
|
|
68
85
|
this.open = false;
|
|
69
86
|
(this as any).reset();
|
|
70
87
|
}
|
|
71
|
-
|
|
88
|
+
|
|
72
89
|
importTemplate() {
|
|
73
90
|
(this as any).download(
|
|
74
91
|
`${this.moduleName}/${this.serviceName}/importTemplate`,
|
|
@@ -78,25 +95,43 @@ export default class uploadDialog extends Vue {
|
|
|
78
95
|
`${this.serviceName}_${new Date().getTime()}.xlsx`
|
|
79
96
|
);
|
|
80
97
|
}
|
|
81
|
-
|
|
98
|
+
|
|
82
99
|
handleFileUploadProgress(event, file, fileList) {
|
|
83
100
|
this.setting.isUploading = true;
|
|
84
101
|
}
|
|
85
|
-
|
|
102
|
+
|
|
86
103
|
handleFileSuccess(response, file, fileList) {
|
|
87
|
-
this.setting.
|
|
104
|
+
this.setting.isShow = false;
|
|
88
105
|
this.setting.isUploading = false;
|
|
89
|
-
|
|
106
|
+
this.submitLoading = false;
|
|
107
|
+
|
|
108
|
+
if (this.$refs.upload) {
|
|
109
|
+
(this.$refs.upload as any).clearFiles();
|
|
110
|
+
}
|
|
111
|
+
|
|
90
112
|
(this as any).$alert(response.msg, "导入结果", {
|
|
91
113
|
dangerouslyUseHTMLString: true,
|
|
114
|
+
type: response.code === 200 ? 'success' : 'error'
|
|
92
115
|
});
|
|
93
|
-
|
|
116
|
+
|
|
117
|
+
this.$emit("onImportSuccess", response);
|
|
94
118
|
}
|
|
95
|
-
|
|
119
|
+
|
|
120
|
+
handleFileError(err, file, fileList) {
|
|
121
|
+
this.setting.isUploading = false;
|
|
122
|
+
this.submitLoading = false;
|
|
123
|
+
(this as any).$message.error("文件上传失败,请重试");
|
|
124
|
+
}
|
|
125
|
+
|
|
96
126
|
submitFileForm() {
|
|
127
|
+
const uploadRef = this.$refs.upload as any;
|
|
128
|
+
if (!uploadRef || !uploadRef.uploadFiles || uploadRef.uploadFiles.length === 0) {
|
|
129
|
+
(this as any).$message.warning("请先选择要上传的文件");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
97
133
|
this.submitLoading = true;
|
|
98
|
-
|
|
99
|
-
this.submitLoading = false;
|
|
134
|
+
uploadRef.submit();
|
|
100
135
|
}
|
|
101
136
|
}
|
|
102
137
|
</script>
|
|
@@ -105,4 +140,4 @@ export default class uploadDialog extends Vue {
|
|
|
105
140
|
.wrapper-container-supplement {
|
|
106
141
|
min-height: 415px;
|
|
107
142
|
}
|
|
108
|
-
</style>
|
|
143
|
+
</style>
|