@@ -1,4 +1,4 @@ | |||
import React, { useEffect, useState } from 'react' | |||
import React, { useEffect, useState } from 'react' | |||
import { Form, Input, InputNumber, Radio, Modal, Switch } from 'antd'; | |||
import positonService from '@/request/service/positon'; | |||
import { useRequest } from '@/hooks/use-request'; | |||
@@ -68,7 +68,7 @@ const PositionEditor: React.FC<EditorProps> = (props) => { | |||
width={640} | |||
onOk={save} | |||
onCancel={() => onCancel()} | |||
confirmLoading= {saveLoading} | |||
confirmLoading={saveLoading} | |||
destroyOnClose | |||
> | |||
<Form | |||
@@ -100,7 +100,7 @@ const PositionEditor: React.FC<EditorProps> = (props) => { | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="sort" label="岗位顺序" | |||
<Form.Item name="sort" label="岗位顺序" | |||
rules={[ | |||
{ | |||
required: true, | |||
@@ -115,7 +115,13 @@ const PositionEditor: React.FC<EditorProps> = (props) => { | |||
<Input.TextArea showCount maxLength={100} /> | |||
</Form.Item> | |||
<Form.Item name="status" label="状态"> | |||
<Form.Item name="status" label="状态" | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请设置岗位状态', | |||
}, | |||
]}> | |||
<Radio.Group options={[ | |||
{ value: 0, label: "开启" }, | |||
{ value: 1, label: "关闭" } | |||
@@ -86,6 +86,12 @@ const MenuListPage: React.FC = () => { | |||
dataIndex: 'sort', | |||
align: 'center', | |||
}, | |||
{ | |||
title: '备注', | |||
key: 'remark', | |||
dataIndex: 'remark', | |||
align: 'center', | |||
}, | |||
{ | |||
title: '状态', | |||
key: 'status', | |||
@@ -100,6 +100,12 @@ export default () => { | |||
dataIndex: 'sort', | |||
align: 'center', | |||
}, | |||
{ | |||
title: '备注', | |||
key: 'remark', | |||
dataIndex: 'remark', | |||
align: 'center', | |||
}, | |||
{ | |||
title: '状态', | |||
key: 'status', | |||
@@ -160,7 +166,7 @@ export default () => { | |||
return ( | |||
<> | |||
<div> | |||
<div style={{ width: 1600 }}> | |||
<Card className='mt-[4px] dark:bg-[rgb(33,41,70)] bg-white roundle-lg px[12px]' bodyStyle={{ paddingTop: 4, paddingBottom: 4 }}> | |||
<div className='flex justify-between content-center'> | |||
<div className='flex justify-normal items-center'> | |||
@@ -59,6 +59,8 @@ const UserEditor: React.FC<EditorProps> = (props) => { | |||
if (visible) { | |||
if (data) { | |||
form.setFieldsValue(data); | |||
} else { | |||
form.setFieldValue("status", 0); | |||
} | |||
setUpdateEditPassword(true) | |||
} else { | |||
@@ -91,12 +93,12 @@ const UserEditor: React.FC<EditorProps> = (props) => { | |||
<> | |||
<Modal | |||
open={visible} | |||
title= {<div className='h-50px'>{isEdit? "编辑用户": "添加用户"}</div>} | |||
title={<div className='h-50px'>{isEdit ? "编辑用户" : "添加用户"}</div>} | |||
width={640} | |||
onOk={save} | |||
onCancel={() => onCancel()} | |||
destroyOnClose | |||
confirmLoading= {saveLoading} | |||
confirmLoading={saveLoading} | |||
> | |||
<Form | |||
form={form} | |||
@@ -120,7 +122,7 @@ const UserEditor: React.FC<EditorProps> = (props) => { | |||
<Form.Item noStyle | |||
shouldUpdate={() => { | |||
const shouldUpdate = shouldUpdateEditPassword; | |||
if(shouldUpdateEditPassword) { | |||
if (shouldUpdateEditPassword) { | |||
setUpdateEditPassword(false) | |||
} | |||
return shouldUpdate | |||
@@ -195,7 +197,13 @@ const UserEditor: React.FC<EditorProps> = (props) => { | |||
<Input /> | |||
</Form.Item> | |||
<Form.Item name="status" label="状态"> | |||
<Form.Item name="status" label="状态" | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请选择用户状态', | |||
}, | |||
]}> | |||
<Radio.Group options={[ | |||
{ value: 0, label: "开启" }, | |||
{ value: 1, label: "关闭" } | |||