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