新增企业
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 save = async () => {
|
||||
@@ -52,7 +52,7 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
||||
values.company_id = data.company_id;
|
||||
editRequest(stringify(values));
|
||||
} else {
|
||||
//addRequest(stringify(values));
|
||||
addRequest(stringify(values));
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('表单验证未通过', error);
|
||||
@@ -76,6 +76,9 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
||||
});
|
||||
} else {
|
||||
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>,
|
||||
<Button key='save' type='primary' loading={editLoading} onClick={save}>
|
||||
<Button key='save' type='primary' loading={addLoading || editLoading} onClick={save}>
|
||||
保存
|
||||
</Button>,
|
||||
]}
|
||||
@@ -108,6 +111,31 @@ export const CompanyEditModal: React.FC<IProps> = (props) => {
|
||||
<Input allowClear placeholder='请填写企业' maxLength={20} showCount />
|
||||
</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
|
||||
label='ERP'
|
||||
name='erp_name'
|
||||
|
||||
@@ -200,13 +200,27 @@ const CompanyListForm: React.FC = () => {
|
||||
</FormItemPlugin>
|
||||
</FormPlugin> */}
|
||||
|
||||
<GapBox style={{ marginBottom: 12, justifyContent: 'space-between' }}>
|
||||
<GapBox>
|
||||
{auth.SF_ADMIN_COMPANY_ADD && (
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => {
|
||||
CompanyEditModalRef.current?.show();
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
)}
|
||||
</GapBox>
|
||||
<HeaderPagination
|
||||
style={{ marginBottom: 12, marginRight: 12 }}
|
||||
style={{ marginBottom: 0, marginRight: 12 }}
|
||||
current={params.curr_page}
|
||||
pageSize={params.page_count}
|
||||
total={ajaxData.count}
|
||||
onChange={page}
|
||||
/>
|
||||
</GapBox>
|
||||
|
||||
<TablePlugin
|
||||
loading={userLoading}
|
||||
|
||||
@@ -199,7 +199,7 @@ const UserListForm: React.FC = () => {
|
||||
|
||||
<GapBox style={{ marginBottom: 12, justifyContent: 'space-between' }}>
|
||||
<GapBox>
|
||||
{auth.SF_ADMIN_USER_ADD && (
|
||||
{auth.SF_ADMIN_USER_ADD_FALSE && (
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => {
|
||||
|
||||
@@ -2,4 +2,5 @@ export const CompanyServices = {
|
||||
getCompanyList: '/Company/getCompanyList',
|
||||
getCompanyAjaxList: '/Company/getCompanyAjaxList',
|
||||
edit: '/Company/edit',
|
||||
add: '/Company/add',
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user