diff --git a/src/layouts/AdminLayout.js b/src/layouts/AdminLayout.js index a601aef..04f57b1 100644 --- a/src/layouts/AdminLayout.js +++ b/src/layouts/AdminLayout.js @@ -117,7 +117,7 @@ class AdminLayout extends React.PureComponent { let isParent = false; for (let i = 0; i < openKeys.length - 1; i += 1) { const item = menuMap[openKeys[i]] || {}; - let path = item.record_id; + let path = item.id; if (item.parent_path !== '') { path = `${item.parent_path}/${path}`; } @@ -185,7 +185,7 @@ class AdminLayout extends React.PureComponent { item.name ) } - key={item.record_id} + key={item.id} > {this.renderNavMenuItems(item.children)} @@ -199,7 +199,7 @@ class AdminLayout extends React.PureComponent { } = this.props; return ( - + {router.startsWith('http') ? ( {icon} diff --git a/src/models/demo.js b/src/models/demo.js index 58b6460..cd65034 100644 --- a/src/models/demo.js +++ b/src/models/demo.js @@ -89,13 +89,13 @@ export default { }), put({ type: 'fetchForm', - payload: { record_id: payload.id }, + payload: { id: payload.id }, }), ]; } }, *fetchForm({ payload }, { call, put }) { - const response = yield call(demoService.get, payload.record_id); + const response = yield call(demoService.get, payload.id); yield [ put({ type: 'saveFormData', @@ -120,7 +120,7 @@ export default { } } else { const response = yield call(demoService.create, params); - if (response.record_id && response.record_id !== '') { + if (response.id && response.id !== '') { success = true; } } @@ -142,7 +142,7 @@ export default { } }, *del({ payload }, { call, put }) { - const response = yield call(demoService.del, payload.record_id); + const response = yield call(demoService.del, payload.id); if (response.status === 'OK') { message.success('删除成功'); yield put({ type: 'fetch' }); @@ -151,9 +151,9 @@ export default { *changeStatus({ payload }, { call, put, select }) { let response; if (payload.status === 1) { - response = yield call(demoService.enable, payload.record_id); + response = yield call(demoService.enable, payload.id); } else { - response = yield call(demoService.disable, payload.record_id); + response = yield call(demoService.disable, payload.id); } if (response.status === 'OK') { @@ -167,7 +167,7 @@ export default { for (let i = 0; i < data.list.length; i += 1) { const item = data.list[i]; - if (item.record_id === payload.record_id) { + if (item.id === payload.id) { item.status = payload.status; } newData.list.push(item); diff --git a/src/models/global.js b/src/models/global.js index b7887fe..24a199d 100644 --- a/src/models/global.js +++ b/src/models/global.js @@ -42,7 +42,7 @@ export default { yield put({ type: 'changeSelectedKeys', - payload: [item.record_id], + payload: [item.id], }); }, *fetchUser(_, { call, put }) { @@ -65,7 +65,7 @@ export default { const menuMap = {}; function fillData(data) { for (let i = 0; i < data.length; i += 1) { - menuMap[data[i].record_id] = data[i]; + menuMap[data[i].id] = data[i]; if (data[i].router !== '') { menuPaths[data[i].router] = data[i]; } diff --git a/src/models/menu.js b/src/models/menu.js index e8c5c54..2c70da0 100644 --- a/src/models/menu.js +++ b/src/models/menu.js @@ -93,7 +93,7 @@ export default { }), put({ type: 'fetchForm', - payload: { record_id: payload.id }, + payload: { id: payload.id }, }), ]; } else { @@ -105,7 +105,7 @@ export default { } }, *fetchForm({ payload }, { call, put }) { - const response = yield call(menuService.get, payload.record_id); + const response = yield call(menuService.get, payload.id); yield put({ type: 'saveFormData', payload: response, @@ -128,7 +128,7 @@ export default { } } else { const response = yield call(menuService.create, params); - if (response.record_id && response.record_id !== '') { + if (response.id && response.id !== '') { success = true; } } @@ -150,7 +150,7 @@ export default { } }, *del({ payload }, { call, put }) { - const response = yield call(menuService.del, payload.record_id); + const response = yield call(menuService.del, payload.id); if (response.status === 'OK') { message.success('删除成功'); yield put({ type: 'fetchTree' }); @@ -171,9 +171,9 @@ export default { *changeStatus({ payload }, { call, put, select }) { let response; if (payload.status === 1) { - response = yield call(menuService.enable, payload.record_id); + response = yield call(menuService.enable, payload.id); } else { - response = yield call(menuService.disable, payload.record_id); + response = yield call(menuService.disable, payload.id); } if (response.status === 'OK') { @@ -187,7 +187,7 @@ export default { for (let i = 0; i < data.list.length; i += 1) { const item = data.list[i]; - if (item.record_id === payload.record_id) { + if (item.id === payload.id) { item.status = payload.status; } newData.list.push(item); diff --git a/src/models/role.js b/src/models/role.js index 33b73d2..00d91d3 100644 --- a/src/models/role.js +++ b/src/models/role.js @@ -90,13 +90,13 @@ export default { }), put({ type: 'fetchForm', - payload: { record_id: payload.id }, + payload: { id: payload.id }, }), ]; } }, *fetchForm({ payload }, { call, put }) { - const response = yield call(roleService.get, payload.record_id); + const response = yield call(roleService.get, payload.id); const { role_menus: roleMenus } = response; if (roleMenus) { @@ -140,7 +140,7 @@ export default { } } else { const response = yield call(roleService.create, params); - if (response.record_id && response.record_id !== '') { + if (response.id && response.id !== '') { success = true; } } @@ -162,7 +162,7 @@ export default { } }, *del({ payload }, { call, put }) { - const response = yield call(roleService.del, payload.record_id); + const response = yield call(roleService.del, payload.id); if (response.status === 'OK') { message.success('删除成功'); yield put({ type: 'fetch' }); @@ -178,9 +178,9 @@ export default { *changeStatus({ payload }, { call, put, select }) { let response; if (payload.status === 1) { - response = yield call(roleService.enable, payload.record_id); + response = yield call(roleService.enable, payload.id); } else { - response = yield call(roleService.disable, payload.record_id); + response = yield call(roleService.disable, payload.id); } if (response.status === 'OK') { @@ -194,7 +194,7 @@ export default { for (let i = 0; i < data.list.length; i += 1) { const item = data.list[i]; - if (item.record_id === payload.record_id) { + if (item.id === payload.id) { item.status = payload.status; } newData.list.push(item); diff --git a/src/models/user.js b/src/models/user.js index 585d4b1..3acc08c 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -88,13 +88,13 @@ export default { }), put({ type: 'fetchForm', - payload: { record_id: payload.id }, + payload: { id: payload.id }, }), ]; } }, *fetchForm({ payload }, { call, put }) { - const response = yield call(userService.get, payload.record_id); + const response = yield call(userService.get, payload.id); yield put({ type: 'saveFormData', payload: response, @@ -117,7 +117,7 @@ export default { } } else { const response = yield call(userService.create, params); - if (response.record_id && response.record_id !== '') { + if (response.id && response.id !== '') { success = true; } } @@ -139,7 +139,7 @@ export default { } }, *del({ payload }, { call, put }) { - const response = yield call(userService.del, payload.record_id); + const response = yield call(userService.del, payload.id); if (response.status === 'OK') { message.success('删除成功'); yield put({ type: 'fetch' }); @@ -148,9 +148,9 @@ export default { *changeStatus({ payload }, { call, put, select }) { let response; if (payload.status === 1) { - response = yield call(userService.enable, payload.record_id); + response = yield call(userService.enable, payload.id); } else { - response = yield call(userService.disable, payload.record_id); + response = yield call(userService.disable, payload.id); } if (response.status === 'OK') { @@ -164,7 +164,7 @@ export default { for (let i = 0; i < data.list.length; i += 1) { const item = data.list[i]; - if (item.record_id === payload.record_id) { + if (item.id === payload.id) { item.status = payload.status; } newData.list.push(item); diff --git a/src/pages/Demo/DemoList.js b/src/pages/Demo/DemoList.js index 6390cdb..c8d02a4 100644 --- a/src/pages/Demo/DemoList.js +++ b/src/pages/Demo/DemoList.js @@ -32,14 +32,14 @@ class DemoList extends PureComponent { onItemDisableClick = item => { this.dispatch({ type: 'demo/changeStatus', - payload: { record_id: item.record_id, status: 2 }, + payload: { id: item.id, status: 2 }, }); }; onItemEnableClick = item => { this.dispatch({ type: 'demo/changeStatus', - payload: { record_id: item.record_id, status: 1 }, + payload: { id: item.id, status: 1 }, }); }; @@ -48,7 +48,7 @@ class DemoList extends PureComponent { type: 'demo/loadForm', payload: { type: 'E', - id: item.record_id, + id: item.id, }, }); }; @@ -65,7 +65,7 @@ class DemoList extends PureComponent { onDelOKClick(id) { this.dispatch({ type: 'demo/del', - payload: { record_id: id }, + payload: { id }, }); this.clearSelectRows(); } @@ -84,7 +84,7 @@ class DemoList extends PureComponent { okText: '确认', okType: 'danger', cancelText: '取消', - onOk: this.onDelOKClick.bind(this, item.record_id), + onOk: this.onDelOKClick.bind(this, item.id), }); }; @@ -92,7 +92,7 @@ class DemoList extends PureComponent { const keys = []; const rows = []; if (selected) { - keys.push(record.record_id); + keys.push(record.id); rows.push(record); } this.setState({ @@ -293,7 +293,7 @@ class DemoList extends PureComponent { onSelect: this.handleTableSelectRow, }} loading={loading} - rowKey={record => record.record_id} + rowKey={record => record.id} dataSource={list} columns={columns} pagination={paginationProps} diff --git a/src/pages/Menu/MenuCard.js b/src/pages/Menu/MenuCard.js index 791737e..294418d 100644 --- a/src/pages/Menu/MenuCard.js +++ b/src/pages/Menu/MenuCard.js @@ -35,7 +35,7 @@ class MenuCard extends PureComponent { } const newData = []; for (let i = 0; i < data.length; i += 1) { - const item = { ...data[i], title: data[i].name, value: data[i].record_id }; + const item = { ...data[i], title: data[i].name, value: data[i].id }; if (item.children && item.children.length > 0) { item.children = this.toTreeSelect(item.children); } diff --git a/src/pages/Menu/MenuList.js b/src/pages/Menu/MenuList.js index ecea8d5..e85fd50 100644 --- a/src/pages/Menu/MenuList.js +++ b/src/pages/Menu/MenuList.js @@ -36,14 +36,14 @@ class MenuList extends PureComponent { onItemDisableClick = item => { this.dispatch({ type: 'menu/changeStatus', - payload: { record_id: item.record_id, status: 2 }, + payload: { id: item.id, status: 2 }, }); }; onItemEnableClick = item => { this.dispatch({ type: 'menu/changeStatus', - payload: { record_id: item.record_id, status: 1 }, + payload: { id: item.id, status: 1 }, }); }; @@ -57,7 +57,7 @@ class MenuList extends PureComponent { type: 'menu/loadForm', payload: { type: 'E', - id: item.record_id, + id: item.id, }, }); }; @@ -82,7 +82,7 @@ class MenuList extends PureComponent { okText: '确认', okType: 'danger', cancelText: '取消', - onOk: this.handleDelOKClick.bind(this, item.record_id), + onOk: this.handleDelOKClick.bind(this, item.id), }); }; @@ -90,7 +90,7 @@ class MenuList extends PureComponent { const keys = []; const rows = []; if (selected) { - keys.push(record.record_id); + keys.push(record.id); rows.push(record); } this.setState({ @@ -182,7 +182,7 @@ class MenuList extends PureComponent { handleDelOKClick(id) { this.dispatch({ type: 'menu/del', - payload: { record_id: id }, + payload: { id }, }); this.clearSelectRows(); } @@ -195,12 +195,12 @@ class MenuList extends PureComponent { data.map(item => { if (item.children) { return ( - + {this.renderTreeNodes(item.children)} ); } - return ; + return ; }); renderSearchForm() { @@ -282,7 +282,7 @@ class MenuList extends PureComponent { }, { title: '创建时间', - width: 100, + width: 150, dataIndex: 'created_at', render: val => {formatDate(val, 'YYYY-MM-DD')}, }, @@ -395,7 +395,7 @@ class MenuList extends PureComponent { onSelect: this.handleTableSelectRow, }} loading={loading} - rowKey={record => record.record_id} + rowKey={record => record.id} dataSource={list} columns={columns} pagination={paginationProps} diff --git a/src/pages/Role/RoleList.js b/src/pages/Role/RoleList.js index 8e8bba5..8ab1fd8 100644 --- a/src/pages/Role/RoleList.js +++ b/src/pages/Role/RoleList.js @@ -32,14 +32,14 @@ class RoleList extends PureComponent { onItemDisableClick = item => { this.dispatch({ type: 'role/changeStatus', - payload: { record_id: item.record_id, status: 2 }, + payload: { id: item.id, status: 2 }, }); }; onItemEnableClick = item => { this.dispatch({ type: 'role/changeStatus', - payload: { record_id: item.record_id, status: 1 }, + payload: { id: item.id, status: 1 }, }); }; @@ -70,7 +70,7 @@ class RoleList extends PureComponent { type: 'role/loadForm', payload: { type: 'E', - id: item.record_id, + id: item.id, }, }); }; @@ -81,7 +81,7 @@ class RoleList extends PureComponent { okText: '确认', okType: 'danger', cancelText: '取消', - onOk: this.handleDelOKClick.bind(this, item.record_id), + onOk: this.handleDelOKClick.bind(this, item.id), }); }; @@ -89,7 +89,7 @@ class RoleList extends PureComponent { const keys = []; const rows = []; if (selected) { - keys.push(record.record_id); + keys.push(record.id); rows.push(record); } this.setState({ @@ -157,7 +157,7 @@ class RoleList extends PureComponent { handleDelOKClick(id) { this.dispatch({ type: 'role/del', - payload: { record_id: id }, + payload: { id }, }); this.clearSelectRows(); } @@ -208,17 +208,14 @@ class RoleList extends PureComponent { { title: '角色名称', dataIndex: 'name', - width: 200, }, { title: '排序值', dataIndex: 'sequence', - width: 100, }, { title: '状态', dataIndex: 'status', - width: 80, render: val => { if (val === 1) { return ; @@ -228,7 +225,6 @@ class RoleList extends PureComponent { }, { title: '创建时间', - width: 100, dataIndex: 'created_at', render: val => {formatDate(val, 'YYYY-MM-DD')}, }, @@ -300,7 +296,7 @@ class RoleList extends PureComponent { onSelect: this.handleTableSelectRow, }} loading={loading} - rowKey={record => record.record_id} + rowKey={record => record.id} dataSource={list} columns={columns} pagination={paginationProps} diff --git a/src/pages/Role/RoleMenu/EditableCell.js b/src/pages/Role/RoleMenu/EditableCell.js index 6eb55f5..f7bad74 100644 --- a/src/pages/Role/RoleMenu/EditableCell.js +++ b/src/pages/Role/RoleMenu/EditableCell.js @@ -5,7 +5,7 @@ export default class EditableCell extends PureComponent { findItem = () => { const { data, record } = this.props; for (let i = 0; i < data.length; i += 1) { - if (data[i].menu_id === record.record_id) { + if (data[i].menu_id === record.id) { return data[i]; } } @@ -32,8 +32,8 @@ export default class EditableCell extends PureComponent { > {record.actions.map(v => ( - - {v.name} + + {v.name} ))} diff --git a/src/pages/Role/RoleMenu/index.js b/src/pages/Role/RoleMenu/index.js index 1da49a7..7784155 100644 --- a/src/pages/Role/RoleMenu/index.js +++ b/src/pages/Role/RoleMenu/index.js @@ -59,11 +59,11 @@ export default class RoleMenu extends PureComponent { handleSave = (record, dataIndex, values) => { const { dataSource } = this.state; const data = [...dataSource]; - const index = data.findIndex(item => item.menu_id === record.record_id); + const index = data.findIndex(item => item.menu_id === record.id); let item = data[index]; if (!item) { item = { - menu_id: record.record_id, + menu_id: record.id, dataIndex: values, }; } else { @@ -101,7 +101,7 @@ export default class RoleMenu extends PureComponent { for (let i = 0; i < addData.length; i += 1) { let exists = false; for (let j = 0; j < list.length; j += 1) { - if (list[j].menu_id === addData[i].record_id) { + if (list[j].menu_id === addData[i].id) { exists = true; break; } @@ -109,8 +109,8 @@ export default class RoleMenu extends PureComponent { if (!exists) { const item = { - menu_id: addData[i].record_id, - actions: addData[i].actions ? addData[i].actions.map(v => v.record_id) : [], + menu_id: addData[i].id, + actions: addData[i].actions ? addData[i].actions.map(v => v.id) : [], }; list.push(item); } @@ -124,7 +124,7 @@ export default class RoleMenu extends PureComponent { for (let i = 0; i < data.length; i += 1) { let exists = false; for (let j = 0; j < selectedRows.length; j += 1) { - if (data[i].menu_id === selectedRows[j].record_id) { + if (data[i].menu_id === selectedRows[j].id) { exists = true; break; } @@ -160,8 +160,8 @@ export default class RoleMenu extends PureComponent { if (selected) { list = selectRows.map(vv => { const item = { - menu_id: vv.record_id, - actions: vv.actions ? vv.actions.map(v => v.record_id) : [], + menu_id: vv.id, + actions: vv.actions ? vv.actions.map(v => v.id) : [], }; return item; }); @@ -203,7 +203,7 @@ export default class RoleMenu extends PureComponent { onSelect: this.handleSelectedRow, onSelectAll: this.handleSelectAll, }} - rowKey={record => record.record_id} + rowKey={record => record.id} components={components} dataSource={menuData} columns={columns} diff --git a/src/pages/User/RoleSelect.js b/src/pages/User/RoleSelect.js index b828a74..0f2ee9b 100644 --- a/src/pages/User/RoleSelect.js +++ b/src/pages/User/RoleSelect.js @@ -57,7 +57,7 @@ export default class RoleSelect extends PureComponent { style={{ width: '100%' }} > {data.map(item => ( - + {item.name} ))} diff --git a/src/pages/User/UserList.js b/src/pages/User/UserList.js index b582596..443f304 100644 --- a/src/pages/User/UserList.js +++ b/src/pages/User/UserList.js @@ -33,14 +33,14 @@ class UserList extends PureComponent { onItemDisableClick = item => { this.dispatch({ type: 'user/changeStatus', - payload: { record_id: item.record_id, status: 2 }, + payload: { id: item.id, status: 2 }, }); }; onItemEnableClick = item => { this.dispatch({ type: 'user/changeStatus', - payload: { record_id: item.record_id, status: 1 }, + payload: { id: item.id, status: 1 }, }); }; @@ -49,7 +49,7 @@ class UserList extends PureComponent { type: 'user/loadForm', payload: { type: 'E', - id: item.record_id, + id: item.id, }, }); }; @@ -66,7 +66,7 @@ class UserList extends PureComponent { onDelOKClick(id) { this.dispatch({ type: 'user/del', - payload: { record_id: id }, + payload: { id }, }); this.clearSelectRows(); } @@ -85,7 +85,7 @@ class UserList extends PureComponent { okText: '确认', okType: 'danger', cancelText: '取消', - onOk: this.onDelOKClick.bind(this, item.record_id), + onOk: this.onDelOKClick.bind(this, item.id), }); }; @@ -93,7 +93,7 @@ class UserList extends PureComponent { const keys = []; const rows = []; if (selected) { - keys.push(record.record_id); + keys.push(record.id); rows.push(record); } this.setState({ @@ -317,7 +317,7 @@ class UserList extends PureComponent { onSelect: this.handleTableSelectRow, }} loading={loading} - rowKey={record => record.record_id} + rowKey={record => record.id} dataSource={list} columns={columns} pagination={paginationProps}