UNPKG

@jecloud/plugin

Version:

JECloud 插件库

1 lines 2.84 kB
var a=this&&this.__assign||function(){return a=Object.assign||function(a){for(var e,t=1,s=arguments.length;t<s;t++)for(var r in e=arguments[t])Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=e[r]);return a},a.apply(this,arguments)};import e from"./task-common-params";import{OperatorEnum as t}from"../enum";import{encode as s,pick as r}from"@jecloud/utils";var o=function(){function o(a){this.operationParamKeys={assignee:"assignee",comment:"comment",target:"target",sequentials:"sequentials"},this.commomParams=new e(a),this.operationParams=this._buildOperationParams(a)}return o.prototype.toParams=function(){return a(a({},r(this.operationParams,[this.operationParamKeys.assignee,this.operationParamKeys.comment,this.operationParamKeys.target,this.operationParamKeys.sequentials])),this.commomParams)},o.prototype.toParams4accurate=function(){switch(this.commomParams.operationId){case t.PROCESS_EMPTY_START_OPERATOR:case t.PROCESS_CANCEL_OPERATOR:case t.TASK_RETREIEVE_OPERATOR:case t.TASK_URGE_OPERATOR:case t.TASK_CLAIM_OPERATOR:case t.TASK_CANCEL_DELEGATE_OPERATOR:case t.PROCESS_HANG_OPERATOR:case t.PROCESS_ACTIVE_OPERATOR:return this.commomParams;case t.PROCESS_EMPTY_SPONSOR_OPERATOR:case t.TASK_SUBMIT_OPERATOR:return a(a({},r(this.operationParams,[this.operationParamKeys.assignee,this.operationParamKeys.comment,this.operationParamKeys.target])),this.commomParams);case t.TASK_DIRECT_SEND_OPERATOR:case t.TASK_GOBACK_OPERATOR:case t.PROCESS_INVALID_OPERATOR:case t.TASK_PASS_OPERATOR:case t.TASK_VETO_OPERATOR:case t.TASK_ABSTAIN_OPERATOR:return a(a({},r(this.operationParams,[this.operationParamKeys.comment])),this.commomParams);case t.TASK_TRANSFER_OPERATOR:case t.TASK_DELEGATE_OPERATOR:return a(a({},r(this.operationParams,[this.operationParamKeys.assignee,this.operationParamKeys.comment])),this.commomParams);case t.TASK_DISMISS_OPERATOR:return a(a({},r(this.operationParams,[this.operationParamKeys.comment,this.operationParamKeys.target])),this.commomParams)}},o.prototype._buildOperationParams=function(a){var e,t,s=a.store;if(!s)return{};var r={target:s.activeNode.target,comment:null!==(e=s.taskComment)&&void 0!==e?e:"",assignee:[],sequential:null!==(t=s.sequential)&&void 0!==t?t:"0"};return r.assignee=o.parseAssigneeParam(Object.values(s.taskUsers)),r.sequentials=o.parseSequentialParam(Object.values(s.taskUsers)),r},o.parseAssigneeParam=function(a){var e=[];return a.forEach((function(a){var t={nodeId:a.nodeId,nodeName:a.nodeName};t.assignee=a.users.map((function(a){return a.id})).join(","),t.assigneeName=a.users.map((function(a){return a.bean&&a.bean.ACCOUNT_NAME||a.text})).join(","),e.push(t)})),s(e)},o.parseSequentialParam=function(a){var e=[];return a.forEach((function(a){-1!=["countersign","batchtask"].indexOf(a.type)&&e.push({nodeId:a.nodeId,sequential:a.sequential})})),s(e)},o}();export default o;