<script>
import refDoc from '@/remote/refDoc'
import myheader from '@/components/header';
import async from '@/util/asyncpromise'
import disaster from '@/remote/disaster'
import Vue from 'vue';
import axios from 'axios'
import report from '@/remote/report'
export default {
name: '',
data () {
return {
tdtMapDivID: "tdtMapDivID_"+this._uid,
tdtMap: {},
zoom:4,
DZ: require('../assets/imgs/icon_t_earthquake_1.png'),
TF: require('../assets/imgs/icon_t_typhoon_9.png'),
HL: require('../assets/imgs/icon_t_floods_9.png'),
DZZH: require('../assets/imgs/icon_t_landslip_9.png'),
HZ: require('../assets/imgs/icon_fire.png'),
DW: require('../assets/imgs/icon_snow.png'),
GH: require('../assets/imgs/icon_t_mudflow_1.png'),
ti: [],
ti1:[],
city:'',
update_time:'',
weather:[],
wea: '',
weato:'',
tem_night: 0,
tem_day: 0,
win: '',
win_speed:'',
weaimgtoday:'',
typeItems1: [],
refDocItems: [],
refDocItems0: [],
refDocItems1: [],
typeItems: [
{
"id": "92ebdd37-b16b-4046-ac36-0a747a51106d",
"longitude": 116.3,
"latitude": 39.9,
"disasterTime": "2020-06-21T01:49:31.62",
"disasterTypeId": 6,
"title": "北京海淀区发生雪灾",
"affectPopulation": "1000",
"deathPopulation": "0",
"transferPopulation": "300"
}
],
mapItems: [],
disasterTypeId:0,
days:90,
subLon:10,
subLat:10,
phoneLon:0,
phoneLat:0,
productTypeId:1,
meiri:[
{
"id": "63805b33-6a89-400e-8a17-422428187f9e",
"productTypeId": 1,
"title": "泥石流",
"institution": "aa",
"reportTime": "2020-04-12T00:00:00",
"reportFormat": "pdf",
"link": "2",
"downloadable": 1
}
],
jieduan:[
{
"id": "63805b33-6a89-400e-8a17-422428187f9e",
"productTypeId": 2,
"title": "泥石流",
"institution": "aa",
"reportTime": "2020-04-12T00:00:00",
"reportFormat": "pdf",
"link": "2",
"downloadable": 1
}
],
fangzai:[
{
"id": "63805b33-6a89-400e-8a17-422428187f9e",
"productTypeId": 5,
"title": "泥石流",
"institution": "aa",
"reportTime": "2020-04-12T00:00:00",
"reportFormat": "pdf",
"link": "2",
"downloadable": 1
}
],
guoji:[
{
"id": "63805b33-6a89-400e-8a17-422428187f9e",
"productTypeId": 3,
"title": "泥石流",
"institution": "aa",
"reportTime": "2020-04-12T00:00:00",
"reportFormat": "pdf",
"link": "2",
"downloadable": 1
}
],
TypeItems: [
{
"id":1,
"name":"每日风险评估",
reportItems:[
{
"id": "63805b33-6a89-400e-8a17-422428187f9e",
"productTypeId": 1,
"title": "泥石流",
"institution": "aa",
"reportTime": "2020-04-12T00:00:00",
"reportFormat": "pdf",
"link": "2",
"downloadable": 1
}
],
},
],
}
},
mounted() {
document.title = '首页'
this.getUser()
let mapObj = {'limit':7}
disaster.getDisaster(mapObj).then(res =>{
this.typeItems = res.data
//console.log("taaaaaaa", this.typeItems)
for(var i = 0; i < this.typeItems.length;i++){
this.typeItems[i].disasterTime = this.typeItems[i].disasterTime.replace(/T/g, ' ').replace(/.[\d]{3}Z/, ' ')
}
// console.log(res.data)
}).catch(error =>{
console.warn(error)
})
this.getLocation()
this.toTypeReport()
let mapbj = {'days':1095}
disaster.getDisasterListWeb(-1,mapbj).then((result)=>{
this.ti1=result['data']
console.log('输出result',result)
console.log('输出result里的data',this.ti1)
this.initTdtMap()
}).catch(error => {
console.warn(error)
})
refDoc.getRefDocType()
.then((res) => {
// 得到报告类型的信息
this.typeItems1 = res.data
this.msg = res.data
//console.log("taaaaaaa", this.typeItems1)
let reqlist = []
let mapObj = { 'limit': 3 }
for (var i = 0; i < this.typeItems1.length; i++) {
reqlist[i] = refDoc.getRefDoc(this.typeItems1[i].id, mapObj)
// console.log("this.typeItems[i].id", this.typeItems1[i].id)
}
// 异步执行多个request,有冲突时limitNum设为1,无冲突时可>1
async(1, reqlist)
.then(res => {
// console.log(res);
for (var i = 0; i < res.length; i++) {
this.typeItems1[i].refDocItems = res[i].data
// console.log("this.typeItems1[i].refDocItems", this.typeItems1[i].refDocItems)
}
this.refDocItems0 = this.typeItems1[0].refDocItems
this.refDocItems1 = this.typeItems1[1].refDocItems
this.msg = res
this.$forceUpdate()
}).catch((error) => {
//this.msg = error
console.warn(error)
})
})
.catch(err => {
})
},