|
@@ -43,7 +43,7 @@ function RoleManager(){
|
|
|
post(api.getRolePage,param).then((res)=>{
|
|
|
if(res.data.code===200){
|
|
|
const data = res.data.data;
|
|
|
- setDataSource(data);
|
|
|
+ setDataSource(data.records);
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -119,8 +119,15 @@ function RoleManager(){
|
|
|
//保存
|
|
|
function addRole(formData){
|
|
|
console.log('保存参数:',formData);
|
|
|
- const param = formData;
|
|
|
- post(api.addRole,param).then((res)=>{
|
|
|
+ console.log(12,formData)
|
|
|
+
|
|
|
+ const arr = formData.softwares.filter((it)=>{
|
|
|
+ if(Object.keys(it).length&&it.softwareMenuIds&&it.softwareMenuIds.length){
|
|
|
+ return it;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ formData.softwares=arr;
|
|
|
+ post(api.addRole,formData).then((res)=>{
|
|
|
if(res.data.code===200){
|
|
|
getTableData();
|
|
|
setAddVisible(false);
|
|
@@ -140,23 +147,25 @@ function RoleManager(){
|
|
|
const columns = [
|
|
|
{ title: '角色名称', dataIndex: 'name', key: 'name' },
|
|
|
{ title: '角色描述', dataIndex: 'remark', key: 'remark' },
|
|
|
- { title: '状态', dataIndex: 'gmtCreate', key: 'statusName'},
|
|
|
+ { title: '状态', key: 'statusName',render:(row) => {
|
|
|
+ return (<span className={ (row.status==='1')?'Enable':'Disable' }>{row.statusName}</span>)
|
|
|
+ }},
|
|
|
/*{ title: '创建时间', dataIndex: 'gmtCreate', key: 'gmtCreate' },*/
|
|
|
- { title: '操作', key: 'operation', render: (row) => {
|
|
|
+ { title: '操作', key: 'operation', render: (row,i) => {
|
|
|
//console.log(21,row)
|
|
|
if(row.rootFlag){
|
|
|
return '-'
|
|
|
}
|
|
|
return (<Space size="middle">
|
|
|
- <a onClick={()=>editRole(row.hospitalId,row.type)}>修改</a>
|
|
|
- {row.status==='1'?(<a onClick={()=>showModal(row.hasUserFlag||row.hasHospitalFlag?4:3,row.hospitalId)}>禁用</a>):(<a onClick={()=>enable(1,row.hospitalId)}>启用</a>)}
|
|
|
- <a onClick={()=>onDelete(row.hospitalId,row.type)}>删除</a>
|
|
|
+ <a onClick={()=>editRole(row.id)}>修改</a>
|
|
|
+ {row.status==='1'?(<a onClick={()=>showModal(row.hasUserFlag?4:3,row.id)}>禁用</a>):(<a onClick={()=>enable(1,row.id)}>启用</a>)}
|
|
|
+ <a onClick={()=>showModal(row.hasUserFlag?2:1,row.id)}>删除</a>
|
|
|
</Space>) }},
|
|
|
];
|
|
|
return (
|
|
|
<Table
|
|
|
className="components-table-demo-nested"
|
|
|
- rowKey={record => record.hospitalId}
|
|
|
+ rowKey={record => record.id}
|
|
|
columns={columns}
|
|
|
dataSource={dataSource}
|
|
|
/>
|
|
@@ -185,7 +194,7 @@ function RoleManager(){
|
|
|
<Form form={form} name="control-hooks" onFinish={onFinish}>
|
|
|
<Row gutter={24}>
|
|
|
<Col span={5} key={0}>
|
|
|
- <Form.Item name="hospitalName" label="角色名称">
|
|
|
+ <Form.Item name="name" label="角色名称">
|
|
|
<Input placeholder='角色名称'/>
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
@@ -196,7 +205,7 @@ function RoleManager(){
|
|
|
>
|
|
|
{statusList.map((item)=>{
|
|
|
return (
|
|
|
- <Option value={item.name} key={item.name}>{item.val}</Option>
|
|
|
+ <Option value={item.name} key={item.name}>{item.val}</Option>
|
|
|
)
|
|
|
})}
|
|
|
</Select>
|