Skip to content

Dev #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 10, 2025
Merged

Dev #99

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"@ant-design/icons": "^5.4.0",
"@ant-design/pro-components": "^2.8.7",
"@babel/standalone": "^7.25.6",
"@codingapi/flow-pc": "^0.0.8",
"@codingapi/form-pc": "^0.0.16",
"@codingapi/ui-framework": "^0.0.12",
"@codingapi/flow-pc": "^0.0.17",
"@codingapi/form-pc": "^0.0.17",
"@codingapi/ui-framework": "^0.0.17",
"@dnd-kit/core": "^6.2.0",
"@dnd-kit/sortable": "^9.0.0",
"@handsontable/react-wrapper": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/config/menus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const menus = [
{
path: '/mirco',
name: '微前端',
icon: "FormOutlined",
icon: "AppstoreOutlined",
page: 'mirco',
},
{
Expand Down
11 changes: 5 additions & 6 deletions admin-ui/src/pages/flow/leave/LeaveForm.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, {useEffect} from "react";
import {FlowFormViewProps} from "@codingapi/ui-framework";
import {Form,FormInput,FormTextArea} from "@codingapi/form-pc";
import {ValidateUtils} from "@codingapi/ui-framework";
import {FlowFormViewProps, ValidateUtils} from "@codingapi/ui-framework";
import {Form, FormInput, FormTextArea} from "@codingapi/form-pc";

const LeaveForm: React.FC<FlowFormViewProps> = (props) => {

useEffect(() => {
if (props.dataVersion && props.data) {
console.log('data',props.data);
console.log('data', props.data);
props.form?.setFieldsValue({
...props.data
});
Expand All @@ -33,8 +32,8 @@ const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
<FormInput
name={"days"}
label={"请假天数"}
inputType={"number"}
required={true}
inputType={"number"}
required={true}
validateFunction={ValidateUtils.validateNotEmpty}
/>

Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/pages/flow/user/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const UserPage = () => {
<Modal
title={"编辑用户"}
open={visible}
destroyOnHidden={true}
onClose={()=>{
setVisible(false);
}}
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/pages/flow/user/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const UserSelect:React.FC<UserSelectProps> = (props) => {
open={props.visible}
onCancel={() => props.setVisible(false)}
onClose={() => props.setVisible(false)}
destroyOnClose={true}
destroyOnHidden={true}
title={"选择用户"}
onOk={() => {
if (props.onSelect) {
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/pages/flow/work/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const FlowPage = () => {
data-testid={"flow-editor"}
title="编辑流程"
open={editorVisible}
destroyOnClose={true}
destroyOnHidden={true}
onClose={()=>{
setEditorVisible(false)
}}
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/src/pages/flow/work/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const FlowSelect: React.FC<FlowSelectProps> = (props) => {
open={props.visible}
onCancel={() => props.setVisible(false)}
onClose={() => props.setVisible(false)}
destroyOnClose={true}
destroyOnHidden={true}
title={"选择流程"}
onOk={() => {
if (props.onSelect) {
Expand Down
27 changes: 19 additions & 8 deletions admin-ui/src/pages/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import React from 'react';
import {PageContainer} from "@ant-design/pro-components";
import {Button, Col, message, Row} from "antd";
import {
Form,
FormCaptcha,
FormCascader,
FormCheckbox,
FormCode,
FormColor,
FormDate,
FormInput,
FormPassword,
FormRadio,
FormRate,
FormSelect,
FormSlider,
FormStepper,
FormSwitch,
FormTextArea,
FormUploader,
FormCheckbox,
FormCaptcha,
FormPassword,
FormInput,
Form
FormUploader
} from "@codingapi/form-pc";
import {FormInstance,FormField} from "@codingapi/ui-framework";
import {FormField, FormInstance} from "@codingapi/ui-framework";


const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance}) => {
Expand Down Expand Up @@ -69,7 +69,12 @@ const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance})

<Button
onClick={async () => {
await formInstance.validate();
const result = await formInstance.validate();
if (result) {
message.success("验证通过");
} else {
message.error("验证失败");
}
}}
>验证表单</Button>

Expand Down Expand Up @@ -379,6 +384,9 @@ const FormPage = () => {
<Form
form={leftFormInstance}
layout={"horizontal"}
onFinish={async (values)=>{
message.success(JSON.stringify(values));
}}
footer={(
<FooterButtons
formInstance={leftFormInstance}
Expand Down Expand Up @@ -567,6 +575,9 @@ const FormPage = () => {

<Col span={12}>
<Form
onFinish={async (values)=>{
message.success(JSON.stringify(values));
}}
form={rightFormInstance}
footer={(
<FooterButtons
Expand Down
3 changes: 0 additions & 3 deletions admin-ui/todo.md

This file was deleted.

6 changes: 3 additions & 3 deletions mobile-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"dependencies": {
"@babel/standalone": "^7.25.6",
"@codingapi/flow-mobile": "^0.0.3",
"@codingapi/form-mobile": "^0.0.3",
"@codingapi/ui-framework": "^0.0.12",
"@codingapi/flow-mobile": "^0.0.17",
"@codingapi/form-mobile": "^0.0.17",
"@codingapi/ui-framework": "^0.0.17",
"@logicflow/core": "^2.0.10",
"@logicflow/extension": "^2.0.14",
"@reduxjs/toolkit": "^2.2.7",
Expand Down
36 changes: 33 additions & 3 deletions mobile-ui/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# TODO
1. 流程图展示
2. 流程的审批历史记录展示
# Mobile-ui with Antd For Micro Frontends

This is a simple React App with Webpack5 & Typescript.

## Features
1. Support Webpack 5 ModuleFederationPlugin for Micro Frontends
2. Support Dynamic zip component loading
3. Support Dynamic Routing & Dynamic Menu
4. Support Axios for API calls
5. Support Antd & Pro-Components UI Library
6. Support Redux for State Management
7. Support Mock Server for API Mocking
8. Support Monaco Editor for Code Editor
9. Support Access ControlPanel for Menu & Page Components

## Running
```shell
yarn

yarn start
```
## Build
```shell
yarn build
```

## Deploy
```shell
cd scripts
sh package.sh
sh deploy.sh
```

1 change: 1 addition & 0 deletions mobile-ui/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/mobile
8 changes: 8 additions & 0 deletions mobile-ui/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
serverHost=server
serverAccount=root
serverPort=22
serverPath=/opt/test/


scp -o ConnectTimeout=30 -P $serverPort -r * $serverAccount@$serverHost:$serverPath
ssh -p $serverPort $serverAccount@$serverHost "cd $serverPath && sed -i 's/\r//g' *.sh && sh install.sh"
12 changes: 12 additions & 0 deletions mobile-ui/scripts/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"

services:
admin-nginx:
image: nginx:latest
volumes:
- "./admin:/usr/share/nginx/html"
environment:
TZ: "Asia/Shanghai"
restart: always
ports:
- "13000:80"
3 changes: 3 additions & 0 deletions mobile-ui/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker-compose build --no-cache
docker-compose up -d
docker ps -a
8 changes: 8 additions & 0 deletions mobile-ui/scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rm -rf mobile

cd ..
yarn
yarn run build


cp -r ./dist/ ./scripts/mobile/
13 changes: 12 additions & 1 deletion mobile-ui/src/pages/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance})

<Button
onClick={async () => {
await formInstance.validate();
const result = await formInstance.validate();
if (result) {
Toast.show("验证通过");
} else {
Toast.show("验证失败");
}
}}
>验证表单</Button>

Expand Down Expand Up @@ -374,6 +379,9 @@ const FormPage = ()=>{
<Form
layout={"horizontal"}
form={rightFormInstance}
onFinish={async (values)=>{
Toast.show(JSON.stringify(values));
}}
footer={(
<FooterButtons formInstance={rightFormInstance}/>
)}
Expand All @@ -390,6 +398,9 @@ const FormPage = ()=>{
<Form
form={leftFormInstance}
layout={"horizontal"}
onFinish={async (values)=>{
Toast.show(JSON.stringify(values));
}}
footer={(
<FooterButtons
formInstance={leftFormInstance}
Expand Down