From c95434ceb0b39cf09b3573cbbd82c1112cf7a7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E5=B8=85?= Date: Thu, 13 Oct 2022 11:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=82=E5=AE=B6=E5=B9=B3=E5=8F=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=BC=80=E5=8F=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/router_elecEvaluation.ts | 4 + .../ManuPlatformManage/index.tsx | 209 ++++++++++++++++ .../modal/ManuPlatformModal.tsx | 225 ++++++++++++++++++ .../ManuPlatformManage/service.ts | 46 ++++ .../PlaceAreasManage/service.ts | 2 +- 5 files changed, 485 insertions(+), 1 deletion(-) create mode 100644 src/pages/ElecEvaluation/ManuPlatformManage/index.tsx create mode 100644 src/pages/ElecEvaluation/ManuPlatformManage/modal/ManuPlatformModal.tsx create mode 100644 src/pages/ElecEvaluation/ManuPlatformManage/service.ts diff --git a/config/router_elecEvaluation.ts b/config/router_elecEvaluation.ts index 6f63442..caa973f 100644 --- a/config/router_elecEvaluation.ts +++ b/config/router_elecEvaluation.ts @@ -73,6 +73,10 @@ export const elecBidEvaluation = [ {//评标场所及区域管理 path: '/ElecEvaluation/PlaceAreasManage', component: './ElecEvaluation/PlaceAreasManage', + }, + {//厂家平台管理 + path: '/ElecEvaluation/ManuPlatformManage', + component: './ElecEvaluation/ManuPlatformManage', }, ], }, diff --git a/src/pages/ElecEvaluation/ManuPlatformManage/index.tsx b/src/pages/ElecEvaluation/ManuPlatformManage/index.tsx new file mode 100644 index 0000000..c98620a --- /dev/null +++ b/src/pages/ElecEvaluation/ManuPlatformManage/index.tsx @@ -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(); + const [spin, spinSet] = useState(false); + const [visible, setVisible] = useState(false); + const manuPlatformInfo = useRef(); + const history = useHistory(); + const manuPlatformModalRef = useRef(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[] = [ + { + 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) => + ( + <> + + { + spinSet(true) + await deleteManuPlatform(record.id); + actionRef.current?.reload(); + spinSet(false) + }} + okText="确定" + cancelText="取消" + > + + + + ) + }, + ] + + return ( + +
+ { + let params = '' + for (const key in form?.getFieldsValue()) { + let element = form?.getFieldsValue()[key]; + if (element != undefined) { + params = params + '&' + key + '=' + element + } + } + return [ + , + , + + ]; + }, + }} + 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"} + /> +
+ closeManuPlatformModal()} reload = {()=>{actionRef?.current?.reload();}} ref={manuPlatformModalRef} /> +
+ ) +} +export default ManuPlatformModalManage; + diff --git a/src/pages/ElecEvaluation/ManuPlatformManage/modal/ManuPlatformModal.tsx b/src/pages/ElecEvaluation/ManuPlatformManage/modal/ManuPlatformModal.tsx new file mode 100644 index 0000000..373d591 --- /dev/null +++ b/src/pages/ElecEvaluation/ManuPlatformManage/modal/ManuPlatformModal.tsx @@ -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 = forwardRef((props,ref) => { + const {manuPlatformInfo, modalVisible, onCancel, reload} = props; + const [saveLoading, setSaveLoading] = useState(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 ( + { onCancel(); clearForm(); } } + onOk={() => { form.submit(); } } + title={
+ 厂家平台信息 +
} + // footer={renderFooter()} + width={"35%"} + > + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ ) +}) +export default ManuPlatformModal; + diff --git a/src/pages/ElecEvaluation/ManuPlatformManage/service.ts b/src/pages/ElecEvaluation/ManuPlatformManage/service.ts new file mode 100644 index 0000000..631b874 --- /dev/null +++ b/src/pages/ElecEvaluation/ManuPlatformManage/service.ts @@ -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} + }); +} + + diff --git a/src/pages/ElecEvaluation/PlaceAreasManage/service.ts b/src/pages/ElecEvaluation/PlaceAreasManage/service.ts index cbbc767..b26dbf0 100644 --- a/src/pages/ElecEvaluation/PlaceAreasManage/service.ts +++ b/src/pages/ElecEvaluation/PlaceAreasManage/service.ts @@ -4,7 +4,7 @@ import request from '@/utils/request'; * @param params */ 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', params: {...params} });