index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div class="layout-pd">
  3. <el-row>
  4. <!--操作-->
  5. <el-col :xs="24">
  6. <el-card class="mt8" shadow="hover">
  7. <el-form :model="Data.Filter" @submit.stop.prevent>
  8. <el-form-item prop="name" style="width: 100%">
  9. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  10. <el-form-item label="用户名">
  11. <el-input v-model="Data.Filter.name" placeholder="用户名" clearable></el-input>
  12. </el-form-item>
  13. </el-col>
  14. </el-form-item>
  15. </el-form>
  16. <hr>
  17. <!-- 按钮 -->
  18. <el-row justify="space-between" class="submit-button" style="margin-bottom:-7px">
  19. <el-row>
  20. <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
  21. <el-button type="primary" icon="ele-RefreshRight" @click="onReset"> 重置 </el-button>
  22. </el-row>
  23. </el-row>
  24. </el-card>
  25. </el-col>
  26. <!--表格-->
  27. <el-col :xs="24">
  28. <el-card style="height: 55vh" class="my-fill mt8" shadow="hover">
  29. <el-table ref="multipleTableRef" v-loading="Data.loading" stripe :data="Data.tableModel" row-key="id"
  30. style="width: 100%">
  31. <el-table-column v-for="column in Data.dynamicColumns" :key="column.prop" :prop="column.prop"
  32. :label="column.label" />
  33. </el-table>
  34. <div class="my-flex my-flex-end" style="margin-top: 20px">
  35. <el-pagination v-model:currentPage="Data.pageInput.currentPage" v-model:page-size="Data.pageInput.pageSize"
  36. :total="Data.total" :page-sizes="[10, 20, 50, 100]" small background @size-change="onSizeChange"
  37. @current-change="onCurrentChange" layout="total, sizes, prev, pager, next, jumper" />
  38. </div>
  39. </el-card>
  40. </el-col>
  41. </el-row>
  42. <EditDialog ref="editDialogRef" />
  43. <AuditDialog ref="auditDialogRef" />
  44. </div>
  45. </template>
  46. <script setup lang="ts" name="authorize/fuelingsdk">
  47. import { onMounted, reactive } from "vue";
  48. import { ElTable } from 'element-plus'
  49. import { associationFilterModel_SearchFilter, associationFilterModel, PageInputAssociationFilterModel } from "/@/api/admin/reportManagement/association/associationDto";
  50. import { AssociationApi } from "/@/api/admin/reportManagement/association/associationApi";
  51. /**页面对象 */
  52. const Data = reactive({
  53. time: '',
  54. /**加载显示 */
  55. loading: false,
  56. /**条件查询模块 */
  57. Filter: {
  58. name: "",
  59. } as associationFilterModel_SearchFilter,
  60. /**表格信息 */
  61. tableModel: [] as Array<associationFilterModel>,
  62. /**动态表头 */
  63. dynamicColumns: [
  64. { prop: 'name', label: '用户名' },
  65. { prop: 'email', label: '邮箱' },
  66. { prop: 'mobile', label: '手机号码' },
  67. { prop: 'createdDate', label: '创建时间' },
  68. { prop: 'modifiedDate', label: '修改时间' },
  69. { prop: 'disable', label: '是否启用用户' },
  70. { prop: 'isLock', label: '账户是否锁定' },
  71. ],
  72. /**分页标识 */
  73. pageInput: {
  74. currentPage: 1,
  75. pageSize: 10,
  76. } as PageInputAssociationFilterModel,
  77. /**分页总数 */
  78. total: 0,
  79. })
  80. /**初始化 */
  81. const init = async () => {
  82. Data.loading = true
  83. const res: any = await new AssociationApi().getPage({ ...Data.pageInput, filter: Data.Filter })
  84. console.log(Data.Filter)
  85. Data.tableModel = res?.data ?? []
  86. Data.total = res?.length ?? 0
  87. Data.loading = false
  88. }
  89. onMounted(() => {
  90. init()
  91. })
  92. /**条件查询 */
  93. const onQuery = () => {
  94. init()
  95. }
  96. /**重置查询条件 */
  97. const resetQuery = () => {
  98. Data.Filter.name = ''
  99. Data.pageInput.currentPage = 1
  100. Data.pageInput.pageSize = 10
  101. }
  102. /**重置 */
  103. const onReset = () => {
  104. resetQuery()
  105. init()
  106. }
  107. /**
  108. * 页条变化
  109. * @param val
  110. */
  111. const onSizeChange = (val: number) => {
  112. Data.pageInput.pageSize = val
  113. init()
  114. }
  115. /**
  116. * 页数 变化
  117. * @param val
  118. */
  119. const onCurrentChange = (val: number) => {
  120. Data.pageInput.currentPage = val
  121. init()
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. .el-input,
  126. .el-select {
  127. width: 240px;
  128. }
  129. /* 输入框标签固定四个字符宽度 */
  130. ::v-deep .el-form-item__label {
  131. // 字体大小14,4个字符,12px右间距
  132. width: 14*4px+12px;
  133. justify-content: start;
  134. }
  135. /* 数据表头 设置灰色样式 */
  136. ::v-deep .el-table th.el-table__cell {
  137. background-color: #F6F6F6;
  138. }
  139. </style>