feat(platform): copy vehicle service detail links
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Banner, Button, Card, Descriptions, Form, Select, Space, Table, Tabs, Tag, Toast, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconRefresh, IconSearch } from '@douyinfe/semi-icons';
|
||||
import { IconCopy, IconRefresh, IconSearch } from '@douyinfe/semi-icons';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { api } from '../api/client';
|
||||
import type { QualityIssueRow, VehicleDetail as VehicleDetailData, VehicleSourceStatus } from '../api/types';
|
||||
@@ -46,6 +46,15 @@ function formatSeconds(value?: number) {
|
||||
return `${Math.round(value)} 秒`;
|
||||
}
|
||||
|
||||
async function copyVehicleServiceURL() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(`${window.location.origin}${window.location.pathname}${window.location.hash}`);
|
||||
Toast.success('已复制服务链接');
|
||||
} catch {
|
||||
Toast.error('复制服务链接失败');
|
||||
}
|
||||
}
|
||||
|
||||
export function VehicleDetail({
|
||||
vin,
|
||||
protocol,
|
||||
@@ -187,6 +196,7 @@ export function VehicleDetail({
|
||||
<Space>
|
||||
<Button icon={<IconSearch />} htmlType="submit" theme="solid" type="primary">查询车辆</Button>
|
||||
<Button icon={<IconRefresh />} onClick={() => load(query)} loading={loading}>刷新</Button>
|
||||
<Button icon={<IconCopy />} onClick={copyVehicleServiceURL}>复制服务链接</Button>
|
||||
<Button disabled={!hasResolvedVIN} onClick={() => onOpenHistory(resolvedVIN, activeProtocol)}>查看历史</Button>
|
||||
<Button disabled={!hasResolvedVIN} onClick={() => onOpenMileage(resolvedVIN, activeProtocol)}>查看里程</Button>
|
||||
</Space>
|
||||
|
||||
Reference in New Issue
Block a user