ocpview-plus 1.0.3 → 1.0.5

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.3",
3
+ "version": "1.0.5",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -49,10 +49,10 @@
49
49
  </div>
50
50
  </template>
51
51
  <div :style="divStyle">
52
- <div v-if="$slots.header">
52
+ <!-- <div v-if="$slots.header">
53
53
  <slot name="header"></slot>
54
- </div>
55
- <Row
54
+ </div> -->
55
+ <!-- <Row
56
56
  v-else
57
57
  v-show="showGrid"
58
58
  type="flex"
@@ -84,7 +84,7 @@
84
84
  >删除</Button
85
85
  >
86
86
  </Col>
87
- </Row>
87
+ </Row> -->
88
88
  <Row v-show="showGrid" style="width: 100%">
89
89
  <!-- 编辑表格 覆写开始 -->
90
90
  <vxe-grid
@@ -107,22 +107,55 @@
107
107
  :show-footer="showFooter"
108
108
  :footer-method="footerMethod"
109
109
  :footer-cell-class-name="footerCellClassName"
110
+ :toolbar-config="toolbarConfig"
111
+ :keyboard-config="VG_keyboardConfig"
112
+ :mouse-config="VG_mouseConfig"
110
113
  @sort-change="RewriteTableOnSortChange"
111
114
  @cell-dblclick="RewriteTableCellDBlclick"
115
+ @edit-activated="VG_editActivated"
116
+ @keydown="VG_keydown"
112
117
  >
113
- <template #columnEdit="{ row, rowIndex, columnIndex }">
114
- <!-- <ControlBox
115
- v-if="editIndex === index && editKey === config.key"
116
- :ref="'cell_' + index + '_' + config.key"
117
- :autofocus="true"
118
- :config="getCellConfig(index, config)"
119
- :valueData="getCurRow(index)"
120
- @inputValue="input"
121
- :editIndex="index"
122
- @doAction="doAction"
123
- ></ControlBox> -->
118
+ <!-- 操作面板插槽 -->
119
+ <template #toolbar_buttons>
120
+ <Row
121
+ v-show="showGrid"
122
+ type="flex"
123
+ justify="start"
124
+ align="middle"
125
+ :gutter="0"
126
+ >
127
+ <Col v-if="showAddBtn">
128
+ <Button
129
+ :style="btnStyle"
130
+ customIcon="iconfont icon-custom-rowadd3"
131
+ type="text"
132
+ :disabled="myConfig.readOnly"
133
+ @click="handleAddRow"
134
+ >添加</Button
135
+ >
136
+ </Col>
137
+ <Col v-if="showAddBtn && showDelBatchBtn">
138
+ <Divider
139
+ type="vertical"
140
+ style="margin: 0 6px 0 6px"
141
+ />
142
+ </Col>
143
+ <Col v-if="showDelBatchBtn">
144
+ <Button
145
+ :style="btnStyle"
146
+ customIcon="iconfont icon-custom-rowdel3"
147
+ type="text"
148
+ :disabled="myConfig.readOnly"
149
+ @click="delBatchRow"
150
+ >删除</Button
151
+ >
152
+ </Col>
153
+ </Row>
154
+ </template>
124
155
 
125
- <ControlBox
156
+ <!-- 编辑列插槽 -->
157
+ <template #columnEdit="{ row, rowIndex, columnIndex }">
158
+ <BillInfoPanelEditTableControlbox
126
159
  :autofocus="true"
127
160
  :config="getTableColumnConfig(columnIndex)"
128
161
  :valueData="row"
@@ -133,19 +166,9 @@
133
166
  }
134
167
  "
135
168
  @doAction="doAction"
136
- ></ControlBox>
137
- <!-- <p>asdf</p> -->
138
- <!-- <vxe-input type="text"></vxe-input> -->
169
+ ></BillInfoPanelEditTableControlbox>
139
170
  </template>
140
171
  </vxe-grid>
