<template>
  <div>
    <div class="container normal-panel normal-margin sticky">
      <save v-if="tool.checkAuth($route.name,'update') && headData.status === '待审核'" @onSave="onSave"></save>
      <onDel v-if="tool.checkAuth($route.name,'delete') && headData.status === '待审核'"></onDel>
      <onCheck v-if="tool.checkAuth($route.name,'check')" :status="headData.status" @onSuccess="onHeadSuccess"></onCheck>
      <switchData></switchData>
    </div>
    <billHead ref="bhead" @onHeadData="onHeadData"></billHead>
    <billBody ref="list">
      <body-add v-if="tool.checkAuth($route.name,'clue_insert') && headData.status === '待审核'" slot="add" @onSuccess="onSuccess"></body-add>
      <template v-slot:edit="scope">
        <body-edit v-if="tool.checkAuth($route.name,'clue_update') && headData.status === '待审核'" :data="scope.data.data" @onSuccess="onSuccess"></body-edit>
      </template>
      <template v-slot:del="scope">
        <body-del v-if="tool.checkAuth($route.name,'clue_delete') && headData.status === '待审核'" :data="scope.data.data" @onSuccess="onSuccess"></body-del>
      </template>
      <template></template>
    </billBody>
  </div>
</template>

<script>
import billHead from './modules/billHead.vue'
import billBody from './modules/billBody.vue'
import bodyEdit from './modules/body_edit.vue'
import bodyAdd from './modules/body_add.vue'
import bodyDel from './modules/body_del.vue'

import save from './modules/op_save.vue'
import onDel from './modules/op_del.vue'
import onCheck from './modules/op_check.vue'
import switchData from './modules/switchData.vue'

export default {
  components:{
    billHead,
    billBody,
    bodyEdit,
    bodyDel,
    bodyAdd,
    save,
    onDel,
    onCheck,
    switchData
  },
  data () {
    return {
      headData:{}
    }
  },
  methods:{
    onSuccess () {
      this.$refs['list'].listData()
    },
    onSave () {
      this.$refs['bhead'].updateOrderclueuploadbill()
    },
    onHeadSuccess () {
      this.$refs['bhead'].queryOrderclueuploadbillMain()
    },
    onHeadData (data) {
      this.headData = data
    }
  },
  mounted () {
  }
}

</script>
<style>
</style>