cnhis-design-vue 3.2.11-release.0 → 3.2.11-release.2

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 (81) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  3. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  4. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  6. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  7. package/es/components/button-print/src/utils/print.js +1 -1
  8. package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
  9. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  10. package/es/components/expand-field/index.d.ts +34 -4
  11. package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +34 -4
  12. package/es/components/expand-field/src/components/PersonModal.vue.d.ts +34 -4
  13. package/es/components/expand-field/src/components/form.vue.d.ts +34 -4
  14. package/es/components/expand-field/src/index.vue.d.ts +34 -4
  15. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  16. package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +3 -3
  17. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  18. package/es/components/form-render/src/utils/business.js +1 -1
  19. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  20. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  21. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue.d.ts +673 -0
  22. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue.js +1 -0
  23. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +1 -0
  24. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/index.d.ts +1 -0
  25. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/index.js +1 -0
  26. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/treeFilter.vue.js +1 -0
  27. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  28. package/es/components/iho-table/src/plugins/index.js +1 -1
  29. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin.js +1 -1
  30. package/es/components/iho-table/src/plugins/rowDragPlugin.js +1 -1
  31. package/es/components/iho-table/src/types/index.d.ts +19 -0
  32. package/es/components/iho-table/src/utils/index.d.ts +17 -0
  33. package/es/components/iho-table/src/utils/index.js +1 -1
  34. package/es/components/iho-table/style/index.css +1 -1
  35. package/es/components/index.css +1 -1
  36. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  37. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  38. package/es/components/select-person/index.d.ts +34 -4
  39. package/es/components/select-person/src/SelectPerson.vue.d.ts +11 -4
  40. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  41. package/es/components/select-person/src/SelectPersonType.vue.d.ts +10 -0
  42. package/es/components/select-person/src/SelectPersonType.vue2.js +1 -1
  43. package/es/components/select-person/src/index.vue.d.ts +34 -4
  44. package/es/components/select-person/src/index.vue2.js +1 -1
  45. package/es/env.d.ts +25 -25
  46. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  47. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  48. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  49. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  50. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  51. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  52. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  53. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  54. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  55. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  56. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  57. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  58. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  59. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  60. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  61. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  62. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  63. package/es/shared/assets/img/failure.png.js +1 -1
  64. package/es/shared/assets/img/logo.png.js +1 -1
  65. package/es/shared/assets/img/no-permission.png.js +1 -1
  66. package/es/shared/assets/img/nodata.png.js +1 -1
  67. package/es/shared/assets/img/notfound.png.js +1 -1
  68. package/es/shared/assets/img/qr.png.js +1 -1
  69. package/es/shared/assets/img/success.png.js +1 -1
  70. package/es/shared/assets/img/table_style_2.png.js +1 -1
  71. package/es/shared/assets/img/video.png.js +1 -1
  72. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  73. package/es/shared/assets/img/xb_big.png.js +1 -1
  74. package/es/shared/assets/img/xb_small.png.js +1 -1
  75. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  76. package/es/shared/hooks/useFormRequest/index.js +1 -1
  77. package/es/shared/hooks/useFormRequest/types.d.ts +4 -0
  78. package/es/shared/package.json.js +1 -1
  79. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  80. package/es/shared/utils/tapable/index.d.ts +139 -0
  81. package/package.json +2 -2
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -1 +1 @@
1
- import{defineComponent as e,inject as t,ref as n,computed as l,watch as a,createVNode as s,createTextVNode as o,mergeProps as i,isVNode as r}from"vue";import{NAvatar as u,NSpin as c,NButton as d,NSpace as m,NIcon as p}from"naive-ui";import{InjectionAIChatEmits as v,InjectionAIChat as f}from"../types/index.js";import g from"../../../../shared/assets/img/ai__avatar.png.js";import h from"../../../../shared/assets/img/logo.png.js";import{isArray as b,isFunction as y}from"lodash-es";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{ChevronForward as x}from"@vicons/ionicons5";import{useScrollLoading as k}from"../../../../shared/hooks/useScrollLoading.js";function S(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!r(e)}var j=e({name:"ChatMain",inheritAttrs:!1,props:{},emits:[],setup(e,{attrs:r,slots:j,emit:C}){const I=t(v),{userAvatar:E,queryData:T,state:_,queryRecord:z,defaultShortcutList:w,hideInput:M=!1,isSmall:N}=t(f),O=n(null),A=n([]),q=n(!1),H=l((()=>N.value?h:g)),J={page:0,hasMore:!0};async function L(e=!1){if(!J.hasMore)return;J.page++,1==J.page&&(A.value=[]);const{records:t,rows:n}=await z.value({page:J.page});b(n)&&A.value.length<=+t&&(A.value=J.page>1?[...A.value,...n]:n,D(),A.value.length>=+t&&(e&&(q.value=!0),J.hasMore=!1,console.log("没有更多消息了")))}function D(){A.value.forEach((e=>{e.buttonType&&(e.disabled=!0),e.contents.forEach((e=>e.disabled=!0))}))}function R(e){const{item:t,msgItem:n,fieldItem:l}=e;if(n)return I("button-click",{item:t,msgItem:n,fieldItem:l}),void A.value.forEach((e=>e.contents.forEach((e=>e.disabled=!0))));A.value.forEach((e=>e.buttonType&&(e.disabled=!0))),t.link||(_.beingSent=!0,_.sendContent="确定")}function B(e,t){const{contentType:n,content:l=""}=t;if("json"!==n||!function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(l))return null;const a=JSON.parse(l),i=["journaling","dashboard"].includes(a.buttonType);return s("div",{class:"card"},[[s("p",null,[a.title]),i?a.fields.map((n=>s(d,{class:"link-btn",style:"--n-height: 36px",secondary:!0,"icon-placement":"right",onClick:()=>R({item:e,msgItem:t,fieldItem:n})},{default:()=>n.name,icon:()=>s(p,{component:x},null)}))):[s("div",{class:"card-body"},[s("p",{class:"card-body__head"},[a.instructionName]),s("div",{class:"card-body__content"},[a.fields.map((e=>s("div",null,[s("span",{class:"label"},[e.name]),o(":"),s("span",null,[e.value])])))])]),s(d,{style:"margin-top: 10px;width: 100%;--n-height: 36px;font-size: 15px",secondary:!0,class:"gradient",disabled:t.disabled,onClick:()=>R({item:e,msgItem:t})},{default:()=>[a.buttonName]})]]])}function F(e,t){const{contents:n=[],buttonType:l=""}=e,a=B(e,n[t]);if(a)return a;return[n[t].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,t,n)=>[e,t===n.length-1?null:s("br",null,null)])),l&&0===t?[s("br",null,null),s(d,i({style:"margin-top: 5px",secondary:!0,class:"gradient",disabled:e.disabled},e.link?{tag:"a",href:e.link,target:"_blank"}:{},{onClick:()=>R({item:e})}),{default:()=>[o("确定")]})]:null]}function G({role:e=""}){return"user"===e}function K(){let e;return s("div",{class:"message-item"},[s(u,{round:!0,size:N.value?64:40,src:H.value},null),s("div",{class:"content-box"},[s("div",{class:"content fillet-10 default"},[s("h2",null,[o("Hi,我是你的AI助理")]),s("p",null,[o("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),s("br",null,null),o("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),b(w.value)&&w.value.length>0?[s("p",{style:"margin: 5px 0 5px"},[o("你可以试着问我:")]),s(m,{"wrap-item":!1},S(e=w.value.map((e=>s(d,{size:"large",secondary:!0,onClick:()=>_.sendContent=e,disabled:_.beingSent},S(e)?e:{default:()=>[e]}))))?e:{default:()=>[e]})]:null])])])}return k(O,(()=>{L()}),M.value?"bottom":"top"),L(!0),a((()=>_.beingSent),(async e=>{var t;if(e){null==(t=O.value)||t.scrollTo({top:0,behavior:"auto"}),A.value.unshift({contents:[{role:"user",content:_.sendContent}]}),D();const e=await T.value({content:_.sendContent,contentType:"text"});b(null==e?void 0:e.contents)&&A.value.unshift(e),_.beingSent=!1,_.sendContent=""}})),()=>s("section",{class:"chat-main",ref:O,style:{"flex-direction":M.value?"column":"column-reverse"}},[[_.beingSent?s("div",{class:"message-item"},[[N.value?null:s(u,{round:!0,size:40,src:H.value},null),s("div",{class:"content-box"},[s("div",{class:"content loading"},[s(c,{size:22,stroke:"#4170EE"},null),s("span",null,[o("正在加载中,请稍等...")])])])]]):null,A.value.map((e=>e.contents.map(((t,n)=>s("div",{class:"message-item"},[[N.value?null:s(u,{round:!0,size:40,src:G(t)?E.value:H.value},null),s("div",{class:["content-box",G(t)?"mine":""]},[s("div",{class:"content"},[y(t.render)?t.render():F(e,n)])])]]))))),q.value?K():null]])}});export{j as default};
1
+ import{defineComponent as e,inject as t,ref as n,computed as l,watch as a,nextTick as s,createVNode as o,createTextVNode as i,mergeProps as r,isVNode as u}from"vue";import{NAvatar as c,NSpin as d,NButton as m,NSpace as p,NIcon as v}from"naive-ui";import{InjectionAIChatEmits as f,InjectionAIChat as g}from"../types/index.js";import h from"../../../../shared/assets/img/ai__avatar.png.js";import b from"../../../../shared/assets/img/logo.png.js";import{isArray as y,isFunction as x}from"lodash-es";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{ChevronForward as k}from"@vicons/ionicons5";import{useScrollLoading as S}from"../../../../shared/hooks/useScrollLoading.js";function j(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!u(e)}var C=e({name:"ChatMain",inheritAttrs:!1,props:{},emits:[],setup(e,{attrs:u,slots:C,emit:I}){const T=t(f),{userAvatar:E,queryData:_,state:w,queryRecord:z,defaultShortcutList:M,hideInput:N=!1,isSmall:O}=t(g),A=n(null),q=n([]),H=n(!1),J=l((()=>O.value?b:h)),L={page:0,hasMore:!0};async function D(e=!1){if(!L.hasMore)return;L.page++,1==L.page&&(q.value=[]);const{records:t,rows:n}=await z.value({page:L.page});y(n)&&q.value.length<=+t&&(q.value=L.page>1?[...q.value,...n]:n,R(),q.value.length>=+t&&(e&&(H.value=!0),L.hasMore=!1,console.log("没有更多消息了")))}function R(){q.value.forEach((e=>{e.buttonType&&(e.disabled=!0),e.contents.forEach((e=>e.disabled=!0))}))}function B(e){const{item:t,msgItem:n,fieldItem:l}=e;if(n)return T("button-click",{item:t,msgItem:n,fieldItem:l}),void q.value.forEach((e=>e.contents.forEach((e=>e.disabled=!0))));q.value.forEach((e=>e.buttonType&&(e.disabled=!0))),t.link||(w.beingSent=!0,w.sendContent="确定")}function F(e,t){const{contentType:n,content:l=""}=t;if("json"!==n||!function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(l))return null;const a=JSON.parse(l),s=["journaling","dashboard"].includes(a.buttonType);return o("div",{class:"card"},[[o("p",null,[a.title]),s?a.fields.map((n=>o(m,{class:"link-btn",style:"--n-height: 36px",secondary:!0,"icon-placement":"right",onClick:()=>B({item:e,msgItem:t,fieldItem:n})},{default:()=>n.name,icon:()=>o(v,{component:k},null)}))):[o("div",{class:"card-body"},[o("p",{class:"card-body__head"},[a.instructionName]),o("div",{class:"card-body__content"},[a.fields.map((e=>o("div",null,[o("span",{class:"label"},[e.name]),i(":"),o("span",null,[e.value])])))])]),o(m,{style:"margin-top: 10px;width: 100%;--n-height: 36px;font-size: 15px",secondary:!0,class:"gradient",disabled:t.disabled,onClick:()=>B({item:e,msgItem:t})},{default:()=>[a.buttonName]})]]])}function G(e,t){const{contents:n=[],buttonType:l=""}=e,a=F(e,n[t]);if(a)return a;return[n[t].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,t,n)=>[e,t===n.length-1?null:o("br",null,null)])),l&&0===t?[o("br",null,null),o(m,r({style:"margin-top: 5px",secondary:!0,class:"gradient",disabled:e.disabled},e.link?{tag:"a",href:e.link,target:"_blank"}:{},{onClick:()=>B({item:e})}),{default:()=>[i("确定")]})]:null]}function K({role:e=""}){return"user"===e}function P(){let e;return o("div",{class:"message-item"},[o(c,{round:!0,size:O.value?64:40,src:J.value},null),o("div",{class:"content-box"},[o("div",{class:"content fillet-10 default"},[o("h2",null,[i("Hi,我是你的AI助理")]),o("p",null,[i("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),o("br",null,null),i("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),y(M.value)&&M.value.length>0?[o("p",{style:"margin: 5px 0 5px"},[i("你可以试着问我:")]),o(p,{"wrap-item":!1},j(e=M.value.map((e=>o(m,{size:"large",secondary:!0,onClick:()=>w.sendContent=e,disabled:w.beingSent},j(e)?e:{default:()=>[e]}))))?e:{default:()=>[e]})]:null])])])}return S(A,(()=>{D()}),N.value?"bottom":"top"),D(!0),a((()=>w.beingSent),(async e=>{var t,n;if(e){q.value.unshift({contents:[{role:"user",content:w.sendContent}]}),null==(t=A.value)||t.scrollTo({top:0,behavior:"auto"}),R();const e=await _.value({content:w.sendContent,contentType:"text"});y(null==e?void 0:e.contents)&&(q.value.unshift(e),await s(),null==(n=A.value)||n.scrollTo({top:0,behavior:"auto"})),w.beingSent=!1,w.sendContent=""}})),()=>o("section",{class:"chat-main",ref:A,style:{"flex-direction":N.value?"column":"column-reverse"}},[[w.beingSent?o("div",{class:"message-item"},[[O.value?null:o(c,{round:!0,size:40,src:J.value},null),o("div",{class:"content-box"},[o("div",{class:"content loading"},[o(d,{size:22,stroke:"#4170EE"},null),o("span",null,[i("正在加载中,请稍等...")])])])]]):null,q.value.map((e=>e.contents.map(((t,n)=>o("div",{class:"message-item"},[[O.value?null:o(c,{round:!0,size:40,src:K(t)?E.value:J.value},null),o("div",{class:["content-box",K(t)?"mine":""]},[o("div",{class:"content"},[x(t.render)?t.render():G(e,n)])])]]))))),H.value?P():null]])}});export{C as default};
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/Viewer';
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/features/modeling';
@@ -0,0 +1 @@
1
+ declare module 'diagram-js/lib/navigation/movecanvas';
@@ -1 +1 @@
1
- import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class b{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.webview}if(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","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=p(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({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)}))}))}async resetPrinter(t,e){const i=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).then((({data:t})=>t))}_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))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:this.printOrigin+"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const r=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const b=await this._testConnection();if(!this._handleResultTest(b,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{b as Print};
1
+ import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class I{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.webview}if(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","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=p(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({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)}))}))}async resetPrinter(t,e){const i=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).then((({data:t})=>t))}_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))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:this.printOrigin+"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const r=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notInstalledApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w):f({type:"notInstalledApp",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const I=await this._testConnection();if(!this._handleResultTest(I,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{I as Print};
@@ -175,9 +175,6 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
- /**
179
- * 改变弹窗大小
180
- */
181
178
  itemKey?: string | Function | undefined;
