yh-hiprint 2.6.12 → 2.6.14

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.
@@ -247,7 +247,7 @@
247
247
  <el-col :span="8">
248
248
  <a
249
249
  class="ep-draggable-item"
250
- tid="defaultModule.text">
250
+ tid="text">
251
251
  <i class="iconfont icon-font-size"></i>
252
252
  <span>文本</span>
253
253
  </a>
@@ -255,7 +255,7 @@
255
255
  <el-col :span="8">
256
256
  <a
257
257
  class="ep-draggable-item"
258
- tid="defaultModule.textVal">
258
+ tid="textVal">
259
259
  <i class="iconfont icon-font-size"></i>
260
260
  <span>值(文本)</span>
261
261
  </a>
@@ -263,7 +263,7 @@
263
263
  <el-col :span="8">
264
264
  <a
265
265
  class="ep-draggable-item"
266
- tid="defaultModule.image">
266
+ tid="image">
267
267
  <i class="iconfont icon-image-fill"></i>
268
268
  <span>图片</span>
269
269
  </a>
@@ -271,7 +271,7 @@
271
271
  <el-col :span="8">
272
272
  <a
273
273
  class="ep-draggable-item"
274
- tid="defaultModule.longText">
274
+ tid="longText">
275
275
  <i class="iconfont icon-file-text"></i>
276
276
  <span>长文本</span>
277
277
  </a>
@@ -279,7 +279,7 @@
279
279
  <el-col :span="8">
280
280
  <a
281
281
  class="ep-draggable-item"
282
- tid="defaultModule.table">
282
+ tid="table">
283
283
  <i class="iconfont icon-table"></i>
284
284
  <span>表格</span>
285
285
  </a>
@@ -287,7 +287,7 @@
287
287
  <el-col :span="8">
288
288
  <a
289
289
  class="ep-draggable-item"
290
- tid="defaultModule.emptyTable">
290
+ tid="emptyTable">
291
291
  <i class="iconfont icon-layout"></i>
292
292
  <span>空白表格</span>
293
293
  </a>
@@ -295,7 +295,7 @@
295
295
  <el-col :span="8">
296
296
  <a
297
297
  class="ep-draggable-item"
298
- tid="defaultModule.html">
298
+ tid="html">
299
299
  <i class="iconfont icon-HTML"></i>
300
300
  <span>html</span>
301
301
  </a>
@@ -303,7 +303,7 @@
303
303
  <el-col :span="8">
304
304
  <a
305
305
  class="ep-draggable-item"
306
- tid="defaultModule.customText">
306
+ tid="customText">
307
307
  <i class="iconfont icon-container-fill"></i>
308
308
  <span>自定义文本</span>
309
309
  </a>
@@ -311,7 +311,7 @@
311
311
  <el-col :span="8">
312
312
  <a
313
313
  class="ep-draggable-item"
314
- tid="defaultModule.barcode">
314
+ tid="barcode">
315
315
  <i class="iconfont icon-barcode"></i>
316
316
  <span>条形码</span>
317
317
  </a>
@@ -319,7 +319,7 @@
319
319
  <el-col :span="8">
320
320
  <a
321
321
  class="ep-draggable-item"
322
- tid="defaultModule.qrcode">
322
+ tid="qrcode">
323
323
  <i class="iconfont icon-qrcode"></i>
324
324
  <span>二维码</span>
325
325
  </a>
@@ -330,7 +330,7 @@
330
330
  <el-col :span="8">
331
331
  <a
332
332
  class="ep-draggable-item"
333
- tid="defaultModule.hline">
333
+ tid="hline">
334
334
  <i class="iconfont icon-border-verticle"></i>
335
335
  <span>横线</span>
336
336
  </a>
@@ -338,7 +338,7 @@
338
338
  <el-col :span="8">
339
339
  <a
340
340
  class="ep-draggable-item"
341
- tid="defaultModule.vline">
341
+ tid="vline">
342
342
  <i class="iconfont icon-border-horizontal"></i>
343
343
  <span>竖线</span>
344
344
  </a>
@@ -346,7 +346,7 @@
346
346
  <el-col :span="8">
347
347
  <a
348
348
  class="ep-draggable-item"
349
- tid="defaultModule.rect">
349
+ tid="rect">
350
350
  <i class="iconfont icon-border"></i>
351
351
  <span>矩形</span>
352
352
  </a>
@@ -354,7 +354,7 @@
354
354
  <el-col :span="8">
355
355
  <a
356
356
  class="ep-draggable-item"
357
- tid="defaultModule.oval">
357
+ tid="oval">
358
358
  <i class="iconfont icon-round"></i>
359
359
  <span>椭圆</span>
360
360
  </a>
@@ -430,769 +430,752 @@
430
430
  </el-dialog>
431
431
  </template>
432
432
  <script setup lang="ts">
433
- // @ts-nocheck
434
- import {onMounted, ref, onActivated, onDeactivated, computed, watch, shallowRef} from 'vue';
435
- import {hiprint, defaultElementTypeProvider, fontSize, scale, zIndex, panel, usePaper, useScale, useDataSource} from 'yh-hiprint';
436
- import {useRoute, onBeforeRouteUpdate} from 'vue-router';
437
- import {toValue} from '@vueuse/core';
438
- import {ElMessageBox, ElMessage} from 'element-plus';
439
- import axios from '@/libs/api.request';
433
+ // @ts-nocheck
434
+ import {onMounted, ref, onActivated, onDeactivated, computed, watch, shallowRef} from 'vue';
435
+ import {
436
+ hiprint,
437
+ defaultElementTypeProvider,
438
+ fontSize,
439
+ scale,
440
+ zIndex,
441
+ panel,
442
+ usePaper,
443
+ useScale,
444
+ useDataSource,
445
+ } from 'yh-hiprint';
446
+ import {useRoute, onBeforeRouteUpdate} from 'vue-router';
447
+ import {toValue} from '@vueuse/core';
448
+ import {ElMessageBox, ElMessage} from 'element-plus';
449
+ import axios from '@/libs/api.request';
450
+ import previewHiprint from './libs/previewHiprint';
451
+ import {defaultPrintElement} from 'yh-hiprint';
440
452
 
441
- interface HiprintTemplate {
442
- setPaper: (width: number, height: number) => void;
443
- zoom: (scale: number) => void;
444
- getJson: () => any;
445
- clear: () => void;
446
- }
453
+ const route = useRoute();
454
+ const hiprintTemplate = shallowRef<HiprintTemplate | null>(null);
447
455
 
448
- const route = useRoute();
449
- const hiprintTemplate = shallowRef<HiprintTemplate | null>(null);
456
+ const {paperType, paperTypeName, paperTypesObj, paperWidth, paperHeight, setPaper} = usePaper();
450
457
 