141
- <!-- <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">
142
- <template v-for="config in soltTableColumns" v-slot:[config.key]="{ index }" :key="'show_' + config.key">
143
- <div @click="EditCell(index,config)" :class="config.cellClassName">
144
- <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>
145
- <ShowText v-else :label="formatValue(index,config)" :contentAlign="config.contentAlign" :class="IsCellError(index,config)" :config="config" :rowIndex="index"></ShowText>
146
- </div>
147
- </template>
148
- </Table> -->
149
172
  <!-- 编辑表格 覆写结束 -->
150
173
  <div
151
174
  ref="page"
@@ -253,10 +276,14 @@
253
276
  </template>
254
277
  <script>
255
278
  import editgridcard from "../editgridcard.vue";
279
+ import BillInfoPanelEditTableControlbox from "./BillInfoPanelEditTableControlbox.vue";
280
+ import useVxeGridEditTypeKeydownEventHook from "./mixins/useVxeGridEditTypeKeydownEventHook.js";
256
281
 
257
282
  export default {
258
283
  name: "BillInfoPanelEditTable",
259
284
  extends: editgridcard,
285
+ components: { BillInfoPanelEditTableControlbox },
286
+ mixins: [useVxeGridEditTypeKeydownEventHook],
260
287
  data() {
261
288
  return {
262
289
  editType: false,
@@ -265,12 +292,13 @@ export default {
265
292
  mode: "cell",
266
293
  autoClear: false,
267
294
  beforeEditMethod: ({ column }) => {
268
- // console.log("🚀 ~ data ~ column:", column);
269
295
  if (this.editType) {
270
296
  return false;
271
297
  }
272
298
  if (this.myConfig.cellbeginedit) {
273
- return this.myConfig.cellbeginedit({ column });
299
+ return this.myConfig.cellbeginedit({
300
+ column: { ...column, name: column.property },
301
+ });
274
302
  }
275
303
  return true;
276
304
  },
@@ -323,13 +351,24 @@ export default {
323
351
  enabled: false,
324
352
  defaultValue: item.defaultValue || "",
325
353
  },
326
- ...(!item.readOnly && {
327
- editRender: {
328
- enabled: true,
329
- defaultValue: item.defaultValue || "",
330
- },
331
- slots: { edit: "columnEdit" },
332
- }),
354
+ ...(!item.readOnly &&
355
+ !columnsItemType && {
356
+ editRender: {
357
+ enabled: true,
358
+ autoselect: this.$utils.get(
359
+ item,
360
+ "autoselect",
361
+ false
362
+ ),
363
+ autofocus: this.$utils.get(
364
+ item,
365
+ "autofocus",
366
+ ""
367
+ ),
368
+ defaultValue: item.defaultValue || "",
369
+ },
370
+ slots: { edit: "columnEdit" },
371
+ }),
333
372
  };
334
373
  });
335
374
  // console.log("newColumns:", newColumns);
@@ -370,16 +409,37 @@ export default {
370
409
  .filter((item) => item.summary)
371
410
  .map((item) => item.name);
372
411
  },
412
+ toolbarConfig() {
413
+ // console.log("this.myConfig", this.myConfig);
414
+ return {
415
+ zoom: this.myConfig.zoom,
416
+ slots: {
417
+ // 自定义插槽模板
418
+ buttons: "toolbar_buttons",
419
+ },
420
+ };
421
+ },
373
422
  },
