|
|
@ -39,58 +39,61 @@ |
|
|
|
type="green" |
|
|
|
size="small" |
|
|
|
@click="handleAdd">新增小区</el-button> |
|
|
|
<el-button style="" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('community')">下载小区模板</el-button> |
|
|
|
|
|
|
|
<el-upload ref="upload_community" |
|
|
|
style="" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'community')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'community')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
<div class="btn_upload" |
|
|
|
v-if="agencyObj.level==='community'||agencyObj.level==='grid'"> |
|
|
|
<el-button style="" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
type="red">导入小区数据</el-button> |
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('building')">下载楼宇模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
|
ref="upload_building" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'building')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'building')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
@click="handleExportModule('community')">下载小区模板</el-button> |
|
|
|
|
|
|
|
<el-upload ref="upload_community" |
|
|
|
style="" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'community')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'community')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
type="red">导入小区数据</el-button> |
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
type="red">导入楼宇数据</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
@click="handleExportModule('room')">下载房屋模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
|
ref="upload_room" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'room')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'room')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
@click="handleExportModule('building')">下载楼宇模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
|
ref="upload_building" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'building')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'building')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
type="red">导入楼宇数据</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-button style=";margin-left:10px" |
|
|
|
type="blue" |
|
|
|
size="small" |
|
|
|
type="red">导入房屋数据</el-button> |
|
|
|
</el-upload> |
|
|
|
@click="handleExportModule('room')">下载房屋模板</el-button> |
|
|
|
|
|
|
|
<el-upload style="" |
|
|
|
ref="upload_room" |
|
|
|
:multiple='false' |
|
|
|
:show-file-list='false' |
|
|
|
:before-upload="((file)=>{beforeUpload(file, 'room')})" |
|
|
|
action="" |
|
|
|
accept=".xls,.xlsx" |
|
|
|
:http-request="(()=>{uploadFile( 'room')})"> |
|
|
|
<el-button style="margin-left:10px" |
|
|
|
size="small" |
|
|
|
type="red">导入房屋数据</el-button> |
|
|
|
</el-upload> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
@ -237,7 +240,7 @@ export default { |
|
|
|
if (fromTree) { |
|
|
|
this.agencyObj = treeObj |
|
|
|
} |
|
|
|
// console.log(this.agencyObj) |
|
|
|
console.log(this.agencyObj) |
|
|
|
const url = "/gov/org/neighborhood/neighborhoodlist" |
|
|
|
|
|
|
|
let params = { |
|
|
@ -399,18 +402,18 @@ export default { |
|
|
|
|
|
|
|
handleExportModule (type) { |
|
|
|
let title = '' |
|
|
|
let url = "/gov/org/neighborhood/exporttemplate" |
|
|
|
let url = "" |
|
|
|
if (type === 'community') { |
|
|
|
title = '小区导入模板' |
|
|
|
url = '' |
|
|
|
url = '/gov/org/neighborhood/exporttemplate' |
|
|
|
|
|
|
|
} else if (type === 'building') { |
|
|
|
title = '楼宇导入模板' |
|
|
|
url = '' |
|
|
|
url = '/gov/org/building/exporttemplate' |
|
|
|
|
|
|
|
} else if (type === 'room') { |
|
|
|
title = '房间导入模板' |
|
|
|
url = '' |
|
|
|
url = '/gov/org/house/exporttemplate' |
|
|
|
} |
|
|
|
|
|
|
|
let params = {} |
|
|
@ -461,13 +464,13 @@ export default { |
|
|
|
|
|
|
|
//清空上传列表 |
|
|
|
let url = '' |
|
|
|
let params = {} |
|
|
|
|
|
|
|
let fileFormData = new FormData(); |
|
|
|
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
|
|
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
|
|
fileFormData.append('orgType', this.agencyObj.level === 'grid' ? 'grid' : 'agency');//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|
|
|
|
|
|
|
|
|
|
|
params.file = fileFormData |
|
|
|
params.orgId = this.agencyObj.id |
|
|
|
params.orgType = this.agencyObj.level === 'grid' ? 'grid' : 'agency' |
|
|
|
|
|
|
|
|
|
|
|
if (type === 'community') { |
|
|
@ -482,24 +485,31 @@ export default { |
|
|
|
|
|
|
|
} else if (type === 'room') { |
|
|
|
this.$refs['upload_room'].clearFiles() |
|
|
|
url = '/gov/org/ichouse/houseimport' |
|
|
|
url = '/gov/org/house/houseimport' |
|
|
|
|
|
|
|
} |
|
|
|
this.startLoading() |
|
|
|
window.app.ajax.post2(url, fileFormData, |
|
|
|
(data, rspMsg) => { |
|
|
|
this.endLoading() |
|
|
|
if (data.code === 0 || data.code > 8000) { |
|
|
|
// this.$message({ |
|
|
|
// type: "success", |
|
|
|
// message: "导入成功" |
|
|
|
// }); |
|
|
|
this.$message.success(rspMsg) |
|
|
|
this.$emit('refreshTree') |
|
|
|
this.loadTable() |
|
|
|
} else { |
|
|
|
this.$message.error(rspMsg) |
|
|
|
} |
|
|
|
}, |
|
|
|
(rspMsg, data) => { |
|
|
|
this.endLoading() |
|
|
|
this.$message.error(rspMsg) |
|
|
|
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|
|
|
|
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params) |
|
|
|
|
|
|
|
if (code === 0) { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message: "导入成功" |
|
|
|
}); |
|
|
|
this.$emit('refreshTree') |
|
|
|
this.loadTable() |
|
|
|
} else { |
|
|
|
// debugger |
|
|
|
// this.$message.error(msg) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -587,6 +597,11 @@ export default { |
|
|
|
.div_btn { |
|
|
|
display: flex; |
|
|
|
margin-top: 20px; |
|
|
|
|
|
|
|
.btn_upload { |
|
|
|
margin-left: 10px; |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.el-row { |
|
|
|