修改规范
This commit is contained in:
parent
55b6eb931c
commit
149675a7e0
|
|
@ -1,84 +0,0 @@
|
||||||
// 创建弹窗
|
|
||||||
import React, { useRef } from 'react';
|
|
||||||
import { createForm } from '@formily/core';
|
|
||||||
import { createSchemaField } from '@formily/react';
|
|
||||||
import Modal, { ModalProps } from '@/components/Modal';
|
|
||||||
import { Form, FormItem, Input, Select } from '@formily/antd';
|
|
||||||
import { addUser } from '@/services/system/accountManage';
|
|
||||||
|
|
||||||
interface AddAccountModalPropsType extends ModalProps {
|
|
||||||
onCancel: () => void;
|
|
||||||
onOk: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SchemaField = createSchemaField({
|
|
||||||
components: {
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = createForm({});
|
|
||||||
|
|
||||||
const AddAccountModal = ({ onOk, onCancel, ...rest }: AddAccountModalPropsType) => {
|
|
||||||
const handleOk = async () => {
|
|
||||||
form.submit(async () => {
|
|
||||||
onOk();
|
|
||||||
const formState = form.getFormState();
|
|
||||||
formState.values.role = parseInt(formState.values.role);
|
|
||||||
await addUser(formState.values);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
onCancel();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal title="添加管理账号" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
|
|
||||||
<Form form={form} labelCol={4} wrapperCol={18}>
|
|
||||||
<SchemaField>
|
|
||||||
<SchemaField.String
|
|
||||||
name="name"
|
|
||||||
title="账号名"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请输入账号名',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="password"
|
|
||||||
title="密码"
|
|
||||||
required
|
|
||||||
x-validator={{
|
|
||||||
required: true,
|
|
||||||
}}
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请输入密码',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="role"
|
|
||||||
title="角色"
|
|
||||||
required
|
|
||||||
x-validator={{
|
|
||||||
required: true,
|
|
||||||
}}
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请选择角色',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</SchemaField>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddAccountModal;
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
// 创建弹窗
|
|
||||||
import React, { useRef, useEffect } from 'react';
|
|
||||||
import { createForm } from '@formily/core';
|
|
||||||
import { createSchemaField } from '@formily/react';
|
|
||||||
import Modal, { ModalProps } from '@/components/Modal';
|
|
||||||
import { Form, FormItem, Input, Select } from '@formily/antd';
|
|
||||||
import { addUser, updateUser } from '@/services/system/accountManage';
|
|
||||||
|
|
||||||
interface AddUserModalPropsType extends ModalProps {
|
|
||||||
editModalData: any;
|
|
||||||
onCancel: () => void;
|
|
||||||
onOk: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SchemaField = createSchemaField({
|
|
||||||
components: {
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = createForm({});
|
|
||||||
|
|
||||||
const AddUserModal = ({ onOk, onCancel, editModalData, ...rest }: AddUserModalPropsType) => {
|
|
||||||
useEffect(() => {
|
|
||||||
form.setInitialValues(editModalData);
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleOk = async () => {
|
|
||||||
onOk();
|
|
||||||
const formState = form.getFormState();
|
|
||||||
formState.values.role = parseInt(formState.values.role);
|
|
||||||
await updateUser(formState.values);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
onCancel();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal title="编辑管理账号" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
|
|
||||||
<Form form={form} labelCol={4} wrapperCol={18}>
|
|
||||||
<SchemaField>
|
|
||||||
<SchemaField.String
|
|
||||||
name="name"
|
|
||||||
title="账号名"
|
|
||||||
required
|
|
||||||
x-disabled
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请输入账号名',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="password"
|
|
||||||
title="密码"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请输入密码',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="role"
|
|
||||||
title="角色"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
x-component-props={{
|
|
||||||
placeholder: '请选择角色',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</SchemaField>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddUserModal;
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
// 添加代币类型弹窗
|
|
||||||
import React, { useRef } from 'react';
|
|
||||||
import { createForm } from '@formily/core';
|
|
||||||
import { createSchemaField } from '@formily/react';
|
|
||||||
import Modal, { ModalProps } from '@/components/Modal';
|
|
||||||
import { Form, FormItem, Input, Select } from '@formily/antd';
|
|
||||||
|
|
||||||
interface AddNoticeModalPropsType extends ModalProps {
|
|
||||||
onOk: (val: any) => void;
|
|
||||||
onCancel: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SchemaField = createSchemaField({
|
|
||||||
components: {
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = createForm({});
|
|
||||||
|
|
||||||
const AddNoticeModal = ({ onOk, onCancel, ...rest }: AddNoticeModalPropsType) => {
|
|
||||||
const handleOk = () => {
|
|
||||||
const formState = form.getFormState();
|
|
||||||
formState.values.code = parseInt(formState.values.code);
|
|
||||||
onOk(formState.values);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
onCancel();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal title="添加通知" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
|
|
||||||
<Form form={form} labelCol={4} wrapperCol={18}>
|
|
||||||
<SchemaField>
|
|
||||||
<SchemaField.String
|
|
||||||
name="code"
|
|
||||||
title="通知码"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="addr"
|
|
||||||
title="通知地址"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
/>
|
|
||||||
<SchemaField.Boolean
|
|
||||||
name="status"
|
|
||||||
title="状态"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Select"
|
|
||||||
enum={[
|
|
||||||
{ label: '启用', value: true },
|
|
||||||
{ label: '禁用', value: false },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</SchemaField>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddNoticeModal;
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
// 修改弹窗
|
|
||||||
import React, { useRef, useEffect } from 'react';
|
|
||||||
import { createForm } from '@formily/core';
|
|
||||||
import { createSchemaField } from '@formily/react';
|
|
||||||
import Modal, { ModalProps } from '@/components/Modal';
|
|
||||||
import { Form, FormItem, Input, Select } from '@formily/antd';
|
|
||||||
|
|
||||||
interface EditNoticeModalPropsType extends ModalProps {
|
|
||||||
editModalData: any;
|
|
||||||
onOk: (val: any) => void;
|
|
||||||
onCancel: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SchemaField = createSchemaField({
|
|
||||||
components: {
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = createForm({});
|
|
||||||
|
|
||||||
const EditNoticeModal = ({ onOk, onCancel, editModalData, ...rest }: EditNoticeModalPropsType) => {
|
|
||||||
useEffect(() => {
|
|
||||||
form.setInitialValues(editModalData);
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleOk = () => {
|
|
||||||
const formState = form.getFormState();
|
|
||||||
onOk(formState.values);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
onCancel();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal title="修改通知" onOk={handleOk} onCancel={handleCancel} width={800} {...rest}>
|
|
||||||
<Form form={form} labelCol={4} wrapperCol={18}>
|
|
||||||
<SchemaField>
|
|
||||||
<SchemaField.String
|
|
||||||
name="code"
|
|
||||||
title="通知码"
|
|
||||||
x-disabled
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
/>
|
|
||||||
<SchemaField.String
|
|
||||||
name="addr"
|
|
||||||
title="通知地址"
|
|
||||||
required
|
|
||||||
x-decorator="FormItem"
|
|
||||||
x-component="Input"
|
|
||||||
/>
|
|
||||||
</SchemaField>
|
|
||||||
</Form>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditNoticeModal;
|
|
||||||
Loading…
Reference in New Issue