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.

55 lines
1.1 KiB

  1. <script setup lang="ts">
  2. import { getPointList } from 'apis/point'
  3. import FtButton from 'components/common/FTButton/index.vue'
  4. import Edit from 'components/point/Edit/index.vue'
  5. import { cloneDeep } from 'lodash'
  6. import { h, provide, ref } from 'vue'
  7. const upDataVisible = ref(false)
  8. const currentData = ref<Point.Point>()
  9. provide('currentData', currentData)
  10. const columns = [
  11. {
  12. title: '名称',
  13. key: 'name',
  14. },
  15. {
  16. title: '类型',
  17. key: 'type',
  18. },
  19. {
  20. title: '坐标',
  21. key: 'position',
  22. },
  23. {
  24. title: '操作',
  25. fixed: 'right',
  26. width: 120,
  27. render: (row: any) => {
  28. return h(
  29. FtButton,
  30. {
  31. class: ['table-cell-mouse-on'],
  32. id: row.id,
  33. onClick: () => {
  34. upDataVisible.value = true
  35. currentData.value = cloneDeep(row)
  36. },
  37. },
  38. { default: () => '编辑' },
  39. )
  40. },
  41. },
  42. ]
  43. </script>
  44. <template>
  45. <div>
  46. <FtTable :columns="columns" :get-data-fn="getPointList" />
  47. <Edit v-if="upDataVisible" @ok="upDataVisible = false" @cancel="upDataVisible = false" />
  48. </div>
  49. </template>
  50. <style scoped lang="scss">
  51. </style>