From 37c7e2661437e9f254f49a426e7ac2402cd10b70 Mon Sep 17 00:00:00 2001 From: powersir <1576775122@qq.com> Date: Wed, 27 Sep 2023 22:34:46 +0800 Subject: [PATCH] add:shopee list --- src/layout/slide/menus.tsx | 2 +- src/models/template.data.ts | 12 ++ src/pages/custom/template/shopee/index.tsx | 215 +++++++++++++++++++++ src/pages/custom/template/xiapi/index.tsx | 9 - src/pages/system/dept/index.tsx | 30 +-- src/request/index.ts | 2 +- 6 files changed, 244 insertions(+), 26 deletions(-) create mode 100644 src/pages/custom/template/shopee/index.tsx delete mode 100644 src/pages/custom/template/xiapi/index.tsx diff --git a/src/layout/slide/menus.tsx b/src/layout/slide/menus.tsx index bb93845..8d5f9b9 100644 --- a/src/layout/slide/menus.tsx +++ b/src/layout/slide/menus.tsx @@ -49,7 +49,7 @@ const SlideMenu = () => { const treeMenuData = useCallback((menus: MenuType[]): ItemType[] => { return (menus).map((menu: MenuType) => { const children = menu?.children?.filter(menu => menu.visible) || []; - const type = ''//(children.length > 0 && (menu.parentPaths?.length??0 > 0)) ? 'group': '' + const type = (children.length > 0 && (menu.parentPaths?.length??0 > 0)) ? 'group': '' return { type: type, key: menu.path, diff --git a/src/models/template.data.ts b/src/models/template.data.ts index 55c8750..354253c 100644 --- a/src/models/template.data.ts +++ b/src/models/template.data.ts @@ -14,3 +14,15 @@ export interface DataDictDetailVO { label: string; value: string; } + + +export interface ShopeeTemplateVO { + id: number; + categoryName: string; + createName: string; + createTime: string; + platformCode: string; + remark: string; + shopName: string; + templateName: string; +} diff --git a/src/pages/custom/template/shopee/index.tsx b/src/pages/custom/template/shopee/index.tsx new file mode 100644 index 0000000..1f8fe1a --- /dev/null +++ b/src/pages/custom/template/shopee/index.tsx @@ -0,0 +1,215 @@ +import { Space, Table, Form, Button, Card, Input, TreeSelect } from 'antd'; +import type { ColumnsType } from 'antd/es/table'; +import { t } from '@/utils/i18n'; +import React, { useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { + ExclamationCircleFilled, + PlusOutlined, + CarryOutOutlined, + SearchOutlined, + UndoOutlined +} from '@ant-design/icons'; +import { antdUtils } from '@/utils/antd'; +import { ShopeeTemplateVO } from '@/models'; + +const treeData = [ + { + value: 'parent 1', + title: 'parent 1', + icon: , + children: [ + { + value: 'parent 1-0', + title: 'parent 1-0', + icon: , + children: [ + { + value: 'leaf1', + title: 'leaf1', + icon: , + }, + { + value: 'leaf2', + title: 'leaf2', + icon: , + }, + ], + }, + { + value: 'parent 1-1', + title: 'parent 1-1', + icon: , + children: [ + { + value: 'sss', + title: 'sss', + icon: , + }, + ], + }, + ], + }, +]; + +export default () => { + const data: ShopeeTemplateVO[] = [ + { + "id": 78, + "platformCode": "Shopee", + "shopName": "Trista", + "categoryName": "T-Shirts", + "templateName": "T-SHIRT", + "remark": "1", + "createName": "admin", + "createTime": "2023-06-15 14:45:15" + }, + { + "id": 77, + "platformCode": "Shopee", + "shopName": "Trista", + "categoryName": "T-Shirts", + "templateName": "T-SHIRT", + "remark": "1", + "createName": "admin", + "createTime": "2023-06-15 14:44:46" + }, + { + "id": 76, + "platformCode": "Shopee", + "shopName": "Trista", + "categoryName": "T-Shirts", + "templateName": "T-SHIRT", + "remark": "", + "createName": "admin", + "createTime": "2023-06-15 14:42:24" + } + ]; + + const showDeleteConfirm = (item: ShopeeTemplateVO) => { + antdUtils.modal?.confirm({ + title: `确认删除标题为: ${item.shopName} 的模板吗?`, + icon: , + content: `请注意删除以后不可恢复!`, + okText: '删除', + okType: 'danger', + cancelText: '取消', + onOk() { + return new Promise((resolve, reject) => { + setTimeout(() => { + antdUtils.message?.open({ + type: 'success', + content: '删除成功', + }); + resolve(null) + }, 1000); + + }).catch(() => antdUtils.message?.open({ + type: 'error', + content: '操作失败', + })); + }, + onCancel() { + }, + }); + }; + + const columns: ColumnsType = [ + { + title: '店铺', + dataIndex: 'shopName', + key: 'shopName', + }, + { + title: '模板名称', + dataIndex: 'templateName', + key: 'templateName', + }, + { + title: '类目', + key: 'categoryName', + dataIndex: 'categoryName' + }, + { + title: '备注', + dataIndex: 'remark', + key: 'remark', + }, + { + title: '创建人', + dataIndex: 'createName', + key: 'createName', + }, + { + title: '创建时间', + key: 'createTime', + dataIndex: 'createTime' + }, + { + title: t("QkOmYwne" /* 操作 */), + key: 'action', + render: (_, record) => ( + + { + }}>编辑 + { + }}>复制 + { + showDeleteConfirm(record) + }}>删除 + + ), + }, + ]; + + const [searchFrom] = Form.useForm(); + const navigate = useNavigate(); + + + const [treeLine, setTreeLine] = useState(true); + const [showLeafIcon, setShowLeafIcon] = useState(false); + const [showIcon, setShowIcon] = useState(false); + + return ( +
+
+ +
+
+
+ + + + + + +
+ + + + +
+
+ +
+
+
+ + + + + + ); +}; + diff --git a/src/pages/custom/template/xiapi/index.tsx b/src/pages/custom/template/xiapi/index.tsx deleted file mode 100644 index 1b1ec80..0000000 --- a/src/pages/custom/template/xiapi/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Empty } from 'antd'; - -const CustomMade = () => { - return ( - - ); -}; - -export default CustomMade; diff --git a/src/pages/system/dept/index.tsx b/src/pages/system/dept/index.tsx index 1042e12..3f8bb94 100644 --- a/src/pages/system/dept/index.tsx +++ b/src/pages/system/dept/index.tsx @@ -39,11 +39,11 @@ export default () => { cancelText: '取消', onOk() { return new Promise(async (resolve) => { - const [error, { code, msg} ] = await deleteApi({ id: data.id }); - if(error || code !== 0) { - antdUtils.message?.open({ type: 'error', content: msg??'操作失败'}) + const [error, { code, msg }] = await deleteApi({ id: data.id }); + if (error || code !== 0) { + antdUtils.message?.open({ type: 'error', content: msg ?? '操作失败' }) } else { - antdUtils.message?.open({ type: 'success', content: '删除成功'}) + antdUtils.message?.open({ type: 'success', content: '删除成功' }) } await load(); resolve('') @@ -109,16 +109,16 @@ export default () => { title: t("QkOmYwne" /* 操作 */), key: 'action', render: (value: DepartmentVO, record) => ( - )}> + )}> { - seEditData(value); - seEditorVisable(true); - }}> + seEditData(value); + seEditorVisable(true); + }}> 编辑 { - showDeleteConfirm(value) - }}> + showDeleteConfirm(value) + }}> 删除 @@ -141,7 +141,7 @@ export default () => {
-
+ @@ -160,9 +160,9 @@ export default () => {
+ seEditData(undefined); + seEditorVisable(true); + }}> 新增部门
@@ -172,7 +172,7 @@ export default () => { columns={columns} dataSource={dataSource} className='bg-transparent' - pagination={false}/> + pagination={false} /> ): Promise { - if (response.config.url !== refreshTokenUrl) { + if (!response.config.url?.startsWith(refreshTokenUrl)) { if(response.data && response.data.code && response.data.code === 401) { return new Promise((resolve) => { this.requestQueue.unshift({resolve, config: response.config, type: 'response'});