imageRecordList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div>
  3. <div class="gva-search-box">
  4. <el-form ref="searchForm" :inline="true" :model="searchInfo">
  5. <el-form-item label="日期" prop="date">
  6. <el-date-picker v-model="searchInfo.date" size="default" type="daterange" unlink-panels
  7. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :disabled-date="disabledDate"
  8. :shortcuts="shortcuts" />
  9. </el-form-item>
  10. <el-form-item label="任务Id">
  11. <el-input v-model="searchInfo.task_id" placeholder="任务ID" />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
  15. <el-button size="small" icon="refresh" @click="onReset">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. </div>
  19. <div class="gva-table-box">
  20. <el-table :data="tableData" @sort-change="sortChange" @selection-change="handleSelectionChange">
  21. <el-table-column type="selection" width="55" />
  22. <el-table-column align="left" label="任务id" min-width="100" prop="task_id" sortable="custom" />
  23. <el-table-column align="left" label="账号" min-width="150" prop="account" />
  24. <el-table-column align="left" label="状态" min-width="100" prop="status">
  25. <template #default="scope">
  26. <div>
  27. {{ statusFiletr(scope.row.status) }}
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column align="left" label="结果" min-width="100" prop="result" />
  32. <el-table-column align="left" label="创建日期" min-width="100" prop="create_date" sortable="custom" />
  33. </el-table>
  34. <div class="gva-pagination">
  35. <el-pagination :current-page="page" :page-size="pageSize" :page-sizes="[10, 30, 50, 100]" :total="total"
  36. layout="total, sizes, prev, pager, next, jumper" @current-change="handleCurrentChange"
  37. @size-change="handleSizeChange" />
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. name: 'ImageRecordList',
  45. }
  46. </script>
  47. <script setup>
  48. import {
  49. getImageRecordList
  50. } from '@/api/imageRecord'
  51. import { toSQLLine } from '@/utils/stringFun'
  52. import { ref } from 'vue'
  53. import { ElMessage, ElMessageBox } from 'element-plus'
  54. import warningBar from '@/components/warningBar/warningBar.vue'
  55. import dayjs from "dayjs";
  56. const apis = ref([])
  57. const page = ref(1)
  58. const total = ref(0)
  59. const pageSize = ref(10)
  60. const tableData = ref([])
  61. const searchInfo = ref({})
  62. const onReset = () => {
  63. searchInfo.value = {}
  64. getTableData()
  65. }
  66. const statusFiletr = (value) => {
  67. const target = statusOptions.value.filter(item => item.value === value)[0]
  68. return target && `${target.label}`
  69. }
  70. const statusOptions = ref([
  71. {
  72. value: 1,
  73. label: '成功'
  74. },
  75. {
  76. value: 2,
  77. label: '未识别'
  78. },
  79. {
  80. value: -1,
  81. label: '失败'
  82. }
  83. ])
  84. // 搜索
  85. const onSubmit = () => {
  86. page.value = 1
  87. pageSize.value = 10
  88. searchInfo.value.task_id = Number(searchInfo.value.task_id)
  89. if (typeof searchInfo.value.date != "undefined") {
  90. searchInfo.value.date[0] = dayjs(searchInfo.value.date[0]).format(
  91. "YYYY-MM-DD"
  92. );
  93. searchInfo.value.date[1] = dayjs(searchInfo.value.date[1]).format(
  94. "YYYY-MM-DD"
  95. );
  96. }
  97. getTableData()
  98. }
  99. // 分页
  100. const handleSizeChange = (val) => {
  101. pageSize.value = val
  102. getTableData()
  103. }
  104. const handleCurrentChange = (val) => {
  105. page.value = val
  106. getTableData()
  107. }
  108. // 排序
  109. const sortChange = ({ prop, order }) => {
  110. if (prop) {
  111. if (prop === 'id') {
  112. prop = 'id'
  113. }
  114. searchInfo.value.orderKey = toSQLLine(prop)
  115. searchInfo.value.desc = order === 'descending'
  116. }
  117. getTableData()
  118. }
  119. // 查询
  120. const getTableData = async () => {
  121. const table = await getImageRecordList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  122. if (table.code === 0) {
  123. tableData.value = table.data.list
  124. total.value = table.data.total
  125. page.value = table.data.page
  126. pageSize.value = table.data.pageSize
  127. }
  128. }
  129. getTableData()
  130. // }
  131. // const closeDialog = () => {
  132. // dialogFormVisible.value = false
  133. // }
  134. const dialogTitle = ref('')
  135. const type = ref('')
  136. const dialogFormVisible = ref(false)
  137. // 批量操作
  138. const handleSelectionChange = (val) => {
  139. apis.value = val
  140. }
  141. // 弹窗相关
  142. // const apiForm = ref(null)
  143. // const initForm = () => {
  144. // apiForm.value.resetFields()
  145. // form.value = {
  146. // game_name: '',
  147. // game_package_name: ''
  148. // }
  149. // }
  150. </script>
  151. <style scoped lang="scss">
  152. .button-box {
  153. padding: 10px 20px;
  154. .el-button {
  155. float: right;
  156. }
  157. }
  158. .warning {
  159. color: #dc143c;
  160. }
  161. </style>