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:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { MenuVO } from '#/api/sys/menu/types';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
getCompanyMenuIdsApi,
|
||||
} from '#/api/company/menu';
|
||||
import { getAllMenusApi } from '#/api/sys/menu';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
|
||||
interface Props {
|
||||
company?: any;
|
||||
@@ -29,6 +31,9 @@ defineOptions({
|
||||
defineProps<Props>();
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignMenu = computed(() => hasPermission('org:company:menu:assign'));
|
||||
|
||||
// 系统菜单列表数据
|
||||
const systemMenuList = ref<MenuVO.MenuInfo[]>([]);
|
||||
|
||||
@@ -78,6 +83,14 @@ const [MainDrawer, mainDrawerApi] = useVbenDrawer({
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
canAssignMenu,
|
||||
(allowed: boolean) => {
|
||||
mainDrawerApi.setState({ showConfirmButton: allowed });
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 将菜单列表转换为树形结构
|
||||
const menuTreeData = computed(() => {
|
||||
const menuMap = new Map<number, any>();
|
||||
@@ -408,8 +421,10 @@ defineExpose({
|
||||
{{ option.label }}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
<Button type="primary" @click="handleSelectAll"> 一键全选 </Button>
|
||||
<Button @click="handleSelectNone"> 取消全选 </Button>
|
||||
<PermissionGate code="org:company:menu:assign">
|
||||
<Button type="primary" @click="handleSelectAll"> 一键全选 </Button>
|
||||
<Button @click="handleSelectNone"> 取消全选 </Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -421,7 +436,7 @@ defineExpose({
|
||||
v-model:checked-keys="checkedKeys"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="menuTreeData"
|
||||
checkable
|
||||
:checkable="canAssignMenu"
|
||||
class="menu-tree"
|
||||
@check="handleTreeCheckChange"
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
|
||||
@@ -16,6 +16,8 @@ import {
|
||||
getCompanyPermissionIdsApi,
|
||||
} from '#/api/company/permission/apis';
|
||||
import { getAllPermissionsApi } from '#/api/sys/permission';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
|
||||
interface Props {
|
||||
company?: any;
|
||||
@@ -33,6 +35,11 @@ defineOptions({
|
||||
defineProps<Props>();
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignPermission = computed(() =>
|
||||
hasPermission('org:company:permission:assign'),
|
||||
);
|
||||
|
||||
// 所有权限列表
|
||||
const allPermissions = ref<any[]>([]);
|
||||
|
||||
@@ -70,6 +77,14 @@ const [MainDrawer, mainDrawerApi] = useVbenDrawer({
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
canAssignPermission,
|
||||
(allowed) => {
|
||||
mainDrawerApi.setState({ showConfirmButton: allowed });
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 按类型分组权限
|
||||
const groupedPermissions = computed(() => {
|
||||
const groups: Record<string, any[]> = {};
|
||||
@@ -210,8 +225,10 @@ defineExpose({
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats-right">
|
||||
<Button @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" @click="selectAll">一键全选</Button>
|
||||
<PermissionGate code="org:company:permission:assign">
|
||||
<Button @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" @click="selectAll">一键全选</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -237,6 +254,7 @@ defineExpose({
|
||||
>
|
||||
<Checkbox
|
||||
:checked="selectedPermissionIds.includes(perm.id)"
|
||||
:disabled="!canAssignPermission"
|
||||
@change="
|
||||
(e: any) => togglePermission(perm.id, e.target.checked)
|
||||
"
|
||||
|
||||
+34
-31
@@ -8,6 +8,7 @@ import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
|
||||
import { formatIntCell, formatNumberCell } from '#/utils/overview-table-cells';
|
||||
|
||||
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
|
||||
import AnimatedMoneyCell from '../../../components/AnimatedMoneyCell.vue';
|
||||
import {
|
||||
@@ -79,37 +80,39 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="categoryExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleCategoryExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportCategoryIds.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选品类 ({{ selectedExportCategoryIds.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleCategoryExportMode', true)"
|
||||
>
|
||||
指定品类导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="categoryExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleCategoryExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportCategoryIds.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选品类 ({{ selectedExportCategoryIds.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleCategoryExportMode', true)"
|
||||
>
|
||||
指定品类导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
|
||||
+34
-31
@@ -6,6 +6,7 @@ import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
|
||||
import { formatIntCell, formatNumberCell } from '#/utils/overview-table-cells';
|
||||
|
||||
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
|
||||
import AnimatedMoneyCell from '../../../components/AnimatedMoneyCell.vue';
|
||||
import {
|
||||
@@ -123,37 +124,39 @@ const sortedData = computed(() => {
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="platformExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('togglePlatformExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportPlatformCodes.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选平台 ({{ selectedExportPlatformCodes.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('togglePlatformExportMode', true)"
|
||||
>
|
||||
指定平台导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="platformExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('togglePlatformExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportPlatformCodes.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选平台 ({{ selectedExportPlatformCodes.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('togglePlatformExportMode', true)"
|
||||
>
|
||||
指定平台导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
|
||||
+34
-31
@@ -7,6 +7,7 @@ import { formatFeeRatioPercent } from '#/utils/overview-fee-ratio';
|
||||
import { formatIntCell, formatNumberCell } from '#/utils/overview-table-cells';
|
||||
|
||||
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
|
||||
import AnimatedMoneyCell from '../../../components/AnimatedMoneyCell.vue';
|
||||
import {
|
||||
@@ -71,37 +72,39 @@ const cellRoi = (v: number | null | undefined) =>
|
||||
{{ props.headingSubtitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="shopExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleShopExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportShopIds.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选店铺 ({{ selectedExportShopIds.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleShopExportMode', true)"
|
||||
>
|
||||
指定店铺导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<PermissionGate code="data:export">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="shopExportMode">
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleShopExportMode', false)"
|
||||
>
|
||||
取消选择
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-blue-500 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(59,130,246,0.28)] transition-colors hover:bg-blue-600 disabled:opacity-50 dark:shadow-none"
|
||||
:disabled="selectedExportShopIds.length === 0"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出已选店铺 ({{ selectedExportShopIds.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
class="rounded-[10px] border border-slate-200 bg-white px-3.5 py-2 text-sm font-medium text-slate-600 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
@click="emit('toggleShopExportMode', true)"
|
||||
>
|
||||
指定店铺导出
|
||||
</button>
|
||||
<button
|
||||
class="rounded-[10px] bg-slate-800 px-5 py-2 text-sm font-semibold text-white shadow-[0_8px_18px_rgba(15,23,42,0.18)] transition-colors hover:bg-slate-900 dark:shadow-none"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出全部
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
getPddGoodsPageApi,
|
||||
} from '#/api/channel/pdd/goods';
|
||||
import { getPddShopPageApi } from '#/api/channel/pdd/shop';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
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';
|
||||
@@ -395,12 +396,14 @@ onMounted(async () => {
|
||||
<Button type="link" size="small" @click="openDetail(row)">
|
||||
详情
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定删除该商品及全部 SKU 吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="channel:pdd:goods:delete">
|
||||
<Popconfirm
|
||||
title="确定删除该商品及全部 SKU 吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
getPddShopPageApi,
|
||||
} from '#/api/channel/pdd/shop';
|
||||
import { syncPddGoodsByShopApi } from '#/api/channel/pdd/goods';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
|
||||
import PddShopDetailModal from './components/PddShopDetailModal.vue';
|
||||
|
||||
@@ -308,15 +309,17 @@ async function handleSyncGoods(row: PddShopVO.Info) {
|
||||
<Button type="link" size="small" @click="openShopDetail(row)">
|
||||
详情
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
:loading="syncingShopId === row.id"
|
||||
:disabled="syncingShopId != null && syncingShopId !== row.id"
|
||||
@click="handleSyncGoods(row)"
|
||||
>
|
||||
同步商品
|
||||
</Button>
|
||||
<PermissionGate code="channel:pdd:goods:sync">
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
:loading="syncingShopId === row.id"
|
||||
:disabled="syncingShopId != null && syncingShopId !== row.id"
|
||||
@click="handleSyncGoods(row)"
|
||||
>
|
||||
同步商品
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -19,12 +19,17 @@ import {
|
||||
getCompanyMenusApi,
|
||||
getCompanyMenuIdsApi,
|
||||
} from '#/api/company/menu/apis';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
import CompanyColPage from '#/views/company/components/CompanyColPage.vue';
|
||||
|
||||
defineOptions({
|
||||
name: 'CompanyMenuManagePage',
|
||||
});
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignMenu = computed(() => hasPermission('org:company:menu:assign'));
|
||||
|
||||
const selectedCompanyId = ref<number | undefined>(undefined);
|
||||
const currentCompany = ref<CompanyVO.CompanyInfoVO | null>(null);
|
||||
|
||||
@@ -196,17 +201,19 @@ async function handleSave() {
|
||||
<span v-if="stats.changed" class="text-orange-500">(未保存)</span>
|
||||
</span>
|
||||
</template>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
<PermissionGate code="org:company:menu:assign">
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -223,7 +230,7 @@ async function handleSave() {
|
||||
v-model:checked-keys="selectedMenuIds"
|
||||
v-model:expanded-keys="menuExpandedKeys"
|
||||
:tree-data="menuTreeData"
|
||||
checkable
|
||||
:checkable="canAssignMenu"
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
|
||||
@@ -20,10 +20,17 @@ import {
|
||||
getCompanyPermissionIdsApi,
|
||||
} from '#/api/company/permission/apis';
|
||||
import { getPermissionTreeApi } from '#/api/sys/permission';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
import CompanyColPage from '#/views/company/components/CompanyColPage.vue';
|
||||
|
||||
defineOptions({ name: 'CompanyPermissionManagePage' });
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignPermission = computed(() =>
|
||||
hasPermission('org:company:permission:assign'),
|
||||
);
|
||||
|
||||
type PermissionTreeNode = {
|
||||
key: number;
|
||||
title: string;
|
||||
@@ -215,17 +222,19 @@ onMounted(() => {
|
||||
<span v-if="stats.changed" class="text-orange-500">(未保存)</span>
|
||||
</span>
|
||||
</template>
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
<PermissionGate code="org:company:permission:assign">
|
||||
<Button :disabled="!currentCompany" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentCompany" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentCompany || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -243,7 +252,7 @@ onMounted(() => {
|
||||
v-model:checked-keys="selectedPermissionIds"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="permissionTreeData"
|
||||
checkable
|
||||
:checkable="canAssignPermission"
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { ImportMappingVO } from '#/api/ec/import/mapping';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
@@ -14,6 +14,11 @@ import {
|
||||
deleteImportMappingApi,
|
||||
getImportMappingPageApi,
|
||||
} from '#/api/ec/import/mapping';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import { ImportMappingType } from '#/api/ec/import/mapping/types/types.enum';
|
||||
|
||||
import ImportMappingFormModal from '../import-mapping/components/ImportMappingFormModal.vue';
|
||||
@@ -25,8 +30,14 @@ const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const loading = ref(false);
|
||||
const formModalRef = ref();
|
||||
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const mappingActionCodes = [
|
||||
'data:import-mapping:create',
|
||||
'data:import-mapping:update',
|
||||
'data:import-mapping:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(mappingActionCodes);
|
||||
|
||||
const mappingTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{ type: 'seq', width: 80, title: '序号' },
|
||||
{
|
||||
field: 'name',
|
||||
@@ -42,8 +53,23 @@ const gridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
{ field: 'createTime', title: '创建时间', width: 180 },
|
||||
{ field: 'updateTime', title: '更新时间', width: 180 },
|
||||
{ title: '操作', width: 160, fixed: 'right', slots: { default: 'action' } },
|
||||
],
|
||||
];
|
||||
|
||||
const mappingActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] = {
|
||||
title: '操作',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const mappingTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(mappingTableBaseColumns ?? []), mappingActionColumn]
|
||||
: (mappingTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: mappingTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -84,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '字段映射模板',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, mappingTableColumns);
|
||||
|
||||
function refresh() {
|
||||
gridApi?.reload();
|
||||
@@ -137,10 +164,12 @@ function getTypeName(type: ImportMappingType): string {
|
||||
<Grid :loading="loading">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
新建模板
|
||||
</Button>
|
||||
<PermissionGate code="data:import-mapping:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
新建模板
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -154,12 +183,16 @@ function getTypeName(type: ImportMappingType): string {
|
||||
<Tag color="green">{{ getMappingCount(row.mapping) }} 个字段</Tag>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }: { row: ImportMappingVO.ImportMappingInfoVO }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: ImportMappingVO.ImportMappingInfoVO }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm title="确定删除该模板?" @confirm="handleDelete(row)">
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="data:import-mapping:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="data:import-mapping:delete">
|
||||
<Popconfirm title="确定删除该模板?" @confirm="handleDelete(row)">
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { ImportMappingVO } from '#/api/ec/import/mapping';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
@@ -14,6 +14,11 @@ import {
|
||||
deleteImportMappingApi,
|
||||
getImportMappingPageApi,
|
||||
} from '#/api/ec/import/mapping';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import { ImportMappingType } from '#/api/ec/import/mapping/types/types.enum';
|
||||
|
||||
import ImportMappingFormModal from '../import-mapping/components/ImportMappingFormModal.vue';
|
||||
@@ -25,8 +30,14 @@ const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const loading = ref(false);
|
||||
const formModalRef = ref();
|
||||
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const mappingActionCodes = [
|
||||
'data:import-mapping:create',
|
||||
'data:import-mapping:update',
|
||||
'data:import-mapping:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(mappingActionCodes);
|
||||
|
||||
const mappingTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{ type: 'seq', width: 80, title: '序号' },
|
||||
{
|
||||
field: 'name',
|
||||
@@ -42,8 +53,23 @@ const gridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
{ field: 'createTime', title: '创建时间', width: 180 },
|
||||
{ field: 'updateTime', title: '更新时间', width: 180 },
|
||||
{ title: '操作', width: 160, fixed: 'right', slots: { default: 'action' } },
|
||||
],
|
||||
];
|
||||
|
||||
const mappingActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] = {
|
||||
title: '操作',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const mappingTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(mappingTableBaseColumns ?? []), mappingActionColumn]
|
||||
: (mappingTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: mappingTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -84,6 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '订单状态映射模板',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, mappingTableColumns);
|
||||
|
||||
function refresh() {
|
||||
gridApi?.reload();
|
||||
@@ -137,10 +164,12 @@ function getTypeName(type: ImportMappingType): string {
|
||||
<Grid :loading="loading">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
新建模板
|
||||
</Button>
|
||||
<PermissionGate code="data:import-mapping:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
新建模板
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -154,12 +183,16 @@ function getTypeName(type: ImportMappingType): string {
|
||||
<Tag color="green">{{ getMappingCount(row.mapping) }} 个状态</Tag>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }: { row: ImportMappingVO.ImportMappingInfoVO }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: ImportMappingVO.ImportMappingInfoVO }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm title="确定删除该模板?" @confirm="handleDelete(row)">
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="data:import-mapping:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="data:import-mapping:delete">
|
||||
<Popconfirm title="确定删除该模板?" @confirm="handleDelete(row)">
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
+19
-11
@@ -20,6 +20,7 @@ import { getAdFeeFieldsApi } from '#/api/ec/shop/ad-fee/apis';
|
||||
import { getShopPageApi } from '#/api/ec/shop';
|
||||
import { createImportTaskApi } from '#/api/ec/import/task';
|
||||
import { useImportTaskStore } from '#/store';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { uploadFile } from '#/utils/upload-file';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
@@ -601,9 +602,14 @@ const shopOptions = computed(() => {
|
||||
</span>
|
||||
</Select.Option>
|
||||
</Select>
|
||||
<Button :disabled="selectedTemplateId !== undefined" @click="handleSaveTemplate">
|
||||
保存为模板
|
||||
</Button>
|
||||
<PermissionGate code="data:import-mapping:create">
|
||||
<Button
|
||||
:disabled="selectedTemplateId !== undefined"
|
||||
@click="handleSaveTemplate"
|
||||
>
|
||||
保存为模板
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="fieldDefsLoading">
|
||||
@@ -803,14 +809,16 @@ const shopOptions = computed(() => {
|
||||
>
|
||||
下一步
|
||||
</Button>
|
||||
<Button
|
||||
v-if="currentStep === 1"
|
||||
type="primary"
|
||||
:loading="createTaskSubmitting"
|
||||
@click="handleCreateTask"
|
||||
>
|
||||
创建导入任务
|
||||
</Button>
|
||||
<PermissionGate code="data:import:create">
|
||||
<Button
|
||||
v-if="currentStep === 1"
|
||||
type="primary"
|
||||
:loading="createTaskSubmitting"
|
||||
@click="handleCreateTask"
|
||||
>
|
||||
创建导入任务
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+27
-20
@@ -34,6 +34,7 @@ import { createImportTaskApi } from '#/api/ec/import/task';
|
||||
import { getAllOrderStatusListApi } from '#/api/ec/order/status';
|
||||
import { getShopPageApi } from '#/api/ec/shop';
|
||||
import { useImportTaskStore } from '#/store';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { uploadFile } from '#/utils/upload-file';
|
||||
import { createPatchedFile } from '../utils/skuCodePatch';
|
||||
|
||||
@@ -1426,12 +1427,14 @@ const shopOptions = computed(() => {
|
||||
</span>
|
||||
</Select.Option>
|
||||
</Select>
|
||||
<Button
|
||||
:disabled="selectedTemplateId !== undefined"
|
||||
@click="handleSaveTemplate"
|
||||
>
|
||||
保存为模板
|
||||
</Button>
|
||||
<PermissionGate code="data:import-mapping:create">
|
||||
<Button
|
||||
:disabled="selectedTemplateId !== undefined"
|
||||
@click="handleSaveTemplate"
|
||||
>
|
||||
保存为模板
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="fieldDefsLoading">
|
||||
@@ -1599,12 +1602,14 @@ const shopOptions = computed(() => {
|
||||
</span>
|
||||
</Select.Option>
|
||||
</Select>
|
||||
<Button
|
||||
:disabled="selectedStatusTemplateId !== undefined"
|
||||
@click="handleSaveStatusTemplate"
|
||||
>
|
||||
保存为模板
|
||||
</Button>
|
||||
<PermissionGate code="data:import-mapping:create">
|
||||
<Button
|
||||
:disabled="selectedStatusTemplateId !== undefined"
|
||||
@click="handleSaveStatusTemplate"
|
||||
>
|
||||
保存为模板
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -1862,14 +1867,16 @@ const shopOptions = computed(() => {
|
||||
>
|
||||
下一步
|
||||
</Button>
|
||||
<Button
|
||||
v-if="currentStep === 2"
|
||||
type="primary"
|
||||
:loading="createTaskSubmitting"
|
||||
@click="handleCreateTask"
|
||||
>
|
||||
创建导入任务
|
||||
</Button>
|
||||
<PermissionGate code="data:import:create">
|
||||
<Button
|
||||
v-if="currentStep === 2"
|
||||
type="primary"
|
||||
:loading="createTaskSubmitting"
|
||||
@click="handleCreateTask"
|
||||
>
|
||||
创建导入任务
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ import {
|
||||
} from '#/api/ec/order';
|
||||
import { getProductPageApi } from '#/api/ec/product';
|
||||
import { getPlatformListApi } from '#/api/ec/platform';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import PlatformTag from '#/components/platform/PlatformTag.vue';
|
||||
import {
|
||||
getFirstOrderItem,
|
||||
@@ -109,6 +114,8 @@ const platformLoaded = ref(false);
|
||||
|
||||
const currentSort = ref<null | { field: string; order: 'asc' | 'desc' }>(null);
|
||||
|
||||
const showCheckboxColumn = useActionColumnVisible(['ec:order:delete']);
|
||||
|
||||
function money(v?: null | number) {
|
||||
if (v == null || Number.isNaN(Number(v))) return '-';
|
||||
return `¥${Number(v).toFixed(2)}`;
|
||||
@@ -236,87 +243,100 @@ async function fetchPlatformOptions() {
|
||||
}
|
||||
}
|
||||
|
||||
const orderTableBaseColumns: VxeGridProps<OrderVO.Info>['columns'] = [
|
||||
{ type: 'seq' as const, width: 56, title: '序号' },
|
||||
{
|
||||
field: 'platformOrderNo',
|
||||
title: '平台订单号',
|
||||
minWidth: 180,
|
||||
showOverflow: 'tooltip' as const,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: '平台',
|
||||
width: 100,
|
||||
slots: { default: 'platform' },
|
||||
},
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺',
|
||||
minWidth: 120,
|
||||
showOverflow: 'tooltip' as const,
|
||||
sortable: true,
|
||||
slots: { default: 'shopName' },
|
||||
},
|
||||
{
|
||||
title: '商品',
|
||||
minWidth: 240,
|
||||
showOverflow: false,
|
||||
slots: { default: 'goods' },
|
||||
},
|
||||
{
|
||||
field: 'payAmount',
|
||||
title: '实付',
|
||||
width: 100,
|
||||
sortable: true,
|
||||
slots: { default: 'payAmount' },
|
||||
},
|
||||
{
|
||||
field: 'receivedAmount',
|
||||
title: '商家实收',
|
||||
width: 110,
|
||||
sortable: true,
|
||||
slots: { default: 'receivedAmount' },
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
width: 110,
|
||||
slots: { default: 'orderStatus' },
|
||||
},
|
||||
{
|
||||
title: '来源',
|
||||
width: 80,
|
||||
slots: { default: 'source' },
|
||||
},
|
||||
{
|
||||
field: 'orderTime',
|
||||
title: '下单时间',
|
||||
minWidth: 160,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: '收件地区',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'region' },
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 180,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
];
|
||||
|
||||
const orderCheckboxColumn: NonNullable<
|
||||
VxeGridProps<OrderVO.Info>['columns']
|
||||
>[number] = {
|
||||
type: 'checkbox' as const,
|
||||
width: 48,
|
||||
fixed: 'left' as const,
|
||||
};
|
||||
|
||||
const orderTableColumns = computed(() => {
|
||||
const cols = [...(orderTableBaseColumns ?? [])];
|
||||
if (showCheckboxColumn.value) {
|
||||
cols.splice(1, 0, orderCheckboxColumn);
|
||||
}
|
||||
return cols;
|
||||
});
|
||||
|
||||
const gridOptions: VxeGridProps<OrderVO.Info> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
reserve: false,
|
||||
},
|
||||
columns: [
|
||||
{ type: 'seq' as const, width: 56, title: '序号' },
|
||||
{
|
||||
type: 'checkbox' as const,
|
||||
width: 48,
|
||||
fixed: 'left' as const,
|
||||
},
|
||||
{
|
||||
field: 'platformOrderNo',
|
||||
title: '平台订单号',
|
||||
minWidth: 180,
|
||||
showOverflow: 'tooltip' as const,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: '平台',
|
||||
width: 100,
|
||||
slots: { default: 'platform' },
|
||||
},
|
||||
{
|
||||
field: 'shopName',
|
||||
title: '店铺',
|
||||
minWidth: 120,
|
||||
showOverflow: 'tooltip' as const,
|
||||
sortable: true,
|
||||
slots: { default: 'shopName' },
|
||||
},
|
||||
{
|
||||
title: '商品',
|
||||
minWidth: 240,
|
||||
showOverflow: false,
|
||||
slots: { default: 'goods' },
|
||||
},
|
||||
{
|
||||
field: 'payAmount',
|
||||
title: '实付',
|
||||
width: 100,
|
||||
sortable: true,
|
||||
slots: { default: 'payAmount' },
|
||||
},
|
||||
{
|
||||
field: 'receivedAmount',
|
||||
title: '商家实收',
|
||||
width: 110,
|
||||
sortable: true,
|
||||
slots: { default: 'receivedAmount' },
|
||||
},
|
||||
{
|
||||
title: '订单状态',
|
||||
width: 110,
|
||||
slots: { default: 'orderStatus' },
|
||||
},
|
||||
{
|
||||
title: '来源',
|
||||
width: 80,
|
||||
slots: { default: 'source' },
|
||||
},
|
||||
{
|
||||
field: 'orderTime',
|
||||
title: '下单时间',
|
||||
minWidth: 160,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
title: '收件地区',
|
||||
minWidth: 140,
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'region' },
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 180,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
columns: orderTableColumns.value,
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -559,6 +579,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, orderTableColumns);
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
@@ -664,26 +685,30 @@ onMounted(async () => {
|
||||
|
||||
<template #extra>
|
||||
<Space wrap size="small">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
添加订单
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定删除选中的订单吗?删除后不可恢复。"
|
||||
ok-text="确定删除"
|
||||
cancel-text="取消"
|
||||
:ok-button-props="{ danger: true, loading: batchDeleteLoading }"
|
||||
:disabled="!hasSelected"
|
||||
@confirm="handleBatchDelete"
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
:disabled="!hasSelected"
|
||||
:loading="batchDeleteLoading"
|
||||
>
|
||||
批量删除
|
||||
<PermissionGate code="ec:order:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
添加订单
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:order:delete">
|
||||
<Popconfirm
|
||||
title="确定删除选中的订单吗?删除后不可恢复。"
|
||||
ok-text="确定删除"
|
||||
cancel-text="取消"
|
||||
:ok-button-props="{ danger: true, loading: batchDeleteLoading }"
|
||||
:disabled="!hasSelected"
|
||||
@confirm="handleBatchDelete"
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
:disabled="!hasSelected"
|
||||
:loading="batchDeleteLoading"
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -761,15 +786,19 @@ onMounted(async () => {
|
||||
<Button type="link" size="small" @click="openDetail(row)">
|
||||
详情
|
||||
</Button>
|
||||
<Button type="link" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个订单吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:order:update">
|
||||
<Button type="link" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:order:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个订单吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -14,6 +14,11 @@ import {
|
||||
deleteCategoryApi,
|
||||
getCategoryTreeApi,
|
||||
} from '#/api/ec/product/category';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
|
||||
import CategoryFormModal from './components/CategoryFormModal.vue';
|
||||
|
||||
@@ -25,9 +30,14 @@ const PlusIcon = createIconifyIcon('lucide:plus');
|
||||
const loading = ref(false);
|
||||
const categoryFormModalRef = ref();
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const categoryActionCodes = [
|
||||
'ec:product:category:create',
|
||||
'ec:product:category:update',
|
||||
'ec:product:category:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(categoryActionCodes);
|
||||
|
||||
const categoryTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
width: 80,
|
||||
@@ -60,13 +70,25 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '更新时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 160,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const categoryActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] =
|
||||
{
|
||||
title: '操作',
|
||||
width: 160,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const categoryTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(categoryTableBaseColumns ?? []), categoryActionColumn]
|
||||
: (categoryTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: categoryTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -144,6 +166,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
tableTitle: '商品类目配置',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, categoryTableColumns);
|
||||
|
||||
function refreshTable() {
|
||||
gridApi?.reload();
|
||||
@@ -184,10 +207,12 @@ function handleModalSuccess() {
|
||||
<Grid :loading="loading">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加类目
|
||||
</Button>
|
||||
<PermissionGate code="ec:product:category:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加类目
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -200,15 +225,19 @@ function handleModalSuccess() {
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个类目吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:product:category:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:product:category:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个类目吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { Button, Image, message, Popconfirm, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteProductApi, getProductPageApi } from '#/api/ec/product';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
|
||||
import ProductDetailModal from './components/ProductDetailModal.vue';
|
||||
import ProductFormModal from './components/ProductFormModal.vue';
|
||||
@@ -324,10 +325,12 @@ function handleDetailEdit(record: ProductVO.Info) {
|
||||
<Page auto-content-height>
|
||||
<Grid :loading="loading" class="product-grid">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
添加商品
|
||||
</Button>
|
||||
<PermissionGate code="ec:product:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
添加商品
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</template>
|
||||
|
||||
<!-- 商品信息:主图 + 名称,点击打开详情 -->
|
||||
@@ -398,26 +401,30 @@ function handleDetailEdit(record: ProductVO.Info) {
|
||||
<Button type="link" size="small" @click="openProductDetail(row)">
|
||||
详情
|
||||
</Button>
|
||||
<Button type="link" size="small" @click="handleEdit(row)">
|
||||
<EditIcon class="mr-0.5 h-3.5 w-3.5" />
|
||||
编辑
|
||||
</Button>
|
||||
<Button type="link" size="small" @click="handleCost(row)">
|
||||
<CoinsIcon class="mr-0.5 h-3.5 w-3.5" />
|
||||
成本
|
||||
</Button>
|
||||
<PermissionGate code="ec:product:update">
|
||||
<Button type="link" size="small" @click="handleEdit(row)">
|
||||
<EditIcon class="mr-0.5 h-3.5 w-3.5" />
|
||||
编辑
|
||||
</Button>
|
||||
<Button type="link" size="small" @click="handleCost(row)">
|
||||
<CoinsIcon class="mr-0.5 h-3.5 w-3.5" />
|
||||
成本
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<Button type="link" size="small" @click="goToOverview(row)">
|
||||
<ChartIcon class="mr-0.5 h-3.5 w-3.5" />
|
||||
统计
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定删除该商品吗?删除后不可恢复。"
|
||||
ok-text="确定删除"
|
||||
cancel-text="取消"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:product:delete">
|
||||
<Popconfirm
|
||||
title="确定删除该商品吗?删除后不可恢复。"
|
||||
ok-text="确定删除"
|
||||
cancel-text="取消"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button type="link" size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { AdFeeDTO, AdFeeVO } from '#/api/ec/shop/ad-fee/types';
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
@@ -19,6 +19,11 @@ import {
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteAdFeeApi, getAdFeePageApi } from '#/api/ec/shop/ad-fee';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import AdFeeFormModal from './components/AdFeeFormModal.vue';
|
||||
@@ -49,8 +54,14 @@ function handleAddForShop(shopId: number) {
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
columns: [
|
||||
const adFeeActionCodes = [
|
||||
'ec:order:create',
|
||||
'ec:order:update',
|
||||
'ec:order:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(adFeeActionCodes);
|
||||
|
||||
const adFeeTableBaseColumns: VxeGridProps<AdFeeVO.Info>['columns'] = [
|
||||
{ type: 'seq' as const, minWidth: 56, title: '序号' },
|
||||
{
|
||||
field: 'shopName',
|
||||
@@ -77,13 +88,25 @@ const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
slots: { default: 'feeAmount' },
|
||||
},
|
||||
{ field: 'feeDate', title: '发生日期', minWidth: 110 },
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const adFeeActionColumn: NonNullable<
|
||||
VxeGridProps<AdFeeVO.Info>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const adFeeTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(adFeeTableBaseColumns ?? []), adFeeActionColumn]
|
||||
: (adFeeTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<AdFeeVO.Info> = {
|
||||
columns: adFeeTableColumns.value,
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -151,6 +174,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, adFeeTableColumns);
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
@@ -235,10 +259,12 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
<PermissionGate code="ec:order:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增广告费
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -264,15 +290,19 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:order:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:order:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这条广告费记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { ProductDTO, ProductVO } from '#/api/ec/product/types';
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
@@ -26,6 +26,11 @@ import {
|
||||
getBrushOrderPageApi,
|
||||
} from '#/api/ec/shop/fake-orders-fee';
|
||||
import { getProductPageApi } from '#/api/ec/product';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import BrushOrderFormModal from './components/BrushOrderFormModal.vue';
|
||||
@@ -122,8 +127,14 @@ function handleAddForShop(shopId: number) {
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
||||
columns: [
|
||||
const brushOrderActionCodes = [
|
||||
'ec:order:create',
|
||||
'ec:order:update',
|
||||
'ec:order:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(brushOrderActionCodes);
|
||||
|
||||
const brushOrderTableBaseColumns: VxeGridProps<BrushOrderVO.Info>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
width: 56,
|
||||
@@ -160,13 +171,25 @@ const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const brushOrderActionColumn: NonNullable<
|
||||
VxeGridProps<BrushOrderVO.Info>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
width: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const brushOrderTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(brushOrderTableBaseColumns ?? []), brushOrderActionColumn]
|
||||
: (brushOrderTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<BrushOrderVO.Info> = {
|
||||
columns: brushOrderTableColumns.value,
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -241,6 +264,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, brushOrderTableColumns);
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
@@ -307,10 +331,12 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增刷单记录
|
||||
</Button>
|
||||
<PermissionGate code="ec:order:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增刷单记录
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</template>
|
||||
|
||||
<div class="shrink-0 space-y-2 border-t border-border px-4 py-3">
|
||||
@@ -418,15 +444,19 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条刷单记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:order:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:order:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这条刷单记录吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -20,6 +20,11 @@ import { batchPddAdFeePipelineStatusApi } from '#/api/channel/pdd/goods-ad-fee-i
|
||||
import type { PddGoodsAdFeeImportVO } from '#/api/channel/pdd/goods-ad-fee-import';
|
||||
import { getPlatformListApi } from '#/api/ec/platform';
|
||||
import { deleteShopApi, getShopPageApi } from '#/api/ec/shop';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import {
|
||||
getPlatformLabel,
|
||||
getPlatformTagColor,
|
||||
@@ -60,7 +65,15 @@ type ShopListRow = Partial<ShopVO.Info> & {
|
||||
shop?: ShopVO.Info;
|
||||
};
|
||||
|
||||
const COLUMN_COUNT = 8;
|
||||
const shopActionCodes = [
|
||||
'ec:shop:create',
|
||||
'ec:shop:update',
|
||||
'ec:shop:delete',
|
||||
'channel:pdd:shop:update',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(shopActionCodes);
|
||||
|
||||
const columnCount = computed(() => (showActionColumn.value ? 8 : 7));
|
||||
|
||||
const searchForm = ref({
|
||||
name: '',
|
||||
@@ -103,62 +116,73 @@ function toShopListRows(records: ShopVO.Info[]): ShopListRow[] {
|
||||
return rows;
|
||||
}
|
||||
|
||||
const shopTableBaseColumns: VxeGridProps<ShopListRow>['columns'] = [
|
||||
{
|
||||
width: 64,
|
||||
title: '序号',
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'seq' },
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
width: 120,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'logoOrPipeline' },
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '店铺名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'name' },
|
||||
},
|
||||
{
|
||||
field: 'platformName',
|
||||
title: '平台',
|
||||
minWidth: 120,
|
||||
showOverflow: true,
|
||||
slots: { default: 'platformName' },
|
||||
},
|
||||
{
|
||||
title: '外部店铺',
|
||||
minWidth: 180,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'externalShop' },
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'createTime' },
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'updateTime' },
|
||||
},
|
||||
];
|
||||
|
||||
const shopActionColumn: NonNullable<
|
||||
VxeGridProps<ShopListRow>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 320,
|
||||
showOverflow: false,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const shopTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(shopTableBaseColumns ?? []), shopActionColumn]
|
||||
: (shopTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<ShopListRow> = {
|
||||
columns: [
|
||||
{
|
||||
width: 64,
|
||||
title: '序号',
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'seq' },
|
||||
},
|
||||
{
|
||||
title: 'Logo',
|
||||
width: 120,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'logoOrPipeline' },
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '店铺名称',
|
||||
minWidth: 'auto',
|
||||
showOverflow: 'tooltip' as const,
|
||||
slots: { default: 'name' },
|
||||
},
|
||||
{
|
||||
field: 'platformName',
|
||||
title: '平台',
|
||||
minWidth: 120,
|
||||
showOverflow: true,
|
||||
slots: { default: 'platformName' },
|
||||
},
|
||||
{
|
||||
title: '外部店铺',
|
||||
minWidth: 180,
|
||||
align: 'center' as const,
|
||||
showOverflow: false,
|
||||
slots: { default: 'externalShop' },
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'createTime' },
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
minWidth: 'auto',
|
||||
slots: { default: 'updateTime' },
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 320,
|
||||
showOverflow: false,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
columns: shopTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: false,
|
||||
@@ -185,7 +209,7 @@ const gridOptions: VxeGridProps<ShopListRow> = {
|
||||
// 管线次行:从 Logo 起横向合并剩余列
|
||||
if (row._rowType === 'pipeline' || row._rowType === 'adfee-pipeline') {
|
||||
if (columnIndex === 1) {
|
||||
return { rowspan: 1, colspan: COLUMN_COUNT - 1 };
|
||||
return { rowspan: 1, colspan: columnCount.value - 1 };
|
||||
}
|
||||
return { rowspan: 0, colspan: 0 };
|
||||
}
|
||||
@@ -297,6 +321,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
tableTitle: '店铺管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, shopTableColumns);
|
||||
|
||||
async function fetchPlatformOptions() {
|
||||
try {
|
||||
@@ -662,10 +687,12 @@ onUnmounted(() => {
|
||||
<Grid :loading="loading" class="shop-grid">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加店铺
|
||||
</Button>
|
||||
<PermissionGate code="ec:shop:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加店铺
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -820,25 +847,31 @@ onUnmounted(() => {
|
||||
<span v-if="!isSubPipelineRow(row)">{{ row.updateTime }}</span>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }: { row: ShopListRow }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: ShopListRow }">
|
||||
<Space v-if="!isSubPipelineRow(row)">
|
||||
<Button
|
||||
v-if="isPddShop(row)"
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
:loading="authorizing"
|
||||
@click="handleAuthorizePdd(row)"
|
||||
>
|
||||
{{ hasExternalShop(row) ? '重新授权' : '授权拼多多' }}
|
||||
</Button>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个店铺吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="channel:pdd:shop:update">
|
||||
<Button
|
||||
v-if="isPddShop(row)"
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
:loading="authorizing"
|
||||
@click="handleAuthorizePdd(row)"
|
||||
>
|
||||
{{ hasExternalShop(row) ? '重新授权' : '授权拼多多' }}
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:shop:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:shop:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个店铺吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
import type { ShopVO } from '#/api/ec/shop/types';
|
||||
import type { PageQueryDTO } from '#/types/common';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
@@ -25,6 +25,11 @@ import {
|
||||
deleteShopMonthlyTargetApi,
|
||||
getShopMonthlyTargetPageApi,
|
||||
} from '#/api/ec/shop/monthly-target';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import EcShopColPage from '#/views/ec/components/EcShopColPage.vue';
|
||||
|
||||
import ShopMonthlyTargetFormModal from './components/ShopMonthlyTargetFormModal.vue';
|
||||
@@ -55,8 +60,15 @@ function handleAddForShop(shopId: number) {
|
||||
formModalVisible.value = true;
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||
columns: [
|
||||
const monthlyTargetActionCodes = [
|
||||
'ec:shop:create',
|
||||
'ec:shop:update',
|
||||
'ec:shop:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(monthlyTargetActionCodes);
|
||||
|
||||
const monthlyTargetTableBaseColumns: VxeGridProps<ShopMonthlyTargetVO.Info>['columns'] =
|
||||
[
|
||||
{ type: 'seq' as const, minWidth: 56, title: '序号' },
|
||||
{
|
||||
field: 'shopName',
|
||||
@@ -78,13 +90,25 @@ const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{ field: 'createTime', title: '创建时间', minWidth: 160 },
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const monthlyTargetActionColumn: NonNullable<
|
||||
VxeGridProps<ShopMonthlyTargetVO.Info>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const monthlyTargetTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(monthlyTargetTableBaseColumns ?? []), monthlyTargetActionColumn]
|
||||
: (monthlyTargetTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<ShopMonthlyTargetVO.Info> = {
|
||||
columns: monthlyTargetTableColumns.value,
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -152,6 +176,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, monthlyTargetTableColumns);
|
||||
|
||||
watch(selectedShopId, () => {
|
||||
gridApi.reload();
|
||||
@@ -238,10 +263,12 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
allow-clear
|
||||
@change="() => refreshTable()"
|
||||
/>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增月销量目标
|
||||
</Button>
|
||||
<PermissionGate code="ec:shop:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-1 h-4 w-4" />
|
||||
新增月销量目标
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -255,15 +282,19 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这条月销量目标吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="ec:shop:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="ec:shop:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这条月销量目标吗?"
|
||||
@confirm="handleDelete(row.id)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { OpenApiKeyVO } from '#/api/open/api-key';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
@@ -16,6 +16,11 @@ import {
|
||||
enableOpenApiKeyApi,
|
||||
getOpenApiKeyListApi,
|
||||
} from '#/api/open/api-key';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
|
||||
import CreateApiKeyModal from './components/CreateApiKeyModal.vue';
|
||||
import OpenApiBaseUrlDisplay from './components/OpenApiBaseUrlDisplay.vue';
|
||||
@@ -30,8 +35,15 @@ function formatExpireAt(cellValue?: null | string) {
|
||||
return cellValue ? String(cellValue) : '永不过期';
|
||||
}
|
||||
|
||||
const gridOptions: VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO> = {
|
||||
columns: [
|
||||
const apiKeyActionCodes = [
|
||||
'open:api-key:create',
|
||||
'open:api-key:update',
|
||||
'open:api-key:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(apiKeyActionCodes);
|
||||
|
||||
const apiKeyTableBaseColumns: VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO>['columns'] =
|
||||
[
|
||||
{ type: 'seq', title: '序号', minWidth: 60 },
|
||||
{ field: 'name', title: '名称', minWidth: 140 },
|
||||
{ field: 'keyPrefix', title: 'Key 前缀', minWidth: 180 },
|
||||
@@ -57,13 +69,25 @@ const gridOptions: VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO> = {
|
||||
formatExpireAt(cellValue),
|
||||
},
|
||||
{ field: 'createTime', title: '创建时间', minWidth: 160 },
|
||||
{
|
||||
title: '操作',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const apiKeyActionColumn: NonNullable<
|
||||
VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const apiKeyTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(apiKeyTableBaseColumns ?? []), apiKeyActionColumn]
|
||||
: (apiKeyTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO> = {
|
||||
columns: apiKeyTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -91,6 +115,7 @@ const gridOptions: VxeGridProps<OpenApiKeyVO.OpenApiKeyInfoVO> = {
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({ gridOptions });
|
||||
syncVxeGridColumns(gridApi, apiKeyTableColumns);
|
||||
|
||||
async function handleDisable(row: OpenApiKeyVO.OpenApiKeyInfoVO) {
|
||||
await disableOpenApiKeyApi(row.id);
|
||||
@@ -132,10 +157,12 @@ function getPermissionTooltip(row: OpenApiKeyVO.OpenApiKeyInfoVO) {
|
||||
|
||||
<Grid :loading="loading">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="openCreateModal">
|
||||
<PlusIcon class="size-4" />
|
||||
创建 API Key
|
||||
</Button>
|
||||
<PermissionGate code="open:api-key:create">
|
||||
<Button type="primary" @click="openCreateModal">
|
||||
<PlusIcon class="size-4" />
|
||||
创建 API Key
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</template>
|
||||
|
||||
<template #permissions="{ row }">
|
||||
@@ -156,25 +183,29 @@ function getPermissionTooltip(row: OpenApiKeyVO.OpenApiKeyInfoVO) {
|
||||
</Tag>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Popconfirm
|
||||
v-if="row.status === 1"
|
||||
title="确认停用该 API Key?"
|
||||
@confirm="handleDisable(row)"
|
||||
>
|
||||
<Button type="link" size="small">停用</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
v-else
|
||||
title="确认启用该 API Key?"
|
||||
@confirm="handleEnable(row)"
|
||||
>
|
||||
<Button type="link" size="small">启用</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm title="确认删除该 API Key?" @confirm="handleDelete(row)">
|
||||
<Button type="link" danger size="small">删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="open:api-key:update">
|
||||
<Popconfirm
|
||||
v-if="row.status === 1"
|
||||
title="确认停用该 API Key?"
|
||||
@confirm="handleDisable(row)"
|
||||
>
|
||||
<Button type="link" size="small">停用</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
v-else
|
||||
title="确认启用该 API Key?"
|
||||
@confirm="handleEnable(row)"
|
||||
>
|
||||
<Button type="link" size="small">启用</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="open:api-key:delete">
|
||||
<Popconfirm title="确认删除该 API Key?" @confirm="handleDelete(row)">
|
||||
<Button type="link" danger size="small">删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -35,6 +35,11 @@ import {
|
||||
} from '#/api/sys/account';
|
||||
|
||||
import SuperAccountFormModal from './components/SuperAccountFormModal.vue';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import {
|
||||
SIDEBAR_LIST_SHELL_CLASS,
|
||||
sidebarListRowClass,
|
||||
@@ -82,8 +87,15 @@ const selectedCompanyLabel = computed(() => {
|
||||
return currentCompany.value.name;
|
||||
});
|
||||
|
||||
const gridOptions: VxeGridProps<SuperAccountVO.AccountInfoVO> = {
|
||||
columns: [
|
||||
const accountActionCodes = [
|
||||
'org:account:create',
|
||||
'org:account:update',
|
||||
'org:account:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(accountActionCodes);
|
||||
|
||||
const accountTableBaseColumns: VxeGridProps<SuperAccountVO.AccountInfoVO>['columns'] =
|
||||
[
|
||||
{ type: 'seq' as const, minWidth: 56, title: '序号' },
|
||||
{
|
||||
field: 'loginCode',
|
||||
@@ -139,13 +151,25 @@ const gridOptions: VxeGridProps<SuperAccountVO.AccountInfoVO> = {
|
||||
minWidth: 160,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const accountActionColumn: NonNullable<
|
||||
VxeGridProps<SuperAccountVO.AccountInfoVO>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 140,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const accountTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(accountTableBaseColumns ?? []), accountActionColumn]
|
||||
: (accountTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
const gridOptions: VxeGridProps<SuperAccountVO.AccountInfoVO> = {
|
||||
columns: accountTableColumns.value,
|
||||
height: '100%',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -220,6 +244,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: false,
|
||||
tableTitle: '账户列表',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, accountTableColumns);
|
||||
|
||||
async function searchCompanies() {
|
||||
companyLoading.value = true;
|
||||
@@ -345,10 +370,12 @@ onMounted(() => {
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增账户
|
||||
</Button>
|
||||
<PermissionGate code="org:account:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon class="mr-2 h-4 w-4" />
|
||||
新增账户
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -431,15 +458,17 @@ onMounted(() => {
|
||||
{{ company.status === 1 ? '启用' : '禁用' }}
|
||||
</span>
|
||||
</button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs font-semibold opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAddForCompany(company)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
<PermissionGate code="org:account:create">
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
class="!h-7 shrink-0 !px-1 !text-xs font-semibold opacity-80 group-hover:opacity-100"
|
||||
@click.stop="handleAddForCompany(company)"
|
||||
>
|
||||
<PlusIcon class="mr-0.5 inline h-3.5 w-3.5" />
|
||||
添加
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -537,15 +566,19 @@ onMounted(() => {
|
||||
</Tag>
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个账户吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="org:account:update">
|
||||
<Button size="small" @click="handleEdit(row)">编辑</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:account:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个账户吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger>删除</Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -15,6 +15,11 @@ import {
|
||||
admin_deleteAccountApi,
|
||||
admin_getAccountPageApi,
|
||||
} from '#/api/company/account';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
|
||||
import AccountFormModal from './components/AccountFormModal.vue';
|
||||
|
||||
@@ -51,6 +56,13 @@ const statusOptions = [
|
||||
{ label: '停用', value: 0 },
|
||||
];
|
||||
|
||||
const accountActionCodes = [
|
||||
'org:account:create',
|
||||
'org:account:update',
|
||||
'org:account:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(accountActionCodes);
|
||||
|
||||
// 搜索表单配置
|
||||
const gridReloadRef = ref<(() => void) | null>(null);
|
||||
const formOptions = computed(() => ({
|
||||
@@ -108,9 +120,7 @@ const formOptions = computed(() => ({
|
||||
collapsedRows: 1,
|
||||
}));
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const accountTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
@@ -163,13 +173,24 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '创建时间',
|
||||
minWidth: 160,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const accountActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] = {
|
||||
title: '操作',
|
||||
width: 120,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const accountTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(accountTableBaseColumns ?? []), accountActionColumn]
|
||||
: (accountTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: accountTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -246,6 +267,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
tableTitle: '账户管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, accountTableColumns);
|
||||
|
||||
// 计算属性
|
||||
const hasSelected = computed(() => {
|
||||
@@ -352,13 +374,17 @@ function handleModalSuccess() {
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加账户
|
||||
</Button>
|
||||
<Button v-if="hasSelected" danger @click="handleBatchDelete">
|
||||
批量删除
|
||||
</Button>
|
||||
<PermissionGate code="org:account:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加账户
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:account:delete">
|
||||
<Button v-if="hasSelected" danger @click="handleBatchDelete">
|
||||
批量删除
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -377,15 +403,19 @@ function handleModalSuccess() {
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }">
|
||||
<template v-if="showActionColumn" #action="{ row }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个账户吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="org:account:update">
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:account:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个账户吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -17,6 +17,11 @@ import {
|
||||
} from '#/api/company';
|
||||
import CompanyMenuDrawer from '#/components/CompanyMenuDrawer.vue';
|
||||
import CompanyPermissionDrawer from '#/components/CompanyPermissionDrawer.vue';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
import CompanyLogoAvatar from '#/views/company/components/CompanyLogoAvatar.vue';
|
||||
|
||||
import CompanyFormModal from './components/CompanyFormModal.vue';
|
||||
@@ -46,9 +51,16 @@ const statusOptions = [
|
||||
{ label: '正常', value: 1 },
|
||||
];
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const companyActionCodes = [
|
||||
'org:company:create',
|
||||
'org:company:update',
|
||||
'org:company:delete',
|
||||
'org:company:menu:assign',
|
||||
'org:company:permission:assign',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(companyActionCodes);
|
||||
|
||||
const companyTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
@@ -108,13 +120,24 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const companyActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const companyTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(companyTableBaseColumns ?? []), companyActionColumn]
|
||||
: (companyTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: companyTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -320,6 +343,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
tableTitle: '公司管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, companyTableColumns);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -335,10 +359,12 @@ gridReloadRef.value = () => gridApi.reload();
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加公司
|
||||
</Button>
|
||||
<PermissionGate code="org:company:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加公司
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -372,26 +398,34 @@ gridReloadRef.value = () => gridApi.reload();
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Button size="small" type="primary" @click="handleMenuManage(row)">
|
||||
菜单
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
@click="handlePermissionManage(row)"
|
||||
>
|
||||
权限
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个公司吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="org:company:update">
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:company:menu:assign">
|
||||
<Button size="small" type="primary" @click="handleMenuManage(row)">
|
||||
菜单
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:company:permission:assign">
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
ghost
|
||||
@click="handlePermissionManage(row)"
|
||||
>
|
||||
权限
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:company:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个公司吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -18,6 +18,11 @@ import {
|
||||
deleteDepartmentApi,
|
||||
getDepartmentPageApi,
|
||||
} from '#/api/org/department';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
|
||||
import DepartmentModal from './components/DepartmentModal.vue';
|
||||
|
||||
@@ -70,9 +75,14 @@ const parentDepartmentOptions = computed(() => {
|
||||
return options;
|
||||
});
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const departmentActionCodes = [
|
||||
'org:department:create',
|
||||
'org:department:update',
|
||||
'org:department:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(departmentActionCodes);
|
||||
|
||||
const departmentTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
@@ -105,13 +115,26 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const departmentActionColumn: NonNullable<
|
||||
VxeGridProps<any>['columns']
|
||||
>[number] = {
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const departmentTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(departmentTableBaseColumns ?? []), departmentActionColumn]
|
||||
: (departmentTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: departmentTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -285,6 +308,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
tableTitle: '部门管理',
|
||||
});
|
||||
gridReloadRef.value = () => gridApi.reload();
|
||||
syncVxeGridColumns(gridApi, departmentTableColumns);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -300,10 +324,12 @@ gridReloadRef.value = () => gridApi.reload();
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加部门
|
||||
</Button>
|
||||
<PermissionGate code="org:department:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加部门
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -325,15 +351,19 @@ gridReloadRef.value = () => gridApi.reload();
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个部门吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="org:department:update">
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:department:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个部门吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -15,6 +15,11 @@ import {
|
||||
deletePositionApi,
|
||||
getPositionPageApi,
|
||||
} from '#/api/org/position';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
syncVxeGridColumns,
|
||||
useActionColumnVisible,
|
||||
} from '#/composables/use-vxe-action-column';
|
||||
|
||||
import PositionModal from './components/PositionModal.vue';
|
||||
|
||||
@@ -47,9 +52,14 @@ const departmentOptions = ref([
|
||||
{ label: '市场部', value: 4 },
|
||||
]);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: [
|
||||
const positionActionCodes = [
|
||||
'org:position:create',
|
||||
'org:position:update',
|
||||
'org:position:delete',
|
||||
];
|
||||
const showActionColumn = useActionColumnVisible(positionActionCodes);
|
||||
|
||||
const positionTableBaseColumns: VxeGridProps<any>['columns'] = [
|
||||
{
|
||||
type: 'seq' as const,
|
||||
minWidth: 'auto',
|
||||
@@ -87,13 +97,25 @@ const gridOptions: VxeGridProps<any> = {
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const positionActionColumn: NonNullable<VxeGridProps<any>['columns']>[number] =
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
fixed: 'right' as const,
|
||||
slots: { default: 'action' },
|
||||
};
|
||||
|
||||
const positionTableColumns = computed(() =>
|
||||
showActionColumn.value
|
||||
? [...(positionTableBaseColumns ?? []), positionActionColumn]
|
||||
: (positionTableBaseColumns ?? []),
|
||||
);
|
||||
|
||||
// VbenVxeGrid 表格配置
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
columns: positionTableColumns.value,
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
@@ -231,6 +253,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
showSearchForm: true,
|
||||
tableTitle: '职位管理',
|
||||
});
|
||||
syncVxeGridColumns(gridApi, positionTableColumns);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -246,10 +269,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<!-- 工具栏工具 -->
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加职位
|
||||
</Button>
|
||||
<PermissionGate code="org:position:create">
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加职位
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -272,15 +297,19 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
</template>
|
||||
|
||||
<!-- 操作列 -->
|
||||
<template #action="{ row }: { row: any }">
|
||||
<template v-if="showActionColumn" #action="{ row }: { row: any }">
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个职位吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
<PermissionGate code="org:position:update">
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
</PermissionGate>
|
||||
<PermissionGate code="org:position:delete">
|
||||
<Popconfirm
|
||||
title="确定要删除这个职位吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
</Popconfirm>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
batchUpdatePositionMenusApi,
|
||||
getPositionMenuIdsApi,
|
||||
} from '#/api/org/position/menu';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
|
||||
defineOptions({
|
||||
name: 'PositionMenuManagePage',
|
||||
@@ -34,6 +36,9 @@ defineOptions({
|
||||
|
||||
const BriefcaseIcon = createIconifyIcon('lucide:briefcase');
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignMenu = computed(() => hasPermission('org:position:menu:assign'));
|
||||
|
||||
const searchForm = ref({
|
||||
name: '',
|
||||
status: undefined as number | undefined,
|
||||
@@ -306,23 +311,25 @@ onMounted(() => {
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button :disabled="!currentPosition" @click="handleSelectNone">
|
||||
取消全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition"
|
||||
@click="handleSelectAll"
|
||||
>
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition || !stats.changed"
|
||||
@click="savePositionPermissions"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
<PermissionGate code="org:position:menu:assign">
|
||||
<Button :disabled="!currentPosition" @click="handleSelectNone">
|
||||
取消全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition"
|
||||
@click="handleSelectAll"
|
||||
>
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition || !stats.changed"
|
||||
@click="savePositionPermissions"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -511,7 +518,7 @@ onMounted(() => {
|
||||
v-model:checked-keys="checkedKeys"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="menuTreeData"
|
||||
checkable
|
||||
:checkable="canAssignMenu"
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
|
||||
@@ -27,11 +27,18 @@ import {
|
||||
getPositionAssignablePermissionTreeApi,
|
||||
getPositionPermissionIdsApi,
|
||||
} from '#/api/org/position/permission';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import { usePermission } from '#/composables/use-permission';
|
||||
|
||||
defineOptions({ name: 'PositionPermissionManagePage' });
|
||||
|
||||
const BriefcaseIcon = createIconifyIcon('lucide:briefcase');
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canAssignPermission = computed(() =>
|
||||
hasPermission('org:position:permission:assign'),
|
||||
);
|
||||
|
||||
type PermissionTreeNode = {
|
||||
key: number;
|
||||
title: string;
|
||||
@@ -260,17 +267,19 @@ onMounted(() => {
|
||||
|
||||
<template #extra>
|
||||
<Space>
|
||||
<Button :disabled="!currentPosition" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentPosition" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
<PermissionGate code="org:position:permission:assign">
|
||||
<Button :disabled="!currentPosition" @click="selectNone">取消全选</Button>
|
||||
<Button type="primary" :disabled="!currentPosition" @click="selectAll">
|
||||
一键全选
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
:disabled="!currentPosition || !stats.changed"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存配置
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
</template>
|
||||
|
||||
@@ -450,7 +459,7 @@ onMounted(() => {
|
||||
v-model:checked-keys="selectedPermissionIds"
|
||||
v-model:expanded-keys="expandedKeys"
|
||||
:tree-data="permissionTreeData"
|
||||
checkable
|
||||
:checkable="canAssignPermission"
|
||||
block-node
|
||||
:selectable="false"
|
||||
@check="handleTreeCheckChange"
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
getOrderStatRebuildStatusApi,
|
||||
reconcileOrderStatApi,
|
||||
} from '#/api/sys/order-stat';
|
||||
import { PermissionGate } from '#/components/permission';
|
||||
import {
|
||||
SIDEBAR_LIST_SHELL_CLASS,
|
||||
sidebarListRowClass,
|
||||
@@ -505,14 +506,16 @@ onMounted(() => {
|
||||
/>
|
||||
</Form.Item>
|
||||
<Space>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="rebuildSubmitting"
|
||||
@click="handleCreateRebuild"
|
||||
>
|
||||
<template #icon><PlayIcon /></template>
|
||||
创建灌数任务
|
||||
</Button>
|
||||
<PermissionGate code="bi:order-stat:calc:create">
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="rebuildSubmitting"
|
||||
@click="handleCreateRebuild"
|
||||
>
|
||||
<template #icon><PlayIcon /></template>
|
||||
创建灌数任务
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Space>
|
||||
<div v-if="lastTaskId" class="mt-2 text-sm text-muted-foreground">
|
||||
最近任务 ID:<Tag color="blue">{{ lastTaskId }}</Tag>
|
||||
@@ -526,10 +529,12 @@ onMounted(() => {
|
||||
placeholder="任务 ID"
|
||||
style="width: 160px"
|
||||
/>
|
||||
<Button :loading="pollLoading" @click="fetchRebuildStatus()">
|
||||
<template #icon><RefreshIcon /></template>
|
||||
查询
|
||||
</Button>
|
||||
<PermissionGate code="bi:order-stat:calc:read">
|
||||
<Button :loading="pollLoading" @click="fetchRebuildStatus()">
|
||||
<template #icon><RefreshIcon /></template>
|
||||
查询
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
<span class="text-sm text-muted-foreground">
|
||||
自动刷新(3s)
|
||||
<Switch v-model:checked="autoPoll" class="ml-2" size="small" />
|
||||
@@ -596,14 +601,16 @@ onMounted(() => {
|
||||
class="w-full"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="reconcileLoading"
|
||||
@click="handleReconcile"
|
||||
>
|
||||
<template #icon><SearchIcon /></template>
|
||||
执行对账
|
||||
</Button>
|
||||
<PermissionGate code="bi:order-stat:calc:read">
|
||||
<Button
|
||||
type="primary"
|
||||
:loading="reconcileLoading"
|
||||
@click="handleReconcile"
|
||||
>
|
||||
<template #icon><SearchIcon /></template>
|
||||
执行对账
|
||||
</Button>
|
||||
</PermissionGate>
|
||||
</Form>
|
||||
|
||||
<div v-if="reconcileReport" class="mt-4">
|
||||
|
||||
Reference in New Issue
Block a user