设备管理
This commit is contained in:
@ -17,8 +17,28 @@ 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': {
|
'/v1/eval/room/reserve/list': {
|
||||||
target: 'http://localhost:18017',//连接天宫的ng
|
target: 'http://localhost:18017',//连接本地
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: { '^': '' },
|
||||||
|
},
|
||||||
|
'/v1/elec/eval/room/list': {
|
||||||
|
target: 'http://localhost:18017',//连接本地
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: { '^': '' },
|
pathRewrite: { '^': '' },
|
||||||
},
|
},
|
||||||
|
@ -109,7 +109,12 @@ export default [
|
|||||||
path: '/',
|
path: '/',
|
||||||
redirect: '/userexpert/login',
|
redirect: '/userexpert/login',
|
||||||
},
|
},
|
||||||
{//委托撤回
|
{//设备管理
|
||||||
|
name: 'Device',
|
||||||
|
path: '/Device',
|
||||||
|
component: './Device',
|
||||||
|
},
|
||||||
|
{//评标室查看预约
|
||||||
name: 'ElecEvalReserve',
|
name: 'ElecEvalReserve',
|
||||||
path: '/ElecEvalReserve',
|
path: '/ElecEvalReserve',
|
||||||
component: './ElecEvalReserve',
|
component: './ElecEvalReserve',
|
||||||
|
@ -1,62 +1,95 @@
|
|||||||
import React, { useState, useRef, useEffect } from 'react';
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
import { Button, Tabs, PageHeader,message } from 'antd';
|
import { Button, Tabs, Tree} from 'antd';
|
||||||
import ProTable, { ActionType } from '@ant-design/pro-table';
|
import ProTable, { ActionType } from '@ant-design/pro-table';
|
||||||
import { reserveList, roomList, cancelReserve } from './service';
|
import { deviceList, getplaceareaList, roomList } from './service';
|
||||||
import '@/assets/ld_style.less';
|
import '@/assets/ld_style.less';
|
||||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import { btnAuthority } from '@/utils/authority';
|
import ProCard from "@ant-design/pro-card";
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
|
||||||
|
|
||||||
|
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 Index: React.FC<{}> = () => {
|
||||||
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
const checkRelationRef = useRef<ActionType>(); //操作数据后刷新列表
|
||||||
|
const [treeData, setTreeData] = useState<any>();
|
||||||
|
const [treeId, setTreeId] = useState<any>();
|
||||||
|
|
||||||
const [areaNameList, setAreaNameList] = useState({});
|
|
||||||
/*拉取数据*/
|
/*拉取数据*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initAreaNameList();
|
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 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
|
* @param record
|
||||||
*/
|
*/
|
||||||
const cancel = async (record: any) => {
|
const cancel = async (record: any) => {};
|
||||||
|
|
||||||
cancelReserve(record.id).then(res => {
|
|
||||||
if (res.code == 200 && res.data) {
|
|
||||||
message.success('预约取消成功');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const current = getURLInformation('current');
|
const current = getURLInformation('current');
|
||||||
|
//列表页loading
|
||||||
|
const [spinLoading, setSpinLoading] = useState<boolean>(false);
|
||||||
|
//新建应答格式
|
||||||
|
const toCreate = async () => {
|
||||||
|
// const id = getProId();
|
||||||
|
// const param = {
|
||||||
|
// tpId: id,
|
||||||
|
// roomType: getURLInformation('roomType'),
|
||||||
|
// };
|
||||||
|
// await getSectionList(param).then((res) => {
|
||||||
|
// if ((res.code = 200)) {
|
||||||
|
// if (res.data.length == 0) {
|
||||||
|
// message.info(`当前项目无可选${sectionName},无法新增`);
|
||||||
|
// } else {
|
||||||
|
// setSectionList(res.data);
|
||||||
|
// setCreateVisible(true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
//编辑应答格式
|
||||||
|
const toEdit = (values: any, param: any) => {
|
||||||
|
|
||||||
|
};
|
||||||
|
const onSelect = (selectedKeys: any, info: any) => {
|
||||||
|
selectedKeys.length == 0 ? setTreeId(null) : setTreeId(selectedKeys[0])
|
||||||
|
|
||||||
|
console.log(selectedKeys)
|
||||||
|
}
|
||||||
const columns: any[] = [
|
const columns: any[] = [
|
||||||
//会议室预约
|
//设备管理
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '序号',
|
title: '序号',
|
||||||
@ -67,45 +100,49 @@ const Index: React.FC<{}> = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '评标场所名称',
|
title: '评标场所名称',
|
||||||
dataIndex: 'reserveBy',
|
dataIndex: 'placeName',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '评标区域名称',
|
title: '评标区域名称',
|
||||||
dataIndex: 'reserveBy',
|
dataIndex: 'areaName',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备类型',
|
title: '设备类型',
|
||||||
dataIndex: 'reserveBy',
|
dataIndex: 'deviceType',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: deviceTypeEnum,
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备名称',
|
title: '设备名称',
|
||||||
dataIndex: 'meetingName',
|
dataIndex: 'deviceName',
|
||||||
search: true,
|
search: true,
|
||||||
width: '10%',
|
width: '10%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备标识',
|
title: '设备标识',
|
||||||
dataIndex: 'meetingName',
|
dataIndex: 'deviceCode',
|
||||||
search: true,
|
search: true,
|
||||||
width: '10%',
|
width: '10%',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: '网络IP',
|
title: '网络IP',
|
||||||
dataIndex: 'meetingName',
|
dataIndex: 'deviceManagementIp',
|
||||||
search: true,
|
search: true,
|
||||||
width: '10%',
|
width: '10%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备状态',
|
title: '设备状态',
|
||||||
dataIndex: 'reserveBy',
|
dataIndex: 'deviceStatus',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
|
valueType: 'select',
|
||||||
|
valueEnum: deviceStatusEnum,
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -114,38 +151,44 @@ const Index: React.FC<{}> = () => {
|
|||||||
width: '7%',
|
width: '7%',
|
||||||
search: false,
|
search: false,
|
||||||
render: (text: any, record: any) => {
|
render: (text: any, record: any) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button type="text" onClick={() => cancel(record)} danger>
|
<Button type="text" onClick={() => {}} danger>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="text" onClick={() => cancel(record)} danger>
|
<Button type="text" onClick={() => {}} danger>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageHeader title="预约管理" />
|
<ProCard split="vertical" bordered headerBordered>
|
||||||
|
<ProCard colSpan="300px">
|
||||||
|
{treeData == undefined ? null : (
|
||||||
|
<Tree
|
||||||
|
defaultExpandAll
|
||||||
|
onSelect={onSelect}
|
||||||
|
treeData={treeData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ProCard>
|
||||||
|
|
||||||
<Tabs defaultActiveKey="1">
|
|
||||||
<TabPane tab="评标预约" key="1">
|
<ProCard bodyStyle={{ width: "100%" }} >
|
||||||
<ProTable
|
<ProTable
|
||||||
actionRef={checkRelationRef}
|
actionRef={checkRelationRef}
|
||||||
className="proSearch"
|
className="proSearch"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
params={{ reserveType: 'eval' }}
|
params={{ treeId: treeId }}
|
||||||
size="small"
|
size="small"
|
||||||
|
|
||||||
request={async (params) =>
|
request={async (params) =>
|
||||||
await reserveList(params).then((res) => {
|
await deviceList(params).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
@ -187,6 +230,9 @@ const Index: React.FC<{}> = () => {
|
|||||||
>
|
>
|
||||||
{searchConfig?.searchText}
|
{searchConfig?.searchText}
|
||||||
</Button>,
|
</Button>,
|
||||||
|
<Button key="toCreate" onClick={() => toCreate()}>
|
||||||
|
新建
|
||||||
|
</Button>,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
@ -197,41 +243,8 @@ const Index: React.FC<{}> = () => {
|
|||||||
}} //默认显示条数
|
}} //默认显示条数
|
||||||
toolBarRender={false}
|
toolBarRender={false}
|
||||||
/>
|
/>
|
||||||
</TabPane>
|
</ProCard>
|
||||||
<TabPane tab="会议预约" key="2">
|
</ProCard>
|
||||||
<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>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -15,3 +15,20 @@ export async function roomList() { // 查询评标室列表
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -4,7 +4,6 @@ import ProTable, { ActionType } from '@ant-design/pro-table';
|
|||||||
import { reserveList, roomList, cancelReserve } from './service';
|
import { reserveList, roomList, cancelReserve } from './service';
|
||||||
import '@/assets/ld_style.less';
|
import '@/assets/ld_style.less';
|
||||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import { btnAuthority } from '@/utils/authority';
|
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user