cnhis-design-vue 3.1.41-beta.44 → 3.1.41-beta.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),null==d||d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -1 +1 @@
1
- import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as d}from"lodash-es";import{format as p}from"date-fns";function h(h,g,v,m,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:S,repeatTip:j}=k,{xAxis:C,grid:E,originX:P,originY:Y,xCellWidth:G,endY:L,startTime:M,leftAddAreaWidth:A,leftScales:X,rightScales:I,yCellHeight:H,endX:D,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:R,event:$,originYCervix:B,other:F}=g,q=d(O),z=new Set;function N(){q.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:S,type:j="circle",childbirthStyle:C={}}=t,E=t.data[d+1],P=U(E,t);if(s&&P&&!f.breakpoint)y=n([...s,...P],{...w});else if(s&&!P&&!f.breakpoint){const e=U(E,t);y=e?n([...s,...e],{...w}):null}let Y,L;if(f.childbirth){const t=s[1]+H;Y=o([s[0],s[1],t],C),c.push(Y),L=i([s[0]+G/2,t-H/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...C}),c.push(L)}const M=u[d-1],A={origin:{data:f,title:x,key:S||"",dataIndex:e,index:d},leftLine:M,rightLine:y,arrowGroup:Y,arrowGroupText:L,...k,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};M?p=l(j,{left:M.get("x2"),top:M.get("y2"),...A}):s&&(A.leftLine=null,p=l(j,{left:s[0],top:s[1],...A}));u.push(y),p&&(!function(t){$.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{m.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{K(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+G/2,top:t.top+H/2})}(t),$.hovered&&Q(t)})),t.on("mouseup",(e=>{if(m.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),v("change",n),J(n,"change")}}))}(p),a.push(p),z.add(p))}(U(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function J(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=q.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;z.size&&(null==(s=h.value)||s.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...z]))),z.clear(),N()}function K(t){const e=t.prevPoint?t.prevPoint.left:P,n=t.nextPoint?t.nextPoint.left:D;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<B&&t.set("top",B),t.top<Y&&t.set("top",Y),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;m.point={x:t.left,y:t.top},m.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],m.show=!0}function U(t,e){if(f(t)&&function(t){const e=M+864e5,n=new Date(t).getTime();return n>=M&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<Y?Y:o>L?L:o]}}function Z(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-A-R-1,height:L-1,left:A,top:0,fill:"transparent"});h.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?A:D;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:d,key:p,scaleNumberStyle:g={}}=t,v=[],m=n+c/2,y=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);y.forEach(((t,e)=>{const n=0===e?L-8:e!==y.length-1||Y||B&&"FHR"!==p?L-e*H:Y+8;v.push(i([m,n],{value:String(t),...r,...g}))}));const k=new u.Rect({...a,width:c,height:L,left:m,top:L/2}),w=i([m,Y>0?Y-H/2:H/2],{value:String(f),...r,...d}),x=new u.Group([...v,k,...w?[w]:[]],{objectCaching:!1,...s});h.value.add(x),x.sendToBack(),n+=c}))}t(X),t(I,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=C.time,{show:a,range:c=[0,23],style:f}=C.processTime;if(t||a){const d=[],p=[],g=[],v=[],m=P+G/2;for(let s=0;s<E.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(d.at(-1),n);d.push(t);const a="top"==o?Y-15:L+15;g.push(i([m+s*G,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:p.at(-1)+1;p.push(t);const e="top"==o?L+15:Y-15;v.push(i([m+s*G,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...v],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){var t;const e=Object.values(F),o=[],i={},r=q.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-i-e)/t,L-i],u=[D-P,t*(D-P)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=P&&n<=D&&o>=i&&o<=L}function h([t,e]){return[P+t,L-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=q.find((t=>t.key===e));if(r){const r=x(e,i,0);o.push(n([P,r,D,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:p(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[w(l.time)-P,L-x(e,a,l.value)],[h,g]=[w(c.time)-P,L-x(e,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=s(v,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:v,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(w(p(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),h.value.add(...o)}(),N(),function(){function t(t,e){const n=q.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=P&&n<=D&&o>=Y&&o<=L&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],q.filter((t=>t.show)).forEach((i=>{if(!S(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<B)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,j(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-R/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=P&&e<=D&&n>=Y&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(K(t),Q(t)):m.show=!1})),t.on("mouseup:before",(n=>{if(m.show=!1,0===n.e.button&&e(t))if(S(t.left,"key",G).includes(t.origin.key))j();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};v("add",e),J(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(L-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(X,A/2),e(I,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(v("remove",n),J(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),v("add",n),J(n))}}}export{h as useBirthProcess};
1
+ import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as d}from"lodash-es";import{format as p}from"date-fns";function h(h,g,v,m,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:S,repeatTip:j}=k,{xAxis:C,grid:E,originX:P,originY:Y,xCellWidth:G,endY:L,startTime:M,leftAddAreaWidth:A,leftScales:X,rightScales:H,yCellHeight:I,endX:D,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:R,event:$,originYCervix:B,other:F,canvasHeight:q}=g,z=d(O),N=new Set;function J(){z.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:S,type:j="circle",childbirthStyle:C={}}=t,E=t.data[d+1],P=Z(E,t);if(s&&P&&!f.breakpoint)y=n([...s,...P],{...w});else if(s&&!P&&!f.breakpoint){const e=Z(E,t);y=e?n([...s,...e],{...w}):null}let Y,L;if(f.childbirth){const t=s[1]+I;Y=o([s[0],s[1],t],C),c.push(Y),L=i([s[0]+G/2,t-I/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...C}),c.push(L)}const M=u[d-1],A={origin:{data:f,title:x,key:S||"",dataIndex:e,index:d},leftLine:M,rightLine:y,arrowGroup:Y,arrowGroupText:L,...k,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};M?p=l(j,{left:M.get("x2"),top:M.get("y2"),...A}):s&&(A.leftLine=null,p=l(j,{left:s[0],top:s[1],...A}));u.push(y),p&&(!function(t){$.hovered&&(t.on("mouseover",(()=>{U(t)})),t.on("mouseout",(()=>{m.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{Q(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+G/2,top:t.top+I/2})}(t),$.hovered&&U(t)})),t.on("mouseup",(e=>{if(m.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),v("change",n),K(n,"change")}}))}(p),a.push(p),N.add(p))}(Z(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=z.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;N.size&&(null==(s=h.value)||s.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...N]))),N.clear(),J()}function Q(t){const e=t.prevPoint?t.prevPoint.left:P,n=t.nextPoint?t.nextPoint.left:D;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<B&&t.set("top",B),t.top<Y&&t.set("top",Y),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function U(t){const{title:e,key:n}=t.origin;m.point={x:t.left,y:t.top},m.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],m.show=!0}function Z(t,e){if(f(t)&&function(t){const e=M+864e5,n=new Date(t).getTime();return n>=M&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<Y?Y:o>L?L:o]}}function _(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-A-R-1,height:L-1,left:A,top:0,fill:"transparent"});h.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?A:D;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:d,key:p,scaleNumberStyle:g={}}=t,v=[],m=n+c/2,y=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);y.forEach(((t,e)=>{const n=0===e?L-8:e!==y.length-1||Y||B&&"FHR"!==p?L-e*I:Y+8;v.push(i([m,n],{value:String(t),...r,...g}))}));const k=new u.Rect({...a,width:c,height:L,left:m,top:L/2}),w=i([m,Y>0?Y-I/2:I/2],{value:String(f),...r,...d}),x=new u.Group([...v,k,...w?[w]:[]],{objectCaching:!1,...s});h.value.add(x),x.sendToBack(),n+=c}))}t(X),t(H,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=C.time,{show:a,range:c=[0,23],position:f,style:d}=C.processTime;if(t||a){const p=[],g=[],v=[],m=[],y=P+G/2,k=I/2;for(let s=0;s<E.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):_(p.at(-1),n);p.push(t);const a="top"===o?Y-k:L+k;v.push(i([y+s*G,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:g.at(-1)+1;g.push(t);const e="top"===f?k:q-k;m.push(i([y+s*G,e],{value:String(t),...r,...d||{}}))}}const w=new u.Group([...v,...m],{objectCaching:!1,...s});h.value.add(w),h.value.sendToBack(w)}}(),function(){var t;const e=Object.values(F),o=[],i={},r=z.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-i-e)/t,L-i],u=[D-P,t*(D-P)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=P&&n<=D&&o>=i&&o<=L}function h([t,e]){return[P+t,L-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=z.find((t=>t.key===e));if(r){const r=x(e,i,0);o.push(n([P,r,D,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:p(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[w(l.time)-P,L-x(e,a,l.value)],[h,g]=[w(c.time)-P,L-x(e,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=s(v,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:v,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(w(p(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),h.value.add(...o)}(),J(),function(){function t(t,e){const n=z.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=P&&n<=D&&o>=Y&&o<=L&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],z.filter((t=>t.show)).forEach((i=>{if(!S(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<B)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,j(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-R/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=P&&e<=D&&n>=Y&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(Q(t),U(t)):m.show=!1})),t.on("mouseup:before",(n=>{if(m.show=!1,0===n.e.button&&e(t))if(S(t.left,"key",G).includes(t.origin.key))j();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};v("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(L-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(X,A/2),e(H,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(v("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),v("add",n),K(n))}}}export{h as useBirthProcess};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.41-beta.44",
3
+ "version": "3.1.41-beta.46",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "effa61cf5b85d29b123bfcdb3dc789246249169c"
64
+ "gitHead": "a1aacb9f0bc7af4fc5004fc0db964ba597bc1141"
65
65
  }