From 55d1b79ec8111be84036b2a4ef5349e983d700e3 Mon Sep 17 00:00:00 2001 From: SEN Date: Fri, 1 Mar 2024 15:59:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=B3=A8=E9=94=80=E8=B4=A6?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Common/DynamicCode/index.tsx | 86 ++++++++++++++++++++ src/components/DataPreview/session/index.tsx | 41 ++++++++++ src/ts/core/target/base/team.ts | 2 + 3 files changed, 129 insertions(+) create mode 100644 src/components/Common/DynamicCode/index.tsx diff --git a/src/components/Common/DynamicCode/index.tsx b/src/components/Common/DynamicCode/index.tsx new file mode 100644 index 000000000..fa07d7d6f --- /dev/null +++ b/src/components/Common/DynamicCode/index.tsx @@ -0,0 +1,86 @@ +import { model } from '@/ts/base'; +import { Button, Input, message, Space } from 'antd'; +import React, { useState } from 'react'; +import { AiOutlineLock, AiOutlineUser } from 'react-icons/ai'; +import orgCtrl from '@/ts/controller'; +import { getResouces } from '@/config/location'; + +interface DynamicCodeType { + /** 是否展示手机号 */ + showPhone?: boolean; + /** 修改手机号 */ + editPhone?: boolean; + /** 手机号 */ + account?: string; +} +const DynamicCode: React.FC = ({ + showPhone = true, + editPhone = true, + account, +}) => { + const resources = getResouces(); + const [formData, setFormData] = useState({ + account: account ?? '', + dynamicCode: '', + dynamicId: '', + }); + /** + * @description: 获取手机验证码 + * @return {*} + */ + const getDynamicCode = React.useCallback(async () => { + if (!/(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/.test(formData.account)) { + message.warn('请输入正确的手机号'); + return false; + } + const res = await orgCtrl.auth.dynamicCode({ + account: formData.account, + platName: resources.platName ?? '资产共享云', + dynamicId: '', + }); + if (res.success && res.data) { + setFormData({ ...formData, dynamicId: res.data.dynamicId }); + } + }, [formData]); + /** + * @description: 校验验证码 + * @return {*} + */ + const verifyCode = (): boolean => { + //TODO:验证手机号与 验证码匹配 + + return true; + }; + return ( + + {showPhone && ( + } + placeholder={`请输入手机号`} + size="large" + readOnly={!editPhone} + defaultValue={formData.account} + onChange={(e) => setFormData({ ...formData, account: e.target.value })} + /> + )} + {/*
短信验证码的编号为:{formData.dynamicId}
*/} + + } + placeholder={`请输入验证码`} + onChange={(e) => setFormData({ ...formData, dynamicCode: e.target.value })} + /> + + +
+ ); +}; + +export default DynamicCode; diff --git a/src/components/DataPreview/session/index.tsx b/src/components/DataPreview/session/index.tsx index 225f6f3a2..9ec8df154 100644 --- a/src/components/DataPreview/session/index.tsx +++ b/src/components/DataPreview/session/index.tsx @@ -9,6 +9,9 @@ import ChatBody from './chat'; import PreviewLayout from '../layout'; import { cleanMenus } from '@/utils/tools'; import useCtrlUpdate from '@/hooks/useCtrlUpdate'; +import { Button, Card, Modal, Space, Tag } from 'antd'; +import DynamicCode from '@/components/Common/DynamicCode'; + const SessionBody = ({ session, relation, @@ -20,6 +23,7 @@ const SessionBody = ({ }) => { const [actions, setActions] = useState<{ key: string; label: string }[]>([]); const [bodyType, setBodyType] = useState(''); + const [openConfirm, setOpenConfirm] = useState(false); useEffect(() => { const newActions = [ @@ -97,6 +101,41 @@ const SessionBody = ({ /> ); }; + const SettingInfo: React.FC<{ target: ITarget }> = ({ target }) => { + return ( + <> + + + + { + const success = true; + // await target.delete(); + if (success) { + setOpenConfirm(false); + sessionStorage.clear(); + window.location.href = '/#/auth'; + // window.location.reload(); + } + }} + onCancel={() => setOpenConfirm(false)}> + + + 您正在进行高危操作: 账号注销( {target.name}) + +
+ 账号注销后,所有信息将会销毁且无法找回,请谨慎操作 +
+
+ +
+ + ); + }; const loadContext = () => { switch (bodyType) { @@ -108,6 +147,8 @@ const SessionBody = ({ return ; case 'relation': return ; + case 'setting': + return ; default: return <>; } diff --git a/src/ts/core/target/base/team.ts b/src/ts/core/target/base/team.ts index b7b977722..3b1b1af63 100644 --- a/src/ts/core/target/base/team.ts +++ b/src/ts/core/target/base/team.ts @@ -207,6 +207,8 @@ export abstract class Team extends Entity implements ITeam { if (notity) { kernel.unSubscribe(this.key); } + console.log('notity',notity); + return notity; } async hardDelete(notity: boolean = false): Promise { -- Gitee From bb9b6aaa4858b84d92178da52c16e3283d1b9780 Mon Sep 17 00:00:00 2001 From: RDLI <2164126847@qq.com> Date: Fri, 1 Mar 2024 16:54:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=96=B9=E5=BC=8F=E4=BC=98=E5=8C=96(?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B3=E8=81=94=E4=BA=8B=E9=A1=B9=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=92=8C=E4=BA=8B=E9=A1=B9=E6=9F=A5=E7=9C=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/executor/open/form/index.tsx | 46 ++++-- src/executor/open/form/matters/index.tsx | 141 ++++++++++++++++++ .../open/form/relateMatters/index.tsx | 55 +++++++ .../operate/entityForm/labelsForm.tsx | 13 ++ src/ts/base/schema.ts | 2 + 5 files changed, 248 insertions(+), 9 deletions(-) create mode 100644 src/executor/open/form/matters/index.tsx create mode 100644 src/executor/open/form/relateMatters/index.tsx diff --git a/src/executor/open/form/index.tsx b/src/executor/open/form/index.tsx index 7e64933d5..9fba259d4 100644 --- a/src/executor/open/form/index.tsx +++ b/src/executor/open/form/index.tsx @@ -14,7 +14,8 @@ import { Spin, message } from 'antd'; import ThingView from './detail'; import useAsyncLoad from '@/hooks/useAsyncLoad'; import { Theme } from '@/config/theme'; -import { model } from '@/ts/base'; +import RelateMatters from './relateMatters'; +import Matters from './matters'; interface IProps { form: IForm; @@ -37,9 +38,36 @@ const FormView: React.FC = ({ form, finished }) => { if (!selectMenu || !rootMenu) return <>; const loadContent = () => { if (select) { - return ( - setSelcet(undefined)} /> - ); + switch (form.metadata.openType) { + case '事项': + //办事视图明细 查看 + return ( + setSelcet(undefined)} + openForm={form.metadata.id} + /> + ); + // 关联事项表单查看 + case '关联事项': + return ( + setSelcet(undefined)} + /> + ); + default: + //默认卡片视图 + return ( + setSelcet(undefined)} + /> + ); + } } return ( = ({ form, finished }) => { dataSource={ new CustomStore({ key: 'id', - async load(loadOptions:any) { + async load(loadOptions: any) { // TODO: 需要杨老师在此处完善数据查询逻辑; // 注释部分是老的分类筛选组件查询逻辑,已弃用 @@ -65,12 +93,12 @@ const FormView: React.FC = ({ form, finished }) => { // species.forEach((it) => { // allSpecies.push(...(it.speciesList || [])); // }); - if(form.metadata.options?.dataRange?.classifyExp){ + if (form.metadata.options?.dataRange?.classifyExp) { loadOptions.options = { - match: JSON.parse(form.metadata.options.dataRange.classifyExp) - } + match: JSON.parse(form.metadata.options.dataRange.classifyExp), + }; } - + if ( filterExp && filterExp.length > 0 diff --git a/src/executor/open/form/matters/index.tsx b/src/executor/open/form/matters/index.tsx new file mode 100644 index 000000000..1d4e88f2b --- /dev/null +++ b/src/executor/open/form/matters/index.tsx @@ -0,0 +1,141 @@ +import { Card, Table } from 'antd'; +import React, { useState, useEffect } from 'react'; +import { ImUndo2 } from 'react-icons/im'; +import { IForm } from '@/ts/core'; +import { schema } from '@/ts/base'; +import orgCtrl from '@/ts/controller'; +import { InstanceDataModel } from '@/ts/base/model'; +import EntityIcon from '@/components/Common/GlobalComps/entityIcon'; +import WorkForm from '@/executor/tools/workForm'; + +/** + * 事项-查看 + */ +interface IProps { + form: IForm; + thingData: schema.XThing; + onBack: () => void; + openForm: string; // 打开的表单 +} +const columns = [ + { + title: '单位名称', + dataIndex: 'belongId', + render: (text: string) => , + }, + { + title: '审批人', + dataIndex: 'createUser', + render: (text: string) => , + }, + { + title: '节点', + dataIndex: 'title', + }, + { + title: '审批时间', + dataIndex: 'createTime', + }, + { + title: '备注信息', + width: 300, + dataIndex: 'comment', + }, +]; +/** + * 物-查看 + * @returns + */ +const WorkFormView: React.FC = (props) => { + const hasDoneTasks = Object.values(props.thingData.archives); + const instance = hasDoneTasks[0]; + const [task, setTask] = useState(); + const [data, setData] = useState(); + const belong = + orgCtrl.user.companys.find((a) => a.id == instance?.belongId) || orgCtrl.user; + + useEffect(() => { + setTimeout(async () => { + const detail = await orgCtrl.work.loadInstanceDetail( + instance.id, + instance.belongId, + ); + if (detail) { + setTask(detail.tasks); + setData(JSON.parse(detail.data || '{}')); + } + }, 0); + }, []); + + /** 渲染表单 */ + const renderWorkForm = () => { + if (!data || !task) { + return <>; + } + const instanceList = [ + { + title: '开始', + belongId: instance?.belongId, + createTime: instance?.createTime, + createUser: instance?.createUser, + comment: '提交', + }, + ]; + task.forEach((tItem) => { + if (!tItem.records) { + return; + } + const instanceItems: any[] = tItem.records?.map((record: any) => { + return { + title: tItem.title, + belongId: instance?.belongId, + createTime: record.createTime, + createUser: record.createUser, + comment: record.comment ?? '同意', + }; + }); + instanceList.push(...instanceItems); + }); + return ( + <> + {data && ( + <> + + 流程明细} + columns={columns} + size="small" + dataSource={instanceList} + /> + + )} + + ); + }; + + return ( + { + props.onBack(); + }}> + + + + 返回 + + }> + {renderWorkForm()} + + ); +}; + +export default WorkFormView; diff --git a/src/executor/open/form/relateMatters/index.tsx b/src/executor/open/form/relateMatters/index.tsx new file mode 100644 index 000000000..d4c75f3cb --- /dev/null +++ b/src/executor/open/form/relateMatters/index.tsx @@ -0,0 +1,55 @@ +import { Card, Tabs } from 'antd'; +import React from 'react'; +import { ImUndo2 } from 'react-icons/im'; +import { IForm } from '@/ts/core'; +import { schema } from '@/ts/base'; +import ThingArchive from '../detail/archive'; +interface IProps { + form: IForm; + thingData: schema.XThing; + onBack: () => void; +} + +/** + * 关联事项 + * @returns + */ +const RelateMatters: React.FC = (props) => { + const doneTasks = Object.values(props.thingData.archives); + + /** 加载每一项 */ + const loadItems = () => { + const items = []; + for (const task of doneTasks) { + items.push({ + key: task.id, + label: task.title, + forceRender: true, + children: , + }); + } + return items; + }; + + return ( + + { + props.onBack(); + }}> + + + + 返回 + + } + /> + + ); +}; + +export default RelateMatters; diff --git a/src/executor/operate/entityForm/labelsForm.tsx b/src/executor/operate/entityForm/labelsForm.tsx index 58a74a5cc..0ca84dba0 100644 --- a/src/executor/operate/entityForm/labelsForm.tsx +++ b/src/executor/operate/entityForm/labelsForm.tsx @@ -103,6 +103,19 @@ const LabelsForm = (props: Iprops) => { rules: [{ required: true, message: '类型为必填项' }], }, }, + { + title: '查看方式', + dataIndex: 'openType', + valueType: 'select', + fieldProps: { + options: ['卡片', '事项', '关联事项'].map((i) => { + return { + value: i, + label: i, + }; + }), + }, + }, { title: '存储位置', dataIndex: 'collName', diff --git a/src/ts/base/schema.ts b/src/ts/base/schema.ts index bc61643b0..325a18bed 100644 --- a/src/ts/base/schema.ts +++ b/src/ts/base/schema.ts @@ -201,6 +201,8 @@ export type XForm = { options: XFormProps | undefined; // 表单的特性 attributes: XAttribute[]; + //打开方式 + openType?: string; // 使用表单的流程节点 bindNodes: XWorkNode[] | undefined; // 表单的目录 -- Gitee From 4401a7f9f50e677ee65dc387c72fe03e6cc7f69d Mon Sep 17 00:00:00 2001 From: SEN Date: Fri, 1 Mar 2024 17:29:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E8=B4=A6=E5=8F=B7=E6=B3=A8?= =?UTF-8?q?=E9=94=80=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Common/DynamicCode/index.tsx | 27 ++++++++++------ src/components/DataPreview/session/index.tsx | 33 +++++++++++--------- src/ts/core/target/base/team.ts | 2 -- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/components/Common/DynamicCode/index.tsx b/src/components/Common/DynamicCode/index.tsx index fa07d7d6f..ee74d7a47 100644 --- a/src/components/Common/DynamicCode/index.tsx +++ b/src/components/Common/DynamicCode/index.tsx @@ -1,23 +1,21 @@ -import { model } from '@/ts/base'; import { Button, Input, message, Space } from 'antd'; -import React, { useState } from 'react'; +import React, { useImperativeHandle, useState, forwardRef } from 'react'; import { AiOutlineLock, AiOutlineUser } from 'react-icons/ai'; +import { model } from '@/ts/base'; import orgCtrl from '@/ts/controller'; import { getResouces } from '@/config/location'; interface DynamicCodeType { /** 是否展示手机号 */ showPhone?: boolean; - /** 修改手机号 */ + /** 是否可修改手机号 */ editPhone?: boolean; /** 手机号 */ account?: string; } -const DynamicCode: React.FC = ({ - showPhone = true, - editPhone = true, - account, -}) => { +// eslint-disable-next-line react/display-name +const DynamicCode = forwardRef((props: DynamicCodeType, ref: any) => { + const { showPhone = true, editPhone = true, account } = props; const resources = getResouces(); const [formData, setFormData] = useState({ account: account ?? '', @@ -35,7 +33,7 @@ const DynamicCode: React.FC = ({ } const res = await orgCtrl.auth.dynamicCode({ account: formData.account, - platName: resources.platName ?? '资产共享云', + platName: `${resources.platName ?? '资产共享云'}_注销账户`, dynamicId: '', }); if (res.success && res.data) { @@ -47,10 +45,19 @@ const DynamicCode: React.FC = ({ * @return {*} */ const verifyCode = (): boolean => { + if (!formData.dynamicId || !formData.dynamicCode) { + message.warning('请先获取验证码'); + return false; + } //TODO:验证手机号与 验证码匹配 + console.log('TODO:验证手机号与 验证码匹配', formData); return true; }; + useImperativeHandle(ref, () => ({ + // 暴露给父组件的方法 + verifyCode, + })); return ( {showPhone && ( @@ -81,6 +88,6 @@ const DynamicCode: React.FC = ({ ); -}; +}); export default DynamicCode; diff --git a/src/components/DataPreview/session/index.tsx b/src/components/DataPreview/session/index.tsx index 9ec8df154..a3aa67e34 100644 --- a/src/components/DataPreview/session/index.tsx +++ b/src/components/DataPreview/session/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { IFile, ISession, ITarget, TargetType } from '@/ts/core'; import { command } from '@/ts/base'; import Directory from '@/components/Directory'; @@ -11,6 +11,7 @@ import { cleanMenus } from '@/utils/tools'; import useCtrlUpdate from '@/hooks/useCtrlUpdate'; import { Button, Card, Modal, Space, Tag } from 'antd'; import DynamicCode from '@/components/Common/DynamicCode'; +import { AiFillWarning } from 'react-icons/ai'; const SessionBody = ({ session, @@ -24,6 +25,7 @@ const SessionBody = ({ const [actions, setActions] = useState<{ key: string; label: string }[]>([]); const [bodyType, setBodyType] = useState(''); const [openConfirm, setOpenConfirm] = useState(false); + const DynamicRef = useRef(); useEffect(() => { const newActions = [ @@ -113,25 +115,28 @@ const SessionBody = ({ title="账号注销" open={openConfirm} onOk={async () => { - const success = true; - // await target.delete(); - if (success) { - setOpenConfirm(false); - sessionStorage.clear(); - window.location.href = '/#/auth'; - // window.location.reload(); + if (DynamicRef.current && DynamicRef.current.verifyCode()) { + if (await target.delete()) { + setOpenConfirm(false); + sessionStorage.clear(); + window.location.href = '/#/auth'; + } } }} onCancel={() => setOpenConfirm(false)}> - + - 您正在进行高危操作: 账号注销( {target.name}) + 您正在进行高危操作: 账号注销( {target.name}) -
- 账号注销后,所有信息将会销毁且无法找回,请谨慎操作 -
+
账号注销后,所有信息将会销毁且无法找回
+
请谨慎操作
- + ); diff --git a/src/ts/core/target/base/team.ts b/src/ts/core/target/base/team.ts index 3b1b1af63..b7b977722 100644 --- a/src/ts/core/target/base/team.ts +++ b/src/ts/core/target/base/team.ts @@ -207,8 +207,6 @@ export abstract class Team extends Entity implements ITeam { if (notity) { kernel.unSubscribe(this.key); } - console.log('notity',notity); - return notity; } async hardDelete(notity: boolean = false): Promise { -- Gitee