You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <el-card class="card1">
  3. <el-text size="large">姓名</el-text>
  4. <el-input v-model="searchObj.name" placeholder="请输入姓名" style="width: 12vw;margin-right:1vw"
  5. clearable></el-input>
  6. <el-text size="large">精网号</el-text>
  7. <el-input v-model="searchObj.jwcode" placeholder="请输入精网号" style="width: 12vw;margin-right:1vw"
  8. clearable></el-input>
  9. <el-text size="large" style="width: 80px">更新时间</el-text>
  10. <el-date-picker v-model="dateRange" type="datetimerange" :default-time="defaultTime" range-separator=""
  11. start-placeholder="开始时间" end-placeholder="结束时间" style="width: 25vw;margin-right:1vw" />
  12. <el-button type="primary" @click="get">查询</el-button>
  13. <el-button type="success" @click="resetSearch">重置</el-button>
  14. </el-card>
  15. <el-card class="card2" style="margin-top:10px" v-show="tableData.length > 0">
  16. <el-table :data="tableData" style="width: 82vw;height:60vh">
  17. <el-table-column type="index" label="序号" width="100" header-align="center" align="center">
  18. <template #default="scope">
  19. {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="name" label="客户姓名" width="180" show-overflow-tooltip />
  23. <el-table-column prop="jwcode" label="精网号" width="180" header-align="center" align="center" />
  24. <el-table-column prop="num" label="数量" width="180" header-align="center" align="center" />
  25. <el-table-column prop="updateType" show-overflow-tooltip label="更新类型" width="180" align="center" />
  26. <el-table-column prop="freeGold" label="免费金币" width="180" align="center" />
  27. <el-table-column prop="permanentGold" label="永久金币" width="180" align="center" />
  28. <el-table-column prop="taskGold" label="任务金币" width="180" align="center" />
  29. <el-table-column prop="operator" label="操作人" width="180" />
  30. <el-table-column prop="createTime" label="更新时间" width="200" header-align="center" align="center" />
  31. <el-table-column prop="remark" label="备注" show-overflow-tooltip width="200" align="center" />
  32. </el-table>
  33. <el-pagination background style="margin-top:20px" v-model:current-page="pagination.pageNum"
  34. v-model:page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper"
  35. :total="pagination.total" @size-change="handlePageSizeChange"
  36. @current-change="handleCurrentChange"></el-pagination>
  37. </el-card>
  38. </template>
  39. <script setup>
  40. import { onMounted, ref } from 'vue'
  41. import { ElMessage } from 'element-plus'
  42. import API from '@/util/http.js'
  43. import moment from 'moment'
  44. import { useAdminStore } from "@/store/index.js"
  45. import { storeToRefs } from "pinia"
  46. import dayjs from 'dayjs'
  47. const adminStore = useAdminStore()
  48. const { adminData, menuTree } = storeToRefs(adminStore)
  49. import { permissionMapping, findMenuById } from "@/utils/menuTreePermission.js"
  50. const defaultTime = [
  51. new Date(2000, 1, 1, 0, 0, 0),
  52. new Date(2000, 2, 1, 23, 59, 59),
  53. ]
  54. const tableData = ref([])
  55. const dateRange = ref([])
  56. const searchObj = ref({
  57. name: '',
  58. jwcode: ''
  59. })
  60. const pagination = ref({
  61. pageNum: 1,
  62. pageSize: 50,
  63. total: 0
  64. })
  65. //获取新表数据
  66. const get = async function () {
  67. try {
  68. if (searchObj.value.name || searchObj.value.jwcode) {
  69. const startTime = dateRange.value && dateRange.value[0] ? moment(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : ""
  70. const endTime = dateRange.value && dateRange.value[1] ? moment(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : ""
  71. const res = await API({
  72. url: '/history/getNewHistoryRecord',
  73. data: {
  74. ...searchObj.value,
  75. startTime: startTime,
  76. endTime: endTime,
  77. pageNum: pagination.value.pageNum,
  78. pageSize: pagination.value.pageSize,
  79. }
  80. })
  81. if (res.code == 200) {
  82. ElMessage.success('查询成功')
  83. tableData.value = res.data.list
  84. console.log('tableData.value', res.data.list)
  85. pagination.value.total = res.data.total
  86. }
  87. } else {
  88. ElMessage.error('请输入姓名或精网号')
  89. return
  90. }
  91. } catch (e) {
  92. ElMessage.error(e.message)
  93. }
  94. }
  95. const resetSearch = function () {
  96. searchObj.value = {
  97. name: '',
  98. jwcode: ''
  99. }
  100. dateRange.value = []
  101. }
  102. const handlePageSizeChange = function (val) {
  103. pagination.value.pageSize = val
  104. get()
  105. }
  106. const handleCurrentChange = function (val) {
  107. pagination.value.pageNum = val
  108. get()
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. .pagination {
  113. display: flex;
  114. margin-top: 1vh;
  115. }
  116. // 搜索的卡片样式
  117. .card1 {
  118. background: #F3FAFE;
  119. }
  120. // 表单的卡片样式
  121. .card2 {
  122. background: #E7F4FD;
  123. }
  124. // 表头背景等
  125. :deep(.el-table__header-wrapper),
  126. :deep(.el-table__body-wrapper),
  127. :deep(.el-table__cell),
  128. /* 表格 */
  129. :deep(.el-table__body td) {
  130. background-color: #F3FAFE !important;
  131. }
  132. /* 表头 */
  133. :deep(.el-table__header th) {
  134. background-color: #F3FAFE !important;
  135. }
  136. /* 鼠标悬停 */
  137. :deep(.el-table__row:hover > .el-table__cell) {
  138. background-color: #E5EBFE !important;
  139. }
  140. </style>