f
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
>
|
>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<!-- 企业选择 -->
|
<!-- 企业选择 -->
|
||||||
<div v-if="showCompanySelect">
|
<div v-if="showCompanySelect && !isSingleUserMode">
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">选择企业</label>
|
<label class="block text-sm font-medium text-gray-700 mb-2">选择企业</label>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="exportOptions.companyIds"
|
v-model="exportOptions.companyIds"
|
||||||
@@ -33,6 +33,14 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 单用户模式提示 -->
|
||||||
|
<div v-if="isSingleUserMode" class="bg-blue-50 border border-blue-200 rounded-lg p-3">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<User class="w-4 h-4 text-blue-600 flex-shrink-0" />
|
||||||
|
<span class="text-sm text-blue-800">当前为单用户模式,将只导出该用户的数据</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 产品选择 -->
|
<!-- 产品选择 -->
|
||||||
<div v-if="showProductSelect">
|
<div v-if="showProductSelect">
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-2">选择产品</label>
|
<label class="block text-sm font-medium text-gray-700 mb-2">选择产品</label>
|
||||||
@@ -136,9 +144,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { productApi, userApi } from '@/api'
|
import { productAdminApi, userApi } from '@/api'
|
||||||
import { useMobileTable } from '@/composables/useMobileTable'
|
import { useMobileTable } from '@/composables/useMobileTable'
|
||||||
import { reactive, ref, watch } from 'vue'
|
import { reactive, ref, watch } from 'vue'
|
||||||
|
import { User } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// 移动端检测
|
// 移动端检测
|
||||||
const { isMobile } = useMobileTable()
|
const { isMobile } = useMobileTable()
|
||||||
@@ -177,6 +186,15 @@ const props = defineProps({
|
|||||||
showDateRange: {
|
showDateRange: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
// 单用户模式相关
|
||||||
|
isSingleUserMode: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
currentUserId: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -250,7 +268,8 @@ const loadProductOptions = async () => {
|
|||||||
try {
|
try {
|
||||||
productLoading.value = true
|
productLoading.value = true
|
||||||
|
|
||||||
const response = await productApi.getProducts({
|
// 使用管理员产品API
|
||||||
|
const response = await productAdminApi.getProducts({
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 1000,
|
page_size: 1000,
|
||||||
name: productSearchKeyword.value
|
name: productSearchKeyword.value
|
||||||
|
|||||||
@@ -329,11 +329,12 @@
|
|||||||
v-model="exportDialogVisible"
|
v-model="exportDialogVisible"
|
||||||
title="导出钱包交易记录"
|
title="导出钱包交易记录"
|
||||||
:loading="exportLoading"
|
:loading="exportLoading"
|
||||||
:show-company-select="true"
|
:show-company-select="!singleUserMode"
|
||||||
:show-product-select="true"
|
:show-product-select="true"
|
||||||
:show-recharge-type-select="false"
|
:show-recharge-type-select="false"
|
||||||
:show-status-select="false"
|
:show-status-select="false"
|
||||||
:show-date-range="true"
|
:show-date-range="true"
|
||||||
|
:is-single-user-mode="singleUserMode"
|
||||||
@confirm="handleExport"
|
@confirm="handleExport"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -543,7 +544,12 @@ const handleViewDetail = (transaction) => {
|
|||||||
|
|
||||||
// 导出相关方法
|
// 导出相关方法
|
||||||
const showExportDialog = () => {
|
const showExportDialog = () => {
|
||||||
exportDialogVisible.value = true
|
// 如果是单用户模式,默认选中当前用户
|
||||||
|
if (singleUserMode.value && currentUser.value?.id) {
|
||||||
|
exportDialogVisible.value = true
|
||||||
|
} else {
|
||||||
|
exportDialogVisible.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleExport = async (options) => {
|
const handleExport = async (options) => {
|
||||||
@@ -555,8 +561,11 @@ const handleExport = async (options) => {
|
|||||||
format: options.format
|
format: options.format
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加企业筛选
|
// 单用户模式:自动添加当前用户ID筛选
|
||||||
if (options.companyIds.length > 0) {
|
if (singleUserMode.value && currentUser.value?.id) {
|
||||||
|
params.user_ids = currentUser.value.id
|
||||||
|
} else if (options.companyIds.length > 0) {
|
||||||
|
// 多用户模式:使用用户选择的企业筛选
|
||||||
params.user_ids = options.companyIds.join(',')
|
params.user_ids = options.companyIds.join(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -337,11 +337,12 @@
|
|||||||
v-model="exportDialogVisible"
|
v-model="exportDialogVisible"
|
||||||
title="导出API调用记录"
|
title="导出API调用记录"
|
||||||
:loading="exportLoading"
|
:loading="exportLoading"
|
||||||
:show-company-select="true"
|
:show-company-select="!singleUserMode"
|
||||||
:show-product-select="true"
|
:show-product-select="true"
|
||||||
:show-recharge-type-select="false"
|
:show-recharge-type-select="false"
|
||||||
:show-status-select="false"
|
:show-status-select="false"
|
||||||
:show-date-range="true"
|
:show-date-range="true"
|
||||||
|
:is-single-user-mode="singleUserMode"
|
||||||
@confirm="handleExport"
|
@confirm="handleExport"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -589,7 +590,12 @@ watch(() => route.query.user_id, async (newUserId) => {
|
|||||||
|
|
||||||
// 导出相关方法
|
// 导出相关方法
|
||||||
const showExportDialog = () => {
|
const showExportDialog = () => {
|
||||||
exportDialogVisible.value = true
|
// 如果是单用户模式,默认选中当前用户
|
||||||
|
if (singleUserMode.value && currentUser.value?.id) {
|
||||||
|
exportDialogVisible.value = true
|
||||||
|
} else {
|
||||||
|
exportDialogVisible.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleExport = async (options) => {
|
const handleExport = async (options) => {
|
||||||
@@ -601,8 +607,11 @@ const handleExport = async (options) => {
|
|||||||
format: options.format
|
format: options.format
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加企业筛选
|
// 单用户模式:自动添加当前用户ID筛选
|
||||||
if (options.companyIds.length > 0) {
|
if (singleUserMode.value && currentUser.value?.id) {
|
||||||
|
params.user_ids = currentUser.value.id
|
||||||
|
} else if (options.companyIds.length > 0) {
|
||||||
|
// 多用户模式:使用用户选择的企业筛选
|
||||||
params.user_ids = options.companyIds.join(',')
|
params.user_ids = options.companyIds.join(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user