<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:criteria>
        <div partial>
          <div class="row " >
            <label class="form-group font_normal_body"><b>用户信息</b></label>

            <div class="form-group col-sm-1" >
              <input type="text" class="input_search" v-model="model.f_userinfo_code"
                     style="width: 95%" placeholder="客户编号" condition="ui.f_userinfo_code='{}'">
            </div>
            <div class="form-group col-sm-1" v-if="false">
              <input type="text" class="input_search" v-model="model.f_user_name"
                     style="width: 95%" placeholder="客户名称" condition="ui.f_user_name like '%{}%'">
            </div>
            <div class="form-group col-sm-1" v-if="false">
              <input type="text" class="input_search" v-model="model.f_address"
                     style="width: 95%" placeholder="客户地址" condition="ua.f_address like '%{}%'">
            </div>
            <div class="form-group col-sm-1 upuserinfo_sel" >
              <v-select
                class="select select_list"
                :width="'95%'"
                :value.sync="model.f_area"
                v-model="model.f_area"
                :options='$parent.$parent.areaList'
                :timeout="500"
                @select-search="$parent.$parent.select_search"
                placeholder='小区选择'
                condition="ua.f_residential_area = '{}'"
                close-on-select
                value-single
              >
              </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_new" style="margin-right: 10px"  @click="$parent.$parent.showUploadCodeCondition()">导入编号</button>
              <button class="button_new" style="margin-right: 10px"  @click="$parent.$parent.clearUserInfoId()">清空编号</button>
              <button class="button_search" style="margin-right: 10px"  @click="search()">查询</button>
            </div>
            <div class="form-group col-sm-1" style="float: right">
              <button class="button_search" style="margin-right: 10px"  @click="$parent.$parent.dragtoPlanItem()">添入计划</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">用户类型:</label>
                    <v-select
                      class="select select_list"
                      :value.sync="model.f_user_type"
                      v-model="model.f_user_type"
                      :options='$parent.$parent.userTypes'
                      placeholder='请选择'
                      condition="uf.f_user_type='{}'"
                      :search="false"
                      close-on-select
                      value-single
                    >
                    </v-select>
                  </div>
                  <div class="form-group col-sm-4" >
                    <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-4" >
                    <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" >
                    <label class="font_normal_body">小区名称:</label>
                    <v-select
                      class="select select_list"
                      :value.sync="model.f_residential_area"
                      v-model="model.f_residential_area"
                      :options='$parent.$parent.hasResidentialArea'
                      placeholder='请选择'
                      :search="false"
                      close-on-select
                      value-single
                    >
                    </v-select>
                  </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_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>
                    <v-select
                      class="select select_list"
                      :value.sync="model.checkBook"
                      v-model="model.checkBook"
                      :options='$parent.$parent.checkBooks'
                      placeholder='请选择'
                      @change="$parent.$parent.areaListdata(model.checkBook)"
                      :search="false"
                      :multiple="true"
                    >
                    </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 00:00:00'"
                      :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 23:59:59'"
                      :show-rest-button="reset"
                      :value.sync="model.f_check_end"
                      v-model="model.f_check_end">
                    </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 23:59:59'"
                      :show-rest-button="reset"
                      :value.sync="model.f_ruhu_end"
                      v-model="model.f_ruhu_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 class="form-group col-sm-4 button-range" >

              <button class="button_search" style="margin-right: 10px"  @click="search()">查询</button>
              <export-excel-safe   :data="$parent.$parent.exportParameter"
                                   :field="$parent.$parent.excelHeaders"
                                   sqlurl="rs/logic/SafeExportExcel" sql-name="planItem"
                                   template-name='安检计划明细' :choose-col="true">
              </export-excel-safe>

            </div>-->
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' class="table_sy">

        <template partial='head'>
          <tr>
            <th><nobr><input type="checkbox" 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>
  </div>
