index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div>
  3. <el-table
  4. :data="tableData"
  5. stripe
  6. ref="table"
  7. row-key="itemclassid"
  8. default-expand-all
  9. size="small"
  10. :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
  11. <el-table-column
  12. prop="itemclassname"
  13. show-overflow-tooltip
  14. :label="$t(`类别名称`)"
  15. width="300">
  16. <template slot-scope="scope">
  17. <el-checkbox v-model="scope.row.selected" :checked="scope.row.selected" @change="onRowSelect(scope.row)" :disabled="scope.row.disabled" style="margin-right: 5px"></el-checkbox>
  18. <span style="color:#3874f6"><b>{{scope.row.itemclassname}}</b></span>
  19. </template>
  20. </el-table-column>
  21. <el-table-column
  22. prop="brandname"
  23. :label="$t(`品牌`)">
  24. </el-table-column>
  25. </el-table>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. name: "index",
  31. props:["tableData"],
  32. data(){
  33. return {
  34. }
  35. },
  36. methods:{
  37. onRowSelect(row){
  38. this.$emit('rowSelect',row)
  39. },
  40. clearAll(){
  41. this.tableData.forEach(row => {
  42. row.selected = false
  43. row.children.forEach(item => {
  44. item.selected = false
  45. })
  46. })
  47. this.$refs.table.clearSelection()
  48. },
  49. },
  50. }
  51. </script>
  52. <style scoped>
  53. </style>