|
@@ -1,11 +1,12 @@
|
|
import React, { useEffect, useState } from 'react';
|
|
import React, { useEffect, useState } from 'react';
|
|
-import { Button, Card, Form, Input, message, Modal, Space, Table } from 'antd';
|
|
|
|
|
|
+import { Button, Card, Form, Input, message, Modal, Select, Space, Table } from 'antd';
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
import moment from 'moment/moment';
|
|
import moment from 'moment/moment';
|
|
import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
|
|
import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
|
|
import Edit from '@/pages/cms/ArticleManagement/edit';
|
|
import Edit from '@/pages/cms/ArticleManagement/edit';
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
import { queryArticle, delArticle } from '@/services/cms/ArticleManagement';
|
|
import { queryArticle, delArticle } from '@/services/cms/ArticleManagement';
|
|
|
|
+import { queryColumn } from '@/services/cms/ColumnList';
|
|
|
|
|
|
interface DataType {
|
|
interface DataType {
|
|
title: string;
|
|
title: string;
|
|
@@ -25,7 +26,8 @@ const ArticleManagement: React.FC = () => {
|
|
const [visible, setVisible] = useState(false);
|
|
const [visible, setVisible] = useState(false);
|
|
const [editData, setEditData] = useState(null);
|
|
const [editData, setEditData] = useState(null);
|
|
const [pagination, setPagination] = useState({ total: 0, current: 1, pageSize: 10 });
|
|
const [pagination, setPagination] = useState({ total: 0, current: 1, pageSize: 10 });
|
|
- const [dataList, setDataList]: any = useState([]);
|
|
|
|
|
|
+ const [dataList, setDataList] = useState([]);
|
|
|
|
+ const [columnList, setColumnList] = useState([]);
|
|
|
|
|
|
// 获取列表数据
|
|
// 获取列表数据
|
|
const getList = () => {
|
|
const getList = () => {
|
|
@@ -44,9 +46,20 @@ const ArticleManagement: React.FC = () => {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // 获取栏目列表数据
|
|
|
|
+ const getColumnList = () => {
|
|
|
|
+ queryColumn({ q: 'list' }).then((res) => {
|
|
|
|
+ if (res && res.code === 0) {
|
|
|
|
+ setColumnList(res.data.list);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
setLoading(true);
|
|
setLoading(true);
|
|
getList();
|
|
getList();
|
|
|
|
+
|
|
|
|
+ getColumnList();
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
// 搜索
|
|
// 搜索
|
|
@@ -185,6 +198,19 @@ const ArticleManagement: React.FC = () => {
|
|
<Form.Item name="title" label="文章标题">
|
|
<Form.Item name="title" label="文章标题">
|
|
<Input placeholder="请输入文章标题" />
|
|
<Input placeholder="请输入文章标题" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
|
+ <Form.Item name="column_id" label="所属栏目">
|
|
|
|
+ <Select style={{ width: '175px' }} placeholder="请选择所属栏目">
|
|
|
|
+ {columnList && columnList.length
|
|
|
|
+ ? columnList.map((el: any) => {
|
|
|
|
+ return (
|
|
|
|
+ <Select.Option value={el.record_id} key={el.record_id}>
|
|
|
|
+ {el.name}
|
|
|
|
+ </Select.Option>
|
|
|
|
+ );
|
|
|
|
+ })
|
|
|
|
+ : null}
|
|
|
|
+ </Select>
|
|
|
|
+ </Form.Item>
|
|
<Form.Item style={{ marginBottom: '10px' }}>
|
|
<Form.Item style={{ marginBottom: '10px' }}>
|
|
<Space>
|
|
<Space>
|
|
<Button type="primary" htmlType="submit">
|
|
<Button type="primary" htmlType="submit">
|