export default { data() { return { userTask: [ 'signtask', 'usertask', 'subprocess', 'serviceTask', 'start', 'cannot', 'parallelgateway', 'exclusivegateway', ], userCollectionArr: [], templateArr: [], } }, computed: { handleIcon() { return function (item) { let ret = '' if (item.extraProp == 'parallel') { ret = 'transform-rotate-90' } switch (item.nodeType.toLowerCase()) { case 'usertask'.toLowerCase(): ret += ' icon-touxiang' break // case 'signTask': case 'SIGNTASK'.toLowerCase(): ret += ' icon-row-full' break case 'canNot': ret += ' icon-tishi' break case 'serviceTask'.toLowerCase(): //服务任务 ret += ' icon-chilun' break case 'subProcess'.toLowerCase(): //内部子流程 ret += ' icon-24gl-rectangle' break default: ret += ' icon-touxiang' break } return ret } }, // handleHeaderColor() {//旧 // return function (row) { // let color = '' // if (row) { // if (row.isOld) { // // color = 'green-top' // if (row?.nodeOpinion?.data?.length > 0) { // if ( // row?.nodeOpinion?.data[0]?.status != 'reject' && // row?.nodeOpinion?.data.filter( // (v) => v.status == 'awaiting_check' // ).length == 0 // ) { // // 已完成(绿色):(isOld && getStatus(data) == false && data[0].status != 'reject' && data[0].status != 'backToStart') 第一条记录不为驳回以及 遍历历史中不存在awaiting_check // color = 'green-top' // } // if (row?.nodeOpinion?.data[0]?.status == 'awaiting_check') { // //审批中(蓝色):(isOld && data[0].status == 'awaiting_check') 排除 已完成以及未通过的状态说明是审批中的 // color = 'blue-top' // } // if ( // row?.nodeOpinion?.data[0]?.status == 'reject' || // row?.nodeOpinion?.data[0]?.status == 'backToStart' || // row?.nodeOpinion?.data[0]?.status == 'signRecoverCancel' || // row?.nodeOpinion?.data[0]?.status == 'revoker_to_start' || // row?.nodeOpinion?.data[0]?.status == 'signBackCancel' // ) { // // 未通过(灰色):(!isOld)||(isOld && (data[0].status == 'reject' || data[0].status == 'backToStart'||data[0].status == 'signRecoverCancel'||data[0].status=='revoker_to_start'||会签节点驳回:signBackCancel)判断一下审批历史第一条是否为驳回) // color = '' // } // } // } else { // color = '' // } // if (this.headerData.nodeId == row.nodeId) { // // color = 'blue-top' // } // return color // } // } // }, // handleHeaderColor() {//new // return function (row) { // let color = '' // if (row) { // if (row.isOld) { // if (row?.nodeOpinion?.data?.length > 0) { // let tempStatus = this.handleParentNodeId(row.parentNodeId) // if (tempStatus == 'green') { // color = 'green-top' // } else if (tempStatus == 'gray') { // color = '' // } else { // color = '' // } // } else { // color = '' // } // } else { // color = '' // } // if (row.isNow) { // color = 'blue-top' // } // return color // } // } // }, handleHeaderColor() { return function (row) { let color = '' if (row.isNow) { color = 'blue-top' if(this.proInststatus === 'manualend') { // 人工终止 color = 'peo-top' row.users = '人工终止' } } else if (row.isOld) { color = 'green-top' } else { color = '' } if (row.isNow && row?.nodeOpinion?.data[0]?.status == 'manual_end') { color = 'peo-top' } if (row.isNow && row?.nodeOpinion?.data[0]?.status == 'hangUp') { color = 'gua-top' } return color } }, isShowSubTitleTips(val) { return function (val) { if (val && val.length > 9) { return false } else { return true } } }, isPopoverDisabled() { return function (node) { let isNodeDisabled = true try { // isNodeDisabled = this.nodeOpinions[node.nodeId] ? false : true isNodeDisabled = node['tableData'] ? false : true } catch (e) {} return isNodeDisabled } }, isShowLineAndArrow() { return function (data, item) { let mark = false if ( item.children && !( item.children.filter( (v) => v.nodeType?.toLowerCase() == 'inclusivegateway' ).length > 0 ) && item.children.filter( (v) => v.nodeType?.toLowerCase() == 'parallelgateway' ).length == 0 && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v?.children?.filter((e) => e.key == 'user')?.length > 0 ).length > 1 ) { mark = true } if ( item?.children?.filter( (v) => v.nodeType?.toLowerCase() == 'parallelgateway' ).length > 0 ) { mark = true } if ( item?.children?.filter( (v) => v.nodeType?.toLowerCase() == 'inclusivegateway' ).length > 0 && item?.children?.filter((v) => v.key == 'user')?.length > 0 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && data.filter((v) => v.key == 'gateLine').length > 1 ) { mark = true } return mark } }, isShowLineAndArrowSub() { return function (data, item, subIndex) { let mark = false if ( item.children && !( item.children.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 ) && item.children.filter( (v) => v.nodeType == 'parallelGateway' || v.nodeType == 'PARALLELGATEWAY' ).length == 0 && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && item.children.findIndex((v) => v.key == 'user') != subIndex ) { mark = true } if ( item?.children?.filter( (v) => v.nodeType == 'PARALLELGATEWAY' || v.nodeType == 'parallelGateway' ).length > 0 || (item?.children?.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 && item?.children?.filter((v) => v.key == 'user')?.length > 1 && subIndex != 0 && item.children.findIndex((v) => v.key == 'user') != subIndex && subIndex != item.children.length - 1) ) { mark = true } if ( item?.children?.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 && item?.children?.filter((v) => v.key == 'user')?.length > 1 && item?.children?.filter((v) => v.key == 'gateway')?.length > 0 && subIndex == 0 && data.filter((v) => v.key == 'gateLine')?.length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 ) { mark = true } if ( item.children[subIndex - 1] && this.userTask.includes( item.children[subIndex - 1].nodeType?.toLowerCase() ) && item.children.findIndex((v) => v.key == 'user') != subIndex ) { mark = true } if ( item.children.findIndex((v) => v.key == 'user') == subIndex && data.filter( (v) => v?.children?.filter((e) => e.key == 'user')?.length > 0 ).length > 1 ) { mark = true } if (item?.children[subIndex]?.nodeType?.toLowerCase() == 'cannot') { mark = true } return mark } }, isShowLineAndArrowNext() { return function (pathList, index) { let mark = false if ( !pathList[index - 1] || (pathList[index - 1] && this.userTask.includes(pathList[index - 1].nodeType?.toLowerCase())) ) { mark = true } if ( this.userTask.includes(pathList[index].nodeType?.toLowerCase()) && pathList[index - 1].nodeType?.toLowerCase() != 'inclusivegateway' ) { mark = true } if ( (pathList[index - 1] && pathList[index - 1].children?.filter((v) => v.key == 'gateLine') .length > 1 && pathList[index - 1].children?.filter( (v) => v?.children?.filter((e) => e.key == 'user')?.length > 0 ).length > 1) || pathList[index].nodeType == 'canNot' ) { mark = true } if ( pathList[index - 1] && pathList[index - 1]?.nodeType?.toLowerCase() == 'inclusivegateway' ) { mark = true } return mark } }, isShowLineAndArrowNextSub() { return function (data, item) { let mark = false if ( item.children && !( item.children.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 ) && item.children.filter((v) => this.userTask.includes(v?.nodeType?.toLowerCase()) ).length > 0 && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && item.children.filter((v) => v.key == 'user').length > 0 ) { mark = true } if ( item.children && item.children.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 && item.children.filter((v) => this.userTask.includes(v?.nodeType?.toLowerCase()) ).length > 1 && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && item.children.filter((v) => v.key == 'user').length > 0 ) { mark = true } if ( item.children && item.children.filter( (v) => v.nodeType == 'inclusiveGateway' || v.nodeType == 'INCLUSIVEGATEWAY' ).length > 0 && item.children.filter((v) => this.userTask.includes(v?.nodeType?.toLowerCase()) ).length > 0 && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && item.children.filter((v) => v.nodeType == 'canNot').length > 0 && item.children.filter((v) => v.key == 'user').length > 0 ) { mark = true } if ( item.children && data.filter((v) => v.key == 'gateLine').length > 1 && data.filter( (v) => v.children.filter((n) => n.key == 'user').length > 0 ).length > 1 && item.children.filter((v) => v.key == 'user').length > 0 ) { mark = true } return mark } }, isShowLineArrowEnd() { return function (userCollectionArr, item) { // setTimeout(() => { let mark = false if (userCollectionArr?.length > 5) { let nowIndex = userCollectionArr.findIndex( (n) => n.nodeId == item.nodeId ) nowIndex = nowIndex + 1 if (nowIndex > 1 && nowIndex % 5 == 0) { mark = true } } return mark // }, 1000) } }, isShowLineArrowStart() { return function (userCollectionArr, item) { // setTimeout(() => { let mark = false let nowIndex = userCollectionArr.findIndex( (n) => n.nodeId == item.nodeId ) // if (item.nodeId == 'UserTask_1buy6tv') { // // } // nowIndex = nowIndex + 1 if (nowIndex > 1 && nowIndex % 5 == 0) { mark = true } return mark // }, 1000) } }, }, methods: { switchType(nodeType) { let ret = '' switch (nodeType.toLowerCase()) { // case 'signTask': // case 'userTask': case 'subProcess'.toLowerCase(): //内部子流程 case 'serviceTask'.toLowerCase(): //服务任务 case 'USERTASK'.toLowerCase(): case 'SIGNTASK'.toLowerCase(): ret = 'user' break case 'EXCLUSIVEGATEWAY'.toLowerCase(): case 'PARALLELGATEWAY'.toLowerCase(): // case 'inclusiveGateway': // case 'parallelGateway': case 'INCLUSIVEGATEWAY'.toLowerCase(): ret = 'gateway' break case 'line': ret = 'gateLine' break case 'start': ret = 'start' break case 'end': ret = 'end' break default: ret = nodeType } return ret }, // handleParentNodeId(parentNodeId) { // if (this.pathMap[parentNodeId].isNow) { // return 'gray' // } else if (this.pathMap[parentNodeId].nodeId == 'startNode') { // return 'green' // } else { // this.handleParentNodeId(this.pathMap[parentNodeId].parentNodeId) // } // }, initHandleCollectionUserArr() { let mark = false let ret = this.handlerJudgeSoild(this.pathList, this.pathList) for (let key in this.tempNodeListObj) { if ( this.tempNodeListObj[key].nodeType.toLowerCase() == 'parallelgateway' || ret ) { mark = true } } if (!mark) { this.isSolidShow = true this.handleCollectionUserArr( this.pathList, this.pathList, this.userCollectionArr ) } }, handleCollectionUserArr(pathList, tempArr, userArr) { if (pathList?.length > 0) { pathList.map((item) => { if (item.key == 'gateway' || item.key == 'gateLine') { if (item?.children?.length > 0) { this.handleCollectionUserArr(item.children, tempArr, userArr) } } else { if ( item.key != 'gateLine' && item.key != 'gateway' && item.key != 'start' && item.key != 'end' ) { userArr.push(item) } } }) } }, handlerJudgeSoild(pathList, tempArr) { let mark = false if (pathList?.length > 0) { pathList.map((item) => { if (item.key == 'gateway' || item.key == 'gateLine') { if (item?.children?.length > 1) { if ( item?.children?.filter( (n) => n?.children?.filter((v) => v?.key == 'user')?.length > 0 ).length > 1 ) { mark = true } } else { this.handlerJudgeSoild(item.children, tempArr) } } }) } return mark }, }, }