inferResult.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="trainResult-container">
  3. <h4>推理结果</h4>
  4. <div class="table">
  5. <ProTable
  6. ref="proTable"
  7. row-key="userId"
  8. :indent="20"
  9. :columns="columns"
  10. :tool-button="false"
  11. :data="tableData"
  12. :request-auto="false"
  13. :init-param="initParam"
  14. :search-col="{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3 }"
  15. >
  16. <template #yuan="scope">
  17. <el-image
  18. style="width: 100px; height: 100px"
  19. :preview-src-list="[getImageUrl(scope.row.yuan)]"
  20. :src="getImageUrl(scope.row.yuan)"
  21. :z-index="9999"
  22. />
  23. </template>
  24. <template #algo1="scope">
  25. <el-image
  26. style="width: 100px; height: 100px"
  27. :preview-src-list="[getImageUrl(scope.row.algo1)]"
  28. :src="getImageUrl(scope.row.algo1)"
  29. :z-index="9999"
  30. />
  31. </template>
  32. <template #algo2="scope">
  33. <el-image
  34. style="width: 100px; height: 100px"
  35. :preview-src-list="[getImageUrl(scope.row.algo2)]"
  36. :src="getImageUrl(scope.row.algo2)"
  37. :z-index="9999"
  38. />
  39. </template>
  40. <template #algo3="scope">
  41. <el-image
  42. style="width: 100px; height: 100px"
  43. :preview-src-list="[getImageUrl(scope.row.algo3)]"
  44. :src="getImageUrl(scope.row.algo3)"
  45. :z-index="9999"
  46. />
  47. </template>
  48. <template #algo4="scope">
  49. <el-image
  50. style="width: 100px; height: 100px"
  51. :preview-src-list="[getImageUrl(scope.row.algo3)]"
  52. :src="getImageUrl(scope.row.algo4)"
  53. :z-index="9999"
  54. />
  55. </template>
  56. </ProTable>
  57. <el-button class="btn" @click="goBack()"> 上一步 </el-button>
  58. <el-button class="btn next" type="success" @click="goHome()"> 返回首页 </el-button>
  59. </div>
  60. </div>
  61. </template>
  62. <script setup lang="tsx" name="trainResult">
  63. import { onMounted, reactive, ref } from 'vue'
  64. import { useRouter } from 'vue-router'
  65. import ProTable from '@/components/ProTable/index.vue'
  66. import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
  67. import { deptTreeSelectApi } from '@/api/modules/system/user'
  68. import { getInferList } from '@/api/modules/taais/task'
  69. const tableData = getInferList()
  70. const router = useRouter()
  71. onMounted(() => {
  72. getTreeFilter()
  73. })
  74. const getImageUrl = name => {
  75. return new URL(`../../../assets/taaisImg/${name}`, import.meta.url).href
  76. }
  77. // ProTable 实例
  78. const proTable = ref<ProTableInstance>()
  79. // 如果表格需要初始化请求参数,直接定义传给 ProTable(之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
  80. const initParam = reactive({ deptId: '' })
  81. // 获取 treeFilter 数据
  82. // 当 proTable 的 requestAuto 属性为 false,不会自动请求表格数据,等待 treeFilter 数据回来之后,更改 initParam.departmentId 的值,才会触发请求 proTable 数据
  83. const treeFilterData = ref<any>([])
  84. const getTreeFilter = async () => {
  85. const { data } = await deptTreeSelectApi()
  86. treeFilterData.value = data
  87. initParam.deptId = treeFilterData.value[0].id
  88. }
  89. // 表格配置项
  90. const columns = reactive<ColumnProps<any>[]>([
  91. { prop: 'yuan', label: '原图' },
  92. { prop: 'algo1', label: '算法1推理' },
  93. { prop: 'algo2', label: '算法2推理' },
  94. { prop: 'algo3', label: '算法3推理' },
  95. { prop: 'algo4', label: '算法4推理' }
  96. ])
  97. const goHome = () => {
  98. router.push(`/index`)
  99. }
  100. const goBack = () => {
  101. router.push(`/logPage/1`)
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. @import './index.scss';
  106. </style>