import{aa as e,F as t,Y as s,c as o,n as a,$ as i,G as l,v as n,o as r,d,w as f,Z as c,L as m,t as h,e as p,Q as u,R as g,x as w,I as y,J as T,K as b,i as k,a0 as I,a3 as v,f as x,X as C,h as L}from"./index-zLEn-L9B.js";import{_ as S}from"./u-tabs._Nh4qi7r.js";import{r as _}from"./uni-app.es.qL3OKTvR.js";import{_ as j}from"./u-sticky.DTRiJUvq.js";import{_ as U}from"./u-avatar.DxDlR1tM.js";import{d as N,e as D}from"./index.nBApl6-K.js";import{_ as R}from"./mescroll-body.DhpiYNwy.js";import{C as F,f as O,r as A,R as J,e as B,i as E,U as $,a as V}from"./emoji.B57gc9B_.js";import{F as q,S as H,C as M,T as P,a as z,A as W,d as K}from"./flowBefore.Bq_39Iwl.js";import{P as X,R as Y}from"./flowLaunch.B0bBl6ls.js";import{b as Z,c as G,d as Q}from"./flowEngine.CrTCOGy1.js";import{r as ee}from"./resources.DipqUmnN.js";import{u as te}from"./index.BEe-rD9x.js";import{c as se}from"./form.DgvUvnaR.js";import{M as oe}from"./mescroll-mixins.C12t-s_D.js";import{_ as ae}from"./_plugin-vue_export-helper.BCo6x5W8.js";const ie=ae({mixins:[oe],components:{CandidateForm:F,userSelect:te,childForm:se,flowInfo:O,records:A,RecordSummary:J},data:()=>({emojiList:B,downOption:{use:!0,auto:!0},upOption:{page:{num:0,size:20,time:null},empty:{use:!0,icon:ee.message.nodata,tip:"暂无数据",fixed:!0,top:"300rpx"},textNoMore:"没有更多数据"},isComment:!1,show:!1,config:{opType:"-1"},currentView:"",formData:{},flowTaskInfo:{},flowTaskNodeList:[],recordList:[],properties:{},endTime:0,tabIndex:0,tabBars:[{name:"表单信息",id:0},{name:"流程信息",id:1},{name:"流转记录",id:2}],tablist:[],flowStatus:"",stepIndex:0,userSelectShow:!1,btnLoading:!1,eventType:"",commentList:[],processId:"",selectShow:!1,candidateList:[],isSummary:!1,summaryType:0,tabsName:"表单信息",flowUrgent:1,flowUrgentList:[{label:"普通",color:"#409EFF",bgColor:"#e5f3fe",value:1,extra:"0"},{label:"重要",color:"#E6A23C",bgColor:"#fef6e5",value:2,extra:"1"},{label:"紧急",color:"#F56C6C",bgColor:"#fee5e5",value:3,extra:"2"}],selectflowUrgent:{extra:"0",label:"普通",value:1},flowTemplateJson:[]}),computed:{baseURL(){return this.define.baseURL}},methods:{getTabBars(){let e=this.tabBars;this.isSummary&&e.push({name:"审批汇总",id:3}),this.isComment&&e.push({name:"流程评论",id:4}),this.tablist=e},upCallback(e){let t={currentPage:e.num,pageSize:e.size,sort:"desc",sidx:"",taskId:this.processId};Z(t,{load:1==e.num}).then((t=>{this.mescroll.endSuccess(t.data.list.length),1==e.num&&(this.commentList=[]);const s=t.data.list.map((e=>(e.image=JSON.parse(e.image),e.file=JSON.parse(e.file),e.text=this.replaceEmoji(e.text),e)));this.commentList=this.commentList.concat(s)})).catch((()=>{this.mescroll.endErr()}))},tabChange(e){this.tabIndex=e,this.tabsName=this.tabBars[e].name},replaceEmoji(e){if(!e)return"";let t=e.replace(/\[([^(\]|\[)]*)\]/g,(e=>"jnpfjnpf"+e+"jnpfjnpf")).split(/jnpfjnpfjnpfjnpf|jnpfjnpf/g);t=t.filter((e=>e));let s=[];for(let o=0;o<t.length;o++){let e={content:t[o],type:"emjio"};if(/\[([^(\]|\[)]*)\]/.test(t[o])){let s="";for(let e=0;e<this.emojiList.length;e++){let a=this.emojiList[e];if(a.alt==t[o]){s=this.getEmojiUrl(a.url);break}}e={content:s,type:"emjio"}}else e={content:t[o],type:"text"};s.push(e)}return s},getEmojiUrl:e=>E[e.replace(".","")],openReplyText(t){e({content:t,showCancel:!1,success:e=>{}})},handleReply(e,t){this.goWriteComment(e)},goWriteComment(e){let s={taskId:this.processId};e&&(s.replyId=e),s=encodeURIComponent(JSON.stringify(s)),t({url:"/pages/workFlow/comment/index?data="+s})},jumpComment(){this.goWriteComment()},addComment(e){e.taskId=this.processId,G(e).then((e=>{this.mescroll.resetUpScroll()}))},delComment(t,s){e({title:"提示",content:"确定删除该评论?",success:e=>{e.confirm&&Q(t).then((e=>{this.commentList.splice(s,1),this.mescroll.resetUpScroll()}))}})},init(e){this.tabIndex=0,this.config=e,this.config.origin="scan",this.taskId=this.config.id,this.getBeforeInfo(this.config)},getBeforeInfo(e){this.formData.flowId=e.flowId,this.loading=!0;const t={taskNodeId:e.taskNodeId,taskOperatorId:e.taskId,flowId:e.flowId};q(e.id||0,t).then((t=>{e.formData=t.data.formData||{},this.flowTaskInfo=t.data.flowTaskInfo||{},this.flowFormInfo=t.data.flowFormInfo||{},e.formType=this.flowFormInfo.formType,this.config.formType=this.flowFormInfo.formType,this.config.formEnCode=this.flowFormInfo.enCode,this.loading=!1,this.flowTemplateInfo=t.data.flowTemplateInfo||{};const i=this.flowTemplateInfo.flowTemplateJson?JSON.parse(this.flowTemplateInfo.flowTemplateJson):null;e.flowTemplateJson=i,this.flowTemplateJson=i,this.isSummary=this.flowTemplateJson.properties.isSummary,this.isComment=this.flowTemplateJson.properties.isComment,this.getTabBars(),this.summaryType=this.flowTemplateJson.properties.summaryType,this.flowTaskNodeList=t.data.flowTaskNodeList||[],this.recordList=(t.data.flowTaskOperatorRecordList||[]).reverse();for(let e=0;e<this.recordList.length;e++){const t=this.recordList[e];t.formType=this.flowFormInfo.formType,t.enCode=this.flowFormInfo.enCode,t.fileList&&(t.fileList=JSON.parse(t.fileList))}this.properties=t.data.approversProperties||{},e.draftData=t.data.draftData||null,e.formConf=this.flowFormInfo.propertyJson,e.type=this.flowTaskInfo.type,this.config.status=this.flowTaskInfo.status,this.config.fullName="-1"==e.opType?this.flowTemplateInfo.fullName:this.flowTaskInfo.fullName,this.title=this.flowTaskInfo.fullName,0!==this.config.status&&3!==this.config.status&&(this.title=this.flowTaskInfo.thisStep?this.config.fullName+"/"+this.flowTaskInfo.thisStep:this.config.fullName),s({title:this.config.fullName}),this.config.formRecords&&this.config.title&&s({title:this.config.title}),this.flowUrgent=this.flowTaskInfo.flowUrgent||1;if(this.selectflowUrgent=(()=>{var e={value:this.flowUrgent,extra:"0",label:"普通"};return this.flowUrgentList.forEach(((t,s)=>{t.value==this.flowUrgent&&(e.extra=s,e.label=t.label)})),e})(),this.flowTaskNodeList.length){for(let e=0;e<this.flowTaskNodeList.length;e++){const t=this.flowTaskNodeList[e],s=e=>{if(Array.isArray(e)&&e.forEach((e=>s(e))),e.nodeId===t.nodeCode)return e.id=t.id,0==t.type&&(e.state="state-past"),1==t.type&&(e.state="state-curr"),void("approver"!==t.nodeType&&"start"!==t.nodeType&&"subFlow"!==t.nodeType||(e.content=t.userName));e.conditionNodes&&Array.isArray(e.conditionNodes)&&s(e.conditionNodes),e.childNode&&s(e.childNode)};s(i)}this.flowTemplateJson=i}switch(1!=e.opType&&"-1"!=e.opType&&(e.readonly=!0),e.formOperates=[],0==e.opType?this.flowTemplateJson&&this.flowTemplateJson.properties&&this.flowTemplateJson.properties.formOperates&&(e.formOperates=this.flowTemplateJson.properties.formOperates||[]):e.formOperates=t.data.formOperates||[],this.config.status){case 0:this.flowStatus=ee.status.submit;break;case 1:default:this.flowStatus=ee.status.review;break;case 2:this.flowStatus=ee.status.reviewAdopt;break;case 3:this.flowStatus=ee.status.reviewRefuse;break;case 4:this.flowStatus=ee.status.reviewUndo;break;case 5:this.flowStatus=ee.status.reviewStop}setTimeout((()=>{this.$nextTick((()=>{this.$refs.child&&this.$refs.child.$refs.form||o({title:"暂无此流程表单",icon:"none",complete:()=>{setTimeout((()=>{a()}),1500)}})}))}),100)}))},eventLauncher(e){this.$refs.child&&this.$refs.child.$refs.form&&this.$refs.child.$refs.form.submit(e)},eventReceiver(e,t){return this.formData=e,this.eventType=t,"save"===t||"submit"===t?this.submitOrSave(t):"saveAudit"===t?this.saveAudit():"audit"===t?this.operate("audit",this.properties.auditBtnText):"reject"===t?this.operate("reject",this.properties.rejectBtnText):void 0},saveAudit(){this.btnLoading=!0,H(this.config.taskId,this.formData).then((e=>{o({title:e.msg,complete:()=>{setTimeout((()=>{this.btnLoading=!1,a()}),1500)}})})).catch((()=>{this.btnLoading=!1}))},submitCandidate(t){this.selectShow=!1,t?this.handleRequest(t):e({title:"提示",content:"您确定要提交当前流程吗?",success:e=>{this.handleRequest()}})},submitOrSave(t){if(this.formData.status="submit"===t?0:1,"save"===t)return this.handleRequest();M(0,{formData:this.formData}).then((t=>{let s=t.data;Array.isArray(s)&&s.length?(this.candidateList=t.data,this.selectShow=!0):e({title:"提示",content:"您确定要提交当前流程吗?",success:e=>{e.confirm&&this.handleRequest()}})})).catch((()=>{this.selectShow=!1}))},handleRequest(e){e&&(this.formData.candidateList=e),"save"===this.eventType&&(this.btnLoading=!0),(this.formData.id?$:V)(this.config.enCode,this.formData).then((e=>{o({title:e.msg,complete:()=>{setTimeout((()=>{this.formData.id&&i("refresh"),this.btnLoading=!1,a()}),1500)}})})).catch((()=>{this.btnLoading=!1}))},handlePress(){e({title:"提示",content:"此操作将提示该节点尽快处理",success:e=>{e.confirm&&X(this.config.id).then((e=>{this.$u.toast(e.msg)}))}})},operate(e,s){let o={eventType:e,title:"确认"+s.replace(/\s+/g,"")};"audit"!==e&&"reject"!==e||(o={...o,hasSign:this.properties.hasSign,hasFreeApprover:this.properties.hasFreeApprover,isCustomCopy:this.properties.isCustomCopy,formData:this.formData,taskId:this.config.taskId,eventType:e}),t({url:"/pages/workFlow/operate/index?config="+encodeURIComponent(JSON.stringify(o))})},handleTransfer(e){P(this.config.taskId,{freeApproverUserId:e}).then((e=>{this.toastAndBack(e.msg,!0)}))},revokeHandle(e){Y(this.config.id,{handleOpinion:e.handleOpinion}).then((e=>{this.toastAndBack(e.msg,!0)}))},recallHandle(e){z(this.config.taskId,{handleOpinion:e.handleOpinion}).then((e=>{this.toastAndBack(e.msg,!0)}))},auditHandle(e){this.handleApproval(e)},rejectHandle(e){this.handleApproval(e)},handleApproval(e){const t={...e,formData:this.formData,enCode:this.config.enCode};("audit"===e.eventType?W:K)(this.config.taskId,t).then((e=>{this.toastAndBack(e.msg,!0)}))},setBtnLoad(e){this.btnLoading=!!e},toastAndBack(e,t){o({title:e,complete:()=>{setTimeout((()=>{t&&i("refresh"),a()}),1500)}})}}},[["render",function(e,t,s,o,a,i){const F=l("childForm"),O=l("candidate-form"),A=k,J=_(n("u-tabs"),S),B=_(n("u-sticky"),j),E=I,$=l("flowInfo"),V=l("records"),q=l("RecordSummary"),H=_(n("u-avatar"),U),M=L,P=_(n("JnpfUploadImg"),N),z=_(n("u-divider"),D),W=v,K=_(n("mescroll-body"),R);return r(),d(A,{class:"flowBefore-v"},{default:f((()=>[c("div",{class:"flow-urgent-value",style:m({"background-color":a.flowUrgentList[a.selectflowUrgent.extra].bgColor}),onClick:t[0]||(t[0]=(...t)=>e.handleShowSelect&&e.handleShowSelect(...t))},[c("span",{style:m({color:a.flowUrgentList[a.selectflowUrgent.extra].color})},h(a.selectflowUrgent.label),5)],4),"-1"===a.config.opType?(r(),d(A,{key:0,class:"flowBefore-box"},{default:f((()=>[p(A,{class:"scroll-v","scroll-y":""},{default:f((()=>[p(F,{ref:"child",config:a.config,onEventReceiver:i.eventReceiver},null,8,["config","onEventReceiver"]),p(O,{modelValue:a.selectShow,"onUpdate:modelValue":t[1]||(t[1]=e=>a.selectShow=e),candidateList:a.candidateList,taskId:a.config.taskId,formData:a.formData,onSubmitCandidate:i.submitCandidate,ref:"candidateForm"},null,8,["modelValue","candidateList","taskId","formData","onSubmitCandidate"])])),_:1})])),_:1})):(r(),d(A,{key:1,class:"flowBefore-box"},{default:f((()=>[p(A,{class:"u-border-bottom"},{default:f((()=>[p(B,null,{default:f((()=>[p(J,{list:a.tablist,"is-scroll":!0,current:a.tabIndex,onChange:i.tabChange,height:"100"},null,8,["list","current","onChange"])])),_:1})])),_:1}),c("template",null,[u(p(A,null,{default:f((()=>[p(A,null,{default:f((()=>[0==a.config.opType||4==a.config.opType?(r(),d(A,{key:0,class:"flowStatus"},{default:f((()=>[p(E,{src:a.flowStatus,mode:"widthFix"},null,8,["src"])])),_:1})):w("",!0),p(F,{ref:"child",config:a.config,onEventReceiver:i.eventReceiver,onSetBtnLoad:i.setBtnLoad},null,8,["config","onEventReceiver","onSetBtnLoad"]),p(O,{modelValue:a.selectShow,"onUpdate:modelValue":t[2]||(t[2]=e=>a.selectShow=e),candidateList:a.candidateList,taskId:a.config.taskId,formData:a.formData,onSubmitCandidate:i.submitCandidate,ref:"candidateForm"},null,8,["modelValue","candidateList","taskId","formData","onSubmitCandidate"])])),_:1})])),_:1},512),[[g,"表单信息"===a.tabsName]]),"流程信息"===a.tabsName?(r(),d(A,{key:0,class:"nodeList-v"},{default:f((()=>[p($,{options:a.flowTemplateJson},null,8,["options"])])),_:1})):w("",!0),"流转记录"===a.tabsName?(r(),d(A,{key:1,class:"record-v"},{default:f((()=>[p(V,{options:a.recordList,endTime:a.endTime},null,8,["options","endTime"])])),_:1})):w("",!0),"审批汇总"===a.tabsName?(r(),d(A,{key:2,class:"record2-v"},{default:f((()=>[p(q,{processId:a.processId,ref:"recordSummary",summaryType:a.summaryType},null,8,["processId","summaryType"])])),_:1})):w("",!0),"流程评论"===a.tabsName?(r(),d(A,{key:3},{default:f((()=>[p(A,{class:"record-v"},{default:f((()=>[p(K,{ref:"mescrollRef",onInit:e.mescrollInit,onDown:e.downCallback,onUp:i.upCallback,sticky:!1,down:a.downOption,up:a.upOption,bottombar:!1},{default:f((()=>[p(A,{class:"discuss_box"},{default:f((()=>[p(W,{"scroll-y":"true",style:{height:"100%"}},{default:f((()=>[(r(!0),y(b,null,T(a.commentList,((t,s)=>(r(),d(A,{class:"u-flex-col discuss_list",key:s},{default:f((()=>[p(A,{class:"u-flex discuss_txt"},{default:f((()=>[p(A,{class:"discuss_txt_left u-flex"},{default:f((()=>[p(H,{src:i.baseURL+t.creatorUserHeadIcon},null,8,["src"]),c("span",{class:"uName"},[c("span",{class:"comment-header-color"},h(t.creatorUser),1),t.replyUser?(r(),y("span",{key:0},[c("span",{class:"replyText"},"回复"),c("span",{class:"replyText comment-content-color"},h(t.replyUser),1),c("span",{class:"replyText comment-header-color"},[c("span",{class:"icon-ym icon-ym-chat",onClick:e=>i.openReplyText(t.replyText)},null,8,["onClick"])])])):w("",!0)])])),_:2},1024)])),_:2},1024),p(A,{class:"u-flex-col discuss_content"},{default:f((()=>[p(A,{class:"msg-text"},{default:f((()=>[(r(!0),y(b,null,T(t.text,((e,t)=>(r(),d(A,{key:t},{default:f((()=>["text"==e.type?(r(),d(M,{key:0,class:"txt comment-content-color"},{default:f((()=>[x(h(e.content),1)])),_:2},1024)):w("",!0),"emjio"==e.type?(r(),d(E,{key:1,class:"msg-text-emoji",src:e.content},null,8,["src"])):w("",!0)])),_:2},1024)))),128))])),_:2},1024),2!=t.isDel?(r(),d(P,{key:0,modelValue:t.image,"onUpdate:modelValue":e=>t.image=e,disabled:"",detailed:"",align:"left"},null,8,["modelValue","onUpdate:modelValue"])):w("",!0),2!=t.isDel?(r(!0),y(b,{key:1},T(t.file,((t,s)=>(r(),d(A,{key:s,class:"jnpf-file-item u-type-primary u-flex u-line-1",onClick:s=>e.openFile(t)},{default:f((()=>[p(A,{class:"u-line-1",style:{"margin-bottom":"10rpx"}},{default:f((()=>[x(h(t.name),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128)):w("",!0)])),_:2},1024),p(A,{class:"u-flex discuss_txt time_button"},{default:f((()=>[p(M,{class:"discuss_txt_left u-flex comment-creator-time"},{default:f((()=>[x(h(e.$u.timeFormat(t.creatorTime,"yyyy-mm-dd hh:MM:ss")),1)])),_:2},1024),p(A,null,{default:f((()=>[1==t.isDel?(r(),d(M,{key:0,class:"del",onClick:C((e=>i.delComment(t.id,s)),["stop"])},{default:f((()=>[x("删除")])),_:2},1032,["onClick"])):w("",!0)])),_:2},1024)])),_:2},1024),s!=a.commentList.length-1?(r(),d(z,{key:0,"half-width":"100%","margin-top":32,"margin-bottom":32,"use-slot":!1})):w("",!0)])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1},8,["onInit","onDown","onUp","down","up"])])),_:1})])),_:1})):w("",!0)])])),_:1}))])),_:1})}],["__scopeId","data-v-fca95ccc"]]);export{ie as F};