cnhis-design-vue 3.1.47-release.0 → 3.1.47-release.1

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.
Files changed (69) hide show
  1. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  2. package/es/components/button-print/src/utils/print.d.ts +7 -5
  3. package/es/components/button-print/src/utils/print.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.d.ts +1 -1
  6. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  9. package/es/components/fabric-chart/src/interface.d.ts +1 -0
  10. package/es/components/form-config/index.d.ts +9 -9
  11. package/es/components/form-config/src/FormConfig.vue.d.ts +9 -9
  12. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
  13. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +4 -4
  14. package/es/components/form-render/index.d.ts +1 -1
  15. package/es/components/form-render/src/FormRender.vue.d.ts +2 -1
  16. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  17. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +1 -1
  18. package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +2 -2
  19. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +4 -4
  20. package/es/components/form-render/src/components/renderer/select.d.ts +2 -2
  21. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  22. package/es/components/form-render/src/hooks/useFormItemDeps.d.ts +1 -0
  23. package/es/components/form-render/src/hooks/useFormItemDeps.js +1 -1
  24. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  25. package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
  26. package/es/components/form-render/src/types/index.d.ts +59 -2
  27. package/es/components/form-render/src/utils/index.js +1 -1
  28. package/es/components/index.css +1 -1
  29. package/es/components/index.d.ts +2 -1
  30. package/es/components/index.js +1 -1
  31. package/es/components/info-header/index.d.ts +2 -2
  32. package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -2
  33. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +1 -1
  34. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +1 -1
  35. package/es/components/multi-chat/index.d.ts +1023 -0
  36. package/es/components/multi-chat/index.js +1 -0
  37. package/es/components/multi-chat/src/MultiChat.vue.d.ts +1005 -0
  38. package/es/components/multi-chat/src/MultiChat.vue.js +1 -0
  39. package/es/components/multi-chat/src/MultiChat.vue2.js +1 -0
  40. package/es/components/multi-chat/src/api/index.d.ts +8 -0
  41. package/es/components/multi-chat/src/api/index.js +1 -0
  42. package/es/components/multi-chat/src/components/ChatFooter.vue.d.ts +17 -0
  43. package/es/components/multi-chat/src/components/ChatFooter.vue.js +1 -0
  44. package/es/components/multi-chat/src/components/ChatFooter.vue2.js +1 -0
  45. package/es/components/multi-chat/src/components/ChatHeader.vue.d.ts +7 -0
  46. package/es/components/multi-chat/src/components/ChatHeader.vue.js +1 -0
  47. package/es/components/multi-chat/src/components/ChatHeader.vue2.js +1 -0
  48. package/es/components/multi-chat/src/components/ChatMain.vue.d.ts +13 -0
  49. package/es/components/multi-chat/src/components/ChatMain.vue.js +1 -0
  50. package/es/components/multi-chat/src/components/ChatMain.vue2.js +1 -0
  51. package/es/components/multi-chat/src/components/SiderList.vue.d.ts +41 -0
  52. package/es/components/multi-chat/src/components/SiderList.vue.js +1 -0
  53. package/es/components/multi-chat/src/components/SiderList.vue2.js +1 -0
  54. package/es/components/multi-chat/src/utils/chatSock.d.ts +28 -0
  55. package/es/components/multi-chat/src/utils/chatSock.js +1 -0
  56. package/es/components/multi-chat/style/index.css +1 -0
  57. package/es/components/scale-view/index.d.ts +28 -0
  58. package/es/components/scale-view/src/ScaleView.vue.d.ts +28 -0
  59. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  60. package/es/components/scale-view/style/index.css +1 -1
  61. package/es/components/shortcut-setter/index.d.ts +2 -2
  62. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +2 -2
  63. package/es/components/steps-wheel/index.d.ts +27 -0
  64. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +27 -0
  65. package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
  66. package/es/components/steps-wheel/src/constants/index.js +1 -1
  67. package/es/components/steps-wheel/style/index.css +1 -1
  68. package/es/shared/package.json.js +1 -1
  69. package/package.json +4 -2
