<template>
  <div class="flex-row">
    <div class="basic-main">
      <div :class="showData ? 'top' : 'auto'" v-if="!showtotal">
        <ignition-list v-ref:query :show-data="showData"></ignition-list>
      </div>
      <div v-if="showtotal">
        <div class="top">
          <ignition-list-manage :show-data="selectdata" :node-snapshot="true"></ignition-list-manage>
        </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)
    }
  },

  watch: {
  }
}
</script>
