You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.7 KiB
113 lines
2.7 KiB
'use strict';
|
|
|
|
import { basicAction } from '@peace/utils'
|
|
import { ApiTable } from '$utils'
|
|
|
|
export function getDepMessage() {
|
|
return dispatch => basicAction({
|
|
type: 'get',
|
|
dispatch: dispatch,
|
|
actionType: 'GET_DEPARTMENT_MESSAGE',
|
|
url: ApiTable.getDepMessage,
|
|
msg: { error: '获取部门信息失败' },
|
|
reducer: { name: 'depMessage' }
|
|
});
|
|
}
|
|
|
|
//新建部门
|
|
export function createDept(data) {
|
|
return dispatch => basicAction({
|
|
type: 'post',
|
|
data,
|
|
dispatch: dispatch,
|
|
actionType: 'CREATE_DEPT',
|
|
url: ApiTable.createDept,
|
|
msg: { option: '新建部门' },
|
|
});
|
|
}
|
|
|
|
//修改部门
|
|
export function updateDept(id, data) {
|
|
return dispatch => basicAction({
|
|
type: 'put',
|
|
data,
|
|
dispatch: dispatch,
|
|
actionType: 'UPDATE_DEPT',
|
|
url: ApiTable.updateDept.replace('{id}', id),
|
|
msg: { option: '修改部门' },
|
|
});
|
|
}
|
|
|
|
//删除部门
|
|
export function delDept(id) {
|
|
return dispatch => basicAction({
|
|
type: 'del',
|
|
dispatch: dispatch,
|
|
actionType: 'DEL_DEPT',
|
|
url: ApiTable.delDept.replace('{id}', id),
|
|
msg: { option: '删除部门' },
|
|
});
|
|
}
|
|
|
|
export function getDepUser(depId) {
|
|
return dispatch => basicAction({
|
|
type: 'get',
|
|
dispatch: dispatch,
|
|
actionType: 'GET_DEPARTMENT_USER',
|
|
url: ApiTable.getDepUser.replace('{depId}', depId),
|
|
msg: { error: '获取部门下用户信息失败' },
|
|
reducer: { name: 'depUser' }
|
|
});
|
|
}
|
|
|
|
export function createUser(data) {
|
|
return dispatch => basicAction({
|
|
type: 'post',
|
|
data,
|
|
dispatch: dispatch,
|
|
actionType: 'CREATE_DEPARTMENT_USER',
|
|
url: ApiTable.createUser,
|
|
msg: { option: '新建用户' },
|
|
});
|
|
}
|
|
|
|
export function updateUser(id, data) {
|
|
return dispatch => basicAction({
|
|
type: 'put',
|
|
data,
|
|
dispatch: dispatch,
|
|
actionType: 'UPDATE_DEPARTMENT_USER',
|
|
url: ApiTable.updateUser.replace('{id}', id),
|
|
msg: { option: '修改用户' },
|
|
});
|
|
}
|
|
|
|
export function delUser(ids) {
|
|
return dispatch => basicAction({
|
|
type: 'del',
|
|
dispatch: dispatch,
|
|
actionType: 'DEL_DEPARTMENT_USER',
|
|
url: ApiTable.delUser.replace('{ids}', ids),
|
|
msg: { option: '删除用户' },
|
|
});
|
|
}
|
|
|
|
export function resetPwd(id, data) {
|
|
return dispatch => basicAction({
|
|
type: 'put',
|
|
data,
|
|
dispatch: dispatch,
|
|
actionType: 'CREATE_DEPARTMENT_USER',
|
|
url: ApiTable.resetPwd.replace('{id}', id),
|
|
msg: { option: '重置用户密码' },
|
|
});
|
|
}
|
|
|
|
export default {
|
|
getDepMessage,
|
|
getDepUser,
|
|
createUser,
|
|
updateUser,
|
|
delUser,
|
|
resetPwd
|
|
}
|