查看修改
This commit is contained in:
@ -7,13 +7,21 @@ import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||
import MeetingReservation from '@/components/ElecBidEvaluation/MeetingReservation';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
const statusEnum = {
|
||||
//"状态:-1-待确认 0-未开启 1-进行中 2-已结束 3-已取消 4-结束未使用"
|
||||
'-1': { text: '待确认' },
|
||||
'0': { text: '未开启' },
|
||||
'1': { text: '进行中' },
|
||||
'2': { text: '已结束' },
|
||||
'3': { text: '已取消' },
|
||||
'4': { text: '结束未使用' },
|
||||
};
|
||||
const Index: React.FC<{}> = () => {
|
||||
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||
const [areaNameList, setAreaNameList] = useState<any>();
|
||||
const [areaList, setAreaList] = useState<any>();
|
||||
//预约id
|
||||
const [meetId, setMeetId] = useState<string>("");
|
||||
const [meetId, setMeetId] = useState<string>('');
|
||||
//预约弹窗
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
//刷新参数
|
||||
@ -25,41 +33,40 @@ const Index: React.FC<{}> = () => {
|
||||
}, []);
|
||||
const initAreaNameList = async () => {
|
||||
await roomList().then((res) => {
|
||||
if (res.success ==true) {
|
||||
if (res.success == true) {
|
||||
// let areaNameList: any[] = [];
|
||||
// console.log(res.data)
|
||||
// res.data.forEach((item: { areaName: string; id: string; }) => {
|
||||
// const tempDetail = { label: '', value: '', };
|
||||
// tempDetail.label = item.areaName;
|
||||
// tempDetail.value = item.id;
|
||||
// areaNameList.push(tempDetail);
|
||||
// })
|
||||
// res.data.forEach((item: { areaName: string; id: string; }) => {
|
||||
// const tempDetail = { label: '', value: '', };
|
||||
// tempDetail.label = item.areaName;
|
||||
// tempDetail.value = item.id;
|
||||
// areaNameList.push(tempDetail);
|
||||
// })
|
||||
let areaNameList = {};
|
||||
setAreaList(res.data);
|
||||
//将拿到的返回值遍历
|
||||
res.data.map((item: { id: string | number; areaName: any; })=>{
|
||||
res.data.map((item: { id: string | number; areaName: any }) => {
|
||||
//使用接口返回值的id做为 代替原本的0,1
|
||||
areaNameList[item.id]={
|
||||
//使用接口返回值中的overdueValue属性作为原本的text:后面的值
|
||||
areaNameList[item.id] = {
|
||||
//使用接口返回值中的overdueValue属性作为原本的text:后面的值
|
||||
text: item.areaName,
|
||||
}
|
||||
})
|
||||
setAreaNameList(areaNameList)
|
||||
};
|
||||
});
|
||||
setAreaNameList(areaNameList);
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
//查看预约
|
||||
//查看预约
|
||||
const viewMeet = (id: any) => {
|
||||
setMeetId(id);
|
||||
setModalVisible(true);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 取消预约
|
||||
* @param record
|
||||
*/
|
||||
const cancel = async (record: any) => {
|
||||
|
||||
cancelReserve(record.id).then(res => {
|
||||
cancelReserve(record.id).then((res) => {
|
||||
if (res.code == 200 && res.data) {
|
||||
message.success('预约取消成功');
|
||||
}
|
||||
@ -121,6 +128,14 @@ const Index: React.FC<{}> = () => {
|
||||
search: false,
|
||||
width: '10%',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: '10%',
|
||||
valueType: 'select',
|
||||
valueEnum: statusEnum,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: '7%',
|
||||
@ -128,7 +143,15 @@ const Index: React.FC<{}> = () => {
|
||||
render: (text: any, record: any) => {
|
||||
return (
|
||||
<>
|
||||
<Button hidden={ record.status > 0 } type="text" onClick={() => cancel(record)} danger>
|
||||
<Button type="text" onClick={() => viewMeet(record.id)} danger>
|
||||
查看
|
||||
</Button>
|
||||
<Button
|
||||
hidden={record.status > 0 && record.timeOut == '1'}
|
||||
type="text"
|
||||
onClick={() => cancel(record)}
|
||||
danger
|
||||
>
|
||||
取消预约
|
||||
</Button>
|
||||
</>
|
||||
@ -196,135 +219,151 @@ const Index: React.FC<{}> = () => {
|
||||
width: '7%',
|
||||
search: false,
|
||||
render: (text: any, record: any) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button type="text" onClick={() => viewMeet(record.id)} danger>
|
||||
查看
|
||||
</Button>
|
||||
<Button hidden={ record.status > 0 } type="text" onClick={() => cancel(record)} danger>
|
||||
<Button
|
||||
hidden={record.status > 0 && record.timeOut == '1'}
|
||||
type="text"
|
||||
onClick={() => cancel(record)}
|
||||
danger
|
||||
>
|
||||
取消预约
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
<Card title="预约管理">
|
||||
<Tabs defaultActiveKey="1">
|
||||
<TabPane tab="评标预约" key="1">
|
||||
{areaNameList && <ProTable
|
||||
actionRef={checkRelationRef}
|
||||
className="proSearch"
|
||||
columns={columns}
|
||||
params={{ reserveType: 'eval' }}
|
||||
size="small"
|
||||
request={async (params) =>
|
||||
await reserveList(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
return Promise.resolve({
|
||||
data: data.records,
|
||||
success: res.success,
|
||||
total: res.data.total,
|
||||
current: res.data.current,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
search={{
|
||||
filterType: 'query',
|
||||
optionRender: (searchConfig: any, { form }) => {
|
||||
return [
|
||||
<Button
|
||||
key="resetText"
|
||||
onClick={() => {
|
||||
form?.setFieldsValue({
|
||||
current: 1,
|
||||
<Tabs defaultActiveKey="1">
|
||||
<TabPane tab="评标预约" key="1">
|
||||
{areaNameList && (
|
||||
<ProTable
|
||||
actionRef={checkRelationRef}
|
||||
className="proSearch"
|
||||
columns={columns}
|
||||
params={{ reserveType: 'eval' }}
|
||||
size="small"
|
||||
request={async (params) =>
|
||||
await reserveList(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
return Promise.resolve({
|
||||
data: data.records,
|
||||
success: res.success,
|
||||
total: res.data.total,
|
||||
current: res.data.current,
|
||||
});
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.resetText}
|
||||
</Button>,
|
||||
<Button
|
||||
key="searchText"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.searchText}
|
||||
</Button>,
|
||||
];
|
||||
},
|
||||
labelWidth: 'auto',
|
||||
span: 4,
|
||||
}}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>}
|
||||
</TabPane>
|
||||
<TabPane tab="会议预约" key="2">
|
||||
{areaNameList && <ProTable
|
||||
className="proSearch"
|
||||
columns={otherColumns}
|
||||
params={{ reserveType: 'meeting' }}
|
||||
size="small"
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
span: 4,
|
||||
}}
|
||||
request={async (params) =>
|
||||
await reserveList(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
return Promise.resolve({
|
||||
data: data.records,
|
||||
success: res.success,
|
||||
total: res.data.total,
|
||||
current: res.data.current,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>}
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
{modalVisible && <MeetingReservation modalVisible={modalVisible} onCancel={() => { setModalVisible(false); }} roomList={areaList} status={'2'} meetId={meetId} onSubmit={() => { setModalVisible(false); setRefresh(refresh => refresh + 1) }} />}
|
||||
|
||||
search={{
|
||||
filterType: 'query',
|
||||
optionRender: (searchConfig: any, { form }) => {
|
||||
return [
|
||||
<Button
|
||||
key="resetText"
|
||||
onClick={() => {
|
||||
form?.setFieldsValue({
|
||||
current: 1,
|
||||
});
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.resetText}
|
||||
</Button>,
|
||||
<Button
|
||||
key="searchText"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.searchText}
|
||||
</Button>,
|
||||
];
|
||||
},
|
||||
labelWidth: 'auto',
|
||||
span: 4,
|
||||
}}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
)}
|
||||
</TabPane>
|
||||
<TabPane tab="会议预约" key="2">
|
||||
{areaNameList && (
|
||||
<ProTable
|
||||
className="proSearch"
|
||||
columns={otherColumns}
|
||||
params={{ reserveType: 'meeting' }}
|
||||
size="small"
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
span: 4,
|
||||
}}
|
||||
request={async (params) =>
|
||||
await reserveList(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
return Promise.resolve({
|
||||
data: data.records,
|
||||
success: res.success,
|
||||
total: res.data.total,
|
||||
current: res.data.current,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
)}
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
{modalVisible && (
|
||||
<MeetingReservation
|
||||
modalVisible={modalVisible}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
}}
|
||||
roomList={areaList}
|
||||
status={'2'}
|
||||
meetId={meetId}
|
||||
onSubmit={() => {
|
||||
setModalVisible(false);
|
||||
setRefresh((refresh) => refresh + 1);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Card>
|
||||
</>
|
||||
|
||||
);
|
||||
};
|
||||
export default Index
|
||||
|
Reference in New Issue
Block a user