style(frontend): 格式化前端代码以通过pre-push检查

This commit is contained in:
yml2213
2026-09-12 17:47:37 +08:00
parent fea82bff36
commit 111f400bdb
7 changed files with 58 additions and 29 deletions
@@ -1,4 +1,10 @@
import { DeleteOutlined, PlayCircleOutlined, ReloadOutlined, SearchOutlined, SettingOutlined } from '@ant-design/icons'
import {
DeleteOutlined,
PlayCircleOutlined,
ReloadOutlined,
SearchOutlined,
SettingOutlined,
} from '@ant-design/icons'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import {
App,
@@ -58,7 +64,6 @@ export default function ProductMatchPanel() {
const [savingRetention, setSavingRetention] = useState(false)
const [cleaningLogs, setCleaningLogs] = useState(false)
const shopsQuery = useQuery({
queryKey: ['admin-kuaishou-industry-shops', 'product-match'],
queryFn: fetchAdminKuaishouIndustryShops,
@@ -98,10 +103,10 @@ export default function ProductMatchPanel() {
useEffect(() => {
if (matchConfig) {
if (typeof matchConfig.maxMatchLogs === "number") {
if (typeof matchConfig.maxMatchLogs === 'number') {
setMaxLogs(matchConfig.maxMatchLogs)
}
if (typeof matchConfig.matchLogRetentionDays === "number") {
if (typeof matchConfig.matchLogRetentionDays === 'number') {
setRetentionDays(matchConfig.matchLogRetentionDays)
}
}
@@ -115,13 +120,13 @@ export default function ProductMatchPanel() {
maxMatchLogs: maxLogs,
matchLogRetentionDays: retentionDays,
})
message.success("匹配日志保留策略已保存并已执行清理")
message.success('匹配日志保留策略已保存并已执行清理')
await Promise.all([
queryClient.invalidateQueries({ queryKey: ["admin-worker-platform-product-match-config"] }),
queryClient.invalidateQueries({ queryKey: ["admin-worker-platform-product-match-logs"] }),
queryClient.invalidateQueries({ queryKey: ['admin-worker-platform-product-match-config'] }),
queryClient.invalidateQueries({ queryKey: ['admin-worker-platform-product-match-logs'] }),
])
} catch (error) {
message.error(error instanceof Error ? error.message : "保存配置失败")
message.error(error instanceof Error ? error.message : '保存配置失败')
} finally {
setSavingRetention(false)
}
@@ -139,10 +144,10 @@ export default function ProductMatchPanel() {
`成功清理 ${result.totalDeleted} 条历史匹配日志,剩余 ${result.remainingTotal} 条`,
)
await Promise.all([
queryClient.invalidateQueries({ queryKey: ["admin-worker-platform-product-match-logs"] }),
queryClient.invalidateQueries({ queryKey: ['admin-worker-platform-product-match-logs'] }),
])
} catch (error) {
message.error(error instanceof Error ? error.message : "清理日志失败")
message.error(error instanceof Error ? error.message : '清理日志失败')
} finally {
setCleaningLogs(false)
}
@@ -454,19 +459,19 @@ export default function ProductMatchPanel() {
</Space>
<div
style={{
display: "flex",
flexWrap: "wrap",
justifyContent: "space-between",
alignItems: "center",
display: 'flex',
flexWrap: 'wrap',
justifyContent: 'space-between',
alignItems: 'center',
gap: 12,
background: "#fafafa",
padding: "8px 12px",
background: '#fafafa',
padding: '8px 12px',
borderRadius: 6,
border: "1px solid #f0f0f0",
border: '1px solid #f0f0f0',
}}
>
<Space wrap align="center" size={8}>
<SettingOutlined style={{ color: "#1677ff" }} />
<SettingOutlined style={{ color: '#1677ff' }} />
<Typography.Text strong style={{ fontSize: 13 }}>
日志保留策略:
</Typography.Text>
@@ -943,15 +943,26 @@ export default function WorkOrdersPanel() {
</Typography.Text>
</Space>
<Space size={4} align="center">
<Typography.Text type="secondary" style={{ fontSize: 12 }}>工单号:</Typography.Text>
<Typography.Text copyable={{ text: row.workOrderNo || getDisplayOrderNo(row) }} style={{ fontSize: 12, fontWeight: 500 }}>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
工单号:
</Typography.Text>
<Typography.Text
copyable={{ text: row.workOrderNo || getDisplayOrderNo(row) }}
style={{ fontSize: 12, fontWeight: 500 }}
>
{row.workOrderNo || getDisplayOrderNo(row)}
</Typography.Text>
</Space>
{row.platformOrderId ? (
<Space size={4} align="center">
<Typography.Text type="secondary" style={{ fontSize: 12 }}>平台号:</Typography.Text>
<Typography.Text type="secondary" copyable={{ text: row.platformOrderId }} style={{ fontSize: 12 }}>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
平台号:
</Typography.Text>
<Typography.Text
type="secondary"
copyable={{ text: row.platformOrderId }}
style={{ fontSize: 12 }}
>
{row.platformOrderId}
</Typography.Text>
</Space>
@@ -208,7 +208,8 @@ export function PddPlatformPanel() {
})
const data = response?.data as AdminPddSyncResult | undefined
if (data) {
const pagesText = data.pagesFetched && data.pagesFetched > 1 ? `(自适应拉取 ${data.pagesFetched} 页)` : ""
const pagesText =
data.pagesFetched && data.pagesFetched > 1 ? `(自适应拉取 ${data.pagesFetched} 页)` : ''
showSuccess(
`店铺【${store.shopName}】同步完成${pagesText}:抓取 ${data.fetchedCount} 笔,入库/更新 ${data.upsertedCount} 笔`,
)
@@ -887,8 +888,10 @@ export function PddPlatformPanel() {
message={
<span>
当前拉单规则:默认抓取<strong>【{orderTypeDesc}】</strong>订单,单页拉取最新
<strong>【{config.pageSize || 50}】</strong>单;已启用<strong>【自适应翻页拉取】</strong>(上限
<strong>【{config.maxPages || 5}】</strong>页),当第 1 页全为新订单时自动向后翻页直至命中数据库已有订单,避免高峰期漏单。
<strong>【{config.pageSize || 50}】</strong>单;已启用
<strong>【自适应翻页拉取】</strong>(上限
<strong>【{config.maxPages || 5}】</strong>页),当第 1
页全为新订单时自动向后翻页直至命中数据库已有订单,避免高峰期漏单。
</span>
}
description="系统自动保存每家店铺上次 Cookie 的测活状态与时间戳。若在定时轮询或手动测试中检测到 Cookie 失效(或触发登录过期),系统将自动更新状态并向 Bark / Wpush 发送内部告警通知。"
@@ -264,7 +264,11 @@ function WorkerAfterSalesItem({
</Typography.Text>
</div>
<Space size={12} wrap className="worker-after-sales-item-meta">
<Typography.Text type="secondary" style={{ fontSize: 12 }} copyable={{ text: item.workOrderNo || item.caseNo }}>
<Typography.Text
type="secondary"
style={{ fontSize: 12 }}
copyable={{ text: item.workOrderNo || item.caseNo }}
>
工单号 {item.workOrderNo || item.caseNo}
</Typography.Text>
<Typography.Text
@@ -912,7 +912,9 @@ function resolveGrabDisabledReason(
return ''
}
function getDisplayOrderNo(order: Pick<WorkOrder, 'workOrderNo' | 'platformOrderId'> | null | undefined): string {
function getDisplayOrderNo(
order: Pick<WorkOrder, 'workOrderNo' | 'platformOrderId'> | null | undefined,
): string {
return String(order?.workOrderNo || order?.platformOrderId || '').trim() || '-'
}
@@ -142,7 +142,9 @@ export function WorkerProfileMobileLedgerRecords({
</div>
{row.note ? <div className="worker-profile-record-note">说明: {row.note}</div> : null}
{row.relatedWorkOrderNo || row.relatedPlatformOrderId ? (
<div className="worker-profile-record-sub">工单号 {row.relatedWorkOrderNo || row.relatedPlatformOrderId}</div>
<div className="worker-profile-record-sub">
工单号 {row.relatedWorkOrderNo || row.relatedPlatformOrderId}
</div>
) : null}
<div className="worker-profile-record-time">
{formatDateTime(String(row.createdAt || ''))}
@@ -200,7 +200,9 @@ export const workerLedgerColumns: TableColumnsType<WorkerWalletLedger> = [
<div className="cell-stack">
<Typography.Text>{row.note || '-'}</Typography.Text>
{row.relatedWorkOrderNo || row.relatedPlatformOrderId ? (
<Typography.Text type="secondary">工单号 {row.relatedWorkOrderNo || row.relatedPlatformOrderId}</Typography.Text>
<Typography.Text type="secondary">
工单号 {row.relatedWorkOrderNo || row.relatedPlatformOrderId}
</Typography.Text>
) : null}
</div>
),