add TabSplitView
This commit is contained in:
@@ -0,0 +1,345 @@
|
||||
<template>
|
||||
<div
|
||||
v-can="permissionCodes.stat.read"
|
||||
class="gao-chart-page"
|
||||
:class="{ embedded, compact }"
|
||||
>
|
||||
<section class="hero" v-entrance-transition>
|
||||
<div class="eyebrow" v-text="'订单经营分析'" />
|
||||
<h1 v-text="'客户经营看板'" />
|
||||
<p v-text="`${currentStoreStore.currentStoreName} · 订单、收款与客户贡献 · 近 1 个月`" />
|
||||
</section>
|
||||
<div v-if="!storeId" class="no-store" v-entrance-transition>
|
||||
<t-empty description="暂无可统计的门店" />
|
||||
</div>
|
||||
<template v-else>
|
||||
<section class="summary">
|
||||
<div
|
||||
v-for="item in summaryList"
|
||||
:key="item.label"
|
||||
class="summary-item"
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
>
|
||||
<span v-text="item.label" />
|
||||
<strong v-text="item.value" />
|
||||
</div>
|
||||
</section>
|
||||
<div class="chart-list">
|
||||
<order-daily-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="dailyList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<div class="two-columns">
|
||||
<order-type-chart
|
||||
v-entrance-transition
|
||||
:list="typeList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<order-payment-chart
|
||||
v-entrance-transition
|
||||
:list="paymentList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<div class="two-columns">
|
||||
<order-status-chart
|
||||
v-entrance-transition
|
||||
:list="statusList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<customer-order-rank-chart
|
||||
v-entrance-transition
|
||||
:list="customerRankList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<order-receivable-card
|
||||
v-entrance-transition
|
||||
:receivable="receivable"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import GaoSalesOrderChartAPI from "@/api/GaoSalesOrderChartAPI";
|
||||
import CustomerOrderRankChart from "@/pages/product/component/CustomerOrderRankChart.vue";
|
||||
import OrderDailyChart from "@/pages/product/component/OrderDailyChart.vue";
|
||||
import OrderPaymentChart from "@/pages/product/component/OrderPaymentChart.vue";
|
||||
import OrderReceivableCard from "@/pages/product/component/OrderReceivableCard.vue";
|
||||
import OrderStatusChart from "@/pages/product/component/OrderStatusChart.vue";
|
||||
import OrderTypeChart from "@/pages/product/component/OrderTypeChart.vue";
|
||||
import type {
|
||||
GaoCustomerOrderRankView,
|
||||
GaoSalesOrderDailyStatView,
|
||||
GaoSalesOrderPaymentStatView,
|
||||
GaoSalesOrderReceivableStatView,
|
||||
GaoSalesOrderStatusStatView,
|
||||
GaoSalesOrderTypeStatView
|
||||
} from "@/types/GaoChart";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
import { clearStoreChartCache } from "@/utils/storeChartCache";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { buildDateTextList, formatMoney, formatQuantity, toUnixRange } from "@/pages/product/component/chartUtils";
|
||||
import { getCurrentStoreId } from "@/utils/store";
|
||||
|
||||
interface SummaryItem {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
withDefaults(defineProps<{
|
||||
/** 嵌在分栏里:顶部内边距交给栏内导航,不再自己让出导航高度 */
|
||||
embedded?: boolean;
|
||||
/** 窄栏里图表一律单列 */
|
||||
compact?: boolean;
|
||||
}>(), {
|
||||
embedded: false,
|
||||
compact: false
|
||||
});
|
||||
|
||||
defineOptions({
|
||||
name: "OrderChartsPanel"
|
||||
});
|
||||
|
||||
const currentStoreStore = useCurrentStoreStore();
|
||||
const dateRange = buildDefaultDateRange();
|
||||
const dateTextList = buildDateTextList(dateRange[0], dateRange[1]);
|
||||
const dailyList = ref<GaoSalesOrderDailyStatView[]>([]);
|
||||
const typeList = ref<GaoSalesOrderTypeStatView[]>([]);
|
||||
const paymentList = ref<GaoSalesOrderPaymentStatView[]>([]);
|
||||
const statusList = ref<GaoSalesOrderStatusStatView[]>([]);
|
||||
const customerRankList = ref<GaoCustomerOrderRankView[]>([]);
|
||||
const receivable = ref<GaoSalesOrderReceivableStatView>({});
|
||||
const isLoading = ref(false);
|
||||
let requestId = 0;
|
||||
|
||||
const storeId = computed(() => currentStoreStore.currentStoreId || getCurrentStoreId());
|
||||
const summaryList = computed<SummaryItem[]>(() => [
|
||||
{
|
||||
label: "订单数",
|
||||
value: `${formatQuantity(receivable.value.orderCount)} 单`
|
||||
},
|
||||
{
|
||||
label: "成交金额",
|
||||
value: formatMoney(receivable.value.saleAmount)
|
||||
},
|
||||
{
|
||||
label: "有效收款",
|
||||
value: formatMoney(receivable.value.paidAmount)
|
||||
},
|
||||
{
|
||||
label: "未收金额",
|
||||
value: formatMoney(receivable.value.unpaidAmount)
|
||||
},
|
||||
{
|
||||
label: "净收款",
|
||||
value: formatMoney(receivable.value.netPaidAmount)
|
||||
}
|
||||
]);
|
||||
|
||||
watch(storeId, async () => {
|
||||
await loadCharts();
|
||||
}, { immediate: true });
|
||||
|
||||
onMounted(async () => {
|
||||
if (!currentStoreStore.currentStoreId) {
|
||||
await currentStoreStore.loadLoginStore();
|
||||
}
|
||||
});
|
||||
|
||||
async function reload(): Promise<void> {
|
||||
clearStoreChartCache();
|
||||
await loadCharts();
|
||||
}
|
||||
|
||||
async function loadCharts(): Promise<void> {
|
||||
if (!storeId.value) {
|
||||
clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRequestId = ++requestId;
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const range = toUnixRange(dateRange);
|
||||
const request = { storeId: storeId.value, ...range, topN: 10 };
|
||||
const [daily, type, payment, status, receivableData, customerRank] = await Promise.all([
|
||||
GaoSalesOrderChartAPI.daily(request),
|
||||
GaoSalesOrderChartAPI.type(request),
|
||||
GaoSalesOrderChartAPI.payment(request),
|
||||
GaoSalesOrderChartAPI.status(request),
|
||||
GaoSalesOrderChartAPI.receivable(request),
|
||||
GaoSalesOrderChartAPI.customerRank(request)
|
||||
]);
|
||||
if (currentRequestId !== requestId) {
|
||||
return;
|
||||
}
|
||||
dailyList.value = daily || [];
|
||||
typeList.value = type || [];
|
||||
paymentList.value = payment || [];
|
||||
statusList.value = status || [];
|
||||
receivable.value = receivableData || {};
|
||||
customerRankList.value = customerRank || [];
|
||||
} catch (error) {
|
||||
if (currentRequestId === requestId) {
|
||||
Message.error(getErrorMessage(error, "订单图表加载失败"));
|
||||
}
|
||||
} finally {
|
||||
if (currentRequestId === requestId) {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearData(): void {
|
||||
isLoading.value = false;
|
||||
dailyList.value = [];
|
||||
typeList.value = [];
|
||||
paymentList.value = [];
|
||||
statusList.value = [];
|
||||
receivable.value = {};
|
||||
customerRankList.value = [];
|
||||
}
|
||||
|
||||
function buildDefaultDateRange(): [string, string] {
|
||||
const end = getDateEnd(new Date());
|
||||
const today = getDateStart(end);
|
||||
const beginMonth = new Date(today.getFullYear(), today.getMonth() - 1, 1, 0, 0, 0, 0);
|
||||
const lastDayOfBeginMonth = new Date(beginMonth.getFullYear(), beginMonth.getMonth() + 1, 0).getDate();
|
||||
const begin = new Date(beginMonth);
|
||||
begin.setDate(Math.min(today.getDate(), lastDayOfBeginMonth));
|
||||
return [formatDateTime(begin), formatDateTime(end)];
|
||||
}
|
||||
|
||||
function getDateStart(date: Date): Date {
|
||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
function getDateEnd(date: Date): Date {
|
||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);
|
||||
}
|
||||
|
||||
function formatDateTime(date: Date): string {
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
}
|
||||
|
||||
function pad(value: number): string {
|
||||
return String(value).padStart(2, "0");
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
reload
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.gao-chart-page {
|
||||
// 卡片配色走变量,深色模式只改 .gao-chart-page 上的变量值
|
||||
--chart-bg: rgba(255, 255, 255, .92);
|
||||
--chart-shadow: var(--td-shadow-1);
|
||||
--chart-title: #0f172a;
|
||||
--chart-text: #7b889d;
|
||||
--chart-label: #52607a;
|
||||
|
||||
gap: 1rem;
|
||||
padding: calc(var(--tui-nav-height) + 1rem) 1rem 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// 分栏里顶部内边距由栏内导航负责
|
||||
&.embedded {
|
||||
padding: 0 1rem 1rem;
|
||||
}
|
||||
|
||||
.hero {
|
||||
padding: .25rem .25rem 0;
|
||||
|
||||
.eyebrow {
|
||||
color: var(--td-brand-color);
|
||||
font-size: .6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: .12em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: var(--chart-title);
|
||||
margin: .25rem 0 0;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--chart-text);
|
||||
margin: .375rem 0 0;
|
||||
font-size: .8125rem;
|
||||
}
|
||||
}
|
||||
|
||||
.summary {
|
||||
gap: .625rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
padding: .75rem .625rem;
|
||||
background: var(--chart-bg);
|
||||
box-shadow: var(--chart-shadow);
|
||||
border-radius: 1rem;
|
||||
|
||||
span {
|
||||
color: var(--chart-label);
|
||||
display: block;
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: var(--chart-title);
|
||||
margin-top: .25rem;
|
||||
display: block;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-list {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.two-columns {
|
||||
gap: 1rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
// 分栏窄容器:双列图表一律改单列
|
||||
&.compact {
|
||||
.two-columns {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.no-store {
|
||||
padding: 1.5rem 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark .gao-chart-page) {
|
||||
--chart-bg: rgba(15, 23, 42, .88);
|
||||
--chart-shadow: 0 .75rem 2rem rgba(2, 6, 23, .32);
|
||||
--chart-title: #e2e8f0;
|
||||
--chart-text: #94a3b8;
|
||||
--chart-label: #94a3b8;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,363 @@
|
||||
<template>
|
||||
<div
|
||||
v-can="permissionCodes.stat.read"
|
||||
class="gao-chart-page"
|
||||
:class="{ embedded, compact }"
|
||||
>
|
||||
<section class="hero" v-entrance-transition>
|
||||
<div class="eyebrow" v-text="'产品经营分析'" />
|
||||
<h1 v-text="'产品经营看板'" />
|
||||
<p v-text="`${currentStoreStore.currentStoreName} · 销售、履约与库存 · 近 1 个月`" />
|
||||
</section>
|
||||
<div v-if="!storeId" class="no-store" v-entrance-transition>
|
||||
<t-empty description="暂无可统计的门店" />
|
||||
</div>
|
||||
<template v-else>
|
||||
<section class="summary">
|
||||
<div
|
||||
v-for="item in summaryList"
|
||||
:key="item.label"
|
||||
class="summary-item"
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
>
|
||||
<span v-text="item.label" />
|
||||
<strong v-text="item.value" />
|
||||
</div>
|
||||
</section>
|
||||
<div class="chart-list">
|
||||
<product-sales-trend-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="salesDailyList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<div class="two-columns">
|
||||
<product-sales-rank-chart
|
||||
v-entrance-transition
|
||||
:list="salesRankList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<product-fulfillment-rank-chart
|
||||
v-entrance-transition
|
||||
:list="fulfillmentRankList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<product-fulfillment-trend-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="fulfillmentDailyList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<product-stock-movement-chart
|
||||
v-entrance-transition
|
||||
:date-text-list="dateTextList"
|
||||
:list="stockMovementList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<product-stock-health-table
|
||||
v-entrance-transition
|
||||
:list="stockHealthList"
|
||||
:sku-health-list="skuHealthList"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import GaoProductChartAPI from "@/api/GaoProductChartAPI";
|
||||
import GaoProductSkuChartAPI from "@/api/GaoProductSkuChartAPI";
|
||||
import ProductFulfillmentRankChart from "@/pages/product/component/ProductFulfillmentRankChart.vue";
|
||||
import ProductFulfillmentTrendChart from "@/pages/product/component/ProductFulfillmentTrendChart.vue";
|
||||
import ProductSalesRankChart from "@/pages/product/component/ProductSalesRankChart.vue";
|
||||
import ProductSalesTrendChart from "@/pages/product/component/ProductSalesTrendChart.vue";
|
||||
import ProductStockHealthTable from "@/pages/product/component/ProductStockHealthTable.vue";
|
||||
import ProductStockMovementChart from "@/pages/product/component/ProductStockMovementChart.vue";
|
||||
import type {
|
||||
GaoProductFulfillmentDailyStatView,
|
||||
GaoProductFulfillmentRankView,
|
||||
GaoProductSalesDailyStatView,
|
||||
GaoProductSalesRankView,
|
||||
GaoProductStockHealthView,
|
||||
GaoProductStockMovementDailyStatView,
|
||||
GaoProductSkuStockHealthView
|
||||
} from "@/types/GaoChart";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
import { clearStoreChartCache } from "@/utils/storeChartCache";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { buildDateTextList, formatMoney, formatQuantity, sumNumber, toUnixRange } from "@/pages/product/component/chartUtils";
|
||||
import { getCurrentStoreId } from "@/utils/store";
|
||||
|
||||
interface SummaryItem {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
withDefaults(defineProps<{
|
||||
/** 嵌在分栏里:顶部内边距交给栏内导航,不再自己让出导航高度 */
|
||||
embedded?: boolean;
|
||||
/** 窄栏里图表一律单列 */
|
||||
compact?: boolean;
|
||||
}>(), {
|
||||
embedded: false,
|
||||
compact: false
|
||||
});
|
||||
|
||||
defineOptions({
|
||||
name: "ProductChartsPanel"
|
||||
});
|
||||
|
||||
const currentStoreStore = useCurrentStoreStore();
|
||||
const dateRange = buildDefaultDateRange();
|
||||
const dateTextList = buildDateTextList(dateRange[0], dateRange[1]);
|
||||
const salesDailyList = ref<GaoProductSalesDailyStatView[]>([]);
|
||||
const salesRankList = ref<GaoProductSalesRankView[]>([]);
|
||||
const fulfillmentDailyList = ref<GaoProductFulfillmentDailyStatView[]>([]);
|
||||
const fulfillmentRankList = ref<GaoProductFulfillmentRankView[]>([]);
|
||||
const stockMovementList = ref<GaoProductStockMovementDailyStatView[]>([]);
|
||||
const stockHealthList = ref<GaoProductStockHealthView[]>([]);
|
||||
const skuHealthList = ref<GaoProductSkuStockHealthView[]>([]);
|
||||
const isLoading = ref(false);
|
||||
let requestId = 0;
|
||||
|
||||
const storeId = computed(() => currentStoreStore.currentStoreId || getCurrentStoreId());
|
||||
const summaryList = computed<SummaryItem[]>(() => [
|
||||
{
|
||||
label: "订单数",
|
||||
value: `${formatQuantity(sumNumber(salesDailyList.value, item => item.orderCount))} 单`
|
||||
},
|
||||
{
|
||||
label: "直接销量",
|
||||
value: formatQuantity(sumNumber(salesDailyList.value, item => item.directBaseQuantity))
|
||||
},
|
||||
{
|
||||
label: "套餐权益",
|
||||
value: formatQuantity(sumNumber(salesDailyList.value, item => item.packageBaseQuantity))
|
||||
},
|
||||
{
|
||||
label: "直接销售额",
|
||||
value: formatMoney(sumNumber(salesDailyList.value, item => item.directSaleAmount))
|
||||
},
|
||||
{
|
||||
label: "低库存产品",
|
||||
value: `${stockHealthList.value.filter(item => 0 < (item.lowStockSkuCount || 0)).length} 个`
|
||||
}
|
||||
]);
|
||||
|
||||
watch(storeId, async () => {
|
||||
await loadCharts();
|
||||
}, { immediate: true });
|
||||
|
||||
onMounted(async () => {
|
||||
if (!currentStoreStore.currentStoreId) {
|
||||
await currentStoreStore.loadLoginStore();
|
||||
}
|
||||
});
|
||||
|
||||
async function reload(): Promise<void> {
|
||||
clearStoreChartCache();
|
||||
await loadCharts();
|
||||
}
|
||||
|
||||
async function loadCharts(): Promise<void> {
|
||||
if (!storeId.value) {
|
||||
clearData();
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRequestId = ++requestId;
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const range = toUnixRange(dateRange);
|
||||
const rangeRequest = { storeId: storeId.value, ...range, topN: 10 };
|
||||
const snapshotRequest = { storeId: storeId.value };
|
||||
const [salesDaily, salesRank, fulfillmentDaily, fulfillmentRank, stockMovement, stockHealth] = await Promise.all([
|
||||
GaoProductChartAPI.salesDaily(rangeRequest),
|
||||
GaoProductChartAPI.salesRank(rangeRequest),
|
||||
GaoProductChartAPI.fulfillmentDaily(rangeRequest),
|
||||
GaoProductChartAPI.fulfillmentRank(rangeRequest),
|
||||
GaoProductChartAPI.stockMovementDaily(rangeRequest),
|
||||
GaoProductChartAPI.stockHealth(snapshotRequest)
|
||||
]);
|
||||
if (currentRequestId !== requestId) {
|
||||
return;
|
||||
}
|
||||
salesDailyList.value = salesDaily || [];
|
||||
salesRankList.value = salesRank || [];
|
||||
fulfillmentDailyList.value = fulfillmentDaily || [];
|
||||
fulfillmentRankList.value = fulfillmentRank || [];
|
||||
stockMovementList.value = stockMovement || [];
|
||||
stockHealthList.value = stockHealth || [];
|
||||
skuHealthList.value = [];
|
||||
if (stockHealthList.value.some(item => 0 < (item.lowStockSkuCount || 0))) {
|
||||
try {
|
||||
const skuHealth = await GaoProductSkuChartAPI.stockHealth({ storeId: storeId.value });
|
||||
if (currentRequestId === requestId) {
|
||||
skuHealthList.value = (skuHealth || []).filter(item => item.lowStock === 1);
|
||||
}
|
||||
} catch (error) {
|
||||
Message.warning(getErrorMessage(error, "低库存规格明细加载失败"));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (currentRequestId === requestId) {
|
||||
Message.error(getErrorMessage(error, "产品图表加载失败"));
|
||||
}
|
||||
} finally {
|
||||
if (currentRequestId === requestId) {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearData(): void {
|
||||
isLoading.value = false;
|
||||
salesDailyList.value = [];
|
||||
salesRankList.value = [];
|
||||
fulfillmentDailyList.value = [];
|
||||
fulfillmentRankList.value = [];
|
||||
stockMovementList.value = [];
|
||||
stockHealthList.value = [];
|
||||
skuHealthList.value = [];
|
||||
}
|
||||
|
||||
function buildDefaultDateRange(): [string, string] {
|
||||
const end = getDateEnd(new Date());
|
||||
const today = getDateStart(end);
|
||||
const beginMonth = new Date(today.getFullYear(), today.getMonth() - 1, 1, 0, 0, 0, 0);
|
||||
const lastDayOfBeginMonth = new Date(beginMonth.getFullYear(), beginMonth.getMonth() + 1, 0).getDate();
|
||||
const begin = new Date(beginMonth);
|
||||
begin.setDate(Math.min(today.getDate(), lastDayOfBeginMonth));
|
||||
return [formatDateTime(begin), formatDateTime(end)];
|
||||
}
|
||||
|
||||
function getDateStart(date: Date): Date {
|
||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
function getDateEnd(date: Date): Date {
|
||||
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);
|
||||
}
|
||||
|
||||
function formatDateTime(date: Date): string {
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||
}
|
||||
|
||||
function pad(value: number): string {
|
||||
return String(value).padStart(2, "0");
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
reload
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.gao-chart-page {
|
||||
// 卡片配色走变量,深色模式只改 .gao-chart-page 上的变量值
|
||||
--chart-bg: rgba(255, 255, 255, .92);
|
||||
--chart-shadow: var(--td-shadow-1);
|
||||
--chart-title: #0f172a;
|
||||
--chart-text: #7b889d;
|
||||
--chart-label: #52607a;
|
||||
|
||||
gap: 1rem;
|
||||
padding: calc(var(--tui-nav-height) + 1rem) 1rem 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// 分栏里顶部内边距由栏内导航负责
|
||||
&.embedded {
|
||||
padding: 0 1rem 1rem;
|
||||
}
|
||||
|
||||
.hero {
|
||||
padding: .25rem .25rem 0;
|
||||
|
||||
.eyebrow {
|
||||
color: var(--td-brand-color);
|
||||
font-size: .6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: .12em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: var(--chart-title);
|
||||
margin: .25rem 0 0;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--chart-text);
|
||||
margin: .375rem 0 0;
|
||||
font-size: .8125rem;
|
||||
}
|
||||
}
|
||||
|
||||
.summary {
|
||||
gap: .625rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
padding: .75rem .625rem;
|
||||
background: var(--chart-bg);
|
||||
box-shadow: var(--chart-shadow);
|
||||
border-radius: 1rem;
|
||||
|
||||
span {
|
||||
color: var(--chart-label);
|
||||
display: block;
|
||||
font-size: .75rem;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: var(--chart-title);
|
||||
margin-top: .25rem;
|
||||
display: block;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-list {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.two-columns {
|
||||
gap: 1rem;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
// 分栏窄容器:双列图表一律改单列
|
||||
&.compact {
|
||||
.two-columns {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.no-store {
|
||||
padding: 1.5rem 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark .gao-chart-page) {
|
||||
--chart-bg: rgba(15, 23, 42, .88);
|
||||
--chart-shadow: 0 .75rem 2rem rgba(2, 6, 23, .32);
|
||||
--chart-title: #e2e8f0;
|
||||
--chart-text: #94a3b8;
|
||||
--chart-label: #94a3b8;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user