厂家平台管理开发完成
This commit is contained in:
@ -74,6 +74,10 @@ export const elecBidEvaluation = [
|
|||||||
path: '/ElecEvaluation/PlaceAreasManage',
|
path: '/ElecEvaluation/PlaceAreasManage',
|
||||||
component: './ElecEvaluation/PlaceAreasManage',
|
component: './ElecEvaluation/PlaceAreasManage',
|
||||||
},
|
},
|
||||||
|
{//厂家平台管理
|
||||||
|
path: '/ElecEvaluation/ManuPlatformManage',
|
||||||
|
component: './ElecEvaluation/ManuPlatformManage',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
209
src/pages/ElecEvaluation/ManuPlatformManage/index.tsx
Normal file
209
src/pages/ElecEvaluation/ManuPlatformManage/index.tsx
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
import { isNotEmpty } from '@/utils/CommonUtils';
|
||||||
|
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
||||||
|
import { Button, Spin, message, Popconfirm } from 'antd';
|
||||||
|
import React, { useRef, useState } from 'react';
|
||||||
|
import { useHistory } from 'umi';
|
||||||
|
import ManuPlatformModal from './modal/ManuPlatformModal';
|
||||||
|
import { getManuPlatformList, deleteManuPlatformInfo } from './service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 厂家平台管理列表
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const ManuPlatformModalManage: React.FC<{}> = () => {
|
||||||
|
const actionRef = useRef<ActionType>();
|
||||||
|
const [spin, spinSet] = useState<boolean>(false);
|
||||||
|
const [visible, setVisible] = useState<boolean>(false);
|
||||||
|
const manuPlatformInfo = useRef<any>();
|
||||||
|
const history = useHistory();
|
||||||
|
const manuPlatformModalRef = useRef<any>(null);
|
||||||
|
//编辑
|
||||||
|
const editManuPlatform = (record: any) => {
|
||||||
|
manuPlatformInfo.current = record;
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
//新增
|
||||||
|
const insertManuPlatform = () => {
|
||||||
|
manuPlatformInfo.current = null;
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
//关闭
|
||||||
|
const closeManuPlatformModal = () => {
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
//删除场所
|
||||||
|
const deleteManuPlatform = async (id: string) => {
|
||||||
|
const hide = message.loading('正在删除');
|
||||||
|
try {
|
||||||
|
const success = await deleteManuPlatformInfo({'platformId':id}).then((res) => {
|
||||||
|
return res.success
|
||||||
|
});
|
||||||
|
hide();
|
||||||
|
if (success) {
|
||||||
|
message.success('删除成功');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hide();
|
||||||
|
message.error('删除失败请重试!');
|
||||||
|
actionRef.current?.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const columns: ProColumns<any>[] = [
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
valueType: 'index',
|
||||||
|
align: 'center',
|
||||||
|
width: 50,
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '平台名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'platformName',
|
||||||
|
hideInSearch: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '平台厂家',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'vender',
|
||||||
|
hideInSearch: false,
|
||||||
|
valueEnum: {
|
||||||
|
'sd_access': { text: '山分' },
|
||||||
|
'hik': { text: '海康' },
|
||||||
|
'icc': { text: '大华' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '平台类型',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'type',
|
||||||
|
hideInSearch: false,
|
||||||
|
valueEnum: {
|
||||||
|
'door': { text: '门禁平台' },
|
||||||
|
'management': { text: '管理平台' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '合作方Key',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'appKey',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '合作方Secret',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'appSecret',
|
||||||
|
hideInSearch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'center',
|
||||||
|
valueType: 'option',
|
||||||
|
width: '9%',
|
||||||
|
render: (_: any, record: any) =>
|
||||||
|
(
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
key="editManuPlatform"
|
||||||
|
type="text"
|
||||||
|
onClick={() =>
|
||||||
|
editManuPlatform(record)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Popconfirm
|
||||||
|
placement="topRight"
|
||||||
|
title={"确定删除么?"}
|
||||||
|
onConfirm={async () => {
|
||||||
|
spinSet(true)
|
||||||
|
await deleteManuPlatform(record.id);
|
||||||
|
actionRef.current?.reload();
|
||||||
|
spinSet(false)
|
||||||
|
}}
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
>
|
||||||
|
<Button type='text' >删除</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Spin spinning={spin}>
|
||||||
|
<div className="zjl-entrust confirm">
|
||||||
|
<ProTable
|
||||||
|
actionRef={actionRef}//action触发后更新表格
|
||||||
|
search={{
|
||||||
|
labelWidth:'auto',
|
||||||
|
defaultCollapsed: true,
|
||||||
|
optionRender: (searchConfig, { form }) => {
|
||||||
|
let params = ''
|
||||||
|
for (const key in form?.getFieldsValue()) {
|
||||||
|
let element = form?.getFieldsValue()[key];
|
||||||
|
if (element != undefined) {
|
||||||
|
params = params + '&' + key + '=' + element
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
<Button
|
||||||
|
key="searchText"
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
form?.submit();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{searchConfig?.searchText}
|
||||||
|
</Button>,
|
||||||
|
<Button
|
||||||
|
key="resetText"
|
||||||
|
onClick={() => {
|
||||||
|
form?.resetFields();
|
||||||
|
actionRef.current?.reset?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{searchConfig?.resetText}
|
||||||
|
</Button>,
|
||||||
|
<Button
|
||||||
|
key="add"
|
||||||
|
type="primary"
|
||||||
|
onClick={insertManuPlatform}
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</Button>
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
columns={columns}
|
||||||
|
options={false}
|
||||||
|
bordered={false}
|
||||||
|
size='small'
|
||||||
|
loading={false}
|
||||||
|
request={async (params) => {
|
||||||
|
spinSet(true);
|
||||||
|
return await getManuPlatformList({
|
||||||
|
...params,
|
||||||
|
}).then((res) => {
|
||||||
|
const result = {
|
||||||
|
data: res.data,
|
||||||
|
success: res.success,
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}).finally(() => {
|
||||||
|
isNotEmpty(window.location.search) && history.push(window.location.pathname);
|
||||||
|
spinSet(false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pagination={false}
|
||||||
|
rowKey={"id"}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<ManuPlatformModal manuPlatformInfo={manuPlatformInfo?.current} modalVisible={visible} onCancel={() => closeManuPlatformModal()} reload = {()=>{actionRef?.current?.reload();}} ref={manuPlatformModalRef} />
|
||||||
|
</Spin>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default ManuPlatformModalManage;
|
||||||
|
|
@ -0,0 +1,225 @@
|
|||||||
|
import { Spin, Modal, message, Form, Input, Select } from 'antd';
|
||||||
|
import Password from 'antd/lib/input/Password';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
import React, { useState, useImperativeHandle, forwardRef, useEffect } from 'react';
|
||||||
|
import { saveManuPlatformInfo, updateManuPlatformInfo } from '../service'
|
||||||
|
|
||||||
|
interface PlaceModalProps {
|
||||||
|
manuPlatformInfo?:ManuPlatformInfo;
|
||||||
|
modalVisible: boolean; //开启关闭控制
|
||||||
|
onCancel: () => void; //关闭方法传入
|
||||||
|
reload: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ManuPlatformInfo {
|
||||||
|
id ?: string;
|
||||||
|
platformName ?: string;
|
||||||
|
vender ?: string;
|
||||||
|
type ?: string;
|
||||||
|
appKey ?: string;
|
||||||
|
appSecret ?: string;
|
||||||
|
platformManagementIp ?: string;
|
||||||
|
platformManagementPort ?: string;
|
||||||
|
platformManagementLogin ?: string;
|
||||||
|
platformManagementPassword ?: string;
|
||||||
|
platformInfo ?: string;
|
||||||
|
serverSshPort ?: string;
|
||||||
|
serverUser ?: string;
|
||||||
|
serverPassword ?: string;
|
||||||
|
status ?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增修改弹出层
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const ManuPlatformModal: React.FC<PlaceModalProps> = forwardRef((props,ref) => {
|
||||||
|
const {manuPlatformInfo, modalVisible, onCancel, reload} = props;
|
||||||
|
const [saveLoading, setSaveLoading] = useState<boolean>(false);
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { Option } = Select;
|
||||||
|
const clearForm = () => {
|
||||||
|
form.resetFields();
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
clearForm();
|
||||||
|
}, [manuPlatformInfo]);
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
|
||||||
|
}));
|
||||||
|
/**
|
||||||
|
* 提交
|
||||||
|
*/
|
||||||
|
const onFinish = async (values: any) => {
|
||||||
|
setSaveLoading(true);
|
||||||
|
if(isEmpty(values['id'])){
|
||||||
|
await saveManuPlatformInfo({ ...values }).then((res) => {
|
||||||
|
if (res?.success) {
|
||||||
|
message.success('保存成功');
|
||||||
|
onCancel();
|
||||||
|
clearForm();
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(()=>{
|
||||||
|
setSaveLoading(false);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
await updateManuPlatformInfo({ ...values }).then((res) => {
|
||||||
|
if (res?.success) {
|
||||||
|
message.success('保存成功');
|
||||||
|
onCancel();
|
||||||
|
clearForm();
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(()=>{
|
||||||
|
setSaveLoading(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
destroyOnClose={true}
|
||||||
|
maskClosable={false}
|
||||||
|
visible={modalVisible}
|
||||||
|
okText="保存"
|
||||||
|
cancelText="关闭"
|
||||||
|
okButtonProps={{ loading: saveLoading }}
|
||||||
|
onCancel={() => { onCancel(); clearForm(); } }
|
||||||
|
onOk={() => { form.submit(); } }
|
||||||
|
title={<div>
|
||||||
|
<span>厂家平台信息</span>
|
||||||
|
</div>}
|
||||||
|
// footer={renderFooter()}
|
||||||
|
width={"35%"}
|
||||||
|
>
|
||||||
|
<Spin spinning={saveLoading}>
|
||||||
|
<Form
|
||||||
|
name="basic"
|
||||||
|
labelCol={{ span: 6 }}
|
||||||
|
wrapperCol={{ span: 18 }}
|
||||||
|
initialValues={{ remember: true }}
|
||||||
|
form={form}
|
||||||
|
onFinish={onFinish}
|
||||||
|
>
|
||||||
|
<Form.Item hidden={true} name="id" initialValue={manuPlatformInfo?.id}>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="平台名称"
|
||||||
|
name="platformName"
|
||||||
|
rules={[{ required: true, message: '请填写平台名称' }]}
|
||||||
|
initialValue={manuPlatformInfo?.platformName}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写平台名称" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="平台厂家"
|
||||||
|
name="vender"
|
||||||
|
rules={[{ required: true, message: '请选择平台厂家' }]}
|
||||||
|
initialValue={manuPlatformInfo?.vender}
|
||||||
|
>
|
||||||
|
<Select placeholder="请选择" allowClear defaultValue={manuPlatformInfo?.vender}>
|
||||||
|
<Option value="sd_access">山分</Option>
|
||||||
|
<Option value="hik">海康</Option>
|
||||||
|
<Option value="icc">大华</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="平台类型"
|
||||||
|
name="type"
|
||||||
|
rules={[{ required: true, message: '请选择平台类型' }]}
|
||||||
|
initialValue={manuPlatformInfo?.type}
|
||||||
|
>
|
||||||
|
<Select placeholder="请选择" allowClear defaultValue={manuPlatformInfo?.type}>
|
||||||
|
<Option value="door">门禁平台</Option>
|
||||||
|
<Option value="management">管理平台</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="合作方Key"
|
||||||
|
name="appKey"
|
||||||
|
initialValue={manuPlatformInfo?.appKey}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写合作方Key" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="合作方Secret"
|
||||||
|
name="appSecret"
|
||||||
|
initialValue={manuPlatformInfo?.appSecret}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写合作方Secret" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="管理平台地址/ip"
|
||||||
|
name="platformManagementIp"
|
||||||
|
initialValue={manuPlatformInfo?.platformManagementIp}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写管理平台地址/ip" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="管理平台端口号"
|
||||||
|
name="platformManagementPort"
|
||||||
|
initialValue={manuPlatformInfo?.platformManagementPort}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写管理平台端口号" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="管理平台登录账号"
|
||||||
|
name="platformManagementLogin"
|
||||||
|
initialValue={manuPlatformInfo?.platformManagementLogin}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写管理平台登录账号" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="管理平台登录密码"
|
||||||
|
name="platformManagementPassword"
|
||||||
|
initialValue={manuPlatformInfo?.platformManagementPassword}
|
||||||
|
>
|
||||||
|
<Password placeholder="请填写管理平台登录密码" maxLength={200} autoComplete="new-password"/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="平台信息"
|
||||||
|
name="platformInfo"
|
||||||
|
initialValue={manuPlatformInfo?.platformInfo}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写平台信息" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="服务器ssh端口"
|
||||||
|
name="serverSshPort"
|
||||||
|
initialValue={manuPlatformInfo?.serverSshPort}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写服务器ssh端口" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="服务器用户名"
|
||||||
|
name="serverUser"
|
||||||
|
initialValue={manuPlatformInfo?.serverUser}
|
||||||
|
>
|
||||||
|
<Input placeholder="请填写服务器用户名" maxLength={200}/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="服务器密码"
|
||||||
|
name="serverPassword"
|
||||||
|
initialValue={manuPlatformInfo?.serverPassword}
|
||||||
|
>
|
||||||
|
<Password placeholder="请填写服务器密码" maxLength={200} autoComplete="new-password"/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="status"
|
||||||
|
label="状态"
|
||||||
|
>
|
||||||
|
<Select placeholder="请选择状态" allowClear defaultValue={isEmpty(manuPlatformInfo?.status) ? '1' : manuPlatformInfo?.status}>
|
||||||
|
<Option value="1">在用</Option>
|
||||||
|
<Option value="0">禁用</Option>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Spin>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
export default ManuPlatformModal;
|
||||||
|
|
46
src/pages/ElecEvaluation/ManuPlatformManage/service.ts
Normal file
46
src/pages/ElecEvaluation/ManuPlatformManage/service.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
/**
|
||||||
|
* 查询平台数据
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export async function getManuPlatformList(params?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/queryParam', {
|
||||||
|
method: 'POST',
|
||||||
|
data: {...params}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存平台信息
|
||||||
|
* @param params 场所实体
|
||||||
|
*/
|
||||||
|
export async function saveManuPlatformInfo(params?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/insert', {
|
||||||
|
method: 'POST',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新平台信息
|
||||||
|
* @param params 场所实体
|
||||||
|
*/
|
||||||
|
export async function updateManuPlatformInfo(params?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/update', {
|
||||||
|
method: 'POST',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除平台信息
|
||||||
|
* @param params 场所实体
|
||||||
|
*/
|
||||||
|
export async function deleteManuPlatformInfo(params?: any) {
|
||||||
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/delete', {
|
||||||
|
method: 'GET',
|
||||||
|
params:{...params}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@ import request from '@/utils/request';
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export async function getPlacePage(params?: any) {
|
export async function getPlacePage(params?: any) {
|
||||||
return request('/api/biz-service-ebtp-evaluation/v1/elec/eval/place/page/list', {
|
return request('/api/biz-service-ebtp-evaluation/v1/eval/platform/queryPageByParam', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {...params}
|
params: {...params}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user