<template>
|
<!--选择街道下社区-->
|
<el-dialog
|
class="height-auto"
|
title="选择街道"
|
:visible="value"
|
width=""
|
:modal='false'
|
:show-close="false"
|
:before-close="onCancel">
|
<div class="chooseCommity" v-for="(list , index) in data" :key="index">
|
<p>{{list.name}}</p>
|
<div class="box"><el-radio v-for="(box , index) in list.childList" :key="index" v-model="street" :label="box.id" >{{box.name}}</el-radio></div>
|
</div>
|
<!-- 导入 -->
|
<el-dialog
|
width="50%"
|
title="导入"
|
v-loading="loading"
|
:visible.sync="innerVisible"
|
append-to-body>
|
<div class="loading-box" >
|
<span class="import-btn" v-for="(text , index) in importData" :key="index">
|
<el-upload
|
name="file"
|
accept=".xls, .xlsx"
|
:headers={Authorization:Authorization}
|
class="upload-demo"
|
:show-file-list="false"
|
:action="text.url"
|
:on-success="success"
|
:on-error="error"
|
:before-upload="beforeUpload"
|
multiple
|
>
|
<el-button
|
type="primary"
|
plain
|
class="m_btn bgc_primary"
|
>{{text.name}}
|
</el-button>
|
</el-upload>
|
</span>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<!-- 导入错误按钮 -->
|
<el-button type="text" class="danger-text" v-if="errUrl" @click="dowErr">下载错误表格</el-button>
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="onOk('ruleForm')">确 定</el-button>
|
</span>
|
</el-dialog>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="onCancel">取 消</el-button>
|
<el-button type="primary" @click="shureCommity">确定</el-button>
|
</div>
|
|
</el-dialog>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
value: {type: Boolean},
|
data:{type:Array}
|
},
|
|
data() {
|
return {
|
Authorization: "",
|
loading:false,
|
errUrl:'', //导入失败地址
|
errpostUrl:'', //导入失败请求接口
|
innerVisible:false, //内存弹框
|
street:'',
|
importData:[
|
{
|
name:'实有人口',
|
url:this.$js.api.http + "common/data/population/serve/import/",
|
error:'population'
|
},
|
{
|
name:'吸毒人员',
|
url:this.$js.api.http + "common/data/population/serve/importDrug",
|
error:'populationDrug'
|
},
|
{
|
name:'社区矫正人员',
|
url:this.$js.api.http + "common/data/population/serve/importCorrect"
|
},
|
{
|
name:'邪教人员',
|
url:this.$js.api.http + "common/data/population/serve/importCult"
|
}, {
|
name:'残疾人',
|
url:this.$js.api.http + "common/data/population/serve/importDisability"
|
},
|
{
|
name:'重点上访人员',
|
url:this.$js.api.http + "common/data/population/serve/importKey"
|
}, {
|
name:'低保户',
|
url:this.$js.api.http + "common/data/population/serve/importLowSecurity"
|
},
|
{
|
name:'重精人员',
|
url:this.$js.api.http + "common/data/population/serve/importMajor"
|
}, {
|
name:'刑释人员',
|
url:this.$js.api.http + "common/data/population/serve/importRehabilitation"
|
},
|
// {
|
// name:'服刑人员',
|
// url:this.$js.api.http + "common/data/population/serve/importSentence"
|
// },
|
{
|
name:'退役军人',
|
url:this.$js.api.http + "common/data/population/serve/importVeterans"
|
},
|
{
|
name:'高龄老人',
|
url:this.$js.api.http + "common/data/population/serve/importElder"
|
},
|
{
|
name:'养老人员',
|
url:this.$js.api.http + "common/data/population/serve/importPension"
|
},
|
|
|
]
|
}
|
},
|
|
created() {
|
this.Authorization = "Bearer " + demo.$session.get("token") || "";
|
},
|
|
// computed: {
|
// syupl() {
|
// return this.$js.api.http + "common/data/population/serve/import";
|
// },
|
// },
|
|
methods:{
|
shureCommity() {
|
this.innerVisible = true;
|
if(this.street) {
|
this.importData = [
|
{
|
name:'实有人口',
|
url:this.$js.api.http + `common/data/population/serve/import/${this.street}`,
|
error:'population'
|
},
|
{
|
name:'吸毒人员',
|
url:this.$js.api.http + `common/data/population/serve/importDrug/${this.street}`,
|
error:'populationDrug'
|
},
|
{
|
name:'社区矫正人员',
|
url:this.$js.api.http + `common/data/population/serve/importCorrect/${this.street}`
|
},
|
{
|
name:'邪教人员',
|
url:this.$js.api.http + `common/data/population/serve/importCult/${this.street}`
|
}, {
|
name:'残疾人',
|
url:this.$js.api.http + `common/data/population/serve/importDisability/${this.street}`
|
},
|
{
|
name:'重点上访人员',
|
url:this.$js.api.http + `common/data/population/serve/importKey/${this.street}`
|
}, {
|
name:'低保户',
|
url:this.$js.api.http + `common/data/population/serve/importLowSecurity/${this.street}`
|
},
|
{
|
name:'重精人员',
|
url:this.$js.api.http + `common/data/population/serve/importMajor/${this.street}`
|
}, {
|
name:'刑释人员',
|
url:this.$js.api.http + `common/data/population/serve/importRehabilitation/${this.street}`
|
},
|
// {
|
// name:'服刑人员',
|
// url:this.$js.api.http + "common/data/population/serve/importSentence"
|
// },
|
{
|
name:'退役军人',
|
url:this.$js.api.http + `common/data/population/serve/importVeterans/${this.street}`
|
},
|
{
|
name:'高龄老人',
|
url:this.$js.api.http + `common/data/population/serve/importElder/${this.street}`
|
},
|
{
|
name:'养老人员',
|
url:this.$js.api.http + `common/data/population/serve/importPension/${this.street}`
|
},
|
|
]
|
}
|
console.log(this.street)
|
},
|
/** 取消 */
|
onCancel () {
|
this.$emit('change', false);
|
},
|
|
/** 确认 */
|
onOk(formName) {
|
|
},
|
|
//导入前
|
beforeUpload(file){
|
this.errUrl = '';
|
this.loading =true
|
this.msg = "导入中,请勿退出系统和关闭网络";
|
},
|
|
success(e, file,fileList) {
|
|
// console.log(fileList)
|
//导入成功
|
this.loading =false
|
if(e.msg ==="导入数据为空!") {
|
demo.toast("导入模板为空");
|
return
|
}
|
if (e.code !== 200) {
|
this.errUrl = e.msg;
|
switch(this.errUrl) {
|
case 'DRUG_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationDrug';
|
break;
|
|
case 'POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'population';
|
break;
|
|
case 'CORRECT_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationCorrect';
|
break;
|
|
case 'CULT_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationCult';
|
break;
|
|
case 'KEY_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationKey';
|
break;
|
|
case 'MAJOR_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationMajor';
|
break;
|
|
case 'REHABILITATION_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationRehabilitation';
|
break;
|
|
case 'SENTENCE_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationSentence';
|
break;
|
|
case 'VETERANS_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationVeterans';
|
break;
|
|
case 'DISABILITY_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationDisability';
|
break;
|
|
case 'LOWSECURITY_POPULATION_ERROR_LIST_':
|
this.errpostUrl = 'populationLowSecurity';
|
break;
|
default:
|
|
if(this.errUrl.search('ELDER_POPULATION_ERROR_LIST') !== -1){
|
this.errpostUrl = 'populationElder';
|
}else if (this.errUrl.search('PENSION_POPULATION_ERROR_LIST') !== -1){
|
this.errpostUrl = 'populationPension';
|
}
|
// this.errpostUrl = '';
|
break;
|
}
|
// demo.toast("导入模板错误");
|
} else {
|
demo.toast("导入成功");
|
this.errUrl = '';
|
this.$emit('success');
|
this.onCancel()
|
}
|
|
},
|
|
error(err) {
|
this.loading =false
|
demo.toast("导入失败!请检查内容是否正确");
|
// console.log(err)
|
},
|
|
dowErr(){
|
//下载错误i
|
let data = {
|
key:this.errUrl
|
}
|
this.$api.post('common/data/population/download/error/'+this.errpostUrl+'?key='+this.errUrl,'',e=>{
|
// console.log(e)
|
location.href = e
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
/deep/.el-dialog__body {
|
height: 200px;
|
overflow: auto;
|
}
|
/deep/.el-button--text {
|
color: #F56C6C;
|
text-decoration: underline;
|
}
|
.loading-box {
|
width: 100%;
|
height: 100%;
|
}
|
.import-btn {
|
float: left;
|
margin-right: 15px;
|
margin-bottom: 15px;
|
}
|
.chooseCommity {
|
padding-bottom: 10px;
|
p {
|
padding-bottom: 10px;
|
color: #333;
|
font-weight: 500;
|
}
|
.box {
|
/deep/.el-radio {
|
margin-bottom: 5px;
|
}
|
|
}
|
}
|
</style>
|