diff --git a/src/20260330145422_131_70.jpg b/src/20260330145422_131_70.jpg new file mode 100644 index 00000000..4619e8bd Binary files /dev/null and b/src/20260330145422_131_70.jpg differ diff --git a/src/api/dashboard.ts b/src/api/dashboard.ts new file mode 100644 index 00000000..b9cce1b5 --- /dev/null +++ b/src/api/dashboard.ts @@ -0,0 +1,58 @@ +import request from '@/utils/request' +const v = "1.0" + +export function getDashboardData(method: string, data: any) { + return request({ + url: '/system', + method: 'post', + params: { + method, + v, + timestamp: new Date().getTime() + }, + data: data, + isSystemApi: true + } as any) +} + +/** + * 获取仓库基础统计数据 + */ +export function getWarehouseStats(data: any = {}) { + return getDashboardData('dashboard.warehouseStats', data) +} + +/** + * 获取门店基础统计数据 + */ +export function getStoreStats(data: any = {}) { + return getDashboardData('dashboard.storeStats', data) +} + +/** + * 获取订单趋势数据 + */ +export function getOrderTrend(data: any = {}) { + return getDashboardData('dashboard.orderTrend', data) +} + +/** + * 获取平台分布数据 + */ +export function getPlatformDist(data: any = {}) { + return getDashboardData('dashboard.platformDist', data) +} + +/** + * 获取商品排行数据 + */ +export function getHotOrderRank(data: any = {}) { + return getDashboardData('dashboard.hotOrderRank', data) +} + +/** + * 获取快递占比数据 + */ +export function getExpressRatio(data: any = {}) { + return getDashboardData('dashboard.expressRatio', data) +} diff --git a/src/api/setting/role.ts b/src/api/setting/role.ts new file mode 100644 index 00000000..0d25b6a4 --- /dev/null +++ b/src/api/setting/role.ts @@ -0,0 +1,67 @@ +import request from '@/utils/request' + +const v = "1.0"; + +/** + * 查询当前主体可分配角色列表,可选返回指定工号已选角色 + */ +export function roleList(data: { employee_id?: number, includeDisabled?: boolean, includeSystem?: boolean }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'setting.role.list', + v, + timestamp: new Date().getTime(), + }, + data + }) +} + +/** + * 给工号新增单个角色绑定 + */ +export function roleAdd(data: { employee_id: number, role_id: number }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'setting.role.add', + v, + timestamp: new Date().getTime() + }, + data + }) +} + +/** + * 删除工号单个角色绑定 + */ +export function roleDelete(data: { employee_id: number, role_id: number }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'setting.role.delete', + v, + timestamp: new Date().getTime() + }, + data + }) +} + +/** + * 批量重置工号角色绑定 + */ +export function roleUpdate(data: { employee_id: number, role_ids: number[] }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'setting.role.update', + v, + timestamp: new Date().getTime() + }, + data + }) +} diff --git a/src/layout/component/TaskView/ScrollPane.vue b/src/layout/component/TaskView/ScrollPane.vue index 3252a843..9e8452c0 100644 --- a/src/layout/component/TaskView/ScrollPane.vue +++ b/src/layout/component/TaskView/ScrollPane.vue @@ -45,11 +45,23 @@ defineExpose({ position: relative; overflow: hidden; width: 100%; + height: 100%; + :deep(.el-scrollbar__bar) { bottom: 0px; + height: 4px; } + :deep(.el-scrollbar__wrap) { - height: 55px; + height: 30px; + overflow-x: auto; + overflow-y: hidden; + } + + :deep(.el-scrollbar__view) { + height: 30px; + display: flex; + align-items: center; } } diff --git a/src/layout/component/TaskView/index.vue b/src/layout/component/TaskView/index.vue index 4d52cc1a..53b98d11 100644 --- a/src/layout/component/TaskView/index.vue +++ b/src/layout/component/TaskView/index.vue @@ -272,72 +272,81 @@ onMounted(() => { display: flex; justify-content: center; align-items: center; - // background: #fafafa; - // border-top: 1px solid #eee; - border-bottom: 1px solid #eee; + background: #fff; + border-bottom: 1px solid #f0f2f5; cursor: pointer; - font-size: 12px; - color: #000000; + font-size: 14px; + color: #909399; + transition: all 0.3s; &:hover { - // background: #f0f2f5; - // color: #409EFF; + background: #f5f7fa; + color: #409EFF; } } .tags-view-wrapper { - height: 32px; - // border-bottom: 1px solid #d8dce5; - // background-color: #e0dbdb; + height: 35px; + width: 100%; + background: #f0f2f5; + border-bottom: 1px solid #d8dce5; + .tags-view-item { display: inline-block; position: relative; cursor: pointer; height: 26px; line-height: 26px; - // border: 1px solid #d8dce5; + border: 1px solid #d8dce5; color: #495060; - background: #b8b5b5; - padding: 0 10px; + background: #fff; + padding: 0 12px; font-size: 12px; - margin-left: 5px; - margin-top: 3px; + margin-left: 6px; + // margin-top: 5px; // 移除 margin-top,改用 flex 居中 + border-radius: 3px; text-decoration: none; + transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + &:first-of-type { margin-left: 15px; } &:last-of-type { margin-right: 15px; } + + &:hover { + background-color: #f6f6f6; + border-color: #b4bccc; + } + &.active { background-color: #42b983; color: #fff; - // border-color: #42b983; + border-color: #42b983; &::before { - content: ''; + content: ""; background: #fff; display: inline-block; width: 8px; height: 8px; border-radius: 50%; position: relative; - margin-right: 2px; + margin-right: 4px; } } .close-icon { width: 16px; height: 16px; - vertical-align: 2px; + line-height: 14px; + vertical-align: middle; border-radius: 50%; text-align: center; - transition: all .3s cubic-bezier(.645, .045, .355, 1); + transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); transform-origin: 100% 50%; margin-left: 5px; - &:before { - transform: scale(.6); - display: inline-block; - vertical-align: -3px; - } + font-size: 12px; + &:hover { background-color: #b4bccc; color: #fff; diff --git a/src/views/dashboard/components/HotOrderRank.vue b/src/views/dashboard/components/HotOrderRank.vue index 38df1616..7c0f9535 100644 --- a/src/views/dashboard/components/HotOrderRank.vue +++ b/src/views/dashboard/components/HotOrderRank.vue @@ -4,24 +4,14 @@
{{ title }}
- +
- +
@@ -38,15 +28,11 @@
{{ $t('dashboard.trend') }}
-
+
-{{ Number(index) + 1 }} + {{ Number(index) + 1 }}
@@ -73,12 +59,7 @@
@@ -166,7 +147,8 @@ onMounted(() => { flex: 1; display: flex; flex-direction: column; - min-height: 0; /* Important for nested flex scroll */ + min-height: 0; + /* Important for nested flex scroll */ } .module-header { @@ -282,7 +264,8 @@ onMounted(() => { display: flex; flex-direction: column; gap: 2px; - overflow: hidden; /* Ensure text truncation works */ + overflow: hidden; + /* Ensure text truncation works */ } .product-name { @@ -328,7 +311,8 @@ onMounted(() => { padding: 12px 20px; border-top: 1px solid #ebeef5; text-align: center; - margin-top: auto; /* Push to bottom */ + margin-top: auto; + /* Push to bottom */ } @media (max-width: 768px) { diff --git a/src/views/dashboard/components/OrderTrend.vue b/src/views/dashboard/components/OrderTrend.vue index 9439e66a..a948f179 100644 --- a/src/views/dashboard/components/OrderTrend.vue +++ b/src/views/dashboard/components/OrderTrend.vue @@ -197,15 +197,6 @@ const handleDataSuccess = (apiData: any) => { let categories: any[] = [] let orders: any[] = [] let shipments: any[] = [] - - // Check if data is nested inside `data` property (common in some backends) - // or if it's the direct payload. - // Based on mixin, `handleDataSuccess(data.data)` was called. - // So `apiData` here is the payload. - - // However, in Vue 2 OrderTrend, it did `const apiData = data.data` again? - // If so, then `apiData` passed to this function might need another unwrap? - // Let's assume standard payload structure. const payload = apiData diff --git a/src/views/dashboard/composables/dashboard-config.ts b/src/views/dashboard/composables/dashboard-config.ts new file mode 100644 index 00000000..003c5dd3 --- /dev/null +++ b/src/views/dashboard/composables/dashboard-config.ts @@ -0,0 +1,69 @@ +import { defineAsyncComponent } from 'vue' + +// Module Permissions Mapping +export const MODULE_PERMISSIONS = { + WAREHOUSE_BASE: 'dashboard.warehouseBaseData', + STORE_BASE: 'dashboard.storeBaseData', + ORDER_TREND: 'dashboard.orderTrend', + PLATFORM_DISTRIBUTION: 'dashboard.platformDist', + HOT_ORDER_RANK: 'dashboard.hotOrderRank', + EXPRESS_RATIO: 'dashboard.expressRatio', +} + +// Dynamic Components Map +export const moduleComponents: Record = { + StatsCardsWarehouse: defineAsyncComponent(() => import('../components/StatsCardsWarehouse.vue')), + StatsCardsStore: defineAsyncComponent(() => import('../components/StatsCardsStore.vue')), + OrderTrend: defineAsyncComponent(() => import('../components/OrderTrend.vue')), + PlatformDistribution: defineAsyncComponent(() => import('../components/PlatformDistribution.vue')), + HotOrderRank: defineAsyncComponent(() => import('../components/HotOrderRank.vue')), + ExpressRatio: defineAsyncComponent(() => import('../components/ExpressRatio.vue')), +} + +export interface DashboardModule { + name: string + component: string + titleKey: string + colSpan?: number + props?: Record +} + +// Static definitions without i18n functions directly (to be used with t() in component) +export const RAW_MODULE_CONFIGS: Record = { + [MODULE_PERMISSIONS.WAREHOUSE_BASE]: { + name: 'StatsCardsWarehouse', + component: 'StatsCardsWarehouse', + titleKey: 'dashboard.warehouseStatistics', + colSpan: 3 + }, + [MODULE_PERMISSIONS.STORE_BASE]: { + name: 'StatsCardsStore', + component: 'StatsCardsStore', + titleKey: 'dashboard.storeStatistics', + colSpan: 3 + }, + [MODULE_PERMISSIONS.ORDER_TREND]: { + name: 'OrderTrend', + component: 'OrderTrend', + titleKey: 'dashboard.orderTrend', + colSpan: 2 + }, + [MODULE_PERMISSIONS.PLATFORM_DISTRIBUTION]: { + name: 'PlatformDistribution', + component: 'PlatformDistribution', + titleKey: 'dashboard.platformDistribution', + colSpan: 1 + }, + [MODULE_PERMISSIONS.HOT_ORDER_RANK]: { + name: 'HotOrderRank', + component: 'HotOrderRank', + titleKey: 'dashboard.hotOrderRank', + colSpan: 2 + }, + [MODULE_PERMISSIONS.EXPRESS_RATIO]: { + name: 'ExpressRatio', + component: 'ExpressRatio', + titleKey: 'dashboard.expressRatio', + colSpan: 1 + } +} diff --git a/src/views/dashboard/composables/useDashboard.ts b/src/views/dashboard/composables/useDashboard.ts index d124d6ba..9d8a2580 100644 --- a/src/views/dashboard/composables/useDashboard.ts +++ b/src/views/dashboard/composables/useDashboard.ts @@ -1,6 +1,6 @@ import { ref, onMounted, onBeforeUnmount, unref } from 'vue' import { useRouter } from 'vue-router' -import request from '@/utils/request' +import { getDashboardData } from '@/api/dashboard' import { ElMessage } from 'element-plus' export function useDashboard(props: { method: string; queryParams?: any }) { @@ -18,18 +18,8 @@ export function useDashboard(props: { method: string; queryParams?: any }) { error.value = null try { - // Use the request utility directly as in Vue 2 mixin - const res: any = await request({ - url: '/system', - method: 'post', - params: { - method: props.method, - v: '1.0', - timestamp: new Date().getTime() - }, - data: unref(props.queryParams) || {}, - // isSystemApi: true // Not sure if this flag is needed in Vue 3 request util, removing for now - }) + // Use the dashboard api utility + const res: any = await getDashboardData(props.method, unref(props.queryParams) || {}) if (res.code === 200) { data.value = res.data diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 0457dda6..458636d2 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -22,11 +22,12 @@