fix 组织机构名未冗余
This commit is contained in:
@@ -54,11 +54,12 @@ namespace Ewide.Core.Service
|
|||||||
var emps = await _sysEmpRep.Where(u => u.Id == sysEmpParam.Id).ToListAsync();
|
var emps = await _sysEmpRep.Where(u => u.Id == sysEmpParam.Id).ToListAsync();
|
||||||
emps.ForEach(u =>
|
emps.ForEach(u =>
|
||||||
{
|
{
|
||||||
u.DeleteNow();
|
u.Delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再新增新员工信息
|
// 再新增新员工信息
|
||||||
var emp = sysEmpParam.Adapt<SysEmp>();
|
var emp = sysEmpParam.Adapt<SysEmp>();
|
||||||
|
emp.OrgName = (await Db.GetRepository<SysOrg>().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(emp.OrgId))).Name;
|
||||||
await _sysEmpRep.InsertAsync(emp);
|
await _sysEmpRep.InsertAsync(emp);
|
||||||
|
|
||||||
// 更新附属机构职位信息
|
// 更新附属机构职位信息
|
||||||
|
|||||||
@@ -40,57 +40,7 @@ export default class form extends Component {
|
|||||||
extIds: [],
|
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()
|
form = React.createRef()
|
||||||
|
|
||||||
@@ -193,7 +143,6 @@ export default class form extends Component {
|
|||||||
postData.id = this.record.id
|
postData.id = this.record.id
|
||||||
}
|
}
|
||||||
//#region 从前段转换后端所需格式
|
//#region 从前段转换后端所需格式
|
||||||
console.log(postData)
|
|
||||||
//#endregion
|
//#endregion
|
||||||
return postData
|
return postData
|
||||||
}
|
}
|
||||||
@@ -208,75 +157,7 @@ export default class form extends Component {
|
|||||||
const { data } = await api.sysPosList()
|
const { data } = await api.sysPosList()
|
||||||
return data
|
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
|
//#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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@@ -298,28 +179,6 @@ export default class form extends Component {
|
|||||||
>
|
>
|
||||||
<Input autoComplete="off" placeholder="请输入姓名" />
|
<Input autoComplete="off" placeholder="请输入姓名" />
|
||||||
</Form.Item>
|
</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">
|
<Form.Item label="昵称" name="nickName">
|
||||||
<Input autoComplete="off" placeholder="请输入昵称" />
|
<Input autoComplete="off" placeholder="请输入昵称" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -410,10 +269,6 @@ export default class form extends Component {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
{/* <h4 className="h4">附加信息</h4>
|
|
||||||
<div className="pl-md pr-md">
|
|
||||||
{this.renderExtInfoTable()}
|
|
||||||
</div> */}
|
|
||||||
</Spin>
|
</Spin>
|
||||||
</Form>
|
</Form>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user