cnhis-design-vue 3.2.10-beta.0 → 3.2.10-beta.11

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 (78) hide show
  1. package/es/components/ai-chat/index.d.ts +15 -0
  2. package/es/components/ai-chat/src/Index.vue.d.ts +15 -0
  3. package/es/components/ai-chat/src/Index.vue2.js +1 -1
  4. package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +2 -0
  5. package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
  6. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  7. package/es/components/ai-chat/style/index.css +1 -1
  8. package/es/components/base-search/index.d.ts +2 -0
  9. package/es/components/base-search/src/index.vue.d.ts +2 -0
  10. package/es/components/button-print/src/utils/print.js +1 -1
  11. package/es/components/classification/index.d.ts +1 -1
  12. package/es/components/classification/src/components/search-filter/index.vue.d.ts +1 -1
  13. package/es/components/classification/src/components/set-classification/index.vue.d.ts +1 -1
  14. package/es/components/classification/src/index.vue.d.ts +1 -1
  15. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  16. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  17. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  18. package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
  19. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  20. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  21. package/es/components/field-set/src/components/table-row.vue2.js +1 -1
  22. package/es/components/form-config/index.d.ts +3 -3
  23. package/es/components/form-config/src/FormConfig.vue.d.ts +3 -3
  24. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -3
  25. package/es/components/form-render/index.js +1 -1
  26. package/es/components/form-render/src/components/renderer/text.d.ts +1 -1
  27. package/es/components/form-render/src/components/renderer/text.js +1 -1
  28. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  29. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  30. package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
  31. package/es/components/form-render/src/types/index.d.ts +4 -3
  32. package/es/components/form-render/src/utils/index.d.ts +2 -0
  33. package/es/components/form-render/src/utils/index.js +1 -1
  34. package/es/components/iho-chat/index.d.ts +1 -1
  35. package/es/components/iho-chat/src/Index.vue.d.ts +1 -1
  36. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  37. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +1 -1
  38. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  39. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  40. package/es/components/iho-chat/src/utils/index.d.ts +1 -1
  41. package/es/components/iho-chat/src/utils/index.js +1 -1
  42. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
  43. package/es/components/iho-table/src/plugins/verticalTablePlugin/src/utils.js +1 -1
  44. package/es/components/index.css +1 -1
  45. package/es/components/index.js +1 -1
  46. package/es/components/quick-search/index.d.ts +3 -0
  47. package/es/components/quick-search/src/index.vue.d.ts +3 -0
  48. package/es/components/scale-view/src/components/formitem/r-upload.d.ts +4 -4
  49. package/es/components/scale-view/src/components/formitem/r-upload.js +1 -1
  50. package/es/components/scale-view/src/hooks/use-component.d.ts +10 -8
  51. package/es/components/scale-view/style/index.css +1 -1
  52. package/es/components/shortcut-setter/index.d.ts +1 -1
  53. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  54. package/es/components/table-filter/src/components/bi-filter/helpers/options.d.ts +1 -7
  55. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +1 -1
  56. package/es/components/table-filter/src/components/classify-filter/components/SelectTreeDynamic.vue.d.ts +1 -1
  57. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +1 -1
  58. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +1 -1
  59. package/es/components/table-filter/src/components/render-widget/components/SelectTreeDynamic.vue.d.ts +1 -1
  60. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +5 -5
  61. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.d.ts +3 -49
  62. package/es/components/table-filter/src/components/render-widget/helpers/enums.d.ts +1 -18
  63. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +5 -5
  64. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +1 -0
  65. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  66. package/es/components/table-filter/src/hooks/useMixins.d.ts +1 -1
  67. package/es/components/table-filter/src/hooks/useRenderWidget.js +1 -1
  68. package/es/components/table-filter/src/types/index.d.ts +2 -0
  69. package/es/components/vod-chunk-upload/index.d.ts +2 -0
  70. package/es/components/vod-chunk-upload/src/chunk-upload-new.vue.d.ts +18 -4
  71. package/es/components/vod-chunk-upload/src/chunk-upload-new.vue2.js +1 -1
  72. package/es/components/vod-chunk-upload/src/hooks/upload-data.d.ts +5 -1
  73. package/es/components/vod-chunk-upload/src/hooks/upload-data.js +1 -1
  74. package/es/components/vod-chunk-upload/src/hooks/vod-computed.js +1 -1
  75. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +2 -0
  76. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +1 -1
  77. package/es/shared/package.json.js +1 -1
  78. package/package.json +2 -2
@@ -23,6 +23,10 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
23
23
  uiStyle: {
24
24
  type: StringConstructor;
25
25
  };
26
+ audioTimed: {
27
+ type: NumberConstructor;
28
+ default: number;
29
+ };
26
30
  }, {
27
31
  cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
28
32
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -49,6 +53,10 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
49
53
  uiStyle: {
50
54
  type: StringConstructor;
51
55
  };
56
+ audioTimed: {
57
+ type: NumberConstructor;
58
+ default: number;
59
+ };
52
60
  }>> & {
53
61
  "onButton-click"?: ((...args: any[]) => any) | undefined;
54
62
  }>>;
@@ -67,10 +75,12 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
67
75
  shortcutList: any;
68
76
  state: any;
69
77
  isSmall: any;
78
+ audioTimed: any;
70
79
  content: import("vue").Ref<string>;
71
80
  btnDisabled: import("vue").ComputedRef<boolean>;
72
81
  recorderStart: () => Promise<void>;
73
82
  recorderStop: () => Promise<void>;
83
+ isValidJSON: (str: string) => boolean;
74
84
  getShortcutName: (item: string | import("../../shared/types").AnyObject) => any;
75
85
  handleShortcut: (item: string | import("../../shared/types").AnyObject) => void;
76
86
  handleKeyDown: (event: KeyboardEvent) => void;
@@ -105,9 +115,14 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
105
115
  uiStyle: {
106
116
  type: StringConstructor;
107
117
  };
118
+ audioTimed: {
119
+ type: NumberConstructor;
120
+ default: number;
121
+ };
108
122
  }>> & {
109
123
  "onButton-click"?: ((...args: any[]) => any) | undefined;
110
124
  }, {
111
125
  hideInput: boolean;
126
+ audioTimed: number;
112
127
  }>>;
113
128
  export default AiChat;
