mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19:19 +08:00
feat: 优化可两栏布局的页面都改成两栏
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<script setup lang="ts">
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
|
||||
import { ColPage } from '@vben/common-ui';
|
||||
|
||||
import PddShopSidebarList from '#/views/channel/pdd/components/PddShopSidebarList.vue';
|
||||
|
||||
defineOptions({ name: 'PddShopColPage' });
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** undefined = 全部渠道店铺 */
|
||||
selectedShopId?: number;
|
||||
showAddAction?: boolean;
|
||||
autoContentHeight?: boolean;
|
||||
leftWidth?: number;
|
||||
leftMinWidth?: number;
|
||||
leftMaxWidth?: number;
|
||||
leftCollapsedWidth?: number;
|
||||
leftCollapsible?: boolean;
|
||||
resizable?: boolean;
|
||||
splitHandle?: boolean;
|
||||
splitLine?: boolean;
|
||||
}>(),
|
||||
{
|
||||
showAddAction: false,
|
||||
autoContentHeight: true,
|
||||
leftWidth: 22,
|
||||
leftMinWidth: 16,
|
||||
leftMaxWidth: 36,
|
||||
leftCollapsedWidth: 5,
|
||||
leftCollapsible: true,
|
||||
resizable: true,
|
||||
splitHandle: false,
|
||||
splitLine: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedShopId': [id: number | undefined];
|
||||
select: [shop: PddShopVO.Info | null];
|
||||
addForShop: [shopId: number];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ColPage
|
||||
:auto-content-height="autoContentHeight"
|
||||
:left-width="leftWidth"
|
||||
:left-min-width="leftMinWidth"
|
||||
:left-max-width="leftMaxWidth"
|
||||
:left-collapsed-width="leftCollapsedWidth"
|
||||
:left-collapsible="leftCollapsible"
|
||||
:right-width="100 - leftWidth"
|
||||
:resizable="resizable"
|
||||
:split-handle="splitHandle"
|
||||
:split-line="splitLine"
|
||||
content-class="!p-2 sm:!p-3"
|
||||
>
|
||||
<template #left="{ isCollapsed, expand, collapse }">
|
||||
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
|
||||
<PddShopSidebarList
|
||||
fluid
|
||||
:collapsed="isCollapsed"
|
||||
show-collapse-action
|
||||
:selected-shop-id="selectedShopId"
|
||||
:show-add-action="showAddAction"
|
||||
@collapse="collapse"
|
||||
@expand="expand"
|
||||
@update:selected-shop-id="emit('update:selectedShopId', $event)"
|
||||
@select="emit('select', $event)"
|
||||
@add-for-shop="emit('addForShop', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<slot />
|
||||
</ColPage>
|
||||
</template>
|
||||
+389
@@ -0,0 +1,389 @@
|
||||
<script setup lang="ts">
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Input,
|
||||
message,
|
||||
Spin,
|
||||
Tooltip,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
import ShopLogoAvatar from '#/views/ec/components/ShopLogoAvatar.vue';
|
||||
|
||||
defineOptions({ name: 'PddShopSidebarList' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** undefined = 全部渠道店铺 */
|
||||
selectedShopId?: number;
|
||||
showAddAction?: boolean;
|
||||
fluid?: boolean;
|
||||
showCollapseAction?: boolean;
|
||||
collapsed?: boolean;
|
||||
}>(),
|
||||
{
|
||||
selectedShopId: undefined,
|
||||
showAddAction: false,
|
||||
fluid: false,
|
||||
showCollapseAction: false,
|
||||
collapsed: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedShopId': [id: number | undefined];
|
||||
select: [shop: PddShopVO.Info | null];
|
||||
addForShop: [shopId: number];
|
||||
collapse: [];
|
||||
expand: [];
|
||||
}>();
|
||||
|
||||
const StoreIcon = createIconifyIcon('lucide:store');
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const PanelCloseIcon = createIconifyIcon('lucide:panel-left-close');
|
||||
const PanelOpenIcon = createIconifyIcon('lucide:panel-left-open');
|
||||
const ChevronUpIcon = createIconifyIcon('lucide:chevron-up');
|
||||
const ChevronDownIcon = createIconifyIcon('lucide:chevron-down');
|
||||
|
||||
const shopSearchName = ref('');
|
||||
const shops = ref<PddShopVO.Info[]>([]);
|
||||
const shopsLoading = ref(false);
|
||||
const shopPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||
|
||||
const shopTotalPages = computed(() => {
|
||||
const { total, pageSize } = shopPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
const allSelected = computed(() => props.selectedShopId === undefined);
|
||||
|
||||
function shopLabel(shop: PddShopVO.Info) {
|
||||
return shop.mallName || `店铺 #${shop.id}`;
|
||||
}
|
||||
|
||||
async function searchShops(resetPage = false) {
|
||||
if (resetPage) {
|
||||
shopPagination.value.current = 1;
|
||||
}
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const result = await getPddShopPageApi({
|
||||
page: shopPagination.value.current,
|
||||
pageSize: shopPagination.value.pageSize,
|
||||
filters: {
|
||||
mallName: shopSearchName.value || undefined,
|
||||
},
|
||||
});
|
||||
shops.value = result.records ?? [];
|
||||
shopPagination.value.total = result.total ?? 0;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取拼多多店铺列表失败');
|
||||
shops.value = [];
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetShopSearch() {
|
||||
shopSearchName.value = '';
|
||||
void searchShops(true);
|
||||
}
|
||||
|
||||
function goShopPage(page: number) {
|
||||
const next = Math.min(shopTotalPages.value, Math.max(1, page));
|
||||
if (next === shopPagination.value.current) return;
|
||||
shopPagination.value.current = next;
|
||||
void searchShops();
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
emit('update:selectedShopId', undefined);
|
||||
emit('select', null);
|
||||
}
|
||||
|
||||
function selectShop(shop: PddShopVO.Info) {
|
||||
emit('update:selectedShopId', shop.id);
|
||||
emit('select', shop);
|
||||
}
|
||||
|
||||
function handleAdd(shopId: number) {
|
||||
const shop = shops.value.find((s) => s.id === shopId) ?? null;
|
||||
emit('update:selectedShopId', shopId);
|
||||
if (shop) {
|
||||
emit('select', shop);
|
||||
}
|
||||
emit('addForShop', shopId);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void searchShops();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="collapsed"
|
||||
class="flex h-full min-h-0 w-full flex-col items-center gap-1 pb-2 pt-3"
|
||||
>
|
||||
<Tooltip title="展开店铺列表">
|
||||
<Button type="text" size="small" class="!px-1" @click="emit('expand')">
|
||||
<PanelOpenIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
<div
|
||||
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
|
||||
>
|
||||
<Tooltip title="全部店铺">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex shrink-0 rounded-md p-0.5 transition-colors hover:bg-accent"
|
||||
:class="
|
||||
allSelected
|
||||
? 'ring-2 ring-primary ring-offset-1 ring-offset-background'
|
||||
: undefined
|
||||
"
|
||||
@click="selectAll"
|
||||
>
|
||||
<div
|
||||
class="flex h-9 w-9 items-center justify-center rounded-md border border-dashed border-border bg-muted/50"
|
||||
>
|
||||
<StoreIcon class="h-4 w-4 text-muted-foreground" />
|
||||
</div>
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<Spin
|
||||
:spinning="shopsLoading"
|
||||
size="small"
|
||||
wrapper-class-name="pdd-shop-sidebar-collapsed-spin"
|
||||
>
|
||||
<div class="flex w-full flex-col items-center gap-1.5">
|
||||
<Tooltip v-for="shop in shops" :key="shop.id" :title="shopLabel(shop)">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex shrink-0 rounded-md p-0.5 transition-colors hover:bg-accent"
|
||||
:class="
|
||||
selectedShopId === shop.id
|
||||
? 'ring-2 ring-primary ring-offset-1 ring-offset-background'
|
||||
: undefined
|
||||
"
|
||||
@click="selectShop(shop)"
|
||||
>
|
||||
<ShopLogoAvatar
|
||||
:logo="shop.logo"
|
||||
:name="shopLabel(shop)"
|
||||
:size="36"
|
||||
/>
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="shopTotalPages > 1"
|
||||
class="flex shrink-0 flex-col items-center gap-0.5"
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-6 !px-1"
|
||||
:disabled="shopPagination.current <= 1 || shopsLoading"
|
||||
@click="goShopPage(shopPagination.current - 1)"
|
||||
>
|
||||
<ChevronUpIcon class="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
<span class="text-[10px] leading-none text-muted-foreground">
|
||||
{{ shopPagination.current }}/{{ shopTotalPages }}
|
||||
</span>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-6 !px-1"
|
||||
:disabled="shopPagination.current >= shopTotalPages || shopsLoading"
|
||||
@click="goShopPage(shopPagination.current + 1)"
|
||||
>
|
||||
<ChevronDownIcon class="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card
|
||||
v-else
|
||||
class="flex h-full flex-col overflow-hidden"
|
||||
:class="fluid ? 'w-full min-w-0' : 'w-[320px] shrink-0'"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<StoreIcon class="h-4 w-4" />
|
||||
拼多多店铺
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template v-if="showCollapseAction" #extra>
|
||||
<Tooltip title="收起店铺列表">
|
||||
<Button type="text" size="small" class="!px-1" @click="emit('collapse')">
|
||||
<PanelCloseIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 items-center gap-2">
|
||||
<Input
|
||||
v-model:value="shopSearchName"
|
||||
placeholder="店铺名称"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
@press-enter="searchShops(true)"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchShops(true)">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetShopSearch">重置</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Card
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
|
||||
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
|
||||
@click="selectAll"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<div
|
||||
class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-dashed border-border bg-muted/50"
|
||||
>
|
||||
<StoreIcon class="h-4 w-4 text-muted-foreground" />
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">全部店铺</span>
|
||||
<span class="shrink-0 text-xs text-muted-foreground">全部记录</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Spin :spinning="shopsLoading">
|
||||
<Empty
|
||||
v-if="!shopsLoading && shops.length === 0"
|
||||
class="py-8"
|
||||
description="暂无拼多多店铺"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="shop in shops"
|
||||
:key="shop.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
selectedShopId === shop.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectShop(shop)"
|
||||
>
|
||||
<div class="flex items-start gap-2">
|
||||
<ShopLogoAvatar
|
||||
:logo="shop.logo"
|
||||
:name="shopLabel(shop)"
|
||||
:size="36"
|
||||
/>
|
||||
<div class="flex min-w-0 flex-1 items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate text-sm font-medium">
|
||||
{{ shopLabel(shop) }}
|
||||
</div>
|
||||
<div
|
||||
v-if="shop.mallId != null"
|
||||
class="mt-1 text-xs text-muted-foreground"
|
||||
>
|
||||
mall_id: {{ shop.mallId }}
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
v-if="showAddAction"
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAdd(shop.id)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="shopPagination.current <= 1 || shopsLoading"
|
||||
@click="goShopPage(shopPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ shopPagination.current }} / {{ shopTotalPages }}
|
||||
<span class="ml-1 opacity-70">({{ shopPagination.total }})</span>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
shopPagination.current >= shopTotalPages || shopsLoading
|
||||
"
|
||||
@click="goShopPage(shopPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pdd-shop-sidebar-collapsed-spin) {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
:deep(.pdd-shop-sidebar-collapsed-spin .ant-spin-container) {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
-240
@@ -1,240 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Input,
|
||||
message,
|
||||
Spin,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
|
||||
defineOptions({ name: 'PddShopSidebarList' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
selectedShopId?: number;
|
||||
showAddAction?: boolean;
|
||||
}>(),
|
||||
{
|
||||
selectedShopId: undefined,
|
||||
showAddAction: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedShopId': [id: number | undefined];
|
||||
select: [shop: PddShopVO.Info | null];
|
||||
addForShop: [shopId: number];
|
||||
}>();
|
||||
|
||||
const StoreIcon = createIconifyIcon('lucide:store');
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
const shopSearchName = ref('');
|
||||
const shops = ref<PddShopVO.Info[]>([]);
|
||||
const shopsLoading = ref(false);
|
||||
const shopPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||
|
||||
const shopTotalPages = computed(() => {
|
||||
const { total, pageSize } = shopPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
const allSelected = computed(() => props.selectedShopId === undefined);
|
||||
|
||||
async function searchShops(resetPage = false) {
|
||||
if (resetPage) {
|
||||
shopPagination.value.current = 1;
|
||||
}
|
||||
shopsLoading.value = true;
|
||||
try {
|
||||
const result = await getPddShopPageApi({
|
||||
page: shopPagination.value.current,
|
||||
pageSize: shopPagination.value.pageSize,
|
||||
filters: {
|
||||
mallName: shopSearchName.value || undefined,
|
||||
},
|
||||
});
|
||||
shops.value = result.records ?? [];
|
||||
shopPagination.value.total = result.total ?? 0;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取渠道店铺列表失败');
|
||||
shops.value = [];
|
||||
} finally {
|
||||
shopsLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetShopSearch() {
|
||||
shopSearchName.value = '';
|
||||
void searchShops(true);
|
||||
}
|
||||
|
||||
function goShopPage(page: number) {
|
||||
const next = Math.min(shopTotalPages.value, Math.max(1, page));
|
||||
if (next === shopPagination.value.current) return;
|
||||
shopPagination.value.current = next;
|
||||
void searchShops();
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
emit('update:selectedShopId', undefined);
|
||||
emit('select', null);
|
||||
}
|
||||
|
||||
function selectShop(shop: PddShopVO.Info) {
|
||||
emit('update:selectedShopId', shop.id);
|
||||
emit('select', shop);
|
||||
}
|
||||
|
||||
function handleAdd(shopId: number) {
|
||||
const shop = shops.value.find((s) => s.id === shopId) ?? null;
|
||||
emit('update:selectedShopId', shopId);
|
||||
if (shop) {
|
||||
emit('select', shop);
|
||||
}
|
||||
emit('addForShop', shopId);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void searchShops();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card
|
||||
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<StoreIcon class="h-4 w-4" />
|
||||
渠道店铺
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 items-center gap-2">
|
||||
<Input
|
||||
v-model:value="shopSearchName"
|
||||
placeholder="店铺名称"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
@press-enter="searchShops(true)"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchShops(true)">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetShopSearch">重置</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Card
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
|
||||
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
|
||||
@click="selectAll"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">全部店铺</span>
|
||||
<span class="shrink-0 text-xs text-muted-foreground">全部记录</span>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Spin :spinning="shopsLoading">
|
||||
<Empty
|
||||
v-if="!shopsLoading && shops.length === 0"
|
||||
class="py-8"
|
||||
description="暂无渠道店铺"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="shop in shops"
|
||||
:key="shop.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
selectedShopId === shop.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectShop(shop)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="truncate text-sm font-medium">
|
||||
{{ shop.mallName || `店铺 #${shop.id}` }}
|
||||
</div>
|
||||
<div
|
||||
v-if="shop.mallId != null"
|
||||
class="mt-1 text-xs text-muted-foreground"
|
||||
>
|
||||
mall_id: {{ shop.mallId }}
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
v-if="showAddAction"
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAdd(shop.id)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="shopPagination.current <= 1 || shopsLoading"
|
||||
@click="goShopPage(shopPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ shopPagination.current }} / {{ shopTotalPages }}
|
||||
<span class="ml-1 opacity-70">({{ shopPagination.total }})</span>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
shopPagination.current >= shopTotalPages || shopsLoading
|
||||
"
|
||||
@click="goShopPage(shopPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -1,18 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { PddGoodsAdFeeVO } from '#/api/channel/pdd/goods-ad-fee';
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Flex,
|
||||
Input,
|
||||
message,
|
||||
Popconfirm,
|
||||
@@ -24,9 +23,9 @@ import {
|
||||
deletePddGoodsAdFeeApi,
|
||||
getPddGoodsAdFeePageApi,
|
||||
} from '#/api/channel/pdd/goods-ad-fee';
|
||||
import PddShopColPage from '#/views/channel/pdd/components/PddShopColPage.vue';
|
||||
|
||||
import GoodsAdFeeFormModal from './components/GoodsAdFeeFormModal.vue';
|
||||
import PddShopSidebarList from './components/PddShopSidebarList.vue';
|
||||
|
||||
defineOptions({ name: 'PddGoodsAdFeeManagement' });
|
||||
|
||||
@@ -35,7 +34,6 @@ const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const loading = ref(false);
|
||||
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const selectedShopName = ref<string | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentAdFeeData = ref<null | PddGoodsAdFeeVO.Info>(null);
|
||||
@@ -47,21 +45,8 @@ const searchForm = ref({
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function onShopSelect(shop: { id: number; mallName?: string } | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
selectedShopName.value = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
selectedShopName.value = shop.mallName;
|
||||
function onShopSelect(shop: PddShopVO.Info | null) {
|
||||
selectedShopId.value = shop?.id;
|
||||
}
|
||||
|
||||
function handleAddForShop(shopId: number) {
|
||||
@@ -187,7 +172,7 @@ function refreshTable() {
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
showSearchForm: false,
|
||||
tableTitle: '广告费记录',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
@@ -234,118 +219,93 @@ const formatAmount = (amount: number) => `¥${Number(amount || 0).toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="商品广告费" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择拼多多渠道店铺筛选右侧按日广告费;未选店铺时展示全部记录。可在店铺行快捷新增。
|
||||
</div>
|
||||
</template>
|
||||
<PddShopColPage
|
||||
show-add-action
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">广告费记录</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,48rem)]">
|
||||
<Input
|
||||
v-model:value="searchForm.goodsId"
|
||||
allow-clear
|
||||
placeholder="goods_id"
|
||||
class="w-[140px]"
|
||||
@press-enter="() => refreshTable()"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateEnd"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<PddShopSidebarList
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
/>
|
||||
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">广告费记录</span>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,42rem)]">
|
||||
<Input
|
||||
v-model:value="searchForm.goodsId"
|
||||
allow-clear
|
||||
placeholder="goods_id"
|
||||
class="w-[140px]"
|
||||
@press-enter="() => refreshTable()"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateEnd"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</Space>
|
||||
</template>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #feeAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedShopLabel }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
使用上方 goods_id 与日期筛选
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #feeAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #goods="{ row }">
|
||||
<div>
|
||||
<div>{{ row.goodsName || '—' }}</div>
|
||||
<div class="text-xs text-muted-foreground">
|
||||
{{ row.goodsId }}
|
||||
</div>
|
||||
<template #goods="{ row }">
|
||||
<div>
|
||||
<div>{{ row.goodsName || '—' }}</div>
|
||||
<div class="text-xs text-muted-foreground">
|
||||
{{ row.goodsId }}
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<GoodsAdFeeFormModal
|
||||
v-model:open="formModalVisible"
|
||||
@@ -354,5 +314,5 @@ const formatAmount = (amount: number) => `¥${Number(amount || 0).toFixed(2)}`;
|
||||
@success="handleFormSuccess"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</PddShopColPage>
|
||||
</template>
|
||||
|
||||
@@ -4,11 +4,9 @@ import type { PddGoodsDTO, PddGoodsVO } from '#/api/channel/pdd/goods';
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Button, Image, Popconfirm, Space, Tag, message } from 'ant-design-vue';
|
||||
import { Button, Card, Image, Popconfirm, Space, Tag, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
@@ -16,18 +14,20 @@ import {
|
||||
getPddGoodsPageApi,
|
||||
} from '#/api/channel/pdd/goods';
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
|
||||
import PddGoodsDetailDrawer from './components/PddGoodsDetailDrawer.vue';
|
||||
import PddShopColPage from '#/views/channel/pdd/components/PddShopColPage.vue';
|
||||
import PddShopDetailModal from '#/views/channel/pdd/shop/components/PddShopDetailModal.vue';
|
||||
import ProductDetailDrawer from '#/views/ec/product/list/components/ProductDetailDrawer.vue';
|
||||
|
||||
import PddGoodsDetailDrawer from './components/PddGoodsDetailDrawer.vue';
|
||||
|
||||
defineOptions({ name: 'PddGoodsManagement' });
|
||||
|
||||
const loading = ref(false);
|
||||
const detailDrawerRef = ref<InstanceType<typeof PddGoodsDetailDrawer>>();
|
||||
const shopDetailModalRef = ref<InstanceType<typeof PddShopDetailModal>>();
|
||||
const productDetailDrawerRef = ref<InstanceType<typeof ProductDetailDrawer>>();
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
/** 左侧选中的拼多多渠道店铺 ID */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const shopNameById = ref<Record<number, string>>({});
|
||||
|
||||
const searchForm = ref({
|
||||
@@ -39,35 +39,34 @@ const searchForm = ref({
|
||||
|
||||
const gridReloadRef = ref<null | (() => void)>(null);
|
||||
|
||||
async function loadShops() {
|
||||
async function loadShopNames() {
|
||||
try {
|
||||
const data = await getPddShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 500,
|
||||
filters: {},
|
||||
});
|
||||
const list = data.records ?? [];
|
||||
shopOptions.value = list.map((s: PddShopVO.Info) => ({
|
||||
label: s.mallName || `店铺#${s.id}`,
|
||||
value: s.id,
|
||||
}));
|
||||
const map: Record<number, string> = {};
|
||||
for (const s of list) {
|
||||
for (const s of data.records ?? []) {
|
||||
map[s.id] = s.mallName || `店铺#${s.id}`;
|
||||
}
|
||||
shopNameById.value = map;
|
||||
|
||||
await gridApi.formApi?.updateSchema([
|
||||
{
|
||||
fieldName: 'shopId',
|
||||
componentProps: { options: shopOptions.value },
|
||||
},
|
||||
]);
|
||||
} catch {
|
||||
message.error('获取渠道店铺失败');
|
||||
}
|
||||
}
|
||||
|
||||
function onShopSelect(shop: PddShopVO.Info | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
searchForm.value.shopId = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
searchForm.value.shopId = shop.id;
|
||||
shopNameById.value[shop.id] = shop.mallName || `店铺#${shop.id}`;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<PddGoodsVO.Info> = {
|
||||
columns: [
|
||||
{ type: 'seq' as const, width: 56, title: '序号' },
|
||||
@@ -134,7 +133,7 @@ const gridOptions: VxeGridProps<PddGoodsVO.Info> = {
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
rowConfig: { isHover: true, height: 72 },
|
||||
@@ -203,22 +202,6 @@ const gridOptions: VxeGridProps<PddGoodsVO.Info> = {
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
schema: [
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '全部店铺',
|
||||
options: shopOptions.value,
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
onChange: (val: number | undefined) => {
|
||||
searchForm.value.shopId = val;
|
||||
gridReloadRef.value?.();
|
||||
},
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '渠道店铺',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
@@ -283,11 +266,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '拼多多渠道商品',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
});
|
||||
|
||||
function openDetail(row: PddGoodsVO.Info) {
|
||||
const shopLabel = row.shopId
|
||||
? shopNameById.value[row.shopId]
|
||||
@@ -322,13 +309,30 @@ async function handleDelete(row: PddGoodsVO.Info) {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadShops();
|
||||
await loadShopNames();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid class="pdd-goods-grid">
|
||||
<PddShopColPage :selected-shop-id="selectedShopId" @select="onShopSelect">
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">拼多多商品</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<Grid class="pdd-goods-grid h-full min-h-0" :loading="loading">
|
||||
<template #thumb="{ row }: { row: PddGoodsVO.Info }">
|
||||
<Image
|
||||
v-if="row.thumbUrl || row.imageUrl"
|
||||
@@ -397,7 +401,9 @@ onMounted(async () => {
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<PddGoodsDetailDrawer
|
||||
ref="detailDrawerRef"
|
||||
@@ -405,7 +411,7 @@ onMounted(async () => {
|
||||
/>
|
||||
<PddShopDetailModal ref="shopDetailModalRef" />
|
||||
<ProductDetailDrawer ref="productDetailDrawerRef" />
|
||||
</Page>
|
||||
</PddShopColPage>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { PddOrderDTO, PddOrderVO } from '#/api/channel/pdd/order';
|
||||
import type { PddShopVO } from '#/api/channel/pdd/shop';
|
||||
import type { ShopDTO, ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { Button, Image, Space, Tag, Tooltip, message } from 'ant-design-vue';
|
||||
import { Button, Card, Image, Space, Tag, Tooltip, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getPddOrderPageApi } from '#/api/channel/pdd/order';
|
||||
import { getShopPageApi } from '#/api/ec/shop';
|
||||
import PddShopColPage from '#/views/channel/pdd/components/PddShopColPage.vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import PddOrderDetailDrawer from './components/PddOrderDetailDrawer.vue';
|
||||
|
||||
@@ -37,7 +37,10 @@ const REFUND_STATUS_MAP: Record<number, { color: string; text: string }> = {
|
||||
|
||||
const loading = ref(false);
|
||||
const detailDrawerRef = ref<InstanceType<typeof PddOrderDetailDrawer>>();
|
||||
const shopOptions = ref<{ label: string; value: number }[]>([]);
|
||||
/** 左侧选中的拼多多渠道店铺 ID */
|
||||
const selectedPddShopId = ref<number | undefined>(undefined);
|
||||
/** 渠道店铺 ID → 内部店铺 ID(订单表 shop_id 为 ec_shop.id) */
|
||||
const ecShopIdByPddShopId = ref<Record<number, number>>({});
|
||||
const shopNameById = ref<Record<number, string>>({});
|
||||
|
||||
const DEFAULT_LIST_DAYS = 7;
|
||||
@@ -94,7 +97,7 @@ function goodsSpecTooltip(row: PddOrderVO.Info) {
|
||||
return text || undefined;
|
||||
}
|
||||
|
||||
async function loadPddShops() {
|
||||
async function loadShopMappings() {
|
||||
try {
|
||||
const data = await getShopPageApi({
|
||||
page: 1,
|
||||
@@ -107,22 +110,37 @@ async function loadPddShops() {
|
||||
!!s.pddShop ||
|
||||
!!s.externalShopId,
|
||||
);
|
||||
shopOptions.value = list.map((s) => ({ label: s.name, value: s.id }));
|
||||
const map: Record<number, string> = {};
|
||||
for (const s of list) map[s.id] = s.name;
|
||||
shopNameById.value = map;
|
||||
|
||||
await gridApi.formApi?.updateSchema([
|
||||
{
|
||||
fieldName: 'shopId',
|
||||
componentProps: { options: shopOptions.value },
|
||||
},
|
||||
]);
|
||||
const ecMap: Record<number, number> = {};
|
||||
const nameMap: Record<number, string> = {};
|
||||
for (const s of list) {
|
||||
nameMap[s.id] = s.name;
|
||||
if (s.externalShopId != null) {
|
||||
ecMap[s.externalShopId] = s.id;
|
||||
}
|
||||
}
|
||||
ecShopIdByPddShopId.value = ecMap;
|
||||
shopNameById.value = nameMap;
|
||||
} catch {
|
||||
message.error('获取店铺列表失败');
|
||||
message.error('获取店铺映射失败');
|
||||
}
|
||||
}
|
||||
|
||||
function onShopSelect(shop: PddShopVO.Info | null) {
|
||||
if (!shop) {
|
||||
selectedPddShopId.value = undefined;
|
||||
searchForm.value.shopId = undefined;
|
||||
return;
|
||||
}
|
||||
selectedPddShopId.value = shop.id;
|
||||
const ecShopId = ecShopIdByPddShopId.value[shop.id];
|
||||
if (ecShopId == null) {
|
||||
message.warning('该拼多多店铺尚未绑定内部店铺,暂无订单数据');
|
||||
searchForm.value.shopId = -1;
|
||||
return;
|
||||
}
|
||||
searchForm.value.shopId = ecShopId;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<PddOrderVO.Info> = {
|
||||
columns: [
|
||||
{ type: 'seq' as const, width: 56, title: '序号' },
|
||||
@@ -187,7 +205,7 @@ const gridOptions: VxeGridProps<PddOrderVO.Info> = {
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
height: 'auto',
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
rowConfig: { isHover: true, height: 84 },
|
||||
@@ -273,22 +291,6 @@ const formOptions = computed(() => ({
|
||||
fieldName: 'orderSn',
|
||||
label: '订单号',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '全部店铺',
|
||||
options: shopOptions.value,
|
||||
allowClear: true,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
onChange: (val: number | undefined) => {
|
||||
searchForm.value.shopId = val;
|
||||
gridReloadRef.value?.();
|
||||
},
|
||||
},
|
||||
fieldName: 'shopId',
|
||||
label: '店铺',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
@@ -362,23 +364,47 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '拼多多订单',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
|
||||
watch(selectedPddShopId, () => {
|
||||
gridApi.reload();
|
||||
});
|
||||
|
||||
function openDetail(row: PddOrderVO.Info) {
|
||||
detailDrawerRef.value?.open(row.id, shopNameById.value[row.shopId]);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadPddShops();
|
||||
await loadShopMappings();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid class="pdd-order-grid">
|
||||
<PddShopColPage
|
||||
:selected-shop-id="selectedPddShopId"
|
||||
@select="onShopSelect"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">拼多多订单</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<Grid class="pdd-order-grid h-full min-h-0" :loading="loading">
|
||||
<template #shopName="{ row }">
|
||||
{{ shopNameById[row.shopId] || `店铺#${row.shopId}` }}
|
||||
</template>
|
||||
@@ -446,10 +472,12 @@ onMounted(async () => {
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<PddOrderDetailDrawer ref="detailDrawerRef" />
|
||||
</Page>
|
||||
</PddShopColPage>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<script setup lang="ts">
|
||||
import type { CompanyVO } from '#/api/company/types';
|
||||
|
||||
import { ColPage } from '@vben/common-ui';
|
||||
|
||||
import CompanySidebarList from '#/views/company/components/CompanySidebarList.vue';
|
||||
|
||||
defineOptions({ name: 'CompanyColPage' });
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
selectedCompanyId?: number;
|
||||
autoContentHeight?: boolean;
|
||||
leftWidth?: number;
|
||||
leftMinWidth?: number;
|
||||
leftMaxWidth?: number;
|
||||
leftCollapsedWidth?: number;
|
||||
leftCollapsible?: boolean;
|
||||
resizable?: boolean;
|
||||
splitHandle?: boolean;
|
||||
splitLine?: boolean;
|
||||
}>(),
|
||||
{
|
||||
autoContentHeight: true,
|
||||
leftWidth: 22,
|
||||
leftMinWidth: 16,
|
||||
leftMaxWidth: 36,
|
||||
leftCollapsedWidth: 5,
|
||||
leftCollapsible: true,
|
||||
resizable: true,
|
||||
splitHandle: false,
|
||||
splitLine: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedCompanyId': [id: number | undefined];
|
||||
select: [company: CompanyVO.CompanyInfoVO];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ColPage
|
||||
:auto-content-height="autoContentHeight"
|
||||
:left-width="leftWidth"
|
||||
:left-min-width="leftMinWidth"
|
||||
:left-max-width="leftMaxWidth"
|
||||
:left-collapsed-width="leftCollapsedWidth"
|
||||
:left-collapsible="leftCollapsible"
|
||||
:right-width="100 - leftWidth"
|
||||
:resizable="resizable"
|
||||
:split-handle="splitHandle"
|
||||
:split-line="splitLine"
|
||||
content-class="!p-2 sm:!p-3"
|
||||
>
|
||||
<template #left="{ isCollapsed, expand, collapse }">
|
||||
<div class="flex h-full min-h-0 min-w-0 flex-col overflow-hidden">
|
||||
<CompanySidebarList
|
||||
fluid
|
||||
:collapsed="isCollapsed"
|
||||
show-collapse-action
|
||||
:selected-company-id="selectedCompanyId"
|
||||
@collapse="collapse"
|
||||
@expand="expand"
|
||||
@update:selected-company-id="emit('update:selectedCompanyId', $event)"
|
||||
@select="emit('select', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<slot />
|
||||
</ColPage>
|
||||
</template>
|
||||
@@ -0,0 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Avatar } from 'ant-design-vue';
|
||||
|
||||
defineOptions({ name: 'CompanyLogoAvatar' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
logo?: string;
|
||||
name?: string;
|
||||
size?: number;
|
||||
}>(),
|
||||
{
|
||||
logo: undefined,
|
||||
name: undefined,
|
||||
size: 36,
|
||||
},
|
||||
);
|
||||
|
||||
const BuildingIcon = createIconifyIcon('lucide:building-2');
|
||||
|
||||
const fallbackText = computed(() => {
|
||||
const text = props.name?.trim();
|
||||
return text ? text.charAt(0).toUpperCase() : '';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Avatar
|
||||
:size="size"
|
||||
:src="logo"
|
||||
:alt="name"
|
||||
shape="square"
|
||||
class="company-logo-avatar shrink-0 !rounded-md !bg-muted"
|
||||
>
|
||||
<span v-if="fallbackText" class="text-xs font-medium">{{ fallbackText }}</span>
|
||||
<BuildingIcon v-else class="h-4 w-4 text-muted-foreground" />
|
||||
</Avatar>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.company-logo-avatar {
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
.company-logo-avatar span {
|
||||
display: block;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,330 @@
|
||||
<script setup lang="ts">
|
||||
import type { CompanyVO } from '#/api/company/types';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Input,
|
||||
message,
|
||||
Select,
|
||||
Spin,
|
||||
Tag,
|
||||
Tooltip,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { getCompanyPageApi } from '#/api/company';
|
||||
import CompanyLogoAvatar from '#/views/company/components/CompanyLogoAvatar.vue';
|
||||
|
||||
defineOptions({ name: 'CompanySidebarList' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
selectedCompanyId?: number;
|
||||
fluid?: boolean;
|
||||
showCollapseAction?: boolean;
|
||||
collapsed?: boolean;
|
||||
}>(),
|
||||
{
|
||||
selectedCompanyId: undefined,
|
||||
fluid: false,
|
||||
showCollapseAction: false,
|
||||
collapsed: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:selectedCompanyId': [id: number | undefined];
|
||||
select: [company: CompanyVO.CompanyInfoVO];
|
||||
collapse: [];
|
||||
expand: [];
|
||||
}>();
|
||||
|
||||
const BuildingIcon = createIconifyIcon('lucide:building-2');
|
||||
const PanelCloseIcon = createIconifyIcon('lucide:panel-left-close');
|
||||
const PanelOpenIcon = createIconifyIcon('lucide:panel-left-open');
|
||||
const ChevronUpIcon = createIconifyIcon('lucide:chevron-up');
|
||||
const ChevronDownIcon = createIconifyIcon('lucide:chevron-down');
|
||||
|
||||
const companySearchForm = ref({
|
||||
name: '',
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
const companies = ref<CompanyVO.CompanyInfoVO[]>([]);
|
||||
const companiesLoading = ref(false);
|
||||
const companyPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||
|
||||
const companyTotalPages = computed(() => {
|
||||
const { total, pageSize } = companyPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
async function searchCompanies(resetPage = false) {
|
||||
if (resetPage) {
|
||||
companyPagination.value.current = 1;
|
||||
}
|
||||
companiesLoading.value = true;
|
||||
try {
|
||||
const result = await getCompanyPageApi({
|
||||
page: companyPagination.value.current,
|
||||
pageSize: companyPagination.value.pageSize,
|
||||
filters: {
|
||||
name: companySearchForm.value.name || undefined,
|
||||
status: companySearchForm.value.status,
|
||||
},
|
||||
});
|
||||
companies.value = result.records ?? [];
|
||||
companyPagination.value.total = result.total ?? 0;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取公司列表失败');
|
||||
companies.value = [];
|
||||
} finally {
|
||||
companiesLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetCompanySearch() {
|
||||
companySearchForm.value = { name: '', status: undefined };
|
||||
void searchCompanies(true);
|
||||
}
|
||||
|
||||
function goCompanyPage(page: number) {
|
||||
const next = Math.min(companyTotalPages.value, Math.max(1, page));
|
||||
if (next === companyPagination.value.current) return;
|
||||
companyPagination.value.current = next;
|
||||
void searchCompanies();
|
||||
}
|
||||
|
||||
function selectCompany(company: CompanyVO.CompanyInfoVO) {
|
||||
emit('update:selectedCompanyId', company.id);
|
||||
emit('select', company);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void searchCompanies();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="collapsed"
|
||||
class="flex h-full min-h-0 w-full flex-col items-center gap-1 pb-2 pt-3"
|
||||
>
|
||||
<Tooltip title="展开公司列表">
|
||||
<Button type="text" size="small" class="!px-1" @click="emit('expand')">
|
||||
<PanelOpenIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
<div
|
||||
class="flex min-h-0 w-full flex-1 flex-col items-center gap-1.5 overflow-y-auto px-1 pb-1 pt-2"
|
||||
>
|
||||
<Spin
|
||||
:spinning="companiesLoading"
|
||||
size="small"
|
||||
wrapper-class-name="company-sidebar-collapsed-spin"
|
||||
>
|
||||
<div class="flex w-full flex-col items-center gap-1.5">
|
||||
<Tooltip v-for="company in companies" :key="company.id" :title="company.name">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex shrink-0 rounded-md p-0.5 transition-colors hover:bg-accent"
|
||||
:class="
|
||||
selectedCompanyId === company.id
|
||||
? 'ring-2 ring-primary ring-offset-1 ring-offset-background'
|
||||
: undefined
|
||||
"
|
||||
@click="selectCompany(company)"
|
||||
>
|
||||
<CompanyLogoAvatar
|
||||
:logo="company.logo"
|
||||
:name="company.name"
|
||||
:size="36"
|
||||
/>
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="companyTotalPages > 1"
|
||||
class="flex shrink-0 flex-col items-center gap-0.5"
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-6 !px-1"
|
||||
:disabled="companyPagination.current <= 1 || companiesLoading"
|
||||
@click="goCompanyPage(companyPagination.current - 1)"
|
||||
>
|
||||
<ChevronUpIcon class="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
<span class="text-[10px] leading-none text-muted-foreground">
|
||||
{{ companyPagination.current }}/{{ companyTotalPages }}
|
||||
</span>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-6 !px-1"
|
||||
:disabled="companyPagination.current >= companyTotalPages || companiesLoading"
|
||||
@click="goCompanyPage(companyPagination.current + 1)"
|
||||
>
|
||||
<ChevronDownIcon class="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card
|
||||
v-else
|
||||
class="flex h-full flex-col overflow-hidden"
|
||||
:class="fluid ? 'w-full min-w-0' : 'w-[320px] shrink-0'"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<BuildingIcon class="h-4 w-4" />
|
||||
公司
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template v-if="showCollapseAction" #extra>
|
||||
<Tooltip title="收起公司列表">
|
||||
<Button type="text" size="small" class="!px-1" @click="emit('collapse')">
|
||||
<PanelCloseIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 flex-col gap-2">
|
||||
<Input
|
||||
v-model:value="companySearchForm.name"
|
||||
placeholder="公司名称"
|
||||
allow-clear
|
||||
class="w-full min-w-0"
|
||||
@press-enter="searchCompanies(true)"
|
||||
/>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<Select
|
||||
v-model:value="companySearchForm.status"
|
||||
placeholder="状态"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
:options="[
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
]"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchCompanies(true)">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetCompanySearch">重置</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Spin :spinning="companiesLoading">
|
||||
<Empty
|
||||
v-if="!companiesLoading && companies.length === 0"
|
||||
class="py-8"
|
||||
description="暂无公司"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="company in companies"
|
||||
:key="company.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
selectedCompanyId === company.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectCompany(company)"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<CompanyLogoAvatar
|
||||
:logo="company.logo"
|
||||
:name="company.name"
|
||||
:size="36"
|
||||
/>
|
||||
<div class="flex min-w-0 flex-1 items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">
|
||||
{{ company.name }}
|
||||
</span>
|
||||
<Tag
|
||||
class="m-0 shrink-0"
|
||||
:color="company.status === 1 ? 'green' : 'red'"
|
||||
>
|
||||
{{ company.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="companyPagination.current <= 1 || companiesLoading"
|
||||
@click="goCompanyPage(companyPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ companyPagination.current }} / {{ companyTotalPages }}
|
||||
<span class="ml-1 opacity-70">({{ companyPagination.total }})</span>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
companyPagination.current >= companyTotalPages || companiesLoading
|
||||
"
|
||||
@click="goCompanyPage(companyPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.company-sidebar-collapsed-spin) {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
:deep(.company-sidebar-collapsed-spin .ant-spin-container) {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
@@ -1,19 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import type { CompanyVO } from '#/api/company/types';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Flex,
|
||||
Input,
|
||||
message,
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
@@ -25,27 +19,13 @@ import {
|
||||
getCompanyMenusApi,
|
||||
getCompanyMenuIdsApi,
|
||||
} from '#/api/company/menu/apis';
|
||||
import { getCompanyPageApi } from '#/api/company';
|
||||
import CompanyColPage from '#/views/company/components/CompanyColPage.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'CompanyMenuManagePage',
|
||||
});
|
||||
|
||||
const BuildingIcon = createIconifyIcon('lucide:building-2');
|
||||
|
||||
const companySearchForm = ref({
|
||||
name: '',
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
const companyList = ref<CompanyVO.CompanyInfoVO[]>([]);
|
||||
const companyLoading = ref(false);
|
||||
const companyPagination = ref({
|
||||
current: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const selectedCompanyId = ref<number | undefined>(undefined);
|
||||
const currentCompany = ref<CompanyVO.CompanyInfoVO | null>(null);
|
||||
|
||||
const systemMenuList = ref<any[]>([]);
|
||||
@@ -54,13 +34,6 @@ const selectedMenuIds = ref<number[]>([]);
|
||||
const menuExpandedKeys = ref<(number | string)[]>([]);
|
||||
const menuLoading = ref(false);
|
||||
|
||||
const selectedCompanyLabel = computed(() => {
|
||||
if (!currentCompany.value) {
|
||||
return '请先选择公司';
|
||||
}
|
||||
return currentCompany.value.name;
|
||||
});
|
||||
|
||||
const menuTreeData = computed(() => {
|
||||
const list = systemMenuList.value;
|
||||
const map = new Map<number, any>();
|
||||
@@ -89,29 +62,10 @@ const stats = computed(() => ({
|
||||
changed: selectedMenuIds.value.length !== companyMenuIds.value.length,
|
||||
}));
|
||||
|
||||
async function searchCompanies() {
|
||||
companyLoading.value = true;
|
||||
try {
|
||||
const result = await getCompanyPageApi({
|
||||
page: companyPagination.value.current,
|
||||
pageSize: companyPagination.value.pageSize,
|
||||
filters: {
|
||||
name: companySearchForm.value.name || undefined,
|
||||
status: companySearchForm.value.status,
|
||||
},
|
||||
});
|
||||
companyList.value = result.records;
|
||||
companyPagination.value.total = result.total;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取公司列表失败');
|
||||
} finally {
|
||||
companyLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function selectCompany(company: CompanyVO.CompanyInfoVO) {
|
||||
function onCompanySelect(company: CompanyVO.CompanyInfoVO) {
|
||||
currentCompany.value = company;
|
||||
await loadCompanyMenus();
|
||||
selectedCompanyId.value = company.id;
|
||||
void loadCompanyMenus();
|
||||
}
|
||||
|
||||
async function loadCompanyMenus() {
|
||||
@@ -208,249 +162,87 @@ async function handleSave() {
|
||||
message.error(error?.message || '保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
function resetCompanySearch() {
|
||||
companySearchForm.value = { name: '', status: undefined };
|
||||
companyPagination.value.current = 1;
|
||||
searchCompanies();
|
||||
}
|
||||
|
||||
function handleCompanyPageChange(page: number, pageSize: number) {
|
||||
companyPagination.value.current = page;
|
||||
companyPagination.value.pageSize = pageSize;
|
||||
searchCompanies();
|
||||
}
|
||||
|
||||
const companyTotalPages = computed(() => {
|
||||
const { total, pageSize } = companyPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
function goCompanyPage(page: number) {
|
||||
const next = Math.min(companyTotalPages.value, Math.max(1, page));
|
||||
if (next === companyPagination.value.current) {
|
||||
return;
|
||||
}
|
||||
handleCompanyPageChange(next, companyPagination.value.pageSize);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
searchCompanies();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="公司菜单管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择公司,右侧勾选并保存该公司可访问的菜单。
|
||||
</div>
|
||||
</template>
|
||||
<CompanyColPage
|
||||
:selected-company-id="selectedCompanyId"
|
||||
@select="onCompanySelect"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">菜单分配</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<!-- 左:公司 -->
|
||||
<Card
|
||||
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<BuildingIcon class="h-4 w-4" />
|
||||
公司
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 flex-col gap-2">
|
||||
<Input
|
||||
v-model:value="companySearchForm.name"
|
||||
placeholder="公司名称"
|
||||
allow-clear
|
||||
class="w-full min-w-0"
|
||||
@press-enter="searchCompanies"
|
||||
/>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<Select
|
||||
v-model:value="companySearchForm.status"
|
||||
placeholder="状态"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
:options="[
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
]"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchCompanies">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetCompanySearch">重置</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Spin :spinning="companyLoading">
|
||||
<Empty
|
||||
v-if="!companyLoading && companyList.length === 0"
|
||||
class="py-8"
|
||||
description="暂无公司"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="company in companyList"
|
||||
:key="company.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
currentCompany?.id === company.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectCompany(company)"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">
|
||||
{{ company.name }}
|
||||
</span>
|
||||
<Tag
|
||||
class="m-0 shrink-0"
|
||||
:color="company.status === 1 ? 'green' : 'red'"
|
||||
>
|
||||
{{ company.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="companyPagination.current <= 1 || companyLoading"
|
||||
@click="goCompanyPage(companyPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ companyPagination.current }} / {{ companyTotalPages }}
|
||||
<span class="ml-1 opacity-70"
|
||||
>({{ companyPagination.total }})</span
|
||||
>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
companyPagination.current >= companyTotalPages || companyLoading
|
||||
"
|
||||
@click="goCompanyPage(companyPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<!-- 右:菜单分配 -->
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">菜单分配</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedCompanyLabel }}
|
||||
<template #extra>
|
||||
<Space wrap size="small">
|
||||
<template v-if="currentCompany">
|
||||
<Tag
|
||||
class="ml-2"
|
||||
:color="currentCompany.status === 1 ? 'green' : 'red'"
|
||||
>
|
||||
<Tag :color="currentCompany.status === 1 ? 'green' : 'red'">
|
||||
{{ currentCompany.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
<span class="ml-3">
|
||||
<span class="text-xs text-muted-foreground">
|
||||
系统菜单 {{ stats.total }} · 已配置
|
||||
<strong class="text-green-600">{{ stats.company }}</strong> · 当前选择
|
||||
<strong class="text-green-600">{{ stats.company }}</strong> · 当前
|
||||
<strong class="text-blue-600">{{ stats.selected }}</strong>
|
||||
<span v-if="stats.changed" class="text-orange-500">(有未保存更改)</span>
|
||||
<span v-if="stats.changed" class="text-orange-500">(未保存)</span>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-if="!currentCompany"
|
||||
class="flex min-h-0 flex-1 items-center justify-center"
|
||||
>
|
||||
<Empty description="请从左侧选择公司以配置菜单" />
|
||||
</div>
|
||||
<div
|
||||
v-if="!currentCompany"
|
||||
class="flex min-h-0 flex-1 items-center justify-center"
|
||||
>
|
||||
<Empty description="请从左侧选择公司以配置菜单" />
|
||||
</div>
|
||||
|
||||
<div v-else class="min-h-0 flex-1 overflow-y-auto px-4 py-3 sm:px-5">
|
||||
<Spin :spinning="menuLoading">
|
||||
<Tree
|
||||
v-model:checked-keys="selectedMenuIds"
|
||||
v-model:expanded-keys="menuExpandedKeys"
|
||||
:tree-data="menuTreeData"
|
||||
checkable
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
>
|
||||
<template #title="{ title, status }">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="min-w-0 truncate font-medium">{{ title }}</span>
|
||||
<Tag
|
||||
v-if="status === 0"
|
||||
color="default"
|
||||
class="m-0 shrink-0"
|
||||
>
|
||||
已禁用
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
</Tree>
|
||||
</Spin>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
</Page>
|
||||
<div v-else class="min-h-0 flex-1 overflow-y-auto px-4 py-3 sm:px-5">
|
||||
<Spin :spinning="menuLoading">
|
||||
<Tree
|
||||
v-model:checked-keys="selectedMenuIds"
|
||||
v-model:expanded-keys="menuExpandedKeys"
|
||||
:tree-data="menuTreeData"
|
||||
checkable
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
>
|
||||
<template #title="{ title, status }">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="min-w-0 truncate font-medium">{{ title }}</span>
|
||||
<Tag
|
||||
v-if="status === 0"
|
||||
color="default"
|
||||
class="m-0 shrink-0"
|
||||
>
|
||||
已禁用
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
</Tree>
|
||||
</Spin>
|
||||
</div>
|
||||
</Card>
|
||||
</CompanyColPage>
|
||||
</template>
|
||||
|
||||
@@ -4,17 +4,11 @@ import type { PermissionVO } from '#/api/sys/permission/types';
|
||||
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Empty,
|
||||
Flex,
|
||||
Input,
|
||||
message,
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
@@ -25,13 +19,11 @@ import {
|
||||
batchUpdateCompanyPermissionsApi,
|
||||
getCompanyPermissionIdsApi,
|
||||
} from '#/api/company/permission/apis';
|
||||
import { getCompanyPageApi } from '#/api/company';
|
||||
import { getPermissionTreeApi } from '#/api/sys/permission';
|
||||
import CompanyColPage from '#/views/company/components/CompanyColPage.vue';
|
||||
|
||||
defineOptions({ name: 'CompanyPermissionManagePage' });
|
||||
|
||||
const BuildingIcon = createIconifyIcon('lucide:building-2');
|
||||
|
||||
type PermissionTreeNode = {
|
||||
key: number;
|
||||
title: string;
|
||||
@@ -40,15 +32,7 @@ type PermissionTreeNode = {
|
||||
children?: PermissionTreeNode[];
|
||||
};
|
||||
|
||||
const companySearchForm = ref({
|
||||
name: '',
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
const companyList = ref<CompanyVO.CompanyInfoVO[]>([]);
|
||||
const companyLoading = ref(false);
|
||||
const companyPagination = ref({ current: 1, pageSize: 20, total: 0 });
|
||||
|
||||
const selectedCompanyId = ref<number | undefined>(undefined);
|
||||
const currentCompany = ref<CompanyVO.CompanyInfoVO | null>(null);
|
||||
|
||||
const permissionTree = ref<PermissionVO.PermissionInfoVO[]>([]);
|
||||
@@ -57,13 +41,6 @@ const companyPermissionIds = ref<number[]>([]);
|
||||
const selectedPermissionIds = ref<number[]>([]);
|
||||
const expandedKeys = ref<number[]>([]);
|
||||
|
||||
const selectedCompanyLabel = computed(() => {
|
||||
if (!currentCompany.value) {
|
||||
return '请先选择公司';
|
||||
}
|
||||
return currentCompany.value.name;
|
||||
});
|
||||
|
||||
const permissionTreeData = computed(() =>
|
||||
mapPermissionToTreeData(permissionTree.value),
|
||||
);
|
||||
@@ -118,29 +95,10 @@ function collectExpandableKeys(nodes: PermissionVO.PermissionInfoVO[]): number[]
|
||||
return keys;
|
||||
}
|
||||
|
||||
async function searchCompanies() {
|
||||
companyLoading.value = true;
|
||||
try {
|
||||
const result = await getCompanyPageApi({
|
||||
page: companyPagination.value.current,
|
||||
pageSize: companyPagination.value.pageSize,
|
||||
filters: {
|
||||
name: companySearchForm.value.name || undefined,
|
||||
status: companySearchForm.value.status,
|
||||
},
|
||||
});
|
||||
companyList.value = result.records;
|
||||
companyPagination.value.total = result.total;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取公司列表失败');
|
||||
} finally {
|
||||
companyLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function selectCompany(company: CompanyVO.CompanyInfoVO) {
|
||||
function onCompanySelect(company: CompanyVO.CompanyInfoVO) {
|
||||
currentCompany.value = company;
|
||||
await loadCompanyPermissions();
|
||||
selectedCompanyId.value = company.id;
|
||||
void loadCompanyPermissions();
|
||||
}
|
||||
|
||||
async function loadCompanyPermissions() {
|
||||
@@ -191,31 +149,6 @@ async function handleSave() {
|
||||
}
|
||||
}
|
||||
|
||||
function resetCompanySearch() {
|
||||
companySearchForm.value = { name: '', status: undefined };
|
||||
companyPagination.value.current = 1;
|
||||
searchCompanies();
|
||||
}
|
||||
|
||||
function handleCompanyPageChange(page: number, pageSize: number) {
|
||||
companyPagination.value.current = page;
|
||||
companyPagination.value.pageSize = pageSize;
|
||||
searchCompanies();
|
||||
}
|
||||
|
||||
const companyTotalPages = computed(() => {
|
||||
const { total, pageSize } = companyPagination.value;
|
||||
return Math.max(1, Math.ceil(total / pageSize) || 1);
|
||||
});
|
||||
|
||||
function goCompanyPage(page: number) {
|
||||
const next = Math.min(companyTotalPages.value, Math.max(1, page));
|
||||
if (next === companyPagination.value.current) {
|
||||
return;
|
||||
}
|
||||
handleCompanyPageChange(next, companyPagination.value.pageSize);
|
||||
}
|
||||
|
||||
function countLeafPermissions(nodes: PermissionVO.PermissionInfoVO[]): number {
|
||||
let count = 0;
|
||||
for (const node of nodes) {
|
||||
@@ -246,237 +179,101 @@ function selectNone() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
searchCompanies();
|
||||
loadPermissionTree();
|
||||
void loadPermissionTree();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="公司权限管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择公司,右侧勾选并保存该公司可分配的权限。
|
||||
</div>
|
||||
</template>
|
||||
<CompanyColPage
|
||||
:selected-company-id="selectedCompanyId"
|
||||
@select="onCompanySelect"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">权限分配</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<!-- 左:公司 -->
|
||||
<Card
|
||||
class="flex h-full w-[320px] shrink-0 flex-col overflow-hidden"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: '8px',
|
||||
minHeight: 0,
|
||||
minWidth: 0,
|
||||
overflow: 'hidden',
|
||||
padding: '12px',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="flex items-center gap-2 text-base font-semibold">
|
||||
<BuildingIcon class="h-4 w-4" />
|
||||
公司
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div class="flex min-w-0 shrink-0 flex-col gap-2">
|
||||
<Input
|
||||
v-model:value="companySearchForm.name"
|
||||
placeholder="公司名称"
|
||||
allow-clear
|
||||
class="w-full min-w-0"
|
||||
@press-enter="searchCompanies"
|
||||
/>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<Select
|
||||
v-model:value="companySearchForm.status"
|
||||
placeholder="状态"
|
||||
allow-clear
|
||||
class="min-w-0 flex-1"
|
||||
:options="[
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 },
|
||||
]"
|
||||
/>
|
||||
<Button type="primary" class="shrink-0" @click="searchCompanies">
|
||||
搜索
|
||||
</Button>
|
||||
<Button class="shrink-0" @click="resetCompanySearch">重置</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||
<Spin :spinning="companyLoading">
|
||||
<Empty
|
||||
v-if="!companyLoading && companyList.length === 0"
|
||||
class="py-8"
|
||||
description="暂无公司"
|
||||
/>
|
||||
<template v-else>
|
||||
<Card
|
||||
v-for="company in companyList"
|
||||
:key="company.id"
|
||||
size="small"
|
||||
:body-style="{ padding: '10px 12px' }"
|
||||
class="mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
|
||||
:class="
|
||||
currentCompany?.id === company.id
|
||||
? 'border-primary bg-primary/5'
|
||||
: undefined
|
||||
"
|
||||
@click="selectCompany(company)"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="min-w-0 truncate text-sm font-medium">
|
||||
{{ company.name }}
|
||||
</span>
|
||||
<Tag
|
||||
class="m-0 shrink-0"
|
||||
:color="company.status === 1 ? 'green' : 'red'"
|
||||
>
|
||||
{{ company.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
</div>
|
||||
</Card>
|
||||
</template>
|
||||
</Spin>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mt-2 flex w-full min-w-0 shrink-0 items-center justify-between gap-2"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="companyPagination.current <= 1 || companyLoading"
|
||||
@click="goCompanyPage(companyPagination.current - 1)"
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<span
|
||||
class="min-w-0 flex-1 truncate text-center text-xs text-muted-foreground"
|
||||
>
|
||||
{{ companyPagination.current }} / {{ companyTotalPages }}
|
||||
<span class="ml-1 opacity-70"
|
||||
>({{ companyPagination.total }})</span
|
||||
>
|
||||
</span>
|
||||
<Button
|
||||
size="small"
|
||||
class="shrink-0"
|
||||
:disabled="
|
||||
companyPagination.current >= companyTotalPages || companyLoading
|
||||
"
|
||||
@click="goCompanyPage(companyPagination.current + 1)"
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<!-- 右:权限分配 -->
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">权限分配</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedCompanyLabel }}
|
||||
<template #extra>
|
||||
<Space wrap size="small">
|
||||
<template v-if="currentCompany">
|
||||
<Tag
|
||||
class="ml-2"
|
||||
:color="currentCompany.status === 1 ? 'green' : 'red'"
|
||||
>
|
||||
<Tag :color="currentCompany.status === 1 ? 'green' : 'red'">
|
||||
{{ currentCompany.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
<span class="ml-3">
|
||||
全部叶子权限 {{ stats.total }} · 已配置
|
||||
<strong class="text-green-600">{{ stats.company }}</strong> · 当前选择
|
||||
<span class="text-xs text-muted-foreground">
|
||||
叶子权限 {{ stats.total }} · 已配置
|
||||
<strong class="text-green-600">{{ stats.company }}</strong> · 当前
|
||||
<strong class="text-blue-600">{{ stats.selected }}</strong>
|
||||
<span v-if="stats.changed" class="text-orange-500"
|
||||
>(有未保存更改)</span
|
||||
>
|
||||
<span v-if="stats.changed" class="text-orange-500">(未保存)</span>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-if="!currentCompany"
|
||||
class="flex min-h-0 flex-1 items-center justify-center"
|
||||
>
|
||||
<Empty description="请从左侧选择公司以配置权限" />
|
||||
</div>
|
||||
<div
|
||||
v-if="!currentCompany"
|
||||
class="flex min-h-0 flex-1 items-center justify-center"
|
||||
>
|
||||
<Empty description="请从左侧选择公司以配置权限" />
|
||||
</div>
|
||||
|
||||
<div v-else class="min-h-0 flex-1 overflow-y-auto px-4 py-3 sm:px-5">
|
||||
<Spin :spinning="permissionLoading">
|
||||
<Tree
|
||||
v-if="permissionTreeData.length > 0"
|
||||
v-model:checked-keys="selectedPermissionIds"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="permissionTreeData"
|
||||
checkable
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
>
|
||||
<template #title="{ title, code, type }">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="min-w-0 truncate font-medium">{{ title }}</span>
|
||||
<span
|
||||
v-if="code"
|
||||
class="shrink-0 text-xs text-muted-foreground"
|
||||
>
|
||||
{{ code }}
|
||||
</span>
|
||||
<Tag
|
||||
v-if="type === 'module'"
|
||||
color="purple"
|
||||
class="m-0 shrink-0"
|
||||
>
|
||||
模块
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
</Tree>
|
||||
<Empty
|
||||
v-else-if="!permissionLoading"
|
||||
class="py-8"
|
||||
description="暂无可分配的权限"
|
||||
/>
|
||||
</Spin>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
</Page>
|
||||
<div v-else class="min-h-0 flex-1 overflow-y-auto px-4 py-3 sm:px-5">
|
||||
<Spin :spinning="permissionLoading">
|
||||
<Tree
|
||||
v-if="permissionTreeData.length > 0"
|
||||
v-model:checked-keys="selectedPermissionIds"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="permissionTreeData"
|
||||
checkable
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
>
|
||||
<template #title="{ title, code, type }">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="min-w-0 truncate font-medium">{{ title }}</span>
|
||||
<span
|
||||
v-if="code"
|
||||
class="shrink-0 text-xs text-muted-foreground"
|
||||
>
|
||||
{{ code }}
|
||||
</span>
|
||||
<Tag
|
||||
v-if="type === 'module'"
|
||||
color="purple"
|
||||
class="m-0 shrink-0"
|
||||
>
|
||||
模块
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
</Tree>
|
||||
<Empty
|
||||
v-else-if="!permissionLoading"
|
||||
class="py-8"
|
||||
description="暂无可分配的权限"
|
||||
/>
|
||||
</Spin>
|
||||
</div>
|
||||
</Card>
|
||||
</CompanyColPage>
|
||||
</template>
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
AdFeeDTO,
|
||||
AdFeeVO,
|
||||
} from '#/api/ec/ad-fee/types';
|
||||
import type { AdFeeDTO, AdFeeVO } from '#/api/ec/ad-fee/types';
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Flex,
|
||||
message,
|
||||
Popconfirm,
|
||||
Space,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteAdFeeApi,
|
||||
getAdFeePageApi,
|
||||
} from '#/api/ec/ad-fee';
|
||||
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||
import { deleteAdFeeApi, getAdFeePageApi } from '#/api/ec/ad-fee';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import AdFeeFormModal from './components/AdFeeFormModal.vue';
|
||||
|
||||
@@ -35,10 +28,7 @@ defineOptions({ name: 'AdFeeManagement' });
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
/** 未选择具体店铺:undefined 表示全部店铺 */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const selectedShopName = ref<string | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentAdFeeData = ref<null | AdFeeVO.Info>(null);
|
||||
@@ -49,21 +39,8 @@ const searchForm = ref({
|
||||
feeDateEnd: undefined as string | undefined,
|
||||
});
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
selectedShopName.value = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
selectedShopName.value = shop.name;
|
||||
function onShopSelect(shop: ShopVO.Info | null) {
|
||||
selectedShopId.value = shop?.id;
|
||||
}
|
||||
|
||||
function handleAddForShop(shopId: number) {
|
||||
@@ -74,11 +51,7 @@ function handleAddForShop(shopId: number) {
|
||||
|
||||
const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 56,
|
||||
title: '序号',
|
||||
},
|
||||
{ type: 'seq' as const, minWidth: 56, title: '序号' },
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺',
|
||||
@@ -103,11 +76,7 @@ const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
minWidth: 110,
|
||||
slots: { default: 'feeAmount' },
|
||||
},
|
||||
{
|
||||
field: 'feeDate',
|
||||
title: '发生日期',
|
||||
minWidth: 110,
|
||||
},
|
||||
{ field: 'feeDate', title: '发生日期', minWidth: 110 },
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
@@ -121,11 +90,7 @@ const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
rowConfig: { isHover: true },
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
toolbarConfig: { custom: true, refresh: true, zoom: true },
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
@@ -184,7 +149,7 @@ function refreshTable() {
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
showSearchForm: false,
|
||||
tableTitle: '推广记录',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
@@ -195,17 +160,17 @@ function resetModalPreset() {
|
||||
presetShopIdForModal.value = null;
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
function handleAdd() {
|
||||
currentAdFeeData.value = null;
|
||||
resetModalPreset();
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
}
|
||||
|
||||
const handleEdit = (record: AdFeeVO.Info) => {
|
||||
function handleEdit(record: AdFeeVO.Info) {
|
||||
resetModalPreset();
|
||||
currentAdFeeData.value = record;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
}
|
||||
|
||||
async function handleDelete(id: number) {
|
||||
try {
|
||||
@@ -217,127 +182,102 @@ async function handleDelete(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleFormSuccess = () => {
|
||||
function handleFormSuccess() {
|
||||
resetModalPreset();
|
||||
refreshTable();
|
||||
};
|
||||
}
|
||||
|
||||
const handleFormCancel = () => {
|
||||
function handleFormCancel() {
|
||||
resetModalPreset();
|
||||
formModalVisible.value = false;
|
||||
};
|
||||
}
|
||||
|
||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="广告费管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择店铺筛选右侧推广记录;未选店铺时展示全部记录。可在店铺行快捷新增该店铺广告费。
|
||||
</div>
|
||||
</template>
|
||||
<EcShopColPage
|
||||
show-add-action
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">推广记录</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,48rem)]">
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateEnd"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<ShopSidebarList
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
/>
|
||||
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">推广记录</span>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,42rem)]">
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateStart"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="开始"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.feeDateEnd"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="结束"
|
||||
class="w-[118px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</Space>
|
||||
</template>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #feeAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedShopLabel }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
使用上方日期筛选;表格在区域内滚动
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #feeAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.feeAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #product="{ row }">
|
||||
<div>
|
||||
<div>{{ row.productName || '—' }}</div>
|
||||
<div
|
||||
v-if="row.productCode"
|
||||
class="text-xs text-muted-foreground"
|
||||
>
|
||||
{{ row.productCode }}
|
||||
</div>
|
||||
<template #product="{ row }">
|
||||
<div>
|
||||
<div>{{ row.productName || '—' }}</div>
|
||||
<div
|
||||
v-if="row.productCode"
|
||||
class="text-xs text-muted-foreground"
|
||||
>
|
||||
{{ row.productCode }}
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<AdFeeFormModal
|
||||
v-model:open="formModalVisible"
|
||||
@@ -346,5 +286,5 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
@success="handleFormSuccess"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</EcShopColPage>
|
||||
</template>
|
||||
|
||||
@@ -2,18 +2,17 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { BrushOrderDTO, BrushOrderVO } from '#/api/ec/brush-order';
|
||||
import type { ProductDTO, ProductVO } from '#/api/ec/product/types';
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Flex,
|
||||
InputNumber,
|
||||
message,
|
||||
Popconfirm,
|
||||
@@ -27,7 +26,7 @@ import {
|
||||
getBrushOrderPageApi,
|
||||
} from '#/api/ec/brush-order';
|
||||
import { getProductPageApi } from '#/api/ec/product';
|
||||
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import BrushOrderFormModal from './components/BrushOrderFormModal.vue';
|
||||
|
||||
@@ -39,7 +38,6 @@ const loading = ref(false);
|
||||
|
||||
/** 未选店铺:undefined 表示全部 */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const selectedShopName = ref<string | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentBrushOrderData = ref<BrushOrderVO.Info | null>(null);
|
||||
@@ -114,21 +112,8 @@ function handleProductPopupScroll(e: Event) {
|
||||
}
|
||||
}
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
selectedShopName.value = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
selectedShopName.value = shop.name;
|
||||
function onShopSelect(shop: ShopVO.Info | null) {
|
||||
selectedShopId.value = shop?.id;
|
||||
}
|
||||
|
||||
function handleAddForShop(shopId: number) {
|
||||
@@ -254,7 +239,7 @@ function refreshTable() {
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
showSearchForm: false,
|
||||
tableTitle: '刷单记录',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
@@ -301,136 +286,118 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="刷单记录管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择店铺筛选右侧记录;未选店铺时展示全部。可在店铺行快捷新增该店铺刷单记录。
|
||||
</div>
|
||||
</template>
|
||||
<EcShopColPage
|
||||
show-add-action
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">刷单记录</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<template #extra>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增刷单记录
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<ShopSidebarList
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
/>
|
||||
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">刷单记录</span>
|
||||
</template>
|
||||
|
||||
<div class="shrink-0 space-y-2 border-t border-border px-4 py-3">
|
||||
<div class="flex flex-wrap items-end gap-2">
|
||||
<div class="flex min-w-0 flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">商品</span>
|
||||
<Select
|
||||
v-model:value="searchForm.productId"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="false"
|
||||
placeholder="名称/编码搜索"
|
||||
class="min-w-[220px] max-w-[320px]"
|
||||
:options="productOptions"
|
||||
:loading="productLoading"
|
||||
:dropdown-match-select-width="false"
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
@search="handleProductSearch"
|
||||
@popup-scroll="handleProductPopupScroll"
|
||||
@focus="
|
||||
() => {
|
||||
if (!productLoaded) void fetchProducts(1, false);
|
||||
}
|
||||
"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≥</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.minBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最小"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≤</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.maxBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最大"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间起</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.startBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="开始"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间止</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.endBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="结束"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<Button type="default" size="small" class="mb-0.5" @click="refreshTable">
|
||||
查询
|
||||
</Button>
|
||||
<div class="shrink-0 space-y-2 border-t border-border px-4 py-3">
|
||||
<div class="flex flex-wrap items-end gap-2">
|
||||
<div class="flex min-w-0 flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">商品</span>
|
||||
<Select
|
||||
v-model:value="searchForm.productId"
|
||||
allow-clear
|
||||
show-search
|
||||
:filter-option="false"
|
||||
placeholder="名称/编码搜索"
|
||||
class="min-w-[220px] max-w-[320px]"
|
||||
:options="productOptions"
|
||||
:loading="productLoading"
|
||||
:dropdown-match-select-width="false"
|
||||
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
@search="handleProductSearch"
|
||||
@popup-scroll="handleProductPopupScroll"
|
||||
@focus="
|
||||
() => {
|
||||
if (!productLoaded) void fetchProducts(1, false);
|
||||
}
|
||||
"
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-xs text-muted-foreground">
|
||||
当前:{{ selectedShopLabel }}
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≥</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.minBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最小"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">金额 ≤</span>
|
||||
<InputNumber
|
||||
v-model:value="searchForm.maxBrushAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
placeholder="最大"
|
||||
class="!w-[110px]"
|
||||
allow-clear
|
||||
@press-enter="refreshTable"
|
||||
@blur="refreshTable"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间起</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.startBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="开始"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5">
|
||||
<span class="text-xs text-muted-foreground">刷单时间止</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.endBrushTime"
|
||||
show-time
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="结束"
|
||||
class="w-[180px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</div>
|
||||
<Button type="default" size="small" class="mb-0.5" @click="refreshTable">
|
||||
查询
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3">
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
修改筛选后点击「查询」或失焦/回车刷新;左侧切换店铺立即刷新
|
||||
</span>
|
||||
</template>
|
||||
<div class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3">
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
|
||||
<template #productInfo="{ row }">
|
||||
<div v-if="row.productName">
|
||||
@@ -465,7 +432,6 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
|
||||
<BrushOrderFormModal
|
||||
v-model:open="formModalVisible"
|
||||
@@ -474,5 +440,5 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
@success="handleFormSuccess"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</EcShopColPage>
|
||||
</template>
|
||||
|
||||
@@ -4,18 +4,17 @@ import type {
|
||||
ShopMonthlyTargetDTO,
|
||||
ShopMonthlyTargetVO,
|
||||
} from '#/api/ec/shop/monthly-target';
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Flex,
|
||||
message,
|
||||
Popconfirm,
|
||||
Space,
|
||||
@@ -26,7 +25,7 @@ import {
|
||||
deleteShopMonthlyTargetApi,
|
||||
getShopMonthlyTargetPageApi,
|
||||
} from '#/api/ec/shop/monthly-target';
|
||||
import ShopSidebarList from '#/views/ec/components/ShopSidebarList.vue';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import ShopMonthlyTargetFormModal from './components/ShopMonthlyTargetFormModal.vue';
|
||||
|
||||
@@ -35,10 +34,7 @@ defineOptions({ name: 'ShopMonthlyTargetManagement' });
|
||||
const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
/** 未选择具体店铺:undefined 表示全部店铺 */
|
||||
const selectedShopId = ref<number | undefined>(undefined);
|
||||
const selectedShopName = ref<string | undefined>(undefined);
|
||||
|
||||
const formModalVisible = ref(false);
|
||||
const currentShopMonthlyTargetData = ref<null | ShopMonthlyTargetVO.Info>(null);
|
||||
@@ -49,21 +45,8 @@ const searchForm = ref({
|
||||
endTargetMonth: undefined as string | undefined,
|
||||
});
|
||||
|
||||
const selectedShopLabel = computed(() => {
|
||||
if (selectedShopId.value == null) {
|
||||
return '全部店铺';
|
||||
}
|
||||
return selectedShopName.value || `店铺 #${selectedShopId.value}`;
|
||||
});
|
||||
|
||||
function onShopSelect(shop: { id: number; name: string } | null) {
|
||||
if (!shop) {
|
||||
selectedShopId.value = undefined;
|
||||
selectedShopName.value = undefined;
|
||||
return;
|
||||
}
|
||||
selectedShopId.value = shop.id;
|
||||
selectedShopName.value = shop.name;
|
||||
function onShopSelect(shop: ShopVO.Info | null) {
|
||||
selectedShopId.value = shop?.id;
|
||||
}
|
||||
|
||||
function handleAddForShop(shopId: number) {
|
||||
@@ -74,43 +57,27 @@ function handleAddForShop(shopId: number) {
|
||||
|
||||
const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||
columns: [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 56,
|
||||
title: '序号',
|
||||
},
|
||||
{ type: 'seq' as const, minWidth: 56, title: '序号' },
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺名称',
|
||||
minWidth: 120,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'targetMonth',
|
||||
title: '目标月份',
|
||||
minWidth: 110,
|
||||
},
|
||||
{ field: 'targetMonth', title: '目标月份', minWidth: 110 },
|
||||
{
|
||||
title: '目标销售额',
|
||||
minWidth: 120,
|
||||
slots: { default: 'targetAmount' },
|
||||
},
|
||||
{
|
||||
field: 'targetOrderCount',
|
||||
title: '目标订单数',
|
||||
minWidth: 100,
|
||||
},
|
||||
{ field: 'targetOrderCount', title: '目标订单数', minWidth: 100 },
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{ field: 'createTime', title: '创建时间', minWidth: 160 },
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
@@ -124,11 +91,7 @@ const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||
rowConfig: { isHover: true },
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
refresh: true,
|
||||
zoom: true,
|
||||
},
|
||||
toolbarConfig: { custom: true, refresh: true, zoom: true },
|
||||
data: [],
|
||||
pagerConfig: {
|
||||
enabled: true,
|
||||
@@ -187,7 +150,7 @@ function refreshTable() {
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
showSearchForm: false,
|
||||
tableTitle: '月销量目标',
|
||||
tableTitle: '',
|
||||
});
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
@@ -198,17 +161,17 @@ function resetModalPreset() {
|
||||
presetShopIdForModal.value = null;
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
function handleAdd() {
|
||||
currentShopMonthlyTargetData.value = null;
|
||||
resetModalPreset();
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
}
|
||||
|
||||
const handleEdit = (record: ShopMonthlyTargetVO.Info) => {
|
||||
function handleEdit(record: ShopMonthlyTargetVO.Info) {
|
||||
resetModalPreset();
|
||||
currentShopMonthlyTargetData.value = record;
|
||||
formModalVisible.value = true;
|
||||
};
|
||||
}
|
||||
|
||||
async function handleDelete(id: number) {
|
||||
try {
|
||||
@@ -220,115 +183,92 @@ async function handleDelete(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleFormSuccess = () => {
|
||||
function handleFormSuccess() {
|
||||
resetModalPreset();
|
||||
refreshTable();
|
||||
};
|
||||
}
|
||||
|
||||
const handleFormCancel = () => {
|
||||
function handleFormCancel() {
|
||||
resetModalPreset();
|
||||
formModalVisible.value = false;
|
||||
};
|
||||
}
|
||||
|
||||
const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="店铺月销量目标管理" :auto-content-height="true">
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
左侧选择店铺筛选右侧月销量目标记录;未选店铺时展示全部记录。可在店铺行快捷新增该店铺月销量目标。
|
||||
</div>
|
||||
</template>
|
||||
<EcShopColPage
|
||||
show-add-action
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
>
|
||||
<Card
|
||||
class="ml-1 flex h-full min-h-0 min-w-0 flex-1 flex-col sm:ml-2"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">月销量目标</span>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增月销量目标
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,48rem)]">
|
||||
<DatePicker
|
||||
v-model:value="searchForm.startTargetMonth"
|
||||
picker="month"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="开始月份"
|
||||
class="w-[120px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.endTargetMonth"
|
||||
picker="month"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="结束月份"
|
||||
class="w-[120px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增月销量目标
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
<Flex gap="middle" class="h-full min-h-0 overflow-hidden">
|
||||
<ShopSidebarList
|
||||
:selected-shop-id="selectedShopId"
|
||||
@select="onShopSelect"
|
||||
@add-for-shop="handleAddForShop"
|
||||
/>
|
||||
|
||||
<Card
|
||||
class="flex h-full min-h-0 min-w-0 flex-1 flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
minHeight: 0,
|
||||
padding: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
<div
|
||||
class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-2 sm:px-3 sm:pb-3"
|
||||
>
|
||||
<template #title>
|
||||
<span class="text-base font-semibold">月销量目标</span>
|
||||
</template>
|
||||
<template #extra>
|
||||
<Space wrap size="small" class="max-w-[min(100%,42rem)]">
|
||||
<DatePicker
|
||||
v-model:value="searchForm.startTargetMonth"
|
||||
picker="month"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="开始月份"
|
||||
class="w-[120px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<span class="text-muted-foreground">—</span>
|
||||
<DatePicker
|
||||
v-model:value="searchForm.endTargetMonth"
|
||||
picker="month"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="结束月份"
|
||||
class="w-[120px]"
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
</Space>
|
||||
</template>
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #targetAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.targetAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div
|
||||
class="shrink-0 border-t border-border px-4 py-2 text-xs text-muted-foreground"
|
||||
>
|
||||
当前:{{ selectedShopLabel }}
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 overflow-hidden px-2 pb-2 pt-0 sm:px-3 sm:pb-3">
|
||||
<Grid :loading="loading" class="h-full min-h-0">
|
||||
<template #toolbar-tools>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
使用上方月份筛选;表格在区域内滚动
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #targetAmount="{ row }">
|
||||
<span class="font-semibold text-red-600">
|
||||
{{ formatAmount(row.targetAmount) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条月销量目标吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
</Flex>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条月销量目标吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<ShopMonthlyTargetFormModal
|
||||
v-model:open="formModalVisible"
|
||||
@@ -337,5 +277,5 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
@success="handleFormSuccess"
|
||||
@cancel="handleFormCancel"
|
||||
/>
|
||||
</Page>
|
||||
</EcShopColPage>
|
||||
</template>
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from '#/api/company';
|
||||
import CompanyMenuDrawer from '#/components/CompanyMenuDrawer.vue';
|
||||
import CompanyPermissionDrawer from '#/components/CompanyPermissionDrawer.vue';
|
||||
import CompanyLogoAvatar from '#/views/company/components/CompanyLogoAvatar.vue';
|
||||
|
||||
import CompanyFormModal from './components/CompanyFormModal.vue';
|
||||
|
||||
@@ -53,6 +54,12 @@ const gridOptions: VxeGridProps<any> = {
|
||||
minWidth: 'auto',
|
||||
title: '序号',
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
width: 72,
|
||||
align: 'center' as const,
|
||||
slots: { default: 'logo' },
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '公司名称',
|
||||
@@ -81,11 +88,6 @@ const gridOptions: VxeGridProps<any> = {
|
||||
minWidth: 200,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
minWidth: 100,
|
||||
slots: { default: 'logo' },
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
minWidth: 100,
|
||||
@@ -341,20 +343,10 @@ gridReloadRef.value = () => gridApi.reload();
|
||||
</template>
|
||||
|
||||
<!-- Logo列 -->
|
||||
<template #logo="{ row }: { row: any }">
|
||||
<div v-if="row.logo">
|
||||
<img
|
||||
:src="row.logo"
|
||||
:alt="row.name"
|
||||
style="
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
"
|
||||
/>
|
||||
<template #logo="{ row }: { row: CompanyVO.CompanyInfoVO }">
|
||||
<div class="flex items-center justify-center">
|
||||
<CompanyLogoAvatar :logo="row.logo" :name="row.name" :size="40" />
|
||||
</div>
|
||||
<span v-else style="color: #999">暂无Logo</span>
|
||||
</template>
|
||||
|
||||
<!-- 状态列 -->
|
||||
|
||||
Reference in New Issue
Block a user