@utogether/udp-core 1.0.1-beta.6 → 1.0.1-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/{403-Co4hnzlW.js → 403-Cjzd1bv9.js} +1 -1
  2. package/dist/{404-BsseeBQQ.js → 404-CJ-3SXgP.js} +1 -1
  3. package/dist/{500-DtKz7MA4.js → 500-CQ65MvIK.js} +1 -1
  4. package/dist/{AuthorityInfo-iWYEWOmC.js → AuthorityInfo-BdISFrap.js} +1 -1
  5. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-DsLG5slc.js +100 -0
  6. package/dist/{Company-CK8Zkcv3.js → Company-Mj-z1hNb.js} +3 -3
  7. package/dist/{CompanyPanel-DL4UrYYG.js → CompanyPanel-BNXZ7ER3.js} +1 -1
  8. package/dist/{Department-BPHn8to4.js → Department-C4ygVbSP.js} +3 -3
  9. package/dist/{DepartmentPanel-Bqraa_NB.js → DepartmentPanel-Bk96mDlD.js} +1 -1
  10. package/dist/{DesignPanel-CFOIOZme.js → DesignPanel-Bwx2QwMM.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-H0FNG35Z.js → DesignPanel.vue_vue_type_style_index_0_lang-B3OjJTHG.js} +24 -26
  12. package/dist/{DictView-CaD1yHQS.js → DictView-DE3jnxnq.js} +19 -18
  13. package/dist/{InvOrganization-CoO0_wsY.js → InvOrganization-Drce3xUC.js} +1 -1
  14. package/dist/Org-C42D9lDj.js +39 -0
  15. package/dist/{Preview-B-K_bxDG.js → Preview-CCXoRvWF.js} +1 -1
  16. package/dist/{ReportDefine-DElbukSL.js → ReportDefine-BWsExcQU.js} +1 -1
  17. package/dist/{ReportDesign-DvUHOKDK.js → ReportDesign-BTzpUpGj.js} +26 -26
  18. package/dist/{ReportQuery-BcSYRNT3.js → ReportQuery-eoSmPXzc.js} +1 -1
  19. package/dist/{ReportQueryFrom-BGEA4Pqk.js → ReportQueryFrom-D4YlI5jl.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-B-KEPnfY.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-DPDGKW9a.js} +1 -1
  21. package/dist/{ReportTemplate-DnPtEoxn.js → ReportTemplate-BTa2YWq0.js} +1 -1
  22. package/dist/{Role-CMKkWZil.js → Role-BTGB91P1.js} +6 -6
  23. package/dist/{RoleAssign-BToNzG9a.js → RoleAssign-BBSY6bYM.js} +3 -3
  24. package/dist/{RolePanel-BikZ-D2u.js → RolePanel-BaTuyeVC.js} +1 -1
  25. package/dist/{RolePanel-BNqd7-M6.js → RolePanel-DNDI7e0g.js} +1 -1
  26. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-BCwAp_1a.js +132 -0
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Nngq860f.js → RolePanel.vue_vue_type_script_setup_true_lang-QUeAQHrg.js} +44 -38
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-BDRDD2FX.js → ScrollPanel.vue_vue_type_style_index_0_lang-nqrbOaQP.js} +1 -1
  29. package/dist/{Staff-DBFATgM_.js → Staff-4dbkOqzl.js} +3 -3
  30. package/dist/{StaffInfo-CrfwZcEL.js → StaffInfo-xFAMTWgD.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CE3_NJF_.js → StaffInfo.vue_vue_type_script_setup_true_lang-CocRlLsO.js} +1 -1
  32. package/dist/{StaffPanel-D54Rl_Bg.js → StaffPanel-Cx-8MHBz.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-B8wtuSZD.js → StaffPanel.vue_vue_type_script_setup_true_lang-B3wfpxel.js} +2 -2
  34. package/dist/{SysUser-CsuovBei.js → SysUser-BHpgPXsI.js} +2 -2
  35. package/dist/{SysUserPanel-DNUwWEVp.js → SysUserPanel-DH79Lsnm.js} +1 -1
  36. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-CY6mhBV0.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BONl2R1a.js} +104 -100
  37. package/dist/{SystemMenu-oLmwvaqT.js → SystemMenu-C2JbVgyr.js} +2 -2
  38. package/dist/{UserInfo-LyrDwBG1.js → UserInfo-Efo-_yRo.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-vinrRyOG.js → UserInfo.vue_vue_type_style_index_0_lang-DnjjBjMU.js} +39 -37
  40. package/dist/{childView-DGKp87fT.js → childView-D7U7qh_A.js} +1 -1
  41. package/dist/{childView-SmYl4G6c.js → childView-wFMGHGiX.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang-wVoPvyRY.js → childView.vue_vue_type_style_index_0_lang-Bshn4N8Y.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-DU-Uun5d.js → childView.vue_vue_type_style_index_0_lang-w2CkZij-.js} +1 -1
  44. package/dist/{code-rule-CfbGjmOs.js → code-rule-B5dIxV6g.js} +1 -1
  45. package/dist/core.es.js +1 -1
  46. package/dist/{cron-task-DMfwGfms.js → cron-task-DWGtihrw.js} +1 -1
  47. package/dist/{frameView-D-hu_pqQ.js → frameView-DF2mXAwO.js} +1 -1
  48. package/dist/{index-ADANSV-q.js → index-VU6c04nN.js} +1562 -1309
  49. package/dist/{layoutView-D3SikBPr.js → layoutView-DUUKW0KX.js} +2 -2
  50. package/dist/{login-CQ1yBBdY.js → login-ByEoQ2HH.js} +11 -11
  51. package/dist/{lov-view-CSobDBH7.js → lov-view-DqD__3-w.js} +2 -2
  52. package/dist/{menuInfo-mFuM30f1.js → menuInfo-a7jPwS1r.js} +1 -1
  53. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BsIPzYg0.js → menuInfo.vue_vue_type_style_index_0_lang-ZzGrkylA.js} +2 -2
  54. package/dist/{pda-app-CIGFsvrX.js → pda-app-EP9d0Ypd.js} +201 -189
  55. package/dist/{resource-mbd4LPi-.js → resource-eughqxkP.js} +1 -1
  56. package/dist/{su-welcome-DruLsVvu.js → su-welcome-98GLKyZM.js} +1 -1
  57. package/dist/{sys-config-TXb5cJM4.js → sys-config-gs16tgwA.js} +1 -1
  58. package/dist/udp-core.css +2 -2
  59. package/dist/{utogether-Cv0UXnEX.js → utogether-C4Dd2epc.js} +1 -1
  60. package/package.json +1 -1
  61. package/src/App.vue +1 -6
  62. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  63. package/src/components/udp/grid.vue +2 -18
  64. package/src/components/udp/index.ts +2 -2
  65. package/src/components/udp/modal-grid.vue +288 -297
  66. package/src/components/udp/utils.ts +11 -18
  67. package/src/main.ts +10 -2
  68. package/src/plugins/i18n/en.ts +24 -13
  69. package/src/plugins/i18n/zh.ts +348 -342
  70. package/src/plugins/vxe-table/index.ts +1 -1
  71. package/src/plugins/vxe-table/render.tsx +92 -17
  72. package/src/style/vxetable.scss +293 -287
  73. package/src/views/organization/org/Org.vue +9 -5
  74. package/src/views/system/menu/SystemMenu.vue +4 -18
  75. package/src/views/system/menu/menuInfo.vue +4 -17
  76. package/src/views/system/role/AuthorityInfo.vue +19 -15
  77. package/src/views/system/role/Role.vue +1 -5
  78. package/src/views/system/role/RolePanel.vue +11 -2
  79. package/src/views/system/role/UserInfo.vue +195 -193
  80. package/src/views/system/role-assign/RolePanel.vue +139 -136
  81. package/src/views/system/sysUser/SysUserPanel.vue +278 -282
  82. package/src/views/uapp/pda/pda-app.vue +36 -11
  83. package/src/views/udev/dict/DictView.vue +6 -1
  84. package/src/views/udev/dict/childView.vue +1 -6
  85. package/src/views/ulogin/login.vue +1 -5
  86. package/src/views/urpt/design/DesignPanel.vue +507 -526
  87. package/src/views/urpt/design/ReportDesign.vue +7 -11
  88. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-BWp7PKyH.js +0 -102
  89. package/dist/Org-BU3oaFx3.js +0 -35
  90. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DYP3u1Nv.js +0 -126
