<template>
  <div id="unit" class="flex-row" v-if="listpage" >
    <div :class="{'basic-main':((!isdetail) && (!usershow)),'binary-left':isdetail||usershow}" >
      <check-plan-list v-ref:list :row="row" :config="config" :f_filialeid.sync="f_filialeid" @select-changed="selected" ></check-plan-list>
    </div>
  </div>

  <div>

  </div>
</template>
<script>
  import Vue from 'vue'

  export default {
    title: '安检考核',
    data () {
      return {
        // f_userinfo_id: '',
        f_filialeid: this.$login.f.orgid,
        listpage: true,
        row: null,
        checkrow: null,
        parentData: '',
        isdetail: false,
        gasPriceShow: false,

        changeView: false,
        nocivilshow:true,
        modalshow:false,
      }
    },
    ready () {
    },
    methods: {
      search(args) {


          if(args.model.f_check_start){
            args.condition += " and f_last_check_date >= '"+ args.model.f_check_start + "'"
          }
          if(args.model.f_check_end){
            args.condition += " and f_last_check_date <= '"+ args.model.f_check_end + "'"
          }

        args.condition += " and f_filialeid in  " + (this.model.f_filialeids ? this.model.f_filialeids : `(${this.$login.f.orgid})`)
        this.searchData.condition=args.condition
        //tag
        return this.model.search( args.condition, args.model)
      },
    //   cancel(obj) {
    //     this.listpage = true
    //   },
    //   dealMsg(val) {
    //     this.listpage = false
    //     this.f_userinfo_id = val.f_userinfo_id
    //   },
    //   selected (obj) {
    //     //tag)
    //     //tag)
    //     this.checkrow = obj.val
    //     this.parentData = this.checkrow.id
    //     this.isdetail = true
    //     this.usershow = false
    //     this.listpage = true
    //   },
    //   selected2 (obj) {
    //
    //   },
      refresh () {
        this.row = null
        this.gasPriceShow = false
        this.isdetail = false
        this.usershow =false
        this.listpage=true
        this.$refs.list.search()
      }
    },
    events: {
      'success' (name, row, res) {
        this.row = row
        this.gasPriceShow = false
        this.isdetail = false
        this.usershow =false
        this.listpage=true
        this.$refs.list.search()
      },
      'error' (name, row, res) {
        this.row = row
        this.gasPriceShow = false
        this.isdetail = false
        this.usershow =false
        this.listpage=true
        this.$refs.list.search()
      },
      'close' (res) {
        this.row = null
        this.gasPriceShow = false
        this.isdetail = false
        this.usershow =false
        this.listpage=true
      },
      'search' () {
        this.row = null
        this.gasPriceShow = false
        this.isdetail = false
        this.usershow =false
        this.listpage=true
        // this.$refs.list.search()
      }
    }
  }
</script>
<style>

</style>
