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,1063 +1,1063 @@
1
- <script>
2
- import { deepCopy } from '../../utils/assist';
3
- import size from '@/components/base/size';
4
- import { resolveComponent } from 'vue';
5
- export default {
6
- mixins: [size],
7
- data () {
8
- return {
9
- globalConfig:{
10
- cellbeginedit:'',
11
- showHeader: true,
12
- showIndex: true,
13
- showStripe:false,
14
- showBorder: true,
15
- showCheckBox: false,
16
- showCondition:false,
17
- checkByHighlight:true,
18
- readOnly: false,
19
- showPage: true,
20
- tableSize:'default',
21
- pageSize:null,
22
- pageShowElevator:true,
23
- pageShowTotal:true,
24
- pageShowSizer:true,
25
- height: null,
26
- manualLoad: true,
27
- multiSelect: false,
28
- operFixedFlag:true,
29
- gridType:'viewGrid',
30
- dynamicHeight:false,
31
- generalOrientation:false,
32
- showSummary:false,
33
- showSumGroup:false,
34
- sumText:'合计',
35
- pageSizeNum:'',
36
- adjustHeight:0,
37
- items:[],
38
- pageConfig: {
39
- page_no: 1,
40
- page_size: 100,
41
- total_results: 0,
42
- pageSizeList: [20, 50, 100, 200, 500, 1000]
43
- },
44
- moduleMethod:[],
45
- headClassName:''
46
- },
47
- tempData:[],
48
- data:[],
49
- addData:[],
50
- delData:[],
51
- columns:[],
52
- checkInfo:[],
53
- checkAddInfo:[],
54
- expand:{},
55
- dictkey:'',
56
- currentDictData:{},
57
- editRowIndex:'',
58
- editRowFlag:true,
59
- loading:false,
60
- conditionSearchParam:{},
61
- showRowAction:false,
62
- modulecode:'',
63
- myToolConfig:{},
64
- showMoreBtn:false ,
65
- initData:[],
66
- showDelRow:false,
67
- showCondition:true,
68
- delRowAction:[{
69
- iconcls: 'row',
70
- name: 'delRow',
71
- text: '删除',
72
- type:'text'
73
- }],
74
- operFixedFlag:true,
75
- editIndex: -1,
76
- editKey:'',
77
- newRow:{},
78
- summaryColumn:[],
79
- total_summary:{},
80
- extraHeight:0,
81
- outsideHeight:0,
82
- tableColumns:[],
83
- soltTableColumns:[],
84
- sumGroupNum:0,
85
- culPage:1
86
- };
87
- },
88
- props: {
89
- config: {
90
- type: Object,
91
- default: () => {
92
- return {};
93
- }
94
- },
95
- dictData: {
96
- type: Object,
97
- default:null
98
- },
99
- toolConfig: {
100
- type: Object,
101
- default: () => {
102
- return {};
103
- }
104
- },
105
- isPop:{
106
- type: Boolean,
107
- default: false
108
- }
109
- },
110
- created () {
111
- this.init();
112
- this.modulecode = this.$Method.getUrlParam('modulecode');
113
- if (!this.modulecode) {
114
- this.modulecode = this.$Method.getUrlParam('billmoduleid');
115
- }
116
- },
117
- computed:{
118
- makeTableColumns() {
119
- return this.initColumn();
120
- },
121
- tableHeight() {
122
- if (!this.myConfig.dynamicHeight) {
123
- let currentHeight = this.currentHeight;
124
- if (this.extraHeight) {
125
- currentHeight = currentHeight - Number(this.extraHeight);
126
- }
127
- if (this.outsideHeight) {
128
- currentHeight = currentHeight - Number(this.outsideHeight);
129
- }
130
- if (this.myConfig.showSummary) {
131
- currentHeight = currentHeight - 50;
132
- }
133
- return currentHeight;
134
- } else {
135
- return null;
136
- }
137
- },
138
- tableMaxHeight() {
139
- if (this.myConfig.dynamicHeight) {
140
- let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
141
- if (this.myConfig.showSummary) {
142
- currentHeight = currentHeight - 50;
143
- }
144
- return currentHeight;
145
- } else {
146
- return null;
147
- }
148
- }
149
-
150
- },
151
- methods: {
152
- init() {
153
- this.myConfig = Object.assign({},this.globalConfig,this.myConfig);
154
-
155
- if (this.config) {
156
- let config = this.$Method.copy(this.config);
157
- for (let temp in config) {
158
- if (temp === 'pageConfig') {
159
- for (let temp2 in config[temp]) {
160
- this.myConfig.pageConfig[temp2] = config[temp][temp2];
161
- }
162
- } else {
163
- this.myConfig[temp] = config[temp];
164
- }
165
- }
166
- }
167
- if (this.dictData) {
168
- this.currentDictData = this.dictData;
169
- } else {
170
- this.currentDictData = [];
171
- }
172
- if (this.myConfig.showDelRow !== undefined) {
173
- this.showDelRow = this.myConfig.showDelRow;
174
- }
175
-
176
- if (this.myConfig.showCondition !== undefined) {
177
- this.showCondition = this.myConfig.showCondition;
178
- }
179
- this.myToolConfig = this.$Method.copy(this.toolConfig);
180
-
181
- // 非弹框模式
182
- if (!this.isPop) {
183
- // 判断是否显示更多 按钮
184
- let num = 0;
185
- if (this.myToolConfig.items) {
186
- this.myToolConfig.items.forEach(el => {
187
- if (el.iconcls === 'row') {
188
- num++;
189
- }
190
- });
191
- }
192
- if (num > 2) {
193
- this.showMoreBtn = true;
194
- } else {
195
- this.showMoreBtn = false;
196
- }
197
- // 是否开启行编辑栏
198
- if (num > 0) {
199
- this.showRowAction = true;
200
- } else {
201
- this.showRowAction = false;
202
- }
203
- // 开启行编辑栏时checkbox显示
204
- if (this.showRowAction) {
205
- if (!this.myConfig.showCheckBox) {
206
- if (this.myConfig.multiSelect) {
207
- this.myConfig.showCheckBox = true;
208
- }
209
- }
210
- }
211
- }
212
-
213
- this.operFixedFlag = this.myConfig.operFixedFlag;
214
- if (this.myConfig.items && this.myConfig.items.length > 0) {
215
- this.myConfig.items.some(el => {
216
- if (el.resizable === true) {
217
- this.myConfig.showBorder = true;
218
- return true;
219
- }
220
- });
221
- }
222
- this.setSizeConfig(this.myConfig);
223
- if (this.customInit) {
224
- this.customInit();
225
- }
226
- },
227
- initCheckColumn(columns) {
228
- if (this.myConfig.showCheckBox) {
229
- let check = {};
230
- check.type = 'selection';
231
- check.align = 'center';
232
- check.key ='selection';
233
- check.width = 40;
234
- check.multiSelect = this.myConfig.multiSelect;
235
- columns.push(check);
236
- }
237
- },
238
- isToolBar(obj) {
239
- let flag = false;
240
- if (this.myToolConfig && this.myToolConfig.items) {
241
- this.myToolConfig.items.some(el => {
242
- if (el.iconcls === obj) {
243
- flag = true;
244
- return true;
245
- }
246
- });
247
- }
248
- return flag;
249
- } ,
250
- initIndexColumn(columns) {
251
- if (this.myConfig.showIndex) {
252
- if (this.myConfig.showSumGroup) {
253
- let indexConfig = {
254
- label: '行号',
255
- name: 'sumindex',
256
- type: 'TextBox',
257
- align: 'center',
258
- width: 45
259
- };
260
- if (this.myConfig.items[0].name !== 'sumindex') {
261
- this.myConfig.items.splice(0, 0, indexConfig);
262
- }
263
- } else {
264
- let index = {};
265
- index.type = 'index';
266
- index.key = 'index';
267
- index.width = 45;
268
- index.title = '行号';
269
- index.align = 'center';
270
- if (this.myConfig.headClassName !== undefined) {
271
- index.className = this.myConfig.headClassName;
272
- }
273
- index.indexMethod = this.indexRender;
274
- if (this.myConfig.indexConfig !== undefined) {
275
- Object.assign(index, this.myConfig.indexConfig);
276
- }
277
- columns.push(index);
278
- }
279
- }
280
- },
281
- initOperColumn(columns) {
282
- if (this.showRowAction || this.showDelRow) {
283
- let action ={};
284
- action.title = '操作';
285
- if (this.myConfig.headClassName !== undefined) {
286
- action.className = this.myConfig.headClassName;
287
- }
288
- action.key = 'action';
289
- action.render = this.actionRender;
290
- if (this.operFixedFlag) {
291
- action.fixed ='right';
292
- }
293
- action.width = 120;
294
- if (this.myToolConfig.items.length === 1) {
295
- action.width = 80;
296
- }
297
- action.align = 'center';
298
- if (this.customInitOperColumn) {
299
- this.customInitOperColumn(action, columns);
300
- } else {
301
- columns.push(action);
302
- }
303
- }
304
- },
305
- onColumnWidthResize(newWidth, oldWidth, column) {
306
- let temp = {};
307
- temp.newWidth = newWidth;
308
- temp.oldWidth = oldWidth;
309
- temp.column = column;
310
- this.$emit('onColumnWidthResize',temp);
311
- },
312
- initExpandColumn(items) {
313
- this.expand.items=[];
314
- let columns =[];
315
- for (let i = 0; i < items.length; i++) {
316
- if (items[i].isExpand === true) {
317
- this.expand.items.push(items[i]);
318
- } else {
319
- columns.push(items[i]);
320
- }
321
- }
322
- if (this.expand.items.length > 0) {
323
- let expand = {
324
- type: 'expand',
325
- width: 50,
326
- render:this.expandRendel
327
- };
328
- const index = columns.findIndex(item => item.type === 'index');
329
- if (index > -1 ) {
330
- columns.splice(index+1, 0, expand);
331
- } else {
332
- const checkindex = columns.findIndex(item => item.type === 'selection');
333
- if (checkindex > -1) {
334
- columns.splice(checkindex+1, 0, expand);
335
- } else {
336
- columns.splice(0, 0, expand);
337
- }
338
- }
339
- items = columns;
340
- }
341
-
342
- },
343
- initColumn() {
344
- let newRow = {};
345
- let summaryColumn = [];
346
- let columns = [];
347
- if (!this.myConfig.items || this.myConfig.items.length === 0) {
348
- return columns;
349
- }
350
- this.initCheckColumn(columns);
351
- this.initOperColumn(columns);
352
- this.initIndexColumn(columns);
353
- const length = this.myConfig.items.length;
354
- for (let i = 0; i < length; i++) {
355
- if (this.myConfig.items[i].visible !== false) {
356
- //this.setColumn(i);
357
- // 添加复杂列项的支持
358
- this.initCommonColumn(this.myConfig.items[i],columns,summaryColumn,newRow);
359
- } else {
360
- if (this.myConfig.items[i].defaultValue !== undefined) {
361
- if (this.myConfig.items[i].name) {
362
- newRow[this.myConfig.items[i].name] = this.myConfig.items[i].defaultValue;
363
- }
364
- if (this.myConfig.items[i].sname) {
365
- newRow[this.myConfig.items[i].sname] = this.myConfig.items[i].defaultValue;
366
- }
367
- if (this.myConfig.items[i].ename) {
368
- newRow[this.myConfig.items[i].ename] = this.myConfig.items[i].defaultValue;
369
- }
370
- }
371
- }
372
- }
373
- this.initExpandColumn(columns);
374
- let obj = {};
375
- obj.columns = columns;
376
- obj.newRow = newRow;
377
- obj.summaryColumn = summaryColumn;
378
- return obj;
379
- },
380
- initCommonColumn (obj,list,summaryColumn,newRow) {
381
- let column = this.$Method.copy(obj);
382
- if (!column.contentAlign) {
383
- column.contentAlign = column.align;
384
- }
385
- column.title = column.label;
386
- if (!column.headClassName) {
387
- if (this.myConfig.headClassName !== undefined) {
388
- column.className = this.myConfig.headClassName;
389
- }
390
- } else {
391
- column.className = column.headClassName;
392
- }
393
-
394
- if (obj.children && obj.children.length > 0) {
395
- column.children = [];
396
- for (let i=0;i<obj.children.length; i++) {
397
- this.initCommonColumn(obj.children[i],column.children,summaryColumn,newRow);
398
- }
399
- list.push(column);
400
- } else {
401
- column = this.initColumnConfig(column,summaryColumn,newRow);
402
- list.push(column);
403
- }
404
- },
405
- initColumnConfig(column,summaryColumn,newRow) {
406
- let type = '';
407
- if (column.type) {
408
- type = column.type.toLowerCase();
409
- }
410
- column.key = column.name;
411
- if (Number(column.width)) {
412
- column.width = Number(column.width);
413
- } else {
414
- delete column.width;
415
- }
416
-
417
- this.setColumnPro(column,type,summaryColumn,newRow);
418
-
419
- if (type !== 'render') {
420
- if (column.render === undefined) {
421
- if (this.setCustomColumn) {
422
- this.setCustomColumn(column);
423
- }
424
- }
425
- }
426
-
427
- // 处理check
428
- if (type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
429
- column.render = this.commonRendel;
430
- if (type === 'picturebox') {
431
- if (column.height === undefined) {
432
- column.height = 40;
433
- }
434
- column.isGrid = true;
435
- }
436
- if (type === 'videobox') {
437
- if (column.height === undefined) {
438
- column.height = 60;
439
- }
440
- }
441
- if (this.myConfig.readOnly) {
442
- column.readOnly = true;
443
- } else {
444
- if (column.readOnly !== true) {
445
- column.readOnly = false;
446
- }
447
- }
448
-
449
- }
450
- if (column.required) {
451
- if (!column.className) {
452
- column.className = 'efuture-grid-head-required';
453
- }
454
- }
455
-
456
- // 事件绑定
457
- if (column.valueChanged) {
458
- column.valueChanged = this.valueChanged;
459
- }
460
- if (column.searchBefore) {
461
- column.searchBefore = this.searchBefore;
462
- }
463
- if (column.setDataBefore) {
464
- column.setDataBefore = this.setDataBefore;
465
- }
466
- if (column.onLinkTo) {
467
- column.onLinkTo = this.onLinkTo;
468
- }
469
- if (type === 'timepicbox' || type === 'datebox' || type === 'daterangebox' || type === 'colorbox' || type === 'combobox') {
470
- column.transfer = true;
471
- }
472
- return column;
473
- },
474
- setColumn(i) {
475
- let column = this.$Method.copy(this.myConfig.items[i]);
476
-
477
- column.title = column.label;
478
- let type = '';
479
- if (column.type) {
480
- type = column.type.toLowerCase();
481
- }
482
- if (!type) {
483
- return;
484
- }
485
-
486
- column.key = column.name;
487
- if (Number(column.width)) {
488
- column.width = Number(column.width);
489
- } else {
490
- delete column.width;
491
- }
492
-
493
- this.setColumnPro(column,type);
494
-
495
- if (type !== 'render') {
496
- if (column.render === undefined) {
497
- if (this.setCustomColumn) {
498
- this.setCustomColumn(column);
499
- }
500
- }
501
- }
502
-
503
- // 处理check
504
- if (type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
505
- column.render = this.commonRendel;
506
- if (type === 'picturebox') {
507
- if (column.height === undefined) {
508
- column.height = 40;
509
- }
510
- }
511
- if (type === 'videobox') {
512
- if (column.height === undefined) {
513
- column.height = 60;
514
- }
515
- }
516
- if (this.myConfig.readOnly) {
517
- column.readOnly = true;
518
- } else {
519
- column.readOnly = false;
520
- }
521
-
522
- }
523
- if (column.required) {
524
- if (!column.className) {
525
- column.className = 'efuture-grid-head-required';
526
- }
527
- }
528
-
529
- if (!column.contentAlign) {
530
- if (!column.align) {
531
- column.contentAlign = column.align;
532
- }
533
-
534
- }
535
- // 事件绑定
536
- if (this.myConfig.items[i].valueChanged) {
537
- column.valueChanged = this.valueChanged;
538
- }
539
- if (this.myConfig.items[i].searchBefore) {
540
- column.searchBefore = this.searchBefore;
541
- }
542
-
543
- if (this.myConfig.items[i].setDataBefore) {
544
- column.setDataBefore = this.setDataBefore;
545
- }
546
- if (this.myConfig.items[i].onLinkTo) {
547
- column.onLinkTo = this.onLinkTo;
548
- }
549
- if (column.formatValue === undefined) {
550
- if (this.myConfig.formatValue !== undefined) {
551
- column.formatValue = this.myConfig.formatValue;
552
- }
553
- }
554
- this.columns.push(column);
555
- },
556
- setColumnPro(column, type, summaryColumn, newRow) {
557
- column.place = 'grid';
558
- if (column.sortable === true) {
559
- column.sortable = 'custom';
560
- } else if (column.sortable === 'default') {
561
- column.sortable = true;
562
- }
563
- if (type === 'numberbox') {
564
- if (!column.contentAlign) {
565
- column.contentAlign = 'right';
566
- }
567
- if (!column.align) {
568
- column.align = 'right';
569
- }
570
- if (column.summary && summaryColumn !== undefined) {
571
- summaryColumn.push(column.name);
572
- }
573
- } else if (type === 'datebox' || type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
574
- if (this.myConfig.generalOrientation && type === 'datebox') {
575
- if (!column.contentAlign) {
576
- column.contentAlign = 'left';
577
- }
578
- if (!column.align) {
579
- column.align = 'left';
580
- }
581
- } else {
582
- if (!column.contentAlign) {
583
- column.contentAlign = 'center';
584
- }
585
- if (!column.align) {
586
- column.align = 'center';
587
- }
588
- }
589
-
590
- } else {
591
- if (!column.contentAlign) {
592
- column.contentAlign = 'left';
593
- }
594
- if (!column.align) {
595
- column.align = 'left';
596
- }
597
- }
598
- if (type === 'combobox') {
599
- if (column.data === undefined) {
600
- let dictkey = column.dictkey;
601
- if (column.customDictkey) {
602
- dictkey = column.customDictkey;
603
- }
604
- column.data = this.currentDictData[dictkey];
605
- }
606
- }
607
-
608
- // 处理默认值
609
- if (column.defaultValue !== undefined) {
610
- newRow[column.name] = column.defaultValue;
611
- } else {
612
- if (type === 'numberbox' || type === 'numberrangebox') {
613
- let min = '';
614
- if (column.min !== undefined) {
615
- min = column.min;
616
- }
617
- if (column.smin !== undefined) {
618
- min = column.smin;
619
- }
620
- if (column.smin === undefined && column.emin !== undefined) {
621
- min = column.emin;
622
- }
623
- column.defaultValue = min;
624
- if (newRow !== undefined) {
625
- newRow[column.name] = min;
626
- if(column.boundaryValue === false) {
627
- newRow[column.name] = '';
628
- column.defaultValue = '';
629
- }
630
- }
631
-
632
- } else {
633
- if (newRow !== undefined) {
634
- if (column.type === 'poptagbox') {
635
- newRow[column.name] = [];
636
- } else {
637
- newRow[column.name] = '';
638
- }
639
- }
640
- }
641
- }
642
- },
643
- expandRendel(h, params) {
644
- return h('div', [
645
- h(resolveComponent('ExpandRow'), {
646
- config: this.expand,
647
- valueData:params.row,
648
- vstyle:'margin-right: 120px',
649
- showRowAction:false,
650
- onInputValue:(val) => {
651
- this.editIndex = params.index;
652
- this.input(val);
653
- //this.editValueChanged(params,val);
654
- }
655
- })
656
- ]);
657
- },
658
- indexRender (row,_index) {
659
- let index = _index + 1;
660
- if (this.myConfig.showPage) {
661
- index = index + (this.myConfig.pageConfig.page_no - 1) * this.myConfig.pageConfig.page_size;
662
- }
663
- if (this.myConfig.indexMethod) {
664
- return this.myConfig.indexMethod(row, index);
665
- } else {
666
- return index;
667
- }
668
- },
669
- actionRender (h, params) {
670
- return h('div', [
671
- h(resolveComponent('Toolbar'), {
672
- config:this.myToolConfig,
673
- tooltype:'row',
674
- moduleMethod:this.globalConfig.moduleMethod,
675
- row:params.row,
676
- onDoAction:(val) => {
677
- val.rowinfo = params;
678
- if (val.name === 'editRowForm') {
679
- if (this.initRowForm) {
680
- this.initRowForm(val);
681
- }
682
- } else if (val.name === 'delRow') {
683
- if (this.delRow) {
684
- this.delRow(params.index);
685
- }
686
- } else {
687
- this.$emit('doAction',val);
688
- }
689
- }
690
- })
691
- ]);
692
- },
693
- remove (index) {
694
- let _index = this.data.findIndex(item => item._customIndex === index);
695
- if (_index === -1) {
696
- _index = index;
697
- }
698
- if (_index > -1) {
699
- if (this.data[_index].flag === undefined || this.data[_index].flag === 'U') {
700
- this.data[_index].flag = 'D';
701
- const row = this.$Method.copy(this.data[_index]);
702
- this.delData.push(row);
703
- }
704
- this.data.splice(_index, 1);
705
- }
706
- if (this.customRemove) {
707
- this.customRemove(_index);
708
- }
709
- },
710
- setEdit(index) {
711
- if (this.editRowIndex === index) {
712
- this.editRowIndex = null;
713
- } else {
714
- this.editRowIndex = index;
715
- }
716
- },
717
- dbclick (e) {
718
- this.$emit('dbclick', e);
719
- },
720
- click (e) {
721
- this.$emit('rowclick', e);
722
- this.$emit('click', e);
723
- },
724
- setData(data) {
725
- this.data = [];
726
- this.data = data;
727
- this.initData = this.$Method.copy(this.data);
728
- this.delData = [];
729
- this.checkInfo = [];
730
- if (this.cancelCellEditing) {
731
- this.cancelCellEditing();
732
- }
733
- },
734
- getData() {
735
- return this.$Method.copy(this.data);
736
- },
737
- clearData() {
738
- this.editIndex = -1;
739
- this.editKey = '';
740
- this.data = [];
741
- this.delData = [];
742
- this.initData = [];
743
- this.checkInfo = [];
744
- this.addData = [];
745
- this.checkAddInfo = [];
746
- this.conditionSearchParam = {};
747
- this.myConfig.pageConfig.page_no = 1;
748
- this.myConfig.pageConfig.total_results = 0;
749
- this.columnWidth = {};
750
- if (this.customClearData) {
751
- this.customClearData();
752
- }
753
- },
754
- updataRow(index, para) {
755
- let row = Object.assign({}, this.data[index], para);
756
- this.data.splice(index,1,row);
757
- this.tempData.splice(index,1,row);
758
- },
759
- getModuleMethod() {
760
- this.modulecode = this.$Method.getUrlParam('modulecode');
761
- if (!this.modulecode) {
762
- this.modulecode = this.$Method.getUrlParam('billmoduleid');
763
- }
764
- this.token = this.$Method.getUrlParam('token');
765
- if (this.modulecode && this.token) {
766
- let btnList = this.getUserModuleMethod();
767
- if (btnList) {
768
- this.globalConfig.moduleMethod = btnList.modulemethod;
769
- }
770
- }
771
- },
772
- getSelection() {
773
- return this.$refs.table.getSelection();
774
- },
775
- input(obj) {
776
- let index = this.editIndex;
777
- if (index === -1) {
778
- if (obj.editIndex !== undefined) {
779
- index = obj.editIndex;
780
- } else {
781
- return;
782
- }
783
- }
784
- let tempRow = {};
785
- if (obj.value !== undefined) {
786
- tempRow[obj.name] = obj.value;
787
- }
788
- if (obj.text !== undefined) {
789
- tempRow[obj.textName] = obj.text;
790
- }
791
- if (obj.svalue !== undefined) {
792
- tempRow[obj.sname] = obj.svalue;
793
- }
794
- if (obj.evalue !== undefined) {
795
- tempRow[obj.ename] = obj.evalue;
796
- }
797
-
798
- if (this.data[index].flag === undefined) {
799
- tempRow.flag = 'U';
800
- }
801
-
802
- if (obj.customRows && obj.customRows.length > 0){
803
- let self = this;
804
- // 处理更新行
805
- obj.customRows.forEach(el => {
806
- if (el.changeIndex !== undefined) {
807
- let newRow = Object.assign({},self.data[el.changeIndex],el);
808
- if (self.data[el.changeIndex].flag === undefined) {
809
- newRow.flag = 'U';
810
- }
811
- self.data.splice(el.changeIndex,1,newRow);
812
- }
813
- });
814
- // 处理新增行
815
- obj.customRows.forEach(el => {
816
- if (el.changeIndex === undefined) {
817
- let newRow = Object.assign({},{},el);
818
- newRow.flag = 'I';
819
- self.data.push(newRow);
820
- }
821
- });
822
- } else {
823
- let newRow = Object.assign({},this.data[index],tempRow);
824
- this.$nextTick(() => {
825
- this.data.splice(index,1,newRow);
826
- });
827
-
828
- }
829
-
830
- },
831
- updateColPro(name, pro) {
832
- const index = this.myConfig.items.findIndex(item => name === item.name);
833
- if (index > -1) {
834
- let item = Object.assign({},this.myConfig.items[index],pro);
835
- this.myConfig.items.splice(index,1,item);
836
- }
837
- },
838
- setRowCheck(index , flag) {
839
- // 单选
840
- if (!this.myConfig.multiSelect) {
841
- let data = this.$Method.copy(this.data);
842
- data.forEach((el,_index) =>{
843
- if (_index === index) {
844
- if (this.myConfig.onSetRowCheckBefore) {
845
- if (this.myConfig.onSetRowCheckBefore(index,flag)) {
846
- el._checked = flag;
847
- if (this.myConfig.checkByHighlight) {
848
- el._highlight = flag;
849
- }
850
- }
851
- } else {
852
- el._checked = flag;
853
- if (this.myConfig.checkByHighlight) {
854
- el._highlight = flag;
855
- }
856
- }
857
- } else {
858
- el._checked = false;
859
- el._highlight = false;
860
- }
861
- });
862
- this.$nextTick(() => {
863
- this.data = data;
864
- });
865
- // 多选
866
- } else {
867
- if (index > -1) {
868
- let newRow = Object.assign({},this.data[index],{});
869
- newRow._checked = flag;
870
- if (this.myConfig.checkByHighlight) {
871
- newRow._highlight = flag;
872
- }
873
- if (this.myConfig.onSetRowCheckBefore) {
874
- if (this.myConfig.onSetRowCheckBefore(index,flag)) {
875
- this.$nextTick(() => {
876
- this.data.splice(index,1,newRow);
877
- this.tempData.splice(index,1,newRow);
878
- });
879
- }
880
- } else {
881
- this.$nextTick(() => {
882
- this.data.splice(index,1,newRow);
883
- this.tempData.splice(index,1,newRow);
884
- });
885
- }
886
- }
887
- }
888
- },
889
- setAllRowCheck(flag) {
890
- let data = this.$Method.copy(this.data);
891
- data.forEach(el =>{
892
- el._checked = flag;
893
- if (this.myConfig.checkByHighlight) {
894
- el._highlight = flag;
895
- }
896
- });
897
- this.$nextTick(() => {
898
- this.data = data;
899
- });
900
- },
901
- setRowDisabled(index , flag) {
902
- if (index > -1) {
903
- let newRow = Object.assign({},this.data[index],{});
904
- newRow._disabled = flag;
905
- this.$nextTick(() => {
906
- this.data.splice(index,1,newRow);
907
- this.tempData.splice(index,1,newRow);
908
- });
909
- }
910
- },
911
- setAllRowDisabled(flag) {
912
- let data = this.$Method.copy(this.data);
913
- data.forEach(el =>{
914
- el._disabled = flag;
915
- });
916
- this.$nextTick(() => {
917
- this.data = data;
918
- });
919
- },
920
- setRowHighlight(index , flag) {
921
- if (index > -1) {
922
- let newRow = Object.assign({},this.data[index],{});
923
- newRow._highlight = flag;
924
- this.$nextTick(() => {
925
- this.data.splice(index,1,newRow);
926
- this.tempData.splice(index,1,newRow);
927
- });
928
- }
929
- },
930
- setAllRowHighlight(flag) {
931
- let data = this.$Method.copy(this.data);
932
- data.forEach(el =>{
933
- el._highlight = flag;
934
- });
935
- this.$nextTick(() => {
936
- this.data = data;
937
- });
938
- },
939
- commonRendel(h, params) {
940
- return h('div', [
941
- h(resolveComponent('ControlBox'), {
942
- config: params.column,
943
- valueData:params.row,
944
- readOnly:params.row.flag === 'D'? true:false,
945
- autofocus:this.editIndex === params.index && this.editKey === params.column.key?true:false,
946
- onInputValue:(val) => {
947
- this.editIndex = params.index;
948
- this.editKey = params.column.key;
949
- this.input(val);
950
- },
951
- onDoAction:(val) =>{
952
- this.doAction(val);
953
- }
954
- })
955
- ]);
956
- },
957
-
958
- setExtraHeight () {
959
- let height = 0;
960
- if (this.$refs.head) {
961
- height = this.$refs.head.offsetHeight;
962
- }
963
- if (this.$refs.page) {
964
- height = height + this.$refs.page.offsetHeight;
965
- }
966
- this.extraHeight = height;
967
- },
968
- setOutsideHeight(value) {
969
- this.outsideHeight = value;
970
- },
971
- getSoltTableColumns(config,list) {
972
- if (config) {
973
- if (config instanceof Array) {
974
- config.forEach(el => {
975
- this.getSoltTableColumns(el, list);
976
- })
977
- } else {
978
- if (config.children && config.children.length > 0) {
979
- config.children.forEach(el => {
980
- this.getSoltTableColumns(el, list);
981
- })
982
- } else {
983
- let temp = Object.assign({},config);
984
- if (temp.key !=='action' && temp.key !== 'actionbtn') {
985
- list.push(temp);
986
- }
987
- }
988
- }
989
- }
990
- },
991
- findColumnConfig(name,config) {
992
- if (name) {
993
- if (config instanceof Array) {
994
- let flag = false;
995
- let tmpConfig = {};
996
- config.some(el => {
997
- let tmp = this.findColumnConfig(name,el);
998
- if (!!tmp) {
999
- flag = true;
1000
- tmpConfig = tmp;
1001
- return true;
1002
- }
1003
- });
1004
- if (flag) {
1005
- return tmpConfig;
1006
- } else {
1007
- return false;
1008
- }
1009
- } else {
1010
- if (config.children && config.children.length > 0) {
1011
- let flag = false;
1012
- let tmpConfig = {};
1013
- config.children.some(el => {
1014
- let tmp = this.findColumnConfig(name, el);
1015
- if (!!tmp) {
1016
- flag = true;
1017
- tmpConfig = tmp;
1018
- return true;
1019
- }
1020
- });
1021
- if (flag) {
1022
- return tmpConfig;
1023
- } else {
1024
- return false;
1025
- }
1026
- } else {
1027
- if(name === config.name) {
1028
- return config;
1029
- } else {
1030
- return false;
1031
- }
1032
- }
1033
- }
1034
- }
1035
- },
1036
- openHelp () {
1037
- window.open(this.curHelpUrl);
1038
- },
1039
- initScrollLeft() {
1040
- if (this.$refs.table && this.$refs.table.$refs.body ) {
1041
- this.$refs.table.$refs.body.scrollLeft = 0;
1042
- }
1043
- },
1044
- },
1045
- watch:{
1046
- data(val){
1047
- this.tempData = deepCopy(val);
1048
- },
1049
- makeTableColumns(val) {
1050
- this.total_summary = {};
1051
- this.newRow = deepCopy(val.newRow);
1052
- this.summaryColumn = deepCopy(val.summaryColumn);
1053
- this.tableColumns = deepCopy(val.columns);
1054
- let soltTableColumns = [];
1055
- this.getSoltTableColumns(val.columns, soltTableColumns);
1056
- this.soltTableColumns = soltTableColumns;
1057
- }
1058
- },
1059
- mounted () {
1060
-
1061
- }
1062
- };
1
+ <script>
2
+ import { deepCopy } from '../../utils/assist';
3
+ import size from '@/components/base/size';
4
+ import { resolveComponent } from 'vue';
5
+ export default {
6
+ mixins: [size],
7
+ data () {
8
+ return {
9
+ globalConfig:{
10
+ cellbeginedit:'',
11
+ showHeader: true,
12
+ showIndex: true,
13
+ showStripe:false,
14
+ showBorder: true,
15
+ showCheckBox: false,
16
+ showCondition:false,
17
+ checkByHighlight:true,
18
+ readOnly: false,
19
+ showPage: true,
20
+ tableSize:'default',
21
+ pageSize:null,
22
+ pageShowElevator:true,
23
+ pageShowTotal:true,
24
+ pageShowSizer:true,
25
+ height: null,
26
+ manualLoad: true,
27
+ multiSelect: false,
28
+ operFixedFlag:true,
29
+ gridType:'viewGrid',
30
+ dynamicHeight:false,
31
+ generalOrientation:false,
32
+ showSummary:false,
33
+ showSumGroup:false,
34
+ sumText:'合计',
35
+ pageSizeNum:'',
36
+ adjustHeight:0,
37
+ items:[],
38
+ pageConfig: {
39
+ page_no: 1,
40
+ page_size: 100,
41
+ total_results: 0,
42
+ pageSizeList: [20, 50, 100, 200, 500, 1000]
43
+ },
44
+ moduleMethod:[],
45
+ headClassName:''
46
+ },
47
+ tempData:[],
48
+ data:[],
49
+ addData:[],
50
+ delData:[],
51
+ columns:[],
52
+ checkInfo:[],
53
+ checkAddInfo:[],
54
+ expand:{},
55
+ dictkey:'',
56
+ currentDictData:{},
57
+ editRowIndex:'',
58
+ editRowFlag:true,
59
+ loading:false,
60
+ conditionSearchParam:{},
61
+ showRowAction:false,
62
+ modulecode:'',
63
+ myToolConfig:{},
64
+ showMoreBtn:false ,
65
+ initData:[],
66
+ showDelRow:false,
67
+ showCondition:true,
68
+ delRowAction:[{
69
+ iconcls: 'row',
70
+ name: 'delRow',
71
+ text: '删除',
72
+ type:'text'
73
+ }],
74
+ operFixedFlag:true,
75
+ editIndex: -1,
76
+ editKey:'',
77
+ newRow:{},
78
+ summaryColumn:[],
79
+ total_summary:{},
80
+ extraHeight:0,
81
+ outsideHeight:0,
82
+ tableColumns:[],
83
+ soltTableColumns:[],
84
+ sumGroupNum:0,
85
+ culPage:1
86
+ };
87
+ },
88
+ props: {
89
+ config: {
90
+ type: Object,
91
+ default: () => {
92
+ return {};
93
+ }
94
+ },
95
+ dictData: {
96
+ type: Object,
97
+ default:null
98
+ },
99
+ toolConfig: {
100
+ type: Object,
101
+ default: () => {
102
+ return {};
103
+ }
104
+ },
105
+ isPop:{
106
+ type: Boolean,
107
+ default: false
108
+ }
109
+ },
110
+ created () {
111
+ this.init();
112
+ this.modulecode = this.$Method.getUrlParam('modulecode');
113
+ if (!this.modulecode) {
114
+ this.modulecode = this.$Method.getUrlParam('billmoduleid');
115
+ }
116
+ },
117
+ computed:{
118
+ makeTableColumns() {
119
+ return this.initColumn();
120
+ },
121
+ tableHeight() {
122
+ if (!this.myConfig.dynamicHeight) {
123
+ let currentHeight = this.currentHeight;
124
+ if (this.extraHeight) {
125
+ currentHeight = currentHeight - Number(this.extraHeight);
126
+ }
127
+ if (this.outsideHeight) {
128
+ currentHeight = currentHeight - Number(this.outsideHeight);
129
+ }
130
+ if (this.myConfig.showSummary) {
131
+ currentHeight = currentHeight - 50;
132
+ }
133
+ return currentHeight;
134
+ } else {
135
+ return null;
136
+ }
137
+ },
138
+ tableMaxHeight() {
139
+ if (this.myConfig.dynamicHeight) {
140
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
141
+ if (this.myConfig.showSummary) {
142
+ currentHeight = currentHeight - 50;
143
+ }
144
+ return currentHeight;
145
+ } else {
146
+ return null;
147
+ }
148
+ }
149
+
150
+ },
151
+ methods: {
152
+ init() {
153
+ this.myConfig = Object.assign({},this.globalConfig,this.myConfig);
154
+
155
+ if (this.config) {
156
+ let config = this.$Method.copy(this.config);
157
+ for (let temp in config) {
158
+ if (temp === 'pageConfig') {
159
+ for (let temp2 in config[temp]) {
160
+ this.myConfig.pageConfig[temp2] = config[temp][temp2];
161
+ }
162
+ } else {
163
+ this.myConfig[temp] = config[temp];
164
+ }
165
+ }
166
+ }
167
+ if (this.dictData) {
168
+ this.currentDictData = this.dictData;
169
+ } else {
170
+ this.currentDictData = [];
171
+ }
172
+ if (this.myConfig.showDelRow !== undefined) {
173
+ this.showDelRow = this.myConfig.showDelRow;
174
+ }
175
+
176
+ if (this.myConfig.showCondition !== undefined) {
177
+ this.showCondition = this.myConfig.showCondition;
178
+ }
179
+ this.myToolConfig = this.$Method.copy(this.toolConfig);
180
+
181
+ // 非弹框模式
182
+ if (!this.isPop) {
183
+ // 判断是否显示更多 按钮
184
+ let num = 0;
185
+ if (this.myToolConfig.items) {
186
+ this.myToolConfig.items.forEach(el => {
187
+ if (el.iconcls === 'row') {
188
+ num++;
189
+ }
190
+ });
191
+ }
192
+ if (num > 2) {
193
+ this.showMoreBtn = true;
194
+ } else {
195
+ this.showMoreBtn = false;
196
+ }
197
+ // 是否开启行编辑栏
198
+ if (num > 0) {
199
+ this.showRowAction = true;
200
+ } else {
201
+ this.showRowAction = false;
202
+ }
203
+ // 开启行编辑栏时checkbox显示
204
+ if (this.showRowAction) {
205
+ if (!this.myConfig.showCheckBox) {
206
+ if (this.myConfig.multiSelect) {
207
+ this.myConfig.showCheckBox = true;
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ this.operFixedFlag = this.myConfig.operFixedFlag;
214
+ if (this.myConfig.items && this.myConfig.items.length > 0) {
215
+ this.myConfig.items.some(el => {
216
+ if (el.resizable === true) {
217
+ this.myConfig.showBorder = true;
218
+ return true;
219
+ }
220
+ });
221
+ }
222
+ this.setSizeConfig(this.myConfig);
223
+ if (this.customInit) {
224
+ this.customInit();
225
+ }
226
+ },
227
+ initCheckColumn(columns) {
228
+ if (this.myConfig.showCheckBox) {
229
+ let check = {};
230
+ check.type = 'selection';
231
+ check.align = 'center';
232
+ check.key ='selection';
233
+ check.width = 40;
234
+ check.multiSelect = this.myConfig.multiSelect;
235
+ columns.push(check);
236
+ }
237
+ },
238
+ isToolBar(obj) {
239
+ let flag = false;
240
+ if (this.myToolConfig && this.myToolConfig.items) {
241
+ this.myToolConfig.items.some(el => {
242
+ if (el.iconcls === obj) {
243
+ flag = true;
244
+ return true;
245
+ }
246
+ });
247
+ }
248
+ return flag;
249
+ } ,
250
+ initIndexColumn(columns) {
251
+ if (this.myConfig.showIndex) {
252
+ if (this.myConfig.showSumGroup) {
253
+ let indexConfig = {
254
+ label: '行号',
255
+ name: 'sumindex',
256
+ type: 'TextBox',
257
+ align: 'center',
258
+ width: 45
259
+ };
260
+ if (this.myConfig.items[0].name !== 'sumindex') {
261
+ this.myConfig.items.splice(0, 0, indexConfig);
262
+ }
263
+ } else {
264
+ let index = {};
265
+ index.type = 'index';
266
+ index.key = 'index';
267
+ index.width = 45;
268
+ index.title = '行号';
269
+ index.align = 'center';
270
+ if (this.myConfig.headClassName !== undefined) {
271
+ index.className = this.myConfig.headClassName;
272
+ }
273
+ index.indexMethod = this.indexRender;
274
+ if (this.myConfig.indexConfig !== undefined) {
275
+ Object.assign(index, this.myConfig.indexConfig);
276
+ }
277
+ columns.push(index);
278
+ }
279
+ }
280
+ },
281
+ initOperColumn(columns) {
282
+ if (this.showRowAction || this.showDelRow) {
283
+ let action ={};
284
+ action.title = '操作';
285
+ if (this.myConfig.headClassName !== undefined) {
286
+ action.className = this.myConfig.headClassName;
287
+ }
288
+ action.key = 'action';
289
+ action.render = this.actionRender;
290
+ if (this.operFixedFlag) {
291
+ action.fixed ='right';
292
+ }
293
+ action.width = 120;
294
+ if (this.myToolConfig.items.length === 1) {
295
+ action.width = 80;
296
+ }
297
+ action.align = 'center';
298
+ if (this.customInitOperColumn) {
299
+ this.customInitOperColumn(action, columns);
300
+ } else {
301
+ columns.push(action);
302
+ }
303
+ }
304
+ },
305
+ onColumnWidthResize(newWidth, oldWidth, column) {
306
+ let temp = {};
307
+ temp.newWidth = newWidth;
308
+ temp.oldWidth = oldWidth;
309
+ temp.column = column;
310
+ this.$emit('onColumnWidthResize',temp);
311
+ },
312
+ initExpandColumn(items) {
313
+ this.expand.items=[];
314
+ let columns =[];
315
+ for (let i = 0; i < items.length; i++) {
316
+ if (items[i].isExpand === true) {
317
+ this.expand.items.push(items[i]);
318
+ } else {
319
+ columns.push(items[i]);
320
+ }
321
+ }
322
+ if (this.expand.items.length > 0) {
323
+ let expand = {
324
+ type: 'expand',
325
+ width: 50,
326
+ render:this.expandRendel
327
+ };
328
+ const index = columns.findIndex(item => item.type === 'index');
329
+ if (index > -1 ) {
330
+ columns.splice(index+1, 0, expand);
331
+ } else {
332
+ const checkindex = columns.findIndex(item => item.type === 'selection');
333
+ if (checkindex > -1) {
334
+ columns.splice(checkindex+1, 0, expand);
335
+ } else {
336
+ columns.splice(0, 0, expand);
337
+ }
338
+ }
339
+ items = columns;
340
+ }
341
+
342
+ },
343
+ initColumn() {
344
+ let newRow = {};
345
+ let summaryColumn = [];
346
+ let columns = [];
347
+ if (!this.myConfig.items || this.myConfig.items.length === 0) {
348
+ return columns;
349
+ }
350
+ this.initCheckColumn(columns);
351
+ this.initOperColumn(columns);
352
+ this.initIndexColumn(columns);
353
+ const length = this.myConfig.items.length;
354
+ for (let i = 0; i < length; i++) {
355
+ if (this.myConfig.items[i].visible !== false) {
356
+ //this.setColumn(i);
357
+ // 添加复杂列项的支持
358
+ this.initCommonColumn(this.myConfig.items[i],columns,summaryColumn,newRow);
359
+ } else {
360
+ if (this.myConfig.items[i].defaultValue !== undefined) {
361
+ if (this.myConfig.items[i].name) {
362
+ newRow[this.myConfig.items[i].name] = this.myConfig.items[i].defaultValue;
363
+ }
364
+ if (this.myConfig.items[i].sname) {
365
+ newRow[this.myConfig.items[i].sname] = this.myConfig.items[i].defaultValue;
366
+ }
367
+ if (this.myConfig.items[i].ename) {
368
+ newRow[this.myConfig.items[i].ename] = this.myConfig.items[i].defaultValue;
369
+ }
370
+ }
371
+ }
372
+ }
373
+ this.initExpandColumn(columns);
374
+ let obj = {};
375
+ obj.columns = columns;
376
+ obj.newRow = newRow;
377
+ obj.summaryColumn = summaryColumn;
378
+ return obj;
379
+ },
380
+ initCommonColumn (obj,list,summaryColumn,newRow) {
381
+ let column = this.$Method.copy(obj);
382
+ if (!column.contentAlign) {
383
+ column.contentAlign = column.align;
384
+ }
385
+ column.title = column.label;
386
+ if (!column.headClassName) {
387
+ if (this.myConfig.headClassName !== undefined) {
388
+ column.className = this.myConfig.headClassName;
389
+ }
390
+ } else {
391
+ column.className = column.headClassName;
392
+ }
393
+
394
+ if (obj.children && obj.children.length > 0) {
395
+ column.children = [];
396
+ for (let i=0;i<obj.children.length; i++) {
397
+ this.initCommonColumn(obj.children[i],column.children,summaryColumn,newRow);
398
+ }
399
+ list.push(column);
400
+ } else {
401
+ column = this.initColumnConfig(column,summaryColumn,newRow);
402
+ list.push(column);
403
+ }
404
+ },
405
+ initColumnConfig(column,summaryColumn,newRow) {
406
+ let type = '';
407
+ if (column.type) {
408
+ type = column.type.toLowerCase();
409
+ }
410
+ column.key = column.name;
411
+ if (Number(column.width)) {
412
+ column.width = Number(column.width);
413
+ } else {
414
+ delete column.width;
415
+ }
416
+
417
+ this.setColumnPro(column,type,summaryColumn,newRow);
418
+
419
+ if (type !== 'render') {
420
+ if (column.render === undefined) {
421
+ if (this.setCustomColumn) {
422
+ this.setCustomColumn(column);
423
+ }
424
+ }
425
+ }
426
+
427
+ // 处理check
428
+ if (type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
429
+ column.render = this.commonRendel;
430
+ if (type === 'picturebox') {
431
+ if (column.height === undefined) {
432
+ column.height = 40;
433
+ }
434
+ column.isGrid = true;
435
+ }
436
+ if (type === 'videobox') {
437
+ if (column.height === undefined) {
438
+ column.height = 60;
439
+ }
440
+ }
441
+ if (this.myConfig.readOnly) {
442
+ column.readOnly = true;
443
+ } else {
444
+ if (column.readOnly !== true) {
445
+ column.readOnly = false;
446
+ }
447
+ }
448
+
449
+ }
450
+ if (column.required) {
451
+ if (!column.className) {
452
+ column.className = 'efuture-grid-head-required';
453
+ }
454
+ }
455
+
456
+ // 事件绑定
457
+ if (column.valueChanged) {
458
+ column.valueChanged = this.valueChanged;
459
+ }
460
+ if (column.searchBefore) {
461
+ column.searchBefore = this.searchBefore;
462
+ }
463
+ if (column.setDataBefore) {
464
+ column.setDataBefore = this.setDataBefore;
465
+ }
466
+ if (column.onLinkTo) {
467
+ column.onLinkTo = this.onLinkTo;
468
+ }
469
+ if (type === 'timepicbox' || type === 'datebox' || type === 'daterangebox' || type === 'colorbox' || type === 'combobox') {
470
+ column.transfer = true;
471
+ }
472
+ return column;
473
+ },
474
+ setColumn(i) {
475
+ let column = this.$Method.copy(this.myConfig.items[i]);
476
+
477
+ column.title = column.label;
478
+ let type = '';
479
+ if (column.type) {
480
+ type = column.type.toLowerCase();
481
+ }
482
+ if (!type) {
483
+ return;
484
+ }
485
+
486
+ column.key = column.name;
487
+ if (Number(column.width)) {
488
+ column.width = Number(column.width);
489
+ } else {
490
+ delete column.width;
491
+ }
492
+
493
+ this.setColumnPro(column,type);
494
+
495
+ if (type !== 'render') {
496
+ if (column.render === undefined) {
497
+ if (this.setCustomColumn) {
498
+ this.setCustomColumn(column);
499
+ }
500
+ }
501
+ }
502
+
503
+ // 处理check
504
+ if (type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
505
+ column.render = this.commonRendel;
506
+ if (type === 'picturebox') {
507
+ if (column.height === undefined) {
508
+ column.height = 40;
509
+ }
510
+ }
511
+ if (type === 'videobox') {
512
+ if (column.height === undefined) {
513
+ column.height = 60;
514
+ }
515
+ }
516
+ if (this.myConfig.readOnly) {
517
+ column.readOnly = true;
518
+ } else {
519
+ column.readOnly = false;
520
+ }
521
+
522
+ }
523
+ if (column.required) {
524
+ if (!column.className) {
525
+ column.className = 'efuture-grid-head-required';
526
+ }
527
+ }
528
+
529
+ if (!column.contentAlign) {
530
+ if (!column.align) {
531
+ column.contentAlign = column.align;
532
+ }
533
+
534
+ }
535
+ // 事件绑定
536
+ if (this.myConfig.items[i].valueChanged) {
537
+ column.valueChanged = this.valueChanged;
538
+ }
539
+ if (this.myConfig.items[i].searchBefore) {
540
+ column.searchBefore = this.searchBefore;
541
+ }
542
+
543
+ if (this.myConfig.items[i].setDataBefore) {
544
+ column.setDataBefore = this.setDataBefore;
545
+ }
546
+ if (this.myConfig.items[i].onLinkTo) {
547
+ column.onLinkTo = this.onLinkTo;
548
+ }
549
+ if (column.formatValue === undefined) {
550
+ if (this.myConfig.formatValue !== undefined) {
551
+ column.formatValue = this.myConfig.formatValue;
552
+ }
553
+ }
554
+ this.columns.push(column);
555
+ },
556
+ setColumnPro(column, type, summaryColumn, newRow) {
557
+ column.place = 'grid';
558
+ if (column.sortable === true) {
559
+ column.sortable = 'custom';
560
+ } else if (column.sortable === 'default') {
561
+ column.sortable = true;
562
+ }
563
+ if (type === 'numberbox') {
564
+ if (!column.contentAlign) {
565
+ column.contentAlign = 'right';
566
+ }
567
+ if (!column.align) {
568
+ column.align = 'right';
569
+ }
570
+ if (column.summary && summaryColumn !== undefined) {
571
+ summaryColumn.push(column.name);
572
+ }
573
+ } else if (type === 'datebox' || type === 'checkbox' || type === 'picturebox' || type === 'videobox') {
574
+ if (this.myConfig.generalOrientation && type === 'datebox') {
575
+ if (!column.contentAlign) {
576
+ column.contentAlign = 'left';
577
+ }
578
+ if (!column.align) {
579
+ column.align = 'left';
580
+ }
581
+ } else {
582
+ if (!column.contentAlign) {
583
+ column.contentAlign = 'center';
584
+ }
585
+ if (!column.align) {
586
+ column.align = 'center';
587
+ }
588
+ }
589
+
590
+ } else {
591
+ if (!column.contentAlign) {
592
+ column.contentAlign = 'left';
593
+ }
594
+ if (!column.align) {
595
+ column.align = 'left';
596
+ }
597
+ }
598
+ if (type === 'combobox') {
599
+ if (column.data === undefined) {
600
+ let dictkey = column.dictkey;
601
+ if (column.customDictkey) {
602
+ dictkey = column.customDictkey;
603
+ }
604
+ column.data = this.currentDictData[dictkey];
605
+ }
606
+ }
607
+
608
+ // 处理默认值
609
+ if (column.defaultValue !== undefined) {
610
+ newRow[column.name] = column.defaultValue;
611
+ } else {
612
+ if (type === 'numberbox' || type === 'numberrangebox') {
613
+ let min = '';
614
+ if (column.min !== undefined) {
615
+ min = column.min;
616
+ }
617
+ if (column.smin !== undefined) {
618
+ min = column.smin;
619
+ }
620
+ if (column.smin === undefined && column.emin !== undefined) {
621
+ min = column.emin;
622
+ }
623
+ column.defaultValue = min;
624
+ if (newRow !== undefined) {
625
+ newRow[column.name] = min;
626
+ if(column.boundaryValue === false) {
627
+ newRow[column.name] = '';
628
+ column.defaultValue = '';
629
+ }
630
+ }
631
+
632
+ } else {
633
+ if (newRow !== undefined) {
634
+ if (column.type === 'poptagbox') {
635
+ newRow[column.name] = [];
636
+ } else {
637
+ newRow[column.name] = '';
638
+ }
639
+ }
640
+ }
641
+ }
642
+ },
643
+ expandRendel(h, params) {
644
+ return h('div', [
645
+ h(resolveComponent('ExpandRow'), {
646
+ config: this.expand,
647
+ valueData:params.row,
648
+ vstyle:'margin-right: 120px',
649
+ showRowAction:false,
650
+ onInputValue:(val) => {
651
+ this.editIndex = params.index;
652
+ this.input(val);
653
+ //this.editValueChanged(params,val);
654
+ }
655
+ })
656
+ ]);
657
+ },
658
+ indexRender (row,_index) {
659
+ let index = _index + 1;
660
+ if (this.myConfig.showPage) {
661
+ index = index + (this.myConfig.pageConfig.page_no - 1) * this.myConfig.pageConfig.page_size;
662
+ }
663
+ if (this.myConfig.indexMethod) {
664
+ return this.myConfig.indexMethod(row, index);
665
+ } else {
666
+ return index;
667
+ }
668
+ },
669
+ actionRender (h, params) {
670
+ return h('div', [
671
+ h(resolveComponent('Toolbar'), {
672
+ config:this.myToolConfig,
673
+ tooltype:'row',
674
+ moduleMethod:this.globalConfig.moduleMethod,
675
+ row:params.row,
676
+ onDoAction:(val) => {
677
+ val.rowinfo = params;
678
+ if (val.name === 'editRowForm') {
679
+ if (this.initRowForm) {
680
+ this.initRowForm(val);
681
+ }
682
+ } else if (val.name === 'delRow') {
683
+ if (this.delRow) {
684
+ this.delRow(params.index);
685
+ }
686
+ } else {
687
+ this.$emit('doAction',val);
688
+ }
689
+ }
690
+ })
691
+ ]);
692
+ },
693
+ remove (index) {
694
+ let _index = this.data.findIndex(item => item._customIndex === index);
695
+ if (_index === -1) {
696
+ _index = index;
697
+ }
698
+ if (_index > -1) {
699
+ if (this.data[_index].flag === undefined || this.data[_index].flag === 'U') {
700
+ this.data[_index].flag = 'D';
701
+ const row = this.$Method.copy(this.data[_index]);
702
+ this.delData.push(row);
703
+ }
704
+ this.data.splice(_index, 1);
705
+ }
706
+ if (this.customRemove) {
707
+ this.customRemove(_index);
708
+ }
709
+ },
710
+ setEdit(index) {
711
+ if (this.editRowIndex === index) {
712
+ this.editRowIndex = null;
713
+ } else {
714
+ this.editRowIndex = index;
715
+ }
716
+ },
717
+ dbclick (e) {
718
+ this.$emit('dbclick', e);
719
+ },
720
+ click (e) {
721
+ this.$emit('rowclick', e);
722
+ this.$emit('click', e);
723
+ },
724
+ setData(data) {
725
+ this.data = [];
726
+ this.data = data;
727
+ this.initData = this.$Method.copy(this.data);
728
+ this.delData = [];
729
+ this.checkInfo = [];
730
+ if (this.cancelCellEditing) {
731
+ this.cancelCellEditing();
732
+ }
733
+ },
734
+ getData() {
735
+ return this.$Method.copy(this.data);
736
+ },
737
+ clearData() {
738
+ this.editIndex = -1;
739
+ this.editKey = '';
740
+ this.data = [];
741
+ this.delData = [];
742
+ this.initData = [];
743
+ this.checkInfo = [];
744
+ this.addData = [];
745
+ this.checkAddInfo = [];
746
+ this.conditionSearchParam = {};
747
+ this.myConfig.pageConfig.page_no = 1;
748
+ this.myConfig.pageConfig.total_results = 0;
749
+ this.columnWidth = {};
750
+ if (this.customClearData) {
751
+ this.customClearData();
752
+ }
753
+ },
754
+ updataRow(index, para) {
755
+ let row = Object.assign({}, this.data[index], para);
756
+ this.data.splice(index,1,row);
757
+ this.tempData.splice(index,1,row);
758
+ },
759
+ getModuleMethod() {
760
+ this.modulecode = this.$Method.getUrlParam('modulecode');
761
+ if (!this.modulecode) {
762
+ this.modulecode = this.$Method.getUrlParam('billmoduleid');
763
+ }
764
+ this.token = this.$Method.getUrlParam('token');
765
+ if (this.modulecode && this.token) {
766
+ let btnList = this.getUserModuleMethod();
767
+ if (btnList) {
768
+ this.globalConfig.moduleMethod = btnList.modulemethod;
769
+ }
770
+ }
771
+ },
772
+ getSelection() {
773
+ return this.$refs.table.getSelection();
774
+ },
775
+ input(obj) {
776
+ let index = this.editIndex;
777
+ if (index === -1) {
778
+ if (obj.editIndex !== undefined) {
779
+ index = obj.editIndex;
780
+ } else {
781
+ return;
782
+ }
783
+ }
784
+ let tempRow = {};
785
+ if (obj.value !== undefined) {
786
+ tempRow[obj.name] = obj.value;
787
+ }
788
+ if (obj.text !== undefined) {
789
+ tempRow[obj.textName] = obj.text;
790
+ }
791
+ if (obj.svalue !== undefined) {
792
+ tempRow[obj.sname] = obj.svalue;
793
+ }
794
+ if (obj.evalue !== undefined) {
795
+ tempRow[obj.ename] = obj.evalue;
796
+ }
797
+
798
+ if (this.data[index].flag === undefined) {
799
+ tempRow.flag = 'U';
800
+ }
801
+
802
+ if (obj.customRows && obj.customRows.length > 0){
803
+ let self = this;
804
+ // 处理更新行
805
+ obj.customRows.forEach(el => {
806
+ if (el.changeIndex !== undefined) {
807
+ let newRow = Object.assign({},self.data[el.changeIndex],el);
808
+ if (self.data[el.changeIndex].flag === undefined) {
809
+ newRow.flag = 'U';
810
+ }
811
+ self.data.splice(el.changeIndex,1,newRow);
812
+ }
813
+ });
814
+ // 处理新增行
815
+ obj.customRows.forEach(el => {
816
+ if (el.changeIndex === undefined) {
817
+ let newRow = Object.assign({},{},el);
818
+ newRow.flag = 'I';
819
+ self.data.push(newRow);
820
+ }
821
+ });
822
+ } else {
823
+ let newRow = Object.assign({},this.data[index],tempRow);
824
+ this.$nextTick(() => {
825
+ this.data.splice(index,1,newRow);
826
+ });
827
+
828
+ }
829
+
830
+ },
831
+ updateColPro(name, pro) {
832
+ const index = this.myConfig.items.findIndex(item => name === item.name);
833
+ if (index > -1) {
834
+ let item = Object.assign({},this.myConfig.items[index],pro);
835
+ this.myConfig.items.splice(index,1,item);
836
+ }
837
+ },
838
+ setRowCheck(index , flag) {
839
+ // 单选
840
+ if (!this.myConfig.multiSelect) {
841
+ let data = this.$Method.copy(this.data);
842
+ data.forEach((el,_index) =>{
843
+ if (_index === index) {
844
+ if (this.myConfig.onSetRowCheckBefore) {
845
+ if (this.myConfig.onSetRowCheckBefore(index,flag)) {
846
+ el._checked = flag;
847
+ if (this.myConfig.checkByHighlight) {
848
+ el._highlight = flag;
849
+ }
850
+ }
851
+ } else {
852
+ el._checked = flag;
853
+ if (this.myConfig.checkByHighlight) {
854
+ el._highlight = flag;
855
+ }
856
+ }
857
+ } else {
858
+ el._checked = false;
859
+ el._highlight = false;
860
+ }
861
+ });
862
+ this.$nextTick(() => {
863
+ this.data = data;
864
+ });
865
+ // 多选
866
+ } else {
867
+ if (index > -1) {
868
+ let newRow = Object.assign({},this.data[index],{});
869
+ newRow._checked = flag;
870
+ if (this.myConfig.checkByHighlight) {
871
+ newRow._highlight = flag;
872
+ }
873
+ if (this.myConfig.onSetRowCheckBefore) {
874
+ if (this.myConfig.onSetRowCheckBefore(index,flag)) {
875
+ this.$nextTick(() => {
876
+ this.data.splice(index,1,newRow);
877
+ this.tempData.splice(index,1,newRow);
878
+ });
879
+ }
880
+ } else {
881
+ this.$nextTick(() => {
882
+ this.data.splice(index,1,newRow);
883
+ this.tempData.splice(index,1,newRow);
884
+ });
885
+ }
886
+ }
887
+ }
888
+ },
889
+ setAllRowCheck(flag) {
890
+ let data = this.$Method.copy(this.data);
891
+ data.forEach(el =>{
892
+ el._checked = flag;
893
+ if (this.myConfig.checkByHighlight) {
894
+ el._highlight = flag;
895
+ }
896
+ });
897
+ this.$nextTick(() => {
898
+ this.data = data;
899
+ });
900
+ },
901
+ setRowDisabled(index , flag) {
902
+ if (index > -1) {
903
+ let newRow = Object.assign({},this.data[index],{});
904
+ newRow._disabled = flag;
905
+ this.$nextTick(() => {
906
+ this.data.splice(index,1,newRow);
907
+ this.tempData.splice(index,1,newRow);
908
+ });
909
+ }
910
+ },
911
+ setAllRowDisabled(flag) {
912
+ let data = this.$Method.copy(this.data);
913
+ data.forEach(el =>{
914
+ el._disabled = flag;
915
+ });
916
+ this.$nextTick(() => {
917
+ this.data = data;
918
+ });
919
+ },
920
+ setRowHighlight(index , flag) {
921
+ if (index > -1) {
922
+ let newRow = Object.assign({},this.data[index],{});
923
+ newRow._highlight = flag;
924
+ this.$nextTick(() => {
925
+ this.data.splice(index,1,newRow);
926
+ this.tempData.splice(index,1,newRow);
927
+ });
928
+ }
929
+ },
930
+ setAllRowHighlight(flag) {
931
+ let data = this.$Method.copy(this.data);
932
+ data.forEach(el =>{
933
+ el._highlight = flag;
934
+ });
935
+ this.$nextTick(() => {
936
+ this.data = data;
937
+ });
938
+ },
939
+ commonRendel(h, params) {
940
+ return h('div', [
941
+ h(resolveComponent('ControlBox'), {
942
+ config: params.column,
943
+ valueData:params.row,
944
+ readOnly:params.row.flag === 'D'? true:false,
945
+ autofocus:this.editIndex === params.index && this.editKey === params.column.key?true:false,
946
+ onInputValue:(val) => {
947
+ this.editIndex = params.index;
948
+ this.editKey = params.column.key;
949
+ this.input(val);
950
+ },
951
+ onDoAction:(val) =>{
952
+ this.doAction(val);
953
+ }
954
+ })
955
+ ]);
956
+ },
957
+
958
+ setExtraHeight () {
959
+ let height = 0;
960
+ if (this.$refs.head) {
961
+ height = this.$refs.head.offsetHeight;
962
+ }
963
+ if (this.$refs.page) {
964
+ height = height + this.$refs.page.offsetHeight;
965
+ }
966
+ this.extraHeight = height;
967
+ },
968
+ setOutsideHeight(value) {
969
+ this.outsideHeight = value;
970
+ },
971
+ getSoltTableColumns(config,list) {
972
+ if (config) {
973
+ if (config instanceof Array) {
974
+ config.forEach(el => {
975
+ this.getSoltTableColumns(el, list);
976
+ })
977
+ } else {
978
+ if (config.children && config.children.length > 0) {
979
+ config.children.forEach(el => {
980
+ this.getSoltTableColumns(el, list);
981
+ })
982
+ } else {
983
+ let temp = Object.assign({},config);
984
+ if (temp.key !=='action' && temp.key !== 'actionbtn') {
985
+ list.push(temp);
986
+ }
987
+ }
988
+ }
989
+ }
990
+ },
991
+ findColumnConfig(name,config) {
992
+ if (name) {
993
+ if (config instanceof Array) {
994
+ let flag = false;
995
+ let tmpConfig = {};
996
+ config.some(el => {
997
+ let tmp = this.findColumnConfig(name,el);
998
+ if (!!tmp) {
999
+ flag = true;
1000
+ tmpConfig = tmp;
1001
+ return true;
1002
+ }
1003
+ });
1004
+ if (flag) {
1005
+ return tmpConfig;
1006
+ } else {
1007
+ return false;
1008
+ }
1009
+ } else {
1010
+ if (config.children && config.children.length > 0) {
1011
+ let flag = false;
1012
+ let tmpConfig = {};
1013
+ config.children.some(el => {
1014
+ let tmp = this.findColumnConfig(name, el);
1015
+ if (!!tmp) {
1016
+ flag = true;
1017
+ tmpConfig = tmp;
1018
+ return true;
1019
+ }
1020
+ });
1021
+ if (flag) {
1022
+ return tmpConfig;
1023
+ } else {
1024
+ return false;
1025
+ }
1026
+ } else {
1027
+ if(name === config.name) {
1028
+ return config;
1029
+ } else {
1030
+ return false;
1031
+ }
1032
+ }
1033
+ }
1034
+ }
1035
+ },
1036
+ openHelp () {
1037
+ window.open(this.curHelpUrl);
1038
+ },
1039
+ initScrollLeft() {
1040
+ if (this.$refs.table && this.$refs.table.$refs.body ) {
1041
+ this.$refs.table.$refs.body.scrollLeft = 0;
1042
+ }
1043
+ },
1044
+ },
1045
+ watch:{
1046
+ data(val){
1047
+ this.tempData = deepCopy(val);
1048
+ },
1049
+ makeTableColumns(val) {
1050
+ this.total_summary = {};
1051
+ this.newRow = deepCopy(val.newRow);
1052
+ this.summaryColumn = deepCopy(val.summaryColumn);
1053
+ this.tableColumns = deepCopy(val.columns);
1054
+ let soltTableColumns = [];
1055
+ this.getSoltTableColumns(val.columns, soltTableColumns);
1056
+ this.soltTableColumns = soltTableColumns;
1057
+ }
1058
+ },
1059
+ mounted () {
1060
+
1061
+ }
1062
+ };
1063
1063
  </script>