index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!-- 签到记录 -->
  2. <template>
  3. <ContentWrap v-hasPermi="['menduner:reward:sign-in-record:query']">
  4. <!-- 搜索工作栏 -->
  5. <el-form
  6. class="-mb-15px"
  7. :model="queryParams"
  8. ref="queryFormRef"
  9. :inline="true"
  10. label-width="68px"
  11. >
  12. <el-form-item label="签到用户" prop="userId">
  13. <el-input
  14. v-model="queryParams.userId"
  15. placeholder="请输入签到用户"
  16. clearable
  17. @keyup.enter="handleQuery"
  18. class="!w-240px"
  19. />
  20. </el-form-item>
  21. <el-form-item label="签到天数" prop="day">
  22. <el-input
  23. v-model="queryParams.day"
  24. placeholder="请输入签到天数"
  25. clearable
  26. @keyup.enter="handleQuery"
  27. class="!w-240px"
  28. />
  29. </el-form-item>
  30. <el-form-item label="签到时间" prop="createTime">
  31. <el-date-picker
  32. v-model="queryParams.createTime"
  33. value-format="YYYY-MM-DD HH:mm:ss"
  34. type="daterange"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期"
  37. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  38. class="!w-240px"
  39. />
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  43. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. </ContentWrap>
  47. <!-- 列表 -->
  48. <ContentWrap>
  49. <el-table v-loading="loading" :data="list">
  50. <el-table-column label="编号" align="center" prop="id" />
  51. <el-table-column label="签到用户" align="center" prop="userId" />
  52. <el-table-column
  53. label="签到天数"
  54. align="center"
  55. prop="day"
  56. :formatter="(_, __, cellValue) => ['第', cellValue, '天'].join(' ')"
  57. />
  58. <el-table-column label="获得积分" align="center" prop="point" width="100">
  59. <template #default="scope">
  60. <el-tag v-if="scope.row.point > 0" class="ml-2" type="success" effect="dark">
  61. +{{ scope.row.point }}
  62. </el-tag>
  63. <el-tag v-else class="ml-2" type="danger" effect="dark"> {{ scope.row.point }} </el-tag>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. label="签到时间"
  68. align="center"
  69. prop="createTime"
  70. :formatter="dateFormatter"
  71. />
  72. </el-table>
  73. <!-- 分页 -->
  74. <Pagination
  75. :total="total"
  76. v-model:page="queryParams.pageNo"
  77. v-model:limit="queryParams.pageSize"
  78. @pagination="getList"
  79. />
  80. </ContentWrap>
  81. </template>
  82. <script lang="ts" setup>
  83. import { dateFormatter } from '@/utils/formatTime'
  84. import * as SignInRecordApi from '@/api/menduner/member/signinRecord/index'
  85. defineOptions({ name: 'MemberSigninRecord' })
  86. const loading = ref(true) // 列表的加载中
  87. const total = ref(0) // 列表的总页数
  88. const list = ref([]) // 列表的数据
  89. const queryParams = reactive({
  90. pageNo: 1,
  91. pageSize: 10,
  92. userId: null,
  93. day: null,
  94. createTime: []
  95. })
  96. const queryFormRef = ref() // 搜索的表单
  97. /** 查询列表 */
  98. const getList = async () => {
  99. loading.value = true
  100. try {
  101. const data = await SignInRecordApi.getSignInRecordPage(queryParams)
  102. list.value = data.list
  103. total.value = data.total
  104. } finally {
  105. loading.value = false
  106. }
  107. }
  108. /** 搜索按钮操作 */
  109. const handleQuery = () => {
  110. queryParams.pageNo = 1
  111. getList()
  112. }
  113. /** 重置按钮操作 */
  114. const resetQuery = () => {
  115. queryFormRef.value.resetFields()
  116. handleQuery()
  117. }
  118. /** 初始化 **/
  119. onMounted(() => {
  120. getList()
  121. })
  122. </script>