</template>

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

    export default {
        name: "checkUserList",
        title: '计划管理',
        data() {
          let model = new PagedList('/rs/sql/FetchUserFileByOrgNoRuHuSXQ', 20, {
            "orderitem": "'f_residential_area,f_building,f_unit,f_floor,f_room'",
            "f_usertype": "''",
            "month": "''",
            "SafeCheckSX": 'this.SafeCheckSX',
            "SafeCheckCQ": "''",
            "startday":"''",
            "endday":"''"})
          model.SafeCheckSX = '1 = 1'
          return {
            model: model,
            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"}],
            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:["selectplan","userlogin"],
        ready(){
          // this.$refs.paged.$refs.criteria.model.f_endfile_time=Util.toStartDateYearString()
          //this.$refs.paged.$refs.criteria.model.f_hasHousehold='未入户'
          this.getCheckBook()
          this.setConList()
          this.loadpage()
          this.getGasbrand()
        },
        methods: {
          areaListdata(area){
            console.log('area=', JSON.stringify(area))
            let uass = []
            let areass = []
            if(area){
              for (let areas of area) {
              if(areas.toString().split("-")[1] === '用户'){
                uass.push(areas.toString().split("-")[0])
              }else{
                areass.push(areas.toString().split("-")[0])
              }
              }
              this.areaen=uass.concat(areass)
              console.log('areaen=', JSON.stringify(this.areaen))
            }

            // this.select_search(areaen)
          },
          getGasbrand(){
            this.meter_gasbrand=[]
            new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_GroupBy`, {
              data: {
                items: 'id,f_meter_brand',
                tablename: 't_gasbrand',
                condition: `f_orgid = '${this.userlogin.orgid}'`,
                groupitem: 'id,f_meter_brand'
              }
            }, {resolveMsg: null, rejectMsg: null}).then(res => {
              this.meter_gasbrand.push({label: '全部', value: ''})
              console.log('res=', JSON.stringify(res))
              res.data.forEach(ress => {
                console.log('ress=', JSON.stringify(ress))
                this.meter_gasbrand.push({
                  label: ress.f_meter_brand,
                  value: ress.id
                })
              })
            })
          },
          getCheckBook(){
            this.checkBooks=[]
            new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_OrderBy`, {
              data: {
                items: 'id,f_check_book_name,f_check_book_type',
                tablename: 't_check_book',
                condition: `f_orgid = '${this.userlogin.orgid}'`,
                orderitem: 'id desc'
              }
            }, {resolveMsg: null, rejectMsg: null}).then(res => {
              this.checkBooks.push({label: '全部', value: ''})
              this.checkBooks.push({label: '未在片区内', value: '111111'})
              res.data.forEach(ress => {
                this.checkBooks.push({
                  label: ress.f_check_book_name,
                  value: `${ress.id}-${ress.f_check_book_type}`
                })
              })
            })
          },
          loadpage(){
            this.select_search()
            this.Mreadibook()
            this.getSliceArea()
          },
          cancel(){
            this.showCondtion=false
            this.excelUserCondtion=false
          },
          //清空用户编号
          clearUserInfoId(){
            this.uploadCodeCondition=''
            Vue.showMessage("已清空用户编号")
          },
          showUploadCodeCondition(){
            this.excelUserCondtion=true
          },
          selfSearch (args) {
            if( args.model.f_last_check_state == '入户' && args.model.f_ruhu_end) {
              args.condition += `and DATEADD(YEAR, 2, CAST(ruhuend.f_offsite_time AS datetime)) < '${args.model.f_ruhu_end}'`
            }
            if(args.model.f_last_check_state && Util.isEmpty(args.model.f_ruhu_end) && (Util.isEmpty(args.model.f_check_start) || Util.isEmpty(args.model.f_check_end))) {
              this.$showMessage("选择安检状态时，需要选择安检时间区间！")
              return
            }
            if(args.model.f_last_check_state && Util.isEmpty(args.model.f_ruhu_end)) {
              this.model.SafeCheckSX = ` f_offsite_time > '${args.model.f_check_start}' and f_offsite_time < '${args.model.f_check_end}'`
              if (args.model.f_last_check_state == '未检') {
                args.condition += ' and  tcp.ruhu is null '
              } else if (args.model.f_last_check_state == '入户') {
                args.condition += ` and tcp.ruhu > 0`
              } else if (args.model.f_last_check_state == '拒检') {
                args.condition += ` and tcp.jujian > 0 and tcp.ruhu = 0 and tcp.daofang = 0 `
              } else if (args.model.f_last_check_state == '到访不遇') {
                args.condition += ` and tcp.daofang > 0 and tcp.ruhu = 0 and tcp.jujian = 0 `
              }
            }else{
              //无条件
              this.model.SafeCheckSX = ` 1 != 1 `
            }
            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 !='')"
            }
            console.log('查询条件',args)
            if(args.model.checkBook){
              let uas = []
              let areas = []
              for (let item of args.model.checkBook) {
                if(item.split("-")[1] === '用户'){
                  uas.push(item.split("-")[0])
                }else{
                  areas.push(item.split("-")[0])
                }
              }
              let ua = this.$login.convertToIn(uas)
              let area = this.$login.convertToIn(areas)
              if (uas.length > 0 && areas.length > 0){
                if (area.indexOf("111111") > 0){
                  args.condition += `and (ua.f_check_book_id in ${ua} or ( (area.f_check_book_id in ${area} or area.f_check_book_id is null ) and ua.f_check_book_id is null ) )`
                }else {
                  args.condition += `and (ua.f_check_book_id in ${ua} or ( area.f_check_book_id in ${area} and ua.f_check_book_id is null ) )`
                }
              }else if (uas.length > 0 && areas.length < 1 ){
                args.condition += `and ua.f_check_book_id in ${ua}`
              } else if (uas.length < 1 && areas.length > 0){
                if (area.indexOf("111111") > 0 ){
                  args.condition += `and (area.f_check_book_id in ${area} or area.f_check_book_id is null ) and ua.f_check_book_id is null`
                }else {
                  args.condition += `and area.f_check_book_id in ${area} and ua.f_check_book_id is null`
                }
              }
            }
            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)
            }
          },
          //将客户信息拖至计划中
          async dragtoPlanItem() {
              if(this.model.rows.length==0){
                Vue.showMessage("未检测到列表中有用户！")
                return
              }
              if(!this.checkAll && this.checkes.length==0){
                Vue.showMessage("请先勾选你要添入到上方计划中的用户！")
                return
              }
              if(this.selectplan && this.selectplan.id){
                this.$parent.isSend=true
                try{
                  let res=await new HttpResetClass().load("POST", "/rs/logic/AddCheckPlanItem", {
                    data:{
                      f_operator:this.userlogin.name,
                      f_plan_id:this.selectplan.id,
                      f_safecheck_type:this.selectplan.f_safecheck_type,
                      f_filialeid:this.userlogin.orgid,
                      f_subscribe_date:'',
                      condition:this.model.condition,
                      SafeCheckSX: this.model.SafeCheckSX,
                      switchCheckAll:true,
                      checkAll:this.checkAll,
                      param:this.checkes,
                      columnName: "ua.id"
                    }
                  }, {resolveMsg: null, rejectMsg: null})
                  //tag+"---"+res.data.result.length)
                  this.$parent.isSend=false
                  if(res.data.code==200){
                    //alert("添加成功！有"+res.data.result.length+"条用户地址已经存在于其他计划中:  \n"+res.data.result.reduce((c,v)=>{c += v.f_user_name+":"+v.f_address+"\n"}),0)
                    this.$showMessage("添加成功！"+(res.data.result.length>0?"有"+res.data.result.length+"条用户地址已经存在于其他计划中":""))
                    this.$parent.refresh()
                  }else{
                    this.$showMessage("添加失败！")
                  }
                }catch (e) {
                  this.$showMessage("添加失败！")
                }
              }else{
                this.$parent.isSend=false
                this.$showMessage("请先打开一个计划再进行操作")
              }
          }
        },
      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>
