index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!-- -->
  2. <template>
  3. <div class="personalInfo">
  4. <el-tabs v-model="activeName" tab-position="top" class="demo-tabs" @tab-click="handleClick">
  5. <el-tab-pane :label="item.label" :name="item.name" v-for="(item,index) in tabData" :key="index">
  6. <tables :requestApi="CompanyTree" :columns="columns" :initParam="initParam" v-if="item.name==activeName">
  7. <template #right="{ row }">
  8. <el-button link type="primary" size="small">编辑</el-button>
  9. <el-button link type="danger" size="small">删除</el-button>
  10. </template>
  11. </tables>
  12. </el-tab-pane>
  13. </el-tabs>
  14. </div>
  15. </template>
  16. <script setup lang="ts">
  17. import tables from "@/components/table.vue";
  18. import tableCustom from "@/components/tableCustom.vue";
  19. import { CompanyTree } from "@/api/index";
  20. import {ref} from "vue";
  21. import type { TabsPaneContext } from 'element-plus'
  22. const tabData = [
  23. { name: 'first', label: '疫苗名称' },
  24. { name: 'first1', label: '生产企业' },
  25. { name: 'first2', label: '规格' },
  26. { name: 'first3', label: '剂型' },
  27. { name: 'first4', label: '单位' },
  28. ]
  29. const activeName = ref('first')
  30. // 渲染表格
  31. const columns: any = [
  32. { type: 'index', label: '编号', width: 80, },
  33. { prop: 'T_D_name', label: '名称', width: 200 },
  34. { prop: 'operation', label: '操作', fixed: 'right', 'min-width': 200 }
  35. ]
  36. //请求参数
  37. const initParam = { T_name: '' }
  38. const handleClick = (tab: TabsPaneContext, event: Event) => {
  39. console.log(tab, event)
  40. }
  41. </script>
  42. <style lang="scss">
  43. /* @import url(); 引入css类 */
  44. .personalInfo {
  45. background: var(--y-card-background);
  46. padding: var(--y-padding);
  47. }
  48. </style>