Commit 7d4a88a9 by bert

init

parent 7e00e7a2
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import rootReducer from '../reducers'
import rootReducer from './reducers'
export default function configureStore(initialState) {
const store = createStore(
......
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import rootReducer from '../reducers'
export default function configureStore(initialState) {
const store = createStore(
rootReducer,
initialState,
applyMiddleware(thunkMiddleware, createLogger())
// applyMiddleware(thunkMiddleware)
)
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers').default
store.replaceReducer(nextReducer)
})
}
return store
}
import { Record, Map } from 'immutable';
// import { Record, Map } from 'immutable';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
const InitState = {
currentIndex : 0,
leftMenu : [],
leftMenuType : '',
......@@ -15,6 +15,6 @@ const InitState = Record({
selectClass : '',
selectKey : 'my_case',
status : 1
})
}
export default InitState
\ No newline at end of file
import _ from 'lodash';
// import _ from 'lodash';
import { message } from 'antd';
import { createReducer } from '../../../util';
import types from '../../types';
......
import { Record, Map } from 'immutable';
// import { Record, Map } from 'immutable';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
const InitState = {
user: null,
loggingIn: false,
loggingOut: false,
loginErrors: null
})
}
export default InitState
......@@ -3,14 +3,7 @@ import { routerReducer } from 'react-router-redux';
import user from './modules/user/user_reducer';
import menu from './modules/menu/menu_reducer';
import myCase from './modules/myCase/my_case_reducer';
import myTask from './modules/myTask/my_task_reducer';
import myFocus from './modules/myFocus/my_focus_reducer';
import addCase from './modules/addCase/add_case_reducer';
import caseManage from './modules/caseManage/case_manage_reducer';
import caseGroup from './modules/caseGroup/case_group_reducer';
import caseDetail from './modules/caseDetail/case_detail_reducer';
import caseRank from './modules/caseRank/case_rank_reducer';
/**
* combineReducers(reducers)
*
......@@ -46,15 +39,5 @@ import caseRank from './modules/caseRank/case_rank_reducer';
export default combineReducers({
user,
menu,
caseManage,
caseGroup,
caseDetail,
caseRank,
myCase,
myTask,
addCase,
myFocus,
routing: routerReducer
});
import keyMirror from 'key-mirror'
/**
* key-mirror:
* keyMirror() 创建的对象,值会与名字一致,编码起来更方便
*/
export default keyMirror({
// Menu
UPDATE_NAVPATH : null,
GET_TOP_MENU : null,
GET_LEFT_MENU : null,
GET_MANAGE_LEFT_MENU : null,
UPDATE_COLLAPSE : null,
UPDATE_STATUS : null,
INIT_MENU : null,
GET_ADD_CASE_LEFT_MENU : null,
// User
UID_NOT_FOUND : null,
FETCH_PROFILE : null,
LOGIN : null,
LOGOUT : null
})
......@@ -9,24 +9,12 @@
* 将逻辑代码统一放在 `Action` 层,这样有利于逻辑重用,且在修改逻辑代码时,不需要改动 `View` 层
*/
import * as addCaseAction from './modules/addCase/add_case_action' // 添加case
import * as caseManageAction from './modules/caseManage/case_manage_action' // case管理
import * as caseRankAction from './modules/caseRank/case_rank_action' // case排名
import * as leftMenuAction from './modules/leftMenu/left_menu_action' // 左侧菜单
import * as myCaseAction from './modules/myCase/my_case_action' // 我的发布
import * as myFocusAction from './modules/myFocus/my_focus_action' // 我的关注
import * as myTaskAction from './modules/myTask/my_task_action' // 我的任务
import * as topMenuAction from './modules/topMenu/top_menu_action' // 顶部菜单
import * as userAction from './modules/user/user_action' // 用户
export default {
...addCaseAction,
...caseManageAction,
...caseRankAction,
...leftMenuAction,
...myCaseAction,
...myFocusAction,
...myTaskAction,
...topMenuAction,
...userAction,
}
......@@ -3,12 +3,6 @@
*
*/
import * as addCaseState from './modules/addCase/add_case_state' // 添加case
import * as caseManageState from './modules/caseManage/case_manage_state' // case管理
import * as caseRankState from './modules/caseRank/case_rank_state' // case排名
import * as myCaseState from './modules/myCase/my_case_state' // 我的发布
import * as myFocusState from './modules/myFocus/my_focus_state' // 我的关注
import * as myTaskState from './modules/myTask/my_task_state' // 我的任务
import * as MenuState from './modules/menu/menu_state' // 顶部菜单
import * as userState from './modules/user/user_state' // 用户
/**
......@@ -18,11 +12,6 @@ import * as userState from './modules/user/user_state' // 用户
*/
const initialState = {
// addCase : new addCaseState,
// caseManage : new caseManageState,
// myCase : new myCaseState,
// myFocus : new myFocusState,
// myTask : new myTaskState,
// menu : new MenuState,
// user : new userState,
}
......
import { Record } from 'immutable';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
typeList : [],
fileList : [],
execList : [],
execCollectList : [],
focusList : [],
focusCollectList : [],
loading : false,
isRootOrgShow : true,
executorUser : undefined,
focusUser : undefined,
caseNo : '',
orgValidateStatus : 'success',
orgList : [],
orgCollectionList : [],
orgId : '',
orgName : '',
})
export default InitState
\ No newline at end of file
import _ from 'lodash';
import { message } from 'antd';
import { createReducer } from '../../../util';
import types from '../../types';
import InitState from './case_detail_state';
export default createReducer(new InitState, {
[`${types.GET_CASE_INFO}_SUCCESS`]: (state, data) => {
return state.set('caseInfo', data.content)
.set('loading', false);
},
[`${types.GET_CASE_INFO}_PENDING`]: (state, data) => {
return state.set('loading', true);
},
[`${types.UPDATE_LOAD}`]: (state, data, params) => {
return state.set('loading', data.loading)
},
[`${types.ADD_COMMENT}_SUCCESS`]: (state, data) => {
message.success('评论成功');
return state.set('loading', false);
},
[`${types.ADD_COMMENT}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_MODEL_VISIBLE}`]: (state, data, params) => {
return state.set('updModalVisible', params.visible)
},
[`${types.UPDATE_CASE_DETAIL_VISIBLE}`]: (state, data, params) => {
return state
.set('updModalVisible', params.state_value.updModalVisible !== undefined ? params.state_value.updModalVisible : state.updModalVisible)
.set('updExecVisible', params.state_value.updExecVisible !== undefined ? params.state_value.updExecVisible : state.updExecVisible)
.set('loading', params.state_value.loading !== undefined ? params.state_value.loading : state.loading)
.set('updGroupVisible', params.state_value.updGroupVisible !== undefined ? params.state_value.updGroupVisible : state.updGroupVisible)
.set('updFocusUserVisible', params.state_value.updFocusUserVisible !== undefined ? params.state_value.updFocusUserVisible : state.updFocusUserVisible)
.set('updCreateUserVisible', params.state_value.updCreateUserVisible !== undefined ? params.state_value.updCreateUserVisible : state.updCreateUserVisible)
.set('selectedExec', params.state_value.selectedExec !== undefined ? params.state_value.selectedExec : state.selectedExec)
.set('selectedCreateUser', params.state_value.selectedCreateUser !== undefined ? params.state_value.selectedCreateUser : state.selectedCreateUser)
.set('orgName', params.state_value.orgName !== undefined ? params.state_value.orgName : state.orgName)
.set('orgId', params.state_value.orgId !== undefined ? params.state_value.orgId : state.orgId)
},
[`${types.UPDATE_EXEC}_SUCCESS`]: (state, data) => {
message.success('修改成功');
return state.set('loading', false);
},
[`${types.GET_DETAIL_ROOT_ORGS}_SUCCESS`]: (state, data, params) => {
const result = data.content && data.content.map(org => {
return {
key: org.uuid,
value: org.uuid,
name: org.name,
isLeaf: org.is_all && org.is_all === '0' ? true : false,
}
})
return state.set('orgList', result)
// .set('orgName', result && result.length>0 ? result[0].name : '请联系管理员配置组权限')
},
[`${types.GET_DETAIL_ORGS_BY_ID}`]: (state, data, params) => {
const result = params.data.content && params.data.content.map(org => {
return {
key: org.uuid,
name: org.name,
isLeaf: false, // TODO 子节点的权限不做约束
}
})
/**
* 通过Id获取到子节点信息
*
* 遍历整个 `tree` 数据,将获取到的子节点信息加到匹配的Id的节点下
* 返回新的节点数据
*
*/
const orgList = Object.assign([], state.orgList, [])
getNewTreeData(orgList, params.key, result, 10);
return state.set('orgList', orgList)
},
[`${types.UPD_DETAIL_ORG_VALUE}`]: (state, data, params) => {
return state.set('orgName', params.orgName)
.set('orgId', params.orgId)
},
[`${types.UPDATE_EXEC}_PENDING`]: (state, data) => {
return state.set('loading', true);
},
[`${types.UPDATE_CREATE_USER}_SUCCESS`]: (state, data) => {
message.success('修改成功');
return state.set('loading', false);
},
[`${types.UPDATE_CREATE_USER}_PENDING`]: (state, data) => {
return state.set('loading', true);
},
[`${types.UPDATE_FOCUS}_SUCCESS`]: (state, data) => {
message.success('修改成功');
return state.set('loading', false);
},
[`${types.UPDATE_FOCUS}_PENDING`]: (state, data) => {
return state.set('loading', true);
},
[`${types.SUBMIT_UPDATE_CASE}_SUCCESS`]: (state, data) => {
console.log('data', data);
message.success('修改成功');
return state.set('loading', false)
.set('updModalVisible', false);
},
[`${types.SUBMIT_UPDATE_CASE}_PENDING`]: (state) => {
return state.set('loading', true)
},
[`${types.SUBMIT_UPDATE_CASE}_ERROR`]: (state) => {
message.success('修改失败');
return state.set('loading', false)
},
})
// 构建新的树结构
function getNewTreeData(treeData, curKey, child, level) {
/**
* getNewTreeData(treeData, curKey, child, level)
*
* 参数:
* 1、 `treeData` 🌲树控件数据
* 2、 `curKey` 选中的 `key`
* 3、 `child` 子节点
* 4、 `level` 层级
*
* desc:
* 将子节点加入对应的节点中
*
* 判断🌲树控件层级不符合标准则退出
*
* 遍历节点,如果有子节点,则递归判断子节点
* 没有则将节点加入子节点中
*
*/
const loop = (data) => {
data.forEach((item) => {
if (curKey.indexOf(item.key) === 0) {
if (child.length == 0) {
// message.info('提示:没有数据了!');
item.isLeaf = true;
} else {
item.children = child;
}
} else {
if (item.children) {
loop(item.children);
}
}
});
};
loop(treeData);
return treeData;
}
\ No newline at end of file
import { Record, Map, List } from 'immutable';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseInfo : {},
updModalVisible : false,
updExecVisible : false,
updGroupVisible : false,
updCreateUserVisible: false,
updFocusUserVisible: false,
loading : false,
selectedExec : null,
selectedCreateUser : null,
orgList : [],
orgId : '',
orgName : '',
})
export default InitState
\ No newline at end of file
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
import { caseMenu } from '../../../../fake/leftMenu';
/**
* 获取case_group列表
*
* @export
* @param {any} reqParams
* @param {any} queryType
* @returns
*/
export function getCaseGroupList(reqParams, queryType) {
console.log('case group reqParams', reqParams);
return {
type: types.GET_CASE_GROUP_LIST,
payload: {
promise: api.get('case/group', { params: reqParams })
// promise: reqwest({
// url : AG_CONF.agUrl + 'case2/tasklist_group',
// method : 'get',
// type : 'json',
// data : [
// { name: 'sign', value: AG_CONF.sign },
// { name: 'ts', value: AG_CONF.ts },
// { name: 'appID', value: AG_CONF.appID } ,
// { name: 'caseNo', value: reqParams.caseNo },
// { name: 'searchMessage', value: reqParams.searchMessage },
// { name: 'taskType', value: reqParams.taskType },
// { name: 'sortType', value: reqParams.sortType },
// { name: 'status', value: reqParams.status },
// { name: 'groupId', value: reqParams.groupId },
// { name: 'isShowAll', value: reqParams.isShowAll },
// ]
// })
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
/**
* 修改state
*
* @export
* @param {any} state_value
* @returns
*/
export function updGroupStateValue(state_value) {
return {
type: types.UPDATE_CASE_GROUP_STATE,
params: {
state_value: state_value
}
}
}
/**
* 获取根节点
*
* @export
* @param {any} reqParams
* @returns
*/
export function getRootOrgs(reqParams) {
return dispatch => {
dispatch({
type: types.GET_ROOT_ORGS,
payload: {
content: OPERATOR_INFO.rootTree
},
})
// 在初始化后,加载case列表数据
if (OPERATOR_INFO.rootTree && OPERATOR_INFO.rootTree.length > 0) {
const groupId = OPERATOR_INFO.rootTree[0].org_id;
dispatch(getCaseGroupList({
...reqParams,
groupId: groupId
}))
dispatch(getGroupStatistics(groupId))
} else {
// 在初始化后,初始化侧栏菜单数据
dispatch({
type: types.INIT_MENU,
params: {
leftMenu: caseMenu
}
})
}
}
}
/**
* 根据Id获取子节点
*
* @export
* @param {any} reqParams
* @param {any} data
* @returns
*/
export function getOrgsById(reqParams, data) {
return {
type: types.GET_ORGS_BY_ID,
params: {
key: reqParams,
data: data
}
}
}
/**
* 选中子节点,查询case列表
* 修改 `case group` 中的树控件的值
*
* @export
* @param {any} org_value
* @param {any} reqParams
* @returns
*/
export function updOrgValue(org_value, reqParams) {
return dispatch => {
dispatch({
type: types.UPD_ORG_VALUE,
params: {
orgValue: org_value,
orgId: reqParams.groupId
}
})
// 在修改树控件值的同时加载对应的case信息
dispatch(getCaseGroupList(reqParams))
// 设置id
dispatch(getGroupStatistics(reqParams.groupId))
}
}
/**
* 获取case_group列表
* 获取初始化的 `Group` 统计数据
* @export
* @param {any} groupId
* @param {any} isShowAll
* @returns
*/
export function getGroupStatistics(groupId, isShowAll) {
return {
type: types.GET_GROUP_STATISTICS,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/statistics_group',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID },
{ name: 'groupId', value: groupId },
{ name: 'isShowAll', value: isShowAll },
]
})
},
params: {
leftMenu: caseMenu
}
}
}
/**
* 修改 rootKey 值
*
* @export
* @param {any} rootKey
* @returns
*/
export function updCaseGroupRootKey(rootKey) {
return {
type: types.UPDATE_CASE_GROUP_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
/**
* 获取case类型列表
*
* @export
* @returns
*/
export function getCaseTypeList() {
return {
type: types.GET_CASE_GROUP_SCREENING_TYPE,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/type',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
/**
* 修改 showSearch 值
*
* @export
* @param {any} showSearch
* @returns
*/
export function updGroupShowSearch(showSearch) {
return {
type: types.UPDATE_CASE_GROUP_SHOW_SEARCH,
params: {
showSearch: !showSearch
}
}
}
/**
* 清除 state 中搜索项的 Value
*
* @export
* @param {any} state
* @returns
*/
export function clearCaseGroupSearch(state) {
const reqParams = {
pageId: 1,
recPerPage: 10,
groupId: state.groupId,
status: state.status
}
return {
type: types.CLEAR_CASE_GROUP_SEARCH,
payload: {
promise: api.get('case/group', { params: reqParams })
}
}
}
\ No newline at end of file
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './case_group_state';
import { fromJS, List } from 'immutable';
export default createReducer(new InitState, {
[`${types.GET_CASE_GROUP_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result && result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseGroupList', result)
.set('caseNo', params.reqParams.caseNo || '')
.set('taskType', params.reqParams.taskType || '')
.set('sortType', params.reqParams.sortType || '')
.set('create_time', params.reqParams.create_time || '')
.set('status', params.reqParams.status || 1)
.set('isDesc', params.reqParams.isDesc || 0)
},
[`${types.GET_CASE_GROUP_LIST}_ERROR`]: (state, data, params) => {
return state.set('loading', false)
},
[`${types.GET_CASE_GROUP_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_CASE_GROUP}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_ROOT_ORGS}`]: (state, data, params) => {
const result = data.content && data.content.map(org => {
return {
key: org.org_id,
name: org.org_name,
isLeaf: org.is_all && org.is_all === '0' ? true : false,
}
})
// state.reqParams.groupId = result && result.length>0 ? result[0].key : null;
return state.set('orgList', result)
.set('orgValue', result && result.length > 0 ? result[0].name : '请联系管理员配置组权限')
.set('orgId', result && result.length > 0 ? result[0].key : null)
},
[`${types.GET_ORGS_BY_ID}`]: (state, data, params) => {
const result = params.data && params.data.content.map(org => {
return {
key: org.uuid,
name: org.name,
isLeaf: false,
}
})
/**
* 通过Id获取到子节点信息
*
* 遍历整个 `tree` 数据,将获取到的子节点信息加到匹配的Id的节点下
* 返回新的节点数据
*
*/
const orgList = Object.assign([], state.orgList, [])
getNewTreeData(orgList, params.key, result, 10);
return state.set('orgList', orgList)
},
[`${types.UPD_ORG_VALUE}`]: (state, data, params) => {
// state.reqParams.groupId = params.orgId;
return state.set('orgValue', params.orgValue)
.set('orgId', params.orgId)
},
[`${types.UPDATE_CASE_GROUP_ROOT_KEY}`]: (state, data, params) => {
return state.set('rootKey', params.rootKey)
},
[`${types.GET_CASE_GROUP_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.UPDATE_CASE_GROUP_SHOW_SEARCH}`]: (state, data, params) => {
return state.set('showSearch', params.showSearch)
},
[`${types.CLEAR_CASE_GROUP_SEARCH}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result && result.map((item, index) => {
item.key = item.caseNo;
})
return state
.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseGroupList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
.set('sourceType', '')
.set('sourceUser', '')
.set('searchType', '')
.set('startTime', '')
.set('endTime', '')
},
[`${types.CLEAR_CASE_GROUP_SEARCH}_ERROR`]: (state, data, params) => {
console.log('group erroe');
return state
.set('loading', false)
.set('pager', 10)
.set('caseGroupList', [])
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
.set('sourceType', '')
.set('sourceUser', '')
.set('searchType', '')
.set('startTime', '')
.set('endTime', '')
},
[`${types.UPDATE_CASE_GROUP_STATE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
.set('sourceType', params.state_value.sourceType !== undefined ? params.state_value.sourceType : state.sourceType)
.set('sourceUser', params.state_value.sourceUser !== undefined ? params.state_value.sourceUser : state.sourceUser)
.set('searchType', params.state_value.searchType !== undefined ? params.state_value.searchType : state.searchType)
.set('startTime', params.state_value.startTime !== undefined ? params.state_value.startTime : state.startTime)
.set('endTime', params.state_value.endTime !== undefined ? params.state_value.endTime : state.endTime)
}
})
// 构建新的树结构
function getNewTreeData(treeData, curKey, child, level) {
/**
* getNewTreeData(treeData, curKey, child, level)
*
* 参数:
* 1、 `treeData` 🌲树控件数据
* 2、 `curKey` 选中的 `key`
* 3、 `child` 子节点
* 4、 `level` 层级
*
* desc:
* 将子节点加入对应的节点中
*
* 判断🌲树控件层级不符合标准则退出
*
* 遍历节点,如果有子节点,则递归判断子节点
* 没有则将节点加入子节点中
*
*/
const loop = (data) => {
data.forEach((item) => {
if (curKey.indexOf(item.key) === 0) {
if (child.length == 0) {
// message.info('提示:没有数据了!');
item.isLeaf = true;
} else {
item.children = child;
}
} else {
if (item.children) {
loop(item.children);
}
}
});
};
loop(treeData);
return treeData;
}
\ No newline at end of file
import { Record, Map, List } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseGroupList : [],
typeList : [],
loading : false,
showSearch : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
sourceType : '',
sourceUser : '',
searchType : '',
startTime : '',
endTime : '',
orgList : List(),
orgValue : '',
orgId : null,
// groupId : '',
isShowAll : 0,
pager: PAGER
})
export default InitState
\ No newline at end of file
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
/**
* 获取case_manage列表
*
* @export
* @param {any} reqParams
* @param {any} queryType
* @returns
*/
export function getCaseManageList(reqParams, queryType) {
console.log('case manage reqParams', reqParams);
return {
type: types.GET_CASE_MANAGE_LIST,
payload: {
promise: api.get('case/all_page', { params: reqParams })
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
/**
* 修改state值
*
* @export
* @param {any} state_value
* @returns
*/
export function updManageStateValue(state_value) {
return {
type: types.UPDATE_CASE_MANAGE_STATE_VALUE,
params: {
state_value: state_value
}
}
}
/**
* 修改 rootKey 值
*
* @export
* @param {any} rootKey
* @returns
*/
export function updManageRootKey(rootKey) {
return {
type: types.UPDATE_CASE_MANAGE_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
/**
* 获取case类型列表
*
* @export
* @returns
*/
export function getCaseTypeList() {
return {
type: types.GET_CASE_MANAGE_SCREENING_TYPE,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/type',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
/**
* 修改 showSearch 值
*
* @export
* @param {any} showSearch
* @returns
*/
export function updManageShowSearch(showSearch) {
return {
type: types.UPDATE_CASE_MANAGE_SHOW_SEARCH,
params: {
showSearch: !showSearch
}
}
}
/**
* 清除 state 中搜索项的 Value
*
* @export
* @param {any} state
* @returns
*/
export function clearCaseManageSearch(state) {
const reqParams = {
pageId: 1,
recPerPage: 10,
status: state.status
}
return {
type: types.CLEAR_CASE_MANAGE_SEARCH,
payload: {
promise: api.get('case/all_page', { params: reqParams })
}
}
}
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './case_manage_state';
export default createReducer(new InitState, {
[`${types.GET_CASE_MANAGE_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseManageList', result)
.set('caseNo', params.reqParams.caseNo)
.set('taskType', params.reqParams.taskType)
.set('sortType', params.reqParams.sortType)
.set('create_time', params.reqParams.create_time)
.set('status', params.reqParams.status)
.set('isDesc', params.reqParams.isDesc)
},
[`${types.GET_CASE_MANAGE_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_CASE_MANAGE}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_CASE_MANAGE_ROOT_KEY}`]: (state, data, params) => {
console.log('params', params);
return state.set('rootKey', params.rootKey)
},
[`${types.GET_CASE_MANAGE_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.UPDATE_CASE_MANAGE_SHOW_SEARCH}`]: (state, data, params) => {
return state.set('showSearch', params.showSearch)
},
[`${types.CLEAR_CASE_MANAGE_SEARCH}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state
.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseManageList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
.set('sourceType', '')
.set('sourceUser', '')
.set('searchType', '')
.set('startTime', '')
.set('endTime', '')
.set('isTimeout', '')
},
[`${types.UPDATE_CASE_MANAGE_STATE_VALUE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
.set('sourceType', params.state_value.sourceType !== undefined ? params.state_value.sourceType : state.sourceType)
.set('sourceUser', params.state_value.sourceUser !== undefined ? params.state_value.sourceUser : state.sourceUser)
.set('searchType', params.state_value.searchType !== undefined ? params.state_value.searchType : state.searchType)
.set('startTime', params.state_value.startTime !== undefined ? params.state_value.startTime : state.startTime)
.set('endTime', params.state_value.endTime !== undefined ? params.state_value.endTime : state.endTime)
.set('isTimeout', params.state_value.isTimeout !== undefined ? params.state_value.isTimeout : state.isTimeout)
}
})
import { Record } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseManageList : [],
typeList : [],
loading : false,
showSearch : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
sourceType : '',
sourceUser : '',
searchType : '',
startTime : '',
endTime : '',
isTimeout : '',
pager: PAGER
})
export default InitState
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
// 获取case_rank列表
export function getCaseRankList(reqParams, queryType) {
console.log('case rank reqParams', reqParams);
return {
type: types.GET_CASE_RANK_LIST,
payload: {
//promise: reqwest({
// url: AG_CONF.agUrl + 'case2/statistics_rank?sign=' + AG_CONF.sign + '&ts=' + AG_CONF.ts + '&appID=' + AG_CONF.appID,
// type: 'json',
// method: 'get',
// data : [
// { name: 'sourceType', value:reqParams.sourceType },
// { name: 'sourceUser', value:reqParams.sourceUser },
// { name: 'startTime', value:reqParams.startTime },
// { name: 'endTime', value:reqParams.endTime },
// { name: 'isDesc', value:reqParams.isDesc },
// { name: 'pageNum', value:reqParams.pageId },
// { name: 'pageSize', value:reqParams.recPerPage }
// ]
//})
promise: api.get('case2/statistics_rank', {params: reqParams})
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
export function updRankStateValue(state_value) {
/**
* 修改值可以做统一处理
* 这里是统一修改 `State` 的值
* 分开过多状态会显得更乱
*
*/
return {
type: types.UPDATE_CASE_RANK_STATE_VALUE,
params: {
state_value: state_value
}
}
}
// 修改 rootKey 值
export function updRankRootKey(rootKey) {
return {
type: types.UPDATE_CASE_RANK_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
// 获取case类型列表
export function getCaseTypeList() {
return {
type: types.GET_CASE_RANK_SCREENING_TYPE,
payload: {
promise: reqwest({
url : AG_CONF.agUrl + 'case2/type',
method : 'get',
type : 'json',
data : [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
// 修改 showSearch 值
export function updRankShowSearch(showSearch) {
return {
type: types.UPDATE_CASE_RANK_SHOW_SEARCH,
params: {
showSearch: !showSearch
}
}
}
// 清除 state 中搜索项的 Value
export function clearCaseRankSearch(state) {
console.log(state)
const reqParams = {
sourceType : 'remain',
pageId : 1,
recPerPage : 10,
status : state.status
}
return {
type: types.CLEAR_CASE_RANK_SEARCH,
payload: {
//promise: api.get('case/all_page', {params: reqParams})
}
}
}
// 按关键字获取员工列表
export function getExecutorKeywordList(keyword) {
/*
todo:需要添加关键字过滤机制时在此处理
*/
console.log("进入员工搜索");
return {
type: types.GET_RANKUSER_LIST_BY_KEYWORD,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'account/search?sign=' + AG_CONF.sign + '&ts=' + AG_CONF.ts + '&appID=' + AG_CONF.appID,
type: 'json',
method: 'post',
data: {
page: '1',
pageSize: '15',
keyword: keyword
}
})
}
}
}
\ No newline at end of file
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './case_rank_state';
export default createReducer(new InitState, {
[`${types.GET_CASE_RANK_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseRankList', result)
.set('caseNo', params.reqParams.caseNo)
.set('taskType', params.reqParams.taskType)
.set('sortType', params.reqParams.sortType)
.set('create_time', params.reqParams.create_time)
.set('status', params.reqParams.status)
.set('isDesc', params.reqParams.isDesc)
},
[`${types.GET_CASE_RANK_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_CASE_RANK}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_CASE_RANK_ROOT_KEY}`]: (state, data, params) => {
console.log('params', params);
return state.set('rootKey', params.rootKey)
},
[`${types.GET_CASE_RANK_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.UPDATE_CASE_RANK_SHOW_SEARCH}`]: (state, data, params) => {
return state.set('showSearch', params.showSearch)
},
[`${types.CLEAR_CASE_RANK_SEARCH}`]: (state, data, params) => {
//let result = data.content;
//result.map((item, index) => {
// item.key = item.caseNo;
//})
return state
.set('loading', false)
//.set('pager', getNewPager(data.pager, state.pager))
//.set('caseRankList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
.set('sourceType', '')
.set('sourceUser', {})
.set('searchType', '')
.set('startTime', '')
.set('endTime', '')
.set('isTimeout', '')
},
[`${types.UPDATE_CASE_RANK_STATE_VALUE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
.set('sourceType', params.state_value.sourceType !== undefined ? params.state_value.sourceType : state.sourceType)
.set('sourceUser', params.state_value.sourceUser !== undefined ? params.state_value.sourceUser : state.sourceUser)
.set('searchType', params.state_value.searchType !== undefined ? params.state_value.searchType : state.searchType)
.set('startTime', params.state_value.startTime !== undefined ? params.state_value.startTime : state.startTime)
.set('endTime', params.state_value.endTime !== undefined ? params.state_value.endTime : state.endTime)
.set('isTimeout', params.state_value.isTimeout !== undefined ? params.state_value.isTimeout : state.isTimeout)
},
[`${types.GET_RANKUSER_LIST_BY_KEYWORD}_SUCCESS`]: (state, data) => {
const execList = _.compact(_.map(data.content, (account, index) => {
if (account.disable == 0) {
return account
}
}))
return state.set('execList', execList)
},
})
import { Record } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseRankList : [],
typeList : [],
execList : [],
loading : false,
showSearch : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
sourceType : 'remain',
sourceUser : {},
searchType : '',
startTime : '',
endTime : '',
isTimeout : '',
pager: PAGER
})
export default InitState
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
/**
* 获取case列表
*
* @export
* @param {any} reqParams
* @param {any} queryType
* @returns
*/
export function getCaseList(reqParams, queryType) {
reqParams.taskMatch = 1; // TODO 侧栏菜单查询时没有带 `taskMatch` 先在 `Action` 中固定该值,之后想法办处理
console.log('my case reqParams', reqParams);
return {
type: types.GET_MY_CASE_LIST,
payload: {
promise: api.get('case/my', { params: reqParams })
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
/**
* 修改case状态为关闭
*
* @export
* @param {any} case_id
* @param {any} reqParams
* @returns
*/
export function updStatusClose(case_id, reqParams) {
return dispatch => {
dispatch({
type: types.UPDATE_STATUS_CLOSE,
payload: {
promise: api.post('case/close', { params: { id: case_id } }).then(function(result) {
if (result.code == '0') {
dispatch(getCaseList(reqParams))
}
}),
}
})
}
}
/**
* 修改case状态为确认完成
*
* @export
* @param {any} case_id
* @param {any} reqParams
* @returns
*/
export function updStatusConfirmFinish(case_id, reqParams) {
return dispatch => {
dispatch({
type: types.UPDATE_STATUS_CONFIRM_FINISH,
payload: {
promise: api.post('case/create_finish', { params: { id: case_id } }).then(function(result) {
if (result.code == '0') {
dispatch(getCaseList(reqParams))
}
}),
}
})
}
}
/**
* 修改state
*
* @export
* @param {any} state_value
* @returns
*/
export function updMyCaseStateValue(state_value) {
return {
type: types.UPDATE_MY_CASE_STATE_VALUE,
params: {
state_value: state_value
}
}
}
/**
* 修改 rootKey 值
*
* @export
* @param {any} rootKey
* @returns
*/
export function updMyCaseRootKey(rootKey) {
return {
type: types.UPDATE_MY_CASE_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
/**
* 获取case类型列表
*
* @export
* @returns
*/
export function getCaseTypeList() {
return {
type: types.GET_MY_CASE_SCREENING_TYPE,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/type',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
/**
* 清除 state 中搜索项的 Value
*
* @export
* @param {any} state
* @returns
*/
export function clearMyCaseSearch(state) {
const reqParams = {
pageId: 1,
recPerPage: 10,
taskMatch: 1,
status: state.status
}
return {
type: types.CLEAR_MY_CASE_SEARCH,
payload: {
promise: api.get('case/my', { params: reqParams })
}
}
}
\ No newline at end of file
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './my_case_state';
export default createReducer(new InitState, {
[`${types.GET_MY_CASE_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('caseNo', params.reqParams.caseNo)
.set('taskType', params.reqParams.taskType)
.set('sortType', params.reqParams.sortType)
.set('create_time', params.reqParams.create_time)
.set('status', params.reqParams.status)
.set('isDesc', params.reqParams.isDesc)
},
[`${types.GET_MY_CASE_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_MY_CASE}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_STATUS_CLOSE}_SUCCESS`]: (state, data) => {
message.success('操作成功');
return state
},
[`${types.UPDATE_STATUS_CONFIRM_FINISH}_SUCCESS`]: (state, data) => {
message.success('操作成功');
return state
},
// [`${types.UPDATE_STATUS_CLOSE}_ERROR`]: (state, data) => {
// /**
// * 如果 `util` 里无法全局处理 `ERROR` 时启动该 `reducer`
// */
// message.error('操作失败');
// return state
// },
// [`${types.UPDATE_STATUS_CONFIRM_FINISH}_ERROR`]: (state, data) => {
// /**
// * 如果 `util` 里无法全局处理 `ERROR` 时启动该 `reducer`
// */
// message.error('操作失败');
// return state
// },
[`${types.UPDATE_MY_CASE_KEYWORD}`]: (state, data, params) => {
return state.set('keyword_value', params.keyword_value)
},
[`${types.UPDATE_MY_CASE_NO_VALUE}`]: (state, data, params) => {
return state.set('caseNo', params.case_no)
},
[`${types.UPDATE_MY_CASE_KEYWORD_FOCUS}`]: (state, data, params) => {
return state.set('focus', params.focus)
},
[`${types.UPDATE_MY_CASE_NO_FOCUS}`]: (state, data, params) => {
return state.set('no_focus', params.focus)
},
[`${types.UPDATE_MY_CASE_ROOT_KEY}`]: (state, data, params) => {
return state.set('rootKey', params.rootKey)
},
[`${types.GET_MY_CASE_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.CLEAR_MY_CASE_SEARCH}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state
.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
},
[`${types.UPDATE_MY_CASE_STATE_VALUE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
}
})
import { Record, Map } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseList : [],
typeList : [],
loading : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
taskMatch: 1,
pager: PAGER
})
export default InitState
\ No newline at end of file
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
/**
* 获取case列表
*
* @export
* @param {any} reqParams
* @param {any} queryType
* @returns
*/
export function getMyFocusList(reqParams, queryType) {
reqParams.taskMatch = 3; // TODO 侧栏菜单查询时没有带 `taskMatch` 先在 `Action` 中固定该值,之后想法办处理
console.log('my focus case_param', reqParams);
return {
type: types.GET_MY_FOCUS_LIST,
payload: {
promise: api.get('case/my', { params: reqParams })
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
/**
* 修改 rootKey 值
*
* @export
* @param {any} rootKey
* @returns
*/
export function updMyFocusRootKey(rootKey) {
return {
type: types.UPDATE_MY_FOCUS_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
/**
* 获取case类型列表
*
* @export
* @returns
*/
export function getCaseTypeList() {
return {
type: types.GET_MY_FOCUS_SCREENING_TYPE,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/type',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
/**
* 修改state
*
* @export
* @param {any} state_value
* @returns
*/
export function updMyFocusStateValue(state_value) {
return {
type: types.UPDATE_MY_FOCUS_STATE_VALUE,
params: {
state_value: state_value
}
}
}
/**
* 清除 state 中搜索项的 Value
*
* @export
* @param {any} state
* @returns
*/
export function clearMyFocusSearch(state) {
const reqParams = {
pageId: 1,
recPerPage: 10,
taskMatch: 3,
status: state.status
}
return {
type: types.CLEAR_MY_FOCUS_SEARCH,
payload: {
promise: api.get('case/my', { params: reqParams })
}
}
}
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './my_focus_state';
export default createReducer(new InitState, {
[`${types.GET_MY_FOCUS_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('caseNo', params.reqParams.caseNo)
.set('taskType', params.reqParams.taskType)
.set('sortType', params.reqParams.sortType)
.set('create_time', params.reqParams.create_time)
.set('status', params.reqParams.status)
.set('isDesc', params.reqParams.isDesc)
},
[`${types.GET_MY_FOCUS_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_MY_FOCUS}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_STATUS_FINISH}_SUCCESS`]: (state, data) => {
message.success('操作成功');
return state
},
// [`${types.UPDATE_STATUS_FINISH}_ERROR`]: (state, data) => {
// /**
// * 如果 `util` 里无法全局处理 `ERROR` 时启动该 `reducer`
// */
// message.error('操作失败');
// return state
// },
[`${types.UPDATE_MY_FOCUS_ROOT_KEY}`]: (state, data, params) => {
return state.set('rootKey', params.rootKey)
},
[`${types.GET_MY_FOCUS_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.CLEAR_MY_FOCUS_SEARCH}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state
.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
},
[`${types.UPDATE_MY_FOCUS_STATE_VALUE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
}
})
\ No newline at end of file
import { Record, Map } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseList : [],
typeList : [],
loading : false,
focus : false,
no_focus : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
taskMatch: 3,
pager: PAGER
})
export default InitState
\ No newline at end of file
import api from '../../../api';
import types from '../../types';
import reqwest from 'reqwest';
import AG_CONF from '../../../constants/AgCode';
import OPERATOR_INFO from '../../../constants/OperatorInfo';
/**
* 获取case列表
*
* @export
* @param {any} reqParams
* @param {any} queryType
* @returns
*/
export function getMyTaskList(reqParams, queryType) {
reqParams.taskMatch = 2; // TODO 侧栏菜单查询时没有带 `taskMatch` 先在 `Action` 中固定该值,之后想法办处理
console.log('my task case_param', reqParams);
return {
type: types.GET_MY_TASK_LIST,
payload: {
promise: api.get('case/my', { params: reqParams })
},
params: {
reqParams: reqParams,
queryType: queryType
}
}
}
/**
* 设置case状态 -> 完成
*
* desc:
* 先将case发送将case状态设置为完成 `Action`,如果设置成功则在发送查询case列表的 `Action`
*
* 这里用到了 `dispatch` 的触发机制,猜想是用递归的方式调用 `Action` 方法,
* 有时间需要深入研究
*
*/
export function updStatusFinish(case_id, reqParams) {
return dispatch => {
dispatch({
type: types.UPDATE_STATUS_FINISH,
payload: {
promise: api.post('case/execte_finish', { params: { id: case_id } }).then(function(result) {
if (result.code == '0') {
dispatch(getMyTaskList(reqParams))
}
}),
}
})
}
}
/**
* 修改 rootKey 值
*
* @export
* @param {any} rootKey
* @returns
*/
export function updMyTaskRootKey(rootKey) {
return {
type: types.UPDATE_MY_TASK_ROOT_KEY,
params: {
rootKey: rootKey
}
}
}
/**
* 获取case类型列表
*
* @export
* @returns
*/
export function getCaseTypeList() {
return {
type: types.GET_MY_TASK_SCREENING_TYPE,
payload: {
promise: reqwest({
url: AG_CONF.agUrl + 'case2/type',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID }
]
})
}
}
}
/**
* 修改state
*
* @export
* @param {any} state_value
* @returns
*/
export function updMyTaskStateValue(state_value) {
return {
type: types.UPDATE_MY_TASK_STATE_VALUE,
params: {
state_value: state_value
}
}
}
/**
* 清除 state 中搜索项的 Value
*
* @export
* @param {any} state
* @returns
*/
export function clearMyTaskSearch(state) {
const reqParams = {
pageId: 1,
recPerPage: 10,
taskMatch: 2,
status: state.status
}
return {
type: types.CLEAR_MY_TASK_SEARCH,
payload: {
promise: api.get('case/my', { params: reqParams })
}
}
}
\ No newline at end of file
import _ from 'lodash';
import { message } from 'antd';
import { createReducer, getNewPager } from '../../../util';
import types from '../../types';
import InitState from './my_task_state';
export default createReducer(new InitState, {
[`${types.GET_MY_TASK_LIST}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('caseNo', params.reqParams.caseNo)
.set('taskType', params.reqParams.taskType)
.set('sortType', params.reqParams.sortType)
.set('create_time', params.reqParams.create_time)
.set('status', params.reqParams.status)
.set('isDesc', params.reqParams.isDesc)
},
[`${types.GET_MY_TASK_LIST}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.GET_MY_TASK}_PENDING`]: (state, data) => {
return state.set('loading', true)
},
[`${types.UPDATE_STATUS_FINISH}_SUCCESS`]: (state, data) => {
message.success('操作成功');
return state
},
// [`${types.UPDATE_STATUS_FINISH}_ERROR`]: (state, data) => {
// /**
// * 如果 `util` 里无法全局处理 `ERROR` 时启动该 `reducer`
// */
// message.error('操作失败');
// return state
// },
[`${types.UPDATE_MY_TASK_ROOT_KEY}`]: (state, data, params) => {
return state.set('rootKey', params.rootKey)
},
[`${types.GET_MY_TASK_SCREENING_TYPE}_SUCCESS`]: (state, data, params) => {
const typeList = _.map(data.content, type => {
return {
text: type.case_type,
value: type.id,
}
});
return state.set('typeList', typeList)
},
[`${types.CLEAR_MY_TASK_SEARCH}_SUCCESS`]: (state, data, params) => {
let result = data.content;
result.map((item, index) => {
item.key = item.caseNo;
})
return state
.set('loading', false)
.set('pager', getNewPager(data.pager, state.pager))
.set('caseList', result)
.set('keyword_value', '')
.set('caseNo', '')
.set('taskType', '')
.set('sortType', '')
.set('create_time', '')
.set('isDesc', 0)
},
[`${types.UPDATE_MY_TASK_STATE_VALUE}`]: (state, data, params) => {
return state
.set('keyword_value', params.state_value.keyword_value !== undefined ? params.state_value.keyword_value : state.keyword_value)
.set('caseNo', params.state_value.caseNo !== undefined ? params.state_value.caseNo : state.caseNo)
.set('taskType', params.state_value.taskType !== undefined ? params.state_value.taskType : state.taskType)
.set('sortType', params.state_value.sortType !== undefined ? params.state_value.sortType : state.sortType)
.set('create_time', params.state_value.create_time !== undefined ? params.state_value.create_time : state.create_time)
.set('isDesc', params.state_value.isDesc !== undefined ? params.state_value.isDesc : state.isDesc)
}
})
\ No newline at end of file
import { Record, Map } from 'immutable';
import { PAGER } from '../../../constants/ProjectConf';
/**
* immutable 确定操作的对象是不可变的,更好的维护性能
* 具体说明在 `immutable.md` 文件中
*/
const InitState = Record({
caseList : [],
typeList : [],
loading : false,
focus : false,
no_focus : false,
rootKey : '',
keyword_value : '',
caseNo : '',
taskType : '',
sortType : '',
create_time : '',
status : 1,
isDesc : 0,
taskMatch: 2,
pager: PAGER
})
export default InitState
\ No newline at end of file
import keyMirror from 'key-mirror'
/**
* key-mirror:
* keyMirror() 创建的对象,值会与名字一致,编码起来更方便
*/
export default keyMirror({
// Add Case
SUBMIT_CASE : null,
GET_CASE_TYPE : null,
GET_EXEC_LIST_BY_KEYWORD : null,
GET_EXEC_COLLECTION_LIST : null,
GET_FOCUS_LIST_BY_KEYWORD : null,
GET_FOCUS_COLLECTION_LIST : null,
UPD_DEFAULT_FILE_LIST : null,
GET_ADD_ROOT_ORGS : null,
GET_ADD_ORGS_BY_ID : null,
UPD_ADD_ORG_VALUE : null,
SET_STATE : null,
SUBMIT_UPDATE_CASE : null,
UPDATE_ADD_CASE_STATE_VALUE : null,
EXEC_STAR : null,
FOCUS_STAR : null,
ORG_STAR : null,
GET_ADD_COLLECTION_ORGS : null,
GET__ORGS_LIST_BY_KEYWORD : null,
// Case Manage
GET_CASE_MANAGE : null,
GET_CASE_MANAGE_LIST : null,
UPDATE_CASE_MANAGE_ROOT_KEY : null,
GET_CASE_MANAGE_SCREENING_TYPE : null,
UPDATE_CASE_MANAGE_SHOW_SEARCH : null,
CLEAR_CASE_MANAGE_SEARCH : null,
UPDATE_CASE_MANAGE_SOURCE_USER : null,
UPDATE_CASE_MANAGE_STATE_VALUE : null,
// Case RANK
GET_CASE_RANK : null,
GET_CASE_RANK_LIST : null,
UPDATE_CASE_RANK_ROOT_KEY : null,
GET_CASE_RANK_SCREENING_TYPE : null,
UPDATE_CASE_RANK_SHOW_SEARCH : null,
CLEAR_CASE_RANK_SEARCH : null,
UPDATE_CASE_RANK_SOURCE_USER : null,
UPDATE_CASE_RANK_STATE_VALUE : null,
GET_RANKUSER_LIST_BY_KEYWORD : null,
// Case Group
GET_CASE_GROUP : null,
GET_CASE_GROUP_LIST : null,
UPDATE_CASE_GROUP_STATE : null, // TODO 该功能还未想好
GET_ROOT_ORGS : null,
GET_ORGS_BY_ID : null,
UPD_ORG_VALUE : null,
GET_GROUP_STATISTICS : null,
UPDATE_CASE_GROUP_ROOT_KEY : null,
GET_CASE_GROUP_SCREENING_TYPE : null,
UPDATE_CASE_GROUP_SHOW_SEARCH : null,
CLEAR_CASE_GROUP_SEARCH : null,
// My Case
GET_MY_CASE : null,
GET_MY_CASE_LIST : null,
UPDATE_STATUS_CLOSE : null,
UPDATE_STATUS_CONFIRM_FINISH : null,
UPDATE_MY_CASE_ROOT_KEY : null,
GET_MY_CASE_SCREENING_TYPE : null,
UPDATE_MY_CASE_STATE_VALUE : null,
CLEAR_MY_CASE_SEARCH : null,
// My Task
GET_MY_TASK : null,
GET_MY_TASK_LIST : null,
UPDATE_STATUS_FINISH : null,
UPDATE_MY_TASK_ROOT_KEY : null,
GET_MY_TASK_SCREENING_TYPE : null,
UPDATE_MY_TASK_STATE_VALUE : null,
CLEAR_MY_TASK_SEARCH : null,
// My Focus
GET_MY_FOCUS : null,
GET_MY_FOCUS_LIST : null,
UPDATE_MY_FOCUS_ROOT_KEY : null,
GET_MY_FOCUS_SCREENING_TYPE : null,
UPDATE_MY_FOCUS_STATE_VALUE : null,
CLEAR_MY_FOCUS_SEARCH : null,
// Menu
UPDATE_NAVPATH : null,
GET_TOP_MENU : null,
GET_LEFT_MENU : null,
GET_MANAGE_LEFT_MENU : null,
UPDATE_COLLAPSE : null,
UPDATE_STATUS : null,
INIT_MENU : null,
GET_ADD_CASE_LEFT_MENU : null,
// User
UID_NOT_FOUND : null,
FETCH_PROFILE : null,
LOGIN : null,
LOGOUT : null,
// Case Detail
GET_CASE_INFO : null,
UPDATE_LOAD : null,
ADD_COMMENT : null,
UPDATE_MODEL_VISIBLE : null,
UPDATE_CASE_DETAIL_VISIBLE : null,
UPDATE_EXEC : null,
GET_DETAIL_ORGS_BY_ID : null,
GET_DETAIL_ROOT_ORGS : null,
UPD_DETAIL_ORG_VALUE : null,
UPDATE_CREATE_USER : null,
UPDATE_FOCUS : null
})
import React, { PropTypes } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { Tree, TreeSelect } from 'antd';
import reqwest from 'reqwest';
import AG_CONF from '../../constants/AgCode';
import * as addCaseAction from '../../store/modules/addCase/add_case_action';
import './index.less';
const TreeNode = TreeSelect.TreeNode;
class OrgTreeSelect extends React.Component {
constructor(props) {
super(props)
this.onChange = this.onChange.bind(this);
this.onLoadData = this.onLoadData.bind(this);
this.onSelect = this.onSelect.bind(this);
}
/**
* 初始化树节点信息
*
*/
componentDidMount() {
// this.props.addCaseAction.getRootOrgs();
this.props.addCaseAction.getCollectionOrgs();
}
/**
* 加载树节点数据
*
* 1、判断该节点有子节点则不做加载
* 2、通过选中节点的ID加载子节点,加载成功后更新节点信息
*
* @param {any} treeNode
* @returns
*/
onLoadData(treeNode) {
const self = this;
if (treeNode.props.children) {
return new Promise(resolver => { resolver() })
}
return reqwest({
url: AG_CONF.agUrl + 'orgs',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID },
{ name: 'pid', value: treeNode.props.eventKey }
]
}).then(function(data) {
self.props.addCaseAction.getOrgsById(treeNode.props.eventKey, data);
})
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*
* 1、获取节点信息,更新选中节点,加载对应的列表数据
*/
onSelect(value, node, extra) {
const id = node.props.eventKey
this.props.addCaseAction.updOrgValue(value, id)
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*
* 判断节点的值,没有值时清除节点信息
*/
onChange(value, arr, obj) {
if (!value) {
this.props.addCaseAction.updOrgValue('', '')
}
}
render() {
const { orgName, orgList, orgCollectionList } = this.props;
// 遍历节点数据,生成节点DOM
const loop = data => data && data.map((item) => {
if (item.children) {
return <TreeNode value={item.name} title={item.name} key={item.key}>{loop(item.children) }</TreeNode>;
}
return <TreeNode value={item.name} title={item.name} key={item.key} isLeaf={item.isLeaf} />;
});
// 获取节点DOM
const treeNodes = loop(orgList ? orgList : orgCollectionList);
// 树节点配置
const TreeSelectParams = {
style: { width: 300 },
value: orgName,
dropdownStyle: { maxHeight: 400, overflow: 'auto' },
placeholder: "请选择",
allowClear: true,
onChange: this.onChange,
loadData: this.onLoadData,
onSelect: this.onSelect
}
return (
<div>
<TreeSelect
{ ...TreeSelectParams }>
{treeNodes}
</TreeSelect>
</div>
);
}
};
function mapStateToProps(state) {
return {
orgList: state.addCase.orgList,
orgCollectionList: state.addCase.orgCollectionList,
orgName: state.addCase.orgName,
orgId: state.addCase.orgId
}
}
function mapDispathToprops(dispatch) {
return {
addCaseAction: bindActionCreators(addCaseAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispathToprops)(OrgTreeSelect);
\ No newline at end of file
/* 配合样式可以做出上传按钮和示例效果 */
.ant-upload-select-picture-card i {
font-size: 28px;
color: #999;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
font-size: 12px;
color: #666;
}
.upload-example {
position: relative;
display: inline-block;
height: 96px;
width: 96px;
padding: 8px;
border: 1px solid #d9d9d9;
border-radius: 6px;
vertical-align: top;
}
.upload-example img {
height: 78px;
width: 78px;
}
.upload-example:before {
position: absolute;
bottom: 8px;
left: 8px;
content: ' ';
width: 78px;
height: 24px;
background-color: #808080;
// background-color: #fff;
opacity: .8;
}
.upload-example span {
position: absolute;
bottom: 8px;
left: 8px;
width: 78px;
height: 24px;
color: #fff;
line-height: 24px;
text-align: center;
}
// // 时间控件有问题修改下
// .ant-time-picker-panel {
// max-width: 169px;
// }
// .ant-advanced-search-form {
// padding: 16px 8px;
// // background: #f8f8f8;
// // border: 1px solid #d9d9d9;
// border-radius: 6px;
// }
// .ant-advanced-search-form > .row {
// position: relative;
// left: -6px;
// }
// .ant-advanced-search-form .ant-btn + .ant-btn {
// margin-left: 8px;
// }
// // 表格样式
// .table-group table td,
// .table-group table th {
// font-size: 13px !important;
// }
\ No newline at end of file
......@@ -9,13 +9,10 @@ import Sidebar from '../../components/Sidebar';
import Footer from '../../components/Footer';
// import { fetchProfile, logout } from '../../store/modules/user/user_action';
import 'antd/dist/antd.less';
// import './index.less';
import styles from './index.less';
// console.log('styles', styles['ant-layout-aside']);
class App extends React.Component {
constructor(props) {
super(props);
......@@ -44,21 +41,6 @@ class App extends React.Component {
render() {
const {user, actions} = this.props;
const { collapse } = this.props; // 判断侧边栏隐藏显示
// return (
// <div className={collapse ? "ant-layout-aside ant-layout-aside-collapse" : "ant-layout-aside"}>
// <Sidebar />
// <div className="ant-layout-main">
// <Header user={user} />
// <NavPath />
// <div className="ant-layout-container">
// <div className="ant-layout-content">
// {this.props.children}
// </div>
// </div>
// <Footer />
// </div>
// </div>
return (
<div className={collapse ? styles["ant-layout-aside"] + ' ' + styles["ant-layout-aside-collapse"] : styles["ant-layout-aside"]}>
......
......@@ -73,9 +73,9 @@
margin-bottom: 20px;
}
.ant-layout-aside .ant-layout-sider {
margin: 16px 0;
}
// .ant-layout-aside .ant-layout-sider {
// margin: 16px 0;
// }
.ant-layout-aside .ant-layout-sider .nav-badge,
.ant-layout-aside .ant-layout-sider .nav-text {
vertical-align: baseline;
......
import React, { PropTypes } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import { Tree, TreeSelect } from 'antd';
import reqwest from 'reqwest'
import AG_CONF from '../../constants/AgCode'
import * as caseDetailAction from '../../store/modules/caseDetail/case_detail_action';
import './index.less'
const TreeNode = TreeSelect.TreeNode;
class OrgTreeSelect extends React.Component {
constructor(props) {
super(props)
this.onChange = this.onChange.bind(this);
this.onLoadData = this.onLoadData.bind(this);
this.onSelect = this.onSelect.bind(this);
}
/**
* 初始化树节点信息
*
*/
componentDidMount() {
this.props.caseDetailAction.getRootOrgs();
}
/**
* 加载树节点数据
*
* 1、判断该节点有子节点则不做加载
* 2、通过选中节点的ID加载子节点,加载成功后更新节点信息
*
* @param {any} treeNode
* @returns
*/
onLoadData(treeNode) {
const self = this;
if (treeNode.props.children) {
return new Promise(resolver => { resolver() })
}
return reqwest({
url: AG_CONF.agUrl + 'orgs',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID },
{ name: 'pid', value: treeNode.props.eventKey }
]
}).then(function(data) {
self.props.caseDetailAction.getOrgsById(treeNode.props.eventKey, data);
})
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*
* 1、获取节点信息,更新选中节点,加载对应的列表数据
*/
onSelect(value, node, extra) {
const id = node.props.eventKey
this.props.caseDetailAction.updOrgValue(value, id)
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*
* 判断节点的值,没有值时清除节点信息
*/
onChange(value, arr, obj) {
if (!value) {
this.props.caseDetailAction.updOrgValue('', '')
}
}
render() {
let { orgName, caseInfo } = this.props;
const caseGroupList = caseInfo.caseGroupList;
if (!orgName) {
orgName = caseGroupList.length > 0 ? caseGroupList[0].groupName : '';
}
// 遍历节点数据,生成节点DOM
const loop = data => data && data.map((item) => {
if (item.children) {
return <TreeNode value={item.name} title={item.name} key={item.key}>{loop(item.children) }</TreeNode>;
}
return <TreeNode value={item.name} title={item.name} key={item.key} isLeaf={item.isLeaf} />;
});
// 获取节点DOM
const treeNodes = loop(this.props.orgList);
// 树节点配置
const TreeSelectParams = {
style: { width: 300 },
value: orgName,
dropdownStyle: { maxHeight: 400, overflow: 'auto' },
placeholder: "请选择",
allowClear: true,
onChange: this.onChange,
loadData: this.onLoadData,
onSelect: this.onSelect
}
return (
<div>
<TreeSelect
{ ...TreeSelectParams }>
{treeNodes}
</TreeSelect>
</div>
);
}
};
function mapStateToProps(state) {
return {
orgList: state.caseDetail.orgList,
orgName: state.caseDetail.orgName,
orgId: state.caseDetail.orgId
}
}
function mapDispathToprops(dispatch) {
return {
caseDetailAction: bindActionCreators(caseDetailAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispathToprops)(OrgTreeSelect);
\ No newline at end of file
import React, { PropTypes } from 'react';
import { Input, Button, Row, Col, Table, Icon } from 'antd';
import { Link } from 'react-router';
import { relatedCaseTableHead } from '../../util/templateUtil';
const addRelatedCase = React.createClass({
propTypes: {
placeholder: React.PropTypes.string,
butText: React.PropTypes.string,
butType: React.PropTypes.string,
onClick: React.PropTypes.func,
delRelatedCase: React.PropTypes.func,
relationList: React.PropTypes.array
},
getDefaultProps: function() {
return {
placeholder: '请输入',
butText: '确认',
butType: 'primary',
relationList: []
}
},
getInitialState: function() {
return { workNumberValue: '' };
},
handleChange: function(e) {
this.setState({ workNumberValue: e.target.value });
},
handleSubmit(event, callback) {
const workNumberValue = this.state.workNumberValue;
if (typeof (callback) == 'function') {
callback(event, workNumberValue);
}
},
render() {
const { placeholder, onClick, butText, butType, value, relationList, delRelatedCase } = this.props;
const { workNumberValue } = this.state;
const inpitParams = {
ref: 'workNumber',
value: value || workNumberValue,
onChange: this.handleChange,
placeholder: placeholder
};
const buttonParams = {
type: butType,
onClick: (event) => {
event.preventDefault();
this.handleSubmit(event, onClick);
}
};
const columns = relatedCaseTableHead({
delRelatedCase: delRelatedCase
});
const loading = false;
// 表格参数
const tableParams = {
columns: columns,
className: "table",
dataSource: relationList,
pagination: false,
size: "middle",
loading: loading
}
return (
<div>
<Row gutter="16" style={{ marginBottom: '16px' }}>
<Col span="8">
<Input
{...inpitParams}
/>
</Col>
<Col span="4">
<Button
{...buttonParams}
>
{butText}
</Button>
</Col>
</Row>
<div className='table-group'>
<Table {...tableParams} />
</div>
</div>
);
}
})
export default addRelatedCase;
/**
* 用于扩展添加关联case
*/
// showModal() {
// this.setState({
// visible: true,
// });
// }
// handleOk() {
// this.setState({
// visible: false,
// });
// }
// handleCancel() {
// this.setState({
// visible: false,
// });
// }
// <Modal title="Modal" visible={caseInfo.visible}
// width={900}
// style={{ top: 20 }}
// footer=""
// onOk={this.handleOk} onCancel={this.handleCancel}
// okText="OK" cancelText="Cancel"
// >
// <AddCase/>
// </Modal>
\ No newline at end of file
import React, { PropTypes } from 'react';
import { Input, Button, Icon, Form, message } from 'antd';
import touxiang from './touxiang.png';
const FormItem = Form.Item;
let Comment = React.createClass({
propTypes: {
commentList: React.PropTypes.array,
subComment: React.PropTypes.func
},
getDefaultProps: function() {
return {
commentList: [],
};
},
getInitialState: function() {
return {
comment: ''
};
},
handleChange: function(e) {
this.setState({
comment: e.target.value
});
},
subComment(event, callback) {
const { comment } = this.state;
if (!comment) {
message.error('请输入评论内容');
return;
}
// 执行回调
callback(comment)
this.setState({comment: ''})
},
render() {
const { commentList, subComment } = this.props;
const { comment } = this.state;
const getFieldProps = this.props.form.getFieldProps;
const commentElem = commentList.length > 0 ?
commentList.map((item) => {
return (
<div style={{ border: '1px solid #e9e9e9', marginBottom: '8px' }}>
<div style={{ float: 'left', padding: '10px' }}>
<img src={touxiang} style={{ width: '108' }} />
</div>
<div style={{ padding: '10px 140px 10px 140px' }}>
<div style={{ marginBottom: '8px' }}>
<span>{item.createUser}</span>
<span style={{ float: 'right' }}>{item.createTime}</span>
</div>
<div>{item.comment}</div>
<div style={{ marginTop: '58px' }}>
<a style={{ marginRight: '20px' }}><Icon type="like" /> {item.likes}</a>
<a><Icon type="dislike" /> {item.booings}</a>
<Button style={{ float: 'right' }} size="small">打赏</Button>
</div>
</div>
</div>
)
}) : "暂无数据";
return (
<Form horizontal form={this.props.form}>
<h3 style={{ marginBottom: '4' }} >评论:</h3>
<FormItem hasFeedback >
<Input
value={comment}
onChange={this.handleChange}
type="textarea"
style={{ height: 150 }}
placeholder="请输入评论内容"
/>
</FormItem>
<Button
style={{ marginBottom: '10px' }}
type="primary"
onClick={(event) => { this.subComment(event, subComment) } }>
发表评论
</Button>
{commentElem}
</Form>
);
}
})
Comment = Form.create()(Comment);
export default Comment;
\ No newline at end of file
.home-row {
margin-bottom: 20px;
}
.home-title-x {
text-align: center;
line-height: 30px;
}
// .ant-tabs-nav .ant-tabs-tab {
// height: 20px;
// }
#components-tabs-demo-card-top .code-box-demo {
background: #ECECEC;
overflow: hidden;
padding: 24px;
}
.card-container > .ant-tabs-card > .ant-tabs-content {
background: #fff;
padding: 16px;
// height: 120px;
margin-top: -16px;
}
// .card-container > .ant-tabs-card > .ant-tabs-bar .ant-tabs-bar,
// .card-container > .ant-tabs-card > .ant-tabs-bar .ant-tabs-tab-active {
// border-color: #fff;
// }
.upload-list-inline .ant-upload-list-item {
display: inline-block;
width: 200px;
margin-right: 8px;
}
.detail-top-list {
margin-bottom: 25px;
border-bottom: 1px dotted #ccc;
}
.detail-top-list .ant-row {
border-top: 1px dotted #ccc;
}
.detail-top-list .detail-title {
text-align: right;
padding: 10px;
line-height: 1.5;
}
.detail-top-list .detail-content {
padding: 10px;
line-height: 1.5;
min-height: 40px;
}
.white-space {
white-space: pre-line;
}
\ No newline at end of file
import React from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Input, Button, Row, Col, Radio, Form, DatePicker, Select, QueueAnim, Icon } from 'antd';
import classNames from 'classnames';
import TreeSelect from './TreeSelect';
import * as caseGroupAction from '../../store/modules/caseGroup/case_group_action'
import './index.less'
import * as Util from '../../util';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const RadioButton = Radio.Button;
const InputGroup = Input.Group;
class SearchInput extends React.Component{
constructor (props) {
super(props)
this.onSearch = this.onSearch.bind(this);
this.onShowSearch = this.onShowSearch.bind(this);
this.clearSearch = this.clearSearch.bind(this);
this.sourceTypeChange = this.sourceTypeChange.bind(this);
this.searchTypeChange = this.searchTypeChange.bind(this);
this.startTimeChange = this.startTimeChange.bind(this);
this.endTimeChange = this.endTimeChange.bind(this);
this.isTimeoutChange = this.isTimeoutChange.bind(this);
}
/**
* 修改 caseNo
*
* @param {any} e
*/
caseNoInputChange(e) {
this.props.caseGroupAction.updGroupStateValue({caseNo: e.target.value});
}
/**
* 修改 keyword
*
* @param {any} e
*/
keywordInputChange(e) {
this.props.caseGroupAction.updGroupStateValue({keyword_value: e.target.value});
}
/**
* 修改 人员姓名
*
* @param {any} e
*/
sourceUserChange(e) {
this.props.caseGroupAction.updGroupStateValue({sourceUser: e.target.value});
}
/**
* 修改 人员类型
*
* @param {any} value
*/
sourceTypeChange(value) {
this.props.caseGroupAction.updGroupStateValue({sourceType: value});
}
/**
* 修改 时区类型
*
* @param {any} value
*/
searchTypeChange(value) {
this.props.caseGroupAction.updGroupStateValue({searchType: value});
}
/**
* 修改 开始时间
*
* @param {any} value
*/
startTimeChange(value) {
const startTime = Util.dateFormat(value, 'yyyy-MM-dd hh:mm:ss')
this.props.caseGroupAction.updGroupStateValue({startTime: startTime});
}
/**
* 修改 结束时间
*
* @param {any} value
*/
endTimeChange(value) {
const endTime = Util.dateFormat(value, 'yyyy-MM-dd hh:mm:ss')
this.props.caseGroupAction.updGroupStateValue({endTime: endTime});
}
/**
* 修改任务进度
*
* @param {any} e
*/
isTimeoutChange(e) {
console.log('value', e.target.value);
this.props.caseGroupAction.updGroupStateValue({isTimeout: e.target.value});
}
/**
* 根据 `值` 搜索匹配的 `case` 列表
*
* desc:
* 获取所有搜索条件,进行 `case` 搜索,关键字需要编码后发送,不然服务端无法读取
*
*/
onSearch(e) {
e.preventDefault();
let reqParams = this.props.reqParams;
reqParams.pageId = 1;
reqParams.recPerPage = this.props.pager.recPerPage;
this.props.caseGroupAction.getCaseGroupList(reqParams);
}
/**
* 清除查询信息
*
* @param {any} e
*/
clearSearch(e) {
e.preventDefault();
this.props.caseGroupAction.clearCaseGroupSearch(this.props.reqParams);
}
/**
* 显示高级搜索
*/
onShowSearch() {
this.props.caseGroupAction.updGroupShowSearch(this.props.showSearch);
}
render() {
const { caseNo, keyword_value, sourceUser, showSearch } = this.props;
// 高级搜索样式
const searchClass = classNames({
'ant-form ant-form-horizontal': true,
'ant-advanced-search-form': showSearch,
});
// 人员类型 DOM
const selectBefore = (
<Select value={this.props.sourceType} onChange={this.sourceTypeChange} style={{ width: 80 }}>
<Option value="">请选择</Option>
<Option value="createUser">发布人</Option>
<Option value="executorUser">执行人</Option>
<Option value="focusUser">关注人</Option>
</Select>
);
return (
<div className="gutter-example" style={{ marginBottom: '16', position: 'relative'}}>
<div className="">
<Row gutter={16}>
<Col span="4">
<Input
size="default"
value={caseNo}
onChange={this.caseNoInputChange.bind(this)}
onPressEnter={this.onSearch}
placeholder="按工单号搜索" />
</Col>
<Col span="6">
<Input
size="default"
value={keyword_value}
onChange={this.keywordInputChange.bind(this)}
onPressEnter={this.onSearch}
placeholder="按关键字搜索" />
</Col>
<Col span="6">
<TreeSelect/>
</Col>
{!showSearch ? [
<Col span="6">
<Button type="primary" onClick={this.onSearch} style={{marginRight: '10px'}}>搜索</Button>
<Button onClick={this.clearSearch}>清除条件</Button>
</Col>
]: null}
</Row>
<QueueAnim style={{marginTop: '20px;'}} component={Form} className={searchClass} type="left" leaveReverse>
{showSearch ? [
<Row key="item1">
<Col span={24}>
<FormItem
label="人员类型"
labelCol={{ span: 3 }}
wrapperCol={{ span: 13 }}
>
<Input
value={sourceUser}
style={{width: '420px'}}
onChange={this.sourceUserChange.bind(this)}
onPressEnter={this.onSearch}
addonBefore={selectBefore}
placeholder="请输入人员姓名"
/>
</FormItem>
</Col>
<Col span={24}>
<FormItem
label="时间区间"
labelCol={{ span: 3 }}
wrapperCol={{ span: 16 }}
>
<Select value={this.props.searchType} onChange={this.searchTypeChange} style={{ width: '110px', marginRight: '20px'}}>
<Option value="">请选择时区</Option>
<Option value="createTime">创建时间</Option>
<Option value="finishTime">完成时间</Option>
<Option value="confirmFinishTime">确认完成时间</Option>
<Option value="closeTime">关闭时间</Option>
</Select>
<DatePicker onChange={this.startTimeChange} value={this.props.startTime} format="yyyy-MM-dd HH:mm:ss" showTime placeholder="开始时间" />
<span> - </span>
<DatePicker onChange={this.endTimeChange} value={this.props.endTime} format="yyyy-MM-dd HH:mm:ss" showTime placeholder="结束时间" />
</FormItem>
</Col>
</Row>,
<Row key="submit">
<Col span={12} offset={12} style={{ textAlign: 'right' }}>
<Button type="primary" onClick={this.onSearch}>搜索</Button>
<Button onClick={this.clearSearch}>清除条件</Button>
</Col>
</Row>,
] : null}
</QueueAnim>
</div>
<div style={{position: 'absolute', top: 0, right: 0}}>
<div style={{float: 'left', marginRight: '20px', lineHeight: '28px'}}>
<a onClick={this.onShowSearch} className="ant-dropdown-link">{!showSearch ? <span>高级搜索<Icon type="down" /></span> : <span>简单搜索<Icon type="up" /></span>}</a>
</div>
</div>
</div>
);
}
};
function mapStateToProps(state) {
return {
keyword_value : state.caseGroup.keyword_value,
caseNo : state.caseGroup.caseNo,
sourceType : state.caseGroup.sourceType,
sourceUser : state.caseGroup.sourceUser,
showSearch : state.caseGroup.showSearch,
searchType : state.caseGroup.searchType,
startTime : state.caseGroup.startTime,
endTime : state.caseGroup.endTime,
isTimeout : state.caseGroup.isTimeout,
reqParams : Util.caseGroupParamsFromat(state),
pager : state.caseGroup.pager
}
}
function mapDispatchToProps(dispatch) {
return {
caseGroupAction: bindActionCreators(caseGroupAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SearchInput);
import React, { PropTypes } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import { Tree, TreeSelect } from 'antd';
import reqwest from 'reqwest';
import AG_CONF from '../../constants/AgCode';
import { getRootOrgs, getOrgsById, updOrgValue } from '../../store/modules/caseGroup/case_group_action';
import './index.less';
import * as Util from '../../util';
const TreeNode = TreeSelect.TreeNode;
class OrgTreeSelect extends React.Component {
constructor(props) {
super(props)
this.onChange = this.onChange.bind(this);
this.onLoadData = this.onLoadData.bind(this);
this.onSelect = this.onSelect.bind(this);
}
/**
* 初始化组织上树数据
*/
componentDidMount() {
this.props.getRootOrgs(this.props.reqParams);
}
/**
* 更具Id加载子节点
*
* 1、有子节点时不加载
* 2、没子节点时加载子节点
*
* @param {any} treeNode
* @returns
*/
onLoadData(treeNode) {
const self = this;
if (treeNode.props.children) {
return new Promise(resolver => { resolver() })
}
return reqwest({
url: AG_CONF.agUrl + 'orgs',
method: 'get',
type: 'json',
data: [
{ name: 'sign', value: AG_CONF.sign },
{ name: 'ts', value: AG_CONF.ts },
{ name: 'appID', value: AG_CONF.appID },
{ name: 'pid', value: treeNode.props.eventKey }
]
}).then(function(data) {
self.props.getOrgsById(treeNode.props.eventKey, data);
})
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*/
onSelect(value, node, extra) {
const query_param = this.props.reqParams
query_param.groupId = node.props.eventKey;
query_param.isShowAll = node.props.isLeaf ? 1 : 0;
query_param.pageId = this.props.pager.pageId;
query_param.recPerPage = this.props.pager.recPerPage;;
this.props.updOrgValue(value, query_param)
}
/**
* 选中树中的某个节点,根据选中节点的Id获取对应的case列表
*/
onChange(value, arr, obj) {
// this.props.updOrgValue(obj)
}
render() {
const { orgValue, orgList } = this.props;
// 遍历节点数据,生成节点DOM
const loop = data => data && data.map((item) => {
if (item.children) {
return <TreeNode value={item.name} title={item.name} key={item.key}>{loop(item.children) }</TreeNode>;
}
return <TreeNode value={item.name} title={item.name} key={item.key} isLeaf={item.isLeaf} />;
});
// 获取节点DOM
const treeNodes = loop(orgList);
// 树节点配置
const TreeSelectParams = {
style: { width: '100%' },
value: orgValue,
dropdownStyle: { maxHeight: 400, overflow: 'auto' },
placeholder: "请选择",
allowClear: true,
onChange: this.onChange,
loadData: this.onLoadData,
onSelect: this.onSelect
}
return (
<div>
<TreeSelect
{ ...TreeSelectParams }>
{treeNodes}
</TreeSelect>
</div>
);
}
};
function mapStateToProps(state) {
return {
orgList: state.caseGroup.orgList,
orgValue: state.caseGroup.orgValue,
reqParams: Util.caseGroupParamsFromat(state),
status: state.menu.status,
pager: state.caseGroup.pager
}
}
function mapDispathToprops(dispatch) {
return {
getOrgsById: bindActionCreators(getOrgsById, dispatch),
getRootOrgs: bindActionCreators(getRootOrgs, dispatch),
updOrgValue: bindActionCreators(updOrgValue, dispatch)
}
}
export default connect(mapStateToProps, mapDispathToprops)(OrgTreeSelect);
\ No newline at end of file
import React, { PropTypes } from 'react'
import { bindActionCreators } from 'redux'
import { Link } from 'react-router'
import { connect } from 'react-redux'
import { Table, Pagination, Row, Col, Button } from 'antd';
import TreeSelect from './TreeSelect';
import TopSearch from './TopSearch';
import * as caseGroupAction from '../../store/modules/caseGroup/case_group_action'
import { getCaseManageMenu } from '../../store/modules/menu/menu_action'
import './index.less'
import * as Util from '../../util';
import { expandedRowRender, caseGroupTableHead } from '../../util/templateUtil';
class CaseGroup extends React.Component {
constructor(props) {
super(props)
this.handleTableChange = this.handleTableChange.bind(this);
this.paginationChange = this.paginationChange.bind(this);
}
/**
* 初始化table数据
*
* desc:
* 1、初始化《分组管理》列表数据
* 2、获取侧边菜单统计数据
* 3、初始化表格类型筛选列表
*
*/
componentDidMount() {
if (this.props.orgId) {
// 按上次操作状态查询
this.props.caseGroupAction.getCaseGroupList(this.props.reqParams)
}
// 获取侧边菜单
// TODO:在树初始化时做了操作,需要优化
// this.props.getCaseManageMenu();
// this.props.getCaseGroupMenu();
// 获取表格类型筛选列表
this.props.caseGroupAction.getCaseTypeList();
}
/**
* 根据分页Id查询相关页面
*
* desc:
* 获取 `state` 中存储的请求参数,在请求参数中加入分页信息,进行查询操作
*
* 优化:
* 1、目前请求参数的格式是普通js对象, 对 `immutable` 掌握不熟,还无法完成处理操作
* 2、参数 `reqParams` 整块获取的形式总感觉不太好,如果独立出来一个一个获取代码又太难看,需要学习下这种情况如何处理
* 3、尝试着 `immutable` 的 `Map` 包装 `reqParams` 获取与赋值操作正常执行,但是将整个对象当做请求参数的时候出现问题,将整个 `Map` 对象单做参数了,太可怕了!!!
*
*/
paginationChange(pageId) {
const reqParams = this.props.reqParams;
reqParams.pageId = pageId;
this.props.caseGroupAction.getCaseGroupList(reqParams)
}
/**
* 表格扩展搜索
*
* desc:
* 根据当前赛选条件,组合成服务端需要的请求参数,获取相应数据
*
* 优化:
* 1、每增加一个列,就需要在方法中加入一个判断,较为麻烦,考虑是否可以更加智能。
*
*/
handleTableChange(pagination, filters, sorter) {
const reqParams = this.props.reqParams;
// 拼接排序字符
reqParams.isDesc = sorter.order == "ascend" ? 'Asc' : 'Desc';
reqParams.sortType = sorter.field + reqParams.isDesc;
// 拼接类型搜索条件
reqParams.taskType = filters.caseTypeName ? filters.caseTypeName.join(',') : '';
reqParams.priority = filters.priority ? filters.priority.join(',') : '';
// 搜索列表
this.props.caseGroupAction.getCaseGroupList(reqParams);
}
render() {
const { loading, caseGroupList, pager, typeList } = this.props;
const columns = caseGroupTableHead({
typeList: typeList
});
// 表格参数
const tableParams = {
columns: columns,
className: "table",
dataSource: caseGroupList,
pagination: false,
scroll: { x: 1600 },
expandedRowRender: expandedRowRender, // 点击扩展详情 DOM
size: "middle",
loading: loading,
onChange: this.handleTableChange
}
// 分页参数
const pagerParams = {
style: { marginTop: 16 },
showQuickJumper: true,
total: pager.total,
showTotal: total => { return `共 ${total} 条` },
current: pager.pageId,
onChange: this.paginationChange,
pageSize: pager.recPerPage
}
return (
<div>
<TopSearch/>
<div className='table-group'>
<Table
{ ...tableParams } />
</div>
<Pagination
{ ...pagerParams } />
</div>
);
}
};
function mapStateToProps(state) {
return {
caseGroupList: state.caseGroup.caseGroupList,
typeList: state.caseGroup.typeList,
loading: state.caseGroup.loading,
reqParams: Util.caseGroupParamsFromat(state),
orgId: state.caseGroup.orgId,
pager: state.caseGroup.pager,
status: state.menu.status
}
}
function mapDispatchToProps(dispatch) {
return {
caseGroupAction: bindActionCreators(caseGroupAction, dispatch),
getCaseManageMenu: bindActionCreators(getCaseManageMenu, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(CaseGroup);
.home-row {
margin-bottom: 20px;
}
.home-title-x {
text-align: center;
line-height: 30px;
}
import React from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Input, Button, Row, Col, Radio, Form, DatePicker, Select, QueueAnim, Icon } from 'antd';
import classNames from 'classnames';
import ExportExcel from '../../components/ExportExcel';
import * as caseRankAction from '../../store/modules/caseRank/case_rank_action'
import './index.less'
import * as Util from '../../util';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const RadioButton = Radio.Button;
const InputGroup = Input.Group;
let timeout;
class SearchInput extends React.Component{
constructor (props) {
super(props)
this.onSearch = this.onSearch.bind(this);
this.onShowSearch = this.onShowSearch.bind(this);
this.clearSearch = this.clearSearch.bind(this);
this.sourceTypeChange = this.sourceTypeChange.bind(this);
this.startTimeChange = this.startTimeChange.bind(this);
this.endTimeChange = this.endTimeChange.bind(this);
this.isTimeoutChange = this.isTimeoutChange.bind(this);
this.executorhange = this.executorhange.bind(this);
this.executorselect = this.executorselect.bind(this);
this.handleChange = this.handleChange.bind(this);
}
caseNoInputChange(e) {
this.props.caseRankAction.updRankStateValue({caseNo: e.target.value});
}
keywordInputChange(e) {
this.props.caseRankAction.updRankStateValue({keyword_value: e.target.value});
}
sourceUserChange(e) {
this.props.caseRankAction.updRankStateValue({sourceUser: e.target.value});
}
sourceTypeChange(value) {
this.props.caseRankAction.updRankStateValue({sourceType: value});
}
startTimeChange(value) {
const startTime = Util.dateFormat(value, 'yyyy-MM-dd')
this.props.caseRankAction.updRankStateValue({startTime: startTime});
}
endTimeChange(value) {
const endTime = Util.dateFormat(value, 'yyyy-MM-dd')
this.props.caseRankAction.updRankStateValue({endTime: endTime});
}
isTimeoutChange(e) {
console.log('value', e.target.value);
this.props.caseRankAction.updRankStateValue({isTimeout: e.target.value});
}
executorhange(inputValue) {
console.log('arguments', arguments)
const self = this;
if (inputValue.length >= 1) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout((function(){self.props.caseRankAction.getExecutorKeywordList(inputValue)}), 300);
}
}
onSearch(e) {
/**
* 根据 `值` 搜索匹配的 `case` 列表
*
* desc:
* 获取所有搜索条件,进行 `case` 搜索,关键字需要编码后发送,不然服务端无法读取
*
*/
e.preventDefault();
let reqParams = this.props.reqParams;
reqParams.pageId = 1;
reqParams.recPerPage = this.props.pager.recPerPage;
//reqParams.sourceUser = this.props.reqParams.sourceUser.key;
this.props.caseRankAction.getCaseRankList(reqParams);
}
handleChange(value) {
console.log(value);
if(!value){
this.props.caseRankAction.updRankStateValue({sourceUser: {}});
}
}
clearSearch(e) {
e.preventDefault();
this.props.caseRankAction.clearCaseRankSearch(this.props.reqParams);
}
onShowSearch() {
this.props.caseRankAction.updRankShowSearch(this.props.showSearch);
}
executorselect(value, option) {
this.props.caseRankAction.updRankStateValue({sourceUser: {key: value.key, label:value.label}});
}
render() {
const { caseNo, keyword_value, sourceUser, showSearch, execList } = this.props;
const executorOptionList = execList && execList.map( (account, index) => {
return <Option key={account.uuid}>{account.realname + '-' + account.familyName}</Option>
})
const btnCls = classNames({
'ant-search-btn': true,
'ant-search-btn-noempty': keyword_value && !!keyword_value.trim(),
});
const searchClass = classNames({
'ant-form ant-form-horizontal': true,
'ant-advanced-search-form': showSearch,
});
console.log(this.props);
return (
<div className="gutter-example" style={{ marginBottom: '16', position: 'relative'}}>
<div className="">
<Row gutter={16}>
<Col span="5">
<FormItem
label="排名类型"
labelCol={{ span: 6 }}
wrapperCol={{ span: 14 }}
>
<Select value={this.props.sourceType} onChange={this.sourceTypeChange} style={{ width: '100%'}}>
<Option value="remain">剩余任务排名</Option>
<Option value="create">发起任务排名</Option>
<Option value="finish">完成任务排名</Option>
<Option value="confirmfinish">确认完成任务排名</Option>
<Option value="close">关闭任务排名</Option>
</Select>
</FormItem>
</Col>
<Col span="5">
<FormItem
label="搜索员工"
labelCol={{ span: 6 }}
wrapperCol={{ span: 14 }}
>
<Select
showSearch
allowClear
value={this.props.sourceUser}
labelInValue
optionFilterProp="children"
onSearch={this.executorhange}
onChange={this.handleChange}
onSelect={this.executorselect}
notFoundContent="无法找到"
filterOption={(inputValue, option) => {return option;}}
placeholder="请输入员工姓名"
style={{ width: '100%' }}
>
{executorOptionList}
</Select>
</FormItem>
</Col>
<Col span="10">
<FormItem
label="时间区间"
labelCol={{ span: 3 }}
wrapperCol={{ span: 18 }}
>
<DatePicker onChange={this.startTimeChange} value={this.props.startTime} format="yyyy-MM-dd" placeholder="开始时间" />
<span> - </span>
<DatePicker onChange={this.endTimeChange} value={this.props.endTime} format="yyyy-MM-dd" placeholder="结束时间" />
</FormItem>
</Col>
<Col span="4">
<Button type="primary" onClick={this.onSearch} style={{marginRight: '5px'}}>搜索</Button>
<Button onClick={this.clearSearch}>清除条件</Button>
</Col>
</Row>
</div>
</div>
);
}
};
function mapStateToProps(state) {
return {
sourceUser : state.caseRank.sourceUser,
execList : state.caseRank.execList,
sourceType : state.caseRank.sourceType,
startTime : state.caseRank.startTime,
endTime : state.caseRank.endTime,
isDesc : state.caseRank.isDesc,
reqParams : Util.caseRankParamsFromat(state),
pager : state.caseRank.pager,
}
}
function mapDispatchToProps(dispatch) {
return {
caseRankAction: bindActionCreators(caseRankAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SearchInput);
import React, { PropTypes } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Table, Pagination, Row, Col, Button } from 'antd';
// import CaseNoInput from './CaseNoInput';
// import KeywordInput from './KeywordInput';
import TopSearch from './TopSearch';
import ExportExcel from '../../components/ExportExcel';
import * as caseRankAction from '../../store/modules/caseRank/case_rank_action'
import { getAddCaseLeftMenu } from '../../store/modules/menu/menu_action';
import './index.less'
import * as Util from '../../util';
import { expandedRowRender, caseRankTableHead } from '../../util/templateUtil';
class CaseRank extends React.Component{
constructor (props) {
super(props)
}
componentDidMount () {
const self = this;
const newRootKey = this.props.routing.locationBeforeTransitions.key
const oldRootKey = this.props.rootKey
// if (newRootKey === oldRootKey) {
// 按上次操作状态查询
this.props.caseRankAction.getCaseRankList(this.props.reqParams)
// } else {
// // 初始化table数据
// this.props.caseRankAction.getCaseRank({
// status : this.props.status,
// pageId : 1,
// recPerPage : this.props.pager.recPerPage || 10
// })
// }
// 获取侧边菜单
setTimeout(function() {
console.log('延迟设置');
self.props.getAddCaseLeftMenu()
}, 1000);
// 修改 `rootKey` 的值
this.props.caseRankAction.updRankRootKey(newRootKey)
// 获取表格类型筛选列表
this.props.caseRankAction.getCaseTypeList();
}
// 分页搜索
paginationChange(pageId) {
/**
* 根据分页Id查询相关页面
*
* desc:
* 获取 `state` 中存储的请求参数,在请求参数中加入分页信息,进行查询操作
*
* 优化:
* 1、目前请求参数的格式是普通js对象, 对 `immutable` 掌握不熟,还无法完成处理操作
* 2、参数 `reqParams` 整块获取的形式总感觉不太好,如果独立出来一个一个获取代码又太难看,需要学习下这种情况如何处理
* 3、尝试着 `immutable` 的 `Map` 包装 `reqParams` 获取与赋值操作正常执行,但是将整个对象当做请求参数的时候出现问题,将整个 `Map` 对象单做参数了,太可怕了!!!
*
*/
let reqParams = this.props.reqParams;
reqParams.pageId = pageId;
this.props.caseRankAction.getCaseRankList(reqParams)
}
// 表格搜索
handleTableChange(pagination, filters, sorter) {
/**
* 表格扩展搜索
*
* desc:
* 根据当前赛选条件,组合成服务端需要的请求参数,获取相应数据
*
* 优化:
* 1、每增加一个列,就需要在方法中加入一个判断,较为麻烦,考虑是否可以更加智能。
*
*/
let reqParams = this.props.reqParams;
// 拼接排序字符
reqParams.isDesc = sorter.order == "ascend"? '1' : '0';
reqParams.sortType = sorter.field + reqParams.isDesc;
// 拼接类型搜索条件
let typeStr = '';
if (filters.caseTypeName && filters.caseTypeName.length > 0) {
filters.caseTypeName.map((type, index) => {
if (index == (filters.caseTypeName.length-1)) {
typeStr += type;
} else {
typeStr += type + ',';
}
})
}
reqParams.taskType = typeStr;
// 搜索列表
this.props.caseRankAction.getCaseRankList(reqParams);
}
render() {
const { loading, caseRankList, pager, typeList } = this.props;
const columns = caseRankTableHead({
typeList: typeList
});
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
return (
<div>
<TopSearch/>
<div className='table-group'>
<Table
columns={columns}
className="table"
dataSource={caseRankList}
pagination={false}
scroll={{ x: 800}}
size="middle"
loading={loading}
onChange={this.handleTableChange.bind(this)} />
</div>
<Pagination
style={{ marginTop: 16 }}
showQuickJumper
total={pager.total}
showTotal={total => `共 ${total} 条`}
current={pager.pageId}
onChange={this.paginationChange.bind(this)}
pageSize={pager.recPerPage}
total={pager.total} />
</div>
);
}
};
function mapStateToProps(state) {
return {
caseRankList : state.caseRank.caseRankList,
typeList : state.caseRank.typeList,
rootKey : state.caseRank.rootKey,
loading : state.caseRank.loading,
reqParams : Util.caseRankParamsFromat(state),
pager : state.caseRank.pager,
status : state.menu.status,
routing : state.routing
}
}
function mapDispatchToProps(dispatch) {
return {
caseRankAction: bindActionCreators(caseRankAction, dispatch),
getAddCaseLeftMenu: bindActionCreators(getAddCaseLeftMenu, dispatch) }
}
export default connect(mapStateToProps, mapDispatchToProps)(CaseRank);
.home-row {
margin-bottom: 20px;
}
.home-title-x {
text-align: center;
line-height: 30px;
}
import React from 'react'
import { Row, Col, Collapse, Alert } from 'antd';
const Panel = Collapse.Panel;
import PanelBox from '../../components/PanelBox';
import {Line,Pie,Doughnut} from 'react-chartjs';
import './index.less'
const chartOption = {
responsive: true
}
const lineData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
const pieData = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
];
const text = `
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal.
Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world.
`;
export default class Home extends React.Component {
constructor () {
super()
}
componentWillMount () {
}
callback() {
}
render () {
const detail = (
<Collapse defaultActiveKey={['1','2','3']} onChange={this.callback}>
<Panel header="This is panel header 1" key="1">
<p>{text}</p>
</Panel>
<Panel header="This is panel header 2" key="2">
<p>{text}</p>
</Panel>
<Panel header="This is panel header 3" key="3">
<p>{text}</p>
</Panel>
</Collapse>
)
return (
<div>
<Alert
message="消息提示的文案"
description="消息提示的辅助性文字介绍消息提示的辅助性文,字介绍消息提示的辅助性文字介绍"
type="info"
showIcon
/>
<PanelBox title="最近的数据">
<Line data={lineData} options={chartOption} />
</PanelBox>
<PanelBox title="最近的数据">
<Row className="home-row" type="flex" justify="space-between">
<Col span="12">
<Pie data={pieData} options={chartOption} />
<h3 className="home-title-x">测试数据1</h3>
</Col>
<Col span="12">
<Doughnut data={pieData} options={chartOption} />
<h3 className="home-title-x">测试数据2</h3>
</Col>
</Row>
</PanelBox>
<Row className="home-row" type="flex" justify="space-between">
<Col span="11">
{detail}
</Col>
<Col span="2">
{/**/}
</Col>
<Col span="11">
{detail}
</Col>
</Row>
</div>
)
}
}
.home-row {
margin-bottom: 20px;
}
.home-title-x {
text-align: center;
line-height: 30px;
}
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Input, Button, Row, Col, Radio, Form, DatePicker, Select, QueueAnim, Icon } from 'antd';
import classNames from 'classnames';
import ExportExcel from '../../components/ExportExcel';
import * as caseManageAction from '../../store/modules/caseManage/case_manage_action';
import './index.less';
import * as Util from '../../util';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const RadioButton = Radio.Button;
const InputGroup = Input.Group;
class SearchInput extends React.Component {
constructor(props) {
super(props)
this.onSearch = this.onSearch.bind(this);
this.onShowSearch = this.onShowSearch.bind(this);
this.clearSearch = this.clearSearch.bind(this);
this.sourceTypeChange = this.sourceTypeChange.bind(this);
this.searchTypeChange = this.searchTypeChange.bind(this);
this.startTimeChange = this.startTimeChange.bind(this);
this.endTimeChange = this.endTimeChange.bind(this);
this.isTimeoutChange = this.isTimeoutChange.bind(this);
}
/**
* 修改 caseNo
*
* @param {any} e
*/
caseNoInputChange(e) {
this.props.caseManageAction.updManageStateValue({ caseNo: e.target.value });
}
/**
* 修改 keyword
*
* @param {any} e
*/
keywordInputChange(e) {
this.props.caseManageAction.updManageStateValue({ keyword_value: e.target.value });
}
/**
* 修改 人员姓名
*
* @param {any} e
*/
sourceUserChange(e) {
this.props.caseManageAction.updManageStateValue({ sourceUser: e.target.value });
}
/**
* 修改 人员类型
*
* @param {any} value
*/
sourceTypeChange(value) {
this.props.caseManageAction.updManageStateValue({ sourceType: value });
}
/**
* 修改 时区类型
*
* @param {any} value
*/
searchTypeChange(value) {
this.props.caseManageAction.updManageStateValue({ searchType: value });
}
/**
* 修改 开始时间
*
* @param {any} value
*/
startTimeChange(value) {
const startTime = Util.dateFormat(value, 'yyyy-MM-dd hh:mm:ss')
this.props.caseManageAction.updManageStateValue({ startTime: startTime });
}
/**
* 修改 结束时间
*
* @param {any} value
*/
endTimeChange(value) {
const endTime = Util.dateFormat(value, 'yyyy-MM-dd hh:mm:ss')
this.props.caseManageAction.updManageStateValue({ endTime: endTime });
}
/**
* 修改任务进度
*
* @param {any} e
*/
isTimeoutChange(e) {
console.log('value', e.target.value);
this.props.caseManageAction.updManageStateValue({ isTimeout: e.target.value });
}
/**
* 根据 `值` 搜索匹配的 `case` 列表
*
* desc:
* 获取所有搜索条件,进行 `case` 搜索,关键字需要编码后发送,不然服务端无法读取
*
*/
onSearch(e) {
e.preventDefault();
let reqParams = this.props.reqParams;
reqParams.pageId = 1;
reqParams.recPerPage = this.props.pager.recPerPage;
this.props.caseManageAction.getCaseManageList(reqParams);
}
/**
* 清除查询信息
*
* @param {any} e
*/
clearSearch(e) {
e.preventDefault();
this.props.caseManageAction.clearCaseManageSearch(this.props.reqParams);
}
/**
* 显示高级搜索
*/
onShowSearch() {
this.props.caseManageAction.updManageShowSearch(this.props.showSearch);
}
render() {
const { caseNo, keyword_value, sourceUser, showSearch } = this.props;
// 高级搜索样式
const searchClass = classNames({
'ant-form ant-form-horizontal': true,
'ant-advanced-search-form': showSearch,
});
// 人员类型 DOM
const selectBefore = (
<Select value={this.props.sourceType} onChange={this.sourceTypeChange} style={{ width: 80 }}>
<Option value="">请选择</Option>
<Option value="createUser">发布人</Option>
<Option value="executorUser">执行人</Option>
<Option value="focusUser">关注人</Option>
</Select>
);
return (
<div className="gutter-example" style={{ marginBottom: '16', position: 'relative' }}>
<div className="">
<Row gutter={16}>
<Col span="4">
<Input
size="default"
value={caseNo}
onChange={this.caseNoInputChange.bind(this) }
onPressEnter={this.onSearch}
placeholder="按工单号搜索" />
</Col>
<Col span="6">
<Input
size="default"
value={keyword_value}
onChange={this.keywordInputChange.bind(this) }
onPressEnter={this.onSearch}
placeholder="按关键字搜索" />
</Col>
{!showSearch ? [
<Col span="12">
<Button type="primary" onClick={this.onSearch} style={{ marginRight: '10px' }}>搜索</Button>
<Button onClick={this.clearSearch}>清除条件</Button>
</Col>
] : null}
</Row>
<QueueAnim style={{ marginTop: '20px;' }} component={Form} className={searchClass} type="left" leaveReverse>
{showSearch ? [
<Row key="item1">
<Col span={24}>
<FormItem
label="任务进度"
labelCol={{ span: 3 }}
wrapperCol={{ span: 14 }}
>
<RadioGroup value={this.props.isTimeout} onChange={this.isTimeoutChange}>
<RadioButton value="">全部</RadioButton>
<RadioButton value="0">已超时</RadioButton>
<RadioButton value="1">未超时</RadioButton>
</RadioGroup>
</FormItem>
</Col>
<Col span={24}>
<FormItem
label="人员类型"
labelCol={{ span: 3 }}
wrapperCol={{ span: 13 }}
>
<Input
value={sourceUser}
style={{ width: '420px' }}
onChange={this.sourceUserChange.bind(this) }
onPressEnter={this.onSearch}
addonBefore={selectBefore}
placeholder="请输入人员姓名"
/>
</FormItem>
</Col>
<Col span={24}>
<FormItem
label="时间区间"
labelCol={{ span: 3 }}
wrapperCol={{ span: 16 }}
>
<Select value={this.props.searchType} onChange={this.searchTypeChange} style={{ width: '110px', marginRight: '20px' }}>
<Option value="">请选择时区</Option>
<Option value="createTime">创建时间</Option>
<Option value="finishTime">完成时间</Option>
<Option value="confirmFinishTime">确认完成时间</Option>
<Option value="closeTime">关闭时间</Option>
</Select>
<DatePicker onChange={this.startTimeChange} value={this.props.startTime} format="yyyy-MM-dd HH:mm:ss" showTime placeholder="开始时间" />
<span> - </span>
<DatePicker onChange={this.endTimeChange} value={this.props.endTime} format="yyyy-MM-dd HH:mm:ss" showTime placeholder="结束时间" />
</FormItem>
</Col>
</Row>,
<Row key="submit">
<Col span={12} offset={12} style={{ textAlign: 'right' }}>
<Button type="primary" onClick={this.onSearch}>搜索</Button>
<Button onClick={this.clearSearch}>清除条件</Button>
</Col>
</Row>,
] : null}
</QueueAnim>
</div>
<div style={{ position: 'absolute', top: 0, right: 0 }}>
<div style={{ float: 'left', marginRight: '20px', lineHeight: '28px' }}>
<a onClick={this.onShowSearch} className="ant-dropdown-link">{!showSearch ? <span>高级搜索<Icon type="down" /></span> : <span>简单搜索<Icon type="up" /></span>}</a>
</div>
<div style={{ float: 'left' }}>
<ExportExcel />
</div>
</div>
</div>
);
}
};
function mapStateToProps(state) {
return {
keyword_value: state.caseManage.keyword_value,
caseNo: state.caseManage.caseNo,
sourceType: state.caseManage.sourceType,
sourceUser: state.caseManage.sourceUser,
showSearch: state.caseManage.showSearch,
searchType: state.caseManage.searchType,
startTime: state.caseManage.startTime,
endTime: state.caseManage.endTime,
isTimeout: state.caseManage.isTimeout,
reqParams: Util.caseManageParamsFromat(state),
pager: state.caseManage.pager
}
}
function mapDispatchToProps(dispatch) {
return {
caseManageAction: bindActionCreators(caseManageAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SearchInput);
import React, { PropTypes } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Table, Pagination, Row, Col, Button } from 'antd';
// import CaseNoInput from './CaseNoInput';
// import KeywordInput from './KeywordInput';
import TopSearch from './TopSearch';
import ExportExcel from '../../components/ExportExcel';
import * as caseManageAction from '../../store/modules/caseManage/case_manage_action'
import { getCaseManageMenu } from '../../store/modules/menu/menu_action'
import './index.less'
import * as Util from '../../util';
import { expandedRowRender, caseManageTableHead } from '../../util/templateUtil';
class CaseManage extends React.Component {
constructor(props) {
super(props)
this.handleTableChange = this.handleTableChange.bind(this);
this.paginationChange = this.paginationChange.bind(this);
}
/**
* 初始化table数据
*
* desc:
* 1、初始化《case管理》列表数据
* 2、获取侧边菜单统计数据
* 3、初始化表格类型筛选列表
*
*/
componentDidMount() {
// 按上次操作状态查询
this.props.caseManageAction.getCaseManageList(this.props.reqParams)
// 获取侧边菜单
this.props.getCaseManageMenu();
// 获取表格类型筛选列表
this.props.caseManageAction.getCaseTypeList();
}
/**
* 根据分页Id查询相关页面
*
* desc:
* 获取 `state` 中存储的请求参数,在请求参数中加入分页信息,进行查询操作
*
* 优化:
* 1、目前请求参数的格式是普通js对象, 对 `immutable` 掌握不熟,还无法完成处理操作
* 2、参数 `reqParams` 整块获取的形式总感觉不太好,如果独立出来一个一个获取代码又太难看,需要学习下这种情况如何处理
* 3、尝试着 `immutable` 的 `Map` 包装 `reqParams` 获取与赋值操作正常执行,但是将整个对象当做请求参数的时候出现问题,将整个 `Map` 对象单做参数了,太可怕了!!!
*
*/
paginationChange(pageId) {
let reqParams = this.props.reqParams;
reqParams.pageId = pageId;
this.props.caseManageAction.getCaseManageList(reqParams)
}
/**
* 表格扩展搜索
*
* desc:
* 根据当前赛选条件,组合成服务端需要的请求参数,获取相应数据
*
* 优化:
* 1、每增加一个列,就需要在方法中加入一个判断,较为麻烦,考虑是否可以更加智能。
*
*/
handleTableChange(pagination, filters, sorter) {
let reqParams = this.props.reqParams;
// 拼接排序字符
reqParams.isDesc = sorter.order == "ascend" ? 'Asc' : 'Desc';
reqParams.sortType = sorter.field + reqParams.isDesc;
reqParams.taskType = filters.caseTypeName ? filters.caseTypeName.join(',') : '';
reqParams.priority = filters.priority ? filters.priority.join(',') : '';
// 搜索列表
this.props.caseManageAction.getCaseManageList(reqParams);
}
render() {
const { loading, caseManageList, pager, typeList } = this.props;
const columns = caseManageTableHead({
typeList: typeList
});
// 表格参数
const tableParams = {
columns: columns,
className: "table",
dataSource: caseManageList,
pagination: false,
scroll: { x: 1600 },
expandedRowRender: expandedRowRender, // 点击扩展详情 DOM
size: "middle",
loading: loading,
onChange: this.handleTableChange
}
// 分页参数
const pagerParams = {
style: { marginTop: 16 },
showQuickJumper: true,
total: pager.total,
showTotal: total => { return `共 ${total} 条` },
current: pager.pageId,
onChange: this.paginationChange,
pageSize: pager.recPerPage
}
return (
<div>
<TopSearch/>
<div className='table-group'>
<Table
{ ...tableParams } />
</div>
<Pagination
{ ...pagerParams } />
</div>
);
}
};
function mapStateToProps(state) {
return {
caseManageList: state.caseManage.caseManageList,
typeList: state.caseManage.typeList,
loading: state.caseManage.loading,
reqParams: Util.caseManageParamsFromat(state),
pager: state.caseManage.pager,
status: state.menu.status
}
}
function mapDispatchToProps(dispatch) {
return {
caseManageAction: bindActionCreators(caseManageAction, dispatch),
getCaseManageMenu: bindActionCreators(getCaseManageMenu, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(CaseManage);
.home-row {
margin-bottom: 20px;
}
.home-title-x {
text-align: center;
line-height: 30px;
}
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Modal, Button, Form, Input } from 'antd';
const FormItem = Form.Item;
let App = React.createClass({
getInitialState() {
return { visible: false };
},
/**
* 显示关闭操作框
*/
showModal() {
this.setState({
visible: true,
});
},
/**
* 执行确认关闭操作
*
* 1、用户没输入关闭信息时给出相应提示
* 2、用户输入关闭信息,执行外部传入的关闭方法,将关闭信息传入该方法中
* 3、隐藏关闭操作框
*
*/
handleOk() {
this.props.form.validateFields((errors, values) => {
if (!!errors) {
console.log('Errors in form!!!');
return;
}
// 执行外部传入的方法
this.props.confirmFinishCase && this.props.confirmFinishCase(values.delete_reason);
this.setState({
visible: false,
});
});
},
/**
* 点击取消的隐藏操作
*
* @param {any} e
*/
handleCancel(e) {
this.setState({
visible: false,
});
},
render() {
const { getFieldProps } = this.props.form;
const { visible } = this.state;
// 设置关闭input:必填、未填写时的提示
const textareaProps = getFieldProps('delete_reason', {
rules: [
{ required: true, message: '必须填写关闭原因!' },
],
});
// 摸态框属性
const modalParams = {
title: "您是否确认要删除这项任务?",
visible: visible,
onOk: this.handleOk,
onCancel: this.handleCancel
}
return (
<span>
<span className="ant-divider"></span>
<a onClick={this.showModal}>关闭</a>
<Modal { ...modalParams }>
<Form horizontal form={this.props.form}>
<FormItem label="请输入删除原因" required >
<Input type="textarea" rows={4} placeholder="请输入删除原因"
{...textareaProps}/>
</FormItem>
</Form>
</Modal>
</span>
);
},
});
App = Form.create()(App);
export default App;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment