Commit 7ad07a39 authored by 成旭东's avatar 成旭东

fix

parent b9b3e90b
Pipeline #28003 passed with stage
in 2 minutes 3 seconds
...@@ -3,18 +3,21 @@ ...@@ -3,18 +3,21 @@
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
import { Card, Table, message, Button, Switch, Popconfirm, Drawer, Form, Input, InputNumber } from 'antd'; import { Card, Table, message, Button, Switch, Popconfirm, Drawer, Form, Input, InputNumber, Select } from 'antd';
import SearchForm from '@/components/SearchForm'; import SearchForm from '@/components/SearchForm';
import InputImages from '@/components/UploadMedia/InputImages'; import InputImages from '@/components/UploadMedia/InputImages';
import configData from './config'; import configData from './config';
import styles from './index.less'; import styles from './index.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { Option } = Select;
const DrawerForm = (props: any) => { const DrawerForm = (props: any) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const { const {
estateData,
getProjectList,
drawerFormOk, drawerFormOk,
drawerFormCancel, drawerFormCancel,
editeObj, editeObj,
...@@ -71,6 +74,16 @@ const DrawerForm = (props: any) => { ...@@ -71,6 +74,16 @@ const DrawerForm = (props: any) => {
}, },
}; };
const searchProject = (val: any) => {
if (val) {
getProjectList({
name: val,
});
} else {
getProjectList();
}
}
return ( return (
<> <>
<Form <Form
...@@ -89,7 +102,16 @@ const DrawerForm = (props: any) => { ...@@ -89,7 +102,16 @@ const DrawerForm = (props: any) => {
}, },
]} ]}
> >
<Input /> <Select
showSearch
onSearch={searchProject}
>
{estateData.list.map((item: any, index: any) => (
<Option key={index} value={item.id}>
{item.name}
</Option>
))}
</Select>
</FormItem> </FormItem>
<FormItem <FormItem
name="title" name="title"
...@@ -206,6 +228,43 @@ const VideoList: React.FC<any> = (props) => { ...@@ -206,6 +228,43 @@ const VideoList: React.FC<any> = (props) => {
}, },
}); });
const [estateData, setEstateData] = useState({
list: [],
pagination: {
pageSize: 10,
current: 1,
total: 0,
},
});
// 获取楼盘数据
const getProjectList = (params = {}) => {
const { dispatch } = props;
dispatch({
type: `estateList/fetchEstateList`,
payload: params,
callback: (ret: any) => {
if (ret.error) {
message.error(ret.error);
} else {
setEstateData({
list: ret.data,
pagination: {
pageSize: ret.size,
current: ret.page,
total: ret.total,
},
})
}
}
});
};
useEffect(() => {
getProjectList();
}, []);
// 获取数据 // 获取数据
const getPageList = (params = {}) => { const getPageList = (params = {}) => {
const { dispatch } = props; const { dispatch } = props;
...@@ -313,12 +372,22 @@ const VideoList: React.FC<any> = (props) => { ...@@ -313,12 +372,22 @@ const VideoList: React.FC<any> = (props) => {
// 编辑视频 // 编辑视频
const editeVideo = (obj: any) => { const editeVideo = (obj: any) => {
const currentEstateData = estateData.list.map((item: any) => item.id);
if (!currentEstateData.includes(obj.project_id)) {
getProjectList({
name: obj.project.name,
})
}
setEditeObj(obj); setEditeObj(obj);
setDrawerVisible(!drawerVisible); setDrawerVisible(!drawerVisible);
} }
// 新建视频 // 新建视频
const addEstateVideo = () => { const addEstateVideo = () => {
getProjectList();
setEditeObj({}); setEditeObj({});
setDrawerVisible(!drawerVisible); setDrawerVisible(!drawerVisible);
} }
...@@ -494,6 +563,8 @@ const VideoList: React.FC<any> = (props) => { ...@@ -494,6 +563,8 @@ const VideoList: React.FC<any> = (props) => {
destroyOnClose destroyOnClose
> >
<DrawerForm <DrawerForm
estateData={estateData}
getProjectList={getProjectList}
drawerFormOk={drawerFormOk} drawerFormOk={drawerFormOk}
drawerFormCancel={drawerFormCancel} drawerFormCancel={drawerFormCancel}
editeObj={editeObj} editeObj={editeObj}
...@@ -505,7 +576,8 @@ const VideoList: React.FC<any> = (props) => { ...@@ -505,7 +576,8 @@ const VideoList: React.FC<any> = (props) => {
); );
}; };
export default connect(({ videoList, loading }: any) => ({ export default connect(({ estateList, videoList, loading }: any) => ({
estateList,
videoList, videoList,
dataLoading: loading.effects['videoList/fetchVideoList'], dataLoading: loading.effects['videoList/fetchVideoList'],
updateLoading: loading.effects['videoList/updateEstateVideo'], updateLoading: loading.effects['videoList/updateEstateVideo'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment