<template>
    <work-busy :is-busy="isSend"></work-busy>
    <div class="binary" style="background-color: #e8f4ff">
      <!--左侧安检计划列表******************************************************-->
      <div class="binary-left flex flex-column" style="width: 16%">
        <div style="height: 9%">
          <div class="row auto">
            <img style="width: 20px;margin: 0 5px" src="../../../../static/images/searchhover.png" @click="showUserCondition()"/>
            <v-select :width="'80%'"
                      class="select select_list"
                      :search="false"
                      :value.sync="currentorder"
                      v-model="currentorder"
                      @change="loadCheckPlan"
                      :options='opt'
                      close-on-select value-single >
            </v-select>
          </div>
          <div class="row auto safe-div-p"><!--<span style="margin-right: 5px" @click="refresh()" style="cursor:default">测试</span>--><span style="margin-right: 5px" @click="delCheckPlan()" style="cursor:default">删除</span> <span @click="sendCheckPlan()" style="cursor:default">下发</span></div>
        </div>
        <div class="leftplan-center safe_plan_list">
          <div class="row safe-leftplan safe_list_li" :class="{'safe-selectplan':selectPlan.id==row.id}" v-for="row in checkplan.list.data" @click="selectPlanChange(row)">
            <table style="width:100%;table-layout:fixed" >
              <tr class="safe-planfont">
                <td rowspan="6"><input type="checkbox" style="pointer-events:auto" v-show="row.plan_count==0 || row.f_issued=='未下发'"  onClick="event.cancelBubble = true" :checked="checkplan.check.isChecked(row.f_check_item_id)"  @change="checkplan.check.setCheckes(row.id)"/></td>
                <td colspan="6" class="safe_p">{{row.f_plan_name}}</td>
                <td colspan="2" style="text-align: center"><img width="20px" style="pointer-events:auto" onClick="event.cancelBubble = true" @click="showUpPlans(row)" src="../../../../static/images/edit.png"/></td>
              </tr>
              <tr class="safe-bodyfont" style="color:#4792de">
                <td colspan="6">{{row.f_issued}}</td>
                <td colspan="2" class="safe_p">{{row.f_checker?row.f_checker:'共享'}}</td>
              </tr>
              <tr class="safe-bodyfont">
                <td colspan="4">{{row.f_plan_year}}-{{row.f_plan_month}}</td>
                <td colspan="2">总 :</td>
                <td colspan="2">{{row.plan_count}}</td>
              </tr>
              <tr class="safe-bodyfont">
                <td colspan="2">未检 :</td>
                <td colspan="2">{{row.unchecked}}</td>
                <td colspan="2">已检 :</td>
                <td colspan="2">{{row.checked}}</td>
              </tr>
              <tr class="safe-bodyfont" v-if="row.f_create_time">
                <td colspan="3">创建时间 :</td>
                <td colspan="5" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" :title="row.f_create_time">{{row.f_create_time}}</td>
              </tr>
              <tr class="safe-bodyfont" v-if="row.f_safecheck_type">
                <td colspan="3">安检类型 :</td>
                <td colspan="5" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" :title="row.f_safecheck_type">{{row.f_safecheck_type}}</td>
              </tr>
            </table>
          </div>
        </div>
        <div style="height: 11%">
          <div class="row auto leftplan-center" style="padding: 8px">
            <div class="col-sm-6" style="">
              <span>共{{checkplan.list.count}}条</span>
            </div>
            <div class="col-sm-6" style="text-align: end">
              <span @click="loadMore('checkplan')"><img src="../../../../static/images/doubledown.png"/>&ensp;更多</span>
            </div>
          </div>
          <div class="row auto" style="padding: 10px;text-align: center">
            <img src="../../../../static/images/addnew.png" @click="showcCreatePlan()"/>
          </div>
        </div>
      </div>
      <!--右侧列表**************************************************************************-->
      <div class="binary-right" style="width: 84%;overflow: auto">
        <div style="height: 5%">
          <div class="col-sm-4">
            <label class="font_normal_body">公&emsp;&emsp;司</label>
            <right-tree-safe :islist="false" :width="'60%'" @re-res="getRes"></right-tree-safe>
          </div>
        </div>
        <div style="height: 95%">
          <div style="height: 50%" class="leftplan-center">
            <check-plan-list :selectplan="selectPlan" :userlogin="userlogin" v-ref:item></check-plan-list>
          </div>
          <div style="height: 50%">
            <check-user-list :selectplan="selectPlan" :userlogin="userlogin" v-ref:user></check-user-list>
          </div>
        </div>
      </div>
      <modal :show.sync="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>
              <input type="text" class="input_search" v-model="planCondition.f_plan_name"  @change="setProperty('checkplan','f_plan_name',planCondition.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="planCondition.f_plan_year"
                v-model="planCondition.f_plan_year"
                @change="setProperty('checkplan','f_plan_year',planCondition.f_plan_year)"
                :search="false"
                :options='getConList("yearList")'
                placeholder='请选择'
                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="planCondition.f_plan_month"
                v-model="planCondition.f_plan_month"
                @change="setProperty('checkplan','f_plan_month',planCondition.f_plan_month)"
                :search="false"
                :options='getConList("monthList")'
                placeholder='请选择'
                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="planCondition.isShare"
                v-model="planCondition.isShare"
                @change="setProperty('checkplan','isAndNot',planCondition.isShare)"
                :options='getConList("conIsAndNot")'
                :search="false"
                placeholder='请选择'
                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="planCondition.issued"
                v-model="planCondition.issued"
                :options='getConList("isAndNot")'
                @change="setProperty('checkplan','issude',planCondition.issued)"
                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>
            <v-select
              class="select select_list"
              :value.sync="planCondition.f_checker"
              v-model="planCondition.f_checker"
              @change="setProperty('checkplan','checkerid',planCondition.f_checker.id)"
              :options='getConList("checker")'
              placeholder='请选择'
              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="planCondition.f_safecheck_type"
                v-model="planCondition.f_safecheck_type"
                @change="setProperty('checkplan','safechecktype',planCondition.f_safecheck_type)"
                :options='getConList("safechecktype")'
                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="planCondition.f_create_operator"  @change="setProperty('checkplan','f_create_operator',planCondition.f_create_operator)"
                     style="width: 60%" placeholder="创建人" />
            </div>
          </div>
        </div>
        <div slot="modal-footer" class="modal-footer" style="text-align: center">
          <button class="button_search" @click="loadCheckPlan" style="margin-right: 15px">查询</button>
          <button class="button_search" @click="cancel">取消</button>
        </div>
      </modal>
      <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'
                placeholder='请选择'
                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'
                placeholder='请选择'
                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"
                :search="false"
                :value.sync="createPlan.isShare"
                v-model="createPlan.isShare"
                :options='isAndNot'
                placeholder='请选择'
                close-on-select
                value-single
              >
              </v-select>
            </div>
            <div class="form-group col-sm-4" v-show="createPlan.isShare=='否'">
              <label class="font_normal_body">安&ensp;检&ensp;员:</label>
              <v-select
                class="select select_list"
                :value.sync="createPlan.checker"
                v-model="createPlan.checker"
                :options='checker'
                placeholder='请选择'
                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_safecheck_type"
                v-model="createPlan.f_safecheck_type"
                :search="false"
                :options='ntoway'
                placeholder='请选择'
                close-on-select
                value-single
              >
              </v-select>
            </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="cancel">取消</button>
        </div>
      </modal>
      <modal :show.sync="showUpPlan" v-ref:modal2 :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="upCheckPlan.f_plan_name"
                     style="width: 60%"  />
            </div>
            <div class="form-group col-sm-4" >
              <label class="font_normal_body">计划年份:</label>
           <v-select
                class="select select_list"
                :value.sync="upCheckPlan.f_plan_year"
                v-model="upCheckPlan.f_plan_year"
                :search="false"
                :value="upCheckPlan.f_plan_year"
                :options='yearList'

                close-on-select
                value-single>


              </v-select>
