<template>
  <div>
    <add-sale-class class="normal-margin" @addSuccess="getClassList" v-if="tool.checkAuth($route.name,'add_saleClass') && !detail"/>
    <tableLayout v-if="saleClassList" :layout="tablecols" :data="saleClassList" :custom="false" height="calc(100vh - 495px)" fixedName="operation">
      <template v-slot:opreation="scope">
        <Del v-if="tool.checkAuth($route.name,'delete')" :id="scope.data.sys_enterprise_saleclassid" @onSuccess="getClassList"/>
      </template>
    </tableLayout>
  </div>
</template>

<script>
import addSaleClass from './modules/addSaleClass'
import Del from './modules/del'
export default {
  name: '',
  inject: ['sys_enterpriseid'],
  data() {
    return {
      saleClassList:'',
      tablecols:[]
    };
  },
  props:['detail'],
  components:{addSaleClass,Del},
  computed:{
  },
  watch:{
  },
  created() {
    this.getClassList()
    this.tablecols = this.tool.tabelCol(this.$route.name)['saleClassTable'].tablecols
    if(this.detail) this.tablecols.pop()
  },
  methods: {
    /* 获取类别数据 */
    async getClassList() {
      let res = await this.$api.requested({
        "id": 20220924134502,
        "content": {
            "pageNumber": 1,
            "pageSize": 999999999,
            "sys_enterpriseid": this.sys_enterpriseid(),
            "where": {
                "condition": ""
            }
        },
      })
      console.log(res);
      this.saleClassList = res.data
    }
  },
};
</script>

<style scoped>

</style>
