新增企业
This commit is contained in:
@@ -35,7 +35,7 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//const { loading: addLoading, request: addRequest } = useRequest(CompanyServices.add, { onSuccess: success });
|
const { loading: addLoading, request: addRequest } = useRequest(CompanyServices.add, { onSuccess: success });
|
||||||
const { loading: editLoading, request: editRequest } = useRequest(CompanyServices.edit, { onSuccess: success });
|
const { loading: editLoading, request: editRequest } = useRequest(CompanyServices.edit, { onSuccess: success });
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
@@ -52,7 +52,7 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
|||||||
values.company_id = data.company_id;
|
values.company_id = data.company_id;
|
||||||
editRequest(stringify(values));
|
editRequest(stringify(values));
|
||||||
} else {
|
} else {
|
||||||
//addRequest(stringify(values));
|
addRequest(stringify(values));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('表单验证未通过', error);
|
console.log('表单验证未通过', error);
|
||||||
@@ -76,6 +76,9 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
|
form.setFieldsValue({
|
||||||
|
company_state: '1',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
@@ -89,7 +92,7 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
|||||||
<Button key='cancel' onClick={() => setOpen(false)}>
|
<Button key='cancel' onClick={() => setOpen(false)}>
|
||||||
取消
|
取消
|
||||||
</Button>,
|
</Button>,
|
||||||
<Button key='save' type='primary' loading={editLoading} onClick={save}>
|
<Button key='save' type='primary' loading={addLoading || editLoading} onClick={save}>
|
||||||
保存
|
保存
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
@@ -108,6 +111,31 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
|||||||
<Input allowClear placeholder='请填写企业' maxLength={20} showCount />
|
<Input allowClear placeholder='请填写企业' maxLength={20} showCount />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
{!data?.company_id && (
|
||||||
|
<>
|
||||||
|
<Form.Item
|
||||||
|
label='用户名'
|
||||||
|
name='login_name'
|
||||||
|
required
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请输入用户名' },
|
||||||
|
{ min: 2, message: '最少2字符' },
|
||||||
|
{ max: 20, message: '最多20字符' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input allowClear placeholder='请填写用户名' maxLength={20} showCount />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
label='密码'
|
||||||
|
name='password'
|
||||||
|
tooltip={data ? undefined : '不填写则系统自动生成初始密码'}
|
||||||
|
rules={[{ min: 6, max: 18, message: '密码需6~18位' }]}
|
||||||
|
>
|
||||||
|
<Input.Password allowClear placeholder={'不填写则系统自动生成初始密码'} />
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label='ERP'
|
label='ERP'
|
||||||
name='erp_name'
|
name='erp_name'
|
||||||
|
|||||||
@@ -200,13 +200,27 @@ const CompanyListForm: React.FC = () => {
|
|||||||
</FormItemPlugin>
|
</FormItemPlugin>
|
||||||
</FormPlugin> */}
|
</FormPlugin> */}
|
||||||
|
|
||||||
<HeaderPagination
|
<GapBox style={{ marginBottom: 12, justifyContent: 'space-between' }}>
|
||||||
style={{ marginBottom: 12, marginRight: 12 }}
|
<GapBox>
|
||||||
current={params.curr_page}
|
{auth.SF_ADMIN_COMPANY_ADD && (
|
||||||
pageSize={params.page_count}
|
<Button
|
||||||
total={ajaxData.count}
|
type='primary'
|
||||||
onChange={page}
|
onClick={() => {
|
||||||
/>
|
CompanyEditModalRef.current?.show();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</GapBox>
|
||||||
|
<HeaderPagination
|
||||||
|
style={{ marginBottom: 0, marginRight: 12 }}
|
||||||
|
current={params.curr_page}
|
||||||
|
pageSize={params.page_count}
|
||||||
|
total={ajaxData.count}
|
||||||
|
onChange={page}
|
||||||
|
/>
|
||||||
|
</GapBox>
|
||||||
|
|
||||||
<TablePlugin
|
<TablePlugin
|
||||||
loading={userLoading}
|
loading={userLoading}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ const UserListForm: React.FC = () => {
|
|||||||
|
|
||||||
<GapBox style={{ marginBottom: 12, justifyContent: 'space-between' }}>
|
<GapBox style={{ marginBottom: 12, justifyContent: 'space-between' }}>
|
||||||
<GapBox>
|
<GapBox>
|
||||||
{auth.SF_ADMIN_USER_ADD && (
|
{auth.SF_ADMIN_USER_ADD_FALSE && (
|
||||||
<Button
|
<Button
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export const CompanyServices = {
|
|||||||
getCompanyList: '/Company/getCompanyList',
|
getCompanyList: '/Company/getCompanyList',
|
||||||
getCompanyAjaxList: '/Company/getCompanyAjaxList',
|
getCompanyAjaxList: '/Company/getCompanyAjaxList',
|
||||||
edit: '/Company/edit',
|
edit: '/Company/edit',
|
||||||
|
add: '/Company/add',
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
Reference in New Issue
Block a user