cnhis-design-vue 3.2.4-beta.36 → 3.2.4-beta.38
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +87 -87
- package/es/components/button-print/index.d.ts +6 -1
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +6 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +6 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +1 -1
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/classification/src/index.vue.d.ts +0 -3
- package/es/components/field-set/src/FieldColor.vue.d.ts +16 -2
- package/es/components/field-set/src/FieldFilter.vue.d.ts +16 -2
- package/es/components/field-set/src/FieldSet.vue.d.ts +31 -2
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +16 -2
- package/es/components/field-set/src/components/Row.vue2.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
- 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/emoji/emotion_001.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_002.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_003.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_004.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_005.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_006.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_007.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_008.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_009.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_010.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_011.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_012.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_013.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_014.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_015.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_016.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_017.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_018.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_019.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_020.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_021.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_022.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_023.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_024.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_025.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_026.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_027.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_028.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_029.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_030.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_031.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_032.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_033.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_034.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_035.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_036.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_037.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_038.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_039.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_040.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_041.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_042.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_043.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_044.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_045.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_046.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_047.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_048.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_049.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_050.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_051.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_052.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_053.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_054.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_055.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_056.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_057.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_058.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_059.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_060.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_061.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_062.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_063.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_064.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_065.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_066.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_067.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_068.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_069.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_070.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_071.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_072.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_073.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_074.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_075.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_076.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_077.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_078.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_079.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_080.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_081.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_082.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_083.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_084.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_085.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_086.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_087.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_088.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_089.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_090.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_091.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_092.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_093.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_094.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_095.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_096.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_097.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_098.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_099.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_100.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_101.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_102.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_103.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_104.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_105.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_106.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_107.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_108.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_109.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_110.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_111.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_112.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_113.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_114.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_115.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_116.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_117.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_118.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_119.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_120.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_121.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_122.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_123.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_124.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_125.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_126.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_127.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_128.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_129.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_130.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_131.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_132.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_133.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_134.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_135.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_136.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_137.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_138.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_139.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_140.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_141.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_142.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_143.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_144.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_145.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_146.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_147.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_148.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_149.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_150.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_151.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_152.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_153.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_154.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_155.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_156.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_157.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_158.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_159.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_160.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_161.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_162.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_163.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_164.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_165.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_166.png.js +1 -1
- package/es/shared/assets/img/emoji/emotion_167.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/tooth/l-b-1.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-2.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-3.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-4.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-5.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-6.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-7.png.js +1 -1
- package/es/shared/assets/img/tooth/l-b-8.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-1.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-2.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-3.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-4.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-5.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-6.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-7.png.js +1 -1
- package/es/shared/assets/img/tooth/l-t-8.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-1.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-2.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-3.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-4.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-5.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-6.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-7.png.js +1 -1
- package/es/shared/assets/img/tooth/r-b-8.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-1.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-2.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-3.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-4.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-5.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-6.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-7.png.js +1 -1
- package/es/shared/assets/img/tooth/r-t-8.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/hooks/useFormRequest/index.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
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
|
+
```
|
@@ -293,6 +293,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
293
293
|
isShowOutSetting: boolean;
|
294
294
|
customProps: {};
|
295
295
|
outerPrintKeys: never[];
|
296
|
+
defaultFormatId: string;
|
296
297
|
};
|
297
298
|
};
|
298
299
|
}, {
|
@@ -400,6 +401,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
400
401
|
isShowOutSetting: boolean;
|
401
402
|
customProps: {};
|
402
403
|
outerPrintKeys: never[];
|
404
|
+
defaultFormatId: string;
|
403
405
|
};
|
404
406
|
};
|
405
407
|
}>> & {}>>;
|
@@ -443,6 +445,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
443
445
|
isShowPrintAllBtn: import("vue").ComputedRef<any>;
|
444
446
|
isShowOutSettingBtn: import("vue").ComputedRef<any>;
|
445
447
|
printCustomProps: import("vue").ComputedRef<any>;
|
448
|
+
defaultPrintFormatId: import("vue").ComputedRef<any>;
|
446
449
|
showSettingItems: import("vue").ComputedRef<import("../../shared/types").AnyObject[]>;
|
447
450
|
isSelectedAll: import("vue").WritableComputedRef<boolean>;
|
448
451
|
initShowDownList: () => Promise<void>;
|
@@ -468,7 +471,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
468
471
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
469
472
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
470
473
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
471
|
-
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void
|
474
|
+
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
472
475
|
handleSelect: (type: string, { templateCode, templateId, key }: import("../../shared/types").AnyObject, isOuterClick: boolean) => Promise<void>;
|
473
476
|
handleClickOutside: () => void;
|
474
477
|
instantiatePrintSDK: () => false | undefined;
|
@@ -490,6 +493,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
490
493
|
reformatPrintParams: () => void;
|
491
494
|
verifiySuccess: (token: string) => void;
|
492
495
|
directPrint: () => Promise<void>;
|
496
|
+
directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
|
493
497
|
NDropdown: any;
|
494
498
|
NButton: any;
|
495
499
|
NIcon: any;
|
@@ -2226,6 +2230,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
2226
2230
|
isShowOutSetting: boolean;
|
2227
2231
|
customProps: {};
|
2228
2232
|
outerPrintKeys: never[];
|
2233
|
+
defaultFormatId: string;
|
2229
2234
|
};
|
2230
2235
|
};
|
2231
2236
|
}>>, {
|
@@ -299,6 +299,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
299
299
|
isShowOutSetting: boolean;
|
300
300
|
customProps: {};
|
301
301
|
outerPrintKeys: never[];
|
302
|
+
defaultFormatId: string;
|
302
303
|
};
|
303
304
|
};
|
304
305
|
}, {
|
@@ -406,6 +407,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
406
407
|
isShowOutSetting: boolean;
|
407
408
|
customProps: {};
|
408
409
|
outerPrintKeys: never[];
|
410
|
+
defaultFormatId: string;
|
409
411
|
};
|
410
412
|
};
|
411
413
|
}>> & {}>>;
|
@@ -449,6 +451,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
449
451
|
isShowPrintAllBtn: import("vue").ComputedRef<any>;
|
450
452
|
isShowOutSettingBtn: import("vue").ComputedRef<any>;
|
451
453
|
printCustomProps: import("vue").ComputedRef<any>;
|
454
|
+
defaultPrintFormatId: import("vue").ComputedRef<any>;
|
452
455
|
showSettingItems: import("vue").ComputedRef<AnyObject[]>;
|
453
456
|
isSelectedAll: import("vue").WritableComputedRef<boolean>;
|
454
457
|
initShowDownList: () => Promise<void>;
|
@@ -474,7 +477,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
474
477
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
475
478
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
476
479
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
477
|
-
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void
|
480
|
+
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
478
481
|
handleSelect: (type: string, { templateCode, templateId, key }: AnyObject, isOuterClick: boolean) => Promise<void>;
|
479
482
|
handleClickOutside: () => void;
|
480
483
|
instantiatePrintSDK: () => false | undefined;
|
@@ -496,6 +499,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
496
499
|
reformatPrintParams: () => void;
|
497
500
|
verifiySuccess: (token: string) => void;
|
498
501
|
directPrint: () => Promise<void>;
|
502
|
+
directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
|
499
503
|
NDropdown: any;
|
500
504
|
NButton: any;
|
501
505
|
NIcon: any;
|
@@ -2232,6 +2236,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
2232
2236
|
isShowOutSetting: boolean;
|
2233
2237
|
customProps: {};
|
2234
2238
|
outerPrintKeys: never[];
|
2239
|
+
defaultFormatId: string;
|
2235
2240
|
};
|
2236
2241
|
};
|
2237
2242
|
}>>, {
|
@@ -101,6 +101,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
101
101
|
isShowOutSetting: boolean;
|
102
102
|
customProps: {};
|
103
103
|
outerPrintKeys: never[];
|
104
|
+
defaultFormatId: string;
|
104
105
|
};
|
105
106
|
};
|
106
107
|
}, {
|
@@ -211,6 +212,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
211
212
|
isShowOutSetting: boolean;
|
212
213
|
customProps: {};
|
213
214
|
outerPrintKeys: never[];
|
215
|
+
defaultFormatId: string;
|
214
216
|
};
|
215
217
|
};
|
216
218
|
}>> & {}>>;
|
@@ -254,6 +256,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
254
256
|
isShowPrintAllBtn: import("vue").ComputedRef<any>;
|
255
257
|
isShowOutSettingBtn: import("vue").ComputedRef<any>;
|
256
258
|
printCustomProps: import("vue").ComputedRef<any>;
|
259
|
+
defaultPrintFormatId: import("vue").ComputedRef<any>;
|
257
260
|
showSettingItems: import("vue").ComputedRef<AnyObject[]>;
|
258
261
|
isSelectedAll: import("vue").WritableComputedRef<boolean>;
|
259
262
|
initShowDownList: () => Promise<void>;
|
@@ -279,7 +282,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
279
282
|
handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
280
283
|
handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
281
284
|
handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
|
282
|
-
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void
|
285
|
+
handleResetPrinter: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
|
283
286
|
handleSelect: (type: string, { templateCode, templateId, key }: AnyObject, isOuterClick: boolean) => Promise<void>;
|
284
287
|
handleClickOutside: () => void;
|
285
288
|
instantiatePrintSDK: () => false | undefined;
|
@@ -301,6 +304,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
301
304
|
reformatPrintParams: () => void;
|
302
305
|
verifiySuccess: (token: string) => void;
|
303
306
|
directPrint: () => Promise<void>;
|
307
|
+
directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
|
304
308
|
NDropdown: any;
|
305
309
|
NButton: any;
|
306
310
|
NIcon: any;
|
@@ -2040,6 +2044,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
2040
2044
|
isShowOutSetting: boolean;
|
2041
2045
|
customProps: {};
|
2042
2046
|
outerPrintKeys: never[];
|
2047
|
+
defaultFormatId: string;
|
2043
2048
|
};
|
2044
2049
|
};
|
2045
2050
|
}>>, {
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as r,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as d,createVNode as p,unref as m,withCtx as v,renderList as y,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as M,NCheckbox as j,NDivider as x}from"naive-ui";import{PrintOutline as E,SettingsOutline as N,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},it=["onClick"],rt={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__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},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[]})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let pt;const mt=e(z),vt=n(""),yt=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=r((()=>{if(!yt.currentFormatId)return{};let t=yt.currentFormatId;return yt.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=r((()=>{let t=yt.formatList.find((t=>t.id===yt.currentFormatId));return null==t?void 0:t.templateId})),St=r((()=>{let t=yt.formatList.find((t=>t.id===yt.currentFormatId));return null==t?void 0:t.number})),Ct=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),Ft=r({get:()=>Lt.value.every((t=>t.selected)),set(t){Lt.value.forEach((e=>{e.selected=t}))}}),Mt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await te(),ht.oneShow=!0},jt=async t=>{if(ut.directPrint){if(yt.spinning)return;return"button"===t?void(Ct.value?await ne():Mt()):Mt()}return Mt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Lt.value.filter((t=>t.selected)),_t("oneShow"),_t("isOutSetting"),mt("saveOuterPrint",wt.value)},Nt=t=>{ht[t]=!0},_t=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},Dt=(t,e)=>{Kt(!1);let n={type:e,formatId:yt.currentFormatId,templateId:Ot.value};const i=null==ut?void 0:ut.params.filter((t=>null==t?void 0:t.templateNumbers.includes(St.value)));(null==i?void 0:i.length)>0&&(t.options=i),mt("success",t,n)},zt=t=>{Kt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Jt=t=>{Kt(!1),mt("cancel",t)},Ut=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},Vt=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),At=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=yt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(i=Object.keys(t[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return r=Object.assign({},JSON.parse(Vt()),Tt.value,a),JSON.stringify(r)},Kt=(t,e)=>{if(yt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else yt.spinning=t},Bt=()=>yt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):yt.spinning,Rt=(t,e,n,i)=>{const r=yt.printParams[t];r&&(yt.isClickOuterPrint=i,yt.currentFormatId=n,Ht(r,t,e,n))},Ht=async(t=[],e,n,i,r)=>{let a=t.length;const l=async t=>{try{--a<=0&&Dt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Bt()&&!r||(Kt(!0,i),ut.prevFn("print").then((()=>{yt.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:vt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++)e>0&&(r.printdlgshow="0"),pt.printDirect({...r,params:Object.assign({},JSON.parse(Vt()),Tt.value,t[e])},l,zt,Jt);else pt.printDirect({...r,params:At(t,e)},(t=>{Dt(t,"print")}),zt,Jt)})).catch((()=>{Ut("print"),Kt(!1)})).finally((()=>{yt.visible=!1})))},qt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=yt.printParams[e];var l;if(a)switch(yt.isClickOuterPrint=r,yt.currentFormatId=i,t){case"previewText":(async(t=[],e,n,i)=>{ut.showLoading&&Bt()||(Kt(!0,i),ut.prevFn("preview").then((()=>{yt.curPrintParamList=t;const r="MULTI"===ut.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:vt.value,params:r,btnprint:ut.btnprint,signature:ut.signature};pt.preview(a,(t=>{Dt(t,"preview")}),zt)})).catch((()=>{Ut("preview"),Kt(!1)})).finally((()=>{yt.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ut.showLoading&&Bt()||(Kt(!0,i),ut.prevFn("edit").then((()=>{yt.curPrintParamList=t,yt.currentFormatId=i,yt.identityVerification.visible=!0})).catch((()=>{Ut("edit")})).finally((()=>{Kt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ut.showLoading&&Bt()||(Kt(!0,i),ut.prevFn("download").then((()=>{yt.curPrintParamList=t;const r="MULTI"===ut.strategy?Object.assign({},JSON.parse(Vt()),Tt.value,t[0]):At(t,e),a={formatId:i,templateId:n,authorizationKey:vt.value,print:{print:"1",type:"1"},params:r,signature:ut.signature};pt.downloadPDF(a,(t=>Dt(t,"preview")),zt)})).catch((()=>{Ut("download"),Kt(!1)})).finally((()=>{yt.visible=!1})))})(a,e,n,i);break;case"resetPrinter":l=i,ut.showLoading&&Bt()||(Kt(!0,l),pt.resetPrinter(l).then((t=>{Kt(!1),t?dt.success("重置打印机成功"):dt.warning("重置打印机失败")})))}},Gt=()=>{},Yt=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Wt(n,e,t))})),n},$t=(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=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},Qt=({customizeDataset:t=[],param:e=[]},n={})=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[t.name]=JSON.stringify($t(n,e,"fieldName"))})),i=Object.assign({},i,$t(n,e,"key")),i},Wt=(t,e,n)=>{if(e.templateNumbers){for(let i=0;i<e.templateNumbers.length;i++){const r=e.templateNumbers[i],a=n[r];if(!a)return dt.error("当前勾选的数据没有匹配的模板"),t;t[r]||(t[r]=[]),t[r].push(Qt(a,e))}return t}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Qt(l,e))}return t},Xt=async t=>{yt.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):[],(()=>{var t,e,n;const i=yt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...i),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const r=sessionStorage.getItem("portal");if(r){const t=JSON.parse(r),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(e);i.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),yt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),yt.printParams=Yt(yt.templateParams,ut.params)},Zt=async()=>{var t;if(yt.isInited)return!0;yt.isInited=!0,yt.spinning=!0,(()=>{if(pt)return!1;pt=new J})();const e=await ut.queryPrintFormatByNumber();return await Xt(e),(null==(t=e.obj)?void 0:t.length)>0&&(vt.value=e.obj[0].authorizationKey||""),yt.spinning=!1,!0},te=async(t=!0)=>{if(await ut.clickPrevFn()){if(!yt.visible){if(!await Zt())return!1}t&&(yt.visible=!yt.visible)}},ee=t=>{if(yt.identityVerification.visible=!1,U(yt.currentFormatId))return Dt(null,"edit");const e={formatId:yt.currentFormatId,templateId:Ot.value,params:Object.assign({},JSON.parse(Vt()),Tt.value,yt.curPrintParamList[0]),token:t};pt.editPrintFormat(e,(t=>{Dt(t,"edit")}),zt)};async function ne(){await te(!1),(()=>{const t=Object.keys(yt.printParams);yt.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=yt.printParams[n],r=yt.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{yt.currentFormatId=t.id,Ht(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{yt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(yt.templateParams).length>0&&(yt.printParams=Yt(yt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await te(!1)}),{deep:!0,immediate:!0}),st({directPrint:ne}),(e,n)=>(o(),s(u,null,[c("div",K,[d(" 外显按钮集合 "),p(m(I),null,{default:v((()=>[(o(!0),s(u,null,y(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Gt,options:(n=m(gt),i=e,yt.printParams[i.templateCode]?n:[]),onSelect:t=>qt(t,e,!0)},{default:v((()=>[p(m(L),{disabled:!yt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Rt(e.templateCode,e.templateId,e.key,!0)},{icon:v((()=>[p(m(F),{component:m(E),size:"18"},null,8,["component"])])),default:v((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,i})),128))])),_:1}),d(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),d(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Lt).length&&m(It)?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>_t("isOutSetting"))},{trigger:v((()=>[p(m(L),{onClick:n[0]||(n[0]=t=>Nt("isOutSetting"))},{default:v((()=>[B,p(m(F),{style:{"margin-left":"8px"},component:m(N),size:"18"},null,8,["component"])])),_:1})])),default:v((()=>[c("div",R,[(o(!0),s(u,null,y(m(Lt),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:v((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[p(m(x)),c("div",Y,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:v((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Ft),"onUpdate:checked":n[1]||(n[1]=t=>h(Ft)?Ft.value=t:null)},{default:v((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[d(" 打印全部按钮 "),p(m(M),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>_t("oneShow"))},{trigger:v((()=>[b(e.$slots,"button",{handleClickPrintBtn:te,printSpinning:yt.spinning,printbtnText:t.btnText,printVisible:yt.visible},(()=>[p(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>jt("icon")),["stop"]))},{default:v((()=>[p(m(L),{loading:t.showLoading&&yt.spinning,onClick:n[3]||(n[3]=w((()=>jt("button")),["stop"]))},{icon:v((()=>[p(m(F),{component:m(E),size:"18"},null,8,["component"])])),default:v((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),p(m(L),{class:"icon-select"},{icon:v((()=>[p(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:v((()=>[c("div",$,[(o(!0),s(u,null,y(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!yt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(x),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[d(" 第二层外显设置 "),p(m(M),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>_t("isOutSetting"))},{trigger:v((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>Nt("isOutSetting"))},[c("span",W,k(t.label),1),p(m(F),{style:{background:"transparent"},component:m(N),size:"18"},null,8,["component"])])])),default:v((()=>[c("div",X,[(o(!0),s(u,null,y(m(Lt),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:v((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[p(m(x)),c("div",nt,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:v((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Ft),"onUpdate:checked":n[6]||(n[6]=t=>h(Ft)?Ft.value=t:null)},{default:v((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[d(" 第二层功能操作 "),c("div",{class:P(["print-lite",yt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Rt(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,it),yt.printParams[t.templateCode]?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>_t(t.key)},{trigger:v((()=>[p(m(F),{component:m(D),size:"18",onClick:e=>Nt(t.key)},null,8,["component","onClick"])])),default:v((()=>[c("div",rt,[(o(!0),s(u,null,y(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>qt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):d("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),p(V,O(e.$attrs,{modelValue:yt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>yt.identityVerification.visible=t),formatId:yt.currentFormatId,templateId:m(Ot),onSuccess:ee}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
|
1
|
+
import{defineComponent as t,inject as e,ref as n,reactive as i,computed as r,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as d,createVNode as p,unref as m,withCtx as y,renderList as v,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as M,NCheckbox as j,NDivider as N}from"naive-ui";import{PrintOutline as x,SettingsOutline as E,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},it=["onClick"],rt={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__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},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:""})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let pt;const mt=e(z),yt=n(""),vt=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=r((()=>{if(!vt.currentFormatId)return{};let t=vt.currentFormatId;return vt.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.templateId})),St=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.number})),Ct=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.defaultFormatId)||""})),Ft=r((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),Mt=r({get:()=>Ft.value.every((t=>t.selected)),set(t){Ft.value.forEach((e=>{e.selected=t}))}}),jt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await ee(),ht.oneShow=!0},Nt=async t=>{if(ut.directPrint){if(vt.spinning)return;return"button"===t?void(Ct.value?await ie():Lt.value?async function(t){await ee(!1);const e=bt.value.find((e=>e.key==t));e&&Ht(e.templateCode,e.templateId,e.key,!1)}(Lt.value):jt()):jt()}return jt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Ft.value.filter((t=>t.selected)),Dt("oneShow"),Dt("isOutSetting"),mt("saveOuterPrint",wt.value)},_t=t=>{ht[t]=!0},Dt=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},zt=(t,e)=>{Bt(!1);let n={type:e,formatId:vt.currentFormatId,templateId:Ot.value};const i=null==ut?void 0:ut.params.filter((t=>null==t?void 0:t.templateNumbers.includes(St.value)));(null==i?void 0:i.length)>0&&(t.options=i),mt("success",t,n)},Jt=t=>{Bt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Ut=t=>{Bt(!1),mt("cancel",t)},Vt=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},At=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),Kt=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=vt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(i=Object.keys(t[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return r=Object.assign({},JSON.parse(At()),Tt.value,a),JSON.stringify(r)},Bt=(t,e)=>{if(vt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else vt.spinning=t},Rt=()=>vt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):vt.spinning,Ht=(t,e,n,i)=>{const r=vt.printParams[t];r&&(vt.isClickOuterPrint=i,vt.currentFormatId=n,qt(r,t,e,n))},qt=async(t=[],e,n,i,r)=>{let a=t.length;const l=async t=>{try{--a<=0&&zt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Rt()&&!r||(Bt(!0,i),ut.prevFn("print").then((()=>{vt.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:yt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++){e>0&&(r.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[e]));pt.printDirect({...r,params:n},l,Jt,Ut)}else pt.printDirect({...r,params:Kt(t,e)},(t=>{zt(t,"print")}),Jt,Ut)})).catch((()=>{Vt("print"),Bt(!1)})).finally((()=>{vt.visible=!1})))},Gt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=vt.printParams[e];if(a)switch(vt.isClickOuterPrint=r,vt.currentFormatId=i,t){case"previewText":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("preview").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,params:a,btnprint:ut.btnprint,signature:ut.signature};pt.preview(l,(t=>{zt(t,"preview")}),Jt)})).catch((()=>{Vt("preview"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("edit").then((()=>{vt.curPrintParamList=t,vt.currentFormatId=i,vt.identityVerification.visible=!0})).catch((()=>{Vt("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("download").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:a,signature:ut.signature};pt.downloadPDF(l,(t=>zt(t,"preview")),Jt)})).catch((()=>{Vt("download"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"resetPrinter":(async(t=[],e,n,i)=>{if(ut.showLoading&&Rt())return;Bt(!0,i);const r=await pt.resetPrinter(i);Bt(!1),"success"!=(null==r?void 0:r.result)?dt.warning("重置打印机失败"):dt.success(r.message||"重置打印机成功")})(a,0,0,i)}},Yt=()=>{},$t=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Xt(n,e,t))})),n},Qt=(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=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},Wt=({customizeDataset:t=[],param:e=[]},n={})=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[t.name]=JSON.stringify(Qt(n,e,"fieldName"))})),i=Object.assign({},i,Qt(n,e,"key")),i},Xt=(t,e,n)=>{if(e.templateNumbers){for(let i=0;i<e.templateNumbers.length;i++){const r=e.templateNumbers[i],a=n[r];if(!a)return dt.error("当前勾选的数据没有匹配的模板"),t;t[r]||(t[r]=[]),t[r].push(Wt(a,e))}return t}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Wt(l,e))}return t},Zt=async t=>{vt.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):[],(()=>{var t,e,n;const i=vt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...i),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const r=sessionStorage.getItem("portal");if(r){const t=JSON.parse(r),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(e);i.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),vt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),vt.printParams=$t(vt.templateParams,ut.params)},te=async()=>{var t;if(vt.isInited)return!0;vt.isInited=!0,vt.spinning=!0,(()=>{if(pt)return!1;pt=new J})();const e=await ut.queryPrintFormatByNumber();return await Zt(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),vt.spinning=!1,!0},ee=async(t=!0)=>{if(await ut.clickPrevFn()){if(!vt.visible){if(!await te())return!1}t&&(vt.visible=!vt.visible)}},ne=t=>{if(vt.identityVerification.visible=!1,U(vt.currentFormatId))return zt(null,"edit");const e=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,vt.curPrintParamList[0])),n={formatId:vt.currentFormatId,templateId:Ot.value,params:e,token:t};pt.editPrintFormat(n,(t=>{zt(t,"edit")}),Jt)};async function ie(){await ee(!1),(()=>{const t=Object.keys(vt.printParams);vt.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=vt.printParams[n],r=vt.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{vt.currentFormatId=t.id,qt(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{vt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(vt.templateParams).length>0&&(vt.printParams=$t(vt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await ee(!1)}),{deep:!0,immediate:!0}),st({directPrint:ie}),(e,n)=>(o(),s(u,null,[c("div",K,[d(" 外显按钮集合 "),p(m(I),null,{default:y((()=>[(o(!0),s(u,null,v(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Yt,options:(n=m(gt),i=e,vt.printParams[i.templateCode]?n:[]),onSelect:t=>Gt(t,e,!0)},{default:y((()=>[p(m(L),{disabled:!vt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,i})),128))])),_:1}),d(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),d(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Ft).length&&m(It)?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>Dt("isOutSetting"))},{trigger:y((()=>[p(m(L),{onClick:n[0]||(n[0]=t=>_t("isOutSetting"))},{default:y((()=>[B,p(m(F),{style:{"margin-left":"8px"},component:m(E),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",R,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[p(m(N)),c("div",Y,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[1]||(n[1]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[d(" 打印全部按钮 "),p(m(M),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>Dt("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:ee,printSpinning:vt.spinning,printbtnText:t.btnText,printVisible:vt.visible},(()=>[p(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>Nt("icon")),["stop"]))},{default:y((()=>[p(m(L),{loading:t.showLoading&&vt.spinning,onClick:n[3]||(n[3]=w((()=>Nt("button")),["stop"]))},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),p(m(L),{class:"icon-select"},{icon:y((()=>[p(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(o(!0),s(u,null,v(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!vt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(N),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[d(" 第二层外显设置 "),p(m(M),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>Dt("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>_t("isOutSetting"))},[c("span",W,k(t.label),1),p(m(F),{style:{background:"transparent"},component:m(E),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[p(m(N)),c("div",nt,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[6]||(n[6]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[d(" 第二层功能操作 "),c("div",{class:P(["print-lite",vt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,it),vt.printParams[t.templateCode]?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>Dt(t.key)},{trigger:y((()=>[p(m(F),{component:m(D),size:"18",onClick:e=>_t(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",rt,[(o(!0),s(u,null,v(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>Gt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):d("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),p(V,O(e.$attrs,{modelValue:vt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>vt.identityVerification.visible=t),formatId:vt.currentFormatId,templateId:m(Ot),onSuccess:ne}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
|
@@ -34,7 +34,7 @@ export declare class Print {
|
|
34
34
|
show(...args: Parameters<IdentityVerificationDialog['show']>): Promise<string>;
|
35
35
|
showPreview(...args: Parameters<PreviewDialog['show']>): Promise<string>;
|
36
36
|
_testConnection(): Promise<unknown>;
|
37
|
-
resetPrinter(formatId: string): Promise<
|
37
|
+
resetPrinter(formatId: string): Promise<any>;
|
38
38
|
_queryServicesPrint(params: AnyObject): Promise<any>;
|
39
39
|
_queryBase64ServicesPrint(params: AnyObject): Promise<any>;
|
40
40
|
_callPrintWithFile(queryParams: AnyObject): Promise<any>;
|
@@ -1 +1 @@
|
|
1
|
-
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=String(navigator.platform).toLowerCase().includes("linux"),p=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,u=`${d}/fdp-api/print/assembly/printIReport`,g=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/previewIReport`,w=`${d}/bi-api/reprot/print/open/client/getRemote`,y=`${d}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this,m&&this._isHiprint&&this._initDomesticSystem();const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{p({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}resetPrinter(t){return new Promise((e=>{p({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>{"success"===t.result?e(!0):e(!1)})).catch((t=>{e(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):p({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):p({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:m="1",messageTimeout:p=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:m,copies:o,messageTimeout:p,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await p({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await p({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await p({method:"post",url:g,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await p({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},p,d){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&m&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==d?void 0:d("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==p?void 0:p({file:s})}await this._queryProxyOrigin();const g=await this._testConnection();if(!this._handleResultTest(g,d))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,d);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==p||p(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:p=!0,messageTimeout:d=0},u,g,f,w="printDirect"){const y=a(e);if(e=this.getIReportFormatId(y,e),y&&m&&this._isHiprint){if(!this.isConnectHiPrint)return void g({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return g({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=u,this._errorCallbackFn=g,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const P=await this._testConnection();if(!this._handleResultTest(P,g))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:d}),a=this._handleResult(r,g,f);if(!a)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(a,w),null==u||u(a)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==g||g(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):p.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&m&&this._isHiprint){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
|
1
|
+
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const p=String(navigator.platform).toLowerCase().includes("linux"),d=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,u=`${m}/fdp-api/print/assembly/printIReport`,f=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${m}/bi-api/reprot/print/open/client/previewIReport`,w=`${m}/bi-api/reprot/print/open/client/getRemote`,y=`${m}/printService/file`;let v=null;class P{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,v)return v;v=this,p&&this._isHiprint&&this._initDomesticSystem();const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):d({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:p="1",messageTimeout:d=0}){const m={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:p,copies:o,messageTimeout:d,...a?{signature:a}:{}};if(s&&(m.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}m.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");m.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=m,await this._queryServicesPrint(m)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:g,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,m){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&p&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==m?void 0:m("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,m);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==d||d(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:d=!0,messageTimeout:m=0},u,f,g,w="printDirect"){const y=a(e);if(e=this.getIReportFormatId(y,e),y&&p&&this._isHiprint){if(!this.isConnectHiPrint)return void f({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return f({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=u,this._errorCallbackFn=f,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,f))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:m}),a=this._handleResult(r,f,g);if(!a)return!1;d&&["downloadPDF"].includes(w)&&await this._browserPrint(a,w),null==u||u(a)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==f||f(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&p&&this._isHiprint){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{P as Print};
|
@@ -1449,9 +1449,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
1449
1449
|
isSecondDisabled(second: number, minute: number | null, hour: number | null): boolean | 0;
|
1450
1450
|
};
|
1451
1451
|
NSelect: any;
|
1452
|
-
/**
|
1453
|
-
* 改变展示方式
|
1454
|
-
*/
|
1455
1452
|
NPopover: any;
|
1456
1453
|
CDatePicker: import("../../../shared/types").SFCWithInstall<import("vue").DefineComponent<{
|
1457
1454
|
updateUnchangedValue: {
|
@@ -230,6 +230,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
230
230
|
type: BooleanConstructor;
|
231
231
|
default: boolean;
|
232
232
|
};
|
233
|
+
fieldDescribeMode: {
|
234
|
+
type: PropType<"column" | "tooltip">;
|
235
|
+
default: string;
|
236
|
+
};
|
233
237
|
}, {
|
234
238
|
fixedWayOptions: {
|
235
239
|
label: string;
|
@@ -314,6 +318,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
314
318
|
type: BooleanConstructor;
|
315
319
|
default: boolean;
|
316
320
|
};
|
321
|
+
fieldDescribeMode: {
|
322
|
+
type: PropType<"column" | "tooltip">;
|
323
|
+
default: string;
|
324
|
+
};
|
317
325
|
}>> & {
|
318
326
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
319
327
|
onEdit?: ((...args: any[]) => any) | undefined;
|
@@ -321,6 +329,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
321
329
|
emit: (event: "edit" | "updateChecked", ...args: any[]) => void;
|
322
330
|
onRemove: () => void;
|
323
331
|
onEdit: () => void;
|
332
|
+
isRenderTooltip: (field: string) => any;
|
324
333
|
getTextValue: (field: string) => any;
|
325
334
|
isMultiple: (field: string) => boolean;
|
326
335
|
isRender: (field: string) => boolean;
|
@@ -419,6 +428,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
419
428
|
type: BooleanConstructor;
|
420
429
|
default: boolean;
|
421
430
|
};
|
431
|
+
fieldDescribeMode: {
|
432
|
+
type: PropType<"column" | "tooltip">;
|
433
|
+
default: string;
|
434
|
+
};
|
422
435
|
}>> & {
|
423
436
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
424
437
|
onEdit?: ((...args: any[]) => any) | undefined;
|
@@ -462,10 +475,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
462
475
|
hide: boolean;
|
463
476
|
}>;
|
464
477
|
draggable: boolean;
|
465
|
-
|
478
|
+
fieldDescribeMode: "column" | "tooltip";
|
479
|
+
isFieldSet: boolean;
|
466
480
|
idx: number;
|
467
481
|
isHighlight: boolean;
|
468
|
-
|
482
|
+
isHighlightRow: boolean;
|
469
483
|
}>;
|
470
484
|
EditDialog: import("vue").DefineComponent<{
|
471
485
|
visible: {
|
@@ -251,6 +251,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
251
251
|
type: BooleanConstructor;
|
252
252
|
default: boolean;
|
253
253
|
};
|
254
|
+
fieldDescribeMode: {
|
255
|
+
type: PropType<"column" | "tooltip">;
|
256
|
+
default: string;
|
257
|
+
};
|
254
258
|
}, {
|
255
259
|
fixedWayOptions: {
|
256
260
|
label: string;
|
@@ -335,6 +339,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
335
339
|
type: BooleanConstructor;
|
336
340
|
default: boolean;
|
337
341
|
};
|
342
|
+
fieldDescribeMode: {
|
343
|
+
type: PropType<"column" | "tooltip">;
|
344
|
+
default: string;
|
345
|
+
};
|
338
346
|
}>> & {
|
339
347
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
340
348
|
onEdit?: ((...args: any[]) => any) | undefined;
|
@@ -342,6 +350,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
342
350
|
emit: (event: "edit" | "updateChecked", ...args: any[]) => void;
|
343
351
|
onRemove: () => void;
|
344
352
|
onEdit: () => void;
|
353
|
+
isRenderTooltip: (field: string) => any;
|
345
354
|
getTextValue: (field: string) => any;
|
346
355
|
isMultiple: (field: string) => boolean;
|
347
356
|
isRender: (field: string) => boolean;
|
@@ -440,6 +449,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
440
449
|
type: BooleanConstructor;
|
441
450
|
default: boolean;
|
442
451
|
};
|
452
|
+
fieldDescribeMode: {
|
453
|
+
type: PropType<"column" | "tooltip">;
|
454
|
+
default: string;
|
455
|
+
};
|
443
456
|
}>> & {
|
444
457
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
445
458
|
onEdit?: ((...args: any[]) => any) | undefined;
|
@@ -483,10 +496,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
483
496
|
hide: boolean;
|
484
497
|
}>;
|
485
498
|
draggable: boolean;
|
486
|
-
|
499
|
+
fieldDescribeMode: "column" | "tooltip";
|
500
|
+
isFieldSet: boolean;
|
487
501
|
idx: number;
|
488
502
|
isHighlight: boolean;
|
489
|
-
|
503
|
+
isHighlightRow: boolean;
|
490
504
|
}>;
|
491
505
|
setStyle: typeof setStyle;
|
492
506
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "save" | "reset")[], "close" | "save" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|