docs: 移除代码中的中文注释标记
This commit is contained in:
parent
1d0cddf901
commit
3614efef1e
|
|
@ -4,7 +4,7 @@ import { DrawerForm, ProFormText, ProFormSelect, ProFormSwitch } from '@ant-desi
|
|||
import { Button, message, Popconfirm, Space, Tag } from 'antd';
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
// 中文注释:站点数据项类型(前端不包含密钥字段,后端列表不返回密钥)
|
||||
// 站点数据项类型(前端不包含密钥字段,后端列表不返回密钥)
|
||||
interface SiteItem {
|
||||
id: number;
|
||||
siteName: string;
|
||||
|
|
@ -14,14 +14,14 @@ interface SiteItem {
|
|||
isDisabled: number;
|
||||
}
|
||||
|
||||
// 中文注释:创建/更新表单的值类型,包含可选的密钥字段
|
||||
// 创建/更新表单的值类型,包含可选的密钥字段
|
||||
interface SiteFormValues {
|
||||
siteName: string;
|
||||
apiUrl?: string;
|
||||
type?: 'woocommerce' | 'shopyy';
|
||||
isDisabled?: boolean;
|
||||
consumerKey?: string; // 中文注释:WooCommerce REST API 的 consumer key
|
||||
consumerSecret?: string; // 中文注释:WooCommerce REST API 的 consumer secret
|
||||
consumerKey?: string; // WooCommerce REST API 的 consumer key
|
||||
consumerSecret?: string; // WooCommerce REST API 的 consumer secret
|
||||
skuPrefix?: string;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ const SiteList: React.FC = () => {
|
|||
}
|
||||
}, [open, editing]);
|
||||
|
||||
// 中文注释:表格列定义
|
||||
// 表格列定义
|
||||
const columns: ProColumns<SiteItem>[] = [
|
||||
{ title: 'ID', dataIndex: 'id', width: 80, sorter: true, hideInSearch: true },
|
||||
{ title: '站点名称', dataIndex: 'siteName', width: 220 },
|
||||
|
|
@ -124,7 +124,7 @@ const SiteList: React.FC = () => {
|
|||
},
|
||||
];
|
||||
|
||||
// 中文注释:表格数据请求
|
||||
// 表格数据请求
|
||||
const tableRequest = async (params: Record<string, any>) => {
|
||||
try {
|
||||
const { current = 1, pageSize = 10, siteName, type } = params;
|
||||
|
|
@ -150,19 +150,19 @@ const SiteList: React.FC = () => {
|
|||
}
|
||||
};
|
||||
|
||||
// 中文注释:提交创建/更新逻辑;编辑时未填写密钥则不提交(保持原值)
|
||||
// 提交创建/更新逻辑;编辑时未填写密钥则不提交(保持原值)
|
||||
const handleSubmit = async (values: SiteFormValues) => {
|
||||
try {
|
||||
if (editing) {
|
||||
const payload: Record<string, any> = {
|
||||
// 中文注释:仅提交存在的字段,避免覆盖为 null/空
|
||||
// 仅提交存在的字段,避免覆盖为 null/空
|
||||
...(values.siteName ? { siteName: values.siteName } : {}),
|
||||
...(values.apiUrl ? { apiUrl: values.apiUrl } : {}),
|
||||
...(values.type ? { type: values.type } : {}),
|
||||
...(typeof values.isDisabled === 'boolean' ? { isDisabled: values.isDisabled } : {}),
|
||||
...(values.skuPrefix ? { skuPrefix: values.skuPrefix } : {}),
|
||||
};
|
||||
// 中文注释:仅当输入了新密钥时才提交,未输入则保持原本值
|
||||
// 仅当输入了新密钥时才提交,未输入则保持原本值
|
||||
if (values.consumerKey && values.consumerKey.trim()) {
|
||||
payload.consumerKey = values.consumerKey.trim();
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ const SiteList: React.FC = () => {
|
|||
}
|
||||
await request(`/site/update/${editing.id}`, { method: 'PUT', data: payload });
|
||||
} else {
|
||||
// 中文注释:新增站点时要求填写 consumerKey 和 consumerSecret
|
||||
// 新增站点时要求填写 consumerKey 和 consumerSecret
|
||||
if (!values.consumerKey || !values.consumerSecret) {
|
||||
throw new Error('Consumer Key and Secret are required');
|
||||
}
|
||||
|
|
@ -226,11 +226,11 @@ const SiteList: React.FC = () => {
|
|||
formRef={formRef}
|
||||
onFinish={handleSubmit}
|
||||
>
|
||||
{/* 中文注释:站点名称,必填 */}
|
||||
{/* 站点名称,必填 */}
|
||||
<ProFormText name="siteName" label="站点名称" placeholder="例如:本地商店" rules={[{ required: true, message: '站点名称为必填项' }]} />
|
||||
{/* 中文注释:API 地址,可选 */}
|
||||
{/* API 地址,可选 */}
|
||||
<ProFormText name="apiUrl" label="API 地址" placeholder="例如:https://shop.example.com" />
|
||||
{/* 中文注释:平台类型选择 */}
|
||||
{/* 平台类型选择 */}
|
||||
<ProFormSelect
|
||||
name="type"
|
||||
label="平台"
|
||||
|
|
@ -239,12 +239,12 @@ const SiteList: React.FC = () => {
|
|||
{ label: 'Shopyy', value: 'shopyy' },
|
||||
]}
|
||||
/>
|
||||
{/* 中文注释:是否禁用 */}
|
||||
{/* 是否禁用 */}
|
||||
<ProFormSwitch name="isDisabled" label="禁用" />
|
||||
<ProFormText name="skuPrefix" label="SKU 前缀" placeholder={editing ? '留空表示不修改' : '可选'} />
|
||||
{/* 中文注释:WooCommerce REST consumer key;新增必填,编辑不填则保持原值 */}
|
||||
{/* WooCommerce REST consumer key;新增必填,编辑不填则保持原值 */}
|
||||
<ProFormText name="consumerKey" label="Key" placeholder={editing ? '留空表示不修改' : '必填'} rules={editing ? [] : [{ required: true, message: 'Key 为必填项' }]} />
|
||||
{/* 中文注释:WooCommerce REST consumer secret;新增必填,编辑不填则保持原值 */}
|
||||
{/* WooCommerce REST consumer secret;新增必填,编辑不填则保持原值 */}
|
||||
<ProFormText name="consumerSecret" label="Secret" placeholder={editing ? '留空表示不修改' : '必填'} rules={editing ? [] : [{ required: true, message: 'Secret 为必填项' }]} />
|
||||
</DrawerForm>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -27,21 +27,21 @@ import { formatShipmentState, formatSource } from '@/utils/format';
|
|||
import RelatedOrders from './RelatedOrders';
|
||||
import { ORDER_STATUS_ENUM } from '@/constants';
|
||||
|
||||
// 中文注释:为保持原文件结构简单,此处从 index.tsx 引入的子组件仍由原文件导出或保持原状
|
||||
// 为保持原文件结构简单,此处从 index.tsx 引入的子组件仍由原文件导出或保持原状
|
||||
// 若后续需要彻底解耦,可将 OrderNote / Shipping / SalesChange 也独立到文件
|
||||
// 当前按你的要求仅抽离详情 Drawer
|
||||
|
||||
type OrderRecord = API.Order;
|
||||
|
||||
interface OrderDetailDrawerProps {
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>; // 中文注释:列表刷新引用
|
||||
orderId: number; // 中文注释:订单主键 ID
|
||||
record: OrderRecord; // 中文注释:订单行记录
|
||||
open: boolean; // 中文注释:是否打开抽屉
|
||||
onClose: () => void; // 中文注释:关闭抽屉回调
|
||||
setActiveLine: (id: number) => void; // 中文注释:高亮当前行
|
||||
OrderNoteComponent: React.ComponentType<any>; // 中文注释:备注组件(从外部注入)
|
||||
SalesChangeComponent: React.ComponentType<any>; // 中文注释:换货组件(从外部注入)
|
||||
tableRef: React.MutableRefObject<ActionType | undefined>; // 列表刷新引用
|
||||
orderId: number; // 订单主键 ID
|
||||
record: OrderRecord; // 订单行记录
|
||||
open: boolean; // 是否打开抽屉
|
||||
onClose: () => void; // 关闭抽屉回调
|
||||
setActiveLine: (id: number) => void; // 高亮当前行
|
||||
OrderNoteComponent: React.ComponentType<any>; // 备注组件(从外部注入)
|
||||
SalesChangeComponent: React.ComponentType<any>; // 换货组件(从外部注入)
|
||||
}
|
||||
|
||||
const OrderDetailDrawer: React.FC<OrderDetailDrawerProps> = ({
|
||||
|
|
@ -57,7 +57,7 @@ const OrderDetailDrawer: React.FC<OrderDetailDrawerProps> = ({
|
|||
const { message } = App.useApp();
|
||||
const ref = useRef<ActionType>();
|
||||
|
||||
// 中文注释:加载详情数据(与 index.tsx 中完全保持一致)
|
||||
// 加载详情数据(与 index.tsx 中完全保持一致)
|
||||
const initRequest = async () => {
|
||||
const { data, success }: API.OrderDetailRes = await ordercontrollerGetorderdetail({ orderId });
|
||||
if (!success || !data) return { data: {} } as any;
|
||||
|
|
@ -84,7 +84,7 @@ const OrderDetailDrawer: React.FC<OrderDetailDrawerProps> = ({
|
|||
size="large"
|
||||
onClose={onClose}
|
||||
footer={[
|
||||
// 中文注释:备注组件(外部传入以避免循环依赖)
|
||||
// 备注组件(外部传入以避免循环依赖)
|
||||
<OrderNoteComponent key="order-note" id={orderId} descRef={ref} />,
|
||||
...(['after_sale_pending', 'pending_reshipment'].includes(
|
||||
record.orderStatus,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ dayjs.extend(relativeTime);
|
|||
/**
|
||||
* RelatedOrders 表格组件
|
||||
* 用于展示订单详情中的关联数据(订阅/订单),按统一表格样式渲染
|
||||
* 中文注释:本组件将订阅与订单统一归一化为五列展示,便于快速浏览
|
||||
* 本组件将订阅与订单统一归一化为五列展示,便于快速浏览
|
||||
*/
|
||||
const RelatedOrders: React.FC<{ data?: any[] }> = ({ data = [] }) => {
|
||||
const rows = (Array.isArray(data) ? data : []).map((it: any) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue