fix 组织机构名未冗余
This commit is contained in:
@@ -40,57 +40,7 @@ export default class form extends Component {
|
||||
extIds: [],
|
||||
},
|
||||
}
|
||||
extColumns = [
|
||||
{
|
||||
title: '附属机构',
|
||||
dataIndex: 'orgId',
|
||||
width: '45%',
|
||||
render: (text, record, index) => (
|
||||
<Form.Item name={['sysEmpParam', 'extIds', index, 'orgId']}>
|
||||
<TreeSelect
|
||||
defaultValue={text}
|
||||
treeData={this.state.options.orgData}
|
||||
className="w-100-p"
|
||||
dropdownStyle={{ maxHeight: '300px', overflow: 'auto' }}
|
||||
treeDefaultExpandAll
|
||||
placeholder="请选择附加组织机构"
|
||||
/>
|
||||
</Form.Item>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '附属岗位',
|
||||
dataIndex: 'posId',
|
||||
width: '45%',
|
||||
render: (text, record, index) => (
|
||||
<Form.Item name={['sysEmpParam', 'extIds', index, 'posId']}>
|
||||
<Select
|
||||
defaultValue={text}
|
||||
className="w-100-p"
|
||||
placeholder="请选择附加职位信息"
|
||||
>
|
||||
{this.state.options.posData.map(item => {
|
||||
return (
|
||||
<Select.Option key={item.id} value={item.id}>
|
||||
{item.name}
|
||||
</Select.Option>
|
||||
)
|
||||
})}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: '70px',
|
||||
render: (text, record) => (
|
||||
<Button onClick={() => this.onRemoveExtData(record)} size="small" danger>
|
||||
删除
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
// 表单实例
|
||||
form = React.createRef()
|
||||
|
||||
@@ -193,7 +143,6 @@ export default class form extends Component {
|
||||
postData.id = this.record.id
|
||||
}
|
||||
//#region 从前段转换后端所需格式
|
||||
console.log(postData)
|
||||
//#endregion
|
||||
return postData
|
||||
}
|
||||
@@ -208,75 +157,7 @@ export default class form extends Component {
|
||||
const { data } = await api.sysPosList()
|
||||
return data
|
||||
}
|
||||
onAddExtData() {
|
||||
const { extIds } = this.state.sysEmpParam
|
||||
|
||||
const record = {
|
||||
key: extIds.length > 0 ? extIds[extIds.length - 1].key + 1 : 0,
|
||||
orgId: undefined,
|
||||
posId: undefined,
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
sysEmpParam: {
|
||||
extIds: [...extIds, record],
|
||||
},
|
||||
},
|
||||
() => {
|
||||
console.log(this.form.current.getFieldsValue())
|
||||
}
|
||||
)
|
||||
}
|
||||
onRemoveExtData(record) {
|
||||
const ext = this.state.sysEmpParam.extIds,
|
||||
remove = ext.find(p => p.key === record.key),
|
||||
index = ext.indexOf(remove)
|
||||
|
||||
ext.splice(index, 1)
|
||||
console.log(ext)
|
||||
|
||||
// this.form.current.setFieldsValue({
|
||||
// sysEmpParam: {
|
||||
// extIds: {}
|
||||
// }
|
||||
// })
|
||||
|
||||
this.setState(
|
||||
{
|
||||
sysEmpParam: {
|
||||
extIds: ext,
|
||||
},
|
||||
},
|
||||
() => {
|
||||
//console.log(this.form.current.getFieldsValue())
|
||||
}
|
||||
)
|
||||
}
|
||||
//#endregion
|
||||
renderExtInfoTable() {
|
||||
//console.log(this.state.sysEmpParam.extIds)
|
||||
return (
|
||||
<Table
|
||||
dataSource={this.state.sysEmpParam.extIds}
|
||||
columns={this.extColumns}
|
||||
pagination={false}
|
||||
size="small"
|
||||
bordered
|
||||
rowKey={record => record.key}
|
||||
footer={() => (
|
||||
<Button
|
||||
block
|
||||
icon={<AntIcon type="plus" />}
|
||||
type="dashed"
|
||||
onClick={() => this.onAddExtData()}
|
||||
>
|
||||
新增一项
|
||||
</Button>
|
||||
)}
|
||||
></Table>
|
||||
)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
@@ -298,28 +179,6 @@ export default class form extends Component {
|
||||
>
|
||||
<Input autoComplete="off" placeholder="请输入姓名" />
|
||||
</Form.Item>
|
||||
{/* {this.props.mode == 'add' && (
|
||||
<>
|
||||
<Form.Item
|
||||
label="密码"
|
||||
name="password"
|
||||
rules={[
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
]}
|
||||
>
|
||||
<Input.Password autoComplete="off" placeholder="请输入密码" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="确认密码"
|
||||
name="confirm"
|
||||
rules={[
|
||||
{ required: true, message: '请确认密码', trigger: 'blur' },
|
||||
]}
|
||||
>
|
||||
<Input.Password autoComplete="off" placeholder="请确认密码" />
|
||||
</Form.Item>
|
||||
</>
|
||||
)} */}
|
||||
<Form.Item label="昵称" name="nickName">
|
||||
<Input autoComplete="off" placeholder="请输入昵称" />
|
||||
</Form.Item>
|
||||
@@ -410,10 +269,6 @@ export default class form extends Component {
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</div>
|
||||
{/* <h4 className="h4">附加信息</h4>
|
||||
<div className="pl-md pr-md">
|
||||
{this.renderExtInfoTable()}
|
||||
</div> */}
|
||||
</Spin>
|
||||
</Form>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user