<template>
  <div class="manage-home">
    <!--导航栏-->
    <div class="manage-navigation">
      <div class="navigation-title"><div class="navigation-date">{{date}}</div></div>
      <div class="safe-manage">

        <label class="font_normal_body">组织机构</label>
        <res-select :initresid='curorgid'
                    @res-select="getorg"
                    :is-mul="true"
                    restype='organization'
                    @blur="$parent.getOrgid()"
                    class="select">
        </res-select>


      </div>
    </div>
    <!--&lt;!&ndash;正文&ndash;&gt;-->
    <div class="manage-text">
      <!--1-->
      <text-user :orgid="orgid" class="text-user" ref="text-user"></text-user>
      <text-shanximap class="text-shanximap" ref="text-shanximap"></text-shanximap>
      <text-sellgas :orgid="orgid" class="text-sellgas" ref="text-sellgas"></text-sellgas>
      <text-totalsellgas class="text-totalsellgas" ref="text-totalsellgas"></text-totalsellgas>
      <text-childsellgas :orgid="orgid" class="text-childsellgas" ref="text-childsellgas"></text-childsellgas>
      <text-profit :orgid="orgid" class="text-profit" ref="text-profit"></text-profit>
      <text-business  :orgid="orgid" class="text-business" ref="text-business"></text-business>
      <!--用气性质分布图-->
      <text-gasproperties :orgid="orgid" class="text-gasproperties" ref="text-gasproperties"></text-gasproperties>
    </div>
    <loading v-if="initdatashow"></loading>
    <loading v-if="initdatashow"  :backurl="backurl"></loading>
  </div>
</template>

<script>
  import * as Util from '../../../stores/Util'
  import * as DataSql from '../../../stores/DataSql'
  import co from 'co'
  import {HttpResetClass} from "vue-client";
  import * as ldapHelper from "system-clients/src/util/LdapHelper";
  import plugins from "../../../plugins/GetLoginInfoService";
  let saveGen = function * (self) {
    //获取分公司树
    let data = {
      source: "tool.getFullTree(this.getRights().where(row.getType() == $organization$))",
      userid: "15"
    }
    let http = new HttpResetClass()
    let ret = yield http.load('POST', `/rs/search`, data, {resolveMsg: null, rejectMsg: null})
    console.log('res-------------------------------')
    console.log(ret)
  }
  export default {
    title: "经营管控",
    data() {
      return {
        backurl:'static/ManageHomePic/加载数据1.gif',
        date:'',   //获取当前时间
        initdatashow:true,
        curorgid:['31307'],
        orgcondition:'',
        orgid:'',
        // obj: {
        //   userid: this.$login.f.id,
        //   source: `tool.getFullTree(this.getRights().where(row.getType() == $organization$))`,
        //   res: this.$login.f.f_fengongsi,
        //   resids: this.$login.f.f_orgids
        // }
      }
    },
    methods: {
      getorg(obj) {
        console.log('回调---------------=======================')
        console.log(obj)
        let str = JSON.stringify(obj)
        str = str.replace(/"/g,`'`)
        str = str.replace(/\[/g,``)
        str = str.replace(/\]/g,``)
        console.log("=====小区model22222222222绑定====",str)
        this.orgid=str
        //查询多个小区时条件
        // args.condition += ` and f_residential_area in  ( ${str} )`


      },
      // 定时获取时间
     getdate(){
       var self=this
       setInterval(() => {
         self.date=Util.toStandardTimeString()
         var refreshHours = new Date().getHours();
         var refreshMin = new Date().getMinutes();
         var refreshSec = new Date().getSeconds();
         // console.log('时间是----------------------------------------')
         // console.log(refreshHours)
         // console.log(refreshMin)
         // console.log(refreshSec)
         if(refreshHours=='0' && refreshMin=='0' && refreshSec=='0'){
           // 指定每天凌晨做的事情
           window.reload()

         }
       }, 1000)
     },
      getRes (obj) {
        this.orgname = obj.res[0]
        this.depresid = obj.resids
        this.f_orgid = obj.resids
      },

    },
    watch: {

    },
    created(){
      // debugger
      this.$login.f.id ='15'
      // this.$login.f.f_orgid ='1123'
    },
    ready() {
     this.getdate()
      var self=this
      setTimeout(function () {
        self.initdatashow=false
      },2000)

      let gen = saveGen(this)
      return co(gen)
    }
  }
</script>

<style scoped>
  .safe-manage {
    float: right;
    background-color: #041343;
    border: solid 1px #0b87e2;
    letter-spacing: 2px;
    color: #ffffff;
    font-size: 1.8rem;
    height: 66%;
    margin: 0.5% 2%;
    padding: 8px 2%;
    width: 28%;
  }
  .select{
    width: 100%;
  }
  .font_normal_body{
    font-size: 1.8rem !important;
    line-height: 15px;
    color: white;
  }
  .text-profit{
    top:64%
  }
  .text-sellgas{
    height: 24%;
  }

  .text-gasproperties {
      position: absolute;
      background-image: url('/static/NewManageHome/分公司年度购进量.png');
      background-repeat: no-repeat;
      background-size: 100% 100%;
      top: 26%;
      left:70%;
      width: 28%;
      height: 26%;
      text-align: center;
      padding-top: 1px;
    }
   .text-business{
     top: 54%;
     height: 44%;
   }


</style>
