feat(前端):终端绑定用户
parent
c96a251bde
commit
36f8dca46f
|
@ -60,24 +60,26 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
destroyOnHidden={true}
|
destroyOnHidden={true}
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
footer={
|
footer={null}
|
||||||
<div style={{ display: 'flex', justifyContent: 'right' }}>
|
// footer={
|
||||||
<Button
|
// <div style={{ display: 'flex', justifyContent: 'right' }}>
|
||||||
type="primary"
|
// <Button
|
||||||
onClick={handleOk}
|
// type="primary"
|
||||||
style={{ marginRight: '20px' }}
|
// onClick={handleOk}
|
||||||
>
|
// style={{ marginRight: '20px' }}
|
||||||
确定
|
// >
|
||||||
</Button>
|
// 确定
|
||||||
<Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
// </Button>
|
||||||
取消
|
// <Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
||||||
</Button>
|
// 取消
|
||||||
</div>
|
// </Button>
|
||||||
}
|
// </div>
|
||||||
|
// }
|
||||||
>
|
>
|
||||||
<div className={styles.model_content}>
|
<div className={styles.model_content}>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
onFinish={handleOk}
|
||||||
labelCol={{ span: 4 }}
|
labelCol={{ span: 4 }}
|
||||||
wrapperCol={{ span: 19 }}
|
wrapperCol={{ span: 19 }}
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
|
@ -97,6 +99,16 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea rows={4} />
|
<Input.TextArea rows={4} />
|
||||||
</Form.Item> */}
|
</Form.Item> */}
|
||||||
|
<Form.Item label={null}>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
style={{ marginRight: '20px' }}
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -9,8 +9,6 @@ import SelectedTable from '../selectedTable';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
interface UserEditModalProps {
|
interface UserEditModalProps {
|
||||||
// visible: boolean;
|
|
||||||
// orgTreeData?: User.OrganizationNode[];
|
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
onOk: (values?: any) => void;
|
onOk: (values?: any) => void;
|
||||||
confirmLoading?: boolean;
|
confirmLoading?: boolean;
|
||||||
|
@ -26,7 +24,7 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
dataDetial,
|
dataDetial,
|
||||||
}) => {
|
}) => {
|
||||||
const { recordData, visible } = dataDetial || {};
|
const { recordData, visible } = dataDetial || {};
|
||||||
const { device_id, device_group_id } = recordData || {};
|
const { device_id } = recordData || {};
|
||||||
const [orgTreeData, setOrgTreeData] = useState<User.OrganizationNode[]>([]);
|
const [orgTreeData, setOrgTreeData] = useState<User.OrganizationNode[]>([]);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
@ -98,7 +96,6 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
user_id: record_id,
|
user_id: record_id,
|
||||||
id: id,
|
id: id,
|
||||||
device_id,
|
device_id,
|
||||||
device_group_id,
|
|
||||||
type: type,
|
type: type,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -107,7 +104,6 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
user_group_id: record_id,
|
user_group_id: record_id,
|
||||||
id: id,
|
id: id,
|
||||||
device_id: device_id,
|
device_id: device_id,
|
||||||
device_group_id,
|
|
||||||
type: type,
|
type: type,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -116,14 +112,17 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
data: list,
|
data: list,
|
||||||
};
|
};
|
||||||
bindUserAdd(payload)
|
bindUserAdd(payload)
|
||||||
.then(() => {
|
.then((res: any) => {
|
||||||
message.success('绑定成功');
|
const { code } = res || {};
|
||||||
onOk();
|
if (code === ERROR_CODE) {
|
||||||
|
message.success('绑定成功');
|
||||||
|
onOk();
|
||||||
|
} else {
|
||||||
|
message.error('绑定失败');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
console.log('list=====', list);
|
|
||||||
onOk(list);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('请检查表单字段');
|
message.error('请检查表单字段');
|
||||||
}
|
}
|
||||||
|
@ -142,24 +141,26 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
destroyOnHidden={true}
|
destroyOnHidden={true}
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
footer={
|
footer={null}
|
||||||
<div style={{ display: 'flex', justifyContent: 'right' }}>
|
// footer={
|
||||||
<Button
|
// <div style={{ display: 'flex', justifyContent: 'right' }}>
|
||||||
type="primary"
|
// <Button
|
||||||
onClick={handleOk}
|
// type="primary"
|
||||||
style={{ marginRight: '20px' }}
|
// onClick={handleOk}
|
||||||
>
|
// style={{ marginRight: '20px' }}
|
||||||
确定
|
// >
|
||||||
</Button>
|
// 确定
|
||||||
<Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
// </Button>
|
||||||
取消
|
// <Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
||||||
</Button>
|
// 取消
|
||||||
</div>
|
// </Button>
|
||||||
}
|
// </div>
|
||||||
|
// }
|
||||||
>
|
>
|
||||||
<div className={styles.model_content}>
|
<div className={styles.model_content}>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
onFinish={handleOk}
|
||||||
labelCol={{ span: 4 }}
|
labelCol={{ span: 4 }}
|
||||||
wrapperCol={{ span: 19 }}
|
wrapperCol={{ span: 19 }}
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
|
@ -179,6 +180,16 @@ const BindUserModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea rows={4} />
|
<Input.TextArea rows={4} />
|
||||||
</Form.Item> */}
|
</Form.Item> */}
|
||||||
|
<Form.Item label={null}>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
style={{ marginRight: '20px' }}
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -44,7 +44,7 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
const { code } = res || {};
|
const { code } = res || {};
|
||||||
if (code === ERROR_CODE) {
|
if (code === ERROR_CODE) {
|
||||||
message.success('保存成功');
|
message.success('保存成功');
|
||||||
onOk();
|
if (onOk) onOk();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('保存失败');
|
message.error('保存失败');
|
||||||
|
@ -76,23 +76,25 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
// 按钮居中对其
|
// 按钮居中对其
|
||||||
footer={
|
footer={null}
|
||||||
<div style={{ display: 'flex', justifyContent: 'right' }}>
|
// footer={
|
||||||
<Button
|
// <div style={{ display: 'flex', justifyContent: 'right' }}>
|
||||||
type="primary"
|
// <Button
|
||||||
onClick={handleOk}
|
// type="primary"
|
||||||
style={{ marginRight: '20px' }}
|
// onClick={handleOk}
|
||||||
>
|
// style={{ marginRight: '20px' }}
|
||||||
确定
|
// >
|
||||||
</Button>
|
// 确定
|
||||||
<Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
// </Button>
|
||||||
取消
|
// <Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
||||||
</Button>
|
// 取消
|
||||||
</div>
|
// </Button>
|
||||||
}
|
// </div>
|
||||||
|
// }
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
onFinish={handleOk}
|
||||||
labelCol={{ span: 5 }}
|
labelCol={{ span: 5 }}
|
||||||
wrapperCol={{ span: 18 }}
|
wrapperCol={{ span: 18 }}
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
|
@ -136,7 +138,7 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Select options={DEVICE_TYPE_OPTIONS} />
|
<Select options={DEVICE_TYPE_OPTIONS} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="model"
|
name="model"
|
||||||
label="型号"
|
label="型号"
|
||||||
rules={[{ required: false, message: '请输入显示名称' }]}
|
rules={[{ required: false, message: '请输入显示名称' }]}
|
||||||
|
@ -164,6 +166,16 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea rows={4} />
|
<Input.TextArea rows={4} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label={null}>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
style={{ marginRight: '20px' }}
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,7 +20,7 @@ const DeletableTable: React.FC<DeletableTableProps> = (props) => {
|
||||||
onDelete,
|
onDelete,
|
||||||
isSerial = true,
|
isSerial = true,
|
||||||
isAction = true,
|
isAction = true,
|
||||||
scrollY = 300,
|
scrollY = 400,
|
||||||
...restProps
|
...restProps
|
||||||
} = props;
|
} = props;
|
||||||
console.log("datasource=====",dataSource);
|
console.log("datasource=====",dataSource);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
import { addUser, editUser, getUserById } from '@/services/userList';
|
import { addUser, editUser, getUserById } from '@/services/userList';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
DatePicker,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
message,
|
message,
|
||||||
|
@ -14,7 +15,6 @@ import {
|
||||||
Radio,
|
Radio,
|
||||||
Select,
|
Select,
|
||||||
TreeSelect,
|
TreeSelect,
|
||||||
DatePicker
|
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
|
||||||
|
@ -46,7 +46,10 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
form.setFieldsValue(data);
|
form.setFieldsValue(data);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const initialValues = { user_group_id: [selectedOrg], status: 1 };
|
const initialValues = {
|
||||||
|
user_group_id: selectedOrg ? selectedOrg : null,
|
||||||
|
status: 1,
|
||||||
|
};
|
||||||
form.setFieldsValue(initialValues);
|
form.setFieldsValue(initialValues);
|
||||||
}
|
}
|
||||||
}, [visible, form, recordData, selectedOrg]);
|
}, [visible, form, recordData, selectedOrg]);
|
||||||
|
@ -124,24 +127,26 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
okText="确定"
|
okText="确定"
|
||||||
// 按钮居中对其
|
// 按钮居中对其
|
||||||
footer={
|
footer={null}
|
||||||
<div style={{ display: 'flex', justifyContent: 'right' }}>
|
// footer={
|
||||||
<Button
|
// <div style={{ display: 'flex', justifyContent: 'right' }}>
|
||||||
type="primary"
|
// <Button
|
||||||
onClick={handleOk}
|
// type="primary"
|
||||||
style={{ marginRight: '20px' }}
|
// onClick={handleOk}
|
||||||
>
|
// style={{ marginRight: '20px' }}
|
||||||
确定
|
// >
|
||||||
</Button>
|
// 确定
|
||||||
<Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
// </Button>
|
||||||
取消
|
// <Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
||||||
</Button>
|
// 取消
|
||||||
</div>
|
// </Button>
|
||||||
}
|
// </div>
|
||||||
|
// }
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
labelCol={{ span: 5 }}
|
labelCol={{ span: 5 }}
|
||||||
|
onFinish={handleOk}
|
||||||
wrapperCol={{ span: 18 }}
|
wrapperCol={{ span: 18 }}
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
style={{ paddingTop: '20px', paddingBottom: '20px' }}
|
style={{ paddingTop: '20px', paddingBottom: '20px' }}
|
||||||
|
@ -198,8 +203,8 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Select placeholder="请选择用户类别" options={USER_TYPE_OPTIONS} />
|
<Select placeholder="请选择用户类别" options={USER_TYPE_OPTIONS} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="birthday" label="出生日期" >
|
<Form.Item name="birthday" label="出生日期">
|
||||||
<DatePicker style={{width:"414px"}}/>
|
<DatePicker style={{ width: '414px' }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="priority"
|
name="priority"
|
||||||
|
@ -249,6 +254,17 @@ const UserEditModal: React.FC<UserEditModalProps> = ({
|
||||||
>
|
>
|
||||||
<Input placeholder="请输入邮箱" />
|
<Input placeholder="请输入邮箱" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label={null}>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
style={{ marginRight: '20px' }}
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
|
@ -80,21 +80,22 @@ const CreatGroup: React.FC<CreatGroupProps> = (props) => {
|
||||||
centered={true}
|
centered={true}
|
||||||
destroyOnHidden={true}
|
destroyOnHidden={true}
|
||||||
width={600}
|
width={600}
|
||||||
footer={
|
footer={null}
|
||||||
<div style={{ display: 'flex', justifyContent: 'right' }}>
|
// footer={
|
||||||
<Button
|
// <div style={{ display: 'flex', justifyContent: 'right' }}>
|
||||||
type="primary"
|
// <Button
|
||||||
onClick={handleOk}
|
// type="primary"
|
||||||
style={{ marginRight: '20px' }}
|
// onClick={handleOk}
|
||||||
loading={loading}
|
// style={{ marginRight: '20px' }}
|
||||||
>
|
// loading={loading}
|
||||||
确定
|
// >
|
||||||
</Button>
|
// 确定
|
||||||
<Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
// </Button>
|
||||||
取消
|
// <Button onClick={onCancel} style={{ marginRight: '20px' }}>
|
||||||
</Button>
|
// 取消
|
||||||
</div>
|
// </Button>
|
||||||
}
|
// </div>
|
||||||
|
// }
|
||||||
>
|
>
|
||||||
<div style={{ height: '300px' }}>
|
<div style={{ height: '300px' }}>
|
||||||
<Form
|
<Form
|
||||||
|
@ -123,6 +124,17 @@ const CreatGroup: React.FC<CreatGroupProps> = (props) => {
|
||||||
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
|
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label={null}>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
style={{ marginRight: '20px' }}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
<Button onClick={onCancel}>取消</Button>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
Loading…
Reference in New Issue