diff --git a/zlt-web/src/main/frontend/src/global.less b/zlt-web/src/main/frontend/src/global.less index f9f5e32d..66537a98 100644 --- a/zlt-web/src/main/frontend/src/global.less +++ b/zlt-web/src/main/frontend/src/global.less @@ -17,6 +17,11 @@ body, left: unset; } + +.hightligh{ + background-color: @yellow-2 !important; +} + canvas { display: block; } diff --git a/zlt-web/src/main/frontend/src/pages/files/File/index.tsx b/zlt-web/src/main/frontend/src/pages/files/File/index.tsx index 15bc042c..14462e0a 100644 --- a/zlt-web/src/main/frontend/src/pages/files/File/index.tsx +++ b/zlt-web/src/main/frontend/src/pages/files/File/index.tsx @@ -1,7 +1,6 @@ import { deleteFile, file } from '@/services/files/api'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; import { - ProFormSelect, PageContainer, ProFormText, ProTable, @@ -12,10 +11,10 @@ import React, { useRef, useState } from 'react'; const { Link } = Typography; -const handleDelete = async (file: FILES.File) => { +const handleDelete = async (deletefile: FILES.File) => { const hide = message.loading('正在删除'); try { - const result = await deleteFile(file.id); + const result = await deleteFile(deletefile.id); hide(); if (result.resp_code === 0) { message.success('删除File成功'); @@ -33,7 +32,7 @@ const handleDelete = async (file: FILES.File) => { const TableList: React.FC = () => { const actionRef = useRef(); - const [params, setParams] = useState>({ tenantId: 'webApp' }); + const [params, setParams] = useState>({ }); const columns: ProColumns[] = [ { dataIndex: 'index', @@ -46,6 +45,7 @@ const TableList: React.FC = () => { { title: '文件大小(B)', dataIndex: 'size', + valueType: 'digit', }, { title: '媒体类型', @@ -68,7 +68,7 @@ const TableList: React.FC = () => { title: '操作', key: 'action', render: (_, entity) => { const success = await handleDelete(entity); if (success) { @@ -90,9 +90,7 @@ const TableList: React.FC = () => { split span={6} className="query-filter" - initialValues={params} onFinish={async (values) => setParams(values)} - onReset={() => setParams({})} > diff --git a/zlt-web/src/main/frontend/src/pages/system/App/components/CreateForm.tsx b/zlt-web/src/main/frontend/src/pages/system/App/components/CreateForm.tsx new file mode 100644 index 00000000..c143c1fc --- /dev/null +++ b/zlt-web/src/main/frontend/src/pages/system/App/components/CreateForm.tsx @@ -0,0 +1,213 @@ +import { + ModalForm, + ProForm, + ProFormCheckbox, + ProFormRadio, + ProFormText, +} from '@ant-design/pro-components'; +import React from 'react'; + +export type FormValueType = { + authorizedGrantTypeCodes?: string[]; +} & Partial; + +export type CreateFormProps = { + onVisibleChange: (flag: boolean) => void; + onSubmit: (values: FormValueType) => Promise; + visible: boolean; + values?: SYSTEM.App; +}; + +const UpdateForm: React.FC = (props) => { + return ( + + + + + + + + + + + + + + + ); +}; + +export default UpdateForm; diff --git a/zlt-web/src/main/frontend/src/pages/system/App/components/UpdateForm.tsx b/zlt-web/src/main/frontend/src/pages/system/App/components/UpdateForm.tsx new file mode 100644 index 00000000..9f2034f3 --- /dev/null +++ b/zlt-web/src/main/frontend/src/pages/system/App/components/UpdateForm.tsx @@ -0,0 +1,203 @@ +import { + ModalForm, + ProForm, + ProFormCheckbox, + ProFormRadio, + ProFormText, +} from '@ant-design/pro-components'; +import { Form } from 'antd'; +import React, { useEffect } from 'react'; + +export type FormValueType = { + authorizedGrantTypeCodes?: string[]; +} & Partial; + +export type UpdateFormProps = { + onVisibleChange: (flag: boolean) => void; + onSubmit: (values: FormValueType) => Promise; + visible: boolean; + values?: SYSTEM.App; +}; + +const UpdateForm: React.FC = (props) => { + const [form] = Form.useForm(); + const { values } = props; + useEffect(() => { + if (values?.authorizedGrantTypes) { + const authorizedGrantTypeCodes = values.authorizedGrantTypes.split(",") + const formData: FormValueType = { ...values, authorizedGrantTypeCodes }; + form.setFieldsValue(formData); + } + }, [form, values]); + return ( + + + + + + + + + + + + + + + ); +}; + +export default UpdateForm; diff --git a/zlt-web/src/main/frontend/src/pages/system/App/index.tsx b/zlt-web/src/main/frontend/src/pages/system/App/index.tsx index 57aa9442..009c7355 100644 --- a/zlt-web/src/main/frontend/src/pages/system/App/index.tsx +++ b/zlt-web/src/main/frontend/src/pages/system/App/index.tsx @@ -1,13 +1,57 @@ -import { app, deleteApp } from '@/services/system/api'; +import { app, saveOrUpdateApp, deleteApp } from '@/services/system/api'; import { PlusOutlined } from '@ant-design/icons'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; import { PageContainer, ProFormText, ProTable, QueryFilter } from '@ant-design/pro-components'; -import { Typography, message, Popconfirm, Button } from 'antd'; +import { Typography, message, Popconfirm, Button, Space } from 'antd'; import React, { useRef, useState } from 'react'; +import CreateForm from './components/CreateForm'; +import UpdateForm from './components/UpdateForm'; const { Link } = Typography; +const handleAdd = async (fields: SYSTEM.App) => { + const hide = message.loading('正在添加'); + try { + const result = await saveOrUpdateApp({ ...fields }); + hide(); + if (result.resp_code === 0) { + message.success('添加应用成功'); + return true; + } else { + message.error(result.resp_msg); + return false; + } + } catch (error) { + hide(); + message.error('添加应用失败'); + return false; + } +}; + +const handleEdit = async (fields: SYSTEM.App) => { + const hide = message.loading('正在更新'); + try { + const result = await saveOrUpdateApp({ ...fields }); + hide(); + if (result.resp_code === 0) { + message.success('修改应用成功'); + return true; + } else { + message.error(result.resp_msg); + return false; + } + } catch (error) { + hide(); + message.error('修改应用失败'); + return false; + } +}; + const handleDelete = async (data: SYSTEM.App) => { + if (!data.id) { + message.error('缺少ID信息,删除应用失败'); + return false; + } const hide = message.loading('正在删除'); try { await deleteApp(data.id); @@ -24,6 +68,9 @@ const handleDelete = async (data: SYSTEM.App) => { const TableList: React.FC = () => { const [params, setParams] = useState>(); const actionRef = useRef(); + const [createModalVisible, handleCreateModalVisible] = useState(false); + const [updateModalVisible, handleUpdateModalVisible] = useState(false); + const [currentRow, setCurrentRow] = useState(); const columns: ProColumns[] = [ { dataIndex: 'index', @@ -56,7 +103,7 @@ const TableList: React.FC = () => { key: 'autoapprove', width: 40, align: 'center', - render: (_, record) => (record.autoapprove === 'true' ? '是' : '否'), + renderText: (_, record) => (record.autoapprove === 'true' ? '是' : '否'), }, { title: '令牌时效', @@ -75,7 +122,7 @@ const TableList: React.FC = () => { key: 'supportIdToken', width: 40, align: 'center', - render: (_, record) => (record.supportIdToken ? '是' : '否'), + renderText: (_, record) => (record.supportIdToken ? '是' : '否'), }, { title: 'ID时效', @@ -88,19 +135,31 @@ const TableList: React.FC = () => { key: 'action', fixed: 'right', width: 40, - render: (_, entity) => { - const success = await handleDelete(entity); - if (success) { - if (actionRef.current) { - actionRef.current.reload(); - } - } - }} - > - 删除 - , + render: (_, entity) => ( + + { + setCurrentRow(entity); + handleUpdateModalVisible(true); + }} + > + 修改 + + { + const success = await handleDelete(entity); + if (success) { + if (actionRef.current) { + actionRef.current.reload(); + } + } + }} + > + 删除 + + + ), }, ]; return ( @@ -133,7 +192,7 @@ const TableList: React.FC = () => {