1.将部门修改为渠道,并且所有dice_表关联渠道表
2.将所有配置表,记录表设置关联渠道 3.优化后台页面设置
This commit is contained in:
@@ -1,32 +1,36 @@
|
||||
import request from '@/utils/http'
|
||||
|
||||
export type DashboardQueryParams = {
|
||||
dept_id?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 大富翁工作台卡片统计(玩家注册、充值、提现、游玩次数,含较上周对比)
|
||||
* @returns 响应
|
||||
*/
|
||||
export function fetchStatistics() {
|
||||
export function fetchStatistics(params?: DashboardQueryParams) {
|
||||
return request.get<any>({
|
||||
url: '/core/dice/dashboard/statistics'
|
||||
url: '/core/dice/dashboard/statistics',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 近期玩家充值统计(近10天每日充值金额)
|
||||
* @returns 响应
|
||||
*/
|
||||
export function fetchRechargeChart() {
|
||||
export function fetchRechargeChart(params?: DashboardQueryParams) {
|
||||
return request.get<any>({
|
||||
url: '/core/dice/dashboard/rechargeChart'
|
||||
url: '/core/dice/dashboard/rechargeChart',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 月度玩家充值汇总(当年1-12月每月充值金额)
|
||||
* @returns 响应
|
||||
*/
|
||||
export function fetchRechargeBarChart() {
|
||||
export function fetchRechargeBarChart(params?: DashboardQueryParams) {
|
||||
return request.get<any>({
|
||||
url: '/core/dice/dashboard/rechargeBarChart'
|
||||
url: '/core/dice/dashboard/rechargeBarChart',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -39,11 +43,11 @@ export interface WalletRecordItem {
|
||||
|
||||
/**
|
||||
* 工作台-玩家充值记录(最新50条)
|
||||
* @returns 列表
|
||||
*/
|
||||
export function fetchWalletRecordList() {
|
||||
export function fetchWalletRecordList(params?: DashboardQueryParams) {
|
||||
return request.get<WalletRecordItem[]>({
|
||||
url: '/core/dice/dashboard/walletRecordList'
|
||||
url: '/core/dice/dashboard/walletRecordList',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -66,21 +70,20 @@ export interface PlayRecordItem {
|
||||
|
||||
/**
|
||||
* 工作台-新增玩家记录(最新50条)
|
||||
* @returns 列表
|
||||
*/
|
||||
export function fetchNewPlayerList() {
|
||||
export function fetchNewPlayerList(params?: DashboardQueryParams) {
|
||||
return request.get<NewPlayerItem[]>({
|
||||
url: '/core/dice/dashboard/newPlayerList'
|
||||
url: '/core/dice/dashboard/newPlayerList',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作台-玩家游玩记录(最新50条)
|
||||
* @returns 列表
|
||||
*/
|
||||
export function fetchPlayRecordList() {
|
||||
export function fetchPlayRecordList(params?: DashboardQueryParams) {
|
||||
return request.get<PlayRecordItem[]>({
|
||||
url: '/core/dice/dashboard/playRecordList'
|
||||
url: '/core/dice/dashboard/playRecordList',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -71,5 +71,19 @@ export default {
|
||||
return request.get<Api.Common.ApiData[]>({
|
||||
url: '/core/dept/accessDept'
|
||||
})
|
||||
},
|
||||
|
||||
destroyPreview(ids: string | number | Array<string | number>) {
|
||||
const idStr = Array.isArray(ids) ? ids.join(',') : String(ids)
|
||||
return request.get<Api.Common.ApiData>({
|
||||
url: '/core/dept/destroyPreview',
|
||||
params: { ids: idStr }
|
||||
})
|
||||
},
|
||||
|
||||
syncChannelConfigs() {
|
||||
return request.post<any>({
|
||||
url: '/core/dept/syncChannelConfigs'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,10 @@ export default {
|
||||
* 可操作角色
|
||||
* @returns 数据列表
|
||||
*/
|
||||
accessRole() {
|
||||
accessRole(params?: Record<string, unknown>) {
|
||||
return request.get<Api.Common.ApiData[]>({
|
||||
url: '/core/role/accessRole'
|
||||
url: '/core/role/accessRole',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
138
saiadmin-artd/src/components/channel/SuperAdminChannelShell.vue
Normal file
138
saiadmin-artd/src/components/channel/SuperAdminChannelShell.vue
Normal file
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div v-if="props.enabled" class="art-full-height super-admin-channel-shell">
|
||||
<div class="box-border flex gap-3 h-full max-md:block max-md:gap-0 max-md:h-auto">
|
||||
<div class="channel-list-panel flex-shrink-0 h-full max-md:w-full max-md:h-auto max-md:mb-5">
|
||||
<ElCard
|
||||
class="channel-tree-card tree-card art-card-xs flex flex-col h-full mt-0"
|
||||
shadow="never"
|
||||
v-loading="loadingChannels"
|
||||
>
|
||||
<template #header>
|
||||
<b class="channel-list-title">{{ $t('common.channelScope.listTitle') }}</b>
|
||||
</template>
|
||||
<ElScrollbar>
|
||||
<ElTree
|
||||
:data="displayTreeData"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
node-key="id"
|
||||
:current-node-key="selectedDeptId"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="onNodeClick"
|
||||
/>
|
||||
</ElScrollbar>
|
||||
</ElCard>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col flex-grow min-w-0 min-h-0">
|
||||
<div v-if="selectedDeptLabel" class="channel-banner mb-3 text-sm text-g-500">
|
||||
{{ bannerLabel }}:<b>{{ selectedDeptLabel }}</b>
|
||||
</div>
|
||||
<div class="flex flex-col flex-1 min-h-0 min-w-0">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<slot v-else />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { isRoleChannelRoute } from '@/utils/channelLayout'
|
||||
import {
|
||||
DEFAULT_CHANNEL_ID,
|
||||
useChannelDeptScope,
|
||||
type ChannelTreeNode
|
||||
} from '@/composables/useChannelDeptScope'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
defineOptions({ name: 'SuperAdminChannelShell' })
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
enabled?: boolean
|
||||
}>(),
|
||||
{
|
||||
enabled: true
|
||||
}
|
||||
)
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const {
|
||||
treeData,
|
||||
selectedDeptId,
|
||||
loadingChannels,
|
||||
selectedDeptLabel,
|
||||
handleChannelClick,
|
||||
provideScope,
|
||||
isConfigScope,
|
||||
showDefaultTemplate
|
||||
} = useChannelDeptScope()
|
||||
|
||||
provideScope()
|
||||
|
||||
const displayTreeData = computed(() => {
|
||||
const nodes = showDefaultTemplate.value
|
||||
? treeData.value
|
||||
: treeData.value.filter((n) => n.id !== DEFAULT_CHANNEL_ID)
|
||||
const defaultLabel = isRoleChannelRoute(route)
|
||||
? t('common.channelScope.defaultRoleTemplate')
|
||||
: t('common.channelScope.defaultTemplate')
|
||||
return nodes.map((node) =>
|
||||
node.id === DEFAULT_CHANNEL_ID && !node.label ? { ...node, label: defaultLabel } : node
|
||||
)
|
||||
})
|
||||
|
||||
const bannerLabel = computed(() => {
|
||||
if (isConfigScope.value) {
|
||||
return t('common.channelScope.currentConfig')
|
||||
}
|
||||
if (isRoleChannelRoute(route)) {
|
||||
return t('common.channelScope.currentRole')
|
||||
}
|
||||
return t('common.channelScope.currentChannel')
|
||||
})
|
||||
|
||||
const onNodeClick = (data: ChannelTreeNode) => {
|
||||
handleChannelClick(data)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.super-admin-channel-shell {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 原 w-64(16rem) 的 0.6 倍 */
|
||||
.channel-list-panel {
|
||||
width: 9.6rem;
|
||||
}
|
||||
|
||||
.channel-tree-card :deep(.el-card__header) {
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.channel-list-title {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.channel-tree-card :deep(.el-tree-node__content) {
|
||||
height: 30px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.channel-tree-card :deep(.el-tree-node__label) {
|
||||
font-size: 13px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.channel-banner b {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
</style>
|
||||
@@ -18,22 +18,34 @@
|
||||
<!-- 缓存路由动画 -->
|
||||
<Transition :name="showTransitionMask ? '' : actualTransition" mode="out-in" appear>
|
||||
<KeepAlive :max="10" :exclude="keepAliveExclude">
|
||||
<SuperAdminChannelShell
|
||||
v-if="route.meta.keepAlive && shouldWrapChannelLayout(route)"
|
||||
:key="'ch-' + route.path"
|
||||
>
|
||||
<component class="art-page-view" :is="Component" :key="route.path" />
|
||||
</SuperAdminChannelShell>
|
||||
<component
|
||||
v-else-if="route.meta.keepAlive"
|
||||
class="art-page-view"
|
||||
:is="Component"
|
||||
:key="route.path"
|
||||
v-if="route.meta.keepAlive"
|
||||
/>
|
||||
</KeepAlive>
|
||||
</Transition>
|
||||
|
||||
<!-- 非缓存路由动画 -->
|
||||
<Transition :name="showTransitionMask ? '' : actualTransition" mode="out-in" appear>
|
||||
<SuperAdminChannelShell
|
||||
v-if="!route.meta.keepAlive && shouldWrapChannelLayout(route)"
|
||||
:key="'ch-' + route.path"
|
||||
>
|
||||
<component class="art-page-view" :is="Component" :key="route.path" />
|
||||
</SuperAdminChannelShell>
|
||||
<component
|
||||
v-else-if="!route.meta.keepAlive"
|
||||
class="art-page-view"
|
||||
:is="Component"
|
||||
:key="route.path"
|
||||
v-if="!route.meta.keepAlive"
|
||||
/>
|
||||
</Transition>
|
||||
</RouterView>
|
||||
@@ -53,6 +65,8 @@
|
||||
import { useAutoLayoutHeight } from '@/hooks/core/useLayoutHeight'
|
||||
import { useSettingStore } from '@/store/modules/setting'
|
||||
import { useWorktabStore } from '@/store/modules/worktab'
|
||||
import SuperAdminChannelShell from '@/components/channel/SuperAdminChannelShell.vue'
|
||||
import { shouldWrapSuperAdminChannelLayout as shouldWrapChannelLayout } from '@/utils/channelLayout'
|
||||
|
||||
defineOptions({ name: 'ArtPageContent' })
|
||||
|
||||
|
||||
12
saiadmin-artd/src/components/dice/ChannelConfigLayout.vue
Normal file
12
saiadmin-artd/src/components/dice/ChannelConfigLayout.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<!-- 兼容旧引用:超管渠道栏已提升至全局 SuperAdminChannelShell -->
|
||||
<template>
|
||||
<slot :dept-id="deptId" :dept-params="deptParams" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useInjectedChannelDept, DEFAULT_CHANNEL_ID } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const channel = useInjectedChannelDept()
|
||||
const deptId = computed(() => channel?.selectedDeptId.value ?? DEFAULT_CHANNEL_ID)
|
||||
const deptParams = computed(() => ({ dept_id: deptId.value }))
|
||||
</script>
|
||||
6
saiadmin-artd/src/composables/useChannelConfigScope.ts
Normal file
6
saiadmin-artd/src/composables/useChannelConfigScope.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/** @deprecated 请使用 useChannelDeptScope */
|
||||
export {
|
||||
DEFAULT_CHANNEL_ID,
|
||||
useChannelDeptScope as useChannelConfigScope,
|
||||
type ChannelTreeNode
|
||||
} from './useChannelDeptScope'
|
||||
230
saiadmin-artd/src/composables/useChannelDeptScope.ts
Normal file
230
saiadmin-artd/src/composables/useChannelDeptScope.ts
Normal file
@@ -0,0 +1,230 @@
|
||||
import type { InjectionKey, Ref, ComputedRef } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import deptApi from '@/api/system/dept'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { isConfigChannelRoute, isRoleChannelRoute, isSuperAdminUser } from '@/utils/channelLayout'
|
||||
|
||||
export interface ChannelTreeNode {
|
||||
id: number
|
||||
label: string
|
||||
children?: ChannelTreeNode[]
|
||||
}
|
||||
|
||||
/** 默认配置模板(dept_id = 0) */
|
||||
export const DEFAULT_CHANNEL_ID = 0
|
||||
|
||||
export interface ChannelDeptScopeContext {
|
||||
treeData: Ref<ChannelTreeNode[]>
|
||||
selectedDeptId: Ref<number>
|
||||
loadingChannels: Ref<boolean>
|
||||
isSuperAdmin: Ref<boolean>
|
||||
selectedDeptLabel: Ref<string>
|
||||
deptQueryParams: ComputedRef<{ dept_id: number }>
|
||||
isConfigScope: ComputedRef<boolean>
|
||||
showDefaultTemplate: ComputedRef<boolean>
|
||||
}
|
||||
|
||||
export const CHANNEL_DEPT_SCOPE_KEY: InjectionKey<ChannelDeptScopeContext> =
|
||||
Symbol('channelDeptScope')
|
||||
|
||||
export function provideChannelDeptScope(ctx: ChannelDeptScopeContext) {
|
||||
provide(CHANNEL_DEPT_SCOPE_KEY, ctx)
|
||||
}
|
||||
|
||||
export function useInjectedChannelDept(): ChannelDeptScopeContext | null {
|
||||
return inject(CHANNEL_DEPT_SCOPE_KEY, null)
|
||||
}
|
||||
|
||||
/** 超管全局渠道栏:创建并 provide 渠道上下文 */
|
||||
export function useChannelDeptScope() {
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
const treeData = ref<ChannelTreeNode[]>([])
|
||||
const selectedDeptId = ref<number>(DEFAULT_CHANNEL_ID)
|
||||
const loadingChannels = ref(false)
|
||||
|
||||
const isConfigScope = computed(() => isConfigChannelRoute(route))
|
||||
const isRoleScope = computed(() => isRoleChannelRoute(route))
|
||||
const showDefaultTemplate = computed(() => isConfigScope.value || isRoleScope.value)
|
||||
|
||||
const isSuperAdmin = computed(() => isSuperAdminUser())
|
||||
|
||||
const selectedDeptLabel = computed(() => {
|
||||
const find = (nodes: ChannelTreeNode[]): string => {
|
||||
for (const n of nodes) {
|
||||
if (n.id === selectedDeptId.value) {
|
||||
return n.label
|
||||
}
|
||||
if (n.children?.length) {
|
||||
const sub = find(n.children)
|
||||
if (sub) return sub
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
return find(treeData.value)
|
||||
})
|
||||
|
||||
const deptQueryParams = computed(() => {
|
||||
const id = selectedDeptId.value
|
||||
if (!showDefaultTemplate.value && id <= 0) {
|
||||
return { dept_id: 0 }
|
||||
}
|
||||
return { dept_id: id }
|
||||
})
|
||||
|
||||
const loadChannels = async () => {
|
||||
loadingChannels.value = true
|
||||
try {
|
||||
const list = await deptApi.accessDept()
|
||||
const channels = Array.isArray(list) ? list : []
|
||||
const nodes: ChannelTreeNode[] = channels.map((item: Record<string, unknown>) => ({
|
||||
id: Number(item.id ?? item.value),
|
||||
label: String(item.label ?? item.name ?? item.id)
|
||||
}))
|
||||
if (isSuperAdmin.value) {
|
||||
if (showDefaultTemplate.value) {
|
||||
treeData.value = [{ id: DEFAULT_CHANNEL_ID, label: '' }, ...nodes]
|
||||
if (!treeData.value.some((n) => n.id === selectedDeptId.value)) {
|
||||
selectedDeptId.value = DEFAULT_CHANNEL_ID
|
||||
}
|
||||
} else {
|
||||
treeData.value = nodes
|
||||
if (nodes.length > 0) {
|
||||
const valid = nodes.some((n) => n.id === selectedDeptId.value)
|
||||
if (!valid || selectedDeptId.value <= 0) {
|
||||
selectedDeptId.value = nodes[0].id
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
treeData.value = nodes
|
||||
if (nodes.length > 0) {
|
||||
selectedDeptId.value = nodes[0].id
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loadingChannels.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleChannelClick = (data: ChannelTreeNode) => {
|
||||
selectedDeptId.value = Number(data.id)
|
||||
}
|
||||
|
||||
const ctx: ChannelDeptScopeContext = {
|
||||
treeData,
|
||||
selectedDeptId,
|
||||
loadingChannels,
|
||||
isSuperAdmin,
|
||||
selectedDeptLabel,
|
||||
deptQueryParams,
|
||||
isConfigScope,
|
||||
showDefaultTemplate
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadChannels()
|
||||
})
|
||||
|
||||
return {
|
||||
...ctx,
|
||||
loadChannels,
|
||||
handleChannelClick,
|
||||
provideScope: () => provideChannelDeptScope(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
/** 将当前选中渠道写入列表查询参数并刷新 */
|
||||
export function bindChannelDeptToSearchParams(
|
||||
searchParams: Record<string, unknown>,
|
||||
refresh: () => void,
|
||||
options?: { immediate?: boolean; enabled?: boolean }
|
||||
) {
|
||||
const channel = useInjectedChannelDept()
|
||||
if (!channel || options?.enabled === false) {
|
||||
return
|
||||
}
|
||||
|
||||
const apply = (deptId: number) => {
|
||||
if (!channel.showDefaultTemplate.value && deptId <= 0) {
|
||||
return
|
||||
}
|
||||
searchParams.dept_id = deptId
|
||||
refresh()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => channel.selectedDeptId.value,
|
||||
(deptId) => apply(deptId),
|
||||
{ immediate: options?.immediate ?? true }
|
||||
)
|
||||
}
|
||||
|
||||
/** 工作台等非 useTable 页面:渠道切换时重新拉数 */
|
||||
export function useChannelDeptReload(loadFn: () => void | Promise<void>) {
|
||||
const channel = useInjectedChannelDept()
|
||||
if (!channel) {
|
||||
onMounted(() => {
|
||||
void loadFn()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
watch(
|
||||
() => channel.selectedDeptId.value,
|
||||
(deptId) => {
|
||||
if (!channel.showDefaultTemplate.value && deptId <= 0) {
|
||||
return
|
||||
}
|
||||
void loadFn()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
}
|
||||
|
||||
/** 请求参数:业务页附带 dept_id;渠道管理员固定本渠道 */
|
||||
export function getChannelDeptRequestParams(): { dept_id?: number } {
|
||||
const channel = useInjectedChannelDept()
|
||||
if (channel?.isSuperAdmin.value) {
|
||||
const deptId = channel.selectedDeptId.value
|
||||
if (!channel.showDefaultTemplate.value && deptId <= 0) {
|
||||
return {}
|
||||
}
|
||||
if (deptId > 0) {
|
||||
return { dept_id: deptId }
|
||||
}
|
||||
if (channel.showDefaultTemplate.value) {
|
||||
return { dept_id: deptId }
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
const dept = userStore.info?.department
|
||||
if (dept && Number(dept.id) > 0) {
|
||||
return { dept_id: Number(dept.id) }
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
/** 保存/更新时附带 dept_id(优先渠道栏选中值,其次表单/行数据中的 dept_id) */
|
||||
export function withChannelDeptParams<T extends Record<string, unknown>>(payload: T): T {
|
||||
const extra = getChannelDeptRequestParams()
|
||||
if ('dept_id' in extra) {
|
||||
return { ...payload, ...extra }
|
||||
}
|
||||
const rowDeptId = payload.dept_id
|
||||
if (rowDeptId !== undefined && rowDeptId !== null && rowDeptId !== '') {
|
||||
const num = Number(rowDeptId)
|
||||
if (num > 0) {
|
||||
return { ...payload, dept_id: num }
|
||||
}
|
||||
}
|
||||
const channel = useInjectedChannelDept()
|
||||
if (channel && channel.selectedDeptId.value > 0) {
|
||||
return { ...payload, dept_id: channel.selectedDeptId.value }
|
||||
}
|
||||
return payload
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
createErrorHandler
|
||||
} from '../../utils/table/tableUtils'
|
||||
import { tableConfig } from '../../utils/table/tableConfig'
|
||||
import { bindChannelDeptToSearchParams, useInjectedChannelDept, getChannelDeptRequestParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
// 类型推导工具类型
|
||||
type InferApiParams<T> = T extends (params: infer P) => any ? P : never
|
||||
@@ -441,6 +442,23 @@ function useTableImpl<TApiFn extends (params: any) => Promise<any>>(
|
||||
// 智能防抖搜索函数
|
||||
const debouncedGetDataByPage = createSmartDebounce(getDataByPage, debounceTime)
|
||||
|
||||
const channelScope = useInjectedChannelDept()
|
||||
const hasChannelScope = !!channelScope
|
||||
bindChannelDeptToSearchParams(
|
||||
searchParams as Record<string, unknown>,
|
||||
() => {
|
||||
void getDataByPage()
|
||||
},
|
||||
{ immediate: hasChannelScope }
|
||||
)
|
||||
|
||||
if (!hasChannelScope) {
|
||||
const channelDeptParams = getChannelDeptRequestParams()
|
||||
if (channelDeptParams.dept_id !== undefined) {
|
||||
Object.assign(searchParams as Record<string, unknown>, channelDeptParams)
|
||||
}
|
||||
}
|
||||
|
||||
// 重置搜索参数
|
||||
const resetSearchParams = async (): Promise<void> => {
|
||||
// 取消防抖的搜索
|
||||
@@ -645,7 +663,7 @@ function useTableImpl<TApiFn extends (params: any) => Promise<any>>(
|
||||
}
|
||||
|
||||
// 挂载时自动加载数据
|
||||
if (immediate) {
|
||||
if (immediate && !hasChannelScope) {
|
||||
onMounted(async () => {
|
||||
await getData()
|
||||
})
|
||||
|
||||
@@ -37,7 +37,15 @@
|
||||
"tips": "Prompt",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"logOutTips": "Do you want to log out?"
|
||||
"logOutTips": "Do you want to log out?",
|
||||
"channelScope": {
|
||||
"listTitle": "Channels",
|
||||
"defaultTemplate": "Default template",
|
||||
"defaultRoleTemplate": "Default role template",
|
||||
"currentConfig": "Current config",
|
||||
"currentChannel": "Current channel",
|
||||
"currentRole": "Current roles"
|
||||
}
|
||||
},
|
||||
"uiMsg": {
|
||||
"titlePrompt": "Prompt",
|
||||
@@ -387,7 +395,7 @@
|
||||
"role": "Role Management",
|
||||
"userCenter": "User Center",
|
||||
"menu": "Menu Management",
|
||||
"dept": "Department Management",
|
||||
"dept": "Channel Management",
|
||||
"config": "System Config"
|
||||
},
|
||||
"safeguard": {
|
||||
@@ -516,12 +524,12 @@
|
||||
"system": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"dept": "Department",
|
||||
"dept": "Channel",
|
||||
"dashboard": "Dashboard",
|
||||
"loginTime": "Last Login",
|
||||
"agentId": "Agent ID",
|
||||
"deptName": "Dept Name",
|
||||
"deptCode": "Dept Code",
|
||||
"deptName": "Channel Name",
|
||||
"deptCode": "Channel Code",
|
||||
"leader": "Leader",
|
||||
"roleName": "Role Name",
|
||||
"roleCode": "Role Code",
|
||||
|
||||
45
saiadmin-artd/src/locales/langs/en/dice/game.json
Normal file
45
saiadmin-artd/src/locales/langs/en/dice/game.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Game",
|
||||
"dialogTitleEdit": "Edit Game",
|
||||
"provider": "Provider",
|
||||
"placeholderProvider": "Enter provider name",
|
||||
"providerCode": "Provider Code",
|
||||
"placeholderProviderCode": "Enter provider code",
|
||||
"gameCode": "Game Code",
|
||||
"placeholderGameCode": "Enter game code",
|
||||
"gameKey": "Game Key",
|
||||
"placeholderGameKey": "Enter unique game key",
|
||||
"gameName": "Name (ZH)",
|
||||
"placeholderGameName": "Enter Chinese name",
|
||||
"gameNameEn": "Name (EN)",
|
||||
"placeholderGameNameEn": "Enter English name",
|
||||
"gameType": "Game Type",
|
||||
"placeholderGameType": "Enter game type",
|
||||
"sort": "Sort",
|
||||
"logo": "Logo URL",
|
||||
"tabPicker": "Pick Image",
|
||||
"tabUpload": "Upload Image",
|
||||
"gameUrl": "Game URL",
|
||||
"placeholderGameUrl": "Enter game URL",
|
||||
"hallUrl": "Hall URL",
|
||||
"placeholderHallUrl": "Enter hall URL",
|
||||
"status": "Status",
|
||||
"statusEnabled": "Enabled",
|
||||
"statusDisabled": "Disabled",
|
||||
"remark": "Remark",
|
||||
"placeholderRemark": "Enter remark",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully",
|
||||
"ruleProviderRequired": "Provider is required",
|
||||
"ruleProviderCodeRequired": "Provider code is required",
|
||||
"ruleGameCodeRequired": "Game code is required",
|
||||
"ruleGameKeyRequired": "Game key is required",
|
||||
"ruleGameNameRequired": "Chinese name is required",
|
||||
"ruleGameTypeRequired": "Game type is required"
|
||||
},
|
||||
"table": {
|
||||
"statusEnabled": "Enabled",
|
||||
"statusDisabled": "Disabled"
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
"profitCalcHint": "Profit per round: paid = win_coin (incl. BIGWIN) - paid_amount (= ante×1); free = win_coin. Refreshes every 2s while open.",
|
||||
"tierRuleTitle": "Tier Rule",
|
||||
"tierRuleContent": "When player profit in this pool is below safety line, use player T*_weight; when above or equal, use pool T*_weight (kill).",
|
||||
"enableKillScore": "Enable kill score",
|
||||
"killScoreWeights": "Kill weights",
|
||||
"killWeightNote": "(Kill weights from pool config type=1; edit in list.)",
|
||||
"btnResetProfit": "Reset Player Total Profit",
|
||||
|
||||
@@ -34,7 +34,15 @@
|
||||
"placeholderRewardTier": "Select reward tier",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully",
|
||||
"validateFailed": "Validation failed, please check required fields and format"
|
||||
"validateFailed": "Validation failed, please check required fields and format",
|
||||
"rulePlayerRequired": "Please select player",
|
||||
"ruleLotteryConfigRequired": "Please select lottery pool config",
|
||||
"ruleLotteryTypeRequired": "Please select draw type",
|
||||
"ruleIsWinRequired": "Please select big win status",
|
||||
"ruleWinCoinRequired": "Win coin is required",
|
||||
"ruleRollArrayLength": "Roll array must have 5 numbers",
|
||||
"ruleRollArrayValues": "Enter 5 numbers, each between 1 and 6",
|
||||
"ruleRewardTierRequired": "Please select reward tier"
|
||||
},
|
||||
"toolbar": {
|
||||
"platformTotalProfit": "Platform Total Profit"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"status": "Status",
|
||||
"adminId": "Admin",
|
||||
"placeholderAdmin": "Select admin (optional)",
|
||||
"placeholderAdminTree": "Select admin by channel",
|
||||
"unassignedChannel": "Unassigned channel",
|
||||
"coin": "Coin",
|
||||
"placeholderCoinAdd": "Default 0 on create, read-only",
|
||||
"lotteryPoolConfig": "Lottery Pool Config",
|
||||
@@ -44,7 +46,18 @@
|
||||
"ruleEnterCoin": "Please enter coin change",
|
||||
"ruleCoinPositive": "Coin change must be greater than 0",
|
||||
"ruleDeductExceed": "Deduct cannot exceed current balance",
|
||||
"operateSuccess": "Success"
|
||||
"operateSuccess": "Success",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully",
|
||||
"rulePasswordRequired": "Password is required",
|
||||
"ruleUsernameRequired": "Username is required",
|
||||
"ruleNicknameRequired": "Nickname is required",
|
||||
"rulePhoneRequired": "Phone is required",
|
||||
"ruleStatusRequired": "Status is required",
|
||||
"ruleCoinRequired": "Coin is required",
|
||||
"configTypeDefault": "Default",
|
||||
"configTypeKillScore": "Kill score",
|
||||
"configTypeUp": "Up score"
|
||||
},
|
||||
"search": {
|
||||
"username": "Username",
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
"placeholderTotalDrawCount": "Auto sum",
|
||||
"placeholderRemark": "Remark (required)",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
"editSuccess": "Updated successfully",
|
||||
"rulePlayerRequired": "Please select player",
|
||||
"ruleUseCoinsRequired": "Coins used is required",
|
||||
"rulePaidDrawRequired": "Paid draw count is required",
|
||||
"ruleFreeDrawRequired": "Free draw count is required",
|
||||
"ruleRemarkRequired": "Remark is required"
|
||||
},
|
||||
"search": {
|
||||
"player": "Player",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"coinChangeSummary": "Coin Change Summary"
|
||||
},
|
||||
"form": {
|
||||
"dialogTitleAdd": "Add Wallet Record",
|
||||
"dialogTitleEdit": "Edit Wallet Record",
|
||||
@@ -19,7 +22,10 @@
|
||||
"placeholderWalletAfter": "Auto calculated",
|
||||
"placeholderRemark": "Optional",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
"editSuccess": "Updated successfully",
|
||||
"ruleUserRequired": "Please select user",
|
||||
"ruleCoinRequired": "Coin change is required",
|
||||
"ruleTypeRequired": "Please select type"
|
||||
},
|
||||
"search": {
|
||||
"type": "Type",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"labelLotteryTypePaid": "Test pool type",
|
||||
"labelLotteryTypeFree": "Test pool type",
|
||||
"labelAnte": "Ante",
|
||||
"placeholderAnte": "Select ante config",
|
||||
"placeholderPaidPool": "Leave empty for custom tier odds below (default: default)",
|
||||
"placeholderFreePool": "Leave empty for custom tier odds below (default: killScore)",
|
||||
"tierProbHint": "Custom tier odds (T1–T5), each 0–100%, sum of five must not exceed 100%",
|
||||
@@ -81,7 +82,7 @@
|
||||
"btnNext": "Next",
|
||||
"btnStart": "Start test",
|
||||
"btnCancel": "Cancel",
|
||||
"warnAnte": "Ante must be greater than 0",
|
||||
"warnAnte": "Please select ante",
|
||||
"warnPaidSpins": "Paid clockwise + counter-clockwise spin counts must be greater than 0",
|
||||
"warnTestSafetyLine": "Test safety line must be greater than or equal to 0",
|
||||
"warnTotalSpins": "At least one of paid/free direction spin counts must be greater than 0",
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
{
|
||||
"search": {
|
||||
"deptName": "channel(Department) Name",
|
||||
"deptCode": "Dept Code",
|
||||
"deptName": "Channel Name",
|
||||
"deptCode": "Channel Code",
|
||||
"status": "Status",
|
||||
"placeholderDeptName": "Please enter dept name",
|
||||
"placeholderDeptCode": "Please enter dept code",
|
||||
"placeholderDeptName": "Please enter channel name",
|
||||
"placeholderDeptCode": "Please enter channel code",
|
||||
"searchSelectPlaceholder": "Please select"
|
||||
},
|
||||
"table": {
|
||||
"deptName": "channel(Department) Name",
|
||||
"deptCode": "Dept Code",
|
||||
"leader": "Leader",
|
||||
"deptName": "Channel Name",
|
||||
"deptCode": "Channel Code",
|
||||
"leader": "Channel Leader",
|
||||
"sort": "Sort",
|
||||
"status": "Status",
|
||||
"createTime": "Create Time"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "Add Department",
|
||||
"titleEdit": "Edit Department",
|
||||
"labelParentDept": "Parent Department",
|
||||
"labelDeptName": "Dept Name",
|
||||
"labelDeptCode": "Dept Code",
|
||||
"labelLeader": "Leader",
|
||||
"titleAdd": "Add Channel",
|
||||
"titleEdit": "Edit Channel",
|
||||
"labelDeptName": "Channel Name",
|
||||
"labelDeptCode": "Channel Code",
|
||||
"labelLeader": "Channel Leader",
|
||||
"labelRemark": "Description",
|
||||
"labelSort": "Sort",
|
||||
"labelStatus": "Enabled",
|
||||
"placeholderDeptName": "Please enter dept name",
|
||||
"placeholderDeptCode": "Please enter dept code",
|
||||
"placeholderDeptName": "Please enter channel name",
|
||||
"placeholderDeptCode": "Please enter channel code",
|
||||
"placeholderRemark": "Please enter description",
|
||||
"placeholderSort": "Please enter sort",
|
||||
"noParentDept": "No parent department",
|
||||
"ruleParentDeptRequired": "Please select parent department",
|
||||
"ruleDeptNameRequired": "Please enter dept name",
|
||||
"ruleDeptCodeRequired": "Please enter dept code",
|
||||
"ruleDeptNameRequired": "Please enter channel name",
|
||||
"ruleDeptCodeRequired": "Please enter channel code",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"table": {
|
||||
"username": "Username",
|
||||
"phone": "Phone",
|
||||
"dept": "Department",
|
||||
"dept": "Channel",
|
||||
"dashboard": "Dashboard",
|
||||
"loginTime": "Last Login",
|
||||
"agentId": "Agent ID",
|
||||
@@ -28,7 +28,7 @@
|
||||
"labelPasswordConfirm": "Confirm Password",
|
||||
"labelEmail": "Email",
|
||||
"labelPhone": "Phone",
|
||||
"labelDept": "Department",
|
||||
"labelDept": "Channel",
|
||||
"labelRole": "Role",
|
||||
"labelGender": "Gender",
|
||||
"labelStatus": "Status",
|
||||
@@ -42,12 +42,15 @@
|
||||
"rulePasswordRequired": "Please enter password",
|
||||
"rulePasswordLength": "Length must be between 6 and 20 characters",
|
||||
"rulePasswordConfirmRequired": "Please enter confirm password",
|
||||
"ruleDeptRequired": "Please select department",
|
||||
"ruleDeptRequired": "Please select channel",
|
||||
"ruleRoleRequired": "Please select role",
|
||||
"addSuccess": "Added successfully",
|
||||
"editSuccess": "Updated successfully"
|
||||
},
|
||||
"ui": {
|
||||
"channelList": "Channel List",
|
||||
"viewingChannel": "Current channel",
|
||||
"defaultConfigTemplate": "Default config template",
|
||||
"promptNewPassword": "Please enter a new password",
|
||||
"passwordLengthError": "Password length must be between 6 and 16",
|
||||
"passwordChanged": "Password updated",
|
||||
|
||||
@@ -37,7 +37,15 @@
|
||||
"tips": "提示",
|
||||
"cancel": "取消",
|
||||
"confirm": "确定",
|
||||
"logOutTips": "您是否要退出登录?"
|
||||
"logOutTips": "您是否要退出登录?",
|
||||
"channelScope": {
|
||||
"listTitle": "渠道列表",
|
||||
"defaultTemplate": "默认配置模板",
|
||||
"defaultRoleTemplate": "默认角色模板",
|
||||
"currentConfig": "当前配置",
|
||||
"currentChannel": "当前渠道",
|
||||
"currentRole": "当前角色范围"
|
||||
}
|
||||
},
|
||||
"uiMsg": {
|
||||
"titlePrompt": "提示",
|
||||
@@ -383,7 +391,7 @@
|
||||
"role": "角色管理",
|
||||
"userCenter": "个人中心",
|
||||
"menu": "菜单管理",
|
||||
"dept": "渠道(部门)管理",
|
||||
"dept": "渠道管理",
|
||||
"config": "系统配置"
|
||||
},
|
||||
"safeguard": {
|
||||
@@ -445,8 +453,8 @@
|
||||
"placeholderTaskName": "请输入任务名称",
|
||||
"placeholderTableName": "请输入数据表名称",
|
||||
"placeholderDataSource": "请输入数据源名称",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"placeholderDeptName": "请输入渠道名称",
|
||||
"placeholderDeptCode": "请输入渠道编码",
|
||||
"placeholderRoleName": "请输入角色名称",
|
||||
"placeholderRoleCode": "请输入角色编码",
|
||||
"placeholderMenuName": "请输入菜单名称",
|
||||
@@ -512,13 +520,13 @@
|
||||
"system": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"dept": "部门",
|
||||
"dept": "渠道",
|
||||
"dashboard": "首页",
|
||||
"loginTime": "上次登录",
|
||||
"agentId": "代理ID",
|
||||
"deptName": "部门名称",
|
||||
"deptCode": "部门编码",
|
||||
"leader": "部门领导",
|
||||
"deptName": "渠道名称",
|
||||
"deptCode": "渠道编码",
|
||||
"leader": "渠道负责人",
|
||||
"roleName": "角色名称",
|
||||
"roleCode": "角色编码",
|
||||
"level": "角色级别",
|
||||
@@ -538,7 +546,7 @@
|
||||
"titleEn": "标题(英文)",
|
||||
"value": "值",
|
||||
"valueEn": "值(英文)",
|
||||
"noParentDept": "无上级部门",
|
||||
"noParentDept": "无上级渠道",
|
||||
"noParentMenu": "无上级菜单",
|
||||
"input": "文本框",
|
||||
"textarea": "文本域",
|
||||
|
||||
45
saiadmin-artd/src/locales/langs/zh/dice/game.json
Normal file
45
saiadmin-artd/src/locales/langs/zh/dice/game.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增游戏",
|
||||
"dialogTitleEdit": "编辑游戏",
|
||||
"provider": "供应商",
|
||||
"placeholderProvider": "请输入供应商名称",
|
||||
"providerCode": "供应商编码",
|
||||
"placeholderProviderCode": "请输入供应商编码",
|
||||
"gameCode": "游戏编号",
|
||||
"placeholderGameCode": "请输入游戏编号",
|
||||
"gameKey": "游戏唯一值",
|
||||
"placeholderGameKey": "请输入游戏唯一值",
|
||||
"gameName": "中文名称",
|
||||
"placeholderGameName": "请输入中文名称",
|
||||
"gameNameEn": "英文名称",
|
||||
"placeholderGameNameEn": "请输入英文名称",
|
||||
"gameType": "游戏类型",
|
||||
"placeholderGameType": "请输入游戏类型",
|
||||
"sort": "排序",
|
||||
"logo": "Logo地址",
|
||||
"tabPicker": "图片选择",
|
||||
"tabUpload": "图片上传",
|
||||
"gameUrl": "游戏地址",
|
||||
"placeholderGameUrl": "请输入游戏地址",
|
||||
"hallUrl": "大厅地址",
|
||||
"placeholderHallUrl": "请输入大厅地址",
|
||||
"status": "状态",
|
||||
"statusEnabled": "启用",
|
||||
"statusDisabled": "禁用",
|
||||
"remark": "备注",
|
||||
"placeholderRemark": "请输入备注",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "更新成功",
|
||||
"ruleProviderRequired": "请输入供应商",
|
||||
"ruleProviderCodeRequired": "请输入供应商编码",
|
||||
"ruleGameCodeRequired": "请输入游戏编号",
|
||||
"ruleGameKeyRequired": "请输入游戏唯一值",
|
||||
"ruleGameNameRequired": "请输入中文名称",
|
||||
"ruleGameTypeRequired": "请输入游戏类型"
|
||||
},
|
||||
"table": {
|
||||
"statusEnabled": "启用",
|
||||
"statusDisabled": "禁用"
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
"profitCalcHint": "计算方式:付费每局按“赢取平台币 win_coin(含 BIGWIN)减去付费金额 压注金额paid_amount(= 压注倍数ante×1)”累加;免费每局按“玩家赢得平台币win_coin”累加。弹窗打开期间每 2 秒自动刷新",
|
||||
"tierRuleTitle": "抽奖档位规则",
|
||||
"tierRuleContent": "当玩家在当前彩金池的累计盈利 低于安全线 时,按 玩家 的 T*_weight 权重抽取档位;当累计盈利 高于或等于安全线 时,按 当前彩金池 的 T*_weight 权重抽取档位(杀分)。",
|
||||
"enableKillScore": "开启杀分",
|
||||
"killScoreWeights": "杀分权重",
|
||||
"killWeightNote": "(杀分权重来自奖池配置,请在列表中编辑对应记录)",
|
||||
"btnResetProfit": "重置玩家累计盈利",
|
||||
|
||||
@@ -34,7 +34,15 @@
|
||||
"placeholderRewardTier": "请选择中奖档位",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功",
|
||||
"validateFailed": "表单验证失败,请检查必填项与格式"
|
||||
"validateFailed": "表单验证失败,请检查必填项与格式",
|
||||
"rulePlayerRequired": "请选择玩家",
|
||||
"ruleLotteryConfigRequired": "请选择彩金池配置",
|
||||
"ruleLotteryTypeRequired": "请选择抽奖类型",
|
||||
"ruleIsWinRequired": "请选择是否中大奖",
|
||||
"ruleWinCoinRequired": "赢取平台币必填",
|
||||
"ruleRollArrayLength": "摇取点数必须为 5 个数",
|
||||
"ruleRollArrayValues": "摇取点数必须填写 5 个数,每个 1~6",
|
||||
"ruleRewardTierRequired": "请选择中奖档位"
|
||||
},
|
||||
"toolbar": {
|
||||
"platformTotalProfit": "平台总盈利"
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"status": "状态",
|
||||
"adminId": "所属管理员",
|
||||
"placeholderAdmin": "选择后台管理员(可选)",
|
||||
"placeholderAdminTree": "按渠道选择后台管理员",
|
||||
"unassignedChannel": "未分配渠道",
|
||||
"coin": "平台币",
|
||||
"placeholderCoinAdd": "创建时默认0,不可改",
|
||||
"lotteryPoolConfig": "彩金池配置",
|
||||
@@ -44,7 +46,18 @@
|
||||
"ruleEnterCoin": "请输入平台币变动",
|
||||
"ruleCoinPositive": "平台币变动必须大于 0",
|
||||
"ruleDeductExceed": "扣点不能超过当前余额",
|
||||
"operateSuccess": "操作成功"
|
||||
"operateSuccess": "操作成功",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功",
|
||||
"rulePasswordRequired": "密码必需填写",
|
||||
"ruleUsernameRequired": "用户名必需填写",
|
||||
"ruleNicknameRequired": "昵称必需填写",
|
||||
"rulePhoneRequired": "手机号必需填写",
|
||||
"ruleStatusRequired": "状态必需填写",
|
||||
"ruleCoinRequired": "平台币必需填写",
|
||||
"configTypeDefault": "默认",
|
||||
"configTypeKillScore": "杀分",
|
||||
"configTypeUp": "上分"
|
||||
},
|
||||
"search": {
|
||||
"username": "用户名",
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
"placeholderTotalDrawCount": "自动求和",
|
||||
"placeholderRemark": "请输入备注(必填)",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
"editSuccess": "修改成功",
|
||||
"rulePlayerRequired": "请选择玩家",
|
||||
"ruleUseCoinsRequired": "消耗硬币必需填写",
|
||||
"rulePaidDrawRequired": "购买抽奖次数必需填写",
|
||||
"ruleFreeDrawRequired": "赠送抽奖次数必需填写",
|
||||
"ruleRemarkRequired": "备注必需填写"
|
||||
},
|
||||
"search": {
|
||||
"player": "玩家",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"coinChangeSummary": "平台币变化统计"
|
||||
},
|
||||
"form": {
|
||||
"dialogTitleAdd": "新增玩家钱包流水",
|
||||
"dialogTitleEdit": "编辑玩家钱包流水",
|
||||
@@ -19,7 +22,10 @@
|
||||
"placeholderWalletAfter": "根据平台币变化自动计算",
|
||||
"placeholderRemark": "选填",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
"editSuccess": "修改成功",
|
||||
"ruleUserRequired": "请选择用户",
|
||||
"ruleCoinRequired": "平台币变化必填",
|
||||
"ruleTypeRequired": "请选择类型"
|
||||
},
|
||||
"search": {
|
||||
"type": "类型",
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
"stepFree": "免费抽奖券",
|
||||
"labelLotteryTypePaid": "测试数据档位类型",
|
||||
"labelLotteryTypeFree": "测试数据档位类型",
|
||||
"labelAnte": "底注 ante",
|
||||
"labelAnte": "底注",
|
||||
"placeholderAnte": "请选择底注配置",
|
||||
"placeholderPaidPool": "不选则下方自定义档位概率(默认 default)",
|
||||
"placeholderFreePool": "不选则下方自定义档位概率(默认 killScore)",
|
||||
"tierProbHint": "自定义档位概率(T1~T5),每档 0-100%,五档之和不能超过 100%",
|
||||
@@ -81,7 +82,7 @@
|
||||
"btnNext": "下一步",
|
||||
"btnStart": "开始测试",
|
||||
"btnCancel": "取消",
|
||||
"warnAnte": "底注 ante 必须大于 0",
|
||||
"warnAnte": "请选择底注",
|
||||
"warnPaidSpins": "付费抽奖顺时针与逆时针次数之和须大于 0",
|
||||
"warnTestSafetyLine": "测试安全线必须大于或等于 0",
|
||||
"warnTotalSpins": "付费或免费至少一种方向次数之和大于 0",
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
{
|
||||
"search": {
|
||||
"deptName": "渠道(部门)名称",
|
||||
"deptCode": "部门编码",
|
||||
"deptName": "渠道名称",
|
||||
"deptCode": "渠道编码",
|
||||
"status": "状态",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"placeholderDeptName": "请输入渠道名称",
|
||||
"placeholderDeptCode": "请输入渠道编码",
|
||||
"searchSelectPlaceholder": "请选择"
|
||||
},
|
||||
"table": {
|
||||
"deptName": "渠道(部门)名称",
|
||||
"deptCode": "部门编码",
|
||||
"leader": "部门领导",
|
||||
"deptName": "渠道名称",
|
||||
"deptCode": "渠道编码",
|
||||
"leader": "渠道负责人",
|
||||
"sort": "排序",
|
||||
"status": "状态",
|
||||
"createTime": "创建时间"
|
||||
},
|
||||
"form": {
|
||||
"titleAdd": "新增部门",
|
||||
"titleEdit": "编辑部门",
|
||||
"labelParentDept": "上级部门",
|
||||
"labelDeptName": "部门名称",
|
||||
"labelDeptCode": "部门编码",
|
||||
"labelLeader": "部门领导",
|
||||
"titleAdd": "新增渠道",
|
||||
"titleEdit": "编辑渠道",
|
||||
"labelDeptName": "渠道名称",
|
||||
"labelDeptCode": "渠道编码",
|
||||
"labelLeader": "渠道负责人",
|
||||
"labelRemark": "描述",
|
||||
"labelSort": "排序",
|
||||
"labelStatus": "启用",
|
||||
"placeholderDeptName": "请输入部门名称",
|
||||
"placeholderDeptCode": "请输入部门编码",
|
||||
"placeholderRemark": "请输入部门描述",
|
||||
"placeholderDeptName": "请输入渠道名称",
|
||||
"placeholderDeptCode": "请输入渠道编码",
|
||||
"placeholderRemark": "请输入渠道描述",
|
||||
"placeholderSort": "请输入排序",
|
||||
"noParentDept": "无上级部门",
|
||||
"ruleParentDeptRequired": "请选择上级部门",
|
||||
"ruleDeptNameRequired": "请输入部门名称",
|
||||
"ruleDeptCodeRequired": "请输入部门编码",
|
||||
"ruleDeptNameRequired": "请输入渠道名称",
|
||||
"ruleDeptCodeRequired": "请输入渠道编码",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"table": {
|
||||
"username": "用户名",
|
||||
"phone": "手机号",
|
||||
"dept": "部门",
|
||||
"dept": "渠道",
|
||||
"dashboard": "首页",
|
||||
"loginTime": "上次登录",
|
||||
"agentId": "代理ID",
|
||||
@@ -28,7 +28,7 @@
|
||||
"labelPasswordConfirm": "确认密码",
|
||||
"labelEmail": "邮箱",
|
||||
"labelPhone": "手机号",
|
||||
"labelDept": "部门",
|
||||
"labelDept": "渠道",
|
||||
"labelRole": "角色",
|
||||
"labelGender": "性别",
|
||||
"labelStatus": "状态",
|
||||
@@ -42,12 +42,15 @@
|
||||
"rulePasswordRequired": "请输入密码",
|
||||
"rulePasswordLength": "长度在 6 到 20 个字符",
|
||||
"rulePasswordConfirmRequired": "请输入确认密码",
|
||||
"ruleDeptRequired": "请选择部门",
|
||||
"ruleDeptRequired": "请选择渠道",
|
||||
"ruleRoleRequired": "请选择角色",
|
||||
"addSuccess": "新增成功",
|
||||
"editSuccess": "修改成功"
|
||||
},
|
||||
"ui": {
|
||||
"channelList": "渠道列表",
|
||||
"viewingChannel": "当前配置渠道",
|
||||
"defaultConfigTemplate": "默认配置模板",
|
||||
"promptNewPassword": "请输入新密码",
|
||||
"passwordLengthError": "密码长度在6到16之间",
|
||||
"passwordChanged": "修改密码成功",
|
||||
|
||||
48
saiadmin-artd/src/utils/channelLayout.ts
Normal file
48
saiadmin-artd/src/utils/channelLayout.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { RouteLocationNormalized } from 'vue-router'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
/** 页面自带左侧渠道栏,不再包一层全局渠道壳 */
|
||||
const BUILTIN_CHANNEL_LAYOUT_PATHS = [
|
||||
'/system/user',
|
||||
'/system/dept'
|
||||
]
|
||||
|
||||
export function isSuperAdminUser(): boolean {
|
||||
const userStore = useUserStore()
|
||||
return Number(userStore.info?.id ?? 0) === 1
|
||||
}
|
||||
|
||||
/** 游戏配置类页面:显示「默认配置模板」 */
|
||||
export function isConfigChannelRoute(route: Pick<RouteLocationNormalized, 'path' | 'meta'>): boolean {
|
||||
if (route.meta?.channelScope === 'config') {
|
||||
return true
|
||||
}
|
||||
return /\/(config|ante_config|lottery_pool_config|reward_config|game)(\/|$)/.test(route.path)
|
||||
}
|
||||
|
||||
/** 角色管理:左侧渠道树含默认模板(dept_id=0)与各渠道角色 */
|
||||
export function isRoleChannelRoute(route: Pick<RouteLocationNormalized, 'path' | 'meta'>): boolean {
|
||||
if (route.meta?.channelScope === 'role') {
|
||||
return true
|
||||
}
|
||||
return route.path.startsWith('/system/role')
|
||||
}
|
||||
|
||||
export function shouldWrapSuperAdminChannelLayout(route: RouteLocationNormalized): boolean {
|
||||
if (!isSuperAdminUser()) {
|
||||
return false
|
||||
}
|
||||
if (route.meta?.isFullPage) {
|
||||
return false
|
||||
}
|
||||
if (route.meta?.noChannelLayout === true) {
|
||||
return false
|
||||
}
|
||||
const path = route.path
|
||||
for (let i = 0; i < BUILTIN_CHANNEL_LAYOUT_PATHS.length; i++) {
|
||||
if (path.startsWith(BUILTIN_CHANNEL_LAYOUT_PATHS[i])) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchRechargeBarChart } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
/**
|
||||
* 充值金额数据
|
||||
@@ -29,10 +30,12 @@
|
||||
*/
|
||||
const xData = ref<string[]>([])
|
||||
|
||||
onMounted(async () => {
|
||||
fetchRechargeBarChart().then((data: any) => {
|
||||
const loadChart = () => {
|
||||
fetchRechargeBarChart(getChannelDeptRequestParams()).then((data: any) => {
|
||||
yData.value = data?.recharge_amount ?? []
|
||||
xData.value = data?.recharge_month ?? []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadChart)
|
||||
</script>
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchStatistics } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const statData = ref({
|
||||
player_count: 0,
|
||||
@@ -123,8 +124,8 @@
|
||||
return 'text-g-600'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchStatistics().then((data: any) => {
|
||||
const loadStatistics = () => {
|
||||
fetchStatistics(getChannelDeptRequestParams()).then((data: any) => {
|
||||
statData.value = {
|
||||
player_count: data?.player_count ?? 0,
|
||||
player_count_change: data?.player_count_change ?? 0,
|
||||
@@ -136,5 +137,7 @@
|
||||
play_count_change: data?.play_count_change ?? 0
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadStatistics)
|
||||
</script>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchNewPlayerList, type NewPlayerItem } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const tableData = ref<NewPlayerItem[]>([])
|
||||
|
||||
@@ -49,9 +50,11 @@
|
||||
return Number(val).toFixed(2)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchNewPlayerList().then((data) => {
|
||||
const loadList = () => {
|
||||
fetchNewPlayerList(getChannelDeptRequestParams()).then((data) => {
|
||||
tableData.value = Array.isArray(data) ? data : []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadList)
|
||||
</script>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchPlayRecordList, type PlayRecordItem } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const tableData = ref<PlayRecordItem[]>([])
|
||||
|
||||
@@ -59,9 +60,11 @@
|
||||
return Number(val).toFixed(2)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchPlayRecordList().then((data) => {
|
||||
const loadList = () => {
|
||||
fetchPlayRecordList(getChannelDeptRequestParams()).then((data) => {
|
||||
tableData.value = Array.isArray(data) ? data : []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadList)
|
||||
</script>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchRechargeChart } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
/**
|
||||
* 充值金额数据
|
||||
@@ -28,10 +29,12 @@
|
||||
*/
|
||||
const xData = ref<string[]>([])
|
||||
|
||||
onMounted(async () => {
|
||||
fetchRechargeChart().then((data: any) => {
|
||||
const loadChart = () => {
|
||||
fetchRechargeChart(getChannelDeptRequestParams()).then((data: any) => {
|
||||
yData.value = data?.recharge_amount ?? []
|
||||
xData.value = data?.recharge_date ?? []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadChart)
|
||||
</script>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { fetchWalletRecordList, type WalletRecordItem } from '@/api/dashboard'
|
||||
import { getChannelDeptRequestParams, useChannelDeptReload } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const tableData = ref<WalletRecordItem[]>([])
|
||||
|
||||
@@ -38,9 +39,11 @@
|
||||
return Number(val).toFixed(2)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchWalletRecordList().then((data) => {
|
||||
const loadList = () => {
|
||||
fetchWalletRecordList(getChannelDeptRequestParams()).then((data) => {
|
||||
tableData.value = Array.isArray(data) ? data : []
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
useChannelDeptReload(loadList)
|
||||
</script>
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -111,10 +112,10 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
await api.save(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -36,5 +36,16 @@ export default {
|
||||
url: '/core/dice/ante_config/DiceAnteConfig/destroy',
|
||||
data: params
|
||||
})
|
||||
},
|
||||
|
||||
/** 底注下拉(按渠道) */
|
||||
async getOptions(params?: Record<string, unknown>) {
|
||||
const res = await request.get<
|
||||
Array<{ id: number; name: string; title: string; mult: number; is_default: number }>
|
||||
>({
|
||||
url: '/core/dice/ante_config/DiceAnteConfig/getOptions',
|
||||
params
|
||||
})
|
||||
return Array.isArray(res) ? res : []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
* 获取 DiceLotteryPoolConfig 列表数据,含 id、name、t1_weight~t5_weight,用于一键测试权重档位类型下拉
|
||||
* name 映射:default=原 type=0,killScore=原 type=1,up=原 type=2
|
||||
*/
|
||||
async getOptions(): Promise<
|
||||
async getOptions(params?: Record<string, unknown>): Promise<
|
||||
Array<{
|
||||
id: number
|
||||
name: string
|
||||
@@ -32,7 +32,8 @@ export default {
|
||||
}>
|
||||
> {
|
||||
const res = await request.get<any>({
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/getOptions'
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/getOptions',
|
||||
params
|
||||
})
|
||||
const rows = Array.isArray(res) ? res : (Array.isArray((res as any)?.data) ? (res as any).data : [])
|
||||
if (!Array.isArray(rows)) return []
|
||||
@@ -97,7 +98,7 @@ export default {
|
||||
/**
|
||||
* 获取当前彩金池(Redis 实例化,无则按 type=0 创建),含玩家累计盈利 profit_amount 实时值
|
||||
*/
|
||||
getCurrentPool() {
|
||||
getCurrentPool(params?: { dept_id?: number }) {
|
||||
return request.get<{
|
||||
id: number
|
||||
name: string
|
||||
@@ -110,14 +111,15 @@ export default {
|
||||
t5_weight: number
|
||||
profit_amount: number
|
||||
}>({
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/getCurrentPool'
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/getCurrentPool',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新当前彩金池:仅 safety_line、t1_weight~t5_weight,不可改 profit_amount
|
||||
*/
|
||||
updateCurrentPool(params: { safety_line?: number; kill_enabled?: number }) {
|
||||
updateCurrentPool(params: { safety_line?: number; kill_enabled?: number; dept_id?: number }) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/updateCurrentPool',
|
||||
data: params
|
||||
@@ -127,9 +129,10 @@ export default {
|
||||
/**
|
||||
* 重置当前彩金池的玩家累计盈利(profit_amount 置为 0)
|
||||
*/
|
||||
resetProfitAmount() {
|
||||
resetProfitAmount(params?: { dept_id?: number }) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/resetProfitAmount'
|
||||
url: '/core/dice/lottery_pool_config/DiceLotteryPoolConfig/resetProfitAmount',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,16 +64,18 @@ export default {
|
||||
},
|
||||
|
||||
/** 获取玩家选项(id、username) */
|
||||
getPlayerOptions() {
|
||||
getPlayerOptions(params?: Record<string, unknown>) {
|
||||
return request.get<{ id: number; username: string }[]>({
|
||||
url: '/core/dice/play_record/DicePlayRecord/getPlayerOptions'
|
||||
url: '/core/dice/play_record/DicePlayRecord/getPlayerOptions',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
/** 获取彩金池配置选项(id、name) */
|
||||
getLotteryConfigOptions() {
|
||||
getLotteryConfigOptions(params?: Record<string, unknown>) {
|
||||
return request.get<{ id: number; name: string }[]>({
|
||||
url: '/core/dice/play_record/DicePlayRecord/getLotteryConfigOptions'
|
||||
url: '/core/dice/play_record/DicePlayRecord/getLotteryConfigOptions',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,9 +87,10 @@ export default {
|
||||
* 获取彩金池配置选项(DiceLotteryPoolConfig.id、name),供 lottery_config_id 下拉使用
|
||||
* @returns [ { id, name } ]
|
||||
*/
|
||||
async getLotteryConfigOptions(): Promise<Array<{ id: number; name: string }>> {
|
||||
async getLotteryConfigOptions(params?: Record<string, unknown>): Promise<Array<{ id: number; name: string }>> {
|
||||
const res = await request.get<any>({
|
||||
url: '/core/dice/player/DicePlayer/getLotteryConfigOptions'
|
||||
url: '/core/dice/player/DicePlayer/getLotteryConfigOptions',
|
||||
params
|
||||
})
|
||||
const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{ id: number; name: string }>
|
||||
return rows.map((r) => ({ id: Number(r.id), name: String(r.name ?? r.id ?? '') }))
|
||||
@@ -99,11 +100,12 @@ export default {
|
||||
* 获取后台管理员选项(SystemUser),供 admin_id 下拉使用
|
||||
* @returns [ { id, username, realname, label } ]
|
||||
*/
|
||||
async getSystemUserOptions(): Promise<
|
||||
async getSystemUserOptions(params?: Record<string, unknown>): Promise<
|
||||
Array<{ id: number; username: string; realname: string; label: string }>
|
||||
> {
|
||||
const res = await request.get<any>({
|
||||
url: '/core/dice/player/DicePlayer/getSystemUserOptions'
|
||||
url: '/core/dice/player/DicePlayer/getSystemUserOptions',
|
||||
params
|
||||
})
|
||||
const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{
|
||||
id: number
|
||||
@@ -117,5 +119,29 @@ export default {
|
||||
realname: String(r.realname ?? ''),
|
||||
label: String(r.label ?? r.username ?? r.id ?? '')
|
||||
}))
|
||||
},
|
||||
|
||||
/**
|
||||
* 超管:按渠道树状展示全部管理员;非超管:扁平列表
|
||||
*/
|
||||
async getSystemUserTreeOptions(params?: Record<string, unknown>): Promise<
|
||||
Array<{
|
||||
id: number | string
|
||||
label: string
|
||||
disabled?: boolean
|
||||
children?: Array<{ id: number; username: string; realname: string; label: string }>
|
||||
}>
|
||||
> {
|
||||
const res = await request.get<any>({
|
||||
url: '/core/dice/player/DicePlayer/getSystemUserTreeOptions',
|
||||
params
|
||||
})
|
||||
const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{
|
||||
id: number | string
|
||||
label: string
|
||||
disabled?: boolean
|
||||
children?: Array<{ id: number; username: string; realname: string; label: string }>
|
||||
}>
|
||||
return rows
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,10 @@ export default {
|
||||
/**
|
||||
* 获取玩家选项(id、username)用于下拉
|
||||
*/
|
||||
getPlayerOptions() {
|
||||
getPlayerOptions(params?: Record<string, unknown>) {
|
||||
return request.get<Api.Common.ApiData>({
|
||||
url: '/core/dice/player_ticket_record/DicePlayerTicketRecord/getPlayerOptions'
|
||||
url: '/core/dice/player_ticket_record/DicePlayerTicketRecord/getPlayerOptions',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
* @returns 数据列表
|
||||
*/
|
||||
list(params: Record<string, any>) {
|
||||
return request.get<Api.Common.ApiPage>({
|
||||
return request.get<Api.Common.ApiPage & { total_coin_change?: number }>({
|
||||
url: '/core/dice/player_wallet_record/DicePlayerWalletRecord/index',
|
||||
params
|
||||
})
|
||||
@@ -66,9 +66,10 @@ export default {
|
||||
/**
|
||||
* 获取玩家选项(id、username)用于下拉
|
||||
*/
|
||||
getPlayerOptions() {
|
||||
getPlayerOptions(params?: Record<string, unknown>) {
|
||||
return request.get<{ id: number; username: string }[]>({
|
||||
url: '/core/dice/player_wallet_record/DicePlayerWalletRecord/getPlayerOptions'
|
||||
url: '/core/dice/player_wallet_record/DicePlayerWalletRecord/getPlayerOptions',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -19,19 +19,20 @@ export default {
|
||||
* 权重编辑弹窗:按档位分组获取当前方向的配置+权重(单方向)
|
||||
* @param direction 0=顺时针 1=逆时针
|
||||
*/
|
||||
weightRatioList(direction: 0 | 1) {
|
||||
weightRatioList(direction: 0 | 1, params?: Record<string, unknown>) {
|
||||
return request.get<Api.Common.ApiData>({
|
||||
url: '/core/dice/reward/DiceReward/weightRatioList',
|
||||
params: { direction }
|
||||
params: { direction, ...(params || {}) }
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 权重编辑弹窗:按档位分组获取配置+顺时针/逆时针权重(dice_reward 双方向)
|
||||
*/
|
||||
weightRatioListWithDirection() {
|
||||
weightRatioListWithDirection(params?: Record<string, unknown>) {
|
||||
return request.get<Api.Common.ApiData>({
|
||||
url: '/core/dice/reward/DiceReward/weightRatioListWithDirection'
|
||||
url: '/core/dice/reward/DiceReward/weightRatioListWithDirection',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
@@ -39,10 +40,13 @@ export default {
|
||||
* 权重编辑弹窗:按 DiceReward 主键 id 批量更新 weight
|
||||
* @param items [{ id: DiceReward.id, weight: 1-10000 }, ...]
|
||||
*/
|
||||
batchUpdateWeights(items: Array<{ id: number; weight: number }>) {
|
||||
batchUpdateWeights(
|
||||
items: Array<{ id: number; weight: number }>,
|
||||
extra?: Record<string, unknown>
|
||||
) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/reward/DiceReward/batchUpdateWeights',
|
||||
data: { items }
|
||||
data: { items, ...(extra || {}) }
|
||||
})
|
||||
},
|
||||
|
||||
@@ -62,6 +66,7 @@ export default {
|
||||
*/
|
||||
startWeightTest(params: {
|
||||
ante?: number
|
||||
ante_config_id?: number
|
||||
lottery_config_id?: number
|
||||
paid_lottery_config_id?: number
|
||||
free_lottery_config_id?: number
|
||||
|
||||
@@ -66,19 +66,23 @@ export default {
|
||||
/**
|
||||
* 批量更新奖励索引配置(第一页:id、grid_number、ui_text、real_ev、tier、remark)
|
||||
*/
|
||||
batchUpdate(items: Array<{ id: number; grid_number?: number; ui_text?: string; real_ev?: number; tier?: string; remark?: string }>) {
|
||||
batchUpdate(
|
||||
items: Array<{ id: number; grid_number?: number; ui_text?: string; real_ev?: number; tier?: string; remark?: string }>,
|
||||
extra?: Record<string, any>
|
||||
) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/batchUpdate',
|
||||
data: { items }
|
||||
data: { items, ...(extra || {}) }
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* T1-T5、BIGWIN 权重配比:按档位分组获取配置列表
|
||||
*/
|
||||
weightRatioList() {
|
||||
weightRatioList(params?: Record<string, unknown>) {
|
||||
return request.get<Api.Common.ApiData>({
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/weightRatioList'
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/weightRatioList',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
@@ -86,34 +90,41 @@ export default {
|
||||
* T1-T5、BIGWIN 权重配比:批量更新顺时针/逆时针权重(写入 dice_reward)
|
||||
*/
|
||||
/** 按 DiceReward 主键 id 批量更新 weight;items: [{ id, weight }, ...] */
|
||||
batchUpdateWeights(items: Array<{ id: number; weight: number }>) {
|
||||
batchUpdateWeights(
|
||||
items: Array<{ id: number; weight: number }>,
|
||||
extra?: Record<string, unknown>
|
||||
) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/batchUpdateWeights',
|
||||
data: { items }
|
||||
data: { items, ...(extra || {}) }
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 大奖权重:按 grid_number 批量保存 BIGWIN 权重(无需 reward id,不存在则自动创建)
|
||||
*/
|
||||
saveBigwinWeightsByGrid(items: Array<{ grid_number: number; weight: number }>) {
|
||||
saveBigwinWeightsByGrid(
|
||||
items: Array<{ grid_number: number; weight: number }>,
|
||||
extra?: Record<string, unknown>
|
||||
) {
|
||||
return request.post<any>({
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/saveBigwinWeightsByGrid',
|
||||
data: { items }
|
||||
data: { items, ...(extra || {}) }
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建奖励对照:按当前奖励配置为顺时针(0)、逆时针(1)生成所有色子可能对应的 dice_reward 记录,权重默认 1,可在奖励对照页权重编辑中调整
|
||||
*/
|
||||
createRewardReference() {
|
||||
createRewardReference(params?: Record<string, any>) {
|
||||
return request.post<{
|
||||
created_clockwise: number
|
||||
created_counterclockwise: number
|
||||
updated_clockwise: number
|
||||
updated_counterclockwise: number
|
||||
}>({
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/createRewardReference'
|
||||
url: '/core/dice/reward_config/DiceRewardConfig/createRewardReference',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
// { type: 'selection' },
|
||||
{ prop: 'group', label: 'page.table.group', minWidth: 140, align: 'center' },
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -162,10 +163,10 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
await api.save(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.saveSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.updateSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
@pagination:current-change="handleCurrentChange"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<ElTag :type="row.status === 1 ? 'success' : 'info'">{{ row.status === 1 ? '启用' : '禁用' }}</ElTag>
|
||||
<ElTag :type="row.status === 1 ? 'success' : 'info'">{{
|
||||
row.status === 1 ? $t('page.table.statusEnabled') : $t('page.table.statusDisabled')
|
||||
}}</ElTag>
|
||||
</template>
|
||||
<template #operation="{ row }">
|
||||
<div class="flex gap-2">
|
||||
@@ -103,6 +105,7 @@
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiParams: { limit: 100 },
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection', align: 'center' },
|
||||
{ prop: 'id', label: 'ID', width: 80, align: 'center' },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogType === 'add' ? '新增游戏' : '编辑游戏'"
|
||||
:title="dialogType === 'add' ? $t('page.form.dialogTitleAdd') : $t('page.form.dialogTitleEdit')"
|
||||
width="680px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@@ -10,55 +10,55 @@
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商" prop="provider">
|
||||
<el-input v-model="formData.provider" placeholder="请输入供应商名称" />
|
||||
<el-form-item :label="$t('page.form.provider')" prop="provider">
|
||||
<el-input v-model="formData.provider" :placeholder="$t('page.form.placeholderProvider')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商编码" prop="provider_code">
|
||||
<el-input v-model="formData.provider_code" placeholder="请输入供应商编码" />
|
||||
<el-form-item :label="$t('page.form.providerCode')" prop="provider_code">
|
||||
<el-input v-model="formData.provider_code" :placeholder="$t('page.form.placeholderProviderCode')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="游戏编号" prop="game_code">
|
||||
<el-input v-model="formData.game_code" placeholder="请输入游戏编号" />
|
||||
<el-form-item :label="$t('page.form.gameCode')" prop="game_code">
|
||||
<el-input v-model="formData.game_code" :placeholder="$t('page.form.placeholderGameCode')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="游戏唯一值" prop="game_key">
|
||||
<el-input v-model="formData.game_key" placeholder="请输入游戏唯一值" />
|
||||
<el-form-item :label="$t('page.form.gameKey')" prop="game_key">
|
||||
<el-input v-model="formData.game_key" :placeholder="$t('page.form.placeholderGameKey')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="中文名称" prop="game_name">
|
||||
<el-input v-model="formData.game_name" placeholder="请输入中文名称" />
|
||||
<el-form-item :label="$t('page.form.gameName')" prop="game_name">
|
||||
<el-input v-model="formData.game_name" :placeholder="$t('page.form.placeholderGameName')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="英文名称" prop="game_name_en">
|
||||
<el-input v-model="formData.game_name_en" placeholder="请输入英文名称" />
|
||||
<el-form-item :label="$t('page.form.gameNameEn')" prop="game_name_en">
|
||||
<el-input v-model="formData.game_name_en" :placeholder="$t('page.form.placeholderGameNameEn')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="游戏类型" prop="game_type">
|
||||
<el-input v-model="formData.game_type" placeholder="请输入游戏类型" />
|
||||
<el-form-item :label="$t('page.form.gameType')" prop="game_type">
|
||||
<el-input v-model="formData.game_type" :placeholder="$t('page.form.placeholderGameType')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-form-item :label="$t('page.form.sort')" prop="sort">
|
||||
<el-input-number v-model="formData.sort" :min="1" :step="1" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="Logo地址" prop="logo">
|
||||
<el-form-item :label="$t('page.form.logo')" prop="logo">
|
||||
<el-tabs v-model="logoInputMode" class="w-full">
|
||||
<el-tab-pane label="图片选择" name="picker">
|
||||
<el-tab-pane :label="$t('page.form.tabPicker')" name="picker">
|
||||
<sa-image-picker
|
||||
v-model="formData.logo"
|
||||
:multiple="false"
|
||||
@@ -67,7 +67,7 @@
|
||||
height="120px"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="图片上传" name="upload">
|
||||
<el-tab-pane :label="$t('page.form.tabUpload')" name="upload">
|
||||
<sa-image-upload
|
||||
v-model="formData.logo"
|
||||
:multiple="false"
|
||||
@@ -78,33 +78,42 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form-item>
|
||||
<el-form-item label="游戏地址" prop="game_url">
|
||||
<el-input v-model="formData.game_url" placeholder="请输入游戏地址" />
|
||||
<el-form-item :label="$t('page.form.gameUrl')" prop="game_url">
|
||||
<el-input v-model="formData.game_url" :placeholder="$t('page.form.placeholderGameUrl')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="大厅地址" prop="hall_url">
|
||||
<el-input v-model="formData.hall_url" placeholder="请输入大厅地址" />
|
||||
<el-form-item :label="$t('page.form.hallUrl')" prop="hall_url">
|
||||
<el-input v-model="formData.hall_url" :placeholder="$t('page.form.placeholderHallUrl')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item :label="$t('page.form.status')" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio :value="1">启用</el-radio>
|
||||
<el-radio :value="0">禁用</el-radio>
|
||||
<el-radio :value="1">{{ $t('page.form.statusEnabled') }}</el-radio>
|
||||
<el-radio :value="0">{{ $t('page.form.statusDisabled') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
<el-form-item :label="$t('page.form.remark')" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
:placeholder="$t('page.form.placeholderRemark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
<el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">{{ $t('table.form.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/game/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -121,40 +130,24 @@
|
||||
data: undefined
|
||||
})
|
||||
const emit = defineEmits<Emits>()
|
||||
const formRef = ref<FormInstance>()
|
||||
const logoInputMode = ref<'picker' | 'upload'>('picker')
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
set: (val) => emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
type GameFormData = {
|
||||
id: number | null
|
||||
provider: string
|
||||
provider_code: string
|
||||
game_code: string
|
||||
game_key: string
|
||||
game_name: string
|
||||
game_name_en: string
|
||||
game_type: string
|
||||
logo: string
|
||||
game_url: string
|
||||
hall_url: string
|
||||
status: number
|
||||
sort: number
|
||||
remark: string
|
||||
}
|
||||
const formRef = ref<FormInstance>()
|
||||
const logoInputMode = ref('picker')
|
||||
|
||||
const initialFormData: GameFormData = {
|
||||
id: null,
|
||||
provider: 'Dicey Fun',
|
||||
provider_code: 'DF',
|
||||
const initialFormData = {
|
||||
id: undefined as number | undefined,
|
||||
provider: '',
|
||||
provider_code: '',
|
||||
game_code: '',
|
||||
game_key: '',
|
||||
game_name: '',
|
||||
game_name_en: '',
|
||||
game_type: 'slot',
|
||||
game_type: '',
|
||||
logo: '',
|
||||
game_url: '',
|
||||
hall_url: '',
|
||||
@@ -166,12 +159,12 @@
|
||||
const formData = reactive({ ...initialFormData })
|
||||
|
||||
const rules = computed<FormRules>(() => ({
|
||||
provider: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
|
||||
provider_code: [{ required: true, message: '请输入供应商编码', trigger: 'blur' }],
|
||||
game_code: [{ required: true, message: '请输入游戏编号', trigger: 'blur' }],
|
||||
game_key: [{ required: true, message: '请输入游戏唯一值', trigger: 'blur' }],
|
||||
game_name: [{ required: true, message: '请输入中文名称', trigger: 'blur' }],
|
||||
game_type: [{ required: true, message: '请输入游戏类型', trigger: 'blur' }]
|
||||
provider: [{ required: true, message: t('page.form.ruleProviderRequired'), trigger: 'blur' }],
|
||||
provider_code: [{ required: true, message: t('page.form.ruleProviderCodeRequired'), trigger: 'blur' }],
|
||||
game_code: [{ required: true, message: t('page.form.ruleGameCodeRequired'), trigger: 'blur' }],
|
||||
game_key: [{ required: true, message: t('page.form.ruleGameKeyRequired'), trigger: 'blur' }],
|
||||
game_name: [{ required: true, message: t('page.form.ruleGameNameRequired'), trigger: 'blur' }],
|
||||
game_type: [{ required: true, message: t('page.form.ruleGameTypeRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
watch(
|
||||
@@ -209,11 +202,11 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success('新增成功')
|
||||
await api.save(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
ElMessage.success('更新成功')
|
||||
await api.update(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div class="art-full-height">
|
||||
<!-- 搜索面板 -->
|
||||
<div class="flex-1 min-h-0 flex flex-col">
|
||||
<TableSearch v-model="searchForm" @search="handleSearch" @reset="resetSearchParams" />
|
||||
|
||||
<ElCard class="art-table-card" shadow="never">
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开启杀分">
|
||||
<el-form-item :label="$t('page.form.enableKillScore')">
|
||||
<el-switch v-model="formData.kill_enabled" :active-value="1" :inactive-value="0" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.form.killScoreWeights')">
|
||||
@@ -85,8 +85,13 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
getChannelDeptRequestParams,
|
||||
withChannelDeptParams
|
||||
} from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
const channelDeptParams = () => getChannelDeptRequestParams()
|
||||
|
||||
interface PoolData {
|
||||
id: number
|
||||
@@ -151,7 +156,7 @@
|
||||
if (!visible.value) return
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await api.getCurrentPool()
|
||||
const res = await api.getCurrentPool(channelDeptParams())
|
||||
const data = res as unknown as PoolData
|
||||
if (data && typeof data === 'object') {
|
||||
pool.value = data
|
||||
@@ -172,7 +177,7 @@
|
||||
stopPolling()
|
||||
return
|
||||
}
|
||||
api.getCurrentPool().then((res) => {
|
||||
api.getCurrentPool(channelDeptParams()).then((res) => {
|
||||
const data = res as unknown as PoolData
|
||||
if (pool.value && data && typeof data === 'object' && data.profit_amount != null) {
|
||||
pool.value.profit_amount = data.profit_amount
|
||||
@@ -193,10 +198,12 @@
|
||||
try {
|
||||
await formRef.value?.validate?.()
|
||||
saving.value = true
|
||||
await api.updateCurrentPool({
|
||||
safety_line: formData.safety_line,
|
||||
kill_enabled: formData.kill_enabled
|
||||
})
|
||||
await api.updateCurrentPool(
|
||||
withChannelDeptParams({
|
||||
safety_line: formData.safety_line,
|
||||
kill_enabled: formData.kill_enabled
|
||||
})
|
||||
)
|
||||
ElMessage.success(t('page.form.msgSaveSuccess'))
|
||||
await loadPool()
|
||||
emit('success')
|
||||
@@ -211,7 +218,7 @@
|
||||
if (!pool.value) return
|
||||
try {
|
||||
resetting.value = true
|
||||
await api.resetProfitAmount()
|
||||
await api.resetProfitAmount(channelDeptParams())
|
||||
ElMessage.success(t('page.form.msgResetProfitSuccess'))
|
||||
await loadPool()
|
||||
emit('success')
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useInjectedChannelDept, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -127,6 +128,7 @@
|
||||
*/
|
||||
const initialFormData = {
|
||||
id: null as number | null,
|
||||
dept_id: undefined as number | undefined,
|
||||
name: '',
|
||||
remark: '',
|
||||
safety_line: 0 as number,
|
||||
@@ -174,6 +176,7 @@
|
||||
if (!props.data) return
|
||||
const numKeys = [
|
||||
'id',
|
||||
'dept_id',
|
||||
'safety_line',
|
||||
't1_weight',
|
||||
't2_weight',
|
||||
@@ -204,6 +207,8 @@
|
||||
/**
|
||||
* 提交表单
|
||||
*/
|
||||
const channelScope = useInjectedChannelDept()
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
try {
|
||||
@@ -212,11 +217,18 @@
|
||||
ElMessage.warning(t('page.form.msgWeightsMust100'))
|
||||
return
|
||||
}
|
||||
const submitData = withChannelDeptParams({
|
||||
...formData,
|
||||
dept_id:
|
||||
formData.dept_id ??
|
||||
props.data?.dept_id ??
|
||||
channelScope?.selectedDeptId.value
|
||||
})
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
await api.save(submitData)
|
||||
ElMessage.success(t('page.form.msgAddSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(submitData)
|
||||
ElMessage.success(t('page.form.msgUpdateSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/play_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
@@ -212,22 +213,22 @@
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
player_id: [{ required: true, message: '请选择玩家', trigger: 'change' }],
|
||||
lottery_config_id: [{ required: true, message: '请选择彩金池配置', trigger: 'change' }],
|
||||
lottery_type: [{ required: true, message: '请选择抽奖类型', trigger: 'change' }],
|
||||
is_win: [{ required: true, message: '请选择是否中大奖', trigger: 'change' }],
|
||||
win_coin: [{ required: true, message: '赢取平台币必填', trigger: 'blur' }],
|
||||
const rules = computed<FormRules>(() => ({
|
||||
player_id: [{ required: true, message: t('page.form.rulePlayerRequired'), trigger: 'change' }],
|
||||
lottery_config_id: [{ required: true, message: t('page.form.ruleLotteryConfigRequired'), trigger: 'change' }],
|
||||
lottery_type: [{ required: true, message: t('page.form.ruleLotteryTypeRequired'), trigger: 'change' }],
|
||||
is_win: [{ required: true, message: t('page.form.ruleIsWinRequired'), trigger: 'change' }],
|
||||
win_coin: [{ required: true, message: t('page.form.ruleWinCoinRequired'), trigger: 'blur' }],
|
||||
rollArrayItems: [
|
||||
{
|
||||
validator: (_rule: any, value: (number | null)[], callback: (e?: Error) => void) => {
|
||||
if (!value || value.length !== 5) {
|
||||
callback(new Error('摇取点数必须为 5 个数'))
|
||||
callback(new Error(t('page.form.ruleRollArrayLength')))
|
||||
return
|
||||
}
|
||||
const ok = value.every((n) => n != null && n >= 1 && n <= 6)
|
||||
if (!ok) {
|
||||
callback(new Error('摇取点数必须填写 5 个数,每个 1~6'))
|
||||
callback(new Error(t('page.form.ruleRollArrayValues')))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
@@ -235,8 +236,8 @@
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
reward_tier: [{ required: true, message: '请选择中奖档位', trigger: 'change' }]
|
||||
})
|
||||
reward_tier: [{ required: true, message: t('page.form.ruleRewardTierRequired'), trigger: 'change' }]
|
||||
}))
|
||||
|
||||
const playerOptions = ref<Array<{ id: number; username: string }>>([])
|
||||
const lotteryConfigOptions = ref<Array<{ id: number; name: string }>>([])
|
||||
@@ -272,9 +273,10 @@
|
||||
if (open) {
|
||||
initPage()
|
||||
try {
|
||||
const deptParams = getChannelDeptRequestParams()
|
||||
const [players, lotteryConfigs] = await Promise.all([
|
||||
api.getPlayerOptions(),
|
||||
api.getLotteryConfigOptions()
|
||||
api.getPlayerOptions(deptParams),
|
||||
api.getLotteryConfigOptions(deptParams)
|
||||
])
|
||||
playerOptions.value = Array.isArray(players) ? players : ((players as any)?.data ?? [])
|
||||
lotteryConfigOptions.value = Array.isArray(lotteryConfigs)
|
||||
@@ -391,10 +393,10 @@
|
||||
delete payload.rollArrayItems
|
||||
if (props.dialogType === 'add') {
|
||||
delete payload.id
|
||||
await api.save(payload)
|
||||
await api.save(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
await api.update(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -262,10 +263,10 @@
|
||||
await formRef.value.validate()
|
||||
const payload = { ...formData }
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
await api.save(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
await api.update(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/player/index'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import EditDialog from './modules/edit-dialog.vue'
|
||||
import WalletOperateDialog from './modules/WalletOperateDialog.vue'
|
||||
@@ -244,7 +245,7 @@
|
||||
const handleStatusChange = async (row: Record<string, any>, status: number) => {
|
||||
row._statusLoading = true
|
||||
try {
|
||||
await api.updateStatus({ id: row.id, status })
|
||||
await api.updateStatus(withChannelDeptParams({ id: row.id, status }))
|
||||
row.status = status
|
||||
} catch {
|
||||
refreshData()
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -157,12 +158,14 @@
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
await walletRecordApi.adminOperate({
|
||||
player_id: props.player.id,
|
||||
type: formData.type!,
|
||||
coin,
|
||||
remark: formData.remark?.trim() || undefined
|
||||
})
|
||||
await walletRecordApi.adminOperate(
|
||||
withChannelDeptParams({
|
||||
player_id: props.player.id,
|
||||
type: formData.type!,
|
||||
coin,
|
||||
remark: formData.remark?.trim() || undefined
|
||||
})
|
||||
)
|
||||
ElMessage.success(t('page.form.operateSuccess'))
|
||||
emit('success')
|
||||
handleClose()
|
||||
|
||||
@@ -35,7 +35,20 @@
|
||||
<sa-switch v-model="formData.status" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.form.adminId')" prop="admin_id">
|
||||
<el-tree-select
|
||||
v-if="useAdminTreeSelect"
|
||||
v-model="formData.admin_id"
|
||||
:data="systemUserTreeOptions"
|
||||
:props="systemUserTreeProps"
|
||||
:placeholder="$t('page.form.placeholderAdminTree')"
|
||||
clearable
|
||||
filterable
|
||||
check-strictly
|
||||
style="width: 100%"
|
||||
:loading="systemUserOptionsLoading"
|
||||
/>
|
||||
<el-select
|
||||
v-else
|
||||
v-model="formData.admin_id"
|
||||
:placeholder="$t('page.form.placeholderAdmin')"
|
||||
clearable
|
||||
@@ -172,6 +185,8 @@
|
||||
import api from '../../../api/player/index'
|
||||
import lotteryConfigApi from '../../../api/lottery_pool_config/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import { isSuperAdminUser } from '@/utils/channelLayout'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
@@ -222,16 +237,18 @@
|
||||
|
||||
/** 新增时密码必填,编辑时选填 */
|
||||
const passwordRules = computed(() =>
|
||||
props.dialogType === 'add' ? [{ required: true, message: '密码必需填写', trigger: 'blur' }] : []
|
||||
props.dialogType === 'add'
|
||||
? [{ required: true, message: t('page.form.rulePasswordRequired'), trigger: 'blur' }]
|
||||
: []
|
||||
)
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
username: [{ required: true, message: '用户名必需填写', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '昵称必需填写', trigger: 'blur' }],
|
||||
phone: [{ required: true, message: '手机号必需填写', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态必需填写', trigger: 'blur' }],
|
||||
coin: [{ required: true, message: '平台币必需填写', trigger: 'blur' }]
|
||||
})
|
||||
const rules = computed<FormRules>(() => ({
|
||||
username: [{ required: true, message: t('page.form.ruleUsernameRequired'), trigger: 'blur' }],
|
||||
name: [{ required: true, message: t('page.form.ruleNicknameRequired'), trigger: 'blur' }],
|
||||
phone: [{ required: true, message: t('page.form.rulePhoneRequired'), trigger: 'blur' }],
|
||||
status: [{ required: true, message: t('page.form.ruleStatusRequired'), trigger: 'blur' }],
|
||||
coin: [{ required: true, message: t('page.form.ruleCoinRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
const initialFormData = {
|
||||
id: null as number | null,
|
||||
@@ -262,6 +279,22 @@
|
||||
const systemUserOptions = ref<
|
||||
Array<{ id: number; username: string; realname: string; label: string }>
|
||||
>([])
|
||||
/** 超管:按渠道分组的管理员树 */
|
||||
const systemUserTreeOptions = ref<
|
||||
Array<{
|
||||
id: number | string
|
||||
label: string
|
||||
disabled?: boolean
|
||||
children?: Array<{ id: number; username: string; realname: string; label: string }>
|
||||
}>
|
||||
>([])
|
||||
const useAdminTreeSelect = computed(() => isSuperAdminUser())
|
||||
const systemUserTreeProps = {
|
||||
label: 'label',
|
||||
value: 'id',
|
||||
children: 'children',
|
||||
disabled: 'disabled'
|
||||
}
|
||||
/** 管理员选项加载中 */
|
||||
const systemUserOptionsLoading = ref(false)
|
||||
/** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */
|
||||
@@ -269,9 +302,9 @@
|
||||
|
||||
function lotteryConfigTypeText(name: unknown): string {
|
||||
const n = String(name ?? '')
|
||||
if (n === 'default') return '默认'
|
||||
if (n === 'killScore') return '杀分'
|
||||
if (n === 'up') return '上分'
|
||||
if (n === 'default') return t('page.form.configTypeDefault')
|
||||
if (n === 'killScore') return t('page.form.configTypeKillScore')
|
||||
if (n === 'up') return t('page.form.configTypeUp')
|
||||
return n || '-'
|
||||
}
|
||||
|
||||
@@ -335,12 +368,43 @@
|
||||
}
|
||||
|
||||
/** 加载后台管理员选项 */
|
||||
function normalizeAdminTreeLabels(
|
||||
nodes: Array<{
|
||||
id: number | string
|
||||
label: string
|
||||
disabled?: boolean
|
||||
children?: Array<{ id: number; username: string; realname: string; label: string }>
|
||||
}>
|
||||
) {
|
||||
return nodes.map((node) => {
|
||||
const item = { ...node }
|
||||
if (item.label === '__unassigned__') {
|
||||
item.label = t('page.form.unassignedChannel')
|
||||
}
|
||||
if (item.children?.length) {
|
||||
item.children = item.children.map((child) => ({
|
||||
...child,
|
||||
label: child.label || child.username || `#${child.id}`
|
||||
}))
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
|
||||
async function loadSystemUserOptions() {
|
||||
systemUserOptionsLoading.value = true
|
||||
try {
|
||||
systemUserOptions.value = await api.getSystemUserOptions()
|
||||
if (useAdminTreeSelect.value) {
|
||||
const tree = await api.getSystemUserTreeOptions(getChannelDeptRequestParams())
|
||||
systemUserTreeOptions.value = normalizeAdminTreeLabels(tree)
|
||||
systemUserOptions.value = []
|
||||
} else {
|
||||
systemUserOptions.value = await api.getSystemUserOptions(getChannelDeptRequestParams())
|
||||
systemUserTreeOptions.value = []
|
||||
}
|
||||
} catch {
|
||||
systemUserOptions.value = []
|
||||
systemUserTreeOptions.value = []
|
||||
} finally {
|
||||
systemUserOptionsLoading.value = false
|
||||
}
|
||||
@@ -363,7 +427,7 @@
|
||||
async function loadLotteryConfigOptions() {
|
||||
lotteryConfigLoading.value = true
|
||||
try {
|
||||
lotteryConfigOptions.value = await api.getLotteryConfigOptions()
|
||||
lotteryConfigOptions.value = await api.getLotteryConfigOptions(getChannelDeptRequestParams())
|
||||
} catch {
|
||||
lotteryConfigOptions.value = []
|
||||
} finally {
|
||||
@@ -376,6 +440,7 @@
|
||||
'status',
|
||||
'coin',
|
||||
'lottery_config_id',
|
||||
'admin_id',
|
||||
't1_weight',
|
||||
't2_weight',
|
||||
't3_weight',
|
||||
@@ -397,7 +462,7 @@
|
||||
;(formData as any)[key] = val != null ? Number(val) || null : null
|
||||
} else if (key === 'lottery_config_id' || key === 'admin_id') {
|
||||
const num = Number(val)
|
||||
;(formData as any)[key] = val != null && !Number.isNaN(num) && num !== 0 ? num : null
|
||||
;(formData as any)[key] = val != null && !Number.isNaN(num) && num > 0 ? num : null
|
||||
} else {
|
||||
;(formData as any)[key] = Number(val) || 0
|
||||
}
|
||||
@@ -429,10 +494,10 @@
|
||||
delete (payload as any).password
|
||||
}
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
await api.save(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
await api.update(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/player_ticket_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
@@ -120,11 +121,11 @@
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = reactive<FormRules>({
|
||||
player_id: [{ required: true, message: '请选择玩家', trigger: 'change' }],
|
||||
use_coins: [{ required: true, message: '消耗硬币必需填写', trigger: 'blur' }],
|
||||
paid_ticket_count: [{ required: true, message: '购买抽奖次数必需填写', trigger: 'blur' }],
|
||||
free_ticket_count: [{ required: true, message: '赠送抽奖次数必需填写', trigger: 'blur' }],
|
||||
remark: [{ required: true, message: '备注必需填写', trigger: 'blur' }]
|
||||
player_id: [{ required: true, message: t('page.form.rulePlayerRequired'), trigger: 'change' }],
|
||||
use_coins: [{ required: true, message: t('page.form.ruleUseCoinsRequired'), trigger: 'blur' }],
|
||||
paid_ticket_count: [{ required: true, message: t('page.form.rulePaidDrawRequired'), trigger: 'blur' }],
|
||||
free_ticket_count: [{ required: true, message: t('page.form.ruleFreeDrawRequired'), trigger: 'blur' }],
|
||||
remark: [{ required: true, message: t('page.form.ruleRemarkRequired'), trigger: 'blur' }]
|
||||
})
|
||||
|
||||
/** 玩家下拉选项(id、username) */
|
||||
@@ -168,7 +169,7 @@
|
||||
if (open) {
|
||||
initPage()
|
||||
try {
|
||||
const list = await api.getPlayerOptions()
|
||||
const list = await api.getPlayerOptions(getChannelDeptRequestParams())
|
||||
const arr = Array.isArray(list) ? list : (list as any)?.data
|
||||
playerOptions.value = Array.isArray(arr)
|
||||
? (arr as Array<{ id: number; username: string }>)
|
||||
@@ -232,10 +233,10 @@
|
||||
if (props.dialogType === 'add') {
|
||||
const rest = { ...formData } as Record<string, unknown>
|
||||
delete rest.id
|
||||
await api.save(rest)
|
||||
await api.save(withChannelDeptParams(rest))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
<!-- 表格头部 -->
|
||||
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
|
||||
<template #left>
|
||||
<span v-if="totalCoinChange !== null" class="table-summary-inline">
|
||||
{{ $t('page.toolbar.coinChangeSummary') }}:<strong :class="coinSummaryClass">{{
|
||||
formatMoney2(totalCoinChange)
|
||||
}}</strong>
|
||||
</span>
|
||||
<!-- <ElSpace wrap>-->
|
||||
<!-- <ElButton-->
|
||||
<!-- v-permission="'dice:player_wallet_record:index:save'"-->
|
||||
@@ -83,6 +88,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { defaultResponseAdapter } from '@/utils/table/tableUtils'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '../../api/player_wallet_record/index'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
@@ -97,15 +103,55 @@
|
||||
create_time: undefined as [string, string] | undefined
|
||||
})
|
||||
|
||||
// 搜索处理:将 create_time 区间转为 create_time_min / create_time_max
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
/** 当前筛选条件下平台币变化合计 */
|
||||
const totalCoinChange = ref<number | null>(null)
|
||||
|
||||
const coinSummaryClass = computed(() => {
|
||||
if (totalCoinChange.value === null) return ''
|
||||
if (totalCoinChange.value > 0) return 'coin-summary-positive'
|
||||
if (totalCoinChange.value < 0) return 'coin-summary-negative'
|
||||
return ''
|
||||
})
|
||||
|
||||
const WALLET_SEARCH_KEYS = [
|
||||
'type',
|
||||
'username',
|
||||
'coin_min',
|
||||
'coin_max',
|
||||
'create_time_min',
|
||||
'create_time_max'
|
||||
] as const
|
||||
|
||||
let summaryRequestSeq = 0
|
||||
|
||||
const listApi = async (params: Record<string, any>) => {
|
||||
const reqId = ++summaryRequestSeq
|
||||
const res = await api.list(params)
|
||||
if (reqId === summaryRequestSeq) {
|
||||
const summary = (res as Record<string, unknown> | undefined)?.total_coin_change
|
||||
totalCoinChange.value =
|
||||
summary !== undefined && summary !== null && summary !== '' ? Number(summary) : null
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
const applySearchParams = (params: Record<string, any>) => {
|
||||
const p = { ...params }
|
||||
if (Array.isArray(p.create_time) && p.create_time.length === 2) {
|
||||
p.create_time_min = p.create_time[0]
|
||||
p.create_time_max = p.create_time[1]
|
||||
}
|
||||
delete p.create_time
|
||||
const paramsRecord = searchParams as Record<string, unknown>
|
||||
WALLET_SEARCH_KEYS.forEach((key) => {
|
||||
delete paramsRecord[key]
|
||||
})
|
||||
Object.assign(searchParams, p)
|
||||
}
|
||||
|
||||
// 搜索处理:将 create_time 区间转为 create_time_min / create_time_max
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
applySearchParams(params)
|
||||
getData()
|
||||
}
|
||||
|
||||
@@ -169,8 +215,9 @@
|
||||
refreshData
|
||||
} = useTable({
|
||||
core: {
|
||||
apiFn: api.list,
|
||||
apiFn: listApi,
|
||||
apiParams: { limit: 100 },
|
||||
excludeParams: ['create_time'],
|
||||
columnsFactory: () => [
|
||||
{ type: 'selection', align: 'center' },
|
||||
{ prop: 'id', label: 'page.table.id', width: 80, align: 'center' },
|
||||
@@ -231,6 +278,25 @@
|
||||
useSlot: true
|
||||
}
|
||||
]
|
||||
},
|
||||
hooks: {
|
||||
onSuccess(_data, response) {
|
||||
const raw = response as unknown as Record<string, unknown>
|
||||
const summary = raw?.total_coin_change
|
||||
if (summary !== undefined && summary !== null && summary !== '') {
|
||||
totalCoinChange.value = Number(summary)
|
||||
}
|
||||
}
|
||||
},
|
||||
transform: {
|
||||
responseAdapter(response) {
|
||||
const raw = (response ?? {}) as Record<string, unknown>
|
||||
const base = defaultResponseAdapter(response)
|
||||
if (raw.total_coin_change !== undefined && raw.total_coin_change !== null) {
|
||||
;(base as Record<string, unknown>).total_coin_change = raw.total_coin_change
|
||||
}
|
||||
return base
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -248,6 +314,25 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.table-summary-inline {
|
||||
margin-right: 12px;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-regular);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table-summary-inline strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.coin-summary-positive {
|
||||
color: var(--el-color-success);
|
||||
}
|
||||
|
||||
.coin-summary-negative {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
/* 类型 tag 放大一倍(large + scale) */
|
||||
:deep(.wallet-record-type-tag) {
|
||||
transform: scale(0.8);
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/player_wallet_record/index'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams, withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
@@ -127,9 +128,9 @@
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules>({
|
||||
player_id: [{ required: true, message: '请选择用户', trigger: 'change' }],
|
||||
coin: [{ required: true, message: '平台币变化必填', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '请选择类型', trigger: 'change' }]
|
||||
player_id: [{ required: true, message: t('page.form.ruleUserRequired'), trigger: 'change' }],
|
||||
coin: [{ required: true, message: t('page.form.ruleCoinRequired'), trigger: 'blur' }],
|
||||
type: [{ required: true, message: t('page.form.ruleTypeRequired'), trigger: 'change' }]
|
||||
})
|
||||
|
||||
const initialFormData: {
|
||||
@@ -188,7 +189,7 @@
|
||||
if (open) {
|
||||
initPage()
|
||||
try {
|
||||
const list = await api.getPlayerOptions()
|
||||
const list = await api.getPlayerOptions(getChannelDeptRequestParams())
|
||||
playerOptions.value = Array.isArray(list) ? list : []
|
||||
} catch {
|
||||
playerOptions.value = []
|
||||
@@ -237,10 +238,10 @@
|
||||
calcWalletAfter()
|
||||
const payload = { ...formData }
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
await api.save(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
await api.update(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -46,17 +46,25 @@
|
||||
</ElCard>
|
||||
|
||||
<WeightRatioDialog v-model="weightRatioVisible" @success="refreshData" />
|
||||
<WeightTestDialog v-model="weightTestVisible" @success="refreshData" />
|
||||
<WeightTestDialog
|
||||
v-model="weightTestVisible"
|
||||
:channel-dept-id="channelDeptId"
|
||||
@success="refreshData"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useInjectedChannelDept } from '@/composables/useChannelDeptScope'
|
||||
import api from '../../api/reward/index'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import WeightRatioDialog from './modules/weight-ratio-dialog.vue'
|
||||
import WeightTestDialog from './modules/weight-test-dialog.vue'
|
||||
|
||||
const channelScope = useInjectedChannelDept()
|
||||
const channelDeptId = computed(() => channelScope?.selectedDeptId.value)
|
||||
|
||||
const currentDirection = ref<0 | 1>(0)
|
||||
const weightRatioVisible = ref(false)
|
||||
const weightTestVisible = ref(false)
|
||||
|
||||
@@ -262,6 +262,7 @@
|
||||
}
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -447,7 +448,7 @@
|
||||
function loadData() {
|
||||
loading.value = true
|
||||
api
|
||||
.weightRatioListWithDirection()
|
||||
.weightRatioListWithDirection(getChannelDeptRequestParams())
|
||||
.then((res: any) => {
|
||||
grouped.value = parsePayload(res)
|
||||
})
|
||||
@@ -483,7 +484,7 @@
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.batchUpdateWeights(items, getChannelDeptRequestParams())
|
||||
.then(() => {
|
||||
ElMessage.success(t('page.weightShared.saveSuccess'))
|
||||
emit('success')
|
||||
|
||||
@@ -319,6 +319,7 @@
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams } from '@/composables/useChannelDeptScope'
|
||||
function formatMoney2(val: unknown): string {
|
||||
if (val === '' || val === null || val === undefined) return '-'
|
||||
const n = typeof val === 'number' ? val : Number(val)
|
||||
@@ -482,7 +483,7 @@
|
||||
function loadData() {
|
||||
loading.value = true
|
||||
api
|
||||
.weightRatioListWithDirection()
|
||||
.weightRatioListWithDirection(getChannelDeptRequestParams())
|
||||
.then((res: any) => {
|
||||
grouped.value = parsePayload(res)
|
||||
})
|
||||
@@ -521,7 +522,7 @@
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.batchUpdateWeights(items, getChannelDeptRequestParams())
|
||||
.then(() => {
|
||||
ElMessage.success(t('page.weightShared.saveSuccess'))
|
||||
emit('success')
|
||||
|
||||
@@ -2,146 +2,170 @@
|
||||
<ElDialog
|
||||
v-model="visible"
|
||||
:title="$t('page.weightTest.title')"
|
||||
width="560px"
|
||||
width="920px"
|
||||
top="4vh"
|
||||
class="weight-test-dialog"
|
||||
:close-on-click-modal="false"
|
||||
destroy-on-close
|
||||
@close="onClose"
|
||||
>
|
||||
<ElAlert type="info" :closable="false" show-icon class="weight-test-tip">
|
||||
<template #title>{{ $t('page.weightTest.alertTitle') }}</template>
|
||||
{{ $t('page.weightTest.alertBody') }}
|
||||
</ElAlert>
|
||||
<ElAlert type="warning" :closable="false" show-icon class="weight-test-tip chain-tip">
|
||||
{{ $t('page.weightTest.chainModeHint') }}
|
||||
</ElAlert>
|
||||
<ElAlert type="info" :closable="false" show-icon class="weight-test-tip chain-tip">
|
||||
{{ $t('page.weightTest.killModeHint') }}
|
||||
</ElAlert>
|
||||
<ElForm :model="form" label-width="140px">
|
||||
<ElFormItem :label="$t('page.weightTest.labelAnte')" prop="ante" required>
|
||||
<ElInputNumber v-model="form.ante" :min="1" :step="1" style="width: 100%" />
|
||||
</ElFormItem>
|
||||
<ElFormItem :label="$t('page.weightTest.labelKillModeEnabled')" prop="kill_mode_enabled">
|
||||
<ElSwitch v-model="form.kill_mode_enabled" />
|
||||
</ElFormItem>
|
||||
<ElFormItem :label="$t('page.weightTest.labelTestSafetyLine')" prop="test_safety_line">
|
||||
<ElInputNumber
|
||||
v-model="form.test_safety_line"
|
||||
:min="0"
|
||||
:step="100"
|
||||
:disabled="!form.kill_mode_enabled"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<div class="weight-test-dialog-body">
|
||||
<ElAlert type="info" :closable="false" show-icon class="weight-test-tip compact-tip">
|
||||
<div class="tip-lines">
|
||||
<div>{{ $t('page.weightTest.alertBody') }}</div>
|
||||
<div>{{ $t('page.weightTest.chainModeHint') }}</div>
|
||||
<div>{{ $t('page.weightTest.killModeHint') }}</div>
|
||||
</div>
|
||||
</ElAlert>
|
||||
|
||||
<div class="section-title">{{ $t('page.weightTest.sectionPaid') }}</div>
|
||||
<ElFormItem
|
||||
:label="$t('page.weightTest.labelLotteryTypePaid')"
|
||||
prop="paid_lottery_config_id"
|
||||
>
|
||||
<ElSelect
|
||||
v-model="form.paid_lottery_config_id"
|
||||
:placeholder="$t('page.weightTest.placeholderPaidPool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in paidLotteryOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.paid_lottery_config_id == null">
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
|
||||
<ElRow :gutter="12" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getPaidTier(t)"
|
||||
min="0"
|
||||
max="100"
|
||||
placeholder="0"
|
||||
class="tier-input"
|
||||
@input="setPaidTier(t, $event)"
|
||||
<ElForm :model="form" label-width="108px" class="weight-test-form">
|
||||
<ElRow :gutter="16">
|
||||
<ElCol :span="8">
|
||||
<ElFormItem :label="$t('page.weightTest.labelAnte')" prop="ante_config_id" required>
|
||||
<ElSelect
|
||||
v-model="form.ante_config_id"
|
||||
:placeholder="$t('page.weightTest.placeholderAnte')"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="syncAnteFromSelect"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in anteOptions"
|
||||
:key="item.id"
|
||||
:label="anteOptionLabel(item)"
|
||||
:value="item.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="8">
|
||||
<ElFormItem :label="$t('page.weightTest.labelKillModeEnabled')" prop="kill_mode_enabled">
|
||||
<ElSwitch v-model="form.kill_mode_enabled" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="8">
|
||||
<ElFormItem :label="$t('page.weightTest.labelTestSafetyLine')" prop="test_safety_line">
|
||||
<ElInputNumber
|
||||
v-model="form.test_safety_line"
|
||||
:min="0"
|
||||
:step="100"
|
||||
:disabled="!form.kill_mode_enabled"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="paidTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: paidTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="paid_s_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_s_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="paid_n_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_n_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
|
||||
<div class="section-title">{{ $t('page.weightTest.sectionFreeAfterPlayAgain') }}</div>
|
||||
<ElFormItem
|
||||
:label="$t('page.weightTest.labelLotteryTypeFree')"
|
||||
prop="free_lottery_config_id"
|
||||
>
|
||||
<ElSelect
|
||||
v-model="form.free_lottery_config_id"
|
||||
:placeholder="$t('page.weightTest.placeholderFreePool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in freeLotteryOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.free_lottery_config_id == null">
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHintFreeChain') }}</div>
|
||||
<ElRow :gutter="12" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getFreeTier(t)"
|
||||
min="0"
|
||||
max="100"
|
||||
placeholder="0"
|
||||
class="tier-input"
|
||||
@input="setFreeTier(t, $event)"
|
||||
/>
|
||||
</div>
|
||||
<ElRow :gutter="20" class="section-row">
|
||||
<ElCol :span="12">
|
||||
<div class="section-title">{{ $t('page.weightTest.sectionPaid') }}</div>
|
||||
<ElFormItem :label="$t('page.weightTest.labelLotteryTypePaid')" prop="paid_lottery_config_id">
|
||||
<ElSelect
|
||||
v-model="form.paid_lottery_config_id"
|
||||
:placeholder="$t('page.weightTest.placeholderPaidPool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in paidLotteryOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.paid_lottery_config_id == null">
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHint') }}</div>
|
||||
<ElRow :gutter="8" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'paid-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getPaidTier(t)"
|
||||
min="0"
|
||||
max="100"
|
||||
placeholder="0"
|
||||
class="tier-input"
|
||||
@input="setPaidTier(t, $event)"
|
||||
/>
|
||||
</div>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="paidTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: paidTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
<ElFormItem :label="$t('page.weightTest.labelCwCount')" prop="paid_s_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_s_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem :label="$t('page.weightTest.labelCcwCount')" prop="paid_n_count" required>
|
||||
<ElSelect
|
||||
v-model="form.paid_n_count"
|
||||
:placeholder="$t('page.weightTest.placeholderSelect')"
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption v-for="c in countOptions" :key="'n-' + c" :label="String(c)" :value="c" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
|
||||
<ElCol :span="12">
|
||||
<div class="section-title">{{ $t('page.weightTest.sectionFreeAfterPlayAgain') }}</div>
|
||||
<ElFormItem :label="$t('page.weightTest.labelLotteryTypeFree')" prop="free_lottery_config_id">
|
||||
<ElSelect
|
||||
v-model="form.free_lottery_config_id"
|
||||
:placeholder="$t('page.weightTest.placeholderFreePool')"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in freeLotteryOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<template v-if="form.free_lottery_config_id == null">
|
||||
<div class="tier-label">{{ $t('page.weightTest.tierProbHintFreeChain') }}</div>
|
||||
<ElRow :gutter="8" class="tier-row">
|
||||
<ElCol v-for="t in tierKeys" :key="'free-' + t" :span="8">
|
||||
<div class="tier-field">
|
||||
<label class="tier-field-label">{{
|
||||
$t('page.weightTest.tierFieldLabel', { tier: t })
|
||||
}}</label>
|
||||
<input
|
||||
type="number"
|
||||
:value="getFreeTier(t)"
|
||||
min="0"
|
||||
max="100"
|
||||
placeholder="0"
|
||||
class="tier-input"
|
||||
@input="setFreeTier(t, $event)"
|
||||
/>
|
||||
</div>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="freeTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: freeTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<div v-if="freeTierSum > 100" class="tier-error">{{
|
||||
$t('page.weightTest.tierSumError', { sum: freeTierSum })
|
||||
}}</div>
|
||||
</template>
|
||||
</ElForm>
|
||||
</ElForm>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<ElButton
|
||||
@@ -160,11 +184,23 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '../../../api/reward/index'
|
||||
import anteConfigApi from '../../../api/ante_config/index'
|
||||
import lotteryPoolApi from '../../../api/lottery_pool_config/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
getChannelDeptRequestParams,
|
||||
useInjectedChannelDept,
|
||||
withChannelDeptParams
|
||||
} from '@/composables/useChannelDeptScope'
|
||||
|
||||
const props = defineProps<{
|
||||
/** 父页面渠道栏选中值(弹窗 teleport 后 inject 可能失效) */
|
||||
channelDeptId?: number
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const channelScope = useInjectedChannelDept()
|
||||
|
||||
const countOptions = [0, 100, 500, 1000, 5000]
|
||||
const tierKeys = ['T1', 'T2', 'T3', 'T4', 'T5'] as const
|
||||
@@ -172,8 +208,13 @@
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
const emit = defineEmits<{ (e: 'success'): void }>()
|
||||
|
||||
const anteOptions = ref<
|
||||
Array<{ id: number; name: string; title: string; mult: number; is_default: number }>
|
||||
>([])
|
||||
|
||||
const form = reactive({
|
||||
ante: 1,
|
||||
ante_config_id: undefined as number | undefined,
|
||||
paid_lottery_config_id: undefined as number | undefined,
|
||||
free_lottery_config_id: undefined as number | undefined,
|
||||
paid_tier_weights: { T1: 20, T2: 20, T3: 20, T4: 20, T5: 20 } as Record<string, number>,
|
||||
@@ -184,11 +225,9 @@
|
||||
test_safety_line: 5000
|
||||
})
|
||||
const lotteryOptions = ref<Array<{ id: number; name: string }>>([])
|
||||
/** 付费抽奖券可选档位:name=default */
|
||||
const paidLotteryOptions = computed(() =>
|
||||
lotteryOptions.value.filter((r) => r.name === 'default')
|
||||
)
|
||||
/** 免费抽奖券可选档位:优先 name=killScore,若无则显示全部以便下拉有选项 */
|
||||
const freeLotteryOptions = computed(() => {
|
||||
const list = lotteryOptions.value.filter((r) => r.name === 'killScore')
|
||||
return list.length > 0 ? list : lotteryOptions.value
|
||||
@@ -230,9 +269,61 @@
|
||||
tierKeys.reduce((s, t) => s + (form.free_tier_weights[t] ?? 0), 0)
|
||||
)
|
||||
|
||||
function resolveDeptParams(): { dept_id?: number } {
|
||||
if (props.channelDeptId !== undefined && props.channelDeptId !== null) {
|
||||
return { dept_id: props.channelDeptId }
|
||||
}
|
||||
const extra = getChannelDeptRequestParams()
|
||||
if (extra.dept_id !== undefined) {
|
||||
return extra
|
||||
}
|
||||
if (channelScope) {
|
||||
return { dept_id: channelScope.selectedDeptId.value }
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
function resolveSubmitDeptId(): number | undefined {
|
||||
const params = resolveDeptParams()
|
||||
if (params.dept_id !== undefined) {
|
||||
return params.dept_id
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
function anteOptionLabel(item: { name: string; title: string; mult: number }): string {
|
||||
const label = (item.title || item.name || '').trim()
|
||||
return label ? `${label} (×${item.mult})` : `×${item.mult}`
|
||||
}
|
||||
|
||||
function syncAnteFromSelect() {
|
||||
const opt = anteOptions.value.find((o) => o.id === form.ante_config_id)
|
||||
if (opt) {
|
||||
form.ante = opt.mult
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAnteOptions() {
|
||||
try {
|
||||
const list = await anteConfigApi.getOptions(resolveDeptParams())
|
||||
anteOptions.value = list
|
||||
const def = list.find((i) => i.is_default === 1) ?? list[0]
|
||||
if (def) {
|
||||
form.ante_config_id = def.id
|
||||
form.ante = def.mult
|
||||
} else {
|
||||
form.ante_config_id = undefined
|
||||
form.ante = 1
|
||||
}
|
||||
} catch {
|
||||
anteOptions.value = []
|
||||
form.ante_config_id = undefined
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLotteryOptions() {
|
||||
try {
|
||||
const list = await lotteryPoolApi.getOptions()
|
||||
const list = await lotteryPoolApi.getOptions(resolveDeptParams())
|
||||
lotteryOptions.value = list.map((r: { id: number; name: string }) => ({
|
||||
id: r.id,
|
||||
name: r.name
|
||||
@@ -255,6 +346,7 @@
|
||||
function buildPayload() {
|
||||
const payload: Record<string, unknown> = {
|
||||
ante: form.ante,
|
||||
ante_config_id: form.ante_config_id,
|
||||
paid_s_count: form.paid_s_count,
|
||||
paid_n_count: form.paid_n_count,
|
||||
free_s_count: 0,
|
||||
@@ -277,6 +369,11 @@
|
||||
}
|
||||
|
||||
function validateForm(): boolean {
|
||||
if (form.ante_config_id == null || form.ante_config_id <= 0) {
|
||||
ElMessage.warning(t('page.weightTest.warnAnte'))
|
||||
return false
|
||||
}
|
||||
syncAnteFromSelect()
|
||||
if (form.ante == null || form.ante <= 0) {
|
||||
ElMessage.warning(t('page.weightTest.warnAnte'))
|
||||
return false
|
||||
@@ -320,7 +417,12 @@
|
||||
if (!validateForm()) return
|
||||
running.value = true
|
||||
try {
|
||||
await api.startWeightTest(buildPayload())
|
||||
const payload = buildPayload()
|
||||
const deptId = resolveSubmitDeptId()
|
||||
if (deptId !== undefined) {
|
||||
payload.dept_id = deptId
|
||||
}
|
||||
await api.startWeightTest(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.weightTest.successCreated'))
|
||||
visible.value = false
|
||||
emit('success')
|
||||
@@ -333,73 +435,122 @@
|
||||
|
||||
watch(visible, (v) => {
|
||||
if (v) {
|
||||
loadLotteryOptions()
|
||||
void loadAnteOptions()
|
||||
void loadLotteryOptions()
|
||||
} else {
|
||||
onClose()
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.channelDeptId ?? channelScope?.selectedDeptId.value,
|
||||
() => {
|
||||
if (visible.value) {
|
||||
void loadAnteOptions()
|
||||
void loadLotteryOptions()
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.weight-test-tip {
|
||||
margin-bottom: 16px;
|
||||
.weight-test-dialog-body {
|
||||
max-height: calc(100vh - 168px);
|
||||
overflow: visible;
|
||||
}
|
||||
.chain-tip {
|
||||
margin-top: -8px;
|
||||
|
||||
.compact-tip {
|
||||
margin-bottom: 12px;
|
||||
:deep(.el-alert__content) {
|
||||
line-height: 1.45;
|
||||
}
|
||||
}
|
||||
|
||||
.tip-lines {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
div + div {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.weight-test-form {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.section-row {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
margin: 8px 0 12px;
|
||||
padding-bottom: 6px;
|
||||
margin: 0 0 10px;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.tier-label {
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.tier-row {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.tier-row {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.tier-field {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.tier-field-label {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
margin-bottom: 4px;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 2px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.tier-input {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
padding: 4px 8px;
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
color: var(--el-text-color-regular);
|
||||
background-color: var(--el-fill-color-blank);
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tier-input:hover {
|
||||
border-color: var(--el-border-color-hover);
|
||||
}
|
||||
|
||||
.tier-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--el-color-primary);
|
||||
box-shadow: 0 0 0 2px var(--el-color-primary-light-7);
|
||||
}
|
||||
.tier-input::placeholder {
|
||||
color: var(--el-text-color-placeholder);
|
||||
}
|
||||
|
||||
.tier-error {
|
||||
font-size: 12px;
|
||||
color: var(--el-color-danger);
|
||||
margin-top: 4px;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.weight-test-dialog.el-dialog {
|
||||
margin-bottom: 4vh;
|
||||
}
|
||||
.weight-test-dialog .el-dialog__body {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="art-full-height reward-config-form">
|
||||
<ElCard shadow="never" class="form-card">
|
||||
<div class="reward-config-form flex-1 min-h-0 flex flex-col">
|
||||
<ElCard shadow="never" class="form-card flex-1 min-h-0 flex flex-col">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>{{ $t('page.toolbar.gameRewardConfig') }}</span>
|
||||
@@ -446,6 +446,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
DEFAULT_CHANNEL_ID,
|
||||
getChannelDeptRequestParams,
|
||||
useChannelDeptReload,
|
||||
useInjectedChannelDept
|
||||
} from '@/composables/useChannelDeptScope'
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@@ -484,6 +490,21 @@
|
||||
weight: number
|
||||
}
|
||||
|
||||
const channelScope = useInjectedChannelDept()
|
||||
const filterDeptId = computed(() => {
|
||||
const scopedId = channelScope?.selectedDeptId.value
|
||||
if (scopedId !== undefined && scopedId !== null) {
|
||||
if (scopedId > 0 || channelScope?.showDefaultTemplate.value) {
|
||||
return scopedId
|
||||
}
|
||||
}
|
||||
const extra = getChannelDeptRequestParams()
|
||||
if (extra.dept_id !== undefined) {
|
||||
return extra.dept_id
|
||||
}
|
||||
return DEFAULT_CHANNEL_ID
|
||||
})
|
||||
|
||||
const activeTab = ref<'index' | 'bigwin'>('index')
|
||||
const loading = ref(false)
|
||||
const savingIndex = ref(false)
|
||||
@@ -506,15 +527,6 @@
|
||||
const REWARD_INDEX_MAX = 25
|
||||
const ALLOWED_INDEX_TIERS = ['T1', 'T2', 'T3', 'T4', 'T5', 'BIGWIN'] as const
|
||||
|
||||
function isAllowedIndexTier(s: string): boolean {
|
||||
for (let i = 0; i < ALLOWED_INDEX_TIERS.length; i++) {
|
||||
if (ALLOWED_INDEX_TIERS[i] === s) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/** 第一页数据(来自 api.list,即 DiceRewardConfig 表) */
|
||||
const indexRows = ref<IndexRow[]>([])
|
||||
/** 奖励索引 Tab:排除 tier=BIGWIN,仅显示 T1~T5 */
|
||||
@@ -524,6 +536,15 @@
|
||||
/** 原始 list 快照,用于重置 */
|
||||
let indexRowsSnapshot: IndexRow[] = []
|
||||
|
||||
function isAllowedIndexTier(s: string): boolean {
|
||||
for (let i = 0; i < ALLOWED_INDEX_TIERS.length; i++) {
|
||||
if (ALLOWED_INDEX_TIERS[i] === s) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function toWeight(v: unknown): number {
|
||||
const n = typeof v === 'number' && !Number.isNaN(v) ? v : Number(v)
|
||||
if (Number.isNaN(n)) return 0
|
||||
@@ -584,7 +605,7 @@
|
||||
}
|
||||
createRewardLoading.value = true
|
||||
try {
|
||||
const res: any = await api.createRewardReference()
|
||||
const res: any = await api.createRewardReference({ dept_id: filterDeptId.value as number })
|
||||
const data = res?.data ?? res
|
||||
let msg = t('page.configPage.createRefSuccessSimple')
|
||||
if (typeof data === 'object' && data !== null) {
|
||||
@@ -608,15 +629,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
function extractIndexList(res: unknown): Record<string, unknown>[] {
|
||||
if (Array.isArray(res)) {
|
||||
return res as Record<string, unknown>[]
|
||||
}
|
||||
if (res && typeof res === 'object') {
|
||||
const obj = res as Record<string, unknown>
|
||||
if (Array.isArray(obj.data)) {
|
||||
return obj.data as Record<string, unknown>[]
|
||||
}
|
||||
if (Array.isArray(obj.records)) {
|
||||
return obj.records as Record<string, unknown>[]
|
||||
}
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
function loadIndexList() {
|
||||
loading.value = true
|
||||
return api
|
||||
.list({ limit: 200 })
|
||||
.then((res: any) => {
|
||||
const list = res?.data?.records ?? res?.records ?? res?.data ?? []
|
||||
const rows = Array.isArray(list)
|
||||
? list.map((r: Record<string, unknown>) => normalizeIndexRow(r))
|
||||
: []
|
||||
.list({ saiType: 'all', limit: 200, dept_id: filterDeptId.value })
|
||||
.then((res: unknown) => {
|
||||
const rows = extractIndexList(res).map((r) => normalizeIndexRow(r))
|
||||
indexRows.value = rows
|
||||
indexRowsSnapshot = rows.map((r) => ({ ...r }))
|
||||
})
|
||||
@@ -628,6 +662,17 @@
|
||||
})
|
||||
}
|
||||
|
||||
/** 挂载时拉数;超管切换左侧渠道时重新拉数 */
|
||||
useChannelDeptReload(loadIndexList)
|
||||
watch(
|
||||
() => filterDeptId.value,
|
||||
(deptId, prev) => {
|
||||
if (deptId !== prev) {
|
||||
loadIndexList()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
function isBigwinWeightDisabled(row: IndexRow): boolean {
|
||||
return row.grid_number === 5 || row.grid_number === 30
|
||||
}
|
||||
@@ -805,7 +850,7 @@
|
||||
remark: r.remark
|
||||
})
|
||||
)
|
||||
await api.batchUpdate(indexPayload)
|
||||
await api.batchUpdate(indexPayload, { dept_id: filterDeptId.value })
|
||||
ElMessage.success(
|
||||
t('page.configPage.ruleGenSuccess', {
|
||||
cwT1: sc.cw.T1,
|
||||
@@ -854,7 +899,7 @@
|
||||
tier: r.tier,
|
||||
remark: r.remark
|
||||
}))
|
||||
await api.batchUpdate(indexPayload)
|
||||
await api.batchUpdate(indexPayload, { dept_id: filterDeptId.value })
|
||||
ElMessage.success(t('page.configPage.saveSuccess'))
|
||||
indexRowsSnapshot = indexRows.value.map((r) => ({ ...r }))
|
||||
} catch (e: any) {
|
||||
@@ -915,14 +960,14 @@
|
||||
tier: r.tier,
|
||||
remark: r.remark
|
||||
}))
|
||||
await api.batchUpdate(batchPayload)
|
||||
await api.batchUpdate(batchPayload, { dept_id: filterDeptId.value })
|
||||
const weightItems = rows.map((r) => ({
|
||||
grid_number: r.grid_number,
|
||||
weight: isBigwinWeightDisabled(r)
|
||||
? 10000
|
||||
: Math.max(0, Math.min(10000, Math.floor(r.weight)))
|
||||
}))
|
||||
await api.saveBigwinWeightsByGrid(weightItems)
|
||||
await api.saveBigwinWeightsByGrid(weightItems, { dept_id: filterDeptId.value })
|
||||
ElMessage.success(t('page.configPage.saveSuccess'))
|
||||
loadIndexList()
|
||||
} catch (e: any) {
|
||||
@@ -938,9 +983,6 @@
|
||||
ElMessage.info(t('page.configPage.resetBigwinReloaded'))
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadIndexList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -229,10 +230,10 @@
|
||||
delete payload.weight
|
||||
}
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(payload)
|
||||
await api.save(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(payload)
|
||||
await api.update(withChannelDeptParams(payload))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
import ArtBarChart from '@/components/core/charts/art-bar-chart/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getChannelDeptRequestParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -360,7 +361,7 @@
|
||||
|
||||
function loadData() {
|
||||
api
|
||||
.weightRatioList()
|
||||
.weightRatioList(getChannelDeptRequestParams())
|
||||
.then((res: any) => {
|
||||
grouped.value = parseWeightRatioPayload(res)
|
||||
})
|
||||
@@ -393,7 +394,7 @@
|
||||
}
|
||||
submitting.value = true
|
||||
api
|
||||
.batchUpdateWeights(items)
|
||||
.batchUpdateWeights(items, getChannelDeptRequestParams())
|
||||
.then(() => {
|
||||
ElMessage.success(t('page.weightRatio.saveSuccess'))
|
||||
emit('success')
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
@@ -137,10 +138,10 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
await api.save(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(withChannelDeptParams(formData))
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<template>
|
||||
<div class="art-full-height">
|
||||
<!-- 搜索面板 -->
|
||||
<TableSearch v-model="searchForm" @search="handleSearch" @reset="resetSearchParams" />
|
||||
|
||||
<ElCard class="art-table-card" shadow="never">
|
||||
<!-- 表格头部 -->
|
||||
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
|
||||
<template #left>
|
||||
<ElSpace wrap>
|
||||
@@ -14,30 +12,22 @@
|
||||
</template>
|
||||
{{ $t('table.actions.add') }}
|
||||
</ElButton>
|
||||
<ElButton @click="toggleExpand" v-ripple>
|
||||
<template #icon>
|
||||
<ArtSvgIcon v-if="isExpanded" icon="ri:collapse-diagonal-line" />
|
||||
<ArtSvgIcon v-else icon="ri:expand-diagonal-line" />
|
||||
</template>
|
||||
{{ isExpanded ? $t('table.searchBar.collapse') : $t('table.searchBar.expand') }}
|
||||
<ElButton v-permission="'core:dept:update'" @click="handleSyncConfigs" v-ripple>
|
||||
补齐渠道配置
|
||||
</ElButton>
|
||||
</ElSpace>
|
||||
</template>
|
||||
</ArtTableHeader>
|
||||
|
||||
<!-- 表格 -->
|
||||
<ArtTable
|
||||
ref="tableRef"
|
||||
rowKey="id"
|
||||
:loading="loading"
|
||||
:data="data"
|
||||
:columns="columns"
|
||||
:default-expand-all="true"
|
||||
@sort-change="handleSortChange"
|
||||
@pagination:size-change="handleSizeChange"
|
||||
@pagination:current-change="handleCurrentChange"
|
||||
>
|
||||
<!-- 操作列 -->
|
||||
<template #operation="{ row }">
|
||||
<div class="flex gap-2">
|
||||
<SaButton
|
||||
@@ -48,20 +38,26 @@
|
||||
<SaButton
|
||||
v-permission="'core:dept:destroy'"
|
||||
type="error"
|
||||
@click="deleteRow(row, api.delete, refreshData)"
|
||||
@click="openDeleteDialog(row)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</ArtTable>
|
||||
</ElCard>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<EditDialog
|
||||
v-model="dialogVisible"
|
||||
:dialog-type="dialogType"
|
||||
:data="dialogData"
|
||||
@success="refreshData"
|
||||
/>
|
||||
|
||||
<DeleteChannelDialog
|
||||
v-model="deleteDialogVisible"
|
||||
:dept-id="deleteDeptId"
|
||||
:dept-name="deleteDeptName"
|
||||
@success="refreshData"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -69,27 +65,26 @@
|
||||
import { useTable } from '@/hooks/core/useTable'
|
||||
import { useSaiAdmin } from '@/composables/useSaiAdmin'
|
||||
import api from '@/api/system/dept'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import TableSearch from './modules/table-search.vue'
|
||||
import EditDialog from './modules/edit-dialog.vue'
|
||||
import DeleteChannelDialog from './modules/delete-channel-dialog.vue'
|
||||
|
||||
// 状态管理
|
||||
const isExpanded = ref(true)
|
||||
const tableRef = ref()
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = ref({
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
status: undefined
|
||||
})
|
||||
|
||||
// 搜索处理
|
||||
const deleteDialogVisible = ref(false)
|
||||
const deleteDeptId = ref<number | null>(null)
|
||||
const deleteDeptName = ref('')
|
||||
|
||||
const handleSearch = (params: Record<string, any>) => {
|
||||
Object.assign(searchParams, params)
|
||||
getData()
|
||||
}
|
||||
|
||||
// 表格配置
|
||||
const {
|
||||
columns,
|
||||
columnChecks,
|
||||
@@ -118,26 +113,20 @@
|
||||
}
|
||||
})
|
||||
|
||||
// 编辑配置
|
||||
const { dialogType, dialogVisible, dialogData, showDialog, deleteRow } = useSaiAdmin()
|
||||
const { dialogType, dialogVisible, dialogData, showDialog } = useSaiAdmin()
|
||||
|
||||
/**
|
||||
* 切换展开/收起所有菜单
|
||||
*/
|
||||
const toggleExpand = (): void => {
|
||||
isExpanded.value = !isExpanded.value
|
||||
nextTick(() => {
|
||||
if (tableRef.value?.elTableRef && data.value) {
|
||||
const processRows = (rows: any[]) => {
|
||||
rows.forEach((row) => {
|
||||
if (row.children?.length) {
|
||||
tableRef.value.elTableRef.toggleRowExpansion(row, isExpanded.value)
|
||||
processRows(row.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
processRows(data.value)
|
||||
}
|
||||
})
|
||||
const openDeleteDialog = (row: any) => {
|
||||
deleteDeptId.value = row.id
|
||||
deleteDeptName.value = row.name
|
||||
deleteDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleSyncConfigs = async () => {
|
||||
try {
|
||||
await api.syncChannelConfigs()
|
||||
ElMessage.success('已为缺失配置的渠道补齐默认配置')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '补齐失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="删除渠道"
|
||||
width="560px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div v-loading="loading">
|
||||
<p class="mb-3 text-sm text-gray-600">确定删除渠道「{{ deptName }}」?可勾选一并删除的关联数据:</p>
|
||||
<el-alert
|
||||
v-if="preview?.user_count > 0"
|
||||
type="error"
|
||||
:closable="false"
|
||||
class="mb-3"
|
||||
:title="`该渠道下仍有 ${preview.user_count} 个用户,请先转移或删除用户`"
|
||||
/>
|
||||
<el-checkbox-group v-model="checkedTables" class="flex flex-col gap-2">
|
||||
<el-checkbox
|
||||
v-for="item in preview?.relations || []"
|
||||
:key="item.table"
|
||||
:label="item.table"
|
||||
:disabled="preview?.user_count > 0"
|
||||
>
|
||||
{{ item.label }}({{ item.count }} 条)
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<p v-if="!preview?.relations?.length" class="text-sm text-gray-500">无关联业务数据,仅删除渠道本身。</p>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
:loading="submitting"
|
||||
:disabled="preview?.user_count > 0"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
确认删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '@/api/system/dept'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
deptId?: number | null
|
||||
deptName?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
modelValue: false,
|
||||
deptId: null,
|
||||
deptName: ''
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: boolean): void
|
||||
(e: 'success'): void
|
||||
}>()
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (v) => emit('update:modelValue', v)
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const submitting = ref(false)
|
||||
const preview = ref<any>(null)
|
||||
const checkedTables = ref<string[]>([])
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
async (open) => {
|
||||
if (!open || !props.deptId) {
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
checkedTables.value = []
|
||||
try {
|
||||
const res: any = await api.destroyPreview(props.deptId)
|
||||
const list = res?.data ?? res
|
||||
preview.value = Array.isArray(list) ? list[0] : list
|
||||
checkedTables.value = (preview.value?.relations || []).map((r: any) => r.table)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const handleClose = () => {
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!props.deptId) {
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await api.delete({ ids: props.deptId, delete_tables: checkedTables.value })
|
||||
ElMessage.success('删除成功')
|
||||
emit('success')
|
||||
handleClose()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '删除失败')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -8,15 +8,6 @@
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||
<el-form-item :label="$t('page.form.labelParentDept')" prop="parent_id">
|
||||
<el-tree-select
|
||||
v-model="formData.parent_id"
|
||||
:data="optionData.treeData"
|
||||
:render-after-expand="false"
|
||||
check-strictly
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('page.form.labelDeptName')" prop="name">
|
||||
<el-input v-model="formData.name" :placeholder="$t('page.form.placeholderDeptName')" />
|
||||
</el-form-item>
|
||||
@@ -75,36 +66,21 @@
|
||||
const { t } = useI18n()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const optionData = reactive({
|
||||
treeData: <any[]>[]
|
||||
})
|
||||
|
||||
/**
|
||||
* 弹窗显示状态双向绑定
|
||||
*/
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
/**
|
||||
* 表单验证规则
|
||||
*/
|
||||
const rules = computed<FormRules>(() => ({
|
||||
parent_id: [
|
||||
{ required: true, message: t('page.form.ruleParentDeptRequired'), trigger: 'change' }
|
||||
],
|
||||
name: [{ required: true, message: t('page.form.ruleDeptNameRequired'), trigger: 'blur' }],
|
||||
code: [{ required: true, message: t('page.form.ruleDeptCodeRequired'), trigger: 'blur' }]
|
||||
}))
|
||||
|
||||
/**
|
||||
* 初始数据
|
||||
*/
|
||||
const initialFormData = {
|
||||
id: null,
|
||||
parent_id: null,
|
||||
level: '',
|
||||
parent_id: 0,
|
||||
level: '0',
|
||||
name: '',
|
||||
code: '',
|
||||
leader_id: null,
|
||||
@@ -113,14 +89,8 @@
|
||||
status: 1
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单数据
|
||||
*/
|
||||
const formData = reactive({ ...initialFormData })
|
||||
|
||||
/**
|
||||
* 监听弹窗打开,初始化表单数据
|
||||
*/
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
@@ -130,33 +100,14 @@
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* 初始化页面数据
|
||||
*/
|
||||
const initPage = async () => {
|
||||
// 先重置为初始值
|
||||
Object.assign(formData, initialFormData)
|
||||
|
||||
const data = await api.list({ tree: true })
|
||||
optionData.treeData = [
|
||||
{
|
||||
id: 0,
|
||||
value: 0,
|
||||
label: t('page.form.noParentDept'),
|
||||
children: data
|
||||
}
|
||||
]
|
||||
|
||||
// 如果有数据,则填充数据
|
||||
if (props.data) {
|
||||
await nextTick()
|
||||
initForm()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化表单数据
|
||||
*/
|
||||
const initForm = () => {
|
||||
if (props.data) {
|
||||
for (const key in formData) {
|
||||
@@ -167,21 +118,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭弹窗并重置表单
|
||||
*/
|
||||
const handleClose = () => {
|
||||
visible.value = false
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交表单
|
||||
*/
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
formData.parent_id = 0
|
||||
formData.level = '0'
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '@/api/system/role'
|
||||
import { withChannelDeptParams } from '@/composables/useChannelDeptScope'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
@@ -155,11 +156,12 @@
|
||||
if (!formRef.value) return
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
const payload = withChannelDeptParams({ ...formData })
|
||||
if (props.dialogType === 'add') {
|
||||
await api.save(formData)
|
||||
await api.save(payload)
|
||||
ElMessage.success(t('page.form.addSuccess'))
|
||||
} else {
|
||||
await api.update(formData)
|
||||
await api.update(payload)
|
||||
ElMessage.success(t('page.form.editSuccess'))
|
||||
}
|
||||
emit('success')
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
<template>
|
||||
<div class="art-full-height">
|
||||
<div class="box-border flex gap-4 h-full max-md:block max-md:gap-0 max-md:h-auto">
|
||||
<div class="flex-shrink-0 w-64 h-full max-md:w-full max-md:h-auto max-md:mb-5">
|
||||
<ElCard class="tree-card art-card-xs flex flex-col h-full mt-0" shadow="never">
|
||||
<div
|
||||
v-show="showChannelSidebar"
|
||||
class="flex-shrink-0 w-64 h-full max-md:w-full max-md:h-auto max-md:mb-5"
|
||||
>
|
||||
<ElCard
|
||||
class="tree-card art-card-xs flex flex-col h-full mt-0"
|
||||
shadow="never"
|
||||
v-loading="channelTreeLoading"
|
||||
>
|
||||
<template #header>
|
||||
<b>部门列表</b>
|
||||
<b>{{ $t('page.ui.channelList') }}</b>
|
||||
</template>
|
||||
<ElScrollbar>
|
||||
<ElTree
|
||||
:data="treeData"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
node-key="id"
|
||||
:current-node-key="currentChannelId"
|
||||
default-expand-all
|
||||
highlight-current
|
||||
@node-click="handleNodeClick"
|
||||
@@ -136,10 +144,19 @@
|
||||
import WorkDialog from './modules/work-dialog.vue'
|
||||
import api from '@/api/system/user'
|
||||
import deptApi from '@/api/system/dept'
|
||||
import { isSuperAdminUser } from '@/utils/channelLayout'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const treeData = ref([])
|
||||
interface ChannelTreeNode {
|
||||
id: number
|
||||
label: string
|
||||
children?: ChannelTreeNode[]
|
||||
}
|
||||
|
||||
const treeData = ref<ChannelTreeNode[]>([])
|
||||
const channelTreeLoading = ref(false)
|
||||
const currentChannelId = ref<number | undefined>(undefined)
|
||||
|
||||
// 编辑框
|
||||
const { dialogType, dialogVisible, dialogData, showDialog, handleSelectionChange, deleteRow } =
|
||||
@@ -228,24 +245,79 @@
|
||||
const handleReset = () => {
|
||||
searchForm.value.dept_id = undefined
|
||||
resetSearchParams()
|
||||
if (isSuperAdminUser()) {
|
||||
currentChannelId.value = undefined
|
||||
} else {
|
||||
applyDefaultChannelSelection()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换部门
|
||||
* @param data
|
||||
*/
|
||||
const handleNodeClick = (data: any) => {
|
||||
const handleNodeClick = (data: ChannelTreeNode) => {
|
||||
currentChannelId.value = data.id
|
||||
searchParams.dept_id = data.id
|
||||
getData()
|
||||
}
|
||||
|
||||
/** 仅超管显示左侧渠道列表;渠道管理员固定本渠道,由后端过滤 */
|
||||
const showChannelSidebar = computed(() => isSuperAdminUser())
|
||||
|
||||
const normalizeChannelTree = (list: unknown[]): ChannelTreeNode[] => {
|
||||
if (!Array.isArray(list)) {
|
||||
return []
|
||||
}
|
||||
return list
|
||||
.map((item) => {
|
||||
const row = item as Record<string, unknown>
|
||||
const id = Number(row.id ?? row.value ?? 0)
|
||||
const label = String(row.label ?? row.name ?? '')
|
||||
return { id, label }
|
||||
})
|
||||
.filter((node) => node.id > 0 && node.label !== '')
|
||||
}
|
||||
|
||||
const fallbackChannelTree = (): ChannelTreeNode[] => {
|
||||
const dept = userStore.info?.department
|
||||
if (!dept || Number(dept.id) <= 0) {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{
|
||||
id: Number(dept.id),
|
||||
label: String(dept.name ?? '')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const applyDefaultChannelSelection = () => {
|
||||
if (treeData.value.length === 0 || isSuperAdminUser()) {
|
||||
return
|
||||
}
|
||||
const first = treeData.value[0]
|
||||
currentChannelId.value = first.id
|
||||
searchParams.dept_id = first.id
|
||||
getData()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门数据
|
||||
* 获取可操作渠道(渠道管理员至少展示本渠道)
|
||||
*/
|
||||
const getDeptList = () => {
|
||||
deptApi.accessDept().then((data: any) => {
|
||||
treeData.value = data
|
||||
})
|
||||
const getDeptList = async () => {
|
||||
channelTreeLoading.value = true
|
||||
try {
|
||||
const data = await deptApi.accessDept()
|
||||
const nodes = normalizeChannelTree(Array.isArray(data) ? data : [])
|
||||
treeData.value = nodes.length > 0 ? nodes : fallbackChannelTree()
|
||||
applyDefaultChannelSelection()
|
||||
} catch {
|
||||
treeData.value = fallbackChannelTree()
|
||||
applyDefaultChannelSelection()
|
||||
} finally {
|
||||
channelTreeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,6 +355,10 @@
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDeptList()
|
||||
if (isSuperAdminUser()) {
|
||||
getDeptList()
|
||||
} else {
|
||||
applyDefaultChannelSelection()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -52,13 +52,14 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('page.form.labelDept')" prop="dept_id">
|
||||
<el-tree-select
|
||||
v-model="formData.dept_id"
|
||||
:data="optionData.deptData"
|
||||
:render-after-expand="false"
|
||||
check-strictly
|
||||
clearable
|
||||
/>
|
||||
<el-select v-model="formData.dept_id" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in optionData.deptData"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -206,6 +207,41 @@
|
||||
/**
|
||||
* 监听弹窗打开,初始化表单数据
|
||||
*/
|
||||
const flattenDeptOptions = (list: any[], result: { id: number; label: string }[] = []) => {
|
||||
for (const item of list) {
|
||||
const id = item.id ?? item.value
|
||||
if (id !== undefined && id !== null) {
|
||||
result.push({
|
||||
id,
|
||||
label: String(item.label ?? item.name ?? id)
|
||||
})
|
||||
}
|
||||
if (item.children?.length) {
|
||||
flattenDeptOptions(item.children, result)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
const loadRoleOptions = async () => {
|
||||
const deptId = formData.dept_id
|
||||
const params =
|
||||
deptId !== undefined && deptId !== null && deptId !== ''
|
||||
? { dept_id: deptId }
|
||||
: undefined
|
||||
const roleData = await roleApi.accessRole(params)
|
||||
optionData.roleList = Array.isArray(roleData) ? roleData : []
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formData.dept_id,
|
||||
() => {
|
||||
if (props.modelValue) {
|
||||
void loadRoleOptions()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
@@ -214,26 +250,23 @@
|
||||
}
|
||||
}
|
||||
)
|
||||
// 初始化页面数据
|
||||
|
||||
const initPage = async () => {
|
||||
// 先重置为初始值
|
||||
Object.assign(formData, initialFormData)
|
||||
// 部门数据
|
||||
const deptData = await deptApi.accessDept()
|
||||
optionData.deptData = deptData
|
||||
optionData.deptData = flattenDeptOptions(Array.isArray(deptData) ? deptData : [])
|
||||
// 角色数据
|
||||
const roleData = await roleApi.accessRole()
|
||||
optionData.roleList = roleData
|
||||
// 如果有数据,则填充数据
|
||||
if (props.data) {
|
||||
if (props.data?.id) {
|
||||
await nextTick()
|
||||
if (props.data.id) {
|
||||
let data = await api.read(props.data.id)
|
||||
const role = (data.roleList as any[])?.map((item: any) => item.id)
|
||||
data.role_ids = role
|
||||
data.password = ''
|
||||
initForm(data)
|
||||
}
|
||||
const data = await api.read(props.data.id)
|
||||
const role = (data.roleList as any[])?.map((item: any) => item.id)
|
||||
data.role_ids = role
|
||||
data.password = ''
|
||||
initForm(data)
|
||||
await loadRoleOptions()
|
||||
} else {
|
||||
await loadRoleOptions()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user