<!--              <datepicker
                placeholder='请选择'
                style="width:60%"
                :disabled-days-of-week="[]"
                :format="'yyyy'"
                :show-rest-button="reset"
                :value.sync="upCheckPlan.f_plan_year"
                v-model="upCheckPlan.f_plan_year">
              </datepicker>-->
            </div>
            <div class="form-group col-sm-4" >
              <label class="font_normal_body">计划月份:</label>
              <v-select
                class="select select_list"
                :value.sync="upCheckPlan.f_plan_month"
                v-model="upCheckPlan.f_plan_month"

                :options='monthList'
                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"
                :search="false"
                :value.sync="upCheckPlan.isShare"
                v-model="upCheckPlan.isShare"
                :options='isAndNot'
                placeholder='请选择'
                close-on-select
                value-single
              >
              </v-select>
            </div>
            <div class="form-group col-sm-4" v-show="upCheckPlan.isShare=='否'">
              <label class="font_normal_body">安&ensp;检&ensp;员:</label>
              <v-select
                class="select select_list"
                :value.sync="upCheckPlan.checker"
                v-model="upCheckPlan.checker"
                :options='checker'
                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="upCheckPlan.f_safecheck_type"
                v-model="upCheckPlan.f_safecheck_type"
                :options='ntoway'
                close-on-select
                value-single
              >
              </v-select>
            </div>
          </div>
        </div>
        <div slot="modal-footer" class="modal-footer" style="text-align: center">
          <button class="button_search" style="margin-right: 15px" @click="upPlan()">保存修改</button>
          <button class="button_search" @click="cancel">取消</button>
        </div>
      </modal>
    </div>
</template>

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

    export default {
        name: "PlanManage",
        title: '计划管理',
        data() {
          return {
            a:'1',
            opt:[{label:"按时间降序",value:"按时间降序"},{label:"按时间升序",value:"按时间升序"}],
            currentorder:'按时间降序',
            checkplan : new SearchList(true),
            selectPlan:{id:''},
            upCheckPlan:{
              f_plan_name:'',
              f_safecheck_type:'',
              f_plan_year:'',
              f_plan_month:'',
              f_checker_id:'',
              isShare:'',
              f_checker:'',
              checker:{}
            },
            isSend:false,
            createPlan:{
              f_plan_name:'',
              f_plan_year:'',
              f_plan_month:'',
              isShare:'否',
              f_issued:'否',
              f_checker_id:null,
              checker:{},
              f_checker:null,
              f_safecheck_type:'',
            },
            planCondition:{},
            showCondtion:false,
            showCreatePlan:false,
            showUpPlan:false,
            isAndNot:[{label:'是',value:'是'},{label:'否',value:'否'}],
            conIsAndNot:[{label:'是',value:'is null'},{label:'否',value:'is not null'}],
            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}],
            safechecktype:[{label:'年度普检',value:'年度普检'}],
            checker:[],
            checkertCon:[],
            userlogin:{
              id:this.$login.f.id,
              name:this.$login.f.name,
              orgid:this.$login.f.orgid,
              orgstr:this.$login.f.orgs,
            }
            //需要测试直接把下面放开即可
            /*userlogin:{
              id:'141701',
              name:'hwq',
              orgid:'35526',
              orgstr:'西华县天然气有限公司'
            }*/
          }
        },
      async ready(){
        await this.loadpage()
      },
   computed: {
        ntoway() {
         /*/!* return AppData.getParam('安检类型')*!/*/
          return this.$appdata.getParam('安检类型')
        }
        },
      methods:{
      /*  ntoway() {
          /!* return AppData.getParam('安检类型')*!/
          return Vue.$appdata.getParam('安检类型')
        },*/
        async loadpage(){
          //await this.checkplan.searchList("/rs/sql/预约计划下发", {},{groupitem:"",f_filialeids:"('"+this.userlogin.orgid+"')",orderitem:"f_create_time desc"})
          await this.loadCheckPlan()
          await this.searchChecker(this.userlogin.id)
        },
        getRes(obj) {
          console.log("----obj"+JSON.stringify(obj.resids))
          console.log(obj)
          if(obj.resids.length>0 && obj.resids[0]!=this.userlogin.orgid && obj.resids[0]){
            this.userlogin.orgid=obj.resids[0]
            this.userlogin.orgstr=obj.res[0]
            if(this.$refs.item && this.$refs.user){
              this.loadpage()
              this.selectPlan={id:""}
              this.$refs.item.model.rows=[]
              this.$refs.user.model.rows=[]
              this.$refs.user.loadpage()
            }
          }
        },
        getConList(field){
          return [{label:'全部',value:''}, ...this[field]]
        },
        selectPlanChange(plan){
          this.selectPlan=plan
          //this.upCheckPlan=plan
        },
        showUserCondition(){
          this.showCondtion=true
        },
        showcCreatePlan(){
          this.showCreatePlan=true
        },
        cancel(){
          this.showCondtion=false
          this.showCreatePlan=false
          this.showUpPlan=false
        },
        //新建计划
        async addNewPlan() {
          if(!this.validationCreatePlan()){
            return
          }
          this.isSend=true
          let res=await new HttpResetClass().load("POST","/rs/sql/getCheckplan", {data: {condition:"f_plan_name='"+this.createPlan.f_plan_name+"'",sortfield:'f_create_time desc'}})
          console.log("结果-"+res.data.length)
          if(res.data.length>0){
            Vue.showMessage("计划名称不能重复！")
            this.isSend=false
            return
          }
          if(this.createPlan.isShare=="是"){
            this.createPlan.f_checker_id=null
            this.createPlan.f_checker=null
          }else{
            this.createPlan.f_checker_id=this.createPlan.checker.id
            this.createPlan.f_checker=this.createPlan.checker.name
          }
          console.log("this.createPlan.f_checker:"+this.createPlan.f_checker)
          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()
          await new HttpResetClass().load('POST',"/rs/logic/createCheckPlan", {"data": this.createPlan},{resolveMsg : '新建计划成功！', rejectMsg : '新建计划失败！'})
          //await this.loadCheckPlan('',()=>{})
          this.createPlan={
            f_plan_name:'',
              f_plan_year:'',
              f_plan_month:'',
              isShare:'否',
              f_issued:'否',
              f_checker_id:null,
              checker:{},
              f_checker:null,
              f_safecheck_type:'',
              f_create_operator:''
          }
          await this.loadCheckPlan()
          this.isSend=false

        },
        validationCreatePlan(){
          if(!this.createPlan.f_plan_name){
            Vue.showMessage("请输入安检计划名称！")
            return false
          }
          if(!this.createPlan.f_plan_year){
            Vue.showMessage("请选择安检年份！")
            return false
          }
          if(!this.createPlan.f_plan_month){
            Vue.showMessage("请选择安检月份！")
            return false
          }
          if(this.createPlan.isShare=="否"){
            if(JSON.stringify(this.createPlan.checker)=='{}'){
              Vue.showMessage("请选择安检人员！")
              return false
            }
          }else{
            this.createPlan.f_checker=''
          }
          if(!this.createPlan.f_safecheck_type){
            Vue.showMessage("请选择安检类型！")
            return false
          }
          return true
        },
        //查询安检员selectChanged
        async searchChecker(id){
          let res=await new HttpResetClass().load('POST', '/rs/search', {
            source: 'tool.getChildrenOfResName($安检员$)',
            userid: id
          }, {resolveMsg: null, rejectMsg: null})
          this.checker=[]
          res.data.forEach((resRow) => {
              this.checker.push({label:resRow.name,value:resRow})
          })
        },
        //设置属性值
        setProperty(modulename, property, value) {
          console.log(modulename+"新添--"+property+"--"+value)
          if(value=='全部'){
            this[modulename].search.setField(property, '')
          }else{
            this[modulename].search.setField(property, value)
          }
        },
        //按条件查询所有安检计划
        async loadCheckPlan() {
          this.isSend=true
          this.checkplan.check.checkes=[]
          let fieldValue=''
          switch(this.currentorder){
            case "按时间降序":
              fieldValue='f_create_time desc'
              break
            case "按时间升序":
              fieldValue='f_create_time'
              break
          }
          console.log("--------fieldValue"+fieldValue)
          this.cancel()
          await this.checkplan.searchList("/rs/sql/预约计划下发",
            {"f_plan_name": "f_plan_name like '%{}%'",
              "f_plan_year":"f_plan_year={}",
              "f_plan_month":"f_plan_month={}",
              "checkerid":"f_checker_id='{}'",
              "isAndNot":"f_checker {}",
              "safechecktype":"f_safecheck_type='{}'",
              "issude":"f_issued = '{}'",
              "f_create_operator": "f_create_operator like '%{}%'"
            },
            {orderitem:fieldValue,
              f_filialeids:"('"+this.userlogin.orgid+"')",
              groupitem:""
            }
          )

          this.isSend=false
        },
        //加载更多数据
        async loadMore(modelname) {
          this.isSend=true
          await this[modelname].list.loadMore()
          this.isSend=false
        },
        showUpPlans(row){
          this.upCheckPlan.id=row.id
          this.upCheckPlan.f_safecheck_type=row.f_safecheck_type
          this.upCheckPlan.f_plan_name=row.f_plan_name
          this.upCheckPlan.f_plan_year=row.f_plan_year
          this.upCheckPlan.f_plan_month=row.f_plan_month
          this.upCheckPlan.f_checker_id=row.f_checker_id?row.f_checker_id:null
          this.upCheckPlan.f_checker=row.f_checker?row.f_checker:null
          this.upCheckPlan.isShare=row.f_checker_id?'否':'是'
          this.upCheckPlan.f_issued=row.f_issued
          this.upCheckPlan.checker={id:row.f_checker_id,name:row.f_checker}
          this.showUpPlan=true
        },
        async upPlan(){
          if(this.upCheckPlan.f_issued=='已下发'){
            this.$showMessage("该计划已下发，无法进行修改！")
            return
          }
          if(!this.upCheckPlan.f_plan_name){
            Vue.showMessage("请输入安检计划名称！")
            return false
          }
          if(!this.upCheckPlan.f_plan_year){
            Vue.showMessage("请选择安检年份！")
            return false
          }
          if(!this.upCheckPlan.f_plan_month){
            Vue.showMessage("请选择安检月份！")
            return false
          }
          console.log(this.upCheckPlan)

          if(this.upCheckPlan.isShare=="是"){
            this.upCheckPlan.f_checker_id=null
            this.upCheckPlan.f_checker=null
          }else{
            this.upCheckPlan.f_checker_id=this.upCheckPlan.checker.id
            this.upCheckPlan.f_checker=this.upCheckPlan.checker.name
          }
          this.isSend=true
          let res=await new HttpResetClass().load("POST", "/rs/logic/updateCheckPlan", {
            data:{
              f_checker:this.upCheckPlan.f_checker,
              f_safecheck_type:this.upCheckPlan.f_safecheck_type,
              f_checker_id:this.upCheckPlan.f_checker_id,
              f_plan_name:this.upCheckPlan.f_plan_name,
              f_plan_year:this.upCheckPlan.f_plan_year,
              f_plan_month:this.upCheckPlan.f_plan_month,
              f_plan_id:this.upCheckPlan.id
            }
          }, {resolveMsg: null, rejectMsg: null})
          if(res.data.code==200){
            this.$showMessage("修改成功！")
            this.cancel()
            await this.loadCheckPlan()
          }else{
            this.$showMessage("修改失败！")
          }
          this.isSend=false
        },
        //下发安检计划
        async sendCheckPlan(f){
          if(this.checkplan.check.checkes.length<1){
            this.$showMessage("请选择要下发的安检计划")
            return
          }
          this.isSend=true
          let res=await new HttpResetClass().load("POST", "/rs/logic/NewBespeakCheckPlan", {
            data:{
              f_issued:'是',
              f_issue_time:Util.toStandardTimeString(),
              f_send_operator:this.userlogin.name,
              param:this.checkplan.check.checkes,
            }
          }, {resolveMsg: null, rejectMsg: null})
          if(res.data.code==200){
            //Vue.showMessage("下发成功！其中有"+res.data.repet+"个计划己经是下发状态")
            this.$showMessage("下发成功！")
          }else{
            this.$showMessage("下发失败！")
          }
          await this.loadCheckPlan()
          this.isSend=false
        },
        //删除安检计划
        async delCheckPlan(f){
          if(this.checkplan.check.checkes.length<1){
            this.$showMessage("请选择要删除的安检计划")
            return
          }
          this.isSend=true
          let res=await new HttpResetClass().load("POST", "/rs/logic/deleteCheckPlan", {
            data:{
              f_operator:this.userlogin.orgstr,//global.login.name,
              condition:"",
              switchCheckAll:true,
              checkAll:false,
              param:this.checkplan.check.checkes,
              columnName: "f_plan_id"
            }
          }, {resolveMsg: null, rejectMsg: null})
          console.log(JSON.stringify(res))
          if(res.data.code==200){
            this.$showMessage("删除成功！")
          }else{
            this.$showMessage("删除失败！")
          }
          if(this.checkplan.check.checkes.indexOf(this.selectPlan.id)!= -1){
            this.selectPlan={id:''}
            console.log("包含了清空selectplan")
          }
          await this.loadCheckPlan()
          this.isSend=false
        },
        async refresh(){
          this.$refs.item.$refs.paged.$refs.criteria.search()
          this.$refs.user.$refs.paged.$refs.criteria.search()
          await this.loadCheckPlan()
        },
        async refreshPlan(){
          this.$refs.item.$refs.paged.$refs.criteria.search()
          await this.loadCheckPlan()
        }
      }
    }
</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;
  }
  .safe_list_li:hover{
    background-color: rgb(245,246,247);
  }
  .safe-selectplan{
    pointer-events: none;
    background-color: rgb(216,234,251);
  }
  .safe_plan_list{
    height: 80%;
    overflow: scroll;
  }

</style>
<style>
  .safe_plan_list::-webkit-scrollbar{
    background-color: #F5F5F5;
  }

  /*定义滚动条轨道 内阴影+圆角*/
  .safe_plan_list::-webkit-scrollbar-track{
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
  }

  /*定义滑块 内阴影+圆角*/
  .safe_plan_list::-webkit-scrollbar-thumb{
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
    background-color: #F5F5F5;
  }
</style>
