(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d216b68"],{c445:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",[a("a-button",{attrs:{type:e.btnType},on:{click:function(t){return e.handle()}}},[e._v(e._s(e.text))]),a("a-modal",{attrs:{title:e.modalTaskTitle,"mask-closable":!1,width:500},model:{value:e.modalTaskVisible,callback:function(t){e.modalTaskVisible=t},expression:"modalTaskVisible"}},[e.modalTaskVisible?a("div",[e.type==e.handleType.reApply?a("div",[e._v("\n        确认无误并重新提交？\n      ")]):e._e(),a("a-form",{ref:"form",attrs:{model:e.form,"label-width":85}},[e.type!==e.handleType.reApply?a("a-form-item",{attrs:{label:"处理意见",prop:"reason"}},[a("a-input",{attrs:{type:"textarea",rows:4},model:{value:e.form.comment,callback:function(t){e.$set(e.form,"comment",t)},expression:"form.comment"}})],1):e._e(),a("div",{directives:[{name:"show",rawName:"v-show",value:2==e.type,expression:"type==2"}]},[e.returnTaskList.length?a("a-form-item",{attrs:{label:"退回节点",prop:"targetKey"}},[a("a-radio-group",{on:{change:e.targetKeyChange},model:{value:e.form.targetKey,callback:function(t){e.$set(e.form,"targetKey",t)},expression:"form.targetKey"}},e._l(e.returnTaskList,(function(t){return a("a-radio-button",{key:t.id,attrs:{value:t.id}},[e._v(e._s(t.name))])})),1)],1):a("span",[e._v("无可退回节点！")])],1),"start"!==e.form.targetKey&&e.candidateUsers.length?a("div",[a("a-form-item",{attrs:{label:"下个节点审批候选人"}},[a("a-select",{staticStyle:{width:"100%"},attrs:{mode:"multiple",placeholder:"请选择下个节点审批候选人"},model:{value:e.candidateUsersSelecteds,callback:function(t){e.candidateUsersSelecteds=t},expression:"candidateUsersSelecteds"}},e._l(e.candidateUsers,(function(t){return a("a-select-option",{key:t.username,attrs:{value:t.username}},[e._v("\n                      "+e._s(t.realname)+"\n                  ")])})),1)],1)],1):e._e()],1)],1):e._e(),a("div",{attrs:{slot:"footer"},slot:"footer"},[a("a-button",{attrs:{type:"text"},on:{click:function(t){e.modalTaskVisible=!1}}},[e._v("取消")]),a("a-button",{attrs:{type:"primary",loading:e.submitLoading},on:{click:e.handelSubmit}},[e._v("提交")])],1)])],1)},i=[],n=a("b775");function r(e){return Object(n["b"])({url:"/flowable/task/completeByDateId",method:"post",data:e})}function l(e){return Object(n["b"])({url:"/flowable/task/taskReturnByDataId",method:"post",data:e})}function o(e){return Object(n["b"])({url:"/flowable/task/taskRejectByDataId",method:"post",data:e})}function d(e){return Object(n["b"])({url:"/flowable/task/findReturnTaskListByDataId",method:"post",data:e})}var c={name:"ActHandleBtn",components:{},props:{btnType:{type:String,default:"link",required:!1},type:{type:String|Number,default:"0",required:!0},dataId:{type:String,default:"",required:!0},variables:{type:Object,default:function(){}},candidateUsers:{type:Array,default:function(){return[]}},text:{type:String,default:"处理",required:!1}},data:function(){return{handleType:{pass:0,back:1,return:2,reApply:3},returnTaskList:[],candidateUsersSelecteds:[],modalTaskVisible:!1,submitLoading:!1,form:{comment:"",targetKey:""},modalTaskTitle:""}},created:function(){},watch:{},methods:{handle:function(){this.form.comment="",this.candidateUsersSelecteds=[],this.type===this.handleType.delegate||(this.type===this.handleType.pass?this.passTask():this.type===this.handleType.back?this.backTask():this.type===this.handleType.return?this.returnTask():this.type===this.handleType.reApply?this.reApply():this.$message.warn("未知类型type，参见 handleType"))},reApply:function(){this.modalTaskTitle="确认重新提交",this.modalTaskVisible=!0},passTask:function(){this.modalTaskTitle="审批通过",this.modalTaskVisible=!0},backTask:function(){this.modalTaskTitle="审批驳回",this.modalTaskVisible=!0},returnTask:function(){var e=this;this.modalTaskTitle="审批退回",this.modalTaskVisible=!0,d({dataId:this.dataId}).then((function(t){e.returnTaskList=t.result||[]}))},handelSubmit:function(){var e=this;this.submitLoading=!0;var t=Object.assign({dataId:this.dataId,candidateUsers:this.candidateUsersSelecteds,values:Object.assign({dataId:this.dataId},this.variables)},this.form);if(this.type==this.handleType.reApply&&(t.comment="重新提交"),!t.comment)return this.$message.error("请输入审批意见！"),void(this.submitLoading=!1);if(this.candidateUsers.length&&0==this.candidateUsersSelecteds.length&&"start"!==this.form.targetKey)return this.$message.error("请选择下个节点审批人！"),void(this.submitLoading=!1);if(this.type==this.handleType.reApply||this.type==this.handleType.pass)r(t).then((function(t){e.submitLoading=!1,t.success?(e.$message.success("操作成功"),e.modalTaskVisible=!1,e.$emit("success")):e.$message.error("操作失败")})).finally((function(){e.submitLoading=!1}));else if(this.type==this.handleType.back)o(t).then((function(t){e.submitLoading=!1,t.success?(e.$message.success("操作成功"),e.modalTaskVisible=!1,e.$emit("success")):e.$message.error("操作失败")})).finally((function(){e.submitLoading=!1}));else if(this.type==this.handleType.return){if(!t.targetKey)return this.$message.error("请选择退回节点！"),void(this.submitLoading=!1);l(t).then((function(t){e.submitLoading=!1,t.success?(e.$message.success("操作成功"),e.modalTaskVisible=!1,e.$emit("success")):e.$message.error("操作失败")})).finally((function(){e.submitLoading=!1}))}},targetKeyChange:function(){this.candidateUsersSelecteds=[],this.$emit("targetKeyChange",this.form.targetKey)}}},u=c,m=a("2877"),h=Object(m["a"])(u,s,i,!1,null,null,null);t["default"]=h.exports}}]);