ocpview-plus 1.3.14 → 1.3.16

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 (213) hide show
  1. package/README.md +55 -43
  2. package/dist/ocpviewplus.min.esm.js +574 -482
  3. package/dist/ocpviewplus.min.js +9 -9
  4. package/dist/style.css +1 -1
  5. package/dist/styles/efviewplus.css +1 -1
  6. package/package.json +146 -146
  7. package/src/components/base/ContractPrintMixins.js +30 -30
  8. package/src/components/base/controlbase.vue +190 -190
  9. package/src/components/base/controlbox.vue +102 -102
  10. package/src/components/base/index.js +2 -2
  11. package/src/components/base/load.js +19 -19
  12. package/src/components/base/probase.js +220 -220
  13. package/src/components/base/size.js +78 -78
  14. package/src/components/billbox/billbox.vue +67 -67
  15. package/src/components/billbox/index.js +1 -1
  16. package/src/components/cascaderbox/cascaderbox.vue +184 -184
  17. package/src/components/cascaderbox/index.js +2 -2
  18. package/src/components/checkbox/checkbox.vue +75 -75
  19. package/src/components/checkbox/checkgroupbox.vue +103 -103
  20. package/src/components/checkbox/index.js +2 -2
  21. package/src/components/colorbox/colorbox.vue +43 -43
  22. package/src/components/colorbox/index.js +1 -1
  23. package/src/components/combobox/combobox.vue +219 -219
  24. package/src/components/combobox/index.js +1 -1
  25. package/src/components/conditionbox/conditionbase.vue +194 -194
  26. package/src/components/conditionbox/conditionbox.vue +62 -62
  27. package/src/components/conditionbox/conditionfilterbox.vue +479 -479
  28. package/src/components/conditionbox/conditionselectorbox.vue +237 -237
  29. package/src/components/conditionbox/index.js +4 -4
  30. package/src/components/conditionbox/queryconditionbox.vue +25 -25
  31. package/src/components/conditionbox/queryconditionboxbase.vue +123 -123
  32. package/src/components/conditionbox/searchconditionbox.vue +113 -113
  33. package/src/components/conditionbox/searchgrid.vue +391 -391
  34. package/src/components/datebox/DateBoxV1.vue +22 -22
  35. package/src/components/datebox/datebox.vue +129 -129
  36. package/src/components/datebox/daterangebox.vue +154 -154
  37. package/src/components/datebox/index.js +5 -5
  38. package/src/components/form/baseform.vue +676 -676
  39. package/src/components/form/detailsbox.vue +487 -487
  40. package/src/components/form/formbox.vue +28 -28
  41. package/src/components/form/formcardbox.vue +267 -267
  42. package/src/components/form/formcardbox2.vue +228 -228
  43. package/src/components/form/formcardgroupbox.vue +251 -251
  44. package/src/components/form/formcompro.js +18 -18
  45. package/src/components/form/formdetail.vue +128 -128
  46. package/src/components/form/formdetailtwo.vue +302 -302
  47. package/src/components/form/index.js +9 -9
  48. package/src/components/form/toolanchor.js +45 -45
  49. package/src/components/form/workform.vue +167 -167
  50. package/src/components/grid/basegrid.vue +1062 -1062
  51. package/src/components/grid/editgrid.vue +51 -51
  52. package/src/components/grid/editgridbase.vue +1062 -1062
  53. package/src/components/grid/editgridcard.vue +193 -193
  54. package/src/components/grid/expandrow.vue +137 -137
  55. package/src/components/grid/index.js +5 -5
  56. package/src/components/grid/viewgrid.vue +121 -121
  57. package/src/components/grid/viewgridbase.vue +1286 -1286
  58. package/src/components/icon/common-icon.vue +53 -53
  59. package/src/components/icon/eicon.vue +28 -28
  60. package/src/components/icon/icons.vue +42 -42
  61. package/src/components/icon/index.js +1 -1
  62. package/src/components/label/index.js +2 -2
  63. package/src/components/label/showtext.vue +94 -94
  64. package/src/components/load/loadcartoon.vue +227 -227
  65. package/src/components/map/index.js +1 -1
  66. package/src/components/map/mapbox.vue +348 -348
  67. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanel.vue +184 -184
  68. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTable.vue +838 -838
  69. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlbox.vue +126 -126
  70. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlboxNumberbox.vue +27 -27
  71. package/src/components/masterplate/RewriteBillListDetails/BillListPanel.vue +126 -126
  72. package/src/components/masterplate/RewriteBillListDetails/BillListPanelQueryBar.vue +280 -280
  73. package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +346 -346
  74. package/src/components/masterplate/RewriteBillListDetails/index.vue +325 -325
  75. package/src/components/masterplate/RewriteBillListDetails/mixins/useVxeGridEditTypeKeydownEventHook.js +251 -251
  76. package/src/components/masterplate/RewriteListdetails/BillListPanelV2.vue +115 -115
  77. package/src/components/masterplate/RewriteListdetails/BillListPanelV2QueryBar.vue +24 -24
  78. package/src/components/masterplate/RewriteListdetails/BillListPanelV3.vue +121 -121
  79. package/src/components/masterplate/RewriteListdetails/BillListPanelV3QueryBar.vue +275 -275
  80. package/src/components/masterplate/RewriteListdetails/indexV2.vue +320 -320
  81. package/src/components/masterplate/RewriteListdetails/indexV3.vue +331 -331
  82. package/src/components/masterplate/appendix.vue +586 -586
  83. package/src/components/masterplate/approval.vue +863 -863
  84. package/src/components/masterplate/base.vue +1028 -1028
  85. package/src/components/masterplate/billasyncimport.vue +614 -614
  86. package/src/components/masterplate/billconditionbox.vue +223 -223
  87. package/src/components/masterplate/billconditionsbox.vue +427 -427
  88. package/src/components/masterplate/billdetailform.vue +1028 -1028
  89. package/src/components/masterplate/billimport.vue +301 -301
  90. package/src/components/masterplate/billquerygrid.vue +391 -391
  91. package/src/components/masterplate/billsinglegrid.vue +234 -234
  92. package/src/components/masterplate/birtreport.vue +185 -185
  93. package/src/components/masterplate/contractappendix.vue +688 -688
  94. package/src/components/masterplate/detailbtntoolbar.vue +311 -311
  95. package/src/components/masterplate/detailsbox.vue +386 -386
  96. package/src/components/masterplate/editgridcard.vue +292 -292
  97. package/src/components/masterplate/editgridcard2.vue +127 -127
  98. package/src/components/masterplate/formcard.vue +105 -105
  99. package/src/components/masterplate/formcardgroupbox.vue +167 -167
  100. package/src/components/masterplate/formdetailtwo.vue +366 -366
  101. package/src/components/masterplate/gridcolset.vue +226 -226
  102. package/src/components/masterplate/index.js +54 -54
  103. package/src/components/masterplate/layouttemplate.vue +51 -51
  104. package/src/components/masterplate/leftlistrightdetails.vue +581 -581
  105. package/src/components/masterplate/leftlistrightlist.vue +464 -464
  106. package/src/components/masterplate/lefttreerightdetails.vue +636 -636
  107. package/src/components/masterplate/levelreport.vue +510 -510
  108. package/src/components/masterplate/listbtntoolbar.vue +276 -276
  109. package/src/components/masterplate/listdetails.vue +768 -768
  110. package/src/components/masterplate/operlog.vue +272 -272
  111. package/src/components/masterplate/options.vue +110 -110
  112. package/src/components/masterplate/page.vue +102 -102
  113. package/src/components/masterplate/promptmessage.vue +73 -73
  114. package/src/components/masterplate/querybar.vue +490 -490
  115. package/src/components/masterplate/report.vue +357 -357
  116. package/src/components/masterplate/rowbtntoolbar.vue +126 -126
  117. package/src/components/masterplate/simpletree.vue +137 -137
  118. package/src/components/masterplate/simpleviewgrid.vue +144 -144
  119. package/src/components/mychart/bar/bar.vue +201 -201
  120. package/src/components/mychart/basechart.vue +190 -190
  121. package/src/components/mychart/complexmychart/barline.vue +153 -153
  122. package/src/components/mychart/gauge/gauge.vue +82 -82
  123. package/src/components/mychart/index.js +8 -8
  124. package/src/components/mychart/line/line.vue +201 -201
  125. package/src/components/mychart/liquidfill/liquidfill.vue +108 -108
  126. package/src/components/mychart/pie/pie.vue +95 -95
  127. package/src/components/mychart/radar/radar.vue +121 -121
  128. package/src/components/mychart/scatter/scatter.vue +75 -75
  129. package/src/components/numberbox/NumberBoxV1.vue +39 -39
  130. package/src/components/numberbox/append.js +11 -11
  131. package/src/components/numberbox/index.js +4 -4
  132. package/src/components/numberbox/numberbox.vue +302 -302
  133. package/src/components/numberbox/numberrangebox.vue +422 -422
  134. package/src/components/picturebox/filebox.vue +369 -369
  135. package/src/components/picturebox/index.js +2 -2
  136. package/src/components/picturebox/picturebox.vue +541 -541
  137. package/src/components/picturebox/uploadbox.vue +164 -164
  138. package/src/components/poptagbox/index.js +1 -1
  139. package/src/components/poptagbox/poptagbox.vue +388 -388
  140. package/src/components/poptextbox/index.js +1 -1
  141. package/src/components/poptextbox/poptextbox.vue +624 -624
  142. package/src/components/radiobox/index.js +1 -1
  143. package/src/components/radiobox/radiogroupbox.vue +75 -75
  144. package/src/components/richtextbox/editor.vue +150 -150
  145. package/src/components/richtextbox/index.js +1 -1
  146. package/src/components/richtextbox/richtextbox.vue +448 -448
  147. package/src/components/textbox/index.js +1 -1
  148. package/src/components/textbox/textbox.vue +97 -97
  149. package/src/components/timebox/index.js +1 -1
  150. package/src/components/timebox/timebox.vue +75 -75
  151. package/src/components/toolbar/ebutton.vue +169 -169
  152. package/src/components/toolbar/index.js +3 -3
  153. package/src/components/toolbar/toolbar.vue +445 -445
  154. package/src/components/tree/CompatTree.vue +297 -297
  155. package/src/components/tree/basetree.vue +1098 -1098
  156. package/src/components/tree/index.js +2 -2
  157. package/src/components/tree/treedata.vue +53 -53
  158. package/src/components/tree/treedatabase.vue +189 -189
  159. package/src/components/upload/billimport.vue +233 -233
  160. package/src/components/upload/index.js +1 -1
  161. package/src/components/videobox/index.js +1 -1
  162. package/src/components/videobox/uploadbox.vue +148 -148
  163. package/src/components/videobox/videobox.vue +503 -503
  164. package/src/components/wrichtextbox/editor.vue +219 -219
  165. package/src/components/wrichtextbox/index.js +1 -1
  166. package/src/components/wrichtextbox/wrichtextbox.vue +62 -62
  167. package/src/index.js +231 -231
  168. package/src/locale/format.js +51 -51
  169. package/src/locale/index.js +63 -63
  170. package/src/locale/lang/zh-CN.js +123 -123
  171. package/src/locale/lang/zh-TW.js +114 -114
  172. package/src/locale/lang/zh-UG.js +115 -115
  173. package/src/locale/lang.js +15 -15
  174. package/src/method/case/case.js +1274 -1274
  175. package/src/method/config/queryconfig.js +24 -24
  176. package/src/method/const/const.js +815 -815
  177. package/src/method/index.js +7 -7
  178. package/src/plugins/theme/theme-variable.css +114 -114
  179. package/src/plugins/vxeTable/index.js +241 -241
  180. package/src/plugins/vxeTable/renderer/components/TableFilterInput.vue +51 -51
  181. package/src/plugins/vxeTable/renderer/filter.js +32 -32
  182. package/src/static/excel/exportexcel.js +626 -626
  183. package/src/static/iview/coustom.js +462 -462
  184. package/src/store/index.js +18 -18
  185. package/src/store/modules/app.js +53 -53
  186. package/src/styles/README.md +3 -3
  187. package/src/styles/common.less +80 -80
  188. package/src/styles/components/anchor.less +74 -74
  189. package/src/styles/components/approval.less +135 -135
  190. package/src/styles/components/button.less +208 -208
  191. package/src/styles/components/card.less +51 -51
  192. package/src/styles/components/content.less +38 -38
  193. package/src/styles/components/font.less +313 -313
  194. package/src/styles/components/form.less +71 -71
  195. package/src/styles/components/iconfont/fonts/iconfont.less +1384 -1384
  196. package/src/styles/components/iconfont/fonts/iconfont.svg +703 -703
  197. package/src/styles/components/index.less +16 -16
  198. package/src/styles/components/input.less +290 -290
  199. package/src/styles/components/modal.less +203 -203
  200. package/src/styles/components/page.less +340 -340
  201. package/src/styles/components/select.less +361 -361
  202. package/src/styles/components/steps.less +367 -367
  203. package/src/styles/components/table.less +544 -544
  204. package/src/styles/components/tabs.less +249 -249
  205. package/src/styles/components/upload.less +82 -82
  206. package/src/styles/custom.less +67 -67
  207. package/src/styles/index.less +6 -6
  208. package/src/styles/pack.less +6 -6
  209. package/src/utils/EfuMessenger.js +155 -155
  210. package/src/utils/assist.js +353 -353
  211. package/src/utils/index.js +1 -1
  212. package/src/utils/random_str.js +10 -10
  213. package/src/components/masterplate/detailgridbox.vue +0 -386
