commit 5acff56c29bd4101a1aa3e7b7ba085022f86232f Author: Chengliang <1546584672@qq.com> Date: Wed Mar 8 15:22:38 2023 +0800 初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..379f712 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +.idea +.vscode + diff --git a/pc4mobx/prj/apis/add.js b/pc4mobx/prj/apis/add.js new file mode 100644 index 0000000..4a98702 --- /dev/null +++ b/pc4mobx/prj/apis/add.js @@ -0,0 +1,11 @@ +import { WeaTools } from 'ecCom'; + +//新建项目-类型 +export const getAddProjectTypes = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjCreateTemplet', 'GET', params); +} + +//新建项目 保存 +export const doSaveNewProject = params => { + return WeaTools.callApi('/api/proj/pcproject/doPrjOperation', 'POST', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/apis/approval.js b/pc4mobx/prj/apis/approval.js new file mode 100644 index 0000000..87cea6a --- /dev/null +++ b/pc4mobx/prj/apis/approval.js @@ -0,0 +1,12 @@ +import {WeaTools} from 'ecCom' + +//列表 +export const getApprovalList = params => { + return WeaTools.callApi('/api/proj/pctask/taskapproval', 'GET', params); +} + +export const doTaskApprovalOpt = params => { + return WeaTools.callApi('/api/proj/pctask/doTaskApprovalOpt', 'GET', params); +} + + diff --git a/pc4mobx/prj/apis/index.js b/pc4mobx/prj/apis/index.js new file mode 100644 index 0000000..a0dc39d --- /dev/null +++ b/pc4mobx/prj/apis/index.js @@ -0,0 +1,11 @@ +import { WeaTools } from 'ecCom'; + +//右键菜单 +export const getRightMenus = params => { + return WeaTools.callApi('/api/proj/prjutil/getrightmenus', 'GET', params); +} + +//高级搜索 公用 +export const getTaskCondition = params => { + return WeaTools.callApi('/api/proj/pctask/taskcondition', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/apis/mindmap.js b/pc4mobx/prj/apis/mindmap.js new file mode 100644 index 0000000..c7d0672 --- /dev/null +++ b/pc4mobx/prj/apis/mindmap.js @@ -0,0 +1,6 @@ +import {WeaTools} from 'ecCom' + +//获取思维导图数据 +export const getPrjMindMap = params => { + return WeaTools.callApi('/api/proj/mindmap/getPrjMindData', 'GET', params); +} diff --git a/pc4mobx/prj/apis/minePrj.js b/pc4mobx/prj/apis/minePrj.js new file mode 100644 index 0000000..59fdd19 --- /dev/null +++ b/pc4mobx/prj/apis/minePrj.js @@ -0,0 +1,15 @@ +import {WeaTools} from 'ecCom' + +// 项目类型-树形 +export const getPrjTypeTreePageList = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjTypeTree', 'GET', params); +} +//列表 +export const getMyPrjList = params => { + return WeaTools.callApi('/api/proj/pcproject/getMyMangerPrjList', 'GET', params); +} +//我的项目 高级搜索 +export const getMyPrjCondition = params => { + return WeaTools.callApi('/api/proj/pcproject/prjcondition', 'GET', params); +} + diff --git a/pc4mobx/prj/apis/prjPortal.js b/pc4mobx/prj/apis/prjPortal.js new file mode 100644 index 0000000..78e6a5c --- /dev/null +++ b/pc4mobx/prj/apis/prjPortal.js @@ -0,0 +1,66 @@ +import {WeaTools} from 'ecCom' + +//项目数据 +export const getProjectDatas = params => { + return WeaTools.callApi('/api/proj/portal/getProjectDatas', 'POST', params); +} + +//项目分组表单 +export const getPrjGroupForm = params => { + return WeaTools.callApi('/api/proj/portal/getPrjGroupForm', 'POST', params); +} + +//项目分组操作 +export const doPrjGroupOperation = params => { + return WeaTools.callApi('/api/proj/portal/doPrjGroupOperation', 'POST', params); +} + +//获取项目动态信息 +export const getPortalProjectDynamicInfo = params => { + return WeaTools.callApi('/api/proj/portal/getPortalProjectDynamicInfo', 'POST', params); +} + +//项目日报操作 +export const doPortalProjectDailyOperation = params => { + return WeaTools.callApi('/api/proj/portal/doPortalProjectDailyOperation', 'POST', params); +} + +//获取项目日报数据 +export const getPortalProjectDailyDatas = params => { + return WeaTools.callApi('/api/proj/portal/getPortalProjectDailyDatas', 'POST', params); +} + +//获取项目门户项目卡片数据 +export const getPortalProjectInfo = params => { + return WeaTools.callApi('/api/proj/portal/getPortalProjectInfo', 'GET', params); +} + +//任务执行条件 +export const getTaskCondition = params => { + return WeaTools.callApi('/api/proj/pctask/taskcondition', 'GET', params); +} + +//任务执行列表 +export const getTaskExecuteList = params => { + return WeaTools.callApi('/api/proj/portal/getProtalTaskList', 'GET', params); +} + +//任务分组表单 +export const getTaskGroupForm = params => { + return WeaTools.callApi('/api/proj/portal/getTaskGroupForm', 'POST', params); +} + +//任务分组操作 +export const doTaskGroupOperation = params => { + return WeaTools.callApi('/api/proj/portal/doTaskGroupOperation', 'POST', params); +} + +//获取右键菜单 +export const getRightMenu = params => { + return WeaTools.callApi('/api/proj/portal/getRightMenu', 'POST', params); +} + +//获取项目搜索分组数据 +export const getPrjSearchDatas = params => { + return WeaTools.callApi('/api/proj/portal/getPrjSearchDatas', 'POST', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/apis/prjReportApi.js b/pc4mobx/prj/apis/prjReportApi.js new file mode 100644 index 0000000..2680c29 --- /dev/null +++ b/pc4mobx/prj/apis/prjReportApi.js @@ -0,0 +1,31 @@ +import {WeaTools} from 'ecCom'; + +//获取反馈数据 +export const getFeedBackData = params => { + return WeaTools.callApi('/api/proj/portal/getFeedBackData', 'POST', params); +} + +//反馈信息表单 +export const getFeedBackInfoForm = params => { + return WeaTools.callApi('/api/proj/portal/getFeedBackInfoForm', 'POST', params); +} + +//反馈信息相关操作 +export const doFeedBackOperation = params => { + return WeaTools.callApi('/api/proj/portal/doFeedBackOperation', 'POST', params); +} + +//反馈设置表单 +export const getFeedBackSettingForm = params => { + return WeaTools.callApi('/api/proj/portal/getFeedBackSettingForm', 'POST', params); +} + +//获取活动周期options +export const getCircleOptions = params => { + return WeaTools.callApi('/api/proj/portal/getCircleOptions', 'POST', params); +} + +//保存完成情况信息 +export const saveMxDatas = params => { + return WeaTools.callApi('/api/proj/portal/saveMxDatas', 'POST', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/apis/projecboard.js b/pc4mobx/prj/apis/projecboard.js new file mode 100644 index 0000000..9137cb0 --- /dev/null +++ b/pc4mobx/prj/apis/projecboard.js @@ -0,0 +1,61 @@ +import {WeaTools} from 'ecCom' + +// 项目类型-树形 +export const getPrjTypeTreePageList = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjTypeTree', 'GET', params); +} + +// 根据项目类型,查询项目,分页显示 +export const getPrjByTypeId = params => { + return WeaTools.callApi('/api/proj/prjboard/getListByTypeIdForBoard', 'GET', params); +} + +export const getPrjInfoForBoard = params => { + return WeaTools.callApi('/api/proj/prjboard/getProjectInfo', 'GET', params); +} + +//看板显示 +export const getKanbanView = params => { + return WeaTools.callApi('/api/proj/prjboard/getPrjBoardView', 'GET', params); +} +//看板新增阶段 +export const addBoardStage = params => { + return WeaTools.callApi('/api/proj/prjboard/addBoardStage', 'GET', params); +} +//编辑阶段 +export const editBoardStage = params => { + return WeaTools.callApi('/api/proj/prjboard/editBoardStage', 'GET', params); +} +//删除阶段 +export const delBoardStage = params => { + return WeaTools.callApi('/api/proj/prjboard/delBoardStage', 'GET', params); +} +//看板拖动 +export const doMovePrjBoard = params => { + return WeaTools.callApi('/api/proj/prjboard/doMovePrjBoard', 'GET', params); +} +//看板新增任务 +export const addBoardTask = params => { + return WeaTools.callApi('/api/proj/prjboard/addBoardTask', 'GET', params); +} +//查询任务卡片 +export const getTaskInfo = params => { + return WeaTools.callApi('/api/proj/prjboard/getTaskInfo', 'GET', params); +} +//查询项目Tab +export const getPrjTabs = params => { + return WeaTools.callApi('/api/proj/prjboard/getProjectTabs', 'GET', params); +} +//设置里程碑任务 +export const setLandMark = params => { + return WeaTools.callApi('/api/proj/prjboard/setLanMark', 'GET', params); +} +//保存任务排序 +export const saveItemOrder = params => { + return WeaTools.callApi('/api/proj/prjboard/saveItemOrder', 'GET', params); +} +//保存阶段排序 +export const saveGroupOrder = params => { + return WeaTools.callApi('/api/proj/prjboard/saveGroupOrder', 'GET', params); +} + \ No newline at end of file diff --git a/pc4mobx/prj/apis/project.js b/pc4mobx/prj/apis/project.js new file mode 100644 index 0000000..437a9a2 --- /dev/null +++ b/pc4mobx/prj/apis/project.js @@ -0,0 +1,203 @@ +import {WeaTools} from 'ecCom' + +// 项目类型-树形 +export const getPrjTypeTreePageList = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjTypeTree', 'GET', params); +} +//列表 +export const getPrjTypeList = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjExecuteList', 'GET', params); +} +//项目执行 高级搜索 +export const getPrjCondition = params => { + return WeaTools.callApi('/api/proj/pcproject/prjcondition', 'GET', params); +} + + +//查詢項目 - 列表 +export const getQueryPrjList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getPrjSearchList','GET', params); +} + +//批量共享 - 列表 +export const getBatchShareList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getBatchShareList','GET', params); +} + +//项目监控- 列表 +export const getPrjMonitorList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getPrjMonitorList','GET', params); +} + + +//项目卡片接口 + +//tab查询 +export const getPrjTabs = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getProjectTabs','GET', params); +} +//项目信息 +export const getPrjInfo = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getProjectInfo','GET', params); +} +//项目日志 +export const getPrjLogList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjLogList','GET', params); +} +//项目字段日志 +export const getPrjFieldLogList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjFieldLogList','POST', params); +} +//项目字段详情日志 +export const getPrjFieldDetaiLogList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjFieldDetailLogList','POST', params); +} + +//项目信息 =-- 编辑保存 +export const savePrjInfo = params =>{ + return WeaTools.callApi('/api/proj/pcproject/doPrjOperation','POST', params); +} + +//项目信息 =-- 删除 +export const delPrjInfo = params =>{ + return WeaTools.callApi('/api/proj/pcproject/doPrjOperation','POST', params); +} + + +//子项目 +export const getPrjSubList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getSubProjectList','GET', params); +} + +//相关交流 +export const getPrjDiscuss = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjdiscuss','GET', params); +} + +//相关交流(new) +export const getExchangeList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getExchangeList','GET', params); +} + +//相关交流保存 +export const exchangeSave = params =>{ + return WeaTools.callApi('/api/proj/prjutil/doDiscussOpt','POST', params); +} + +//相关交流删除 +export const exchangeDelete = params =>{ + return WeaTools.callApi('/api/proj/prjutil/exchangeDelete','GET', params); +} + +//共享设置 +export const getPrjShare = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjshare','GET', params); +} + +//共享设置添加 +export const addPrjShare = params => { + return WeaTools.callApi('/api/proj/prjutil/doProjectShareOpt', 'POST', params); +} + +//共享设置批量删除 +export const delBatchPjrShare = params => { + return WeaTools.callApi('/api/proj/prjutil/doProjectShareOpt', 'POST', params); +} + +//统计报告 +export const getPrjStastics = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjstastics','GET', params); +} + +//任务列表 +export const getPrjTaskList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/getPrjViewProcess','GET', params); +} +//任务列表 -- 版本 +export const getPrjTaskVersion = params =>{ + return WeaTools.callApi('/api/proj/pctask/gettaskversion','GET', params); +} +//任务列表 -- 相关流程-文档-写作-日志 列表 +export const getPrjDspList = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjDspList','GET', params); +} + +//任务列表 -- 通知项目成员 +export const getNoticeMember= params =>{ + return WeaTools.callApi('/api/proj/pcproject/noticeMember','GET', params); +} + +//任务列表 -- 历史版本对比 +export const getPrjHisCompare = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjHisCompare','GET', params); +} + + +//项目执行 +export const doPlanOpt = params =>{ + return WeaTools.callApi('/api/proj/pcproject/doPlanOpt','GET', params); +} + +//项目另存为模板 +export const doSaveTemplet = params =>{ + return WeaTools.callApi('/api/proj/pcproject/doSaveTemplet','GET', params); +} + +//项目初始化导入 +export const prjimptopt = params =>{ + return WeaTools.callApi('/api/proj/prjutil/prjimpopt','GET', params); +} + +//WBS导入配置字段 +export const getTaskWbsField = params =>{ + return WeaTools.callApi('/api/proj/prjutil/getTaskWbsField','POST', params); +} + +//WBS导入配置字段 +export const doTaskWbsFieldSave = params =>{ + return WeaTools.callApi('/api/proj/prjutil/doSaveTaskWbsField','POST', params); +} + +//项目任务模板(重新生成项目类型模板) +export const doPrjTemplateFile = params =>{ + return WeaTools.callApi('/api/proj/prjutil/doPrjTemplateFile','GET', params); +} +//项目导入 +export const doPrjimpopt = params =>{ + return WeaTools.callApi('/api/proj/prjutil/doprjimpopt','POST', params); +} + +//批量共享 +export const savePrjBatchShare = params =>{ + return WeaTools.callApi('/api/proj/pcproject/prjShareMultiOpt','POST', params); +} + +/*********** 报表 ********************** */ + +export const getPrjReport = params => { + return WeaTools.callApi('/api/proj/prjReport/getPrjReport', 'GET', params); +} + +export const getPrjReportCondition = params => { + return WeaTools.callApi('/api/proj/prjReport/getRepCondition', 'GET', params); +} + +//模板阶段设置 +export const getPrjTempletStageList = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjTempletStageList', 'GET', params); +} + +//模板阶段保存 +export const savePrjTempletStage = params => { + return WeaTools.callApi('/api/proj/pcproject/savePrjTempletStage', 'POST', params); +} + +//模板阶段保存 +export const getPrjResources = params => { + return WeaTools.callApi('/api/proj/pcproject/getPrjResources', 'GET', params); +} + +//获取资产模块应用分权是否开启和 禁用所有人是否开启并配置应用列表 +export const getDetachable = params => { + return WeaTools.callApi('/api/cpt/maint/getDetachable', 'GET', params); +} diff --git a/pc4mobx/prj/apis/projectprotal.js b/pc4mobx/prj/apis/projectprotal.js new file mode 100644 index 0000000..800b406 --- /dev/null +++ b/pc4mobx/prj/apis/projectprotal.js @@ -0,0 +1,10 @@ +import {WeaTools} from 'ecCom' + +// 根据项目类型,查询项目,分页显示 +export const getTaskPageList = params => { + return WeaTools.callApi('/api/proj/portal/getTaskPageList', 'GET', params); +} + +export const getTaskInfoNew = params => { + return WeaTools.callApi('/api/proj/portal/getTaskInfoNew', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/apis/queryTask.js b/pc4mobx/prj/apis/queryTask.js new file mode 100644 index 0000000..930d300 --- /dev/null +++ b/pc4mobx/prj/apis/queryTask.js @@ -0,0 +1,9 @@ +import {WeaTools} from 'ecCom' + +//列表 +export const getTaskSearchList = params => { + return WeaTools.callApi('/api/proj/pctask/tasksearch', 'GET', params); +} + + + diff --git a/pc4mobx/prj/apis/task.js b/pc4mobx/prj/apis/task.js new file mode 100644 index 0000000..c00c8b0 --- /dev/null +++ b/pc4mobx/prj/apis/task.js @@ -0,0 +1,129 @@ +import {WeaTools} from 'ecCom' + +//任务执行条件 +export const getTaskCondition = params => { + return WeaTools.callApi('/api/proj/pctask/taskcondition', 'GET', params); +} + +//任务执行列表 +export const getTaskExecuteList = params => { + return WeaTools.callApi('/api/proj/pctask/taskexecute', 'GET', params); +} + +//tab查询 +export const getTaskTabs = params =>{ + return WeaTools.callApi('/api/proj/pctask/getTaskTabs','GET', params); +} + +//任务卡片--任务信息 +export const getTaskForm = params => { + return WeaTools.callApi('/api/proj/pctask/gettaskform', 'GET', params); +} + +//任务卡片--编辑保存 +export const saveTaskInfo = params => { + return WeaTools.callApi('/api/proj/pctask/doTaskOperation', 'POST', params); +} + +//任务卡片--删除 +export const delTask = params => { + return WeaTools.callApi('/api/proj/pctask/doTaskOperation', 'POST', params); +} + +//任务卡片--子任务查询 +export const getTaskSubList = params => { + return WeaTools.callApi('/api/proj/pctask/tasksub', 'GET', params); +} + +//任务卡片--子任务查询 +export const getTaskSubCondition = params => { + return WeaTools.callApi('/api/proj/pctask/taskcondition', 'GET', params); +} + +//任务卡片--共享设置列表 +export const getTaskShareList = params => { + return WeaTools.callApi('/api/proj/pctask/taskshare', 'GET', params); +} + +//任务卡片--共享设置添加 +export const addTaskShare = params => { + return WeaTools.callApi('/api/proj/prjutil/doProjectShareOpt', 'POST', params); +} + +//任务卡片--共享设置批量删除 +export const delBatchTaskShare = params => { + return WeaTools.callApi('/api/proj/prjutil/doProjectShareOpt', 'POST', params); +} + +//任务卡片--相关流程-文档-客户-资产 reftype=req ,doc, crm , cpt +export const getTaskReference = params => { + return WeaTools.callApi('/api/proj/pctask/taskreference', 'GET', params); +} + +//任务卡片--相关交流--内容 +export const getTaskExchange = params => { + return WeaTools.callApi('/api/proj/pctask/taskdiscuss', 'GET', params); +} + +//任务卡片--相关交流--高级搜索 +export const getTaskExchangeCondition = params => { + return WeaTools.callApi('/api/proj/pctask/taskcondition', 'GET', params); +} + + +//任务卡片--所需 流程-文档 新增,删除 修改 +export const doDspTaskRequiredOpt = params => { + return WeaTools.callApi('/api/proj/pctask/doDspTaskRequiredOpt', 'GET', params); +} + +//任务卡片--流程创建 +export const addRequiredWF = params => { + return WeaTools.callApi('/api/proj/pctask/addRequiredWF', 'GET', params); +} + +//任务卡片--相关流程-文档 -客户-资产 新增,删除 +export const doDspTaskReferenceOpt = params => { + return WeaTools.callApi('/api/proj/pctask/doDspTaskReferenceOpt', 'GET', params); +} +//任务卡片--修改记录 +export const taskModifyList = params => { + return WeaTools.callApi('/api/proj/pctask/taskModifyList', 'GET', params); +} + +//任务卡片新增阶段联动 获取任务对应的阶段 +export const getTaskStage = params => { + return WeaTools.callApi('/api/proj/pctask/getTaskStage', 'GET', params); +} + +//任务日志 +export const getTaskLogList = params => { + return WeaTools.callApi('/api/proj/pctask/taskLogList', 'POST', params); +} + +//任务字段日志 +export const getTaskFieldLogList = params => { + return WeaTools.callApi('/api/proj/pctask/taskFieldLogList', 'POST', params); +} + +//任务字段详情日志 +export const getTaskFieldDetailLogList = params => { + return WeaTools.callApi('/api/proj/pctask/taskFieldDetailLogList', 'POST', params); +} + +//获取批量修改字段 +export const getModifySelect = params => { + return WeaTools.callApi('/api/proj/pctask/getModifySelect', 'POST', params); +} + +export const getModifyFields = params => { + return WeaTools.callApi('/api/proj/remind/getConditionField', 'POST', params); +} + +export const submitBatchModify = params => { + return WeaTools.callApi('/api/proj/pctask/submitBatchModify', 'POST', params); +} + +//判断角色下是否有人员 +export const getCheckRole = params => { + return WeaTools.callApi('/api/task/develop/checkRole', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/prj/components/App.js b/pc4mobx/prj/components/App.js new file mode 100644 index 0000000..7d59ccd --- /dev/null +++ b/pc4mobx/prj/components/App.js @@ -0,0 +1,173 @@ +import React, { Component } from 'react'; +import { inject, observer } from 'mobx-react'; +import './kanban/style/index.less' +import Kanban from './kanban'; +import { toJS } from 'mobx'; +import { Icon, message } from 'antd'; +import { WeaInput, WeaAlertPage } from 'ecCom'; +import QueueAnim from 'rc-queue-anim'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +class App extends Component { + + constructor(props) { + super(props); + this.state = { + columns: props.columns || [], + visible: false, + groupName: "" + } + } + + index = 0; + handleAdd = (value) => { + const input = this.refs.groupNameInput.refs.inputNormal.refs.input.refs.input; + if (value && this.state.visible) { + if (this.checkGroupRepeat(value)) { + this.props.boardStore.saveGroup(value); + this.setState({ visible: !this.state.visible, groupName: "" }); + } else { + message.error(getLabel('387703', "阶段名称重复!")); + } + } + if (!this.state.visible) { + input.focus(); + input.setSelectionRange(0, input.value.length); + this.setState({ visible: !this.state.visible, groupName: "" }); + } + + + + } + + + checkGroupRepeat = (name) => { + const { boardStore: { columns } } = this.props; + let checked = true; + const stages = toJS(columns); + stages.map(item => { + if (item.title == name) { + checked = false; + } + }); + return checked; + } + + + componentWillUnmount() { + const { boardStore, columns } = this.props; + boardStore.clearStatus(); + } + + render() { + const { boardStore } = this.props; + const { userid, usericons, username, delGrop, isedit, columns, canEditBoard, canAddTask } = boardStore; + if (!isedit && columns && columns.length == 0) { + return ( + +
+ {getLabel('387719', "对不起,该看板暂无数据 !")} +
+
+ ) + } else { + return ( + +
+ {getLabel('387718', "新建阶段")} +
+
+
+ { + this.setState({ groupName: value }) + }} + onBlur={value => { + this.handleAdd(value); + }} + /> +
+ +
+ + } onChange={boardStore.doMovePrjBoard} > + {boardStore.columns && boardStore.columns.map((column) => { + + return ( + delGrop(id)} + userInfo={{ + userid: userid, + username: username, + usericons: usericons + }} + isedit={isedit} + canEditBoard={canEditBoard} + canAddTask={canAddTask} + groupid={column.id} + // footer={ } + saveTask={(params) => { this.props.boardStore.saveTask(params) }} + saveGroupName={(name, id) => { this.props.boardStore.saveGroupName(name, id) }} + checkRepeat={(name, id) => { this.props.boardStore.checkGroupRepeat(name, id) }} + // extra={} + + > + { + this.getItems(column.items) + } + + ) + }) + } +
+ ); + } + + } + + getItems = (items) => { + const { boardStore: { canAddTask, canEditBoard } } = this.props; + let comItems = []; + items && items.map((item) => { + comItems.push( + { this.props.boardStore.setLandMark(id, value) }} + onTaskClick={(value) => { this.props.boardStore.showSlideModal(true, value) }} + finish={item.finish} + key={item.id} + /> + ) + }) + return comItems; + } +} + +export default App; \ No newline at end of file diff --git a/pc4mobx/prj/components/Approval.js b/pc4mobx/prj/components/Approval.js new file mode 100644 index 0000000..b68d177 --- /dev/null +++ b/pc4mobx/prj/components/Approval.js @@ -0,0 +1,219 @@ +import React from 'react'; +import { inject, observer } from 'mobx-react'; +import { Button, Tabs,Card,Pagination,Row,Col } from 'antd'; +import {toJS} from "mobx"; +import {Condition,getAdButtons} from './list/listCondition'; +import {WeaTableNew} from 'comsMobx'; +import ModifyLogDialog from "./dialog/modifyLogDialog" +import ExchangeDialog from './dialog/exchangeDialog' + +const WeaTable = WeaTableNew.WeaTable; +import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaBrowser,WeaTools,WeaProgress,WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +@inject('prjApprovalStore') +@observer +class Approval extends React.Component { + constructor(props) { + super(props); + window._cptTable = { + reLoad: props.prjApprovalStore.reLoad + } + } + + componentDidMount() { + this.doInit(this.props); + } + doInit(props){ + const { location,prjApprovalStore } = props; + const {initDatas,doSearch,initTreeDatas} = prjApprovalStore; + initDatas(); + doSearch(); + } + + componentWillReceiveProps(nextProps){ + if(this.props.location.key !== nextProps.location.key){ + const { location,prjApprovalStore } = nextProps; + prjApprovalStore.clearStatus(); + this.doInit(nextProps); + } + } + + componentWillUnmount(){ + const { prjApprovalStore } = this.props; + prjApprovalStore.clearStatus(); + } + render(){ + const {prjApprovalStore} = this.props; + const {loading,tableStore,showSearchAd,form,exchangeStore,logTableStore,logVisible} = prjApprovalStore; + const formParams = form.getFormParams() || {}; + return ( + + } + iconBgcolor='#217346' + buttons={this.getTopButtons()} + buttonSpace={10} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + onDropMenuClick={this.onRightMenuClick.bind(this)} + > + {prjApprovalStore.setShowSearchAd(bool)}} + hideSearchAd={()=> prjApprovalStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v=>{prjApprovalStore.doSearch()}} + onSearchChange={v=>{prjApprovalStore.appendFormFields({taskname:{value:v}})}} + /> + this.reRenderColumns(c)} + tableWidth={this.tableWidth} + onOperatesClick={this.onOperatesClick.bind(this)} + /> +
+ + +
) + + } + getTopButtons(){ + const {prjApprovalStore} = this.props; + const {rightMenu,tableStore} = prjApprovalStore; + let {selectedRowKeys} = tableStore; + let btnArr = []; + let that = this; + const isDisabled = !(selectedRowKeys.length>0 && `${toJS(selectedRowKeys)}`); + rightMenu && rightMenu.length>0 && toJS(rightMenu).map(m=>{ + m.isTop == '1' && btnArr.length < 4 && btnArr.push( + + ); + }); + return btnArr; + } + + getRightMenu(){ + const {prjApprovalStore }= this.props; + const {rightMenu,tableStore} = prjApprovalStore; + let {selectedRowKeys} = tableStore; + let btnArr = []; + const isDisabled = !(selectedRowKeys.length>0 && `${toJS(selectedRowKeys)}`); + rightMenu && rightMenu.length>0 && rightMenu.map(m=>{ + btnArr.push({ + icon: , + content: m.menuName, + disabled:isDisabled && m.isControl == "1" + }) + }); + return btnArr + } + onRightMenuClick(key){ + const {prjApprovalStore }= this.props; + const {rightMenu,tableStore} = prjApprovalStore; + let {selectedRowKeys} = tableStore; + let that = this; + rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{ + if(Number(key) == i){ + let fn = m.menuFun.indexOf('this') >= 0 ? `${m.menuFun.split('this')[0]})` : m.menuFun; + if(m.type == "BTN_COLUMN"){ //定制列 + prjApprovalStore.onShowColumn(); + }else if(m.type == "BTN_BATCHAPPROVE"){ + prjApprovalStore.doTaskApprovalOpt({method:'approve',taskids:`${toJS(selectedRowKeys)}`}); + }else if(m.type == "BTN_BATCHBACK"){ + prjApprovalStore.doTaskApprovalOpt({method:"refuse",taskids:`${toJS(selectedRowKeys)}`}); + } + } + }); + } + + reRenderColumns(columns){ + columns.forEach((c,i)=>{ + if(c.dataIndex=='finish'){ + c.render = function(text, record){ + return + + + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + + tableWidth = (columns) => { + let width = 0; + let cols = 0; + columns.map(col => { + if (col.display === 'true') { + let oldwidth = col.oldWidth || '10%'; + let widthInt = parseFloat(oldwidth.replace('%', '')); + if (widthInt <= 0) { + widthInt = 10; + } + width += widthInt; + cols++ + } + }) + //超过10列,才出现滚动条,width>100才出现滚动条 + if(cols<=10){ + width = 100 ; + } + return `${width}%`; + } + + onOperatesClick(record,index,operate,flag){ + let that = this; + const {prjApprovalStore }= this.props; + const {doTaskApprovalOpt,viewModifyLog,exchangeStore} = prjApprovalStore; + + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + if(fn != ""){ + if("onApprove"==fn){ + doTaskApprovalOpt({method:'approve',taskids:record.randomFieldId}); + }else if('onReject' == fn){ + doTaskApprovalOpt({method:"refuse",taskids:record.randomFieldId}); + }else if('onLog' == fn){ + viewModifyLog(record.randomFieldId); + this.refs.modifyLogDialog.setVisible(true); + }else if('onDiscuss' == fn){ //相关交流 + exchangeStore.handleExchangeDialog(true,"task",record.randomFieldId,{}) + } + } + } + onEnterSearch = () =>{ + const {prjApprovalStore} = this.props; + prjApprovalStore.doSearch(); + prjApprovalStore.setShowSearchAd(false); + } +} + +export default WeaTools.tryCatch(React, + props => , + {error: ""} +)(Approval); \ No newline at end of file diff --git a/pc4mobx/prj/components/BatchShare.js b/pc4mobx/prj/components/BatchShare.js new file mode 100644 index 0000000..70e8440 --- /dev/null +++ b/pc4mobx/prj/components/BatchShare.js @@ -0,0 +1,230 @@ +import React from 'react'; +import { inject, observer } from 'mobx-react'; +import { Button, Tabs,Card,Pagination,Row,Col } from 'antd'; +import {toJS} from "mobx"; +import {Condition,getAdButtons} from './list/listCondition'; +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaBrowser,WeaTools,WeaLeftRightLayout,WeaProgress,WeaLocaleProvider} from 'ecCom'; +import ShareDialog from './dialog/shareDialog' +import ListLeftTree from './list/listLeftTree' +import BatchShareDialog from './comp/prj-batch-share' +const getLabel = WeaLocaleProvider.getLabel; + +@inject('prjBatchShareStore') +@observer +class BatchShare extends React.Component { + constructor(props) { + super(props); + } + doInit(props){ + const {prjBatchShareStore } = props; + const {initTreeDatas,doSearch,initDatas} = prjBatchShareStore; + //doSearch(); + initDatas(); + //initTreeDatas(); + } + componentDidMount(){ + this.doInit(this.props); + } + componentWillReceiveProps(nextProps){ + if(this.props.location.key !== nextProps.location.key){ + const { location,prjBatchShareStore } = nextProps; + prjBatchShareStore.clearStatus(); + this.doInit(nextProps); + } + } + componentWillUnmount(){ + const { prjBatchShareStore } = this.props; + prjBatchShareStore.clearStatus(); + } + render(){ + const {prjBatchShareStore} = this.props; + const {loading,tableStore,showSearchAd,form,reLoad,showLeft} = prjBatchShareStore; + const formParams = form.getFormParams() || {}; + let {selectedRowKeys} = tableStore; + return ( + + } + iconBgcolor='#217346' + buttons={this.getTopButtons()} + buttonSpace={10} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + onDropMenuClick={this.onRightMenuClick.bind(this)} + > + } + onCollapse={showLeft => prjBatchShareStore.setLeftShow(showLeft)} + > + {prjBatchShareStore.setShowSearchAd(bool)}} + hideSearchAd={()=> prjBatchShareStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v=>{prjBatchShareStore.doSearch()}} + onSearchChange={v=>{prjBatchShareStore.appendFormFields({name:{value:v}})}} + onChange={ this.changeData } + /> + reLoad()} + getColumns={c=>this.reRenderColumns(c)} + tableWidth={this.tableWidth} + onOperatesClick={this.onOperatesClick.bind(this)} + /> +
+
+ + { + prjBatchShareStore.saveBatchShare({prjids:`${toJS(selectedRowKeys)}`,share:JSON.stringify(v)}); + } + } + onCancel={() => {prjBatchShareStore.handleShareDialog(false) }} + /> +
) + + } + + getTopButtons(){ + const {prjBatchShareStore} = this.props; + const {rightMenu,tableStore} = prjBatchShareStore; + let {selectedRowKeys} = tableStore; + let btnArr = []; + let that = this; + const isDisabled = !(selectedRowKeys.length>0 && `${toJS(selectedRowKeys)}`); + rightMenu && rightMenu.length>0 && toJS(rightMenu).map(m=>{ + m.isTop == '1' && btnArr.length < 4 && btnArr.push( + + ); + }); + return btnArr; + } + + getRightMenu(){ + const {prjBatchShareStore }= this.props; + const {rightMenu,tableStore} = prjBatchShareStore; + let btnArr = []; + let {selectedRowKeys} = tableStore; + const isDisabled = !(selectedRowKeys.length>0 && `${toJS(selectedRowKeys)}`); + rightMenu && rightMenu.length>0 && rightMenu.map(m=>{ + btnArr.push({ + icon: , + content: m.menuName, + disabled: isDisabled && m.isControl == "1" + }) + }); + return btnArr + } + onRightMenuClick(key){ + const {prjBatchShareStore }= this.props; + const {rightMenu,tableStore} = prjBatchShareStore; + let {selectedRowKeys} = tableStore; + let that = this; + rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{ + if(Number(key) == i){ + let fn = m.menuFun.indexOf('this') >= 0 ? `${m.menuFun.split('this')[0]})` : m.menuFun; + if(m.type == "BTN_SEARCH"){ //定制列 + prjBatchShareStore.doSearch(); + }else if(m.type == "BTN_COLUMN"){ //定制列 + prjBatchShareStore.onShowColumn(); + }else if(m.type == "BTN_SHAREBATCH"){ //批量共享 + prjBatchShareStore.handleShareDialog(true) + } + } + }); + } + reRenderColumns(columns){ + columns.forEach((c,i)=>{ + if(c.dataIndex=='finish'){ + c.render = function(text, record){ + return + + + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + + tableWidth = (columns) => { + let width = 0; + let cols = 0; + columns.map(col => { + if (col.display === 'true') { + let oldwidth = col.oldWidth || '10%'; + let widthInt = parseFloat(oldwidth.replace('%', '')); + if (widthInt <= 0) { + widthInt = 10; + } + width += widthInt; + cols++ + } + }) + //超过10列,才出现滚动条,width>100才出现滚动条 + if(cols<=10){ + width = 100 ; + } + return `${width}%`; + } + + changeData=(key)=>{ + const {prjBatchShareStore} = this.props; + prjBatchShareStore.setShowSearchAd(false); + prjBatchShareStore.doSearch({ + tabkey:key + }); + } + + onOperatesClick(record,index,operate,flag){ + const {prjBatchShareStore} = this.props; + const {shareStore,} = prjBatchShareStore; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + let that = this; + if(fn != ""){ + if("onShare"==fn){ //共享 + shareStore.handleShareDialog(true,"prj",record.randomFieldId) + } + } + } + onEnterSearch = () =>{ + const {prjBatchShareStore} = this.props; + prjBatchShareStore.doSearch(); + prjBatchShareStore.setShowSearchAd(false); + } +} + +export default WeaTools.tryCatch(React, + props => , + {error: ""} +)(BatchShare); \ No newline at end of file diff --git a/pc4mobx/prj/components/Demo.js b/pc4mobx/prj/components/Demo.js new file mode 100644 index 0000000..8875841 --- /dev/null +++ b/pc4mobx/prj/components/Demo.js @@ -0,0 +1,121 @@ +import React from 'react' +import { WeaDraggable ,WeaBrowser,WeaInput} from 'ecCom'; +import { Row, Col } from 'antd'; +import jQuery from 'jquery'; +import { observable, action } from 'mobx'; +import { inject, observer} from 'mobx-react'; +import {WeaForm, WeaSwitch} from 'comsMobx'; +import {WeaSearchGroup, WeaFormItem} from 'ecCom'; +import {Button} from 'antd'; + +const datas = { + "condition": [ + { + "title": "基本信息", + "items": [ + { + "colSpan": 2, + "conditionType": "INPUT", + 'rules': 'required|string', + "domkey": [ + "resourcename" + ], + "fieldcol": 12, + "isQuickSearch": true, + "label": "姓名", + "labelcol": 6, + "value": "", + "viewAttr": 2 + }, + { + colSpan:2, + "fieldcol": 12, + "labelcol": 6, + conditionType:"SCOPE", + domkey: + ["seclevel", "seclevelTo"], + endValue:100, + isQuickSearch:false, + label:"安全级别", + startValue:'0', + viewAttr:3, + precision: 0, + min:[0, 10], + max:[10, 1000], + }, + { + colSpan:2, + "fieldcol": 12, + "labelcol": 6, + conditionType:"TIMERANGEPICKER", + domkey: + ["starttime", "endtime"], + label:"时间区间", + starttime:'14:50', + endtime:"15:30", + viewAttr:3, + 'rules': 'required|string', // 校验规则 + }, + + ], + "defaultshow": true + } + ] + } + +class DemoStore { + @observable form = new WeaForm(); + + @action + getFormParams() { + return this.form.getFormParams(); + } + } + + const demoStore = new DemoStore(); + +@observer +export default class Main extends React.Component{ + constructor(props) { + super(props); + } + componentDidMount() { + const conditioninfo = datas.condition; + const {form} = demoStore; + form.initFormFields(conditioninfo); + } + onChange(data) { + + } + getSearchs() { + const conditioninfo = datas.condition; + const { form } = demoStore; + const {isFormInit} = form; + let group = []; + isFormInit && conditioninfo.map((c,i) =>{ + let items = []; + c.items.map((field,index) => { + items.push({ + com:( + + ), + colSpan:1 + }) + }); + group.push() + }); + return group; + } + render() { + const { form } = demoStore; + return (
+ {this.getSearchs()} +
+
+
) + } +}; \ No newline at end of file diff --git a/pc4mobx/prj/components/Home.js b/pc4mobx/prj/components/Home.js new file mode 100644 index 0000000..5e43f55 --- /dev/null +++ b/pc4mobx/prj/components/Home.js @@ -0,0 +1,17 @@ +import { WeaPopoverHrm,WeaLocaleProvider } from 'ecCom'; + +class Home extends React.Component { + render() { + return ( +
+ + + + {this.props.children} + +
+ ) + } +} + +export default Home diff --git a/pc4mobx/prj/components/ProjectReport.js b/pc4mobx/prj/components/ProjectReport.js new file mode 100644 index 0000000..4fa5934 --- /dev/null +++ b/pc4mobx/prj/components/ProjectReport.js @@ -0,0 +1,138 @@ +import React from 'react'; +import { inject, observer } from 'mobx-react'; +import { Button, } from 'antd'; +import {toJS} from "mobx"; +import {WeaTableNew} from 'comsMobx'; +import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaTools,WeaProgress,WeaBrowser,WeaLocaleProvider} from 'ecCom'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; +import {Condition,getAdButtons} from './list/listCondition'; + +@inject('projectReportStore') +@observer +class ProjectReport extends React.Component { + constructor(props) { + super(props); + } + componentDidMount(){ + const {projectReportStore,params } = this.props; + const {doSearch,initData} = projectReportStore; + initData(params); + doSearch(params); + } + componentWillReceiveProps(nextProps){ + const keyOld = this.props.location.key; + const keyNew = nextProps.location.key; + if(keyOld !== keyNew) { + const {projectReportStore,params } = nextProps; + const {doSearch,initData} = projectReportStore; + initData(params); + doSearch(params); + } + } + componentWillUnmount(){ + const {projectReportStore,params } = this.props; + projectReportStore.clearStatus(); + } + render(){ + const {projectReportStore} = this.props; + const {title,loading,form,showSearchAd,tableStore,reLoad} = projectReportStore; + return ( + + } + iconBgcolor='#217346' + buttons={[]} + buttonSpace={10} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + onDropMenuClick={this.onRightMenuClick.bind(this)} + > + {projectReportStore.setShowSearchAd(bool)}} + hideSearchAd={()=> projectReportStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v=>{prjExecuteStore.doSearch()}} + advanceHeight={100} + /> + this.reRenderColumns(c)} + register_table={()=>reLoad()} + /> +
+
+ ) + } + + onEnterSearch = ()=>{ + const projectReportStore = this.props; + projectReportStore.doSearch(); + projectReportStore.setShowSearchAd(false); + } + + reRenderColumns(columns){ + columns.forEach(c=>{ + if(c.dataIndex=='resultcount'){ + c.render = function(text, record){ + if(record.resultcountspan){ + return + + + } + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + getRightMenu(){ + const {projectReportStore} = this.props; + const {rightMenu} = projectReportStore; + let btnArr = []; + rightMenu && rightMenu.length>0 && rightMenu.map(m=>{ + btnArr.push({ + icon: , + content: m.menuName, + }) + }); + return btnArr + } + onRightMenuClick(key){ + const {projectReportStore} = this.props; + const {rightMenu} = projectReportStore; + let that = this; + rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{ + if(Number(key) == i){ + if(m.type == "BTN_SEARCH"){ + projectReportStore.doSearch(); + } + } + }); + } + +} + +export default WeaTools.tryCatch(React, + props => , + {error: ""} +)(ProjectReport); \ No newline at end of file diff --git a/pc4mobx/prj/components/add/LinkCardItem.js b/pc4mobx/prj/components/add/LinkCardItem.js new file mode 100644 index 0000000..62da649 --- /dev/null +++ b/pc4mobx/prj/components/add/LinkCardItem.js @@ -0,0 +1,81 @@ + +import {Card,Icon,Popover,Button,AutoComplete,Menu,message} from 'antd'; +import {WeaInputSearch,WeaTools,WeaErrorPage} from 'ecCom' +import * as mobx from 'mobx' +import isEqual from 'lodash/isEqual'; + +class LinkCardItem extends React.Component{ + constructor(props) { + super(props); + this.state = { + width: 0 + } + } + componentDidMount(){ + if (!document.getElementsByClassName) { + document.getElementsByClassName = function (className, element) { + var children = (element || document).getElementsByTagName('*'); + var elements = new Array(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + var classNames = child.className.split(' '); + for (var j = 0; j < classNames.length; j++) { + if (classNames[j] == className) { + elements.push(child); + break; + } + } + } + return elements; + }; + } + let coms = document.getElementsByClassName('centerItem')[0]; + !!coms.offsetWidth && this.setState({width:coms.offsetWidth}); + } + shouldComponentUpdate(nextProps,nextState) { + const prjbean = this.props.prjbean; + const prjbeanNext = nextProps.prjbean; + let needrender = false; + + return !isEqual(prjbean, prjbeanNext) + || this.props.iscommon !== nextProps.iscommon + || this.props.num !== nextProps.num + || this.state.width !== nextState.width; + } + render(){ + const {width} = this.state; + const {prjbean,iscommon,num,actions,user} = this.props; + const {beagenters,belongtoUsers,id,name,isview,typeId} = prjbean; + + const colorarray = ["#55D2D4","#B37BFA","#FFC62E","#8DCE36","#37B2FF","#FF9537","#FF5E56"]; + return ( +
+ {iscommon && } +
+ {name} +
+ +
+ {!iscommon && +
+ +
+ } +
+
+ ) + } + //显示项目信息 + showPrjInfo(id,typeid){ + const {actions} = this.props; + actions.addProjectStore.handleShareDialog(true,{viewtype:'showadd',templetid:id,prjtypeid:typeid}); + } + //新建项目 + addProject(id,typeid){ + const {actions} = this.props; + actions.addProjectStore.handleShareDialog(true,{viewtype:'add',templetid:id,prjtypeid:typeid}); + } +} + +export default LinkCardItem + diff --git a/pc4mobx/prj/components/add/MLinkCard.js b/pc4mobx/prj/components/add/MLinkCard.js new file mode 100644 index 0000000..cd965b1 --- /dev/null +++ b/pc4mobx/prj/components/add/MLinkCard.js @@ -0,0 +1,44 @@ +import LinkCardItem from './LinkCardItem'; +import {Card,Icon} from 'antd'; +import isEqual from 'lodash/isEqual'; +import * as mobx from 'mobx' + + +class MLinkCard extends React.Component { + shouldComponentUpdate(nextProps) { + const _c = !isEqual(mobx.toJS(this.props.types), mobx.toJS(nextProps.types)); + return _c || this.props.isAbc !== nextProps.isAbc + } + render() { + const {types,isAbc,actions,user} = this.props; + return ( +
+ { + types.map((type,i)=>{ + const {prjbeans,img,color,letter,selected,typeName,prjtmpcount} = type; + const icontype ="icon-base " +img; + return ( + +
+ {isAbc ? + {letter} + : +
+ + {typeName}{('(' + (prjtmpcount) + ')')} +
+ } +
+ { + prjbeans.map((obj,j)=>) + } +
+ ) + }) + } +
+ ) + } +} + +export default MLinkCard diff --git a/pc4mobx/prj/components/add/OLinkCard.js b/pc4mobx/prj/components/add/OLinkCard.js new file mode 100644 index 0000000..ffa2881 --- /dev/null +++ b/pc4mobx/prj/components/add/OLinkCard.js @@ -0,0 +1,54 @@ +import LinkCardItem from './LinkCardItem'; +import {Card,Icon} from 'antd'; +import isEqual from 'lodash/isEqual'; +class OLinkCard extends React.Component{ + + render() { + const {types,isAbc,actions,user} = this.props; + return ( +
+ { + types.map((type,i)=>{ + const {prjbeans,img,color,letter,selected,typeName} = type; + const icontype ="icon-base " +img; + return ( + +
+
+
+
+ {isAbc ? + {letter} + : +
+ + {typeName}{prjbeans && ('(' + (prjbeans.length-1) + ')')} +
+ } +
+
+
+
+
    + { + prjbeans.map((obj,j)=> +
  • + +
  • + ) + } +
+
+
+
+ ) + }) + } +
+ ) + } + + +} + +export default OLinkCard \ No newline at end of file diff --git a/pc4mobx/prj/components/add/index.js b/pc4mobx/prj/components/add/index.js new file mode 100644 index 0000000..d2654f9 --- /dev/null +++ b/pc4mobx/prj/components/add/index.js @@ -0,0 +1,114 @@ + +import { inject, observer} from 'mobx-react'; +import {Row,Col,Input,Button,Alert,Spin,Icon} from 'antd' +import {WeaTop} from "ecCom" + +import MLinkCard from './MLinkCard'; +import OLinkCard from './OLinkCard'; + +import AddProject from '../dialog/addProjectDialog' +import {WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +@inject('prjAddStore') +@observer +class PrjAdd extends React.Component { + + componentDidMount() { + const {prjAddStore} = this.props; + prjAddStore.initDatas(); + this.scrollheigth(); + } + scrollheigth(){ + let top = jQuery(".wea-prj-add-content").offset() ? (jQuery(".wea-prj-add-content").offset().top ? jQuery(".wea-prj-add-content").offset().top : 0) : 0; + let scrollheigth = document.documentElement.clientHeight - top; + jQuery(".wea-prj-add-content").height(scrollheigth-30); + } + componentWillReceiveProps(nextProps){ + const keyOld = this.props.location.key; + const keyNew = nextProps.location.key; + if(keyOld !== keyNew) { + const {prjAddStore} = nextProps; + prjAddStore.initDatas(); + this.scrollheigth(); + } + } + componentWillUnmount(){ + const { prjAddStore } = this.props; + prjAddStore.clearStatus(); + } + + render() { + const {prjAddStore} = this.props; + const {showDatas = {},mulitcol,isAbc,loading,addProjectStore} = prjAddStore; + const {typesShow,typesCols,usedBeans,abcBtns,user} = showDatas; + const actions = {addProjectStore}; + return ( +
+ } + iconBgcolor='#217346' + title={getLabel(15007,"新建项目")} + buttons={this.getButtons()} + showDropIcon={false}/> +
+ {isAbc && ( +
+ { + abcBtns.map(abcBtn => ) + } +
) + } + { + typesShow.length == 0 && !loading ? :( + mulitcol ? + + {typesCols.map((c,i)=>{ + return + + + })} + + : + + + + + ) + } +
+ +
+ ); + } + getButtons(){ + const {prjAddStore} = this.props; + const {isAbc,mulitcol} = prjAddStore; + return [ + , + + ] + } + goABC(letter){ + const {prjAddStore} = this.props; + prjAddStore.setAbcSelected(letter); + let topheight = jQuery('#'+letter).position().top; + jQuery(".wea-prj-add-content").scrollTop(topheight); + } + showMulitcol(){ + const {prjAddStore} = this.props; + const mulitcol = prjAddStore.mulitcol; + prjAddStore.setMulitcol(!mulitcol); + jQuery(".wea-wf-add-content").scrollTop(0); + } + showABC(){ + const {prjAddStore} = this.props; + const {isAbc} = prjAddStore; + prjAddStore.setIsAbc(!isAbc); + jQuery(".wea-wf-add-content").scrollTop(0); + } +} + +export default PrjAdd \ No newline at end of file diff --git a/pc4mobx/prj/components/common/ProjectStastics.js b/pc4mobx/prj/components/common/ProjectStastics.js new file mode 100644 index 0000000..56966e7 --- /dev/null +++ b/pc4mobx/prj/components/common/ProjectStastics.js @@ -0,0 +1,376 @@ + +import { Tooltip } from 'antd'; +import { WeaLocaleProvider, WeaEchart } from 'ecCom'; +import { observer } from "mobx-react"; +import { toJS } from 'mobx'; +const getLabel = WeaLocaleProvider.getLabel; +import '../../style/stastic.less' + +@observer +export default class ProjectStastics extends React.Component { + constructor(props) { + super(props); + this.chart1 = null; + this.chart2 = null; + this.chart3 = null; + this.setChart1Ref = element => { + this.chart1 = element; + } + this.setChart2Ref = element => { + this.chart2 = element; + } + this.setChart3Ref = element => { + this.chart3 = element; + } + const _this = this; + window.onresize = function() { + _this.chart1 && _this.chart1.chart.resize(); + _this.chart2 && _this.chart2.chart.resize(); + _this.chart3 && _this.chart3.chart.resize(); + } + } + componentDidMount() { + + } + componentWillReceiveProps(nextProps) { + let key = this.props.statkey; + let key_ = nextProps.statkey; + if(key!==key_){ + this.chart1 && this.chart1.paint(); + this.chart2 && this.chart2.paint(); + this.chart3 && this.chart3.paint(); + } + } + render() { + + const { contentStore: { stastics } } = this.props; + let chartdata = toJS(stastics); + let charts = { + option1: { + tooltip: { + trigger: 'item', + formatter: "{a}
{b}: {c} ({d}%)" + }, + legend: { + orient: 'vertical', + x: 'left', + data: chartdata.chart1 ? chartdata.chart1.legend:[] + }, + series: [ + { + type: 'pie', + radius: ['50%', '70%'], + avoidLabelOverlap: false, + label: { + normal: { + show: false, + position: 'center' + }, + emphasis: { + show: true, + textStyle: { + fontSize: '30', + fontWeight: 'bold' + } + } + }, + labelLine: { + normal: { + show: false + } + }, + // data: [ + // { value: 335, name: '直接访问' }, + // { value: 310, name: '邮件营销' }, + // { value: 234, name: '联盟广告' }, + // { value: 135, name: '视频广告' }, + // { value: 1548, name: '搜索引擎' } + // ] + data : chartdata.chart1 ? chartdata.chart1.series:[] + } + ] + }, + option2:{ + color: ['#0270c1','#C2C9D4', '#75D294', '#F72E04'], + tooltip: { + trigger: 'none', + axisPointer: { + type: 'cross' + } + }, + legend: { + data:[getLabel(23774,"已完成"),getLabel(1979,"未开始"),getLabel(1960,"进行中"),getLabel(32556,"已延期")] + }, + grid: { + top: 70, + bottom: 50 + }, + xAxis: [ + { + type: 'category', + axisTick: { + alignWithLabel: true + }, + axisLine: { + onZero: false, + lineStyle: { + color:'#d14a61' + } + }, + axisPointer: { + label: { + formatter: function (params) { + return getLabel(1331,"数量")+' ' + params.value + + (params.seriesData.length>3 ? ':' +(parseInt(params.seriesData[0].data)+parseInt(params.seriesData[1].data)+parseInt(params.seriesData[2].data)+parseInt(params.seriesData[3].data)): ''); + } + } + }, + //data: ["2016-1", "2016-2", "2016-3", "2016-4", "2016-5", "2016-6", "2016-7", "2016-8", "2016-9", "2016-10", "2016-11", "2016-12"] + data : chartdata.chart2 ? chartdata.chart2.xAxis:[] + }, + ], + yAxis: [ + { + type: 'value' + } + ], + series: [ + { + name:getLabel(23774,"已完成"), + type:'line', + smooth: true, + //data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] + data : chartdata.chart2 ? chartdata.chart2.finish_data:[] + }, + { + name:getLabel(1979,"未开始"), + type:'line', + smooth: true, + //data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] + data : chartdata.chart2 ? chartdata.chart2.todo_data:[] + }, + { + name:getLabel(1960,"进行中"), + type:'line', + smooth: true, + data : chartdata.chart2 ? chartdata.chart2.doing_data:[] + }, + { + name:getLabel(32556,"已延期"), + type:'line', + smooth: true, + data : chartdata.chart2 ? chartdata.chart2.overtime_data:[] + } + ] + }, + option3: { + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + label: { + backgroundColor: '#6a7985' + } + } + }, + legend: { + data: [getLabel(23774,"已完成"),getLabel(1979,"未开始"), getLabel(1960,"进行中"), getLabel(32556,"已延期")] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: [ + { + type: 'category', + boundaryGap: false, + //data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] + data : chartdata.chart3 ? chartdata.chart3.xAxis:[] + } + ], + yAxis: [ + { + type: 'value' + } + ], + series: [ + { + name: getLabel(23774,"已完成"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.finish_data:[], + color: { + colorStops: [{ + offset: 0, color: '#0270c1' // 0% 处的颜色 + }, { + offset: 1, color: '#0270c1' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(1979,"未开始"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.todo_data:[], + color: { + colorStops: [{ + offset: 0, color: '#C2C9D4' // 0% 处的颜色 + }, { + offset: 1, color: '#C2C9D4' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(1960,"进行中"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.doing_data:[], + color: { + colorStops: [{ + offset: 0, color: '#75D294' // 0% 处的颜色 + }, { + offset: 1, color: '#75D294' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(32556,"已延期"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.overtime_data:[], + color: { + colorStops: [{ + offset: 0, color: '#F72E04' // 0% 处的颜色 + }, { + offset: 1, color: '#F72E04' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + } + ] + } + + } + + // let topTab = [ + // { + // color: '#000000', + // groupid: 'flowAll', + // showcount: true, + // title: '任务统计', + // viewcondition: 0 + // }, + // { + // color: '#ff3232', + // groupid: 'flowNew', + // showcount: true, + // title: '按负责人', + // viewcondition: 1 + // }, + // { + // color: '#fea468', + // groupid: 'flowRes', + // showcount: true, + // title: '按看板', + // viewcondition: 2 + // } + // ]; + + return ( +
+ {/* {this.getStastics(toJS(stastics))} */} +
+
+ +
+ {chartdata.allnum ? chartdata.allnum.value:0}{getLabel(27591,"个")} + {chartdata.allnum ? chartdata.allnum.lable:''} +
+
+ +
+ {chartdata.finishnum ? chartdata.finishnum.value:0}{getLabel(27591,"个")} + {chartdata.finishnum ? chartdata.finishnum.lable:''} +
+
+ +
+ {chartdata.todonum ? chartdata.todonum.value:0}{getLabel(27591,"个")} + {chartdata.todonum ? chartdata.todonum.lable:''} +
+
+ +
+ {chartdata.doingnum ? chartdata.doingnum.value:0}{getLabel(27591,"个")} + {chartdata.doingnum ? chartdata.doingnum.lable:''} +
+
+ +
+ {chartdata.overtimenum ? chartdata.overtimenum.value:0}{getLabel(27591,"个")} + {chartdata.overtimenum ? chartdata.overtimenum.lable:''} +
+
+ +
+ {chartdata.workday1 ? chartdata.workday1.value:0}{getLabel(1925,"天")} + {chartdata.workday1 ? chartdata.workday1.lable:''} +
+
+ +
+ {chartdata.workday2 ? chartdata.workday2.value:0}{getLabel(1925,"天")} + {chartdata.workday2 ? chartdata.workday2.lable:''} +
+
+
+
+ +
+ {chartdata.hrmidsnum ? chartdata.hrmidsnum.value:0}{getLabel(127,"人")} + {chartdata.hrmidsnum ? chartdata.hrmidsnum.lable:''} +
+
+ +
+ {chartdata.members ? chartdata.members.value:0}{getLabel(127,"人")} + {chartdata.members ? chartdata.members.lable:''} +
+
+
+
+ +
+
+
+
{getLabel(387425,"阶段任务分布")}
+
+ {chartdata.chart1&&} +
+
+
+
{getLabel(387426,"阶段任务状态统计")}
+
+ {chartdata.chart2&&} +
+
+
+
+
+
{getLabel(387427,"负责人任务状态统计")}
+
+ {chartdata.chart3&&} +
+
+
+
+
+ ) + } +} + diff --git a/pc4mobx/prj/components/common/TabDiscuss.js b/pc4mobx/prj/components/common/TabDiscuss.js new file mode 100644 index 0000000..aa82ac9 --- /dev/null +++ b/pc4mobx/prj/components/common/TabDiscuss.js @@ -0,0 +1,586 @@ +import { Row, Col,Button, Modal, message } from 'antd'; +import { WeaBrowser, WeaNewScroll, WeaRichText } from 'ecCom'; +import { inject, observer } from 'mobx-react'; +import { imgZoom} from '../../util/index'; +const confirm = Modal.confirm; +import {toJS} from 'mobx'; +import {WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +class TabDiscuss extends React.Component { + constructor(props) { + super(props); + } + + + + componentDidMount() { + let dom = ReactDOM.findDOMNode(this); + imgZoom(dom, ".wea-cl-content"); + } + componentWillReceiveProps(nextProps) { + + } + componentDidUpdate(prevProps, prevState) { + let dom = ReactDOM.findDOMNode(this); + imgZoom(dom, ".wea-cl-content"); + } + + componentWillUnmount(){ + const {setBrowserList} = this.props.contentStore; + setBrowserList({ + 'create': {remark: ''}, + datas: [], + }) + } + + render() { + const {exchangeList,_BrowserList} = this.props.contentStore; + let _exchangeList = toJS(exchangeList); + let BrowserList = toJS(_BrowserList); + const { sortid } = this.props; + let exchangeListDatas = _exchangeList ? _exchangeList.datas : []; + let wf_auth_url = _exchangeList ? _exchangeList.wf_auth_url : ""; + let doc_auth_url = _exchangeList ? _exchangeList.doc_auth_url : ""; + let acc_auth_url = _exchangeList ? _exchangeList.acc_auth_url : ""; + + let bottomBarConfig = []; + let mirror = { + Document: { type: 37, name: getLabel(126529,"文档"), icon: 'icon-blog-Document' }, + Flow: { type: 152, name: getLabel(131692,"流程"), icon: 'icon-blog-Process' }, + Customer: { type: 18, name: getLabel(30043,"客户"), icon: 'icon-blog-Personnel' }, + Project: { type: 135, name: getLabel(30046,"项目"), icon: 'icon-blog-Project' }, + Task: { type: 'prjtsk', name: getLabel(383349,"任务"), icon: 'icon-blog-Task' }, + } + let objDocument = { + name: 'Browser', + show:
+ + {mirror['Document'].name} +
, + type: mirror['Document'].type, + title: mirror['Document'].name, + }; + let objFlow = { + name: 'Browser', + show:
+ + {mirror['Flow'].name} +
, + type: mirror['Flow'].type, + title: mirror['Flow'].name, + }; + let objCustomer = { + name: 'Browser', + show:
+ + {mirror['Customer'].name} +
, + type: mirror['Customer'].type, + title: mirror['Customer'].name, + }; + + let objProject = { + name: 'Browser', + show:
+ + {mirror['Project'].name} +
, + type: mirror['Project'].type, + title: mirror['Project'].name, + }; + let objTask = { + name: 'Browser', + show:
+ + {mirror['Task'].name} +
, + type: mirror['Task'].type, + title: mirror['Task'].name, + }; + + _exchangeList.docids && bottomBarConfig.push(objDocument);//相关文档 + _exchangeList.relatedwf && bottomBarConfig.push(objFlow);//相关流程 + _exchangeList.relatedcus && bottomBarConfig.push(objCustomer);//相关客户 + _exchangeList.projectids && bottomBarConfig.push(objProject);//相关项目 + _exchangeList.relatedprj && bottomBarConfig.push(objTask);//相关任务 + _exchangeList.relateddoc && bottomBarConfig.push({ + name: 'Upload', + show:
+ + {getLabel(128158,"附件")} +
, + uploadId: 'project_edit', + uploadUrl: `${_exchangeList.relateddoc.uploadUrl}?category=${_exchangeList.relateddoc.category}`, + category: _exchangeList.relateddoc.category, + maxUploadSize: _exchangeList.relateddoc.maxSize, + style: { display: "inline-block", padding: 0 } + }) + //相关附件--relateddoc + let browserParam = { + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: true, + linkUrl: "/hrm/resource/HrmResource.jsp?id=", + pageSize: 10, + quickSearchName: "", + title: getLabel(383424,"人力资源"), + type: "1", + viewAttr: 1, + } + return ( +
+ { + Array.isArray(BrowserList.datas) && BrowserList.datas.map((element, index) => { + let replaceDatas = []; + replaceDatas.push(element.creater); + let baseParams = { + '37': 'docids', + '152': 'relatedwf', + '18': 'relatedcus', + '135': 'projectids', + 'prjtsk': 'relatedprj', + } + element['id'] == BrowserList[element['id']] + let newbottomBarConfig = bottomBarConfig.map((_element, _index) => { + _element['memorise'] = true + for (let key in BrowserList) { + if (key == element['id']) { + return { ..._element, replaceDatas: BrowserList[element['id']][baseParams[_element.type]] } + } + } + return _element + }) + let bottomBarRight={ + Component: + + + + }; + + + let show = element.isEdit == true ? + +
+ this.onChange(element.id, text)} + onStatusChange={s => { }} + onToolsChange={(name, ids, list, type) => this.transfStr(name, ids, list, type, element.id)} + /> +
+
+ :
+ + + + + + +
+ +
+ +
${element.remark}
`}} + /> + { + element.projectids&&element.projectids.length > 0 ? + element.projectids.map((e, _index) => {//相关项目 + return + }) : '' + } + { + element.relatedcus&&element.relatedcus.length > 0 ? + element.relatedcus.map((e, _index) => {//客户 + return + }) : '' + } + { + element.relateddoc&&element.relateddoc.length > 0 ? + element.relateddoc.map((e, _index) => {//修改成附件 + if (e.showLoad) { + return + } else { + return + } + }) : '' + } + { + element.relatedprj&&element.relatedprj.length > 0 ? + element.relatedprj.map((e, _index) => { + return + }) : '' + } + { + element.relatedwf&&element.relatedwf.length > 0 ? + element.relatedwf.map((e, _index) => {//流程 + return + }) : '' + } + { + element.docids&&element.docids.length > 0 ? + element.docids.map((e, _index) => {//文档 + return + }) : '' + } + + {/**/} +
+ + + + {element.time} + + + + { + element.canedit ? ( + this.edit(element.id)} + > {`${getLabel(126036,"编辑")}`} + ) : "" + } + { + element.canedit ? ( + this.delete(element.id)} + style = {{position:'absolute',right:'20px',cursor:'pointer', color: '#b2b2b2'}} + > {`${getLabel(131966,"删除")}`} + ) : "" + } + + + +
+ return show + }) + } + { + exchangeListDatas.length == 1 ? +
+ {getLabel(383567,"暂无相关交流")} +
+ : '' + } +
+ ) + } + + + edit = (_id) => { + const {exchangeList,changeDiscussList,_BrowserList,setBrowserList} = this.props.contentStore; + let _exchangeList = toJS(exchangeList); + let BrowserList = toJS(_BrowserList); + let oldBrowserList = { ...BrowserList }; + let oldexchangeList = { ..._exchangeList } + oldexchangeList.datas.forEach((element, index) => { + if (_id == element['id']) { + element.isEdit = true; + if (oldBrowserList[_id] == undefined) { + oldBrowserList[_id] = {}; + } + oldBrowserList[_id].relatedwf = element.relatedwf; + oldBrowserList[_id].docids = element.docids; + oldBrowserList[_id].projectids = element.projectids; + oldBrowserList[_id].relatedcus = element.relatedcus; + oldBrowserList[_id].relateddoc = element.relateddoc; + oldBrowserList[_id].relatedprj = element.relatedprj; + } + }) + setBrowserList(oldBrowserList); + changeDiscussList(oldexchangeList) + } + onChange = (id, text) => { + const {_BrowserList,setBrowserList} = this.props.contentStore; + let BrowserList = toJS(_BrowserList); + let oldBrowserList = { ...BrowserList }; + if (oldBrowserList[id] == undefined) { + oldBrowserList[id] = {}; + } + oldBrowserList[id]['remark'] = text; + setBrowserList(oldBrowserList); + } + delete = (e) => { + const {exchangeDelete} = this.props.contentStore; + const { sortid } = this.props; + confirm({ + title : getLabel(131329,"信息确认"), + content : getLabel(15097,"确定要删除吗?"), + onOk(){ + exchangeDelete({ id: e, sortid: sortid }); + }, + onCancel() {} + }) + + } + dosubmit = (id) => { + const {exchangeSave,_BrowserList,setBrowserList} = this.props.contentStore; + let BrowserList = toJS(_BrowserList); + let oldBrowserList = { ...BrowserList } + const { sortid } = this.props; + let params = oldBrowserList[id]; + let mewParams = { ...params } + let canSubmit = false; + for (let key in mewParams) { + if (key != 'id' && key != 'sortid') { + if (key == 'remark') { + if (mewParams[key]) { + canSubmit = true + } + } + } + } + + if (params.docids.length == 0) { + delete mewParams.docids + } + if (params.projectids.length == 0) { + delete mewParams.projectids + } + if (params.relatedcus.length == 0) { + delete mewParams.relatedcus + } + if (params.relateddoc.length == 0) { + delete mewParams.relateddoc + } + if (params.relatedprj.length == 0) { + delete mewParams.relatedprj + } + if (params.relatedwf.length == 0) { + delete mewParams.relatedwf + } + if (params.docids.length > 0) { + let docidsarr = [] + params.docids.forEach((_e, _index) => { + docidsarr.push(_e['id']); + }) + mewParams.docids = docidsarr.join(','); + } + if (params.projectids.length > 0) { + let projectidssarr = [] + params.projectids.forEach((_e, _index) => { + projectidssarr.push(_e['id']); + }) + mewParams.projectids = projectidssarr.join(','); + + } + if (params.relatedcus.length > 0) {//客户和任务有问题 + let relatedcusarr = [] + params.relatedcus.forEach((_e, _index) => { + relatedcusarr.push(_e['id']); + }) + mewParams.relatedcus = relatedcusarr.join(','); + + } + if (params.relateddoc.length > 0) { + let relateddocarr = [] + params.relateddoc.forEach((_e, _index) => { + relateddocarr.push(_e['id']); + }) + mewParams.relateddoc = relateddocarr.join(','); + + } + if (params.relatedprj.length > 0) { + let relatedprjarr = [] + params.relatedprj.forEach((_e, _index) => { + relatedprjarr.push(_e['id']); + }) + mewParams.relatedprj = relatedprjarr.join(','); + + } + if (params.relatedwf.length > 0) { + let relatedwfarr = [] + params.relatedwf.forEach((_e, _index) => { + relatedwfarr.push(_e['id']); + }) + mewParams.relatedwf = relatedwfarr.join(','); + + } + mewParams['id'] = id == 'create' ? '' : id; + mewParams['sortid'] = sortid; + let stateBrowserList = { ...BrowserList }; + stateBrowserList['create']['docids'] = [] + stateBrowserList['create']['projectids'] = [] + stateBrowserList['create']['relatedcus'] = [] + stateBrowserList['create']['relateddoc'] = [] + stateBrowserList['create']['relatedprj'] = [] + stateBrowserList['create']['relatedwf'] = [] + stateBrowserList['create']['remark'] = '' + + if (canSubmit) { + setBrowserList(stateBrowserList); + exchangeSave(mewParams); + } else { + message.error(getLabel(126982,"请填写内容")); + // Modal.warning({ + // title: getLabel(382056,"警告"), + // content: getLabel(126982,"请填写内容"), + // }); + } + } + + docancel = (e) => { + const {exchangeList,changeDiscussList} = this.props.contentStore; + let _exchangeList = toJS(exchangeList); + let oldexchangeList = { ..._exchangeList } + oldexchangeList.datas.forEach((element, index) => { + if (e == index) { + element.isEdit = false; + } + }) + changeDiscussList(oldexchangeList) + } + + transfStr = (name = '', ids = '', list = [], type = '', id = '') => { + const {_BrowserList,setBrowserList,exchangeList} = this.props.contentStore; + let BrowserList = toJS(_BrowserList); + let _exchangeList = toJS(exchangeList); + let acc_auth_url = _exchangeList ? _exchangeList.acc_auth_url : ""; + let { sortid } = this.props; + let str = ''; + let idsArr = []; + const mirror = { + 37: "doc", + prjtsk: "task", + 18: "crm", + 152: "workflow", + 135: "project", + workplan: "workplan", + blogTemplate: "blogTemplate" + } + const browserType = { + 37: "docids", + prjtsk: "relatedprj", + 18: "relatedcus", + 152: "relatedwf", + 135: "projectids",//项目 + Upload: "relateddoc",//附件 + } + list.map(item => { + if (name === 'Browser') { + let urlstr=this.openProjectAppLink(mirror[type],item.id,sortid); + str +=` ${item.name || item.showname} ` + idsArr.push(item.id) + } + if (name === 'Upload' && type === 'image') { + str += '  ' + } + if (name === 'Upload' && type === 'file') { + str += ` ${item.filename} ` + if (item.showLoad) { + let urlstr=item.loadlink+"&sortid="+sortid+acc_auth_url; + str += `${getLabel(258,"下载")}(${item.filesize}) ` + } + } + }) + + let oldBrowserList = { ...BrowserList }; + if (oldBrowserList[id] == undefined) { + oldBrowserList[id] = {}; + } + if (name != 'Upload') { + oldBrowserList[id][browserType[type]] = list; + } else { + if(type === 'file'){ + list.map(item => { + oldBrowserList[id]['relateddoc'].push({ id: item.fileid}) + }) + } + + } + setBrowserList(oldBrowserList); + return str + } + + openProjectAppLink=(linkType, linkid, prjid)=>{ + const {exchangeList} = this.props.contentStore; + let _exchangeList = toJS(exchangeList); + let wf_auth_url = _exchangeList ? _exchangeList.wf_auth_url : ""; + let doc_auth_url = _exchangeList ? _exchangeList.doc_auth_url : ""; + let acc_auth_url = _exchangeList ? _exchangeList.acc_auth_url : ""; + if (linkType == "doc") + return `${window.ecologyContentPath || ''}/spa/document/index.jsp?id=${linkid}&prjid=${prjid}`+doc_auth_url; + else if (linkType == "task") + return `${window.ecologyContentPath || ''}/spa/prj/index.html#/main/prj/taskCard?taskid=${linkid}`; + else if (linkType == "crm") + return `${window.ecologyContentPath || ''}/spa/crm/static/index.html#/main/crm/customerView?customerId=${linkid}`; + else if (linkType == "workflow") + return `${window.ecologyContentPath || ''}/spa/workflow/static4form/index.html#/main/workflow/req?fromModul=prj&modulResourceId=${prjid}&requestid=${linkid}`+wf_auth_url; + else if (linkType == "project") + return `${window.ecologyContentPath || ''}/spa/prj/index.html#/main/prj/projectCard?prjid=${prjid}`; + else + return ''; + } + +} + +export default TabDiscuss + + diff --git a/pc4mobx/prj/components/common/TaskList.js b/pc4mobx/prj/components/common/TaskList.js new file mode 100644 index 0000000..07b12be --- /dev/null +++ b/pc4mobx/prj/components/common/TaskList.js @@ -0,0 +1,256 @@ + +import { Button, Row, Col, Icon, message, Modal } from 'antd'; +import { WeaTab, WeaAlertPage, WeaProgress, WeaSearchGroup, WeaFormItem, WeaLocaleProvider } from 'ecCom'; +import { inject, observer } from "mobx-react"; +import { toJS } from 'mobx'; +import { WeaTableNew, WeaSwitch } from 'comsMobx'; +import { Condition } from "../list/listCondition" +import TaskInfoDialog from '../dialog/taskDialog' +import ExchangeDialog from '../dialog/exchangeDialog' +import ShareDialog from '../dialog/shareDialog' +import RelateListDialog from "../dialog/relateListDialog" +import EditPrjTaskDataDialog from "../dialog/editPrjTaskDataDialog" +import TaskBatchEditDialog from '../dialog/taskBatchEditDialog'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class TaskList extends React.Component { + constructor(props) { + super(props); + this.state = { + taskid: "", + coWorkVisiable: false, + workPlanVisible: false + } + } + + componentDidMount() { + + if(!window.weaWorkplan && !window.weaCowork){ + eventRegister.loadModule('f_workplan', ()=> { + eventRegister.loadModule('f_cowork', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载日程模块失败,请联系系统管理员!"); + }); + return; + } + if(window.weaWorkplan && !window.weaCowork){ + eventRegister.loadModule('f_cowork', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + }else{ + eventRegister.loadModule('f_workplan', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + } + } + + render() { + const { contentStore, account, taskBatchEditDialogStore, delCallBack } = this.props; + const { taskListTableStore, taskListRight: { hasRight, verified }, taskListTabs, taskListform, showSearchAd, taskListSearchParams, shareStore, exchangeStore, taskInfoStore, reLoad, prjid, refTaskList, showEditTask } = contentStore; + const formParams = taskListform.getFormParams() || {}; + const rowSelection = { + onChange(selectedRowKeys, selectedRows) { + taskInfoStore.onRowSelect(selectedRowKeys); + } + }; + if (verified && !hasRight) { + return ( +
+ {getLabel(2012, "对不起,您暂时没有权限!")} +
+
+ ) + } + if (verified && hasRight) { + return ( +
+ { + { contentStore.setShowSearchAd(bool) }} + hideSearchAd={() => contentStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v => { contentStore.getPrjTaskList() }} + onSearchChange={v => { contentStore.taskListform.updateFields({ taskname: { value: v } }, false); }} + onChange={this.changeVision} + /> + } +
+ {this.getQuickSearch()} +
+ reLoad(taskListTableStore)} + getColumns={c => this.reRenderColumns(c)} + onOperatesClick={this.onOperatesClick.bind(this)} + rowSelection={rowSelection} + /> + {contentStore.resetTaskInfoStore()}}/> + + + { + refTaskList(); + if(delCallBack){ + delCallBack(); + } + }} /> + + + {window.weaCowork && window.weaCowork.com && window.weaCowork.com.CreateCowork && this.state.coWorkVisiable && this.state.taskid !== "" && ( + { + this.setState({ + coWorkVisiable: false + }); + }} + />) + } + + { + window.weaWorkplan && window.weaWorkplan.com && window.weaWorkplan.com.WorkPlanCreate && + ( { this.setWorkPlanVisible(false); }}//关闭回调 + onlyClose={() => { this.setWorkPlanVisible(false) }}//关闭回调,只做关闭操作 + workPlanId={""} //日程id,1查看日程时用到 + createConditionParams={[]}//创建的默认值日期和时间,没有传[] + activeKey={""} //查看页面显示的面板1是基本信息,7是相关交流 + //changeTab={(key) => { }}//查看页面切换面板的回调 + selectUser={account && account.userid}//新建日程的创建人id + workPlanTypeOptions={"2"}//客户模块的新建日程,普通新建传'',客户新建传3 + crmIDs={[]}//通过客户模块新建日程,并自动带出相关客户,[{'id':'','name':''}] + projectid={prjid} + taskid={this.state.taskid} + description={""}//客户模块需求,支持新建时传入的'基本信息-内容' + />) + } +
) + } + return
+ } + reRenderColumns(columns) { + columns.forEach((c,i) => { + if (c.dataIndex == 'finish') { + c.render = function (text, record) { + return + + + } + } else { + // c.render = function (text, record) { + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + getQuickSearch() { + const { taskListQuickitems, taskListquickform, getPrjTaskList } = this.props.contentStore; + const { isFormInit } = taskListquickform; + let group = []; + const formParams = taskListquickform.getFormParams(); + isFormInit && toJS(taskListQuickitems).map((c,i) => { + let items = []; + c.items.map((fields, index) => { + items.push({ + com: ( + { getPrjTaskList({ [fields.domkey[0]]: res[fields.domkey[0]].value }); }} /> + ), + colSpan: 1, + }) + }); + group.push() + }); + return group; + } + + onOperatesClick(record, index, operate, flag) { + let that = this; + const { contentStore, delCallBack } = this.props; + const { shareStore, exchangeStore, taskInfoStore, prjid } = contentStore; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:", ""); + fn = fn.substring(0, fn.indexOf('(')); + + if (fn != "") { + if ("onShare" == fn) { //共享 + shareStore.handleShareDialog(true, "task", record.randomFieldId, {}) + } else if ('onNewCowork' == fn) { //新建协作 + this.setState({ taskid: record.randomFieldId, coWorkVisiable: true }); + const coworkStoreMap = window.weaCowork.store && window.weaCowork.store.coworkStoreMap; + const cowortore = coworkStoreMap && coworkStoreMap.getMapStore(3); + cowortore && cowortore.setCreateState({ showNewCowork: true, createOrEdit: 0 }); + } else if ('onNewWorkplan' == fn) { //新建日程 + this.setState({ taskid: record.randomFieldId, workPlanVisible: true }); + } else if ('onAddSubTask' == fn) { //新建子任务 + taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: record.randomFieldId }); + } else if ('onEditTask' == fn) { //编辑 + taskInfoStore.handleDialog(true, "edit", record.randomFieldId); + } else if ('onDiscuss' == fn) { //相关交流 + exchangeStore.handleExchangeDialog(true, "task", record.randomFieldId, {}) + } else if ('onDel' == fn) { //删除 + taskInfoStore.delTask("del", record.randomFieldId, ()=> {if(delCallBack) delCallBack()}); + } + } + } + + changeVision = (key) => { + const { contentStore, getRightMenu } = this.props; + contentStore.getPrjTaskList({ version: key == "0" ? "" : key }) + getRightMenu&&getRightMenu({type:'tasklist',version: key == "0" ? "" : key}); + } + + getAdButtons = () => { + const { contentStore,ecid } = this.props; + const { getPrjTaskList, setShowSearchAd, taskListform } = contentStore; + return [ + (), + (), + () + ]; + } + + setWorkPlanVisible = (bool) => { + this.setState({ workPlanVisible: bool }) + } + + onEnterSearch=() =>{ + const { contentStore } = this.props; + contentStore.getPrjTaskList(); + contentStore.setShowSearchAd(false); + } + +} diff --git a/pc4mobx/prj/components/common/exchangeLogs.js b/pc4mobx/prj/components/common/exchangeLogs.js new file mode 100644 index 0000000..501a388 --- /dev/null +++ b/pc4mobx/prj/components/common/exchangeLogs.js @@ -0,0 +1,67 @@ +import { Card,Pagination } from 'antd'; +import {WeaPopoverHrm,WeaLocaleProvider} from 'ecCom' +import equals from 'deep-equal' +const getLabel = WeaLocaleProvider.getLabel; + +class ExchangeLogs extends React.Component{ + constructor(props) { + super(props); + this.state={ + page:props.page || 1 + } + } + shouldComponentUpdate(nextProps,nextState) { + if(!equals(this.props.data, nextProps.data)){ + this.setState({page:1}) + } + return !equals(this.props.data, nextProps.data)|| + !equals(this.state.page,nextState.page); + } + render(){ + const {page} = this.state; + const {data=[],totalSize=0} = this.props; + return ( +
+ + {this.getCards(page)} + { + Number(totalSize)>0 ? +
+ :
{getLabel(83320,"没有可显示的数据")}
+ } +
+ ) + } + getCards(page){ + const {data} = this.props; + let cards = []; + data.map((item,index)=>{ + if(index>=(10*Number(page)-10) && index<= (10*Number(page)-1)){ + cards.push( +
+
+
  {item.createdate} {item.createtime}
+
+
+ {item.docids &&
{getLabel(857,"相关文档")}: 
} + {item.requestids &&
{getLabel(1044,"相关流程")}: 
} + {item.crmids &&
{getLabel(783,"相关客户")}: 
} + {item.projectids &&
{getLabel(782,"相关项目")}: 
} + {item.tskids &&
{getLabel(33414,"相关任务")}: 
} + {item.accessory &&
{getLabel(22194,"相关附件")}: 
} + +
+
+
+
) + } + }); + return cards; + } + changePageSize=(page)=>{ + this.setState({page:page}); + typeof this.props.onChange === 'function' && this.props.onChange(page); + } +} + +export default ExchangeLogs; \ No newline at end of file diff --git a/pc4mobx/prj/components/common/mindMap/MindMap.js b/pc4mobx/prj/components/common/mindMap/MindMap.js new file mode 100644 index 0000000..1bb975a --- /dev/null +++ b/pc4mobx/prj/components/common/mindMap/MindMap.js @@ -0,0 +1,256 @@ +import { Button, Radio, Slider, message, Modal } from 'antd'; +import * as React from 'react'; +import { WeaLocaleProvider, WeaInputSearch, WeaBrowser } from 'ecCom'; +import D3Tree from './RectTree'; +import { toJS } from 'mobx'; +import { inject, observer } from 'mobx-react'; +import './index.less'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class MindMap extends React.Component { + searchedNode = [] + constructor(props) { + super(props); + this.state = { + layout : '0', + scale : 10 + } + + } + + render() { + const { store } = this.props; + const { nodeForm, topButtons, hasChildren,path,canEdit } = this.props; + const dataParams = path?{pathid:path.id,nodeid:nodeForm.id}:{}; + return ( +
+
+ {topButtons.length > 0 && + { + topButtons + } + } + + {getLabel(22986, '左')} + {getLabel(22988, '右')} + {getLabel(31276, '上')} + {getLabel(23010, '下')} + +
+ + `${value * 10}%`} + onChange={this.changeScale} + > + + +
+ + + +
+ { + this.props.pathType === 1 && + store.d3Tree = ref} + showMenu={true} + menus={this.props.rightMenus} + closeRight={(bool)=>{this.props.closeRight(bool)}} + closeDialog={(bool)=>{this.props.closeDialog(bool)}} + // onDelete={(readonly || !nodeForm.parentid) || this.deleteNode} + // onAddChild={readonly || this.addChildren} + // onDeleteChild={(readonly) || (hasChildren && this.deleteChildren)} + // onSynchro={readonly || this.synchronize} + showname={this.getShowname} + desc="hrmNames" + desc2="description" + desc3="overstr" + > + } + +
+ ) + } + + + getShowname = (d) => { + return `${d.name}`; + } + changeSearchValue = () => { + this.searchedNode = []; + } + searchNode = (value) => { + const { store, params } = this.props; + if (!value) { + this.searchedNode = []; + return; + } + if (store.d3Tree ) { + if (this.searchedNode.length === 0) { + this.timer = 0; + this.searchedNode = store.d3Tree .searchNode(value.toLowerCase()); + } + const length = this.searchedNode.length; + if (length > 0) { + store.d3Tree .centerNode(this.searchedNode[this.timer % length]); + this.timer++; + } + } + } + zoom = (scale) => { + // this.props.changeScale(parseInt(scale * 10)); + this.setState({ + scale : parseInt(scale * 10) + }); + } + zoomIn = () => { + // this.props.changeScale(Math.min(this.props.scale + 1, 30)); + this.setState({ + scale : Math.min(this.state.scale + 1, 30) + }); + } + zoomOut = () => { + // this.props.changeScale(Math.max(this.props.scale - 1, 1)); + this.setState({ + scale : Math.max(this.state.scale - 1, 1) + }); + } + changeScale = (scale) => { + this.setState({ + scale : scale + }); + } + importPath = () => { + this.props.openPathTemplateDialog(); + } + setCombine = () => { + const { edcPathDesignerStore: store, params } = this.props; + this.props.combineSetDialogStore.open({ appid: params.appid }); + } + changeLayout = (e) => { + // const { edcPathDesignerStore: store } = this.props; + this.searchedNode = []; + // this.props.changeLayout(e.target.value); + this.setState({ + layout : e.target.value + }); + } + + saveNode = () => { + this.props.saveNode(); + } + saveAsTemplate = () => { + const { edcPathDesignerStore: store } = this.props; + if (this.props.d3Tree) { + const { edcPathDesignerStore: store } = this.props; + const svg = this.props.d3Tree .baseSvg; + const g = this.props.d3Tree .svgGroup; + const serializer = new XMLSerializer(); + let source = serializer.serializeToString(svg.node()); + source = '\r\n' + source; + const url = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(source); + const canvas = document.createElement("canvas"); + const { width, height } = svg.node().getBoundingClientRect(); + canvas.width = width; + canvas.height = height; + const context = canvas.getContext("2d"); + const image = new Image; + image.src = url; + image.onload = () => { + context.drawImage(image, 50, 25); + const img = canvas.toDataURL("image/png"); + this.props.saveAsTemplate(img); + } + } + } + addChildren = () => { + const { edcPathDesignerStore: store } = this.props; + const { nodeForm } = store; + this.props.setChildOpreator([]); + this.props.allChildOpreator(nodeForm.id).then((childOpreator) => { + this.props.setChildOpreator(childOpreator); + if (this.browser) { + this.browser.openModal(); + const selectPerson = (ids, names, objs) => { + if (objs.length > 99) { + message.warn(getLabel('502645', '下级节点不能超过99个')); + this.browser.openModal(); + return; + } + const { edcPathDesignerStore: store } = this.props; + const oldids = childOpreator.map(d => d.id); + const newids = objs.filter(d => oldids.indexOf(d.id) === -1).map(d => d.id); + if (newids.length === 0) { + message.warn(getLabel('502646', '请选择需要添加的人员')); + return; + } + this.props.addNodes(nodeForm.id, newids.join(',')); + } + this.selectPerson = selectPerson; + } + }); + } + addNodes = (ids, names, objs) => { + this.selectPerson(ids, names, objs); + } + + deleteNode = () => { + Modal.confirm({ + title: getLabel('505951','删除节点') , + content: getLabel('505952','确认要删除选中的节点?') , + onOk: () => { + const { edcPathDesignerStore: store } = this.props; + const { nodeForm } = store; + this.props.deleteNode(nodeForm.id); + } + }); + } + + deleteChildren = () => { + Modal.confirm({ + title: getLabel('505953','删除节点') , + content: getLabel('505954','确认要删除所有下级节点?') , + onOk: () => { + const { edcPathDesignerStore: store } = this.props; + const { nodeForm } = store; + this.props.deleteChildren(nodeForm.id); + } + }); + } + + synchronize = () => { + if (this.nodeBrowser) { + this.nodeBrowser.openModal(); + } + } + +} \ No newline at end of file diff --git a/pc4mobx/prj/components/common/mindMap/RectTree.js b/pc4mobx/prj/components/common/mindMap/RectTree.js new file mode 100644 index 0000000..99fa2f8 --- /dev/null +++ b/pc4mobx/prj/components/common/mindMap/RectTree.js @@ -0,0 +1,940 @@ + +import { isEqual, uniqueId, cloneDeep } from 'lodash'; +import * as React from 'react'; +import loadjs from 'loadjs'; +import classnames from 'classnames'; +import { RightMenu, RightMenuStore } from './rightMenu'; +import { WeaSlideModal, WeaDialog } from 'ecCom'; + +import './index.less'; +const getLength = (str) => { + let realLength = 0, len = str.length, charCode = -1; + for (let i = 0; i < len; i++) { + charCode = str.charCodeAt(i); + if (charCode >= 0 && charCode <= 128) realLength += 1; + else realLength += 2; + } + return realLength; +}; +const getSubStr = (str, start, length) => { + let rt = [], currentLength = 0, len = str.length, charCode = -1; + for (let i = 0; i < len; i++) { + charCode = str.charCodeAt(i); + if (charCode >= 0 && charCode <= 128) { + currentLength++; + } else { + currentLength += 2; + } + if (currentLength > start && currentLength <= length) { + rt.push(str.charAt(i)); + } + } + return rt.join(''); +} +const getShortStr = (ele, data, w = 100) => { + const length = parseInt(w / 6); + const datalength = data ? getLength(data) : 0; + if (length >= datalength) { + return data; + } + return getSubStr(data, 0, length) + '...'; +} +export default class D3Tree extends React.Component { + totalNodes = 0; + maxLabelLength = 0; + i = 0; + selectedPath = []; + currentPath = []; + overedPath = []; + static defaultProps = { + widthToggle: true, + showRight: true, + layout: '0', + showMenu: false + } + constructor(props) { + super(props); + this.state = { + duration: 750, + hoverNode: undefined, + id: `d3TreeContainer_${new Date().getTime()}_${uniqueId()}`, + width: 220, + height: 100 + } + this.didMountTree = false; + this.rightMenuStore = new RightMenuStore(); + } + render() { + const { showRight, style, showMenu } = this.props; + const menu = [ + { + key: '1', + icon: , + content: '按钮 1', + }, + { + key: '2', + icon: , + content: '按钮 2', + } + ]; + return ( +
{ this.props.closeRight(false) }}> + {/* */} +
this.container = ref} + id={this.state.id} + className="d3-tree" + style={style} + onContextMenu={showMenu ? this.onContextMenu : undefined} + /> + {/* */} + {/*
+ {this.props.showRight && this.renderRight()} +
*/} +
e.stopPropagation()} className={"Prj-WeaSlideModal"}> + )} + onClose={() => { this.props.closeRight(false) }} + onAnimationEnd={() => console.log('onAnimationEnd')} /> +
+ + {/* this.props.closeDialog(false) } + visible={this.props.showDialog} + style={{ width: 1000, height: 600 }} + title={'活动计划'} + hasScroll + url={this.renderRight() !== 'function'&& this.renderRight()} + > + */} +
this.selection = ref}>
+
+ ) + } + onContextMenu = (e) => { + if (this.isClickNode && this.opreateNode) { + const left = e.clientX; + const top = e.clientY; + this.showRightMenu(); + this.rightMenuStore.show(left, top, + this.opreateNode.id === this.root.id, + this.getHasChild(this.opreateNode), + this.getChildVisible(this.opreateNode)); + } + this.isClickNode = false; + e.stopPropagation && e.stopPropagation(); + e.preventDefault && e.preventDefault(); + e.nativeEvent && e.nativeEvent.preventDefault(); + } + showRightMenu = () => { + if (!this.menuWrapper) { + this.menuWrapper = document.createElement('div'); + document.body.appendChild(this.menuWrapper); + } + ReactDOM.render(, this.menuWrapper); + } + clickAnyWhere = (e) => { + this.rightMenuStore.hide(); + if (this.startMove && this.selection) { + this.startMove = false; + this.selection.style.display = 'none'; + const top = parseInt(this.selection.style.top); + const left = parseInt(this.selection.style.left); + const width = parseInt(this.selection.style.width); + const height = parseInt(this.selection.style.height); + + this.selection.style.height = '0px'; + this.selection.style.width = '0px'; + } + } + mouseup = (d) => { + const e = window.event; + if (e.button === 2) { + this.opreateNode = d; + this.isClickNode = true; + this.click(d); + } + + } + renderRight = () => { + if (typeof this.props.renderRight === 'function') { + if (this.selectedNode && this.props.renderRight) { + return this.props.renderRight(this.selectedNode); + } else { + return null; + } + } else { + return this.props.renderRight; + } + } + diableMouseOut = () => { + this.canTriggerMouseOut = false; + } + enableMouseOut = () => { + this.canTriggerMouseOut = true; + this.outNode(); + } + componentWillReceiveProps(nextProps) { + if (!isEqual(this.props.data, nextProps.data) || + this.props.layout !== nextProps.layout && this.container && + (this.didMountTree = false, this.container.innerHTML = "", true)) { + if (nextProps.data) { + clearTimeout(this.initTimer); + this.initTimer = setTimeout(() => { + this.initTree(nextProps.data); + }, 100); + } + } + if (this.props.scale !== nextProps.scale) { + if (this.svgGroup) { + const transform = this.svgGroup.attr("transform"); + if (transform) { + const scale = nextProps.scale / 10; + this.svgGroup.attr("transform", `${transform.split('scale')[0]}scale(${scale})`); + } + } + } + } + componentWillUnmount() { + window.removeEventListener('resize', this.resize); + document.removeEventListener('mouseup', this.clickAnyWhere); + if (this.container) { + /* this.container.removeEventListener('mousedown', this.onMouseDown); + this.container.removeEventListener('mousemove', this.onMouseMove); */ + } + if (this.menuWrapper) { + ReactDOM.unmountComponentAtNode(this.menuWrapper); + document.body.removeChild(this.menuWrapper); + delete this.menuWrapper; + } + } + componentDidMount() { + window.addEventListener('resize', this.resize); + document.addEventListener('mouseup', this.clickAnyWhere); + if (this.container) { + /* this.container.addEventListener('mousedown', this.onMouseDown); + this.container.addEventListener('mousemove', this.onMouseMove); */ + } + if (!loadjs.isDefined('weaEdcD3js')) { + loadjs(['/edc/d3/d3.v3.js'], 'weaEdcD3js', { + success: () => { + if (this.container && this.props.data) { + const _this = this; + setTimeout(function(){ + _this.initTree(_this.props.data); + _this.resize(); + _this.click(_this.root); + },1000); + } + } + }); + } else { + if (this.container && this.props.data) { + const _this = this; + setTimeout(function(){ + _this.initTree(_this.props.data); + _this.resize(); + _this.click(_this.root); + },1000); + + } + } + + } + onMouseDown = (e) => { + if (e.button === 0 && this.selection && e.target.tagName === 'svg') { + this.selectionLeft = e.clientX; + this.selectionTop = e.clientY; + this.selection.style.display = 'block'; + this.selection.style.top = this.selectionTop + 'px'; + this.selection.style.left = this.selectionLeft + 'px'; + this.startMove = true; + } + } + onMouseMove = (e) => { + if (this.startMove) { + this.selection.style.height = (e.y - this.selectionTop) + 'px'; + this.selection.style.width = (e.x - this.selectionLeft) + 'px'; + e.stopPropagation && e.stopPropagation(); + e.preventDefault && e.preventDefault(); + e.nativeEvent && e.nativeEvent.preventDefault(); + } + } + resize = () => { + clearTimeout(this.resizeTimer); + this.resizeTimer = setTimeout(() => { + const viewerHeight = this.container.clientHeight; + const viewerWidth = this.container.clientWidth; + d3.select(`#${this.state.id}>svg`) + .attr("width", viewerWidth) + .attr("height", viewerHeight); + }, 100); + } + getSize = () => { + const { layout } = this.props; + const { width, height } = this.state; + if (layout === '1') { // 上 + return { + nodeSize: [width + 10, height], + width, + height, + deep: width + } + } else if (layout === '3') { // 下 + return { + nodeSize: [width + 10, height], + width, + height, + deep: width * -1 + } + } else if (layout === '0') { // 左 + return { + nodeSize: [height + 10, width], + width, + height, + deep: width * 2, + } + } else if (layout === '2') { // 右 + return { + nodeSize: [height + 10, width], + width, + height, + deep: width * -2, + } + } + } + searchNode = (name, nodes = [this.root]) => { + const searchedNode = []; + nodes.forEach(node => { + if (node.name.toLowerCase().indexOf(name) > -1) { + searchedNode.push(node); + } + if (node.children) { + searchedNode.push(...this.searchNode(name, node.children)); + } + if (node._children) { + searchedNode.push(...this.searchNode(name, node._children)); + } + }); + return searchedNode; + } + initTree(treeData) { + const { layout } = this.props; + const { width, height } = this.state; + const { nodeSize } = this.getSize(); + if (this.container && window.d3) { + const viewerHeight = this.container.clientHeight; + const viewerWidth = this.container.clientWidth; + this.tree = d3.layout.tree().nodeSize(nodeSize); + // define a d3 diagonal projection for use by the node paths later on. + this.diagonal = d3.svg.diagonal() + .projection((d) => { + return (layout === '1' || layout === '3') ? + [d.x + width / 2, d.y + height / 2] : + [d.y + width / 2, d.x + height / 2]; + }); + + this.sortTree(); + if (!this.didMountTree) { + const zoom = (e) => { + this.svgGroup.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); + if (this.props.zoom) { + this.props.zoom(d3.event.scale) + } + } + if (this.props.zoom) { + this.props.zoom(1) + } + this.zoomListener = d3.behavior.zoom().scaleExtent([0.1, 2]).on("zoom", zoom); + + // define the baseSvg, attaching a class for styling and the zoomListener + this.baseSvg = d3.select("#" + this.state.id).append("svg") + .attr("width", viewerWidth) + .attr("height", viewerHeight) + .attr("class", "overlay") + .call(this.zoomListener); + this.svgGroup = this.baseSvg.append("g"); + } + // Define the drag listeners for drag/drop behaviour of nodes. + // Define the root + const { x0 = viewerHeight / 2, y0 = 0 } = this.root || {}; + this.root = cloneDeep(treeData) + this.root.x0 = x0 + this.root.y0 = y0; + + // Layout the tree initially and center on the root node. + this.update(this.root); + if (!this.didMountTree) { + this.centerNode(this.root); + } + //选中的节点在不在树中时 选中根节点 + const curNodeId = this.selectedNode.id; + const treeNodeIds = [treeData.id]; + treeData.children.map(c => { + treeNodeIds.push(c.id); + }) + if (treeNodeIds.indexOf(curNodeId) < 0) { + this.click(this.root); + } + this.didMountTree = true; + } else { + setTimeout(() => { + this.initTree(treeData); + }, 50); + } + } + + centerNode = (source) => { + const { layout } = this.props; + const { width, height } = this.state; + const viewerHeight = this.container.clientHeight; + const viewerWidth = this.container.clientWidth; + const scale = this.zoomListener.scale(); + const isRoot = source === this.root; + this.selectedNode = source; + let x = 0; + let y = 0; + if (layout === '1') { + y = -source.y0; + x = -source.x0; + x = x * scale + viewerWidth / 2; + if (isRoot) { + y = y * scale + height; + } else { + y = y * scale + viewerHeight / 2; + } + } else if (layout === '3') { + y = -source.y0; + x = -source.x0; + x = x * scale + viewerWidth / 2; + if (isRoot) { + y = y * scale + viewerHeight - height * 2; + } else { + y = y * scale + viewerHeight / 2; + } + } else if (layout === '2') { + x = -source.y0; + y = -source.x0; + if (isRoot) { + x = x * scale + viewerWidth - width * 2; + } else { + x = x * scale + viewerWidth / 2; + } + y = y * scale + viewerHeight / 2; + } else { + x = -source.y0; + y = -source.x0; + if (isRoot) { + x = x * scale + width; + } else { + x = x * scale + viewerWidth / 2; + } + y = y * scale + viewerHeight / 2; + } + this.svgGroup.transition() + .duration(this.state.duration) + .attr("transform", "translate(" + x + "," + y + ")scale(" + scale + ")"); + this.zoomListener.scale(scale); + this.zoomListener.translate([x, y]); + this.click(source); + } + collapse = (d) => { + if (d.children) { + d._children = d.children; + d._children.forEach(collapse); + d.children = null; + } + } + + expand = (d) => { + if (d._children) { + d.children = d._children; + d.children.forEach(expand); + d._children = null; + } + } + sortTree = () => { + this.tree.sort((a, b) => { + return parseInt(a.id) - parseInt(b.id); + }); + } + getXY = (x, y) => { + const { layout } = this.props; + if (layout === '1' || layout === '3') { // 上下 + return `${x},${y}`; + } else { + return `${y},${x}`; + } + } + + update = (source) => { + if (!this.tree) { + setTimeout(() => { + this.update(source); + }, 50); + return; + } + const { desc, desc2, desc3, showname, showSubmitCount = true, nameTitle } = this.props; + const { duration } = this.state; + const { deep, width, height, textAnchor } = this.getSize(); + // Compute the new tree layout. + window.tree = this.tree; + const nodes = this.tree.nodes(this.root).reverse(); + const links = this.tree.links(nodes); + const isShownameFunc = typeof showname === 'function'; + const isDescFunc = typeof desc === 'function'; + const isDesc2Func = typeof desc2 === 'function'; + const isDesc3Func = typeof desc3 === 'function'; + // Normalize for fixed-depth. + nodes.forEach((d) => { + d.y = d.depth * deep; + if (d.current) { + this.currentPath = this.getLinksToParents(d); + } + }); + + // Update the nodes… + const node = this.svgGroup.selectAll("g.node") + .data(nodes, (d) => d.id); + + // Enter any new nodes at the parent's previous position. + const nodeEnter = node.enter().append("g") + .attr("class", 'node') + .attr("transform", d => `translate(${this.getXY(source.x0, source.y0)})`) + .on("click", this.click) + .on('mouseup', this.mouseup); + + nodeEnter.append("rect") + .attr('class', 'node-rect') + .attr("width", width) + .attr("height", height) + .attr("stroke", "#999") + .attr("stroke-width", 2) + .attr("fill", "#fff") + .attr("rx", 2) + .attr("ry", 2); + nodeEnter.append("rect") + .attr("class", 'flag') + .attr("x", 1) + .attr("y", 1) + .attr("width", 6) + .attr("height", height - 2) + .attr("fill", "rgb(230, 228, 228)") + nodeEnter.append("rect") + .attr("class", 'flag2') + .attr("x", 1) + .attr("y", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return height - height*(finish/100) + 1*(finish/100) + }else{ + return 1 + } + }) + .attr("width", 6) + .attr("height", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return (height - 2)*(finish/100) + }else{ + // console.log((height - 2)); + return height - 2 + } + + }) + .attr("fill", "#fff") + .style("fill", (d) => { + if(d.type=="task"){ + if(d.overstr!==""){ + return "red"; + }else{ + return "#52c41a"; + } + + }else{ + return d.type=="prj" ? "#f7f7f7" : (d.type=="task" && d.isfinish == 1 ? "#52c41a" : '#f7f7f7'); + } + }); + const textg = nodeEnter.append('g').attr('class', 'text-g'); + textg.append("text") + .attr("x", 20) + .attr("y", 20) + .attr("dy", ".5em") + .attr("text-anchor", textAnchor) + .text(function (d) { + return getShortStr(this, isShownameFunc ? showname(d) : d[showname],120); + }) + .on('click', this.clickTitle); + textg.append('title').text(d => nameTitle ? nameTitle : isShownameFunc ? showname(d) : d[showname]); + + nodeEnter.append("text") + .attr("display", d => { + let all = 0; + if (d.children) { + all = d.children.length; + } else if (d._children) { + all = d._children.length; + } + return all ? 'block' : 'none'; + }) + .attr("class", 'count') + .attr("x", width - 30) + .attr("y", 20) + .attr("dy", ".35em") + .attr("text-anchor", textAnchor) + .text(d => { + let submitCount = 0; + let all = 0; + if (d.children) { + submitCount = d.children.filter(d => d.isfinish).length; + all = d.children.length; + } else if (d._children) { + submitCount = d._children.filter(d => d.isfinish).length; + all = d._children.length; + } + if (showSubmitCount) { + return `${submitCount}/${all}` + } else { + return `${all}` + } + }); + + const descg = nodeEnter.append('g').attr('class', 'desc-g'); + descg.append("text") + .attr("class", 'desc') + .attr("x", 20) + .attr("y", 45) + .attr("dy", ".35em") + .attr("text-anchor", textAnchor).text(function (d) { + return getShortStr(this, isDescFunc ? desc(d) : d[desc], 120); + }); + descg.append('title').text(d => isDescFunc ? desc(d) : d[desc]); + const descg2 = nodeEnter.append('g').attr('class', 'desc-g2'); + descg2.append("text") + .attr("class", 'desc') + .attr("x", 20) + .attr("y", 65) + .attr("dy", ".35em") + .attr("text-anchor", textAnchor).text(function (d) { + return d[desc2]; + }); + descg2.append('title').text(d => isDesc2Func ? desc(d) : d[desc2]); + const descg3 = nodeEnter.append('g').attr('class', 'desc-g3'); + descg3.append("text") + .attr("class", 'desc') + .attr("x", 20) + .attr("y", 85) + .attr("dy", ".35em") + .attr("fill", "rgb(109, 106, 236") + .attr("text-anchor", textAnchor).text(function (d) { + return getShortStr(this, isDesc3Func ? desc(d) : d[desc3], 120); + }); + descg3.append('title').text(d => isDesc3Func ? desc(d) : d[desc3]); + // descText.append('svg:title').text(d=>d[desc]); + // Transition nodes to their new position. + const nodeUpdate = node.transition() + .duration(duration) + .attr("transform", d => `translate(${this.getXY(d.x, d.y)})`) + .attr("class", (d) => { + if (this.selectedNode && d.id === this.selectedNode.id) { + return 'node node-selected' + } else { + return 'node'; + } + }); + nodeEnter.append("rect") + .attr("class", 'flag2') + .attr("x", 1) + .attr("y", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return height - height*(finish/100) + 1*(finish/100) + }else{ + return 1 + } + }) + .attr("width", 6) + .attr("height", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return (height - 2)*(finish/100) + }else{ + // console.log((height - 2)); + return height - 2 + } + + }) + .attr("fill", "#fff") + .style("fill", (d) => { + if(d.type=="task"){ + if(d.overstr!==""){ + return "red"; + }else{ + return "#52c41a"; + } + + }else{ + return d.type=="prj" ? "#f7f7f7" : (d.type=="task" && d.isfinish == 1 ? "#52c41a" : '#f7f7f7'); + } + }); + + nodeUpdate.select("rect.flag2") + .attr("y", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return height - height*(finish/100) + 1*(finish/100) + }else{ + return 1 + } + }) + .attr("height", (d)=>{ + if(d.type=="task"){ + // console.log((height - 2)*(d.finish/100),222,height,d.finish,d.id); + let finish = d.finish == -1 ? 0 : d.finish; + return (height - 2)*(finish/100) + }else{ + // console.log((height - 2)); + return height - 2 + } + + }) + .style("fill", (d) => { + if(d.type=="task"){ + if(d.overstr!==""){ + return "red"; + }else{ + return "#52c41a"; + } + + }else{ + return d.type=="prj" ? "#f7f7f7" : (d.type=="task" && d.isfinish == 1 ? "#52c41a" : '#f7f7f7'); + } + }); + + + + nodeUpdate.select("rect.node-rect") + .attr("width", width) + .attr("height", height) + .attr("stroke", "#999") + .attr("stroke-width", 2) + .attr("fill", "#fff"); + + nodeUpdate.select("text").style("fill-opacity", 1); + nodeUpdate.select("g.text-g>text").text(function (d) { + return getShortStr(this, isShownameFunc ? showname(d) : d[showname]); + }); + nodeUpdate.select("g.text-g>title").text(function (d) { + return nameTitle ? nameTitle : isShownameFunc ? showname(d) : d[showname]; + }) + nodeUpdate.select("g.desc-g>text.desc").text(function (d) { + return getShortStr(this, isDescFunc ? desc(d) : d[desc], 120); + }); + nodeUpdate.select("g.desc-g2>text.desc").text(function (d) { + return d[desc2]; + }); + nodeUpdate.select("g.desc-g3>text.desc").text(function (d) { + return getShortStr(this, isDesc3Func ? desc(d) : d[desc3], 120); + }); + nodeUpdate.select("g.desc-g>title").text(function (d) { + return isDescFunc ? desc(d) : d[desc]; + }); + nodeUpdate.select("g.desc-g>title").text(d => isDescFunc ? desc(d) : d[desc]); + + nodeUpdate.select('text.count').text(d => { + let submitCount = 0; + let all = 0; + if (d.children) { + submitCount = d.children.filter(d => d.isfinish).length; + all = d.children.length; + } else if (d._children) { + submitCount = d._children.filter(d => d.isfinish).length; + all = d._children.length; + } + if (showSubmitCount) { + return `${submitCount}/${all}` + } else { + return `${all}` + } + + }).attr("display", d => { + let all = 0; + if (d.children) { + all = d.children.length; + } else if (d._children) { + all = d._children.length; + } + return all ? 'block' : 'none'; + }) + + nodeUpdate.select("g.count>text").text(d => { + let submitCount = 0; + let all = 0; + if (d.children) { + submitCount = d.children.filter(d => d.isfinish).length; + all = d.children.length; + } else if (d._children) { + submitCount = d._children.filter(d => d.isfinish).length; + all = d._children.length; + } + if (showSubmitCount) { + return `${submitCount}/${all}` + } else { + return `${all}` + } + + }).attr("display", d => { + let all = 0; + if (d.children) { + all = d.children.length; + } else if (d._children) { + all = d._children.length; + } + return all ? 'block' : 'none'; + }) + + + + // Transition exiting nodes to the parent's new position. + const nodeExit = node.exit().transition() + .duration(duration) + .attr("transform", d => `translate(${this.getXY(source.x, source.y)})`) + .remove(); + + nodeExit.select("rect") + .attr("width", width) + .attr("height", height) + .attr("stroke", "#ccc") + .attr("stroke-width", 2); + + nodeExit.select("text"); + // Update the links… + const link = this.svgGroup.selectAll("path.link") + .data(links, d => d.target.id) + .attr('class', "link"); + + // Enter any new links at the parent's previous position. + link.enter().insert("path", "g") + .attr('class', "link") + .attr("stroke", d => { + const { source: { id: from }, target: { id: to } } = d; + if (this.selectedPath.indexOf(`${from},${to}`) > -1) { + return "#2db7f5" + } else if (this.currentPath.indexOf(`${from},${to}`) > -1) { + return "#2db7f5"; + } + return "#ccc" + }) + .attr('fill', "none") + .attr("stroke-width", 1.5) + .attr("x", width / 2) + .attr("y", height / 2) + .attr("d", (d) => { + const o = { + x: source.x0, + y: source.y0 + }; + return this.diagonal({ + source: o, + target: o + }); + }); + + // Transition links to their new position. + link.transition() + .duration(duration) + .attr("d", this.diagonal) + .attr("stroke", d => { + const { source: { id: from }, target: { id: to } } = d; + if (this.selectedPath.indexOf(`${from},${to}`) > -1) { + return "#2db7f5" + } else if (this.currentPath.indexOf(`${from},${to}`) > -1) { + return "#2db7f5"; + } + return "#ccc" + }); + + // Transition exiting nodes to the parent's new position. + link.exit().transition() + .duration(duration) + .attr("d", (d) => { + var o = { + x: source.x, + y: source.y + }; + return this.diagonal({ + source: o, + target: o + }); + }) + .remove(); + + // Stash the old positions for transition. + nodes.forEach((d) => { + d.x0 = d.x; + d.y0 = d.y; + }); + } + clickTitle = (d) => { + if (this.props.onClickTitle) { + this.props.onClickTitle(d); + window.event.stopPropagation(); + } + } + click = (d) => { + if (d) { + this.selectedPath = this.getLinksToParents(d); + this.selectedNode = d; + // d = this.toggleChildren(d); + this.update(d); + if (this.props.onClick) { + this.props.onClick(d, this.getHasChild(d)); + } + } + } + getLinksToParents = (d) => { + const selectedPath = []; + let current = d; + while (current) { + selectedPath.push(`${current.parentid},${current.id}`); + current = current.parent; + } + return selectedPath; + } + toggleChildren = () => { + const d = this.opreateNode; + if (d) { + if (d.children) { + d._children = d.children; + d.children = null; + } else if (d._children) { + d.children = d._children; + d._children = null; + } + this.update(d); + } + } + getChildVisible = (d) => { + return !!d.children; + } + getHasChild = (d) => { + return !!d.children || !!d._children; + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/common/mindMap/index.less b/pc4mobx/prj/components/common/mindMap/index.less new file mode 100644 index 0000000..2e16af1 --- /dev/null +++ b/pc4mobx/prj/components/common/mindMap/index.less @@ -0,0 +1,364 @@ +@right-width: 450px; +@right-size: 450px; +.d3-tree-wrapper { + height: 100%; + position: relative; + .right { + background: #fff; + overflow: hidden; + } + .d3-tree { + overflow: hidden; // margin: 16px; + position: absolute; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; + } + &.with-toggle { + .d3-tree { + top: 50px; + } + } + &.with-right { + .right { + position: absolute; + right: 0px; + width: @right-width; + display: block; + margin-left: 8px; + transition: 0.3s; + top: 50px; + bottom: 0px; // border-left: 1px solid #efefef; + box-shadow: 0 9px 12px -2px rgba(39, 54, 78, 0.11); + z-index: 100; + } + .d3-tree { + height: e("calc(100% - 82px)"); + overflow: hidden; // margin: 16px; + position: absolute; + left: 0px; + right: 0px; // margin-right: 8px; + } + } + .node { + cursor: pointer; + } + /* .link { + fill: none; + stroke: #ccc; + stroke-width: 1.5px; + &.link-selected { + stroke: #2db7f5; + } + &-over { + stroke: #2db7f5; + } + } */ + .node-selected { + .node-rect { + stroke: #2db7f5; + } + } +} + +.edc-tree-memu-item { + &:hover { + background-color: #57c5f7; + color: #fff; + } +} + +.d3-tree-add { + position: absolute; + border-radius: 50%; + padding: 5px 8px; + display: none; +} + +.d3-tree-tips { + &>div { + -webkit-box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.3); + box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.3); + background: #fff; + padding: 16px; + } + .tips-handle { + cursor: pointer; + &:hover { + color: #2db7f5; + } + } + .tips-opts { + position: absolute; + right: 10px; + bottom: 10px; + button { + padding: 5px 8px; + border-radius: 50%; + margin-left: 10px; + } + } +} + +.d3-tree-toggle { + .ant-radio-button-wrapper-checked { + background: #2db7f5; + color: #fff; + } + .ant-radio-button-wrapper { + border-radius: 0px; + padding: 0px 8px; + } + .ant-radio-button-wrapper:first-child { + border-radius: 3px 0px 0px 3px; + } + .ant-radio-button-wrapper:last-child { + border-radius: 0px 3px 3px 0px; + } + .ant-btn-group, + .ant-radio-group { + padding: 10px 0px; + margin-right: 10px; + float: left; + position: relative; + } + .ant-btn-group { + .opt-btn { + margin-right: 10px; + &:last-child { + margin-right: 0px; + } + } + &.linked { + .opt-btn { + margin-right: 0px; + } + } + } + .opt-btn { + padding: 4px 8px; // border-radius: 0px; + } +} + +.border-selection { + position: fixed; + border: 1px solid #2db7f5; +} + + +.wea-edc-path-designer { + height: 100%; + background: #ebedf0; + position: relative; + overflow: hidden; + .tree-layout-toggle { + position: absolute; + z-index: 10; + width: 100%; + height: 50px; + background: #fff; + padding: 0px 16px; + box-shadow: 1px 0 6px 0 rgba(39, 54, 78, 0.12); + .edc-zoom-line { + position: relative; + float: left; + padding: 10px 0px; + margin-right: 10px; + button, + .ant-slider { + float: left; + } + button { + border-radius: 50%; + padding: 0px 4px; + border: 0px; + font-size: 16px; + &:not(:hover) { + color: #999; + } + } + .ant-slider { + width: 200px; + margin-top: 3px; + } + } + } +} + +.border-selection { + display: none; +} + +.edc-node-form { + height: 100%; + width: 100%; + .wea-form-item { + padding: 8px 24px; + } + .toggle { + width: 18px; + height: 60px; + position: absolute; + top: 50%; + left: 0px; + margin-top: -80px; + z-index: 11; + cursor: pointer; + background-size: 100% 100%; + background: url("/cloudstore/resource/pc/com/images/leftTree-hide.png") no-repeat -2px 0; + &:hover { + background: url(/cloudstore/resource/pc/com/images/leftTree-hide-hover.png) no-repeat -2px 0; + } + } + .reporttime { + width:fit-content; + width:-moz-fit-content; + display: inline-block; + } + .saveTime { + width:fit-content; + width:-moz-fit-content; + display: inline-block; + } + .wea-input-number { + width: 70px; + } +} + +.edc-path-tree { + overflow: hidden; + position: absolute; + top: 50px; + bottom: 0px; + margin: 10px; + width: 100%; + .react-resizable-handle { + position: absolute; + width: 10px; + height: 100%; + bottom: 0; + right: 0px; + cursor: col-resize; + } + &>.left, + &>.right { + position: relative; + display: inline-block; + height: 32px; + margin: 0; + padding: 0 15px; + color: rgba(0, 0, 0, 0.65); + line-height: 30px; + border: 1px solid #d9d9d9; + border-top-width: 1.02px; + border-left: 0; + cursor: pointer; + -webkit-transition: color .3s, background .3s, border-color .3s; + transition: color .3s, background .3s, border-color .3s; + .d3-tree-wrapper>.right{ + top: 0px; + right: -15px; + } + + } + &>.left { + float: left; + position: relative; + border-left: 1px solid #d9d9d9; + border-radius: 4px 0 0 4px; + } + &>.right { + border-radius: 0 4px 4px 0; + } + &>.left, + &>.right { + &.checked { + z-index: 1; + color: #1890ff; + background: #fff; + border-color: #1890ff; + -webkit-box-shadow: -1px 0 0 0 #1890ff; + box-shadow: -1px 0 0 0 #1890ff; + } + } +} + +.edc-path-node-form { + padding: 10px 24px; + .edc-node-setting { + border: 1px solid #eaeaea; + .edc-addNode-item-row { + padding: 0px 18px 5px 18px; + } + } + .edc-addNode-item-row { + padding-bottom: 5px; + } + .edc-operator-group { + border: 1px solid #eaeaea; + margin-top: 10px; + .itemCol { + display: inline-block; + vertical-align: middle; + line-height: 32px; + height: 32px; + &.BROWSER { + width: 200px; + } + &.SCOPE, + &.SELECT, + &.SELECT_LINKAGE { + margin-left: 10px; + } + &.SELECT_LINKAGE { + .wea-select-group { + display: inline-block; + width: 200px; + position: relative; + } + } + .labelStyle { + line-height: 32px; + vertical-align: top; + } + .ant-select { + vertical-align: top; + } + } + } + .edc-operator-table { + border: 1px solid #eaeaea; + } + +} + +.wea-slide-modal-content{ + height: 100%; + width: 100%; +} + +.d3-tree-wrapper.rodal-close{ + display: none; +} +.d3-tree-wrapper.wea-slide-modal-content { + height: 100%; + background: #fff; +} +.d3-tree-wrapper.ant-spin-nested-loading{ + position: relative; + height: 100%; +} +.d3-tree-wrapper.ant-spin-container{ + position: relative; + zoom: 1; + height: 100%; +} + +.Prj-WeaSlideModal .wea-slide-modal { + position: static!important; + .rodal-fade-enter { + position: absolute!important; + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/common/mindMap/rightMenu.js b/pc4mobx/prj/components/common/mindMap/rightMenu.js new file mode 100644 index 0000000..4e3385b --- /dev/null +++ b/pc4mobx/prj/components/common/mindMap/rightMenu.js @@ -0,0 +1,91 @@ +import { observer } from "mobx-react"; +import { observable, action, computed } from "mobx"; +import { Icon } from 'antd'; +import { WeaLocaleProvider } from "ecCom"; +const getLabel = WeaLocaleProvider.getLabel; + +export const RightMenu = observer(({ store, onToggleChildren,menus }) => { + const { left, top, visible, hasChild, childVisible, isRoot } = store; + // console.log(data); + + return ( +
+
+
    + {hasChild &&
  • +
  • + + {childVisible ? + : } + + {childVisible ? getLabel('26985','收起') : getLabel('15315','展开') } +
  • + + } + {/* {onBatchReject && hasChild && data && data.current && data.status != 2 && data.arrival &&
  • + + {getLabel('506005','批量退回')} +
  • } + {onSetting &&
  • + + {getLabel('502283', '设置')} +
  • } + {onAddChild &&
  • + + {getLabel('502284', '添加下级')} +
  • } + {onDeleteChild &&
  • + + {getLabel('502285', '删除下级')} +
  • } + {!isRoot && onDelete &&
  • + + {getLabel('502286', '删除')} +
  • } + {onReject && data.status == 2 && data.parent && data.parent.current && data.parent.iscurrentnode == 1 + && data.parent.status != 2 &&
  • + + {getLabel('502287', '退回')} +
  • } + {onSynchro &&
  • + + {getLabel('506099', '同步')} +
  • } */} + { + menus.length > 0 && menus.map((obj)=>{ + return
  • {obj.action(e)}}> +
  • + + {obj.name} +
  • + + }) + } +
+
+ ) +}); + +export class RightMenuStore { + @observable visible = false; + @observable left = 0; + @observable top = 0; + @observable isRoot = false; + @observable hasChild = false; + @observable childVisible = false; + @action show = (left, top, isRoot, hasChild, childVisible) => { + this.visible = true; + this.left = left; + this.top = top; + this.isRoot = isRoot; + this.hasChild = hasChild; + this.childVisible = childVisible; + } + @action hide = () => { + this.visible = false; + } + @action position = (left, top) => { + this.left = left; + this.top = top; + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/common/projectInfo.js b/pc4mobx/prj/components/common/projectInfo.js new file mode 100644 index 0000000..e5fcbd3 --- /dev/null +++ b/pc4mobx/prj/components/common/projectInfo.js @@ -0,0 +1,36 @@ + +import { observer} from "mobx-react"; +import {WeaAlertPage,WeaLocaleProvider } from "ecCom" +import ProjectCondition from '../list/projectCondition' +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class ProjectInfo extends React.Component { + constructor(props) { + super(props); + } + componentDidMount(){ + } + componentWillReceiveProps(nextProps) { + } + render() { + const {prjinfoRight:{verified,hasRight},fieldInfo,form,setFormFields,setValidate } = this.props.formStore; + if (verified && !hasRight) { + return ( +
+ {getLabel(2012,"对不起,您暂时没有权限!")} +
+
+ ) + } + if (verified && hasRight) { + return ( +
+ {setFormFields(v)}} setValidate={(v)=>{setValidate(v)}} /> +
) + } + return
+ } + +} + diff --git a/pc4mobx/prj/components/common/projectSub.js b/pc4mobx/prj/components/common/projectSub.js new file mode 100644 index 0000000..1a46785 --- /dev/null +++ b/pc4mobx/prj/components/common/projectSub.js @@ -0,0 +1,135 @@ + +import {Button,Row,Col,Icon,message,Modal} from 'antd'; +import {WeaTab,WeaAlertPage, WeaProgress,WeaLocaleProvider} from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import {Condition} from '../list/listCondition'; +import ProjectDialog from '../dialog/projectDialog' +import ShareDialog from '../dialog/shareDialog' +import ExchangeDialog from '../dialog/exchangeDialog' +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class ProjectSub extends React.Component { + constructor(props) { + super(props); + + + } + componentDidMount(){ + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const {contentStore} = this.props; + const {showSearchAd,prjSubStore,prjSubform,condition,prjsubRight:{hasRight,verified},exchangeStore,projectInfoStore,reLoad} = contentStore; + const formParams = prjSubform.getFormParams() || {}; + if (verified && !hasRight) { + return ( +
+ {getLabel(2012,"对不起,您暂时没有权限!")} +
+
+ ) + } + + if (verified && hasRight) { + return ( +
+ {contentStore.setShowSearchAd(bool)}} + hideSearchAd={()=> contentStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v=>{contentStore.getPrjSubList()}} + onSearchChange={v=>{contentStore.appendFormFields({prjname:{value:v}})}} + /> + reLoad(prjSubStore)} + getColumns={c=>this.reRenderColumns(c)} + onOperatesClick={this.onOperatesClick.bind(this)} + /> + + + +
) + } + return
+ } + + reRenderColumns(columns){ + columns.forEach((c,i)=>{ + if(c.dataIndex=='finish'){ + c.render = function(text, record){ + return + + + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + + onOperatesClick(record,index,operate,flag){ + const {contentStore} = this.props; + const {shareStore,exchangeStore,projectInfoStore} = contentStore; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + let that = this; + // saveCapitalId(record.randomFieldId); //保存资产id + if(fn != ""){ + if("onShare"==fn){ //共享 + shareStore.handleShareDialog(true,"prj",record.randomFieldId) + }else if('onNormal' == fn){ //正常 + contentStore.doSubPlanOpt({method:'normal',prjid:record.randomFieldId}) + }else if('onOver' == fn){ //延期 + contentStore.doSubPlanOpt({method:'delay',prjid:record.randomFieldId}) + }else if('onFinish' == fn){ //完成 + contentStore.doSubPlanOpt({method:'complete',prjid:record.randomFieldId}) + }else if('onFrozen' == fn){ //冻结 + contentStore.doSubPlanOpt({method:'freeze',prjid:record.randomFieldId}) + }else if('onEdit' == fn){ //编辑 + projectInfoStore.handleDialog(true,record.randomFieldId,{viewtype:'edit',prjid:record.randomFieldId}) ; + }else if('onListTask' == fn){ //任务列表 + + }else if('onDiscuss' == fn){ //相关交流 + exchangeStore.handleExchangeDialog(true,"prj",record.randomFieldId,{}) + } + } + } + + getAdButtons = () => { + const {contentStore} = this.props; + const {getPrjSubList,setShowSearchAd,clearFormFields} = contentStore; + return [ + (), + (), + () + ]; + } + + onEnterSearch=()=>{ + const {contentStore} = this.props; + contentStore.getPrjSubList(); + contentStore.setShowSearchAd(false); + } +} + diff --git a/pc4mobx/prj/components/common/relateDocument.js b/pc4mobx/prj/components/common/relateDocument.js new file mode 100644 index 0000000..94c10ef --- /dev/null +++ b/pc4mobx/prj/components/common/relateDocument.js @@ -0,0 +1,248 @@ + +import {Button,Row,Col, Icon,message,Modal} from 'antd'; +import {WeaTools,WeaBrowser,WeaAlertPage,WeaLocaleProvider} from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import PrjShowGroup from '../comp/prj-show-group' +import PrjTableEdit from '../comp/prj-table-edit' +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class RelateExchange extends React.Component { + constructor(props) { + super(props); + this.state ={ + + } + + } + componentDidMount(){ + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const {contentStore} = this.props; + const {taskDocStore,relateList,taskRelRight:{hasRight,verified},relateList:{canRef}} = contentStore; + const columns = [ + { + title: getLabel(16398,"文档目录"), //列名 + dataIndex: 'docCategoryName', //列的id 对应数据 + key: 'docCategoryName', //前端渲染key值 + com: [ + { label: '', type: 'LINK_DOC' , key: 'docCategoryName', viewAttr:1, width: 120, otherParams: {className: 'test-className'}}, + ], + colSpan: 1, + width: '50%', + className: 'wea-table-edit-name', + }, + { + title: getLabel(17906,"必要"), //列名 + dataIndex: 'isNecessary', //列的id 对应数据 + key: 'isNecessary', //前端渲染key值 + com: [ + { label: '', type: 'CHECKBOX' ,editType: '1',viewAttr:canRef?2:1, key: 'isNecessary', width: 80, } + ], + colSpan: 1, + width: '40%', + className: 'wea-table-edit-ismust', + }, + { + title: '', //列名 + dataIndex: 'operate', //列的id 对应数据 + key: 'sex', //前端渲染key值 + com: [ + { label: '', type: 'OPERATE' ,editType: '1', key: 'operate', options: [{ key: '1', showname: getLabel(91,"删除")}] } + ], + colSpan: 1, + width: '10%', + className: 'prj-dropdown-link', + }, + ]; + if (verified && !hasRight) { + return ( +
+ {getLabel(2012,"对不起,您暂时没有权限!")} +
+
+ ) + } + if (verified && hasRight) { + return ( +
+ + {this.onCreatDoc(categoryid,taskid)}} + /> + + + + + +
) + } + return
+ } + getButtons(){ + const {contentStore} = this.props; + const {relateList:{canRef}} = contentStore; + let btn = []; + if(canRef){ + btn.push( + this.addDocType(ids, names, datas)} customized={true} > + + + ); + } + return btn; + } + getRelateButtons(){ + const {contentStore} = this.props; + const {taskDocStore,relateList:{canRelated}} = contentStore; + const {selectedRowKeys} = taskDocStore; + let btn = []; + if(canRelated){ + btn.push(this.addDocument(ids, names, datas)} customized={true} > + + ); + btn.push( ); + } + return btn; + } + //编辑 + onChange=(data)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + doDspTaskRequiredOpt({ + method:'modifyRequiredDocN', + taskid : taskid, + secID : data.reqDocSecCategory, + isNecessary:data.isNecessary + },'doc'); + } + //新增所需文档 + addDocType=(ids, names, datas)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + doDspTaskRequiredOpt({ + method:'addRequiredDoc', + taskid : taskid, + secID : ids + },'doc'); + } + onCreatDoc = (categoryid,taskid) =>{ + // const {addDocFn} = this.props; + window.open((window.ecologyContentPath || '')+"/spa/document/index.jsp?secid="+categoryid+"&isEdit=1&router=1&moudleFrom=task#/main/document/edit", "_blank"); + let _this = this; + window.__createDocFn = function (obj) { + let docid = obj.docid; + let docsubject = obj.docSubject; + // console.log(docid,docsubject); + // addDocFn && addDocFn(docid,docsubject); + _this.addDocument(docid, docsubject, '') + } + } + //删除 + handleOperate=(record)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83600,"您确认要删除吗?"), + onOk() { + doDspTaskRequiredOpt({ + method:'delRequiredDoc', + taskid : taskid, + secID : record.reqDocSecCategory + },'doc'); + }, + onCancel() { }, + }) + + } + //新建 + addDocument=(ids, names, datas)=>{ + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,prjid} = contentStore; + doDspTaskReferenceOpt({ + dotype:'doc', + method:'add', + prjid : prjid, + taskid:taskid, + docid:ids, + ids:"" + },'doc') + } + deleteDocument=()=>{ + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,taskDocStore,prjid} = contentStore; + const {selectedRowKeys} = taskDocStore; + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83601,"您确认要删除选中的记录吗?"), + onOk() { + doDspTaskReferenceOpt({ + dotype:'doc', + method:'del', + prjid : prjid, + taskid:taskid, + docid:"", + ids:`${toJS(selectedRowKeys)}` + },'doc') + }, + onCancel() { }, + }) + } + onOperatesClick(record,index,operate,flag){ + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,taskDocStore,prjid} = contentStore; + if(fn != ""){ + if("onDelRelated"==fn){ //delete + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83600,"您确认要删除吗?"), + onOk() { + doDspTaskReferenceOpt({ + dotype:'doc', + method:'del', + prjid : prjid, + taskid:taskid, + docid:"", + ids:record.randomFieldId + },'doc') + }, + onCancel() { }, + }) + } + } + } + +} + diff --git a/pc4mobx/prj/components/common/relateExchange-1.js b/pc4mobx/prj/components/common/relateExchange-1.js new file mode 100644 index 0000000..6fb3e04 --- /dev/null +++ b/pc4mobx/prj/components/common/relateExchange-1.js @@ -0,0 +1,192 @@ + +import {Button,Row,Col,Icon,message} from 'antd'; +import {WeaNewScroll,WeaTextarea,WeaSearchGroup ,WeaRichText,WeaLocaleProvider } from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import * as Util from '../../util/index' +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class RelateExchange extends React.Component { + constructor(props) { + super(props); + this.state ={ + showGroup:true, + richValue:"", + status:"", + "doc":"", + "task":"", + "crm":"", + "workflow":"", + "project":"", + file:"" + } + + } + componentDidMount(){ + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const {showGroup,richValue} = this.state; + const basicToolBar = { + toolbar: [ + { name: 'document', items: [ 'Source'] }, + { name: 'styles', items: [ 'Format', 'Font', 'FontSize' ] }, + { name: 'colors', items: [ 'TextColor' ] }, + { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', ] }, + ], + extraPlugins: 'autogrow', + height:150, + autoGrow_minHeight: 150, + autoGrow_maxHeight: 600, + removePlugins: 'resize', + }; + + // 顶部,底部工具栏扩展 + const bottomBarConfig = [ + { + name: 'Browser', // 浏览按钮组件 + show: + {getLabel(857,"相关文档")}, // 使用组件库图标 + type: '37', // 浏览按钮类型 文档 + title: getLabel(58,"文档"), // 浏览按钮标题 + }, + { + name: 'Browser', // 浏览按钮组件 + show: + {getLabel(1044,"相关流程")}, + type: '152', // 浏览按钮类型 + title: getLabel(18015,"流程"), // 浏览按钮标题 + }, + { + name: 'Browser', + show: + {getLabel(783,"相关客户")}, + type: '18', // 浏览按钮类型 + title: getLabel(136,"客户"), // 浏览按钮标题 + }, + { + name: 'Browser', + show: + {getLabel(782,"相关项目")}, + type: '135', // 浏览按钮类型 + title: getLabel(101,"项目"), // 浏览按钮标题 + }, + { + name: 'Browser', + show: + {getLabel(33414,"相关任务")}, + type: 'prjtsk', // 浏览按钮类型 --目前没有,等待开发 + title: getLabel(1332,"任务"), // 浏览按钮标题 + }, + { + name: 'Upload', // 上传组件 + type: 'file', // 上传组件类型 + show: + {getLabel(156,"附件")+"("+getLabel(18642,"此目录下上传附件最大大小")+":5M)"}, // 使用 antd 图标 + uploadUrl: (window.ecologyContentPath || '')+'/api/doc/upload/uploadFile?model=reply', // 上传地址 --目前没有,等待开发 + category: (window.ecologyContentPath || '')+'/api/doc/upload/uploadFile?model=reply', // 文档目录 --目前没有,等待开发 + maxUploadSize:5 + }, + { + name: 'Component', + style: {float: 'right'}, + show: ( + + ) + } + ]; + return ( +
+ +
+ + +
{getLabel(1044,"相关交流")}
+ + + this.setState({showGroup:!showGroup})}/> + +
+ + + this.setState({richValue: v})} + onStatusChange={s => this.setState({status: s})} + onToolsChange={this.transfStr} + /> + + + +
+ +
+ { + //
+ // 相关交流 + // + // + // + //
+ // + + // + } +
) + } + transfStr = (name = '', ids = '', list = [], type = '') => { + const {doc,task,workflow,crm,project,} = this.state; + if(type == "37"){ + + }else if(type== "prjtsk"){ + + }else if(type== "18"){ + + }else if(type== "152"){ + + }else if(type== "135"){ + + }else if(type== "file"){ + + } + let str = ''; + const mirror = { + 37: "doc", + prjtsk: "task", + 18: "crm", + 152: "workflow", + 135: "project", + } + list.map(item => { + if(name === 'Upload' && type === 'image'){ + str += '' + } + if(name === 'Upload' && type === 'file'){ + str += (`${item.filename}
`) + } + if(name === 'Browser'){ + str += ( `${item.name || item.showname}
`) + } + }) + return str + } + handleSubmitExchange=()=>{ + let { richValue} = this.state; + let ckref = this.refs.prjRelateExchange; + if (!ckref.checkMode()) { + message.error(getLabel(27541,"请将编辑器切换到可视化模式")); + return; + } + this.refs.prjRelateExchange.setData(''); + } +} + diff --git a/pc4mobx/prj/components/common/relateExchange.js b/pc4mobx/prj/components/common/relateExchange.js new file mode 100644 index 0000000..550cdae --- /dev/null +++ b/pc4mobx/prj/components/common/relateExchange.js @@ -0,0 +1,211 @@ + +import {Button,Row,Col,Icon,message,Modal} from 'antd'; +import {WeaNewScroll,WeaTextarea,WeaSearchGroup ,WeaRichText,WeaFormItem ,WeaBrowser,WeaUpload,WeaTab,WeaTools,WeaLocaleProvider} from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import ExchangeLogs from './exchangeLogs' +import {Condition} from '../list/listCondition'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class RelateExchange extends React.Component { + constructor(props) { + super(props); + this.state ={ + showGroup:false, + value:"", + "doc":"", + "task":"", + "crm":"", + "workflow":"", + "project":"", + file:"", + key:0 + } + } + componentWillUnmount(){ + this.setState({ + showGroup:false, + value:"", + "doc":"", + "task":"", + "crm":"", + "workflow":"", + "project":"", + file:"", + key:0 + }) + } + render() { + const {contentStore} = this.props; + const {showSearchAd ,exchangeContent,exchangeform } = contentStore; + const formParams = exchangeform.getFormParams() || {}; + const {showGroup,value,key} = this.state; + const formItemLayout = { + labelCol: { span:5 }, + wrapperCol: { span: 14 }, + }; + + return ( +
+
+ {/* {contentStore.setShowSearchAd(bool)}} + hideSearchAd={()=> contentStore.setShowSearchAd(false)} + searchsAd={ +
+ } + showSearchAd={showSearchAd} + onSearch={v=>{contentStore.getRelateExchangeInfo()}} + onSearchChange={v=>{contentStore.setFormFields({remark:{value:v}})}} + /> */} + + + {this.saveValue(v)}} /> + + + + +
+ + + {getLabel(83273,"附加信息")} + this.setState({showGroup:!showGroup})}/> + +
+ + + {this.getFormItem()} + { (exchangeContent.showacc || false) && + + + +
+
) + } + getFormItem(){ + const {contentStore} = this.props; + const { exchangeContent } = contentStore; + const items =[ + {label:getLabel(857,"相关文档"),title:getLabel(857,"文档"),type:37,key:"doc",show:exchangeContent.showdoc || false}, + {label:getLabel(1044,"相关流程"),title:getLabel(18015,"流程"),type:152,key:"wf",show:exchangeContent.showwf || false}, + {label:getLabel(783,"相关客户"),title:getLabel(136,"客户"),type:18,key:"crm",show:exchangeContent.showcrm || false}, + {label:getLabel(782,"相关项目"),title:getLabel(101,"项目"),type:135,key:"prj",show:exchangeContent.showprj || false}, + {label:getLabel(33414,"相关任务"),title:getLabel(1332,"任务"),type:'prjtsk',key:"task",show:exchangeContent.showtask || false}, + ]; + const formItemLayout = { + labelCol: { span:5 }, + wrapperCol: { span: 14 }, + }; + let group =[]; + items.map((item,i)=>{ + if(item.show){ + group.push( + + this.docOnchange(item.key,ids, names, datas)} /> + + ) + }else{ + return; + } + + }) + return group; + } + docOnchange=(type,ids, names, datas)=>{ + if(type =="doc"){ + this.setState({doc:ids}) + }else if(type == "wf"){ + this.setState({workflow:ids}) + }else if(type == "crm"){ + this.setState({crm:ids}) + }else if(type == "task"){ + this.setState({task:ids}) + }else if(type == "prj"){ + this.setState({project:ids}) + } + } + fileUploadBack=(arr)=>{ + this.setState({file:arr}) + } + saveValue=(v)=>{ + this.setState({value:v}) + } + + handleSubmitExchange=()=>{ + const { value,doc,task,crm,workflow, project, file,key} = this.state; + const {targetid,discusstype} = this.props.contentStore; + if(value){ + let params = { + id:targetid, + discusstype:discusstype, + remark:value.replace(/(^\s*)|(\s*$)/g,"").replace(/\n/g,'
'), + relateddoc:doc, + relatedwf:workflow, + relatedcrm:crm, + relatedprj:project, + relatedtsk:task, + relatedacc:`${file}`, + } + WeaTools.callApi('/api/proj/prjutil/doDiscussOpt', 'POST', params).then(data=>{ + typeof this.props.callBack == "function" && this.props.callBack(); + this.setState({ + value:"", + "doc":"", + "task":"", + "crm":"", + "workflow":"", + "project":"", + file:"", + key:key+1 + }) + }); + }else{ + Modal.info({ + title: getLabel(15172,"系统提示"), + content: getLabel(83900,"请填写交流信息"), + }); + } + } + getAdButtons = () => { + const {contentStore} = this.props; + const {setShowSearchAd,clearFormFields,getRelateExchangeInfo} = contentStore; + return [ + (), + (), + () + ]; + } + pageNoChange=(index)=>{ + const {contentStore} = this.props; + const {getRelateExchangeInfo} = contentStore; + getRelateExchangeInfo({pageIndex:index}); + } +} + diff --git a/pc4mobx/prj/components/common/relateWorkFlow.js b/pc4mobx/prj/components/common/relateWorkFlow.js new file mode 100644 index 0000000..deec10f --- /dev/null +++ b/pc4mobx/prj/components/common/relateWorkFlow.js @@ -0,0 +1,248 @@ + +import {Button,Row,Col, Icon,message,Modal} from 'antd'; +import {WeaTools,WeaBrowser,WeaAlertPage,WeaLocaleProvider} from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import PrjShowGroup from '../comp/prj-show-group' +import PrjTableEdit from '../comp/prj-table-edit' +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class RelateExchange extends React.Component { + constructor(props) { + super(props); + this.state ={ + + } + + } + componentDidMount(){ + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const {contentStore} = this.props; + const {taskReqStore,relateList,relateList:{canRef},taskRelRight:{hasRight,verified},register_table} = contentStore; + const columns = [ + { + title: getLabel(16579,"流程类型"), //列名 + dataIndex: 'wfname', //列的id 对应数据 + key: 'wfname', //前端渲染key值 + com: [ + { label: '', type: 'LINK_WF' , key: 'wfname', viewAttr:1, width: 120, otherParams: {className: 'test-className'}}, + ], + colSpan: 1, + width: '50%', + className: 'wea-table-edit-name', + }, + { + title: getLabel(17906,"必要"), //列名 + dataIndex: 'isNecessary', //列的id 对应数据 + key: 'isNecessary', //前端渲染key值 + com: [ + { label: '', type: 'CHECKBOX' ,editType: '1', viewAttr:canRef?2:1,key: 'isNecessary', width: 80, } + ], + colSpan: 1, + width: '40%', + className: 'wea-table-edit-ismust', + }, + { + title: '', //列名 + dataIndex: 'operate', //列的id 对应数据 + key: 'sex', //前端渲染key值 + com: [ + { label: '', type: 'OPERATE' ,editType: '1', key: 'operate', options: [{ key: '1', showname: getLabel(91,"删除")}] } + ], + colSpan: 1, + width: '10%', + className: 'prj-dropdown-link', + }, + ]; + if (verified && !hasRight) { + return ( +
+ {getLabel(2012,"对不起,您暂时没有权限!")} +
+
+ ) + } + if (verified && hasRight) { + return ( +
+ + + + + + + +
) + } + return
+ } + getButtons(){ + const {contentStore} = this.props; + const {taskReqStore,relateList:{canRef}} = contentStore; + let btn = []; + if(canRef){ + btn.push( + this.addWorkFlowType(ids, names, datas)} customized={true} > + + + ); + } + return btn; + } + getRelateButtons(){ + const {contentStore} = this.props; + const {taskReqStore,relateList:{canRelated}} = contentStore; + const {selectedRowKeys} = taskReqStore; + let btn = []; + if(canRelated){ + btn.push(this.addWorkFlow(ids, names, datas)} customized={true} > + + ); + btn.push( ); + } + return btn; + } + //编辑 + onChange=(data)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + doDspTaskRequiredOpt({ + method:'modifyRequiredWFN', + taskid : taskid, + wfid : data.wfid1, + isNecessary:data.isNecessary + },'req'); + } + //新增 + addWorkFlowType=(ids, names, datas)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + doDspTaskRequiredOpt({ + method:'addRequiredWF', + taskid : taskid, + wfids : ids + },'req'); + } + //删除 + handleOperate=(record)=>{ + const {contentStore} = this.props; + const {doDspTaskRequiredOpt,taskid,} = contentStore; + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83600,"您确认要删除吗?"), + onOk() { + doDspTaskRequiredOpt({ + method:'delRequiredWF', + taskid : taskid, + wfid : record.wfid1 + },'req'); + }, + onCancel() { }, + }) + + } + + onCreatReq = (workflowid,taskId) => { + window.open("/workflow/request/CreateRequestForward.jsp?workflowid="+workflowid+"&taskrecordid="+taskId , "_blank"); + } + + onCreatDoc = (docid,taskid) => { + window.open((window.ecologyContentPath || '')+"/spa/document/index.jsp?secid="+ docid +"&isEdit=1&router=1&moudleFrom=task#/main/document/edit?taskrecordid="+taskid , "_blank"); + } + + //新建流程 + addWorkFlow=(ids, names, datas)=>{ + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,prjid} = contentStore; + doDspTaskReferenceOpt({ + dotype:'workflow', + method:'add', + prjid : prjid, + taskid:taskid, + requestid:ids, + ids:"" + },'req') + } + //删除流程 + deleteWorkFlow = ()=>{ + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,taskReqStore,prjid} = contentStore; + const {selectedRowKeys} = taskReqStore; + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83601,"您确认要删除选中的记录吗?"), + onOk() { + doDspTaskReferenceOpt({ + dotype:'workflow', + method:'del', + prjid : prjid, + taskid:taskid, + requestid:"", + ids:`${toJS(selectedRowKeys)}` + },'req') + }, + onCancel() { }, + }) + } + onOperatesClick(record,index,operate,flag){ + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + const {contentStore} = this.props; + const {doDspTaskReferenceOpt,taskid,taskReqStore,prjid} = contentStore; + if(fn != ""){ + if("onDelRelated"==fn){ //delete + Modal.confirm({ + title: getLabel(15172,"系统提示"), + content: getLabel(83600,"您确认要删除吗?"), + onOk() { + doDspTaskReferenceOpt({ + dotype:'workflow', + method:'del', + prjid : prjid, + taskid:taskid, + requestid:"", + ids:record.randomFieldId + },'req') + }, + onCancel() { }, + }) + } + } + } + +} + diff --git a/pc4mobx/prj/components/common/resourcePage.js b/pc4mobx/prj/components/common/resourcePage.js new file mode 100644 index 0000000..3839cea --- /dev/null +++ b/pc4mobx/prj/components/common/resourcePage.js @@ -0,0 +1,201 @@ + +import { observer } from "mobx-react"; +import React from 'react'; +import { toJS } from 'mobx'; +import {WeaAlertPage} from 'ecCom'; +import {WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; +import {Spin} from 'antd'; +import '../../style/resource.less'; +@observer +export default class resourcePage extends React.Component { + + constructor(props) { + super(props); + } + + render() { + const {contentStore} = this.props; + let {resourceInfo} = contentStore; + let resource = toJS(resourceInfo); + if (!resource.success) { + return ( +
+ ); + } + let Document, Workflow, Customer, Project, Task, Accessory, Capital; + //相关文档 + resource.docList && ( + Document = resource.docList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关流程 + resource.wfList && ( + Workflow = resource.wfList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关客戶 + resource.cusList && ( + Customer = resource.cusList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关項目 + resource.prjList && ( + Project = resource.prjList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关任务 + resource.taskList && ( + Task = resource.taskList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + //相关附件 + resource.accList && ( + Accessory = resource.accList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + //相关资产 + resource.cptList && ( + Capital = resource.cptList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + return (
    {((resource.docList && resource.docList.length !== 0) || (resource.wfList && resource.wfList.length !== 0) || + (resource.cusList && resource.cusList.length !== 0) || (resource.prjList && resource.prjList.length !== 0) || + (resource.taskList && resource.taskList.length !== 0) || (resource.accList && resource.accList.length !== 0)) ? ( +
    + { + (resource.docList && resource.docList.length !== 0) && ( +
    +
    + + {getLabel(857, '相关文档')} +
    + +
    + ) + } + + {(resource.wfList && resource.wfList.length !== 0) && ( +
    +
    + + {getLabel(1044, '相关流程')} +
    +
      + {Workflow} +
    +
    + )} + + + {(resource.accList && resource.accList.length !== 0) && ( +
    +
    + + {getLabel(22194, '相关附件')} +
    + +
    + )} + + {(resource.prjList && resource.prjList.length !== 0) && ( +
    +
    + + {getLabel(782, '相关项目')} +
    +
      + {Project} +
    +
    + )} + + {(resource.taskList && resource.taskList.length !== 0) && ( +
    +
    + + {getLabel(33414, '相关任务')} +
    +
      + {Task} +
    +
    + )} + + {(resource.cusList && resource.cusList.length !== 0) && ( +
    +
    + + {getLabel(783, '相关客户')} +
    +
      + {Customer} +
    +
    + )} + + {(resource.cptList && resource.cptList.length !== 0) && ( +
    +
    + + {getLabel(858, '相关资产')} +
    +
      + {Capital} +
    +
    + )} + + +
    ) : ( +
    + +
    {getLabel(83553, '暂无数据')}
    +
    +
    + )}
    ) + + } + + +} + diff --git a/pc4mobx/prj/components/common/sharePage.js b/pc4mobx/prj/components/common/sharePage.js new file mode 100644 index 0000000..0942d54 --- /dev/null +++ b/pc4mobx/prj/components/common/sharePage.js @@ -0,0 +1,622 @@ + +import {Button,Row,Col,Icon,message,Modal} from 'antd'; +import {WeaTab,WeaAuth,WeaAlertPage,WeaLocaleProvider } from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import {WeaTableNew} from 'comsMobx'; +import * as Apis from '../../apis/project'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class TaskShare extends React.Component { + constructor(props) { + super(props); + + + } + shareCondition = [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharetype" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(21956, "对象类型"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(179, "人力资源") + }, { + "key": "5", + "selected": false, + "showname": getLabel(141, "分部") + }, { + "key": "2", + "selected": false, + "showname": getLabel(124, "部门") + }, { + "key": "11", + "selected": false, + "showname": getLabel(6086, "岗位") + }, { + "key": "3", + "selected": false, + "showname": getLabel(122, "角色") + }, { + "key": "4", + "selected": false, + "showname": getLabel(1340, "所有人") + } + ], + "viewAttr": 2 + }, { + "2": [[ + { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "57", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "relatedshareid" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(106, "对象"), + "labelcol": 6, + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "INPUT_INTERVAL", + "needDefaultValue":false, + "domkey": [ + "seclevel", + "seclevelMax" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(683, "安全级别"), + "labelcol": 6, + "value": [ + 0, + '' + ], + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ], + "5": [[ + { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "194", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "relatedshareid" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(106, "对象"), + "labelcol": 6, + "value": 3, + "viewAttr": 2 + } + ], [ + { + "colSpan": 2, + "conditionType": "INPUT_INTERVAL", + "needDefaultValue":false, + "domkey": [ + "seclevel", + "seclevelMax" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(683, "安全级别"), + "labelcol": 6, + "value": [ + 0, + '' + ], + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ], + "1": [[ + { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "17", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "relatedshareid" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(106, "对象"), + "labelcol": 6, + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ], + "11": [[ + { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "278", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "relatedshareid" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(106, "对象"), + "labelcol": 6, + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT_LINKAGE", + "domkey": [ + "joblevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(28169, "岗位级别"), + "labelcol": 6, + "options": [ + { + "key": "0", + "selected": true, + "showname": getLabel(140, "总部") + }, { + "key": "2", + "selected": false, + "showname": getLabel(19437, "指定分部") + }, { + "key": "1", + "selected": false, + "showname": getLabel(19438, "指定部门") + } + ], + "selectLinkageDatas": { + "1": { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "57", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "jobtitledepartment" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": "", + "labelcol": 6, + "viewAttr": 3 + }, + "2": { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "194", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "jobtitlesubcompany" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": "", + "labelcol": 6, + "viewAttr": 3 + } + }, + "viewAttr": 2 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ], + "4": [[ + { + "colSpan": 2, + "conditionType": "INPUT_INTERVAL", + "needDefaultValue":false, + "domkey": [ + "seclevel", + "seclevelMax" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(683, "安全级别"), + "labelcol": 6, + "value": [ + 0, + '' + ], + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ], + "3": [[ + { + "browserConditionParam": { + "completeParams": {}, + "conditionDataParams": {}, + "dataParams": {}, + "destDataParams": {}, + "hasAddBtn": false, + "hasAdvanceSerach": true, + "idSeparator": ",", + "isAutoComplete": 1, + "isDetail": 0, + "isMultCheckbox": false, + "isSingle": false, + "pageSize": 10, + "quickSearchName": "", + "type": "65", + "viewAttr": 3 + }, + "colSpan": 2, + "conditionType": "BROWSER", + "domkey": [ + "relatedshareid" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(106, "对象"), + "labelcol": 6, + "viewAttr": 3 + }, { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "rolelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(139, "级别"), + "labelcol": 6, + "options": [ + { + "key": "0", + "selected": true, + "showname": getLabel(124, "部门") + }, { + "key": "1", + "selected": false, + "showname": getLabel(141, "分部") + }, { + "key": "2", + "selected": false, + "showname": getLabel(140, "总部") + } + ], + "viewAttr": 2 + } + ], [ + { + "colSpan": 2, + "conditionType": "INPUT_INTERVAL", + "needDefaultValue":false, + "domkey": [ + "seclevel", + "seclevelMax" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(683, "安全级别"), + "labelcol": 6, + "value": [ + 0, + '' + ], + "viewAttr": 3 + } + ], [ + { + "colSpan": 2, + "conditionType": "SELECT", + "domkey": [ + "sharelevel" + ], + "fieldcol": 18, + "isQuickSearch": false, + "label": getLabel(385, "权限"), + "labelcol": 6, + "options": [ + { + "key": "1", + "selected": true, + "showname": getLabel(33564, "查看") + }, { + "key": "2", + "selected": false, + "showname": getLabel(93, "编辑") + } + ], + "viewAttr": 2 + } + ] + ] + } +]; + componentDidMount(){ + Apis.getDetachable().then(data=>{ + if(data.appDetachDisableAll){//禁用所有人选项 + let temp =this.shareCondition[0]; + temp.options.splice(5,1); + this.shareCondition[0] = temp ; + } + }); + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const {contentStore:{shareTableStore,isShowShare,showAddShareModal,shareRight:{hasRight,verified}},contentStore,title} = this.props; + + if (verified && !hasRight) { + return ( +
    + {getLabel(2012,"对不起,您暂时没有权限!")} +
    +
    + ) + } + if (verified && hasRight) { + return ( +
    + + { + contentStore.addShare(v); + showAddShareModal(false); + }} + onCancel={() => { + showAddShareModal(false); + }} + /> +
    ) + } + return
    + } + + onOperatesClick=(record,index,operate,flag)=>{ + const {contentStore} = this.props; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + let that = this; + if(fn != ""){ + if('onDel' == fn){ //删除 + contentStore.delBatchShare(record.id); + } + } + } +} + diff --git a/pc4mobx/prj/components/common/stageList.js b/pc4mobx/prj/components/common/stageList.js new file mode 100644 index 0000000..841cacd --- /dev/null +++ b/pc4mobx/prj/components/common/stageList.js @@ -0,0 +1,47 @@ + +import { observer } from "mobx-react"; +import React from 'react'; +import { WeaTableEdit } from 'ecCom'; +import { toJS } from 'mobx'; +@observer +export default class StageList extends React.Component { + + constructor(props) { + super(props); + } + + render() { + const { contentStore } = this.props; + const { stageInfo : { stageColumns, stageColumnDatas, selectedDatas, selectedRowKeys,canedit }, onRowSelect, onChange } = contentStore; + return ( +
    + {stageColumns && stageColumns.length>0 && {this.tableEdit = el}} + />} +
    ) + + } + + getRowSelection = (rowSelection) => { + const { contentStore } = this.props; + const { stageInfo : { canedit }} = contentStore; + let sel = { ...rowSelection }; + sel.getCheckboxProps = (record) => { + return { disabled: record.candel == false }; + } + return canedit ? sel:null; + } + +} + diff --git a/pc4mobx/prj/components/common/tabComponent.js b/pc4mobx/prj/components/common/tabComponent.js new file mode 100644 index 0000000..487b8cf --- /dev/null +++ b/pc4mobx/prj/components/common/tabComponent.js @@ -0,0 +1,45 @@ +/* + * @Author: lusx + * @Date: 2020-04-22 11:11:59 + * @Last Modified by: lusx + * @Last Modified time: 2020-04-22 11:35:08 + */ + +import { observer } from "mobx-react"; +import { WeaTab, WeaLocaleProvider } from 'ecCom'; +import { Button } from 'antd'; +import { Condition } from '../list/listCondition'; +const getLabel = WeaLocaleProvider.getLabel; +@observer +class TabComponent extends React.Component { + render() { + const { contentStore, account } = this.props; + const { showSearchAd, tasksubform } = contentStore; + const formParams = tasksubform.getFormParams() || {}; + return ( + { contentStore.setShowSearchAd(bool) }} + hideSearchAd={() => contentStore.setShowSearchAd(false)} + searchsAd={ +
    + } + showSearchAd={showSearchAd} + onSearch={v => { contentStore.getTaskSubList() }} + onSearchChange={v => { contentStore.setFormFields({ taskname: { value: v } }) }} + /> + ) + } + getAdButtons = () => { + const { contentStore } = this.props; + const { getTaskSubList, setShowSearchAd, clearFormFields } = contentStore; + return [ + (), + (), + () + ]; + } +} +export { TabComponent } \ No newline at end of file diff --git a/pc4mobx/prj/components/common/taskInfo.js b/pc4mobx/prj/components/common/taskInfo.js new file mode 100644 index 0000000..909aa4f --- /dev/null +++ b/pc4mobx/prj/components/common/taskInfo.js @@ -0,0 +1,478 @@ +import { WeaSearchGroup, WeaFormItem, WeaDatePicker, WeaTimePicker, WeaTools, WeaAlertPage, WeaUpload, WeaProgress, WeaRichText, WeaLocaleProvider, WeaInputEncrypt } from 'ecCom'; +import { Button, Row, Col, InputNumber, Modal, message } from 'antd'; +import { toJS } from "mobx" +import { WeaSwitch } from "comsMobx" +import { inject, observer } from 'mobx-react'; +import PrjDateTime from '../comp/prj-data-time' +import { datediff } from '../../util/index' +import { isUndefined } from 'util'; +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; +const view_basicToolBar = { + uploadUrl: (window.ecologyContentPath || '')+"/api/blog/fileupload/uploadimage", + startupFocus: false, + toolbar: [], +}; + +const basicToolBar = { + uploadUrl: (window.ecologyContentPath || '')+"/api/blog/fileupload/uploadimage", + startupFocus: false, + toolbar: [ + { name: 'markdown', items: ['Markdown'] }, + { name: 'document', items: ['Source', '-', 'Save', 'NewPage', 'Preview', '-', 'Templates'] }, + { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] }, + { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat'] }, + { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] }, + { name: 'colors', items: ['TextColor', 'BGColor'] }, + { name: 'tools', items: ['Maximize', 'ShowBlocks'] }, + { name: 'insert', items: ['Image', 'Table', 'Smiley'] } + ], +}; + +@observer +export default class TaskInfo extends React.Component { + + constructor(props) { + super(props); + this.state = { + stageVisiable : 3 + } + } + + render() { + const { taskInfo, setFormFields, setValidate, fieldinfo, isTimeShow } = this.props.listStore; + const { form } = this.props; + const { isFormInit } = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && fieldinfo.map((c,i) => { + let items = []; + c.items.map(fields => { + let hide = false; + let dom; + let hasunderline = false; + //只读样式控制 + let stylecss = { 'margin-right': '5px', 'margin-top': '6px' }; + if (fields.viewAttr == "1" || (fields.conditionType == "BROWSER" && fields.browserConditionParam.viewAttr == "1")) { + hasunderline = true; + stylecss = { 'margin-right': '5px', 'margin-top': '16px' }; + } + if (fields.domkey[0] == "begindate") { + dom = + + { setFormFields({ begindate__begintime: { value: v } }); this.workdayComputed(v, "begin") }} /> + + + } else if (fields.domkey[0] == "enddate") { + dom = + + { + if (taskInfo.maxSubTaskEndDate == "" || typeof (taskInfo.maxSubTaskEndDate) == "undefined") { + setFormFields({ enddate__endtime: { value: v } }); + this.workdayComputed(v, "end") + } else { + if (new Date(v[0]) < new Date(taskInfo.maxSubTaskEndDate)) { + // Modal.warning({ + // title: getLabel(83887, "任务完成的最后时间小于其子任务完成的最后时间!"), + // content: "" + // }); + message.error(getLabel(83887, "任务完成的最后时间小于其子任务完成的最后时间!")); + setFormFields({ enddate__endtime: { value: [taskInfo.maxSubTaskEndDate, formParams.endtime] } }); + this.workdayComputed([taskInfo.maxSubTaskEndDate, formParams.endtime], "end") + } else { + setFormFields({ enddate__endtime: { value: v } }); + this.workdayComputed(v, "end") + } + } + }} /> + + + } else if (fields.domkey[0] == "actualbegindate") { + dom = + + { setFormFields({ actualbegindate__actualbegintime: { value: v } }); this.onActualComputed(v, "begin") }} /> + + + } else if (fields.domkey[0] == "actualenddate") { + dom = + + { setFormFields({ actualenddate__actualendtime: { value: v } }); this.onActualComputed(v, "end") }} /> + + + } else if (fields.domkey[0] == "finish") { + if (fields.viewAttr == "1") { + dom = + + + {fields.befSpan || ""} + + } else { + dom = + + { this.checkProgress(v); }} /> + % + + + } + } else if (fields.conditionType == "RICHTEXT") { //多行文本 + if(fields.viewAttr == "1"){ + dom = WeaTools.EncryBase.desensitization(fields.value)? : +
    ; + }else{ + dom = + } + } else if (fields.domkey[0] == "accessory") { + let domkey = fields.domkey[0]; + dom = + + { this.endDateComputed(v) }} />; + } else if (fields.domkey[0] == "realmandays") { + dom = { this.endActualDateComputed(v) }} />; + } else if (fields.domkey[0] == "parentid") { + dom = { this.onParentChange(v) }} />; + }else { + dom = ; + } + if (hasunderline) { + items.push({ + com: ( + {dom} + ), + colSpan: 1, + hide: hide + }); + } else { + items.push({ + com: ( + {dom} + ), + colSpan: 1, + hide: hide + }); + } + + }); + group.push() + }); + return group; + } + + workdayComputed = (arg, type) => { + const { setFormFields, taskInfo: { passnoworktime, userid }, isTimeShow } = this.props.listStore; + const { form } = this.props; + const formParams = form.getFormParams() || {}; + let res = ""; + if (type == "begin") { + if (arg[0] && formParams.enddate) { + res = datediff(arg[0], formParams.enddate, isTimeShow=='1'?arg[1] || "00:00":"00:00", isTimeShow=='1'?formParams.endtime || "23:59":"23:59", userid, passnoworktime); + } + } else { + if (arg[0] && formParams.begindate) { + res = datediff(formParams.begindate, arg[0], isTimeShow=='1'?formParams.begintime || "00:00":"00:00", isTimeShow=='1'?arg[1] || "23:59":"23:59", userid, passnoworktime); + } + } + setFormFields({ workday: { value: res } }); + } + + onActualComputed = (arg, type) => { //maxSubTaskEndDate + const { setFormFields, taskInfo: { passnoworktime, userid }, isTimeShow } = this.props.listStore; + const { form } = this.props; + const formParams = form.getFormParams() || {}; + let res = "0"; + if (type == "begin") { + if (arg[0] && formParams.actualenddate) { + res = datediff(arg[0], formParams.actualenddate, isTimeShow=='1'?arg[1] || "00:00":"00:00", isTimeShow=='1'?formParams.actualendtime || "23:59":"23:59", userid, passnoworktime); + } + } else { + if (arg[0] && formParams.actualbegindate) { + res = datediff(formParams.actualbegindate, arg[0], isTimeShow=='1'?formParams.actualbegintime || "00:00":"00:00", isTimeShow=='1'?arg[1] || "23:59":"23:59", userid, passnoworktime); + } + } + setFormFields({ realmandays: { value: res } }) + } + + endDateComputed = (value) => { + const { setFormFields, taskInfo: { passnoworktime, userid } } = this.props.listStore; + const { form } = this.props; + const formParams = form.getFormParams() || {}; + + let b = typeof (formParams.begindate) == "undefined" ? "" : formParams.begindate; + let e = typeof (formParams.enddate) == "undefined" ? "" : formParams.enddate; + let w = typeof (formParams.workday) == "undefined" ? "" : formParams.workday; + let bt = typeof (formParams.begintime) == "undefined" ? "" : formParams.begintime; + let et = typeof (formParams.endtime) == "undefined" ? "" : formParams.endtime; + let res = ""; + let alldate = ""; + if (bt == "") { + bt = "00:00"; + } + if (et == "") { + et = "23:59"; + } + + if (w == "" && b != "" && e != "") { + setFormFields({ enddate: { value: "" } }) + } else if (w != "" && ((b != "" && e != "") || (b != "" && e == ""))) { + if (w > 0) { + if (passnoworktime != "1") { + + alldate = this.addEndDate(b, w, bt); + } else { + + $.ajax({ + type: "post", + url: "/proj/process/GetDateByWorkLong.jsp", + data: "method=getEndDate&workLong=" + w + "&begindate=" + b + "&begintime=" + bt + "&manager=" + userid, + dataType: "text", + async: false, + success: function (data) { + alldate = data.trim(); + } + }); + } + if(alldate == 'error'){ + message.error(getLabel(84409, "一般工作时间未设置,请告知管理员!")); + setFormFields({ enddate__endtime: { value: [] } }) + }else{ + let tmpesp = alldate.split(" "); + setFormFields({ enddate__endtime: { value: [tmpesp[0], tmpesp[1]] } }) + } + } else { + setFormFields({ workday: { value: "" }, enddate__endtime: { value: [] } }) + } + + } else if (w != "" && b == "" && e != "") { + if (w > 0) { + if (passnoworktime != "1") { + + alldate = this.addBeginDate(e, -(w), et); + } else { + $.ajax({ + type: "post", + url: "/proj/process/GetDateByWorkLong.jsp", + data: "method=getBeginDate&workLong=" + w + "&enddate=" + e + "&endtime=" + et + "&manager=" + userid, + dataType: "text", + async: false, + success: function (data) { + alldate = data.trim(); + } + }); + } + if(alldate == 'error'){ + message.error(getLabel(84409, "一般工作时间未设置,请告知管理员!")); + setFormFields({ enddate__endtime: { value: [] } }) + }else{ + let tmpesp = alldate.split(" "); + setFormFields({ enddate__endtime: { value: [tmpesp[0], tmpesp[1]] } }) + } + } else { + setFormFields({ workday: { value: "" }, begindate__begintime: { value: [] } }) + } + + } + } + + endActualDateComputed = (value) => { + const { setFormFields, taskInfo: { passnoworktime, userid } } = this.props.listStore; + const { form } = this.props; + const formParams = form.getFormParams() || {}; + + let b = typeof (formParams.actualbegindate) == "undefined" ? "" : formParams.actualbegindate; + let e = typeof (formParams.actualenddate) == "undefined" ? "" : formParams.actualenddate; + let w = typeof (formParams.realmandays) == "undefined" ? "" : formParams.realmandays; + let bt = typeof (formParams.actualbegintime) == "undefined" ? "" : formParams.actualbegintime; + let et = typeof (formParams.actualendtime) == "undefined" ? "" : formParams.actualendtime; + let res = ""; + let alldate = ""; + if (bt == "") { + bt = "00:00"; + } + if (et == "") { + et = "23:59"; + } + + if (w == "" && b != "" && e != "") { + setFormFields({ actualenddate: { value: "" } }) + } else if (w != "" && ((b != "" && e != "") || (b != "" && e == ""))) { + if (w > 0) { + if (passnoworktime != "1") { + + alldate = this.addEndDate(b, w, bt); + } else { + + $.ajax({ + type: "post", + url: "/proj/process/GetDateByWorkLong.jsp", + data: "method=getEndDate&workLong=" + w + "&begindate=" + b + "&begintime=" + bt + "&manager=" + userid, + dataType: "text", + async: false, + success: function (data) { + alldate = data.trim(); + } + }); + } + if(alldate == 'error'){ + message.error(getLabel(84409, "一般工作时间未设置,请告知管理员!")); + setFormFields({ actualenddate__actualendtime: { value: [] } }) + }else{ + let tmpesp = alldate.split(" "); + setFormFields({ actualenddate__actualendtime: { value: [tmpesp[0], tmpesp[1]] } }) + } + } else { + setFormFields({ realmandays: { value: "" }, actualenddate__actualendtime: { value: [] } }) + } + + } else if (w != "" && b == "" && e != "") { + if (w > 0) { + if (passnoworktime != "1") { + + alldate = this.addBeginDate(e, -(w), et); + } else { + $.ajax({ + type: "post", + url: "/proj/process/GetDateByWorkLong.jsp", + data: "method=getBeginDate&workLong=" + w + "&enddate=" + e + "&endtime=" + et + "&manager=" + userid, + dataType: "text", + async: false, + success: function (data) { + alldate = data.trim(); + } + }); + } + if(alldate == 'error'){ + message.error(getLabel(84409, "一般工作时间未设置,请告知管理员!")); + setFormFields({ actualenddate__actualendtime: { value: [] } }) + }else{ + let tmpesp = alldate.split(" "); + setFormFields({ actualenddate__actualendtime: { value: [tmpesp[0], tmpesp[1]] } }) + } + } else { + setFormFields({ realmandays: { value: "" }, actualenddate__actualendtime: { value: [] } }) + } + + } + } + + addBeginDate = (dd, dadd, bt) => { + let arr = dd.split("-"); + let btt = bt.split(":"); + let a = new Date(arr[0], arr[1] - 1, arr[2], btt[0], btt[1]).valueOf(); + a = (a + dadd * 24 * 60 * 60 * 1000) + 60 * 1000; + a = new Date(a); + return this.format(a); + } + + + addEndDate = (dd, dadd, bt) => { + let arr = dd.split("-"); + let btt = bt.split(":"); + let a = new Date(arr[0], arr[1] - 1, arr[2], btt[0], btt[1]).valueOf(); + a = (a + dadd * 24 * 60 * 60 * 1000) - 60 * 1000; + a = new Date(a); + return this.format(a); + } + + format = (date) => { + let o = { + "M+": date.getMonth() + 1, //month + "d+": date.getDate(), //day + "h+": date.getHours(), //hour + "m+": date.getMinutes(), //minute + "s+": date.getSeconds(), //second + "q+": Math.floor((date.getMonth() + 3) / 3), //quarter + "S": date.getMilliseconds() //millisecond + } + let format = "yyyy-MM-dd hh:mm"; + if (/(y+)/.test(format)) format = format.replace(RegExp.$1, + (date.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in o) if (new RegExp("(" + k + ")").test(format)) + format = format.replace(RegExp.$1, + RegExp.$1.length == 1 ? o[k] : + ("00" + o[k]).substr(("" + o[k]).length)); + return format; + } + + checkProgress = (value) => { //进度编辑校验 + const { taskInfo, setFormFields } = this.props.listStore; + if (Number(taskInfo.finishmax) == 99) { + if (value > 99) { + // Modal.warning({ + // title: getLabel(383829, "该任务所必须的相关文档或者相关流程不存在,任务不能完成100%。"), + // content: '', + // }); + message.error(getLabel(383829, "该任务所必须的相关文档或者相关流程不存在,任务不能完成100%。")); + setFormFields({ finish: { value: 99 } }); + } else { + setFormFields({ finish: { value: value } }); + } + } else { + if (value > 100) { + setFormFields({ finish: { value: 100 } }); + } else { + setFormFields({ finish: { value: value } }); + } + } + } + + onParentChange = (obj) => { + const { resetStage } = this.props.listStore; + if(obj.parentid.value != ""){ + resetStage({viewAttr : 1},obj.parentid.value); + }else{ + resetStage({viewAttr : 3}); + } + + } +} + diff --git a/pc4mobx/prj/components/common/taskSub.js b/pc4mobx/prj/components/common/taskSub.js new file mode 100644 index 0000000..07baf2a --- /dev/null +++ b/pc4mobx/prj/components/common/taskSub.js @@ -0,0 +1,181 @@ + +import { Button, Row, Col, Icon, message, Modal } from 'antd'; +import { WeaTab, WeaProgress, WeaLocaleProvider } from 'ecCom'; +import { inject, observer } from "mobx-react"; +import { toJS } from 'mobx'; +// import { Condition } from '../list/listCondition'; +import { WeaTableNew } from 'comsMobx'; +import ShareDialog from '../dialog/shareDialog' +import ExchangeDialog from '../dialog/exchangeDialog' +import TaskInfoDialog from '../dialog/taskDialog' +import ModifyLogDialog from "../dialog/modifyLogDialog" +import { TabComponent as TabSelf } from './tabComponent'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class TaskSub extends React.Component { + constructor(props) { + super(props); + this.state = { + taskid: "", + coWorkVisiable: false, + workPlanVisible: false + } + + } + componentDidMount(){ + + if(!window.weaWorkplan && !window.weaCowork){ + eventRegister.loadModule('f_workplan', ()=> { + eventRegister.loadModule('f_cowork', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载日程模块失败,请联系系统管理员!"); + }); + return; + } + if(window.weaWorkplan && !window.weaCowork){ + eventRegister.loadModule('f_cowork', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + }else{ + eventRegister.loadModule('f_workplan', ()=> { + }, ()=> { + // 加载文件失败 的业务处理, 网络超时,没文件之类 + alert("加载协作模块失败,请联系系统管理员!"); + }); + } + + } + componentWillReceiveProps(nextProps) { + + } + render() { + const { contentStore, account, showTab = true, callBack } = this.props; + const { showSearchAd, taskSubStore, tasksubform, exchangeStore, taskInfoStore, logVisible, logTableStore, reLoad, prjid } = contentStore; + const formParams = tasksubform.getFormParams() || {}; + return ( +
    + {showTab && } + reLoad(taskSubStore)} + getColumns={c => this.reRenderColumns(c)} + onOperatesClick={this.onOperatesClick.bind(this)} + /> + + + + + {window.weaCowork && window.weaCowork.com && window.weaCowork.com.CreateCowork && this.state.coWorkVisiable && this.state.taskid !== "" && ( + { + this.setState({ + coWorkVisiable: false + }); + }} + />) + } + + { + window.weaWorkplan && window.weaWorkplan.com && window.weaWorkplan.com.WorkPlanCreate && + ( { this.setWorkPlanVisible(false); }}//关闭回调 + onlyClose={() => { this.setWorkPlanVisible(false) }}//关闭回调,只做关闭操作 + workPlanId={""} //日程id,1查看日程时用到 + createConditionParams={[]}//创建的默认值日期和时间,没有传[] + activeKey={""} //查看页面显示的面板1是基本信息,7是相关交流 + //{(key) => { }}//查看页面切换面板的回调 + selectUser={account && account.userid}//新建日程的创建人id + workPlanTypeOptions={"2"}//客户模块的新建日程,普通新建传'',客户新建传3 + crmIDs={[]}//通过客户模块新建日程,并自动带出相关客户,[{'id':'','name':''}] + projectid={prjid} + taskid={this.state.taskid} + description={""}//客户模块需求,支持新建时传入的'基本信息-内容' + />) + } +
    ) + } + + // getAdButtons = () => { + // const {contentStore} = this.props; + // const {getTaskSubList,setShowSearchAd,clearFormFields} = contentStore; + // return [ + // (), + // (), + // () + // ]; + // } + reRenderColumns(columns) { + columns.forEach((c,i) => { + if (c.dataIndex == 'finish') { + c.render = function (text, record) { + return + + + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + onOperatesClick(record,index,operate,flag){ + const {contentStore:{shareStore,exchangeStore,taskInfoStore,viewModifyLog},callBack} = this.props; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + let that = this; + // saveCapitalId(record.randomFieldId); //保存资产id + if(fn != ""){ + if("onShare"==fn){ //共享 + shareStore.handleShareDialog(true,"task",record.randomFieldId,{}) + }else if('onNewCowork' == fn){ //新建协作 + this.setState({ taskid: record.randomFieldId, coWorkVisiable: true }); + const coworkStoreMap = window.weaCowork.store && window.weaCowork.store.coworkStoreMap; + const cowortore = coworkStoreMap && coworkStoreMap.getMapStore(3); + cowortore && cowortore.setCreateState({ showNewCowork: true, createOrEdit: 0 }); + }else if('onNewWorkplan' == fn){ //新建日程 + this.setState({ taskid: record.randomFieldId, workPlanVisible: true }); + }else if('onApprove' == fn){ // + + }else if('onReject' == fn){ // + + }else if('onEdit' == fn){ //编辑 + taskInfoStore.handleDialog(true,"edit",record.randomFieldId); + }else if('onLog' == fn){ //修改记录 + viewModifyLog(record.randomFieldId); + this.refs.modifyLogDialog.setVisible(true); + }else if('onDiscuss' == fn){ //相关交流 + exchangeStore.handleExchangeDialog(true,"task",record.randomFieldId,{}) + }else if('onDel' == fn){ //删除 + taskInfoStore.delTask("del",record.randomFieldId,callBack); + } + } + } + + setWorkPlanVisible = (bool) => { + this.setState({ workPlanVisible: bool }) + } +} + diff --git a/pc4mobx/prj/components/common/wbsFieldSet.js b/pc4mobx/prj/components/common/wbsFieldSet.js new file mode 100644 index 0000000..91f5371 --- /dev/null +++ b/pc4mobx/prj/components/common/wbsFieldSet.js @@ -0,0 +1,62 @@ +import { WeaSearchGroup, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaTableEditable, WeaSelect } from 'ecCom'; +import { Row, Col } from 'antd'; +import { toJS } from "mobx" +import { WeaSwitch } from "comsMobx" +import { observer } from 'mobx-react'; +import WeaPrjFieldSetTableEdit from "../comp/weaPrjFieldSetTableEdit"; + +const getLabel = WeaLocaleProvider.getLabel; + +@observer +export default class WbsFieldSet extends React.Component { + constructor(props) { + super(props); + } + + getCircle() { + let style = { + height: 30, + textAlign: 'center', + } + return style; + } + render() { + const { wbsStore } = this.props; + const { columns,columnDatas} = this.props.wbsStore; + return (
    + {this.wbsFieldSet = el}} + rowKey={"groupid"} + needAdd={true} + needCopy={false} + onRowSelect={this.onRowSelect} + getRowSelection={this.getRowSelection} + /> +
    ); + } + + onRowSelect = (selectedKey) => { + const {wbsStore} = this.props; + wbsStore.setSelectRowKeys(selectedKey); + } + + onChange=(datas)=>{ + const {wbsStore} = this.props; + const {setColumnDatas} = wbsStore; + setColumnDatas(datas); + } + + getRowSelection = (rowSelection) => { + let sel = { ...rowSelection }; + sel.getCheckboxProps = (record) => { + return { disabled: record.canDel == 'n' }; + } + return sel; + } + +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/Prjschedule/dailyPaper.js b/pc4mobx/prj/components/comp/Prjschedule/dailyPaper.js new file mode 100644 index 0000000..942d72e --- /dev/null +++ b/pc4mobx/prj/components/comp/Prjschedule/dailyPaper.js @@ -0,0 +1,143 @@ +import React from 'react'; +import { Row,Col } from 'antd'; +import {WeaNewScroll } from "ecCom" +import classnames from 'classnames'; +import './style/index.less'; + +class DailyPaper extends React.Component { + static defaultProps = { + stageGroups:[ + { + key:"0", + name:"全部", + }, + { + key:"1", + name:"立项", + }, + { + key:"2", + name:"搭建中", + }, + { + key:"3", + name:"验收中", + }, + { + key:"4", + name:"维护中", + }, + ], + selectGroupTypeKey:"0" + } + constructor(props){ + super(props); + this.state={ + + } + } + renderTitleGroup(stageGroups){ + const {selectGroupTypeKey="0"} = this.props; + let btnArr = []; + stageGroups && stageGroups.map((group)=>{ + let isSelect = ""; + if(selectGroupTypeKey == group.key) { + isSelect = "selected"; + } + btnArr.push( + {this.changeTypeGroup(group.key)}} className={isSelect} > + {group.name} + + ) + }) + return btnArr + } + changeTypeGroup=(key)=>{ + + } + + render() { + const { stageGroups } = this.props; + + return ( +
    +
    + + + 阶段 : + {stageGroups && this.renderTitleGroup(stageGroups)} + + +
    + +
    + + +
    +
    +
    + 张三 泛微上海大区/EBU上海一部 + 回复评论 +
    +
    2017/02/05 14:22
    +
    +
    项目:上海投资咨询公司(二次开发合同)2012 当前阶段: 立项 当前任务:需求调研
    +
    预计十一之后收取第三笔款,现场调研确认,需求变更与新增工作量
    +
    相关文档:人力资源模块调研文档(v1)
    +
    +
    + +
    + + +
    +
    +
    + 张三 泛微上海大区/EBU上海一部 + +
    +
    2017/02/05 14:22
    +
    +
    项目:上海投资咨询公司(二次开发合同)2012 当前阶段: 立项 当前任务:需求调研
    +
    预计十一之后收取第三笔款,现场调研确认,需求变更与新增工作量
    +
    +
    + +
    + + +
    +
    +
    + 张三 泛微上海大区/EBU上海一部 + +
    +
    2017/02/05 14:22
    +
    +
    项目:上海投资咨询公司(二次开发合同)2012 当前阶段: 立项 当前任务:需求调研
    +
    预计十一之后收取第三笔款,现场调研确认,需求变更与新增工作量
    +
    +
    +
    李四 2017/05/02 14:55
    +
    ok!!!
    +
    +
    +
    王五 2017/05/02 16:55
    +
    没问题。
    +
    +
    +
    +
    + +
    +
    +
    +
    + ) + } +} + +export default DailyPaper \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/Prjschedule/index.js b/pc4mobx/prj/components/comp/Prjschedule/index.js new file mode 100644 index 0000000..4225902 --- /dev/null +++ b/pc4mobx/prj/components/comp/Prjschedule/index.js @@ -0,0 +1,3 @@ +import DailyPaper from './dailyPaper' + +export default DailyPaper \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/Prjschedule/style/index.less b/pc4mobx/prj/components/comp/Prjschedule/style/index.less new file mode 100644 index 0000000..54bcd2d --- /dev/null +++ b/pc4mobx/prj/components/comp/Prjschedule/style/index.less @@ -0,0 +1,79 @@ +.project-paper{ + height: 100%; + color: #494949; + .project-paper-header .ant-row{ + margin: 15px 10px; + border: 2px solid #eaeaea; + height: 35px; + line-height: 35px; + border-radius: 5px; + .header-left{ + display: inline-block; + width: 100px; + text-align: center; + background-color: #ececec; + height: 31px; + border-right: 2px solid #eaeaea; + } + .header-right span{ + display: inline-block; + height: 31px; + line-height: 31px; + margin-left: 20px; + } + .header-right .selected{ + color: #2A7CBC + } + } + .project-paper-body .ant-row{ + margin: 10px 10px; + .body-img{ + width: 50px; + height: 50px; + border-radius: 100%; + background-color: #e9e9e9; + float: left; + } + .body-right{ + margin-left: 60px; + border-bottom: 2px solid #eaeaea; + padding-bottom: 10px; + .body-right-title { + height: 25px; + line-height: 25px; + font-weight: 700; + .body-right-title-right{ + float: right; + margin-right: 10px; + color: #2A7CBC; + } + } + .body-right-time{ + color: #999; + margin-bottom: 8px; + } + .body-right-content{ + .project-name{ + color: #2A7CBC; + font-weight: 700; + } + .body-right-content-h{ + line-height: 22px; + } + // .body-right-content-reply,.body-right-content-link{ + + // } + .body-right-content-reply-reply{ + background: #ececec; + border-radius: 4px; + margin: 5px; + .reply-container{ + padding: 5px 15px 5px; + } + } + } + } + + + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/extend-dialog/index.js b/pc4mobx/prj/components/comp/extend-dialog/index.js new file mode 100644 index 0000000..d2cf9a4 --- /dev/null +++ b/pc4mobx/prj/components/comp/extend-dialog/index.js @@ -0,0 +1,231 @@ +import { Modal,Row, Col, Button,Icon,Menu,} from 'antd'; +import {Dropdown} from 'mode-coms' +import {WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; +const Item = Menu.Item +import isString from 'lodash/isString'; +import './style/index.css' + +class Main extends React.Component { + static defaultProps = { + style: {width: 520, height: 400}, + icon: 'icon-coms-ModelingEngine', + maskClosable: false, + closable: true, + title: 'Dialog', + iconBgcolor: '#2db7f5', + isallscreen:false, + hasMoreBtn:false + } + static contextTypes = { + router: React.PropTypes.routerShape + } + listenRouter(){ + this.context.router.listen(nextState => { + const { path } = this.state; + const { pathname } = nextState; + if(path !== pathname){ + this._reactInternalInstance !== undefined && this.setState({path:pathname, visible:false}); + } + }) + } + constructor(props) { + super(props); + this.state = { + visible: false, + modalBody: '', + title: props.title || '', + url: props.url || '', + style: props.style, + icon: props.icon, + closable: props.closable, + buttons: props.buttons, + maskClosable: props.maskClosable, + iconBgcolor: props.iconBgcolor, + path: window.location.hash && window.location.hash.split('#/')[1].split('?')[0], + isallscreen:false, + hasMoreBtn:props.hasMoreBtn || false, + dropMenuDatas:props.dropMenuDatas || [], + showDrop:false + } + this.onCancel = this.onCancel.bind(this); + } + componentWillReceiveProps(nextProps){ + + + if (this.props.visible !== nextProps.visible || this.state.visible !== nextProps.visible) { + this.setState({visible: nextProps.visible}); + } + if (this.props.url !== nextProps.url) { + this.setState({url: nextProps.url}); + } + // if (!WeaTools.isEqual(this.props.style, nextProps.style)) { + // this.setState({style: nextProps.style}); + // } + if ('buttons' in this.props) { + this.setState({buttons: nextProps.buttons}); + } + if (this.props.title !== nextProps.title) { + this.setState({title: nextProps.title}); + } + // if (this.props.icon !== nextProps.icon) { + // this.setState({icon: nextProps.icon}); + // } + // if (this.props.iconBgcolor !== nextProps.iconBgcolor) { + // this.setState({iconBgcolor: nextProps.iconBgcolor}); + // } + } + shouldComponentUpdate(...args) { + return true + // return PureRenderMixin.shouldComponentUpdate.apply(this, args); + } + componentDidMount(){ + this.listenRouter(); + window.initExtendDialog = params => { + let state = {}; + if (params.style) { + state.style = params.style; + } + if (params.buttons) { + state.buttons = params.buttons; + } + if (params.url) { + state.url = params.url; + } + if (params.modalBody) { + state.modalBody = params.modalBody; + } + if (params.title) { + state.title = params.title; + } + if (params.icon) { + state.icon = params.icon; + } + if (params.closable !== undefined) { + state.closable = params.closable; + } + if (params.maskClosable !== undefined) { + state.maskClosable = params.maskClosable; + } + if (params.iconBgcolor) { + state.iconBgcolor = params.iconBgcolor; + } + if(params.hasMoreBtn){ + state.hasMoreBtn = params.hasMoreBtn + } + if(params.dropMenuDatas){ + state.dropMenuDatas = params.dropMenuDatas + } + this.setState(state); + } + window.showExtendDialog = () => { + this.setState({visible: true}); + } + window.closeExtendDialog = () => { + this.onCancel(); + } + } + onCancel() { + this.setState({visible: false}); + this.props.onCancel && this.props.onCancel(); + } + toAllScreen=()=>{ + const screenH = window.document.documentElement.clientHeight || window.body.clientHeight; + + this.setState({ + style:{width:"100%",height:screenH-100}, + isallscreen:true + }); + jQuery('.extend-dialog .ant-modal').addClass('extend-dialog-allscreen') + } + claseAllScreen=()=>{ + this.setState({ + style:this.props.style, + isallscreen:false + }); + jQuery('.extend-dialog .ant-modal').removeClass('extend-dialog-allscreen') + } + getFooterButtons(){ + const {buttons,dropMenuDatas,hasMoreBtn,showDrop} = this.state; + let newButtons = []; + const menu = dropMenuDatas ? + {if(typeof this.props.onDropMenuClick == 'function') this.props.onDropMenuClick(o.key)}}> + { + dropMenuDatas.map((d, i)=> { + return + {d.icon} + {d.content} + + })} + : ''; + if(hasMoreBtn){ + newButtons.push( + this.setState({showDrop:false})} style={{display:showDrop ? "block":"none"}}> +
    + {menu}
    + +
    ) + } + return [...buttons,...newButtons] + + } + render(){ + const {children, hideIcon = false} = this.props; + const {modalBody, visible, url, closable, style, maskClosable, buttons, title, icon, iconBgcolor,isallscreen,hasMoreBtn,dropMenuDatas} = this.state; + let titleEle = ( + + +
    + { + !hideIcon && +
    + +
    + } + {title} +
    + + +
    + { + isallscreen ? : + + } + +
    + +
    + ); + let body; + if (modalBody) { + body = modalBody; + if (isString(modalBody)) body =
    + } + + return ( + +
    + {children ? children : ''} + {body} + {url? + + : '' + } +
    +
    + ) + } +} +export default Main; \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/extend-dialog/style/index.css b/pc4mobx/prj/components/comp/extend-dialog/style/index.css new file mode 100644 index 0000000..77ead50 --- /dev/null +++ b/pc4mobx/prj/components/comp/extend-dialog/style/index.css @@ -0,0 +1,96 @@ +.extend-dialog iframe { + border: none; +} + +.extend-dialog .extend-dialog-header-icon{ + display: inline-block; + height: 48px; + width: 35px; + text-align: center +} +.extend-dialog .extend-dialog-header-icon:hover{ + color:#666 !important; +} +.extend-dialog-allscreen{ + top: 10 !important; + left: 0 !important; + padding-bottom: 0; + transform: translate(0px, 0px)!important; +} + +.extend-dialog .ant-modal-body { + padding: 0; +} + +.extend-dialog .ant-modal-content .ant-modal-header { + padding: 0; + background-color: #f9f9f9; +} + +.extend-dialog .ant-modal-footer button { + margin-left: 0; + margin-right: 10px; +} + +.extend-dialog .ant-modal-footer button:last-child { + margin-right: 0; +} + +.extend-dialog .ant-modal-footer button { + border-radius: 3px; +} + +.extend-dialog .extend-dialog-body { + position: relative; +} + +.extend-dialog .extend-dialog-menu{ + position: absolute; + bottom: 21px; + right: 0px; + max-width: 200px; + border: 1px solid #dadada; + box-shadow: 0 0 2px #dadada; + z-index: 1000; + box-sizing: border-box; +} +.extend-dialog-menu{ + background-color: #fff; +} +.extend-dialog-menu .ant-menu { + margin: 10px 0; + border: 0; + text-align: left; +} +.extend-dialog-menu .ant-menu .ant-menu-item-selected { + border: 0; + color: #000; +} +.extend-dialog-menu .ant-menu .ant-menu-item-active{ + background-color: #57c5f7; + color:#fff; +} + +.extend-dialog-menu .ant-menu .ant-menu-item { + height: 30px; + line-height: 30px; + padding: 0 8px 0 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.extend-dialog-menu .ant-menu .ant-menu-item .extend-dialog-menu-icon { + display: inline-block; + width: 36px; + margin-right: 6px; + text-align: center; +} +.extend-dialog-menu .extend-right-menu-icon-background{ + width: 36px; + height: 100%; + background-color: #f2f5f7; + position: absolute; + top: 0; + left: 0; + z-index: 0; +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/kanban/Draggable.js b/pc4mobx/prj/components/comp/kanban/Draggable.js new file mode 100644 index 0000000..3beb853 --- /dev/null +++ b/pc4mobx/prj/components/comp/kanban/Draggable.js @@ -0,0 +1,69 @@ +import React from 'react'; + + +export default class Draggable extends React.Component { + constructor(){ + super(); + this._timer ; + } + componentDidMount() { + let $this = $(this.refs._container) + let handle = $this.find(this.props.handle) + let isDrag = false; + // let _timer = + handle.mousedown((e1) => { + clearTimeout(this._timer) + + let startX = e1.clientX; + let startY = e1.clientY; + let offset = $this.offset(); + // isDrag = false; + // $this.css({ position: 'fixed', ...offset, width: $this.width(), height: $this.height() }); + this.props.onStart && this.props.onStart(e1, { $target: $this }, { position: 'fixed', ...offset, width: $this.width(), height: $this.height() }); + // this._timer = setTimeout(()=>{ + $(document).mousemove((e) => { + + let offsetX = e.clientX - startX; + let offsetY = e.clientY - startY; + // isDrag = true; + if (this.props.axis == 'x') { + // let offsetX = e.clientX - startX; + $this.css({ left: offset.left + offsetX }); + } else if (this.props.axis == 'y') { + // let offsetY = e.clientY - startY; + $this.css({ top: offset.top + offsetY }); + } else { + // let offsetX = e.clientX - startX; + // let offsetY = e.clientY - startY; + $this.css({ left: offset.left + offsetX, top: offset.top + offsetY, zIndex: 9999 }); + } + this.props.onDrag && this.props.onDrag({ target: this.refs._container }); + }).mouseup(() => { + $(document).unbind('mousemove'); + $(document).unbind('mouseup'); + this.props.onStop && this.props.onStop({ target: this.refs._container }); + $this.removeAttr("style"); + return false; + }) + // },200) + + //if (!isDrag) { + // this.props.onClick && this.props.onClick({ target: this.refs._container }); + // return false; + // } else { + // return false; + // } + + }); + } + render() { + return ( +
    + {this.props.children} +
    + ) + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/kanban/index.js b/pc4mobx/prj/components/comp/kanban/index.js new file mode 100644 index 0000000..6a7cf4f --- /dev/null +++ b/pc4mobx/prj/components/comp/kanban/index.js @@ -0,0 +1,413 @@ +import React from 'react' +import Draggable from './Draggable'; +import './index.less'; +import { Icon, Tooltip, Menu, Dropdown, Input } from 'antd'; + +export default class Main extends React.Component { + constructor(props) { + super(props) + this.state = { + columns: props.columns || [], + _columns: [], + key: 0, + newTask: { + name: '' + } + + } + this._columns = props.columns; + } + handleStart = (column, _, { $target }, targetOffset) => { + // let $columnplaceholder = $(this.refs._columnplaceholder); + // let $columnstore = $(this.refs._columnstore); + this._dragColumn = column; + this.offset = { width: $target.width(), height: $target.height(), ...$target.offset() }; + this.targetOffset = targetOffset; + const startAction = ($target, offset, placeoffset) => { + $target.css(offset); + let $columnplaceholder = $(this.refs._columnplaceholder); + let $columnstore = $(this.refs._columnstore); + $columnplaceholder.show().css(placeoffset) + $target.after($columnplaceholder).appendTo($columnstore); + }; + this.startAction = startAction.bind(this, $target, targetOffset, { width: $target.width(), height: $target.height(), ...$target.offset() }); + //this.startAction(); + + this.moving = true; + // $columnplaceholder.show().css({ width: $target.width(), height: $target.height(), ...$target.offset() }) + // $target.after($columnplaceholder).appendTo($columnstore); + } + handleMove = (e) => { + let $target = $(e.target); + const diffX = e.clientX - this.offset.left; + if (!this.moving || Math.abs(diffX) < 5) { + return; + } + $target.css(this.targetOffset); + let $columnplaceholder = $(this.refs._columnplaceholder); + let $columnstore = $(this.refs._columnstore); + $columnplaceholder.show().css(this.offset) + $target.after($columnplaceholder).appendTo($columnstore); + + + // this.startAction && this.startAction(); + + //let columnKey = e.columnKey; + let { left } = $target.offset(); + let width = $target.width(); + let children = $(this.refs._columns).children(); + let first = children.eq(0); + let { left: firstLeft } = $(first).offset(); + if (left < (firstLeft + width / 2)) { + first.children().appendTo($(this.refs._columnplaceholder).parent()) + first.append($(this.refs._columnplaceholder)); + this._columns = this.swapColumn(this._columns, 0, this.getIndex(this._columns, this._dragColumn)) + } else { + children.each((index, ele) => { + const { left: currentLeft } = $(ele).offset(); + if (left + width > currentLeft + width / 2 && left < currentLeft + width / 2) { + $(ele).children().appendTo($(this.refs._columnplaceholder).parent()) + $(ele).append($(this.refs._columnplaceholder)) + this._columns = this.swapColumn(this._columns, index, this.getIndex(this._columns, this._dragColumn)) + } + }) + } + } + getIndex = (columns, column) => { + for (let index = 0; index < columns.length; index++) { + if (columns[index].key == column.key) { + return index; + } + } + } + swrapColumnByKey = (columns, key1, key2) => { + let index1 = 0, index2 = 0; + for (let index = 0; index < columns.length; index++) { + if (columns[index].key == key1) { + index1 = index; + } + if (columns[index].key == key2) { + index2 == index; + } + } + return this.swapColumn(columns, index1, index2); + } + swapColumn = (columns, index1, index2) => { + let _columns = []; + for (let index = 0; index < columns.length; index++) { + if (index == index1) { + _columns.push(columns[index2]); + } else if (index == index2) { + _columns.push(columns[index1]); + } else { + _columns.push(columns[index]); + } + } + return _columns; + } + handleStop = () => { + $(this.refs._columnstore).empty(); + $(this.refs._columnplaceholder).removeAttr('style'); + $(this.refs._columnplaceholder).appendTo($(this.refs._columnstore).parent()); + this.setState({ columns: this._columns, key: this.state.key + 1 }); + this.moving = false; + } + + handleItemStart = (column, item, _, { $target }) => { + this._dragColumn = column; + this._dragItem = item; + this.itemMoving = true; + this.itemOffset = { width: $target.width(), height: $target.height(), ...$target.offset() }; + // let $itemplaceholder = $(this.refs._itemplaceholder); + // $itemplaceholder.show().css({ width: $target.width(), height: $target.height(), ...$target.offset() }) + // $target.after($itemplaceholder).appendTo($(this.refs._itemstore)); + } + handleItemMove = (e) => { + const { left, top } = $(e.target).offset(); + let $target = $(e.target); + const width = $(e.target).width(); + const height = $(e.target).height(); + const thisId = $(e.target).attr("id"); + const diffX = e.clientX - this.itemOffset.left; + if (!this.itemMoving || Math.abs(diffX) < 5) { + return; + } + let $itemplaceholder = $(this.refs._itemplaceholder); + $itemplaceholder.show().css(this.itemOffset); + $target.after($itemplaceholder).appendTo($(this.refs._itemstore)); + + $("[id^=drag-item-]").each((_, ele) => { + if ($(ele).attr("id") == thisId) { + return; + } + const { left: currentLeft, top: currentTop } = $(ele).offset(); + const currentWidth = $(ele).width(); + const currentHeight = $(ele).height(); + + if (left + width > currentLeft + currentWidth / 2 && left < currentLeft + currentWidth / 2) { + if (top + height > currentTop + currentHeight / 2) { + if (top < currentTop + currentHeight / 2) { + $(ele).before($(this.refs._itemplaceholder)); + this._columns = this.appendItem(this._columns, thisId, $(ele).attr("id"), false); + } else { + if (this.isLastItemOfColumn($(ele))) { + $(ele).after($(this.refs._itemplaceholder)); + this._columns = this.appendItem(this._columns, thisId, $(ele).attr("id"), true); + } + } + } + + } + }) + + $('.wea-draggable-column.column-empty').each((_, ele) => { + const { left: currentLeft } = $(ele).offset(); + const currentWidth = $(ele).width(); + if (left + width > currentLeft + currentWidth / 2 && left < currentLeft + currentWidth / 2) { + $(ele).find('.drag-item-wrap').append($(this.refs._itemplaceholder)); + this._columns = this.appendItem(this._columns, thisId, '', false, $(ele).attr('id')); + } + + }) + + + + } + handleItemStop = () => { + $(this.refs._itemstore).empty(); + $(this.refs._itemplaceholder).removeAttr('style'); + $(this.refs._itemplaceholder).appendTo($(this.refs._itemstore).parent()); + this.setState({ columns: this._columns, key: this.state.key + 1 }); + this.itemMoving = false; + } + isLastItemOfColumn = ($ele) => { + let silbs = $ele.parent().find("[id^=drag-item-]"); + let last = silbs.last(); + return last.attr("id") == $ele.attr("id"); + } + appendItem = (columns, fromkey1, tokey2, after, toColumnKey) => { + let _columns = []; + for (let i = 0; i < columns.length; i++) { + let _items = []; + let items = columns[i].items; + if (`drag-column-${columns[i].key}` == toColumnKey) { + _items.push(this._dragItem); + } else { + for (let j = 0; j < items.length; j++) { + if (!items[j]) { + continue; + } + if (`drag-item-${items[j].key}` == fromkey1) { + continue; + } else if (`drag-item-${items[j].key}` == tokey2) { + let formitem = this._dragItem + if (after) { + _items.push(items[j]); + if (formitem) { + _items.push(formitem); + } + } else { + if (formitem) { + _items.push(formitem); + } + _items.push(items[j]); + } + continue; + } + _items.push(items[j]); + } + } + _columns.push({ ...columns[i], items: _items }) + } + return _columns; + } + + componentDidMount() { + let $this = $(this.refs._kanban); + // let kanban_column = $this.find(".mode-kanban-column-row"); + let kanban = $this; + + + + kanban.mousedown((e) => { + let startX = e.clientX; + let startY = e.clientY; + let offset = $this.offset(); + let lastmoveX = startX; + e.stopPropagation(); + /* setTimeout(function () { + $(document).mousemove((e) => { + let offsetX = e.clientX - lastmoveX; + let nowoffsetX = kanban.scrollLeft(); + lastmoveX = e.clientX; + if (offsetX < 0) { + kanban.scrollLeft(nowoffsetX + (offsetX * -1)); + } else { + kanban.scrollLeft(nowoffsetX - (offsetX)); + } + //$(document).scrollLeft(kanban.scrollLeft()+offsetX); + }).mouseup(() => { + $(document).unbind('mousemove'); + return false; + }) + return false; + }, 200); */ + return false; + }); + let $area = $(this.refs._area); + let area = $area; + area.mousedown(() => { + }); + + } + + + render() { + const menu = ( + + + 修改阶段名称 + + + + 删除阶段 + + + ); + return ( +
    +
    +
    +
    +
    +
    + {this.state.columns.map((column) => { + return ( +
    +
    + 0 ? 'column' : 'column-empty'}`} + defaultClassName="wea-draggable-column" + onStart={this.handleStart.bind(this, column)} + onStop={this.handleStop} + onDrag={this.handleMove} + handle=".column-dragg-handle" + axis="both" + > + +
    + + {column.title} + + + +
    +
    + { + column.items.map((item) => { + return ( + + +
    + + {item.title} + { + item.islandmark != "1" && + + + + } + { + item.islandmark == "1" && + + + + } + { + item.collection != "1" && + + + + } + { + item.collection == "1" && + + + + } + + {/*
    + Tag 1 + >Link + Tag 2 + Prevent Default +
    */} +
    +
    + ) + }) + } +
    + + +
    + +
    +
    + +
    + +
    + + +新任务 + +
    +
    + +
    +
    + ) + })} +
    +
    + ) + } + + _handleClick = (e) => { + e.stopPropagation(); + } + + areaClick(event) { + + } + + saveTask(key, value) { + + } + + handleChange = (value) => { + this.setState({ + newTask: { + name: value + } + }) + } + + handleFocus = (value) => { + //console.log('这是获得焦点的value: ' + value); + } + + handleBlur = (value) => { + //console.log('这是失去焦点的value: ' + value); + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/kanban/index.less b/pc4mobx/prj/components/comp/kanban/index.less new file mode 100644 index 0000000..f2bb8d3 --- /dev/null +++ b/pc4mobx/prj/components/comp/kanban/index.less @@ -0,0 +1,184 @@ +.column-header { + background-color: #eef0f4; + border-bottom: 1px solid #e8e8e8; + padding: 16px; + border-radius: 2px 2px 0 0; + zoom: 1; + margin-bottom: -1px; + min-height: 48px; + font-size: 16px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + color: rgba(0, 0, 0, 0.85); + font-weight: 500; + .ant-dropdown-link{ + float: right; + font-size: 16px; + font-weight: 700; + color: #484848; + } + .column-header-menu{ + z-index: 999; + float: right; + } +} +.mode-kanban { + overflow: auto; + width: 100%; + height: 93%; + position: relative; + // width:auto; + // padding-left: 8px; + .ant-row, + [class*=" ant-col"], + [class^=ant-col] { + height: 100% + } + .mode-kanban-column-placeholder { + border: 1px dashed gray; + display: none; + width: 100%; + height: 100%; + margin-top: 8px; + //margin-left: -8px; + // margin-right: -8px; + } + .mode-kanban-item { + min-height: 41px; + border-radius: 5px; + position: relative; + margin: 0 5px 5px 5px; + padding: 0 0 0 10px; + cursor: pointer; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.2) + } + .mode-kanban-item-placeholder{ + border: 1px dashed gray; + display: none; + // height: 88px; + margin: 10px; + // padding-left: 50px + } + .mode-kanban-column-row{ + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + min-width: 640px; + padding: 0 20px; + overflow-y: auto; + } + .mode-kanban-column { + background-color: #eef0f4; + box-shadow: 0 2px 8px rgba(0, 0, 0, .2); + height: 100%; + margin-top: 8px; + margin-left: 8px; + margin-right: 8px; + border: 1px solid #e9e9e9; + border-radius: 10px; + width: 290px; + overflow: auto; + } + .mode-kanban-new-task{ + position: relative; + + } + .mode-kanban-new-task-area{ + min-height: 41px; + border-radius: 5px; + position: relative; + margin: 0 5px 5px 5px; + padding: 0 0 0 10px; + cursor: pointer; + background-color: #fff; + box-shadow: 0 1px 3px rgba(0,0,0,.2) + } + + .mode-kanban-new-task-btn{ + border-radius: 5px; + position: relative; + // cursor: pointer; + span { + background-color: #fff; + color : #757575; + line-height: 32px; + display: inline-block; + height: 32px; + margin: 3px 5px 6px 5px; + padding: 0 18px; + cursor: pointer; + border-radius: 18px; + box-shadow: 0 1px 2px rgba(0,0,0,.12); + + } + } +} +.item-header{ + margin: 10px 0 +} +.item-dragg-handle{ + // padding-left: 24px; + // height: 80px; + // overflow: hidden ; + overflow: hidden; + padding: 10px 20px 10px 10px; +} +.item-dragg-handle-title{ + // margin: 16px 0; + width : 80% ; + font-size: 14px; + // padding: 10px 0px 10px 0px; + display: inline-block; + // text-align:center; + // display:block; + // float:left +} + +.item-dragg-handle-operation{ + font-size: 18px; + color: gainsboro; + padding-right: 10px; + display: none; +} + +.item-dragg-handle-operation2{ + font-size: 18px; + padding-right: 10px; + color: #2db7f5; +} + +.item-dragg-handle-collection{ + font-size: 18px; + color: gainsboro; + display: none; +} + +.item-dragg-handle-collection2{ + font-size: 18px; + color: rgb(248, 192, 72); +} + +span.item-dragg-handle-collection:hover{ + color:black; +} + +span.item-dragg-handle-operation:hover{ + color:black; +} + +div.mode-kanban-item:hover { + background-color: #eef0f4; +} + +div.mode-kanban-item:hover span{ + display: inline-block; +} + +div.mode-kanban-new-task-btn:hover span{ + background-color: rgb(59, 56, 56); + color: white; +} diff --git a/pc4mobx/prj/components/comp/prj-batch-share/customerShare.js b/pc4mobx/prj/components/comp/prj-batch-share/customerShare.js new file mode 100644 index 0000000..e555758 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-batch-share/customerShare.js @@ -0,0 +1,156 @@ +import {Table,Icon,Row,Col,Button,Spin} from 'antd' +import {WeaTools,WeaInput,WeaSelect,WeaBrowser,WeaLocaleProvider} from 'ecCom' +const getLabel = WeaLocaleProvider.getLabel; +import equal from 'deep-equal' + +const { getComponent } = WeaTools; + +class CustomerShare extends React.Component { + constructor(props) { + super(props); + this.state = { + columns: [], + datas: [], + selectedRowKeys: [], + current: 1, + showGroup: props.showGroup ? props.showGroup : false + } + this.doDelete = this.doDelete.bind(this); + this.doAdd = this.doAdd.bind(this); + } + componentDidMount() { + const { datas = [], columns = [] } = this.props; + columns.length > 0 && this.setState(datas.length > 0 ? {datas: this.addKeytoDatas(datas),columns} : {columns}) + } + componentWillReceiveProps(nextProps,nextState) { + const { columns = [], datas = [], selectedRowKeys = [] } = this.props; + const _columns = nextProps.columns || []; + const _datas = nextProps.datas || []; + const _selectedRowKeys = nextProps.selectedRowKeys || []; + !equal(columns,_columns) && this.setState({columns:_columns}); + this.setState({datas: this.addKeytoDatas(_datas)}); + !equal(selectedRowKeys,_selectedRowKeys) && this.setState({selectedRowKeys:_selectedRowKeys}) + } + addKeytoDatas(datas){ + let _datas = datas.map((data, i) => { + let _data = {...data}; + _data.key = i + return _data + }) + return _datas + } + render() { + const { datas,showGroup,columns, selectedRowKeys } = this.state; + const {title,needAdd,needCopy} = this.props; + return( +
    + + +
    {title}
    + + {needAdd && + + + + this.setState({showGroup:!showGroup})}/> + + } +
    + + + + + + + + ) + } + getColumns(){ + const { columns } = this.state; + let _columns = [].concat(columns); + _columns = _columns.map(col => { + let _col = { ...col }; + _col.render = ( text, record, index ) => { + return this.getColRender( _col, text, record, index ); + } + return _col + }); + return _columns + } + getColRender( _col, text, record, index ){ + const { com,isLink = false,linkKey =[],linkUrl=""} = _col; + let _com = []; + com.map((c,i) => { + if(typeof c.props === 'object'){ + _com.push(c); + }else{ + const { domkey,viewAttr =2,key, label, formItemType = 'INPUT', options = [], browserConditionParam = {}, width ,value } = c; + const _type = formItemType.toUpperCase(); + _com.push( + + {label && {label}} + { _type === 'INPUT' && !isLink && + + } + + ) + } + }); + return ( +
    + {_com} +
    + ) + } + getRowSelection(){ + const { columns, selectedRowKeys } = this.state; + if(!`${columns}`) return null + const rowSelection = { + selectedRowKeys, + onChange: (sRowKeys, selectedRows) => { + this.setState({selectedRowKeys : sRowKeys}); + } + } + return rowSelection + } + + doAdd(){ + typeof this.props.addColumns === 'function' && this.props.addColumns(); + } + doDelete(){ + const { datas, current, selectedRowKeys } = this.state; + let _datas = [].concat(datas); + selectedRowKeys.map(key => { + _datas = _datas.filter(data => data.key !== key); + }); + _datas = _datas.map((data, i) => { + let _data = {...data}; + _data.key = i; + return _data + }) + this.setState({datas: _datas,selectedRowKeys: []}); + this.onChange(_datas); + + } + onChange(datas){ + const { columns } = this.state; + let _datas = datas.map((data, i) => { + let _data = {...data} + delete _data.key + return _data + }); + typeof this.props.onChange === 'function' && this.props.onChange(_datas, columns); + } +} + +export default CustomerShare; + diff --git a/pc4mobx/prj/components/comp/prj-batch-share/index.js b/pc4mobx/prj/components/comp/prj-batch-share/index.js new file mode 100644 index 0000000..f96cf85 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-batch-share/index.js @@ -0,0 +1,198 @@ +import React from 'react'; +import { WeaDialog, WeaRightMenu, WeaNewScroll, WeaAuth, WeaLocaleProvider } from "ecCom" +import { Button, } from "antd" +const getLabel = WeaLocaleProvider.getLabel; +import PrjShowGroup from "../prj-show-group" +import WeaBatchShareTable from './customerShare.js' +import './index.less' + +class BatchShareDialog extends React.Component { + constructor(props) { + super(props) + this.state = { + datas: [] + }; + } + componentWillReceiveProps(nextProps) { + if(this.props.visible !== nextProps.visible){ + this.setState({ datas: [] }); + } + } + shouldComponentUpdate() { + return true; + } + render() { + const { visible, title, condition, onCancel } = this.props; + const { datas } = this.state; + const columns = [ + { + "title": getLabel(21956, "对象类型"), + "com": [{ label: '', type: 'INPUT', "viewAttr": 1, key: 'sharetypespan', disabled: false, },], + "width": "20%", + "dataIndex": "sharetypespan", + "key": "sharetypespan" + }, + { + "title": getLabel(106, "对象"), + "com": [{ label: '', type: 'INPUT', "viewAttr": 1, key: 'relatedshareidspan', disabled: false, },], + "width": "30%", + "dataIndex": "relatedshareidspan", + "key": "relatedshareidspan" + }, + { + "title": getLabel(683, "安全级别"), + "com": [{ label: '', type: 'INPUT', "viewAttr": 1, key: 'seclevel_seclevelMax', disabled: false, },], + "width": "30%", + "dataIndex": "seclevel_seclevelMax", + "key": "seclevel_seclevelMax" + }, + { + "title": getLabel(3005, "共享级别"), + "com": [{ label: '', type: 'INPUT', "viewAttr": 1, key: 'sharelevelspan', disabled: false, },], + "width": "20%", + "dataIndex": "sharelevelspan", + "key": "sharelevelspan" + }, + ]; + let that = this; + return ( + { typeof onCancel === 'function' && onCancel(); }} + style={{ width: 800, height: 500 }} + > + + +
    +
    + + { + let seclevel = v.seclevel; + let seclevelMax = v.seclevelMax; + if(v.sharetype === '1'||v.sharetype === '6'||v.sharetype === '7'||v.sharetype === '9'||v.sharetype === '11'){ + }else{ + if(""+seclevel&&(typeof seclevelMax === 'undefined' || seclevelMax === null || seclevelMax === "")){ + v.seclevel_seclevelMax = "≥"+seclevel; + }else if(""+seclevelMax&&(typeof seclevel === 'undefined' || seclevel === null || seclevel === "")){ + v.seclevel_seclevelMax = "≤"+seclevelMax; + }else{ + v.seclevel_seclevelMax = seclevel+" - "+seclevelMax; + } + } + //if (v.seclevel) { v.seclevel_seclevelMax = v.seclevel + "-" + v.seclevelMax; } + if (v.sharetype !== "4") { + const relatedshareids = v.relatedshareid.split(","); + const relatedshareidspans = v.relatedshareidspan.split(","); + let joblevel = ''; + let joblevelspan = ''; + let jobtitlespan = ''; + if(v.sharetype==='11'){ + joblevel = v.joblevel; + joblevelspan = v.joblevelspan; + if(joblevel==='1'){ + jobtitlespan = v.jobtitledepartmentspan; + }else if(joblevel==='2'){ + jobtitlespan = v.jobtitlesubcompanyspan; + } + } + if (relatedshareids.length > 1) { + relatedshareids.map((item, index) => { + let relatedshareidspan = relatedshareidspans[index] + if(v.sharetype==='11'){ + relatedshareidspan +='/'+joblevelspan; + if(joblevel==='1'||joblevel==='2'){ + relatedshareidspan +='('+jobtitlespan+')'; + } + } + datas.push({ + ...v, + relatedshareid: item, + relatedshareidspan: relatedshareidspan + }) + }); + }else { + let relatedshareidspan = v.relatedshareidspan; + let rolelevelspan = v.rolelevelspan; + if(v.sharetype==='11'||v.sharetype==='3'){ + if(v.sharetype==='11'){ + relatedshareidspan +='/'+joblevelspan; + if(joblevel==='1'||joblevel==='2'){ + relatedshareidspan +='('+jobtitlespan+')'; + } + }else if(v.sharetype==='3'){ + relatedshareidspan = rolelevelspan+"/"+relatedshareidspan; + } + datas.push({...v,relatedshareidspan:relatedshareidspan}); + }else{ + datas.push(v) + } + } + } else { + datas.push(v) + } + that.setState({ datas: datas }); + }} + onCancel={() => { }} + /> + + +
    +
    +
    +
    +
    + ) + } + getBottomButtons() { + const { onCancel, onSave } = this.props; + const { datas } = this.state; + let btnArr = []; + btnArr.push() + btnArr.push() + return btnArr; + } + getRightMenu() { + const { onCancel, onSave } = this.props; + const { datas } = this.state; + let btns = []; + btns.push({ + key: "1", + icon: , + content: getLabel(86, "保存"), + onClick: () => { typeof onSave === 'function' && onSave(datas); this.setState({ datas: [] }); } + }); + return btns; + } + addColumns() { + this.refs.customerShare.onOk(); + } + editTableDatas(data) { + this.setState({ datas: data }) + } + +} + +export default BatchShareDialog \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-batch-share/index.less b/pc4mobx/prj/components/comp/prj-batch-share/index.less new file mode 100644 index 0000000..9b6e601 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-batch-share/index.less @@ -0,0 +1,52 @@ +.prj-auth-customersize{ + margin-top: 10px; + .ant-form-item { + font-size: 12px; + margin-bottom: 10px; + color: #666; + } +} + +.wea-batchshare-table{ + padding-top: 20px; + padding-left: 25px; + padding-right: 25px; +} +.wea-batchshare-table .wea-title { + font-size: 12px; + color: #484848; + padding-bottom: 10px; + padding-left: 10px; + border-bottom: solid 1px #ebebeb; +} +.wea-batchshare-table .wea-title i { + cursor: pointer; +} +.wea-batchshare-table .wea-title button { + width: 20px; + height: 20px; + text-align: center; + padding: 0; + margin-right: 15px; +} +.wea-batchshare-table .ant-table-tbody>tr>td { + padding: 10px 8px; + word-break: break-all; +} +.wea-batchshare-table .ant-table-thead>tr>th { + background-color: #f8fcff; +} +.wea-batchshare-table .ant-table-thead>tr>th { + padding-top: 14px; + padding-bottom: 14px; +} +.wea-batchshare-table .ant-table-thead th { + border-bottom: 1px solid #eaeaea; + font-weight: 400; +} +.wea-batchshare-table .ant-table,.wea-batchshare-table .ant-table table { + border-radius: 0; +} +.wea-batchshare-table .ant-btn-sm { + border-radius: 0; +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-data-time/index.js b/pc4mobx/prj/components/comp/prj-data-time/index.js new file mode 100644 index 0000000..7c08fa3 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-data-time/index.js @@ -0,0 +1,66 @@ +import {InputNumber, Modal, Icon} from 'antd'; +import isEmpty from 'lodash/isEmpty'; +import isArray from 'lodash/isArray' +import {WeaDatePicker,WeaTimePicker} from "ecCom" +import equals from 'deep-equal' + +class Main extends React.Component { + constructor(props){ + super(props) + this.state={ + dateValue: '', + timeValue: '' + } + if (!isEmpty(props.value)) { + if (props.value[0]) this.state.dateValue = props.value[0]; + if (props.value[1]) this.state.timeValue = props.value[1]; + } + } + componentWillReceiveProps(nextProps){ + if (!equals(this.props.value,nextProps.value)) { + let dateValue = '', timeValue = ''; + if (!isEmpty(nextProps.value)) { + dateValue = nextProps.value[0]; + timeValue = nextProps.value[1]; + } + this.setState({dateValue, timeValue}); + } + } + onChangeDate(value) { + this.setState({dateValue: value}); + const {timeValue = ''} = this.state; + this.props.onChange && this.props.onChange([value, timeValue]); + } + onChangeTime(value) { + this.setState({timeValue: value}); + const {dateValue = ''} = this.state; + this.props.onChange && this.props.onChange([dateValue, value]); + } + render(){ + const {dateValue, timeValue, } = this.state; + const {viewAttr,otherParams,startValue="",endValue="",isTimeShow='1',type,domkey}=this.props; + let name = domkey&&domkey[0]; + let timename = ''; + if(name==='begindate'){ + timename ='begintime'; + }else if(name==='enddate'){ + timename ='endtime'; + }else if(name==='actualbegindate'){ + timename ='actualbegintime'; + }else if(name==='actualenddate'){ + timename ='actualendtime'; + } + return( +
    + + + + + + +
    + ); + } +} + +export default Main; \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-left-right-layout/index.js b/pc4mobx/prj/components/comp/prj-left-right-layout/index.js new file mode 100644 index 0000000..f92de83 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-left-right-layout/index.js @@ -0,0 +1,69 @@ +import { Icon} from 'antd'; +import cloneDeep from 'lodash/cloneDeep' +import './index.less' + + +class LeftRightLayout extends React.Component { + constructor(props) { + super(props); + this.state = { + showLeft:props.defaultShowLeft || true, + isHover:false, + leftWidth:props.leftWidth || 250, + treeWidth:props.treeWidth || 250 + // showRight:false + } + } + componentWillReceiveProps(nextProps){ + if(this.props.showRight !== nextProps.showRight){ + this.showright(nextProps.showRight); + } + } + leftShowCo(e){ + const {showLeft,leftWidth,treeWidth} = this.state; + const { onLeftChange,leftCom} = this.props; + if(showLeft){ + jQuery(".three-side-left").animate({width:0},300,"linear",onLeftChange && onLeftChange(false)) + }else{ + jQuery(".three-side-left").animate({width:leftCom? leftWidth:treeWidth},300,"linear",onLeftChange && onLeftChange(true)) + } + this.setState({showLeft:!showLeft}); + e.stopPropagation(); + e.preventDefault(); + e.nativeEvent.preventDefault(); + } + render() { + const {showLeft,height,isHover,leftWidth,treeWidth} = this.state; + const {children,leftCom,rightCom,showRight} = this.props; + return ( +
    + { + leftCom && +
    +
    + {leftCom} +
    +
    + } +
    + { + leftCom && +
    this.setState({isHover:true})} + onMouseLeave={()=>this.setState({isHover:false})} + style={{background: `url('/cloudstore/images/e9/leftTree-${showLeft ? "show" : "hide"}${isHover ? "-hover" : ""}.png') no-repeat -2px 0`}} + >
    + } +
    +
    + {children} +
    +
    +
    +
    + ) + } +} + +export default LeftRightLayout; \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-left-right-layout/index.less b/pc4mobx/prj/components/comp/prj-left-right-layout/index.less new file mode 100644 index 0000000..a65261e --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-left-right-layout/index.less @@ -0,0 +1,54 @@ + +@coms-prefix:coms-mode; + +@coms-height:46px; +@coms-small-height:32px; + +.wea-left-middle-right-layout, +.wea-left-middle-right-layout .three-side-left, +.wea-left-middle-right-layout .three-side-right{ + height: 100%; + overflow: hidden; +} +.wea-left-middle-right-layout{ + background-color: #e8edf4; + width: 100%; +} +.wea-left-middle-right-layout .three-side-left{ + float: left; + background-color: #fff; + .three-side-left-left1{ + height: 100%; + overflow: hidden; + float: left; + border-right: 1px solid #ececec; + } + .three-side-left-left2{ + height: 100%; + overflow: hidden; + float: left; + } +} +.wea-left-middle-right-layout .three-side-right{ + border-right: 1px solid #ececec; + position: relative; + .three-side-right-container{ + padding: 0 0px 0 1px; + box-sizing: border-box; + height: 100%; + width: 100%; + } +} + +.wea-left-middle-right-layout .wea-three-side-layout-show-left{ + width: 18px; + height: 60px; + position: absolute; + top: 50%; + left: 0; + margin-top: -30px; + z-index: 11; + cursor: pointer; + background-size: 100% 100%; +} + diff --git a/pc4mobx/prj/components/comp/prj-progress/index.js b/pc4mobx/prj/components/comp/prj-progress/index.js new file mode 100644 index 0000000..ebea566 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-progress/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import Progress from './progress'; +import warning from 'warning'; + +const AntProgress = Progress; + +// For downward compatibility +AntProgress.Line = (props) => { + warning(false, ' is deprecated, use instead.'); + return ; +}; +AntProgress.Circle = (props) => { + warning(false, ' is deprecated, use instead.'); + return ; +}; + +export default AntProgress; diff --git a/pc4mobx/prj/components/comp/prj-progress/progress.js b/pc4mobx/prj/components/comp/prj-progress/progress.js new file mode 100644 index 0000000..2b57043 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-progress/progress.js @@ -0,0 +1,102 @@ +import React, { PropTypes } from 'react'; +import {Icon} from 'antd'; +import { Circle } from 'rc-progress'; +import classNames from 'classnames'; + +const statusColorMap = { + normal: '#2db7f5', + exception: '#ff5500', + success: '#87d068', +}; + +export default class Line extends React.Component { + static defaultProps = { + type: 'line', + percent: 0, + showInfo: true, + trailColor: '#f3f3f3', + prefixCls: 'ant-progress', + } + + static propTypes = { + status: PropTypes.oneOf(['normal', 'exception', 'active', 'success']), + type: PropTypes.oneOf(['line', 'circle']), + showInfo: PropTypes.bool, + percent: PropTypes.number, + width: PropTypes.number, + strokeWidth: PropTypes.number, + trailColor: PropTypes.string, + format: PropTypes.func, + } + + render() { + const { prefixCls, status, format, percent, trailColor, + type, strokeWidth,progressBg, width, className, showInfo, ...restProps} = this.props; + // const progressStatus = (parseInt(percent, 10) >= 100 && !('status' in this.props)) + // ? 'success' : (status || 'normal'); + const progressStatus= status|| 'normal'; + let progressInfo; + let progress; + const textFormatter = format || (percentNumber => `${percentNumber}%`); + + if (showInfo) { + let text; + const iconType = type === 'circle' ? '' : '-circle'; + if (progressStatus === 'exception') { + text = format ? textFormatter(percent) : ; + } else if (progressStatus === 'success') { + text = format ? textFormatter(percent) : ; + } else { + text = textFormatter(percent); + } + progressInfo = {text}; + } + + if (type === 'line') { + const percentStyle = { + width: `${percent}%`, + height: strokeWidth || 10, + backgroundColor:progressBg || "#2db7f5" + }; + progress = ( +
    +
    +
    +
    +
    +
    + {progressInfo} +
    + ); + } else if (type === 'circle') { + const circleSize = width || 132; + const circleStyle = { + width: circleSize, + height: circleSize, + fontSize: circleSize * 0.16 + 6, + }; + progress = ( +
    + + {progressInfo} +
    + ); + } + + const classString = classNames({ + [`${prefixCls}`]: true, + [`${prefixCls}-${type}`]: true, + [`${prefixCls}-status-${progressStatus}`]: true, + [`${prefixCls}-show-info`]: showInfo, + [className]: !!className, + }); + + return ( +
    + {progress} +
    + ); + } +} diff --git a/pc4mobx/prj/components/comp/prj-progress/style/index.less b/pc4mobx/prj/components/comp/prj-progress/style/index.less new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/prj/components/comp/prj-show-group/index.js b/pc4mobx/prj/components/comp/prj-show-group/index.js new file mode 100644 index 0000000..59d6bf2 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-show-group/index.js @@ -0,0 +1,37 @@ +import {Row, Col, Icon} from 'antd'; +import './index.less' + +class PrjShowGroup extends React.Component { + constructor(props) { + super(props); + this.state = { + showGroup: props.showGroup ? props.showGroup : true + } + } + + render() { + const {title,leftComponent=[],rightComponent=[], children,btnspace} = this.props; + const {showGroup} = this.state; + return ( +
    + +
    +
    {leftComponent}
    + +
    + {rightComponent} + this.setState({showGroup:!showGroup})}/> + + + + { + children + } + + + ) + } + +} + +export default PrjShowGroup \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-show-group/index.less b/pc4mobx/prj/components/comp/prj-show-group/index.less new file mode 100644 index 0000000..87e3a51 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-show-group/index.less @@ -0,0 +1,33 @@ +.prj-exchange-title{ + height: 50px; + line-height: 50px!important; + border-bottom: 1px solid #e9e9e9; + .prj-exchange-title-left{ + padding-left: 20px; + color: #484848; + font-weight: 600; + } + .prj-exchange-title-right{ + text-align: right; + padding-right: 15px; + font-size: 12px; + } + +} + +.prj-exchange-content{ + .prj-exchange-cell-fujian{ + margin-top: 10px; + padding-bottom: 5px; + border-bottom: 1px solid #e2e2e2; + .wea-form-item{ + margin-bottom: 5px; + } + } +} +/*全局设置button samll 样式*/ +.prj-btn-small{ + padding: 0px 4px; + border-radius: 0; + margin-right: 10px; +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-table-edit/index.js b/pc4mobx/prj/components/comp/prj-table-edit/index.js new file mode 100644 index 0000000..946f0ef --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-table-edit/index.js @@ -0,0 +1,271 @@ +import {Table, Icon, Button, Spin, Row, Col,Menu, Dropdown,} from 'antd'; +import { WeaTools,WeaInput,WeaTextarea,WeaSelect,WeaBrowser,WeaDatePicker,WeaTimePicker,WeaCheckbox,WeaLocaleProvider} from "ecCom" +const getLabel = WeaLocaleProvider.getLabel; +import classNames from 'classnames' +import isEqual from 'lodash/isEqual'; +import './index.less' + +//国际化 zxt- 20170419 +const defaultLocale = { + total: getLabel(18609,"共"), + totalUnit: getLabel(18256,"条"), +}; + + +class Main extends React.Component { + //国际化 zxt- 20170419 + static contextTypes = { + antLocale: React.PropTypes.object, + } + getLocale() { + let locale = {}; + if(this.context.antLocale && this.context.antLocale.Table) { + locale = this.context.antLocale.WeaTableEdit; + } + return { + ...defaultLocale, + ...locale, + ...this.props.locale + }; + } + constructor(props) { + super(props); + this.state = { + columns: [], + datas: [], + selectedRowKeys: [], + current: 1 + } + this.onEdit = this.onEdit.bind(this); + } + componentDidMount() { + const { datas = [], columns = [] } = this.props; + columns.length > 0 && this.setState(datas.length > 0 ? {datas: this.addKeytoDatas(datas),columns} : {columns}) + } + componentWillReceiveProps(nextProps) { + const { columns = [], datas = [], selectedRowKeys = [] } = this.props; + const _columns = nextProps.columns || []; + const _datas = nextProps.datas || []; + const _selectedRowKeys = nextProps.selectedRowKeys || []; + !isEqual(columns,_columns) && this.setState({columns: _columns}); + !isEqual(datas,_datas) && this.setState({datas: this.addKeytoDatas(_datas)}); + !isEqual(selectedRowKeys,_selectedRowKeys) && this.setState({selectedRowKeys: _selectedRowKeys}); + } + componentDidUpdate() { + + } + addKeytoDatas(datas){ + let _datas = datas.map((data, i) => { + let _data = {...data}; + _data.key = i + return _data + }) + return _datas + } + render() { + const { datas } = this.state; + const {tableProps} = this.props; + return( +
    +
    + + ) + } + getColumns(){ + const { columns } = this.state; + let _columns = [].concat(columns); + _columns = _columns.map(col => { + let _col = { ...col }; + _col.render || (_col.render = ( text, record, index ) => { + return this.getColRender( _col, text, record, index ); + }) + return _col + }); + return _columns + } + getColRender( _col, text, record, index ){ + const { com } = _col; + let _com = []; + const {onCreatReq, onCreatDoc} = this.props; + com.map((c,i) => { + if(typeof c.props === 'object'){ + _com.push(c); + }else{ + const { key, label = '', type = 'INPUT', options = [], browserConditionParam = {}, innerStyle = {width: "100%"}, + viewAttr = 2 ,showTime = false ,format = "yyyy-MM-dd",otherParams } = c; + const _type = type.toUpperCase(); + let style = _type === 'BROWSER' ? {...innerStyle}:{...innerStyle, display: 'inline-block'} + _com.push( + + {label && {label}} + { _type === 'INPUT' && + this.onEdit(record, index, key, value)} /> + } + { _type === 'TEXTAREA' && + this.onEdit(record, index, key, value)} /> + } + { _type === 'DATEPICKER' && + this.onEdit(record, index, key, value)} /> + } + { _type === 'TIMEPICKER' && + this.onEdit(record, index, key, value)} /> + } + { _type === 'SELECT' && + this.onEdit(record, index, key, value)} /> + } + { _type === 'BROWSER' && + this.onEdit(record, index, key, ids, names, bDatas)} /> + } + { _type === 'CHECKBOX' && + this.onEdit(record, index, key, value)} + /> + } + { + _type == "LINK_WF" && + + onCreatReq(record.wfid,record.taskId)}>{record[key]}({record.requiredWFCount}) + ! + + } + { + _type == "LINK_DOC" && + + onCreatDoc && onCreatDoc(record.reqDocSecCategory,record.taskId)}>{record[key]}({record.requiredDocCount}) + ! + + } + { + _type == "OPERATE" && + + + {getLabel(104,"操作")} + + + } + + ) + } + }); + return ( +
    + {_com} +
    + ) + } + getBrowerDatas(record, key){ + let replaceDatas = []; + if(record[key + 'span'] !== undefined) { + let keys = record[key].split(','); + let values = record[key + 'span'].split(','); + if(keys.length === values.length){ + keys.map((k, i) => { + if (k != '' && values[i] != '') replaceDatas.push({id: k, name: values[i]}); + }); + }else{ + + } + } + return replaceDatas + } + getPagination() { + const { pageSize = 0, paginationSize = ''} = this.props; + if( !pageSize ) return false; + const { current } = this.state; + const locale = this.getLocale(); + let obj = { + size: paginationSize, + current, + pageSize, + }; + return obj + } + onEdit(record, index, key, value, names, bDatas){ + const { pageSize = 0 } = this.props; + const { datas, current } = this.state; + let _datas = [].concat(datas); + _datas[pageSize * (current - 1) + index][key] = value; + if(names) _datas[pageSize * (current - 1) + index][key + 'span'] = names; + this.setState({datas: _datas}); + this.onChange(_datas,index); + } + onChange(datas,index){ + const { columns } = this.state; + let _datas = datas.map((data, i) => { + let _data = {...data} + delete _data.key + return _data + }) + typeof this.props.onChange === 'function' && this.props.onChange(_datas[index], columns); + } + getMenu(record,options,bool){ + let menu = []; + if(options && bool){ + options.map(item=>{ + menu.push( + + {item.showname} + + ) + }) + return this.onMenuClick(record,options)}> + {menu} + + } + return menu + } + onMenuClick=(record,options)=>{ + typeof this.props.operate == "function" && this.props.operate(record); + } +} + +export default Main; + diff --git a/pc4mobx/prj/components/comp/prj-table-edit/index.less b/pc4mobx/prj/components/comp/prj-table-edit/index.less new file mode 100644 index 0000000..f062b40 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-table-edit/index.less @@ -0,0 +1,16 @@ +.wea-table-edit .prj-dropdown-link .ant-dropdown-link { + color: #484848 +} +.prj-link-a a:link { + color: #484848; +} +.prj-link-a a:hover { + color: #038ef6 +} + +.prj-content-must{ + color: red; + margin-left: 5px; + font-size: 14px; + font-weight: 700; +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/prj-task-layout/index.js b/pc4mobx/prj/components/comp/prj-task-layout/index.js new file mode 100644 index 0000000..1a05f69 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-task-layout/index.js @@ -0,0 +1,85 @@ +import { Icon} from 'antd'; +import React from 'react'; +import cloneDeep from 'lodash/cloneDeep' +import './index.less' + + +export class PrjTaskLayout extends React.Component { + constructor(props) { + super(props); + this.state = { + showLeft:props.defaultShowLeft || true, + isHover:false, + leftWidth:props.leftWidth || 250, + treeWidth:props.treeWidth || 250 + //showRight:false + } + } + componentWillReceiveProps(nextProps){ + if(this.props.showRight !== nextProps.showRight){ + // this.showright(nextProps.showRight); + this.rightShowCo(nextProps.showRight); + } + } + + componentDidMount(props){ + let $this = $(this.refs._container) + let handle = $this.find(this.props.handle) + // let isDrag = false; + // let _timer = + $this.click(function(){ + rightShowCo(false); + }); + + } + leftShowCo(e){ + const {showLeft,leftWidth,treeWidth} = this.state; + const { onLeftChange,leftCom} = this.props; + if(showLeft){ + jQuery(".three-side-right").animate({width:0},300,"linear",onLeftChange && onLeftChange(false)) + }else{ + jQuery(".three-side-right").animate({width:leftCom? leftWidth:treeWidth},300,"linear",onLeftChange && onLeftChange(true)) + } + this.setState({showLeft:!showLeft}); + e.stopPropagation(); + e.preventDefault(); + e.nativeEvent.preventDefault(); + } + + rightShowCo(showRight){ + // const {showLeft,leftWidth,treeWidth} = this.state; + const { rightCom,rightWidth} = this.props; + if(showRight){ + jQuery(".prj-layout-right").animate({width:0},300,"linear") + }else{ + jQuery(".prj-layout-right").animate({width:rightCom? rightWidth:0},300,"linear") + } + //this.setState({showLeft:!showLeft}); + // e.stopPropagation(); + // e.preventDefault(); + // e.nativeEvent.preventDefault(); + } + + render() { + const {leftCom,rightCom,rightWidth} = this.props; + return ( +
    +
    +
    +
    + {rightCom && rightCom} +
    +
    +
    +
    +
    +
    + {leftCom && leftCom} +
    +
    +
    +
    + ) + } +} + diff --git a/pc4mobx/prj/components/comp/prj-task-layout/index.less b/pc4mobx/prj/components/comp/prj-task-layout/index.less new file mode 100644 index 0000000..540ecd5 --- /dev/null +++ b/pc4mobx/prj/components/comp/prj-task-layout/index.less @@ -0,0 +1,48 @@ + +@coms-prefix:coms-mode; + +@coms-height:46px; +@coms-small-height:32px; + + +.wea-prj-task-layout, +.wea-prj-task-layout .prj-layout-left, +.wea-prj-task-layout .prj-layout-right{ + height: 100%; + overflow: hidden; +} + +.wea-prj-task-layout{ + background-color: #e8edf4; + width: 100%; + height: 100%; +} + +.wea-prj-task-layout .prj-layout-left{ + border-right: 1px solid #ececec; + // position: relative; + height: 100%; + // float: right; + // width: 100%; + .prj-layout-container{ + padding: 0 0px 0 1px; + box-sizing: border-box; + height: 100%; + width: 100%; + } +} + +.wea-prj-task-layout .prj-layout-right{ + float: right; + background-color: brown; + box-shadow: -5px 10px 23px 2px rgba(0,0,0,0.3), 0 3px 6px rgba(0,0,0,.15); + z-index: 100; + .prj-layout-board{ + height: 100%; + overflow: hidden; + float: right; + border-right: 1px solid #ececec; + } + +} + diff --git a/pc4mobx/prj/components/comp/prjTaskListTable/index.js b/pc4mobx/prj/components/comp/prjTaskListTable/index.js new file mode 100644 index 0000000..e66a7ee --- /dev/null +++ b/pc4mobx/prj/components/comp/prjTaskListTable/index.js @@ -0,0 +1,375 @@ +import {toJS} from "mobx" +import {Table,Icon,Row,Col,Button,Modal,InputNumber,message} from 'antd' +import {WeaInput,WeaSelect,WeaBrowser,WeaDialog,WeaNewScroll,WeaLocaleProvider,WeaError} from 'ecCom' +import './index.less' +import equal from "deep-equal" +import PrjDateTime from '../prj-data-time' +import {datediff,endDateDiff} from '../../../util' +import AddProjectDialog from '../../dialog/addProjectDialog' +import {AddProjectStore} from "../../../stores/addProjectStore" +const getLabel = WeaLocaleProvider.getLabel; + +class PrjTaskListTable extends React.Component { + constructor(props) { + super(props); + this.state = { + showModal:false, + clickKey:"", + datas:props.datas || [], + selectedRowKeys: [], + taskViewAttr :props.taskViewAttr||"", + } + this.remind1 = new Array(); + this.remind2 = new Array(); + this.remind3 = new Array(); + } + componentDidMount() { + const { datas = [], taskViewAttr} = this.props; + const newdatas = this.addKeytoDatas(datas); + this.setState({datas: this.changeBeforeTask(newdatas),taskViewAttr: taskViewAttr}) + } + componentShouldUpdate(nextProps,nextState){ + return !equal(this.state,nextState)||!equal(this.props.nextProps) + } + componentWillReceiveProps(nextProps,nextState) { + const { datas = [], selectedRowKeys = [],taskViewAttr } = this.state; + const _datas = nextProps.datas || []; + const _selectedRowKeys = nextProps.selectedRowKeys || []; + const _taskViewAttr = nextProps.taskViewAttr || ""; + !equal(datas,_datas) && this.setState({datas: this.addKeytoDatas(_datas)}); + !equal(taskViewAttr,_taskViewAttr) && this.setState({taskViewAttr: _taskViewAttr}); + !equal(selectedRowKeys,_selectedRowKeys) && this.setState({selectedRowKeys:_selectedRowKeys}) + } + componentWillUnmount(){ + + } + addKeytoDatas(datas){ + let _datas = datas.map((data, i) => { + let _data = {...data}; + _data.key = i+1; + _data.rowIndex = i+1; + return _data + }) + return _datas + } + //change 前置任务 + changeBeforeTask=(datas)=>{ + let _datas = [].concat(datas); + _datas.map(item=>{ + if(item.beftaskid && item.beftaskid !== "0"){ + for(let i = 0 ;i < _datas.length; i++){ + if(_datas[i].realid == item.beftaskid){ + item.beftaskid = _datas[i].rowIndex; + item.beftaskname = _datas[i].name; + } + } + } + }) + return _datas; + } + render() { + const { datas,showModal,taskViewAttr } = this.state; + return( +
    + +
    +
    + + + this.setState({showModal:false})} + + > + +
    +
    + + + + + ) + } + getColumns(){ + const {taskViewAttr } = this.state; + const { stageOptions, isTimeShow } = this.props; + let dis = true; + if(taskViewAttr==2){ + dis = false; + } + return [{ + title: getLabel(15486,"序号"), + dataIndex: 'rowIndex', + width:"5%", + render: (text, record, index ) => {return {text}}, + }, { + title: getLabel(1352,"任务名称"), + dataIndex: 'name', + width:"20%", + render: (text, record, index ) => + { + this.remind1.push(ref); + }} + error={getLabel(385869,"此项必填")} + tipPosition="top" + > + this.onEdit(record, index,"name" , value)} + /> + + , + }, { + title: getLabel('24902','阶段') , + dataIndex: 'stageid', + width:"10%", + render: (text, record, index ) => { + return + { + this.remind2.push(ref); + }} + error={getLabel(385869,"此项必填")} + tipPosition="top" + > + this.onEdit(record, index,"stageid" , value)} + style={{width:80}} + /> + + }, + }, { + title: getLabel(1298,"工期"), + dataIndex: 'workday', + width:"5%", + render:(text, record, index)=> + this.onEdit(record, index,"workday" , value)} /> + + }, { + title: getLabel(742,"开始时间"), + dataIndex: 'begindate', + width:"15%", + render:(text, record, index)=> + + //onChange={(v)=>{this.timeComputed(v,"begin",index)}} + }, { + title: getLabel(743,"结束时间"), + dataIndex: 'enddate', + width:"15%", + render:(text, record, index)=> + + //onChange={(v)=>{this.timeComputed(v,"end",index)}} + }, { + title: getLabel(2233,"前置任务"), + dataIndex: 'beftaskid', + width:"15%", + render:(text, record, index)=> + + + + {!dis&&this.setState({showModal:true,clickKey:record.key})}/>} + + },{ + title: getLabel(2097,"负责人"), + dataIndex: 'hrmid', + width:"20%", + render:(text, record, index)=> + { + this.remind3.push(ref); + }} + error={getLabel(385869,"此项必填")} + tipPosition="top" + style={{width:90}} + > + {this.onEdit( record, index,"hrmid",ids, names, bDatas)}} + replaceDatas={[{id: text, name: record.hrmname}]} + /> + + + }]; + } + + onEdit= (record, index,name , value,names,bDatas) =>{ + let that = this; + const {clickKey,datas} = this.state; + let _datas = [].concat(datas); + if(name == "hrmid"){ + _datas[index][name] = value ; + _datas[index]["hrmname"] = names ; + }else{ + _datas[index][name] = value ; + } + if(name == "workday") { + let res = "2023-09-09"; + //接口计算 + res = endDateDiff(record.begindate,value) + _datas[index]["enddate"] = res + } + + this.setState({datas : _datas}); + this.onChange(_datas); + } + + getButtons(){ + let btn = []; + btn.push(); + btn.push(); + return btn; + } + getModalColumns(){ + return [{ + title: getLabel(15486,"序号"), + dataIndex: 'rowIndex', + width:"15%", + render: (text, record, index ) =>{text}, + }, { + title: getLabel(1352,"任务名称"), + dataIndex: 'name', + width:"85%", + render: (text, record, index ) => {text}, + }] + } + onRowClick=(record, index)=>{ + let that = this; + const {clickKey,datas} = this.state; + let _datas = [].concat(datas); + if(record.key == clickKey){ + // Modal.warning({ + // title: getLabel(15172,"系统提示"), + // content: getLabel(24468,"不能把本身设置为前置任务!"), + // onOk() { + // that.setState({showModal:false,clickKey:""}) + // } + // }) + message.error(getLabel(24468,"不能把本身设置为前置任务!")); + that.setState({showModal:false,clickKey:""}); + }else{ + _datas[clickKey-1].beftaskname = record.name; + _datas[clickKey-1].beftaskid = record.rowIndex; + that.setState({showModal:false,clickKey:"",datas :_datas}) + this.onChange(_datas); + } + } + + onClear=()=>{ + let that = this; + const {clickKey,datas} = this.state; + let _datas = [].concat(datas); + _datas[clickKey-1].beftaskname = ""; + _datas[clickKey-1].beftaskid = ""; + that.setState({showModal:false,clickKey:"",datas :_datas}) + this.onChange(_datas); + } + + //计算工期 + timeComputed= (arg,type,index) =>{ + const {userid ,isworkday} = this.props; + const {datas} = this.state; + let _datas = [].concat(datas); + let res = ""; + if(type == "begin"){ + let time = ""; + if(!arg[1]){time = "00:00" }else{time = arg[1]} + if( _datas[index]["enddate"] && arg[0] ){ + res = datediff(arg[0],_datas[index]["enddate"],time,_datas[index]["endtime"] || "23:59",userid,isworkday); + } + _datas[index]["begindate"] = arg[0] + _datas[index]["begintime"] = time; + }else{ + let time = ""; + if(!arg[1]){time = "00:00"}else{time = arg[1]} + if(_datas[index]['begindate'] && arg[0] ){ + res = datediff(_datas[index]['begindate'],arg[0],_datas[index]['begintime'] || "00:00",time,userid,isworkday); + } + _datas[index]["enddate"] = arg[0] + _datas[index]["endtime"] = time; + } + _datas[index].workday = res; + this.setState({datas:_datas}) + this.onChange(_datas); + } + + getRowSelection(){ + let that = this; + const rowSelection = { + onChange(selectedRowKeys, selectedRows) { + typeof that.props.onRowSelect === 'function' && that.props.onRowSelect(selectedRowKeys); + }, + selectedRowKeys:that.props.selectedRowKeys + } + return rowSelection + } + + onChange(datas){ + typeof this.props.onChange === 'function' && this.props.onChange(datas); + } + + showErrors() { + toJS(this.remind1).map(c => { + if (c && !c.props.children.props.value && c.props.children.props.viewAttr == "3") { + c.showError(); + } + }); + toJS(this.remind2).map(c => { + if (c && !c.props.children.props.value && c.props.children.props.viewAttr == "3") { + c.showError(); + } + }); + toJS(this.remind3).map(c => { + if(c&&c.props.children.props.replaceDatas&&(c.props.children.props.replaceDatas[0]?!c.props.children.props.replaceDatas[0].id:!c.props.children.props.replaceDatas[0])&&c.props.children.props.viewAttr=="3"){ + c.showError(); + } + }); + } +} + +export default PrjTaskListTable; diff --git a/pc4mobx/prj/components/comp/prjTaskListTable/index.less b/pc4mobx/prj/components/comp/prjTaskListTable/index.less new file mode 100644 index 0000000..6d21867 --- /dev/null +++ b/pc4mobx/prj/components/comp/prjTaskListTable/index.less @@ -0,0 +1,23 @@ + + +.wea-prj-table-edit .ant-table-tbody>tr>td { + padding: 10px 8px; + word-break: break-all; +} +.wea-prj-table-edit .ant-table-thead>tr>th { + background-color: #f8fcff; +} +.wea-prj-table-edit .ant-table-thead>tr>th { + padding-top: 14px; + padding-bottom: 14px; +} +.wea-prj-table-edit .ant-table-thead th { + border-bottom: 1px solid #eaeaea; + font-weight: 400; +} +.wea-prj-table-edit .ant-table,.wea-prj-table-edit .ant-table table { + border-radius: 0; +} +.wea-prj-table-edit .icon-selebeforetask:hover{ + color: #038ef6 +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/task-view-list/ListItem.js b/pc4mobx/prj/components/comp/task-view-list/ListItem.js new file mode 100644 index 0000000..7984cf9 --- /dev/null +++ b/pc4mobx/prj/components/comp/task-view-list/ListItem.js @@ -0,0 +1,48 @@ +import React from 'react'; +// import ButtonView from '../view-button'; +// import { ListItemProps } from '../../stores/mode-app/BaseStore'; +import classNames from 'classnames'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +// export interface ListItemCompProps { +// data: ListItemProps; +// onClick?: (key: string,special:any) => void; +// showIcon?: boolean; +// currentKey?:string +// } +export default class ListItem extends React.Component { + onClick = () => { + const { data, onClick } = this.props; + onClick && onClick(data.key, data.id); + } + + render() { + const { data, currentKey } = this.props; + const className = classNames('task-list-item-content'); + let isCurrent = currentKey && currentKey == data.key; + return ( +
    +
    +
    + {/*
    {data.state}
    */} +
    +
    +
    + { data.islandmark ? {getLabel('19173','里程碑')} : {getLabel('2086','普通')}} + { data.cnum > 0 && {data.cfnum}/{data.cnum}} + {data.isfinish && {getLabel(23774,"已完成")}} + {data.islater && {getLabel('1982','超期') }{data.laterDays > 0 && {data.laterDays}{getLabel('1925','天')}}} +
    +
    +
    +
    +
    + ) + } +} + diff --git a/pc4mobx/prj/components/comp/task-view-list/index.js b/pc4mobx/prj/components/comp/task-view-list/index.js new file mode 100644 index 0000000..b523e91 --- /dev/null +++ b/pc4mobx/prj/components/comp/task-view-list/index.js @@ -0,0 +1,48 @@ +import React from 'react'; +import { WeaNewScroll, WeaInputSearch } from 'ecCom'; +import { Pagination } from 'antd'; +import ListItem from './ListItem'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +export default class ListView extends React.Component { + + render() { + const { datas, pagination, scrollHeight = document.documentElement.clientHeight, currentKey } = this.props; + return ( +
    + {/* */} + + {datas.length === 0 ? +

    + {getLabel('83553',"暂无数据")} +

    + : +
    + { + datas && datas.length > 0 && datas.map(d => ( + + )) + } +
    + } + +
    +
    + +
    +
    + ) + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/view-list/ListItem.js b/pc4mobx/prj/components/comp/view-list/ListItem.js new file mode 100644 index 0000000..6771b65 --- /dev/null +++ b/pc4mobx/prj/components/comp/view-list/ListItem.js @@ -0,0 +1,45 @@ +import React from 'react'; +// import ButtonView from '../view-button'; +// import { ListItemProps } from '../../stores/mode-app/BaseStore'; +import classNames from 'classnames'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +// export interface ListItemCompProps { +// data: ListItemProps; +// onClick?: (key: string,special:any) => void; +// showIcon?: boolean; +// currentKey?:string +// } +export default class ListItem extends React.Component { + onClick = () => { + const { data, onClick } = this.props; + onClick && onClick(data.key, data.special); + } + + render() { + const { data, currentKey } = this.props; + const className = classNames('prj-list-item-content'); + let isCurrent = currentKey && currentKey == data.key; + return ( +
    +
    +
    +
    {data.state}
    +
    +
    {data.name}
    +
    + {`${data.label + " : "+ data.person }`} +
    +
    +
    +
    +
    + ) + } +} + diff --git a/pc4mobx/prj/components/comp/view-list/index.js b/pc4mobx/prj/components/comp/view-list/index.js new file mode 100644 index 0000000..290133e --- /dev/null +++ b/pc4mobx/prj/components/comp/view-list/index.js @@ -0,0 +1,50 @@ +import React from 'react'; +import { WeaNewScroll, WeaInputSearch } from 'ecCom'; +import { Pagination } from 'antd'; +import ListItem from './ListItem'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +export default class ListView extends React.Component { + + render() { + const { datas, pagination, scrollHeight = document.documentElement.clientHeight, currentKey, onSearchListItem, onSearchChange, prjValue, fromPortal } = this.props; + return ( +
    + { + !fromPortal&& + } + + {datas.length === 0 ? +

    + {getLabel('83553',"暂无数据")} +

    + : +
    + { + datas && datas.length > 0 && datas.map(d => ( + + )) + } +
    + } + +
    +
    + +
    +
    + ) + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/weaDragula/index.js b/pc4mobx/prj/components/comp/weaDragula/index.js new file mode 100644 index 0000000..eeb2929 --- /dev/null +++ b/pc4mobx/prj/components/comp/weaDragula/index.js @@ -0,0 +1,98 @@ + +import dragula from 'react-dragula'; +import isFunction from 'lodash/isFunction'; +import findIndex from 'lodash/findIndex'; + +class WeaPrjDragula extends React.Component { + constructor(props) { + super(props); + this.drake = null; + } + componentDidMount() { + this.initDragula(); + } + + componentWillUnmount() { + this.drake && this.drake.destroy(); + } + + render() { + return this.props.children; + } + + initDragula = () => { + let {container,canDrag, onDrop, getKeyFromDom, getKeyFromData} = this.props; + if (typeof(container) == "string") { + container = jQuery(container, ReactDOM.findDOMNode(this))[0]; + } else if (isFunction(container)) { + container = container(); + } + this.drake = dragula([container], { + isContainer: function (el) { + return false; + }, + moves: (el, source, handle, sibling) => { + return isFunction(canDrag) ? canDrag(handle, el, source, sibling) : canDrag; + }, + mirrorContainer: container + }); + this.drake.on("drop",(el, target, source, sibling) => { + + let {datas} = this.props; + if (Array.isArray(datas) && isFunction(getKeyFromDom) && isFunction(getKeyFromData) && isFunction(onDrop)) { + let dataKey = getKeyFromDom(el), downKey = sibling ? getKeyFromDom(sibling) : -1; + if (downKey == dataKey) { + downKey = -1; + } + let dataIdx = findIndex(datas, (data) => getKeyFromData(data) == dataKey); + let downIdx = downKey == -1 ? datas.length : findIndex(datas, (data) => getKeyFromData(data) == downKey); + downIdx = downIdx > dataIdx ? downIdx - 1 : downIdx; + let data = datas.splice(dataIdx, 1)[0]; + datas.splice(downIdx, 0, data); + + /* + // 遍历并返回新的数据 + let curData = null; + datas = datas.map((data, index) => { + if (this.getRowKey(data) == key) { + dataIdx = index; + curData = data; + } + if (downKey !== -1 && downKey == this.getRowKey(data)) { + downIdx = dataIdx >= 0 ? index - 1 : index; + } + if (dataIdx == -1 && downIdx == -1) { + // 当前与放置的index都没找到,说明未到影响区 + return data; + } else if (dataIdx >=0 && downIdx == -1) { + // 找到当前的但没有找到放置位置,需要将下方数据上移一位 + return index == datas.length - 1 ? datas[dataIdx] : datas[index + 1]; + } else if (dataIdx == -1 && downIdx >=0) { + // 找到放置位置但没有找到当前的,需要将上方数据下移一位 + return downIdx == index ? null : datas[index - 1]; + } else { + // 都找到之后,如果相等,则做下特殊处理,如果不等,说明已过影响区 + return index == downIdx ? curData : index == dataIdx ? datas[index - 1] : data; + } + }); + // 处理放置位置的数据。 + datas[downIdx] = curData;*/ + onDrop(datas, dataIdx, downIdx); + } else { + isFunction(onDrop) && onDrop(el, sibling, target, source); + } + }); + } + +} + +WeaPrjDragula.propTypes = { + container: React.PropTypes.any,//可拖拽区域 + canDrag: React.PropTypes.any,//是否可拖拽,可以传方法,方法的传参为当前点击的节点。 + onDrop: React.PropTypes.func,//拖拽结束时触发的方法,第1个参数是拖拽的DOM节点,第二个参数是所放下的位置下方的DOM节点。 + datas: React.PropTypes.array,//数组 + getKeyFromData: React.PropTypes.func,//从数组中获得key的方法。 + getKeyFromDom: React.PropTypes.func,//从Dom中获得key的方法 +}; + +export default WeaPrjDragula; \ No newline at end of file diff --git a/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/index.js b/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/index.js new file mode 100644 index 0000000..2f63f11 --- /dev/null +++ b/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/index.js @@ -0,0 +1,317 @@ +import { Table, Icon, Row, Col, Button } from 'antd' +import { WeaTools, WeaCascader, WeaSelect, WeaError } from 'ecCom' +import equal from 'deep-equal'; +import isFunction from 'lodash/isFunction'; +import { Modal } from "antd"; +import { toJS } from "mobx" +import './style/index.css'; +import { WeaLocaleProvider } from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; + +class WeaPrjFieldSetTableEdit extends React.Component { + + select = new Array(); + cascader; + + constructor(props) { + super(props); + this.state = { + columns: [], + datas: [], + selectedRowKeys: [], + current: 1, + showGroup: props.showGroup ? props.showGroup : false + } + } + componentDidMount() { + const { datas = [], columns = [] } = this.props; + columns.length > 0 && this.setState(datas.length > 0 ? { datas: this.addKeytoDatas(datas), columns } : { columns }) + } + + componentWillReceiveProps(nextProps, nextState) { + const _columns = nextProps.columns || []; + const _showGroup = nextProps.showGroup || false; + const _datas = nextProps.datas || []; + !equal(_columns, this.props.columns) && this.setState({ columns: _columns }); + !equal(_showGroup, this.state.showGroup) && this.setState({ showGroup: _showGroup }); + if (!equal(_datas, this.state.datas)) { + this.setState({ datas: this.addKeytoDatas(_datas) }); + } + } + addKeytoDatas(datas) { + let _datas = datas.map((data, i) => { + let _data = { ...data }; + _data.key = i; + return _data + }) + return _datas + } + render() { + const { datas, showGroup, selectedRowKeys } = this.state; + const { title, needAdd } = this.props; + return ( +
    + +
    +
    {title}
    + + {needAdd && +
    + + + this.setState({ showGroup: !showGroup })} /> + + } + + + +
    + + + + + ) + } + getColumns() { + const { columns } = this.state; + let _columns = [].concat(columns); + _columns = _columns.map(col => { + let _col = { ...col }; + + _col.render = (text, record, index) => { + return this.getColRender(_col, text, record, index); + } + return _col + }); + return _columns + } + + getColRender(_col, text, record, index) { + const { com, isTask = false, useRecord = false, dataIndex, } = _col; + const { wftype, notwfid } = this.props; + const { datas } = this.state; + let _com = []; + let list = (useRecord && record.com ? record.com[dataIndex] : com) || []; + list.map((c,i) => { + if (typeof c.props === 'object') { + _com.push(c); + } else { + let { key, label = '', type = 'INPUT', options = [], browserConditionParam = {}, innerStyle = { width: "100%" }, + viewAttr = 2, showTime = false, format = "yyyy-MM-dd", compDef, onChange, otherParams, title } = c; + const _type = type.toUpperCase(); + _com.push( + + {_type === 'TEXT' && {text} + } + {_type === 'SELECT' && isTask &&//任务字段 + { + this.select.push(ref); + } } + error={getLabel(385869,"此项必填")} + tipPosition="top" + style={{width:"100%"}} + > + this.onEdit({ record, index, key, value }, onChange, "getfield")} + /> + + } + {_type === 'SELECT' && !isTask &&//wbs字段 + { + this.select.push(ref); + } } + error={getLabel(385869,"此项必填")} + tipPosition="top" + style={{width:"100%"}} + > + this.onEdit({ record, index, key, value }, onChange)} + /> + + } + {_type === 'CASCADER' && + { + this.cascader=ref; + } } + error={getLabel(385869,"此项必填")} + tipPosition="top" + style={{width:"100%"}} + > + this.onEdit({ record, index, key, value }, onChange)} + /> + + } + + ) + } + }); + return ( +
    + {_com} +
    + ) + } + + getBrowerDatas(record, key) { + let replaceDatas = []; + if (record[key + 'span'] !== undefined) { + let keys = record[key].split(','); + let values = record[key + 'span'].split(','); + if (keys.length === values.length) { + keys.map((k, i) => { + replaceDatas.push({ id: k, name: values[i] }); + }); + } else { + } + } + return replaceDatas + } + getRowSelection() { + const { columns, selectedRowKeys } = this.state; + const { onRowSelect, getRowSelection } = this.props; + if (!`${columns}`) return null; + let rowSelection = { + selectedRowKeys, + onChange: (sRowKeys, selectedRows) => { + this.setState({ selectedRowKeys: sRowKeys }); + typeof onRowSelect === 'function' && onRowSelect(sRowKeys, selectedRows); + }, + }; + if (typeof getRowSelection === 'function') { + rowSelection = getRowSelection(rowSelection); + } + return rowSelection; + } + + onEdit({ record, index, key, value, names, bDatas }, onChange, api) { + const { pageSize = 0, contentStore } = this.props; + const { datas, current } = this.state; + let _datas = [].concat(datas); + _datas[pageSize * (current - 1) + index][key] = value; + if (names) _datas[pageSize * (current - 1) + index][key + 'span'] = names; + let fieldname = _datas[index]['taskfield']; + const params = {fieldname: fieldname } + + if (api && api == "getfield") { + WeaTools.callApi("/api/proj/prjutil/getWbsFieldNum", "POST", { ...params}).then((datas) => { + const options = datas.options; + _datas[index]["com"] = { + ..._datas[index]["com"], + "wbsfield": [{ + "label": "", + "type": "SELECT", + "key": "wbsfield", + "editType": "3", + "options": options + }] + } + _datas[index]["wbsfield"] = ""; + this.setState({ datas: _datas }); + }) + } + this.onChange(_datas); + isFunction(onChange) && onChange(value, record, index, key); + } + + doAdd = () => { + let { datas, columns } = this.state; + let _data = {}; + columns.forEach((col, index) => { + const { com = [], useRecord = false, dataIndex } = col; + com.map(c => { + if (typeof c.props === 'object') { + return; + } + const { key: k, defaultValue } = c; + k && (_data[k] = defaultValue || ''); + }); + _data.com = { + ..._data.com, + [dataIndex]: com + } + _data.viewAttr = "3"; + }); + let _datas = [].concat(datas); + _datas.push(_data); + this.setState({ datas: this.addKeytoDatas(_datas) }); + this.onChange(_datas); + } + + doDelete = () => { + const { datas, selectedRowKeys } = this.state; + const _this = this; + if (selectedRowKeys.length > 0) { + Modal.confirm({ + title: getLabel(15172, '系统提示'), + content: getLabel(83600, '确定要删除吗?'), + onOk() { + let _datas = [].concat(datas); + selectedRowKeys.map(key => { + _datas = _datas.filter(data => data.key !== key) + }); + _datas = _datas.map((data, i) => { + let _data = { ...data }; + _data.key = i; + return _data + }) + _this.setState({ datas: _datas, selectedRowKeys: [] }); + _this.onChange(_datas); + typeof _this.props.onRowSelect === 'function' && _this.props.onRowSelect([]); + }, + onCancel() { }, + }); + } else { + Modal.info({ + title: getLabel(15172, '系统提示'), + content: getLabel(32568, "请选择要删除的记录!") + }); + } + } + onChange(datas) { + const { columns } = this.state; + let _datas = datas.map((data, i) => { + let _data = { ...data } + delete _data.key + return _data + }) + typeof this.props.onChange === 'function' && this.props.onChange(_datas, columns); + } + showErrors() { + toJS(this.select).map(c => { + if (c && !c.props.children.props.value && c.props.children.props.viewAttr == "3") { + c.showError(); + } + }); + } + +} + +export default WeaPrjFieldSetTableEdit; diff --git a/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/style/index.css b/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/style/index.css new file mode 100644 index 0000000..f60912d --- /dev/null +++ b/pc4mobx/prj/components/comp/weaPrjFieldSetTableEdit/style/index.css @@ -0,0 +1,102 @@ +.wea-cpt-table-edit{ + padding-top: 20px; + padding-left: 25px; + padding-right: 25px; +} +.wea-cpt-table-edit .wea-title { + font-size: 15px; + color: #484848; + padding-bottom: 10px; + padding-left: 10px; + border-bottom: solid 1px #ebebeb; +} +.wea-cpt-table-edit .wea-title i { + cursor: pointer; +} +.wea-cpt-table-edit .wea-title button { + width: 20px; + height: 20px; + text-align: center; + padding: 0; + margin-right: 15px; +} +.wea-cpt-table-edit .ant-table-tbody>tr>td { + padding: 10px 8px; + word-break: break-all; +} + +.table-edit-opertion button { + width: 20px; + height: 20px; + text-align: center; + padding: 0; + margin-right: 15px; +} +.wea-cpt-table-edit .ant-table-thead>tr>th { + background-color: #f8fcff; +} +.wea-cpt-table-edit .ant-table-thead>tr>th { + padding-top: 14px; + padding-bottom: 14px; +} +.wea-cpt-table-edit .ant-table-thead th { + border-bottom: 1px solid #eaeaea; + font-weight: 400; +} +.wea-cpt-table-edit .ant-table,.wea-cpt-table-edit .ant-table table { + border-radius: 0; +} +.wea-cpt-table-edit .ant-btn-sm { + border-radius: 0; +} + +.wea-cpt-table-edit-wf{ + padding-top: 8px; +} + +.wea-cpt-table-edit-wf .wea-title { + font-size: 15px; + color: #484848; + padding-bottom: 10px; + padding-left: 10px; + border-bottom: solid 1px #ebebeb; +} +.wea-cpt-table-edit-wf .wea-title i { + cursor: pointer; +} +.wea-cpt-table-edit-wf .wea-title button { + width: 20px; + height: 20px; + text-align: center; + padding: 0; + margin-right: 15px; +} +.wea-cpt-table-edit-wf .ant-table-tbody>tr>td { + padding: 10px 8px; + word-break: break-all; +} + +.table-edit-opertion button { + width: 20px; + height: 20px; + text-align: center; + padding: 0; + margin-right: 15px; +} +.wea-cpt-table-edit-wf .ant-table-thead>tr>th { + background-color: #f8fcff; +} +.wea-cpt-table-edit-wf .ant-table-thead>tr>th { + padding-top: 14px; + padding-bottom: 14px; +} +.wea-cpt-table-edit-wf .ant-table-thead th { + border-bottom: 1px solid #eaeaea; + font-weight: 400; +} +.wea-cpt-table-edit-wf .ant-table,.wea-cpt-table-edit-wf .ant-table table { + border-radius: 0; +} +.wea-cpt-table-edit-wf .ant-btn-sm { + border-radius: 0; +} \ No newline at end of file diff --git a/pc4mobx/prj/components/dialog/ProjectFieldDetailLogDialog.js b/pc4mobx/prj/components/dialog/ProjectFieldDetailLogDialog.js new file mode 100644 index 0000000..b8cb18b --- /dev/null +++ b/pc4mobx/prj/components/dialog/ProjectFieldDetailLogDialog.js @@ -0,0 +1,116 @@ +import { Button, Row, Col} from 'antd'; +import {WeaDialog ,WeaNewScroll ,WeaLocaleProvider ,WeaBrowser ,WeaSelectGroup ,WeaRightMenu} from 'ecCom'; +import {observer} from "mobx-react"; +import _mapValues from 'lodash/mapValues' +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +class ProjectFieldDetailLogDialog extends React.Component { + constructor(props) { + super(props); + this.state = {hrmid:'',date:[]}; + } + + shouldComponentUpdate(nextProps,nextState){ + return true; + } + + render() { + const {title,tableStore,store} = this.props; + const {fieldDetailLogVisible} = store; + const selectLinkageDatas = { + "6": { + conditionType: "RANGEPICKER", + domkey: ["start", "end"] + } + }; + const options = [ + { key: "0", showname: getLabel(332,"全部") }, + { key: "1", showname: getLabel(15537,"今天") }, + { key: "2", showname: getLabel(15539,"本周") }, + { key: "3", showname: getLabel(15541,"本月") }, + { key: "4", showname: getLabel(21904,"本季") }, + { key: "5", showname: getLabel(15384,"本年") }, + { key: "6", showname: getLabel(32530,"指定日期范围") } + ]; + const menu = [ + { + key: '1', + icon: , + content: getLabel(388113,'搜索'), + onClick: () =>{ + store.getPrjFieldDetaiLogList({prjid:store.prjid,fieldname:store.field,...this.state}); + } + }, + { + key: '2', + icon: , + content: getLabel(309,"关闭"), + onClick: () =>{ + store.setFieldDetailLogVisible(false) + } + } + ]; + return ( +
    + {store.setFieldDetailLogVisible(false)}} + style={{width:'700px', height:'400px'}} + > + + +
    {getLabel(99,'操作者')} + + { + this.setState({hrmid:ids}); + } + } + /> + + + {getLabel(22823,'日期')} + + { + this.setState({date:value}); + }} + /> + + + + + + + + ) + } + + getButtons(){ + const {store} = this.props; + let btnArr = []; + btnArr.push() + return btnArr; + } + +} + +export default ProjectFieldDetailLogDialog; \ No newline at end of file diff --git a/pc4mobx/prj/components/dialog/SaveTemplateDialog.js b/pc4mobx/prj/components/dialog/SaveTemplateDialog.js new file mode 100644 index 0000000..5afc14e --- /dev/null +++ b/pc4mobx/prj/components/dialog/SaveTemplateDialog.js @@ -0,0 +1,65 @@ +import React from 'react'; +import { Button, Modal } from 'antd'; +import { inject, observer } from 'mobx-react'; +import { WeaLocaleProvider ,WeaDialog,WeaInput,WeaFormItem,WeaError} from "ecCom" + +const getLabel = WeaLocaleProvider.getLabel; + + +@observer +export default class SvaeTemplateDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + date: "" + } + } + componentDidMount() { + + } + + onCheck(){ + const { prjCardStore } = this.props; + const {doSaveTemplet,templatename} = prjCardStore; + if(templatename.trim()===""){ + this.refs.weaError.showError(); + }else{ + doSaveTemplet(); + } + } + + render() { + const { prjCardStore } = this.props; + const {prjname,setVisiable,saveTemplateName,doSaveVisible } = prjCardStore; + + return
    + { setVisiable(false) }} + icon='icon-coms-project' + iconBgcolor='#217346' + style={{width: 380, height: 80}} + buttons={ [ + , + ]} + > + + + { + saveTemplateName(v); + }} + /> + + + +
    + } +} diff --git a/pc4mobx/prj/components/dialog/addPrjGroupDialog.js b/pc4mobx/prj/components/dialog/addPrjGroupDialog.js new file mode 100644 index 0000000..9e63d70 --- /dev/null +++ b/pc4mobx/prj/components/dialog/addPrjGroupDialog.js @@ -0,0 +1,49 @@ + +import { Button,Spin} from 'antd'; +import {WeaLocaleProvider, WeaDialog, WeaSelect, WeaFormItem} from "ecCom" +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import ProjectCondition from '../list/projectCondition'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +class AddPrjGroupDialog extends React.Component { + constructor(props) { + super(props); + this.state={ + width:1020, + height:650, + } + } + + render() { + const {prjGroupStore} = this.props; + const {visible,handlePrjGroupDialog,fieldinfo,form,setFormFields,title} = prjGroupStore; + return ( +
    + handlePrjGroupDialog(false)} + buttons={this.getDialogButtons()} + > + {setFormFields(v)}} /> + +
    ) + } + + getDialogButtons(){ + const {projectPortalStore,prjGroupStore} = this.props; + let btn = []; + btn.push(); + btn.push(); + return btn + } + +} + +export default AddPrjGroupDialog; \ No newline at end of file diff --git a/pc4mobx/prj/components/dialog/addProjectDialog.js b/pc4mobx/prj/components/dialog/addProjectDialog.js new file mode 100644 index 0000000..d0ad70e --- /dev/null +++ b/pc4mobx/prj/components/dialog/addProjectDialog.js @@ -0,0 +1,232 @@ + +import { Button,Spin} from 'antd'; +import {WeaDialog,WeaTab,WeaNewScroll,WeaRightMenu,WeaLocaleProvider } from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import PrjTaskListTable from '../comp/prjTaskListTable' +import ProjectCondition from '../list/projectCondition' +import StageList from '../common/stageList'; +const getLabel = WeaLocaleProvider.getLabel; + +@observer +class AddProjectDialog extends React.Component { + constructor(props) { + super(props); + this.state={ + width:1020, + height:650, + } + } + componentDidMount(){ + } + componentWillReceiveProps(nextProps){ + } + render() { + const {addProjectStore} = this.props.contentStore; + const {title,selectedKey,visible,conditionDatas:{userid,taskinfo,fieldinfo,taskViewAttr},saveListDatas,saveRowKeys,selectedRowKey,spinning} = addProjectStore; + const {form,setFormFields,setValidate,isTimeShow} = addProjectStore; + const tabs = [{key:"prjinfo",title:getLabel(16290,"项目信息")},{key:"sublist",title:getLabel(18505,"任务列表")}, { key: "stagelist", title: getLabel('387407',"阶段设置") },{ key: "rolelist", title: "角色管理" }]; + const { width} = this.state; + const formParams = form.getFormParams() || {}; + const {roleIframeUrl} = addProjectStore; + let dialogHeight = window.innerHeight - 150; + if (dialogHeight > 600) dialogHeight = 600; + + return ( +
    + addProjectStore.handleShareDialog(false)} + buttons={this.getDialogButtons()} + > + + + + +
    + {setFormFields(v)}} setValidate={(v)=>{setValidate(v)}} /> +
    +
    + {saveListDatas(datas)}} + onRowSelect={(rowkeys)=>{saveRowKeys(rowkeys)}} + stageOptions={this.getStageOptions()} + isTimeShow={isTimeShow} + /> +
    +
    + { this.StageList = el }} contentStore={addProjectStore} /> +
    +
    + */} +
    + ) + + } + + closeRight = (bool) => { + this.setState({ + showRight : bool + }) + } + + getRenderRight = () => { + const { mindMapStore, location: { query } } = this.props; + const {prjTaskCardStore, renderType} = mindMapStore; + if(renderType == "prjEdit" && this.state.selectObj.type == "prj"){ + return ; + } + if(renderType == "taskEdit" && this.state.selectObj.type == "task"){ + return this.state.selectObj.id.replace("task_","") && { mindMapStore.initPath(query);}} contentStore={mindMapStore} taskCardStore={prjTaskCardStore} taskid={this.state.selectObj.id.replace("task_","").replace("prj_","")} />; + + // return "/spa/prj/index.html#/main/prj/taskCard?taskid="+this.state.selectObj.id.replace("task_",""); + } + } + + getRightMenus = () => { + let selectObj = this.state.selectObj; + let rightMenus = []; + if(selectObj.type == "prj"){ + rightMenus.push({ + action : (e)=>this.editProject(e), + name : getLabel(33564, "查看"), + icon : "icon-coms-search", + }); + // if(selectObj.editOk){ + // rightMenus.push({ + // action : (e)=>this.editProject(e), + // name : "编辑", + // icon : "icon-coms-edit", + // }); + // } + if(selectObj.editTaskOk){ + rightMenus.push({ + action : (e)=>this.addTask(e), + name : getLabel('15266', '新建任务'), + icon : "icon-coms-New-Flow", + }); + } + + }else if(selectObj.type == "task"){ + rightMenus.push({ + action : (e)=>this.editTask(e), + name : getLabel(33564, "查看"), + icon : "icon-coms-search", + }); + if(selectObj.canEditAndDel){ + // rightMenus.push({ + // action : (e)=>this.editTask(e), + // name : "编辑", + // icon : "icon-coms-edit", + // }); + rightMenus.push({ + action : (e)=>this.delTask(e), + name : getLabel(131966,"删除"), + icon : "icon-coms-delete", + }); + } + if(selectObj.canAddChild){ + rightMenus.push({ + action : (e)=>this.addChildTask(e), + name : getLabel('382600','新建下级任务') , + icon : "icon-coms-New-Flow", + }); + } + } + return rightMenus; + } + + editProject = (e) => { + e.stopPropagation && e.stopPropagation(); + // this.setState({ + // renderType : "prjEdit", + // // showRight : true, + // }); + const { showSlideModal, setRenderType } = this.props.mindMapStore; + showSlideModal(true); + setRenderType("prjEdit"); + } + + editTask = (e) => { + e.stopPropagation && e.stopPropagation(); + // this.setState({ + // renderType : "taskEdit", + // // showRight : true, + // }); + const { showSlideModal, setRenderType } = this.props.mindMapStore; + showSlideModal(true); + setRenderType("taskEdit"); + } + + delTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const _this = this; + const { mindMapStore, location: { query } } = this.props; + Modal.confirm({ + title: getLabel(15172, "系统提示"), + content: getLabel(83925, "该任务及其子任务都会被删除,您确认要删除吗?"), + onOk() { + Task_Apis.delTask({ method: "del" , taskid: _this.state.selectObj.id.replace("task_","")}).then(data => { + if (data.success) { + mindMapStore.initPath(query); + message.success(getLabel(83472, "删除成功!")); + } else { + message.error(getLabel(383746, "请求失败") + ":" + data.msgcode); + } + }) + }, + onCancel() { }, + }) + } + + addTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const { mindMapStore, location: { query : { prjid }} } = this.props; + const { taskInfoStore } = mindMapStore; + taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: "" }); + } + + addChildTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const { mindMapStore, location: { query : { prjid }} } = this.props; + const { taskInfoStore } = mindMapStore; + taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: this.state.selectObj.id.replace("task_","") }); + } + + zoom = (scale) => { + const { mindMapStore, params } = this.props; + mindMapStore.changeScale(parseInt(scale * 10)); + } + +} + +export default MindMapPage; \ No newline at end of file diff --git a/pc4mobx/prj/components/mindmap/TaskCard.js b/pc4mobx/prj/components/mindmap/TaskCard.js new file mode 100644 index 0000000..3c42c30 --- /dev/null +++ b/pc4mobx/prj/components/mindmap/TaskCard.js @@ -0,0 +1,496 @@ +import React from 'react'; +import { Button, Tabs, Row, Col, InputNumber, Modal, message } from 'antd'; +import { inject, observer } from 'mobx-react'; +import { toJS } from "mobx" +import { WeaRightMenu, WeaReqTop, WeaNewScroll, WeaTools, WeaAlertPage, WeaDialog, WeaBrowser, WeaLocaleProvider, WeaTop, WeaTab } from "ecCom" +import { WeaTableNew, WeaSwitch } from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; +import RelareExchange from '../common/relateExchange' +import TabDiscuss from '../common/TabDiscuss' +import RelateWorkFlow from '../common/relateWorkFlow' +import RelateDocument from "../common/relateDocument" +import TaskSub from '../projectBoard/taskSub' +import TaskShare from '../common/sharePage' +import TaskInfo from '../common/taskInfo' +import RealteCrmDialog from '../dialog/relateCrmDialog' +import "../projectBoard/style/slide.less" +@observer +export default class TaskCard extends React.Component { + componentDidMount() { + const { taskCardStore, taskid } = this.props; + const { getTaskTabs } = taskCardStore; + getTaskTabs({taskid: taskid }); + } + componentWillUnmount() { + + } + + componentWillReceiveProps(nextprops) { + const { taskCardStore } = this.props; + const { clearStatus, getTaskTabs } = taskCardStore; + if (this.props.taskid !== nextprops.taskid) { + clearStatus(); + getTaskTabs({ taskid: nextprops.taskid }); + } + } + + render() { + const { taskCardStore, callBack } = this.props; + const { tabDatas, selectTabKey, loading, taskname, shareStore, hasRight, verified, form, taskid, saveAndReLoadWf } = taskCardStore; + if (verified && !hasRight) { + return ( +
    + {getLabel(2012, "对不起,您暂时没有权限!")} +
    +
    + ) + } + if (verified && hasRight) { + const tabDatas1 = toJS(tabDatas); + let _this = this; + let tabUrl = function (key) { + if (tabDatas1) { + for (let i = 0; i < tabDatas1.length; i++) { + if (tabDatas1[i].id == key && tabDatas1[i].shortname == "taskinfo") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "tasksub") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "exchange") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "taskshare") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "req") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "doc") { + return
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "crm") { + return
    {_this.getReleateCrmOrCpt("crm")}
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "cpt") { + return
    {_this.getReleateCrmOrCpt("cpt")} + _this.addCapital(ids, names, datas)} customized={true} hasAdvanceSerach={true}> +
    + } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "") { + if (tabDatas[i].linkurl.indexOf("noright") > -1) { + return +
    + {getLabel(2012, "对不起,您暂时没有权限!")} +
    +
    + } else { + return tabDatas1[i].linkurl; + } + } + } + return "" + } + }(selectTabKey); + return ( +
    + + } + iconBgcolor='#217346' + buttons={this.getButtons()} + buttonSpace={10} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + onDropMenuClick={this.onRightMenuClick.bind(this)} + tabDatas={tabDatas} + selectedKey={selectTabKey} + onChange={this.taskCardChangeTab.bind(this)} + > +
    +
    + + { + typeof tabUrl === "object" ? tabUrl : + */} +
    + ) + + } + + closeRight = (bool) => { + this.setState({ + showRight : bool + }) + } + + getRenderRight = () => { + const { mindMapStore, prjid } = this.props; + const {prjTaskCardStore, renderType} = mindMapStore; + if(renderType == "prjEdit" && this.state.selectObj.type == "prj"){ + return ; + } + if(renderType == "taskEdit" && this.state.selectObj.type == "task"){ + return this.state.selectObj.id.replace("task_","") && { mindMapStore.initPath({prjid:prjid});}} contentStore={mindMapStore} taskCardStore={prjTaskCardStore} taskid={this.state.selectObj.id.replace("task_","").replace("prj_","")} />; + + // return "/spa/prj/index.html#/main/prj/taskCard?taskid="+this.state.selectObj.id.replace("task_",""); + } + } + + getRightMenus = () => { + let selectObj = this.state.selectObj; + let rightMenus = []; + if(selectObj.type == "prj"){ + rightMenus.push({ + action : (e)=>this.editProject(e), + name : getLabel(33564, "查看"), + icon : "icon-coms-search", + }); + // if(selectObj.editOk){ + // rightMenus.push({ + // action : (e)=>this.editProject(e), + // name : "编辑", + // icon : "icon-coms-edit", + // }); + // } + if(selectObj.editTaskOk){ + rightMenus.push({ + action : (e)=>this.addTask(e), + name : getLabel('15266', '新建任务'), + icon : "icon-coms-New-Flow", + }); + } + + }else if(selectObj.type == "task"){ + rightMenus.push({ + action : (e)=>this.editTask(e), + name : getLabel(33564, "查看"), + icon : "icon-coms-search", + }); + if(selectObj.canEditAndDel){ + // rightMenus.push({ + // action : (e)=>this.editTask(e), + // name : "编辑", + // icon : "icon-coms-edit", + // }); + rightMenus.push({ + action : (e)=>this.delTask(e), + name : getLabel(131966,"删除"), + icon : "icon-coms-delete", + }); + } + if(selectObj.canAddChild){ + rightMenus.push({ + action : (e)=>this.addChildTask(e), + name : getLabel('382600','新建下级任务') , + icon : "icon-coms-New-Flow", + }); + } + } + return rightMenus; + } + + editProject = (e) => { + e.stopPropagation && e.stopPropagation(); + // this.setState({ + // renderType : "prjEdit", + // // showRight : true, + // }); + const { showSlideModal, setRenderType } = this.props.mindMapStore; + showSlideModal(true); + setRenderType("prjEdit"); + } + + editTask = (e) => { + e.stopPropagation && e.stopPropagation(); + // this.setState({ + // renderType : "taskEdit", + // // showRight : true, + // }); + const { showSlideModal, setRenderType } = this.props.mindMapStore; + showSlideModal(true); + setRenderType("taskEdit"); + } + + delTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const _this = this; + const { mindMapStore, prjid} = this.props; + Modal.confirm({ + title: getLabel(15172, "系统提示"), + content: getLabel(83925, "该任务及其子任务都会被删除,您确认要删除吗?"), + onOk() { + Task_Apis.delTask({ method: "del" , taskid: _this.state.selectObj.id.replace("task_","")}).then(data => { + if (data.success) { + mindMapStore.initPath({prjid}); + message.success(getLabel(83472, "删除成功!")); + } else { + message.error(getLabel(383746, "请求失败") + ":" + data.msgcode); + } + }) + }, + onCancel() { }, + }) + } + + addTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const { mindMapStore, prjid } = this.props; + const { taskInfoStore } = mindMapStore; + taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: "" }); + } + + addChildTask = (e) => { + e.stopPropagation && e.stopPropagation(); + const { mindMapStore, prjid } = this.props; + const { taskInfoStore } = mindMapStore; + taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: this.state.selectObj.id.replace("task_","") }); + } + + zoom = (scale) => { + const { mindMapStore, params } = this.props; + mindMapStore.changeScale(parseInt(scale * 10)); + } + +} + +export default MindMapPage; \ No newline at end of file diff --git a/pc4mobx/prj/components/single/mindmap/index.less b/pc4mobx/prj/components/single/mindmap/index.less new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/prj/components/single/project/ProjectStastics.js b/pc4mobx/prj/components/single/project/ProjectStastics.js new file mode 100644 index 0000000..93d47e7 --- /dev/null +++ b/pc4mobx/prj/components/single/project/ProjectStastics.js @@ -0,0 +1,399 @@ +import { inject,observer } from "mobx-react"; +import {withRouter} from 'react-router'; +import { Tooltip } from 'antd'; +import { WeaLocaleProvider, WeaEchart } from 'ecCom'; +import { toJS } from 'mobx'; +const getLabel = WeaLocaleProvider.getLabel; + +@inject('prjStasticStore') +@withRouter +@observer + class ProjectStastics extends React.Component { + + constructor(props) { + super(props); + this.chart1 = null; + this.chart2 = null; + this.chart3 = null; + this.setChart1Ref = element => { + this.chart1 = element; + } + this.setChart2Ref = element => { + this.chart2 = element; + } + this.setChart3Ref = element => { + this.chart3 = element; + } + const _this = this; + window.onresize = function() { + _this.chart1 && _this.chart1.chart.resize(); + _this.chart2 && _this.chart2.chart.resize(); + _this.chart3 && _this.chart3.chart.resize(); + } + } + componentDidMount(){ + const {prjid} = this.props; + const { location, prjStasticStore } = this.props; + if(prjid==''||prjid==null){ + prjStasticStore.initDatas(location.query.prjid); + }else{ + prjStasticStore.initDatas(prjid); + } + } + componentWillReceiveProps(nextProps) { + const {prjid} = this.props; + if(prjid==''||prjid==null){ + if (this.props.location.key !== nextProps.location.key) { + const { prjStasticStore } = nextProps; + this.chart1 && this.chart1.paint(); + this.chart2 && this.chart2.paint(); + this.chart3 && this.chart3.paint(); + prjStasticStore.initDatas(location.query.prjid); + } + }else{ + if (this.props.prjid !== nextProps.prjid) { + const { location, prjStasticStore } = nextProps; + this.chart1 && this.chart1.paint(); + this.chart2 && this.chart2.paint(); + this.chart3 && this.chart3.paint(); + prjStasticStore.initDatas(prjid); + } + } + } + render() { + const { prjStasticStore: { stastics } } = this.props; + let chartdata = toJS(stastics); + let charts = { + option1: { + tooltip: { + trigger: 'item', + formatter: "{a}
    {b}: {c} ({d}%)" + }, + legend: { + orient: 'vertical', + x: 'left', + data: chartdata.chart1 ? chartdata.chart1.legend:[] + }, + series: [ + { + type: 'pie', + radius: ['50%', '70%'], + avoidLabelOverlap: false, + label: { + normal: { + show: false, + position: 'center' + }, + emphasis: { + show: true, + textStyle: { + fontSize: '30', + fontWeight: 'bold' + } + } + }, + labelLine: { + normal: { + show: false + } + }, + // data: [ + // { value: 335, name: '直接访问' }, + // { value: 310, name: '邮件营销' }, + // { value: 234, name: '联盟广告' }, + // { value: 135, name: '视频广告' }, + // { value: 1548, name: '搜索引擎' } + // ] + data : chartdata.chart1 ? chartdata.chart1.series:[] + } + ] + }, + option2:{ + color: ['#0270c1','#C2C9D4', '#75D294', '#F72E04'], + tooltip: { + trigger: 'none', + axisPointer: { + type: 'cross' + } + }, + legend: { + data:[getLabel(23774,"已完成"),getLabel(1979,"未开始"),getLabel(1960,"进行中"),getLabel(32556,"已延期")] + }, + grid: { + top: 70, + bottom: 50 + }, + xAxis: [ + { + type: 'category', + axisTick: { + alignWithLabel: true + }, + axisLine: { + onZero: false, + lineStyle: { + color:'#d14a61' + } + }, + axisPointer: { + label: { + formatter: function (params) { + return getLabel(1331,"数量")+' ' + params.value + + (params.seriesData.length>3 ? ':' +(parseInt(params.seriesData[0].data)+parseInt(params.seriesData[1].data)+parseInt(params.seriesData[2].data)+parseInt(params.seriesData[3].data)): ''); + } + } + }, + //data: ["2016-1", "2016-2", "2016-3", "2016-4", "2016-5", "2016-6", "2016-7", "2016-8", "2016-9", "2016-10", "2016-11", "2016-12"] + data : chartdata.chart2 ? chartdata.chart2.xAxis:[] + }, + ], + yAxis: [ + { + type: 'value' + } + ], + series: [ + { + name:getLabel(23774,"已完成"), + type:'line', + smooth: true, + //data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] + data : chartdata.chart2 ? chartdata.chart2.finish_data:[] + }, + { + name:getLabel(1979,"未开始"), + type:'line', + smooth: true, + //data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3] + data : chartdata.chart2 ? chartdata.chart2.todo_data:[] + }, + { + name:getLabel(1960,"进行中"), + type:'line', + smooth: true, + data : chartdata.chart2 ? chartdata.chart2.doing_data:[] + }, + { + name:getLabel(32556,"已延期"), + type:'line', + smooth: true, + data : chartdata.chart2 ? chartdata.chart2.overtime_data:[] + } + ] + }, + option3: { + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + label: { + backgroundColor: '#6a7985' + } + } + }, + legend: { + data: [getLabel(23774,"已完成"),getLabel(1979,"未开始"), getLabel(1960,"进行中"), getLabel(32556,"已延期")] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: [ + { + type: 'category', + boundaryGap: false, + //data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] + data : chartdata.chart3 ? chartdata.chart3.xAxis:[] + } + ], + yAxis: [ + { + type: 'value' + } + ], + series: [ + { + name: getLabel(23774,"已完成"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.finish_data:[], + color: { + colorStops: [{ + offset: 0, color: '#0270c1' // 0% 处的颜色 + }, { + offset: 1, color: '#0270c1' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(1979,"未开始"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.todo_data:[], + color: { + colorStops: [{ + offset: 0, color: '#C2C9D4' // 0% 处的颜色 + }, { + offset: 1, color: '#C2C9D4' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(1960,"进行中"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.doing_data:[], + color: { + colorStops: [{ + offset: 0, color: '#75D294' // 0% 处的颜色 + }, { + offset: 1, color: '#75D294' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + }, + { + name: getLabel(32556,"已延期"), + type: 'line', + areaStyle: { normal: {} }, + data : chartdata.chart3 ? chartdata.chart3.overtime_data:[], + color: { + colorStops: [{ + offset: 0, color: '#F72E04' // 0% 处的颜色 + }, { + offset: 1, color: '#F72E04' // 100% 处的颜色 + }], + globalCoord: false // 缺省为 false + } + } + ] + } + + } + + // let topTab = [ + // { + // color: '#000000', + // groupid: 'flowAll', + // showcount: true, + // title: '任务统计', + // viewcondition: 0 + // }, + // { + // color: '#ff3232', + // groupid: 'flowNew', + // showcount: true, + // title: '按负责人', + // viewcondition: 1 + // }, + // { + // color: '#fea468', + // groupid: 'flowRes', + // showcount: true, + // title: '按看板', + // viewcondition: 2 + // } + // ]; + + return ( +
    + {/* {this.getStastics(toJS(stastics))} */} +
    +
    + +
    + {chartdata.allnum ? chartdata.allnum.value:0}{getLabel(27591,"个")} + {chartdata.allnum ? chartdata.allnum.lable:''} +
    +
    + +
    + {chartdata.finishnum ? chartdata.finishnum.value:0}{getLabel(27591,"个")} + {chartdata.finishnum ? chartdata.finishnum.lable:''} +
    +
    + +
    + {chartdata.todonum ? chartdata.todonum.value:0}{getLabel(27591,"个")} + {chartdata.todonum ? chartdata.todonum.lable:''} +
    +
    + +
    + {chartdata.doingnum ? chartdata.doingnum.value:0}{getLabel(27591,"个")} + {chartdata.doingnum ? chartdata.doingnum.lable:''} +
    +
    + +
    + {chartdata.overtimenum ? chartdata.overtimenum.value:0}{getLabel(27591,"个")} + {chartdata.overtimenum ? chartdata.overtimenum.lable:''} +
    +
    + +
    + {chartdata.workday1 ? chartdata.workday1.value:0}{getLabel(1925,"天")} + {chartdata.workday1 ? chartdata.workday1.lable:''} +
    +
    + +
    + {chartdata.workday2 ? chartdata.workday2.value:0}{getLabel(1925,"天")} + {chartdata.workday2 ? chartdata.workday2.lable:''} +
    +
    +
    +
    + +
    + {chartdata.hrmidsnum ? chartdata.hrmidsnum.value:0}{getLabel(127,"人")} + {chartdata.hrmidsnum ? chartdata.hrmidsnum.lable:''} +
    +
    + +
    + {chartdata.members ? chartdata.members.value:0}{getLabel(127,"人")} + {chartdata.members ? chartdata.members.lable:''} +
    +
    +
    +
    + +
    +
    +
    +
    {getLabel(387425,"阶段任务分布")}
    +
    + {chartdata.chart1&&} +
    +
    +
    +
    {getLabel(387426,"阶段任务状态统计")}
    +
    + {chartdata.chart2&&} +
    +
    +
    +
    +
    +
    {getLabel(387427,"负责人任务状态统计")}
    +
    + {chartdata.chart3&&} +
    +
    +
    +
    +
    + ) + } + + + +} + +export default ProjectStastics; + diff --git a/pc4mobx/prj/components/single/project/ProjectSub.js b/pc4mobx/prj/components/single/project/ProjectSub.js new file mode 100644 index 0000000..bdb8768 --- /dev/null +++ b/pc4mobx/prj/components/single/project/ProjectSub.js @@ -0,0 +1,218 @@ + +import {Button,Row,Col,Icon,message,Modal} from 'antd'; +import {WeaTab,WeaAlertPage, WeaProgress,WeaLocaleProvider,WeaRightMenu,WeaTop} from 'ecCom'; +import {inject, observer} from "mobx-react"; +import {withRouter} from 'react-router'; +import {toJS} from 'mobx'; +import {Condition} from '../../list/listCondition'; +import ProjectDialog from '../../dialog/projectDialog' +import ShareDialog from '../../dialog/shareDialog' +import ExchangeDialog from '../../dialog/exchangeDialog' +import AddProject from '../../dialog/addProjectDialog' +import {WeaTableNew} from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; + +@inject('projectSubStore') +@withRouter +@observer +class ProjectSub extends React.Component { + constructor(props) { + super(props); + + + } + componentDidMount(){ + const {prjid} = this.props; + const {location, projectSubStore } = this.props; + if(prjid==''||prjid==null){ + projectSubStore.initData(location.query.prjid); + }else{ + projectSubStore.initData(prjid); + } + } + componentWillReceiveProps(nextProps) { + const {prjid} = this.props; + if(prjid==''||prjid==null){ + if (this.props.location.key !== nextProps.location.key) { + const {location, projectSubStore } = nextProps; + projectSubStore.initData(location.query.prjid); + } + }else{ + if (this.props.prjid !== nextProps.prjid) { + const { projectSubStore } = nextProps; + projectSubStore.initData(prjid); + } + } + } + render() { + const {projectSubStore} = this.props; + const {showSearchAd,prjSubStore,prjSubform,condition,prjsubRight:{hasRight,verified},exchangeStore,projectInfoStore,reLoad} = projectSubStore; + const formParams = prjSubform.getFormParams() || {}; + if (verified && !hasRight) { + return ( +
    + {getLabel(2012,"对不起,您暂时没有权限!")} +
    +
    + ) + } + + if (verified && hasRight) { + return ( +
    + + + {projectSubStore.setShowSearchAd(bool)}} + hideSearchAd={()=> projectSubStore.setShowSearchAd(false)} + searchsAd={ +
    + } + showSearchAd={showSearchAd} + onSearch={v=>{projectSubStore.getPrjSubList()}} + onSearchChange={v=>{projectSubStore.appendFormFields({prjname:{value:v}})}} + /> + reLoad(prjSubStore)} + getColumns={c=>this.reRenderColumns(c)} + onOperatesClick={this.onOperatesClick.bind(this)} + /> + + + + +
    +
    + ) + } + return
    + } + + reRenderColumns(columns){ + columns.forEach((c,i)=>{ + if(c.dataIndex=='finish'){ + c.render = function(text, record){ + return + + + } + } else { + // c.render = function(text, record){ + // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; + // return + // } + } + }) + return columns; + } + + onOperatesClick(record,index,operate,flag){ + const {projectSubStore} = this.props; + const {shareStore,exchangeStore,projectInfoStore } = projectSubStore; + let _href = operate && operate.href ? operate.href : ""; + let fn = _href.replace("javascript:",""); + fn = fn.substring(0,fn.indexOf('(')); + let that = this; + // saveCapitalId(record.randomFieldId); //保存资产id + if(fn != ""){ + if("onShare"==fn){ //共享 + shareStore.handleShareDialog(true,"prj",record.randomFieldId) + }else if('onNormal' == fn){ //正常 + projectSubStore.doSubPlanOpt({method:'normal',prjid:record.randomFieldId}) + }else if('onOver' == fn){ //延期 + projectSubStore.doSubPlanOpt({method:'delay',prjid:record.randomFieldId}) + }else if('onFinish' == fn){ //完成 + projectSubStore.doSubPlanOpt({method:'complete',prjid:record.randomFieldId}) + }else if('onFrozen' == fn){ //冻结 + projectSubStore.doSubPlanOpt({method:'freeze',prjid:record.randomFieldId}) + }else if('onEdit' == fn){ //编辑 + projectInfoStore.handleDialog(true,record.randomFieldId,{viewtype:'edit',prjid:record.randomFieldId}) ; + }else if('onListTask' == fn){ //任务列表 + + }else if('onDiscuss' == fn){ //相关交流 + exchangeStore.handleExchangeDialog(true,"prj",record.randomFieldId,{}) + } + } + } + getRightMenu() { + const { projectSubStore } = this.props; + const { rightMenu } = projectSubStore; + let btnArr = []; + rightMenu && rightMenu.length > 0 && rightMenu.map(m => { + let disabled = false; + btnArr.push({ + icon: , + content: m.menuName, + disabled: disabled + }) + }); + return btnArr + } + onRightMenuClick(key) { + let that = this; + const { projectSubStore } = this.props; + const { rightMenu, prjid, addProjectStore} = projectSubStore; + rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => { + if (Number(key) == i) { + if (m.type == "BTN_NEWPRJSUB") { //新建子项目 + addProjectStore.handleShareDialog(true, { viewtype: 'add', prjid: prjid }); + } + + if (m.type == "BTN_COLUMN") { //显示定制 + projectSubStore.onShowColumn(); + } + } + }); + } + + getAdButtons = () => { + const {projectSubStore} = this.props; + const {getPrjSubList,setShowSearchAd,clearFormFields} = projectSubStore; + return [ + (), + (), + () + ]; + } + + getButtons() { + const { projectSubStore } = this.props; + const { rightMenu, prjid, addProjectStore} = projectSubStore; + let btnArr = []; + rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => { + m.isTop == '1' && btnArr.length < 4 && btnArr.push( + + ); + }); + return btnArr; + } + + onEnterSearch=() =>{ + const { projectSubStore } = this.props; + projectSubStore.getPrjSubList(); + projectSubStore.setShowSearchAd(false); + } + +} + +export default ProjectSub; \ No newline at end of file diff --git a/pc4mobx/prj/components/single/project/ResourcePage.js b/pc4mobx/prj/components/single/project/ResourcePage.js new file mode 100644 index 0000000..735d075 --- /dev/null +++ b/pc4mobx/prj/components/single/project/ResourcePage.js @@ -0,0 +1,228 @@ +import { inject,observer } from "mobx-react"; +import React from 'react'; +import {withRouter} from 'react-router'; +import { toJS } from 'mobx'; +import {WeaAlertPage} from 'ecCom'; +import {WeaLocaleProvider} from 'ecCom'; +const getLabel = WeaLocaleProvider.getLabel; +import {Spin} from 'antd'; +import '../../../style/resource.less'; + +@inject('prjResourceStore') +@withRouter +@observer + class ResourcePage extends React.Component { + + constructor(props) { + super(props); + } + componentDidMount(){ + const {prjid} = this.props; + const { location, prjResourceStore } = this.props; + if(prjid==''||prjid==null){ + prjResourceStore.initDatas(location.query.prjid); + }else{ + prjResourceStore.initDatas(prjid); + } + } + componentWillReceiveProps(nextProps) { + const {prjid} = this.props; + if(prjid==''||prjid==null){ + if (this.props.location.key !== nextProps.location.key) { + const { location, prjResourceStore } = nextProps; + prjResourceStore.initDatas(location.query.prjid); + } + }else{ + if (this.props.prjid !== nextProps.prjid) { + const { location, prjResourceStore } = nextProps; + prjResourceStore.initDatas(prjid); + } + } + } + render() { + const {prjResourceStore} = this.props; + let {resourceInfo} = prjResourceStore; + let resource = toJS(resourceInfo); + if (!resource.success) { + return ( +
    + ); + } + let Document, Workflow, Customer, Project, Task, Accessory, Capital; + //相关文档 + resource.docList && ( + Document = resource.docList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关流程 + resource.wfList && ( + Workflow = resource.wfList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关客戶 + resource.cusList && ( + Customer = resource.cusList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关項目 + resource.prjList && ( + Project = resource.prjList.map((item, index) => { + return ( +
  • {item.name}
  • + ) + })) + + //相关任务 + resource.taskList && ( + Task = resource.taskList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + //相关附件 + resource.accList && ( + Accessory = resource.accList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + //相关资产 + resource.cptList && ( + Capital = resource.cptList.map((item, index) => { + return ( +
  • + {item.name} +
  • + ) + })) + + return (
    {((resource.docList && resource.docList.length !== 0) || (resource.wfList && resource.wfList.length !== 0) || + (resource.cusList && resource.cusList.length !== 0) || (resource.prjList && resource.prjList.length !== 0) || + (resource.taskList && resource.taskList.length !== 0) || (resource.accList && resource.accList.length !== 0)) ? ( +
    + { + (resource.docList && resource.docList.length !== 0) && ( +
    +
    + + {getLabel(857, '相关文档')} +
    + +
    + ) + } + + {(resource.wfList && resource.wfList.length !== 0) && ( +
    +
    + + {getLabel(1044, '相关流程')} +
    +
      + {Workflow} +
    +
    + )} + + + {(resource.accList && resource.accList.length !== 0) && ( +
    +
    + + {getLabel(22194, '相关附件')} +
    + +
    + )} + + {(resource.prjList && resource.prjList.length !== 0) && ( +
    +
    + + {getLabel(782, '相关项目')} +
    +
      + {Project} +
    +
    + )} + + {(resource.taskList && resource.taskList.length !== 0) && ( +
    +
    + + {getLabel(33414, '相关任务')} +
    +
      + {Task} +
    +
    + )} + + {(resource.cusList && resource.cusList.length !== 0) && ( +
    +
    + + {getLabel(783, '相关客户')} +
    +
      + {Customer} +
    +
    + )} + + {(resource.cptList && resource.cptList.length !== 0) && ( +
    +
    + + {getLabel(858, '相关资产')} +
    +
      + {Capital} +
    +
    + )} + + +
    ) : ( +
    + +
    {getLabel(83553, '暂无数据')}
    +
    +
    + )}
    ) + } + + + +} + +export default ResourcePage; + diff --git a/pc4mobx/prj/components/single/project/StageSetList.js b/pc4mobx/prj/components/single/project/StageSetList.js new file mode 100644 index 0000000..4dd2477 --- /dev/null +++ b/pc4mobx/prj/components/single/project/StageSetList.js @@ -0,0 +1,171 @@ + +import React from 'react'; +import {withRouter} from 'react-router'; +import { WeaTableEdit,WeaRightMenu,WeaTop } from 'ecCom'; +import { Button } from 'antd'; +import { toJS } from 'mobx'; +import {inject, observer} from "mobx-react"; + +@inject('stageSetStore') +@withRouter +@observer + class StageSetList extends React.Component { + + constructor(props) { + super(props); + } + componentDidMount(){ + const {prjid} = this.props; + const { location, stageSetStore } = this.props; + if(prjid==''||prjid==null){ + stageSetStore.initData(location.query.prjid); + }else{ + stageSetStore.initData(prjid); + } + } + + componentWillUnmount() { + const { stageSetStore } = this.props; + stageSetStore.clearStageStatus(); + } + + componentWillReceiveProps(nextProps) { + const {prjid} = this.props; + if(prjid==''||prjid==null){ + if (this.props.location.key !== nextProps.location.key) { + const { location, stageSetStore } = nextProps; + stageSetStore.initData(location.query.prjid); + } + }else{ + if (this.props.prjid !== nextProps.prjid) { + const { stageSetStore } = nextProps; + stageSetStore.initData(prjid); + } + } + } + + render() { + const { stageSetStore } = this.props; + const { stageInfo : { stageColumns, stageColumnDatas, selectedDatas, selectedRowKeys }, onRowSelect, onChange } = stageSetStore; + return ( +
    + + + {stageColumns && stageColumns.length>0 &&} + +
    + ) + + } + + getRowSelection = (rowSelection) => { + let sel = { ...rowSelection }; + sel.getCheckboxProps = (record) => { + return { disabled: record.candel == false }; + } + return sel; + } + + getRightMenu() { + const { stageSetStore } = this.props; + const { rightMenu } = stageSetStore; + let btnArr = []; + rightMenu && rightMenu.length > 0 && rightMenu.map(m => { + let disabled = false; + if (stageSetStore.stageInfo.selectedRowKeys.length == 0) {//项目卡片 + if (m.type == "BTN_COPY" || m.type == "BTN_DELETE") { + disabled = true; + } + } + btnArr.push({ + icon: , + content: m.menuName, + disabled: disabled + }) + }); + return btnArr + } + + onRightMenuClick(key) { + let that = this; + const { stageSetStore } = this.props; + const { rightMenu } = stageSetStore; + rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => { + if (Number(key) == i) { + + if (m.type == 'BTN_ADD_SHARE') { //新增 + this.refs.StageList.refs.edit.doAdd() + } else if (m.type == "BTN_DELETE") { //删除 + this.refs.StageList.refs.edit.doDelete() + } else if (m.type == "BTN_COPY") { //复制 + this.refs.StageList.refs.edit.doCopy() + } else if (m.type == "BTN_SUBMIT") { //保存 + const checkProps = this.refs.StageList.refs.edit.doRequiredCheck(); + stageSetStore.saveStageSet(checkProps); + } + if (m.type == "BTN_COLUMN") { //显示定制 + stageSetStore.onShowColumn(); + } + } + }); + } + + getButtons() { + const { stageSetStore } = this.props; + const { rightMenu } = stageSetStore; + let btnArr = []; + rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => { + let disabled = false; + if (stageSetStore.stageInfo.selectedRowKeys.length == 0) {//项目卡片 + if (m.type == "BTN_COPY" || m.type == "BTN_DELETE") { + disabled = true; + } + } + m.isTop == '1' && btnArr.length < 4 && btnArr.push( + + ); + }); + return btnArr; + } + +} + +export default StageSetList; + diff --git a/pc4mobx/prj/components/single/style/taskCardNew.less b/pc4mobx/prj/components/single/style/taskCardNew.less new file mode 100644 index 0000000..c06949a --- /dev/null +++ b/pc4mobx/prj/components/single/style/taskCardNew.less @@ -0,0 +1,495 @@ +.task-list-view-content{ + + + .task-list-view { + height: 100%; + .ant-pagination { + margin-top: 9px; + text-align: center; + &>li { + float: none; + display: inline-block; + } + } + } + .task-list-item{ + border: 10px; + box-sizing: border-box; + display: block; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + cursor : pointer; + text-decoration : none; + margin : 0px; + padding : 0px; + outline : none; + font-size : 12px; + font-weight : inherit; + position : relative; + color : #000; + line-height : 16px; + -webkit-transition : all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; + transition : all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; + background : none; + + .task-list-item-content { + margin-left: 0px; + position: relative; + padding: 10px 0px; + margin: 0px 20px; + border-bottom: 1px solid #e7e7e7; + .name-state{ + float: right; + width: 60px; + height: 18px; + background: #038ef6; + color: #fff; + border-radius: 10px; + text-align: center; + line-height: 18px; + } + .task-list-item-content-top{ + white-space: nowrap; + overflow: hidden; + .name-wrapper { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .subname-wrapper { + font-size: 10px; + line-height: 18px; + height: 18px; + margin: 8px 0px 0px; + color: rgba(0, 0, 0, 0.54); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + .tip{ + font-size: 10px; + background-color: #eaebed; + margin-right: 5px; + padding: 0px 6px; + border-radius: 6px; + } + .tip-status{ + font-size: 10px; + margin-right: 5px; + padding: 0px 6px; + border-radius: 6px; + border: 1px solid #a8e0ce; + color: #a8e0ce; + } + .tip-status.later{ + background-color: red; + color: white; + border: 0px; + } + } + } + } + } +} + +.top_tips { + // font-family : PingFang SC, "\5FAE\8F6F\96C5\9ED1", Arial; + // -webkit-font-smoothing : antialiased; + // -moz-osx-font-smoothing: grayscale; + -webkit-box-flex : 1; + flex : 1; + display : -webkit-box; + display : flex; + padding : 4px; + cursor : pointer; + -webkit-box-align : center; + align-items : center; + -webkit-transition : background-color .2s; + transition : background-color .2s; + border-radius : 30px; + + &:hover { + background-color: #e8f3ff; + } + + .left_icon { + .manager-img { + width : 40px; + height : 40px; + border-radius: 100%; + font-size: 40px; + + } + .stauts_wks{ + color:#2db7f5; + } + .stauts_finish{ + color:green; + } + .flag{ + color:red; + } + .flag1{ + color:#b9b9b9; + } + float: left; + width: 45px; + } + + .right_info { + margin-left: 10px; + + .right_info_l { + // width : 80px; + overflow : hidden; + text-overflow : ellipsis; + white-space : nowrap; + font-size : 15px; + color : #303030; + font-weight : 500; + } + .right_info_overflow { + width: 80px; + } + + .right_info_r { + line-height: 1; + margin-top : 5px; + font-size : 12px; + color : #909090; + font-weight: 500; + + } + } +} + +.task_card_new { + // font-family : PingFang SC, "\5FAE\8F6F\96C5\9ED1", Arial; + // -webkit-font-smoothing : antialiased; + // -moz-osx-font-smoothing: grayscale; + height : 100%; + + .task_card_new_l_top { + margin-bottom : 5px; + background-color: #fff; + } + + .task_card_new_l { + width:62%; + height:100%; + float:left + } + .task_card_new_r { + margin-left : 5px; + background-color: #fff; + + .task_card_new-dt-title { + height : 50px; + line-height: 50px; + text-indent: 20px; + font-size: 16px; + color: #303030; + font-weight: 500; + .task_card_new-main-card-title{ + + } + } + } + + .task_card_new_l_contents { + display: contents; + } + // padding: 14px; + // .ant-row>div { + // // padding: 8px 8px 0 8px; + // } + + ; + + .ant-card-body { + padding: 16px; + } + + .prj-card-title { + font-size: 16px; + cursor : pointer; + } + + .prj-card-msg { + font-size : 10px; + color : #c9c9c9; + line-height: 20px; + } + + .manager-img { + width : 25px; + height : 25px; + border-radius: 100%; + } + + .ant-card { + box-shadow: 3px 2px 4px #dad8d845; + } + + .ant-card-head { + height: 24px + } + + .ant-row { + //padding : 5px 10px 5px 10px; + // font-size : 15px; + line-height : 24px; + } + + .ant-card-body { + padding: 0px; + + } + + .manager-img2 { + width : 40px; + height : 40px; + border-radius: 100%; + margin-left : 30px; + } + + .ant-tabs-bar { + margin-bottom: 0px; + } + + .ant-steps { + font-size : 0; + width : 100%; + line-height: 1.5; + display : -ms-flexbox; + display : table-cell; + } + + .prj-step { + .step-row { + padding: 5px 0px 5px 5px; + } + + .step-img { + width: 38px; + } + + .step-num { + font-size : 26px; + margin-left: 10px; + } + + .step-title { + font-size: 10px; + color : #909090; + } + } + + .prj_protal_card_title { + font-size : 15px; + font-weight : 400; + border-left : 3px solid #0094ff; + padding-left: 5px; + } + + .new-task-wide { + margin: 0px 20px; + } + + .new-task-wide-title { + .new-task-wide-title-container { + text-indent: 24px; + height : 47px; + line-height: 47px; + min-height : 35px; + font-size : 18px; + color : #303030; + font-weight: 500; + overflow-y : hidden; + width: 100%; + } + + .timecol{ + width: 0; + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .timecol1{ + display: flex; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + .new-tab-bar-menu-wraps { + height : 45px; + line-height : 45px; + + .new-tab-bar-menu-ul { + list-style : none; + padding : 0px; + margin : 0px; + padding : 0px 20px; + display : -webkit-box; + display : flex; + -webkit-box-pack: end; + justify-content : flex-end; + align-content : center; + position : relative; + + .wea-tab { + position: static; + + .wea-search-container { + width : 100%; + position : absolute; + left : 0px; + right : 0px; + top : 44px; + background-color : #fff; + z-index : 1000; + border : 1px solid #dadada; + -webkit-box-shadow: 0 0 2px #dadada; + box-shadow : 0 0 2px #dadada; + + .wea-advanced-search { + position : absolute; + right : 29px; + border-bottom : 0; + background-color : #fff; + -webkit-box-shadow: 0 -1px 2px -1px #dadada; + box-shadow : 0 -1px 2px -1px #dadada; + } + } + } + + .wea-tab { + .mask-dark { + position: absolute; + width: 100%; + z-index: 3; + background-color: #fff; + filter: alpha(opacity=40); + -moz-opacity: .4; + -khtml-opacity: .4; + opacity: .4; + } + } + .wea-advanced-searchsAd{ + height: 270px !important; + } + .wea-search-buttons { + padding: 5px 0 !important; + } + >li { + &:not(:last-of-type) { + .new-tab-bar-menu-name { + &::after { + content : ''; + display : inline-block; + background-color: #dedede; + width : 1px; + height : 19px; + position : absolute; + top : 3px; + right : 1px; + } + } + } + + &:nth-of-type(1) { + >.new-tab-bar-menu-name { + border-top-left-radius : 13px; + border-bottom-left-radius: 13px; + } + } + + &:nth-last-of-type(1) { + >.new-tab-bar-menu-name { + border-top-right-radius : 13px; + border-bottom-right-radius: 13px; + } + } + } + + .new-tab-bar-menu-name { + cursor: pointer; + padding : 5px 15px; + background: #f3f3f3; + color : #606060; + position : relative; + &:hover{ + color: #338fe5 + } + } + } + } +} + +.new-dt-container { + // font-family : PingFang SC, "\5FAE\8F6F\96C5\9ED1", Arial; + // -webkit-font-smoothing : antialiased; + // -moz-osx-font-smoothing: grayscale; + cursor : pointer; + -webkit-transition : color .2s; + transition : color .2s; + padding-right : 20px; + font-size : 14px; + color : #303030; + line-height : 1.5; + -moz-user-select : none; + -webkit-user-select : none; + -ms-user-select : none; + -o-user-select : none; + user-select : none; + + &:hover { + color: #338fe5; + } +} + +.new-show-dt-arrow { + &::before { + content : '\003C'; + font-weight : bold; + padding-right: 5px; + } +} + +.new-show-dt-arrow-r { + &::before { + content : '\0399'; + font-weight : bold; + vertical-align: middle; + padding-right : 5px; + } +} + +.new-show-dt-line { + &::before { + content : '\0399'; + font-weight : bold; + vertical-align: middle; + padding-right : 1px; + + } +} + +.new-show-dt-line { + &::before { + content : '\0399'; + vertical-align: middle; + padding-right : 1px; + font-weight : bold; + } +} + +.new-show-dt-line-r { + &::before { + content : '\003E'; + font-weight : bold; + padding-right: 1px; + } +} \ No newline at end of file diff --git a/pc4mobx/prj/components/single/style/taskDynamic.less b/pc4mobx/prj/components/single/style/taskDynamic.less new file mode 100644 index 0000000..f441e87 --- /dev/null +++ b/pc4mobx/prj/components/single/style/taskDynamic.less @@ -0,0 +1,160 @@ +.prj-dynamic-tab{ + padding: 0 0 5px 0; + border-bottom: 1px solid #e8e8e8; +} + +.prj-dynamic-tab-item{ + display: inline; + position: relative; + padding: 5px 15px 5px 5px; + color: #606060; + + .active::after{ + content: ''; + display: inline-block; + height: 3px; + width: 82%; + position: absolute; + background-color: #338fe5; + bottom: 0; + left: 0; + } +} + +.prj-dynamic-tab-item:hover{ + color: #338fe5; + cursor:pointer; +} + +.exchange-content{ + line-height:20px; + font-size:10px; + color:black; + display: inline-block; + padding: 20px 5px; + .formImgPlay{ + max-width: 150px; + max-height: 150px; + } +} + +.exchange-date{ + line-height:20px; + color:#909090; +} + +.exchange-operate { + position : relative; + display : inline-block; + padding-right: 15px; + + &::after { + content : ''; + width : 1px; + display : inline-block; + height : 13px; + background: #dedede; + position : absolute; + bottom : 5px; + right : 7px; + } + + &:last-child { + &::after { + content : ''; + background: #fff; + } + } + + a { + color : #606060; + font-size: 12px; + + &:hover { + color: #00a9ff; + } + } + +} + +.exchange-row { + padding: 0 0 0 0px !important; + > span{ + &:nth-of-type(1){ + >p { + &:nth-of-type(1){ + display: inline; + } + } + } + } +} +.jiaoliu-box { + padding: 0 0 0 0px !important; + position: relative; + > span{ + &:nth-of-type(1){ + >p { + &:nth-of-type(1){ + display: inline; + } + } + } + } +} + +.modify-log { + border-left: 3px solid #909090; + .modify-record { + .log-green { + color: #24b47e; + background-color: rgba(36,180,126,0.1); + } + .log-red { + color: #ea0d0d; + background-color: rgba(234,13,13,0.1); + text-decoration: line-through; + text-decoration-color: #ea0d0d; + } + color : #909090; + margin : 5px 0 0 0; + padding : 0 0 0 5px; + + } +} + +.writeDiv{ + border: 1px solid #d6d6d6; + border-radius: 3px; + color: #a2a2a2; + cursor: pointer; + background: #fff; + font-size: 10px; + padding: 5px; + border-left: 2px solid #ee6723; + &:hover{ + border : 1px solid #2db7f5; + border-left: 2px solid #ee6723; + } +} + +.manager-img{ + height:25px; + width:25px; + border-radius:20px; +} + +.dynamic-exchange-operate{ + display: flex; + align-items: center; + justify-content: space-between; +} + +.dynamic-exchange-time{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 0; + flex: 1; + color: #999999 +} \ No newline at end of file diff --git a/pc4mobx/prj/components/single/task/TaskCardNew.js b/pc4mobx/prj/components/single/task/TaskCardNew.js new file mode 100644 index 0000000..2aee948 --- /dev/null +++ b/pc4mobx/prj/components/single/task/TaskCardNew.js @@ -0,0 +1,745 @@ +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx" +import React from 'react'; +import { WeaLeftRightLayout, WeaTop, WeaTab, WeaNewScroll, WeaLocaleProvider, WeaBrowser, WeaAlertPage } from 'ecCom'; +import { WeaTableNew } from 'comsMobx'; +const WeaTable = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; +import '../style/taskCardNew.less'; +import ListView from "../../comp/task-view-list"; +import { Row, Tooltip, Col, Icon, Modal, message } from "antd"; +import { TaskDynamic } from "./TaskDynamic"; +import TabDiscuss from '../../common/TabDiscuss' +import RelateWorkFlow from '../../common/relateWorkFlow' +import RelateDocument from "../../common/relateDocument" +import TaskSub from '../../common/taskSub'; +import { TabComponent as TabSelf } from '../../common/tabComponent'; +import TaskShare from '../../common/sharePage' +//import TaskNewInfo from './TaskNewInfo' +import RealteCrmDialog from '../../dialog/relateCrmDialog' +import ProjectLogDialog from "../../dialog/modifyLogDialog" +import ProjectFieldLogDialog from '../../dialog/projectFieldLogDialog'; +import ProjectFieldDetailLogDialog from '../../dialog/ProjectFieldDetailLogDialog'; +import TaskInfoDialog from '../../dialog/taskDialog' +import PrjForm from "../../prjForm.js"; +import classnames from 'classnames'; +// const rightMenus = [ +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-edit", menuName: "编辑", type: "BTN_EDIT" }, +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "删除", type: "BTN_DELETE" } +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" }, +// { isControl: "1", isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" } +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加子任务", type: "BTN_NEWSUB" }, +// { isTop: "0", menuFun: "", menuIcon: "icon-coms-Custom", menuName: "显示列定制", type: "BTN_COLUMN" }, +// { isTop: "1", type: "searchsAd" } +// ], +// [ + +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "新建流程", type: "BTN_NEWREQ" } +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "新建文档", type: "BTN_NEWDOC" } +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" }, +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" } +// ], +// [ +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" }, +// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" } +// ] +// ] +@inject("taskCardNewStore","taskDynamicStore") +@observer +class TaskCardNew extends React.Component { + static defaultProps = { + prefixCls: 'new' + }; + constructor(props) { + super(props); + this.state = { + selectedKey : "", + showdt : false + } + + } + componentDidMount(){ + const { prjid, taskCardNewStore, hasList, taskid } = this.props; + if(hasList){ + taskCardNewStore.initData(prjid); + }else{ + taskCardNewStore.initTaskData(taskid); + } + + } + componentWillReceiveProps(nextProps) { + if (this.props.prjid !== nextProps.prjid) { + const { prjid, taskCardNewStore, hasList, taskid } = nextProps; + if(hasList){ + taskCardNewStore.initData(prjid); + }else{ + taskCardNewStore.initTaskData(taskid); + } + } + } + render() { + const { taskCardNewStore, taskid, hasList, prefixCls, taskInfoStore, prjid, isDialog, taskDynamicStore, delCallBack, fromPortal } = this.props; + const { taskinfo, loading, changeTabs } = taskCardNewStore; + const { tabDatas, selectTabKey, shareStore, taskLogTableStore, taskFieldLogTableStore, taskFieldDetailLogTableStore, fieldname, fieldinfo, getTaskList, breadcrumb, rightMenu, getTaskForm, initData, initTaskData } = taskCardNewStore; + const { getPortalProjectDynamicInfo } = taskDynamicStore; + const tabDatas1 = toJS(tabDatas); + let _this = this; + const titleStyle = { + fontSize : "15px" + } + const height = document.body.offsetHeight - $(".prj-portal-page .wea-new-top-wapper").height() - 57 - 52.4 - $(".task_card_new .task_card_new_l_top").height() - 20 - 30; + const scrollHeight = ($(".e9theme-layout-header").length > 0 || $(".e8theme-layout-header").length > 0) ? height - 55 - 22 : height - 15; + const { showdt } = this.state; + const textdt = showdt ? getLabel('518183','显示动态') : getLabel('518184','隐藏动态'); + const classdtArrow = classnames({ + 'new-show-dt-arrow': showdt, + 'new-show-dt-arrow-r': !showdt + }); + const classdtLine = classnames('new-dt-container',{ + 'new-show-dt-line': showdt, + 'new-show-dt-line-r': !showdt + }); + const classCardL = classnames('task_card_new_l',{ + 'task_card_new_l_contents': showdt + }) + const bWidth = !showdt?"62%":"100%"; + const showDynamic = !showdt?"":"none"; + const tabRenderNode = { + [selectTabKey]: { + 'taskinfo':
    + + < ProjectLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectLogDialog@t80d3f`} ref="taskLogDialog" title={getLabel('83926', '任务日志')} tableStore={taskLogTableStore} store={taskCardNewStore} /> + + + { + if(hasList){ + initData(prjid); + }else{ + initTaskData(taskid); + } + getTaskForm({ viewtype: 'view', taskid: taskCardNewStore.taskid }); + getPortalProjectDynamicInfo("alltask"); + getPortalProjectDynamicInfo("tasklog"); + }} /> +
    , + 'tasksub':
    { + if(hasList){ + initData(prjid); + }else{ + initTaskData(taskid); + } + }} />
    , + 'exchange':
    , + 'taskshare':
    , + 'req':
    , + 'doc':
    , + 'crm':
    {_this.getReleateCrmOrCpt("crm")}
    , + 'cpt':
    {_this.getReleateCrmOrCpt("cpt")} + _this.addCapital(ids, names, datas)} customized={true} hasAdvanceSerach={true} /> +
    + } + + } + const tabRenderHandle = (id, shortname, linkurl) => { + if (shortname !== '') { + return tabRenderNode[id][shortname] + } else if (shortname === "") { + if (linkurl.indexOf("noright") > -1) { + return +
    + {getLabel(2012, "对不起,您暂时没有权限!")} +
    +
    + } else { + return linkurl; + } + } + } + let tabUrl = function () { + if (tabDatas1) { + const prefixCls = 'new-tab-bar-menu' + for (let i = 0; i < tabDatas1.length; i++) { + if (tabDatas1[i].id == selectTabKey) { + if (tabDatas1[i].shortname !== ''){ + return ( + + { + rightMenu&&rightMenu.length>1&& +
    +
      + {rightMenu.map((menu,i) => ( + menu.isTop == 1 && + (menu.type === 'searchsAd' ? +
      + :
    • { _this.menuClick(menu) }}>{menu.menuName}
    • ) + )) + } +
    +
    + } + 1)?'45px':'0px',bottom: '0px',width: '100%'}}> + { + tabRenderHandle(tabDatas1[i].id, tabDatas1[i].shortname, tabDatas[i].linkurl) + } + +
    + ) + }else if (tabDatas1[i].shortname === ""){ + return tabRenderHandle(tabDatas1[i].id, tabDatas1[i].shortname, tabDatas[i].linkurl); + } + } + } + return "" + } + }(); + + if (hasList) { + if(taskCardNewStore.taskList.length==0){ + return +
    + {getLabel(83553, '暂无数据')} +
    + { + if(hasList){ + initData(prjid); + if(delCallBack){ + delCallBack(); + } + }else{ + initTaskData(taskid); + } + }} /> +
    + } + return ( + } + onCollapse={showLeft => {}} + > + {/* +
    任务1 + + 展开收起按钮 + */} +
    + + + { this.setState(pre => ({ showdt: !pre.showdt })) }}>{textdt}
    ]} + loading={loading} + breadcrumb={breadcrumb || [{ name: "#9" }, { name: "#12" }, { name: "#13" }]} + /> +
    +
    +
    +
    +
    {taskinfo.subject}
    +
    + +
    +
    +
    + { + taskinfo.hrmid&& taskinfo.hrmid.length>0? + window.pointerXY(e)} > + + + : + window.pointerXY(e)} > + + + } + +
    +
    + 0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname}> +
    + {taskinfo.hrmidname&&taskinfo.hrmidname.length>0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname} +
    +
    + +
    + {getLabel('15285', '任务负责人')} +
    +
    +
    + +
    +
    +
    + { + taskinfo.finish == 100 ? : + taskinfo.islater ? : + // + taskinfo.wks ? : + + } + +
    +
    +
    + { + taskinfo.finish == 100 ? getLabel('23774','已完成') : taskinfo.islater ? getLabel('21984', "已超期") : taskinfo.wks ? getLabel(1979,"未开始") : getLabel('1960','进行中') + } +
    +
    + {getLabel('1929','当前状态')} +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + {taskinfo.islandmark == 0 ? getLabel('30587', '否') : getLabel('163', '是')} +
    +
    + {getLabel('2232', '里程碑任务')} +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + {taskinfo.begindate ||getLabel('514133','未设置')}~{taskinfo.enddate ||getLabel('514133','未设置')} +
    +
    + {getLabel('518186','开始结束时间')} +
    +
    +
    + + + + changeTabs(v) } + /> + +
    +
    + { + typeof tabUrl === "object" ? tabUrl : +