<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:criteria>
        <div partial>
          <div class="row">
            <div class="form-group col-sm-2" >
              <label class="font_normal_body">用户信息</label>
              <input type="text" class="input_search" v-model="model.f_userinfo_code"
                     style="width: 60%" placeholder="客户编号" condition="ui.f_userinfo_code='{}'">
            </div>
            <div class="form-group col-sm-2" >
              <label class="font_normal_body" title="参数名称：安检用户状态">用户状态:</label>
              <v-select
                class="select select_list"
                :value.sync="model.f_user_state"
                v-model="model.f_user_state"
                :options='$parent.$parent.userStates'
                placeholder='请选择'
                condition="ui.f_user_state='{}'"
                :search="false"
                close-on-select
                value-single
              >
              </v-select>
            </div>
            <div class="form-group col-sm-2" >
              <label class="font_normal_body"title="参数名称：用气性质">用气性质:</label>
              <v-select
                class="select select_list"
                :value.sync="model.f_gasproperties"
                v-model="model.f_gasproperties"
                :options='$parent.$parent.gasproperties'
                placeholder='请选择'
                condition="uf.f_gasproperties in {}"
                :search="false"
                :multiple="true"
                close-on-select
              >
              </v-select>
            </div>
            <div class="form-group col-sm-2" >
              <label class="font_normal_body">气表品牌:</label>
              <v-select
                class="select select_list"
                :value.sync="model.metergasbrand"
                v-model="model.metergasbrand"
                :options='$parent.$parent.meter_gasbrand'
                placeholder='气表品牌'
                condition="uf.f_gasbrand_id in {}"
                :search="false"
                :multiple="true"
                close-on-select
              >
              </v-select>
            </div>
            <div class="form-group col-sm-4" >
              <button class="button_new" style="margin-right: 10px"  @click="$parent.$parent.showUserCondition()">更多条件</button>
              <button class="button_search" style="margin-right: 10px"  @click="search()">查询</button>
              <button class="button_search" style="margin-right: 10px"  @click="$parent.$parent.createAndSend()">下发</button>
            </div>
            <modal :show.sync="$parent.$parent.showCondtion" v-ref:modal :width="'50%'" :backdrop="false">
              <div slot="modal-header" class="modal-header">
                <h4 class="modal-title">
                  用户查询条件
                </h4>
              </div>
              <div slot="modal-body" class="modal-body">
                <div class="row">
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">楼&ensp;栋&ensp;号:</label>
                    <input type="text" class="input_search" v-model="model.f_building"
                           style="width: 60%" placeholder="请选择" condition="ua.f_building='{}'">
                  </div>
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">单&ensp;元&ensp;号:</label>
                    <input type="text" class="input_search" v-model="model.f_unit"
                           style="width: 60%" placeholder="请选择" condition="ua.f_unit='{}'">
                  </div>
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">派发情况:</label>
                    <v-select
                      class="select select_list"
                      :value.sync="model.yearCheck"
                      v-model="model.yearCheck"
                      :options='$parent.$parent.yearCheckList'
                      placeholder='请选择'
                      condition="{}"
                      :search="false"
                      close-on-select
                      value-single
                    >
                    </v-select>
                  </div>
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">安检状态:</label>
                    <v-select
                      class="select select_list"
                      :value.sync="model.f_last_check_state"
                      v-model="model.f_last_check_state"
                      :options='$parent.$parent.entry_status'
                      placeholder='请选择'
                      :search="false"
                      close-on-select
                      value-single
                    >
                    </v-select>
                  </div>
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">安检起始:</label>
                    <datepicker
                      placeholder='请选择'
                      style="width:60%;text-align: center"
                      :disabled-days-of-week="[]"
                      :format="'yyyy-MM-dd'"
                      :show-rest-button="reset"
                      :value.sync="model.f_check_start"
                      v-model="model.f_check_start">
                    </datepicker>
                  </div>
                  <div class="form-group col-sm-4" >
                    <label class="font_normal_body">安检截止:</label>
                    <datepicker
                      placeholder='请选择'
                      :disabled-days-of-week="[]"
                      style="width:60%;text-align: center"
                      :format="'yyyy-MM-dd'"
                      :show-rest-button="reset"
                      :value.sync="model.f_check_end"
                      v-model="model.f_check_end">
                    </datepicker>
                  </div>

                </div>
              </div>
              <div slot="modal-footer" class="modal-footer" style="text-align: center">
                <button class="button_search" style="margin-right: 15px" @click="search()">查询</button>
                <button class="button_search" @click="$parent.$parent.cancel">取消</button>
              </div>
            </modal>
            <modal :show.sync="$parent.$parent.excelUserCondtion" width="500px" v-ref:modal1 >
              <div slot="modal-header" class="modal-header">
                <h4 class="modal-title">
                  导入用户编号
                </h4>
              </div>
              <div slot="modal-body" class="modal-body">
                <div class="row">
                  <file-upload class="my-file-uploader " name="UploadFile" class="btn btn-success" style="border-radius: 2px;"
                               action="rs/file/uploadFile" tagname="档案信息导入" v-ref:file :headers="headers" multiple></file-upload>
                  <img src="../../../assets/Excelformat.png" style="width: 100%"/>
                </div>
              </div>
              <footer slot="modal-footer" class="modal-footer">
              </footer>
            </modal>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' class="table_sy">

        <template partial='head'>
          <tr>
            <th><nobr><input type="checkbox" @dblclick.stop="" onClick="event.cancelBubble = true" :checked="$parent.$parent.$parent.checkAll" @change="$parent.$parent.$parent.setCheckAll()"/> 全选</nobr></th>
            <th><nobr>用户编号</nobr></th>
            <th><nobr>用户名称</nobr></th>
            <th><nobr>用户类型</nobr></th>
            <th><nobr>小区名称</nobr></th>
            <!--            <th><nobr>片区</nobr></th>-->
            <th><nobr>抄表册</nobr></th>
            <th title="当前所在的安检计划名称"><nobr>所属计划</nobr></th>
            <th title="最后一次安检日期"><nobr>安检日期</nobr></th>
            <th><nobr>详细地址</nobr></th>
          </tr>
        </template>
        <template partial='body'>
          <td style="text-align: center;white-space:nowrap;"><input type="checkbox" onClick="event.cancelBubble = true" :checked="$parent.$parent.$parent.isChecked(row.id)"  @change="$parent.$parent.$parent.setCheckes(row.id)" /></td>
          <td style="text-align: center"><nobr>{{row.f_userinfo_code}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_user_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_user_type}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_residential_area}}</nobr></td>
          <!--          <td style="text-align: center"><nobr>{{row.f_slice_area}}</nobr></td>-->
          <td style="text-align: center"><nobr>{{row.f_book_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_plan_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_last_check_date}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_address}}</nobr></td>
        </template>
      </data-grid>
    </criteria-paged>
    <modal :show.sync="showCreatePlan" v-ref:modal1 :width="'50%'" :backdrop="false">
      <div slot="modal-header" class="modal-header">
        <h4 class="modal-title">
          新建计划
        </h4>
      </div>
      <div slot="modal-body" class="modal-body">
        <div class="row">
          <div class="form-group col-sm-4" >
            <label class="font_normal_body">计划名称:</label>
            <input type="text" class="input_search" v-model="createPlan.f_plan_name"
                   style="width: 60%" placeholder="请选择" />
          </div>
          <div class="form-group col-sm-4" >
            <label class="font_normal_body">计划年份:</label>
            <v-select
              class="select select_list"
              :value.sync="createPlan.f_plan_year"
              v-model="createPlan.f_plan_year"
              :search="false"
              :options='yearList'
              close-on-select
              value-single
            >
            </v-select>
          </div>
          <div class="form-group col-sm-4" >
            <label class="font_normal_body">计划月份:</label>
            <v-select
              class="select select_list"
              :value.sync="createPlan.f_plan_month"
              v-model="createPlan.f_plan_month"
              :search="false"
              :options='monthList'
              close-on-select
              value-single>
            </v-select>
          </div>
          <div class="form-group col-sm-4" >
            <label class="font_normal_body">计划开始:</label>
            <datepicker
              placeholder='请选择'
              style="width:60%"
              :disabled-days-of-week="[]"
              :format="'yyyy-MM-dd'"
              :show-rest-button="reset"
              :value.sync="createPlan.f_start_time"
              v-model="createPlan.f_start_time">
            </datepicker>
          </div>
          <div class="form-group col-sm-4" >
            <label class="font_normal_body">计划结束:</label>
            <datepicker
              placeholder='请选择'
              style="width:60%"
              :disabled-days-of-week="[]"
              :format="'yyyy-MM-dd'"
              :show-rest-button="reset"
              :value.sync="createPlan.f_end_time"
              v-model="createPlan.f_end_time">
            </datepicker>
          </div>
        </div>
      </div>
      <div slot="modal-footer" class="modal-footer" style="text-align: center">
        <button class="button_search" style="margin-right: 15px" @click="addNewPlan()">创建计划</button>
        <button class="button_search" @click="cancelCreatePlan">取消</button>
      </div>
    </modal>
  </div>
