<template>
  <div>
    <add-sale-class class="normal-margin" :data="data" @addSuccess="getClassList" v-if="tool.checkAuth($route.name,'classAdd') "/>
    <tableLayout  :layout="tablecols" :data="saleClassList" :custom="false" height="calc(100vh - 405px)" fixedName="operation">
      <template v-slot:opreation="scope">
        <Del v-if="tool.checkAuth($route.name,'classDel')" :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 {
  props:['data','detail'],
  data() {
    return {
      saleClassList:[],
      tablecols:[],
      param:{}
    };
  },
  components:{addSaleClass,Del},
  computed:{
  },
  created() {
    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": 1000,
            "sys_enterpriseid": this.data.sys_enterpriseid,
            "where": {
                "condition": ""
            }
        },
      })
      this.saleClassList = res.data
    }
  },
  mounted() {
    this.getClassList()
  },
  watch:{
    data (val) {
      this.param = val
      this.getClassList()
    }
  },
};
</script>

<style scoped>

</style>
