|
|
@@ -37,7 +37,7 @@
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="dialogVisible = false">关 闭</el-button>
|
|
|
- <el-button size="small" @click="upload" type="primary">上 传</el-button>
|
|
|
+ <el-button size="small" @click="upload" type="primary" :loading="loading">上 传</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
@@ -62,7 +62,8 @@
|
|
|
uploadShow: false,
|
|
|
module: '',
|
|
|
attaments: [], //上传文件
|
|
|
- file: ''
|
|
|
+ file: '',
|
|
|
+ loading: false
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -92,18 +93,28 @@
|
|
|
},
|
|
|
// 文件上传
|
|
|
async upload() {
|
|
|
+ this.loading = true;
|
|
|
if (this.attaments.length == 0) {
|
|
|
return this.$message.warning('文件不能为空!');
|
|
|
}
|
|
|
this.module = this.$props.defModule;
|
|
|
-
|
|
|
- await importBatch({
|
|
|
- module: this.module,
|
|
|
- multiPartFiles: this.attaments
|
|
|
- });
|
|
|
- this.$message.success('操作成功!');
|
|
|
- this.dialogVisible = false;
|
|
|
- this.$emit('success');
|
|
|
+ try {
|
|
|
+ await importBatch({
|
|
|
+ module: this.module,
|
|
|
+ multiPartFiles: this.attaments
|
|
|
+ });
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.loading = false;
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.$emit('success');
|
|
|
+ } catch (error) {
|
|
|
+ this.loading = false;
|
|
|
+ // this.$message.error(error.message);
|
|
|
+ // this.$alert(error.message, '导入失败', {
|
|
|
+ // confirmButtonText: '确定',
|
|
|
+ // type: 'error'
|
|
|
+ // });
|
|
|
+ }
|
|
|
},
|
|
|
//下载模板
|
|
|
downLoadTemplate() {
|