功能变化:

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

View File

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