<template>
  <!--<div class="app-bg auto">-->
  <!--&lt;!&ndash;<tools-page :need-back='true' title="安检计划"  @back="back()"></tools-page>&ndash;&gt;-->
  <!--<div class="row app-input">-->
  <!--<label class="col-xs-12 control-label text-left">{{context}}</label>-->
  <!--</div>-->
  <!--<div class="row app-btn" style="margin-bottom: -5px;">-->
  <!--&lt;!&ndash; <button class="btn btn-primary col-xs-6" @click= "planinfomation()"><span class="glyphicon glyphicon-zoom-in" style="margin-right: 20px;"></span>查询</button> &ndash;&gt;-->

  <!--</div>-->
  <!--</div>-->

  <!--<div v-for='row in resultdata' class="app-list auto" @click = "inputMeter(row)">-->
  <!--<div class="row" style="color: #00B9F1;">-->
  <!--<span class="col-xs-3">户号：</span><span class="col-xs-3">{{row.f_userid}}</span>-->
  <!--<span class="col-xs-3">姓名：</span><span class="col-xs-3">{{row.f_username}}</span>-->
  <!--</div>-->
  <!--<div class="row">-->
  <!--<span class="col-xs-3">表号：</span><span class="col-xs-3">{{row.f_meternumber}}</span>-->
  <!--<span class="col-xs-3">用户类型：</span><span class="col-xs-3">{{row.f_usertype}}</span>-->
  <!--</div>-->
  <!--<div class="row">-->
  <!--<span class="col-xs-3">地址：</span><span class="col-xs-8">{{row.f_address}}</span>-->
  <!--</div>-->
  <!--<back-page :need-back='true'  @flag="$back()"></back-page>-->
  <!--</div>-->
  <!--</div>-->


  <div class="auto">
      <div class="row text-center" style="margin-top: 20px;">
        <button class="btn  btn-primary" style="width: 15%;  border-radius: 5px ;" @click= "upload()">上传</button>
      </div>

      <div v-for="row in model" v-if="model.length > 0">
          <div @click="inspect(row)" class="auto app-text" style="margin-top: 5px;">
            <div class="panel" style="padding: 10px 10px 5px 10px;">
              <div class="panel-body panel-self">
                <div class="col-xs-6">
                  <p class="panel-title col-xs-5 text-left font"><b>用户编号:</b></p>
                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_userinfo_code }}</p>
                </div>
                <div class="col-xs-6">
                  <p class="panel-title col-xs-5 text-left font"><b>用户名称:</b></p>
                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_user_name }}</p>
                </div>
                <div class="col-xs-6">
                  <p class="panel-title col-xs-5 text-left font"><b>用户类型:</b></p>
                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_user_type }}
                  </p>
                </div>