@@ -25,6 +25,10 @@ declare const _default: import("vue").DefineComponent<{
25
25
  uiStyle: {
26
26
  type: StringConstructor;
27
27
  };
28
+ audioTimed: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ };
28
32
  }, {
29
33
  cssVars: import("vue").ComputedRef<AnyObject>;
30
34
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -51,6 +55,10 @@ declare const _default: import("vue").DefineComponent<{
51
55
  uiStyle: {
52
56
  type: StringConstructor;
53
57
  };
58
+ audioTimed: {
59
+ type: NumberConstructor;
60
+ default: number;
61
+ };
54
62
  }>> & {
55
63
  "onButton-click"?: ((...args: any[]) => any) | undefined;
56
64
  }>>;
@@ -69,10 +77,12 @@ declare const _default: import("vue").DefineComponent<{
69
77
  shortcutList: any;
70
78
  state: any;
71
79
  isSmall: any;
80
+ audioTimed: any;
72
81
  content: import("vue").Ref<string>;
73
82
  btnDisabled: import("vue").ComputedRef<boolean>;
74
83
  recorderStart: () => Promise<void>;
75
84
  recorderStop: () => Promise<void>;
85
+ isValidJSON: (str: string) => boolean;
76
86
  getShortcutName: (item: string | AnyObject) => any;
77
87
  handleShortcut: (item: string | AnyObject) => void;
78
88
  handleKeyDown: (event: KeyboardEvent) => void;
@@ -107,9 +117,14 @@ declare const _default: import("vue").DefineComponent<{
107
117
  uiStyle: {
108
118
  type: StringConstructor;
109
119
  };
120
+ audioTimed: {
121
+ type: NumberConstructor;
122
+ default: number;
123
+ };
110
124
  }>> & {
111
125
  "onButton-click"?: ((...args: any[]) => any) | undefined;
112
126
  }, {
113
127
  hideInput: boolean;
128
+ audioTimed: number;
114
129
  }>;
115
130
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as t,provide as o,toRefs as r,computed as s,openBlock as i,createElementBlock as a,normalizeClass as n,normalizeStyle as p,unref as u,createVNode as m,createBlock as l,createCommentVNode as d}from"vue";import h from"./components/ChatMain.js";import c from"./components/ChatFooter.vue.js";import{useTheme as y}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"naive-ui";import"../../../shared/hooks/useScrollLoading.js";import{InjectionAIChat as v,InjectionAIChatEmits as S}from"./types/index.js";var f=e({__name:"Index",props:{userAvatar:{type:String},defaultShortcutList:{type:Array},shortcutList:{type:Array},queryData:{type:Function,reuired:!0},queryRecord:{type:Function,reuired:!0},hideInput:{type:Boolean},uiStyle:{type:String}},emits:["button-click"],setup(e,{emit:f}){const j=e,k=y(),g=t({beingSent:!1,sendContent:""});return o(v,{...r(j),state:g,isSmall:s((()=>"small"===j.uiStyle))}),o(S,f),(t,o)=>(i(),a("div",{class:n(["ai-chat","small"===e.uiStyle?"ai-chat--small":""]),style:p(u(k))},[m(u(h)),e.hideInput?d("v-if",!0):(i(),l(c,{key:0}))],6))}});export{f as default};
1
+ import{defineComponent as e,reactive as t,provide as o,toRefs as r,computed as s,openBlock as i,createElementBlock as a,normalizeClass as n,normalizeStyle as u,unref as m,createVNode as p,createBlock as d,createCommentVNode as l}from"vue";import h from"./components/ChatMain.js";import c from"./components/ChatFooter.vue.js";import{useTheme as y}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"naive-ui";import"../../../shared/hooks/useScrollLoading.js";import{InjectionAIChat as v,InjectionAIChatEmits as f}from"./types/index.js";var S=e({__name:"Index",props:{userAvatar:{type:String},defaultShortcutList:{type:Array},shortcutList:{type:Array},queryData:{type:Function,reuired:!0},queryRecord:{type:Function,reuired:!0},hideInput:{type:Boolean},uiStyle:{type:String},audioTimed:{type:Number,default:10}},emits:["button-click"],setup(e,{emit:S}){const j=e,k=y(),g=t({beingSent:!1,sendContent:""});return o(v,{...r(j),state:g,isSmall:s((()=>"small"===j.uiStyle))}),o(f,S),(t,o)=>(i(),a("div",{class:n(["ai-chat","small"===e.uiStyle?"ai-chat--small":""]),style:u(m(k))},[p(m(h)),e.hideInput?l("v-if",!0):(i(),d(c,{key:0}))],6))}});export{S as default};
@@ -6,10 +6,12 @@ declare const _default: import("vue").DefineComponent<{}, {
6
6
  shortcutList: any;
7
7
  state: any;
8
8
  isSmall: any;
9
+ audioTimed: any;
9
10
  content: import("vue").Ref<string>;
10
11
  btnDisabled: import("vue").ComputedRef<boolean>;
11
12
  recorderStart: () => Promise<void>;
12
13
  recorderStop: () => Promise<void>;
14
+ isValidJSON: (str: string) => boolean;
13
15
  getShortcutName: (item: string | AnyObject) => any;
14
16
  handleShortcut: (item: string | AnyObject) => void;
15
17
  handleKeyDown: (event: KeyboardEvent) => void;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as n,ref as t,computed as o,watch as l,onBeforeUnmount as i,openBlock as a,createElementBlock as s,normalizeClass as r,unref as d,Fragment as c,renderList as u,createBlock as f,withCtx as v,createTextVNode as p,toDisplayString as k,createCommentVNode as m,createElementVNode as b,createSlots as h,createVNode as w,getCurrentInstance as y}from"vue";import{NButton as g,NInput as x,NIcon as S}from"naive-ui";import{PaperPlane as C}from"@vicons/ionicons5";import{InjectionAIChatEmits as K,InjectionAIChat as _}from"../types/index.js";import j from"../../../audio-sdk/src/audioSDK.js";import{isString as z}from"lodash-es";const M={key:0,class:"menu-box fillet-8"},E={class:"input-wrapper fillet-10"},R=b("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[b("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),b("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),b("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),b("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),D={class:"btn-box"},F=["disabled"];var N=e({__name:"ChatFooter",setup(e){const N=j.create(),U=n(K),{shortcutList:B,state:J,isSmall:L}=n(_),O=t(""),P=o((()=>!O.value.replace(/(&nbsp;|\s|<br>)+/g,"")));async function T(){await N.recorderStart(y(),{onStop:V,allowPunctuationMark:!1,timed:5,realTimeRecognition:!0})}async function V(){try{const e=await N.recorderStop();if("success"!==e.result)return;const{text:n}=e.data;O.value=n}catch(e){console.log(e)}}function q(e){var n,t;if(z(e))return e;return JSON.parse((null==(t=null==(n=null==e?void 0:e.contents)?void 0:n[0])?void 0:t.content)||"{}").instructionName}function A(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),G()))}function G(){P.value||(J.beingSent=!0,J.sendContent=O.value,O.value="")}return l((()=>J.sendContent),(e=>{e&&!J.beingSent&&(O.value=e)})),i((()=>{N.destroy()})),(e,n)=>(a(),s("section",{class:r(["chat-footer",d(J).beingSent?"disabled":""])},[d(B)&&d(B).length>0?(a(),s("div",M,[(a(!0),s(c,null,u(d(B),(e=>(a(),f(d(g),{secondary:"",size:"small",round:!!d(L),key:q(e),onClick:()=>function(e){var n;if(z(e))O.value=e;else{const t=null==(n=null==e?void 0:e.contents)?void 0:n[0];U("button-click",t,e)}}(e)},{default:v((()=>[p(k(q(e)),1)])),_:2},1032,["round","onClick"])))),128))])):m("v-if",!0),b("div",E,[d(L)?(a(),f(d(x),{key:0,style:{"--n-height":"48px"},round:"",placeholder:"",disabled:d(J).beingSent,value:O.value,"onUpdate:value":n[0]||(n[0]=e=>O.value=e),onKeydown:A},h({_:2},[d(L)?{name:"suffix",fn:v((()=>[w(d(g),{text:"",disabled:d(J).beingSent,onClick:T},{icon:v((()=>[w(d(S),{size:"30"},{default:v((()=>[R])),_:1})])),_:1},8,["disabled"]),w(d(g),{circle:"",class:"gradient",style:{"margin-left":"10px"},disabled:d(P),onClick:G},{icon:v((()=>[w(d(S),{color:"#fff",size:"20",component:d(C)},null,8,["component"])])),_:1},8,["disabled"])])),key:"0"}:void 0]),1032,["disabled","value"])):(a(),s(c,{key:1},[w(d(x),{type:"textarea",placeholder:"请向我提问,Shift+Enter换行",disabled:d(J).beingSent,autosize:{minRows:2,maxRows:7},value:O.value,"onUpdate:value":n[1]||(n[1]=e=>O.value=e),onKeydown:A},null,8,["disabled","value"]),b("div",D,[b("span",{class:r(["btn-send","gradient","fillet-8",d(P)?"disabled":""]),disabled:d(P),onClick:G},[w(d(S),{color:"#fff",size:"22",component:d(C)},null,8,["component"])],10,F)])],64))])],2))}});export{N as default};
1
+ import{defineComponent as e,inject as n,ref as t,computed as o,watch as l,onBeforeUnmount as i,openBlock as a,createElementBlock as s,normalizeClass as r,unref as d,Fragment as c,renderList as u,createBlock as f,withCtx as p,createTextVNode as v,toDisplayString as k,createCommentVNode as m,createElementVNode as b,createVNode as h,getCurrentInstance as w}from"vue";import{NButton as y,NInput as g,NIcon as x}from"naive-ui";import{PaperPlane as S}from"@vicons/ionicons5";import{InjectionAIChatEmits as C,InjectionAIChat as K}from"../types/index.js";import _ from"../../../audio-sdk/src/audioSDK.js";import{isString as j}from"lodash-es";const z={key:0,class:"menu-box fillet-8"},M={class:"input-wrapper fillet-10"},E=b("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[b("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 448h128"}),b("path",{d:"M384 208v32c0 70.4-57.6 128-128 128h0c-70.4 0-128-57.6-128-128v-32",fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),b("path",{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 368v80"}),b("path",{d:"M256 64a63.68 63.68 0 0 0-64 64v111c0 35.2 29 65 64 65s64-29 64-65V128c0-36-28-64-64-64z",fill:"none",stroke:"#4972EF","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"})],-1),N={class:"btn-box"},R=["disabled"];var D=e({__name:"ChatFooter",setup(e){const D=_.create(),F=n(C),{shortcutList:J,state:O,isSmall:T,audioTimed:U}=n(K),B=t(""),I=o((()=>!B.value.replace(/(&nbsp;|\s|<br>)+/g,"")));async function L(){await D.recorderStart(w(),{onStop:P,allowPunctuationMark:!1,timed:U.value||10,realTimeRecognition:!0})}async function P(){try{const e=await D.recorderStop();if("success"!==e.result)return;const{text:n}=e.data;B.value=n}catch(e){console.log(e)}}function V(e){var n,t;if(j(e))return e;const o=null==(t=null==(n=null==e?void 0:e.contents)?void 0:n[0])?void 0:t.content;return(function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(o)?JSON.parse(o):{}).instructionName}function q(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),A()))}function A(){I.value||(O.beingSent=!0,O.sendContent=B.value,B.value="")}return l((()=>O.sendContent),(e=>{e&&!O.beingSent&&(B.value=e)})),i((()=>{D.destroy()})),(e,n)=>(a(),s("section",{class:r(["chat-footer",d(O).beingSent?"disabled":""])},[d(J)&&d(J).length>0?(a(),s("div",z,[(a(!0),s(c,null,u(d(J),(e=>(a(),f(d(y),{secondary:"",size:"small",round:d(T),key:V(e),onClick:()=>function(e){var n;if(j(e))B.value=e;else{const t=null==(n=null==e?void 0:e.contents)?void 0:n[0];F("button-click",{msgItem:t,item:e})}}(e)},{default:p((()=>[v(k(V(e)),1)])),_:2},1032,["round","onClick"])))),128))])):m("v-if",!0),b("div",M,[d(T)?(a(),f(d(g),{key:0,style:{"--n-height":"48px"},round:"",placeholder:"",disabled:d(O).beingSent,value:B.value,"onUpdate:value":n[0]||(n[0]=e=>B.value=e),onKeydown:q},{suffix:p((()=>[h(d(y),{text:"",disabled:d(O).beingSent,onClick:L},{icon:p((()=>[h(d(x),{size:"30"},{default:p((()=>[E])),_:1})])),_:1},8,["disabled"]),h(d(y),{circle:"",class:"gradient",style:{"margin-left":"10px"},disabled:d(I),onClick:A},{icon:p((()=>[h(d(x),{color:"#fff",size:"20",component:d(S)},null,8,["component"])])),_:1},8,["disabled"])])),_:1},8,["disabled","value"])):(a(),s(c,{key:1},[h(d(g),{type:"textarea",placeholder:"请向我提问,Shift+Enter换行",disabled:d(O).beingSent,autosize:{minRows:2,maxRows:7},value:B.value,"onUpdate:value":n[1]||(n[1]=e=>B.value=e),onKeydown:q},null,8,["disabled","value"]),b("div",N,[b("span",{class:r(["btn-send","gradient","fillet-8",d(I)?"disabled":""]),disabled:d(I),onClick:A},[h(d(x),{color:"#fff",size:"22",component:d(S)},null,8,["component"])],10,R)])],64))])],2))}});export{D as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as n,ref as t,computed as l,watch as s,createVNode as a,createTextVNode as o,mergeProps as i,isVNode as r}from"vue";import{NAvatar as u,NSpin as c,NButton as d,NSpace as p,NIcon as m}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 k}from"@vicons/ionicons5";import{useScrollLoading as x}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 E=n(v),{userAvatar:_,queryData:z,state:T,queryRecord:w,defaultShortcutList:I,hideInput:L=!1,isSmall:M}=n(f),N=t(null),O=t([]),A=t(!1),q=l((()=>M.value?h:g)),H={page:0,hasMore:!0};async function J(e=!1){if(!H.hasMore)return;H.page++,1==H.page&&(O.value=[]);const{records:n,rows:t}=await w.value({page:H.page});b(t)&&O.value.length<=+n&&(O.value=H.page>1?[...O.value,...t]:t,D(),O.value.length>=+n&&(e&&(A.value=!0),H.hasMore=!1,console.log("没有更多消息了")))}function D(){O.value.forEach((e=>{e.buttonType&&(e.disabled=!0),e.contents.forEach((e=>e.disabled=!0))}))}function R(e){const{item:n,msgItem:t,isLink:l}=e;if(t)return E("button-click",t,n),void O.value.forEach((e=>e.contents.forEach((e=>e.disabled=!0))));O.value.forEach((e=>e.buttonType&&(e.disabled=!0))),n.link||(T.beingSent=!0,T.sendContent="确定")}function B(e,n){const{contentType:t,content:l=""}=n;if("json"!==t||!function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(l))return null;const s=JSON.parse(l),i=["journaling","dashboard"].includes(s.buttonType);return a("div",{class:"card"},[[a("p",null,[s.title]),i?s.fields.map((t=>a(d,{class:"link-btn",style:"--n-height: 36px",secondary:!0,"icon-placement":"right",onClick:()=>R({item:e,msgItem:n,isLink:i})},{default:()=>t.name,icon:()=>a(m,{component:k},null)}))):[a("div",{class:"card-body"},[a("p",{class:"card-body__head"},[s.instructionName]),a("div",{class:"card-body__content"},[s.fields.map((e=>a("div",null,[a("span",{class:"label"},[e.name]),o(":"),a("span",null,[e.value])])))])]),a(d,{style:"margin-top: 10px;width: 100%;--n-height: 36px;font-size: 15px",secondary:!0,class:"gradient",disabled:n.disabled,onClick:()=>R({item:e,msgItem:n})},{default:()=>[s.buttonName]})]]])}function F(e,n){const{contents:t=[],buttonType:l=""}=e,s=B(e,t[n]);if(s)return s;return[t[n].content.replace(/\\n|\n|\r\n/g,"<br>").split("<br>").filter((e=>!!e)).map(((e,n,t)=>[e,n===t.length-1?null:a("br",null,null)])),l&&0===n?[a("br",null,null),a(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 a("div",{class:"message-item"},[a(u,{round:!0,size:M.value?64:40,src:q.value},null),a("div",{class:"content-box"},[a("div",{class:"content fillet-10 default"},[a("h2",null,[o("Hi,我是你的AI助理")]),a("p",null,[o("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),a("br",null,null),o("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),b(I.value)&&I.value.length>0?[a("p",{style:"margin: 5px 0 5px"},[o("你可以试着问我:")]),a(p,{"wrap-item":!1},S(e=I.value.map((e=>a(d,{size:"large",secondary:!0,onClick:()=>T.sendContent=e,disabled:T.beingSent},S(e)?e:{default:()=>[e]}))))?e:{default:()=>[e]})]:null])])])}return x(N,(()=>{J()}),L.value?"bottom":"top"),J(!0),s((()=>T.beingSent),(async e=>{if(e){O.value.unshift({contents:[{role:"user",content:T.sendContent}]}),D();const e=await z.value({content:T.sendContent,contentType:"text"});b(null==e?void 0:e.contents)&&O.value.unshift(e),T.beingSent=!1,T.sendContent=""}})),()=>a("section",{class:"chat-main",ref:N,style:{"flex-direction":L.value?"column":"column-reverse"}},[[T.beingSent?a("div",{class:"message-item"},[[M.value?null:a(u,{round:!0,size:40,src:q.value},null),a("div",{class:"content-box"},[a("div",{class:"content loading"},[a(c,{size:22,stroke:"#4170EE"},null),a("span",null,[o("正在加载中,请稍等...")])])])]]):null,O.value.map((e=>e.contents.map(((n,t)=>a("div",{class:"message-item"},[[M.value?null:a(u,{round:!0,size:40,src:G(n)?_.value:q.value},null),a("div",{class:["content-box",G(n)?"mine":""]},[a("div",{class:"content"},[y(n.render)?n.render():F(e,t)])])]]))))),A.value?K():null]])}});export{j as default};
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 +1 @@
1
- .c-recording-wrapper{align-items:center;background-color:#fff;border-radius:10px;bottom:100px;display:flex;height:350px;justify-content:center;left:calc(50% - 250px);position:fixed;width:500px}@keyframes toScale{0%{transform:translateX(-50%) translateY(-50%) scale(1)}to{transform:translateX(-50%) translateY(-50%) scale(1.5)}}.c-recording-wrapper .content{font-size:18px;position:absolute;text-align:center;top:20px}.c-recording-wrapper .animation{animation:toScale 1s infinite;background-color:#5585f54d;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) scale(1);z-index:-1}.c-recording-wrapper .animation,.c-recording-wrapper .icon-box{align-items:center;border-radius:50%;display:flex;height:90px;justify-content:center;width:90px}.c-recording-wrapper .icon-box{background-color:#5585f5;cursor:pointer}.c-recording-wrapper .tip{bottom:20px;position:absolute}.ai-chat{background:linear-gradient(135deg,#c9dbfb,#c9dbfb 20%,rgba(237,237,253,.5) 70%,rgba(151,97,251,.2));display:flex;flex-flow:column nowrap;height:100%;padding:45px 0 60px;width:100%}.ai-chat,.ai-chat *{box-sizing:border-box}.ai-chat .fillet-10{border-radius:10px}.ai-chat .fillet-8{border-radius:8px}.ai-chat .n-avatar{background-color:var(--c-primary-color)}.ai-chat .gradient{background:linear-gradient(178deg,#8f66f7,#4170ee);color:#fff}.ai-chat .gradient:active,.ai-chat .gradient:focus,.ai-chat .gradient:hover{color:#fff}.ai-chat .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:auto;padding:0 130px 0 82px;row-gap:16px}.ai-chat .chat-main::-webkit-scrollbar{width:5px}.ai-chat .chat-main::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-main .message-item{column-gap:8px;display:flex;flex-flow:row nowrap}.ai-chat .chat-main .message-item:first-child{margin-bottom:auto}.ai-chat .chat-main .message-item .n-avatar{flex-shrink:0}.ai-chat .chat-main .message-item .content-box .content{background:#fff;border-radius:10px;padding:10px 12px}.ai-chat .chat-main .message-item .content-box .content .card{width:236px}.ai-chat .chat-main .message-item .content-box .content .card>p{font-size:14px;line-height:19px}.ai-chat .chat-main .message-item .content-box .content .card .link-btn{display:flex;flex-flow:row wrap;font-size:14px;justify-content:space-between;margin-top:10px;width:100%}.ai-chat .chat-main .message-item .content-box .content .card .link-btn .n-button__content{display:unset;flex:1;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-main .message-item .content-box .content .card .card-body{border:1px solid #d5d5d5;border-radius:8px;margin-top:5px;overflow:hidden}.ai-chat .chat-main .message-item .content-box .content .card .card-body__head{background:rgba(65,112,238,.14);line-height:36px;padding:0 15px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content{padding:10px 6px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div{display:flex;font-size:12px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div .label{flex:0 0 90px;text-align:right}.ai-chat .chat-main .message-item .content-box .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content-box .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.ai-chat .chat-main .message-item .content-box.mine .content{background:hsla(0,0%,100%,.48);border-radius:8px}.ai-chat .chat-footer{padding:30px 130px 0}.ai-chat .chat-footer.disabled{cursor:not-allowed}.ai-chat .chat-footer .menu-box{background:#fff;column-gap:8px;display:flex;margin-bottom:8px;overflow-x:auto;padding:10px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{width:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{height:5px}.ai-chat .chat-footer .input-wrapper{background:#fff;box-shadow:0 3px 4px 0 rgba(0,0,0,.1);padding:15px 20px}.ai-chat .chat-footer .input-wrapper .n-input__border,.ai-chat .chat-footer .input-wrapper .n-input__state-border{border:none}.ai-chat .chat-footer .input-wrapper .n-input:not(.n-input--disabled).n-input--focus .n-input__state-border{box-shadow:unset}.ai-chat .chat-footer .input-wrapper .btn-box{display:flex;justify-content:flex-end}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send{align-items:center;cursor:pointer;display:flex;height:46px;justify-content:center;width:58px}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send.disabled{cursor:not-allowed;opacity:.5}.ai-chat--small{padding:20px 20px 44px}.ai-chat--small .chat-main{padding:0 0 10px}.ai-chat--small .chat-main .message-item{display:unset}.ai-chat--small .chat-main .message-item .n-avatar{background:transparent}.ai-chat--small .chat-main .message-item .content-box{display:flex;flex-flow:row nowrap}.ai-chat--small .chat-main .message-item .content-box .content{border-radius:3px 14px 14px;max-width:calc(100% - 55px)}.ai-chat--small .chat-main .message-item .content-box .content.default{border-radius:4px 16px 16px}.ai-chat--small .chat-main .message-item .content-box.mine{flex-flow:row-reverse nowrap}.ai-chat--small .chat-main .message-item .content-box.mine .content{background:#5874dc;border-radius:14px 0 14px 14px;color:#fff}.ai-chat--small .chat-footer{padding:10px 0 0}.ai-chat--small .chat-footer .menu-box{background:none;padding:0}.ai-chat--small .chat-footer .menu-box .n-button{background:#fff}.ai-chat--small .chat-footer .input-wrapper{border-radius:24px;box-shadow:0 0 6px 0 hsla(240,9%,85%,.74);padding:0}
1
+ .c-recording-wrapper{align-items:center;background-color:#fff;border-radius:10px;bottom:100px;display:flex;height:350px;justify-content:center;left:calc(50% - 250px);position:fixed;width:500px}@keyframes toScale{0%{transform:translateX(-50%) translateY(-50%) scale(1)}to{transform:translateX(-50%) translateY(-50%) scale(1.5)}}.c-recording-wrapper .content{font-size:18px;position:absolute;text-align:center;top:20px}.c-recording-wrapper .animation{animation:toScale 1s infinite;background-color:#5585f54d;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) scale(1);z-index:-1}.c-recording-wrapper .animation,.c-recording-wrapper .icon-box{align-items:center;border-radius:50%;display:flex;height:90px;justify-content:center;width:90px}.c-recording-wrapper .icon-box{background-color:#5585f5;cursor:pointer}.c-recording-wrapper .tip{bottom:20px;position:absolute}.ai-chat{background:linear-gradient(135deg,#c9dbfb,#c9dbfb 20%,rgba(237,237,253,.5) 70%,rgba(151,97,251,.2));display:flex;flex-flow:column nowrap;font-size:14px;height:100%;padding:45px 0 60px;width:100%}.ai-chat,.ai-chat *{box-sizing:border-box}.ai-chat .fillet-10{border-radius:10px}.ai-chat .fillet-8{border-radius:8px}.ai-chat .n-avatar{background-color:var(--c-primary-color)}.ai-chat .gradient{background:linear-gradient(178deg,#8f66f7,#4170ee);color:#fff}.ai-chat .gradient:active,.ai-chat .gradient:focus,.ai-chat .gradient:hover{color:#fff}.ai-chat .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:auto;padding:0 130px 0 82px;row-gap:16px}.ai-chat .chat-main::-webkit-scrollbar{width:5px}.ai-chat .chat-main::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-main::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-main .message-item{column-gap:8px;display:flex;flex-flow:row nowrap}.ai-chat .chat-main .message-item:first-child{margin-bottom:auto}.ai-chat .chat-main .message-item .n-avatar{flex-shrink:0}.ai-chat .chat-main .message-item .content-box .content{background:#fff;border-radius:10px;flex:unset;padding:10px 12px}.ai-chat .chat-main .message-item .content-box .content .card{width:236px}.ai-chat .chat-main .message-item .content-box .content .card>p{font-size:14px;line-height:19px}.ai-chat .chat-main .message-item .content-box .content .card .link-btn{display:flex;flex-flow:row wrap;font-size:14px;justify-content:space-between;margin-top:10px;width:100%}.ai-chat .chat-main .message-item .content-box .content .card .link-btn .n-button__content{display:unset;flex:1;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ai-chat .chat-main .message-item .content-box .content .card .card-body{border:1px solid #d5d5d5;border-radius:8px;margin-top:5px;overflow:hidden}.ai-chat .chat-main .message-item .content-box .content .card .card-body__head{background:rgba(65,112,238,.14);line-height:36px;padding:0 15px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content{padding:10px 6px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div{display:flex;font-size:12px}.ai-chat .chat-main .message-item .content-box .content .card .card-body__content>div .label{flex:0 0 60px;text-align:right}.ai-chat .chat-main .message-item .content-box .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content-box .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.ai-chat .chat-main .message-item .content-box.mine .content{background:hsla(0,0%,100%,.48);border-radius:8px}.ai-chat .chat-footer{padding:30px 130px 0}.ai-chat .chat-footer.disabled{cursor:not-allowed}.ai-chat .chat-footer .menu-box{background:#fff;column-gap:8px;display:flex;margin-bottom:8px;overflow-x:auto;padding:10px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{width:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-footer .menu-box::-webkit-scrollbar-track-piece{background-color:unset}.ai-chat .chat-footer .menu-box::-webkit-scrollbar{height:5px}.ai-chat .chat-footer .input-wrapper{background:#fff;box-shadow:0 3px 4px 0 rgba(0,0,0,.1);padding:15px 20px}.ai-chat .chat-footer .input-wrapper .n-input__border,.ai-chat .chat-footer .input-wrapper .n-input__state-border{border:none}.ai-chat .chat-footer .input-wrapper .n-input:not(.n-input--disabled).n-input--focus .n-input__state-border{box-shadow:unset}.ai-chat .chat-footer .input-wrapper .btn-box{display:flex;justify-content:flex-end}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send{align-items:center;cursor:pointer;display:flex;height:46px;justify-content:center;width:58px}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send.disabled{cursor:not-allowed;opacity:.5}.ai-chat--small{padding:20px 0 44px}.ai-chat--small .chat-main{padding:0 20px 10px}.ai-chat--small .chat-main .message-item{display:unset}.ai-chat--small .chat-main .message-item .n-avatar{background:transparent}.ai-chat--small .chat-main .message-item .content-box{display:flex;flex-flow:row nowrap}.ai-chat--small .chat-main .message-item .content-box .content{border-radius:3px 14px 14px;max-width:calc(100% - 55px)}.ai-chat--small .chat-main .message-item .content-box .content.default{border-radius:4px 16px 16px}.ai-chat--small .chat-main .message-item .content-box.mine{flex-flow:row-reverse nowrap}.ai-chat--small .chat-main .message-item .content-box.mine .content{background:#5874dc;border-radius:14px 0 14px 14px;color:#fff}.ai-chat--small .chat-footer{padding:10px 20px 0}.ai-chat--small .chat-footer .menu-box{background:none;padding:0}.ai-chat--small .chat-footer .menu-box .n-button{background:#fff}.ai-chat--small .chat-footer .input-wrapper{border-radius:24px;box-shadow:0 0 6px 0 hsla(240,9%,85%,.74);padding:0}
@@ -75,6 +75,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
75
75
  advanceColWidth: number | null | undefined;
76
76
  accurateSearch: any;
77
77
  extendKey: string;
78
+ extendType: string;
78
79
  }[];
79
80
  transformParams: (paramsList: any[]) => any;
80
81
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -152,6 +153,7 @@ declare const CBaseSearch: SFCWithInstall<import("vue").DefineComponent<{
152
153
  accurateSearch?: any;
153
154
  isAccurateSearchVal?: boolean | undefined;
154
155
  extendKey?: string | undefined;
156
+ extendType?: string | undefined;
155
157
  }[]>;
156
158
  filterChangeFnList: import("vue").Ref<any[]>;
157
159
  showQuickSearch: import("vue").ComputedRef<boolean>;
@@ -76,6 +76,7 @@ declare const _default: import("vue").DefineComponent<{
76
76
  advanceColWidth: number | null | undefined;
77
77
  accurateSearch: any;
78
78
  extendKey: string;
79
+ extendType: string;
79
80
  }[];
80
81
  transformParams: (paramsList: any[]) => any;
81
82
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -153,6 +154,7 @@ declare const _default: import("vue").DefineComponent<{
153
154
  accurateSearch?: any;
154
155
  isAccurateSearchVal?: boolean | undefined;
155
156
  extendKey?: string | undefined;
157
+ extendType?: string | undefined;
156
158
  }[]>;
157
159
  filterChangeFnList: import("vue").Ref<any[]>;
158
160
  showQuickSearch: import("vue").ComputedRef<boolean>;
@@ -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:"/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 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};
@@ -1746,7 +1746,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
1746
1746
  }>>;
1747
1747
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1748
1748
  emit: (event: "update:modelValue", ...args: any[]) => void;
1749
- options: import("vue").Ref<never[]>;
1749
+ options: import("vue").Ref<any[]>;
1750
1750
  filterApiConfig: import("../../shared/types").AnyObject;
1751
1751
  classifyFilterList: import("vue").Ref<import("../../shared/types").AnyObject[]>;
1752
1752
  optionSetting: import("vue").ComputedRef<any>;
@@ -1210,7 +1210,7 @@ declare const _default: import("vue").DefineComponent<{
1210
1210
  }>>;
1211
1211
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1212
1212
  emit: (event: "update:modelValue", ...args: any[]) => void;
1213
- options: import("vue").Ref<never[]>;
1213
+ options: import("vue").Ref<any[]>;
1214
1214
  filterApiConfig: import("../../../../../shared/types").AnyObject;
1215
1215
  classifyFilterList: import("vue").Ref<import("../../../../../shared/types").AnyObject[]>;
1216
1216
  optionSetting: import("vue").ComputedRef<any>;
@@ -1504,7 +1504,7 @@ declare const _default: import("vue").DefineComponent<{
1504
1504
  }>>;
1505
1505
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1506
1506
  emit: (event: "update:modelValue", ...args: any[]) => void;
1507
- options: import("vue").Ref<never[]>;
1507
+ options: import("vue").Ref<any[]>;
1508
1508
  filterApiConfig: import("../../../../../shared/types").AnyObject;
1509
1509
  classifyFilterList: import("vue").Ref<import("../../../../../shared/types").AnyObject[]>;
1510
1510
  optionSetting: import("vue").ComputedRef<any>;
@@ -1748,7 +1748,7 @@ declare const _default: import("vue").DefineComponent<{
1748
1748
  }>>;
1749
1749
  getDynamicSelectData: (params: any, filterApiConfig: any) => Promise<any>;
1750
1750
  emit: (event: "update:modelValue", ...args: any[]) => void;
1751
- options: import("vue").Ref<never[]>;
1751
+ options: import("vue").Ref<any[]>;
1752
1752
  filterApiConfig: AnyObject;
1753
1753
  classifyFilterList: import("vue").Ref<AnyObject[]>;
1754
1754
  optionSetting: import("vue").ComputedRef<any>;
@@ -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 s,isRef as d,createSlots as i,renderList as c,withCtx as p,renderSlot as f,nextTick as y}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 R,endOfDay as _}from"date-fns";var A=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:A,emit:I}){const M=e,C=t(),$=a(null),b=a(null),j=a();let P="";const U=l({get:()=>z(M.formattedValue)?null:M.formattedValue,set(e){g(e)&&g(P)&&w(P,e)||P===e||(I("update:formatted-value",e,D(e)?Date.parse(e):g(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),P=e)}}),q=l((()=>{const e=Reflect.get(C,"type")||"";return["datetime","datetimerange"].includes(e)})),x=l((()=>{if(Reflect.get(C,"format"))return C.format;const e=C.type||"";return q.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),E=l((()=>q.value?x.value.split(" "):"")),{focus:F,blur:H,handleConfirm:L}=v($,{formatRef:x,attrs:C,emit:I,allowedInvalidValue:M.allowedInvalidValue});async function B(e){!async function(e){var t;if(!e||!M.holidays.length)return;await y();const a=null==(t=$.value)?void 0:t.panelInstRef;if(!a)return;const l=a.$el;if(!l)return;O(),"daterange"===M.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"===M.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);M.holidays.some((e=>e.getDate()===o.getDate()&&e.getMonth()===o.getMonth()&&e.getFullYear()===o.getFullYear()))&&(y((()=>t.classList.add("c-date-picker__holiday"))),a.push(t))}))}),{immediate:!0,deep:!0});return()=>{n(),a.length=0}}}(e),e&&q.value&&(await y(),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,isPanel:!0}):(await y(),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=Reflect.get(C,"type")||"",s=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(u.includes("range")?null==(o=M.onConfirm)||o.call(M,...e):(await y(),s.focus(),L(s),s.blur(),null==(r=M.onConfirm)||r.call(M,Date.parse(s.value),s.value)),!(null==s?void 0:s.value)||!M.updateUnchangedValue||u.includes("range"))return;const d=s.value;h(s,V(new Date,x.value)),h(s,d)}function z(e){return M.allowedInvalidValue&&M.allowedInvalidValue===e}return n(O),o((()=>M.formattedValue),(e=>{j.value=z(e)?e:M.placeholder?M.placeholder:"选择日期时间",z(e)||(P=e)}),{immediate:!0}),A({$datePicker:$,focus:F,blur:H,setShortcutValue:async function(e){const t=Reflect.get(C,"type")||"";if(!t||!t.includes("range")||!$.value)return;const a=$.value.$el.querySelectorAll(".n-input__input-el");let l,n;const o=new Date;if("week"===e){const e=S(o,{weeks:1});l=V(R(e),x.value)}else{const e=S(o,{months:1});l=V(R(e),x.value)}n=V(_(o),x.value),h(a[0],l),await y(),h(a[1],n)}}),(t,a)=>(r(),u(s(m),{ref_key:"datePickerRef",ref:$,"onUpdate:show":B,onConfirm:T,placeholder:j.value,to:e.to,type:e.type,"formatted-value":s(U),"onUpdate:formatted-value":a[0]||(a[0]=e=>d(U)?U.value=e:null)},i({_:2},[c(t.$slots,((e,a)=>({name:a,fn:p((()=>[f(t.$slots,a)]))})))]),1032,["placeholder","to","type","formatted-value"]))}});export{A 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{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};
@@ -363,7 +363,7 @@ declare const _default: import("vue").DefineComponent<{
363
363
  label: string;
364
364
  value: number;
365
365
  }[];
366
- getSelectText: (field: string) => "密码无需设置" | "主键不可设置" | "不支持脱敏设置" | undefined;
366
+ getSelectText: (field: string) => any;
367
367
  selectProps: (field: string) => {
368
368
  valueField: string;
369
369
  labelField: string;
@@ -385,7 +385,7 @@ declare const _default: import("vue").DefineComponent<{
385
385
  label: string;
386
386
  value: number;
387
387
  }[];
388
- getSelectText: (field: string) => "密码无需设置" | "主键不可设置" | "不支持脱敏设置" | undefined;
388
+ getSelectText: (field: string) => any;
389
389
  selectProps: (field: string) => {
390
390
  valueField: string;
391
391
  labelField: string;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,reactive as l,watch as i,openBlock as a,createElementBlock as d,createElementVNode as r,Fragment as s,renderList as c,normalizeStyle as o,unref as n,createBlock as u,withCtx as p,createTextVNode as m,toDisplayString as f,createCommentVNode as h,createVNode as v,mergeProps as k,renderSlot as b}from"vue";import{NCheckbox as x,NPopconfirm as y,NButton as g}from"naive-ui";import _ from"../../../shared/components/VueDraggable/src/vuedraggable.js";import w from"./components/table-row.vue.js";import{cloneDeep as A}from"lodash-es";import{isShowExplicitRequired as F,setStyle as j}from"./utils/index.js";import{COLUMNLIST_MAP as C}from"./constants/filter.js";const R={class:"main-wrapper"},q={class:"main-wrapper__table"},V={class:"main-wrapper__table-header"},H={class:"main-wrapper__table-body",ref:"tableBodyRef"},S=["tabindex"],U={key:0,class:"main-wrapper__table-footer"};var E=e({__name:"FieldFilter",props:{footerFlag:{type:Boolean,default:!0},defaultList:{type:Array,default:()=>[]}},emits:["save","close","reset"],setup(e,{expose:E,emit:L}){const B=e,O=t([]),T=t([]),D=l({columns:O,data:T,onUpdateChecked:function({checked:e,column:t}){const l=!e||G(t.field);t.checkedAll=!l}}),N=()=>{L("save")},P=()=>{L("close")};function $(){T.value=A(B.defaultList),z(),L("reset")}function z(){O.value=Object.entries(C).map((([e,t])=>{const l=function(e){return e?["isShowSearch","filterExplicit","explicitRequired"].includes(e)?"checkbox":["defaultValue"].includes(e)?"select":["customTitle"].includes(e)?"input":["width"].includes(e)?"inputNumber":"text":"text"}(e),i={isShow:!0,title:t,type:l,field:e};return"checkbox"===l&&Object.assign(i,{checkedAll:!G(e),disabledAll:!1,isHeadCheckHide:["filterExplicit","explicitRequired"].includes(e)}),i}))}function G(e){return T.value.some((t=>("explicitRequired"!==e||F(t))&&!t[e]))}return i((()=>B.defaultList),(e=>{e.length>0&&(T.value=A(e),z())}),{immediate:!0,deep:!0}),E({getTableFields:()=>T.value}),(t,l)=>(a(),d("div",R,[r("div",q,[r("div",V,[(a(!0),d(s,null,c(O.value,((e,t)=>(a(),d(s,{key:t},[e.isShow?(a(),d("span",{key:0,class:"table-cell",style:o(n(j)(e,t))},[r("span",null,["checkbox"!==e.type||e.isHeadCheckHide?(a(),d(s,{key:1},[m(f(e.title),1)],64)):(a(),u(n(x),{key:0,checked:e.checkedAll,"onUpdate:checked":[t=>e.checkedAll=t,t=>{return l=t,i=e.field,void T.value.forEach((e=>{("explicitRequired"!==i||"explicitRequired"===i&&F(e))&&(e[i]=l)}));var l,i}],disabled:e.disabledAll},{default:p((()=>[m(f(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"]))])],4)):h("v-if",!0)],64)))),128))]),r("div",H,[v(n(_),{modelValue:T.value,"onUpdate:modelValue":l[0]||(l[0]=e=>T.value=e),animation:"150","item-key":"id",draggable:".item"},{item:p((({element:e,index:t})=>[e.hide?h("v-if",!0):(a(),d("div",{key:0,class:"item",tabindex:t},[v(w,k(D,{element:e,idx:t+1}),null,16,["element","idx"])],8,S))])),_:1},8,["modelValue"])],512)]),e.footerFlag?(a(),d("div",U,[h(" 底部按钮插槽 "),b(t.$slots,"fieldFilterFooter",{},(()=>[v(n(y),{onPositiveClick:$},{trigger:p((()=>[v(n(g),{style:{"margin-right":"8px"}},{default:p((()=>[m("恢复默认设置")])),_:1})])),default:p((()=>[m(" 确认要恢复系统默认设置吗? ")])),_:1}),v(n(g),{style:{"margin-right":"8px"},onClick:P},{default:p((()=>[m("取消")])),_:1}),v(n(g),{type:"primary",onClick:N},{default:p((()=>[m("保存")])),_:1})]))])):h("v-if",!0)]))}});export{E as default};
1
+ import{defineComponent as e,ref as t,reactive as i,watch as l,openBlock as a,createElementBlock as d,createElementVNode as r,Fragment as s,renderList as o,normalizeStyle as c,unref as n,createBlock as u,withCtx as p,createTextVNode as m,toDisplayString as f,createCommentVNode as h,createVNode as v,mergeProps as k,renderSlot as b}from"vue";import{NCheckbox as x,NPopconfirm as y,NButton as g}from"naive-ui";import _ from"../../../shared/components/VueDraggable/src/vuedraggable.js";import w from"./components/table-row.vue.js";import{cloneDeep as A}from"lodash-es";import{isShowExplicitRequired as F,setStyle as j}from"./utils/index.js";import{COLUMNLIST_MAP as C}from"./constants/filter.js";const R={class:"main-wrapper"},q={class:"main-wrapper__table"},V={class:"main-wrapper__table-header"},H={class:"main-wrapper__table-body",ref:"tableBodyRef"},S=["tabindex"],U={key:0,class:"main-wrapper__table-footer"};var E=e({__name:"FieldFilter",props:{footerFlag:{type:Boolean,default:!0},defaultList:{type:Array,default:()=>[]}},emits:["save","close","reset"],setup(e,{expose:E,emit:L}){const T=e,B=t([]),O=t([]),D=i({columns:B,data:O,onUpdateChecked:function({checked:e,column:t}){const i=!e||G(t.field);t.checkedAll=!i}}),N=()=>{L("save")},P=()=>{L("close")};function $(){O.value=A(T.defaultList),z(),L("reset")}function z(){B.value=Object.entries(C).map((([e,t])=>{const i=function(e){return e?["isShowSearch","filterExplicit","explicitRequired"].includes(e)?"checkbox":["optionType","defaultValue"].includes(e)?"select":["customTitle"].includes(e)?"input":["width"].includes(e)?"inputNumber":"text":"text"}(e),l={isShow:!0,title:t,type:i,field:e};return"checkbox"===i&&Object.assign(l,{checkedAll:!G(e),disabledAll:!1,isHeadCheckHide:["filterExplicit","explicitRequired"].includes(e)}),l}))}function G(e){return O.value.some((t=>("explicitRequired"!==e||F(t))&&!t[e]))}return l((()=>T.defaultList),(e=>{e.length>0&&(O.value=A(e),z())}),{immediate:!0,deep:!0}),E({getTableFields:()=>O.value}),(t,i)=>(a(),d("div",R,[r("div",q,[r("div",V,[(a(!0),d(s,null,o(B.value,((e,t)=>(a(),d(s,{key:t},[e.isShow?(a(),d("span",{key:0,class:"table-cell",style:c(n(j)(e,t))},[r("span",null,["checkbox"!==e.type||e.isHeadCheckHide?(a(),d(s,{key:1},[m(f(e.title),1)],64)):(a(),u(n(x),{key:0,checked:e.checkedAll,"onUpdate:checked":[t=>e.checkedAll=t,t=>{return i=t,l=e.field,void O.value.forEach((e=>{("explicitRequired"!==l||"explicitRequired"===l&&F(e))&&(e[l]=i)}));var i,l}],disabled:e.disabledAll},{default:p((()=>[m(f(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"]))])],4)):h("v-if",!0)],64)))),128))]),r("div",H,[v(n(_),{modelValue:O.value,"onUpdate:modelValue":i[0]||(i[0]=e=>O.value=e),animation:"150","item-key":"id",draggable:".item"},{item:p((({element:e,index:t})=>[e.hide?h("v-if",!0):(a(),d("div",{key:0,class:"item",tabindex:t},[v(w,k(D,{element:e,idx:t+1}),null,16,["element","idx"])],8,S))])),_:1},8,["modelValue"])],512)]),e.footerFlag?(a(),d("div",U,[h(" 底部按钮插槽 "),b(t.$slots,"fieldFilterFooter",{},(()=>[v(n(y),{onPositiveClick:$},{trigger:p((()=>[v(n(g),{style:{"margin-right":"8px"}},{default:p((()=>[m("恢复默认设置")])),_:1})])),default:p((()=>[m(" 确认要恢复系统默认设置吗? ")])),_:1}),v(n(g),{style:{"margin-right":"8px"},onClick:P},{default:p((()=>[m("取消")])),_:1}),v(n(g),{type:"primary",onClick:N},{default:p((()=>[m("保存")])),_:1})]))])):h("v-if",!0)]))}});export{E as default};
@@ -553,7 +553,7 @@ declare const _default: import("vue").DefineComponent<{
553
553
  label: string;
554
554
  value: number;
555
555
  }[];
556
- getSelectText: (field: string) => "密码无需设置" | "主键不可设置" | "不支持脱敏设置" | undefined;
556
+ getSelectText: (field: string) => any;
557
557
  selectProps: (field: string) => {
558
558
  valueField: string;
559
559
  labelField: string;
@@ -216,7 +216,7 @@ declare const _default: import("vue").DefineComponent<{
216
216
  label: string;
217
217
  value: number;
218
218
  }[];
219
- getSelectText: (field: string) => "密码无需设置" | "主键不可设置" | "不支持脱敏设置" | undefined;
219
+ getSelectText: (field: string) => any;
220
220
  selectProps: (field: string) => {
221
221
  valueField: string;
222
222
  labelField: string;
@@ -1 +1 @@
1
- import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as r,unref as a,createBlock as o,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,resolveDynamicComponent as p,normalizeClass as m,withDirectives as v,vShow as y,mergeProps as h,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as k,NCheckbox as x,NPopover as E,NSpace as S,NSelect as D,NColorPicker as w,NInput as T,NInputNumber as O,NPopconfirm as R}from"naive-ui";import{setStyle as M,setColorInfo as N,isShowExplicitRequired as U,isDisable as P}from"../utils/index.js";import{ReorderTwoOutline as _,HelpCircleOutline as j,CaretDownOutline as A,CreateOutline as C,TrashOutline as F}from"@vicons/ionicons5";import{isFunction as L,isArray as H,range as I}from"lodash-es";import{COLOR_MAP as B}from"../constants/index.js";import{WIDGET_TYPE as V,SELECT_MAP as W,WIDGET_MAP as q,SELECT_TYPE as K,SELECT_DEFAULT_MAP as $,DATE_MAP as z,DATETIME_MAP as G}from"../constants/filter.js";const J={class:"row"},Q=["title"],X=c("span",null,"拖拽调整顺序",-1),Y={key:0};var Z=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionOption:{type:Array,default:()=>[]},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["updateChecked","edit"],setup(e,{emit:Z}){const ee=e,te=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],le=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],ie=[{label:"字体",value:"font"},{label:"背景",value:"background"}],ne=Object.entries(B).map((([e])=>e));function re(){ee.data.splice(ee.index,1)}function ae(){Z("edit",ee.element)}function oe(){var e;return ee.element.feildDescribe||(null==(e=ee.element.settingObj)?void 0:e.fieldDescDev)}function de(e){return"seq"===e?ee.idx:"optionType"===e?ee.element[e]&&ee.element.type===V.SELECT?W[ee.element[e]]:"":"type"===e?q[ee.element[e]]:ee.element[e]}function ue(e){if("defaultValue"===e){const{optionType:e}=ee.element;return e===K.SELECT_MULTIPLE}return!1}function se(e){if("0001"==ee.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=ee.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![V.DATE,V.DATETIME,V.SELECT].includes(ee.element.type)||["editable"].includes(e)&&ee.element[`${e}Hide`])}function ce(e){return["explicitRequired","defaultValue"].includes(e)?U(ee.element):!["isSum","isAvg"].includes(e)||"NUMBER"===ee.element.fieldType}function fe(e){const{relation:t}=ee.element;return"isSearch"===e&&H(null==t?void 0:t.fieldList)&&t.fieldList.length>0}function pe(e){if("hideExpression"===e)return"PASSWORD"===ee.element.attrType?"密码无需设置":ee.element.name===ee.primaryKey||ee.element.columnName===ee.primaryKey?"主键不可设置":ee.element.disableDesensitization||ee.element[`${e}Disabled`]?"不支持脱敏设置":void 0}function me(e){const t={valueField:"value",labelField:"label"};return"hideExpression"===e&&(t.valueField="ruleId",t.labelField="name"),t}function ve(e){var t;switch(e.field){case"fixedWay":return te;case"sortDirection":return le;case"sortPriority":return function(){const e=I(1,ee.data.length+1).map((e=>({label:e.toString(),value:e}))),t=ee.data.filter((e=>!!e.sortPriority&&e.uuid!==ee.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return ie;case"hideExpression":return null==(t=ee.hideExpressionOption)?void 0:t.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"defaultValue":{const{type:e,optionInfo:t}=ee.element;return e===V.SELECT?H(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries($).map((([e,t])=>({value:e,label:t}))):e===V.DATE?Object.entries(z).map((([e,t])=>({value:e,label:t}))):e===V.DATETIME?Object.entries(G).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function ye(e){var t;if(1==ee.element.defaultMark||"color"===e.type&&ee.isHighlightRow)return!0;if("checkbox"===e.type){if("show"===e.field&&e.fieldShowMaxValue)return!ee.element[e.field]&&(null==(t=ee.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue;if(["isSearch","isSum","isAvg"].includes(e.field)){if(Reflect.has(ee.element,"isMerge"))return 1==ee.element.isMerge;if("isSearch"===e.field&&Reflect.has(ee.element,"notParticipatingSearch"))return 1==ee.element.notParticipatingSearch}return P(ee.element,e.field)}if("sortPriority"===e.field){const{sortDirection:e}=ee.element;return!e||"NONE"===e}return P(ee.element,e.field)}function he(e){return["title","result"].includes(e.field)&&ee.element.style||{}}return(U,P)=>(t(),l("div",J,[(t(!0),l(i,null,n(e.columns,((U,H)=>{return t(),l(i,{key:H},[U.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[U.field],style:r(a(M)(U,H,e.columnWidthProps))},["text"===U.type?(t(),l(i,{key:0},[0===H?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),o(a(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(_)},null,8,["component"])])),default:d((()=>[X])),_:1})):s("v-if",!0),(I=U.field,"title"===I&&("tooltip"===ee.fieldDescribeMode&&ee.element.feildDescribe||ee.developMode&&(null==(B=ee.element.settingObj)?void 0:B.fieldDescDev))?(t(),o(a(b),{key:1,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(j)},null,8,["component"])])),default:d((()=>[c("span",null,f(oe()),1)])),_:1})):s("v-if",!0)),a(L)(e.titleRender)?(t(),o(p((()=>e.titleRender(e.element))),{key:2})):s("v-if",!0)],64)):s("v-if",!0),0===H&&a(L)(e.titleRender)?s("v-if",!0):(t(),l("span",{key:1,class:m([e.isHighlight&&"title"===U.field?"highlight":""]),style:r(he(U))},f(de(U.field)),7))],64)):s("v-if",!0),"checkbox"===U.type&&se(U.field)?(t(),l(i,{key:1},[v(u(a(x),{disabled:ye(U),checked:e.element[U.field],"onUpdate:checked":[t=>e.element[U.field]=t,e=>function(e,t){Z("updateChecked",{checked:e,column:t})}(e,U)]},null,8,["disabled","checked","onUpdate:checked"]),[[y,ce(U.field)]]),fe(U.field)?(t(),o(a(E),{key:0,placement:"right-start","show-arrow":!1},{trigger:d((()=>[u(a(k),{style:{"margin-left":"5px",top:"2px"},component:a(A)},null,8,["component"])])),default:d((()=>[c("div",null,[c("span",null,f(e.element.relation.tableName),1),u(a(S),{"wrap-item":!1,vertical:""},{default:d((()=>[(t(!0),l(i,null,n(e.element.relation.fieldList,(e=>v((t(),o(a(x),{key:e.id,checked:e.checked,"onUpdate:checked":t=>e.checked=t,label:e.title},null,8,["checked","onUpdate:checked","label"])),[[y,"0001"!==e.sid]]))),128))])),_:1})])])),_:1})):s("v-if",!0)],64)):s("v-if",!0),"select"===U.type&&se(U.field)?(t(),l(i,{key:2},[pe(U.field)?(t(),l("span",Y,f(pe(U.field)),1)):v((t(),o(a(D),h({key:1},me(U.field),{clearable:"",multiple:ue(U.field),disabled:ye(U),value:e.element[U.field],"onUpdate:value":[t=>e.element[U.field]=t,e=>function(e,t){"sortDirection"!==t.field||"NONE"!==e&&e||(ee.element.sortPriority=null),"colorScope"===t.field&&N(ee.element)}(e,U)],options:ve(U)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[y,ce(U.field)]])],64)):s("v-if",!0),"color"===U.type?(t(),o(a(w),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:ye(U),value:e.element[U.field],"onUpdate:value":[t=>e.element[U.field]=t,P[0]||(P[0]=t=>a(N)(e.element))],"show-preview":"",modes:["hex"],swatches:a(ne)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===U.type?v((t(),o(a(T),{key:4,value:e.element[U.field],"onUpdate:value":t=>e.element[U.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[y,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===U.type?(t(),o(a(O),{key:5,value:e.element[U.field],"onUpdate:value":t=>e.element[U.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===U.type&&a(L)(U.contentRender)?(t(),o(p((()=>U.contentRender(U,e.element))),{key:6})):s("v-if",!0),"custom"===U.type&&"opt"===U.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(C),onClick:ae},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(a(R),{onPositiveClick:re},{trigger:d((()=>[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(F)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,Q)):s("v-if",!0)],64);var I,B})),128))]))}});export{Z as default};
1
+ import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as o,unref as r,createBlock as a,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,resolveDynamicComponent as p,normalizeClass as m,withDirectives as v,vShow as y,mergeProps as h,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as k,NCheckbox as x,NPopover as E,NSpace as S,NSelect as T,NColorPicker as D,NInput as w,NInputNumber as O,NPopconfirm as C}from"naive-ui";import{setStyle as R,setColorInfo as M,isShowExplicitRequired as N,isDisable as U}from"../utils/index.js";import{ReorderTwoOutline as F,HelpCircleOutline as P,CaretDownOutline as _,CreateOutline as j,TrashOutline as A}from"@vicons/ionicons5";import{isFunction as L,isArray as H,range as I}from"lodash-es";import{COLOR_MAP as V}from"../constants/index.js";import{WIDGET_MAP as B,SELECT_TYPE as W,WIDGET_TYPE as q,SELECT_MAP as K,SELECT_DEFAULT_MAP as $,DATE_MAP as z,DATETIME_MAP as G}from"../constants/filter.js";const J={class:"row"},Q=["title"],X=c("span",null,"拖拽调整顺序",-1),Y={key:0};var Z=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionOption:{type:Array,default:()=>[]},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["updateChecked","edit"],setup(e,{emit:Z}){const ee=e,te=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],le=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],ie=[{label:"字体",value:"font"},{label:"背景",value:"background"}],ne=Object.entries(V).map((([e])=>e));function oe(){ee.data.splice(ee.index,1)}function re(){Z("edit",ee.element)}function ae(){var e;return ee.element.feildDescribe||(null==(e=ee.element.settingObj)?void 0:e.fieldDescDev)}function de(e){return"seq"===e?ee.idx:"type"===e?B[ee.element[e]]:ee.element[e]}function ue(e){if("defaultValue"===e){const{optionType:e}=ee.element;return e===W.SELECT_MULTIPLE}return!1}function se(e){if("0001"==ee.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=ee.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![q.DATE,q.DATETIME,q.SELECT].includes(ee.element.type)||["editable"].includes(e)&&ee.element[`${e}Hide`])}function ce(e){return["explicitRequired","defaultValue"].includes(e)?N(ee.element):!["isSum","isAvg"].includes(e)||"NUMBER"===ee.element.fieldType}function fe(e){const{relation:t}=ee.element;return"isSearch"===e&&H(null==t?void 0:t.fieldList)&&t.fieldList.length>0}function pe(e){var t,l;return"optionType"===e?(null==(l=null==(t=ee.element)?void 0:t.optionTypeConfig)?void 0:l.option)?"":ee.element[e]&&ee.element.type===q.SELECT?K[ee.element[e]]:" ":"hideExpression"===e?"PASSWORD"===ee.element.attrType?"密码无需设置":ee.element.name===ee.primaryKey||ee.element.columnName===ee.primaryKey?"主键不可设置":ee.element.disableDesensitization||ee.element[`${e}Disabled`]?"不支持脱敏设置":void 0:void 0}function me(e){const t={valueField:"value",labelField:"label"};return"hideExpression"===e&&(t.valueField="ruleId",t.labelField="name"),t}function ve(e){var t,l;switch(e.field){case"fixedWay":return te;case"sortDirection":return le;case"sortPriority":return function(){const e=I(1,ee.data.length+1).map((e=>({label:e.toString(),value:e}))),t=ee.data.filter((e=>!!e.sortPriority&&e.uuid!==ee.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return ie;case"hideExpression":return null==(t=ee.hideExpressionOption)?void 0:t.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"optionType":return(null==(l=ee.element.optionTypeConfig)?void 0:l.option)||[];case"defaultValue":{const{relatedFields:e=[]}=ee.element.optionTypeConfig||{},t=e.find((e=>"defaultValue"===e.field));if(L(null==t?void 0:t.getOption))return t.getOption(ee.element);const{type:l,optionInfo:i}=ee.element;return l===q.SELECT?H(null==i?void 0:i.list)&&i.list.length>0?i.list.map((e=>({...e,label:e.name}))):Object.entries($).map((([e,t])=>({value:e,label:t}))):l===q.DATE?Object.entries(z).map((([e,t])=>({value:e,label:t}))):l===q.DATETIME?Object.entries(G).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function ye(e){var t;if(1==ee.element.defaultMark||"color"===e.type&&ee.isHighlightRow)return!0;if("checkbox"===e.type){if("show"===e.field&&e.fieldShowMaxValue)return!ee.element[e.field]&&(null==(t=ee.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue;if(["isSearch","isSum","isAvg"].includes(e.field)){if(Reflect.has(ee.element,"isMerge"))return 1==ee.element.isMerge;if("isSearch"===e.field&&Reflect.has(ee.element,"notParticipatingSearch"))return 1==ee.element.notParticipatingSearch}return U(ee.element,e.field)}if("sortPriority"===e.field){const{sortDirection:e}=ee.element;return!e||"NONE"===e}return U(ee.element,e.field)}function he(e){return["title","result"].includes(e.field)&&ee.element.style||{}}return(N,U)=>(t(),l("div",J,[(t(!0),l(i,null,n(e.columns,((N,H)=>{return t(),l(i,{key:H},[N.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[N.field],style:o(r(R)(N,H,e.columnWidthProps))},["text"===N.type?(t(),l(i,{key:0},[0===H?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),a(r(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(r(k),{style:{"margin-right":"5px",top:"2px"},component:r(F)},null,8,["component"])])),default:d((()=>[X])),_:1})):s("v-if",!0),(I=N.field,"title"===I&&("tooltip"===ee.fieldDescribeMode&&ee.element.feildDescribe||ee.developMode&&(null==(V=ee.element.settingObj)?void 0:V.fieldDescDev))?(t(),a(r(b),{key:1,trigger:"hover"},{trigger:d((()=>[u(r(k),{style:{"margin-right":"5px",top:"2px"},component:r(P)},null,8,["component"])])),default:d((()=>[c("span",null,f(ae()),1)])),_:1})):s("v-if",!0)),r(L)(e.titleRender)?(t(),a(p((()=>e.titleRender(e.element))),{key:2})):s("v-if",!0)],64)):s("v-if",!0),0===H&&r(L)(e.titleRender)?s("v-if",!0):(t(),l("span",{key:1,class:m([e.isHighlight&&"title"===N.field?"highlight":""]),style:o(he(N))},f(de(N.field)),7))],64)):s("v-if",!0),"checkbox"===N.type&&se(N.field)?(t(),l(i,{key:1},[v(u(r(x),{disabled:ye(N),checked:e.element[N.field],"onUpdate:checked":[t=>e.element[N.field]=t,e=>function(e,t){Z("updateChecked",{checked:e,column:t})}(e,N)]},null,8,["disabled","checked","onUpdate:checked"]),[[y,ce(N.field)]]),fe(N.field)?(t(),a(r(E),{key:0,placement:"right-start","show-arrow":!1},{trigger:d((()=>[u(r(k),{style:{"margin-left":"5px",top:"2px"},component:r(_)},null,8,["component"])])),default:d((()=>[c("div",null,[c("span",null,f(e.element.relation.tableName),1),u(r(S),{"wrap-item":!1,vertical:""},{default:d((()=>[(t(!0),l(i,null,n(e.element.relation.fieldList,(e=>v((t(),a(r(x),{key:e.id,checked:e.checked,"onUpdate:checked":t=>e.checked=t,label:e.title},null,8,["checked","onUpdate:checked","label"])),[[y,"0001"!==e.sid]]))),128))])),_:1})])])),_:1})):s("v-if",!0)],64)):s("v-if",!0),"select"===N.type&&se(N.field)?(t(),l(i,{key:2},[pe(N.field)?(t(),l("span",Y,f(pe(N.field)),1)):v((t(),a(r(T),h({key:1},me(N.field),{clearable:"",multiple:ue(N.field),disabled:ye(N),value:e.element[N.field],"onUpdate:value":[t=>e.element[N.field]=t,e=>function(e,t){if("sortDirection"!==t.field||"NONE"!==e&&e||(ee.element.sortPriority=null),"colorScope"===t.field&&M(ee.element),"optionType"===t.field){const{relatedFields:e=[]}=ee.element.optionTypeConfig||{};e.forEach((e=>{ee.element[e.field]=null}))}}(e,N)],options:ve(N)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[y,ce(N.field)]])],64)):s("v-if",!0),"color"===N.type?(t(),a(r(D),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:ye(N),value:e.element[N.field],"onUpdate:value":[t=>e.element[N.field]=t,U[0]||(U[0]=t=>r(M)(e.element))],"show-preview":"",modes:["hex"],swatches:r(ne)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===N.type?v((t(),a(r(w),{key:4,value:e.element[N.field],"onUpdate:value":t=>e.element[N.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[y,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===N.type?(t(),a(r(O),{key:5,value:e.element[N.field],"onUpdate:value":t=>e.element[N.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===N.type&&r(L)(N.contentRender)?(t(),a(p((()=>N.contentRender(N,e.element))),{key:6})):s("v-if",!0),"custom"===N.type&&"opt"===N.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[u(r(b),{trigger:"hover"},{trigger:d((()=>[u(r(k),{component:r(j),onClick:re},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(r(C),{onPositiveClick:oe},{trigger:d((()=>[u(r(b),{trigger:"hover"},{trigger:d((()=>[u(r(k),{component:r(A)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,Q)):s("v-if",!0)],64);var I,V})),128))]))}});export{Z as default};
@@ -1900,7 +1900,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1900
1900
  prefix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
1901
1901
  suffix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
1902
1902
  allowSlash?: string | boolean | undefined;
1903
- allowModify?: "0" | "1" | undefined;
1903
+ allowModify?: import("..").FormCommonState | undefined;
1904
1904
  show_key?: string | undefined;
1905
1905
  whiteList?: string[] | undefined;
1906
1906
  bordered?: string | boolean | undefined;
@@ -2148,7 +2148,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2148
2148
  prefix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
2149
2149
  suffix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
2150
2150
  allowSlash?: string | boolean | undefined;
2151
- allowModify?: "0" | "1" | undefined;
2151
+ allowModify?: import("..").FormCommonState | undefined;
2152
2152
  show_key?: string | undefined;
2153
2153
  whiteList?: string[] | undefined;
2154
2154
  bordered?: string | boolean | undefined;
@@ -2367,7 +2367,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2367
2367
  prefix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
2368
2368
  suffix?: string | import("../../shared/types").AnyObject | (() => any) | undefined;
2369
2369
  allowSlash?: string | boolean | undefined;
2370
- allowModify?: "0" | "1" | undefined;
2370
+ allowModify?: import("..").FormCommonState | undefined;
2371
2371
  show_key?: string | undefined;
2372
2372
  whiteList?: string[] | undefined;
2373
2373
  bordered?: string | boolean | undefined;