@@ -17,7 +17,7 @@ const CreateForm = (props) => { | |||
> | |||
<Form | |||
layout="horizontal" | |||
labelCol={{ span: 4 }} | |||
labelCol={{ span: 6 }} | |||
preserve={false} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -33,9 +33,9 @@ const CreateForm = (props) => { | |||
<Input placeholder="请输入管理员姓名" /> | |||
</Form.Item> | |||
<Form.Item name="email" label="邮箱账号" rules={[{ required: true, max: 50,message:"请输入邮箱账号"},{pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, | |||
message: '邮箱格式不正确', }]}> | |||
<Input placeholder="电子邮件是登录账户" disabled={props.values.id?true:false} /> | |||
<Form.Item name="email" label="登陆账号(手机号)" rules={[{ required: true, max: 50,message:"请输入手机号"},{pattern: /^1[3-9][0-9]{9}$/, | |||
message: '手机号格式不正确', }]}> | |||
<Input placeholder="手机号是登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
{/* <Form.Item name="type" label="所属平台" rules={[{ required: true }]}> | |||
<Select placeholder='请选择所属平台' allowClear options={[ | |||
@@ -53,10 +53,10 @@ message: '邮箱格式不正确', }]}> | |||
}, | |||
]}/> | |||
</Form.Item> */} | |||
<Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="电话" rules={[{ max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入电话" /> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item name="remark" label="备注" rules={[{ max: 100 }]}> | |||
<Input placeholder="请输入备注" /> | |||
</Form.Item> | |||
@@ -338,6 +338,7 @@ const companyManage = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone=value.email; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -172,6 +172,9 @@ const handleAdd = async (fields) => { | |||
<a | |||
key="config" | |||
onClick={() => { | |||
if(record.pid=="0"){ | |||
record.pid=null; | |||
} | |||
handleModalVisible(true); | |||
setCurrentRow(record); | |||
}} | |||
@@ -292,24 +295,24 @@ const handleAdd = async (fields) => { | |||
)} | |||
<CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -145,6 +145,9 @@ const TableList = () => { | |||
<a | |||
key="primary3" | |||
onClick={() => { | |||
if(record.pid==0){ | |||
record.pid=null; | |||
} | |||
setStepFormValues(record); | |||
handleModalVisible(true); | |||
}} | |||
@@ -310,24 +313,24 @@ const TableList = () => { | |||
)} | |||
{ | |||
createModalVisible && <CreateForm | |||
treeDatas={ | |||
[ | |||
{ | |||
key: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: treeData, | |||
}, | |||
] || [ | |||
{ | |||
id: '0', | |||
parentId: '0', | |||
title: '顶级', | |||
value: '0', | |||
children: [], | |||
}, | |||
] | |||
treeDatas={treeData | |||
// [ | |||
// { | |||
// key: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: treeData, | |||
// }, | |||
// ] || [ | |||
// { | |||
// id: '0', | |||
// parentId: '0', | |||
// title: '顶级', | |||
// value: '0', | |||
// children: [], | |||
// }, | |||
// ] | |||
} | |||
onFinish={async (value) => { | |||
var success = false; | |||
@@ -1,5 +1,5 @@ | |||
import React,{useEffect,useState} from 'react'; | |||
import { Modal, Form, Input, Button, Select } from 'antd'; | |||
import { Modal, Form, Input, Button, Select,TreeSelect } from 'antd'; | |||
import api from './service' | |||
const CreateForm = (props) => { | |||
@@ -32,7 +32,7 @@ const CreateForm = (props) => { | |||
preserve={false} | |||
layout="horizontal" | |||
labelCol={{ | |||
span: 4, | |||
span: 6, | |||
}} | |||
initialValues={props.values} | |||
onFinish={props.onFinish} | |||
@@ -40,21 +40,31 @@ const CreateForm = (props) => { | |||
<Form.Item name="id" hidden={true}> | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户" rules={[{ required: true, max: 255 }]}> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
{/* <Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> */} | |||
<TreeSelect | |||
style={{ width: '100%' }} | |||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} | |||
treeData={props.treeDatas} | |||
placeholder="请选择上级名称" | |||
treeDefaultExpandAll | |||
/> | |||
</Form.Item> | |||
<Form.Item name="account" label="登录账户(手机号)" rules={[{ required: true, max: 255,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确'}]}> | |||
<Input placeholder="请输入登录账户" disabled={props.values.id?true:false} /> | |||
</Form.Item> | |||
<Form.Item name="name" label="用户姓名" rules={[{ required: true, max: 255 }]}> | |||
<Input placeholder="请输入用户姓名" /> | |||
</Form.Item> | |||
<Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
{/* <Form.Item name="phone" label="用户手机" rules={[{ required: true,max: 20,pattern: /0?(13|14|15|18|17)[0-9]{9}$/, | |||
message: '手机号格式不正确' }]}> | |||
<Input placeholder="请输入用户手机" /> | |||
</Form.Item> | |||
<Form.Item name="sysOrgId" label="所属组织" rules={[{ required: true }]}> | |||
<Select placeholder="请选择所属组织"> | |||
{orgData} | |||
</Select> | |||
</Form.Item> | |||
</Form.Item> */} | |||
<Form.Item> | |||
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} > | |||
取消 | |||
@@ -1,6 +1,6 @@ | |||
import { PlusOutlined } from '@ant-design/icons'; | |||
import { Button, message, Select,Popconfirm } from 'antd'; | |||
import React, { useState, useRef } from 'react'; | |||
import React, { useState, useRef,useEffect } from 'react'; | |||
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; | |||
import ProTable from '@ant-design/pro-table'; | |||
import CreateForm from './components/CreateForm' | |||
@@ -84,6 +84,7 @@ const userManager = () => { | |||
const [selectDatas, SetselectData] = useState(); | |||
const [sysUserId, SetSysUserId] = useState(); | |||
const [account, setaccount] = useState(); | |||
const [treeData, setTreeData] = useState(); | |||
const InitRole = (id) => { | |||
SetSysUserId(id); | |||
api.GetRoleDic().then(r => { | |||
@@ -221,6 +222,18 @@ const userManager = () => { | |||
render: (_, record) => Btn(record) | |||
}, | |||
]; | |||
useEffect(() => { | |||
initfranchiseeType(); | |||
}, []); | |||
function initfranchiseeType() { | |||
api.gettree2().then((r) => { | |||
debugger | |||
setTreeData(r.data); | |||
});api | |||
} | |||
return ( | |||
<PageContainer host header={{ | |||
title: '', | |||
@@ -298,6 +311,7 @@ const userManager = () => { | |||
if (value.id) { | |||
success = await handleUpdate(value); | |||
} else { | |||
value.phone= value.account; | |||
success = await handleAdd(value); | |||
} | |||
if (success) { | |||
@@ -314,6 +328,7 @@ const userManager = () => { | |||
handleModalVisible(false); | |||
setStepFormValues({}); | |||
}} | |||
treeDatas={treeData} | |||
modalVisible={createModalVisible} | |||
values={stepFormValues || {}} | |||
/> | |||
@@ -85,6 +85,15 @@ function gettree(params) { | |||
}); | |||
} | |||
function gettree2(params) { | |||
return request(getDataBaseUrl()+'/api/organize/tree', { | |||
method: 'GET', | |||
data: { | |||
...params, | |||
}, | |||
}); | |||
} | |||
export default { | |||
Page, | |||
Enable, | |||
@@ -99,5 +108,6 @@ export default { | |||
AddUserRole, | |||
UpdateUserRole, | |||
SetDataRole, | |||
gettree | |||
gettree, | |||
gettree2 | |||
}; |