</template>

<script>
import {HttpResetClass, PagedList} from "vue-client";
import * as Util from "../../../components/Util";
import Vue from "vue";

export default {
  title: '计划管理',
  data() {
    return {
      createPlan:{
        f_safecheck_type:"年度普检",
        checker:"",
        isShare:"否",
        f_usertype:"",
        f_issued:'是',
        f_end_time:Util.toStandardDateString().replace(new Date().getFullYear().toString(),(new Date().getFullYear()+1).toString()),
        f_start_time:Util.toStandardDateString(),
        f_plan_month:(new Date().getMonth()+1).toString(),
        f_plan_year:new Date().getFullYear().toString(),
        f_plan_name:""
      },
      yearList:[{label:"2020",value:"2020"},{label:"2021",value:"2021"},{label:"2022",value:"2022"},{label:"2023",value:"2023"},{label:"2024",value:"2024"},{label:"2025",value:"2025"},{label:"2026",value:"2026"},{label:"2027",value:"2027"},{label:"2028",value:"2028"},{label:"2029",value:"2029"},{label:"2030",value:"2030"}],
      monthList:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"3",value:"3"},{label:"4",value:"4"},{label:"5",value:"5"},{label:"6",value:"6"},{label:"7",value:"7"},{label:"8",value:"8"},{label:"9",value:"9"},{label:"10",value:"10"},{label:"11",value:"11"},{label:"12",value:"12"}],
      showCreatePlan:false,
      model:new PagedList('/rs/sql/FetchUserFileByOrgNoRuHuSXQ', 20, {
        "orderitem": "'f_residential_area,f_building,f_unit,f_floor,f_room'",
        "f_usertype": "''",
        "month": "''",
        "SafeCheckSX": {"f_check_start": '', "f_check_end": ''},
        "SafeCheckCQ": "''",
        "startday":"''",
        "endday":"''"}),
      a:'1',
      opt:[{label:"测试",value:"测试"}],
      showCondtion:false,
      userTypes:[],//用户类型
      entry_status:[],
      userStates:[],//用户状态
      gasproperties:[],//用气性质
      meter_gasbrand:[],//气表品牌
      hasHousehold:[{label:"全部",value:""},{label:"已入户",value:"已入户"},{label:"未入户",value:"未入户"}],
      yearCheckList:[{label:"全部",value:""},{label:"已在计划中",value:"ua.f_plan_id is not null"},{label:"未在计划中",value:"ua.f_plan_id is null"}],
      checkStateList:[{label:"全部",value:""},{label:"两年内已检",value:"DATEDIFF(day,isnull(ui.f_last_check_date,'2010-01-01'),GETDATE())<=730"},{label:"两年内未检",value:"DATEDIFF(day,isnull(ui.f_last_check_date,'2010-01-01'),GETDATE())>730"},{label:"从未安检",value:"从未安检"}],
      hasResidentialArea:[{label:"全部",value:""},{label:"有名称",value:"有名称"},{label:"无名称",value:"无名称"}],
      sliceArea:[],
      meterbooks:[],
      checkBooks:[{label:'sss',value:'1-用户'},{label:'ssssss',value:'1-小区'}],
      cbc:[],
      areaList:[],
      checkAll:false,
      checkes:[],
      areaen:[],//片区
      excelUserCondtion:false,
      uploadCodeCondition:''
    }
  },
  props:["userlogin","bookrow","needprops","row","bookrowsdata","addcondata"],
  ready(){
      console.log("this.bookrow",this.bookrow)
      console.log("this.row",this.row)
      console.log("this.needprops",this.needprops)
      this.createPlan.checker = this.needprops.checker.filter(item=>item.label == this.row.f_checker_name)[0].value
      this.createPlan.f_checker_id=this.createPlan.checker.id
      this.createPlan.f_checker=this.createPlan.checker.name
      this.createPlan.f_usertype = this.row.f_user_type
      this.createPlan.f_plan_name = `${this.row.f_check_book_name}${this.createPlan.f_plan_year}年${this.createPlan.f_plan_month}月`
      this.$refs.paged.$refs.criteria.model.f_user_state='正常'
      this.meter_gasbrand=this.needprops.meter_gasbrand,
      this.checkBooks=this.needprops.checkBooks,
      this.entry_status=this.needprops.entry_status,
      this.userTypes=this.needprops.userTypes,
      this.userStates=this.needprops.userStates,
      this.gasproperties=this.needprops.gasproperties,
      this.areaList=this.needprops.areaList,
      this.sliceArea=this.needprops.sliceArea,
      this.cbc=this.needprops.cbc,
      this.meterbooks=this.needprops.meterbooks
  },
  methods: {
    async addNewPlan(){
      this.createPlan.f_plan_type='预约计划'
      this.createPlan.f_subcompany=this.userlogin.orgstr
      this.createPlan.f_filialeid=this.userlogin.orgid
      this.createPlan.f_create_operator=this.userlogin.name
      this.createPlan.f_create_time=Util.toStandardTimeString()
      this.createPlan.f_check_book_id = this.row.id
      console.log(this.createPlan)
      const addPlan = {
          f_operator:this.userlogin.name,
          f_filialeid:this.userlogin.orgid,
          f_subscribe_date:'',
          condition:this.model.condition,
          switchCheckAll:true,
          checkAll:this.checkAll,
          param:this.checkes,
          columnName: "ua.id"
      }
      new HttpResetClass().load("POST",'/rs/logic/createAndAddPlan',{createPlan:this.createPlan,addPlan}).then(res=>{
        if(res.data.code==200){
          this.$showMessage("计划下发成功！"+(res.data.result.length>0?"有"+res.data.result.length+"条用户地址已经存在于其他计划中":""))
          this.cancelCreatePlan()
        }else{
          this.$showMessage("计划下发失败！")
        }
      })
    },
    cancelCreatePlan(){
      this.showCreatePlan = false
    },
    createAndSend(){
      if(this.model.rows.length==0){
        Vue.showMessage("未检测到列表中有用户！")
        return
      }
      if(!this.checkAll && this.checkes.length==0){
        Vue.showMessage("请先勾选你要添入到上方计划中的用户！")
        return
      }
      this.showCreatePlan = true
    },
    cancel(){
      this.showCondtion=false
      this.excelUserCondtion=false
    },
    //清空用户编号
    clearUserInfoId(){
      this.uploadCodeCondition=''
      Vue.showMessage("已清空用户编号")
    },
    showUploadCodeCondition(){
      this.excelUserCondtion=true
    },
    selfSearch (args) {
      console.log(this.bookrow,"6666")
      //tag)
      // 判断时间和状态匹配条件
      if (!Util.isEmpty(args.model.f_last_check_state) && (!Util.isEmpty(args.model.f_check_start) || !Util.isEmpty(args.model.f_check_end) )){
        if (args.model.f_last_check_state == '未检'){
          var lscon = args.model.f_check_start ? ` or ua.f_last_check_date <= '${args.model.f_check_start} 00:00:00'` :''
          lscon += lscon ? (args.model.f_check_end ? ` or ua.f_last_check_date >= '${args.model.f_check_end} 23:59:59'` :''): (args.model.f_check_end ? `ua.f_last_check_date >= '${args.model.f_check_end} 23:59:59'` :'')
          args.condition +=`and (ua.f_last_check_state is null or ua.f_last_check_state =''  ${lscon} ) `
        }else  {
          var lscon = args.model.f_check_start ? ` and ua.f_last_check_date >= '${args.model.f_check_start} 00:00:00'` :''
          lscon += lscon ? (args.model.f_check_end ? ` and ua.f_last_check_date <= '${args.model.f_check_end} 23:59:59'` :'') : (args.model.f_check_end ? ` ua.f_last_check_date <= '${args.model.f_check_end} 23:59:59'` :'')
          args.condition += `and ua.f_last_check_state = '${args.model.f_last_check_state}' ${lscon}`
        }

      }else if (Util.isEmpty(args.model.f_last_check_state) && (!Util.isEmpty(args.model.f_check_start) || !Util.isEmpty(args.model.f_check_end) )) {
        var lscon = args.model.f_check_start ? ` and ua.f_last_check_date >= '${args.model.f_check_start} 00:00:00'` :''
        lscon += lscon ? (args.model.f_check_end ? ` and ua.f_last_check_date <= '${args.model.f_check_end} 23:59:59'` :'') : (args.model.f_check_end ? ` ua.f_last_check_date <= '${args.model.f_check_end} 23:59:59'` :'')
        args.condition += lscon
      }else if (!Util.isEmpty(args.model.f_last_check_state) && Util.isEmpty(args.model.f_check_start) && Util.isEmpty(args.model.f_check_end)){
        this.$showMessage("选择安检状态时，需要选择安检时间区间！")
        return
      }else{
        console.log('这块无条件')
      }
      let condition1=`(ua.f_last_check_date is null or ua.f_last_check_date ='')`
      let arge = args.condition.replace('从未安检',condition1)
      args.condition = arge
      // 上一个界面条件拼接进来
      if(this.addcondata){
        args.condition += this.addcondata
      }
      var checkallcond = ''
      // 判断小区或者单位是否是多选 全选
      if(this.bookrowsdata.checkAll){
        if(this.row.f_user_type === '民用'){
          checkallcond = ` and area.f_check_book_id = ${this.row.id} `
        }else{
          checkallcond = ` and tc.f_check_book_id = ${this.row.id} `
        }

        if(this.bookrowsdata.bookrows.length > 0){
          this.bookrowsdata.bookrows.forEach((item) => {
            if(this.row.f_user_type === '民用'){
              checkallcond +=  ` and area.id != ${item}`
            }else{
              checkallcond +=  ` and tc.id != ${item}`
            }
          })
        }
      }else{
        var nums = '('
        this.bookrowsdata.bookrows.forEach((item) => {
          if(this.bookrowsdata.bookrows[this.bookrowsdata.bookrows.length -1] == item){
            nums += item +')'
          }else{
            nums += item +','
          }
        })
        if(this.row.f_user_type === '民用'){
          checkallcond +=  ` and area.id in  ${nums}`
        }else{
          checkallcond += ` and tc.id in ${nums}`
        }
      }
      args.condition +=  checkallcond
      args.condition += ` and ui.f_filialeid='${this.userlogin.orgid}'`
      if (args.model.f_residential_area == "无名称"){
        args.condition +=" and (ua.f_residential_area is null or ua.f_residential_area ='')"
      }else if (args.model.f_residential_area == "有名称"){
        args.condition +=" and (ua.f_residential_area is not null and ua.f_residential_area !='')"
      }
      if(this.uploadCodeCondition){
        args.condition +=` and ${this.uploadCodeCondition}`
      }
      this.cancel()
      this.checkes=[]
      this.checkAll=false
      this.model.search(args.condition, args.model, args.condValue)
    },
    showUserCondition(){
      this.showCondtion=true
    },
    setConList(){
      this.entry_status=this.$appdata.getParam('安检状态') ? [{
        label: '全部',
        value: ''
      }, ...this.$appdata.getParam('安检状态')] : [{label: '全部', value: ''}]

      this.userTypes=this.$appdata.getParam('用户类型') ? [{
        label: '全部',
        value: ''
      }, ...this.$appdata.getParam('用户类型')] : [{label: '全部', value: ''}]
      this.userStates=this.$appdata.getParam('安检用户状态') ? [{
        label: '全部',
        value: ''
      }, ...this.$appdata.getParam('安检用户状态')] : [{label: '全部', value: ''}]
      this.gasproperties=this.$appdata.getParam('用气性质') ? [{
        label: '全部',
        value: ''
      }, ...this.$appdata.getParam('用气性质')] : [{label: '全部', value: ''}]
      // this.meter_classifys=this.$appdata.getParam('气表类型') ? [{
      //   label: '全部',
      //   value: ''
      // }, ...this.$appdata.getParam('气表类型')] : [{label: '全部', value: ''}]
    },
    select_search(text, type){
      //tag
      let pcdText=text?`   and f_residential_area like '%${text}%'`:''
      if (type == 'pqId'){
        if(text.length==0){
          pcdText=text?`   and 1=1`:''
        }else {
          pcdText =text?`and f_check_book_id in (${text})`:''
        }

      }
      new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/safe_singleTable_OrderBy`, {data:{items:"*",tablename:"t_area",orderitem:"id",condition:`f_orgid = '${this.userlogin.orgid}' ${pcdText} `}}, {resolveMsg: null, rejectMsg: null}).then((res)=>{
        //tag)
        this.areaList=[]
        this.areaList.push({label:"全部",value:""})
        res.data.forEach((result)=>{
          this.areaList.push({label:result.f_residential_area,value:result.f_residential_area})
          //console.log('this.areaList=', JSON.stringify(this.areaList))
        })
        //tag)
      })


    },
    //获取抄表册
    async Mreadibook(){
      this.cbc=[]
      this.sliceArea=[]
      let http = new HttpResetClass()
      let getMeterReadingBooks = await http.load('POST','rs/logic/getMeterBooksData',
        {data: {f_orgid: "('"+this.userlogin.orgid+"')"}},
        {resolveMsg: null, rejectMsg: '获取失败！！！'})
      this.cbc = [{label: '全部', value: ''}]
      //tag
      //tag)
      //tag
      this.meterbooks=[]
      this.meterbooks=getMeterReadingBooks.data.meterbooks
      this.meterbooks.forEach((res) => {
        this.cbc.push({label: res.f_book_name, value: res.id})
        /*if(res.f_book_slice_area){
          if(this.sliceArea.indexOf(res.f_book_slice_area)<0){
            this.sliceArea.push(res.f_book_slice_area)
          }
        }*/
      })

    },
    //片区获取
    async getSliceArea()  {
      let http = new HttpResetClass()
      let getAllArea = await http.load('POST', '/rs/search', {
        source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
        userid: this.userlogin.id
      }, {resolveMsg: null, rejectMsg: '获取片区出错！！！'})
      this.sliceArea = [{label: '全部', value: ''}]
      //tag
      //tag
      //tag
      getAllArea.data.forEach((res) => {
        if(res.parentid==this.userlogin.orgid){
          this.sliceArea.push({label:res.name,value:res.name})
        }
      })
      //tag
    },
    //片区改变-对应抄表册下拉重新赋值
    slice_areaChange(value) {
      //tag
      if(!value){
        this.cbc=[]
        this.meterbooks.forEach((res) => {
          this.cbc.push({label: res.f_book_name, value: res.id})
        })
      }else{
        this.cbc=[]
        this.meterbooks.forEach((res) => {
          if(res.f_book_slice_area==value){
            this.cbc.push({label: res.f_book_name, value: res.id})
          }
        })
      }
    },
    isChecked(v) {
      // 如果全选，不在的按选中算，否则，在的按选中算
      if (this.checkAll) {
        return this.checkes.indexOf(v) == -1
      } else {
        return this.checkes.indexOf(v) != -1
      }
    },
    setCheckAll() {
      this.checkAll=this.checkAll?false:true;
      // 全选改变后，清空选中数据
      this.checkes = []
    },
    setCheckes(id) {
      let index=this.checkes.indexOf(id)
      if(index<0){
        this.checkes.push(id)
      }else{
        this.checkes.splice(index,1)
      }
    },
  },
  watch: {
    'areaen'(val) {
      //console.log('val=', JSON.stringify(val))
      this.select_search(val, 'pqId')
    }
  },
  events: {
    onFileUpload: function (file, res) {
      //tag)
      //tag)
      let data = {
        filepath: res.f_downloadpath
      }
      new HttpResetClass().load('POST','/rs/logic/safe_GetUserInfoFromExcel', {data: data}, {
        resolveMsg: '导入成功！已生成条件，若要去除导入条件请点击旁边 ‘清空用户编号’ 按钮。',
        rejectMsg: '导入失败'
      }).then((res) => {
        this.uploadCodeCondition=res.data.condition
        this.excelUserCondtion = false
      })
    },

  }
}
</script>

<style scoped>
.safe-planfont{
  font-family: MicrosoftYaHei;
  font-size: 15px;
  font-weight: normal;
  font-stretch: normal;
  letter-spacing: 2px;
  color: #333333;
  line-height: 25px;
}
.safe-bodyfont{
  font-family: MicrosoftYaHei;
  font-size: 14px;
  font-weight: normal;
  font-stretch: normal;
  letter-spacing: 0px;
  color: #999999;
  line-height: 30px;
}
.safe-leftplan{
  height:auto;
  border-bottom:1px solid #ececec;
  padding: 10px 5px
}
.leftplan-center{
  border-top:1px solid #ececec;
  border-bottom:1px solid #ececec;
}
.safe_p{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.safe-div-p{
  color: #4792de;
  text-align: end;
  padding: 8px 15px;
}
</style>
<style lang="less">
.upuserinfo_sel ul{
  width: 150% !important;
}
</style>
