取消预约、设备管理
This commit is contained in:
240
src/pages/Device/index.tsx
Normal file
240
src/pages/Device/index.tsx
Normal file
@ -0,0 +1,240 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Button, Tabs, PageHeader,message } from 'antd';
|
||||
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||
import { reserveList, roomList, cancelReserve } from './service';
|
||||
import '@/assets/ld_style.less';
|
||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||
import { btnAuthority } from '@/utils/authority';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
const Index: React.FC<{}> = () => {
|
||||
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||
|
||||
const [areaNameList, setAreaNameList] = useState({});
|
||||
/*拉取数据*/
|
||||
useEffect(() => {
|
||||
initAreaNameList();
|
||||
}, []);
|
||||
const initAreaNameList = async () => {
|
||||
await roomList().then((res) => {
|
||||
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);
|
||||
// })
|
||||
let areaNameList = {};
|
||||
//将拿到的返回值遍历
|
||||
res.data.map((item: { id: string | number; areaName: any; })=>{
|
||||
//使用接口返回值的id做为 代替原本的0,1
|
||||
areaNameList[item.id]={
|
||||
//使用接口返回值中的overdueValue属性作为原本的text:后面的值
|
||||
text: item.areaName,
|
||||
}
|
||||
})
|
||||
setAreaNameList(areaNameList)
|
||||
}
|
||||
})
|
||||
};
|
||||
/**
|
||||
* 取消预约
|
||||
* @param record
|
||||
*/
|
||||
const cancel = async (record: any) => {
|
||||
|
||||
cancelReserve(record.id).then(res => {
|
||||
if (res.code == 200 && res.data) {
|
||||
message.success('预约取消成功');
|
||||
}
|
||||
});
|
||||
};
|
||||
const current = getURLInformation('current');
|
||||
|
||||
|
||||
const columns: any[] = [
|
||||
//会议室预约
|
||||
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
valueType: 'index',
|
||||
search: false,
|
||||
width: '3%',
|
||||
},
|
||||
{
|
||||
title: '评标场所名称',
|
||||
dataIndex: 'reserveBy',
|
||||
width: '10%',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '评标区域名称',
|
||||
dataIndex: 'reserveBy',
|
||||
width: '10%',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
dataIndex: 'reserveBy',
|
||||
width: '10%',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'meetingName',
|
||||
search: true,
|
||||
width: '10%',
|
||||
},
|
||||
{
|
||||
title: '设备标识',
|
||||
dataIndex: 'meetingName',
|
||||
search: true,
|
||||
width: '10%',
|
||||
},
|
||||
|
||||
{
|
||||
title: '网络IP',
|
||||
dataIndex: 'meetingName',
|
||||
search: true,
|
||||
width: '10%',
|
||||
},
|
||||
{
|
||||
title: '设备状态',
|
||||
dataIndex: 'reserveBy',
|
||||
width: '10%',
|
||||
search: true,
|
||||
},
|
||||
|
||||
{
|
||||
title: '操作',
|
||||
width: '7%',
|
||||
search: false,
|
||||
render: (text: any, record: any) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button type="text" onClick={() => cancel(record)} danger>
|
||||
编辑
|
||||
</Button>
|
||||
<Button type="text" onClick={() => cancel(record)} danger>
|
||||
删除
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="预约管理" />
|
||||
|
||||
<Tabs defaultActiveKey="1">
|
||||
<TabPane tab="评标预约" key="1">
|
||||
<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,
|
||||
});
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.resetText}
|
||||
</Button>,
|
||||
<Button
|
||||
key="searchText"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchConfig?.searchText}
|
||||
</Button>,
|
||||
];
|
||||
},
|
||||
}}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
</TabPane>
|
||||
<TabPane tab="会议预约" key="2">
|
||||
<ProTable
|
||||
className="proSearch"
|
||||
columns={otherColumns}
|
||||
params={{ reserveType: 'meeting' }}
|
||||
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,
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Index
|
||||
|
||||
|
17
src/pages/Device/service.ts
Normal file
17
src/pages/Device/service.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export async function reserveList(data: any) { // 查询会议室/评标室预约情况
|
||||
return request('/v1/eval/room/reserve/list', {
|
||||
method: 'post',
|
||||
data: {...data,pageNo: data.current}
|
||||
});
|
||||
}
|
||||
|
||||
export async function roomList() { // 查询评标室列表
|
||||
///api/biz-service-ebtp-evaluation
|
||||
return request('/v1/elec/eval/room/list', {
|
||||
method: 'get',
|
||||
params: {}
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Button, Tabs, PageHeader } from 'antd';
|
||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||
import { reserveList, roomList } from './service';
|
||||
import { Button, Tabs, PageHeader,message } from 'antd';
|
||||
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||
import { reserveList, roomList, cancelReserve } from './service';
|
||||
import '@/assets/ld_style.less';
|
||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||
import { btnAuthority } from '@/utils/authority';
|
||||
@ -39,11 +39,23 @@ const Index: React.FC<{}> = () => {
|
||||
setAreaNameList(areaNameList)
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 取消预约
|
||||
* @param record
|
||||
*/
|
||||
const cancel = async (record: any) => {
|
||||
|
||||
cancelReserve(record.id).then(res => {
|
||||
if (res.code == 200 && res.data) {
|
||||
message.success('预约取消成功');
|
||||
}
|
||||
});
|
||||
};
|
||||
const current = getURLInformation('current');
|
||||
|
||||
const columns: any = [
|
||||
// 我参与的项目
|
||||
// 评标室
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
@ -53,7 +65,7 @@ const Index: React.FC<{}> = () => {
|
||||
},
|
||||
{
|
||||
title: '评标室',
|
||||
dataIndex: 'areaId',
|
||||
dataIndex: 'areaName',
|
||||
valueType: 'select',
|
||||
valueEnum: areaNameList,
|
||||
search: true,
|
||||
@ -93,7 +105,7 @@ const Index: React.FC<{}> = () => {
|
||||
},
|
||||
{
|
||||
title: '标段名称',
|
||||
dataIndex: 'sectionNames',
|
||||
dataIndex: 'packageNames',
|
||||
search: false,
|
||||
width: '10%',
|
||||
},
|
||||
@ -104,7 +116,7 @@ const Index: React.FC<{}> = () => {
|
||||
render: (text: any, record: any) => {
|
||||
return (
|
||||
<>
|
||||
<Button hidden={btnAuthority(['ebtp-supplier'])} type="text" onClick={() => {}} danger>
|
||||
<Button hidden={ record.status > 0 } type="text" onClick={() => cancel(record)} danger>
|
||||
取消预约
|
||||
</Button>
|
||||
</>
|
||||
@ -123,11 +135,17 @@ const Index: React.FC<{}> = () => {
|
||||
width: '3%',
|
||||
},
|
||||
{
|
||||
title: '会议室名称',
|
||||
dataIndex: 'areaName',
|
||||
title: '会议名称',
|
||||
dataIndex: 'meetingName',
|
||||
search: true,
|
||||
width: '10%',
|
||||
},
|
||||
{
|
||||
title: '会议人数',
|
||||
dataIndex: 'numberInMeeting',
|
||||
width: '5%',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '预约开始时间',
|
||||
dataIndex: 'reserveStartDate',
|
||||
@ -157,13 +175,17 @@ const Index: React.FC<{}> = () => {
|
||||
width: '7%',
|
||||
search: false,
|
||||
render: (text: any, record: any) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button hidden={btnAuthority(['ebtp-supplier'])} type="text" onClick={() => {}} danger>
|
||||
<Button hidden={ record.status > 0 } type="text" onClick={() => cancel(record)} danger>
|
||||
取消预约
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -259,7 +281,11 @@ const Index: React.FC<{}> = () => {
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{ defaultPageSize: 10, showSizeChanger: false }} //默认显示条数
|
||||
pagination={{
|
||||
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||
defaultPageSize: 10,
|
||||
showSizeChanger: false,
|
||||
}} //默认显示条数
|
||||
toolBarRender={false}
|
||||
/>
|
||||
</TabPane>
|
||||
|
@ -18,7 +18,7 @@ export async function roomList() { // 查询评标室列表
|
||||
|
||||
export async function cancelReserve(id: any) { // 取消预约
|
||||
///api/biz-service-ebtp-evaluation
|
||||
return request('/v1/eval/room/reserve/cancel'+`${id}`, {
|
||||
return request('/v1/eval/room/reserve/cancel/'+`${id}`, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user