@@ -1,838 +1,838 @@
1
- <template>
2
- <Card ref="card" :bordered="false" :padding="0" dis-hover>
3
- <!-- 如果myConfig.modetype为1,则显示 -->
4
- <template v-if="myConfig.modetype === '1'">
5
- <!-- 如果showTitle为true,则显示 -->
6
- <p v-if="showTitle" @click="toggle" style="cursor: pointer">
7
- <Row
8
- type="flex"
9
- justify="start"
10
- align="middle"
11
- style="margin-top: 14px; margin-bottom: 14px"
12
- >
13
- <!-- 如果showGrid为true,则显示icon-custom-pack,否则显示icon-custom-spread -->
14
- <Icon
15
- custom="iconfont icon-custom-pack"
16
- color="#f3b352"
17
- v-show="showGrid"
18
- size="14"
19
- />
20
- <Icon
21
- v-show="!showGrid"
22
- color="#f3b352"
23
- custom="iconfont icon-custom-spread"
24
- size="14"
25
- />
26
- <!-- 显示myConfig.title -->
27
- <span
28
- style="
29
- margin-left: 10px;
30
- font-size: 14px;
31
- font-weight: bold;
32
- "
33
- v-text="myConfig.title"
34
- />
35
- </Row>
36
- </p>
37
- <!-- 显示分割线 -->
38
- <Divider
39
- style="margin-left: 24px; margin-top: 0px; margin-bottom: 10px"
40
- />
41
- </template>
42
- <!-- 如果myConfig.modetype为2,则显示 -->
43
- <template v-if="myConfig.modetype === '2'">
44
- <div v-if="showTitle" style="margin-bottom: 10px">
45
- <span class="efuture-title-verticalline" /><span
46
- style="font-size: 14px; font-weight: bold"
47
- v-text="myConfig.title"
48
- />
49
- </div>
50
- </template>
51
- <div :style="divStyle">
52
- <!-- <div v-if="$slots.header">
53
- <slot name="header"></slot>
54
- </div> -->
55
- <!-- <Row
56
- v-else
57
- v-show="showGrid"
58
- type="flex"
59
- justify="start"
60
- align="middle"
61
- :gutter="0"
62
- style="margin-bottom: 10px"
63
- >
64
- <Col v-if="showAddBtn">
65
- <Button
66
- :style="btnStyle"
67
- customIcon="iconfont icon-custom-rowadd3"
68
- type="text"
69
- :disabled="myConfig.readOnly"
70
- @click="handleAddRow"
71
- >添加</Button
72
- >
73
- </Col>
74
- <Col v-if="showAddBtn && showDelBatchBtn">
75
- <Divider type="vertical" style="margin: 0 6px 0 6px" />
76
- </Col>
77
- <Col v-if="showDelBatchBtn">
78
- <Button
79
- :style="btnStyle"
80
- customIcon="iconfont icon-custom-rowdel3"
81
- type="text"
82
- :disabled="myConfig.readOnly"
83
- @click="delBatchRow"
84
- >删除</Button
85
- >
86
- </Col>
87
- </Row> -->
88
- <Row v-show="showGrid" style="width: 100%">
89
- <!-- 编辑表格 覆写开始 -->
90
- <vxe-grid
91
- ref="table"
92
- keep-source
93
- border="full"
94
- style="width: 100%"
95
- :columns="RewriteColumns"
96
- :data="dataList"
97
- :height="tableHeight"
98
- :max-height="tableMaxHeight + 100"
99
- :loading="loading"
100
- :sort-config="{ remote: true, trigger: 'cell' }"
101
- :valid-config="{
102
- showMessage: false,
103
- autoClear: false,
104
- }"
105
- :editConfig="editConfig"
106
- :edit-rules="validRules"
107
- :show-footer="showFooter"
108
- :footer-method="footerMethod"
109
- :footer-cell-class-name="footerCellClassName"
110
- :toolbar-config="toolbarConfig"
111
- :keyboard-config="VG_keyboardConfig"
112
- :mouse-config="VG_mouseConfig"
113
- @sort-change="RewriteTableOnSortChange"
114
- @cell-dblclick="RewriteTableCellDBlclick"
115
- @edit-activated="VG_editActivated"
116
- @keydown="VG_keydown"
117
- >
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>
155
-
156
- <!-- 编辑列插槽 -->
157
- <template #columnEdit="{ row, rowIndex, columnIndex }">
158
- <BillInfoPanelEditTableControlbox
159
- :autofocus="true"
160
- :config="getTableColumnConfig(columnIndex)"
161
- :valueData="row"
162
- :editIndex="rowIndex"
163
- @inputValue="
164
- (params) => {
165
- cellInput({ params, row });
166
- }
167
- "
168
- @doAction="doAction"
169
- ></BillInfoPanelEditTableControlbox>
170
- </template>
171
- </vxe-grid>
172
- <!-- 编辑表格 覆写结束 -->
173
- <div
174
- ref="page"
175
- v-if="myConfig.showPage"
176
- style="background: #eee; padding-top: 5px; width: 100%"
177
- >
178
- <Card
179
- :bordered="false"
180
- :padding="0"
181
- :dis-hover="true"
182
- style="border-radius: 0px"
183
- >
184
- <Row
185
- type="flex"
186
- justify="end"
187
- style="padding: 5px; padding-right: 10px"
188
- >
189
- <Page
190
- :total="myConfig.pageConfig.total_results"
191
- :size="myConfig.pageSize"
192
- :current="myConfig.pageConfig.page_no"
193
- :page-size="myConfig.pageConfig.page_size"
194
- :page-size-opts="
195
- myConfig.pageConfig.pageSizeList
196
- "
197
- @on-page-size-change="changePageSize"
198
- @on-change="changePage"
199
- :show-total="myConfig.pageShowTotal"
200
- :show-elevator="myConfig.pageShowElevator"
201
- :show-sizer="myConfig.pageShowSizer"
202
- ></Page>
203
- </Row>
204
- </Card>
205
- </div>
206
- </Row>
207
- <p
208
- v-show="showGrid && showEffectValue"
209
- @click="toggleEffect"
210
- style="
211
- cursor: pointer;
212
- background-color: #fff2de;
213
- height: 36px;
214
- line-height: 36px;
215
- border: 1px solid #f3b352;
216
- margin-top: 10px;
217
- "
218
- >
219
- <Icon
220
- custom="iconfont icon-custom-help"
221
- size="20"
222
- style="margin-left: 10px"
223
- color="#D5882E"
224
- />
225
- <span style="margin-left: 4px; color: #d5882e">参考数据</span>
226
- </p>
227
- <Row
228
- v-show="showGrid && showEffectValue && showEffectGrid"
229
- class="efuture-effect-grid"
230
- style="margin-top: 10px"
231
- >
232
- <Table
233
- ref="effect_table"
234
- :row-class-name="rowClassName"
235
- :loading="loading"
236
- :size="myConfig.tableSize"
237
- :border="myConfig.showBorder"
238
- :stripe="myConfig.showStripe"
239
- :maxHeight="tableMaxHeight"
240
- :columns="tableColumns"
241
- :data="curlEffectData"
242
- @on-column-width-resize="onColumnWidthResize"
243
- >
244
- <template
245
- v-for="config in soltTableColumns"
246
- v-slot:[config.key]="{ row, index }"
247
- :key="'show_effect' + config.key"
248
- >
249
- <ShowText
250
- :label="effectFormatValue(index, config, row)"
251
- :contentAlign="config.contentAlign"
252
- :class="config.cellClassName"
253
- :config="config"
254
- :rowIndex="index"
255
- ></ShowText>
256
- </template>
257
- </Table>
258
- </Row>
259
- </div>
260
- <Modal
261
- v-if="!editRowFlag"
262
- v-model="showEditRowForm"
263
- width="90%"
264
- title="编辑"
265
- @on-ok="editRow"
266
- >
267
- <div>
268
- <ExpandRow
269
- ref="rowForm"
270
- :config="myConfig"
271
- :dictData="dictData"
272
- />
273
- </div>
274
- </Modal>
275
- </Card>
276
- </template>
277
- <script>
278
- import editgridcard from "../editgridcard.vue";
279
- import BillInfoPanelEditTableControlbox from "./BillInfoPanelEditTableControlbox.vue";
280
- import useVxeGridEditTypeKeydownEventHook from "./mixins/useVxeGridEditTypeKeydownEventHook.js";
281
-
282
- export default {
283
- name: "BillInfoPanelEditTable",
284
- extends: editgridcard,
285
- components: { BillInfoPanelEditTableControlbox },
286
- mixins: [useVxeGridEditTypeKeydownEventHook],
287
- data() {
288
- return {
289
- editType: false,
290
- editConfig: {
291
- trigger: "click",
292
- mode: "cell",
293
- autoClear: false,
294
- beforeEditMethod: (params) => {
295
- const { column, row, rowIndex } = params;
296
- if (this.editType) {
297
- return false;
298
- }
299
- if (this.myConfig.cellbeginedit) {
300
- return this.myConfig.cellbeginedit({
301
- column: { ...column, name: column.property },
302
- row: row,
303
- rowIndex: rowIndex,
304
- transmission: params,
305
- });
306
- }
307
- return true;
308
- },
309
- },
310
- dataList: [],
311
- };
312
- },
313
- computed: {
314
- /**
315
- * 表格列定义清洗
316
- */
317
- RewriteColumns() {
318
- // console.log("this.tableColumns", this.tableColumns);
319
- const newColumns = this.tableColumns.map((item) => {
320
- const columnsItemType = this.getColumnsItemType(item.key);
321
- return {
322
- ...(item.title && {
323
- title: item.title,
324
- }),
325
- ...(item.name && {
326
- field: item.name,
327
- }),
328
- ...(item.width && {
329
- width: item.width < 60 ? 60 : item.width,
330
- }),
331
- ...(item.minWidth && {
332
- minWidth: item.minWidth < 60 ? 60 : item.minWidth,
333
- }),
334
- ...(item.align && {
335
- align: item.align,
336
- }),
337
- ...(item.resizable && {
338
- resizable: item.resizable,
339
- }),
340
- sortable: false,
341
- ...(columnsItemType && {
342
- type: columnsItemType,
343
- sortable: false,
344
- }),
345
- formatter: (params) => {
346
- const { row, cellValue } = params;
347
- const valueFormat = this.$Method.formatValue(
348
- cellValue,
349
- row,
350
- item
351
- );
352
- return valueFormat;
353
- },
354
- editRender: {
355
- enabled: false,
356
- defaultValue: item.defaultValue || "",
357
- },
358
- ...(item.isFilters && {
359
- filters: [{ data: null }],
360
- filterRender: {
361
- name: "FilterInput",
362
- },
363
- }),
364
- ...(!item.readOnly &&
365
- !columnsItemType && {
366
- editRender: {
367
- enabled: true,
368
- autoselect: this.$utils.get(
369
- item,
370
- "autoselect",
371
- false
372
- ),
373
- autofocus: this.$utils.get(
374
- item,
375
- "autofocus",
376
- ""
377
- ),
378
- defaultValue: item.defaultValue || "",
379
- },
380
- slots: { edit: "columnEdit" },
381
- }),
382
- };
383
- });
384
- // console.log("newColumns:", newColumns);
385
- return newColumns;
386
- },
387
- /**
388
- * 表格数据
389
- */
390
- validRules() {
391
- return this.$utils.reduce(
392
- this.tableColumns,
393
- (previous, item) => {
394
- const columnsItemType = this.getColumnsItemType(item.key);
395
- if (!columnsItemType) {
396
- if (item.required) {
397
- previous[item.name] = [
398
- {
399
- required: true,
400
- message: `${item.label}必填`,
401
- },
402
- ];
403
- }
404
- }
405
- return previous;
406
- },
407
- {}
408
- );
409
- },
410
- /**
411
- * 是否显示合计
412
- */
413
- showFooter() {
414
- const showType = this.myConfig.showSummary;
415
- return showType;
416
- },
417
- sumFields() {
418
- return this.tableColumns
419
- .filter((item) => item.summary)
420
- .map((item) => item.name);
421
- },
422
- toolbarConfig() {
423
- // console.log("this.myConfig", this.myConfig);
424
- return {
425
- zoom: this.myConfig.zoom,
426
- slots: {
427
- // 自定义插槽模板
428
- buttons: "toolbar_buttons",
429
- },
430
- };
431
- },
432
- },
433
- methods: {
434
- // ==================================================================
435
-
436
- /**
437
- * 【覆写】编辑项触发回车事件
438
- */
439
- enterKeyDown() {
440
- const $table = this.$refs.table;
441
- this.VG_keyCode13Event($table);
442
- },
443
-
444
- /**
445
- * 【覆写】手工触发编辑事件
446
- */
447
- valueChanged(obj) {
448
- const column = this.findColumnConfig(obj.name, this.myConfig.items);
449
- this.addRowInfo(obj, column);
450
- const valueChangedSucc = column.valueChanged(obj);
451
- this.updateFooterEvent();
452
- return valueChangedSucc;
453
- },
454
- setDataBefore(obj, that) {
455
- const column = this.findColumnConfig(
456
- that.myConfig.name,
457
- this.myConfig.items
458
- );
459
- let temp = {};
460
- temp.data = obj;
461
- temp.tabname = this.myConfig.name;
462
- this.addRowInfo(temp, column);
463
- const setDataBeforeSucc = column.setDataBefore(temp, that);
464
- this.updateFooterEvent();
465
- return setDataBeforeSucc;
466
- },
467
-
468
- /**
469
- * 【覆写】获取全量数据
470
- */
471
- getData() {
472
- const $table = this.$refs.table;
473
- return $table.getTableData().fullData;
474
- },
475
-
476
- /**
477
- * 【覆写】获取增量变更数据事件
478
- * 临时方案,待优化封装
479
- */
480
- getChangeData() {
481
- // console.log("我猜测到这里了获取变更数据");
482
- // this.$utils
483
- // this.$refs.table
484
- const $table = this.$refs.table;
485
- const keyField = "_X_ROW_KEY";
486
- // 获取编辑分组数据
487
- const { insertRecords, removeRecords, updateRecords } =
488
- $table.getRecordset();
489
- // 数据整理
490
- const reportconds = [
491
- ...removeRecords.map((item) => {
492
- const itemFilterByKeyField = this.$utils.omit(
493
- item,
494
- keyField
495
- );
496
- return {
497
- ...itemFilterByKeyField,
498
- flag: item.flag || "D",
499
- };
500
- }),
501
- ...updateRecords.map((item) => {
502
- const itemFilterByKeyField = this.$utils.omit(
503
- item,
504
- keyField
505
- );
506
- return {
507
- ...itemFilterByKeyField,
508
- flag: item.flag || "U",
509
- };
510
- }),
511
- ...insertRecords.map((item) => {
512
- const itemFilterByKeyField = this.$utils.omit(
513
- item,
514
- keyField
515
- );
516
- return {
517
- ...itemFilterByKeyField,
518
- flag: item.flag || "I",
519
- };
520
- }),
521
- ];
522
- // 排序字段处理逻辑
523
- const sortFieldName = "browno";
524
- const reportcondsGroupBy_Flag = this.$utils.groupBy(
525
- reportconds,
526
- "flag"
527
- );
528
- const reportcondsGroup_I = this.$utils.get(
529
- reportcondsGroupBy_Flag,
530
- "I",
531
- []
532
- );
533
- const reportcondsGroup_U = this.$utils.get(
534
- reportcondsGroupBy_Flag,
535
- "U",
536
- []
537
- );
538
- const reportcondsGroup_D = this.$utils.get(
539
- reportcondsGroupBy_Flag,
540
- "D",
541
- []
542
- );
543
- const fullData = $table.getTableData().fullData;
544
- const maxItem = this.$utils.max(fullData, sortFieldName);
545
- let serialidMaxSub = 1;
546
- if (maxItem) {
547
- serialidMaxSub = this.$utils.add(maxItem[sortFieldName], 1);
548
- }
549
- const insertRecordsForSortNum = reportcondsGroup_I.map((item) => {
550
- const f_item = { ...item };
551
- f_item[sortFieldName] = serialidMaxSub;
552
- serialidMaxSub = this.$utils.add(serialidMaxSub, 1);
553
- return f_item;
554
- });
555
- // 最终返回结果转换拼接返回
556
- const flagDataList = [
557
- ...insertRecordsForSortNum,
558
- ...reportcondsGroup_U,
559
- ...reportcondsGroup_D,
560
- ];
561
- return flagDataList;
562
- },
563
-
564
- /**
565
- * 覆写表格必填项校验
566
- */
567
- async tableCheckValidate() {
568
- const $tableVM = this.$refs.table;
569
- const errMap = await $tableVM.validate(true);
570
- return errMap ? true : false;
571
- },
572
-
573
- /**
574
- * 覆写增行事件
575
- */
576
- async handleAddRow() {
577
- const $tableVM = this.$refs.table;
578
- let rowData = null;
579
- if (this.myConfig.addRowBefore) {
580
- let temp = {};
581
- temp.name = this.myConfig.name;
582
- temp.grid = $tableVM;
583
- rowData = this.myConfig.addRowBefore(temp);
584
- if (rowData === false) {
585
- return;
586
- }
587
- }
588
- if (!rowData || rowData === true) {
589
- rowData = {};
590
- }
591
- const errMap = await $tableVM.validate(true);
592
- if (errMap) {
593
- return false;
594
- }
595
- const { row: newRow } = await $tableVM.insertAt(rowData, -1);
596
- // 后续完善
597
- const tableColumns = $tableVM.getTableColumn();
598
- const visibleColumns = this.$utils.get(
599
- tableColumns,
600
- "visibleColumn",
601
- []
602
- );
603
- const column = this.$utils.find(visibleColumns, (column) => {
604
- return (
605
- column &&
606
- column.editRender &&
607
- column.editRender.enabled !== false
608
- );
609
- });
610
- await $tableVM.setEditRow(newRow, false);
611
- },
612
-
613
- /**
614
- * 覆写选择删行事件
615
- */
616
- delBatchRow() {
617
- const $tableVM = this.$refs.table;
618
- $tableVM.removeCheckboxRow();
619
- },
620
-
621
- /**
622
- * 【覆写】表格数据赋值事件
623
- */
624
- setData(data = [], flag = "set") {
625
- switch (flag) {
626
- case "set":
627
- // console.log("初始化表格数据触发");
628
- this.dataList = [...data];
629
- break;
630
-
631
- case "I":
632
- // console.log("手工全量编辑触发");
633
- const $tableVM = this.$refs.table;
634
- // 移除表格组件
635
- $tableVM.remove().then(() => {
636
- $tableVM.insertAt([...data], -1);
637
- });
638
- break;
639
-
640
- default:
641
- break;
642
- }
643
- },
644
-
645
- /**
646
- * 【覆写】编辑项内容整理透传
647
- */
648
- addRowInfo(obj, column) {
649
- const $tableVM = this.$refs.table;
650
- let editRecord = $tableVM.getEditRecord();
651
- if (!editRecord) {
652
- editRecord = this.VG_currentEditRecord;
653
- }
654
- obj.rowinfo = { ...editRecord, index: editRecord.rowIndex };
655
- },
656
-
657
- /**
658
- * 【覆写】手工更新当前编辑项事件
659
- */
660
- updataRow(editRecord, item) {
661
- const { row, $table } = editRecord;
662
- $table.setRow(row, item);
663
- },
664
- addRow(item) {
665
- const $tableVM = this.$refs.table;
666
- $tableVM.insertAt(item, -1);
667
- },
668
- delRow(editRecord) {
669
- const { row } = editRecord;
670
- const $tableVM = this.$refs.table;
671
- $tableVM.remove(row);
672
- },
673
-
674
- /**
675
- * 【覆写】获取多选数据事件
676
- */
677
- getSelection() {
678
- const selectDataList = this.$refs.table.getCheckboxRecords(true);
679
- return [...selectDataList];
680
- },
681
-
682
- /**
683
- * 【覆写】更改编辑状态事件
684
- */
685
- setReadOnly(value) {
686
- let obj = {};
687
- obj.readOnly = value;
688
- if (this.config.showCheckBox !== false) {
689
- if (obj.readOnly) {
690
- obj.showCheckBox = false;
691
- } else {
692
- obj.showCheckBox = true;
693
- }
694
- }
695
- this.editType = value;
696
- this.setPro(obj);
697
- },
698
-
699
- // ==================================================================
700
-
701
- /**
702
- * 在值发生改变时更新表尾合计
703
- */
704
- updateFooterEvent() {
705
- const $tableVM = this.$refs.table;
706
- $tableVM.updateFooter();
707
- },
708
-
709
- footerCellClassName() {
710
- return "efu-stable-footer-row";
711
- },
712
-
713
- footerMethod(params) {
714
- const { columns, data } = params;
715
- const sumSub = this.editType ? 1 : 2;
716
- return [
717
- columns.map((item, index) => {
718
- if (index === sumSub) {
719
- return "合计";
720
- }
721
- if (this.sumFields.includes(item.field)) {
722
- const sumData = this.handleSumField({
723
- list: data,
724
- field: item.field,
725
- });
726
- const columnConfig = this.getTableColumnConfig(index);
727
- const format = this.$utils.get(
728
- columnConfig,
729
- "format",
730
- null
731
- );
732
- const notzero = this.$utils.get(
733
- columnConfig,
734
- "notzero",
735
- null
736
- );
737
- const formatSumData = this.$Method.formatNumber(
738
- sumData,
739
- format,
740
- notzero
741
- );
742
- return formatSumData;
743
- }
744
- return null;
745
- }),
746
- ];
747
- },
748
-
749
- handleSumField(params) {
750
- const { list, field } = params;
751
- let count = 0;
752
- list.forEach((item) => {
753
- count = this.$utils.add(count, item[field]);
754
- });
755
- return count;
756
- },
757
-
758
- getTableColumnConfig(index) {
759
- let column = this.tableColumns[index];
760
- if (column.type === "NumberBox") {
761
- column.place = "unset";
762
- }
763
- return this.tableColumns[index];
764
- },
765
-
766
- cellInput({ params, row }) {
767
- row[params.name] = params.value;
768
- },
769
-
770
- batchUpdateRows(dataList = []) {
771
- if (this.$utils.isEmpty(dataList)) return false;
772
- const $tableVM = this.$refs.table;
773
- const editRecord = $tableVM.getEditRecord();
774
- if (editRecord) {
775
- $tableVM.remove(editRecord.row);
776
- }
777
- $tableVM.insertAt(dataList, -1);
778
- },
779
-
780
- /**
781
- * 批量更新数据【待完善】
782
- */
783
- batchUpdateDatas(record = {}) {
784
- const $tableVM = this.$refs.table;
785
- const tableData = $tableVM.getTableData().fullData;
786
- tableData.forEach((item) => Object.assign(item, record));
787
- },
788
-
789
- /**
790
- * 清除表格数据数据
791
- */
792
- clearData() {
793
- // 获取表格组件的实例
794
- const $tableVM = this.$refs.table;
795
- // 移除表格组件
796
- $tableVM.remove();
797
- },
798
-
799
- /**
800
- * 表格列 type 类型转义
801
- */
802
- getColumnsItemType(key) {
803
- const columnsItemType = {
804
- selection: "checkbox",
805
- index: "seq",
806
- };
807
- return this.$utils.get(columnsItemType, key, null);
808
- },
809
-
810
- /**
811
- * 表格排序事件
812
- */
813
- RewriteTableOnSortChange(params) {
814
- const { order, field } = params;
815
- const orderType = order ? order : "normal";
816
- this.sortChagne({ order: orderType, key: field });
817
- },
818
-
819
- /**
820
- * 表格双击事件
821
- */
822
- RewriteTableCellDBlclick(params) {
823
- const { row } = params;
824
- this.dbclick(row);
825
- },
826
-
827
- handleZoom() {
828
- const $tableVM = this.$refs.table;
829
- $tableVM.zoom();
830
- },
831
- },
832
- mounted() {
833
- // console.log("我继承覆写了999999");
834
- },
835
- };
836
- </script>
837
-
838
- <style lang="scss" scoped></style>
1
+ <template>
2
+ <Card ref="card" :bordered="false" :padding="0" dis-hover>
3
+ <!-- 如果myConfig.modetype为1,则显示 -->
4
+ <template v-if="myConfig.modetype === '1'">
5
+ <!-- 如果showTitle为true,则显示 -->
6
+ <p v-if="showTitle" @click="toggle" style="cursor: pointer">
7
+ <Row
8
+ type="flex"
9
+ justify="start"
10
+ align="middle"
11
+ style="margin-top: 14px; margin-bottom: 14px"
12
+ >
13
+ <!-- 如果showGrid为true,则显示icon-custom-pack,否则显示icon-custom-spread -->
14
+ <Icon
15
+ custom="iconfont icon-custom-pack"
16
+ color="#f3b352"
17
+ v-show="showGrid"
18
+ size="14"
19
+ />
20
+ <Icon
21
+ v-show="!showGrid"
22
+ color="#f3b352"
23
+ custom="iconfont icon-custom-spread"
24
+ size="14"
25
+ />
26
+ <!-- 显示myConfig.title -->
27
+ <span
28
+ style="
29
+ margin-left: 10px;
30
+ font-size: 14px;
31
+ font-weight: bold;
32
+ "
33
+ v-text="myConfig.title"
34
+ />
35
+ </Row>
36
+ </p>
37
+ <!-- 显示分割线 -->
38
+ <Divider
39
+ style="margin-left: 24px; margin-top: 0px; margin-bottom: 10px"
40
+ />
41
+ </template>
42
+ <!-- 如果myConfig.modetype为2,则显示 -->
43
+ <template v-if="myConfig.modetype === '2'">
44
+ <div v-if="showTitle" style="margin-bottom: 10px">
45
+ <span class="efuture-title-verticalline" /><span
46
+ style="font-size: 14px; font-weight: bold"
47
+ v-text="myConfig.title"
48
+ />
49
+ </div>
50
+ </template>
51
+ <div :style="divStyle">
52
+ <!-- <div v-if="$slots.header">
53
+ <slot name="header"></slot>
54
+ </div> -->
55
+ <!-- <Row
56
+ v-else
57
+ v-show="showGrid"
58
+ type="flex"
59
+ justify="start"
60
+ align="middle"
61
+ :gutter="0"
62
+ style="margin-bottom: 10px"
63
+ >
64
+ <Col v-if="showAddBtn">
65
+ <Button
66
+ :style="btnStyle"
67
+ customIcon="iconfont icon-custom-rowadd3"
68
+ type="text"
69
+ :disabled="myConfig.readOnly"
70
+ @click="handleAddRow"
71
+ >添加</Button
72
+ >
73
+ </Col>
74
+ <Col v-if="showAddBtn && showDelBatchBtn">
75
+ <Divider type="vertical" style="margin: 0 6px 0 6px" />
76
+ </Col>
77
+ <Col v-if="showDelBatchBtn">
78
+ <Button
79
+ :style="btnStyle"
80
+ customIcon="iconfont icon-custom-rowdel3"
81
+ type="text"
82
+ :disabled="myConfig.readOnly"
83
+ @click="delBatchRow"
84
+ >删除</Button
85
+ >
86
+ </Col>
87
+ </Row> -->
88
+ <Row v-show="showGrid" style="width: 100%">
89
+ <!-- 编辑表格 覆写开始 -->
90
+ <vxe-grid
91
+ ref="table"
92
+ keep-source
93
+ border="full"
94
+ style="width: 100%"
95
+ :columns="RewriteColumns"
96
+ :data="dataList"
97
+ :height="tableHeight"
98
+ :max-height="tableMaxHeight + 100"
99
+ :loading="loading"
100
+ :sort-config="{ remote: true, trigger: 'cell' }"
101
+ :valid-config="{
102
+ showMessage: false,
103
+ autoClear: false,
104
+ }"
105
+ :editConfig="editConfig"
106
+ :edit-rules="validRules"
107
+ :show-footer="showFooter"
108
+ :footer-method="footerMethod"
109
+ :footer-cell-class-name="footerCellClassName"
110
+ :toolbar-config="toolbarConfig"
111
+ :keyboard-config="VG_keyboardConfig"
112
+ :mouse-config="VG_mouseConfig"
113
+ @sort-change="RewriteTableOnSortChange"
114
+ @cell-dblclick="RewriteTableCellDBlclick"
115
+ @edit-activated="VG_editActivated"
116
+ @keydown="VG_keydown"
117
+ >
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>
155
+
156
+ <!-- 编辑列插槽 -->
157
+ <template #columnEdit="{ row, rowIndex, columnIndex }">
158
+ <BillInfoPanelEditTableControlbox
159
+ :autofocus="true"
160
+ :config="getTableColumnConfig(columnIndex)"
161
+ :valueData="row"
162
+ :editIndex="rowIndex"
163
+ @inputValue="
164
+ (params) => {
165
+ cellInput({ params, row });
166
+ }
167
+ "
168
+ @doAction="doAction"
169
+ ></BillInfoPanelEditTableControlbox>
170
+ </template>
171
+ </vxe-grid>
172
+ <!-- 编辑表格 覆写结束 -->
173
+ <div
174
+ ref="page"
175
+ v-if="myConfig.showPage"
176
+ style="background: #eee; padding-top: 5px; width: 100%"
177
+ >
178
+ <Card
179
+ :bordered="false"
180
+ :padding="0"
181
+ :dis-hover="true"
182
+ style="border-radius: 0px"
183
+ >
184
+ <Row
185
+ type="flex"
186
+ justify="end"
187
+ style="padding: 5px; padding-right: 10px"
188
+ >
189
+ <Page
190
+ :total="myConfig.pageConfig.total_results"
191
+ :size="myConfig.pageSize"
192
+ :current="myConfig.pageConfig.page_no"
193
+ :page-size="myConfig.pageConfig.page_size"
194
+ :page-size-opts="
195
+ myConfig.pageConfig.pageSizeList
196
+ "
197
+ @on-page-size-change="changePageSize"
198
+ @on-change="changePage"
199
+ :show-total="myConfig.pageShowTotal"
200
+ :show-elevator="myConfig.pageShowElevator"
201
+ :show-sizer="myConfig.pageShowSizer"
202
+ ></Page>
203
+ </Row>
204
+ </Card>
205
+ </div>
206
+ </Row>
207
+ <p
208
+ v-show="showGrid && showEffectValue"
209
+ @click="toggleEffect"
210
+ style="
211
+ cursor: pointer;
212
+ background-color: #fff2de;
213
+ height: 36px;
214
+ line-height: 36px;
215
+ border: 1px solid #f3b352;
216
+ margin-top: 10px;
217
+ "
218
+ >
219
+ <Icon
220
+ custom="iconfont icon-custom-help"
221
+ size="20"
222
+ style="margin-left: 10px"
223
+ color="#D5882E"
224
+ />
225
+ <span style="margin-left: 4px; color: #d5882e">参考数据</span>
226
+ </p>
227
+ <Row
228
+ v-show="showGrid && showEffectValue && showEffectGrid"
229
+ class="efuture-effect-grid"
230
+ style="margin-top: 10px"
231
+ >
232
+ <Table
233
+ ref="effect_table"
234
+ :row-class-name="rowClassName"
235
+ :loading="loading"
236
+ :size="myConfig.tableSize"
237
+ :border="myConfig.showBorder"
238
+ :stripe="myConfig.showStripe"
239
+ :maxHeight="tableMaxHeight"
240
+ :columns="tableColumns"
241
+ :data="curlEffectData"
242
+ @on-column-width-resize="onColumnWidthResize"
243
+ >
244
+ <template
245
+ v-for="config in soltTableColumns"
246
+ v-slot:[config.key]="{ row, index }"
247
+ :key="'show_effect' + config.key"
248
+ >
249
+ <ShowText
250
+ :label="effectFormatValue(index, config, row)"
251
+ :contentAlign="config.contentAlign"
252
+ :class="config.cellClassName"
253
+ :config="config"
254
+ :rowIndex="index"
255
+ ></ShowText>
256
+ </template>
257
+ </Table>
258
+ </Row>
259
+ </div>
260
+ <Modal
261
+ v-if="!editRowFlag"
262
+ v-model="showEditRowForm"
263
+ width="90%"
264
+ title="编辑"
265
+ @on-ok="editRow"
266
+ >
267
+ <div>
268
+ <ExpandRow
269
+ ref="rowForm"
270
+ :config="myConfig"
271
+ :dictData="dictData"
272
+ />
273
+ </div>
274
+ </Modal>
275
+ </Card>
276
+ </template>
277
+ <script>
278
+ import editgridcard from "../editgridcard.vue";
279
+ import BillInfoPanelEditTableControlbox from "./BillInfoPanelEditTableControlbox.vue";
280
+ import useVxeGridEditTypeKeydownEventHook from "./mixins/useVxeGridEditTypeKeydownEventHook.js";
281
+
282
+ export default {
283
+ name: "BillInfoPanelEditTable",
284
+ extends: editgridcard,
285
+ components: { BillInfoPanelEditTableControlbox },
286
+ mixins: [useVxeGridEditTypeKeydownEventHook],
287
+ data() {
288
+ return {
289
+ editType: false,
290
+ editConfig: {
291
+ trigger: "click",
292
+ mode: "cell",
293
+ autoClear: false,
294
+ beforeEditMethod: (params) => {
295
+ const { column, row, rowIndex } = params;
296
+ if (this.editType) {
297
+ return false;
298
+ }
299
+ if (this.myConfig.cellbeginedit) {
300
+ return this.myConfig.cellbeginedit({
301
+ column: { ...column, name: column.property },
302
+ row: row,
303
+ rowIndex: rowIndex,
304
+ transmission: params,
305
+ });
306
+ }
307
+ return true;
308
+ },
309
+ },
310
+ dataList: [],
311
+ };
312
+ },
313
+ computed: {
314
+ /**
315
+ * 表格列定义清洗
316
+ */
317
+ RewriteColumns() {
318
+ // console.log("this.tableColumns", this.tableColumns);
319
+ const newColumns = this.tableColumns.map((item) => {
320
+ const columnsItemType = this.getColumnsItemType(item.key);
321
+ return {
322
+ ...(item.title && {
323
+ title: item.title,
324
+ }),
325
+ ...(item.name && {
326
+ field: item.name,
327
+ }),
328
+ ...(item.width && {
329
+ width: item.width < 60 ? 60 : item.width,
330
+ }),
331
+ ...(item.minWidth && {
332
+ minWidth: item.minWidth < 60 ? 60 : item.minWidth,
333
+ }),
334
+ ...(item.align && {
335
+ align: item.align,
336
+ }),
337
+ ...(item.resizable && {
338
+ resizable: item.resizable,
339
+ }),
340
+ sortable: false,
341
+ ...(columnsItemType && {
342
+ type: columnsItemType,
343
+ sortable: false,
344
+ }),
345
+ formatter: (params) => {
346
+ const { row, cellValue } = params;
347
+ const valueFormat = this.$Method.formatValue(
348
+ cellValue,
349
+ row,
350
+ item
351
+ );
352
+ return valueFormat;
353
+ },
354
+ editRender: {
355
+ enabled: false,
356
+ defaultValue: item.defaultValue || "",
357
+ },
358
+ ...(item.isFilters && {
359
+ filters: [{ data: null }],
360
+ filterRender: {
361
+ name: "FilterInput",
362
+ },
363
+ }),
364
+ ...(!item.readOnly &&
365
+ !columnsItemType && {
366
+ editRender: {
367
+ enabled: true,
368
+ autoselect: this.$utils.get(
369
+ item,
370
+ "autoselect",
371
+ false
372
+ ),
373
+ autofocus: this.$utils.get(
374
+ item,
375
+ "autofocus",
376
+ ""
377
+ ),
378
+ defaultValue: item.defaultValue || "",
379
+ },
380
+ slots: { edit: "columnEdit" },
381
+ }),
382
+ };
383
+ });
384
+ // console.log("newColumns:", newColumns);
385
+ return newColumns;
386
+ },
387
+ /**
388
+ * 表格数据
389
+ */
390
+ validRules() {
391
+ return this.$utils.reduce(
392
+ this.tableColumns,
393
+ (previous, item) => {
394
+ const columnsItemType = this.getColumnsItemType(item.key);
395
+ if (!columnsItemType) {
396
+ if (item.required) {
397
+ previous[item.name] = [
398
+ {
399
+ required: true,
400
+ message: `${item.label}必填`,
401
+ },
402
+ ];
403
+ }
404
+ }
405
+ return previous;
406
+ },
407
+ {}
408
+ );
409
+ },
410
+ /**
411
+ * 是否显示合计
412
+ */
413
+ showFooter() {
414
+ const showType = this.myConfig.showSummary;
415
+ return showType;
416
+ },
417
+ sumFields() {
418
+ return this.tableColumns
419
+ .filter((item) => item.summary)
420
+ .map((item) => item.name);
421
+ },
422
+ toolbarConfig() {
423
+ // console.log("this.myConfig", this.myConfig);
424
+ return {
425
+ zoom: this.myConfig.zoom,
426
+ slots: {
427
+ // 自定义插槽模板
428
+ buttons: "toolbar_buttons",
429
+ },
430
+ };
431
+ },
432
+ },
433
+ methods: {
434
+ // ==================================================================
435
+
436
+ /**
437
+ * 【覆写】编辑项触发回车事件
438
+ */
439
+ enterKeyDown() {
440
+ const $table = this.$refs.table;
441
+ this.VG_keyCode13Event($table);
442
+ },
443
+
444
+ /**
445
+ * 【覆写】手工触发编辑事件
446
+ */
447
+ valueChanged(obj) {
448
+ const column = this.findColumnConfig(obj.name, this.myConfig.items);
449
+ this.addRowInfo(obj, column);
450
+ const valueChangedSucc = column.valueChanged(obj);
451
+ this.updateFooterEvent();
452
+ return valueChangedSucc;
453
+ },
454
+ setDataBefore(obj, that) {
455
+ const column = this.findColumnConfig(
456
+ that.myConfig.name,
457
+ this.myConfig.items
458
+ );
459
+ let temp = {};
460
+ temp.data = obj;
461
+ temp.tabname = this.myConfig.name;
462
+ this.addRowInfo(temp, column);
463
+ const setDataBeforeSucc = column.setDataBefore(temp, that);
464
+ this.updateFooterEvent();
465
+ return setDataBeforeSucc;
466
+ },
467
+
468
+ /**
469
+ * 【覆写】获取全量数据
470
+ */
471
+ getData() {
472
+ const $table = this.$refs.table;
473
+ return $table.getTableData().fullData;
474
+ },
475
+
476
+ /**
477
+ * 【覆写】获取增量变更数据事件
478
+ * 临时方案,待优化封装
479
+ */
480
+ getChangeData() {
481
+ // console.log("我猜测到这里了获取变更数据");
482
+ // this.$utils
483
+ // this.$refs.table
484
+ const $table = this.$refs.table;
485
+ const keyField = "_X_ROW_KEY";
486
+ // 获取编辑分组数据
487
+ const { insertRecords, removeRecords, updateRecords } =
488
+ $table.getRecordset();
489
+ // 数据整理
490
+ const reportconds = [
491
+ ...removeRecords.map((item) => {
492
+ const itemFilterByKeyField = this.$utils.omit(
493
+ item,
494
+ keyField
495
+ );
496
+ return {
497
+ ...itemFilterByKeyField,
498
+ flag: item.flag || "D",
499
+ };
500
+ }),
501
+ ...updateRecords.map((item) => {
502
+ const itemFilterByKeyField = this.$utils.omit(
503
+ item,
504
+ keyField
505
+ );
506
+ return {
507
+ ...itemFilterByKeyField,
508
+ flag: item.flag || "U",
509
+ };
510
+ }),
511
+ ...insertRecords.map((item) => {
512
+ const itemFilterByKeyField = this.$utils.omit(
513
+ item,
514
+ keyField
515
+ );
516
+ return {
517
+ ...itemFilterByKeyField,
518
+ flag: item.flag || "I",
519
+ };
520
+ }),
521
+ ];
522
+ // 排序字段处理逻辑
523
+ const sortFieldName = "browno";
524
+ const reportcondsGroupBy_Flag = this.$utils.groupBy(
525
+ reportconds,
526
+ "flag"
527
+ );
528
+ const reportcondsGroup_I = this.$utils.get(
529
+ reportcondsGroupBy_Flag,
530
+ "I",
531
+ []
532
+ );
533
+ const reportcondsGroup_U = this.$utils.get(
534
+ reportcondsGroupBy_Flag,
535
+ "U",
536
+ []
537
+ );
538
+ const reportcondsGroup_D = this.$utils.get(
539
+ reportcondsGroupBy_Flag,
540
+ "D",
541
+ []
542
+ );
543
+ const fullData = $table.getTableData().fullData;
544
+ const maxItem = this.$utils.max(fullData, sortFieldName);
545
+ let serialidMaxSub = 1;
546
+ if (maxItem) {
547
+ serialidMaxSub = this.$utils.add(maxItem[sortFieldName], 1);
548
+ }
549
+ const insertRecordsForSortNum = reportcondsGroup_I.map((item) => {
550
+ const f_item = { ...item };
551
+ f_item[sortFieldName] = serialidMaxSub;
552
+ serialidMaxSub = this.$utils.add(serialidMaxSub, 1);
553
+ return f_item;
554
+ });
555
+ // 最终返回结果转换拼接返回
556
+ const flagDataList = [
557
+ ...insertRecordsForSortNum,
558
+ ...reportcondsGroup_U,
559
+ ...reportcondsGroup_D,
560
+ ];
561
+ return flagDataList;
562
+ },
563
+
564
+ /**
565
+ * 覆写表格必填项校验
566
+ */
567
+ async tableCheckValidate() {
568
+ const $tableVM = this.$refs.table;
569
+ const errMap = await $tableVM.validate(true);
570
+ return errMap ? true : false;
571
+ },
572
+
573
+ /**
574
+ * 覆写增行事件
575
+ */
576
+ async handleAddRow() {
577
+ const $tableVM = this.$refs.table;
578
+ let rowData = null;
579
+ if (this.myConfig.addRowBefore) {
580
+ let temp = {};
581
+ temp.name = this.myConfig.name;
582
+ temp.grid = $tableVM;
583
+ rowData = this.myConfig.addRowBefore(temp);
584
+ if (rowData === false) {
585
+ return;
586
+ }
587
+ }
588
+ if (!rowData || rowData === true) {
589
+ rowData = {};
590
+ }
591
+ const errMap = await $tableVM.validate(true);
592
+ if (errMap) {
593
+ return false;
594
+ }
595
+ const { row: newRow } = await $tableVM.insertAt(rowData, -1);
596
+ // 后续完善
597
+ const tableColumns = $tableVM.getTableColumn();
598
+ const visibleColumns = this.$utils.get(
599
+ tableColumns,
600
+ "visibleColumn",
601
+ []
602
+ );
603
+ const column = this.$utils.find(visibleColumns, (column) => {
604
+ return (
605
+ column &&
606
+ column.editRender &&
607
+ column.editRender.enabled !== false
608
+ );
609
+ });
610
+ await $tableVM.setEditRow(newRow, false);
611
+ },
612
+
613
+ /**
614
+ * 覆写选择删行事件
615
+ */
616
+ delBatchRow() {
617
+ const $tableVM = this.$refs.table;
618
+ $tableVM.removeCheckboxRow();
619
+ },
620
+
621
+ /**
622
+ * 【覆写】表格数据赋值事件
623
+ */
624
+ setData(data = [], flag = "set") {
625
+ switch (flag) {
626
+ case "set":
627
+ // console.log("初始化表格数据触发");
628
+ this.dataList = [...data];
629
+ break;
630
+
631
+ case "I":
632
+ // console.log("手工全量编辑触发");
633
+ const $tableVM = this.$refs.table;
634
+ // 移除表格组件
635
+ $tableVM.remove().then(() => {
636
+ $tableVM.insertAt([...data], -1);
637
+ });
638
+ break;
639
+
640
+ default:
641
+ break;
642
+ }
643
+ },
644
+
645
+ /**
646
+ * 【覆写】编辑项内容整理透传
647
+ */
648
+ addRowInfo(obj, column) {
649
+ const $tableVM = this.$refs.table;
650
+ let editRecord = $tableVM.getEditRecord();
651
+ if (!editRecord) {
652
+ editRecord = this.VG_currentEditRecord;
653
+ }
654
+ obj.rowinfo = { ...editRecord, index: editRecord.rowIndex };
655
+ },
656
+
657
+ /**
658
+ * 【覆写】手工更新当前编辑项事件
659
+ */
660
+ updataRow(editRecord, item) {
661
+ const { row, $table } = editRecord;
662
+ $table.setRow(row, item);
663
+ },
664
+ addRow(item) {
665
+ const $tableVM = this.$refs.table;
666
+ $tableVM.insertAt(item, -1);
667
+ },
668
+ delRow(editRecord) {
669
+ const { row } = editRecord;
670
+ const $tableVM = this.$refs.table;
671
+ $tableVM.remove(row);
672
+ },
673
+
674
+ /**
675
+ * 【覆写】获取多选数据事件
676
+ */
677
+ getSelection() {
678
+ const selectDataList = this.$refs.table.getCheckboxRecords(true);
679
+ return [...selectDataList];
680
+ },
681
+
682
+ /**
683
+ * 【覆写】更改编辑状态事件
684
+ */
685
+ setReadOnly(value) {
686
+ let obj = {};
687
+ obj.readOnly = value;
688
+ if (this.config.showCheckBox !== false) {
689
+ if (obj.readOnly) {
690
+ obj.showCheckBox = false;
691
+ } else {
692
+ obj.showCheckBox = true;
693
+ }
694
+ }
695
+ this.editType = value;
696
+ this.setPro(obj);
697
+ },
698
+
699
+ // ==================================================================
700
+
701
+ /**
702
+ * 在值发生改变时更新表尾合计
703
+ */
704
+ updateFooterEvent() {
705
+ const $tableVM = this.$refs.table;
706
+ $tableVM.updateFooter();
707
+ },
708
+
709
+ footerCellClassName() {
710
+ return "efu-stable-footer-row";
711
+ },
712
+
713
+ footerMethod(params) {
714
+ const { columns, data } = params;
715
+ const sumSub = this.editType ? 1 : 2;
716
+ return [
717
+ columns.map((item, index) => {
718
+ if (index === sumSub) {
719
+ return "合计";
720
+ }
721
+ if (this.sumFields.includes(item.field)) {
722
+ const sumData = this.handleSumField({
723
+ list: data,
724
+ field: item.field,
725
+ });
726
+ const columnConfig = this.getTableColumnConfig(index);
727
+ const format = this.$utils.get(
728
+ columnConfig,
729
+ "format",
730
+ null
731
+ );
732
+ const notzero = this.$utils.get(
733
+ columnConfig,
734
+ "notzero",
735
+ null
736
+ );
737
+ const formatSumData = this.$Method.formatNumber(
738
+ sumData,
739
+ format,
740
+ notzero
741
+ );
742
+ return formatSumData;
743
+ }
744
+ return null;
745
+ }),
746
+ ];
747
+ },
748
+
749
+ handleSumField(params) {
750
+ const { list, field } = params;
751
+ let count = 0;
752
+ list.forEach((item) => {
753
+ count = this.$utils.add(count, item[field]);
754
+ });
755
+ return count;
756
+ },
757
+
758
+ getTableColumnConfig(index) {
759
+ let column = this.tableColumns[index];
760
+ if (column.type === "NumberBox") {
761
+ column.place = "unset";
762
+ }
763
+ return this.tableColumns[index];
764
+ },
765
+
766
+ cellInput({ params, row }) {
767
+ row[params.name] = params.value;
768
+ },
769
+
770
+ batchUpdateRows(dataList = []) {
771
+ if (this.$utils.isEmpty(dataList)) return false;
772
+ const $tableVM = this.$refs.table;
773
+ const editRecord = $tableVM.getEditRecord();
774
+ if (editRecord) {
775
+ $tableVM.remove(editRecord.row);
776
+ }
777
+ $tableVM.insertAt(dataList, -1);
778
+ },
779
+
780
+ /**
781
+ * 批量更新数据【待完善】
782
+ */
783
+ batchUpdateDatas(record = {}) {
784
+ const $tableVM = this.$refs.table;
785
+ const tableData = $tableVM.getTableData().fullData;
786
+ tableData.forEach((item) => Object.assign(item, record));
787
+ },
788
+
789
+ /**
790
+ * 清除表格数据数据
791
+ */
792
+ clearData() {
793
+ // 获取表格组件的实例
794
+ const $tableVM = this.$refs.table;
795
+ // 移除表格组件
796
+ $tableVM.remove();
797
+ },
798
+
799
+ /**
800
+ * 表格列 type 类型转义
801
+ */
802
+ getColumnsItemType(key) {
803
+ const columnsItemType = {
804
+ selection: "checkbox",
805
+ index: "seq",
806
+ };
807
+ return this.$utils.get(columnsItemType, key, null);
808
+ },
809
+
810
+ /**
811
+ * 表格排序事件
812
+ */
813
+ RewriteTableOnSortChange(params) {
814
+ const { order, field } = params;
815
+ const orderType = order ? order : "normal";
816
+ this.sortChagne({ order: orderType, key: field });
817
+ },
818
+
819
+ /**
820
+ * 表格双击事件
821
+ */
822
+ RewriteTableCellDBlclick(params) {
823
+ const { row } = params;
824
+ this.dbclick(row);
825
+ },
826
+
827
+ handleZoom() {
828
+ const $tableVM = this.$refs.table;
829
+ $tableVM.zoom();
830
+ },
831
+ },
832
+ mounted() {
833
+ // console.log("我继承覆写了999999");
834
+ },
835
+ };
836
+ </script>
837
+
838
+ <style lang="scss" scoped></style>