|
@@ -1,9 +1,14 @@
|
|
|
import { useRef, useState } from "react";
|
|
|
-import { ActionType, ProColumns } from '@ant-design/pro-components';
|
|
|
+import { ActionType, ProColumns } from "@ant-design/pro-components";
|
|
|
import { ProTable } from "@ant-design/pro-components";
|
|
|
-import { Space, Tag, message, Popconfirm } from 'antd';
|
|
|
+import { Space, Tag, message, Popconfirm } from "antd";
|
|
|
import AddTemplateDrawer from "./AddTemplateDrawer";
|
|
|
-import { GetTemplateList, DeleteTemplate, OnMarketTemplate, OffMarketTemplate } from "@/api/templateStore";
|
|
|
+import {
|
|
|
+ GetTemplateList,
|
|
|
+ DeleteTemplate,
|
|
|
+ OnMarketTemplate,
|
|
|
+ OffMarketTemplate,
|
|
|
+} from "@/api/templateStore";
|
|
|
import { history } from "umi";
|
|
|
import { MODULE_TEMPLATE_TYPE } from "@/constants";
|
|
|
|
|
@@ -56,39 +61,39 @@ export default () => {
|
|
|
),
|
|
|
},
|
|
|
{
|
|
|
- title: '模版名称',
|
|
|
- dataIndex: 'name',
|
|
|
+ title: "模版名称",
|
|
|
+ dataIndex: "name",
|
|
|
copyable: true,
|
|
|
ellipsis: true,
|
|
|
},
|
|
|
{
|
|
|
- title: '作者',
|
|
|
- dataIndex: 'createByName',
|
|
|
+ title: "作者",
|
|
|
+ dataIndex: "createByName",
|
|
|
ellipsis: true,
|
|
|
search: false,
|
|
|
},
|
|
|
{
|
|
|
- title: '模版分类',
|
|
|
- dataIndex: 'type',
|
|
|
+ title: "模版分类",
|
|
|
+ dataIndex: "type",
|
|
|
copyable: true,
|
|
|
ellipsis: true,
|
|
|
valueType: "select",
|
|
|
fieldProps: {
|
|
|
- options: MODULE_TEMPLATE_TYPE
|
|
|
- }
|
|
|
+ options: MODULE_TEMPLATE_TYPE,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
disable: true,
|
|
|
- title: '标签',
|
|
|
- dataIndex: 'labels',
|
|
|
+ title: "标签",
|
|
|
+ dataIndex: "labels",
|
|
|
search: false,
|
|
|
renderFormItem: (_, { defaultRender }) => {
|
|
|
return defaultRender(_);
|
|
|
},
|
|
|
render: (_, record) => (
|
|
|
<Space>
|
|
|
- {record.tags?.split(',').map((tag: string) => (
|
|
|
- <Tag color='green' key={tag}>
|
|
|
+ {record.tags?.split(",").map((tag: string) => (
|
|
|
+ <Tag color="green" key={tag}>
|
|
|
{tag}
|
|
|
</Tag>
|
|
|
))}
|
|
@@ -118,8 +123,8 @@ export default () => {
|
|
|
),
|
|
|
},
|
|
|
{
|
|
|
- title: '使用量',
|
|
|
- dataIndex: 'useNum',
|
|
|
+ title: "使用量",
|
|
|
+ dataIndex: "useNum",
|
|
|
search: false,
|
|
|
},
|
|
|
{
|
|
@@ -195,37 +200,42 @@ export default () => {
|
|
|
actionRef={actionRef}
|
|
|
cardBordered
|
|
|
request={async (params, sort, filter) => {
|
|
|
- const isOnMarket = params?.isOnMarket === 'on' ? 1 : params?.isOnMarket === 'off' ? 0 : undefined;
|
|
|
+ const isOnMarket =
|
|
|
+ params?.isOnMarket === "on"
|
|
|
+ ? 1
|
|
|
+ : params?.isOnMarket === "off"
|
|
|
+ ? 0
|
|
|
+ : undefined;
|
|
|
const res = await GetTemplateList({
|
|
|
currentPage: params.current || 1,
|
|
|
pageSize: params.pageSize || 10,
|
|
|
filters: [
|
|
|
- {name: 'name', value: params?.name},
|
|
|
- {name: 'isFree', value: params?.isFree},
|
|
|
- {name: 'isOnMarket', value: isOnMarket},
|
|
|
- {name: 'isDel', value: 0},
|
|
|
- {name: 'type', value: params?.type}
|
|
|
- ]
|
|
|
+ { name: "name", value: params?.name },
|
|
|
+ { name: "isFree", value: params?.isFree },
|
|
|
+ { name: "isOnMarket", value: isOnMarket },
|
|
|
+ { name: "isDel", value: 0 },
|
|
|
+ { name: "type", value: params?.type },
|
|
|
+ ],
|
|
|
});
|
|
|
|
|
|
const data = res?.result || {};
|
|
|
-
|
|
|
+
|
|
|
return {
|
|
|
success: true,
|
|
|
data: data.model || [],
|
|
|
total: data.totalCount || 0,
|
|
|
- }
|
|
|
+ };
|
|
|
}}
|
|
|
columnsState={{
|
|
|
- persistenceKey: 'shalu-marketplace',
|
|
|
- persistenceType: 'localStorage',
|
|
|
+ persistenceKey: "shalu-marketplace",
|
|
|
+ persistenceType: "localStorage",
|
|
|
defaultValue: {
|
|
|
- option: { fixed: 'right', disable: true },
|
|
|
+ option: { fixed: "right", disable: true },
|
|
|
},
|
|
|
}}
|
|
|
rowKey="id"
|
|
|
search={{
|
|
|
- labelWidth: 'auto',
|
|
|
+ labelWidth: "auto",
|
|
|
}}
|
|
|
options={{
|
|
|
setting: {
|
|
@@ -236,7 +246,15 @@ export default () => {
|
|
|
pageSize: 10,
|
|
|
}}
|
|
|
dateFormatter="string"
|
|
|
- headerTitle={<AddTemplateDrawer onSuccess={() => {actionRef.current?.reload()}} editData={editData} />}
|
|
|
+ headerTitle={
|
|
|
+ <AddTemplateDrawer
|
|
|
+ onClose={() => setEditData(undefined)}
|
|
|
+ onSuccess={() => {
|
|
|
+ actionRef.current?.reload();
|
|
|
+ }}
|
|
|
+ editData={editData}
|
|
|
+ />
|
|
|
+ }
|
|
|
/>
|
|
|
);
|
|
|
-}
|
|
|
+};
|