You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
8.1KB

  1. import{I as me,G as _e,E as X,x as ve,y as he,r as u,o as ye,b as c,c as _,d as h,f as d,h as n,e as y,F as Y,H as M,M as we,j as C,L as Ce,n as Ie,i as V,u as m,t as De,k as ke,aG as Se,U as G,C as xe,ae as Te,af as K,aH as Ve,aF as Pe,s as $e}from"./index-dd5fae99.js";import{S as je,p as z}from"./seal-1f46529d.js";import{h as be,i as Oe,f as Be,b as J,c as qe,e as Re}from"./uploadAction-3962500e.js";const Ue={class:"footerPage"},Le={id:"signContainer",class:"sign_content h-full"},Ee=["id","onDrop"],Ae=["id"],Fe={key:0},Ne=["id","onDragstart","onDragend"],He=["src"],Xe=["onClick"];const Ye={class:"footer"},Me={class:"el-upload__tip"},Ge={class:"flex justify-center"},Ke=ke({name:"stamp"}),et=Object.assign(Ke,{setup(ze){const W=me(()=>import("./pdf.worker.entry-849d37c7.js").then(t=>t.p),[]),I=_e(X.userStore).userInfo,{proxy:w}=$e(),r=ve(),D=he(),Q=X.dictStore.uploadUrl,Je=u([{src:je}]),O=u(0),P=u({loadType:"url",title:r.query.filename,docValue:""}),k=u(!1),R=u(!1),U=u(),L=async()=>{var l,o;const t=await Se({projectId:r.query.projectId,auditOpinion:((l=g.value)==null?void 0:l.comment)||void 0});R.value=((o=t.data)==null?void 0:o.isCommit)||!1;const e=await G({fileId:t.data.fileId});U.value=t.data.fileId;const a=URL.createObjectURL(e);P.value.docValue=a,E(P.value)},E=t=>{z.GlobalWorkerOptions.workerSrc=W;const e=t.loadType,a=t.docValue;let l=null;if(e==="byBase64"){var o=a,f=Z(o);l=f}else l=a;var j=z.getDocument(l);j.promise.then(function(p){O.value=p.numPages,xe(()=>{A(p,1)})},function(p){console.error(p)})},A=(t,e)=>{t&&t.getPage(e).then(function(a){const o=a.getViewport({scale:2}),f=document.getElementById("pageCanvas_"+e),j=f.getContext("2d");f.width=2380,f.height=3368,f.style.width="1190px";var p=document.getElementById("pageView_"+e);p.style.height=o.height/2+"px",p.style.width=o.width/2+"px",a.render({canvasContext:j,viewport:o}),e<O.value&&A(t,e+1)})},Z=t=>{t=t.replace(/[\r\n]/g,"");var e=window.atob(t),a=e.length,l=new Uint8Array(new ArrayBuffer(a));for(let o=0;o<a;o++)l[o]=e.charCodeAt(o);return l},F=t=>{S.value.splice(t,1)},S=u([]),ee=(t,e,a)=>{var l;if(console.log("start"),k.value||(l=S.value)!=null&&l.length&&a)w.$message.warning("请勿重复盖章!");else{const f=Object.assign({posX:0,posY:0},e);t.dataTransfer.setData("Text",JSON.stringify(f)),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(t.target,62,62)}},te=(t,e)=>{console.log("end"),e>=0&&F(e)},ae=t=>{console.log("enter")},oe=t=>{t.preventDefault(),t.stopPropagation(),console.log("over")},se=t=>{console.log("leave")},le=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),console.log("drop"),t.dataTransfer.getData("Text")){const a=JSON.parse(t.dataTransfer.getData("Text"));a.posX=t.offsetX,a.posY=842-t.offsetY,a.posPage=e,a.width=a.width||124,a.height=a.height||124,a.id="seal_"+Date.parse(new Date),a.left=t.offsetX-a.width/2,a.top=t.offsetY-a.height/2,a.fileUrl="222",S.value.push(a),console.log(a,"印章签署相关信息")}},N=u(),g=u({attachments:[]}),ne={comment:[{required:!0,message:"请输入意见",trigger:"blur"}]};u(!1);const re=u(!1),ie=async t=>{t&&await t.validate(async e=>{if(e){const a={instanceId:r.query.instanceId,projectId:r.query.projectId,taskId:r.query.taskId,action:"PASS",auditInfo:{text:g.value.comment,attachments:g.value.attachments.map(o=>({fileId:o.response.data.id,fileName:o.response.data.originalFileName}))}};(await Te(a)).data==="TASKID_ERROR"?(w.$message.warning("当前审批任务有变动,请返回待我处理列表!"),D.push({name:"waitMeToHandle"})):(L(),w.$message.success("提交成功!"),re.value=!1)}})},B=u(!1),de=async()=>{B.value=!0;let t={posPage:6,posX:487,posY:540};if(r.query.instName==="项目预审审批流程"&&(I.value.empPosUnitCode===q.value?t={posPage:6,posX:487,posY:540}:I.value.empPosUnitCode===$.value&&(t={posPage:6,posX:487,posY:380})),console.log(I.value.empPosUnitCode),console.log($.value),console.log(I.value.empPosUnitCode===$.value),console.log(t),r.query.instName==="项目预审审批流程"&&I.value.empPosUnitCode!==q.value&&!v.value.isHigherSuperOrg)(await K({instanceId:r.query.instanceId,projectId:r.query.projectId,projectCode:r.query.projectCode,taskId:r.query.taskId,action:"PASS"})).data==="TASKID_ERROR"?(w.$message.warning("当前审批任务有变动,请返回待我处理列表!"),D.push({name:"waitMeToHandle"})):(w.$message.success("签署成功!"),D.go(-1));else{const e=await Ve({...t,notSealedFileId:U.value,projectId:r.query.projectId*1,signType:1}),a=await G({fileId:e.data}),l=URL.createObjectURL(a);P.value.docValue=l,E(P.value),B.value=!1,k.value=!0,(await K({instanceId:r.query.instanceId,projectId:r.query.projectId,projectCode:r.query.projectCode,taskId:r.query.taskId,action:"PASS"})).data==="TASKID_ERROR"&&(w.$message.warning("当前审批任务有变动,请返回待我处理列表!"),D.push({name:"waitMeToHandle"}))}},v=u({}),q=u(),$=u(),ue=async()=>{const t=await Pe(r.query.projectId);v.value=t.data,q.value=v.value.isSuperOrg?v.value.superOrgCode:v.value.buildOrgCode,$.value=v.value.isHigherSuperOrg?v.value.higherSuperOrgCode:""};return ye(()=>{L(),ue()}),(t,e)=>{const a=c("CircleClose"),l=c("el-icon"),o=c("el-col"),f=c("el-popover"),j=c("el-card"),p=c("el-row"),ce=c("el-input"),H=c("el-form-item"),x=c("el-button"),pe=c("el-upload"),ge=c("el-form"),fe=c("el-dialog");return _(),h("div",Ue,[d(p,{gutter:8,class:Ie(`h-full overflow-hidden ${k.value,""}`)},{default:n(()=>[d(o,{span:24,class:"h-full"},{default:n(()=>[y("div",Le,[(_(!0),h(Y,null,M(O.value,s=>(_(),h("div",{id:`pageView_${s}`,key:s,class:"pageView",onDragenter:e[0]||(e[0]=i=>ae(i)),onDragover:e[1]||(e[1]=i=>oe(i)),onDragleave:e[2]||(e[2]=i=>se(i)),onDrop:i=>le(i,s)},[y("canvas",{id:`pageCanvas_${s}`,class:"pageCanvas"},null,8,Ae),k.value?C("",!0):(_(),h("div",Fe,[S.value.length>0?(_(!0),h(Y,{key:0},M(S.value,(i,T)=>(_(),h("div",{key:T},[i.posPage===s?(_(),h("div",{key:0,id:`drag${i.id}`,class:"sealView",draggable:"true",style:we(`
  2. width: ${i.width}px;
  3. height: ${i.height}px;
  4. left: ${i.left}px;
  5. top: ${i.top}px;`),onDragstart:b=>ee(b,i,0),onDragend:b=>te(b,T)},[y("img",{src:i.src,style:{width:"100%",height:"100%"}},null,8,He),y("p",{class:"sealDel",onClick:b=>F(T)},[d(l,null,{default:n(()=>[d(a)]),_:1})],8,Xe)],44,Ne)):C("",!0)]))),128)):C("",!0)]))],40,Ee))),128))])]),_:1}),C("",!0)]),_:1},8,["class"]),C("",!0),y("div",Ye,[k.value?C("",!0):(_(),Ce(x,{key:0,type:"primary",loading:B.value,onClick:de},{default:n(()=>e[17]||(e[17]=[V(" 确认盖章 ")])),_:1},8,["loading"])),d(x,{onClick:e[8]||(e[8]=s=>m(D).go(-1))},{default:n(()=>e[18]||(e[18]=[V("返回")])),_:1})]),d(fe,{"model-value":!R.value,title:"填写审核意见",width:"600px","destroy-on-close":"","show-close":!1,"close-on-click-modal":!1,"close-on-press-escape":!1},{footer:n(()=>[y("div",Ge,[d(x,{class:"ml-22",type:"primary",onClick:e[11]||(e[11]=s=>ie(N.value))},{default:n(()=>e[20]||(e[20]=[V(" 提交 ")])),_:1}),d(x,{onClick:e[12]||(e[12]=s=>t.$router.go(-1))},{default:n(()=>e[21]||(e[21]=[V(" 返回 ")])),_:1})])]),default:n(()=>[d(ge,{ref_key:"formRef",ref:N,model:g.value,rules:ne,"label-width":"auto","label-suffix":":"},{default:n(()=>[d(p,null,{default:n(()=>[d(o,{span:24},{default:n(()=>[d(H,{label:"审核意见",prop:"comment"},{default:n(()=>[d(ce,{modelValue:g.value.comment,"onUpdate:modelValue":e[9]||(e[9]=s=>g.value.comment=s),maxlength:"200",placeholder:"请输入","show-word-limit":"",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1}),d(o,{span:24},{default:n(()=>[d(H,{label:"附件",prop:"files"},{default:n(()=>[d(pe,{"file-list":g.value.attachments,"onUpdate:fileList":e[10]||(e[10]=s=>g.value.attachments=s),class:"w-full",action:m(Q),"on-success":s=>m(be)(s,g.value.attachments),"on-error":m(Oe),"before-upload":s=>m(Be)(s,{types:m(J)}),accept:m(J).map(s=>`.${s}`).join(","),multiple:"",limit:10,"on-preview":m(qe)},{tip:n(()=>[y("div",Me,"支持"+De(m(Re))+"文件",1)]),default:n(()=>[d(x,{type:"primary",class:"mr-4"},{default:n(()=>e[19]||(e[19]=[V("上传附件")])),_:1})]),_:1},8,["file-list","action","on-success","on-error","before-upload","accept","on-preview"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])])}}});export{et as default};