index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <el-dialog
  3. v-model="dialogFormVisible"
  4. title="导入记录"
  5. width="850px"
  6. @close="close"
  7. >
  8. <el-table
  9. ref="table"
  10. v-loading="listLoading"
  11. border
  12. :data="list"
  13. @selection-change="setSelectRows"
  14. @sort-change="onSortChange"
  15. >
  16. <el-table-column
  17. align="center"
  18. fixed="left"
  19. label="序号"
  20. type="index"
  21. width="55"
  22. />
  23. <el-table-column
  24. align="center"
  25. label="任务名称"
  26. min-width="200"
  27. prop="name"
  28. show-overflow-tooltip
  29. />
  30. <el-table-column
  31. align="center"
  32. label="操作时间"
  33. min-width="200"
  34. prop="created_at"
  35. show-overflow-tooltip
  36. />
  37. <el-table-column
  38. align="center"
  39. label="失败原因"
  40. min-width="100"
  41. prop="message"
  42. show-overflow-tooltip
  43. />
  44. <el-table-column
  45. align="center"
  46. label="执行结果"
  47. min-width="200"
  48. prop="result"
  49. show-overflow-tooltip
  50. />
  51. <el-table-column
  52. align="center"
  53. label="操作人员"
  54. min-width="100"
  55. prop="result"
  56. show-overflow-tooltip
  57. >
  58. <template #default="{ row }">
  59. {{ row.admin?.name }}
  60. </template>
  61. </el-table-column>
  62. <template #empty>
  63. <el-empty class="vab-data-empty" description="暂无数据" />
  64. </template>
  65. </el-table>
  66. <el-pagination
  67. background
  68. :current-page="queryForm.page"
  69. :layout="layout"
  70. :page-size="queryForm.per_page"
  71. :total="total"
  72. @current-change="handleCurrentChange"
  73. @size-change="handleSizeChange"
  74. />
  75. <template #footer>
  76. <el-button type="primary" @click="close">取 消</el-button>
  77. </template>
  78. </el-dialog>
  79. </template>
  80. <script>
  81. import { useUserStore } from '@/store/modules/user'
  82. import { getApi } from '@/api/api'
  83. export default defineComponent({
  84. name: 'RoleManagementEdit',
  85. emits: ['fetch-data'],
  86. setup(props, { emit }) {
  87. const state = reactive({
  88. formRef: null,
  89. title: '',
  90. list: [],
  91. listLoading: true,
  92. layout: 'total, sizes, prev, pager, next, jumper',
  93. total: 0,
  94. queryForm: {
  95. page: 1,
  96. per_page: 10,
  97. type: 'App\\\\Repositories\\\\Models\\\\Base\\\\Admin',
  98. },
  99. dialogFormVisible: false,
  100. })
  101. const showEdit = (type) => {
  102. state.queryForm.type = type
  103. getList()
  104. state.listLoading = false
  105. state.dialogFormVisible = true
  106. }
  107. const close = () => {
  108. state.dialogFormVisible = false
  109. }
  110. const userStore = useUserStore()
  111. const getList = async () => {
  112. state.queryForm.admin_id = userStore.id
  113. const {
  114. data: { data, meta },
  115. } = await getApi('/base/tasks', state.queryForm)
  116. state.list = data
  117. state.total = meta.pagination.total
  118. console.log('上传任务', data)
  119. }
  120. //切换当前页数据条数
  121. const handleSizeChange = (val) => {
  122. state.queryForm.per_page = val
  123. getList()
  124. }
  125. //切换页码
  126. const handleCurrentChange = (val) => {
  127. state.queryForm.page = val
  128. getList()
  129. }
  130. onMounted(() => {})
  131. return {
  132. ...toRefs(state),
  133. showEdit,
  134. getList,
  135. close,
  136. handleCurrentChange,
  137. handleSizeChange,
  138. }
  139. },
  140. })
  141. </script>
  142. <style lang="scss" scoped>
  143. .body {
  144. margin-bottom: 30px;
  145. }
  146. .title {
  147. font-size: 16px;
  148. font-weight: 550;
  149. color: #333333;
  150. margin-bottom: 10px;
  151. }
  152. .item {
  153. display: flex;
  154. padding: 7px 0;
  155. }
  156. .item-left {
  157. min-width: 100px;
  158. }
  159. </style>