|
|
@ -34,16 +34,19 @@ |
|
|
|
<el-button style="" |
|
|
|
type="yellow" |
|
|
|
size="small" |
|
|
|
icon="el-icon-download" |
|
|
|
@click="handleExport">导出</el-button> |
|
|
|
<el-button style="" |
|
|
|
type="green" |
|
|
|
size="small" |
|
|
|
icon="el-icon-plus" |
|
|
|
@click="handleAdd">新增小区</el-button> |
|
|
|
<div class="btn_upload" |
|
|
|
v-if="agencyObj.level==='community'||agencyObj.level==='grid'"> |
|
|
|
<el-button style="" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
icon="el-icon-download" |
|
|
|
@click="handleExportModule('community')">下载小区模板</el-button> |
|
|
|
|
|
|
|
<el-upload ref="upload_community" |
|
|
@ -56,12 +59,15 @@ |
|
|
|
:http-request="(()=>{uploadFile( 'community')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
icon="el-icon-upload2" |
|
|
|
:loading="importCommunityLoading" |
|
|
|
type="red">导入小区数据</el-button> |
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
icon="el-icon-download" |
|
|
|
@click="handleExportModule('building')">下载楼宇模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
@ -74,11 +80,14 @@ |
|
|
|
:http-request="(()=>{uploadFile( 'building')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
icon="el-icon-upload2" |
|
|
|
:loading="importBuildingLoading" |
|
|
|
type="red">导入楼宇数据</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
icon="el-icon-download" |
|
|
|
@click="handleExportModule('room')">下载房屋模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
@ -91,6 +100,8 @@ |
|
|
|
:http-request="(()=>{uploadFile( 'room')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
icon="el-icon-upload2" |
|
|
|
:loading="importRoomLoading" |
|
|
|
type="red">导入房屋数据</el-button> |
|
|
|
</el-upload> |
|
|
|
</div> |
|
|
@ -192,7 +203,9 @@ let loading // 加载动画 |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
loading: false, |
|
|
|
importBuildingLoading: false, |
|
|
|
importRoomLoading: false, |
|
|
|
importCommunityLoading: false, |
|
|
|
total: 0, |
|
|
|
pageSize: 20, |
|
|
|
pageNo: 0, |
|
|
@ -457,10 +470,16 @@ export default { |
|
|
|
async uploadFile (type) { |
|
|
|
|
|
|
|
if (this.fileName == "") { |
|
|
|
|
|
|
|
this.$message.warning('请选择要上传的文件!') |
|
|
|
return false |
|
|
|
} |
|
|
|
this.loading = true |
|
|
|
|
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
message: '导入中,请到系统管理-导入记录中查看进度', |
|
|
|
duration: 0 |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
//清空上传列表 |
|
|
|
let url = '' |
|
|
@ -471,6 +490,7 @@ export default { |
|
|
|
fileFormData.append('orgType', this.agencyObj.level === 'grid' ? 'grid' : 'agency');//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
|
|
|
|
|
|
if (type === 'community') { |
|
|
|
this.importCommunityLoading = true |
|
|
|
this.$refs['upload_community'].clearFiles() |
|
|
|
url = '/gov/org/icneighborhood/neighborhoodimport' |
|
|
|
|
|
|
@ -478,27 +498,44 @@ export default { |
|
|
|
} else if (type === 'building') { |
|
|
|
this.$refs['upload_building'].clearFiles() |
|
|
|
url = '/gov/org/building/buildingimport' |
|
|
|
|
|
|
|
this.importBuildingLoading = true |
|
|
|
|
|
|
|
} else if (type === 'room') { |
|
|
|
this.$refs['upload_room'].clearFiles() |
|
|
|
url = '/gov/org/house/houseimport' |
|
|
|
|
|
|
|
this.importRoomLoading = true |
|
|
|
} |
|
|
|
this.startLoading() |
|
|
|
|
|
|
|
window.app.ajax.post2(url, fileFormData, |
|
|
|
(data, rspMsg) => { |
|
|
|
this.endLoading() |
|
|
|
|
|
|
|
if (data.code === 0 || data.code > 8000) { |
|
|
|
|
|
|
|
} |
|
|
|
this.$emit('refreshTree') |
|
|
|
this.loadTable() |
|
|
|
// this.showMessage(rspMsg) |
|
|
|
if (type === 'community') { |
|
|
|
this.importCommunityLoading = false |
|
|
|
|
|
|
|
} else if (type === 'building') { |
|
|
|
this.importBuildingLoading = false |
|
|
|
|
|
|
|
} else if (type === 'room') { |
|
|
|
this.importRoomLoading = false |
|
|
|
} |
|
|
|
this.showMessage(rspMsg) |
|
|
|
}, |
|
|
|
(rspMsg, data) => { |
|
|
|
this.endLoading() |
|
|
|
this.$message.error(rspMsg) |
|
|
|
if (type === 'community') { |
|
|
|
this.importCommunityLoading = false |
|
|
|
|
|
|
|
} else if (type === 'building') { |
|
|
|
this.importBuildingLoading = false |
|
|
|
|
|
|
|
} else if (type === 'room') { |
|
|
|
this.importRoomLoading = false |
|
|
|
} |
|
|
|
// this.$message.error(rspMsg) |
|
|
|
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|
|
|
|
|
|
|
|
|
|
|