451
- const {paperType, paperTypeName, paperTypesObj, paperWidth, paperHeight, setPaper} = usePaper();
452
- function setPaperHandler(type) {
453
- setPaper(type, () => {
454
- hiprintTemplate.value?.setPaper(paperWidth.value, paperHeight.value);
458
+ const canvasRef = ref();
459
+ const {scaleValue, scalePercentage, canZoomIn, canZoomOut, zoomIn, zoomOut} = useScale(() => {
460
+ hiprintTemplate.value?.zoom(scaleValue.value);
461
+ canvasRef?.value.update();
455
462
  });
456
- }
457
463
 
458
- const canvasRef = ref();
459
- const {scaleValue, scalePercentage, canZoomIn, canZoomOut, zoomIn, zoomOut} = useScale(() => {
460
- hiprintTemplate.value?.zoom(scaleValue.value);
461
- canvasRef?.value.update();
462
- });
463
-
464
- const previewShow = ref(false);
465
- const previewHtml = ref('');
466
- async function previewPrint() {
467
- let {
468
- data: {list, json},
469
- } = await axios.request({
470
- url: `/printTemplate/data/${detailData.value.code}`,
471
- method: 'post',
472
- type: 'json',
473
- data: [
474
- {
475
- code: '50101820',
476
- },
477
- ],
478
- });
479
- if (json) {
480
- if (Array.isArray(list) && list.length > 0) {
481
- list = list.map((item) => {
482
- let printData = {};
483
- let datas = Object.entries(item);
484
- datas.forEach((arr) => {
485
- if (Array.isArray(arr[1])) {
486
- printData[arr[0]] = arr[1];
487
- } else {
488
- if (arr[1] !== null) {
489
- let itemsEntries = Object.entries(arr[1]);
490
- itemsEntries.forEach((cArr) => {
491
- printData[`$${arr[0]}[${cArr[0]}]`] = cArr[1];
492
- });
493
- }
494
- }
495
- });
496
- return printData;
497
- });
498
- } else {
499
- list = [];
500
- }
501
- previewHtml.value = new hiprint.PrintTemplate({template: JSON.parse(json)}).getHtml(list)[0].innerHTML;
502
- previewShow.value = true;
503
- } else {
504
- ElMessage.warning({
505
- message: '模板配置不存在,请检查',
506
- });
464
+ async function previewPrint() {
465
+ previewHiprint(detailData.value.code);
507
466
  }
508
- }
509
-
510
- function saveConfig() {
511
- let arr = [].concat(formCode.value);
512
- let json = hiprintTemplate.value?.getJson();
513
- json.panels[0].printElements.forEach((item) => {
514
- if (item.printElementType.type === 'table') {
515
- arr.push(item.options.field);
516
- }
517
- });
518
467
 
519
- axios
520
- .request({
521
- url: '/printTemplate/save',
522
- method: 'post',
523
- type: 'json',
524
- data: {
525
- id: detailData.value.id,
526
- json: JSON.stringify(json),
527
- dsIds: arr.join(','),
528
- },
529
- })
530
- .then((res) => {
531
- ElMessage.success({
532
- message: '恭喜模板保存成功',
533
- });
468
+ function saveConfig() {
469
+ let arr = [].concat(formCode.value);
470
+ let json = hiprintTemplate.value?.getJson();
471
+ json.panels[0].printElements.forEach((item) => {
472
+ if (item.printElementType.type === 'table') {
473
+ arr.push(item.options.field);
474
+ }
534
475
  });
535
- }
536
476
 
537
- function clearPrint() {
538
- hiprintTemplate.value?.clear();
539
- }
477
+ axios
478
+ .request({
479
+ url: '/printTemplate/save',
480
+ method: 'post',
481
+ type: 'json',
482
+ data: {
483
+ id: detailData.value.id,
484
+ json: JSON.stringify(json),
485
+ dsIds: arr.join(','),
486
+ },
487
+ })
488
+ .then((res) => {
489
+ ElMessage.success({
490
+ message: '恭喜模板保存成功',
491
+ });
492
+ });
493
+ }
540
494
 
541
- function testUpdate() {
542
- let els = hiprintTemplate.value.getSelectEls();
543
- window.a = els[0];
544
- a.options.top = a.options.top + 10;
545
- hiprintJQuery(a.designTarget[0]).css('top', a.options.displayTop());
546
- }
495
+ function clearPrint() {
496
+ hiprintTemplate.value?.clear();
497
+ }
547
498
 
548
- const {detailData, getDetail, listCode, dataSourceList, listColumns, formCode, formColumns, dataSourceForm, getDataSourceList} = useDataSource(axios);
499
+ const {
500
+ detailData,
501
+ getDetail,
502
+ listCode,
503
+ dataSourceList,
504
+ listColumns,
505
+ formCode,
506
+ formColumns,
507
+ dataSourceForm,
508
+ getDataSourceList,
509
+ } = useDataSource(axios);
549
510
 
550
- watch(
551
- () => formColumns.value,
552
- (val) => {
553
- if (val && val.length && hiprintTemplate.value) {
554
- hiprintTemplate.value.setFields(
555
- val.map((item) => {
556
- return {
557
- field: item,
558
- text: item,
559
- };
560
- })
561
- );
562
- } else {
563
- hiprintTemplate.value?.setFields('');
511
+ watch(
512
+ () => formColumns.value,
513
+ (val) => {
514
+ if (val && val.length && hiprintTemplate.value) {
515
+ hiprintTemplate.value.setFields(
516
+ val.map((item) => {
517
+ return {
518
+ field: item,
519
+ text: item,
520
+ };
521
+ })
522
+ );
523
+ } else {
524
+ hiprintTemplate.value?.setFields('');
525
+ }
526
+ },
527
+ {
528
+ deep: true,
529
+ immediate: true,
564
530
  }
565
- },
566
- {
567
- deep: true,
568
- immediate: true,
569
- }
570
- );
531
+ );
571
532
 
572
- const selectedEle = shallowRef([]);
533
+ const selectedEle = shallowRef([]);
573
534
 
574
- const isLessThanTwoSelected = computed(() => {
575
- return !selectedEle.value || selectedEle.value.length < 2;
576
- });
535
+ const isLessThanTwoSelected = computed(() => {
536
+ return !selectedEle.value || selectedEle.value.length < 2;
537
+ });
577
538
 
578
- const isMoreThanTwoSelected = computed(() => {
579
- return selectedEle.value && selectedEle.value.length >= 2;
580
- });
539
+ const isMoreThanTwoSelected = computed(() => {
540
+ return selectedEle.value && selectedEle.value.length >= 2;
541
+ });
581
542
 
582
- const isMoreSelected = computed(() => {
583
- return selectedEle.value && selectedEle.value.length >= 3;
584
- });
543
+ const isMoreSelected = computed(() => {
544
+ return selectedEle.value && selectedEle.value.length >= 3;
545
+ });
585
546
 
586
- let selectedTableEle = ref(null);
547
+ let selectedTableEle = ref(null);
587
548
 
588
- let selectedTableEleColumns = computed(() => {
589
- if (selectedTableEle.value && selectedTableEle.value.printElementType.type === 'table') {
590
- return selectedTableEle.value.options?.columns[0]['columns'] || [];
591
- } else {
592
- return [];
593
- }
594
- });
549
+ let selectedTableEleColumns = computed(() => {
550
+ if (selectedTableEle.value && selectedTableEle.value.printElementType.type === 'table') {
551
+ return selectedTableEle.value.options?.columns[0]['columns'] || [];
552
+ } else {
553
+ return [];
554
+ }
555
+ });
595
556
 
596
- function onAlign(e) {
597
- switch (e) {
598
- case 'top':
599
- let tys = selectedEle.value.map((item) => item.options.top);
600
- let tminY = Math.min(...tys);
601
- selectedEle.value.forEach((item) => {
602
- item.options.top = tminY;
603
- hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
604
- });
605
- break;
606
- case 'middle':
607
- let mys = selectedEle.value.map((item) => item.options.top);
608
- let mminY = Math.min(...mys);
609
- let mbaseIndex = mys.indexOf(mminY);
610
- let mbaseObj = selectedEle.value[mbaseIndex];
611
- let baseY = mbaseObj.options.height / 2 + mbaseObj.options.top;
612
- selectedEle.value.forEach((item, index) => {
613
- if (mbaseIndex !== index) {
614
- item.options.top = baseY - item.options.height / 2;
557
+ function onAlign(e) {
558
+ switch (e) {
559
+ case 'top':
560
+ let tys = selectedEle.value.map((item) => item.options.top);
561
+ let tminY = Math.min(...tys);
562
+ selectedEle.value.forEach((item) => {
563
+ item.options.top = tminY;
615
564
  hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
616
- }
617
- });
618
- break;
619
- case 'bottom':
620
- let bys = selectedEle.value.map((item) => item.options.top + item.options.height);
621
- let bmaxY = Math.max(...bys);
622
- selectedEle.value.forEach((item) => {
623
- item.options.top = bmaxY - item.options.height;
624
- hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
625
- });
626
- break;
627
- case 'left':
628
- let lxs = selectedEle.value.map((item) => item.options.left);
629
- let lminX = Math.min(...lxs);
630
- selectedEle.value.forEach((item) => {
631
- item.options.left = lminX;
632
- hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
633
- });
634
- break;
635
- case 'center':
636
- let cxs = selectedEle.value.map((item) => item.options.left);
637
- let cminX = Math.min(...cxs);
638
- let cbaseIndex = cxs.indexOf(cminX);
639
- let cbaseObj = selectedEle.value[cbaseIndex];
640
- let baseX = cbaseObj.options.width / 2 + cbaseObj.options.left;
641
- selectedEle.value.forEach((item, index) => {
642
- if (cbaseIndex !== index) {
643
- item.options.left = baseX - item.options.width / 2;
644
- hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
645
- }
646
- });
647
- break;
648
- case 'right':
649
- let rxs = selectedEle.value.map((item) => item.options.left + item.options.width);
650
- let rmaxX = Math.max(...rxs);
651
- selectedEle.value.forEach((item) => {
652
- item.options.left = rmaxX - item.options.width;
653
- hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
654
- });
655
- break;
656
- default:
657
- break;
658
- }
659
- }
660
-
661
- function onSplit(key) {
662
- switch (key) {
663
- case 'horizontal':
664
- let lxs = selectedEle.value.map((item) => item.options.left);
665
- let rxs = selectedEle.value.map((item) => item.options.left + item.options.width);
666
- let minlx = Math.min(...lxs);
667
- let maxrx = Math.max(...rxs);
668
- let minlxIndex = lxs.indexOf(minlx);
669
- let maxrxIndex = rxs.indexOf(maxrx);
670
- if (minlxIndex !== maxrxIndex) {
671
- let sortCompos = selectedEle.value.sort((a, b) => {
672
- return a.options.left - b.options.left;
673
565
  });
674
- let countWidth = 0;
675
- sortCompos.forEach((item) => {
676
- countWidth += item.options.width;
677
- });
678
- let countGap = maxrx - minlx - countWidth;
679
- let gap = countGap / (sortCompos.length - 1);
680
- sortCompos.forEach((item, index, arr) => {
681
- if (index > 0 && index < arr.length - 1) {
682
- let preItem = arr[index - 1];
683
- item.options.left = preItem.options.left + preItem.options.width + gap;
684
- hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
566
+ break;
567
+ case 'middle':
568
+ let mys = selectedEle.value.map((item) => item.options.top);
569
+ let mminY = Math.min(...mys);
570
+ let mbaseIndex = mys.indexOf(mminY);
571
+ let mbaseObj = selectedEle.value[mbaseIndex];
572
+ let baseY = mbaseObj.options.height / 2 + mbaseObj.options.top;
573
+ selectedEle.value.forEach((item, index) => {
574
+ if (mbaseIndex !== index) {
575
+ item.options.top = baseY - item.options.height / 2;
576
+ hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
685
577
  }
686
578
  });
687
- } else {
688
- // TODO 此处隐藏了操作提示,这一处提示是告知为什么不能进行操作的原因,不过措辞没有研究好。所以遇到这种情况暂时做静默处理吧。
689
- // let obj = selectedEle.value[minlxIndex];
690
- // this.$message.info(`[${obj.compName}]元素影响均匀分布计算了,请取消选中[${obj.compName}]`)
691
- }
692
- break;
693
- case 'vertical':
694
- let tys = selectedEle.value.map((item) => item.options.top);
695
- let bys = selectedEle.value.map((item) => item.options.top + item.options.height);
696
- let minly = Math.min(...tys);
697
- let maxry = Math.max(...bys);
698
- let minlyIndex = tys.indexOf(minly);
699
- let maxryIndex = bys.indexOf(maxry);
700
- if (minlyIndex !== maxryIndex) {
701
- let sortCompos = selectedEle.value.sort((a, b) => {
702
- return a.options.top - b.options.top;
579
+ break;
580
+ case 'bottom':
581
+ let bys = selectedEle.value.map((item) => item.options.top + item.options.height);
582
+ let bmaxY = Math.max(...bys);
583
+ selectedEle.value.forEach((item) => {
584
+ item.options.top = bmaxY - item.options.height;
585
+ hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
703
586
  });
704
- let countHeight = 0;
705
- sortCompos.forEach((item) => {
706
- countHeight += item.options.height;
587
+ break;
588
+ case 'left':
589
+ let lxs = selectedEle.value.map((item) => item.options.left);
590
+ let lminX = Math.min(...lxs);
591
+ selectedEle.value.forEach((item) => {
592
+ item.options.left = lminX;
593
+ hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
707
594
  });
708
- let countGap = maxry - minly - countHeight;
709
- let gap = countGap / (sortCompos.length - 1);
710
- sortCompos.forEach((item, index, arr) => {
711
- if (index > 0 && index < arr.length - 1) {
712
- let preItem = arr[index - 1];
713
- item.options.top = preitem.options.top + preItem.options.height + gap;
714
- hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
595
+ break;
596
+ case 'center':
597
+ let cxs = selectedEle.value.map((item) => item.options.left);
598
+ let cminX = Math.min(...cxs);
599
+ let cbaseIndex = cxs.indexOf(cminX);
600
+ let cbaseObj = selectedEle.value[cbaseIndex];
601
+ let baseX = cbaseObj.options.width / 2 + cbaseObj.options.left;
602
+ selectedEle.value.forEach((item, index) => {
603
+ if (cbaseIndex !== index) {
604
+ item.options.left = baseX - item.options.width / 2;
605
+ hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
715
606
  }
716
607
  });
717
- } else {
718
- // TODO 此处隐藏了操作提示,这一处提示是告知为什么不能进行操作的原因,不过措辞没有研究好。所以遇到这种情况暂时做静默处理吧。
719
- // let obj = selectedEle.value[minlxIndex];
720
- // this.$message.info(`[${obj.compName}]元素影响均匀分布计算了,请取消选中[${obj.compName}]`)
721
- }
722
- break;
723
- default:
724
- break;
608
+ break;
609
+ case 'right':
610
+ let rxs = selectedEle.value.map((item) => item.options.left + item.options.width);
611
+ let rmaxX = Math.max(...rxs);
612
+ selectedEle.value.forEach((item) => {
613
+ item.options.left = rmaxX - item.options.width;
614
+ hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
615
+ });
616
+ break;
617
+ default:
618
+ break;
619
+ }
725
620
  }
726
- }
727
621
 
728
- function onSize(key) {
729
- switch (key) {
730
- case 'width':
731
- let width = selectedEle.value[0].options.width;
732
- selectedEle.value.forEach((item) => {
733
- item.options.width = width;
734
- hiprintJQuery(item.designTarget[0]).css('width', item.options.displayWidth());
735
- });
736
- break;
737
- case 'height':
738
- let height = selectedEle.value[0].options.height;
739
- selectedEle.value.forEach((item) => {
740
- item.options.height = height;
741
- hiprintJQuery(item.designTarget[0]).css('height', item.options.displayHeight());
742
- });
743
- break;
744
- case 'both':
745
- let {w, h} = selectedEle.value[0].rect;
622
+ function onSplit(key) {
623
+ switch (key) {
624
+ case 'horizontal':
625
+ let lxs = selectedEle.value.map((item) => item.options.left);
626
+ let rxs = selectedEle.value.map((item) => item.options.left + item.options.width);
627
+ let minlx = Math.min(...lxs);
628
+ let maxrx = Math.max(...rxs);
629
+ let minlxIndex = lxs.indexOf(minlx);
630
+ let maxrxIndex = rxs.indexOf(maxrx);
631
+ if (minlxIndex !== maxrxIndex) {
632
+ let sortCompos = selectedEle.value.sort((a, b) => {
633
+ return a.options.left - b.options.left;
634
+ });
635
+ let countWidth = 0;
636
+ sortCompos.forEach((item) => {
637
+ countWidth += item.options.width;
638
+ });
639
+ let countGap = maxrx - minlx - countWidth;
640
+ let gap = countGap / (sortCompos.length - 1);
641
+ sortCompos.forEach((item, index, arr) => {
642
+ if (index > 0 && index < arr.length - 1) {
643
+ let preItem = arr[index - 1];
644
+ item.options.left = preItem.options.left + preItem.options.width + gap;
645
+ hiprintJQuery(item.designTarget[0]).css('left', item.options.displayLeft());
646
+ }
647
+ });
648
+ } else {
649
+ // TODO 此处隐藏了操作提示,这一处提示是告知为什么不能进行操作的原因,不过措辞没有研究好。所以遇到这种情况暂时做静默处理吧。
650
+ // let obj = selectedEle.value[minlxIndex];
651
+ // this.$message.info(`[${obj.compName}]元素影响均匀分布计算了,请取消选中[${obj.compName}]`)
652
+ }
653
+ break;
654
+ case 'vertical':
655
+ let tys = selectedEle.value.map((item) => item.options.top);
656
+ let bys = selectedEle.value.map((item) => item.options.top + item.options.height);
657
+ let minly = Math.min(...tys);
658
+ let maxry = Math.max(...bys);
659
+ let minlyIndex = tys.indexOf(minly);
660
+ let maxryIndex = bys.indexOf(maxry);
661
+ if (minlyIndex !== maxryIndex) {
662
+ let sortCompos = selectedEle.value.sort((a, b) => {
663
+ return a.options.top - b.options.top;
664
+ });
665
+ let countHeight = 0;
666
+ sortCompos.forEach((item) => {
667
+ countHeight += item.options.height;
668
+ });
669
+ let countGap = maxry - minly - countHeight;
670
+ let gap = countGap / (sortCompos.length - 1);
671
+ sortCompos.forEach((item, index, arr) => {
672
+ if (index > 0 && index < arr.length - 1) {
673
+ let preItem = arr[index - 1];
674
+ item.options.top = preitem.options.top + preItem.options.height + gap;
675
+ hiprintJQuery(item.designTarget[0]).css('top', item.options.displayTop());
676
+ }
677
+ });
678
+ } else {
679
+ // TODO 此处隐藏了操作提示,这一处提示是告知为什么不能进行操作的原因,不过措辞没有研究好。所以遇到这种情况暂时做静默处理吧。
680
+ // let obj = selectedEle.value[minlxIndex];
681
+ // this.$message.info(`[${obj.compName}]元素影响均匀分布计算了,请取消选中[${obj.compName}]`)
682
+ }
683
+ break;
684
+ default:
685
+ break;
686
+ }
687
+ }
746
688
 
747
- selectedEle.value.forEach((item) => {
748
- item.options.height = h;
749
- item.options.width = w;
750
- hiprintJQuery(item.designTarget[0]).css('height', item.options.displayHeight()).css('width', item.options.displayWidth());
751
- });
752
- break;
753
- default:
754
- break;
689
+ function onSize(key) {
690
+ switch (key) {
691
+ case 'width':
692
+ let width = selectedEle.value[0].options.width;
693
+ selectedEle.value.forEach((item) => {
694
+ item.options.width = width;
695
+ hiprintJQuery(item.designTarget[0]).css('width', item.options.displayWidth());
696
+ });
697
+ break;
698
+ case 'height':
699
+ let height = selectedEle.value[0].options.height;
700
+ selectedEle.value.forEach((item) => {
701
+ item.options.height = height;
702
+ hiprintJQuery(item.designTarget[0]).css('height', item.options.displayHeight());
703
+ });
704
+ break;
705
+ case 'both':
706
+ let {w, h} = selectedEle.value[0].rect;
707
+
708
+ selectedEle.value.forEach((item) => {
709
+ item.options.height = h;
710
+ item.options.width = w;
711
+ hiprintJQuery(item.designTarget[0])
712
+ .css('height', item.options.displayHeight())
713
+ .css('width', item.options.displayWidth());
714
+ });
715
+ break;
716
+ default:
717
+ break;
718
+ }
755
719
  }
756
- }
757
720
 
758
- function tableFieldChange(val) {
759
- selectedTableEle.value.updateOption('field', val);
760
- }
721
+ function tableFieldChange(val) {
722
+ selectedTableEle.value.updateOption('field', val);
723
+ }
761
724
 
762
- function tableColumnCancel() {
763
- selectedTableEle.value = null;
764
- }
725
+ function tableColumnCancel() {
726
+ selectedTableEle.value = null;
727
+ }
765
728
 
766
- function init() {
767
- try {
768
- hiprint.init({
769
- providers: [new defaultElementTypeProvider()],
770
- });
771
- hiprint.setConfig();
772
- hiprint.setConfig({
773
- optionItems: [fontSize, scale, zIndex],
774
- movingDistance: 2.5,
775
- text: {
776
- tabs: [
777
- {
778
- options: [],
779
- },
780
- {
781
- name: '样式',
782
- options: [
783
- {
784
- name: 'scale',
785
- after: 'transform',
786
- hidden: false,
787
- },
788
- ],
789
- },
790
- ],
791
- supportOptions: [
792
- {
793
- name: 'styler',
794
- hidden: true,
795
- },
796
- {
797
- name: 'scale',
798
- after: 'transform',
799
- hidden: false,
800
- },
801
- {
802
- name: 'formatter',
803
- hidden: true,
804
- },
805
- ],
806
- },
807
- image: {
808
- tabs: [
809
- {
810
- replace: true,
811
- name: '基本',
812
- options: [
813
- {
814
- name: 'field',
815
- hidden: false,
816
- },
817
- {
818
- name: 'src',
819
- hidden: false,
820
- },
821
- {
822
- name: 'fit',
823
- hidden: false,
824
- },
825
- ],
826
- },
827
- ],
828
- },
829
- table: {
830
- tabs: [{options: [{name: 'field', hidden: true}]}],
831
- },
832
- });
729
+ function init() {
730
+ try {
731
+ hiprint.init({
732
+ providers: [new defaultElementTypeProvider()],
733
+ });
734
+ hiprint.setConfig();
735
+ hiprint.setConfig({
736
+ optionItems: [fontSize, scale, zIndex],
737
+ movingDistance: 2.5,
738
+ text: {
739
+ tabs: [
740
+ {
741
+ options: [],
742
+ },
743
+ {
744
+ name: '样式',
745
+ options: [
746
+ {
747
+ name: 'scale',
748
+ after: 'transform',
749
+ hidden: false,
750
+ },
751
+ ],
752
+ },
753
+ ],
754
+ supportOptions: [
755
+ {
756
+ name: 'styler',
757
+ hidden: true,
758
+ },
759
+ {
760
+ name: 'scale',
761
+ after: 'transform',
762
+ hidden: false,
763
+ },
764
+ {
765
+ name: 'formatter',
766
+ hidden: true,
767
+ },
768
+ ],
769
+ },
770
+ image: {
771
+ tabs: [
772
+ {
773
+ replace: true,
774
+ name: '基本',
775
+ options: [
776
+ {
777
+ name: 'field',
778
+ hidden: false,
779
+ },
780
+ {
781
+ name: 'src',
782
+ hidden: false,
783
+ },
784
+ {
785
+ name: 'fit',
786
+ hidden: false,
787
+ },
788
+ ],
789
+ },
790
+ ],
791
+ },
792
+ table: {
793
+ tabs: [{options: [{name: 'field', hidden: true}]}],
794
+ },
795
+ });
833
796
 
834
- hiprint.PrintElementTypeManager.buildByHtml(hiprintJQuery('.ep-draggable-item'));
835
- hiprintJQuery('#hiprint-printTemplate').empty();
836
- let template = JSON.parse(detailData.value.json) || panel;
837
- hiprintTemplate.value = new hiprint.PrintTemplate({
838
- template,
839
- onImageChooseClick: (target) => {
840
- console.log(target);
841
- },
842
- fontList: [
843
- {title: '微软雅黑', value: 'Microsoft YaHei'},
844
- {title: '黑体', value: 'STHeitiSC-Light'},
845
- {title: '思源黑体', value: 'SourceHanSansCN-Normal'},
846
- {title: '宋体', value: 'SimSun'},
847
- {title: '华为楷体', value: 'STKaiti'},
848
- {title: 'cursive', value: 'cursive'},
849
- {title: 'Times New Roman', value: 'Times New Roman'},
850
- ],
851
- dataMode: 1,
852
- history: true,
853
- onDataChanged: (type, json) => {},
854
- onUpdateError: (e) => {
855
- console.error(e);
856
- },
857
- settingContainer: '#PrintElementOptionSetting',
858
- paginationContainer: '.hiprint-printPagination',
859
- });
797
+ hiprint.PrintElementTypeManager.buildByHtml(hiprintJQuery('.ep-draggable-item'));
798
+ hiprintJQuery('#hiprint-printTemplate').empty();
799
+ let template = JSON.parse(detailData.value.json) || panel;
800
+ hiprintTemplate.value = new hiprint.PrintTemplate({
801
+ template,
802
+ onImageChooseClick: (target) => {
803
+ console.log(target);
804
+ },
805
+ fontList: [
806
+ {title: '微软雅黑', value: 'Microsoft YaHei'},
807
+ {title: '黑体', value: 'STHeitiSC-Light'},
808
+ {title: '思源黑体', value: 'SourceHanSansCN-Normal'},
809
+ {title: '宋体', value: 'SimSun'},
810
+ {title: '华为楷体', value: 'STKaiti'},
811
+ {title: 'cursive', value: 'cursive'},
812
+ {title: 'Times New Roman', value: 'Times New Roman'},
813
+ ],
814
+ dataMode: 1,
815
+ history: true,
816
+ onDataChanged: (type, json) => {},
817
+ onUpdateError: (e) => {
818
+ console.error(e);
819
+ },
820
+ settingContainer: '#PrintElementOptionSetting',
821
+ paginationContainer: '.hiprint-printPagination',
822
+ });
860
823
 
861
- hiprintTemplate.value?.design('#hiprint-printTemplate', {grid: true});
862
- scaleValue.value = hiprintTemplate.value.editingPanel.scale || 1;
863
- window.ht = hiprintTemplate.value;
824
+ hiprintTemplate.value?.design('#hiprint-printTemplate', {grid: true});
825
+ scaleValue.value = hiprintTemplate.value.editingPanel.scale || 1;
826
+ window.ht = hiprintTemplate.value;
864
827
 
865
- if (formColumns.value) {
866
- hiprintTemplate.value?.setFields(
867
- formColumns.value.map((item) => {
868
- return {
869
- field: item,
870
- text: item,
871
- };
872
- })
873
- );
874
- }
875
- hiprintJQuery('.hiprint-designer').on('mousedown', '.hiprint-printElement', (e) => {
876
- let t = e.currentTarget;
877
- selectedEle.value = hiprintTemplate.value?.getSelectEls() || [];
878
- let pes = hiprintTemplate.value?.editingPanel.printElements;
879
- let index = pes.map((item) => item.designTarget[0]).findIndex((item) => t === item);
880
- let pe = pes[index];
881
- selectedTableEle.value = pe || null;
882
- if (pe && pe.options.field) {
883
- listCode.value = pe.options.field;
884
- }
885
- });
886
- hiprintJQuery('#PrintElementOptionSetting').on('input', 'input[type=number]', ($el) => {
887
- let val = parseInt($el.target.value);
888
- if (val < 1) {
889
- $el.target.value = 1;
828
+ if (formColumns.value) {
829
+ hiprintTemplate.value?.setFields(
830
+ formColumns.value.map((item) => {
831
+ return {
832
+ field: item,
833
+ text: item,
834
+ };
835
+ })
836
+ );
890
837
  }
891
- if (val > 2000) {
892
- $el.target.value = 2000;
838
+ hiprintJQuery('.hiprint-designer').on('mousedown', '.hiprint-printElement', (e) => {
839
+ let t = e.currentTarget;
840
+ selectedEle.value = hiprintTemplate.value?.getSelectEls() || [];
841
+ let pes = hiprintTemplate.value?.editingPanel.printElements;
842
+ let index = pes.map((item) => item.designTarget[0]).findIndex((item) => t === item);
843
+ let pe = pes[index];
844
+ selectedTableEle.value = pe || null;
845
+ if (pe && pe.options.field) {
846
+ listCode.value = pe.options.field;
847
+ }
848
+ });
849
+ hiprintJQuery('#PrintElementOptionSetting').on('input', 'input[type=number]', ($el) => {
850
+ let val = parseInt($el.target.value);
851
+ if (val < 1) {
852
+ $el.target.value = 1;
853
+ }
854
+ if (val > 2000) {
855
+ $el.target.value = 2000;
856
+ }
857
+ });
858
+ } catch (error) {
859
+ console.log(error.message);
860
+ clearPrint();
861
+ hiprintTemplate.value = null;
862
+ if (error.message.indexOf('setTemplateId') > -1) {
863
+ ElMessageBox.alert('模板有错误,请返回列表手动修改或这清空模板!');
893
864
  }
894
- });
895
- } catch (error) {
896
- console.log(error.message);
897
- clearPrint();
898
- hiprintTemplate.value = null;
899
- if (error.message.indexOf('setTemplateId') > -1) {
900
- ElMessageBox.alert('模板有错误,请返回列表手动修改或这清空模板!');
901
865
  }
902
866
  }
903
- }
904
867
 
905
- let updateing = false;
906
- async function updateTemplate(code) {
907
- if (updateing === true) {
908
- return false;
909
- }
910
- updateing = true;
911
- if (hiprintTemplate.value) {
912
- await getDetail(code);
913
- if (detailData.value && detailData.value.json) {
914
- let jsonObj = JSON.parse(detailData.value.json);
915
- hiprintTemplate.value?.update(jsonObj);
916
- let {width, height} = jsonObj.panels[0];
917
- paperWidth.value = width;
918
- paperHeight.value = height;
919
- setPaperHandler('other');
920
- scaleValue.value = 1;
921
- } else {
922
- hiprintTemplate.value?.update({
923
- panels: [
924
- {
925
- index: 0,
926
- name: 1,
927
- height: 297,
928
- width: 210,
929
- paperHeader: 125,
930
- paperFooter: 272.5,
931
- paperNumberLeft: 430,
932
- paperNumberTop: 5,
933
- printElements: [],
934
- watermarkOptions: {content: '', rotate: 25, timestamp: false, format: 'YYYY-MM-DD HH:mm'},
935
- },
936
- ],
937
- });
938
- paperWidth.value = 210;
939
- paperHeight.value = 297;
940
- setPaperHandler('other');
941
- scaleValue.value = 1;
868
+ let updateing = false;
869
+ async function updateTemplate(code) {
870
+ if (updateing === true) {
871
+ return false;
942
872
  }
943
- } else {
944
- await getDetail(code);
945
- if (detailData.value && detailData.value.json) {
946
- let jsonObj = JSON.parse(detailData.value.json);
947
- let {width, height} = jsonObj.panels[0];
948
- paperWidth.value = width;
949
- paperHeight.value = height;
950
- setPaperHandler('other');
873
+ updateing = true;
874
+ if (hiprintTemplate.value) {
875
+ await getDetail(code);
876
+ if (detailData.value && detailData.value.json) {
877
+ let jsonObj = JSON.parse(detailData.value.json);
878
+ hiprintTemplate.value?.update(jsonObj);
879
+ let {width, height} = jsonObj.panels[0];
880
+ paperWidth.value = width;
881
+ paperHeight.value = height;
882
+ setPaperHandler('other');
883
+ scaleValue.value = 1;
884
+ } else {
885
+ hiprintTemplate.value?.update({
886
+ panels: [
887
+ {
888
+ index: 0,
889
+ name: 1,
890
+ height: 297,
891
+ width: 210,
892
+ paperHeader: 125,
893
+ paperFooter: 272.5,
894
+ paperNumberLeft: 430,
895
+ paperNumberTop: 5,
896
+ printElements: [],
897
+ watermarkOptions: {
898
+ content: '',
899
+ rotate: 25,
900
+ timestamp: false,
901
+ format: 'YYYY-MM-DD HH:mm',
902
+ },
903
+ },
904
+ ],
905
+ });
906
+ paperWidth.value = 210;
907
+ paperHeight.value = 297;
908
+ setPaperHandler('other');
909
+ scaleValue.value = 1;
910
+ }
951
911
  } else {
952
- paperWidth.value = 210;
953
- paperHeight.value = 297;
954
- setPaperHandler('other');
912
+ await getDetail(code);
913
+ if (detailData.value && detailData.value.json) {
914
+ let jsonObj = JSON.parse(detailData.value.json);
915
+ let {width, height} = jsonObj.panels[0];
916
+ paperWidth.value = width;
917
+ paperHeight.value = height;
918
+ setPaperHandler('other');
919
+ } else {
920
+ paperWidth.value = 210;
921
+ paperHeight.value = 297;
922
+ setPaperHandler('other');
923
+ }
924
+ init();
955
925
  }
956
- init();
926
+ updateing = false;
957
927
  }
958
- updateing = false;
959
- }
960
928
 
961
- const hasDataSource = computed(() => {
962
- return Array.isArray(formCode.value) ? formCode.value.length > 0 : formCode.value;
963
- });
929
+ const hasDataSource = computed(() => {
930
+ return Array.isArray(formCode.value) ? formCode.value.length > 0 : formCode.value;
931
+ });
964
932
 
965
- function wheelHandler(e: MouseEvent) {
966
- console.log(e);
967
- if (e.ctrlKey) {
968
- const isZoomIn = e.wheelDelta < 0;
969
- const isZoomOut = e.wheelDelta > 0;
970
- if (isZoomIn && canZoomIn) {
971
- e.preventDefault();
972
- e.stopPropagation();
973
- zoomIn();
974
- }
975
- if (isZoomOut && canZoomOut) {
976
- e.preventDefault();
977
- e.stopPropagation();
978
- zoomOut();
933
+ function wheelHandler(e: MouseEvent) {
934
+ if (e.ctrlKey) {
935
+ const isZoomIn = e.wheelDelta < 0;
936
+ const isZoomOut = e.wheelDelta > 0;
937
+ if (isZoomIn && canZoomIn) {
938
+ e.preventDefault();
939
+ e.stopPropagation();
940
+ zoomIn();
941
+ }
942
+ if (isZoomOut && canZoomOut) {
943
+ e.preventDefault();
944
+ e.stopPropagation();
945
+ zoomOut();
946
+ }
979
947
  }
980
948
  }
981
- }
982
949
 
983
- onActivated(() => {
984
- updateTemplate(route.query.code);
985
- window.addEventListener('wheel', wheelHandler, {passive: false});
986
- });
950
+ onActivated(() => {
951
+ updateTemplate(route.query.code);
952
+ window.addEventListener('wheel', wheelHandler, {passive: false});
953
+ });
987
954
 
988
- onBeforeRouteUpdate((to) => {
989
- updateTemplate(to.query.code);
990
- });
955
+ onBeforeRouteUpdate((to) => {
956
+ updateTemplate(to.query.code);
957
+ });
991
958
 
992
- onDeactivated(() => {
993
- clearPrint();
994
- window.removeEventListener('wheel', wheelHandler);
995
- });
959
+ onDeactivated(() => {
960
+ clearPrint();
961
+ window.removeEventListener('wheel', wheelHandler);
962
+ });
996
963
 
997
- onMounted(async () => {
998
- await getDataSourceList();
999
- });
964
+ onMounted(async () => {
965
+ await getDataSourceList();
966
+ });
1000
967
  </script>
1001
968
  <style lang="scss">
1002
- .hiprint-designer {
1003
- width: calc(100% + 32px);
1004
- height: calc(100%);
1005
- overflow: hidden;
1006
- display: flex;
1007
- flex-direction: column;
1008
- background-color: var(--el-bg-color-page);
1009
- margin: 0 -16px;
1010
- &__header {
1011
- padding: 0 16px;
1012
- height: 50px;
969
+ .hiprint-designer {
970
+ width: calc(100% + 32px);
971
+ height: calc(100%);
972
+ overflow: hidden;
1013
973
  display: flex;
1014
- background-color: var(--el-bg-color);
1015
- align-items: center;
1016
- box-shadow: var(--el-box-shadow-lighter);
1017
- position: relative;
1018
- z-index: 1;
1019
- > * {
1020
- margin-right: 10px;
1021
- margin-left: 0 !important;
1022
- }
1023
- .paper-setting-text {
1024
- width: 100px;
1025
- .iconfont {
1026
- display: inline-block;
1027
- padding: 0 10px 0 20px;
1028
- }
1029
- }
1030
- .percentage {
1031
- width: 165px;
1032
- }
1033
- .el-select {
1034
- --el-select-width: auto;
1035
- width: 150px;
1036
- }
1037
- > .el-button {
1038
- padding: 5px;
1039
- }
1040
- .el-form-item {
1041
- margin-bottom: 0;
1042
- margin-right: 10px;
1043
- }
1044
- &_content {
1045
- flex: 1;
974
+ flex-direction: column;
975
+ background-color: var(--el-bg-color-page);
976
+ margin: 0 -16px;
977
+ &__header {
978
+ padding: 0 16px;
979
+ height: 50px;
980
+ display: flex;
981
+ background-color: var(--el-bg-color);
982
+ align-items: center;
983
+ box-shadow: var(--el-box-shadow-lighter);
984
+ position: relative;
985
+ z-index: 1;
1046
986
  > * {
1047
987
  margin-right: 10px;
1048
988
  margin-left: 0 !important;
1049
989
  }
990
+ .paper-setting-text {
991
+ width: 100px;
992
+ .iconfont {
993
+ display: inline-block;
994
+ padding: 0 10px 0 20px;
995
+ }
996
+ }
997
+ .percentage {
998
+ width: 165px;
999
+ }
1000
+ .el-select {
1001
+ --el-select-width: auto;
1002
+ width: 150px;
1003
+ }
1004
+ > .el-button {
1005
+ padding: 5px;
1006
+ }
1007
+ .el-form-item {
1008
+ margin-bottom: 0;
1009
+ margin-right: 10px;
1010
+ }
1011
+ &_content {
1012
+ flex: 1;
1013
+ > * {
1014
+ margin-right: 10px;
1015
+ margin-left: 0 !important;
1016
+ }
1017
+ }
1050
1018
  }
1051
- }
1052
- &_title {
1053
- font-size: 18px;
1054
- font-weight: bold;
1055
- line-height: 1.7em;
1056
- margin-bottom: 10px;
1057
- }
1058
- .ep-draggable-item {
1059
- user-select: none;
1060
- width: 100%;
1061
- height: 70px;
1062
- display: inline-flex;
1063
- flex-direction: column;
1064
- align-items: center;
1065
- margin-bottom: 10px;
1066
- .iconfont {
1067
- font-size: 30px;
1068
- width: 40px;
1069
- height: 40px;
1070
- text-align: center;
1071
- line-height: 40px;
1019
+ &_title {
1020
+ font-size: 18px;
1021
+ font-weight: bold;
1022
+ line-height: 1.7em;
1023
+ margin-bottom: 10px;
1072
1024
  }
1073
- }
1074
- &__main {
1075
- flex: 1;
1076
- overflow: hidden;
1077
- display: flex;
1078
- &_left {
1079
- width: 300px;
1080
- overflow: hidden;
1081
- background-color: var(--el-color-white);
1082
- box-shadow: var(--el-box-shadow-lighter);
1083
- .el-scrollbar__view {
1084
- padding: 16px;
1025
+ .ep-draggable-item {
1026
+ user-select: none;
1027
+ width: 100%;
1028
+ height: 70px;
1029
+ display: inline-flex;
1030
+ flex-direction: column;
1031
+ align-items: center;
1032
+ margin-bottom: 10px;
1033
+ .iconfont {
1034
+ font-size: 30px;
1035
+ width: 40px;
1036
+ height: 40px;
1037
+ text-align: center;
1038
+ line-height: 40px;
1085
1039
  }
1086
1040
  }
1087
- &_canvas {
1041
+ &__main {
1088
1042
  flex: 1;
1089
1043
  overflow: hidden;
1090
- .el-scrollbar__view {
1091
- padding: 20px 10px 40px 20px;
1092
- #hiprint-printTemplate {
1093
- position: relative;
1044
+ display: flex;
1045
+ &_left {
1046
+ width: 300px;
1047
+ overflow: hidden;
1048
+ background-color: var(--el-color-white);
1049
+ box-shadow: var(--el-box-shadow-lighter);
1050
+ .el-scrollbar__view {
1051
+ padding: 16px;
1094
1052
  }
1095
1053
  }
1096
- }
1097
- &_right {
1098
- width: 340px;
1099
- overflow: hidden;
1100
- background-color: var(--el-color-white);
1101
- box-shadow: var(--el-box-shadow-lighter);
1102
- display: flex;
1103
- flex-direction: column;
1104
- .prop-tabs {
1105
- height: 100%;
1054
+ &_canvas {
1055
+ flex: 1;
1106
1056
  overflow: hidden;
1057
+ .el-scrollbar__view {
1058
+ padding: 20px 10px 40px 20px;
1059
+ #hiprint-printTemplate {
1060
+ position: relative;
1061
+ }
1062
+ }
1063
+ }
1064
+ &_right {
1065
+ width: 340px;
1066
+ overflow: hidden;
1067
+ background-color: var(--el-color-white);
1068
+ box-shadow: var(--el-box-shadow-lighter);
1107
1069
  display: flex;
1108
1070
  flex-direction: column;
1109
- .prop-tab-items {
1071
+ .prop-tabs {
1072
+ height: 100%;
1073
+ overflow: hidden;
1110
1074
  display: flex;
1111
- height: 43px;
1112
- box-sizing: border-box;
1113
- .prop-tab-item {
1114
- height: 40px;
1115
- line-height: 40px;
1116
- flex: 1;
1117
- text-align: center;
1075
+ flex-direction: column;
1076
+ .prop-tab-items {
1077
+ display: flex;
1078
+ height: 43px;
1079
+ box-sizing: border-box;
1080
+ .prop-tab-item {
1081
+ height: 40px;
1082
+ line-height: 40px;
1083
+ flex: 1;
1084
+ text-align: center;
1085
+ }
1086
+ }
1087
+ .hiprint-option-items.active {
1088
+ display: block;
1089
+ padding: 0 6px 0 12px;
1118
1090
  }
1119
1091
  }
1120
- .hiprint-option-items.active {
1121
- display: block;
1122
- padding: 0 6px 0 12px;
1123
- }
1124
- }
1125
- .hiprint-option-items {
1126
- height: 100%;
1127
- overflow: auto;
1128
- padding: 16px;
1129
- box-sizing: border-box;
1130
- &::-webkit-scrollbar {
1131
- width: 4px;
1132
- height: 4px;
1133
- }
1092
+ .hiprint-option-items {
1093
+ height: 100%;
1094
+ overflow: auto;
1095
+ padding: 16px;
1096
+ box-sizing: border-box;
1097
+ &::-webkit-scrollbar {
1098
+ width: 4px;
1099
+ height: 4px;
1100
+ }
1134
1101
 
1135
- &::-webkit-scrollbar-thumb {
1136
- border-radius: 4px;
1137
- background: #bbb;
1102
+ &::-webkit-scrollbar-thumb {
1103
+ border-radius: 4px;
1104
+ background: #bbb;
1105
+ }
1138
1106
  }
1139
- }
1140
- .hiprint-designer_title {
1141
- padding: 0 10px;
1142
- margin: 0;
1143
- }
1144
- #PrintElementOptionSetting {
1145
- flex: 1;
1146
- overflow: hidden;
1147
- }
1148
- .el-form {
1149
- padding: 0 10px 10px;
1150
- .el-form-item--small {
1151
- margin-bottom: 5px;
1107
+ .hiprint-designer_title {
1108
+ padding: 0 10px;
1109
+ margin: 0;
1152
1110
  }
1153
- .el-form-item__label {
1154
- margin-bottom: 0;
1111
+ #PrintElementOptionSetting {
1112
+ flex: 1;
1113
+ overflow: hidden;
1155
1114
  }
1156
- .el-button {
1157
- width: 100%;
1115
+ .el-form {
1116
+ padding: 0 10px 10px;
1117
+ .el-form-item--small {
1118
+ margin-bottom: 5px;
1119
+ }
1120
+ .el-form-item__label {
1121
+ margin-bottom: 0;
1122
+ }
1123
+ .el-button {
1124
+ width: 100%;
1125
+ }
1158
1126
  }
1159
1127
  }
1160
1128
  }
1161
1129
  }
1162
- }
1163
1130
 
1164
- .paper-setting {
1165
- display: flex;
1166
- .paper-setting_types {
1167
- width: 100px;
1168
- margin-right: 10px;
1169
- .paper-setting-type-item {
1170
- width: 100%;
1171
- text-align: center;
1172
- height: 40px;
1173
- line-height: 40px;
1174
- cursor: pointer;
1175
- &:hover {
1176
- background-color: var(--el-color-primary-light-9);
1131
+ .print-preview-dialog {
1132
+ min-width: 1000px;
1133
+ max-width: 1200px;
1134
+ .el-message-box__container {
1135
+ justify-content: center;
1136
+ background-color: #f2f2f2;
1137
+ }
1138
+ .hiprint-printPaper {
1139
+ margin-top: 5px;
1140
+ position: relative;
1141
+ background-color: #fff;
1142
+ &:last-child {
1143
+ margin-bottom: 5px;
1177
1144
  }
1178
1145
  }
1179
1146
  }
1180
- .paper-setting__content {
1181
- flex: 1;
1182
- .el-input {
1183
- width: 140px;
1184
- .el-input-group__prepend,
1185
- .el-input-group__append {
1186
- padding: 0 9px;
1147
+ .paper-setting {
1148
+ display: flex;
1149
+ .paper-setting_types {
1150
+ width: 100px;
1151
+ margin-right: 10px;
1152
+ .paper-setting-type-item {
1153
+ width: 100%;
1154
+ text-align: center;
1155
+ height: 40px;
1156
+ line-height: 40px;
1157
+ cursor: pointer;
1158
+ &:hover {
1159
+ background-color: var(--el-color-primary-light-9);
1160
+ }
1187
1161
  }
1188
1162
  }
1189
- .el-button + .el-button {
1190
- margin-left: 0;
1191
- }
1192
- > * {
1193
- width: 100%;
1194
- margin-bottom: 10px;
1163
+ .paper-setting__content {
1164
+ flex: 1;
1165
+ .el-input {
1166
+ width: 140px;
1167
+ .el-input-group__prepend,
1168
+ .el-input-group__append {
1169
+ padding: 0 9px;
1170
+ }
1171
+ }
1172
+ .el-button + .el-button {
1173
+ margin-left: 0;
1174
+ }
1175
+ > * {
1176
+ width: 100%;
1177
+ margin-bottom: 10px;
1178
+ }
1195
1179
  }
1196
1180
  }
1197
- }
1198
1181
  </style>