182
179
  }>, {
183
180
  move: Function;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as t,ref as a,computed as l,onBeforeUnmount as n,watch as o,openBlock as r,createBlock as u,unref as d,isRef as s,createSlots as i,renderList as p,withCtx as c,renderSlot as y,nextTick as f}from"vue";import{NDatePicker as m}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as v,handleInputEvent as h}from"../../../shared/hooks/useDateTime.js";import{isArray as g,isEqual as w,isString as D,isNumber as k}from"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{format as V,sub as S,startOfDay as _,endOfDay as A}from"date-fns";var I=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String},to:{type:[Object,String,Boolean],default:"body"},holidays:{type:Array,default:()=>[]},type:{type:String,default:"date"}},emits:["update:formatted-value"],setup(e,{expose:I,emit:M}){const R=e,C=t(),$=a(null),b=a(null),j=a();let P="";const U=l({get:()=>z(R.formattedValue)?null:R.formattedValue,set(e){g(e)&&g(P)&&w(P,e)||P===e||(M("update:formatted-value",e,D(e)?Date.parse(e):g(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),P=e)}}),q=l((()=>R.type.includes("datetime"))),x=l((()=>Reflect.get(C,"format")?C.format:q.value?"yyyy-MM-dd HH:mm:ss":"month"===R.type?"yyyy-MM":"year"===R.type?"yyyy":"yyyy-MM-dd")),E=l((()=>q.value?x.value.split(" "):"")),{focus:F,blur:H,handleConfirm:L}=v($,{formatRef:x,attrs:{...C,type:R.type},emit:M,allowedInvalidValue:R.allowedInvalidValue});async function B(e){!async function(e){var t;if(!e||!R.holidays.length)return;await f();const a=null==(t=$.value)?void 0:t.panelInstRef;if(!a)return;const l=a.$el;if(!l)return;O(),"daterange"===R.type?Y.push(n((()=>a.startDateArray),".n-date-panel-calendar--start .n-date-panel-dates>div"),n((()=>a.endDateArray),".n-date-panel-calendar--end .n-date-panel-dates>div")):"date"===R.type&&Y.push(n((()=>a.dateArray),".n-date-panel-calendar .n-date-panel-dates>div"));function n(e,t){const a=[],n=o(e,(e=>{a.forEach((e=>e.classList.remove("c-date-picker__holiday"))),a.length=0,g(e)&&Array.from(l.querySelectorAll(t)).forEach(((t,l)=>{const{ts:n}=e[l]||{};if(!k(n))return;const o=new Date(n);R.holidays.some((e=>e.getDate()===o.getDate()&&e.getMonth()===o.getMonth()&&e.getFullYear()===o.getFullYear()))&&(f((()=>t.classList.add("c-date-picker__holiday"))),a.push(t))}))}),{immediate:!0,deep:!0});return()=>{n(),a.length=0}}}(e),e&&q.value&&(await f(),async function e(t=0){var a;t>2||(b.value=null==(a=$.value)?void 0:a.panelInstRef,b.value?v(b,{formatRef:E,attrs:{...C,type:R.type},isPanel:!0}):(await f(),e(++t)))}())}const Y=[];function O(){Y.forEach((e=>e())),Y.length=0}async function T(...e){var t,a,l,n,o,r;const u=null==(n=null==(l=null==(a=null==(t=$.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:n.call(l,"input");if(R.type.includes("range")?null==(o=R.onConfirm)||o.call(R,...e):(await f(),u.focus(),L(u),u.blur(),null==(r=R.onConfirm)||r.call(R,Date.parse(u.value),u.value)),!(null==u?void 0:u.value)||!R.updateUnchangedValue||R.type.includes("range"))return;const d=u.value;h(u,V(new Date,x.value)),h(u,d)}function z(e){return R.allowedInvalidValue&&R.allowedInvalidValue===e}return n(O),o((()=>R.formattedValue),(e=>{j.value=z(e)?e:R.placeholder?R.placeholder:"选择日期时间",z(e)||(P=e)}),{immediate:!0}),I({$datePicker:$,focus:F,blur:H,setShortcutValue:async function(e){if(!R.type||!R.type.includes("range")||!$.value)return;const t=$.value.$el.querySelectorAll(".n-input__input-el");let a,l;const n=new Date;if("week"===e){const e=S(n,{weeks:1});a=V(_(e),x.value)}else{const e=S(n,{months:1});a=V(_(e),x.value)}l=V(A(n),x.value),h(t[0],a),await f(),h(t[1],l)}}),(t,a)=>(r(),u(d(m),{ref_key:"datePickerRef",ref:$,"onUpdate:show":B,onConfirm:T,placeholder:j.value,to:e.to,type:e.type,"formatted-value":d(U),"onUpdate:formatted-value":a[0]||(a[0]=e=>s(U)?U.value=e:null)},i({_:2},[p(t.$slots,((e,a)=>({name:a,fn:c((()=>[y(t.$slots,a)]))})))]),1032,["placeholder","to","type","formatted-value"]))}});export{I as default};
