|
|
@ -67,15 +67,39 @@ |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" @click="exportHandle()">{{$t("export")}}</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="导入网格" |
|
|
|
label-width="90px"> |
|
|
|
<el-cascader v-model="deptIdListUpload" |
|
|
|
:options="options" |
|
|
|
ref="deptTree" |
|
|
|
:props="{ checkStrictly: false }" |
|
|
|
clearable> |
|
|
|
</el-cascader> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-upload class="upload-demo" ref="uploadBuilding" v-loading="uploadLoading" :action="uploadBuildingUrl" :limit="1" |
|
|
|
:on-success="uploadBuildingSuccess" :on-error="errorExceed" :before-upload="beforeUpload" accept=".xls,.xlsx"> |
|
|
|
<el-button type="danger">导入楼栋信息</el-button> |
|
|
|
</el-upload> |
|
|
|
<el-button type="primary" |
|
|
|
@click="beforeImportUser">导入</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|
|
|
<el-upload ref="uploadBuilding" |
|
|
|
:action="uploadBuildingUrl" |
|
|
|
:limit="1" |
|
|
|
:on-success='uploadBuildingSuccess' |
|
|
|
:on-error='errorExceed'> |
|
|
|
<el-button id="importBut" |
|
|
|
style="display: none" |
|
|
|
type="primary">导入</el-button> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item>--> |
|
|
|
<!-- <el-upload class="upload-demo" ref="uploadBuilding" v-loading="uploadLoading" :action="uploadBuildingUrl" :limit="1"--> |
|
|
|
<!-- :on-success="uploadBuildingSuccess" :on-error="errorExceed" :before-upload="beforeUpload" accept=".xls,.xlsx">--> |
|
|
|
<!-- <el-button type="danger" @click="beforeImportUser">导入楼栋信息</el-button>--> |
|
|
|
<!-- </el-upload>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
<!-- <el-form-item>--> |
|
|
|
<!-- <el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
</el-form> |
|
|
|
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> |
|
|
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|
|
@ -141,13 +165,26 @@ export default { |
|
|
|
uploadBuildingUrl: '', |
|
|
|
streetArr: [], |
|
|
|
communitys: [], |
|
|
|
deptIdListUpload: [], |
|
|
|
grids: [], |
|
|
|
options: [], |
|
|
|
plotArr: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
AddOrUpdate |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
'deptIdListUpload': function (val) { |
|
|
|
if (val.length > 0) { |
|
|
|
this.gridIdImport = val[val.length - 1] |
|
|
|
this.uploadBuildingUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicplotbuilding/importBuilding?token= |
|
|
|
${Cookies.get('token')}&gridId=` + val[val.length - 1] |
|
|
|
} else { |
|
|
|
this.gridIdImport = '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created: function () { |
|
|
|
this.getOptions() |
|
|
|
// 乡镇下拉框赋值 |
|
|
@ -223,6 +260,15 @@ export default { |
|
|
|
} |
|
|
|
this.buildingTypeArr = res.data |
|
|
|
}).catch(() => {}) |
|
|
|
this.$http |
|
|
|
.get(`/sys/user/deptOptions/getByLoginUser`) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.options = res.data.options |
|
|
|
}) |
|
|
|
.catch(() => { }) |
|
|
|
}, |
|
|
|
buildingTypeFormat (row, column) { |
|
|
|
if (row.buildingType) { |
|
|
@ -252,6 +298,45 @@ export default { |
|
|
|
this.uploadLoading = false |
|
|
|
this.$message.error('上传失败请重试') |
|
|
|
}, |
|
|
|
beforeImportUser () { |
|
|
|
//所属组织全都不选,直接上传 |
|
|
|
if (this.gridIdImport === '') { |
|
|
|
document.getElementById('importBut').click() |
|
|
|
return false |
|
|
|
} |
|
|
|
//选中网格 |
|
|
|
let selectGird = this.$refs['deptTree'].getCheckedNodes()[0].label |
|
|
|
|
|
|
|
this.$confirm(`确定将楼栋导入到${selectGird}?`, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
document.getElementById('importBut').click() |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
uploadSuccess (response, file, fileList) { |
|
|
|
this.uploeadLoeading = false |
|
|
|
this.$refs.upload.clearFiles() |
|
|
|
if (response.code !== 0 || (response.data !== null && response.data.length > 0)) { |
|
|
|
this.errordataList = response.data |
|
|
|
if (this.errordataList != null && this.errordataList.length > 0) { |
|
|
|
this.faultDataVisible = true |
|
|
|
} else { |
|
|
|
this.$message.error(response.msg) |
|
|
|
} |
|
|
|
this.getDataList() |
|
|
|
return |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
message: '导入成功', |
|
|
|
type: 'success', |
|
|
|
duration: 1000, |
|
|
|
onClose: () => { |
|
|
|
this.getDataList() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//导入完成 |
|
|
|
uploadBuildingSuccess (response, file, fileList) { |
|
|
|
console.log('+++++++++ 成功 +++++++') |
|
|
|