<template>
  <div>
    <list ref="list">
      <!--单位计量-->
      <unitAdd 
        type="add" 
        slot="unitAdd" 
        @unitAddSuccess="unitAddSuccess" 
        v-if="tool.checkAuth($route.name,'insert')" 
      />
      <template v-slot:unitEdit="scope">
        <unitAdd 
          type="edit"  
          @unitAddSuccess="unitAddSuccess" 
          :unitData="scope.data" 
          v-if="tool.checkAuth($route.name,'update')" 
        />
      </template>
      <template v-slot:unitDel="scope">
        <Del type="unit" 
          @deleteSuccess="UnitDeleteSuccess" 
          :id="scope.data.data.unitid"  
          v-if="tool.checkAuth($route.name,'delete')"
        />
      </template>
      <!--单位计量组-->
      <template v-slot:unitGroupAdd="scope">
        <unit-group-add 
          type="add" 
          @unitAddSuccess="unitGroupAddSuccess" 
          :allUnit="scope.data" 
          v-if="tool.checkAuth($route.name,'insert')" 
        />
      </template>
      <template v-slot:unitGroupEdit="scope">
        <unit-group-add 
          type="edit" 
          :unitData="scope.data.row" 
          @unitAddSuccess="unitGroupAddSuccess" 
          :allUnit="scope.data.unitList" 
          v-if="tool.checkAuth($route.name,'update')"
        />
      </template>
      <template v-slot:unitGroupDel="scope">
        <Del type="unitGroup" 
          @deleteSuccess="unitGroupDelSuccess" 
          :id="scope.data.unitgroupid" 
          v-if="tool.checkAuth($route.name,'delete')"
        />
      </template>
    </list>
  </div>
</template>

<script>
import list from './components/list'
import Del from './components/delete'
import unitAdd from './components/unitAdd'
import unitGroupAdd from './components/unitGroupAdd'
export default {
  name: '',
  data() {
    return {
    };
  },
  components:{list,Del,unitAdd,unitGroupAdd},
  computed:{
  },
  watch:{
  },
  created() {
  },
  methods: {
    /* 计量单位增加成功 */
    unitAddSuccess() {
      this.$refs.list.getUnit()
    },
    /* 计量单位删除成功 */
    UnitDeleteSuccess() {
      this.$refs.list.getUnit()
    },
    /* 计量组添加成功 */
    unitGroupAddSuccess() {
      this.$refs.list.getUnitGroup()
    },
    /* 计量组删除成功 */
    unitGroupDelSuccess() {
      this.$refs.list.getUnitGroup()
    },
  },
};
</script>

<style scoped>

</style>
