Browse Source

人房导入房屋导入

master
zhangyuan 3 years ago
parent
commit
95d064d0f8
  1. BIN
      public/fangwu.xlsx
  2. BIN
      public/renfang.xlsx
  3. 2
      src/views/modules/news/allnews-add-or-update.vue
  4. 105
      src/views/modules/personroom/epidemicbuildingunit.vue

BIN
public/fangwu.xlsx

Binary file not shown.

BIN
public/renfang.xlsx

Binary file not shown.

2
src/views/modules/news/allnews-add-or-update.vue

@ -374,7 +374,7 @@ export default {
} }
} }
</script> </script>
<style> <style scoped>
.avatar-uploader .el-upload { .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
border-radius: 6px; border-radius: 6px;

105
src/views/modules/personroom/epidemicbuildingunit.vue

@ -38,13 +38,10 @@
<el-form-item> <el-form-item>
<el-button v-if="$hasPermission(':epidemicbuildingunit:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> <el-button v-if="$hasPermission(':epidemicbuildingunit:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary"> <el-button type="primary"
<a :href="`https://epdc-yushan.elinkservice.cn/epdc-admin/fang.xlsx`" @click="templateSelect">导入模板</el-button>
target="_blank"
download="人房信息表.xlsx"
style="color: #ffffff">{{ $t('exportTemplate') }}</a>
</el-button>
</el-form-item> </el-form-item>
<el-form-item label="导入网格" <el-form-item label="导入网格"
label-width="90px"> label-width="90px">
@ -57,7 +54,11 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
@click="beforeImportUser">导入</el-button> @click="beforeImportUser">人房导入</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary"
@click="beforeImportHouse">房屋导入</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-upload ref="upload" <el-upload ref="upload"
@ -67,10 +68,20 @@
:on-error='errorExceed'> :on-error='errorExceed'>
<el-button id="importBut" <el-button id="importBut"
style="display: none" style="display: none"
type="primary">导入</el-button> type="primary">人房导入</el-button>
</el-upload>
</el-form-item>
<el-form-item>
<el-upload ref="uploadHouse"
:action="uploadHouseUrl"
:limit="1"
:on-success='uploadHouseSuccess'
:on-error='errorHouseExceed'>
<el-button id="importHouseBut"
style="display: none"
type="primary">房屋导入</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="exports()">一户一码</el-button> <el-button type="primary" @click="exports()">一户一码</el-button>
</el-form-item> </el-form-item>
@ -144,7 +155,7 @@
@click="exportError">导出错误数据</el-button> @click="exportError">导出错误数据</el-button>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog title="一户一码" :visible.sync="dialogVisibleExcel" width="30%"> <el-dialog title="一户一码" :visible.sync="dialogVisibleExcel" width="35%">
<div style="text-align: center"> <div style="text-align: center">
<el-form class="but-sty" inline label-width="90px"> <el-form class="but-sty" inline label-width="90px">
<el-form-item> <el-form-item>
@ -179,6 +190,31 @@
<el-button @click="dialogVisibleExcel = false"> </el-button> <el-button @click="dialogVisibleExcel = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="导出选择" :visible.sync="dialogVisibleTemplate" width="30%">
<div style="text-align: center">
<el-form class="but-sty" inline label-width="90px">
<el-form-item>
<el-button type="primary">
<a :href="`https://epdc-yushan.elinkservice.cn/epdc-admin/renfang.xlsx`"
target="_blank"
download="人房信息表.xlsx"
style="color: #ffffff">人房信息模板</a>
</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary">
<a :href="`https://epdc-yushan.elinkservice.cn/epdc-admin/fangwu.xlsx`"
target="_blank"
download="房屋信息表.xlsx"
style="color: #ffffff">房屋信息模板</a>
</el-button>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleTemplate = false"> </el-button>
</span>
</el-dialog>
</div> </div>
</el-card> </el-card>
</template> </template>
@ -200,6 +236,7 @@ export default {
exportErrorInfoURL: '/custom/epidemicusererror/export4Room' exportErrorInfoURL: '/custom/epidemicusererror/export4Room'
}, },
uploadUrl: '', uploadUrl: '',
uploadHouseUrl: '',
options: [], options: [],
zLoading: false, zLoading: false,
faultDataVisible: false, faultDataVisible: false,
@ -213,6 +250,7 @@ export default {
id: '' id: ''
}, },
exportTemplate: false, exportTemplate: false,
dialogVisibleTemplate: false,
dialogVisibleExcel: false, dialogVisibleExcel: false,
} }
}, },
@ -225,6 +263,8 @@ export default {
this.gridIdImport = val[val.length - 1] this.gridIdImport = val[val.length - 1]
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicbuildingunit/importHouse?token= this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicbuildingunit/importHouse?token=
${Cookies.get('token')}&gridId=` + val[val.length - 1] ${Cookies.get('token')}&gridId=` + val[val.length - 1]
this.uploadHouseUrl = `${window.SITE_CONFIG['apiURL']}/custom/epidemicbuildingunit/importHouseSimple?token=
${Cookies.get('token')}&gridId=` + val[val.length - 1]
} else { } else {
this.gridIdImport = '' this.gridIdImport = ''
} }
@ -316,10 +356,31 @@ export default {
} }
}) })
}, },
uploadHouseSuccess (response, file, fileList) {
this.uploeadLoeading = false
this.$refs.uploadHouse.clearFiles()
if (response.code === 0) {
this.$message({
message: response.data,
type: 'success',
duration: 5000,
onClose: () => {
this.getDataList()
}
})
this.getDataList()
return
}
this.$message.error('上传失败请重试')
},
errorExceed (file, fileList) { errorExceed (file, fileList) {
this.uploeadLoeading = false this.uploeadLoeading = false
this.$message.error('上传失败请重试') this.$message.error('上传失败请重试')
}, },
errorHouseExceed (file, fileList) {
this.uploeadLoeading = false
this.$message.error('上传失败请重试')
},
updateMa () { updateMa () {
this.$http.post(`/custom/epidemicbuildingunit/updateMaCode`).then(({ data: res }) => { this.$http.post(`/custom/epidemicbuildingunit/updateMaCode`).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
@ -412,7 +473,9 @@ export default {
} }
this.zLoading = false this.zLoading = false
}, },
templateSelect () {
this.dialogVisibleTemplate = true
},
downloadMa (id) { downloadMa (id) {
this.$http.post(`/custom/epidemicbuildingunit/createHouseQrcode`, {id: id}, { responseType: 'blob' }).then(res => { this.$http.post(`/custom/epidemicbuildingunit/createHouseQrcode`, {id: id}, { responseType: 'blob' }).then(res => {
let fileName = '房屋二维码.png' let fileName = '房屋二维码.png'
@ -455,6 +518,26 @@ export default {
}).then(() => { }).then(() => {
document.getElementById('importBut').click() document.getElementById('importBut').click()
}).catch(() => { }) }).catch(() => { })
},
beforeImportHouse () {
//
if (this.gridIdImport === '' || this.gridIdImport === undefined) {
this.$message({
type: 'warning',
message: '请先选择网格'
});
return false
}
//
let selectGird = this.$refs['deptTree'].getCheckedNodes()[0].label
this.$confirm(`确定将房屋导入到${selectGird}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
document.getElementById('importHouseBut').click()
}).catch(() => { })
} }
} }
} }

Loading…
Cancel
Save