<!--                <div class="col-xs-6">-->
<!--                  <p class="panel-title col-xs-5 text-left font"><b>计划名称:</b></p>-->
<!--                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_plan_name }}</p>-->
<!--                </div>-->
                <div class="col-xs-12">
                  <p class="panel-title text-left font" style="width: 23%;float: left"><b>用户电话:</b></p>
                  <p class="panel-title text-left input-font" style="width: 77%">{{ row.f_user_phone2 ? row.f_user_phone2 : row.f_user_phone }}
                    <img src="../../assets/phone.png" style="width: 6%" v-on:click.stop.prevent='$parent.$parent.$parent.makeAPhoneCall(row.f_user_phone2 ? row.f_user_phone2 : row.f_user_phone)'></img>
                  </p>
                </div>

                <div class="col-xs-12">
                  <p class="panel-title text-left font" style="width: 23%;float: left"><b>用户地址:</b></p>
                  <p class="panel-title text-left input-font" style="width: 77%">{{ row.f_address }}</p>
                </div>
                <div class="col-xs-6">
                  <p class="panel-title col-xs-5 text-left font"><b>安检状态:</b></p>
                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_state }}</p>
                </div>
                <div class="col-xs-6">
                  <p class="panel-title col-xs-5 text-left font"><b>上传状态:</b></p>
                  <p class="panel-title col-xs-7 text-left input-font">{{ row.f_upload_state }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">有无安检计划</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_no_checkplan }}</p>
                </div>
                <!--<div class="row text-right" v-show="row.f_upload_state != '已传'" >-->
                  <!--<button type="button" class="btn btn-primary yybtn-color" v-on:click.stop.prevent='$parent.$parent.$parent.reserve($index)'>预约</button>&nbsp;-->
                  <!--<button type="button" class="btn btn-primary qxbtn-color" v-if ='row.f_prearranged_date'-->
                          <!--v-on:click.stop.prevent='$parent.$parent.$parent.cancelReserve($index, row.id)'>取消预约</button>-->
                <!--</div>-->
              </div>
            </div>
          </div>
      </div>
    <div v-if="model.length == 0">
      暂无数据
    </div>
<!--    <back-page :need-back='true'   @flag="$back()"></back-page>-->
  </div>
</template>

<script>
  import co from 'co'
  import Vue from 'vue'
  import LocalPathList from './LocalPathList'
  import { PagedList } from 'vue-client'

  export default {
    title:'抄表用户信息',
    data () {
      return {
        model:[],
        context: '',
        enableButton:false,
        // 测试用数组
        result: [{"f_check_item_id":"441e7ecc05bd418494011c1524437a70","f_checker_id":"18518","row":{"f_devices":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]},{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"device0":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]}],"device1":[],"device2":[],"device3":[],"device4":[],"device5":[{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"f_approved_time":null,"f_street":null,"f_client_evaluation":null,"f_defect_urgency":null,"f_repair_approved_time":null,"f_notified_path":null,"f_longitude":null,"f_cutoff_gas":null,"f_approved_by":null,"f_check_item_id":"441e7ecc05bd418494011c1524437a70","f_card_id":null,"f_pic3_path":null,"f_recording1_path":null,"f_remark":null,"f_building":"2号楼","f_room_style":"多层","f_client_suggestion":null,"f_close_valve_path":null,"f_state":"未检","f_defect_registered":null,"f_repaired_uploaded":null,"id":"15eb6a232bd4495485b2a6352a83045d","f_heating_style_":null,"f_heating_style":"热力公司集中供暖","f_complete":null,"f_recording2_path":null,"f_overall_path":null,"f_defect_expand":null,"f_zero_meter":null,"f_defect_notified":null,"f_recording3_path":null,"f_pic1_path":null,"f_SafeToRepair_id":null,"f_residential_area":null,"f_overall2_path":null,"f_cutoff_gas_path":null,"f_usegas":null,"f_stop_service":null,"f_user_phone":"","f_nongasuser_path":"file:///android_asset/nopic.png","f_approved":"未审核","f_unit":"2单元","f_signname":null,"f_sign_imgid":null,"f_no_gas_device":false,"f_check_plan_id":"7b892a031f2f40e99e944e8969d7329c","f_checker_id":"18518","f_prearranged_date":null,"f_noncivil_style":null,"f_check_type":"民用","f_defect_dorm":null,"f_defect_other":null,"f_amr_path":null,"f_orgstr":"1531.1535.18506.18518.","f_close_valve":false,"f_repaired":null,"f_repair_date":null,"f_approved_note":null,"f_orgid":"1531.1535.","f_empty_pipe":null,"f_floor":"1层","f_entry_status":"入户","f_close_adjuster":null,"f_repair_approved_note":null,"f_onsite_time":"2019-04-13 15:18:29","f_repair_approved":"未审核","f_stop_devices":null,"f_ratification_des":null,"f_no_checkplan":"有计划安检","f_repair_approved_by":null,"f_room":"20101号","f_address":"77高新区-怕踢街道-zqxiaoqu2号楼号楼2单元单元1层层20101号室","f_sign_path":null,"f_userinfoid":"548","f_offsite_time":"2019-04-13 15:18:34","f_defect_notfixed":null,"f_subcompany":"中海油.海南分公司","f_notfixed_path":null,"f_close_adjuster_path":null,"f_pic2_path":null,"f_noanswer_path":"file:///android_asset/nopic.png","f_unload_battery":false,"f_latitude":null,"f_usage":null,"f_repairman":null,"f_plan_id":null,"f_user_name":"111","f_checker_name":"测试1","style__":"","style_view_":"","f_entry_class":"success"}}
          // {"f_check_item_id":"1d93ee9383c2409f8b16b96c3abdb567","f_checker_id":"18518","row":{"f_devices":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]},{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"device0":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]}],"device1":[],"device2":[],"device3":[],"device4":[],"device5":[{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"f_approved_time":null,"f_street":null,"f_client_evaluation":null,"f_defect_urgency":null,"f_repair_approved_time":null,"f_notified_path":null,"f_longitude":null,"f_cutoff_gas":null,"f_approved_by":null,"f_check_item_id":"441e7ecc05bd418494011c1524437a70","f_card_id":null,"f_pic3_path":null,"f_recording1_path":null,"f_remark":null,"f_building":"2号楼","f_room_style":"多层","f_client_suggestion":null,"f_close_valve_path":null,"f_state":"未检","f_defect_registered":null,"f_repaired_uploaded":null,"id":"15eb6a232bd4495485b2a6352a83045d","f_heating_style_":null,"f_heating_style":"热力公司集中供暖","f_complete":null,"f_recording2_path":null,"f_overall_path":null,"f_defect_expand":null,"f_zero_meter":null,"f_defect_notified":null,"f_recording3_path":null,"f_pic1_path":null,"f_SafeToRepair_id":null,"f_residential_area":null,"f_overall2_path":null,"f_cutoff_gas_path":null,"f_usegas":null,"f_stop_service":null,"f_user_phone":"","f_nongasuser_path":"file:///android_asset/nopic.png","f_approved":"未审核","f_unit":"2单元","f_signname":null,"f_sign_imgid":null,"f_no_gas_device":false,"f_check_plan_id":"7b892a031f2f40e99e944e8969d7329c","f_checker_id":"18518","f_prearranged_date":null,"f_noncivil_style":null,"f_check_type":"民用","f_defect_dorm":null,"f_defect_other":null,"f_amr_path":null,"f_orgstr":"1531.1535.18506.18518.","f_close_valve":false,"f_repaired":null,"f_repair_date":null,"f_approved_note":null,"f_orgid":"1531.1535.","f_empty_pipe":null,"f_floor":"1层","f_entry_status":"入户","f_close_adjuster":null,"f_repair_approved_note":null,"f_onsite_time":"2019-04-13 15:18:29","f_repair_approved":"未审核","f_stop_devices":null,"f_ratification_des":null,"f_no_checkplan":"有计划安检","f_repair_approved_by":null,"f_room":"20101号","f_address":"77高新区-怕踢街道-zqxiaoqu2号楼号楼2单元单元1层层20101号室","f_sign_path":null,"f_userinfoid":"548","f_offsite_time":"2019-04-13 15:18:34","f_defect_notfixed":null,"f_subcompany":"中海油.海南分公司","f_notfixed_path":null,"f_close_adjuster_path":null,"f_pic2_path":null,"f_noanswer_path":"file:///android_asset/nopic.png","f_unload_battery":false,"f_latitude":null,"f_usage":null,"f_repairman":null,"f_plan_id":null,"f_user_name":"111","f_checker_name":"测试1","style__":"","style_view_":"","f_entry_class":"success"}}
        ]
        // 获取用户信息数组
        // resultdata:[{"f_check_item_id":"441e7ecc05bd418494011c1524437a70","f_checker_id":"18518","row":{"f_devices":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]},{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"device0":[{"f_device_type":"热水器","f_items":[{"f_item_value":"正常","f_is_defect":"","f_item_name":"热水器烟道","f_path":"","id":"0dac97b7715c4177a656b00d1995da24","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"","f_is_defect":"","f_item_name":"热水器品牌","f_path":"","id":"b00231992fac40aa9a8e7d33b9eefbb7","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"string"},{"f_item_value":"卫生间","f_is_defect":"","f_item_name":"安装位置","f_path":"","id":"f5c5ea59791a4bb5b76a58272e776b56","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""},{"f_item_value":"正常","f_is_defect":"","f_item_name":"工作状态","f_path":"","id":"fabaf277bb9c4858948db63b7c55a365","f_defect_level":null,"f_device_id":"20e6dea47ed84ecb88070b3f4c3777b7","type":"selector","selected":""}]}],"device1":[],"device2":[],"device3":[],"device4":[],"device5":[{"f_device_type":"燃气表","f_items":[{"f_item_value":null,"f_is_defect":"","f_item_name":"表号","f_path":"","id":"56cb352415de406783c304ca25ed9be7","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":null,"f_is_defect":"","f_item_name":"表封号","f_path":"","id":"6bc8d49e473b43cb92a8bfc15c5a57bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"0","f_is_defect":"","f_item_name":"累计购气量","f_path":"","id":"a213f5f4092c4d5a96f0d856a13fd0af","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"number"},{"f_item_value":"安然中海油","f_is_defect":"","f_item_name":"表品牌","f_path":"","id":"acc505d987304d689a9801b199527cf8","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"string"},{"f_item_value":"G2.5","f_is_defect":"","f_item_name":"表型号","f_path":"","id":"ceb6c96ca39e4fcf89b26bfc6fa42a45","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""},{"f_item_value":"厨房","f_is_defect":"","f_item_name":"位置","f_path":"","id":"dffeb7d1d4dc4a989a5d333f092416bf","f_defect_level":null,"f_device_id":"3c90473662d54fc689d5da673f45a6bb","type":"selector","selected":""}]}],"f_approved_time":null,"f_street":null,"f_client_evaluation":null,"f_defect_urgency":null,"f_repair_approved_time":null,"f_notified_path":null,"f_longitude":null,"f_cutoff_gas":null,"f_approved_by":null,"f_check_item_id":"441e7ecc05bd418494011c1524437a70","f_card_id":null,"f_pic3_path":null,"f_recording1_path":null,"f_remark":null,"f_building":"2号楼","f_room_style":"多层","f_client_suggestion":null,"f_close_valve_path":null,"f_state":"未检","f_defect_registered":null,"f_repaired_uploaded":null,"id":"15eb6a232bd4495485b2a6352a83045d","f_heating_style_":null,"f_heating_style":"热力公司集中供暖","f_complete":null,"f_recording2_path":null,"f_overall_path":null,"f_defect_expand":null,"f_zero_meter":null,"f_defect_notified":null,"f_recording3_path":null,"f_pic1_path":null,"f_SafeToRepair_id":null,"f_residential_area":null,"f_overall2_path":null,"f_cutoff_gas_path":null,"f_usegas":null,"f_stop_service":null,"f_user_phone":"","f_nongasuser_path":"file:///android_asset/nopic.png","f_approved":"未审核","f_unit":"2单元","f_signname":null,"f_sign_imgid":null,"f_no_gas_device":false,"f_check_plan_id":"7b892a031f2f40e99e944e8969d7329c","f_checker_id":"18518","f_prearranged_date":null,"f_noncivil_style":null,"f_check_type":"民用","f_defect_dorm":null,"f_defect_other":null,"f_amr_path":null,"f_orgstr":"1531.1535.18506.18518.","f_close_valve":false,"f_repaired":null,"f_repair_date":null,"f_approved_note":null,"f_orgid":"1531.1535.","f_empty_pipe":null,"f_floor":"1层","f_entry_status":"入户","f_close_adjuster":null,"f_repair_approved_note":null,"f_onsite_time":"2019-04-13 15:18:29","f_repair_approved":"未审核","f_stop_devices":null,"f_ratification_des":null,"f_no_checkplan":"有计划安检","f_repair_approved_by":null,"f_room":"20101号","f_address":"77高新区-怕踢街道-zqxiaoqu2号楼号楼2单元单元1层层20101号室","f_sign_path":null,"f_userinfoid":"548","f_offsite_time":"2019-04-13 15:18:34","f_defect_notfixed":null,"f_subcompany":"中海油.海南分公司","f_notfixed_path":null,"f_close_adjuster_path":null,"f_pic2_path":null,"f_noanswer_path":"file:///android_asset/nopic.png","f_unload_battery":false,"f_latitude":null,"f_usage":null,"f_repairman":null,"f_plan_id":null,"f_user_name":"111","f_checker_name":"测试1","style__":"","style_view_":"","f_entry_class":"success"}}]
      }
    },
    methods: {
      inspect(row){
        if(this.enableButton){
          return
        }
        this.enableButton=true
        if (row.f_upload_state == '未传' || (row.f_upload_state == '已传' && row.f_state == '未检')) {
          this.$resetpost(`${this.$androidUtil.getProxyUrl()}/api/af-safecheck/sql/查询计划项表信息`, {data: {f_userid: row.f_userinfoid}}).then((response) => {
            console.log(JSON.stringify(response))
            row['f_plan_meters'] = response.data
            let pardate = {
              _this:this,
              tittle:'安检已办',
              safe:false
            }
            this.$dispatch('gotoson',pardate)
            this.enableButton=false
            this.$goto('safecheck-order-v', {f_plan_id: row.f_plan_id, item: row, role: 'inspect',buttonState:false}, 'self', this.refresh)
            /*if (row.f_user_type == '民用') {
              this.$goto('paper-set', {f_plan_id: row.f_plan_id, item: row, role: 'inspect'}, 'self', this.refresh)
            } else {
              this.$goto('paper-set-noncivil', {f_plan_id: row.f_plan_id, item: row, role: 'inspect'}, 'self', this.refresh)
            }*/
          }).catch((msg)=>{
            this.$showMessage("网络故障，请稍候再试!")
            this.enableButton=false
          })
        }else{
          this.$showMessage("该安检单已被上传！")
          this.enableButton=false
        }
      },
      // 上传所有未成功上传的数据
      async uploadAll() {
        console.log(`this.model==>${this.model}`)
        console.log(`this.model.rows.length==>${this.model.length}`)
        // if(this.model.rows.length <= 0){
        //   this.model.rows = this.result
        // }
        //安卓
        if(this.model.length>0){


          let param = {
            rows:this.model
          }
          let paramStr = JSON.stringify(param)
          // 多长截断一次
          let subLength = 800
          for (let i = 0; i < paramStr.length; i += subLength) {
            HostApp.param_cache(paramStr.substr(i, subLength))
          }
          HostApp.__this__ = this
          HostApp.syncLogic({
            // logic别名，key必须为logic
            'logic': 'UploadAll',
            // 回调执行方法名，key必须为callback
            'callback': 'javascript:HostApp.__this__.uploadCallBack()',
            // 固定key，代表是否将logic执行结果作为参数传入回调方法，1代表true，0代表false，
            // 执行回调方法传入key为backresult
            // 如需额外拼接参数，写在logic返回值的params，例如xxlogic返回:{"params": "success"}
            'backresult': 1
          })
          // if(this.resultdata.length>0){
          // let ret = this.$androidUtil.bzLogic('UploadAll', {data: this.resultdata})
          // let ret = this.$androidUtil.bzLogic('UploadAll', {rows:this.model})
          // HostApp.__this__ = this
          // HostApp.logicWithHint({
          //   // logic别名，key必须为logic
          //   'logic': 'UploadAll',
          //   // 回调执行方法名，key必须为callback
          //   'callback': 'javascript:HostApp.__this__.uploadCallBack()',
          //   // logic执行需要的业务参数
          //   'data': {rows:this.model},
          //   // 固定key，代表是否将logic执行结果作为参数传入回调方法，1代表true，0代表false，
          //   // 执行回调方法传入key为backresult
          //   // 如需额外拼接参数，写在logic返回值的params，例如xxlogic返回:{"params": "success"}
          //   'backresult': 1
          // })
        }else{
          this.$showMessage('暂无可上传数据')
          return false
        }
      },
      upload(){
        this.uploadAll().then((res)=>{
          console.log('批量上传执行结果===》'+JSON.stringify(res))
          this.refresh()
        })

      },
      uploadCallBack(jo){
        console.log('jo -->' + JSON.stringify(jo))
        console.log('jo.state -->' + JSON.stringify(jo.state))
        if(jo.state == 'ok'){
          let ret = JSON.parse(jo.result)
          console.log('ret ===> '+ JSON.stringify(ret))
          if(ret.state == 0){
            HostApp.alert(`${ret.successcount}条安检单上传成功，${ret.invalidcount}条安检单已作废，${ret.nocheckcount}条安检单由于网络异常上传失败！，${ret.nocheckcount}条安检单由于pc端计划被调整上传失败！,${ret.imgcount}条安检单由于图片上传失败！`)
            this.refresh()
            return true
          }
        }

      },
      // 查询所有未上传斌保存在手机上的数据
      // download() {
      //   console.log(`Vue.user========>${Vue.user}`)
      //   let res = this.$androidUtil.bzLogic('getCheckPlanInfo',{condition:this.condition})
      //   console.log(`res.data.data===>${res.data.data}`)
      //   console.log(`res.data.code===>${res.data.code}`)
      //
      //   if (res.data && res.data.code === 200) {
      //     console.log("查询到结果")
      //       if (res.data.data.length > 0) {
      //         this.context = `有${res.data.data.length}条数据未上传，请点击上传按钮，自动上传`
      //         this.resultdata  = [...res.data.data]
      //       } else {
      //         // this.resultdata  = []
      //         this.context = '没有未上传数据'
      //       }
      //   }
      // },
      refresh() {
        console.log("批量上传页面刷新")
        // hard code relationship
        //安卓
        let value = this.$androidUtil.bzLogic('path_getUploadPaperList', {})
        if(value.data.length > 0){
          this.model = value.data
        }else{
          this.model = []
        }
        // //PC模拟安卓
        // this.$androidUtil.path({alias: 'getCheckPlan', data:{}}).then((value)=>{
        //   console.log(value)
        //   if(value.data.length > 0){
        //     this.model = value.data
        //   }
        // })

      },
    },

    ready () {
      //组件初始化时获取本地未上传用户信息
      // this.download()
     this.refresh()
    }
  }
</script>
<style>
  .bg {
    background-color: blue;
    height: 1px;
    border: 0;
  }
  .app-row {
    background-color: white;
    padding: 10px 10px 0 10px;
    border-bottom: 1px solid rgba(235, 235, 235, 0.5);
  }
  .search_input {
    border: 0;
    outline: none;
  }
  .font{
    font: 15px PingFang-SC-Medium;
    color: #666666;
  }
  .input-font{
    font: 15px PingFang-SC-Medium;
    color: #333333;
  }
  .btn-font{
    font:600 16px PingFang-SC-Bold;
    color: #499EDF;
  }
  .btn-color{
    background-color: #FFFFFF;
    border-radius: 10px ;
    border: 1px solid #499EDF;
  }
  .app-text {
    font-size: 12px;
  }
  .panel-self{
    border-radius: 10px;
    border:1px solid #499EDF;
    background-color: #F8F8F8;
  }
  .yybtn-color{
    border-radius: 4px ;
    border: 1px solid #499EDF;
  }
  .qxbtn-color{
    background-color: #FFFFFF;
    border-radius: 4px ;
    border: 1px solid #499EDF;
  }

</style>
