cnhis-design-vue 3.2.8-release.3 → 3.2.8
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.
- package/README.md +87 -87
- package/es/components/ai-chat/index.d.ts +12 -1
- package/es/components/ai-chat/src/Index.vue.d.ts +12 -1
- package/es/components/ai-chat/src/Index.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/ai-chat/src/components/ChatMain.js +1 -1
- package/es/components/ai-chat/src/types/index.d.ts +14 -6
- package/es/components/ai-chat/style/index.css +1 -1
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
- package/es/components/iho-chat/index.d.ts +3 -1
- package/es/components/iho-chat/src/Index.vue.d.ts +3 -1
- package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -1
- package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +2 -0
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
- package/es/components/iho-chat/src/utils/index.js +1 -1
- package/es/components/iho-chat/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/Select.vue.d.ts +3 -0
- package/es/components/table-filter/src/components/render-widget/components/Select.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +3 -0
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +3 -0
- package/es/shared/assets/img/ai__avatar.png.js +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,87 +1,87 @@
|
|
1
|
-
# 安装
|
2
|
-
|
3
|
-
```shell
|
4
|
-
npm i cnhis-design-vue@[版本号]
|
5
|
-
# or
|
6
|
-
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
-
```
|
8
|
-
|
9
|
-
## 1.全局引入
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
// main.ts
|
13
|
-
import { createApp } from 'vue';
|
14
|
-
import App from './App.vue';
|
15
|
-
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
-
import cui from 'cnhis-design-vue';
|
17
|
-
|
18
|
-
const app = createApp(App);
|
19
|
-
app.use(cui).mount('#app');
|
20
|
-
```
|
21
|
-
|
22
|
-
## 2. 按需引入
|
23
|
-
|
24
|
-
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
-
|
26
|
-
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
-
|
28
|
-
```shell
|
29
|
-
# 安装自动导入样式的插件
|
30
|
-
npm i -d vite-plugin-style-import
|
31
|
-
```
|
32
|
-
|
33
|
-
```typescript
|
34
|
-
// vite.config.ts
|
35
|
-
import { defineConfig } from 'vite';
|
36
|
-
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
-
|
38
|
-
export default defineConfig({
|
39
|
-
plugins: [
|
40
|
-
// ...otherPlugins
|
41
|
-
createStyleImportPlugin({
|
42
|
-
libs: [
|
43
|
-
{
|
44
|
-
libraryName: 'cnhis-design-vue',
|
45
|
-
esModule: true,
|
46
|
-
ensureStyleFile: true,
|
47
|
-
resolveStyle: name => {
|
48
|
-
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
]
|
52
|
-
})
|
53
|
-
]
|
54
|
-
});
|
55
|
-
```
|
56
|
-
|
57
|
-
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
-
|
59
|
-
```typescript
|
60
|
-
// main.ts
|
61
|
-
import 'cnhis-design-vue/es/components/index.css';
|
62
|
-
```
|
63
|
-
|
64
|
-
## 3.FAQ
|
65
|
-
|
66
|
-
### 3.1 项目打包后样式丢失
|
67
|
-
|
68
|
-
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
-
|
70
|
-
```typescript
|
71
|
-
// vite.config.ts
|
72
|
-
import { defineConfig } from 'vite';
|
73
|
-
|
74
|
-
export default defineConfig({
|
75
|
-
build: {
|
76
|
-
rollupOptions: {
|
77
|
-
// ..otherOptions
|
78
|
-
output: {
|
79
|
-
dir: './dist',
|
80
|
-
manualChunks: {
|
81
|
-
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
});
|
87
|
-
```
|
1
|
+
# 安装
|
2
|
+
|
3
|
+
```shell
|
4
|
+
npm i cnhis-design-vue@[版本号]
|
5
|
+
# or
|
6
|
+
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
+
```
|
8
|
+
|
9
|
+
## 1.全局引入
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
// main.ts
|
13
|
+
import { createApp } from 'vue';
|
14
|
+
import App from './App.vue';
|
15
|
+
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
+
import cui from 'cnhis-design-vue';
|
17
|
+
|
18
|
+
const app = createApp(App);
|
19
|
+
app.use(cui).mount('#app');
|
20
|
+
```
|
21
|
+
|
22
|
+
## 2. 按需引入
|
23
|
+
|
24
|
+
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
+
|
26
|
+
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
+
|
28
|
+
```shell
|
29
|
+
# 安装自动导入样式的插件
|
30
|
+
npm i -d vite-plugin-style-import
|
31
|
+
```
|
32
|
+
|
33
|
+
```typescript
|
34
|
+
// vite.config.ts
|
35
|
+
import { defineConfig } from 'vite';
|
36
|
+
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
+
|
38
|
+
export default defineConfig({
|
39
|
+
plugins: [
|
40
|
+
// ...otherPlugins
|
41
|
+
createStyleImportPlugin({
|
42
|
+
libs: [
|
43
|
+
{
|
44
|
+
libraryName: 'cnhis-design-vue',
|
45
|
+
esModule: true,
|
46
|
+
ensureStyleFile: true,
|
47
|
+
resolveStyle: name => {
|
48
|
+
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
})
|
53
|
+
]
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
+
|
59
|
+
```typescript
|
60
|
+
// main.ts
|
61
|
+
import 'cnhis-design-vue/es/components/index.css';
|
62
|
+
```
|
63
|
+
|
64
|
+
## 3.FAQ
|
65
|
+
|
66
|
+
### 3.1 项目打包后样式丢失
|
67
|
+
|
68
|
+
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
+
|
70
|
+
```typescript
|
71
|
+
// vite.config.ts
|
72
|
+
import { defineConfig } from 'vite';
|
73
|
+
|
74
|
+
export default defineConfig({
|
75
|
+
build: {
|
76
|
+
rollupOptions: {
|
77
|
+
// ..otherOptions
|
78
|
+
output: {
|
79
|
+
dir: './dist',
|
80
|
+
manualChunks: {
|
81
|
+
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
```
|
@@ -18,6 +18,9 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
18
18
|
type: import("vue").PropType<import("./src/types").QueryRecord>;
|
19
19
|
reuired: boolean;
|
20
20
|
};
|
21
|
+
hideInput: {
|
22
|
+
type: BooleanConstructor;
|
23
|
+
};
|
21
24
|
}, {
|
22
25
|
cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
|
23
26
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
@@ -39,6 +42,9 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
39
42
|
type: import("vue").PropType<import("./src/types").QueryRecord>;
|
40
43
|
reuired: boolean;
|
41
44
|
};
|
45
|
+
hideInput: {
|
46
|
+
type: BooleanConstructor;
|
47
|
+
};
|
42
48
|
}>> & {}>>;
|
43
49
|
state: import("../../shared/types").AnyObject;
|
44
50
|
ChatMain: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
|
@@ -80,5 +86,10 @@ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
80
86
|
type: import("vue").PropType<import("./src/types").QueryRecord>;
|
81
87
|
reuired: boolean;
|
82
88
|
};
|
83
|
-
|
89
|
+
hideInput: {
|
90
|
+
type: BooleanConstructor;
|
91
|
+
};
|
92
|
+
}>>, {
|
93
|
+
hideInput: boolean;
|
94
|
+
}>>;
|
84
95
|
export default AiChat;
|
@@ -20,6 +20,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
20
20
|
type: PropType<QueryRecord>;
|
21
21
|
reuired: boolean;
|
22
22
|
};
|
23
|
+
hideInput: {
|
24
|
+
type: BooleanConstructor;
|
25
|
+
};
|
23
26
|
}, {
|
24
27
|
cssVars: import("vue").ComputedRef<AnyObject>;
|
25
28
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
@@ -41,6 +44,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
41
44
|
type: PropType<QueryRecord>;
|
42
45
|
reuired: boolean;
|
43
46
|
};
|
47
|
+
hideInput: {
|
48
|
+
type: BooleanConstructor;
|
49
|
+
};
|
44
50
|
}>> & {}>>;
|
45
51
|
state: AnyObject;
|
46
52
|
ChatMain: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
|
@@ -82,5 +88,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
82
88
|
type: PropType<QueryRecord>;
|
83
89
|
reuired: boolean;
|
84
90
|
};
|
85
|
-
|
91
|
+
hideInput: {
|
92
|
+
type: BooleanConstructor;
|
93
|
+
};
|
94
|
+
}>>, {
|
95
|
+
hideInput: boolean;
|
96
|
+
}>;
|
86
97
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,reactive as t,provide as
|
1
|
+
import{defineComponent as e,reactive as t,provide as o,toRefs as r,openBlock as s,createElementBlock as i,normalizeStyle as n,unref as a,createVNode as p,createBlock as u,createCommentVNode as m}from"vue";import d from"./components/ChatMain.js";import h from"./components/ChatFooter.vue.js";import{useTheme as c}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 y}from"./types/index.js";var v=e({__name:"Index",props:{userAvatar:{type:String,required:!0},defaultShortcutList:{type:Array},shortcutList:{type:Array},queryData:{type:Function,reuired:!0},queryRecord:{type:Function,reuired:!0},hideInput:{type:Boolean}},setup(e){const v=e,l=c(),f=t({beingSent:!1,sendContent:""});return o(y,{...r(v),state:f}),(t,o)=>(s(),i("div",{class:"ai-chat",style:n(a(l))},[p(a(d)),e.hideInput?m("v-if",!0):(s(),u(h,{key:0}))],4))}});export{v as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as n,ref as t,computed as l,watch as a,openBlock as i,createElementBlock as o,normalizeClass as s,unref as u,Fragment as r,renderList as
|
1
|
+
import{defineComponent as e,inject as n,ref as t,computed as l,watch as a,openBlock as i,createElementBlock as o,normalizeClass as s,unref as u,Fragment as r,renderList as d,createBlock as c,withCtx as v,createTextVNode as f,toDisplayString as p,createCommentVNode as b,createElementVNode as m,createVNode as y}from"vue";import{NButton as g,NInput as h,NIcon as x}from"naive-ui";import{PaperPlane as k}from"@vicons/ionicons5";import{InjectionAIChat as C}from"../types/index.js";const K={key:0,class:"menu-box fillet-8"},S={class:"input-wrapper fillet-10"},w={class:"input-box"},z={class:"btn-box"},_=["disabled"];var E=e({__name:"ChatFooter",setup(e){const{shortcutList:E,state:R}=n(C),j=t(""),D=l((()=>!j.value.replace(/( |\s|<br>)+/g,"")));function F(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),L()))}function L(){D.value||(R.beingSent=!0,R.sendContent=j.value,j.value="")}return a((()=>R.sendContent),(e=>{e&&!R.beingSent&&(j.value=e)})),(e,n)=>(i(),o("section",{class:s(["chat-footer",u(R).beingSent?"disabled":""])},[u(E)&&u(E).length>0?(i(),o("div",K,[(i(!0),o(r,null,d(u(E),(e=>(i(),c(u(g),{secondary:"",size:"small",key:e,onClick:n=>j.value=e},{default:v((()=>[f(p(e),1)])),_:2},1032,["onClick"])))),128))])):b("v-if",!0),m("div",S,[m("div",w,[y(u(h),{type:"textarea",placeholder:"请向我提问,Shift+Enter换行",disabled:u(R).beingSent,autosize:{minRows:2,maxRows:7},value:j.value,"onUpdate:value":n[0]||(n[0]=e=>j.value=e),onKeydown:F},null,8,["disabled","value"])]),m("div",z,[m("span",{class:s(["btn-send","gradient","fillet-8",u(D)?"disabled":""]),disabled:u(D),onClick:L},[y(u(x),{color:"#fff",size:"22",component:u(k)},null,8,["component"])],10,_)])])],2))}});export{E as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as t,ref as n,watch as
|
1
|
+
import{defineComponent as e,inject as t,ref as n,watch as l,createVNode as s,createTextVNode as a,mergeProps as o,isVNode as r}from"vue";import{NAvatar as i,NSpin as u,NButton as c,NSpace as d}from"naive-ui";import{InjectionAIChat as p}from"../types/index.js";import m from"../../../../shared/assets/img/ai__avatar.png.js";import{isArray as v,isFunction as f}from"lodash";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as g}from"../../../../shared/hooks/useScrollLoading.js";function h(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!r(e)}var b=e({name:"ChatMain",inheritAttrs:!1,props:{},emits:[],setup(e,{attrs:r,slots:b,emit:y}){const{userAvatar:k,queryData:C,state:S,queryRecord:j,defaultShortcutList:x,hideInput:z=!1}=t(p),w=n(null),M=n([]),A=n(!1),_={page:0,hasMore:!0};let q=!1;async function E(e=!1){if(!_.hasMore)return;_.page++,1==_.page&&(M.value=[]);const{records:t,rows:n}=await j.value({page:_.page});v(n)&&M.value.length<=+t&&(M.value=_.page>1?[...M.value,...n]:n,M.value.length>=+t&&(e&&(A.value=!0),_.hasMore=!1,console.log("没有更多消息了")))}function H({content:e="",button:t={}}){const n=e.replace(/\\n|\n|\r/g,"<br>").split("<br>").map(((e,t,n)=>[e,t===n.length-1?null:s("br",null,null)])),l=t.content?[s("br",null,null),s(c,o({secondary:!0,class:"gradient",disabled:t.disabled},t.link?{tag:"a",href:t.link,target:"_blank"}:{},{onClick:()=>function(e){e.link||(q=!0,S.beingSent=!0,S.sendContent=e.content,e.disabled=!0)}(t)}),{default:()=>[t.content]})]:null;return[n,l]}function I({role:e=""}){return"user"===e}function L(){let e;return s("div",{class:"message-item"},[s(i,{round:!0,size:40,src:m},null),s("div",{class:"content fillet-10 default"},[s("h2",null,[a("Hi,我是你的AI助理")]),s("p",null,[a("我汇集了医生站/护士站各项智能服务,可以向我进行提问哦 ~ "),s("br",null,null),a("你的反馈助我成长,期待我们一起探索未来!下次可以在首页和应用页找到我~")]),v(x.value)&&x.value.length>0?[s("p",{style:"margin: 5px 0 5px"},[a("你可以试着问我:")]),s(d,{"wrap-item":!1},h(e=x.value.map((e=>s(c,{size:"large",secondary:!0,onClick:()=>S.sendContent=e,disabled:S.beingSent},h(e)?e:{default:()=>[e]}))))?e:{default:()=>[e]})]:null])])}return g(w,(()=>{E()}),z.value?"bottom":"top"),E(!0),l((()=>S.beingSent),(async e=>{if(e){q||M.value.unshift({role:"user",content:S.sendContent}),q=!1;const e=await C.value({content:S.sendContent,contentType:"text"});v(e)&&M.value.unshift(...e),S.beingSent=!1,S.sendContent=""}})),()=>s("section",{class:"chat-main",ref:w,style:{"flex-direction":z.value?"column":"column-reverse"}},[[S.beingSent?s("div",{class:"message-item"},[s(i,{round:!0,size:40,src:m},null),s("div",{class:"content fillet-10 loading"},[s(u,{size:22,stroke:"#4170EE"},null),s("span",null,[a("正在加载中,请稍等...")])])]):null,M.value.map((e=>s("div",{class:"message-item"},[s(i,{round:!0,size:40,src:I(e)?k.value:m},null),s("div",{class:["content",I(e)?"fillet-8 mine":"fillet-10"]},[f(e.render)?e.render():H(e)])]))),A.value?L():null]])}});export{b as default};
|
@@ -2,6 +2,16 @@ import { InjectionKey, VNodeChild } from 'vue';
|
|
2
2
|
import { AnyObject } from '../../../../shared/types';
|
3
3
|
export declare const InjectionAIChat: InjectionKey<AnyObject>;
|
4
4
|
export declare const InjectionAIChatEmits: InjectionKey<(event: string, ...args: any[]) => void>;
|
5
|
+
export type MessageList = Array<{
|
6
|
+
role: string;
|
7
|
+
content: string;
|
8
|
+
render?: () => VNodeChild;
|
9
|
+
button?: {
|
10
|
+
content: string;
|
11
|
+
link: string;
|
12
|
+
};
|
13
|
+
[key: string]: any;
|
14
|
+
}>;
|
5
15
|
export type QueryData = (props: {
|
6
16
|
content: string;
|
7
17
|
contentType: string;
|
@@ -12,9 +22,7 @@ export type QueryData = (props: {
|
|
12
22
|
}>>;
|
13
23
|
export type QueryRecord = (props: {
|
14
24
|
page: number;
|
15
|
-
}) => Promise<
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
[key: string]: any;
|
20
|
-
}>>;
|
25
|
+
}) => Promise<{
|
26
|
+
records: number;
|
27
|
+
rows: MessageList;
|
28
|
+
}>;
|
@@ -1 +1 @@
|
|
1
|
-
.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 .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:scroll;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{background:#fff;padding:10px 12px}.ai-chat .chat-main .message-item .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content.mine{background:hsla(0,0%,100%,.48)}.ai-chat .chat-main .message-item .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.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;padding:10px}.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;
|
1
|
+
.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:scroll;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{background:#fff;padding:10px 12px}.ai-chat .chat-main .message-item .content.default h2{font-size:22px;font-weight:500;margin:10px 0}.ai-chat .chat-main .message-item .content.mine{background:hsla(0,0%,100%,.48)}.ai-chat .chat-main .message-item .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.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;padding:10px}.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}
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/Viewer';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/features/modeling';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'diagram-js/lib/navigation/movecanvas';
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as y,renderList as f,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as O}from"vue";import{isObject as C}from"@vue/shared";import{useMessage as I,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as F,NCheckbox as E,NDivider as x}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as J}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as A}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as B}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{useShortcuts as K}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const R={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},q=d("span",{class:"label bold"},"外显设置",-1),Y={class:"newprint-button-poperOver"},H={class:"print-lite"},$={class:"label bold"},Q={class:"print-li"},W={class:"print-lite"},X={key:0,class:"newprint-button-outer__shortcut"},Z={class:"newprint-button-poperOver"},ee=["onMouseenter","onClick"],te={class:"label bold"},ne={class:"newprint-button-poperOver"},re={class:"print-lite"},ie={class:"label bold"},ae={class:"print-li"},le={class:"print-lite"},oe=["onClick"],se={key:0,class:"newprint-button-outer__shortcut"},ue={class:"newprint-button-poperOver"},ce=["onMouseenter"],de={class:"print-lite"},pe=["onClick"];var me=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:me}){const ve=e,ye=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],fe=I();let ge;const he=t(z),ke=n(""),be=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],ireportExecuteMode:1}),Pe=n({});let we=n([]),Se=n([{label:ve.previewText,key:"previewText"},{label:ve.pdfLoadText,key:"downloadPdf"},{label:ve.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ce=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Ie=n([]),Le=n([]),Te=i((()=>{if(!be.currentFormatId)return{};let e=be.currentFormatId;return be.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=Te.value)?void 0:e.name)||"格式选择"}));const je=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.templateId})),Me=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.number})),Fe=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowPrintAll})),Ee=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowOutSetting})),xe=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.customProps)||{}})),Ne=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.defaultFormatId)||""})),_e=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.printAllType)||1})),De=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.shortcut)||{}})),Je=i((()=>{var e,t;const n=Object.keys(De.value);if(n.length>0){if(Ne.value&&n.includes(Ne.value))return(null==(e=De.value[Ne.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=De.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=ye.map((e=>e.key));return we.value.filter((t=>!e.includes(t.key)))})),Ae=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ue=async()=>{var e,t;(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await mt(),Ce.oneShow=!0},Ve=async e=>{if(ve.directPrint){if(be.spinning)return;return"button"===e?void(Fe.value?await ft():Ne.value?async function(e){await mt(!1);const t=Ie.value.find((t=>t.key==e));t&&et(t.templateCode,t.templateId,t.key,!1)}(Ne.value):Ue()):Ue()}return Ue()},Be=(e,t)=>{Oe[e]=t},Ke=()=>{Ie.value=we.value.filter((e=>!e.selected)),Le.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),he("saveOuterPrint",Le.value)},Re=e=>{Ce[e]=!0},Ge=e=>{Oe.oneClickType="",Ce[e]=!1,"isOutSetting"==e&&(Ce.isOutSetting=!1)},qe=(e,t)=>{Xe(!1);let n={type:t,formatId:be.currentFormatId,templateId:(null==e?void 0:e.templateId)||je.value,templateCode:(null==e?void 0:e.templateCode)||Me.value};he("success",e,n)},Ye=e=>{Xe(!1),he("error",e),C(e)&&"notInstalledApp"===e.type&&fe.error(e.message)},He=e=>{Xe(!1),he("cancel",e)},$e=e=>{he("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Qe=()=>JSON.stringify({...ve.token?{token:ve.token}:{}}),We=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=be.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(Qe()),xe.value,a),JSON.stringify(i)},Xe=(e,t)=>{if(be.isClickOuterPrint){if(e&&t){const n=Le.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Le.value.forEach((e=>{e.isLoading=!1}))}else be.spinning=e},Ze=()=>be.isClickOuterPrint?Le.value.some((e=>e.isLoading)):be.spinning,et=(e,t,n,r)=>{const i=be.printParams[e];if(!i)return;be.isClickOuterPrint=r,be.currentFormatId=n;const a=be.originParams[e]||[];tt(i,e,t,n,a)},tt=async(e=[],t,n,r,i=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&qe(e,"print")}catch(e){console.log("error",e)}};ve.showLoading&&Ze()&&!a||(Xe(!0,r),ve.prevFn("print").then((()=>{be.curPrintParamList=e;const a={formatId:r,ireportExecuteMode:be.ireportExecuteMode,templateId:n,authorizationKey:ke.value,printdlgshow:ve.printdlgshow,signature:ve.signature,copies:ve.printCopies};if("MULTI"===ve.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[t]));ge.printDirect({...a,params:n},o,Ye,He)}else ge.printDirect({...a,params:We(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,qe(e,"print")}),Ye,He)})).catch((()=>{$e("print"),Xe(!1)})).finally((()=>{be.visible=!1})))},nt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=be.printParams[t];if(a)switch(be.isClickOuterPrint=i,be.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("preview").then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,params:a,btnprint:ve.btnprint,signature:ve.signature};ge.preview(l,(e=>{qe(e,"preview")}),Ye)})).catch((()=>{$e("preview"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("edit").then((()=>{be.curPrintParamList=e,be.currentFormatId=r,be.identityVerification.visible=!0})).catch((()=>{$e("edit")})).finally((()=>{Xe(!1)})))})(a,0,0,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("download").then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,print:{print:"1",type:"1",resolution:null==ve?void 0:ve.resolution},params:a,signature:ve.signature};ge.downloadPDF(l,(e=>qe(e,"preview")),Ye)})).catch((()=>{$e("download"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!ve.showLoading||!Ze()){Xe(!0,r);try{const e=await ge.resetPrinter(r);if(Xe(!1),"success"==(null==e?void 0:e.result))return void fe.success(e.message||"重置打印机成功");fe.warning("重置打印机失败")}catch(e){Xe(!1),fe.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},rt=()=>{},it=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},st(n,t,e))})),n},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=B(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},ot=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(lt(n,t,"fieldName"))})),r=Object.assign({},r,lt(n,t,"key")),r},st=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return fe.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(ot(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return fe.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(ot(l,t))}return e},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return fe.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return fe.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},ct=async e=>{var t;be.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],be.ireportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].ireportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(De.value),i=be.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=De.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));we.value.unshift(...i),Ee.value&&we.value.push(...ye),(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(we.value.forEach((e=>{var t;(null==(t=ve.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Le.value=we.value.filter((e=>e.selected))),Ie.value=we.value.filter((e=>!e.selected)),ve.hideButtons.length>0&&(Se.value=Se.value.filter((e=>!ve.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Se.value=Se.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Se.value=Se.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Se.value=Se.value.filter((e=>"resetPrinter"!=e.key)))}})(),be.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params),pt()},dt=async()=>{var e;if(be.isInited)return!0;be.isInited=!0,be.spinning=!0,(()=>{if(ge)return!1;ge=new A})();const t=await ve.queryPrintFormatByNumber();return await ct(t),(null==(e=t.obj)?void 0:e.length)>0&&(ke.value=t.obj[0].authorizationKey||""),be.spinning=!1,!0},pt=async()=>{const e=Object.keys(De.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=De.value[n],{stop:i,signature:a}=K().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=be.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=be.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];tt(n,e.templateCode,e.templateId,e.key,r)}}}});Pe.value[n]=i}},mt=async(e=!0)=>{if(await ve.clickPrevFn()){if(!be.visible){if(!await dt())return!1}e&&(be.visible=!be.visible)}},vt=e=>{if(be.identityVerification.visible=!1,U(be.currentFormatId))return qe(null,"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,be.curPrintParamList[0])),n="MULTI"===ve.strategy?t:We(be.curPrintParamList,Me.value),r={formatId:be.currentFormatId,templateId:je.value,params:n,token:e};ge.editPrintFormat(r,(e=>{qe(e,"edit")}),Ye)},yt=(e,t)=>{const n=Le.value[t+1];return t<Le.value.length-1&&!be.printParams[e.templateCode]&&be.printParams[n.templateCode]};async function ft(){await mt(!1),(()=>{const e=Object.keys(be.printParams);be.isClickOuterPrint=!1;const t=be.originParams;if(1==_e.value)for(let n=0;n<e.length;n++){const r=e[n],i=be.printParams[r],a=t[r]||[],l=be.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{be.currentFormatId=e.id,tt(i,e.number,e.templateId,e.id,a,!0)}))}2==_e.value&&Le.value.forEach((e=>{const n=be.printParams[e.templateCode],r=t[e.templateCode]||[];be.currentFormatId=e.key,tt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{be.isInited=!1,mt()})),l((()=>{const e=Object.keys(Pe.value);e.length>0&&e.forEach((e=>{Pe.value[e]&&Pe.value[e]()}))})),o((()=>ve.params),(e=>{Object.keys(be.templateParams).length>0&&(be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params))}),{deep:!0}),o((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await mt(!1)}),{deep:!0,immediate:!0}),me({directPrint:ft}),(t,n)=>(s(),u(c,null,[d("div",R,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:y((()=>[(s(!0),u(c,null,f(Le.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:rt,options:(r=v(Se),i=t,be.printParams[i.templateCode]?r:[]),onSelect:e=>nt(e,t,!0)},{default:y((()=>[m(v(j),{disabled:!be.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>et(t.templateCode,t.templateId,t.key,!0),class:h(n==Le.value.length-1?"outerLastButton":yt(t,n)?"isPrintDisabled":"")},{icon:y((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:y((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Le.value.length>0&&Le.value.length==v(ze).length&&v(Ee)&&2!=v(_e)?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,show:Ce.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:y((()=>[m(v(j),{class:h(Le.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Re("isOutSetting"))},{default:y((()=>[q,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:y((()=>[d("div",Y,[(s(!0),u(c,null,f(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",H,[d("span",$,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:y((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",Q,[m(v(x)),d("div",W,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:y((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:y((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(F),{trigger:"click","show-arrow":!1,show:Ce.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:y((()=>[w(t.$slots,"button",{handleClickPrintBtn:mt,printSpinning:be.spinning,printbtnText:e.btnText,printVisible:be.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:y((()=>[m(v(j),{loading:e.showLoading&&be.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(Le.value.length>0?"printAllLeftCls":"")},{icon:y((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:y((()=>[k(" "+b(v(Fe)?"打印全部":e.btnText)+" ",1),v(Je)?(s(),u("span",X,b(v(Je)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:y((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[d("div",Z,[(s(!0),u(c,null,f(Ie.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Be("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Be("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!be.printParams[n.templateCode])return[];Be(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(x),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ce.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:y((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Re("isOutSetting"))},[d("span",te,b(e.label),1),m(v(M),{color:Le.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:y((()=>[d("div",ne,[(s(!0),u(c,null,f(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[d("span",ie,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:y((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",ae,[m(v(x)),d("div",le,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:y((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:y((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",be.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>et(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",se,b(e.shortcutLabel),1)):p("v-if",!0)],8,oe),be.printParams[e.templateCode]?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ce[e.key],onClickoutside:t=>Ge(e.key)},{trigger:y((()=>[m(v(M),{component:v(J),size:"18",onClick:t=>Re(e.key)},null,8,["component","onClick"])])),default:y((()=>[d("div",ue,[(s(!0),u(c,null,f(v(Se),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Be("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Be("twoMouseType",""))},[d("div",de,[d("span",{class:"label",onClick:n=>nt(t.key,e,!1)},b(t.label),9,pe)])],42,ce)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,ee)))),128))])])),_:3},8,["show"])],2112))]),m(V,O(t.$attrs,{modelValue:be.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>be.identityVerification.visible=e),formatId:be.currentFormatId,templateId:v(je),onSuccess:vt}),null,16,["modelValue","formatId","templateId"])],64))}});export{me as default};
|
1
|
+
import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as O}from"vue";import{isObject as I}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as F,NCheckbox as E,NDivider as x}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as J}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as A}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as B}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{useShortcuts as K}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const R={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},q=d("span",{class:"label bold"},"外显设置",-1),Y={class:"newprint-button-poperOver"},H={class:"print-lite"},$={class:"label bold"},Q={class:"print-li"},W={class:"print-lite"},X={key:0,class:"newprint-button-outer__shortcut"},Z={class:"newprint-button-poperOver"},ee=["onMouseenter","onClick"],te={class:"label bold"},ne={class:"newprint-button-poperOver"},re={class:"print-lite"},ie={class:"label bold"},ae={class:"print-li"},le={class:"print-lite"},oe=["onClick"],se={key:0,class:"newprint-button-outer__shortcut"},ue={class:"newprint-button-poperOver"},ce=["onMouseenter"],de={class:"print-lite"},pe=["onClick"];var me=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:me}){const ve=e,fe=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],ye=C();let ge;const he=t(z),ke=n(""),be=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],ireportExecuteMode:1}),Pe=n({});let we=n([]),Se=n([{label:ve.previewText,key:"previewText"},{label:ve.pdfLoadText,key:"downloadPdf"},{label:ve.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ie=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Ce=n([]),Le=n([]),Te=i((()=>{if(!be.currentFormatId)return{};let e=be.currentFormatId;return be.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=Te.value)?void 0:e.name)||"格式选择"}));const je=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.templateId})),Me=i((()=>{let e=be.formatList.find((e=>e.id===be.currentFormatId));return null==e?void 0:e.number})),Fe=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowPrintAll})),Ee=i((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.isShowOutSetting})),xe=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.customProps)||{}})),Ne=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.defaultFormatId)||""})),_e=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.printAllType)||1})),De=i((()=>{var e;return(null==(e=ve.newPrintSetting)?void 0:e.shortcut)||{}})),Je=i((()=>{var e,t;const n=Object.keys(De.value);if(n.length>0){if(Ne.value&&n.includes(Ne.value))return(null==(e=De.value[Ne.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=De.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=fe.map((e=>e.key));return we.value.filter((t=>!e.includes(t.key)))})),Ae=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ue=async()=>{var e,t;(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await mt(),Ie.oneShow=!0},Ve=async e=>{if(ve.directPrint){if(be.spinning)return;return"button"===e?void(Fe.value?await yt():Ne.value?async function(e){await mt(!1);const t=Ce.value.find((t=>t.key==e));t&&et(t.templateCode,t.templateId,t.key,!1)}(Ne.value):Ue()):Ue()}return Ue()},Be=(e,t)=>{Oe[e]=t},Ke=()=>{Ce.value=we.value.filter((e=>!e.selected)),Le.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),he("saveOuterPrint",Le.value)},Re=e=>{Ie[e]=!0},Ge=e=>{Oe.oneClickType="",Ie[e]=!1,"isOutSetting"==e&&(Ie.isOutSetting=!1)},qe=(e,t)=>{Xe(!1);let n={type:t,formatId:be.currentFormatId,templateId:(null==e?void 0:e.templateId)||je.value,templateCode:(null==e?void 0:e.templateCode)||Me.value};he("success",e,n)},Ye=e=>{Xe(!1),he("error",e),I(e)&&"notInstalledApp"===e.type&&ye.error(e.message)},He=e=>{Xe(!1),he("cancel",e)},$e=e=>{he("error",{message:"前置条件执行错误",type:e,preExecution:!0})},Qe=()=>JSON.stringify({...ve.token?{token:ve.token}:{}}),We=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=be.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(Qe()),xe.value,a),JSON.stringify(i)},Xe=(e,t)=>{if(be.isClickOuterPrint){if(e&&t){const n=Le.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Le.value.forEach((e=>{e.isLoading=!1}))}else be.spinning=e},Ze=()=>be.isClickOuterPrint?Le.value.some((e=>e.isLoading)):be.spinning,et=(e,t,n,r)=>{const i=be.printParams[e];if(!i)return;be.isClickOuterPrint=r,be.currentFormatId=n;const a=be.originParams[e]||[];tt(i,e,t,n,a)},tt=async(e=[],t,n,r,i=[],a)=>{let l=e.length;const o=async e=>{try{--l<=0&&qe(e,"print")}catch(e){console.log("error",e)}};ve.showLoading&&Ze()&&!a||(Xe(!0,r),ve.prevFn("print",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const a={formatId:r,ireportExecuteMode:be.ireportExecuteMode,templateId:n,authorizationKey:ke.value,printdlgshow:ve.printdlgshow,signature:ve.signature,copies:ve.printCopies};if("MULTI"===ve.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[t]));ge.printDirect({...a,params:n},o,Ye,He)}else ge.printDirect({...a,params:We(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,qe(e,"print")}),Ye,He)})).catch((()=>{$e("print"),Xe(!1)})).finally((()=>{be.visible=!1})))},nt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=be.printParams[t];if(a)switch(be.isClickOuterPrint=i,be.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("preview",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,params:a,btnprint:ve.btnprint,signature:ve.signature};ge.preview(l,(e=>{qe(e,"preview")}),Ye)})).catch((()=>{$e("preview"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("edit",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e,be.currentFormatId=r,be.identityVerification.visible=!0})).catch((()=>{$e("edit")})).finally((()=>{Xe(!1)})))})(a,0,n,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{ve.showLoading&&Ze()||(Xe(!0,r),ve.prevFn("download",{formatId:r,templateId:n}).then((()=>{be.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,e[0])),a="MULTI"===ve.strategy?i:We(e,t),l={formatId:r,templateId:n,ireportExecuteMode:be.ireportExecuteMode,authorizationKey:ke.value,print:{print:"1",type:"1",resolution:null==ve?void 0:ve.resolution},params:a,signature:ve.signature};ge.downloadPDF(l,(e=>qe(e,"preview")),Ye)})).catch((()=>{$e("download"),Xe(!1)})).finally((()=>{be.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!ve.showLoading||!Ze()){Xe(!0,r);try{const e=await ge.resetPrinter(r);if(Xe(!1),"success"==(null==e?void 0:e.result))return void ye.success(e.message||"重置打印机成功");ye.warning("重置打印机失败")}catch(e){Xe(!1),ye.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},rt=()=>{},it=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},st(n,t,e))})),n},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=B(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},ot=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(lt(n,t,"fieldName"))})),r=Object.assign({},r,lt(n,t,"key")),r},st=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return ye.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(ot(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return ye.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(ot(l,t))}return e},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return ye.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return ye.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},ct=async e=>{var t;be.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],be.ireportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].ireportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(De.value),i=be.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=De.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));we.value.unshift(...i),Ee.value&&we.value.push(...fe),(null==(t=null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(we.value.forEach((e=>{var t;(null==(t=ve.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Le.value=we.value.filter((e=>e.selected))),Ce.value=we.value.filter((e=>!e.selected)),ve.hideButtons.length>0&&(Se.value=Se.value.filter((e=>!ve.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Se.value=Se.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Se.value=Se.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Se.value=Se.value.filter((e=>"resetPrinter"!=e.key)))}})(),be.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params),pt()},dt=async()=>{var e;if(be.isInited)return!0;be.isInited=!0,be.spinning=!0,(()=>{if(ge)return!1;ge=new A})();const t=await ve.queryPrintFormatByNumber();return await ct(t),(null==(e=t.obj)?void 0:e.length)>0&&(ke.value=t.obj[0].authorizationKey||""),be.spinning=!1,!0},pt=async()=>{const e=Object.keys(De.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=De.value[n],{stop:i,signature:a}=K().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=be.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=be.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];tt(n,e.templateCode,e.templateId,e.key,r)}}}});Pe.value[n]=i}},mt=async(e=!0)=>{if(await ve.clickPrevFn()){if(!be.visible){if(!await dt())return!1}e&&(be.visible=!be.visible)}},vt=e=>{if(be.identityVerification.visible=!1,U(be.currentFormatId))return qe(null,"edit");const t=JSON.stringify(Object.assign({},JSON.parse(Qe()),xe.value,be.curPrintParamList[0])),n="MULTI"===ve.strategy?t:We(be.curPrintParamList,Me.value),r={formatId:be.currentFormatId,templateId:je.value,params:n,token:e};ge.editPrintFormat(r,(e=>{qe(e,"edit")}),Ye)},ft=(e,t)=>{const n=Le.value[t+1];return t<Le.value.length-1&&!be.printParams[e.templateCode]&&be.printParams[n.templateCode]};async function yt(){await mt(!1),(()=>{const e=Object.keys(be.printParams);be.isClickOuterPrint=!1;const t=be.originParams;if(1==_e.value)for(let n=0;n<e.length;n++){const r=e[n],i=be.printParams[r],a=t[r]||[],l=be.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{be.currentFormatId=e.id,tt(i,e.number,e.templateId,e.id,a,!0)}))}2==_e.value&&Le.value.forEach((e=>{const n=be.printParams[e.templateCode],r=t[e.templateCode]||[];be.currentFormatId=e.key,tt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{be.isInited=!1,mt()})),l((()=>{const e=Object.keys(Pe.value);e.length>0&&e.forEach((e=>{Pe.value[e]&&Pe.value[e]()}))})),o((()=>ve.params),(e=>{Object.keys(be.templateParams).length>0&&(be.printParams=it(be.templateParams,ve.params),be.originParams=at(be.templateParams,ve.params))}),{deep:!0}),o((()=>{var e;return null==(e=ve.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await mt(!1)}),{deep:!0,immediate:!0}),me({directPrint:yt}),(t,n)=>(s(),u(c,null,[d("div",R,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(Le.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:rt,options:(r=v(Se),i=t,be.printParams[i.templateCode]?r:[]),onSelect:e=>nt(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!be.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>et(t.templateCode,t.templateId,t.key,!0),class:h(n==Le.value.length-1?"outerLastButton":ft(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Le.value.length>0&&Le.value.length==v(ze).length&&v(Ee)&&2!=v(_e)?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,show:Ie.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(Le.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>Re("isOutSetting"))},{default:f((()=>[q,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",Y,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",H,[d("span",$,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",Q,[m(v(x)),d("div",W,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(F),{trigger:"click","show-arrow":!1,show:Ie.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:mt,printSpinning:be.spinning,printbtnText:e.btnText,printVisible:be.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&be.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(Le.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Fe)?"打印全部":e.btnText)+" ",1),v(Je)?(s(),u("span",X,b(v(Je)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",Z,[(s(!0),u(c,null,y(Ce.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Be("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Be("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!be.printParams[n.templateCode])return[];Be(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(x),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ie.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>Re("isOutSetting"))},[d("span",te,b(e.label),1),m(v(M),{color:Le.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",ne,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",re,[d("span",ie,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",ae,[m(v(x)),d("div",le,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",be.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>et(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",se,b(e.shortcutLabel),1)):p("v-if",!0)],8,oe),be.printParams[e.templateCode]?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ie[e.key],onClickoutside:t=>Ge(e.key)},{trigger:f((()=>[m(v(M),{component:v(J),size:"18",onClick:t=>Re(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ue,[(s(!0),u(c,null,y(v(Se),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Be("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Be("twoMouseType",""))},[d("div",de,[d("span",{class:"label",onClick:n=>nt(t.key,e,!1)},b(t.label),9,pe)])],42,ce)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,ee)))),128))])])),_:3},8,["show"])],2112))]),m(V,O(t.$attrs,{modelValue:be.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>be.identityVerification.visible=e),formatId:be.currentFormatId,templateId:v(je),onSuccess:vt}),null,16,["modelValue","formatId","templateId"])],64))}});export{me as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as r,computed as a,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as u,createVNode as d,unref as m,withCtx as c,renderSlot as f,withModifiers as y,createTextVNode as v,toDisplayString as g,mergeProps as b}from"vue";import{isObject as h}from"@vue/shared";import{useMessage as I,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import E from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as M,getPrivateFormatApi as O}from"../api.js";var L=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String}},setup(t,{expose:L}){var D;const C=t,N=e(),V=I();let B;const R=n(x),z={},A=i(""),J=r({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,ireportExecuteMode:1});let U=i([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(D=C.externalOptionConfig)?void 0:D.options)||[]]);const q=a((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=a((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=a((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await dt():st()}return st()},H=t=>d("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),h(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...r){i&&clearTimeout(i),n&&!i&&t.apply(null,r),i=setTimeout((()=>{i=null,!n&&t.apply(null,r)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print").then((()=>{const t={ireportExecuteMode:J.ireportExecuteMode,formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit").then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1",resolution:null==C?void 0:C.resolution},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const r=J.formatList.find((e=>e.id===t))||{};if(Object.keys(r).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==r?void 0:r.name)||e.label,await M({formatForms:[{...r}],name:z.name||r.templateName,number:z.number||r.number,templateId:z.templateId||r.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(i=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),rt=(t,e,n)=>{const i={};return e.forEach((e=>{let r=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},at=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(rt(n,e,"fieldName"))}})),i=Object.assign({},i,rt(n,e,"key")),i})),ot=async t=>{var e,n;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.ireportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].ireportExecuteMode||1,J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await O({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const r=null==(n=null==i?void 0:i[0])?void 0:n.id;if(r&&t.map((t=>t.id)).includes(r))return r}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},r=Object.keys(i);r.includes("RY7.2.21.1.M2.G94181E")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),r.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let i=null==(n=await C.queryTemplateParams())?void 0:n.obj;if(!i||!_.value)return V.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=i,J.printParams=at(J.templateParams,C.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new T})();const e=await C.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=at(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},ut=t=>{if(J.identityVerification.visible=!1,S(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function dt(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),L({directPrint:dt}),(e,n)=>(s(),p(u,null,[d(m(P),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[d(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=y((()=>G("button")),["stop"]))},{default:c((()=>[v(g(t.btnText)+" ",1),d(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=y((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),d(E,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:ut}),null,16,["modelValue","formatId","templateId"])],64))}});export{L as default};
|
1
|
+
import{defineComponent as t,useAttrs as e,inject as n,ref as r,reactive as i,computed as a,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as v,createTextVNode as y,toDisplayString as g,mergeProps as b}from"vue";import{isObject as I}from"@vue/shared";import{useMessage as h,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import E from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as M,getPrivateFormatApi as O}from"../api.js";var L=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String}},setup(t,{expose:L}){var D;const C=t,N=e(),V=h();let B;const R=n(x),z={},A=r(""),J=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,ireportExecuteMode:1});let U=r([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(D=C.externalOptionConfig)?void 0:D.options)||[]]);const q=a((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=a((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=a((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),I(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},r={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));r={datasetData:{}},r.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{r[t]=[],J.printParams.forEach((e=>{r[t].includes(e[t])||r[t].push(e[t])})),r[t]=r[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),r),JSON.stringify(n)},tt=((t,e,n=!0)=>{let r=null;return function(...i){r&&clearTimeout(r),n&&!r&&t.apply(null,i),r=setTimeout((()=>{r=null,!n&&t.apply(null,i)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t={ireportExecuteMode:J.ireportExecuteMode,formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,r;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download",{formatId:J.currentFormatId,templateId:_.value}).then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,ireportExecuteMode:J.ireportExecuteMode,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1",resolution:null==C?void 0:C.resolution},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const i=J.formatList.find((e=>e.id===t))||{};if(Object.keys(i).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==i?void 0:i.name)||e.label,await M({formatForms:[{...i}],name:z.name||i.templateName,number:z.number||i.number,templateId:z.templateId||i.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(r=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||r.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},rt=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),it=(t,e,n)=>{const r={};return e.forEach((e=>{let i=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(r=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||r})(e,t[e[n]]);t[e[n]]&&i&&(r[e[n]]=i)})),r},at=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let r={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;r.datasetData={[t.name]:JSON.stringify(it(n,e,"fieldName"))}})),r=Object.assign({},r,it(n,e,"key")),r})),ot=async t=>{var e,n;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.ireportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].ireportExecuteMode||1,J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await O({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:r=[]}=e.map||{};Object.assign(z,e.map||{});const i=null==(n=null==r?void 0:r[0])?void 0:n.id;if(i&&t.map((t=>t.id)).includes(i))return i}}const r=t.find((t=>1==t[e]));return(null==r?void 0:r.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),rt();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),r=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},i=Object.keys(r);i.includes("RY7.2.21.1.M2.G94181E")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let r=null==(n=await C.queryTemplateParams())?void 0:n.obj;if(!r||!_.value)return V.error("获取打印模板失败,请联系管理员!"),rt();J.templateParams=r,J.printParams=at(J.templateParams,C.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new T})();const e=await C.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=at(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,S(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),L({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=v((()=>G("button")),["stop"]))},{default:c((()=>[y(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=v((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),u(E,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{L as default};
|
@@ -776,6 +776,8 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
776
776
|
handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
|
777
777
|
setMenuPosition: (event: MouseEvent) => Promise<void>;
|
778
778
|
showMessage: (item: import("../../shared/types").AnyObject) => boolean;
|
779
|
+
showReferenceMsg: (item: import("../../shared/types").AnyObject) => any;
|
780
|
+
showBlendMsg: (item: import("../../shared/types").AnyObject) => any;
|
779
781
|
showTemplateMsg: (item: import("../../shared/types").AnyObject, type: "template" | "system") => boolean | undefined;
|
780
782
|
isTemplate3: (content: import("../../shared/types").AnyObject) => boolean;
|
781
783
|
needShowTime: (item: import("../../shared/types").AnyObject, index: number) => boolean;
|
@@ -993,7 +995,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
993
995
|
defaultValue: import("../../shared/types").AnyObject[];
|
994
996
|
}>;
|
995
997
|
btnDisabled: import("vue").ComputedRef<boolean>;
|
996
|
-
handleCall: (chatMessageType: string, checkedIds?:
|
998
|
+
handleCall: (chatMessageType: string, checkedIds?: string[]) => void;
|
997
999
|
handleKeyDown: (event: KeyboardEvent) => void;
|
998
1000
|
isWrap: (event: KeyboardEvent) => boolean;
|
999
1001
|
handleInput: () => void;
|
@@ -781,6 +781,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
781
781
|
handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
|
782
782
|
setMenuPosition: (event: MouseEvent) => Promise<void>;
|
783
783
|
showMessage: (item: AnyObject) => boolean;
|
784
|
+
showReferenceMsg: (item: AnyObject) => any;
|
785
|
+
showBlendMsg: (item: AnyObject) => any;
|
784
786
|
showTemplateMsg: (item: AnyObject, type: "template" | "system") => boolean | undefined;
|
785
787
|
isTemplate3: (content: AnyObject) => boolean;
|
786
788
|
needShowTime: (item: AnyObject, index: number) => boolean;
|
@@ -998,7 +1000,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
998
1000
|
defaultValue: AnyObject[];
|
999
1001
|
}>;
|
1000
1002
|
btnDisabled: import("vue").ComputedRef<boolean>;
|
1001
|
-
handleCall: (chatMessageType: string, checkedIds?:
|
1003
|
+
handleCall: (chatMessageType: string, checkedIds?: string[]) => void;
|
1002
1004
|
handleKeyDown: (event: KeyboardEvent) => void;
|
1003
1005
|
isWrap: (event: KeyboardEvent) => boolean;
|
1004
1006
|
handleInput: () => void;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as o,watch as
|
1
|
+
import{defineComponent as e,ref as t,computed as o,watch as a,openBlock as s,createBlock as i,unref as n,withCtx as r,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as f,vShow as h,normalizeStyle as y,createCommentVNode as g,createTextVNode as v}from"vue";import{NModal as w,NImageGroup as b,NImage as k,NInput as M,NIcon as T,NTooltip as _}from"naive-ui";import{SearchOutline as I,DownloadOutline as S}from"@vicons/ionicons5";import{searchChatRecordApi as x}from"../api/index.js";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import{useDebounceFn as A}from"@vueuse/core";import{format as H,isSameWeek as D,isSameMonth as C}from"date-fns";import{last as O}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as z}from"../../../../shared/hooks/useScrollLoading.js";import{useState as L}from"../hooks/useState.js";import{getFileSize as U,downloadFile as E}from"../utils/index.js";import"trtc-sdk-v5";const $={class:"label"},F={class:"image-box"},P={class:"file-type"},R={class:"text"},B={class:"name"},G={class:"detail"},N={class:"opt-box"};var q=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const q=e,J=j(),{state:K}=L(),Q=t([]),V=t([]),W=t(),X=t(),Y=t(),Z=A(oe,500),ee={page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")};async function te(){var e;try{if(!ee.hasMore)return;ee.page++;const t=await x({orgId:K.orgId,keyword:Y.value,endTime:"",startTime:"",lastSendTime:ee.lastSendTime,memberIdSet:[],page:ee.page,recordType:"image"===q.type?"IMAGE":"FILE",receiver:K.currentSessionItem.receiver,userId:K.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(ee.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let o=t||[];if(Array.isArray(t)&&t.length>0&&(o=t[0].recordList),ee.lastSendTime=null==(e=O(o))?void 0:e.sendTime,"image"===q.type){const e=function(e){const t={};e.forEach((e=>{const o=new Date(e.sendTime);let a=H(o,"yyyy年MM月");D(o,new Date)?a="本周":C(o,new Date)&&(a="本月"),t[a]||(t[a]=[]),t[a].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(o);Q.value=ee.page>1?Q.value.concat(e):e}else{const e=o.map((e=>new Promise((async t=>{const o=await U(e.content.fileUrl);t({...e,size:o})})))),t=await Promise.all(e);V.value=ee.page>1?V.value.concat(t):t}}catch(e){console.log(e)}}function oe(){Object.assign(ee,{page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")}),te()}z(W,(()=>{te()})),z(X,(()=>{te()}));const ae=o((()=>"image"===q.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:o,senderName:a}=e;return`${t} · ${H(new Date(o),"yyyy/MM/dd HH:mm")} ${a}`}function ie(e){var t;const o=(null==(t=e.content)?void 0:t.msg)||"",a=o.lastIndexOf(".");if(-1!==a){return o.charAt(a+1).toUpperCase()}return"?"}return a((()=>q.visible),(e=>{e?oe():Y.value=""})),(t,o)=>(s(),i(n(w),{preset:"dialog",title:n(ae),"show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{default:r((()=>[l(c("div",{class:"iho-chat-dialog__content iho-chat-image-wrapper",ref_key:"imageRef",ref:W},[m(n(b),{"show-toolbar-tooltip":""},{default:r((()=>[(s(!0),p(d,null,u(Q.value,(e=>(s(),p("div",{class:"image-item",key:e.label},[c("span",$,f(e.label),1),c("div",F,[(s(!0),p(d,null,u(e.list,(e=>(s(),i(n(k),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[h,"image"===e.type]]),l(c("div",{class:"iho-chat-dialog__content iho-chat-file-wrapper",style:y(n(J))},[m(n(M),{clearable:"",placeholder:"搜索文件",value:Y.value,"onUpdate:value":o[0]||(o[0]=e=>Y.value=e),valueModifiers:{trim:!0},onInput:n(Z)},{prefix:r((()=>[m(n(T),{component:n(I)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:X},[(s(!0),p(d,null,u(V.value,((e,t)=>(s(),p("div",{class:"file-item",key:t},[c("span",P,f(ie(e)),1),c("div",R,[c("span",B,f(e.content.msg),1),c("span",G,f(se(e)),1)]),c("div",N,[g(' <n-tooltip :show-arrow="false">\n\t\t\t\t\t\t\t<template #trigger>\n\t\t\t\t\t\t\t\t<n-icon :size="16" :component="OpenOutline" />\n\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t转发\n\t\t\t\t\t\t</n-tooltip> '),m(n(_),{"show-arrow":!1},{trigger:r((()=>[m(n(T),{size:16,component:n(S),onClick:()=>n(E)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])),default:r((()=>[v(" 下载 ")])),_:2},1024)])])))),128))],512)],4),[[h,"image"!==e.type]])])),_:1},8,["title"]))}});export{q as default};
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
18
18
|
defaultValue: AnyObject[];
|
19
19
|
}>;
|
20
20
|
btnDisabled: import("vue").ComputedRef<boolean>;
|
21
|
-
handleCall: (chatMessageType: string, checkedIds?:
|
21
|
+
handleCall: (chatMessageType: string, checkedIds?: string[]) => void;
|
22
22
|
handleKeyDown: (event: KeyboardEvent) => void;
|
23
23
|
isWrap: (event: KeyboardEvent) => boolean;
|
24
24
|
handleInput: () => void;
|