<!--
 * @Author: zhangyu
 * @Date: 2020-05-08 15:55:30
 * @Info:
 * @LastEditTime: 2020-05-18 11:25:20
 -->
<template>
  <div>
    <saga-toolbar ref="toolBar" @addbrand="handleAddBrand"></saga-toolbar>
    <div style="margin-top: 90px;">
      <saga-brand ref="sagaBrand" pageType="brand" @updatebrand="handleAddBrand"></saga-brand>
    </div>
    <addBrand ref="addBrand" :brand="brand" @refresh="brandListRefresh"></addBrand>
  </div>
</template>

<script>
import sagaBrand from "@/components/brand/sagaBrand"
import sagaToolbar from "@/components/brand/brandTool"
import addBrand from "@/components/business/addBrand";
export default {
  name: "brand",
  components: {
    sagaBrand,
    sagaToolbar,
    addBrand
  },
  created() {},
  mounted() {},
  data() {
    return {
      brand: {}, //选择的品牌对象
    }
  },
  methods: {
    handleAddBrand(brand) { //(添加/修改/删除品牌弹窗)
      if (brand && brand.BrandID) {
        this.brand = brand
      } else {
        this.brand = {}
      }
      this.$refs.addBrand.outerVisible = true
    },
    brandListRefresh() { //刷新品牌列表
      //清空搜索关键字
      this.$refs.sagaBrand.keyWord = ""
      this.$refs.toolBar.getBrandCount()
      this.$refs.sagaBrand.getBrandData()
    },
  }
}
</script>
<style lang="scss" scoped>

</style>
