Skip to content

Commit

Permalink
feat: 1. 上线审批流。2.修复反馈问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft authored and jianbing.chen committed Dec 18, 2024
1 parent 17c3b30 commit 560111b
Show file tree
Hide file tree
Showing 36 changed files with 1,278 additions and 70 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"中后台低代码平台"
],
"scripts": {
"preinstall": "npx only-allow pnpm",
"start:editor": "pnpm --filter editor start",
"build:editor": "pnpm --filter editor build",
"start:admin": "pnpm --filter admin start",
Expand Down Expand Up @@ -55,6 +56,7 @@
"ahooks": "^3.7.8",
"antd": "^5.21.1",
"axios": "^0.27.2",
"classnames": "^2.5.1",
"copy-to-clipboard": "^3.3.3",
"less": "^4.2.0",
"lodash-es": "^4.17.21",
Expand All @@ -65,6 +67,7 @@
"react-quill": "^2.0.0",
"react-router-dom": "^6.21.2",
"standard-version": "^9.5.0",
"styled-components": "^6.1.13",
"vite": "^5.0.8",
"vite-plugin-externals-new": "^1.5.5",
"vite-plugin-svgr": "^4.2.0",
Expand All @@ -75,9 +78,13 @@
"@types/react": "latest",
"@types/react-dom": "latest",
"lint-staged": "^10.0.7",
"only-allow": "^1.2.1",
"typescript": "latest",
"yorkie": "^2.0.0"
},
"engines": {
"node": ">=18.0.0"
},
"standard-version": {
"types": [
{
Expand Down
3 changes: 2 additions & 1 deletion packages/editor/.env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 接口地址
VITE_BASE_API=http://mars-api.marsview.cc/api
# VITE_BASE_API=http://mars-api.marsview.cc/api
VITE_BASE_API=http://localhost:5000/api
# 后台访问地址
VITE_ADMIN_URL=http://admin.marsview.cc
36 changes: 36 additions & 0 deletions packages/editor/src/api/workflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import request from '@/utils/request';
import { PageParams } from './types';

export interface IWorkFlow {
id: number;
form_name: string;
form_desc: string;
page_id: number;
template_data: string;
user_id: number;
user_name: string;
created_at: string;
updated_at: string;
}
export default {
// 获取模板列表
getTemplateList: (params: PageParams) => {
return request.get('/workflow/list', params, { showLoading: false });
},
// 获取模板详情
getTemplateDetail: (id: number) => {
return request.get<IWorkFlow>(`/workflow/detail/${id}`);
},
// 创建模板
createTemplate: (params: { form_name: string; form_desc?: string }) => {
return request.post('/workflow/create', params);
},
// 更新模板
updateTemplate: (params: Omit<IWorkFlow, 'id'>) => {
return request.post('/workflow/update', params);
},
// 删除模板
deleteTemplate: (id: number) => {
return request.post(`/workflow/delete/${id}`);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Input, Modal, Form, Radio } from 'antd';
import { useImperativeHandle, useState, MutableRefObject } from 'react';
import { createPageData, updatePageData } from '@/api';
import { PageItem } from '@/api/pageMember';
import { usePageStore } from '@/stores/pageStore';
/**
* 创建页面
*/
Expand All @@ -18,6 +19,7 @@ const CreatePage = (props: IModalProp) => {
const [type, setType] = useState<'create' | 'edit'>('create');
const [recordId, setRecordId] = useState(0);
const [loading, setLoading] = useState(false);
const userId = usePageStore((store) => store.userInfo.userId);

// 暴露方法
useImperativeHandle(props.createRef, () => ({
Expand Down Expand Up @@ -71,25 +73,31 @@ const CreatePage = (props: IModalProp) => {
confirmLoading={loading}
onOk={handleOk}
onCancel={handleCancel}
width={500}
width={600}
okText="确定"
cancelText="取消"
>
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} initialValues={{ is_public: 1, is_edit: 1 }}>
<Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} initialValues={{ is_public: 1, is_edit: 1 }}>
<Form.Item label="名称" name="name" rules={[{ required: true, message: '请输入页面名称' }]}>
<Input placeholder="请输入页面名称" maxLength={15} showCount />
</Form.Item>
<Form.Item label="描述" name="remark">
<Input placeholder="请输入页面描述" maxLength={20} showCount />
</Form.Item>
<Form.Item label="权限" name="is_public" rules={[{ required: true, message: '请选择访问类型' }]}>
<Form.Item
label="权限"
name="is_public"
rules={[{ required: true, message: '请选择访问类型' }]}
extra="公开页面支持所有人访问。私有页面仅自己可访问。"
>
<Radio.Group>
<Radio value={1}>公开</Radio>
<Radio value={2}>私有</Radio>
<Radio value={3}>公开模板</Radio>
{/* 普通用户暂不开放模板设置 */}
{userId == 50 ? <Radio value={3}>公开模板</Radio> : null}
</Radio.Group>
</Form.Item>
<Form.Item label="模式" name="is_edit" rules={[{ required: true, message: '请选择编辑模式' }]}>
<Form.Item label="模式" name="is_edit" rules={[{ required: true, message: '请选择编辑模式' }]} extra="公开后设置他人可查看或编辑;">
<Radio.Group>
<Radio value={1}>编辑</Radio>
<Radio value={2}>查看</Radio>
Expand Down
1 change: 0 additions & 1 deletion packages/editor/src/components/Searchbar/index.module.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.searchBar {
padding-inline: 10px;
margin-bottom: 20px;
border-radius: 5px;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/StyleConfig/StyleConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const StyleConfig = () => {
</Flex>
</Form.Item>
)}
<Form.Item key={'overflow'} name={['scopeStyle', 'overflow']} label={'overflow'}>
<Form.Item key={'overflow'} name={['scopeStyle', 'overflow']} label="溢出">
<Select
placeholder={'请选择'}
options={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
border-bottom: 1px solid @border-color;
}
.logo {
width: 300px;
font-size: 20px;
display: flex;
align-items: center;
Expand All @@ -27,6 +26,8 @@
}
.menu {
flex: 1;
display: flex;
justify-content: center;
:global {
.ant-menu-horizontal {
border-bottom: none;
Expand Down
10 changes: 8 additions & 2 deletions packages/editor/src/layout/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
LoadingOutlined,
PieChartOutlined,
CloudOutlined,
ApartmentOutlined,
} from '@ant-design/icons';
import { toBlob } from 'html-to-image';
import { usePageStore } from '@/stores/pageStore';
Expand Down Expand Up @@ -80,6 +81,11 @@ const Header = memo(() => {
key: 'templates',
icon: <PieChartOutlined style={{ fontSize: 16 }} />,
},
{
label: '工作流',
key: 'workflows',
icon: <ApartmentOutlined style={{ fontSize: 16 }} />,
},
{
label: '图片云',
key: 'cloud',
Expand All @@ -88,7 +94,7 @@ const Header = memo(() => {
];

useEffect(() => {
if (['/projects', '/pages', '/libs', '/templates', '/cloud'].includes(location.pathname)) {
if (['/projects', '/pages', '/libs', '/templates', '/workflows', '/cloud'].includes(location.pathname)) {
setNav(true);
setNavKey([location.pathname.slice(1)]);
} else {
Expand Down Expand Up @@ -228,7 +234,7 @@ const Header = memo(() => {
{/* 首页 - 导航菜单 */}
{isNav && (
<div className={styles.menu}>
<Menu onClick={handleTab} selectedKeys={navKey} mode="horizontal" items={items} />
<Menu onClick={handleTab} selectedKeys={navKey} mode="horizontal" items={items} style={{ width: items.length * 110 }} />
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { getPageList, delPageData } from '@/api';
import { useNavigate } from 'react-router-dom';
import { Modal, message } from '@/utils/AntdGlobal';
import { usePageStore } from '@/stores/pageStore';
import CreatePage from '../../Header/CreatePage';

import CreatePage from '@/components/CreatePage';
/**
* 编辑器中,快捷操作页面列表
* 打开、修改、删除、新增页面
Expand Down
4 changes: 1 addition & 3 deletions packages/editor/src/packages/utils/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,7 @@ const handleVisible = async ({ action, next }: ActionNode<{ target: string; show
ref.hide({ ...data });
}
} else {
const expression = action.expression ?? {};
const formula = expression.value;
const result = renderFormula(formula);
const result = action.expression;
if (result) {
ref.show({ ...data });
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/pages/admin/menu/CreateMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Menu } from '@/api/types';
import { getMenuList, addMenu, updateMenu, getPageList } from '@/api';
import { PageItem } from '@/api/pageMember';
import { arrayToTree } from '@/utils/util';
import CreatePage from '@/layout/components/Header/CreatePage';
import CreatePage from '@/components/CreatePage';

export default function CreateMenu(props: IModalProp<Menu.EditParams>) {
const [form] = Form.useForm();
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/pages/home/LibList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getLibList } from '@/api/lib';
import { usePageStore } from '@/stores/pageStore';
import { message } from '@/utils/AntdGlobal';
import SearchBar from '@/components/Searchbar/SearchBar';
import CreateLib from '@/layout/components/Header/CreateLib';
import CreateLib from './lib/CreateLib';
import dayjs from 'dayjs';
import style from './index.module.less';

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/pages/home/PageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import dayjs from 'dayjs';
import { getPageList, copyPageData, delPageData } from '@/api';
import { PageItem } from '@/api/types';
import { message, Modal } from '@/utils/AntdGlobal';
import CreatePage from '@/layout/components/Header/CreatePage';
import CreatePage from '@/components/CreatePage';
import SearchBar from '@/components/Searchbar/SearchBar';
import styles from './index.module.less';

Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/pages/home/ProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function Index() {
const CardItem: React.FC<ProjectCardItemProps> = ({ item, isAuth }) => {
const getEnvTag = (env: 'stg' | 'pre' | 'prd', name: string) => {
return (
<a href={`${import.meta.env.VITE_ADMIN_URL}/project/stg/${item.id}`} target="_blank">
<a href={`${import.meta.env.VITE_ADMIN_URL}/project/${env}/${item.id}`} target="_blank">
{name}
</a>
);
Expand Down
15 changes: 4 additions & 11 deletions packages/editor/src/pages/home/index.module.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.project,
.pageList,
.libWrap {
.libWrap,
.workflow {
padding: 30px 20px;
height: calc(100vh - 64px);
overflow: auto;
Expand Down Expand Up @@ -72,16 +73,8 @@
background: none;
}
}
.footer {
display: flex;
flex-direction: row-reverse;
height: 35px;
border-top: 1px solid #f0f0f0;
padding-top: 12px;
}
.gabLeft {
margin-left: 4px;
}
}
.project {
.projectList {
flex: 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const CreateLib = (props: IModalProp) => {
setVisible(false);
};
return (
<Modal title="创建组件库" open={visible} onOk={handleOk} onCancel={handleCancel} width={500} okText="确定" cancelText="取消">
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<Modal title="创建组件库" open={visible} onOk={handleOk} onCancel={handleCancel} width={600} okText="确定" cancelText="取消">
<Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 17 }}>
<Form.Item
label="组件标识"
name="tag"
Expand Down
Loading

0 comments on commit 560111b

Please sign in to comment.