1108 lines
49 KiB
JavaScript
1108 lines
49 KiB
JavaScript
import React from "react";
|
|
import _ from 'lodash';
|
|
import $ from 'jquery';
|
|
import * as API from '../apis/prjReportApi';
|
|
import {Row, Col, Progress, Tooltip, message, InputNumber, Popover, Button } from 'antd';
|
|
import {observable, action, toJS} from "mobx";
|
|
import {WeaDatePicker, WeaInput, WeaBrowser, WeaLocaleProvider, WeaInputNumber, WeaError} from "ecCom";
|
|
import {FeedBackInfoStore} from "./portal/feedBackInfoStore"
|
|
import {FeedBackSettingStore} from "./portal/feedBackSettingStore"
|
|
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
export class ReportStore {
|
|
@observable prjid = "";
|
|
@observable modeInfo = {};wEAver2018
|
|
@observable projInfo = {};
|
|
@observable columns = [];
|
|
@observable tableDatas = [];
|
|
@observable tableForamtDatas = [];
|
|
@observable dialogVisible = false;
|
|
@observable dialogData = {};
|
|
@observable dialogSource = {};
|
|
@observable columnsWidth = true;
|
|
|
|
@observable submitHash = {};
|
|
@observable submitData = [];
|
|
@observable expandedRowKeys = [];
|
|
@observable nowVersionSelected = '0';
|
|
@observable monthOptions = [];
|
|
@observable canSave = true;
|
|
|
|
@observable submitLoading = false;
|
|
@observable submitTip = "正在生成流程视图数据,请稍后...";
|
|
|
|
@observable remind1 = new Array();
|
|
@observable remind2 = new Array();
|
|
@observable remind3 = new Array();
|
|
@observable remind4 = new Array();
|
|
@observable feedBackInfoStore = new FeedBackInfoStore();
|
|
@observable feedBackSettingStore = new FeedBackSettingStore();
|
|
|
|
@observable prjstatus = "";
|
|
|
|
@observable type = ""; //反馈周期
|
|
@observable activity = ""; //当前活动周期
|
|
@action
|
|
init = (prjid) => {
|
|
this.prjid = prjid;
|
|
|
|
this.onQueryData(true);
|
|
this.nowVersionSelected = '0';
|
|
}
|
|
|
|
@action
|
|
onQueryData = (isInit) => {
|
|
if (!this.prjid) return;
|
|
this.tableDatas = [];
|
|
this.tableForamtDatas = [];
|
|
this.remind1 = new Array();
|
|
this.remind2 = new Array();
|
|
this.remind3 = new Array();
|
|
this.remind4 = new Array();
|
|
API.getFeedBackData({prjid: this.prjid}).then(({columns, datas, projInfo, month, type, activity}) => {
|
|
// if (!msg) {
|
|
// let month = ["201908", "201909"];
|
|
// let columns = [{
|
|
// dataIndex: "name",
|
|
// width: 250,
|
|
// fixed: "left",
|
|
// title: "任务名称",
|
|
// key: "name"
|
|
// }, {
|
|
// dataIndex: "hrmids",
|
|
// width: 60,
|
|
// title: "小组经理",
|
|
// key: "hrmids"
|
|
// }, {
|
|
// dataIndex: "dateRange",
|
|
// width: 150,
|
|
// title: "时间段",
|
|
// key: "dateRange"
|
|
// }, {
|
|
// dataIndex: "islandmark",
|
|
// width: 50,
|
|
// title: "里程碑",
|
|
// key: "islandmark"
|
|
// }, {
|
|
// dataIndex:"progress",
|
|
// width: 45,
|
|
// title: "进度",
|
|
// key: "progress"
|
|
// }, {
|
|
// children: [{
|
|
// dataIndex: "planCtx_201908",
|
|
// width: 170,
|
|
// title: "计划内容",
|
|
// key: "planCtx_201908"
|
|
// }, {
|
|
// dataIndex: "finishTime_201908",
|
|
// width: 125,
|
|
// title: "完成时间",
|
|
// key: "finishTime_201908"
|
|
// }, {
|
|
// dataIndex: "assistUser_201908",
|
|
// width: 125,
|
|
// title: "配合人员",
|
|
// key: "assistUser_201908"
|
|
// }, {
|
|
// dataIndex: "progress_201908",
|
|
// width: 50,
|
|
// title: "进度",
|
|
// key: "progress_201908"
|
|
// }, {
|
|
// dataIndex: "finishCtx_201908",
|
|
// width: 180,
|
|
// title: "完成情况",
|
|
// key: "finishCtx_201908"
|
|
// }, {
|
|
// dataIndex: "unFinishReason_201908",
|
|
// width: 80,
|
|
// title: "未完成原因",
|
|
// key: "unFinishReason_201908"
|
|
// }],
|
|
// title: "2019年8月"
|
|
// }, {
|
|
// children: [{
|
|
// dataIndex: "planCtx_201909",
|
|
// width: 170,
|
|
// title: "计划内容",
|
|
// key: "planCtx_201909"
|
|
// }, {
|
|
// dataIndex: "finishTime_201909",
|
|
// width: 125,
|
|
// title: "完成时间",
|
|
// key: "finishTime_201909"
|
|
// }, {
|
|
// dataIndex: "assistUser_201909",
|
|
// width: 125,
|
|
// title: "配合人员",
|
|
// key: "assistUser_201909"
|
|
// }, {
|
|
// dataIndex: "progress_201909",
|
|
// width: 50,
|
|
// title: "进度",
|
|
// key: "progress_201909"
|
|
// }, {
|
|
// dataIndex: "finishCtx_201909",
|
|
// width: 180,
|
|
// title: "完成情况",
|
|
// key: "finishCtx_201909"
|
|
// }, {
|
|
// dataIndex: "unFinishReason_201909",
|
|
// width: 80,
|
|
// title: "未完成原因",
|
|
// key: "unFinishReason_201909"
|
|
// }, {
|
|
// dataIndex: "caozuo_201909",
|
|
// width: 80,
|
|
// title: "操作",
|
|
// key: "caozuo_201909"
|
|
// }],
|
|
// title: "2019年9月"
|
|
// }]
|
|
// let datas = [{
|
|
// islandmark: "否",
|
|
// hrmids: [{
|
|
// name: "杨文元-tw",
|
|
// id: "21"
|
|
// }],
|
|
// unFinishReason_201908: "111",
|
|
// finishTime_201909: "",
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: "",
|
|
// finishTime_201908: "",
|
|
// unFinishReason_201909: "",
|
|
// assistUser_201909: "",
|
|
// assistUser_201908: "",
|
|
// hbid_201908: "7",
|
|
// hbid_201909: "45",
|
|
|
|
// children: [{
|
|
// islandmark: "否",
|
|
// unFinishReason_201908: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// finishTime_201909: {
|
|
// viewAttr: 1,
|
|
// value: "2019-09-30"
|
|
// },
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: "test"
|
|
// },
|
|
// finishTime_201908: {
|
|
// viewAttr: 1,
|
|
// value: "2019-08-26"
|
|
// },
|
|
// unFinishReason_201909: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// assistUser_201909: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// assistUser_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// hbid_201908: 11,
|
|
// hbid_201909: 47,
|
|
// caozuo_201909:"11",
|
|
// name: "test",
|
|
// finishCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: [{
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "ddd",
|
|
// attach: [],
|
|
// wcnrid: "26"
|
|
// }]
|
|
// },
|
|
// progress: "-1%",
|
|
// planCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: "test"
|
|
// },
|
|
// finishCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// key: 502,
|
|
// progress_201909: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// }
|
|
// }, {
|
|
// islandmark: "否",
|
|
// unFinishReason_201908: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// finishTime_201909: {
|
|
// viewAttr: 1,
|
|
// value: "2019-09-30"
|
|
// },
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: "test2"
|
|
// },
|
|
// finishTime_201908: {
|
|
// viewAttr: 1,
|
|
// value: "2019-08-26"
|
|
// },
|
|
// unFinishReason_201909: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// assistUser_201909: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// assistUser_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// hbid_201908: 9,
|
|
// hbid_201909: 46,
|
|
// name: "test2",
|
|
// finishCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: [{
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "tt",
|
|
// attach: [],
|
|
// wcnrid: "25"
|
|
// }]
|
|
// },
|
|
// progress: "-1%",
|
|
// planCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: "test2"
|
|
// },
|
|
// finishCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// key: 503,
|
|
// progress_201909: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// }
|
|
// }],
|
|
// name: "工作包001",
|
|
// finishCtx_201909: "",
|
|
// progress: "15%",
|
|
// planCtx_201909: "",
|
|
// finishCtx_201908: "",
|
|
// key: 1,
|
|
// progress_201909: {
|
|
// viewAttr: 3,
|
|
// value: 15
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 15
|
|
// }
|
|
// }, {
|
|
// islandmark: "否",
|
|
// hrmids: [{
|
|
// name: "杨文元-tw",
|
|
// id: "21"
|
|
// }],
|
|
// unFinishReason_201908: "",
|
|
// finishTime_201909: "",
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: "",
|
|
// finishTime_201908: "",
|
|
// unFinishReason_201909: "",
|
|
// assistUser_201909: "杨文元-tw",
|
|
// assistUser_201908: "",
|
|
// hbid_201908: "8",
|
|
// hbid_201909: "41",
|
|
// children: [{
|
|
// islandmark: "否",
|
|
// unFinishReason_201908: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// finishTime_201909: {
|
|
// viewAttr: 1,
|
|
// value: "2019-09-30"
|
|
// },
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: "test3"
|
|
// },
|
|
// finishTime_201908: {
|
|
// viewAttr: 1,
|
|
// value: "2019-08-26"
|
|
// },
|
|
// unFinishReason_201909: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// assistUser_201909: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// assistUser_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// hbid_201908: 12,
|
|
// hbid_201909: 44,
|
|
// name: "test3",
|
|
// finishCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: [{
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "test",
|
|
// attach: [],
|
|
// wcnrid: "24"
|
|
// }]
|
|
// },
|
|
// progress: "-1%",
|
|
// planCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: "test3"
|
|
// },
|
|
// finishCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// key: 504,
|
|
// progress_201909: {
|
|
// viewAttr: 1,
|
|
// value: 100.0
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// }
|
|
// }, {
|
|
// islandmark: "否",
|
|
// unFinishReason_201908: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// finishTime_201909: {
|
|
// viewAttr: 1,
|
|
// value: "2019-09-30"
|
|
// },
|
|
// dateRange: ["2019-08-26", "2019-08-26"],
|
|
// planCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: "test4"
|
|
// },
|
|
// finishTime_201908: {
|
|
// viewAttr: 1,
|
|
// value: "2019-08-26"
|
|
// },
|
|
// unFinishReason_201909: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// assistUser_201909: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// assistUser_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// hbid_201908: 10,
|
|
// hbid_201909: 42,
|
|
// name: "test4",
|
|
// finishCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: [{
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "test2",
|
|
// attach: [],
|
|
// wcnrid: "23"
|
|
// }, {
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "test",
|
|
// attach: [],
|
|
// wcnrid: "22"
|
|
// }]
|
|
// },
|
|
// progress: "-1%",
|
|
// planCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: "test4"
|
|
// },
|
|
// finishCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// key: 505,
|
|
// progress_201909: {
|
|
// viewAttr: 1,
|
|
// value: 100.0
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// }
|
|
// }, {
|
|
// islandmark: "否",
|
|
// unFinishReason_201908: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// finishTime_201909: {
|
|
// viewAttr: 1,
|
|
// value: "2019-09-30"
|
|
// },
|
|
// dateRange: ["2019-10-08", "2019-10-26"],
|
|
// planCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: "test5"
|
|
// },
|
|
// finishTime_201908: {
|
|
// viewAttr: 1,
|
|
// value: "2019-08-26"
|
|
// },
|
|
// unFinishReason_201909: {
|
|
// viewAttr: 1,
|
|
// value: ""
|
|
// },
|
|
// assistUser_201909: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// assistUser_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// hbid_201908: 21,
|
|
// hbid_201909: 43,
|
|
// name: "test5",
|
|
// finishCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: [{
|
|
// cjsj: "2019-09-11",
|
|
// attachids: "",
|
|
// ctx: "test",
|
|
// attach: [],
|
|
// wcnrid: "21"
|
|
// }]
|
|
// },
|
|
// progress: "-1%",
|
|
// planCtx_201909: {
|
|
// viewAttr: 1,
|
|
// value: "test5"
|
|
// },
|
|
// finishCtx_201908: {
|
|
// viewAttr: 1,
|
|
// value: []
|
|
// },
|
|
// key: 1001,
|
|
// progress_201909: {
|
|
// viewAttr: 1,
|
|
// value: 100.0
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 0.0
|
|
// }
|
|
// }],
|
|
// name: "工作包002",
|
|
// finishCtx_201909: "",
|
|
// progress: "11%",
|
|
// planCtx_201909: "",
|
|
// finishCtx_201908: "",
|
|
// key: 501,
|
|
// progress_201909: {
|
|
// viewAttr: 3,
|
|
// value: 100
|
|
// },
|
|
// progress_201908: {
|
|
// viewAttr: 1,
|
|
// value: 11
|
|
// }
|
|
// }];
|
|
// let projInfo = {
|
|
// prjstatus: 11,
|
|
// manager: "1",
|
|
// jindu: "",
|
|
// name: "测试项目001",
|
|
// statusname: "计划变更",
|
|
// id: 1,
|
|
// version: [{
|
|
// showname: "当前版本",
|
|
// key: "0",
|
|
// selected: true
|
|
// }]
|
|
// };
|
|
|
|
this.columns = columns;
|
|
if (this.columns && this.columns.length <= 1) {
|
|
this.columns = this.columns.map(col => {
|
|
col.fixed = "";
|
|
return col
|
|
});
|
|
$('.ant-table-content').css('padding-left', '0');
|
|
}
|
|
this.computeColumnsWidth(this.columns);
|
|
this.tableDatas = datas;
|
|
this.tableForamtDatas = this.compileByType(this.tableDatas);
|
|
if (isInit) {
|
|
this.expandedRowKeys = this.tableForamtDatas.map(f => f.key);
|
|
}
|
|
this.projInfo = projInfo;
|
|
month&&(this.monthOptions=[...month].map((mon) => {
|
|
return {
|
|
showname: mon,
|
|
key: mon
|
|
}
|
|
}));
|
|
projInfo&&(this.prjstatus=projInfo.prjstatus);
|
|
this.type = type;
|
|
this.activity = activity;
|
|
// } else {
|
|
// message.warning(res.msg)
|
|
// }
|
|
|
|
})
|
|
}
|
|
|
|
@action
|
|
onExpandedRowKeysChange = (Keys) => {
|
|
this.expandedRowKeys = Keys;
|
|
}
|
|
@action
|
|
onEditionChange = (key) => {
|
|
this.nowVersionSelected = key;
|
|
this.onQueryData(this.prjid, key);
|
|
}
|
|
|
|
// @action
|
|
// saveData = (key) => {
|
|
// let check = true;
|
|
// if (!this.submitData.length && key === '2') {
|
|
// message.error("无数据修改");
|
|
// return;
|
|
// }
|
|
|
|
// if (key === '1') {
|
|
|
|
// toJS(this.remind1).map(c => {
|
|
// if (c && !c.props.children.props.value && c.props.children.props.viewAttr == "3") {
|
|
// c.showError();
|
|
// check = false;
|
|
// }
|
|
// });
|
|
// toJS(this.remind2).map(c => {
|
|
// if (c && !c.props.children.props.value && c.props.children.props.viewAttr == "3") {
|
|
// c.showError();
|
|
// check = false;
|
|
// }
|
|
// });
|
|
// 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();
|
|
// check = false;
|
|
// }
|
|
// });
|
|
|
|
|
|
// }
|
|
// if(!check){
|
|
// message.error("请检查必填项");
|
|
// return;
|
|
// }
|
|
|
|
// const jsondata = JSON.stringify(this.submitData)
|
|
// if (key === '2') {
|
|
// this.submitTip = "数据保存中,请稍后...";
|
|
// this.submitLoading = true;
|
|
// API.save({jsondata, projId: this.prjid}).then(res => { //保存
|
|
// this.submitLoading = false;
|
|
// if ('' + res.code === '200') {
|
|
// this.submitData = [];
|
|
// this.submitHash= [];
|
|
// message.success(res.msg)
|
|
// this.onQueryData(this.prjid,{});
|
|
// } else {
|
|
// message.warning(res.msg)
|
|
// }
|
|
// })
|
|
// } else if (key === '1') { //提交
|
|
// this.submitTip = "正在生成流程视图数据,请稍后...";
|
|
// this.submitLoading = true;
|
|
// API.submit({jsondata, projId: this.prjid}).then(res => {
|
|
// this.submitLoading = false;
|
|
// if ('' + res.code === '200') {
|
|
// this.submitData = [];
|
|
// this.submitHash= [];
|
|
// message.success(res.msg)
|
|
// window.open(res.datas.linkUrl, '_blank');
|
|
// } else {
|
|
// message.warning(res.msg)
|
|
// }
|
|
// })
|
|
// }
|
|
// }
|
|
|
|
@action
|
|
computeColumnsWidth = (columns) => {
|
|
this.columnsWidth = 0;
|
|
if (!(columns && columns.length)) return '0';
|
|
columns.forEach(col => {
|
|
if (col.children) {
|
|
col.children.forEach(child => {
|
|
if (child.width) {
|
|
this.columnsWidth += child.width
|
|
} else {
|
|
this.columnsWidth += 200
|
|
}
|
|
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
@action
|
|
compileByType = (datas, parentIndex = null) => {
|
|
|
|
let tempDatas = [];
|
|
_.forEach(datas, (item, index) => {
|
|
const tempObj = {};
|
|
_.forIn(item, (valueObj, key) => {
|
|
if (key == 'key') {
|
|
tempObj[key] = valueObj;
|
|
} else {
|
|
let value = valueObj.hasOwnProperty('value') ? valueObj['value'] : valueObj,
|
|
// viewAttr = valueObj.hasOwnProperty('viewAttr') ? valueObj['viewAttr'] : 1;
|
|
viewAttr = 1;
|
|
if (_.startsWith(key, 'progress') && value !== "") {
|
|
value = parseFloat(value)<0?0:parseFloat(value);
|
|
if (!_.startsWith(key, 'progress_')) {
|
|
tempObj[key] = (
|
|
<div className="percent-btn-group">
|
|
<Progress ecId={`${this && this.props && this.props.ecId || ''}_Progress@48f3o7`} type="circle" percent={value} status={value === 100 && 'success'}
|
|
width={32}/>
|
|
</div>
|
|
)
|
|
} else {
|
|
if ('' + viewAttr === '1') {
|
|
tempObj[key] = (
|
|
<div title={`${value}%`}>{value}%</div>
|
|
)
|
|
} else {
|
|
tempObj[key] = (
|
|
<div className="progress-input-number">
|
|
|
|
<InputNumber ecId={`${this && this.props && this.props.ecId || ''}_InputNumber@3x1g2s`}
|
|
defaultValue={value<(item["progress"] != "" ? parseInt(item["progress"]) : 0)?item["progress"] != "" ? parseInt(item["progress"]) : 0:value}
|
|
// viewAttr={viewAttr}
|
|
disabled={viewAttr==1?true:false}
|
|
min={item["progress"] != "" ? parseInt(item["progress"]) : 0}
|
|
max={100}
|
|
onChange={(val) => {
|
|
if (val === '' || val < 0) {
|
|
val = 0
|
|
}
|
|
this.changeData(val, index, key, parentIndex, item)
|
|
}}
|
|
/>
|
|
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
} else if (key === 'dateRange' && (value[0] || value[1])) {
|
|
const beginDate = value[0]?value[0]:'', endDate = value[1]?value[1]:'';
|
|
const renderDate = (date) => {
|
|
return date;
|
|
// const dateArr = date.split("-");
|
|
// return `${dateArr[0]}-${dateArr[1]}-${dateArr[2]}`
|
|
}
|
|
tempObj[key] = (<div>
|
|
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@qdh4py`}>
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@l18w2r`} span={11}>{renderDate(beginDate)}</Col>
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@hcn2z4`} span={2}> - </Col>
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@b9kfcy`} span={11}>{renderDate(endDate)}</Col>
|
|
</Row>
|
|
</div>)
|
|
} else if (key === 'hrmids') {
|
|
tempObj[key] = (<WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@tpal86`}
|
|
type={17}
|
|
title={getLabel('179', '人力资源')}
|
|
isSingle={false}
|
|
replaceDatas={JSON.parse(valueObj).datas}
|
|
viewAttr={1}
|
|
/>)
|
|
} else if (_.startsWith(key, 'assistUser_')) { //配合人员
|
|
tempObj[key] = (
|
|
<WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@n13qi1`}
|
|
// style={{width:"100%"}}
|
|
type={17}
|
|
title={getLabel('179', '人力资源')}
|
|
// isMultCheckbox
|
|
isSingle={false}
|
|
replaceDatas={JSON.parse(valueObj).datas}
|
|
viewAttr={1}
|
|
// onChange={(id, name, data) => {
|
|
// this.changeData(data, index, key, parentIndex, item)
|
|
// }}
|
|
/>)
|
|
}else if (_.startsWith(key, 'finishTime_')) { //完成时间
|
|
// tempObj[key] = (<WeaError
|
|
// ref={(ref) => {
|
|
// this.remind1.push(ref);
|
|
// }}
|
|
// error={getLabel(385869,"此项必填")}
|
|
// tipPosition="left"
|
|
// ><WeaDatePicker
|
|
// value={value}
|
|
// viewAttr={viewAttr}
|
|
// onChange={(val) => {
|
|
// this.changeData(val, index, key, parentIndex, item)
|
|
// }}
|
|
// /></WeaError>)
|
|
tempObj[key] = (<WeaDatePicker ecId={`${this && this.props && this.props.ecId || ''}_WeaDatePicker@cnepkp`}
|
|
value={value}
|
|
viewAttr={viewAttr}
|
|
onChange={(val) => {
|
|
this.changeData(val, index, key, parentIndex, item)
|
|
}}
|
|
/>)
|
|
} else if (_.startsWith(key, 'planCtx_')) { //计划内容
|
|
const tempArr = key.split("_");
|
|
const total = tempArr[0] + 'Total_' + tempArr[1];
|
|
|
|
tempObj[key] = (<Tooltip ecId={`${this && this.props && this.props.ecId || ''}_Tooltip@xs2870`} placement="bottom" title={value}><Row ecId={`${this && this.props && this.props.ecId || ''}_Row@sthcnf`} className="plan_input_wrapper">
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@051msv`} span={18} >
|
|
|
|
{/* <WeaError
|
|
ref={(ref) => {
|
|
this.remind1.push(ref);
|
|
}}
|
|
error={getLabel(385869,"此项必填")}
|
|
tipPosition="left"
|
|
>
|
|
<WeaInput
|
|
value={value}
|
|
viewAttr={viewAttr}
|
|
onChange={(val) => {
|
|
this.changeData(val, index, key, parentIndex, item)
|
|
}}
|
|
/>
|
|
</WeaError> */}
|
|
|
|
<WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@wof0nm`}
|
|
value={value}
|
|
viewAttr={viewAttr}
|
|
onChange={(val) => {
|
|
this.changeData(val, index, key, parentIndex, item)
|
|
}}
|
|
/>
|
|
|
|
</Col>
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@43t0hs`} span={6}>
|
|
<div className="plan_input_add">
|
|
{item[total] && item[total] > 0 &&
|
|
<a className='plan_input_add_number'
|
|
onClick={() => {
|
|
this.onToggleDialog(true, value, {
|
|
type: 'plan',
|
|
index,
|
|
key,
|
|
parentIndex,
|
|
item,
|
|
modeInfo: this.modeInfo
|
|
})
|
|
}}
|
|
title={item[total]}>{item[total]}</a>}
|
|
{viewAttr > 1 &&
|
|
<i className="icon-coms-Add-to-o icon-select"
|
|
onClick={() => {
|
|
this.onToggleDialog(true, value, {
|
|
type: 'plan',
|
|
index,
|
|
key,
|
|
parentIndex,
|
|
item,
|
|
modeInfo: this.modeInfo
|
|
})
|
|
}}
|
|
/>}
|
|
</div>
|
|
</Col>
|
|
</Row>
|
|
</Tooltip>
|
|
)
|
|
} else if (_.startsWith(key, 'finishCtx_')) { //完成情况
|
|
const planCtx = `planCtx_${key.split("_")[1]}`;
|
|
const viewAttrCopy = item[planCtx] && item[planCtx]['viewAttr'] ? item[planCtx]['viewAttr'] : 1;
|
|
const len = value.length || 0;
|
|
value = _.isArray(toJS(value)) && value.length ? value : [];
|
|
const showData = len == 0 ? "" : value[len - 1]['ctx'];
|
|
let showDatas = "";
|
|
let content = [];
|
|
value.length > 0 && value.map((item,index)=>{
|
|
content.push(
|
|
<p style={{borderBottom:"1px solid gray",wordWrap:"break-word"}}>
|
|
{index+1}.{item.ctx && item.ctx}
|
|
<span style={{float:"right"}}>{item.cjsj && item.cjsj}</span>
|
|
</p>
|
|
)
|
|
})
|
|
value.map(item=>{
|
|
showDatas += (item.ctx+"\r\n")
|
|
});
|
|
tempObj[key] = (<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@oehu12`} className="plan_input_wrapper2">
|
|
{/* <Popover content={<div style={{width:"400px"}}>{content}</div>} placement="left" trigger="hover"> */}
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@sdqmyo`} span={18}>
|
|
{
|
|
viewAttr == 3 &&<WeaError ecId={`${this && this.props && this.props.ecId || ''}_WeaError@36zg9q`}
|
|
ref={(ref) => {
|
|
this.remind1.push(ref);
|
|
}}
|
|
error={getLabel(385869,"此项必填")}
|
|
tipPosition="left"
|
|
>
|
|
|
|
<WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@00puej`}
|
|
placeholder={getLabel('22069', '完成情况')}
|
|
value={showData}
|
|
viewAttr={viewAttr}
|
|
style={{border: "1px solid #ddd"}}
|
|
readOnly = {true}
|
|
className='finish-input-border'
|
|
onChange={(val) => {
|
|
value[len - 1] = {...value[len - 1], ctx: val}
|
|
this.changeData(value, index, key, parentIndex, item)
|
|
}}/>
|
|
|
|
</WeaError>
|
|
}
|
|
{
|
|
viewAttr == 1 && <span className="report-span2" >{showData}</span>
|
|
}
|
|
|
|
</Col>
|
|
{/* </Popover> */}
|
|
{/* */}
|
|
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@05f13f`} span={6}>
|
|
<div className="plan_input_add">
|
|
{len > 0 && item[key.replace('finishCtx','caozuo')] &&
|
|
<a className='plan_input_add_number'
|
|
onClick={() => {
|
|
// console.log(111,item[key.replace('finishCtx','caozuo')],item)
|
|
this.onToggleDialog(true, value, {
|
|
type: 'condition', index, key, parentIndex, item, mainid:item[key.replace('finishCtx','caozuo')]
|
|
})
|
|
}}
|
|
title={len}>{len}</a>
|
|
}
|
|
{viewAttrCopy > 1 &&
|
|
<i className="icon-coms-Add-to-o icon-select"
|
|
onClick={() => {
|
|
this.onToggleDialog(true, value, {
|
|
type: 'condition', index, key, parentIndex, item
|
|
})
|
|
}}
|
|
/>}
|
|
</div>
|
|
</Col>
|
|
</Row>)
|
|
} else if (_.startsWith(key, 'unFinishReason_')) { //未完成原因
|
|
let content=<span style={{borderBottom:"1px solid gray",wordWrap:"break-word",width:"400px"}}>{value}</span>
|
|
tempObj[key] = ( <Popover ecId={`${this && this.props && this.props.ecId || ''}_Popover@twcexo`} content={<div style={{width:"400px"}}>{content}</div>} placement="left" trigger="hover"><WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@6n32nm`}
|
|
value={value}
|
|
viewAttr={viewAttr}
|
|
onChange={(val) => {
|
|
this.changeData(val, index, key, parentIndex, item)
|
|
}}
|
|
/></Popover>)
|
|
} else if (_.startsWith(key, 'caozuo_')) { //操作项
|
|
let content=<span style={{borderBottom:"1px solid gray",wordWrap:"break-word",width:"400px"}}>{value}</span>
|
|
tempObj[key] = ( <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@rb9f7d`} onClick={()=>{this.openDialog(value)}}>{getLabel(93, "编辑")}</Button> );
|
|
} else if (!item['children']) {
|
|
tempObj[key] = (<Tooltip ecId={`${this && this.props && this.props.ecId || ''}_Tooltip@0j6qr8`} title={value} placement="bottomLeft"><span className="report-span" >{value}</span></Tooltip>);
|
|
} else {
|
|
if (key === 'children' && value.length) { //递归解析树形结构
|
|
tempObj[key] = this.compileByType(item.children, index + '')
|
|
} else { //纯文本显示值
|
|
tempObj[key] = (<Tooltip ecId={`${this && this.props && this.props.ecId || ''}_Tooltip@rmeig2`} title={value} placement="bottomLeft"><span className="report-span" >{value}</span></Tooltip>);
|
|
}
|
|
}
|
|
}
|
|
|
|
})
|
|
tempDatas.push(tempObj)
|
|
})
|
|
// console.log(tempDatas);
|
|
return tempDatas;
|
|
}
|
|
|
|
@action
|
|
openDialog = (value) => {
|
|
this.feedBackInfoStore.handleFeedBackInfoDialog(true,{id:value});
|
|
}
|
|
|
|
@action
|
|
changeData = (value, index, key, parentIndex, item) => {
|
|
this.onDataChange(value, index, key, parentIndex, item)
|
|
}
|
|
|
|
@action
|
|
onDataChange = (value, index, key, parentIndex, item) => {
|
|
// console.log(value, index, key, parentIndex, item);
|
|
//处理数据显示
|
|
if (parentIndex) {
|
|
if (_.startsWith(key, 'planCtxTotal_')) {
|
|
const data = this.tableDatas[parentIndex].children[index][key];
|
|
const viewAttr = data.hasOwnProperty('viewAttr') ? data.viewAttr : ""; //获取数据原本的viewAttr
|
|
this.tableDatas[parentIndex].children[index][key] = viewAttr ? {value, viewAttr} : value;
|
|
|
|
} else if (_.startsWith(key, 'finishCtx_')){
|
|
// console.log(toJS(this.tableDatas[parentIndex].children[index][key]));
|
|
const data = this.tableDatas[parentIndex].children[index][key];
|
|
const viewAttr = data.hasOwnProperty('viewAttr') ? data.viewAttr : ""; //获取数据原本的viewAttr
|
|
|
|
let finshCtxs = [];
|
|
value.map(item=>{
|
|
let attachids = [];
|
|
let attachs = item.attach;
|
|
attachs.length > 0 && attachs.map(attach=>{
|
|
attachids.push(attach['fileid']);
|
|
})
|
|
let newitem = {
|
|
...item,
|
|
attachids : attachids
|
|
}
|
|
finshCtxs.push(newitem);
|
|
});
|
|
|
|
this.tableDatas[parentIndex].children[index][key] = viewAttr ? {value : finshCtxs, viewAttr} : finshCtxs;
|
|
}else {
|
|
const data = this.tableDatas[parentIndex].children[index][key];
|
|
const viewAttr = data.hasOwnProperty('viewAttr') ? data.viewAttr : ""; //获取数据原本的viewAttr
|
|
// if (viewAttr == '3' && !('' + value)) {
|
|
// return;
|
|
// }
|
|
this.tableDatas[parentIndex].children[index][key] = viewAttr ? {value, viewAttr} : {value};
|
|
}
|
|
} else {
|
|
this.tableDatas[index][key].value = value;
|
|
}
|
|
|
|
this.tableForamtDatas = this.compileByType(this.tableDatas)
|
|
//处理数据保存
|
|
const id = item['hbid_' + key.split('_')[1]];
|
|
const formatKey = key.split("_")[0];
|
|
//配合人员特殊处理
|
|
if (formatKey == "assistUser") {
|
|
let value_ = value;
|
|
let assistUserIds = [];
|
|
if (value_.length > 0) {
|
|
value_.map(item => {
|
|
assistUserIds.push(parseInt(item.id));
|
|
});
|
|
}
|
|
value = assistUserIds;
|
|
}
|
|
let finshCtxs = [];
|
|
|
|
let param = {
|
|
id,
|
|
key: item['key'],
|
|
[formatKey]: value,
|
|
};
|
|
//完成情况相关附件特殊处理
|
|
if (_.startsWith(key, 'finishCtx_')){
|
|
|
|
value.map(item=>{
|
|
let attachids = [];
|
|
let attachs = item.attach;
|
|
attachs.length > 0 && attachs.map(attach=>{
|
|
attachids.push(attach['fileid']);
|
|
})
|
|
let newitem = {
|
|
...item,
|
|
attachids : attachids
|
|
}
|
|
finshCtxs.push(newitem);
|
|
});
|
|
param = {
|
|
id,
|
|
key: item['key'],
|
|
[formatKey]: finshCtxs,
|
|
};
|
|
}
|
|
if (!this.submitHash[""+id]) {
|
|
this.submitData.push(param);
|
|
this.submitHash = {
|
|
...this.submitHash,
|
|
[id] : '' + (this.submitData.length - 1)
|
|
}
|
|
} else {
|
|
this.submitData[this.submitHash[""+id]] = Object.assign(this.submitData[this.submitHash[id]], param);
|
|
}
|
|
|
|
}
|
|
|
|
@action
|
|
onToggleDialog = (bool, data, dialogSource = {}) => {
|
|
this.dialogVisible = bool;
|
|
this.dialogData = data;
|
|
this.dialogSource = dialogSource;
|
|
}
|
|
|
|
@action getLineClass = () => {
|
|
this.lineindex ++ ;
|
|
if(this.lineindex % 2 == 1){
|
|
return "dark-row"
|
|
}else{
|
|
return "light-row"
|
|
}
|
|
}
|
|
|
|
@action
|
|
setDialogData = (v) => {
|
|
this.dialogData = v;
|
|
}
|
|
|
|
@action
|
|
saveMxDatas = () =>{
|
|
const mxParams = JSON.stringify({mxdatas:toJS(this.dialogData)});
|
|
const params = {mainid:this.dialogSource.mainid,mxdatas:mxParams}
|
|
API.saveMxDatas(params).then(data=>{
|
|
if(data.success){
|
|
message.success(getLabel(18758,"保存成功"));
|
|
this.onToggleDialog(false);
|
|
this.onQueryData(true);
|
|
}else{
|
|
message.error(getLabel('507580','出现错误!对不起,您暂时没有权限!!'));
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
export default new ReportStore();
|