<template>
  <div class="flex-row">
    <div class="basic-main">
      <div :class="showData ? 'top' : 'auto'">
        <installinfoselect :show-data="showData" v-ref:query></installinfoselect>
      </div>
      <div v-if="showtotal" class="panel panel-info" style="height: 90%;">
        <tabset v-ref:tabs :close="false">
          <tab :header='selectdata.title'>
            <function-service-control  v-ref:service :selectdata="selectdata"></function-service-control>
          </tab>
          <tab header='附件'>
            <apply-upload :blodid="selectdata.f_process_id"
                          :isupload = "isupload"
                          :isdelete="true"
                          :isusetype="true"
                          :isremark = "true"
                          :takeimg="false"
                          :issearch="true"
                          :defname="selectdata.defname"
            >
            </apply-upload>
          </tab>
        </tabset>
      </div>
    </div>
  </div>

</template>
<script>
  import Vue from 'vue'
  import {HttpResetClass} from 'vue-client'
  export default {
    title: '报建业务',
    data () {
      return {
        selectdata: null,
        showtotal: false, // 控制详情显示
        showData: true,     // 控制列表数据
        isupload: false
      }
    },
    ready () {
      this.getConfig()
    },
    methods: {
      // 获取功能配置
      async getConfig () {
        let http = new HttpResetClass()
        let res = await http.load('POST', 'rs/logic/ApplyGetFunction', null,
          {resolveMsg: null, rejectMsg: '流程标识获取失败！！！'}
        )
        Vue.prototype.$function_vue = res.data
      }
    },
    events: {
      // 刷新控制层
      async 'breakControl' (servicedata) {
        let http = new HttpResetClass()
        let data = {
          condition: `u.id = ${servicedata.id}`,
          data: {
            f_filiale: "榆林."+this.$login.f.orgs
          }
        }

        let res = await http.load('POST', 'rs/sql/checkuserfunction', {data:data}, {
          resolveMsg: null,
          rejectMsg: '数据更新失败！！！'
        })

        this.showtotal = false

        this.selectdata = Object.assign({}, this.selectdata, res.data[0])

        this.$nextTick(() => {
          this.showtotal = true
        })
      },
      // 查询
      'search' () {
        // 关闭详细
        this.showtotal = false
        // 显示列表数据
        this.showData = true
        // 显示分页
        this.$refs.query.$refs.cp.pager = true
        // 调用查询
        this.$refs.query.$refs.cp.$refs.cri.search()
      },
      'loadPage' () {
        // 关闭详细
        this.showtotal = false
        // 显示列表数据
        this.showData = true
        // 显示分页
        this.$refs.query.$refs.cp.pager = true
        // 调用查询
        this.$refs.query.$refs.cp.loadPage(this.$refs.query.model.pageIndex)
      },
      // 点击功能操作
      'func' (funcdata, row) {
        this.selectdata = Object.assign({}, funcdata, row)
        this.isupload = funcdata.title === '图纸变更';
        console.log("当前按钮",funcdata.title)
        // 关闭分页
        this.$refs.query.$refs.cp.pager = false
        // 关闭列表数据
        this.showData = false

        this.$nextTick(() => {
          this.showtotal = true
        })
      }
    }
  }
</script>
<style scoped>
  /*清除浮动*/
  .clearfix:after,.clearfix:before{
    display: table;
  }
  .clearfix:after{
    clear: both;
  }
  .head{
    height: auto;
    font-weight: bold;
    color: #000000;
    font-family: 微软雅黑;
  }
</style>
