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.

162 lines
5.7 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
4 weeks 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 canLook = ref(findMenuById(menuTree.value, permissionMapping.new_version_gold_query))
  55. const tableData = ref([])
  56. const dateRange = ref([])
  57. const searchObj = ref({
  58. name: '',
  59. jwcode: ''
  60. })
  61. const pagination = ref({
  62. pageNum: 1,
  63. pageSize: 50,
  64. total: 0
  65. })
  66. //获取新表数据
  67. const get = async function () {
  68. if(!canLook.value){
  69. ElMessage.error('无此权限')
  70. return
  71. }
  72. try {
  73. if (searchObj.value.name || searchObj.value.jwcode) {
  74. const startTime = dateRange.value && dateRange.value[0] ? moment(dateRange.value[0]).format('YYYY-MM-DD HH:mm:ss') : ""
  75. const endTime = dateRange.value && dateRange.value[1] ? moment(dateRange.value[1]).format('YYYY-MM-DD HH:mm:ss') : ""
  76. const res = await API({
  77. url: '/history/getNewHistoryRecord',
  78. data: {
  79. ...searchObj.value,
  80. startTime: startTime,
  81. endTime: endTime,
  82. pageNum: pagination.value.pageNum,
  83. pageSize: pagination.value.pageSize,
  84. }
  85. })
  86. if (res.code == 200) {
  87. ElMessage.success('查询成功')
  88. tableData.value = res.data.list
  89. console.log('tableData.value', res.data.list)
  90. pagination.value.total = res.data.total
  91. }
  92. } else {
  93. ElMessage.error('请输入姓名或精网号')
  94. return
  95. }
  96. } catch (e) {
  97. ElMessage.error(e.message)
  98. }
  99. }
  100. const resetSearch = function () {
  101. searchObj.value = {
  102. name: '',
  103. jwcode: ''
  104. }
  105. dateRange.value = []
  106. }
  107. const handlePageSizeChange = function (val) {
  108. pagination.value.pageSize = val
  109. get()
  110. }
  111. const handleCurrentChange = function (val) {
  112. pagination.value.pageNum = val
  113. get()
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. .pagination {
  118. display: flex;
  119. margin-top: 1vh;
  120. }
  121. // 搜索的卡片样式
  122. .card1 {
  123. background: #F3FAFE;
  124. }
  125. // 表单的卡片样式
  126. .card2 {
  127. background: #E7F4FD;
  128. }
  129. // 表头背景等
  130. :deep(.el-table__header-wrapper),
  131. :deep(.el-table__body-wrapper),
  132. :deep(.el-table__cell),
  133. /* 表格 */
  134. :deep(.el-table__body td) {
  135. background-color: #F3FAFE !important;
  136. }
  137. /* 表头 */
  138. :deep(.el-table__header th) {
  139. background-color: #F3FAFE !important;
  140. }
  141. /* 鼠标悬停 */
  142. :deep(.el-table__row:hover > .el-table__cell) {
  143. background-color: #E5EBFE !important;
  144. }
  145. </style>