1
+ import{defineComponent as e,useAttrs as t,ref as a,computed as l,onBeforeUnmount as n,watch as o,openBlock as r,createBlock as u,unref as d,isRef as s,createSlots as i,renderList as p,withCtx as c,renderSlot as y,nextTick as f}from"vue";import{promiseTimeout as m}from"@vueuse/shared";import{NDatePicker as v}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as h,handleInputEvent as g}from"../../../shared/hooks/useDateTime.js";import{isArray as w,isEqual as D,isString as k,isNumber as V}from"lodash-es";import"@vue/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{format as S,sub as _,startOfDay as A,endOfDay as I}from"date-fns";var M=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String},to:{type:[Object,String,Boolean],default:"body"},holidays:{type:Array,default:()=>[]},type:{type:String,default:"date"}},emits:["update:formatted-value"],setup(e,{expose:M,emit:R}){const C=e,$=t(),b=a(null),j=a(null),P=a();let U="";const q=l({get:()=>G(C.formattedValue)?null:C.formattedValue,set(e){w(e)&&w(U)&&D(U,e)||U===e||(R("update:formatted-value",e,k(e)?Date.parse(e):w(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),U=e)}}),x=l((()=>C.type.includes("datetime"))),E=l((()=>Reflect.get($,"format")?$.format:x.value?"yyyy-MM-dd HH:mm:ss":"month"===C.type?"yyyy-MM":"year"===C.type?"yyyy":"yyyy-MM-dd")),F=l((()=>x.value?E.value.split(" "):"")),{focus:H,blur:L,handleConfirm:B}=h(b,{formatRef:E,attrs:{...$,type:C.type},emit:R,allowedInvalidValue:C.allowedInvalidValue});async function Y(e){!async function(e){var t;if(!e||!C.holidays.length)return;await m(0);const a=null==(t=b.value)?void 0:t.panelInstRef;if(!a)return;const l=a.$el;if(!l)return;T(),"daterange"===C.type?O.push(n((()=>a.startDateArray),".n-date-panel-calendar--start .n-date-panel-dates>div"),n((()=>a.endDateArray),".n-date-panel-calendar--end .n-date-panel-dates>div")):"date"===C.type&&O.push(n((()=>a.dateArray),".n-date-panel-calendar .n-date-panel-dates>div"));function n(e,t){const a=[],n=o(e,(e=>{a.forEach((e=>e.classList.remove("c-date-picker__holiday"))),a.length=0,w(e)&&Array.from(l.querySelectorAll(t)).forEach(((t,l)=>{const{ts:n}=e[l]||{};if(!V(n))return;const o=new Date(n);C.holidays.some((e=>e.getDate()===o.getDate()&&e.getMonth()===o.getMonth()&&e.getFullYear()===o.getFullYear()))&&(f((()=>t.classList.add("c-date-picker__holiday"))),a.push(t))}))}),{immediate:!0,deep:!0});return()=>{n(),a.length=0}}}(e),e&&x.value&&(await f(),async function e(t=0){var a;t>2||(j.value=null==(a=b.value)?void 0:a.panelInstRef,j.value?h(j,{formatRef:F,attrs:{...$,type:C.type},isPanel:!0}):(await f(),e(++t)))}())}const O=[];function T(){O.forEach((e=>e())),O.length=0}async function z(...e){var t,a,l,n,o,r;const u=null==(n=null==(l=null==(a=null==(t=b.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:n.call(l,"input");if(C.type.includes("range")?null==(o=C.onConfirm)||o.call(C,...e):(await f(),u.focus(),B(u),u.blur(),null==(r=C.onConfirm)||r.call(C,Date.parse(u.value),u.value)),!(null==u?void 0:u.value)||!C.updateUnchangedValue||C.type.includes("range"))return;const d=u.value;g(u,S(new Date,E.value)),g(u,d)}function G(e){return C.allowedInvalidValue&&C.allowedInvalidValue===e}return n(T),o((()=>C.formattedValue),(e=>{P.value=G(e)?e:C.placeholder?C.placeholder:"选择日期时间",G(e)||(U=e)}),{immediate:!0}),M({$datePicker:b,focus:H,blur:L,setShortcutValue:async function(e){if(!C.type||!C.type.includes("range")||!b.value)return;const t=b.value.$el.querySelectorAll(".n-input__input-el");let a,l;const n=new Date;if("week"===e){const e=_(n,{weeks:1});a=S(A(e),E.value)}else{const e=_(n,{months:1});a=S(A(e),E.value)}l=S(I(n),E.value),g(t[0],a),await f(),g(t[1],l)}}),(t,a)=>(r(),u(d(v),{ref_key:"datePickerRef",ref:b,"onUpdate:show":Y,onConfirm:z,placeholder:P.value,to:e.to,type:e.type,"formatted-value":d(q),"onUpdate:formatted-value":a[0]||(a[0]=e=>s(q)?q.value=e:null)},i({_:2},[p(t.$slots,((e,a)=>({name:a,fn:c((()=>[y(t.$slots,a)]))})))]),1032,["placeholder","to","type","formatted-value"]))}});export{M as default};
@@ -518,6 +518,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
518
518
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
519
519
  default: () => {};
