功能变化:

1.文件导入优化;
pull/84/head
猿小天 2023-01-02 21:41:54 +08:00
parent a319030271
commit 62943431f2
2 changed files with 35 additions and 42 deletions

View File

@ -4,6 +4,7 @@
<slot>导入</slot>
</el-button>
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<div v-loading="loading">
<el-upload
ref="upload"
:limit="1"
@ -27,9 +28,10 @@
<el-button type="warning" style="font-size:14px;margin-top: 20px" @click="importTemplate"></el-button>
<el-button type="warning" style="font-size:14px;margin-top: 20px" @click="updateTemplate"></el-button>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
<el-button type="primary" :disabled="loading" @click="submitFileForm"> </el-button>
<el-button :disabled="loading" @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
@ -75,6 +77,11 @@ export default {
}
}
},
data(){
return {
loading:false
}
},
methods: {
/** 导入按钮操作 */
handleImport () {
@ -107,17 +114,17 @@ export default {
const that = this
// that.upload.open = false
that.upload.isUploading = false
that.loading = true
that.$refs.upload.clearFiles()
//
return request({
url: that.importApi,
url: util.baseURL() + that.api + 'import_data/',
method: 'post',
data: {
url: response.data.url,
updateSupport: that.upload.updateSupport
url: response.data.url
}
}).then(response => {
// this.$alert("", "", { dangerouslyUseHTMLString: true });
that.loading = false
that.$alert('导入成功', '导入完成', {
confirmButtonText: '确定',
callback: action => {
@ -129,22 +136,8 @@ export default {
//
submitFileForm () {
this.$refs.upload.submit()
},
getUpdateField () {
const that = this
if (that.updateFieldApi) {
return request({
url: that.updateFieldApi,
method: 'get'
}).then(res => {
that.fieldOptions = res.data
})
}
}
},
mounted () {
this.getUpdateField()
}
}
</script>

View File

@ -165,7 +165,7 @@ export const crudOptions = (vm) => {
component: {
placeholder: '请选择是否管理员',
show (context) {
return !!vm.info.is_superuser
return vm.info.is_superuser
}
}
}