<!-- @desc:商品档案  @auth:常皓宁  @time:2024-1-31 14:56 -->
<template>
  <div class="main-div" ref="mainDiv">
    <loading :loading="loading" v-if="!modalVisible"></loading>
    <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
      <template #left>
        <!--    查询    -->
        <BaseIndexButton ref="search" name="search"></BaseIndexButton>
        <!--    清空条件    -->
        <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
        <!--    编辑    -->
        <BaseIndexButton ref="edit" name="edit"></BaseIndexButton>
        <!--    启用    -->
        <BaseIndexButton ref="enable" name="enable"></BaseIndexButton>
        <!--    停用    -->
        <BaseIndexButton ref="disable" name="disable"></BaseIndexButton>
      </template>
      <template #right>
        <!--   新建     -->
        <BaseIndexButton ref="add" name="add"></BaseIndexButton>
      </template>
    </BaseIndexButtonGroup>

    <!--  查询条件区域  -->
    <div id="search-cond-div" ref="search-cond-div" class="search-cond-class">
      <SearchCond ref="searchCond" v-model="searchCond"
                  @collapse-change="collapseChange" :setFlag="false"
                  :searchContent="searchContent"
      ></SearchCond>
    </div>

    <!--  表格部分  -->
    <div :style="'height: ' + (tableHeight + 30) + 'px'" class="split-div-class">
      <DkSplit v-model="split">
        <!-- 左边部分   -->
        <div slot="left" class="split-pane">
          <DkTree  :data="hgSpuCategoryList" :topCurrentFlag="true" style="margin-top: 5px" expandMode="one"
                   id="categoryId" parent-id="parentId" tree-node-name="categoryName" :height="tableHeight"></DkTree>
        </div>

        <!-- 右边部分   -->
        <DkTable slot="right" :id="'table-' + $options.name" ref="table-select" :data="tableData" :pageFlag="true"
                 :page-total="pageInfo.total" :current-page="pageInfo.currentPage" :choose-flag="false"
                 :height="this.tableHeight" primaryKey="typeId" @pageChange="pageSizeChange">
          <DkTableColumn field="编码"></DkTableColumn>
          <DkTableColumn field="名称"></DkTableColumn>
          <DkTableColumn field="flgValid" type="switch" ></DkTableColumn>
        </DkTable>
      </DkSplit>
    </div>
  </div>
</template>

<script>
import {indexMixin} from "@/mixins";

export default {
  name: 'goods-attr',
  mixins: [indexMixin],
  data(){
    let self = this
    return{
      split: 0.15,
      minSplit: 0.15,
      hgSpuCategoryList:[
      ],
      searchContent:
        [
          {
            itemCode: '商品名称',
          },
          {
            itemCode: '商品编码',
          },
          {
            itemCode: '唯一编码',
          },
          {
            itemCode: '商品品牌',
          },
        ],
    }
  },
  methods:{
    /**
     * @desc   : 新建按钮点击事件
     * @author : 常皓宁
     * @date   : 2024/1/31 9:19
     */
    add() {
      console.log('sdsdsds')
      this.$router.push('/core/goods/add')
    },

  },
  created() {
    this.primaryKey = 'goodsId'  // 设置主键Id
    this.routeObjName = 'goods'  // 设置路由名称
  },
  mounted() {
    this.hgSpuCategoryList = [
      {
        categoryId:0,
        categoryName:'全部分类',
        parentId:null
      },
      {
        categoryId:1,
        categoryName:'智能一体机',
        parentId:0
      },
      {
        categoryId:2,
        categoryName:'陶瓷坐便',
        parentId:0
      },
      {
        categoryId:3,
        categoryName:'浴室柜',
        parentId:0
      },
      {
        categoryId:4,
        categoryName:'定制浴室柜',
        parentId:0
      },
      {
        categoryId:5,
        categoryName:'花洒',
        parentId:0
      },
      {
        categoryId:6,
        categoryName:'淋浴房',
        parentId:0
      },
      {
        categoryId:7,
        categoryName:'龙头类',
        parentId:0
      },
      {
        categoryId:8,
        categoryName:'五金类',
        parentId:0
      },
      {
        categoryId:9,
        categoryName:'浴缸',
        parentId:0
      },
      {
        categoryId:10,
        categoryName:'配件',
        parentId:0
      },
    ]
  }
}
</script>

<style scoped>

</style>
