WXL
20 小时以前 05c363fdd7ab04e3bd9a753e2c5d5bfff04d681c
1
"use strict";const e=require("../../common/vendor.js"),o=require("../../stores/user.js"),n=require("../../stores/useHomeButton.js");if(!Array){(e.resolveComponent("up-icon")+e.resolveComponent("u-radio")+e.resolveComponent("u-radio-group")+e.resolveComponent("u--textarea")+e.resolveComponent("u-icon")+e.resolveComponent("u-popup")+e.resolveComponent("uni-icons")+e.resolveComponent("u-modal"))()}Math||((()=>"../../uni_modules/uview-plus/components/u-icon/u-icon.js")+(()=>"../../uni_modules/uview-plus/components/u-radio/u-radio.js")+(()=>"../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js")+(()=>"../../uni_modules/uview-plus/components/u--textarea/u--textarea.js")+(()=>"../../uni_modules/uview-plus/components/u-icon/u-icon.js")+(()=>"../../uni_modules/uview-plus/components/u-popup/u-popup.js")+(()=>"../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js")+(()=>"../../uni_modules/uview-plus/components/u-modal/u-modal.js"))();const t={__name:"ethicalInfo",setup(t){const{showHomeButton:i,checkAutoLogin:a,goHome:l}=n.useHomeButton(),s=o.useUserStore();e.ref({});const r=e.ref({hospitalNo:"",donorName:"",gender:"",age:"",diagnosis:"",receiveStatus:"0",endtime:""}),u=e.ref(null),c=e.ref(null),p=e.ref([]),d=e.ref({expertconclusion:"",expertopinion:""}),m=e.ref({name:"",title:""}),v=e.ref(!1),g=e.ref("确认提交"),x=e.ref("确定要提交审查意见吗?提交后将无法修改。"),f=e.computed(()=>(new Date).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})),h=e.ref([{label:"同意",value:"1"},{label:"驳回",value:"2"}]),w=e.ref(!1),T=e.reactive({signatureUrl:"",signatureTime:"",fileName:"",serverData:null});let y=null,S=!1,N=0,z=0,L=[];const b=e.ref(""),C=e.computed(()=>L.length>0),j=e.computed(()=>""!==b.value),U=e.reactive({uploadUrl:"/api/common/upload",extraParams:{caseNo:"",expertId:"",expertName:"",type:"ethics_review_signature",bizType:"expert_review"}}),k=e.ref(!0),_=e.ref(!0),P=e.ref("提交审查"),D=e=>({0:"pending",1:"pending",2:"pending",3:"submitted",4:"submitted",5:"success",6:"error"}[e]||"pending"),$=e.computed(()=>"3"==r.value.receiveStatus),Y=e.computed(()=>$.value);e.computed(()=>!Y.value&&(""!==d.value.expertconclusion&&d.value.expertopinion.trim().length>0&&""!==T.signatureUrl&&T.signatureUrl.startsWith("http"))),e.onLoad(async e=>{a(e),u.value=e.id,c.value=e.fcid,c.value&&await F(c.value)}),e.onShow(()=>{const o=e.index.getStorageSync("userInfo");o&&(m.value.name=o.nickName||o.userName||"")});const F=async o=>{try{e.index.showLoading({title:"加载中..."});const n={fcid:o,pageNum:1,pageSize:1},t=await e.index.$uapi.get("/project/ethicalreviewopinions/listnew",n);if(200==t.code&&t.rows&&t.rows.length>0){const o=t.rows[0];if(console.log("加载的审查数据:",o),r.value={...r.value,inpatientno:o.inpatientno,name:o.name,sex:o.sex,age:o.age,ageunit:o.ageunit,expertType:o.expertType,diagnosisname:o.diagnosisname,receiveStatus:o.receiveStatus||"0",endtime:o.endtime||"",caseNo:o.caseNo||""},console.log(o.receiveStatus,"data.receiveStatus"),console.log(r.value.receiveStatus,"caseInfo.value"),o.expertconclusion&&(d.value.expertconclusion=o.expertconclusion.toString()),o.expertopinion&&(d.value.expertopinion=o.expertopinion),o.expertname)m.value.name=o.expertname;else{const o=e.index.getStorageSync("userInfo");o&&(m.value.name=o.nickName||o.userName||"")}o.sigin&&(o.sigin.startsWith("http")?T.signatureUrl=o.sigin:T.signatureUrl=`/api${o.sigin.startsWith("/")?"":"/"}${o.sigin}`,T.signatureTime=o.conclusiontime||""),o.filePatch&&H(o.filePatch),I(o),W(o.receiveStatus),U.extraParams.caseNo=o.caseNo||"",U.extraParams.expertName=m.value.name}else e.index.showToast({title:t.msg||"未找到审查数据",icon:"none"})}catch(n){if("未登录"==n.message)return;e.index.showToast({title:"加载失败",icon:"none"})}finally{e.index.hideLoading()}},I=e=>{e.receiveStatus},H=e=>{if(e)try{let o=[];if(e.startsWith("[")&&e.endsWith("]")){const n=e.replace(/\\"/g,'"');o=JSON.parse(n)}else if(e.includes("fileName"))o=JSON.parse(e);else{o=e.split(";").filter(e=>e.trim()).map(e=>({fileName:e.split("/").pop()||"附件",path:e,fileUrl:e}))}p.value=o.map((e,o)=>{const n=e.fileName||`附件${o+1}`,t=e.fileUrl||e.path||e.url||"",i=n.split(".").pop().toLowerCase();let a="file-text",l="#909399";return["jpg","jpeg","png","gif","bmp","webp"].includes(i)?(a="photo",l="#fa8c16"):["doc","docx"].includes(i)?(a="file-text",l="#1890ff"):["xls","xlsx","csv"].includes(i)?(a="file-text",l="#52c41a"):["pdf"].includes(i)?(a="file-text",l="#f56c6c"):["txt","text"].includes(i)?(a="file-text",l="#909399"):["zip","rar","7z"].includes(i)&&(a="folder",l="#722ed1"),{id:e.infoid||o+1,name:n,icon:a,color:l,size:"--",url:t,type:i,createTime:e.createTime||""}})}catch(o){console.error("解析附件失败:",o,e);const n=e.split(";").filter(e=>e.trim());p.value=n.map((e,o)=>{const n=e.split("/").pop()||`附件${o+1}`,t=n.split(".").pop().toLowerCase();let i="file-text",a="#909399";return["jpg","jpeg","png","gif","bmp"].includes(t)?(i="photo",a="#fa8c16"):["doc","docx"].includes(t)?(i="file-text",a="#1890ff"):["xls","xlsx"].includes(t)?(i="file-text",a="#52c41a"):["pdf"].includes(t)&&(i="file-text",a="#f56c6c"),{id:o+1,name:n,icon:i,color:a,size:"--",url:e}})}},W=e=>{switch(e){case"3":case"4":case"5":case"6":k.value=!1,_.value=!1;break;default:k.value=!0,_.value=!0,P.value="提交审查"}},B=()=>{Y.value?e.index.showToast({title:"当前任务已超时,不可操作",icon:"none"}):(w.value=!0,e.nextTick$1(()=>{J()}))},M=()=>{w.value=!1,O()},J=()=>{y=e.index.createCanvasContext("signatureCanvas"),O()},O=()=>{y&&(y.clearRect(0,0,650,300),y.setStrokeStyle("#000000"),y.setLineWidth(3),y.setLineCap("round"),y.setLineJoin("round"),y.draw(),L=[],b.value="")},q=()=>{0!=L.length&&(L.pop(),y.clearRect(0,0,650,300),y.setStrokeStyle("#000000"),y.setLineWidth(3),y.setLineCap("round"),y.setLineJoin("round"),L.forEach(e=>{y.beginPath(),y.moveTo(e.startX,e.startY),y.lineTo(e.endX,e.endY),y.stroke()}),y.draw(),0==L.length?b.value="":R())},X=e=>{if(Y.value)return;S=!0;const o=e.touches[0];N=o.x,z=o.y,y.beginPath(),y.moveTo(N,z)},A=e=>{if(!S||Y.value)return;const o=e.touches[0],n=o.x,t=o.y;y.lineTo(n,t),y.stroke(),y.draw(!0),L.push({startX:N,startY:z,endX:n,endY:t}),N=n,z=t},E=()=>{S&&(S=!1,y.closePath(),R())},R=()=>{e.index.canvasToTempFilePath({canvasId:"signatureCanvas",success:e=>{b.value=e.tempFilePath},fail:e=>{console.error("获取画布图片失败:",e)}})},V=async()=>{if(b.value)try{e.index.showLoading({title:"保存签名中..."});const o=await G(b.value);o?(T.signatureUrl=o.url,T.signatureTime=(new Date).toLocaleString("zh-CN"),T.fileName=o.originalFilename||`signature_${Date.now()}.png`,T.serverData=o,K(o),e.index.hideLoading(),e.index.showToast({title:"签名保存成功",icon:"success"}),w.value=!1,O()):(e.index.hideLoading(),e.index.showToast({title:"签名上传失败",icon:"none"}))}catch(o){console.error("签名上传失败:",o),e.index.hideLoading(),e.index.showToast({title:"签名上传失败",icon:"none"})}else e.index.showToast({title:"请先签名",icon:"none"})},G=o=>new Promise((n,t)=>{const i=e.index.getStorageSync("token"),a=e.index.getStorageSync("userInfo"),l=(null==a?void 0:a.nickName)||(null==a?void 0:a.userName)||m.value.name;e.index.uploadFile({url:"/api/common/upload",filePath:o,name:"file",header:{Authorization:`Bearer ${i}`},formData:{bizType:"expert_review_signature",caseNo:r.value.caseNo||"",expertName:l,uploadType:"signature"},success:e=>{if(200==e.statusCode){const o=JSON.parse(e.data);console.log("签名上传成功:",o),200==o.code?n({url:o.url,fileName:o.fileName,newFileName:o.newFileName,originalFilename:o.originalFilename,filePath:o.filePath||o.fileName,size:o.size}):t(new Error(o.msg||"上传失败"))}else t(new Error(`上传失败,状态码: ${e.statusCode}`))},fail:e=>{t(e)}})}),K=o=>{try{const n={signatureUrl:T.signatureUrl,signatureTime:T.signatureTime,fileName:T.fileName,uploadData:o,caseNo:r.value.caseNo,timestamp:Date.now()};e.index.setStorageSync("expert_review_signature",n)}catch(n){console.error("保存签名到本地失败:",n)}},Q=()=>{Y.value?e.index.showToast({title:"当前任务已超时,不可操作",icon:"none"}):e.index.showModal({title:"提示",content:"确定要删除签名吗?",success:o=>{o.confirm&&(T.signatureUrl="",T.signatureTime="",T.fileName="",T.serverData=null,e.index.removeStorageSync("expert_review_signature"))}})},Z=()=>{if(T.signatureUrl){let o=T.signatureUrl;o.startsWith("http")||(o=`${(null==s?void 0:s.baseUrlHt)||""}${o}`),e.index.previewImage({urls:[o]})}},ee=e=>{console.log("选中结论:",e)},oe=async()=>{if(Y.value)e.index.showToast({title:"当前任务已超时,不可操作",icon:"none"});else if(ie(!0))try{e.index.showLoading({title:"保存中..."});const o={fcid:c.value,expertconclusion:d.value.expertconclusion,expertopinion:d.value.expertopinion,sigin:T.signatureUrl,receiveStatus:"2",conclusiontime:e.dayjs().format("YYYY-MM-DD HH:mm:ss")},n=await e.index.$uapi.post("/project/ethicalreviewopinions/edit",o);200==n.code?(e.index.showToast({title:"保存成功",icon:"success"}),r.value.receiveStatus="2",W("2")):e.index.showToast({title:n.msg||"保存失败",icon:"none"})}catch(o){console.error("保存草稿失败:",o),e.index.showToast({title:"保存失败",icon:"none"})}finally{e.index.hideLoading()}},ne=()=>{console.log(1),Y.value?e.index.showToast({title:"当前任务已超时,不可操作",icon:"none"}):(console.log(2),ie()&&(g.value="确认提交",x.value="确定要提交审查意见吗?提交后将无法修改。",v.value=!0))},te=async()=>{try{e.index.showLoading({title:"提交中..."}),console.log(r.value,"form.value");const o={id:c.value,expertconclusion:d.value.expertconclusion,expertopinion:d.value.expertopinion,sigin:T.signatureUrl,expertType:r.value.expertType,receiveStatus:"1"==d.value.expertconclusion?"5":"6",conclusiontime:e.dayjs().format("YYYY-MM-DD HH:mm:ss")},n=await e.index.$uapi.post("/project/ethicalreviewopinions/edit",o);200==n.code?(e.index.showToast({title:"提交成功",icon:"success",duration:2e3}),r.value.receiveStatus=o.receiveStatus,W(o.receiveStatus),v.value=!1,setTimeout(()=>{e.index.navigateBack()},1500)):e.index.showToast({title:n.msg||"提交失败",icon:"none"})}catch(o){console.error("提交失败:",o),e.index.showToast({title:"提交失败",icon:"none"})}finally{e.index.hideLoading()}},ie=(o=!1)=>d.value.expertconclusion||o?(console.log(3),d.value.expertopinion.trim()||o?(console.log(T,"signatureData"),!(!T.signatureUrl&&!o)||(e.index.showToast({title:"请进行手写签名",icon:"none"}),!1)):(e.index.showToast({title:"请输入审查意见",icon:"none"}),!1)):(e.index.showToast({title:"请选择审查结论",icon:"none"}),!1);return(o,n)=>{return e.e({a:e.t((t=r.value.receiveStatus,{0:"待接收",1:"未接收",2:"已接收",3:"超时",4:"中止",5:"完成",6:"驳回"}[t]||"未知状态")),b:e.n(D(r.value.receiveStatus)),c:e.p({name:"file-text",size:"14",color:"#909399"}),d:e.t(r.value.inpatientno||"--"),e:e.p({name:"account",size:"14",color:"#909399"}),f:e.t(r.value.name||"--"),g:e.p({name:"man",size:"14",color:"#909399"}),h:e.t(r.value.sex||"--"),i:e.t(r.value.age||"--"),j:e.t(r.value.ageunit||"岁"),k:e.p({name:"heart",size:"14",color:"#909399"}),l:e.t(r.value.diagnosisname||"--"),m:e.t(p.value.length),n:e.f(p.value,(o,n,t)=>e.e({a:"36d8dc6e-4-"+t,b:e.p({name:o.icon,color:o.color,size:"18"}),c:e.t(o.name),d:o.type},o.type?{e:e.t(o.type||"文件")}:{},{f:e.t(o.size),g:"36d8dc6e-5-"+t,h:o.id,i:e.o(n=>(o=>{if(o.url){e.index.showLoading({title:"加载中..."});const n=o.type||o.url.split(".").pop().toLowerCase();["jpg","jpeg","png","gif","bmp","webp"].includes(n)?e.index.previewImage({urls:[o.url],current:0,success:()=>{console.log("图片预览成功")},fail:o=>{console.error("图片预览失败:",o),e.index.showToast({title:"图片加载失败",icon:"none"})},complete:()=>{e.index.hideLoading()}}):["pdf","doc","docx","xls","xlsx","ppt","pptx","txt"].includes(n)?e.index.downloadFile({url:o.url,success:o=>{if(200==o.statusCode){const t=o.tempFilePath;e.index.openDocument({filePath:t,showMenu:!0,fileType:"pdf"==n?"pdf":"",success:()=>{console.log("打开文档成功")},fail:o=>{console.error("打开文档失败:",o),e.index.showToast({title:"无法打开该文件",icon:"none"})}})}},fail:o=>{console.error("下载文件失败:",o),e.index.showToast({title:"文件下载失败",icon:"none"})},complete:()=>{e.index.hideLoading()}}):(e.index.showToast({title:`暂不支持预览${n}格式文件`,icon:"none"}),e.index.hideLoading())}else e.index.showToast({title:`预览: ${o.name}`,icon:"none"})})(o),o.id)})),o:e.p({name:"arrow-right",size:"14",color:"#c0c4cc"}),p:$.value},$.value?{q:e.p({name:"clock",size:"16"})}:{},{r:e.f(h.value,(o,n,t)=>({a:o.value,b:"36d8dc6e-8-"+t+",36d8dc6e-7",c:e.p({name:o.value,label:o.label,customStyle:{marginBottom:"16rpx"}})})),s:e.o(ee),t:e.o(e=>d.value.expertconclusion=e),v:e.p({placement:"column",activeColor:"#007aff",disabled:Y.value,modelValue:d.value.expertconclusion}),w:e.o(e=>d.value.expertopinion=e),x:e.p({placeholder:"请输入详细的审查意见和改进建议...",maxlength:"1000",count:!0,height:120,border:"surround",disabled:Y.value,modelValue:d.value.expertopinion}),y:e.p({name:"edit-pen",size:"16",color:"#007aff"}),z:e.t(m.value.name),A:e.p({name:"clock",size:"16",color:"#007aff"}),B:e.t(f.value),C:$.value},$.value?{D:e.p({name:"clock",size:"16"})}:{},{E:T.signatureUrl},T.signatureUrl?e.e({F:T.signatureUrl,G:e.o(Z),H:e.t(m.value.name),I:e.t(T.signatureTime),J:!Y.value},Y.value?{}:{K:e.p({name:"photo",size:"16"}),L:e.o(Q)}):e.e({M:!Y.value},Y.value?{}:{N:e.p({name:"edit-pen",size:"48",color:"#c0c4cc"}),O:e.o(B)}),{P:e.p(o.N),Q:e.o((...e)=>o.O&&o.O(...e)),R:!Y.value},Y.value?{}:e.e({S:k.value},k.value?{T:e.p({name:"file-text",size:"16",color:"#606266"}),U:e.o(oe)}:{},{V:_.value},_.value?{W:e.p({name:"checkmark",size:"16",color:"#fff"}),X:e.t(P.value),Y:e.o(ne)}:{}),{Z:Y.value},Y.value?{aa:e.p({name:"info-circle",size:"20",color:"#fa8c16"})}:{},{ab:"650px",ac:"300px",ad:e.o(X),ae:e.o(A),af:e.o(E),ag:e.p({name:"trash",size:"20"}),ah:e.o(O),ai:e.p({name:"play-left",size:"20"}),aj:e.o(q),ak:!C.value,al:e.p({name:"checkmark",size:"20"}),am:e.o(V),an:!j.value,ao:b.value},b.value?{ap:b.value}:{},{aq:e.o(M),ar:e.p({show:w.value,mode:"bottom",round:20,closeable:!0,closeIcon:"close"}),as:e.unref(i)},e.unref(i)?{at:e.p({type:"home",size:"24",color:"#fff"}),av:e.o((...o)=>e.unref(l)&&e.unref(l)(...o))}:{},{aw:e.o(te),ax:e.o(e=>v.value=!1),ay:e.p({show:v.value,title:g.value,content:x.value,showCancelButton:!0}),az:e.gei(o,"")});var t}}};wx.createPage(t);