ocpview-plus 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-plus",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -43,8 +43,18 @@ export default {
43
43
  text: '编辑',
44
44
  }, ],
45
45
  openChange: false,
46
+ focusIndex: null,
47
+ focusKey: null,
46
48
  };
47
49
  },
50
+ computed: {
51
+ colKeys() {
52
+ return this.soltTableColumns.map(c => c.key);
53
+ }
54
+ },
55
+ beforeUnmount() {
56
+ document.removeEventListener('keydown', this.handleKeydown);
57
+ },
48
58
  methods: {
49
59
  customInit() {
50
60
  if (this.myConfig.items && this.myConfig.items.length > 0) {
@@ -99,6 +109,10 @@ export default {
99
109
  this.customInit2();
100
110
  }
101
111
  this.myConfig.getGridObject = this.getGridObject;
112
+ //监听键盘事件
113
+ document.addEventListener('keydown', (e) => {
114
+ this.handleKeydown(e);
115
+ })
102
116
  },
103
117
  getGridObject() {
104
118
  let that = this;
@@ -450,6 +464,7 @@ export default {
450
464
  return error;
451
465
  },
452
466
  EditCell(index, config) {
467
+ this.setEditGridFocus(index, config.key);
453
468
  if (this.myConfig.readOnly) {
454
469
  this.cancelCellEditing();
455
470
  return;
@@ -487,6 +502,95 @@ export default {
487
502
  this.setcheckInfo(index, config.key);
488
503
  }
489
504
  },
505
+ // 设置焦点位置
506
+ setEditGridFocus(rowIdx, colKey) {
507
+ this.focusIndex = rowIdx;
508
+ this.focusKey = colKey;
509
+ this.editIndex = rowIdx;
510
+ this.editKey = colKey;
511
+ this.focusCell(rowIdx, colKey);
512
+ },
513
+ // 设置键盘选中单元格样式
514
+ focusCell(rowIdx, colKey) {
515
+ this.$nextTick(() => {
516
+ const tableEl = this.$refs.table.$el;
517
+ const selector = `div[cell-row="${rowIdx}"][cell-col="${colKey}"]`;
518
+ let curElement = tableEl.querySelector(selector);
519
+ if(curElement) {
520
+ const arr = tableEl.querySelectorAll('.ivu-table-column-selected');
521
+ if(arr.length != 0) {
522
+ arr.forEach(el => {
523
+ el.classList.remove('ivu-table-column-selected');
524
+ })
525
+ }
526
+
527
+ const cellDiv = curElement.closest('td');
528
+ if (cellDiv) {
529
+ cellDiv.classList.add('ivu-table-column-selected');
530
+ cellDiv.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
531
+ }
532
+ }
533
+ });
534
+ },
535
+ // 键盘导航事件
536
+ handleKeydown(event) {
537
+ if (this.focusIndex === null || this.focusKey === null) return;
538
+ const colIdx = this.colKeys.findIndex(it => { return it == this.focusKey});
539
+
540
+ this.focusKey = this.colKeys[colIdx];
541
+ let newRow = this.focusIndex;
542
+ let newCol = colIdx;
543
+
544
+ let name = 'cell_' + this.editIndex + '_' + this.editKey;
545
+ const { key } = event;
546
+
547
+ if(key == 'ArrowUp') {
548
+ if (this.focusIndex > 0) newRow--;
549
+ this.extEditStatus();
550
+ }
551
+ if(key == 'ArrowDown') {
552
+ if (this.focusIndex < this.data.length - 1) newRow++;
553
+ this.extEditStatus();
554
+ }
555
+ if(key == 'ArrowLeft') {
556
+ if (colIdx > 1) newCol--;
557
+ this.extEditStatus();
558
+ }
559
+ if(key == 'ArrowRight') {
560
+ if (colIdx < this.colKeys.length - 1) newCol++;
561
+ this.extEditStatus();
562
+ }
563
+
564
+ if(key == 'Enter') {
565
+ if (colIdx < this.colKeys.length - 1) newCol++;
566
+ }
567
+
568
+ this.setEditGridFocus(newRow, this.colKeys[newCol]);
569
+ if(!this.myConfig.readOnly) {
570
+ // 解决键盘按下input框的值不修改问题
571
+ if (this.$refs[name] && this.$refs[name].autofocus) {
572
+ return true;
573
+ }
574
+ } else {
575
+ this.handleOut();
576
+ }
577
+ event.preventDefault();
578
+ },
579
+ extEditStatus() {
580
+ if(!this.myConfig.readOnly) {
581
+ //this.handleOut();
582
+ let name = 'cell_' + this.editIndex + '_' + this.editKey;
583
+ if (this.$refs[name] && this.$refs[name].setFocus) {
584
+ this.$refs[name].setFocus(false);
585
+ }
586
+ let self = this;
587
+ this.$nextTick(() => {
588
+ self.editKey = '';
589
+ self.oldEditIndex = this.editIndex;
590
+ //self.editIndex = -1;
591
+ });
592
+ }
593
+ },
490
594
  setcheckInfo(index, key) {
491
595
  let checkIndex = index;
492
596
  let row = this.getCurRow(index);
@@ -633,6 +737,7 @@ export default {
633
737
  this.editIndex = nextKey.editIndex;
634
738
  this.editKey = nextKey.editKey;
635
739
  this.setcheckInfo(nextKey.editIndex, nextKey.editKey);
740
+ this.setEditGridFocus(this.editIndex, this.editKey);
636
741
  }
637
742
  },
638
743
  findNextItems(editIndex, editName) {
@@ -950,3 +1055,8 @@ export default {
950
1055
  },
951
1056
  };
952
1057
  </script>
1058
+ <style lang="less">
1059
+ .ivu-table-column-selected, .active-cell{
1060
+ box-shadow: inset 0 0 0 2px #AF292E;
1061
+ }
1062
+ </style>
@@ -39,7 +39,7 @@ export default {
39
39
  showAsyncImportExport:false,
40
40
  showBillContPrintMode:false,
41
41
  showPrintMode:false,
42
- billprintModeUrl:'/mall-sysconf-vue/#/billdataprint?modulecode={modulecode}&dataid={dataid}&mktcode={mktcode}&token={token}',
42
+ billprintModeUrl:'/widgetmodelv3/#/bill-print?modulecode={modulecode}&dataid={dataid}&mktcode={mktcode}&token={token}',
43
43
  printModeUrl:'',
44
44
  eventObject:['valueChanged','setDataBefore','searchBefore','cellbeginedit','importSuccess','addRowBefore','indexMethod','delRowBefore','delRowAfter','onSelectionChange','formatValue','updateCellConfig','overrideSearchParam','overrideData','refurbishCheck','onSingleChange','onSetRowCheck','onSelect','onSelectCancel','onSelectionChange','customSummary','customImgPath','onDelTag','onSearch','onAppend','filterData','onAddTag','getDictData','setLabel','setImportUrl','onLinkTo','newSaveFormBefore','setQueryConfig','setNodeClass','setTreeNodeIcon','rowClassName','customSummaryGroup','disabledDate'],
45
45
  layoutTypeList:['ListDetails','ListDetailsV2','BillListDetails']
@@ -33,9 +33,9 @@
33
33
  </Col>
34
34
  </Row>
35
35
  <Row v-show="showGrid" >
36
- <Table ref="table" :row-class-name="rowClassName" :loading="loading" :size="myConfig.tableSize" :stripe="myConfig.showStripe" :border="myConfig.showBorder" :height="tableHeight" :maxHeight="tableMaxHeight" :show-header="myConfig.showHeader" @on-selection-change="OnSelectionChange" :columns="tableColumns" :data="data" @on-column-width-resize="onColumnWidthResize" @on-row-click="rowClick" :show-summary="myConfig.showSummary" :summary-method="handleSummary">
36
+ <Table ref="table" :row-class-name="rowClassName" :loading="loading" :size="myConfig.tableSize" :stripe="myConfig.showStripe" :border="myConfig.showBorder" :height="tableHeight" :maxHeight="tableMaxHeight" :show-header="myConfig.showHeader" @on-selection-change="OnSelectionChange" :columns="tableColumns" :data="data" @on-column-width-resize="onColumnWidthResize" @on-row-click="rowClick" :show-summary="myConfig.showSummary" :summary-method="handleSummary">
37
37
  <template v-for="config in soltTableColumns" v-slot:[config.key]="{ index }" :key="'show_' + config.key">
38
- <div @click="EditCell(index,config)" :class="config.cellClassName">
38
+ <div @click="EditCell(index,config)" :class="config.cellClassName" :cell-row="index" :cell-col="config.key">
39
39
  <ControlBox v-if="editIndex === index && editKey=== config.key" :ref="'cell_'+ index + '_' + config.key" :autofocus="true" :config="getCellConfig(index,config)" :valueData="getCurRow(index)" @inputValue="input" :editIndex="index" @doAction="doAction"></ControlBox>
40
40
  <ShowText v-else :label="formatValue(index,config)" :contentAlign="config.contentAlign" :class="IsCellError(index,config)" :config="config" :rowIndex="index"></ShowText>
41
41
  </div>
@@ -104,9 +104,43 @@ export default {
104
104
  },
105
105
  curlEffectData:[],
106
106
  effectData:[]
107
-
108
107
  };
109
108
  },
109
+ computed: {
110
+ tableHeight() {
111
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
112
+ if(this.isFull) {
113
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
114
+ } else {
115
+ if (!this.myConfig.dynamicHeight) {
116
+ currentHeight = this.currentHeight;
117
+ if (this.extraHeight) {
118
+ currentHeight = currentHeight - Number(this.extraHeight);
119
+ }
120
+ if (this.outsideHeight) {
121
+ currentHeight = currentHeight - Number(this.outsideHeight);
122
+ }
123
+ if (this.myConfig.showSummary) {
124
+ currentHeight = currentHeight - 50;
125
+ }
126
+ }
127
+ }
128
+ return currentHeight;
129
+ },
130
+ tableMaxHeight() {
131
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
132
+ if(this.isFull) {
133
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
134
+ } else {
135
+ if (this.myConfig.dynamicHeight) {
136
+ if (this.myConfig.showSummary) {
137
+ currentHeight = currentHeight - 50;
138
+ }
139
+ }
140
+ }
141
+ return currentHeight;
142
+ }
143
+ },
110
144
  methods: {
111
145
  customInit2() {
112
146
  if (this.myConfig.showTitle !== undefined) {
@@ -4,7 +4,7 @@
4
4
  <Modal title="附件" v-model="showDetailAppendix" :width="appendixCurrentWidth" :footer-hide="true">
5
5
  <AppendixBoxs v-if="detalAppendixFlag" ref="detailappendix" :config="billDetailAppendixConfig" @doAction="doAction"/>
6
6
  </Modal>
7
- <Modal title="模版打印" v-model="showPrintMode" :width="appendixCurrentWidth" :footer-hide="true" :fullscreen="true">
7
+ <Modal title="模版打印" v-model="showPrintMode" :width="appendixCurrentWidth" :footer-hide="true" :fullscreen="true" class-name="print-bill-panel-modal">
8
8
  <iframe ref="iframetemplate" v-if="printModeReset" :src="printModeUrl" width="100%" height="100%" allowtransparency="true" frameborder="0" ></iframe>
9
9
  </Modal>
10
10
  <BillAsyncImport v-if="importReset" ref="billAsyncImport" :config="billAsyncImportConfig" />
@@ -31,3 +31,11 @@ export default {
31
31
  },
32
32
  };
33
33
  </script>
34
+ <style lang="less">
35
+ .print-bill-panel-modal{
36
+ .ivu-modal-body{
37
+ padding: 0px!important;
38
+ overflow: hidden!important;
39
+ }
40
+ }
41
+ </style>