Merge branch 'master-电子评标室-预约管理-liuh' into 'release_electronic_bid_evaluation_room'
8.26 电子评标室 预约管理 liuh See merge request eshop/fe_service_ebtp_frontend!246
This commit is contained in:
@ -17,6 +17,31 @@ export default {
|
|||||||
// changeOrigin: true,
|
// changeOrigin: true,
|
||||||
// pathRewrite: { '^': '' },
|
// pathRewrite: { '^': '' },
|
||||||
// },
|
// },
|
||||||
|
'/v1/elec/eval/placearea/list': { // /v1/elec/eval/placearea/uset/list
|
||||||
|
target: 'http://localhost:18017', //连接天宫的ng
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
|
'/v1/eval/device/queryPageByParam': {
|
||||||
|
target: 'http://localhost:18017', //连接天宫的ng
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
|
'/v1/eval/room/reserve/cancel': {
|
||||||
|
target: 'http://localhost:18017',//连接本地
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
|
'/v1/eval/room/reserve/list': {
|
||||||
|
target: 'http://localhost:18017',//连接本地
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
|
'/v1/elec/eval/room/list': {
|
||||||
|
target: 'http://localhost:18017',//连接本地
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
'/api/*': {
|
'/api/*': {
|
||||||
target: 'http://10.242.31.158:18022',//连接天宫的ng
|
target: 'http://10.242.31.158:18022',//连接天宫的ng
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
|
@ -129,6 +129,16 @@ export default [
|
|||||||
path: '/',
|
path: '/',
|
||||||
redirect: '/userexpert/login',
|
redirect: '/userexpert/login',
|
||||||
},
|
},
|
||||||
|
{//设备管理
|
||||||
|
name: 'Device',
|
||||||
|
path: '/Device',
|
||||||
|
component: './Device',
|
||||||
|
},
|
||||||
|
{//评标室查看预约
|
||||||
|
name: 'ElecEvalReserve',
|
||||||
|
path: '/ElecEvalReserve',
|
||||||
|
component: './ElecEvalReserve',
|
||||||
|
},
|
||||||
...home,//各角色主页
|
...home,//各角色主页
|
||||||
...menuaZhaoBiao,//项目菜单所有路由
|
...menuaZhaoBiao,//项目菜单所有路由
|
||||||
{
|
{
|
||||||
|
162
src/pages/Device/DeviceForm.tsx
Normal file
162
src/pages/Device/DeviceForm.tsx
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
import { Form, Input, Modal, Select, Spin } from "antd"
|
||||||
|
import React, { useEffect, useState } from "react"
|
||||||
|
import { getDeviceById } from "./service";
|
||||||
|
|
||||||
|
|
||||||
|
interface DeviceFormProps {
|
||||||
|
modalVisible: boolean;
|
||||||
|
titleName: string;
|
||||||
|
onCancel: () => void;
|
||||||
|
status: string;//状态 0-新建 1-编辑 2-查看
|
||||||
|
type: string;
|
||||||
|
tpId: string;
|
||||||
|
deviceId: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
const deviceTypeEnum = {
|
||||||
|
'resource_door': { text: '门禁点' },
|
||||||
|
'resource_camera': { text: '监控点' },
|
||||||
|
'resource_nvr': { text: 'nvr' },
|
||||||
|
'resource_encodeDevice': { text: '编码设备' },
|
||||||
|
'resource_oneMachine': { text: '门禁一体机' },
|
||||||
|
}
|
||||||
|
const layout = {
|
||||||
|
labelCol: { span: 7 },
|
||||||
|
wrapperCol: { span: 10 },
|
||||||
|
};
|
||||||
|
const DeviceForm: React.FC<DeviceFormProps> = (props) => {
|
||||||
|
|
||||||
|
const { titleName, modalVisible, onCancel, type, tpId, deviceId } = props;
|
||||||
|
const [spinning, setSping] = useState<boolean>();//加载遮罩
|
||||||
|
const [editInformation, setEditInformation] = useState<boolean>(false);//是否可编
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
//窗口状态 0-新建 1-编辑 2-查看
|
||||||
|
const [modalStatus, setModalStatus] = useState<string | undefined>(status);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
Int();
|
||||||
|
form.resetFields();//清除form中数据
|
||||||
|
}, [type, deviceId]);
|
||||||
|
const Int = () => {
|
||||||
|
|
||||||
|
setSping(true);
|
||||||
|
if (type == "new") {//==========================================================新建
|
||||||
|
|
||||||
|
setSping(false);
|
||||||
|
setEditInformation(false);//可编辑
|
||||||
|
|
||||||
|
} else if (type == "edit") {//=========================================================修改
|
||||||
|
console.log(deviceId);
|
||||||
|
getDeviceById(deviceId).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const data = res.data;
|
||||||
|
|
||||||
|
form.setFieldsValue({
|
||||||
|
"id": data.id,
|
||||||
|
"deviceName": data.deviceName,
|
||||||
|
"deviceManagementIp": data.deviceManagementIp,
|
||||||
|
"deviceCode": data.deviceCode,
|
||||||
|
"devicePlatform": data.devicePlatform,
|
||||||
|
"placeId": data.placeId,
|
||||||
|
"areaId": data.areaId,
|
||||||
|
});
|
||||||
|
setSping(false);
|
||||||
|
setEditInformation(false);//可编辑
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} else if (type == "read") {//=========================================================查看
|
||||||
|
getDeviceById(deviceId).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const data = res.data;
|
||||||
|
|
||||||
|
form.setFieldsValue({
|
||||||
|
"id": data.id,
|
||||||
|
"deviceName": data.deviceName,
|
||||||
|
"deviceManagementIp": data.deviceManagementIp,
|
||||||
|
"deviceCode": data.deviceCode,
|
||||||
|
"devicePlatform": data.devicePlatform,
|
||||||
|
"placeId": data.placeId,
|
||||||
|
"areaId": data.areaId,
|
||||||
|
})
|
||||||
|
|
||||||
|
setSping(false);
|
||||||
|
setEditInformation(true)
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
mask={true}
|
||||||
|
destroyOnClose
|
||||||
|
title={titleName}
|
||||||
|
visible={modalVisible}
|
||||||
|
onCancel={() => onCancel()}
|
||||||
|
className="返回"
|
||||||
|
width={"60%"}
|
||||||
|
/*style={{top: "2%", height: "96%", overflowY: "auto"}}
|
||||||
|
bodyStyle={{paddingTop: "16px"}}*/
|
||||||
|
centered
|
||||||
|
|
||||||
|
>
|
||||||
|
<Spin spinning={spinning}>
|
||||||
|
<Form
|
||||||
|
{...layout}
|
||||||
|
name="basic"
|
||||||
|
form={form}
|
||||||
|
>
|
||||||
|
<Form.Item name="id" label="设备id" hidden>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="placeId" label="评标场所" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="评标场所" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="areaId" label="评标区域" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="评标区域" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="devicePlatform" label="管理平台" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="管理平台" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="deviceType" label="设备类型" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Select
|
||||||
|
placeholder="选择设备类型"
|
||||||
|
allowClear
|
||||||
|
disabled={modalStatus == "2"}
|
||||||
|
>
|
||||||
|
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="deviceName" label="设备名称" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="设备名称" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="deviceManagementIp" label="网络IP" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="网络IP" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item name="deviceCode" label="设备标识" rules={[{ required: !(modalStatus == "2") }]}>
|
||||||
|
<Input placeholder="设备标识" disabled={modalStatus == "2"} maxLength={50} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
</Form>
|
||||||
|
|
||||||
|
</Spin>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default DeviceForm
|
268
src/pages/Device/index.tsx
Normal file
268
src/pages/Device/index.tsx
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
|
import { Button, Spin, Tabs, Tree} from 'antd';
|
||||||
|
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||||
|
import { deviceList, getplaceareaList, roomList } from './service';
|
||||||
|
import '@/assets/ld_style.less';
|
||||||
|
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||||
|
import ProCard from "@ant-design/pro-card";
|
||||||
|
import DeviceForm from './DeviceForm';
|
||||||
|
|
||||||
|
|
||||||
|
const deviceTypeEnum = {
|
||||||
|
'resource_door': { text: '门禁点' },
|
||||||
|
'resource_camera': { text: '监控点' },
|
||||||
|
'resource_nvr': { text: 'nvr' },
|
||||||
|
'resource_encodeDevice': { text: '编码设备' },
|
||||||
|
'resource_oneMachine': { text: '门禁一体机' },
|
||||||
|
|
||||||
|
}
|
||||||
|
const deviceStatusEnum = {
|
||||||
|
'online_0': { text: '离线' },
|
||||||
|
'online_1': { text: '在线' },
|
||||||
|
'online_9': { text: '无此设备' },
|
||||||
|
}
|
||||||
|
const Index: React.FC<{}> = () => {
|
||||||
|
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||||
|
const [treeData, setTreeData] = useState<any>();
|
||||||
|
const [treeId, setTreeId] = useState<any>();
|
||||||
|
const [updateVisible, setUpdateVisible] = useState<boolean>(false)
|
||||||
|
const [type, setType] = useState<any>();// 状态 编辑or 查看
|
||||||
|
const [deviceId, setDeviceId] = useState<any>("");//设备id
|
||||||
|
const [spin, spinSet] = useState<boolean>(false);//加载遮罩
|
||||||
|
const [updateChange, setUpdateChange] = useState<string>('')
|
||||||
|
|
||||||
|
/*拉取数据*/
|
||||||
|
useEffect(() => {
|
||||||
|
getplaceareaList().then((res: { code: number; data: any[] | undefined; }) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
let data: any = [];
|
||||||
|
if (res.data != undefined) {
|
||||||
|
res.data.map((item: any, index: any) => {
|
||||||
|
const title1 = item.placeName;
|
||||||
|
const key1 = item.id;
|
||||||
|
let children1: any = [];
|
||||||
|
if (item.roomList != undefined) {
|
||||||
|
const children = item.roomList.map((item: any, index: any) => {
|
||||||
|
const title2 = item.areaName;
|
||||||
|
const key2 = item.id;
|
||||||
|
|
||||||
|
return { title: title2, key: key2}
|
||||||
|
});
|
||||||
|
children1 = children;
|
||||||
|
}
|
||||||
|
const first = { title: title1, key: key1, children: children1 }
|
||||||
|
data.push(first);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setTreeData(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const toAdd = async (props?: any) => {
|
||||||
|
spinSet(true);
|
||||||
|
setUpdateChange('新增设备');
|
||||||
|
setType("new");
|
||||||
|
setUpdateVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
const toEdit = (dId: String) => {
|
||||||
|
setUpdateChange('修改设备');
|
||||||
|
console.log(dId)
|
||||||
|
setDeviceId(dId)
|
||||||
|
setType("edit");
|
||||||
|
setUpdateVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const toRead = (props: any) => {
|
||||||
|
setUpdateChange('查看设备');
|
||||||
|
setDeviceId(props.id)
|
||||||
|
setType("read");
|
||||||
|
setUpdateVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设备管理
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
|
||||||
|
const current = getURLInformation('current');
|
||||||
|
//列表页loading
|
||||||
|
const [spinLoading, setSpinLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const onSelect = (selectedKeys: any, info: any) => {
|
||||||
|
selectedKeys.length == 0 ? setTreeId(null) : setTreeId(selectedKeys[0])
|
||||||
|
|
||||||
|
console.log(selectedKeys)
|
||||||
|
}
|
||||||
|
const columns: any[] = [
|
||||||
|
//设备管理
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
dataIndex: 'index',
|
||||||
|
valueType: 'index',
|
||||||
|
search: false,
|
||||||
|
width: '3%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '评标场所名称',
|
||||||
|
dataIndex: 'placeName',
|
||||||
|
width: '10%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '评标区域名称',
|
||||||
|
dataIndex: 'areaName',
|
||||||
|
width: '10%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备类型',
|
||||||
|
dataIndex: 'deviceType',
|
||||||
|
width: '10%',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: deviceTypeEnum,
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
dataIndex: 'deviceName',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备标识',
|
||||||
|
dataIndex: 'deviceCode',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '网络IP',
|
||||||
|
dataIndex: 'deviceManagementIp',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备状态',
|
||||||
|
dataIndex: 'deviceStatus',
|
||||||
|
width: '10%',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: deviceStatusEnum,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
// {
|
||||||
|
// title: '操作',
|
||||||
|
// width: '7%',
|
||||||
|
// search: false,
|
||||||
|
// render: (text: any, record: any) => {
|
||||||
|
// return (
|
||||||
|
// <>
|
||||||
|
// <Button type="text" onClick={() => {toEdit(record.id)}} danger>
|
||||||
|
// 编辑
|
||||||
|
// </Button>
|
||||||
|
// <Button type="text" onClick={() => {}} danger>
|
||||||
|
// 删除
|
||||||
|
// </Button>
|
||||||
|
// </>
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: '0px 24px' }}>
|
||||||
|
<Spin spinning={spin}>
|
||||||
|
<ProCard split="vertical" bordered headerBordered>
|
||||||
|
<ProCard colSpan="300px">
|
||||||
|
{treeData == undefined ? null : (
|
||||||
|
<Tree
|
||||||
|
defaultExpandAll
|
||||||
|
onSelect={onSelect}
|
||||||
|
treeData={treeData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ProCard>
|
||||||
|
|
||||||
|
|
||||||
|
<ProCard bodyStyle={{ width: "100%" }} >
|
||||||
|
<ProTable
|
||||||
|
actionRef={checkRelationRef}
|
||||||
|
className="proSearch"
|
||||||
|
columns={columns}
|
||||||
|
params={{ treeId: treeId }}
|
||||||
|
size="small"
|
||||||
|
|
||||||
|
request={async (params) =>
|
||||||
|
await deviceList(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>,
|
||||||
|
// <Button key="toCreate" onClick={() => toAdd()}>
|
||||||
|
// 新建
|
||||||
|
// </Button>,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
pagination={{
|
||||||
|
defaultCurrent: isNotEmpty(current) ? Number(current) : 1,
|
||||||
|
defaultPageSize: 10,
|
||||||
|
showSizeChanger: false,
|
||||||
|
}} //默认显示条数
|
||||||
|
toolBarRender={false}
|
||||||
|
/>
|
||||||
|
</ProCard>
|
||||||
|
</ProCard>
|
||||||
|
{/* {updateVisible ? (
|
||||||
|
<DeviceForm key={Math.random()} titleName={updateChange}
|
||||||
|
type={type} deviceId={deviceId} status={'2'} onCancel={() => setUpdateVisible(false)}
|
||||||
|
modalVisible={updateVisible} tpId={''} />
|
||||||
|
) : null} */}
|
||||||
|
</Spin>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Index
|
||||||
|
|
||||||
|
|
41
src/pages/Device/service.ts
Normal file
41
src/pages/Device/service.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
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: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function deviceList(data: any) {
|
||||||
|
// 查询设备列表
|
||||||
|
return request('/v1/eval/device/queryPageByParam', {
|
||||||
|
method: 'post',
|
||||||
|
data: { ...data, pageNo: data.current },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getplaceareaList() {
|
||||||
|
// 查询场所、区域列表
|
||||||
|
/// /v1/elec/eval/placearea/uset/list
|
||||||
|
return request('/v1/elec/eval/placearea/list', {
|
||||||
|
method: 'get',
|
||||||
|
params: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getDeviceById(id: any) {
|
||||||
|
return request('/v1/eval/device/query/'+`${id}`, {
|
||||||
|
method: 'get',
|
||||||
|
params: {}
|
||||||
|
});
|
||||||
|
}
|
371
src/pages/ElecEvalReserve/index.tsx
Normal file
371
src/pages/ElecEvalReserve/index.tsx
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
|
import { Button, Tabs, message, Card } 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 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 [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
|
//刷新参数
|
||||||
|
const [refresh, setRefresh] = useState<number>(0);
|
||||||
|
|
||||||
|
/*拉取数据*/
|
||||||
|
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 = {};
|
||||||
|
setAreaList(res.data);
|
||||||
|
//将拿到的返回值遍历
|
||||||
|
res.data.map((item: { id: string | number; areaName: any }) => {
|
||||||
|
//使用接口返回值的id做为 代替原本的0,1
|
||||||
|
areaNameList[item.id] = {
|
||||||
|
//使用接口返回值中的overdueValue属性作为原本的text:后面的值
|
||||||
|
text: item.areaName,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
setAreaNameList(areaNameList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
//查看预约
|
||||||
|
const viewMeet = (id: any) => {
|
||||||
|
setMeetId(id);
|
||||||
|
setModalVisible(true);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 取消预约
|
||||||
|
* @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: 'areaId',
|
||||||
|
valueEnum: areaNameList,
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约开始时间',
|
||||||
|
dataIndex: 'reserveStartDate',
|
||||||
|
search: true,
|
||||||
|
valueType: 'dateTime',
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约结束时间',
|
||||||
|
dataIndex: 'reserveEndDate',
|
||||||
|
search: true,
|
||||||
|
valueType: 'dateTime',
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约人',
|
||||||
|
dataIndex: 'reserveBy',
|
||||||
|
width: '5%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约人联系方式',
|
||||||
|
dataIndex: 'reserveContactNumber',
|
||||||
|
width: '5%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '项目名称',
|
||||||
|
dataIndex: 'projectName',
|
||||||
|
search: false,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '标段名称',
|
||||||
|
dataIndex: 'packageNames',
|
||||||
|
search: false,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
width: '10%',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: statusEnum,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: '7%',
|
||||||
|
search: false,
|
||||||
|
render: (text: any, record: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button type="text" onClick={() => viewMeet(record.id)} danger>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
hidden={record.status > 0 && record.timeOut == '1'}
|
||||||
|
type="text"
|
||||||
|
onClick={() => cancel(record)}
|
||||||
|
danger
|
||||||
|
>
|
||||||
|
取消预约
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const otherColumns: any[] = [
|
||||||
|
//会议室预约
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
dataIndex: 'index',
|
||||||
|
valueType: 'index',
|
||||||
|
search: false,
|
||||||
|
width: '3%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '评标室',
|
||||||
|
dataIndex: 'areaId',
|
||||||
|
valueEnum: areaNameList,
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '会议名称',
|
||||||
|
dataIndex: 'meetingName',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '会议人数',
|
||||||
|
dataIndex: 'numberInMeeting',
|
||||||
|
width: '5%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约开始时间',
|
||||||
|
dataIndex: 'reserveStartDate',
|
||||||
|
valueType: 'dateTime',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约结束时间',
|
||||||
|
dataIndex: 'reserveEndDate',
|
||||||
|
valueType: 'dateTime',
|
||||||
|
search: true,
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约人',
|
||||||
|
dataIndex: 'reserveBy',
|
||||||
|
width: '5%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预约人联系方式',
|
||||||
|
dataIndex: 'reserveContactNumber',
|
||||||
|
width: '5%',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: '7%',
|
||||||
|
search: false,
|
||||||
|
render: (text: any, record: any) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button type="text" onClick={() => viewMeet(record.id)} danger>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<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,
|
||||||
|
});
|
||||||
|
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
|
||||||
|
|
||||||
|
|
24
src/pages/ElecEvalReserve/service.ts
Normal file
24
src/pages/ElecEvalReserve/service.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function cancelReserve(id: any) { // 取消预约
|
||||||
|
///api/biz-service-ebtp-evaluation
|
||||||
|
return request('/v1/eval/room/reserve/cancel/'+`${id}`, {
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user