import{a4 as e,g as t,Y as a,M as i,N as o,c as s,F as n,n as l,$ as d,v as r,d as c,w as p,i as h,o as m,e as f,H as u,x as g,I as y,J as b,K as T,f as L,t as v,h as C,a0 as k,a3 as _,j,X as F,Z as V}from"./index-8nyjtlby.js";import{_ as x}from"./index.DLc6LkTL.js";import{r as I}from"./uni-app.es.CtWzWZ5l.js";import{_ as W,a as S}from"./u-form.DTMD9u-I.js";import{_ as w,a as U}from"./u-radio-group.BKpw8NZJ.js";import{_ as A}from"./index.C-r9m3eK.js";import{_ as N}from"./u-input.CpdlGpzj.js";import{_ as D}from"./u-button.DcSxWIR3.js";import{_ as O}from"./index.CnkVMRgp.js";import{_ as $}from"./index.Dv1mS7nT.js";import{_ as B}from"./u-icon.34NfwpE0.js";import{_ as J}from"./u-popup.-A-FNsIz.js";import{r as q}from"./resources.DipqUmnN.js";import{_ as z}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./MultSelect.B4FxgTNn.js";import"./u-search.MoA8OxSI.js";import"./u-checkbox-group.BbzPMwPX.js";import"./emitter.DrjJCwnj.js";import"./u-avatar.C7zZA82N.js";import"./ly-tree.A6kvlG5W.js";import"./u-badge.hLjBC6zA.js";import"./ly-checkbox.-ni42YSS.js";import"./u-action-sheet.DLBqtS0r.js";function E(t){return e({url:"/api/system/CommonWords",method:"post",data:t})}function M(t){return e({url:`/api/system/CommonWords/${t.id}`,method:"put",data:t})}const P=z({data:()=>({placeholder:"请输入",icon:q.message.nodata,customStyle:{color:"red",width:"100%",height:"100%",borderRadius:"0",border:"0"},commonWordsText:"",show2:!1,show:!1,btnTxt:"确认",typeList:[{fullName:"审批前",id:1},{fullName:"审批后",id:2}],props:{label:"nodeName",value:"nodeCode"},list:[{fullName:"重新审批",disabled:!1,name:1},{fullName:"直接提交给我",disabled:!1,name:2}],config:{},dataForm:{fileList:[],handleOpinion:"",signImg:"",copyIds:"",freeApproverUserId:"",branchList:[],candidateList:{},rejectStep:"",freeApproverType:1,rejectType:1},candidateValue:{},selectList:[],selectVal:{},isCandidate:!1,branchList:[],candidateList:[],candidateType:"",seletUserLabel:"选择人员",opinionName:"审批意见",isShow:!0,isBranch:!1,isSign:!1,rejectList:[],isLastAppro:!0,rejectType:1,commonWordsList:[],commonWordsData:{},key:+new Date}),onLoad(e){try{this.config=JSON.parse(decodeURIComponent(e.config))}catch{this.config=JSON.parse(e.config)}this.userInfo=t("userInfo")||{},this.dataForm.signImg=this.userInfo.signImg,this.rejectList=this.config.rejectList.list||[],this.rejectType=this.config.rejectType,this.isLastAppro=this.config.rejectList.isLastAppro,a({title:this.config.title}),this.btnTxt=this.btnTxt+this.config.title.replace(/\s+/g,""),this.isCandidate=!0,this.candidateType=this.config.candidateType,this.isSign="submit"!==this.config.eventType&&this.config.hasSign,this.config.hasFreeApprover?(this.opinionName="加签原因",this.seletUserLabel="加签人员",this.isBranch=!1):this.isBranch=1==this.candidateType&&"transfer"!==this.config.eventType&&"reject"!==this.config.eventType,3===this.candidateType&&(this.isCandidate=!1),this.candidateList=this.config.candidateList,this.branchList=this.config.branchList||[],this.branchList.length&&(this.branchList=this.branchList.filter((e=>e.isBranchFlow)),this.candidateList=this.config.branchList.filter((e=>!e.isBranchFlow&&e.isCandidates)),this.candidateList=this.candidateList.map((e=>({...e,label:e.nodeName+"审批人"})))),"reject"!==this.config.eventType&&"revoke"!==this.config.eventType&&"recall"!==this.config.eventType&&"submit"!==this.config.eventType&&"transfer"!==this.config.eventType||("transfer"===this.config.eventType&&(this.seletUserLabel="转给谁",this.opinionName="转审原因",this.placeholder="请输入"),"reject"===this.config.eventType&&(this.opinionName="退回意见",this.dataForm.rejectStep=this.rejectList[0][this.props.value],this.dataForm.rejectType=3!=this.rejectType?this.rejectType:1),"recall"===this.config.eventType&&(this.opinionName="撤回原因",this.placeholder="请输入"),"revoke"===this.config.eventType&&(this.opinionName="撤回原因",this.placeholder="请输入")),"approvalCancel"===this.config.eventType&&(this.opinionName="驳回原因",this.placeholder="请输入"),i("confirm",((e,t)=>{this.selectConfirm(e,t)})),this.init(),"submit"!==this.config.eventType&&this.config.hasOpinion&&this.getSelector()},onUnload(){o("confirm")},methods:{init(){if(1==this.candidateType){let e=[];this.isCandidate=!1;const t=this.candidateList;for(let a=0;a<this.dataForm.branchList.length;a++){e:for(let t=0;t<this.branchList.length;t++){let i=this.branchList[t];if(this.dataForm.branchList[a]===i.nodeId&&i.isCandidates){this.isCandidate=!0,e.push({...i,label:i.nodeName+"审批人"});break e}}this.candidateList=[...t,...e]}}else 2==this.candidateType&&Array.isArray(this.candidateList)&&this.candidateList.length&&(this.isCandidate="freeapprover"!==this.config.eventType,this.candidateList=this.candidateList.map((e=>({...e,label:e.nodeName+"审批人"}))));this.key=+new Date},getSelector(){e({url:"/api/system/CommonWords/Selector?type=App",method:"get"}).then((e=>{this.commonWordsList=e.data.list||[],this.key=+new Date}))},confirm(e){if(this.commonWordsData.commonWordsText=this.commonWordsText,this.commonWordsData.commonWordsType=1,!this.commonWordsText)return this.$u.toast("审批常用语不能为空");(0===this.commonWordsData.id?E:M)(this.commonWordsData).then((e=>{this.show2=!1,this.commonWordsText="",s({title:e.msg,icon:"none",complete:()=>{this.getSelector()}})})).catch((e=>{this.show2=!1,this.getSelector()}))},cancel(){this.show2=!1,this.commonWordsText=""},commonWords(){this.show=!0,this.key=+new Date},selectCommonWord(e){this.dataForm.handleOpinion=this.dataForm.handleOpinion+e.commonWordsText,this.show=!1},delCommonWord(t){var a;(a=t.id,e({url:`/api/system/CommonWords/${a}`,method:"DELETE"})).then((e=>{this.$u.toast(e.msg),this.getSelector()}))},editCommonWord(e){this.show2=!0;let t={commonWordsText:"",enabledMark:1,id:0,sortCode:0,systemIds:[],systemNames:[]};e.id?(this.commonWordsText=e.commonWordsText,this.commonWordsData={...e,systemIds:[],systemNames:[]}):(this.commonWordsText="",this.commonWordsData=t)},radioChange(e){this.dataForm.rejectType=e.name},open(e){this.isShow=!e},change(e,t){if(!e.length)return this.dataForm.candidateList={};let a=[];for(let i=0;i<e.length;i++)a.push(e[i]);this.$set(this.dataForm.candidateList,t,a)},branchChange(e){this.dataForm.branchList=e,this.candidateList=[],this.init()},freeApproverChange(e){this.isBranch=!1,this.isCandidate=!1,this.config.hasFreeApprover&&2==e&&this.candidateList.length&&(this.isCandidate=!0,this.candidateType=this.config.candidateType,1==this.candidateType&&this.branchList.length>0&&(this.isBranch=!0))},openSelect(e){this.selectList=[];for(let t in this.selectVal)t===e.nodeId&&(this.selectList=this.selectVal[t]);e.formData=this.config.formData,e.taskId=this.config.taskId,e.selectList=this.selectList,e.candidateList=JSON.stringify(this.candidateList),n({url:"/pages/workFlow/candiDateUserSelect/index?data="+encodeURIComponent(JSON.stringify(e))})},selectConfirm(e,t){let a=e,i=[],o=[],s=[];for(let n=0;n<this.candidateList.length;n++)for(let e=0;e<a.length;e++)a[e].nodeId===this.candidateList[n].nodeId&&(o.push(a[e].fullName),s.push(a[e]),this.$set(this.candidateValue,t,o.join(",")),i.push(a[e].id));this.$set(this.selectVal,t,s),this.$set(this.dataForm.candidateList,t,i)},handleClick(e){if("cancel"===e)return l();this.isCandidate||delete this.dataForm.candidateList,this.config.hasSign||delete this.dataForm.signImg,this.config.hasFreeApprover||delete this.dataForm.freeApproverType,this.dataForm.copyIds=this.dataForm.copyIds?this.dataForm.copyIds.join():"";let t={...this.dataForm,eventType:this.config.eventType,candidateType:this.candidateType};return"transfer"!==e||this.dataForm.freeApproverUserId.length?this.config.hasFreeApprover&&!this.dataForm.freeApproverUserId.length?this.$u.toast("加签人员不能为空"):this.isBranch&&this.branchList.length&&!this.dataForm.branchList.length?this.$u.toast("分支选择不能为空"):this.isCandidate&&(t.candidateList=this.dataForm.candidateList,!Object.keys(this.dataForm.candidateList).length)?this.$u.toast("候选人不能为空"):"submit"!==this.config.eventType&&this.isSign&&!this.dataForm.signImg?this.$u.toast("签名不能为空"):(1==this.config.type&&(t={...t,...this.config.formData}),t.fileList=t.fileList,d("operate",t),void l()):this.$u.toast("转审人员不能为空")}}},[["render",function(e,t,a,i,o,s){const n=I(r("JnpfSelect"),x),l=I(r("u-form-item"),W),d=h,q=I(r("u-radio"),w),z=I(r("u-radio-group"),U),E=I(r("JnpfUserSelect"),A),M=I(r("u-input"),N),P=I(r("u-button"),D),R=I(r("JnpfUploadFile"),O),H=I(r("JnpfSign"),$),G=I(r("u-form"),S),K=I(r("u-icon"),B),X=C,Y=k,Z=_,Q=I(r("u-popup"),J),ee=j;return m(),c(d,{class:"operate-v"},{default:p((()=>[f(d,{class:"jnpf-wrap"},{default:p((()=>[f(G,{model:o.dataForm,"label-position":"left","label-width":"150",ref:"dataForm"},{default:p((()=>[f(d,{class:"u-p-l-20 u-p-r-20 form-item-box"},{default:p((()=>["reject"===o.config.eventType&&o.isLastAppro?(m(),c(l,{key:0,label:"退回节点",class:u({"form-item":3==o.rejectType})},{default:p((()=>[f(n,{modelValue:o.dataForm.rejectStep,"onUpdate:modelValue":t[0]||(t[0]=e=>o.dataForm.rejectStep=e),options:o.config.rejectList.list,props:o.props,disabled:2!=o.config.rejectStep},null,8,["modelValue","options","props","disabled"])])),_:1},8,["class"])):g("",!0)])),_:1}),3==o.rejectType&&"reject"===o.config.eventType?(m(),c(d,{key:0,class:"reject"},{default:p((()=>[f(d,{class:""},{default:p((()=>[f(z,{modelValue:o.dataForm.rejectType,"onUpdate:modelValue":t[1]||(t[1]=e=>o.dataForm.rejectType=e)},{default:p((()=>[(m(!0),y(T,null,b(o.list,((e,t)=>(m(),c(q,{onChange:t=>s.radioChange(e),key:t,name:e.name,disabled:e.disabled},{default:p((()=>[L(v(e.fullName),1)])),_:2},1032,["onChange","name","disabled"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1})):g("",!0),f(d,{class:"u-p-l-20 u-p-r-20 form-item-box"},{default:p((()=>[o.isBranch?(m(),c(l,{key:0,label:"分支选择",prop:"branch",required:""},{default:p((()=>[f(n,{modelValue:o.dataForm.branchList,"onUpdate:modelValue":t[2]||(t[2]=e=>o.dataForm.branchList=e),onChange:s.branchChange,placeholder:"请选择审批分支",options:o.branchList,multiple:"",props:o.config.props},null,8,["modelValue","onChange","options","props"])])),_:1})):g("",!0),!o.config.hasFreeApprover&&"transfer"!==o.config.eventType||"revoke"===o.config.eventType||"recall"===o.config.eventType||"reject"===o.config.eventType?g("",!0):(m(),c(l,{key:1,label:o.seletUserLabel,prop:"freeApproverUserId",required:!("transfer"!==o.config.eventType&&!o.config.hasFreeApprover)},{default:p((()=>[f(E,{modelValue:o.dataForm.freeApproverUserId,"onUpdate:modelValue":t[3]||(t[3]=e=>o.dataForm.freeApproverUserId=e),onOpen:s.open},null,8,["modelValue","onOpen"])])),_:1},8,["label","required"])),o.config.hasFreeApprover?(m(),c(l,{key:2,label:"加签类型"},{default:p((()=>[f(n,{options:o.typeList,modelValue:o.dataForm.freeApproverType,"onUpdate:modelValue":t[4]||(t[4]=e=>o.dataForm.freeApproverType=e),onChange:s.freeApproverChange},null,8,["options","modelValue","onChange"])])),_:1})):g("",!0),"transfer"!==o.config.eventType&&"revoke"!==o.config.eventType&&"recall"!==o.config.eventType&&o.isCandidate?(m(!0),y(T,{key:3},b(o.candidateList,((e,t)=>(m(),c(l,{prop:"comInput",key:t,label:e.nodeName,required:""},{default:p((()=>[e.hasCandidates?(m(),c(M,{key:0,type:"select","select-open":e.selectShow,modelValue:o.candidateValue[e.nodeId],"onUpdate:modelValue":t=>o.candidateValue[e.nodeId]=t,onClick:t=>s.openSelect(e),placeholder:"请选择审批候选人","input-align":"right"},null,8,["select-open","modelValue","onUpdate:modelValue","onClick"])):(m(),c(E,{key:1,modelValue:o.candidateValue[e.nodeId],"onUpdate:modelValue":t=>o.candidateValue[e.nodeId]=t,multiple:"",onChange:t=>s.change(t,e.nodeId),onOpen:s.open},null,8,["modelValue","onUpdate:modelValue","onChange","onOpen"]))])),_:2},1032,["label"])))),128)):g("",!0),"submit"!==o.config.eventType&&o.config.hasOpinion?(m(),c(l,{key:4,label:o.opinionName,prop:"handleOpinion"},{default:p((()=>[f(d,{class:"words-contain"},{default:p((()=>[f(M,{style:{flex:"1"},modelValue:o.dataForm.handleOpinion,"onUpdate:modelValue":t[5]||(t[5]=e=>o.dataForm.handleOpinion=e),type:"textarea",placeholder:o.placeholder,"input-align":"right"},null,8,["modelValue","placeholder"]),"transfer"!=o.config.eventType&&"recall"!=o.config.eventType&&"revoke"!==o.config.eventType&&"approvalCancel"!==o.config.eventType?(m(),c(d,{key:0,class:"u-p-10"},{default:p((()=>[f(P,{size:"mini",onClick:s.commonWords},{default:p((()=>[L("常用语")])),_:1},8,["onClick"])])),_:1})):g("",!0)])),_:1})])),_:1},8,["label"])):g("",!0),"submit"!==o.config.eventType&&o.config.hasOpinion?(m(),c(l,{key:5,label:o.config.title+"附件",prop:"fileList"},{default:p((()=>[f(R,{modelValue:o.dataForm.fileList,"onUpdate:modelValue":t[6]||(t[6]=e=>o.dataForm.fileList=e),limit:3},null,8,["modelValue"])])),_:1},8,["label"])):g("",!0),o.config.isCustomCopy&&"transfer"!==o.config.eventType&&"revoke"!==o.config.eventType&&"recall"!==o.config.eventType?(m(),c(l,{key:6,label:"抄送人员",prop:"copyIds"},{default:p((()=>[f(E,{modelValue:o.dataForm.copyIds,"onUpdate:modelValue":t[7]||(t[7]=e=>o.dataForm.copyIds=e),multiple:"",onOpen:s.open},null,8,["modelValue","onOpen"])])),_:1})):g("",!0),o.isSign?(m(),c(l,{key:7,label:"签名",prop:"signImg",required:""},{default:p((()=>[f(H,{modelValue:o.dataForm.signImg,"onUpdate:modelValue":t[8]||(t[8]=e=>o.dataForm.signImg=e),isInvoke:!0},null,8,["modelValue"])])),_:1})):g("",!0)])),_:1})])),_:1},8,["model"])])),_:1}),o.isShow?(m(),c(d,{key:0},{default:p((()=>["submit"!==o.config.eventType?(m(),c(d,{key:0,class:"flowBefore-actions"},{default:p((()=>[f(P,{class:"buttom-btn",type:"primary",onClick:t[9]||(t[9]=e=>s.handleClick(o.config.eventType))},{default:p((()=>[L(v(o.btnTxt),1)])),_:1})])),_:1})):g("",!0)])),_:1})):g("",!0),o.isShow?(m(),c(d,{key:1},{default:p((()=>["submit"===o.config.eventType?(m(),c(d,{key:0,class:"flowBefore-actions"},{default:p((()=>[f(P,{class:"buttom-btn",onClick:t[10]||(t[10]=e=>s.handleClick("cancel"))},{default:p((()=>[L("取消")])),_:1}),f(P,{class:"buttom-btn",type:"primary",onClick:t[11]||(t[11]=e=>s.handleClick(o.config.eventType))},{default:p((()=>[L("确定 ")])),_:1})])),_:1})):g("",!0)])),_:1})):g("",!0),f(Q,{modelValue:o.show,"onUpdate:modelValue":t[12]||(t[12]=e=>o.show=e),mode:"bottom","border-radius":"14",height:"700rpx",closeable:"","mask-close-able":!1},{default:p((()=>[f(d,{class:"u-p-28 hd",style:{"text-align":"center"}},{default:p((()=>[L("常用审批语")])),_:1}),f(d,{class:"add"},{default:p((()=>[f(d,{class:"add-inner",onClick:s.editCommonWord},{default:p((()=>[f(K,{name:"plus-circle-fill",color:"#81d3f8",size:"28"}),f(X,{class:"u-m-l-8"},{default:p((()=>[L("添加常用语")])),_:1})])),_:1},8,["onClick"])])),_:1}),f(d,{class:"content"},{default:p((()=>[f(Z,{"scroll-y":"true",style:{height:"480rpx"}},{default:p((()=>[f(d,{class:"commonList u-flex-col"},{default:p((()=>[o.commonWordsList.length>0?(m(!0),y(T,{key:0},b(o.commonWordsList,((e,t)=>(m(),c(d,{class:"u-flex item",key:t},{default:p((()=>[f(d,{class:"txt",onClick:t=>s.selectCommonWord(e)},{default:p((()=>[L(v(e.commonWordsText),1)])),_:2},1032,["onClick"]),1==e.commonWordsType?(m(),c(d,{key:0,class:"icon",onClick:F((t=>s.editCommonWord(e)),["stop"])},{default:p((()=>[V("i",{class:"icon-ym icon-ym-btn-edit",style:{color:"#81d3f8","font-size":"36rpx"}})])),_:2},1032,["onClick"])):g("",!0),1==e.commonWordsType?(m(),c(d,{key:1,class:"icon",onClick:F((t=>s.delCommonWord(e)),["stop"])},{default:p((()=>[V("i",{class:"icon-ym icon-ym-extend-trash",style:{color:"#e35d4b","font-size":"36rpx"}})])),_:2},1032,["onClick"])):g("",!0)])),_:2},1024)))),128)):g("",!0),o.commonWordsList.length<=0?(m(),c(d,{key:1,class:""},{default:p((()=>[f(d,{class:"notData-box u-flex-col"},{default:p((()=>[f(d,{class:"u-flex-col notData-inner"},{default:p((()=>[f(Y,{src:o.icon,mode:"",class:"iconImg"},null,8,["src"]),f(X,{class:"notData-inner-text"},{default:p((()=>[L("暂无数据")])),_:1})])),_:1})])),_:1})])),_:1})):g("",!0)])),_:1})])),_:1})])),_:1})])),_:1},8,["modelValue"]),(m(),c(Q,{modelValue:o.show2,"onUpdate:modelValue":t[14]||(t[14]=e=>o.show2=e),mode:"center",width:"500rpx","border-radius":"24",key:o.key},{default:p((()=>[f(d,{class:"u-flex-col innerPopup-box"},{default:p((()=>[f(d,{class:"innerPopup-hd"},{default:p((()=>[L(" 审批常用语 ")])),_:1}),f(d,{class:"innerPopup-content"},{default:p((()=>[f(M,{modelValue:o.commonWordsText,"onUpdate:modelValue":t[13]||(t[13]=e=>o.commonWordsText=e),type:"textarea",placeholder:"请输入内容","auto-height":!1,maxlength:"99999",height:"150","input-align":"right"},null,8,["modelValue"])])),_:1}),f(d,{class:"u-flex btn-box"},{default:p((()=>[f(ee,{class:"btn",onClick:s.cancel},{default:p((()=>[L("取消")])),_:1},8,["onClick"]),f(ee,{class:"btn btn2",onClick:s.confirm},{default:p((()=>[L("确定")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1},8,["modelValue"]))])),_:1})}],["__scopeId","data-v-1db7c0b3"]]);export{P as default};