@@ -1 +1 @@
1
- import{defineComponent as t,reactive as e,computed as r,onMounted as a,onUnmounted as n,watch as i,openBlock as l,createElementBlock as o,Fragment as s,createVNode as m,unref as d,withCtx as p,renderSlot as u,withModifiers as c,createTextVNode as f,toDisplayString as v,mergeProps as y}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as g,NDropdown as I,NButton as P,NIcon as w}from"naive-ui";import{ChevronDown as h}from"@vicons/ionicons5";import{Print as F}from"./utils/print.js";import{isIReport as k}from"./utils/browserPrint.js";import T from"./components/IdentityVerification.vue.js";import{format as x}from"date-fns";import{savePrivateFormatApi as S,getPrivateFormatApi as D}from"./api.js";var O=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})}},emits:["success","error","clickoutside"],setup(t,{expose:O,emit:j}){var E;const L=t,M=g();let N;const V={},C=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),Y=e([{label:L.printText,key:"printText"},{label:L.previewText,key:"previewText"},{label:L.pdfLoadText,key:"downloadPdf"},{label:L.formatEditText,key:"formatEditText"},...(null==(E=L.externalOptionConfig)?void 0:E.options)||[]]),J=r((()=>{if(!C.currentFormatId)return{};let t=C.currentFormatId;return C.formatList.find((e=>e.id===t))})),U=r((()=>{var t;return(null==(t=J.value)?void 0:t.name)||"格式选择"})),A=r((()=>{let t=C.formatList.find((t=>t.id===C.currentFormatId));return null==t?void 0:t.templateId})),B=async t=>{if(L.directPrint){if(C.spinning)return;return"button"===t?void await it():rt()}return rt()},q=t=>m("span",{class:{active:t.key===C.currentFormatId}},[t.label]),R=(t,e)=>{let r={type:e,formatId:C.currentFormatId,templateId:A.value};j("success",t,r)},_=t=>{j("error",t),b(t)&&"notInstalledApp"===t.type&&M.error(t.message)},z=t=>{j("error",{message:"前置条件执行错误",type:t,preExecution:!0})},H=(t=0)=>{var e;const r=(null==(e=L.printParams)?void 0:e.length)?L.printParams[t]:C.printParams[t];return JSON.stringify({...r||{},...L.token?{token:L.token}:{}})},$=()=>{var t,e;let r={},a={};if(null==(t=C.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(C.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(C.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(C.printParams[0]).forEach((t=>{a[t]=[],C.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(H(0)),a),JSON.stringify(r)},G=()=>{let t=C.printParams.length;const e=async e=>{try{--t<=0&&R(e,"print")}catch(t){console.log("error",t)}};L.prevFn("print").then((()=>{const t={formatId:C.currentFormatId,templateId:A.value,printdlgshow:L.printdlgshow};if("MULTI"===L.strategy)for(let r=0;r<C.printParams.length;r++)r>0&&(t.printdlgshow="0"),N.printDirect({...t,params:H(r)},e,_);else N.printDirect({...t,params:$()},(t=>{R(t,"print")}),_)})).catch((()=>{z("print")})).finally((()=>{C.visible=!1}))},K=async(t,e)=>{var r,a;switch(t){case"printText":G();break;case"previewText":(async()=>{L.prevFn("preview").then((()=>{const t="MULTI"===L.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,params:t,btnprint:L.btnprint};N.preview(e,(t=>{R(t,"preview")}),_)})).catch((()=>{z("preview")})).finally((()=>{C.visible=!1}))})();break;case"formatEditText":L.prevFn("edit").then((()=>{C.identityVerification.visible=!0})).catch((()=>{z("edit")})).finally((()=>{C.visible=!1}));break;case"downloadPdf":(async()=>{L.prevFn("download").then((()=>{const t="MULTI"===L.strategy?H():$(),e={formatId:C.currentFormatId,templateId:A.value,print:{print:"1",type:"1"},params:t};N.downloadPDF(e,(t=>R(t,"preview")),_)})).catch((()=>{z("download")})).finally((()=>{C.visible=!1}))})();break;default:{C.visible=!1;const n=C.formatList.find((e=>e.id===t))||{};if(Object.keys(n).length>0){C.currentFormatId=t;const[e]=Y;e.label=(null==n?void 0:n.name)||e.label,await S({formatForms:[{...n}],name:V.name||n.templateName,number:V.number||n.number,templateId:V.templateId||n.templateId,...V.id?{id:V.id}:{}},{token:L.token})}else null==(a=null==(r=L.externalOptionConfig)?void 0:r.onSelect)||a.call(r,t,e);break}}},Q=()=>{C.visible=!1,j("clickoutside")},W=()=>(C.isInited=!1,C.spinning=!1,setTimeout((()=>{C.visible=!1}),0),!1),X=(t,e,r)=>{const a={};return e.forEach((e=>{let n=((t,e)=>{const r={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let a=e;return Object.keys(r).includes(t.type)&&e&&(a=x(e,r[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[r]]);t[e[r]]&&n&&(a[e[r]]=n)})),a},Z=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(X(r,e,"fieldName"))}})),a=Object.assign({},a,X(r,e,"key")),a})),tt=async t=>{var e;if(C.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],C.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await D({templateId:t[0].templateId},{token:L.token});if("SUCCESS"===a.result){const{formatForms:e=[]}=a.map||{};Object.assign(V,a.map||{});const n=null==(r=null==e?void 0:e[0])?void 0:r.id;if(n&&t.map((t=>t.id)).includes(n))return n}const n=t.find((t=>1==t[e]));return(null==n?void 0:n.id)||t[0].id})(C.formatList,"defaultFlag"),!C.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),W();(()=>{const t=C.formatList.map((t=>({label:t.name,key:t.id})));Y.unshift({label:U.value,key:"format",children:t})})();let r=null==(e=await L.queryTemplateParams())?void 0:e.obj;if(!r||!A.value)return M.error("获取打印模板失败,请联系管理员!"),W();C.templateParams=r,C.printParams=Z(C.templateParams,L.params)},et=async()=>{if(C.isInited)return!0;C.isInited=!0,C.spinning=!0,(()=>{if(N)return!1;N=new F})();const t=await L.queryPrintFormatByNumber();return await tt(t),C.spinning=!1,!0},rt=async(t=!0)=>{var e;if(await L.clickPrevFn())if(null==(e=L.params)?void 0:e.length){if(!C.visible){if(!await et())return!1}t&&(C.visible=!C.visible)}else M.warning(L.noDataMsg)},at=()=>{C.watchPrintParamsReformatFn&&C.watchPrintParamsReformatFn(),C.isInited?C.printParams=Z(C.templateParams,L.params):C.watchPrintParamsReformatFn=()=>i((()=>C.isInited),(t=>{if(!t)return!1;at()}))},nt=t=>{if(C.identityVerification.visible=!1,k(C.currentFormatId))return R(null,"edit");const e={formatId:C.currentFormatId,templateId:A.value,params:H(),token:t};N.editPrintFormat(e,(t=>{R(t,"edit")}),_)};async function it(){await rt(!1),G()}return a((()=>{C.isInited=!1})),n((()=>{null==N||N.destroy()})),i((()=>L.params),(t=>{if(!(null==t?void 0:t.length))return!1;at()}),{deep:!0}),O({directPrint:it}),(e,r)=>(l(),o(s,null,[m(d(I),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:C.visible,onClickoutside:Q,options:Y,onSelect:K,"render-label":q},{default:p((()=>[u(e.$slots,"button",{handleClickPrintBtn:rt,printSpinning:C.spinning,printbtnText:t.btnText,printVisible:C.visible},(()=>[m(d(P),{class:"dropdown-button",onClick:r[1]||(r[1]=c((()=>B("button")),["stop"]))},{default:p((()=>[f(v(t.btnText)+" ",1),m(d(w),{component:d(h),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=c((()=>B("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),m(T,y(e.$attrs,{modelValue:C.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>C.identityVerification.visible=t),formatId:C.currentFormatId,templateId:d(A),onSuccess:nt}),null,16,["modelValue","formatId","templateId"])],64))}});export{O as default};
1
+ import{defineComponent as t,reactive as e,computed as r,onMounted as a,watch as n,openBlock as i,createElementBlock as o,Fragment as l,createVNode as s,unref as m,withCtx as p,renderSlot as d,withModifiers as u,createTextVNode as c,toDisplayString as f,mergeProps as v}from"vue";import{isObject as y}from"@vue/shared";import{useMessage as b,NDropdown as g,NButton as I,NIcon as P}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as h}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import k from"./components/IdentityVerification.vue.js";import{format as T}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as S}from"./api.js";var D=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})}},emits:["success","error","clickoutside"],setup(t,{expose:D,emit:O}){var j;const E=t,L=b();let M;const N={},V=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),C=e([{label:E.printText,key:"printText"},{label:E.previewText,key:"previewText"},{label:E.pdfLoadText,key:"downloadPdf"},{label:E.formatEditText,key:"formatEditText"},...(null==(j=E.externalOptionConfig)?void 0:j.options)||[]]),Y=r((()=>{if(!V.currentFormatId)return{};let t=V.currentFormatId;return V.formatList.find((e=>e.id===t))})),J=r((()=>{var t;return(null==(t=Y.value)?void 0:t.name)||"格式选择"})),U=r((()=>{let t=V.formatList.find((t=>t.id===V.currentFormatId));return null==t?void 0:t.templateId})),A=async t=>{if(E.directPrint){if(V.spinning)return;return"button"===t?void await nt():et()}return et()},B=t=>s("span",{class:{active:t.key===V.currentFormatId}},[t.label]),q=(t,e)=>{let r={type:e,formatId:V.currentFormatId,templateId:U.value};O("success",t,r)},R=t=>{O("error",t),y(t)&&"notInstalledApp"===t.type&&L.error(t.message)},_=t=>{O("error",{message:"前置条件执行错误",type:t,preExecution:!0})},z=(t=0)=>{var e;const r=(null==(e=E.printParams)?void 0:e.length)?E.printParams[t]:V.printParams[t];return JSON.stringify({...r||{},...E.token?{token:E.token}:{}})},H=()=>{var t,e;let r={},a={};if(null==(t=V.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(V.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(V.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(V.printParams[0]).forEach((t=>{a[t]=[],V.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(z(0)),a),JSON.stringify(r)},$=()=>{let t=V.printParams.length;const e=async e=>{try{--t<=0&&q(e,"print")}catch(t){console.log("error",t)}};E.prevFn("print").then((()=>{const t={formatId:V.currentFormatId,templateId:U.value,printdlgshow:E.printdlgshow};if("MULTI"===E.strategy)for(let r=0;r<V.printParams.length;r++)r>0&&(t.printdlgshow="0"),M.printDirect({...t,messageTimeout:0,params:z(r)},e,R);else M.printDirect({...t,messageTimeout:0,params:H()},(t=>{q(t,"print")}),R)})).catch((()=>{_("print")})).finally((()=>{V.visible=!1}))},G=async(t,e)=>{var r,a;switch(t){case"printText":$();break;case"previewText":(async()=>{E.prevFn("preview").then((()=>{const t="MULTI"===E.strategy?z():H(),e={formatId:V.currentFormatId,templateId:U.value,params:t,btnprint:E.btnprint};M.preview(e,(t=>{q(t,"preview")}),R)})).catch((()=>{_("preview")})).finally((()=>{V.visible=!1}))})();break;case"formatEditText":E.prevFn("edit").then((()=>{V.identityVerification.visible=!0})).catch((()=>{_("edit")})).finally((()=>{V.visible=!1}));break;case"downloadPdf":(async()=>{E.prevFn("download").then((()=>{const t="MULTI"===E.strategy?z():H(),e={formatId:V.currentFormatId,templateId:U.value,print:{print:"1",type:"1"},params:t};M.downloadPDF(e,(t=>q(t,"preview")),R)})).catch((()=>{_("download")})).finally((()=>{V.visible=!1}))})();break;default:{V.visible=!1;const n=V.formatList.find((e=>e.id===t))||{};if(Object.keys(n).length>0){V.currentFormatId=t;const[e]=C;e.label=(null==n?void 0:n.name)||e.label,await x({formatForms:[{...n}],name:N.name||n.templateName,number:N.number||n.number,templateId:N.templateId||n.templateId,...N.id?{id:N.id}:{}},{token:E.token})}else null==(a=null==(r=E.externalOptionConfig)?void 0:r.onSelect)||a.call(r,t,e);break}}},K=()=>{V.visible=!1,O("clickoutside")},Q=()=>(V.isInited=!1,V.spinning=!1,setTimeout((()=>{V.visible=!1}),0),!1),W=(t,e,r)=>{const a={};return e.forEach((e=>{let n=((t,e)=>{const r={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let a=e;return Object.keys(r).includes(t.type)&&e&&(a=T(e,r[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[r]]);t[e[r]]&&n&&(a[e[r]]=n)})),a},X=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(W(r,e,"fieldName"))}})),a=Object.assign({},a,W(r,e,"key")),a})),Z=async t=>{var e;if(V.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],V.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await S({templateId:t[0].templateId},{token:E.token});if("SUCCESS"===a.result){const{formatForms:e=[]}=a.map||{};Object.assign(N,a.map||{});const n=null==(r=null==e?void 0:e[0])?void 0:r.id;if(n&&t.map((t=>t.id)).includes(n))return n}const n=t.find((t=>1==t[e]));return(null==n?void 0:n.id)||t[0].id})(V.formatList,"defaultFlag"),!V.currentFormatId)return L.error("获取打印格式失败,请联系管理员!"),Q();(()=>{const t=V.formatList.map((t=>({label:t.name,key:t.id})));C.unshift({label:J.value,key:"format",children:t})})();let r=null==(e=await E.queryTemplateParams())?void 0:e.obj;if(!r||!U.value)return L.error("获取打印模板失败,请联系管理员!"),Q();V.templateParams=r,V.printParams=X(V.templateParams,E.params)},tt=async()=>{if(V.isInited)return!0;V.isInited=!0,V.spinning=!0,(()=>{if(M)return!1;M=new h})();const t=await E.queryPrintFormatByNumber();return await Z(t),V.spinning=!1,!0},et=async(t=!0)=>{var e;if(await E.clickPrevFn())if(null==(e=E.params)?void 0:e.length){if(!V.visible){if(!await tt())return!1}t&&(V.visible=!V.visible)}else L.warning(E.noDataMsg)},rt=()=>{V.watchPrintParamsReformatFn&&V.watchPrintParamsReformatFn(),V.isInited?V.printParams=X(V.templateParams,E.params):V.watchPrintParamsReformatFn=()=>n((()=>V.isInited),(t=>{if(!t)return!1;rt()}))},at=t=>{if(V.identityVerification.visible=!1,F(V.currentFormatId))return q(null,"edit");const e={formatId:V.currentFormatId,templateId:U.value,params:z(),token:t};M.editPrintFormat(e,(t=>{q(t,"edit")}),R)};async function nt(){await et(!1),$()}return a((()=>{V.isInited=!1})),n((()=>E.params),(t=>{if(!(null==t?void 0:t.length))return!1;rt()}),{deep:!0}),D({directPrint:nt}),(e,r)=>(i(),o(l,null,[s(m(g),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:V.visible,onClickoutside:K,options:C,onSelect:G,"render-label":B},{default:p((()=>[d(e.$slots,"button",{handleClickPrintBtn:et,printSpinning:V.spinning,printbtnText:t.btnText,printVisible:V.visible},(()=>[s(m(I),{class:"dropdown-button",onClick:r[1]||(r[1]=u((()=>A("button")),["stop"]))},{default:p((()=>[c(f(t.btnText)+" ",1),s(m(P),{component:m(w),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=u((()=>A("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),s(k,v(e.$attrs,{modelValue:V.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>V.identityVerification.visible=t),formatId:V.currentFormatId,templateId:m(U),onSuccess:at}),null,16,["modelValue","formatId","templateId"])],64))}});export{D as default};
@@ -14,6 +14,8 @@ export declare class Print {
14
14
  private readonly messageHandlerQueue;
15
15
  private messageHandler;
16
16
  private postMessage;
17
+ messageCollect(id: string, data: AnyObject): Promise<unknown>;
18
+ messageCollectAndNotifyFail(id: string, data: AnyObject, messageTimeout: number): Promise<unknown>;
17
19
  destroy(): void;
18
20
  /**
19
21
  * @desc 调用实例方法打开弹窗
@@ -26,7 +28,7 @@ export declare class Print {
26
28
  _handleMonitorNotify(message: string | unknown): void;
27
29
  _handleResult(data: AnyObject, errorCallbackFn?: Func): false | AnyObject;
28
30
  _handleResultTest(result: unknown, errorCallbackFn?: Func): boolean;
29
- _handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, errorCallbackFn?: Func): Promise<false | {
31
+ _handleEventQueryPrintData(templateId: string, formatId: string, params: AnyObject, messageTimeout: number, errorCallbackFn?: Func): Promise<false | {
30
32
  file: any;
31
33
  printerName: any;
32
34
  pageCount: any;
@@ -38,20 +40,20 @@ export declare class Print {
38
40
  pageCount: any;
39
41
  formatId: string;
40
42
  };
41
- _handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode, btnprint }: AnyObject): Promise<any>;
43
+ _handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
42
44
  _handleEventEditFormat({ templateId, formatId, params, token }: AnyObject): Promise<any>;
43
45
  _queryProxyOrigin(): Promise<void>;
44
46
  _queryPrintFile(formatId: string, params?: string): Promise<any>;
45
47
  _browserPrint(result: AnyObject, mode: string): Promise<string | void>;
46
48
  preview({ templateId, formatId, params, btnprint }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
47
- printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
49
+ printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
48
50
  private _downloadPDF;
49
51
  /**
50
52
  * 下载pdf
51
53
  */
52
54
  downloadPDF(params: AnyObject, onResolve: Func, onReject: Func): void;
53
- print({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
54
- queryPrintData({ templateId, formatId, params }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | {
55
+ print({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | undefined>;
56
+ queryPrintData({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<false | {
55
57
  file: any;
56
58
  printerName: any;
57
59
  pageCount: any;
@@ -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`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=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.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}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(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).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}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!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="0",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:u})||{},{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(`${m}/${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;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}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 u=await this._testConnection();if(!this._handleResultTest(u,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}_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){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=l(new Date,"yyyy-MM-dd");let i=l(new Date,"yyyyMMddHHmmss");t.customFileName&&(i=`${i}${t.customFileName}`),t.print.filename=`${this.downloadPath}/${e}/${i}/${i}`.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
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as n,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const h=t.create({timeout:1e3,withCredentials:!1}),c=`${window.location.protocol}//${window.location.host}`,m=`${c}/fdp-api/print/assembly/printIReport`,u=`${c}/bi-api/reprot/print/open/client/getRemote`,p=`${c}/printService/file`;let f=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],f)return f;f=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:n}=e;try{s(i.res||"")}catch(t){n(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t,e=5e3){if(!this.webview)return Promise.reject();const i=l();return 0===e?this.messageCollect(i,t):this.messageCollectAndNotifyFail(i,t,e)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{h({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(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).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:s(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,n){const r={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(r);return this._handleQueryPrintDataResult(a,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:s,print:n,printdlgshow:r="0",nobillnode:a="1",btnprint:o="1",messageTimeout:l=5e3}){const h={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:a,printdlgshow:r,btnprint:o,messageTimeout:l};if(n){try{n=JSON.parse(n)}catch(t){}h.print=n}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");h.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(h)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s}){const n={};let r={};try{r=Object.assign({},n,JSON.parse(i))}catch(t){r=n}const a={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=c+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({method:"post",url:m,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await n(`${p}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:s},n,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==n||n({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:s}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==n||n(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,printdlgshow:n,nobillnode:o,isDownloadFile:l=!0,messageTimeout:d=5e3},h,c,m="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,m),void(null==h||h({file:t}))):null==c?void 0:c("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,c))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,printdlgshow:n,nobillnode:o,messageTimeout:d}),a=this._handleResult(r,c);if(!a)return!1;l&&["downloadPDF"].includes(m)&&await this._browserPrint(a,m),null==h||h(a)}catch(t){const e="printDirect"===m?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==c||c(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async n=>{if(n||s(null),a(t.formatId))return i(n);const r=this,o=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(n.filedir);i(o,n)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=5e3},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,r);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,r);if(!l)return!1;n&&n(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=5e3},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,r);return!!o&&(n&&n(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,n);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s},n,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:s}),l=this._handleResult(o,r);if(!l)return!1;n&&n(l)}async addPrintFormat({templateId:t,params:e,token:i},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,n);if(!o)return!1;s&&s(o)}}export{w as Print};
@@ -1 +1 @@
1
- import{ref as t,reactive as e,onMounted as i,nextTick as r}from"vue";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as a}from"date-fns";import{getChildrenSize as n}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as s,range as d}from"lodash-es";import"../temperature/useShadow.js";import{useTop as l}from"./useTop.js";import{useCenter as p}from"./useCenter.js";function u(u,h,c,m){var f,g;const x=t(),w=t(),y=t(),b=e({show:!1,point:{x:0,y:0},list:[]}),v=e({show:!1,point:{x:0,y:0},list:[],target:null}),C=null!=(f=h.data.left.width)?f:0,H=n(h.data.top.treeData),Y=function(){const{xAxis:t}=h.data;return"top"===t.position?t.height:0}(),j=function(){const t=s(h.data.top.treeData);let e=0;const{cellWidth:i,cellHeight:r}=h.data.top.tree;return function t(o,a=0){o.forEach((o=>{var s;const d={top:e*r+Y,left:a*i,width:i,height:r};if(e++,null==(s=o.children)?void 0:s.length){e--;const i=n(o.children);d.height=i*r,t(o.children,a+1)}else d.width=C-d.left;Object.assign(o,d)}))}(t),t}();console.log(j);const D=function(){const{grid:t}=h.data;return t.mainXCell*t.subXCell}(),M=h.data.top.tree.cellHeight,T=Y+M*H,X=function(){const t=s(h.data.xAxis),{position:e,startTime:i,spaceValue:r,spaceTimeStamp:o}=t,n=Date.parse(i),l=d(D/r+1).map((t=>0===t?i:a(new Date(n+t*o),"yyyy-MM-dd HH:mm:ss")));return{...t,list:l,left:C,top:"top"===e?0:T}}(),A=function(){const{grid:t}=h.data;return t.mainYCell*t.subYCell}(),G=function(){var t;const{width:e,right:i}=h.data;if(!i)return e;return e-(null!=(t=i.width)?t:0)}(),S=h.data.xAxis.height+M*H,N=function(){var t;const{bottom:e=null,height:i}=h.data;if(!e)return i;return i-(null!=(t=e.height)?t:0)}(),P=(G-C)/D,W=(N-S)/A,E=Date.parse((null==(g=h.data.xAxis)?void 0:g.startTime)||a(new Date,"yyyy-MM-dd HH:mm:ss")),O=36e5/P,k=e({canvasWidth:h.data.width,canvasHeight:h.data.height,borderStyle:{...o,...h.data.borderStyle||{}},grid:h.data.grid,top:h.data.top,other:h.data.other,topGridYNumber:H,topGridYCellHeight:M,topGridOriginY:Y,topGridEndY:T,treeData:j,xAxis:X,startTime:E,timeXCell:O,gridXNumber:D,gridYNumber:A,xCellWidth:P,yCellHeight:W,originX:C,endX:G,originY:S,endY:N});return i((async()=>{await r(),l(u,k),p(u,k)})),{propItems:k,redrawPoints:w,select:x,pointTipProps:b,pointMenuProps:v,clickMenu:y}}export{u as useSurgicalAnesthesiaChart};
1
+ import{ref as t,reactive as e,computed as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as n}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"@vueuse/core";import{cloneDeep as d,range as u}from"lodash-es";import"../temperature/useShadow.js";import{useTop as p}from"./useTop.js";import{useCenter as h}from"./useCenter.js";function m(m,c,v,g){const f=t(),x=t(),w=t(),y=e({show:!1,point:{x:0,y:0},list:[]}),b=e({show:!1,point:{x:0,y:0},list:[],target:null}),C=a((()=>{var t;return null!=(t=c.data.left.width)?t:0})),H=a((()=>s(c.data.top.treeData))),Y=a((()=>{const{xAxis:t}=c.data;return"top"===t.position?t.height:0})),j=function(){const t=d(c.data.top.treeData);let e=0;const{cellWidth:a,cellHeight:r}=c.data.top.tree;return function t(i,l=0){i.forEach((i=>{var o;const n={top:e*r+Y.value,left:l*a,width:a,height:r};if(e++,null==(o=i.children)?void 0:o.length){e--;const a=s(i.children);n.height=a*r,t(i.children,l+1)}else n.width=C.value-n.left;Object.assign(i,n)}))}(t),t}();console.log(j);const D=a((()=>{const{grid:t}=c.data;return t.mainXCell*t.subXCell})),T=a((()=>c.data.top.tree.cellHeight)),M=a((()=>Y.value+T.value*H.value)),X=a((()=>{const t=d(c.data.xAxis),{position:e,spaceValue:a,spaceTimeStamp:r}=t,i=u(D.value/a+1).map((e=>0===e?t.startTime:n(new Date(E.value+e*a*r),"yyyy-MM-dd HH:mm:ss")));return{...t,list:i,left:C.value,top:"top"===e?0:M.value}})),A=a((()=>{const{grid:t}=c.data;return t.mainYCell*t.subYCell})),S=a((()=>{var t;const{width:e,right:a}=c.data;if(!a)return e;return e-(null!=(t=a.width)?t:0)})),G=a((()=>c.data.xAxis.height+T.value*H.value)),W=a((()=>{var t;const{bottom:e=null,height:a}=c.data;if(!e)return a;return a-(null!=(t=e.height)?t:0)})),N=a((()=>(S.value-C.value)/D.value)),P=a((()=>(W.value-G.value)/A.value)),E=a((()=>{var t;return Date.parse((null==(t=c.data.xAxis)?void 0:t.startTime)||n(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=a((()=>X.value.spaceTimeStamp/N.value));console.log("xCellWidth",N.value);const k=e({canvasWidth:c.data.width,canvasHeight:c.data.height,borderStyle:{...o,...c.data.borderStyle||{}},grid:c.data.grid,top:c.data.top,other:c.data.other,topGridYNumber:r(H),topGridYCellHeight:r(T),topGridOriginY:r(Y),topGridEndY:r(M),treeData:j,xAxis:r(X),startTime:r(E),timeXCell:r(O),gridXNumber:r(D),gridYNumber:r(A),xCellWidth:r(N),yCellHeight:r(P),originX:r(C),endX:r(S),originY:r(G),endY:r(W)});return i((async()=>{await l(),p(m,k),h(m,k)})),{propItems:k,redrawPoints:x,select:f,pointTipProps:y,pointMenuProps:b,clickMenu:w}}export{m as useSurgicalAnesthesiaChart};
@@ -1,4 +1,4 @@
1
1
  import { type Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { AnyObject } from '../../../../../../es/shared/types';
4
- export declare function useTop(canvas: Ref<fabric.Canvas>, propItems: AnyObject): void;
4
+ export declare function useTop(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function): void;
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,drawTextGroup as o}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"../temperature/useShadow.js";function n(n,l){const{grid:d,originX:s,endX:u,xCellWidth:a,gridXNumber:h,top:p,topList:c,canvasWidth:g,borderStyle:f,treeData:m,xAxis:v,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:x,topGridEndY:G}=l;r(n,{...l,gridYNumber:j,originY:b,yCellHeight:x,endY:G}),function(){const{height:o,list:r,left:l,top:d,spaceValue:s}=v,u=[],h=d+o/2;r.forEach(((t,i)=>{const o=l+i*a*s;u.push(e([o,h],{value:t.slice(11,16)}))}));const p=u.length>0?new t.Group([...u],{...i,objectCaching:!1}):null;p&&n.value.add(p)}(),function(){var e;const r=(null==(e=null==p?void 0:p.tree)?void 0:e.textStyle)||{},l=[];!function t(e){e.forEach((e=>{var i;const{width:n,height:d,left:s,top:u,title:a=""}=e,h={value:a,...r};(null==(i=e.children)?void 0:i.length)?(h.value=a.split("").join("\n"),t(e.children)):h.textAlign="left",l.push(o({width:n,height:d,...f},h,{left:s,top:u},!0))}))}(m);const d=l.length>0?new t.Group([...l],{...i,objectCaching:!1}):null;d&&n.value.add(d)}()}export{n as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,drawTextGroup as n,drawLine as o,drawPoint as l}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"@vueuse/core";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";function c(c,u,a){const{cumputedX:d}=s(u),{grid:f,originX:h,endX:p,xCellWidth:m,gridXNumber:x,top:g,topList:v,canvasWidth:C,borderStyle:L,treeData:y,xAxis:X,topGridYNumber:Y,topGridOriginY:j,topGridYCellHeight:w,topGridEndY:b}=u,S=new Set;function G(e,{isCustomIcon:i,isContinue:n,isLeft:r}){const{x:s,y1:c,y2:u,halfY:a}=e;if(!s||s<h||s>p)return;const{lineStyle:d}=g.data||{};let f;const x={left:s,top:a};f=i?l("circle",{fill:d.stroke,...x}):n?l(">",{fill:d.stroke,...x,fontSize:18}):o([s,c,s,a],d);const v=new t.Rect({width:m,height:w,fill:"transparent",left:s-m/2,top:c}),C=new t.Group([f,v],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,lockMovementY:!0});var L;return C.isLeft=r,(L=C).on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1),t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(L),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}}(L)})),L.on("mouseup",(t=>{t.button})),C}r(c,{...u,gridYNumber:Y,originY:j,yCellHeight:w,endY:b}),function(){const{height:n,list:o,left:l,top:r,spaceValue:s}=X,u=[],a=r+n/2;o.forEach(((t,i)=>{const n=l+i*m*s;u.push(e([n,a],{value:t.slice(11,16)}))}));const d=u.length>0?new t.Group([...u],{...i,objectCaching:!1}):null;d&&c.value.add(d)}(),function(){var e;const l=(null==(e=null==g?void 0:g.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:c,left:u,top:a,title:f=""}=e,m={value:f,...l};(null==(i=e.children)?void 0:i.length)?(m.value=f.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=g.data||{},l=t.top,r=l+w,s=r-w/2,c={y1:l,y2:r,halfY:s},u=[];function a(t){const{startLine:e,endLine:i}=u[t],{startLine:n,endLine:o}=u[t-1]||{};if(e){const t={x1:h,x2:i?i.left:p};o?(t.x1=o.left,o.limitX.x2=e.left):n&&(t.x1=n.left,n.limitX.x2=e.left),e.limitX=t}if(i){const t={x1:e?e.left:h,x2:p};i.limitX=t}}t.data.forEach(((t,i,n)=>{const{time:l,continue:r,value:f}=t,[m,x]=l,g=m&&d(m),v=x&&d(x),C=G({...c,x:g},{isCustomIcon:!v&&!r,isContinue:!1,isLeft:!0}),L=G({...c,x:v},{isCustomIcon:!1,isContinue:!!r});let y;if((C||g<h)&&(L||v>p)){y=o([C?g:h,s,L?v:p,s],e)}u.push({startLine:C,centerLine:y,endLine:L}),a(i),y&&(C&&(C.centerLine=y),L&&(L.centerLine=y),S.add(y)),C&&S.add(C),L&&S.add(L)}))}(e)),r.push(n({width:s,height:c,...L},m,{left:u,top:a},!0))}))}(y);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&c.value.add(s),S.size&&c.value.add(...S)}()}export{c as useTop};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,L,k,Y,S,E,$,M,P,O){r(j,L);const{getEqualXTypes:T,handleAddPrevent:A}=y(j,k),{createShadowLines:I}=t(),{left:C,xScaleList:R,xCellWidth:X,yCellHeight:z,originX:D,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=L,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=m(C.yScaleValue);function ne(t){var i;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(N.size&&j.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],c=n[i-1],p=n[i+1],d=o[r-1],f=o[r+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const c=t.map((e=>({x:e[0],y:e[1]}))),p=new e.Polygon(c,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){p.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=I(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),j.value.add(...e)}N.add(p),j.value.add(p)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,C.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,t,r){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,Y=[],E=[],M=[];null==(u=e.list)||u.forEach(((u,O)=>{const T=a(c)?w.find((e=>e.key===u.key)):e,A=ae(u,r),I={};I.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-z}}(A,u,T),function(e,t,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=a,{value:x}=u;let b,w,j,L,k,Y;if(t.noRise&&h.show)if(h.text)j=l([e[0],e[1]+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),M.push(j);else{const t=e[1]+2*z;L=s([e[0],e[1],t],h.style||{}),M.push(L)}t.rise&&f.show&&f.text&&(k=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),M.push(k));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),M.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=S(c,r.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===K?"bottom":"center"}),b&&M.push(b),w&&M.push(w)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5},arrowGroup:{obj:L,top:2*z},riseText:{obj:k,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(A,u,T,I),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),M.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),M.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(A,u,T,I),function(n,l,s,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],S=ae(w,r),M=se(c,e.list[s].value),O=S&&se(c,w.value);!n||!S||l.breakpoint||M||O||n[0]===S[0]||(f=i([...n,...S],{...v}));const T=l.pacemakerShow&&"pulse"==c?y.value:M?0:x,A=E[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:c,_type:d(g,c),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...L.event.hovered?L.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:L.event,...M?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");p=o(T,{left:A.get("x2"),top:M?e-5:e,...I})}else n&&(I.leftLine=null,p=o(T,{left:n[0],top:M?n[1]-5:n[1],...I}));E.push(f),p&&(g.includes("脉搏")?Z.add(p):ee.add(p),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),k("change",n),ce(n,"change")}}))}(p),Y.push(p),te.add(p))}(A,u,O,T,I)})),"pulse"===c&&Q.forEach((e=>{U.set(e,Y.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(Y).then((e=>{const t=E.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(M).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||E(e.left)).slice(-5)}`],P.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(f(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=S(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${E(e)}:00`);return B&&l<h(B)?(A("exceedMin"),!1):!(l>o)||(A("exceedMax"),!1)}function ce(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;pe()}function pe(){var e;te.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=S(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),L.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=F&&n<=_){O.point={x:i,y:n},O.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(O.list=[...x]),"pain"===o&&(O.list=[...b]),O.target=e.target;else{O.target=null,O.list=["新增节点"],G.forEach((t=>{if(!T(i,"_type",X).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&O.list.push({renderItem:M?M(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==O.list.length||(O.show=!1,1===O.list.length&&t&&A("repeat"))}}}})),{pointTipProps:P,pointMenuProps:O,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};k("change",r),ce(r,"change")}else{const t={data:{time:E(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};k("add",t),ce(t)}},setPopup:re,isAddPoint:ue,updateData:ce,redrawPoints:pe}}export{j as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as p,isValidValue as d,setOtherType as c,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"@vueuse/core";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as w}from"../../constants/index.js";function j(j,k,Y,S,E,$,M,P,O,T){r(j,k);const{getEqualXTypes:A,handleAddPrevent:I}=y(j,Y),{createShadowLines:C}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:q,vitalSignsOriginY:W,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var i;const o=ne.find((e=>"pulse"===e.type));if(o&&(null==(i=o.dataList)?void 0:i.length)&&(Q.size&&j.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],d=n[i+1],c=o[r-1],f=o[r+1];if(p&&c){if(p[0]!==c[0]){const e=Math.max(p[0],c[0]);l.push([p,c].find((t=>t[0]===e)))}}else p?l.push(p):c&&s.push(c);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var i,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),d=new e.Polygon(p,{...n,...(null==(i=o.shadow)?void 0:i.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){d.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=C(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...n,...(null==(t=o.shadow)?void 0:t.style)||{}}),Q.add(e)})),j.value.add(...e)}Q.add(d),j.value.add(d)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},w,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{j.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function se(e,t,r){var u;const{type:p,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:w=[]}=r,S=[],$=[],P=[];null==(u=e.list)||u.forEach(((u,T)=>{const A=a(p)?w.find((e=>e.key===u.key)):e,I=ue(u,r),C={};C.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=W.originY+z?e[1]+z:e[1]-z,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-z}}(I,u,A),function(e,t,r,a,u){var c,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(p))return;const{lineAttr:m={}}=r,{value:x}=a;let b,w,j,k,Y,S;if(t.noRise&&h.show){const t=L(h)?E(u.type,u.list,35):e[1];if(h.text)j=l([e[0],L(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),P.push(j);else{const i=t+2*z;k=s([e[0],t,i],h.style||{}),P.push(k)}}t.rise&&f.show&&f.text&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),P.push(Y));t.verified&&(S=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),P.push(S));if(d(t.physicsReduce)||d(t.drugReduce)){const l=E(p,u.list,null!=(c=t.physicsReduce)?c:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),w=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:j,top:5,isFixed:L(h)},arrowGroup:{obj:k,top:2*z,isFixed:L(h)},riseText:{obj:Y,top:(x?-z:0)-5},verifiedText:{obj:S,top:(x?-z:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,u,A,C,r),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(p))return;let o,a;const{upArrowShow:u=!1,limitValueShow:d=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<W.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=s([e[0],i[0],i[1]],m,"up"),P.push(o)}if(d){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...r.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),P.push(a)}+t.value<Math.min(...r.list)&&(a=l([e[0],e[1]-z],i),P.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(I,u,A,C),function(n,l,s,a,u){let d,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,w=e.list[s+1],L=ue(w,r),E=re(p,e.list[s].value),P=L&&re(p,w.value);!n||!L||l.breakpoint||E||P||n[0]===L[0]||(f=i([...n,...L],{...v}));const T=l.pacemakerShow&&"pulse"==p?y.value:E?0:x,A=$[s-1],I={origin:{data:l,title:g,key:m||"",unit:r.unit,type:p,_type:c(g,p),dataIndex:t,index:s},leftLine:A,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==p?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...E?{selectable:!1,evented:!1,...b}:{}};if(A){const e=A.get("y2");d=o(T,{left:A.get("x2"),top:E?e-5:e,...I})}else n&&(I.leftLine=null,d=o(T,{left:n[0],top:E?n[1]-5:n[1],...I}));$.push(f),d&&(g.includes("脉搏")?ee.add(d):te.add(d),function(e){q.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{O.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B:W;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),q.hovered&&ae(e)})),e.on("mouseup",(t=>{if(O.show=!1,1===t.button){const{type:t}=e.origin,i=M(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};j.value.discardActiveObject(),Y("change",n),de(n,"change")}}))}(d),S.push(d),ie.add(d))}(I,u,T,A,C)})),"pulse"===p&&U.forEach((e=>{Z.set(e,S.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(S).then((e=>{const t=$.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{j.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&j.value.remove(e.leftLine),e.rightLine&&j.value.remove(e.rightLine))}}(t,e)}))}))}))}function re(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;O.point={x:e.left,y:e.top},O.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},a="hover"===t?l.value:M(o,e.top);if(d(s))return`药物降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;if(d(r))return`物理降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||$(e.left)).slice(-5)}`],O.show=!0}function ue(e,t){const i="pain"===t.type?B:W;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=S(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function pe(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${$(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function de(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;ie.size&&(null==(e=j.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);j.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||se(t,i,e)}))})),oe(),le(),k.event.evented&&j.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){T.point={x:i,y:n},T.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(T.list=[...x]),"pain"===o&&(T.list=[...b]),T.target=e.target;else{T.target=null,T.list=["新增节点"],H.forEach((t=>{if(!A(i,"_type",F).includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:W;n>=i.originY&&n<=i.endY&&T.list.push({renderItem:P?P(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=pe(i);t&&1!==T.list.length||(T.show=!1,1===T.list.length&&t&&I("repeat"))}}}})),{pointTipProps:O,pointMenuProps:T,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=g(i,[...x,...b]);s[`${e.type}`]=e.value,a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};Y("change",r),de(r,"change")}else{const t={data:{time:$(e.pointer.x),value:M(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};Y("add",t),de(t)}},setPopup:ae,isAddPoint:pe,updateData:de,redrawPoints:ce}}function L(e){return"fixed"===e.position}export{j as useCenter};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},i={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...n,...r})}function s([t,r],n){return new e.Text(String(n.value),{...o,left:t,top:r,...n})}function l([r,n,i],o,l="down"){const a=c([r,n,r,i],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?i-3:i+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,n,c,s=!1){const l=new e.Rect({...i,...r,...s?{}:{stroke:"transparent"}}),{value:a="标题",textAlign:u="center",verticalAlign:g="center"}=n,h=r.width/2,d=r.height/2,f=new e.Text(String(a),{...o,...n,..."left"==u||"right"==u?{originX:u,left:"left"==u?-h:h}:{},..."top"==g||"bottom"==g?{originY:g,top:"top"==g?-d:d}:{}});return new e.Group([l,f],{objectCaching:!1,...t,...c})}function u(t="circle",r){const n={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},i=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...n});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...n});case"image":return new e.Image(r.element,{...n,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),n={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},i=new e.Line([0,t/2,t,t/2],n),o=new e.Line([t/2,0,t/2,t],n);return new e.Group([i,o])};return new e.Group([i(),t()],{scale:1,...n})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([i(),o],{scale:1,...n})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...n})}}export{r as defaultBorderStyle,n as defaultLineStyle,i as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},i={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...n,...r})}function s([t,r],n){return new e.Text(String(n.value),{...o,left:t,top:r,...n})}function a([r,n,i],o,a="down"){const l=c([r,n,r,i],{strokeWidth:1,stroke:o.fill}),g=s([r+.5,"up"===a?i-3:i+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===a?180:0,objectCaching:!1,...o});return new e.Group([l,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function l(r,n,c,s=!1){const a=new e.Rect({...i,...r,...s?{}:{stroke:"transparent"}}),{value:l="标题",textAlign:g="center",verticalAlign:u="center"}=n,h=r.width/2,d=r.height/2,f=new e.Text(String(l),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-h:h}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-d:d}:{}});return new e.Group([a,f],{objectCaching:!1,...t,...c})}function g(t="circle",r){const n={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},i=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...n});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...n});case"image":return new e.Image(r.element,{...n,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),n={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},i=new e.Line([0,t/2,t,t/2],n),o=new e.Line([t/2,0,t/2,t],n);return new e.Group([i,o])};return new e.Group([i(),t()],{scale:1,...n})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([i(),o],{scale:1,...n})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...n})}}export{r as defaultBorderStyle,n as defaultLineStyle,i as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,a as drawArrow,c as drawLine,g as drawPoint,s as drawText,l as drawTextGroup};
@@ -13,6 +13,7 @@ export declare type ITreeItem = Partial<{
13
13
  data: Array<{
14
14
  time: string[];
15
15
  value: AnyObject;
16
+ [key: string]: any;
16
17
  }>;
17
18
  children: ITreeItem[];
18
19
  top: number;
@@ -141,7 +141,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
141
141
  level_key?: string | undefined;
142
142
  link_key?: string | undefined;
143
143
  link_key_split?: string | undefined;
144
- show_key?: string[] | undefined;
144
+ show_key?: string | string[] | undefined;
145
145
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
146
146
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
147
147
  setting?: {
@@ -1861,7 +1861,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1861
1861
  level_key?: string | undefined;
1862
1862
  link_key?: string | undefined;
1863
1863
  link_key_split?: string | undefined;
1864
- show_key?: string[] | undefined;
1864
+ show_key?: string | string[] | undefined;
1865
1865
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
1866
1866
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
1867
1867
  setting?: {
@@ -3590,7 +3590,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
3590
3590
  level_key?: string | undefined;
3591
3591
  link_key?: string | undefined;
3592
3592
  link_key_split?: string | undefined;
3593
- show_key?: string[] | undefined;
3593
+ show_key?: string | string[] | undefined;
3594
3594
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
3595
3595
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
3596
3596
  setting?: {
@@ -5310,7 +5310,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
5310
5310
  level_key?: string | undefined;
5311
5311
  link_key?: string | undefined;
5312
5312
  link_key_split?: string | undefined;
5313
- show_key?: string[] | undefined;
5313
+ show_key?: string | string[] | undefined;
5314
5314
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
5315
5315
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
5316
5316
  setting?: {
@@ -7483,7 +7483,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
7483
7483
  validate(path?: string): Promise<void>;
7484
7484
  getFormValues(needCombineExtendKey?: boolean): any;
7485
7485
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
7486
- setFieldState(path: string, handler: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
7486
+ setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
7487
7487
  match: (pattern: import("@formily/path").Pattern) => boolean;
7488
7488
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
7489
7489
  data: any;
@@ -8006,7 +8006,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
8006
8006
  level_key?: string | undefined;
8007
8007
  link_key?: string | undefined;
8008
8008
  link_key_split?: string | undefined;
8009
- show_key?: string[] | undefined;
8009
+ show_key?: string | string[] | undefined;
8010
8010
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
8011
8011
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
8012
8012
  setting?: {
@@ -9737,7 +9737,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
9737
9737
  level_key?: string | undefined;
9738
9738
  link_key?: string | undefined;
9739
9739
  link_key_split?: string | undefined;
9740
- show_key?: string[] | undefined;
9740
+ show_key?: string | string[] | undefined;
9741
9741
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
9742
9742
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
9743
9743
  setting?: {
@@ -11441,7 +11441,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
11441
11441
  level_key?: string | undefined;
11442
11442
  link_key?: string | undefined;
11443
11443
  link_key_split?: string | undefined;
11444
- show_key?: string[] | undefined;
11444
+ show_key?: string | string[] | undefined;
11445
11445
  conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
11446
11446
  conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
11447
11447
  setting?: {
@@ -13532,7 +13532,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
13532
13532
  validate(path?: string): Promise<void>;
13533
13533
  getFormValues(needCombineExtendKey?: boolean): any;
13534
13534
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
13535
- setFieldState(path: string, handler: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
13535
+ setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
13536
13536
  match: (pattern: import("@formily/path").Pattern) => boolean;
13537
13537
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
13538
13538
  data: any;
@@ -143,7 +143,7 @@ declare const _default: import("vue").DefineComponent<{
143
143
  level_key?: string | undefined;
144
144
  link_key?: string | undefined;
145
145
  link_key_split?: string | undefined;
146
- show_key?: string[] | undefined;
146
+ show_key?: string | string[] | undefined;
147
147
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
148
148
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
149
149
  setting?: {
@@ -1863,7 +1863,7 @@ declare const _default: import("vue").DefineComponent<{
1863
1863
  level_key?: string | undefined;
1864
1864
  link_key?: string | undefined;
1865
1865
  link_key_split?: string | undefined;
1866
- show_key?: string[] | undefined;
1866
+ show_key?: string | string[] | undefined;
1867
1867
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
1868
1868
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
1869
1869
  setting?: {
@@ -3592,7 +3592,7 @@ declare const _default: import("vue").DefineComponent<{
3592
3592
  level_key?: string | undefined;
3593
3593
  link_key?: string | undefined;
3594
3594
  link_key_split?: string | undefined;
3595
- show_key?: string[] | undefined;
3595
+ show_key?: string | string[] | undefined;
3596
3596
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
3597
3597
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
3598
3598
  setting?: {
@@ -5312,7 +5312,7 @@ declare const _default: import("vue").DefineComponent<{
5312
5312
  level_key?: string | undefined;
5313
5313
  link_key?: string | undefined;
5314
5314
  link_key_split?: string | undefined;
5315
- show_key?: string[] | undefined;
5315
+ show_key?: string | string[] | undefined;
5316
5316
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
5317
5317
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
5318
5318
  setting?: {
@@ -7485,7 +7485,7 @@ declare const _default: import("vue").DefineComponent<{
7485
7485
  validate(path?: string): Promise<void>;
7486
7486
  getFormValues(needCombineExtendKey?: boolean): any;
7487
7487
  setFormValues(values: import("../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
7488
- setFieldState(path: string, handler: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
7488
+ setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
7489
7489
  match: (pattern: import("@formily/path").Pattern) => boolean;
7490
7490
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
7491
7491
  data: any;
@@ -8008,7 +8008,7 @@ declare const _default: import("vue").DefineComponent<{
8008
8008
  level_key?: string | undefined;
8009
8009
  link_key?: string | undefined;
8010
8010
  link_key_split?: string | undefined;
8011
- show_key?: string[] | undefined;
8011
+ show_key?: string | string[] | undefined;
8012
8012
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
8013
8013
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
8014
8014
  setting?: {
@@ -9739,7 +9739,7 @@ declare const _default: import("vue").DefineComponent<{
9739
9739
  level_key?: string | undefined;
9740
9740
  link_key?: string | undefined;
9741
9741
  link_key_split?: string | undefined;
9742
- show_key?: string[] | undefined;
9742
+ show_key?: string | string[] | undefined;
9743
9743
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
9744
9744
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
9745
9745
  setting?: {
@@ -11443,7 +11443,7 @@ declare const _default: import("vue").DefineComponent<{
11443
11443
  level_key?: string | undefined;
11444
11444
  link_key?: string | undefined;
11445
11445
  link_key_split?: string | undefined;
11446
- show_key?: string[] | undefined;
11446
+ show_key?: string | string[] | undefined;
11447
11447
  conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
11448
11448
  conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
11449
11449
  setting?: {
@@ -13534,7 +13534,7 @@ declare const _default: import("vue").DefineComponent<{
13534
13534
  validate(path?: string): Promise<void>;
13535
13535
  getFormValues(needCombineExtendKey?: boolean): any;
13536
13536
  setFormValues(values: import("../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
13537
- setFieldState(path: string, handler: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
13537
+ setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
13538
13538
  match: (pattern: import("@formily/path").Pattern) => boolean;
13539
13539
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
13540
13540
  data: any;
@@ -470,7 +470,7 @@ declare const _default: import("vue").DefineComponent<{}, {
470
470
  validate(path?: string): Promise<void>;
471
471
  getFormValues(needCombineExtendKey?: boolean): any;
472
472
  setFormValues(values: import("../../..").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
473
- setFieldState(path: string, handler: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
473
+ setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
474
474
  match: (pattern: import("@formily/path").Pattern) => boolean;
475
475
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
476
476
  data: any;
@@ -96,7 +96,7 @@ declare const _default: import("vue").DefineComponent<{
96
96
  level_key?: string | undefined;
97
97
  link_key?: string | undefined;
98
98
  link_key_split?: string | undefined;
99
- show_key?: string[] | undefined;
99
+ show_key?: string | string[] | undefined;
100
100
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
101
101
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
102
102
  setting?: {
@@ -1827,7 +1827,7 @@ declare const _default: import("vue").DefineComponent<{
1827
1827
  level_key?: string | undefined;
1828
1828
  link_key?: string | undefined;
1829
1829
  link_key_split?: string | undefined;
1830
- show_key?: string[] | undefined;
1830
+ show_key?: string | string[] | undefined;
1831
1831
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
1832
1832
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
1833
1833
  setting?: {
@@ -3531,7 +3531,7 @@ declare const _default: import("vue").DefineComponent<{
3531
3531
  level_key?: string | undefined;
3532
3532
  link_key?: string | undefined;
3533
3533
  link_key_split?: string | undefined;
3534
- show_key?: string[] | undefined;
3534
+ show_key?: string | string[] | undefined;
3535
3535
  conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
3536
3536
  conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
3537
3537
  setting?: {
@@ -5622,7 +5622,7 @@ declare const _default: import("vue").DefineComponent<{
5622
5622
  validate(path?: string): Promise<void>;
5623
5623
  getFormValues(needCombineExtendKey?: boolean): any;
5624
5624
  setFormValues(values: import("../../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
5625
- setFieldState(path: string, handler: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
5625
+ setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
5626
5626
  match: (pattern: import("@formily/path").Pattern) => boolean;
5627
5627
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
5628
5628
  data: any;
@@ -457,7 +457,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
457
457
  validate(path?: string): Promise<void>;
458
458
  getFormValues(needCombineExtendKey?: boolean): any;
459
459
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
460
- setFieldState(path: string, handler: (field: Partial<Pick<import("@formily/core/esm/models/Field").Field<any, any, any, any>, import("@formily/core/esm/types").NonFunctionPropertyNames<{
460
+ setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core/esm/models/Field").Field<any, any, any, any>, import("@formily/core/esm/types").NonFunctionPropertyNames<{
461
461
  match: (pattern: import("@formily/path").Pattern) => boolean;
462
462
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
463
463
  data: any;
@@ -1,4 +1,5 @@
1
1
  import { AnyObject, FormOperationalConfig } from '../../../../es/shared/types';
2
+ import { Field } from '@formily/core';
2
3
  import { Component, FunctionalComponent, PropType } from 'vue';
3
4
  import { RequestInstance } from './hooks';
4
5
  import { FieldItem, FieldVisitor, FormBusinessFormatter, FormLowCodeReactions } from './types';
@@ -451,7 +452,7 @@ declare const _default: import("vue").DefineComponent<{
451
452
  validate(path?: string): Promise<void>;
452
453
  getFormValues(needCombineExtendKey?: boolean): any;
453
454
  setFormValues(values: AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
454
- setFieldState(path: string, handler: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
455
+ setFieldState(path: string, setter: (field: Partial<Pick<Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
455
456
  match: (pattern: import("@formily/path").Pattern) => boolean;
456
457
  validate: (triggerType?: import("@formily/validator").ValidatorTriggerType | undefined) => any;
457
458
  data: any;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as j,createElementVNode as b,withKeys as k,toDisplayString as v,renderSlot as F}from"vue";import{useTheme as C}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as H,cloneDeep as S}from"lodash-es";import{createForm as x,onFieldValueChange as A,onFieldMount as L,onFieldUnmount as O,onFieldReact as R,onFormMount as w}from"@formily/core";import{FormProvider as B,FormConsumer as _}from"@formily/vue";import{NForm as V,NTabs as D,NTabPane as I,NConfigProvider as N}from"naive-ui";import{InjectionFormLifeCycleCaller as q,InjectionFormGraph as W}from"./constants/index.js";import{useAutoHidden as T}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as U}from"./hooks/useComplexOptions.js";import{useFormDomEvent as E,useFormExposeEvent as G}from"./hooks/useFormEvent.js";import{useFormGraph as K}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as M}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as P}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as J}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as $}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as z}from"./hooks/useOperationalForm.js";import{useWordbookSetting as Q}from"./hooks/useWordbookSetting.js";import"./utils/index.js";import{useFieldListAdaptor as X}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as Y}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as Z}from"./hooks/useFormValidator.js";import{useAnchor as ee}from"./hooks/useAnchor.js";import{useFormContext as oe}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import{createObjSchema as te}from"./utils/schema.js";const re={key:0,style:{height:"54px"}},se={style:{"white-space":"pre"}};var ae=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},uniqueCacheData:{type:Boolean,default:!1}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:ae,emit:ie}){const le=e,ne=C(),{nuiThemeOverrides:me}=$();Z();const de=o(),pe=t((()=>H(le.maxHeight)?le.maxHeight+"px":le.maxHeight)),{SchemaField:ue,businessCollector:ce,formItemDepsCollector:fe,changeContextCollector:he,formUUID:ye}=oe(le,ie),{anchorBarRef:ge,currentAnchor:je,updateAnchorList:be,anchorIdList:ke,onScroll:ve}=ee(le,ie,de,fe),{callLifeCycle:Fe}=M(le);r(q,Fe),Fe("onSetup");const{trigger:Ce}=T(),{observeFormGraph:He,setGraph:Se,removeGraph:xe}=K();r(W,He);const{lowCodeEventTrigger:Ae}=P(),Le=x({initialValues:le.initialData,effects(e){A("*",(o=>{const t=o.props.name.toString();ce.trigger(e,t),fe.trigger(t),ie("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:he.getContext(t,o.value)}),Ae(o),Oe(t,o.value),we(t),_e(t,o.value)})),L("*",Se),O("*",xe),le.linebarAutoHidden&&(R("*",Ce),w((e=>e.query("*").forEach(Ce)))),le.anchor&&R("*",be)}}),{lowCodeReactionsHandler:Oe,triggerAllReactionsHandler:Re}=J(t((()=>le.lowCodeReactions)),Le),{operationalFormHandler:we,triggerAllOperationalFormHandler:Be}=z(t((()=>le.operationalForm)),Le),{wordbookSettingHandler:_e}=Q(Le,he);s(Re),s(Be);const{schemaAdaptor:Ve}=X(ce);let De=le.fieldList||[];const Ie=t((()=>le.schema?le.schema:le.fieldList?(De=Y().traverse(S(le.fieldList),le.fieldVisitor),te(Ve(De))):te({}))),{onKeydown:Ne}=E({formModel:Le,formRenderRef:de,props:le}),{clearSpan:qe}=U();a((()=>qe(ye)));const We=G({formModel:Le,formRenderRef:de,formItemDepsCollector:fe,getFieldList:()=>De,formUUID:ye});return ae({formModel:Le,validate:(e="*")=>We.validate(e),getFormValues:(e=!0)=>We.getFormValues(e),async setFormValues(e,o=!0,t=!1,r=!0){t&&(ce.triggerLock=!0),We.setFormValues(e,o,r),await i(),ce.triggerLock=!1},setFieldState(e,o){We.setFieldState(e,o)},resetFields(e="*"){We.resetFields(e)},queryWidget:async e=>We.queryWidget(e),getFieldList:()=>De,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(V),{class:d(["form-render",{"form-render--no-border":!e.bordered,"form-render--underline":"underline"===e.bordered}]),"require-mark-placement":"left",style:p(m(ne))},{default:u((()=>[e.anchor?(l(),c("section",re,[f(m(D),{value:m(je),"onUpdate:value":t[0]||(t[0]=e=>h(je)?je.value=e:null),type:"line",ref_key:"anchorBarRef",ref:ge},{default:u((()=>[(l(!0),c(y,null,g(m(ke),(e=>(l(),n(m(I),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):j("v-if",!0),f(m(N),{"theme-overrides":m(me)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(pe)}),ref_key:"formRenderRef",ref:de,onScroll:t[1]||(t[1]=(...e)=>m(ve)&&m(ve)(...e)),onKeydownCapture:t[2]||(t[2]=k(((...e)=>m(Ne)&&m(Ne)(...e)),["enter"]))},[f(m(B),{form:m(Le)},{default:u((()=>[f(m(ue),{schema:m(Ie)},null,8,["schema"]),e.consumer?(l(),n(m(_),{key:0},{default:u((({form:e})=>[b("div",se,v(JSON.stringify(e.values,null,2)),1)])),_:1})):j("v-if",!0),F(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{ae as default};
1
+ import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as j,createElementVNode as b,withKeys as k,toDisplayString as v,renderSlot as F}from"vue";import{useTheme as C}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as H,isObject as x,isBoolean as A}from"lodash-es";import{createForm as L,onFieldValueChange as O,onFieldMount as R,onFieldUnmount as w,onFieldReact as B,onFormMount as _}from"@formily/core";import{FormProvider as D,FormConsumer as V}from"@formily/vue";import{NForm as I,NTabs as N,NTabPane as q,NConfigProvider as W}from"naive-ui";import{InjectionFormLifeCycleCaller as E,InjectionFormGraph as K}from"./constants/index.js";import{useAutoHidden as T}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as U}from"./hooks/useComplexOptions.js";import{useFormDomEvent as G,useFormExposeEvent as M}from"./hooks/useFormEvent.js";import{useFormGraph as P}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as J}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as $}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as z}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as Q}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as X}from"./hooks/useOperationalForm.js";import{useWordbookSetting as Y}from"./hooks/useWordbookSetting.js";import"./utils/index.js";import{useFieldListAdaptor as Z}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as ee}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as oe}from"./hooks/useFormValidator.js";import{useAnchor as te}from"./hooks/useAnchor.js";import{useFormContext as re}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import{createObjSchema as se}from"./utils/schema.js";const ae={key:0,style:{height:"54px"}},ie={style:{"white-space":"pre"}};var le=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},uniqueCacheData:{type:Boolean,default:!1}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:le,emit:ne}){const me=e,de=C(),{nuiThemeOverrides:pe}=Q();oe();const ue=o(),ce=t((()=>S(me.maxHeight)?me.maxHeight+"px":me.maxHeight)),{SchemaField:fe,businessCollector:he,formItemDepsCollector:ye,changeContextCollector:ge,formUUID:je}=re(me,ne),{anchorBarRef:be,currentAnchor:ke,updateAnchorList:ve,anchorIdList:Fe,onScroll:Ce}=te(me,ne,ue,ye),{callLifeCycle:Se}=J(me);r(E,Se),Se("onSetup");const{trigger:He}=T(),{observeFormGraph:xe,setGraph:Ae,removeGraph:Le}=P();r(K,xe);const{lowCodeEventTrigger:Oe}=$(),Re=L({initialValues:me.initialData,effects(e){O("*",(o=>{const t=o.props.name.toString();he.trigger(e,t),ye.trigger(t),ne("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:ge.getContext(t,o.value)}),Oe(o),we(t,o.value),_e(t),Ve(t,o.value)})),R("*",Ae),w("*",Le),me.linebarAutoHidden&&(B("*",He),_((e=>e.query("*").forEach(He)))),me.anchor&&B("*",ve)}}),{lowCodeReactionsHandler:we,triggerAllReactionsHandler:Be}=z(t((()=>me.lowCodeReactions)),Re),{operationalFormHandler:_e,triggerAllOperationalFormHandler:De}=X(t((()=>me.operationalForm)),Re),{wordbookSettingHandler:Ve}=Y(Re,ge);s(Be),s(De);const{schemaAdaptor:Ie}=Z(he);let Ne=me.fieldList||[];const qe=t((()=>me.schema?me.schema:me.fieldList?(Ne=ee().traverse(H(me.fieldList),me.fieldVisitor),se(Ie(Ne))):se({}))),{onKeydown:We}=G({formModel:Re,formRenderRef:ue,props:me}),{clearSpan:Ee}=U();a((()=>Ee(je)));const Ke=M({formModel:Re,formRenderRef:ue,formItemDepsCollector:ye,getFieldList:()=>Ne,formUUID:je});return le({formModel:Re,validate:(e="*")=>Ke.validate(e),getFormValues:(e=!0)=>Ke.getFormValues(e),async setFormValues(e,o={},t=!1,r=!0){var s,a,l,n;let m=!0,d=!0;x(o)?(d=null==(s=o.needSplitExtendKey)||s,m=null==(a=o.avoidDependKeyConnection)||a,t=null!=(l=o.avoidBusinessConnection)&&l,r=null==(n=o.overwrite)||n):A(o)&&(d=o),t&&(he.triggerLock=!0),m&&(ye.triggerDisabled=!0),Ke.setFormValues(e,d,r),await i(),he.triggerLock=!1,ye.triggerDisabled=!1},setFieldState(e,o){Ke.setFieldState(e,o)},resetFields(e="*"){Ke.resetFields(e)},queryWidget:async e=>Ke.queryWidget(e),getFieldList:()=>Ne,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(I),{class:d(["form-render",{"form-render--no-border":!e.bordered,"form-render--underline":"underline"===e.bordered}]),"require-mark-placement":"left",style:p(m(de))},{default:u((()=>[e.anchor?(l(),c("section",ae,[f(m(N),{value:m(ke),"onUpdate:value":t[0]||(t[0]=e=>h(ke)?ke.value=e:null),type:"line",ref_key:"anchorBarRef",ref:be},{default:u((()=>[(l(!0),c(y,null,g(m(Fe),(e=>(l(),n(m(q),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):j("v-if",!0),f(m(W),{"theme-overrides":m(pe)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(ce)}),ref_key:"formRenderRef",ref:ue,onScroll:t[1]||(t[1]=(...e)=>m(Ce)&&m(Ce)(...e)),onKeydownCapture:t[2]||(t[2]=k(((...e)=>m(We)&&m(We)(...e)),["enter"]))},[f(m(D),{form:m(Re)},{default:u((()=>[f(m(fe),{schema:m(qe)},null,8,["schema"]),e.consumer?(l(),n(m(V),{key:0},{default:u((({form:e})=>[b("div",ie,v(JSON.stringify(e.values,null,2)),1)])),_:1})):j("v-if",!0),F(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{le as default};