@@ -1,526 +1,507 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2022-03-21 10:36:15
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-04-08 15:38:16
6
- * @Description: 设计面板
7
- -->
8
- <template>
9
- <div v-spinning="loading" class="ut-design-panel">
10
- <el-card class="design-panel-contain">
11
- <el-space style="margin-bottom: 10px" fill>
12
- <div class="flex justify-between">
13
- <div>
14
- <ut-button icon="ri-eye-line ri-1x" content="preview" @tap="handlePreView" />
15
- <el-select
16
- v-model="currentRecord.paperType"
17
- size="small"
18
- placeholder="Select Paper"
19
- class="ml-1 mr-1"
20
- style="width: 100px !important"
21
- @change="handlePaperChange(currentRecord.paperType)"
22
- >
23
- <el-option
24
- v-for="item in dataDict['SU.PRINT.PAPER'].children"
25
- :key="item.dictCode"
26
- :label="item.dictName"
27
- :value="item.dictCode"
28
- >
29
- <span style="float: left">{{ item.dictName }}</span>
30
- <span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">{{
31
- item.dictDesc
32
- }}</span>
33
- </el-option>
34
- </el-select>
35
- <el-popover
36
- v-if="currentRecord.paperType === 'customize'"
37
- v-model:visible="paperPopVisible"
38
- title="设置纸张宽高(mm)"
39
- width="300"
40
- size="small"
41
- effect="light"
42
- trigger="click"
43
- >
44
- <div>
45
- <div class="flex justify-center mb-1" style="width: 100%">
46
- <vxe-input v-model="paperSize.width" type="number" class="w-40" placeholder="宽(mm)" />
47
- <div class="flex items-center justify-center w-8">~</div>
48
- <vxe-input
49
- v-model="paperSize.height"
50
- type="number"
51
- class="w-40"
52
- placeholder="高(mm)"
53
- />
54
- </div>
55
- <ut-button style="width: 100%" content="confirm" @tap="handleCustomSize" />
56
- </div>
57
- <template #reference>
58
- <ut-button
59
- icon="ri-font-size"
60
- content="customSize"
61
- @click.stop="paperPopVisible = true"
62
- />
63
- </template>
64
- </el-popover>
65
- <ut-button
66
- status="u-cyan"
67
- icon="ri-upload-2-line"
68
- content="importJSON"
69
- auth="import"
70
- @tap="handleShowImport()"
71
- />
72
- <vxe-button
73
- icon="ri-indeterminate-circle-line "
74
- class="design-custom-button"
75
- @click="handleScale('N')"
76
- />
77
- <vxe-input
78
- v-model="scale.ration"
79
- disabled
80
- align="center"
81
- style="width: 70px; margin-left: 10px"
82
- />
83
- <vxe-button
84
- icon="ri-add-circle-fill "
85
- class="design-custom-button"
86
- @click="handleScale('Y')"
87
- />
88
- <ut-button
89
- status="danger"
90
- icon="ri-delete-bin-5-fill"
91
- content="repaint"
92
- auth="repaint"
93
- @tap="handleClearPaper()"
94
- />
95
- </div>
96
- <div>
97
- <ut-button icon="ri-save-3-fill" content="save" @tap="handleSave()" />
98
- <ut-button status="info" icon="ri-reply-fill" content="back" @tap="handleClose" />
99
- </div>
100
- </div>
101
- <div style="font-size: 12px; color: red; text-align: center">
102
- 温馨提示:
103
- 蓝色线(页眉)以下,每张纸打印都会重复打印到页面底部;红色线(页尾)以下,每张纸打印都会重复打印到页面底部
104
- </div>
105
- </el-space>
106
- <el-row>
107
- <el-col :span="3">
108
- <el-card class="ut-design-item">
109
- <el-row>
110
- <el-col :span="24" class="rect-printElement-types hiprintEpContainer">
111
- <el-row class="drag_item_title">拖拽组件列表</el-row>
112
- <el-row style="height: 60px">
113
- <el-col :span="12" class="drag_item_box">
114
- <div>
115
- <a class="ep-draggable-item" tid="defaultModule.text">
116
- <span class="ri-text" ariel-hidden="true" />
117
- <p class="glyphicon-class">文本</p>
118
- </a>
119
- </div>
120
- </el-col>
121
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
122
- <div>
123
- <a class="ep-draggable-item" tid="defaultModule.image">
124
- <span class="ri-image-line" ariel-hidden="true" />
125
- <p class="glyphicon-class">图片</p>
126
- </a>
127
- </div>
128
- </el-col>
129
- </el-row>
130
- <el-row style="height: 60px">
131
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
132
- <div>
133
- <a class="ep-draggable-item" tid="defaultModule.longText">
134
- <span class="ri-line-height" ariel-hidden="true" />
135
- <p class="glyphicon-class">长文</p>
136
- </a>
137
- </div>
138
- </el-col>
139
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
140
- <div>
141
- <a class="ep-draggable-item" tid="defaultModule.table">
142
- <span class="ri-table-line" ariel-hidden="true" />
143
- <p class="glyphicon-class">表格</p>
144
- </a>
145
- </div>
146
- </el-col>
147
- </el-row>
148
- <el-row class="drag_item_title">辅助</el-row>
149
- <el-row style="height: 60px">
150
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
151
- <div>
152
- <a class="ep-draggable-item" tid="defaultModule.hline">
153
- <span class="ri-expand-horizontal-s-fill" ariel-hidden="true" />
154
- <p class="glyphicon-class">横线</p>
155
- </a>
156
- </div>
157
- </el-col>
158
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
159
- <div>
160
- <a class="ep-draggable-item" tid="defaultModule.vline">
161
- <span class="ri-expand-vertical-s-fill" ariel-hidden="true" />
162
- <p class="glyphicon-class">竖线</p>
163
- </a>
164
- </div>
165
- </el-col>
166
- </el-row>
167
- <el-row style="height: 60px">
168
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
169
- <div>
170
- <a class="ep-draggable-item" tid="defaultModule.rect">
171
- <span class="ri-square-line" ariel-hidden="true" />
172
- <p class="glyphicon-class">矩形</p>
173
- </a>
174
- </div>
175
- </el-col>
176
- <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
177
- <div>
178
- <a class="ep-draggable-item" tid="defaultModule.oval">
179
- <span class="ri-checkbox-blank-circle-line" ariel-hidden="true" />
180
- <p class="glyphicon-class">椭圆</p>
181
- </a>
182
- </div>
183
- </el-col>
184
- </el-row>
185
- </el-col>
186
- </el-row>
187
- </el-card>
188
- </el-col>
189
- <el-col :xs="15" :sm="15" :md="15" :lg="16" :xl="18">
190
- <el-card class="card-design">
191
- <div id="hiprint-printTemplate" class="hiprint-printTemplate" />
192
- </el-card>
193
- </el-col>
194
- <el-col :xs="6" :sm="6" :md="6" :lg="5" :xl="3">
195
- <el-card class="design-setting-panel">
196
- <el-row class="hinnn-layout-sider">
197
- <div id="PrintElementOptionSetting" />
198
- </el-row>
199
- </el-card>
200
- </el-col>
201
- </el-row>
202
- </el-card>
203
- <vxe-modal v-model="showImportView" title="导入模板JSON数据" height="320" width="450" show-footer>
204
- <template #default>
205
- <p style="color: red">切勿随意修改JSON数据,可能导致模板加载出错</p>
206
- <vxe-textarea v-model="templateContent" :rows="10" size="mini" />
207
- </template>
208
- <template #footer>
209
- <ut-button icon="ri-close-fill" content="cancel" @tap="showImportView = false" />
210
- <ut-button icon="ri-save-3-fill" status="u-cyan" content="confirm" @tap="handleImportJson" />
211
- </template>
212
- </vxe-modal>
213
- <preview v-if="showPreviewModal" ref="previewRef" />
214
- </div>
215
- </template>
216
-
217
- <script setup lang="ts">
218
- import { onMounted, reactive, ref, nextTick, onBeforeUnmount } from 'vue';
219
- import { VXETable } from 'vxe-table';
220
- import { useGlobal } from '@utogether/utils';
221
- import to from 'await-to-js';
222
- import { clone } from 'xe-utils';
223
- import { useSystemStoreHook } from '../../../store/modules/system';
224
- import panel from './panel';
225
- import Preview from './Preview.vue';
226
- // import printData from './print-data';
227
- import { getServiceApi } from '../../../api';
228
- // import { errorMessage } from '@utogether/utils';
229
-
230
- import '../../../style/suprint.css';
231
- import '../../../style/print-lock.css';
232
-
233
- interface IProps {
234
- record: IRecord;
235
- }
236
- const props = withDefaults(defineProps<IProps>(), {
237
- record: (): IRecord => {
238
- return {};
239
- }
240
- });
241
-
242
- let { $printPlugin } = useGlobal();
243
-
244
- const systemStoreHook = useSystemStoreHook();
245
- const dataDict = systemStoreHook.getDataDict;
246
-
247
- const serviceApi = getServiceApi();
248
- let hiprintTemplate = null;
249
- const showPreviewModal = ref(false);
250
- const paperPopVisible = ref(false);
251
- const showImportView = ref(false);
252
- const loading = ref(false);
253
- const previewRef = ref(null);
254
- const templateContent = ref('');
255
- const currentRecord = ref<IRecord>({});
256
- const paperSize = reactive<IRecord>({});
257
- const scale = reactive({ max: 5, min: 0.5, value: 1, ration: '100%' });
258
-
259
- const handleCustomSize = () => {
260
- paperPopVisible.value = false;
261
- hiprintTemplate.setPaper(paperSize.width || 210, paperSize.height || 296.6);
262
- };
263
- // 直接打印(静默打印)
264
- // const handlePictBridge = async () => {
265
- // if (window.hiwebSocket.opened) {
266
- // const data = await serviceApi('CUS003', {});
267
- // const printerList = hiprintTemplate.getPrinterList();
268
- // hiprintTemplate.print2(data, { printer: '', title: 'hiprint测试打印' });
269
- // return;
270
- // }
271
- // errorMessage('客户端未连接,无法直接打印');
272
- // };
273
-
274
- const handleSave = async (cb?) => {
275
- const body = currentRecord.value;
276
- let bt = templateContent.value;
277
- if (!bt) {
278
- const template = hiprintTemplate.getJson();
279
- bt = JSON.stringify(template);
280
- }
281
- body.templateContent = bt;
282
- loading.value = true;
283
- const [err, data] = await to(serviceApi.put('/urpt/v1/printTemplate', [body]));
284
- loading.value = false;
285
- if (!err) {
286
- templateContent.value = '';
287
- currentRecord.value = data[0];
288
- }
289
- cb && cb();
290
- };
291
-
292
- const handleClose = () => {
293
- // hiprint = null
294
- emit('onClose');
295
- };
296
-
297
- const emit = defineEmits<{ (e: 'onClose'): void }>();
298
-
299
- // 放大缩小值
300
- const handleScale = max => {
301
- let scaleValue = scale.value;
302
- if (max === 'Y') {
303
- scaleValue += 0.1;
304
- if (scaleValue > scale.max) scaleValue = 5;
305
- } else {
306
- scaleValue -= 0.1;
307
- if (scaleValue < scale.min) scaleValue = 0.5;
308
- }
309
- if (hiprintTemplate) {
310
- // scaleValue: 放大缩小值, false: 不保存(不传也一样), 如果传 true, 打印时也会放大
311
- hiprintTemplate.zoom(scaleValue);
312
- scale.value = scaleValue;
313
- scale.ration = `${(scaleValue * 100).toFixed(0)}%`;
314
- }
315
- };
316
-
317
- /**
318
- * @Author: liwei
319
- * @Date: 2021-09-01 11:21:05
320
- * @Desc: 参数设置drawer回调,将参数设置dom添加到弹出层中
321
- */
322
- const handleClearPaper = async () => {
323
- const type = await VXETable.modal.confirm('重绘操作不可逆,您确定继续吗?', '温馨提示');
324
- if (type === 'confirm') {
325
- hiprintTemplate.clear();
326
- }
327
- };
328
- const handleShowImport = async () => {
329
- showImportView.value = true;
330
- };
331
- const handleImportJson = async () => {
332
- const type = await VXETable.modal.confirm('导入后将覆盖原有的模板,您确定继续吗?', '温馨提示');
333
- if (type === 'confirm') {
334
- handleSave(handleClose);
335
- showImportView.value = false;
336
- }
337
- };
338
- const handlePreView = async () => {
339
- showPreviewModal.value = true;
340
- // const data = await serviceApi('CUS003', {});
341
- const data = {};
342
- // data.pageSize = 6789;
343
- nextTick(() => {
344
- previewRef.value.show(hiprintTemplate, data, paperSize.width || 220);
345
- });
346
- };
347
- // 纸张切换
348
- const handlePaperChange = code => {
349
- if ('customize' !== code) {
350
- const { width, height } = getPaperSize(code);
351
- paperSize.width = width;
352
- paperSize.height = height;
353
- hiprintTemplate.setPaper(paperSize.width, paperSize.height);
354
- } else {
355
- paperPopVisible.value = true;
356
- }
357
- };
358
- const getPaperSize = code => {
359
- const paper = {
360
- A3: { width: 420, height: 296.6 },
361
- A4: { width: 210, height: 296.6 },
362
- A5: { width: 210, height: 147.6 },
363
- bisect: { width: 241, height: 140 },
364
- trisection: { width: 241, height: 93 }
365
- };
366
- return paper[code];
367
- };
368
-
369
- onMounted(() => {
370
- const { record } = props;
371
- loading.value = true;
372
- currentRecord.value = clone(record, true);
373
- const template = record.templateContent ? JSON.parse(record.templateContent) : panel;
374
- $('#hiprint-printTemplate').empty();
375
- $printPlugin.print.init({
376
- providers: [new $printPlugin.provider()]
377
- });
378
- // 还原配置
379
- $printPlugin.print.setConfig();
380
- // 替换配置
381
- $printPlugin.print.setConfig({
382
- movingDistance: 2.5,
383
- text: {
384
- supportOptions: [
385
- { name: 'styler', hidden: true },
386
- { name: 'formatter', hidden: true }
387
- ]
388
- }
389
- });
390
-
391
- $printPlugin.print.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
392
- hiprintTemplate = new $printPlugin.print.PrintTemplate({
393
- template,
394
- settingContainer: '#PrintElementOptionSetting',
395
- paginationContainer: '.hiprint-printPagination',
396
- history: false // 是否需要 撤销重做功能
397
- });
398
- hiprintTemplate.design('#hiprint-printTemplate', { grid: true });
399
- scale.value = hiprintTemplate.editingPanel.scale || 1;
400
- loading.value = false;
401
- });
402
- onBeforeUnmount(() => {
403
- $printPlugin = null;
404
- hiprintTemplate = null;
405
- });
406
- </script>
407
-
408
- <style lang="scss">
409
- .ut-design-panel {
410
- // .design-panel-contain > .el-card__body {
411
- // height: 85vh;
412
- // padding: 3px !important;
413
- // }
414
-
415
- // .card-design {
416
- // display: flex;
417
- // justify-content: center;
418
- // background: url('./bg.png');
419
- // }
420
-
421
- // ::v-deep(.ut-design-item > .el-card__body) {
422
- // padding: 3px;
423
- // }
424
-
425
- // ::v-deep(.card-design > .el-card__body) {
426
- // height: 75vh;
427
- // overflow: auto;
428
- // }
429
-
430
- ::v-deep(.design-setting-panel > .el-card__body) {
431
- height: 75vh;
432
- padding: 3px;
433
- overflow: auto;
434
- }
435
-
436
- // .el-space {
437
- // width: 100%;
438
- // margin: 5px 0 0 !important;
439
- // }
440
-
441
- // ::v-deep(.el-space__item) {
442
- // width: 100%;
443
- // padding-right: 10px;
444
- // padding-bottom: 0 !important;
445
- // }
446
- }
447
- // 拖拽
448
- .drag_item_box {
449
- height: 100%;
450
- padding: 6px;
451
- }
452
-
453
- .drag_item_box > div {
454
- display: flex;
455
- align-items: center;
456
- justify-content: center;
457
- width: 100%;
458
- height: 100%;
459
- background-color: #fff;
460
- }
461
-
462
- .drag_item_box > div > a {
463
- text-align: center;
464
- text-decoration-line: none;
465
- }
466
-
467
- .drag_item_box > div > a > span {
468
- font-size: 28px;
469
- }
470
-
471
- .drag_item_box > div > a > p {
472
- margin: 0;
473
- }
474
-
475
- .drag_item_title {
476
- padding: 12px 6px 0;
477
- font-size: 14px;
478
- font-weight: bold;
479
- }
480
-
481
- // 默认图片
482
- .design-custom-button {
483
- font-size: 16px;
484
- }
485
-
486
- .el-card__body {
487
- padding: 16px;
488
- }
489
-
490
- .design-setting-panel > .el-card__body {
491
- height: 75vh;
492
- padding: 3px;
493
- overflow: auto;
494
- }
495
-
496
- .design-custom-button:not(.is--disabled):hover {
497
- color: inherit !important;
498
- }
499
-
500
- // 辅助线样式
501
- .toplineOfPosition {
502
- border: 0;
503
- border-top: 1px dashed purple;
504
- }
505
-
506
- .bottomlineOfPosition {
507
- border: 0;
508
- border-top: 1px dashed purple;
509
- }
510
-
511
- .leftlineOfPosition {
512
- border: 0;
513
- border-left: 1px dashed purple;
514
- }
515
-
516
- .rightlineOfPosition {
517
- border: 0;
518
- border-left: 1px dashed purple;
519
- }
520
-
521
- // 设计容器
522
- .card-design {
523
- overflow: hidden;
524
- overflow: auto;
525
- }
526
- </style>
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2022-03-21 10:36:15
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-08-12 09:57:22
6
+ * @Description: 设计面板
7
+ -->
8
+ <template>
9
+ <div v-spinning="loading" class="ut-design-panel">
10
+ <el-card class="design-panel-contain">
11
+ <el-space style="margin-bottom: 10px" fill>
12
+ <div class="flex justify-between">
13
+ <div>
14
+ <ut-button icon="ri-eye-line ri-1x" content="preview" @tap="handlePreView" />
15
+ <el-select
16
+ v-model="currentRecord.paperType"
17
+ size="small"
18
+ placeholder="Select Paper"
19
+ class="ml-1 mr-1"
20
+ style="width: 100px !important"
21
+ @change="handlePaperChange(currentRecord.paperType)"
22
+ >
23
+ <el-option
24
+ v-for="item in dataDict['SU.PRINT.PAPER'].children"
25
+ :key="item.dictCode"
26
+ :label="item.dictName"
27
+ :value="item.dictCode"
28
+ >
29
+ <span style="float: left">{{ item.dictName }}</span>
30
+ <span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">{{
31
+ item.dictDesc
32
+ }}</span>
33
+ </el-option>
34
+ </el-select>
35
+ <el-popover
36
+ v-if="currentRecord.paperType === 'customize'"
37
+ v-model:visible="paperPopVisible"
38
+ title="设置纸张宽高(mm)"
39
+ width="300"
40
+ size="small"
41
+ effect="light"
42
+ trigger="click"
43
+ >
44
+ <div>
45
+ <div class="flex justify-center mb-1" style="width: 100%">
46
+ <vxe-input v-model="paperSize.width" type="number" class="w-40" placeholder="宽(mm)" />
47
+ <div class="flex items-center justify-center w-8">~</div>
48
+ <vxe-input v-model="paperSize.height" type="number" class="w-40" placeholder="高(mm)" />
49
+ </div>
50
+ <ut-button style="width: 100%" content="confirm" @tap="handleCustomSize" />
51
+ </div>
52
+ <template #reference>
53
+ <ut-button icon="ri-font-size" content="customSize" @tap.stop="paperPopVisible = true" />
54
+ </template>
55
+ </el-popover>
56
+ <ut-button
57
+ status="u-cyan"
58
+ icon="ri-upload-2-line"
59
+ content="importJSON"
60
+ auth="import"
61
+ @tap="handleShowImport()"
62
+ />
63
+ <vxe-button icon="ri-indeterminate-circle-line " class="design-custom-button" @click="handleScale('N')" />
64
+ <vxe-input v-model="scale.ration" disabled align="center" style="width: 70px; margin-left: 10px" />
65
+ <vxe-button icon="ri-add-circle-fill " class="design-custom-button" @click="handleScale('Y')" />
66
+ <ut-button
67
+ status="danger"
68
+ icon="ri-delete-bin-5-fill"
69
+ content="repaint"
70
+ auth="repaint"
71
+ @tap="handleClearPaper()"
72
+ />
73
+ </div>
74
+ <div>
75
+ <ut-button icon="ri-save-3-fill" content="save" @tap="handleSave()" />
76
+ <ut-button status="info" icon="ri-reply-fill" content="back" @tap="handleClose" />
77
+ </div>
78
+ </div>
79
+ <div style="font-size: 12px; color: red; text-align: center">
80
+ 温馨提示: 蓝色线(页眉)以下,每张纸打印都会重复打印到页面底部;红色线(页尾)以下,每张纸打印都会重复打印到页面底部
81
+ </div>
82
+ </el-space>
83
+ <el-row>
84
+ <el-col :span="3">
85
+ <el-card class="ut-design-item">
86
+ <el-row>
87
+ <el-col :span="24" class="rect-printElement-types hiprintEpContainer">
88
+ <el-row class="drag_item_title">拖拽组件列表</el-row>
89
+ <el-row style="height: 60px">
90
+ <el-col :span="12" class="drag_item_box">
91
+ <div>
92
+ <a class="ep-draggable-item" tid="defaultModule.text">
93
+ <span class="ri-text" ariel-hidden="true" />
94
+ <p class="glyphicon-class">文本</p>
95
+ </a>
96
+ </div>
97
+ </el-col>
98
+ <el-col :span="12" class="drag_item_box">
99
+ <div>
100
+ <a class="ep-draggable-item" tid="defaultModule.image">
101
+ <span class="ri-image-line" ariel-hidden="true" />
102
+ <p class="glyphicon-class">图片</p>
103
+ </a>
104
+ </div>
105
+ </el-col>
106
+ </el-row>
107
+ <el-row style="height: 60px">
108
+ <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
109
+ <div>
110
+ <a class="ep-draggable-item" tid="defaultModule.longText">
111
+ <span class="ri-line-height" ariel-hidden="true" />
112
+ <p class="glyphicon-class">长文</p>
113
+ </a>
114
+ </div>
115
+ </el-col>
116
+ <el-col :span="12" class="drag_item_box">
117
+ <div>
118
+ <a class="ep-draggable-item" tid="defaultModule.table">
119
+ <span class="ri-table-line" ariel-hidden="true" />
120
+ <p class="glyphicon-class">表格</p>
121
+ </a>
122
+ </div>
123
+ </el-col>
124
+ </el-row>
125
+ <el-row class="drag_item_title">辅助</el-row>
126
+ <el-row style="height: 60px">
127
+ <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
128
+ <div>
129
+ <a class="ep-draggable-item" tid="defaultModule.hline">
130
+ <span class="ri-expand-horizontal-s-fill" ariel-hidden="true" />
131
+ <p class="glyphicon-class">横线</p>
132
+ </a>
133
+ </div>
134
+ </el-col>
135
+ <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
136
+ <div>
137
+ <a class="ep-draggable-item" tid="defaultModule.vline">
138
+ <span class="ri-expand-vertical-s-fill" ariel-hidden="true" />
139
+ <p class="glyphicon-class">竖线</p>
140
+ </a>
141
+ </div>
142
+ </el-col>
143
+ </el-row>
144
+ <el-row style="height: 60px">
145
+ <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
146
+ <div>
147
+ <a class="ep-draggable-item" tid="defaultModule.rect">
148
+ <span class="ri-square-line" ariel-hidden="true" />
149
+ <p class="glyphicon-class">矩形</p>
150
+ </a>
151
+ </div>
152
+ </el-col>
153
+ <el-col :span="12" class="drag_item_box" tid="defaultModule.text">
154
+ <div>
155
+ <a class="ep-draggable-item" tid="defaultModule.oval">
156
+ <span class="ri-checkbox-blank-circle-line" ariel-hidden="true" />
157
+ <p class="glyphicon-class">椭圆</p>
158
+ </a>
159
+ </div>
160
+ </el-col>
161
+ </el-row>
162
+ </el-col>
163
+ </el-row>
164
+ </el-card>
165
+ </el-col>
166
+ <el-col :xs="15" :sm="15" :md="15" :lg="16" :xl="18">
167
+ <el-card class="card-design">
168
+ <div id="hiprint-printTemplate" class="hiprint-printTemplate" />
169
+ </el-card>
170
+ </el-col>
171
+ <el-col :xs="6" :sm="6" :md="6" :lg="5" :xl="3">
172
+ <el-card class="design-setting-panel">
173
+ <el-row class="hinnn-layout-sider">
174
+ <div id="PrintElementOptionSetting" />
175
+ </el-row>
176
+ </el-card>
177
+ </el-col>
178
+ </el-row>
179
+ </el-card>
180
+ <vxe-modal v-model="showImportView" title="导入模板JSON数据" height="320" width="450" show-footer>
181
+ <template #default>
182
+ <p style="color: red">切勿随意修改JSON数据,可能导致模板加载出错</p>
183
+ <vxe-textarea v-model="templateContent" :rows="10" size="mini" />
184
+ </template>
185
+ <template #footer>
186
+ <ut-button icon="ri-close-fill" content="cancel" @tap="showImportView = false" />
187
+ <ut-button icon="ri-save-3-fill" status="u-cyan" content="confirm" @tap="handleImportJson" />
188
+ </template>
189
+ </vxe-modal>
190
+ <preview v-if="showPreviewModal" ref="previewRef" />
191
+ </div>
192
+ </template>
193
+
194
+ <script setup lang="ts">
195
+ import { onMounted, reactive, ref, nextTick, onBeforeUnmount } from 'vue';
196
+ import { VxeUI } from 'vxe-pc-ui';
197
+ import { useGlobal } from '@utogether/utils';
198
+ import to from 'await-to-js';
199
+ import { clone } from 'xe-utils';
200
+ import { useSystemStoreHook } from '../../../store/modules/system';
201
+ import panel from './panel';
202
+ import Preview from './Preview.vue';
203
+ // import printData from './print-data';
204
+ import { getServiceApi } from '../../../api';
205
+ // import { errorMessage } from '@utogether/utils';
206
+
207
+ import '../../../style/suprint.css';
208
+ import '../../../style/print-lock.css';
209
+
210
+ interface IProps {
211
+ record: IRecord;
212
+ }
213
+ const props = withDefaults(defineProps<IProps>(), {
214
+ record: (): IRecord => {
215
+ return {};
216
+ }
217
+ });
218
+
219
+ let { $printPlugin } = useGlobal();
220
+
221
+ const systemStoreHook = useSystemStoreHook();
222
+ const dataDict = systemStoreHook.getDataDict;
223
+
224
+ const serviceApi = getServiceApi();
225
+ let hiprintTemplate = null;
226
+ const showPreviewModal = ref(false);
227
+ const paperPopVisible = ref(false);
228
+ const showImportView = ref(false);
229
+ const loading = ref(false);
230
+ const previewRef = ref(null);
231
+ const templateContent = ref('');
232
+ const currentRecord = ref<IRecord>({});
233
+ const paperSize = reactive<IRecord>({});
234
+ const scale = reactive({ max: 5, min: 0.5, value: 1, ration: '100%' });
235
+
236
+ const handleCustomSize = () => {
237
+ paperPopVisible.value = false;
238
+ hiprintTemplate.setPaper(paperSize.width || 210, paperSize.height || 296.6);
239
+ };
240
+ // 直接打印(静默打印)
241
+ // const handlePictBridge = async () => {
242
+ // if (window.hiwebSocket.opened) {
243
+ // const data = await serviceApi('CUS003', {});
244
+ // const printerList = hiprintTemplate.getPrinterList();
245
+ // hiprintTemplate.print2(data, { printer: '', title: 'hiprint测试打印' });
246
+ // return;
247
+ // }
248
+ // errorMessage('客户端未连接,无法直接打印');
249
+ // };
250
+
251
+ const handleSave = async (cb?) => {
252
+ const body = currentRecord.value;
253
+ let bt = templateContent.value;
254
+ if (!bt) {
255
+ const template = hiprintTemplate.getJson();
256
+ bt = JSON.stringify(template);
257
+ }
258
+ body.templateContent = bt;
259
+ loading.value = true;
260
+ const [err, data] = await to(serviceApi.put('/urpt/v1/printTemplate', [body]));
261
+ loading.value = false;
262
+ if (!err) {
263
+ templateContent.value = '';
264
+ currentRecord.value = data[0];
265
+ }
266
+ cb && cb();
267
+ };
268
+
269
+ const handleClose = () => {
270
+ // hiprint = null
271
+ emit('onClose');
272
+ };
273
+
274
+ const emit = defineEmits<{ (e: 'onClose'): void }>();
275
+
276
+ // 放大缩小值
277
+ const handleScale = max => {
278
+ let scaleValue = scale.value;
279
+ if (max === 'Y') {
280
+ scaleValue += 0.1;
281
+ if (scaleValue > scale.max) scaleValue = 5;
282
+ } else {
283
+ scaleValue -= 0.1;
284
+ if (scaleValue < scale.min) scaleValue = 0.5;
285
+ }
286
+ if (hiprintTemplate) {
287
+ // scaleValue: 放大缩小值, false: 不保存(不传也一样), 如果传 true, 打印时也会放大
288
+ hiprintTemplate.zoom(scaleValue);
289
+ scale.value = scaleValue;
290
+ scale.ration = `${(scaleValue * 100).toFixed(0)}%`;
291
+ }
292
+ };
293
+
294
+ /**
295
+ * @Author: liwei
296
+ * @Date: 2021-09-01 11:21:05
297
+ * @Desc: 参数设置drawer回调,将参数设置dom添加到弹出层中
298
+ */
299
+ const handleClearPaper = async () => {
300
+ const type = await VxeUI.modal.confirm('重绘操作不可逆,您确定继续吗?', '温馨提示');
301
+ if (type === 'confirm') {
302
+ hiprintTemplate.clear();
303
+ }
304
+ };
305
+ const handleShowImport = async () => {
306
+ showImportView.value = true;
307
+ };
308
+ const handleImportJson = async () => {
309
+ const type = await VxeUI.modal.confirm('导入后将覆盖原有的模板,您确定继续吗?', '温馨提示');
310
+ if (type === 'confirm') {
311
+ handleSave(handleClose);
312
+ showImportView.value = false;
313
+ }
314
+ };
315
+ const handlePreView = async () => {
316
+ showPreviewModal.value = true;
317
+ // const data = await serviceApi('CUS003', {});
318
+ const data = {};
319
+ // data.pageSize = 6789;
320
+ nextTick(() => {
321
+ previewRef.value.show(hiprintTemplate, data, paperSize.width || 220);
322
+ });
323
+ };
324
+ // 纸张切换
325
+ const handlePaperChange = code => {
326
+ if ('customize' !== code) {
327
+ const { width, height } = getPaperSize(code);
328
+ paperSize.width = width;
329
+ paperSize.height = height;
330
+ hiprintTemplate.setPaper(paperSize.width, paperSize.height);
331
+ } else {
332
+ paperPopVisible.value = true;
333
+ }
334
+ };
335
+ const getPaperSize = code => {
336
+ const paper = {
337
+ A3: { width: 420, height: 296.6 },
338
+ A4: { width: 210, height: 296.6 },
339
+ A5: { width: 210, height: 147.6 },
340
+ bisect: { width: 241, height: 140 },
341
+ trisection: { width: 241, height: 93 }
342
+ };
343
+ return paper[code];
344
+ };
345
+
346
+ onMounted(() => {
347
+ const { record } = props;
348
+ loading.value = true;
349
+ currentRecord.value = clone(record, true);
350
+ const template = record.templateContent ? JSON.parse(record.templateContent) : panel;
351
+ $('#hiprint-printTemplate').empty();
352
+ $printPlugin.print.init({
353
+ providers: [new $printPlugin.provider()]
354
+ });
355
+ // 还原配置
356
+ $printPlugin.print.setConfig();
357
+ // 替换配置
358
+ $printPlugin.print.setConfig({
359
+ movingDistance: 2.5,
360
+ text: {
361
+ supportOptions: [
362
+ { name: 'styler', hidden: true },
363
+ { name: 'formatter', hidden: true }
364
+ ]
365
+ }
366
+ });
367
+
368
+ $printPlugin.print.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
369
+ hiprintTemplate = new $printPlugin.print.PrintTemplate({
370
+ template,
371
+ settingContainer: '#PrintElementOptionSetting',
372
+ paginationContainer: '.hiprint-printPagination',
373
+ history: false // 是否需要 撤销重做功能
374
+ });
375
+ hiprintTemplate.design('#hiprint-printTemplate', { grid: true });
376
+ scale.value = hiprintTemplate.editingPanel.scale || 1;
377
+ loading.value = false;
378
+ });
379
+ onBeforeUnmount(() => {
380
+ $printPlugin = null;
381
+ hiprintTemplate = null;
382
+ });
383
+ </script>
384
+
385
+ <style lang="scss">
386
+ .ut-design-panel {
387
+ // .design-panel-contain > .el-card__body {
388
+ // height: 85vh;
389
+ // padding: 3px !important;
390
+ // }
391
+
392
+ // .card-design {
393
+ // display: flex;
394
+ // justify-content: center;
395
+ // background: url('./bg.png');
396
+ // }
397
+
398
+ // ::v-deep(.ut-design-item > .el-card__body) {
399
+ // padding: 3px;
400
+ // }
401
+
402
+ // ::v-deep(.card-design > .el-card__body) {
403
+ // height: 75vh;
404
+ // overflow: auto;
405
+ // }
406
+
407
+ ::v-deep(.design-setting-panel > .el-card__body) {
408
+ height: 75vh;
409
+ padding: 3px;
410
+ overflow: auto;
411
+ }
412
+
413
+ // .el-space {
414
+ // width: 100%;
415
+ // margin: 5px 0 0 !important;
416
+ // }
417
+
418
+ // ::v-deep(.el-space__item) {
419
+ // width: 100%;
420
+ // padding-right: 10px;
421
+ // padding-bottom: 0 !important;
422
+ // }
423
+ }
424
+ // 拖拽
425
+ .drag_item_box {
426
+ height: 100%;
427
+ padding: 6px;
428
+ }
429
+
430
+ .drag_item_box > div {
431
+ display: flex;
432
+ align-items: center;
433
+ justify-content: center;
434
+ width: 100%;
435
+ height: 100%;
436
+ background-color: #fff;
437
+ }
438
+
439
+ .drag_item_box > div > a {
440
+ text-align: center;
441
+ text-decoration-line: none;
442
+ }
443
+
444
+ .drag_item_box > div > a > span {
445
+ font-size: 28px;
446
+ }
447
+
448
+ .drag_item_box > div > a > p {
449
+ margin: 0;
450
+ }
451
+
452
+ .drag_item_title {
453
+ padding: 12px 6px 0;
454
+ font-size: 14px;
455
+ font-weight: bold;
456
+ }
457
+
458
+ // 默认图片
459
+ .design-custom-button {
460
+ font-size: 16px;
461
+ }
462
+
463
+ .el-card__body {
464
+ padding: 16px;
465
+ }
466
+
467
+ .design-setting-panel > .el-card__body {
468
+ height: 75vh;
469
+ padding: 3px;
470
+ overflow: auto;
471
+ }
472
+
473
+ .design-custom-button:not(.is--disabled):hover {
474
+ color: inherit !important;
475
+ }
476
+
477
+ // 辅助线样式
478
+ .toplineOfPosition {
479
+ border: 0;
480
+ border-top: 1px dashed purple;
481
+ }
482
+
483
+ .bottomlineOfPosition {
484
+ border: 0;
485
+ border-top: 1px dashed purple;
486
+ }
487
+
488
+ .leftlineOfPosition {
489
+ border: 0;
490
+ border-left: 1px dashed purple;
491
+ }
492
+
493
+ .rightlineOfPosition {
494
+ border: 0;
495
+ border-left: 1px dashed purple;
496
+ }
497
+
498
+ // 设计容器
499
+ .card-design {
500
+ overflow: hidden;
501
+ overflow: auto;
502
+ }
503
+
504
+ .hiprint-printElement-image-content img {
505
+ content: url('/logo.png');
506
+ }
507
+ </style>