前端:关于promiseResult里的数据如何使用

1 篇文章 0 订阅
1 篇文章 0 订阅
<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 => {

      })
		
		
		
		
		
		},

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我叫杨傲天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值