You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

6 months ago
  1. <template>
  2. <div>
  3. <div v-for="(item, index) in TABLE_DATA_MAP[tableName]" :key="index + item">
  4. <el-table-column
  5. :label="item.label"
  6. :key="index + item"
  7. :min-width="item.width"
  8. :sortable="item.sortable"
  9. :prop="item.key"
  10. show-overflow-tooltip
  11. >
  12. <template slot-scope="scope">
  13. <span v-if="!item.hidden">{{ scope.row[item.key] }}</span>
  14. <span v-if="item.Dict">{{ item.Dict[scope.row[item.key]] }}</span>
  15. <span
  16. v-if="item.isFixedTwo"
  17. >{{ toFixedTwo(scope.row[item.molecule], scope.row[item.denominator]) }}</span>
  18. <span
  19. v-if="item.isPercent"
  20. >{{ toPercent(scope.row[item.molecule], scope.row[item.denominator]) }}</span>
  21. </template>
  22. </el-table-column>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import {TABLE_DATA_MAP} from "@/utils/tableData";
  28. export default {
  29. name: "table-column",
  30. props: {
  31. tableName: String
  32. },
  33. data() {
  34. return {
  35. TABLE_DATA_MAP
  36. }
  37. }
  38. }
  39. </script>
  40. <style scoped>
  41. </style>