<template>
  <div class="flex-row">
    <div class="basic-main">
      <div :class="showData ? 'top' : 'auto'">
        <yiban-supervisory-list v-ref:query :show-data="showData"></yiban-supervisory-list>
      </div>
      <div v-if="showtotal" style="height: 89%">
        <div class="col-sm-2" style="margin-top: 20px">
          <new-supervisory-chart :selectdata="selectdata"></new-supervisory-chart>
        </div>
        <div class="col-sm-10" style="margin-top: 20px">
          <tabset v-ref:tabs :close="false">
            <tab :header='selectdata.defname'>
              <supervisory-service-control :selectdata="selectdata" :node-snapshot="true"></supervisory-service-control>
            </tab>
            <tab header='附件'>
              <apply-upload :blodid="selectdata.f_process_id"
                            :isupload = "projectStart"
                            :isdelete="false"
                            :isusetype="true"
                            :isremark = "true"
                            :takeimg="false"
                            :issearch="true"
                            :defname="selectdata.defname">
              </apply-upload>
            </tab>
          </tabset>
        </div>
      </div>
    </div>
  </div>

</template>
<script>
  import Vue from 'vue'
  import {HttpResetClass} from 'vue-client'
  export default {
    title: '已办列表',
    data () {
      return {
        showtotal: false, // 控制详细信息显示
        showData: true,
        selectdata: {},
        xmlname: '' // 配置文件名称
      }
    },
    created () {
    },
    methods: {
      // 获取页面配置json文件
      async loadName () {
        let http = new HttpResetClass()
        let data = {
          workname: this.selectdata.processname
        }
       let res=  await http.load('POST', 'rs/logic/ApplyGetConfigs', {
          data
        }, {resolveMsg: null, rejectMsg: null})
        Vue.prototype.$workflow_vue = res.data
      }
    },
    events: {
      'onMessage' (data) {
        console.log('接收消息')
        console.log(data)
        if (data.type === 'apply-task') {
          this.$refs.queryuser.$refs.cp.$refs.cri.search()
        }
      },
      async 'apply' (val) {
        this.selectdata = val
        this.showtotal = false

        // 获取配置文件
        await this.loadName()

        this.$refs.query.$refs.cp.pager = false
        this.showData = false

        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)
      }
    },
    computed: {
      projectStart () {
        return this.$login.r.includes('报装文件上传')
      }
    },
    watch: {
    }
  }
</script>