374
423
  methods: {
375
424
  // ==================================================================
376
425
 
426
+ /**
427
+ * 【覆写】编辑项触发回车事件
428
+ */
429
+ enterKeyDown() {
430
+ const $table = this.$refs.table;
431
+ this.VG_keyCode13Event($table);
432
+ },
433
+
377
434
  /**
378
435
  * 【覆写】手工触发编辑事件
379
436
  */
380
437
  valueChanged(obj) {
381
438
  const $tableVM = this.$refs.table;
382
- const editRecord = $tableVM.getEditRecord();
439
+ let editRecord = $tableVM.getEditRecord();
440
+ if (!editRecord) {
441
+ editRecord = this.VG_currentEditRecord;
442
+ }
383
443
  const params = { ...obj, rowinfo: editRecord };
384
444
  const column = this.findColumnConfig(obj.name, this.myConfig.items);
385
445
  const valueChangedSucc = column.valueChanged(params);
@@ -497,26 +557,39 @@ export default {
497
557
  */
498
558
  async handleAddRow() {
499
559
  const $tableVM = this.$refs.table;
500
- let row = null;
560
+ let rowData = null;
501
561
  if (this.myConfig.addRowBefore) {
502
562
  let temp = {};
503
563
  temp.name = this.myConfig.name;
504
564
  temp.grid = $tableVM;
505
- row = this.myConfig.addRowBefore(temp);
506
- if (row === false) {
565
+ rowData = this.myConfig.addRowBefore(temp);
566
+ if (rowData === false) {
507
567
  return;
508
568
  }
509
569
  }
510
- if (!row || row === true) {
511
- row = {};
570
+ if (!rowData || rowData === true) {
571
+ rowData = {};
512
572
  }
513
-
514
573
  const errMap = await $tableVM.validate(true);
515
574
  if (errMap) {
516
575
  return false;
517
576
  }
518
-
519
- const { row: newRow } = await $tableVM.insertAt(row, -1);
577
+ const { row: newRow } = await $tableVM.insertAt(rowData, -1);
578
+ // 后续完善
579
+ const tableColumns = $tableVM.getTableColumn();
580
+ const visibleColumns = this.$utils.get(
581
+ tableColumns,
582
+ "visibleColumn",
583
+ []
584
+ );
585
+ const column = this.$utils.find(visibleColumns, (column) => {
586
+ return (
587
+ column &&
588
+ column.editRender &&
589
+ column.editRender.enabled !== false
590
+ );
591
+ });
592
+ await $tableVM.setEditRow(newRow, false);
520
593
  },
521
594
 
522
595
  /**
@@ -619,6 +692,10 @@ export default {
619
692
  },
620
693
 
621
694
  getTableColumnConfig(index) {
695
+ let column = this.tableColumns[index];
696
+ if (column.type === "NumberBox") {
697
+ column.place = "unset";
698
+ }
622
699
  return this.tableColumns[index];
623
700
  },
624
701
 
@@ -685,6 +762,11 @@ export default {
685
762
  const { row } = params;
686
763
  this.dbclick(row);
687
764
  },
765
+
766
+ handleZoom() {
767
+ const $tableVM = this.$refs.table;
768
+ $tableVM.zoom();
769
+ },
688
770
  },
689
771
  mounted() {
690
772
  // console.log("我继承覆写了999999");
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div v-if="hackReset" @keydown.enter="keyDown('enter')">
3
+ <template v-if="type === 'Divider'">
4
+ <Divider
5
+ :orientation="config.orientation"
6
+ :dashed="config.dashed"
7
+ :type="config.vtype"
8
+ :id="config.id"
9
+ :style="config.style"
10
+ >
11
+ <template v-if="!!config.label || !!config.hide" #default>
12
+ <span v-if="!!config.label" v-text="config.label"> </span>
13
+ <div v-if="!!config.hide">
14
+ <p
15
+ v-if="hideFlag"
16
+ @click.stop="hide"
17
+ class="efuture-hide-text"
18
+ >
19
+ <Icon type="ios-arrow-up" />
20
+ <span> 收起查询条件 </span>
21
+ </p>
22
+ <p v-else @click.stop="hide" class="efuture-hide-text">
23
+ <Icon type="ios-arrow-down" />
24
+ <span>展开查询条件</span>
25
+ </p>
26
+ </div>
27
+ </template>
28
+ </Divider>
29
+ </template>
30
+ <template v-else-if="type === 'NumberRangeBox'">
31
+ <NumberRangeBox
32
+ ref="myControl"
33
+ :fatherSvalue="svalue"
34
+ :fatherEvalue="evalue"
35
+ @inputValue="input"
36
+ :config="config"
37
+ ></NumberRangeBox>
38
+ </template>
39
+ <template v-else-if="type === 'DateRangeBox'">
40
+ <DateRangeBox
41
+ ref="myControl"
42
+ :fatherSvalue="svalue"
43
+ :fatherEvalue="evalue"
44
+ @inputValue="input"
45
+ :config="config"
46
+ ></DateRangeBox>
47
+ </template>
48
+ <template v-else-if="type === 'PopTextBox'">
49
+ <PopTextBox
50
+ ref="myControl"
51
+ :fatherValue="value"
52
+ :fatherText="text"
53
+ @inputValue="input"
54
+ :config="config"
55
+ ></PopTextBox>
56
+ </template>
57
+ <template v-else-if="type === 'PictureBox'">
58
+ <PictureBox
59
+ ref="myControl"
60
+ v-if="config.multiSelect !== true"
61
+ :fatherValue="value"
62
+ @inputValue="input"
63
+ :config="config"
64
+ :readOnly="readOnly"
65
+ :showStyle="config.showStyle"
66
+ ></PictureBox>
67
+ <PictureBox
68
+ ref="myControl"
69
+ v-else
70
+ :config="config"
71
+ :readOnly="readOnly"
72
+ :showStyle="config.showStyle"
73
+ ></PictureBox>
74
+ </template>
75
+ <template v-else-if="type === 'VideoBox'">
76
+ <VideoBox
77
+ ref="myControl"
78
+ v-if="config.multiSelect !== true"
79
+ :fatherValue="value"
80
+ @inputValue="input"
81
+ :config="config"
82
+ :readOnly="readOnly"
83
+ :showStyle="config.showStyle"
84
+ ></VideoBox>
85
+ <VideoBox
86
+ ref="myControl"
87
+ v-else
88
+ :config="config"
89
+ :readOnly="readOnly"
90
+ :showStyle="config.showStyle"
91
+ ></VideoBox>
92
+ </template>
93
+ <template v-else-if="type === 'NumberBox'">
94
+ <BillInfoPanelEditTableControlboxNumberbox
95
+ ref="myControl"
96
+ :fatherValue="value"
97
+ :readOnly="readOnly"
98
+ @inputValue="input"
99
+ :config="config"
100
+ ></BillInfoPanelEditTableControlboxNumberbox>
101
+ </template>
102
+ <template v-else>
103
+ <component
104
+ :is="type"
105
+ ref="myControl"
106
+ :fatherValue="value"
107
+ :readOnly="readOnly"
108
+ @inputValue="input"
109
+ :config="config"
110
+ />
111
+ </template>
112
+ </div>
113
+ </template>
114
+
115
+ <script>
116
+ import controlbox from "../../base/controlbox.vue";
117
+ import BillInfoPanelEditTableControlboxNumberbox from "./BillInfoPanelEditTableControlboxNumberbox.vue";
118
+ export default {
119
+ name: "BillInfoPanelEditTableControlbox",
120
+ extends: controlbox,
121
+ components: { BillInfoPanelEditTableControlboxNumberbox },
122
+ mounted() {
123
+ // console.log("我继承覆写了999999");
124
+ },
125
+ };
126
+ </script>
@@ -0,0 +1,21 @@
1
+ <script>
2
+ import numberbox from "../../numberbox/numberbox.vue";
3
+ export default {
4
+ name: "BillInfoPanelEditTableControlboxNumberbox",
5
+ extends: numberbox,
6
+ methods: {
7
+ init() {
8
+ // 获取默认属性
9
+ this.myConfig = Object.assign({}, this.globalConfig, this.myConfig);
10
+
11
+ // 获取动态属性
12
+ if (this.config) {
13
+ this.myConfig = Object.assign({}, this.myConfig, this.config);
14
+ }
15
+ },
16
+ },
17
+ mounted() {
18
+ // console.log("我继承覆写了999999");
19
+ },
20
+ };
21
+ </script>