520
520
  };
521
+ forceShowSelectAll: {
522
+ type: BooleanConstructor;
523
+ };
521
524
  }, {
522
525
  $attrs: {
523
526
  [x: string]: unknown;
@@ -620,6 +623,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
620
623
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
621
624
  default: () => {};
622
625
  };
626
+ forceShowSelectAll: {
627
+ type: BooleanConstructor;
628
+ };
623
629
  }>> & {
624
630
  onCheck?: ((...args: any[]) => any) | undefined;
625
631
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -708,6 +714,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
708
714
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
709
715
  default: () => {};
710
716
  };
717
+ forceShowSelectAll: {
718
+ type: BooleanConstructor;
719
+ };
711
720
  }, {
712
721
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
713
722
  defaultList: {
@@ -791,6 +800,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
791
800
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
792
801
  default: () => {};
793
802
  };
803
+ forceShowSelectAll: {
804
+ type: BooleanConstructor;
805
+ };
794
806
  }>> & {}>>;
795
807
  emit: any;
796
808
  keyword: import("vue").Ref<string>;
@@ -941,6 +953,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
941
953
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
942
954
  default: () => {};
943
955
  };
956
+ forceShowSelectAll: {
957
+ type: BooleanConstructor;
958
+ };
944
959
  }>>, {
945
960
  data: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../shared/types").AnyObject)[];
946
961
  defaultList: ((string | number) | {
@@ -972,6 +987,7 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
972
987
  switchTypeProps: import("../../shared/types").AnyObject[];
973
988
  switchTypeData: import("../../shared/types").AnyObject;
974
989
  tagProps: import("../../shared/types").AnyObject;
990
+ forceShowSelectAll: boolean;
975
991
  }> | import("vue").DefineComponent<{
976
992
  defaultList: {
977
993
  type: import("vue").PropType<((string | number) | {
@@ -1058,6 +1074,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1058
1074
  children: string;
1059
1075
  };
1060
1076
  };
1077
+ forceShowSelectAll: {
1078
+ type: BooleanConstructor;
1079
+ };
1061
1080
  }, {
1062
1081
  searchFilterBase: {
1063
1082
  isOpen: boolean;
@@ -1069,10 +1088,7 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1069
1088
  key: string;
1070
1089
  label: string;
1071
1090
  }[];
1072
- labelListName: {
1073
- dept: string;
1074
- role: string;
1075
- };
1091
+ labelListName: any;
1076
1092
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
1077
1093
  defaultList: {
1078
1094
  type: import("vue").PropType<((string | number) | {
@@ -1159,6 +1175,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1159
1175
  children: string;
1160
1176
  };
1161
1177
  };
1178
+ forceShowSelectAll: {
1179
+ type: BooleanConstructor;
1180
+ };
1162
1181
  }>> & {}>>;
1163
1182
  emit: any;
1164
1183
  keyword: import("vue").Ref<string>;
@@ -1574,6 +1593,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1574
1593
  children: string;
1575
1594
  };
1576
1595
  };
1596
+ forceShowSelectAll: {
1597
+ type: BooleanConstructor;
1598
+ };
1577
1599
  }>>, {
1578
1600
  data: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../shared/types").AnyObject)[];
1579
1601
  defaultList: ((string | number) | {
@@ -1605,6 +1627,7 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1605
1627
  showSelectType: boolean;
1606
1628
  roleData: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../shared/types").AnyObject)[];
1607
1629
  roleFields: Record<string, any>;
1630
+ forceShowSelectAll: boolean;
1608
1631
  }>>;
1609
1632
  getProps: import("vue").ComputedRef<Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
1610
1633
  defaultList: {
@@ -1704,6 +1727,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1704
1727
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
1705
1728
  default: () => {};
1706
1729
  };
1730
+ forceShowSelectAll: {
1731
+ type: BooleanConstructor;
1732
+ };
1707
1733
  }>> & {
1708
1734
  onCheck?: ((...args: any[]) => any) | undefined;
1709
1735
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -1810,6 +1836,9 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1810
1836
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
1811
1837
  default: () => {};
1812
1838
  };
1839
+ forceShowSelectAll: {
1840
+ type: BooleanConstructor;
1841
+ };
1813
1842
  }>> & {
1814
1843
  onCheck?: ((...args: any[]) => any) | undefined;
1815
1844
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -1847,6 +1876,7 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1847
1876
  switchTypeProps: import("../../shared/types").AnyObject[];
1848
1877
  switchTypeData: import("../../shared/types").AnyObject;
1849
1878
  tagProps: import("../../shared/types").AnyObject;
1879
+ forceShowSelectAll: boolean;
1850
1880
  }>>;
1851
1881
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("check" | "changeModalVisible")[], "check" | "changeModalVisible", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1852
1882
  visible: {
@@ -192,6 +192,9 @@ declare const _default: import("vue").DefineComponent<{
192
192
  type: PropType<import("../../../../shared/types").AnyObject>;
193
193
  default: () => {};
194
194
  };
195
+ forceShowSelectAll: {
196
+ type: BooleanConstructor;
197
+ };
195
198
  }, {
196
199
  $attrs: {
197
200
  [x: string]: unknown;
@@ -294,6 +297,9 @@ declare const _default: import("vue").DefineComponent<{
294
297
  type: PropType<import("../../../../shared/types").AnyObject>;
295
298
  default: () => {};
296
299
  };
300
+ forceShowSelectAll: {
301
+ type: BooleanConstructor;
302
+ };
297
303
  }>> & {
298
304
  onCheck?: ((...args: any[]) => any) | undefined;
299
305
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -382,6 +388,9 @@ declare const _default: import("vue").DefineComponent<{
382
388
  type: PropType<import("../../../../shared/types").AnyObject>;
383
389
  default: () => {};
384
390
  };
391
+ forceShowSelectAll: {
392
+ type: BooleanConstructor;
393
+ };
385
394
  }, {
386
395
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
387
396
  defaultList: {
@@ -465,6 +474,9 @@ declare const _default: import("vue").DefineComponent<{
465
474
  type: PropType<import("../../../../shared/types").AnyObject>;
466
475
  default: () => {};
467
476
  };
477
+ forceShowSelectAll: {
478
+ type: BooleanConstructor;
479
+ };
468
480
  }>> & {}>>;
469
481
  emit: any;
470
482
  keyword: import("vue").Ref<string>;
@@ -615,6 +627,9 @@ declare const _default: import("vue").DefineComponent<{
615
627
  type: PropType<import("../../../../shared/types").AnyObject>;
616
628
  default: () => {};
617
629
  };
630
+ forceShowSelectAll: {
631
+ type: BooleanConstructor;
632
+ };
618
633
  }>>, {
619
634
  data: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../../../shared/types").AnyObject)[];
620
635
  defaultList: ((string | number) | {
@@ -646,6 +661,7 @@ declare const _default: import("vue").DefineComponent<{
646
661
  switchTypeProps: import("../../../../shared/types").AnyObject[];
647
662
  switchTypeData: import("../../../../shared/types").AnyObject;
648
663
  tagProps: import("../../../../shared/types").AnyObject;
664
+ forceShowSelectAll: boolean;
649
665
  }> | import("vue").DefineComponent<{
650
666
  defaultList: {
651
667
  type: PropType<((string | number) | {
@@ -732,6 +748,9 @@ declare const _default: import("vue").DefineComponent<{
732
748
  children: string;
733
749
  };
734
750
  };
751
+ forceShowSelectAll: {
752
+ type: BooleanConstructor;
753
+ };
735
754
  }, {
736
755
  searchFilterBase: {
737
756
  isOpen: boolean;
@@ -743,10 +762,7 @@ declare const _default: import("vue").DefineComponent<{
743
762
  key: string;
744
763
  label: string;
745
764
  }[];
746
- labelListName: {
747
- dept: string;
748
- role: string;
749
- };
765
+ labelListName: any;
750
766
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
751
767
  defaultList: {
752
768
  type: PropType<((string | number) | {
@@ -833,6 +849,9 @@ declare const _default: import("vue").DefineComponent<{
833
849
  children: string;
834
850
  };
835
851
  };
852
+ forceShowSelectAll: {
853
+ type: BooleanConstructor;
854
+ };
836
855
  }>> & {}>>;
837
856
  emit: any;
838
857
  keyword: import("vue").Ref<string>;
@@ -1248,6 +1267,9 @@ declare const _default: import("vue").DefineComponent<{
1248
1267
  children: string;
1249
1268
  };
1250
1269
  };
1270
+ forceShowSelectAll: {
1271
+ type: BooleanConstructor;
1272
+ };
1251
1273
  }>>, {
1252
1274
  data: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../../../shared/types").AnyObject)[];
1253
1275
  defaultList: ((string | number) | {
@@ -1279,6 +1301,7 @@ declare const _default: import("vue").DefineComponent<{
1279
1301
  showSelectType: boolean;
1280
1302
  roleData: (import("naive-ui/es/tree/src/interface").TreeOptionBase & Record<string, unknown> & import("../../../../shared/types").AnyObject)[];
1281
1303
  roleFields: Record<string, any>;
1304
+ forceShowSelectAll: boolean;
1282
1305
  }>>;
1283
1306
  getProps: import("vue").ComputedRef<Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
1284
1307
  defaultList: {
@@ -1378,6 +1401,9 @@ declare const _default: import("vue").DefineComponent<{
1378
1401
  type: PropType<import("../../../../shared/types").AnyObject>;
1379
1402
  default: () => {};
1380
1403
  };
1404
+ forceShowSelectAll: {
1405
+ type: BooleanConstructor;
1406
+ };
1381
1407
  }>> & {
1382
1408
  onCheck?: ((...args: any[]) => any) | undefined;
1383
1409
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -1484,6 +1510,9 @@ declare const _default: import("vue").DefineComponent<{
1484
1510
  type: PropType<import("../../../../shared/types").AnyObject>;
1485
1511
  default: () => {};
1486
1512
  };
1513
+ forceShowSelectAll: {
1514
+ type: BooleanConstructor;
1515
+ };
1487
1516
  }>> & {
1488
1517
  onCheck?: ((...args: any[]) => any) | undefined;
1489
1518
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -1521,6 +1550,7 @@ declare const _default: import("vue").DefineComponent<{
1521
1550
  switchTypeProps: import("../../../../shared/types").AnyObject[];
1522
1551
  switchTypeData: import("../../../../shared/types").AnyObject;
1523
1552
  tagProps: import("../../../../shared/types").AnyObject;
1553
+ forceShowSelectAll: boolean;
1524
1554
  }>>;
1525
1555
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("check" | "changeModalVisible")[], "check" | "changeModalVisible", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1526
1556
  visible: {