diff --git a/src/views/audit/gold/rechargeAudit.vue b/src/views/audit/gold/rechargeAudit.vue index d73b3c8..94b707c 100644 --- a/src/views/audit/gold/rechargeAudit.vue +++ b/src/views/audit/gold/rechargeAudit.vue @@ -195,6 +195,7 @@ import moment from 'moment' import {useAdminStore} from "@/store/index.js"; import {storeToRefs} from "pinia"; import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" +import dayjs from "dayjs"; // 精网号去空格 const trimJwCode = () => { if (rechargeAudit.value.jwcode) { @@ -389,17 +390,10 @@ const resetSearch = function () { // 今天 const getToday = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + const today = dayjs() + const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') + getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'today' // 标记当前激活状态 @@ -409,18 +403,11 @@ const getToday = function () { // 昨天 const getYesterday = function () { - const yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - const startTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() - ) - const endTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() + 1 - ) + + const today = dayjs() + const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') + getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'yesterday' // 标记当前激活状态 @@ -430,17 +417,10 @@ const getYesterday = function () { // 近7天 const get7Days = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - 6 - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + + const today = dayjs() + const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.add(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = '7days' // 标记当前激活状态 diff --git a/src/views/audit/gold/refundAudit.vue b/src/views/audit/gold/refundAudit.vue index cce6768..50fb69b 100644 --- a/src/views/audit/gold/refundAudit.vue +++ b/src/views/audit/gold/refundAudit.vue @@ -336,6 +336,7 @@ const get = async function (val) { import {useAdminStore} from "@/store/index.js"; import {storeToRefs} from "pinia"; import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" +import dayjs from "dayjs"; const adminStore = useAdminStore(); const {menuTree} = storeToRefs(adminStore); @@ -450,9 +451,9 @@ const resetSearch = function () { // 今天 const getToday = function () { - const today = new Date() - const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate()) - const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1) + const today = dayjs() + const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('dateRange', dateRange.value) activeTimeRange.value = 'today' // 标记当前激活状态 @@ -465,10 +466,9 @@ const getToday = function () { // 昨天 const getYesterday = function () { - const yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - const startTime = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate()) - const endTime = new Date(yesterday.getFullYear(), yesterday.getMonth(), yesterday.getDate() + 1) + const today = dayjs() + const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('dateRange', dateRange.value) activeTimeRange.value = 'yesterday' // 标记当前激活状态 @@ -480,9 +480,9 @@ const getYesterday = function () { // 近7天 const get7Days = function () { - const today = new Date() - const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 6) - const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1) + const today = dayjs() + const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.add(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('dateRange', dateRange.value) activeTimeRange.value = '7days' // 标记当前激活状态 diff --git a/src/views/consume/gold/coinConsumeDetail.vue b/src/views/consume/gold/coinConsumeDetail.vue index 5750d3a..e8a486b 100644 --- a/src/views/consume/gold/coinConsumeDetail.vue +++ b/src/views/consume/gold/coinConsumeDetail.vue @@ -287,17 +287,9 @@ const reset = function () { } // 今天 const getToday = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + const today = dayjs() + const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'today' // 标记当前激活状态 @@ -306,18 +298,9 @@ const getToday = function () { } // 昨天 const getYesterday = function () { - const yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - const startTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() - ) - const endTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() + 1 - ) + const today = dayjs() + const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'yesterday' // 标记当前激活状态 @@ -326,17 +309,9 @@ const getYesterday = function () { } // 近7天 const get7Days = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - 6 - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + const today = dayjs() + const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.add(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = '7days' // 标记当前激活状态 diff --git a/src/views/permissions/permission.vue b/src/views/permissions/permission.vue index 201fb01..dc0807c 100644 --- a/src/views/permissions/permission.vue +++ b/src/views/permissions/permission.vue @@ -588,15 +588,15 @@ const permissionEdit = async function () { }); }); await ElMessageBox.confirm( - `确认修改权限角色?您正在将【${userName}】的权限角色从【${oldRole}】修改为【${newRole}】变更后,该用户的可操作权限将同步更新为新角色配置,涉及数据访问、功能操作等权限变化,请谨慎确认。`, - '警告', - { - confirmButtonText: '确认', - cancelButtonText: '取消', - type: "warning", - lockScroll: false, - dangerouslyUseHTMLString: true //允许解析 HTML 标签 - } + `确认修改权限角色?您正在将【${userName}】的权限角色从【${oldRole}】修改为【${newRole}】变更后,该用户的可操作权限将同步更新为新角色配置,涉及数据访问、功能操作等权限变化,请谨慎确认。`, + '警告', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: "warning", + lockScroll: false, + dangerouslyUseHTMLString: true //允许解析 HTML 标签 + } ) const result = await request({ url: '/permission/updateAdmin', @@ -615,12 +615,12 @@ const permissionEdit = async function () { console.log('编辑最后提交数据', permissionEditObj.value); if (result.code == 200) { await ElMessageBox.alert( - `用户${userName}的权限角色已更改为【${newRole}】`, - '成功', - { - confirmButtonText: '确定', - type: 'success' // 设置为 success 类型 - } + `用户${userName}的权限角色已更改为【${newRole}】`, + '成功', + { + confirmButtonText: '确定', + type: 'success' // 设置为 success 类型 + } ); get(); closeUserEditVisible(); @@ -696,10 +696,10 @@ const handleAddRole = async function () { }); addRole.value.roleName = addRole.value.roleName.replace(/\s+/g, ''); console.log('去除角色名空格:', addRole.value.roleName); - + // 确保提交时包含所有选中的权限ID(包括父节点) const finalCheckedKeys = addRole.value.checkedKeys || []; - + const res = await API({ url: '/role/add', data: { @@ -740,7 +740,7 @@ const editStatus = async function (row) { }) console.log('请求成功2', result) ElMessage.success( - permissionEditObj.value.adminStatus == 1 ? '启用成功' : '禁用成功' + permissionEditObj.value.adminStatus == 1 ? '启用成功' : '禁用成功' ) permissionEditObj.value = {} get() @@ -865,7 +865,7 @@ const handleEditRolePermissionCheck = (checkedNodes, checkedInfo) => { // 由于设置了 check-strictly="false",Element Plus 会自动处理父子节点联动 // 我们只需要使用 checkedKeys,它已经包含了所有必要的节点ID permissionEditRoleObj.value.checkedKeys = checkedKeys; - + console.log('编辑角色选中的权限ID:', checkedKeys); console.log('选中的节点数量:', allCheckedNodes.length); }; @@ -1056,7 +1056,7 @@ const permissionEditRoleInit = async function (row) { }); data.value = res.data; data.value = data.value.filter(item => item.id !== 9); - + // 收集当前行权限树的叶子节点id(只收集实际选中的叶子节点) if (row.tree && row.tree.length > 0) { const leafIds = collectIds2(row.tree); @@ -1072,9 +1072,9 @@ const permissionEditRoleInit = async function (row) { } console.log('编辑角色', permissionEditRoleObj.value); permissionEditRoleVisible.value = true; - + // 等待DOM更新后手动设置树的选中状态 - await nextTick(); + await nextTick(); if (treeRef.value && permissionEditRoleObj.value.checkedKeys.length > 0) { treeRef.value.setCheckedKeys(permissionEditRoleObj.value.checkedKeys); console.log('手动设置树的选中状态:', permissionEditRoleObj.value.checkedKeys); @@ -1096,13 +1096,13 @@ const permissionEditRole = async function () { // 确保提交时包含所有选中的权限ID(包括父节点) let finalCheckedKeys = permissionEditRoleObj.value.checkedKeys || []; - + // 为所有选中的节点添加其父节点ID const allKeys = new Set(finalCheckedKeys); finalCheckedKeys.forEach(nodeId => { selectParentNodesForSubmit(data.value, nodeId, allKeys); }); - + finalCheckedKeys = Array.from(allKeys); const res = await API({ @@ -1231,7 +1231,7 @@ onMounted(async function () { 用户管理 + @click="checkTab = 'role'"> 角色管理 @@ -1281,8 +1281,8 @@ onMounted(async function () { {{ - scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize - }} + scope.$index + 1 + (getObj.pageNum - 1) * getObj.pageSize + }} @@ -1299,13 +1299,13 @@ onMounted(async function () { 重置密码 + :disabled="scope.row.adminStatus === 0 || scope.row.account === adminData.account"> 修改权限 + :disabled="scope.row.adminStatus === 0 || scope.row.account === adminData.account"> 删除 @@ -1321,7 +1321,7 @@ onMounted(async function () { @@ -1333,8 +1333,8 @@ onMounted(async function () { + layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handlePageSizeChange" + @current-change="handleCurrentChange"> @@ -1363,8 +1363,8 @@ onMounted(async function () { {{ - scope.$index + 1 + (getRoleObj.pageNum - 1) * getRoleObj.pageSize - }} + scope.$index + 1 + (getRoleObj.pageNum - 1) * getRoleObj.pageSize + }} @@ -1378,24 +1378,6 @@ onMounted(async function () { - @@ -1409,16 +1391,16 @@ onMounted(async function () { + layout="total, sizes, prev, pager, next, jumper" :total="roleTotal" @size-change="handleRolePageSizeChange" + @current-change="handleRoleCurrentChange"> + show-checkbox check-strictly :expand-on-click-node="false" + :default-expanded-keys="currentRoleMenuTree.map(item => item.id)" :default-checked-keys="Rolecheckedkeys" /> 关闭 @@ -1429,7 +1411,7 @@ onMounted(async function () { + style="max-width: 600px; align-items: center"> @@ -1440,14 +1422,14 @@ onMounted(async function () { + @change="handleMarketChange"> + :value="item.value"> @@ -1458,14 +1440,14 @@ onMounted(async function () { + style="width: 180px; margin-right: 10px;" /> 添加 + type="textarea" /> @@ -1481,7 +1463,7 @@ onMounted(async function () { + style="max-width: 600px; align-items: center"> @@ -1490,7 +1472,7 @@ onMounted(async function () { + @change="EdithandleMarketChange"> @@ -1500,20 +1482,20 @@ onMounted(async function () { + :value="item.value"> + style="width: 220px"> + :value="item.value"> + :props="{ label: 'menuName', children: 'children' }" :default-checked-keys="permissionEditObj.checkedKeys"> 暂无数据 @@ -1524,7 +1506,7 @@ onMounted(async function () { + style="width: 180px; margin-right: 10px;" /> 添加 @@ -1546,14 +1528,14 @@ onMounted(async function () { + style="max-width: 600px; align-items: center"> + :value="item.value"> @@ -1563,9 +1545,9 @@ onMounted(async function () { + :props="{ label: 'menuName', children: 'children' }" :checked-keys="addRole.checkedKeys" + :check-strictly="false" + @check="handleCheckChange"> {{ node.label }} @@ -1589,7 +1571,7 @@ onMounted(async function () { + :before-close="cancelResetPassword"> @@ -1615,14 +1597,14 @@ onMounted(async function () { + style="max-width: 600px; align-items: center"> + :value="item.value"> @@ -1630,10 +1612,10 @@ onMounted(async function () { + :props="{ label: 'menuName', children: 'children' }" + :default-checked-keys="permissionEditRoleObj.checkedKeys" + :check-strictly="false" + @check="handleEditRolePermissionCheck"> {{ node.label }} diff --git a/src/views/recharge/gold/coinRechargeDetail.vue b/src/views/recharge/gold/coinRechargeDetail.vue index 6c1c843..6383792 100644 --- a/src/views/recharge/gold/coinRechargeDetail.vue +++ b/src/views/recharge/gold/coinRechargeDetail.vue @@ -7,6 +7,7 @@ import axios from 'axios' import moment from 'moment' import API from '@/util/http.js' import {marketMapping, reverseMarketMapping} from '@/utils/marketMap.js'; +import dayjs from "dayjs"; //这是获取用户信息的接口 const adminData = ref({}) const getAdminData = async function () { @@ -344,17 +345,9 @@ const reset = function () { } // 今天 const getToday = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + const today = dayjs() + const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'today' // 标记当前激活状态 @@ -370,18 +363,9 @@ const handleCurrentChange = function (val) { } // 昨天 const getYesterday = function () { - const yesterday = new Date() - yesterday.setDate(yesterday.getDate() - 1) - const startTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() - ) - const endTime = new Date( - yesterday.getFullYear(), - yesterday.getMonth(), - yesterday.getDate() + 1 - ) + const today = dayjs() + const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = 'yesterday' // 标记当前激活状态 @@ -390,17 +374,9 @@ const getYesterday = function () { } // 近7天 const get7Days = function () { - const today = new Date() - const startTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() - 6 - ) - const endTime = new Date( - today.getFullYear(), - today.getMonth(), - today.getDate() + 1 - ) + const today = dayjs() + const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.add(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] console.log('getTime', getTime.value) activeTimeRange.value = '7days' // 标记当前激活状态 diff --git a/src/views/usergold/gold/clientCountDetail.vue b/src/views/usergold/gold/clientCountDetail.vue index 0177b10..84273cd 100644 --- a/src/views/usergold/gold/clientCountDetail.vue +++ b/src/views/usergold/gold/clientCountDetail.vue @@ -8,6 +8,7 @@ import API from '@/util/http.js' import {writeFile, utils} from 'xlsx' import request from "@/util/request.js"; import {marketMapping, reverseMarketMapping} from "../../../utils/marketMap.js"; +import dayjs from "dayjs"; // 标记当前激活的时间范围按钮 const activeTimeRange = ref('') @@ -223,9 +224,9 @@ const search = function () { // 今天 const getToday = function () { - const today = moment() - const startTime = today.startOf('day').toDate() - const endTime = today.add(1, 'days').startOf('day').toDate() + const today = dayjs() + const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] activeTimeRange.value = 'today' // 标记当前激活状态 @@ -234,10 +235,9 @@ const getToday = function () { // 昨天 const getYesterday = function () { - const today = moment() - const yesterday = moment().subtract(1, 'day') - const startTime = yesterday.startOf('day').toDate() - const endTime = today.startOf('day').toDate() + const today = dayjs() + const startTime = today.subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.subtract(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] activeTimeRange.value = 'yesterday' // 标记当前激活状态 @@ -246,8 +246,9 @@ const getYesterday = function () { // 近7天 const get7Days = function () { - const startTime = moment().subtract(6, 'day').startOf('day').toDate() - const endTime = moment().add(1, 'days').startOf('day').toDate() + const today = dayjs() + const startTime = today.subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.add(1, 'day').endOf('day').format('YYYY-MM-DD HH:mm:ss') getTime.value = [startTime, endTime] activeTimeRange.value = '7days' // 标记当前激活状态 diff --git a/src/views/workspace/index.vue b/src/views/workspace/index.vue index 29c9f00..2f43749 100644 --- a/src/views/workspace/index.vue +++ b/src/views/workspace/index.vue @@ -232,7 +232,6 @@ import {ArrowUpBold, ArrowDownBold, SemiSelect} from '@element-plus/icons-vue' import {marketMapping} from "@/utils/marketMap.js"; - // 地区数据 const markets = ref([]) // 图表相关 @@ -321,7 +320,8 @@ const formatDate = function (date) { const getToday = function () { const today = dayjs() const startTime = today.startOf('day').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') + const endTime =today.endOf('day').format('YYYY-MM-DD HH:mm:ss') + // const endTime = today.add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('看看dateRange', dateRange.value) activeTimeRange.value = 'today' // 标记当前激活状态 @@ -332,7 +332,8 @@ const getToday = function () { const getWeek = function () { const today = dayjs() const startTime = (today.startOf('week').add(1, 'day')).format('YYYY-MM-DD HH:mm:ss') - const endTime = today.add(1, 'week').startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.endOf('week').format('YYYY-MM-DD HH:mm:ss') + // const endTime = today.add(1, 'week').startOf('week').add(1, 'day').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('看看dateRange', dateRange.value) activeTimeRange.value = 'week' // 标记当前激活状态 @@ -343,7 +344,8 @@ const getWeek = function () { const getMonth = function () { const today = dayjs() const startTime = today.startOf('month').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.add(1, 'month').startOf('month').format('YYYY-MM-DD HH:mm:ss') + // const endTime = today.add(1, 'month').startOf('month').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.endOf('month').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('看看dateRange', dateRange.value) activeTimeRange.value = 'month' // 标记当前激活状态 @@ -354,7 +356,8 @@ const getMonth = function () { const getYear = function () { const today = dayjs() const startTime = today.startOf('year').format('YYYY-MM-DD HH:mm:ss') - const endTime = today.add(1, 'year').startOf('year').format('YYYY-MM-DD HH:mm:ss') + const endTime = today.endOf('year').format('YYYY-MM-DD HH:mm:ss') + // const endTime = today.add(1, 'year').startOf('year').format('YYYY-MM-DD HH:mm:ss') dateRange.value = [startTime, endTime] console.log('看看dateRange', dateRange.value) activeTimeRange.value = 'year' // 标记当前激活状态 @@ -457,7 +460,8 @@ const getMarkets = async () => { } }) if (Array.isArray(response.data)) { - markets.value = response.data.filter(data => data !== "1") + // markets.value = response.data.filter(data => data !== "1") + markets.value = response.data console.log('市场列表获取成功:', markets.value) } else { console.error('获取市场列表失败', response) @@ -476,12 +480,10 @@ const getChartData = async () => { if (!markets.value || markets.value.length === 0) { await getMarkets() } - // 本年 if (!dateRange.value || dateRange.value.length === 0) { getYear() } - const params = { markets: markets.value, startDate: dateRange.value[0], @@ -495,6 +497,7 @@ const getChartData = async () => { }) console.log('看看params', params) if (Array.isArray(response.marketGraphs)) { + // const filteredGraphs = response.marketGraphs.filter(data => data.market !== "1"); // 处理图表数据 processChartData(response.marketGraphs) // 处理排名数据