|
@@ -6,7 +6,7 @@ import { Button, message, Modal, Image } from 'antd';
|
6
|
6
|
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
7
|
7
|
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons';
|
8
|
8
|
// import { getNoticeList, removeNotice, addNotice, updateNotice, exportNotice } from '@/services/system/notice';
|
9
|
|
-import { getSEOList, saveSEO} from '@/services/other/seo';
|
|
9
|
+import { getSEOList, saveSEO, setRelease ,setReleaseAll } from '@/services/other/seo';
|
10
|
10
|
import SEOForm from './edit';
|
11
|
11
|
import moment from 'moment';
|
12
|
12
|
import { KeepAlive } from 'react-activation';
|
|
@@ -19,17 +19,16 @@ const NoticeTableList: React.FC = () => {
|
19
|
19
|
const formTableRef = useRef<FormInstance>();
|
20
|
20
|
|
21
|
21
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
22
|
|
-
|
23
|
22
|
const actionRef = useRef<ActionType>();
|
24
|
23
|
const intl = useIntl();
|
25
|
24
|
const [currentRow, setCurrentRow] = useState<any>();
|
26
|
|
- const [enumList,setEnumList] = useState()
|
|
25
|
+ const [enumList, setEnumList] = useState()
|
27
|
26
|
|
28
|
27
|
useEffect(() => {
|
29
|
28
|
getEnum()
|
30
|
29
|
}, [])
|
31
|
30
|
|
32
|
|
- const getEnum = ()=>{
|
|
31
|
+ const getEnum = () => {
|
33
|
32
|
getDataEnumList({ enumUuid: '2024810214616101' }).then((res) => {
|
34
|
33
|
console.log(res.rows)
|
35
|
34
|
|
|
@@ -40,6 +39,49 @@ const NoticeTableList: React.FC = () => {
|
40
|
39
|
setEnumList(enumOptions); // 设置 enumList
|
41
|
40
|
})
|
42
|
41
|
}
|
|
42
|
+ const releaseAll = async () => {
|
|
43
|
+ try {
|
|
44
|
+ Modal.confirm({
|
|
45
|
+ title: '提示',
|
|
46
|
+ content: '确定发布吗?',
|
|
47
|
+ okText: '确认',
|
|
48
|
+ cancelText: '取消',
|
|
49
|
+ onOk: async () => {
|
|
50
|
+ const res = await setReleaseAll();
|
|
51
|
+ if (res.code == 200) {
|
|
52
|
+ message.success('发布成功')
|
|
53
|
+ } else {
|
|
54
|
+ message.error(res.msg || '发布失败')
|
|
55
|
+ }
|
|
56
|
+ },
|
|
57
|
+ });
|
|
58
|
+
|
|
59
|
+ } catch (error) {
|
|
60
|
+
|
|
61
|
+ }
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ const release = async (id) => {
|
|
65
|
+ try {
|
|
66
|
+ Modal.confirm({
|
|
67
|
+ title: '提示',
|
|
68
|
+ content: '确定发布吗?',
|
|
69
|
+ okText: '确认',
|
|
70
|
+ cancelText: '取消',
|
|
71
|
+ onOk: async () => {
|
|
72
|
+ const res = await setRelease(id);
|
|
73
|
+ if (res.code == 200) {
|
|
74
|
+ message.success('发布成功')
|
|
75
|
+ } else {
|
|
76
|
+ message.error(res.msg || '发布失败')
|
|
77
|
+ }
|
|
78
|
+ },
|
|
79
|
+ });
|
|
80
|
+
|
|
81
|
+ } catch (error) {
|
|
82
|
+
|
|
83
|
+ }
|
|
84
|
+ }
|
43
|
85
|
const columns: ProColumns<API.System.Notice>[] = [
|
44
|
86
|
{
|
45
|
87
|
title: '序号',
|
|
@@ -99,6 +141,15 @@ const NoticeTableList: React.FC = () => {
|
99
|
141
|
>
|
100
|
142
|
编辑
|
101
|
143
|
</Button>,
|
|
144
|
+ <Button
|
|
145
|
+ type="link"
|
|
146
|
+ size="small"
|
|
147
|
+ key="edit"
|
|
148
|
+
|
|
149
|
+ onClick={() => release(record.html)}
|
|
150
|
+ >
|
|
151
|
+ 发布
|
|
152
|
+ </Button>,
|
102
|
153
|
],
|
103
|
154
|
},
|
104
|
155
|
];
|
|
@@ -116,7 +167,14 @@ const NoticeTableList: React.FC = () => {
|
116
|
167
|
labelWidth: 120,
|
117
|
168
|
}}
|
118
|
169
|
toolBarRender={() => [
|
119
|
|
-
|
|
170
|
+
|
|
171
|
+ <Button
|
|
172
|
+ type="primary"
|
|
173
|
+ key="fabu"
|
|
174
|
+ onClick={() => releaseAll()}
|
|
175
|
+ >
|
|
176
|
+ 全量发布
|
|
177
|
+ </Button>
|
120
|
178
|
]}
|
121
|
179
|
request={(params) => {
|
122
|
180
|
return getSEOList({ ...params } as API.System.NoticeListParams).then((res) => {
|
|
@@ -135,6 +193,7 @@ const NoticeTableList: React.FC = () => {
|
135
|
193
|
}
|
136
|
194
|
}
|
137
|
195
|
columns={columns}
|
|
196
|
+
|
138
|
197
|
/>
|
139
|
198
|
</div>
|
140
|
199
|
<SEOForm
|
|
@@ -143,7 +202,7 @@ const NoticeTableList: React.FC = () => {
|
143
|
202
|
if (currentRow) {
|
144
|
203
|
values.uuid = currentRow.uuid;
|
145
|
204
|
}
|
146
|
|
-
|
|
205
|
+
|
147
|
206
|
success = await saveSEO({ ...values });
|
148
|
207
|
if (success) {
|
149
|
208
|
setModalVisible(false);
|