ocpview-plus 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/efviewplus.min.esm.js +99954 -0
- package/dist/efviewplus.min.js +142 -0
- package/dist/locale/lang.js +1 -0
- package/dist/locale/zh-CN.js +1 -0
- package/dist/locale/zh-TW.js +1 -0
- package/dist/locale/zh-UG.js +1 -0
- package/dist/style.css +9 -0
- package/dist/styles/efviewplus.css +1 -0
- package/package.json +144 -0
- package/src/components/base/controlbase.vue +191 -0
- package/src/components/base/controlbox.vue +102 -0
- package/src/components/base/index.js +3 -0
- package/src/components/base/load.js +20 -0
- package/src/components/base/probase.js +220 -0
- package/src/components/base/size.js +78 -0
- package/src/components/billbox/billbox.vue +68 -0
- package/src/components/billbox/index.js +2 -0
- package/src/components/cascaderbox/cascaderbox.vue +184 -0
- package/src/components/cascaderbox/index.js +2 -0
- package/src/components/checkbox/checkbox.vue +76 -0
- package/src/components/checkbox/checkgroupbox.vue +104 -0
- package/src/components/checkbox/index.js +3 -0
- package/src/components/colorbox/colorbox.vue +44 -0
- package/src/components/colorbox/index.js +2 -0
- package/src/components/combobox/combobox.vue +220 -0
- package/src/components/combobox/index.js +2 -0
- package/src/components/conditionbox/conditionbase.vue +195 -0
- package/src/components/conditionbox/conditionbox.vue +63 -0
- package/src/components/conditionbox/conditionfilterbox.vue +477 -0
- package/src/components/conditionbox/conditionselectorbox.vue +237 -0
- package/src/components/conditionbox/index.js +5 -0
- package/src/components/conditionbox/queryconditionbox.vue +26 -0
- package/src/components/conditionbox/queryconditionboxbase.vue +124 -0
- package/src/components/conditionbox/searchconditionbox.vue +114 -0
- package/src/components/conditionbox/searchgrid.vue +391 -0
- package/src/components/datebox/datebox.vue +129 -0
- package/src/components/datebox/daterangebox.vue +155 -0
- package/src/components/datebox/index.js +3 -0
- package/src/components/form/baseform.vue +677 -0
- package/src/components/form/detailsbox.vue +487 -0
- package/src/components/form/formbox.vue +29 -0
- package/src/components/form/formcardbox.vue +268 -0
- package/src/components/form/formcardgroupbox.vue +252 -0
- package/src/components/form/formcompro.js +19 -0
- package/src/components/form/formdetail.vue +129 -0
- package/src/components/form/formdetailtwo.vue +302 -0
- package/src/components/form/index.js +8 -0
- package/src/components/form/toolanchor.js +46 -0
- package/src/components/form/workform.vue +168 -0
- package/src/components/grid/basegrid.vue +1061 -0
- package/src/components/grid/editgrid.vue +51 -0
- package/src/components/grid/editgridbase.vue +947 -0
- package/src/components/grid/editgridcard.vue +193 -0
- package/src/components/grid/expandrow.vue +137 -0
- package/src/components/grid/index.js +6 -0
- package/src/components/grid/viewgrid.vue +122 -0
- package/src/components/grid/viewgridbase.vue +1284 -0
- package/src/components/icon/common-icon.vue +53 -0
- package/src/components/icon/eicon.vue +29 -0
- package/src/components/icon/icons.vue +42 -0
- package/src/components/icon/index.js +2 -0
- package/src/components/label/index.js +3 -0
- package/src/components/label/showtext.vue +95 -0
- package/src/components/load/loadcartoon.vue +228 -0
- package/src/components/map/index.js +2 -0
- package/src/components/map/mapbox.vue +348 -0
- package/src/components/masterplate/appendix.vue +586 -0
- package/src/components/masterplate/approval.vue +803 -0
- package/src/components/masterplate/base.vue +985 -0
- package/src/components/masterplate/billasyncimport.vue +614 -0
- package/src/components/masterplate/billconditionbox.vue +224 -0
- package/src/components/masterplate/billconditionsbox.vue +427 -0
- package/src/components/masterplate/billdetailform.vue +990 -0
- package/src/components/masterplate/billimport.vue +263 -0
- package/src/components/masterplate/billquerygrid.vue +316 -0
- package/src/components/masterplate/billsinglegrid.vue +234 -0
- package/src/components/masterplate/birtreport.vue +185 -0
- package/src/components/masterplate/detailbtntoolbar.vue +311 -0
- package/src/components/masterplate/detailsbox.vue +386 -0
- package/src/components/masterplate/editgridcard.vue +222 -0
- package/src/components/masterplate/editgridcard2.vue +109 -0
- package/src/components/masterplate/formcard.vue +106 -0
- package/src/components/masterplate/formcardgroupbox.vue +168 -0
- package/src/components/masterplate/formdetailtwo.vue +356 -0
- package/src/components/masterplate/gridcolset.vue +227 -0
- package/src/components/masterplate/index.js +23 -0
- package/src/components/masterplate/layouttemplate.vue +33 -0
- package/src/components/masterplate/leftlistrightdetails.vue +474 -0
- package/src/components/masterplate/leftlistrightlist.vue +465 -0
- package/src/components/masterplate/lefttreerightdetails.vue +619 -0
- package/src/components/masterplate/levelreport.vue +510 -0
- package/src/components/masterplate/listbtntoolbar.vue +257 -0
- package/src/components/masterplate/listdetails.vue +769 -0
- package/src/components/masterplate/operlog.vue +272 -0
- package/src/components/masterplate/options.vue +110 -0
- package/src/components/masterplate/page.vue +102 -0
- package/src/components/masterplate/promptmessage.vue +74 -0
- package/src/components/masterplate/querybar.vue +490 -0
- package/src/components/masterplate/report.vue +357 -0
- package/src/components/masterplate/rowbtntoolbar.vue +126 -0
- package/src/components/masterplate/simpletree.vue +129 -0
- package/src/components/masterplate/simpleviewgrid.vue +144 -0
- package/src/components/mychart/bar/bar.vue +202 -0
- package/src/components/mychart/basechart.vue +190 -0
- package/src/components/mychart/complexmychart/barline.vue +154 -0
- package/src/components/mychart/gauge/gauge.vue +83 -0
- package/src/components/mychart/index.js +9 -0
- package/src/components/mychart/line/line.vue +202 -0
- package/src/components/mychart/liquidfill/liquidfill.vue +109 -0
- package/src/components/mychart/pie/pie.vue +96 -0
- package/src/components/mychart/radar/radar.vue +122 -0
- package/src/components/mychart/scatter/scatter.vue +76 -0
- package/src/components/numberbox/append.js +11 -0
- package/src/components/numberbox/index.js +3 -0
- package/src/components/numberbox/numberbox.vue +303 -0
- package/src/components/numberbox/numberrangebox.vue +423 -0
- package/src/components/picturebox/filebox.vue +365 -0
- package/src/components/picturebox/index.js +3 -0
- package/src/components/picturebox/picturebox.vue +541 -0
- package/src/components/picturebox/uploadbox.vue +164 -0
- package/src/components/poptagbox/index.js +2 -0
- package/src/components/poptagbox/poptagbox.vue +389 -0
- package/src/components/poptextbox/index.js +2 -0
- package/src/components/poptextbox/poptextbox.vue +601 -0
- package/src/components/radiobox/index.js +2 -0
- package/src/components/radiobox/radiogroupbox.vue +76 -0
- package/src/components/richtextbox/editor.vue +150 -0
- package/src/components/richtextbox/index.js +2 -0
- package/src/components/richtextbox/richtextbox.vue +448 -0
- package/src/components/textbox/index.js +2 -0
- package/src/components/textbox/textbox.vue +98 -0
- package/src/components/timebox/index.js +2 -0
- package/src/components/timebox/timebox.vue +76 -0
- package/src/components/toolbar/ebutton.vue +169 -0
- package/src/components/toolbar/index.js +3 -0
- package/src/components/toolbar/toolbar.vue +446 -0
- package/src/components/tree/basetree.vue +725 -0
- package/src/components/tree/index.js +3 -0
- package/src/components/tree/treedata.vue +51 -0
- package/src/components/tree/treedatabase.vue +189 -0
- package/src/components/upload/billimport.vue +233 -0
- package/src/components/upload/index.js +2 -0
- package/src/components/videobox/index.js +2 -0
- package/src/components/videobox/uploadbox.vue +148 -0
- package/src/components/videobox/videobox.vue +503 -0
- package/src/components/wrichtextbox/editor.vue +219 -0
- package/src/components/wrichtextbox/index.js +2 -0
- package/src/components/wrichtextbox/wrichtextbox.vue +63 -0
- package/src/index.js +215 -0
- package/src/locale/format.js +51 -0
- package/src/locale/index.js +63 -0
- package/src/locale/lang/zh-CN.js +123 -0
- package/src/locale/lang/zh-TW.js +114 -0
- package/src/locale/lang/zh-UG.js +115 -0
- package/src/locale/lang.js +15 -0
- package/src/method/case/case.js +1180 -0
- package/src/method/config/queryconfig.js +24 -0
- package/src/method/const/const.js +815 -0
- package/src/method/index.js +8 -0
- package/src/static/excel/exportexcel.js +627 -0
- package/src/static/iview/coustom.js +463 -0
- package/src/store/index.js +19 -0
- package/src/store/modules/app.js +53 -0
- package/src/styles/README.md +3 -0
- package/src/styles/common.less +75 -0
- package/src/styles/components/anchor.less +74 -0
- package/src/styles/components/approval.less +136 -0
- package/src/styles/components/button.less +208 -0
- package/src/styles/components/card.less +51 -0
- package/src/styles/components/content.less +38 -0
- package/src/styles/components/font.less +314 -0
- package/src/styles/components/form.less +72 -0
- package/src/styles/components/iconfont/fonts/iconfont.less +1376 -0
- package/src/styles/components/iconfont/fonts/iconfont.svg +699 -0
- package/src/styles/components/iconfont/fonts/iconfont.ttf +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff2 +0 -0
- package/src/styles/components/index.less +16 -0
- package/src/styles/components/input.less +290 -0
- package/src/styles/components/modal.less +203 -0
- package/src/styles/components/page.less +340 -0
- package/src/styles/components/select.less +361 -0
- package/src/styles/components/steps.less +367 -0
- package/src/styles/components/table.less +544 -0
- package/src/styles/components/tabs.less +249 -0
- package/src/styles/components/upload.less +83 -0
- package/src/styles/custom.less +67 -0
- package/src/styles/index.less +6 -0
- package/src/styles/pack.less +6 -0
- package/src/utils/EfuMessenger.js +155 -0
- package/src/utils/assist.js +353 -0
- package/src/utils/index.js +1 -0
- package/src/utils/random_str.js +10 -0
|
@@ -0,0 +1,1284 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { deepCopy } from '../../utils/assist';
|
|
3
|
+
import Base from './basegrid.vue';
|
|
4
|
+
import elementResizeDetectorMaker from 'element-resize-detector';
|
|
5
|
+
import {gzip} from 'pako';
|
|
6
|
+
export default {
|
|
7
|
+
name: 'viewgridbase',
|
|
8
|
+
extends: Base,
|
|
9
|
+
data () {
|
|
10
|
+
return {
|
|
11
|
+
myConfig:{
|
|
12
|
+
resources:'',
|
|
13
|
+
method:'',
|
|
14
|
+
response:'',
|
|
15
|
+
searchParam:null,
|
|
16
|
+
readOnly:true,
|
|
17
|
+
multiSelect:true,
|
|
18
|
+
bindSearchParam:'ph_key',
|
|
19
|
+
showAll:false,
|
|
20
|
+
exportMethod:'exportExcel',
|
|
21
|
+
separator:'::',
|
|
22
|
+
exportType:'2',
|
|
23
|
+
overrideData:'',
|
|
24
|
+
headStyle:'padding-bottom: 10px;padding-top: 10px;',
|
|
25
|
+
multiSelectGrid:false,
|
|
26
|
+
multiGridCol:11,
|
|
27
|
+
multiGridTitle:'已选择',
|
|
28
|
+
gridTitle:'待选择',
|
|
29
|
+
highLightRow:true,
|
|
30
|
+
dynamicColumnFlag:false,
|
|
31
|
+
dynameicColumnConfig: {
|
|
32
|
+
groupColumns:[],
|
|
33
|
+
dynameicColumnName:'',
|
|
34
|
+
dynameicColumnValue:'',
|
|
35
|
+
dynameicColumnValueTitle:'',
|
|
36
|
+
dynameicColumnValuePro:{},
|
|
37
|
+
dynameicColumnSumLable:'动态合计'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
multiGridCol:11,
|
|
41
|
+
gridCol:11,
|
|
42
|
+
editRowFlag:false,
|
|
43
|
+
singleData:{},
|
|
44
|
+
searchBeforeSearchParam:{},
|
|
45
|
+
order_field:'',
|
|
46
|
+
order_direction:'',
|
|
47
|
+
rightActive:false,
|
|
48
|
+
leftActive:false,
|
|
49
|
+
multiSelectData:[],
|
|
50
|
+
multiTableColumns:[],
|
|
51
|
+
dynamicColumnItems:[],
|
|
52
|
+
tempMultiSelectData:[],
|
|
53
|
+
multiSoltTableColumns:[],
|
|
54
|
+
showHelpBtn:false
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
computed:{
|
|
58
|
+
makeTableColumns() {
|
|
59
|
+
if (this.myConfig.dynamicColumnFlag) {
|
|
60
|
+
return [];
|
|
61
|
+
} else {
|
|
62
|
+
return this.initColumn();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
customInit() {
|
|
68
|
+
if (this.isPop) {
|
|
69
|
+
if (!this.myConfig.showCheckBox) {
|
|
70
|
+
if (this.myConfig.multiSelect) {
|
|
71
|
+
this.myConfig.showCheckBox = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (this.myConfig.multiGridCol) {
|
|
75
|
+
this.multiGridCol = Number(this.myConfig.multiGridCol);
|
|
76
|
+
this.gridCol = 24 - 2 - this.multiGridCol;
|
|
77
|
+
}
|
|
78
|
+
this.myConfig.tableSize = 'small';
|
|
79
|
+
this.myConfig.headStyle = '';
|
|
80
|
+
this.myConfig.showBorder = false;
|
|
81
|
+
this.myConfig.headStyle = '';
|
|
82
|
+
this.myConfig.pageSize = 'small';
|
|
83
|
+
if (this.myConfig.height === undefined) {
|
|
84
|
+
this.myConfig.height = 360;
|
|
85
|
+
}
|
|
86
|
+
if (!this.myConfig.pageSizeNum) {
|
|
87
|
+
this.myConfig.pageConfig.page_size = 50;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (this.myConfig.pageSizeNum) {
|
|
92
|
+
this.myConfig.pageConfig.page_size = Number(this.myConfig.pageSizeNum);
|
|
93
|
+
}
|
|
94
|
+
this.myConfig.items.forEach(el => {
|
|
95
|
+
if (el.resizable === undefined) {
|
|
96
|
+
el.resizable = true;
|
|
97
|
+
}
|
|
98
|
+
if (!el.width && !el.minWidth) {
|
|
99
|
+
el.minWidth = 60;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
if (this.myConfig.multiSelectGrid) {
|
|
103
|
+
this.multiTableColumns = this.multiInitColumn();
|
|
104
|
+
}
|
|
105
|
+
if (this.myConfig.gridType === 'billGrid') {
|
|
106
|
+
this.getModuleMethod();
|
|
107
|
+
}
|
|
108
|
+
if (this.myConfig.dynamicColumnFlag) {
|
|
109
|
+
this.myConfig.showPage = false;
|
|
110
|
+
}
|
|
111
|
+
let self = this;
|
|
112
|
+
this.curHelpUrl = this.OmdUrl.getCurHelpUrl(self);
|
|
113
|
+
if (this.curHelpUrl) {
|
|
114
|
+
this.showHelpBtn = true;
|
|
115
|
+
} else {
|
|
116
|
+
this.showHelpBtn = false;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
conditionAction(temp) {
|
|
120
|
+
let data = [];
|
|
121
|
+
switch (temp.action) {
|
|
122
|
+
case 'condition_search' :
|
|
123
|
+
if (temp.para) {
|
|
124
|
+
this.conditionSearchParam = this.$Method.copy(temp.para);
|
|
125
|
+
}
|
|
126
|
+
this.refurbish();
|
|
127
|
+
break;
|
|
128
|
+
case 'condition_clear' :
|
|
129
|
+
this.conditionSearchParam = {};
|
|
130
|
+
break;
|
|
131
|
+
case 'condition_ok' :
|
|
132
|
+
if (this.myConfig.multiSelect) {
|
|
133
|
+
data = this.getSelection();
|
|
134
|
+
} else {
|
|
135
|
+
if (this.singleData.currentRow) {
|
|
136
|
+
data.push(this.singleData.currentRow);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (data.length === 0) {
|
|
140
|
+
this.alert('请选择');
|
|
141
|
+
} else {
|
|
142
|
+
temp.rows = data;
|
|
143
|
+
this.$emit('conditionAction',temp);
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
case 'condition_cancel' :
|
|
147
|
+
this.$emit('conditionAction',temp);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
getSearchParam(obj, flag) {
|
|
152
|
+
let searchParam =Object.assign({},this.myConfig.searchParam,this.searchBeforeSearchParam);
|
|
153
|
+
if (!searchParam) {
|
|
154
|
+
searchParam = {};
|
|
155
|
+
}
|
|
156
|
+
if (this.myConfig.response === 'report') {
|
|
157
|
+
searchParam = Object.assign({},searchParam,this.conditionSearchParam);
|
|
158
|
+
} else {
|
|
159
|
+
let tempSearchParam = {};
|
|
160
|
+
for (let el in searchParam) {
|
|
161
|
+
if (this.conditionSearchParam[el]) {
|
|
162
|
+
tempSearchParam[el]={'$and':[]};
|
|
163
|
+
let temp = {};
|
|
164
|
+
temp[el] = searchParam[el];
|
|
165
|
+
tempSearchParam[el]['$and'].push(temp);
|
|
166
|
+
let temp2 = {};
|
|
167
|
+
temp2[el] = this.conditionSearchParam[el];
|
|
168
|
+
tempSearchParam[el]['$and'].push(temp2);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
searchParam = Object.assign({},searchParam,this.conditionSearchParam);
|
|
172
|
+
for (let el in tempSearchParam) {
|
|
173
|
+
searchParam['$and'] = this.$Method.copy(tempSearchParam[el]['$and']);
|
|
174
|
+
delete searchParam[el];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (this.myConfig.showPage) {
|
|
179
|
+
if (!flag) {
|
|
180
|
+
this.myConfig.pageConfig.page_no = 1;
|
|
181
|
+
searchParam.page_no = 1;
|
|
182
|
+
this.culPage = 1;
|
|
183
|
+
} else {
|
|
184
|
+
if (this.myConfig.pageConfig.page_no) {
|
|
185
|
+
searchParam.page_no = this.myConfig.pageConfig.page_no;
|
|
186
|
+
} else {
|
|
187
|
+
searchParam.page_no = 1;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
searchParam.page_size = this.myConfig.pageConfig.page_size;
|
|
191
|
+
}
|
|
192
|
+
if (this.order_field) {
|
|
193
|
+
searchParam.order_field = this.order_field;
|
|
194
|
+
if (this.order_direction) {
|
|
195
|
+
searchParam.order_direction = this.order_direction;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (obj) {
|
|
199
|
+
searchParam =Object.assign({},searchParam,obj);
|
|
200
|
+
}
|
|
201
|
+
if (!this.myConfig.dynamicColumnFlag) {
|
|
202
|
+
if (this.summaryColumn && this.summaryColumn.length > 0) {
|
|
203
|
+
searchParam.summary_fld = this.summaryColumn.join(',');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (this.myConfig.showSumGroup) {
|
|
207
|
+
searchParam.sumgroups = this.myConfig.sumgroups;
|
|
208
|
+
}
|
|
209
|
+
if (this.myConfig.overrideSearchParam) {
|
|
210
|
+
return this.myConfig.overrideSearchParam(searchParam);
|
|
211
|
+
} else {
|
|
212
|
+
return searchParam;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
},
|
|
216
|
+
setWhereParam(obj) {
|
|
217
|
+
this.conditionSearchParam = this.$Method.copy(obj);
|
|
218
|
+
},
|
|
219
|
+
refurbish(obj,flag) {
|
|
220
|
+
this.loading = true;
|
|
221
|
+
let self = this;
|
|
222
|
+
this.singleData = {};
|
|
223
|
+
self.data = [];
|
|
224
|
+
self.asyncPost(self.myConfig.resources,self.myConfig.method,self.getSearchParam(obj,flag),function(data) {
|
|
225
|
+
self.dynamicInitData = data;
|
|
226
|
+
if (self.myConfig.dynamicColumnFlag) {
|
|
227
|
+
self.makeDynamicColumn();
|
|
228
|
+
} else {
|
|
229
|
+
self.refurbishSucceedDefault();
|
|
230
|
+
}
|
|
231
|
+
self.loading = false;
|
|
232
|
+
},function(e) {
|
|
233
|
+
self.loading = false;
|
|
234
|
+
self.$nextTick(() => {
|
|
235
|
+
setTimeout(() => {
|
|
236
|
+
self.alert(e, null, 2);
|
|
237
|
+
}, 1000);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
changePage (para) {
|
|
242
|
+
let old = this.myConfig.pageConfig.page_no;
|
|
243
|
+
if (this.myConfig.refurbishCheck) {
|
|
244
|
+
this.myConfig.refurbishCheck(para,old,this.callBackChangePage);
|
|
245
|
+
} else {
|
|
246
|
+
this.myConfig.pageConfig.page_no = para;
|
|
247
|
+
this.refurbish(null, true);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
},
|
|
251
|
+
refurbishSucceedDefault () {
|
|
252
|
+
this.sumGroupNum = 0;
|
|
253
|
+
if (this.dynamicInitData && this.dynamicInitData[this.myConfig.response]) {
|
|
254
|
+
if (this.myConfig.showAll) {
|
|
255
|
+
if (this.myConfig.rowAll) {
|
|
256
|
+
this.dynamicInitData[this.myConfig.response].splice(0,0,this.myConfig.rowAll);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
let data = [];
|
|
260
|
+
if (this.myConfig.overrideData) {
|
|
261
|
+
data = this.myConfig.overrideData(this.dynamicInitData[this.myConfig.response]);
|
|
262
|
+
} else {
|
|
263
|
+
data = this.dynamicInitData[this.myConfig.response];
|
|
264
|
+
}
|
|
265
|
+
if (this.dynamicInitData.sumgroups) {
|
|
266
|
+
data = this.doSumgroups(data, this.dynamicInitData.sumgroups);
|
|
267
|
+
}
|
|
268
|
+
this.data = data;
|
|
269
|
+
this.tempData = this.$Method.copy(data);
|
|
270
|
+
}
|
|
271
|
+
if (this.dynamicInitData.total_results !== undefined) {
|
|
272
|
+
this.myConfig.pageConfig.total_results= Number(this.dynamicInitData.total_results);
|
|
273
|
+
}
|
|
274
|
+
if (this.dynamicInitData.total_summary !== undefined) {
|
|
275
|
+
this.total_summary = Object.assign({}, {}, this.dynamicInitData.total_summary);
|
|
276
|
+
if (!this.myConfig.showSummary) {
|
|
277
|
+
Object.assign(this.myConfig,{'showSummary':true});
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
if (this.myConfig.showSummary) {
|
|
281
|
+
Object.assign(this.myConfig,{'showSummary':false});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
callBackChangePage(flag ,newvalue, oldvale) {
|
|
286
|
+
if (!flag) {
|
|
287
|
+
this.$nextTick(() => {
|
|
288
|
+
this.myConfig.pageConfig.page_no = oldvale;
|
|
289
|
+
this.myConfig.showPage = false;
|
|
290
|
+
this.myConfig = Object.assign({},this.myConfig);
|
|
291
|
+
this.$nextTick(() => {
|
|
292
|
+
this.myConfig.showPage = true;
|
|
293
|
+
this.myConfig = Object.assign({},this.myConfig);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
} else {
|
|
297
|
+
this.myConfig.pageConfig.page_no = newvalue;
|
|
298
|
+
this.refurbish(null,true);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
callBackChangePageSize(flag ,newvalue, oldvale) {
|
|
302
|
+
if (!flag) {
|
|
303
|
+
this.$nextTick(() => {
|
|
304
|
+
this.myConfig.pageConfig.page_size = oldvale;
|
|
305
|
+
this.myConfig.showPage = false;
|
|
306
|
+
this.myConfig = Object.assign({},this.myConfig);
|
|
307
|
+
this.$nextTick(() => {
|
|
308
|
+
this.myConfig.showPage = true;
|
|
309
|
+
this.myConfig = Object.assign({},this.myConfig);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
} else {
|
|
313
|
+
this.myConfig.pageConfig.page_size = newvalue;
|
|
314
|
+
this.refurbish(null,true);
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
changePageSize (para) {
|
|
318
|
+
let old = this.myConfig.pageConfig.page_size;
|
|
319
|
+
if (this.myConfig.refurbishCheck) {
|
|
320
|
+
this.myConfig.refurbishCheck(para,old,this.callBackChangePageSize);
|
|
321
|
+
} else {
|
|
322
|
+
this.myConfig.pageConfig.page_size = para;
|
|
323
|
+
if (this.data && this.data.length > 0) {
|
|
324
|
+
this.refurbish(null, true);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
sortChagne (para) {
|
|
329
|
+
this.order_field = '';
|
|
330
|
+
this.order_direction = '';
|
|
331
|
+
let tempField = [];
|
|
332
|
+
let tempDirection = [];
|
|
333
|
+
if (this.config.searchParam) {
|
|
334
|
+
if (this.config.searchParam.order_field) {
|
|
335
|
+
tempField = this.config.searchParam.order_field.split(',');
|
|
336
|
+
if (this.config.searchParam.order_direction) {
|
|
337
|
+
tempDirection = this.config.searchParam.order_direction.split(',');
|
|
338
|
+
let tempDirectionNum = tempDirection.length;
|
|
339
|
+
for (let i=tempDirectionNum;i<tempField.length;i++) {
|
|
340
|
+
tempDirection.push('asc');
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
for (let i=0;i<tempField.length;i++) {
|
|
344
|
+
tempDirection.push('asc');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (para.order !== 'normal') {
|
|
350
|
+
let index = tempField.findIndex(el => el === para.key);
|
|
351
|
+
if (index > -1) {
|
|
352
|
+
tempDirection.splice(index, 1, para.order);
|
|
353
|
+
} else {
|
|
354
|
+
tempField.push(para.key);
|
|
355
|
+
tempDirection.push(para.order);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (tempField.length > 0) {
|
|
359
|
+
this.order_field = tempField.join();
|
|
360
|
+
this.order_direction = tempDirection.join();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (this.data && this.data.length > 0) {
|
|
364
|
+
this.refurbish();
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
onCurrentChange(currentRow,oldCurrentRow) {
|
|
368
|
+
this.singleData = {};
|
|
369
|
+
this.singleData.currentRow= currentRow;
|
|
370
|
+
this.singleData.oldCurrentRow= oldCurrentRow;
|
|
371
|
+
if (this.myConfig.onSingleChange) {
|
|
372
|
+
this.myConfig.onSingleChange();
|
|
373
|
+
}
|
|
374
|
+
if (this.myConfig.showCheckBox) {
|
|
375
|
+
if (this.myConfig.onSetRowCheck) {
|
|
376
|
+
this.myConfig.onSetRowCheck(currentRow._customIndex,true);
|
|
377
|
+
} else {
|
|
378
|
+
this.setRowCheck(currentRow._customIndex,true);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
},
|
|
383
|
+
onSelect(rows,curRow) {
|
|
384
|
+
if (this.myConfig.onSelect) {
|
|
385
|
+
this.myConfig.onSelect(rows,curRow);
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
onSelectCancel(rows,curRow) {
|
|
389
|
+
if (this.myConfig.onSelectCancel) {
|
|
390
|
+
this.myConfig.onSelectCancel(rows,curRow);
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
OnSelectionChange(row) {
|
|
394
|
+
this.$nextTick(() => {
|
|
395
|
+
if (this.myConfig.onSelectionChange) {
|
|
396
|
+
this.myConfig.onSelectionChange(row);
|
|
397
|
+
}
|
|
398
|
+
if (row && row.length > 0) {
|
|
399
|
+
this.leftActive = true;
|
|
400
|
+
} else {
|
|
401
|
+
this.leftActive = false;
|
|
402
|
+
}
|
|
403
|
+
let data = this.$Method.copy(this.data);
|
|
404
|
+
let flag = false;
|
|
405
|
+
data.forEach((el,index) => {
|
|
406
|
+
flag = false;
|
|
407
|
+
row.forEach(el2 => {
|
|
408
|
+
if (index === el2._customIndex) {
|
|
409
|
+
flag = true;
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
el._checked = flag;
|
|
414
|
+
})
|
|
415
|
+
this.data = data;
|
|
416
|
+
this.tempData = this.$Method.copy(data);
|
|
417
|
+
/*if (this.data.length === row.length) {
|
|
418
|
+
if (!this.isAll) {
|
|
419
|
+
this.$refs.table.selectAll(true);
|
|
420
|
+
this.isAll = true;
|
|
421
|
+
} else {
|
|
422
|
+
this.isAll = false;
|
|
423
|
+
}
|
|
424
|
+
}*/
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
OnMultiSelectionChange (row) {
|
|
428
|
+
this.$nextTick(() => {
|
|
429
|
+
let data = this.$Method.copy(this.tempMultiSelectData);
|
|
430
|
+
let flag = false;
|
|
431
|
+
data.forEach((el,index) => {
|
|
432
|
+
flag = false;
|
|
433
|
+
row.forEach(el2 => {
|
|
434
|
+
if (index === el2._customIndex) {
|
|
435
|
+
flag = true;
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
el._checked = flag;
|
|
440
|
+
})
|
|
441
|
+
this.tempMultiSelectData = data;
|
|
442
|
+
if (row && row.length > 0) {
|
|
443
|
+
this.rightActive = true;
|
|
444
|
+
} else {
|
|
445
|
+
this.rightActive = false;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
removeRow(index) {
|
|
450
|
+
this.data.splice(index, 1);
|
|
451
|
+
},
|
|
452
|
+
doBatchAction(obj) {
|
|
453
|
+
if (obj.name !== 'addData') {
|
|
454
|
+
let data = this.getSelection();
|
|
455
|
+
if (data.length === 0) {
|
|
456
|
+
this.alert('请至少选择一行');
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
obj.data= data;
|
|
460
|
+
}
|
|
461
|
+
this.$emit('doAction', obj);
|
|
462
|
+
},
|
|
463
|
+
add() {
|
|
464
|
+
let obj = {};
|
|
465
|
+
obj.name ='addData';
|
|
466
|
+
this.$emit('doAction', obj);
|
|
467
|
+
},
|
|
468
|
+
setSearchBeforeSearchParam(obj) {
|
|
469
|
+
this.searchBeforeSearchParam = Object.assign({},{},obj);
|
|
470
|
+
},
|
|
471
|
+
clearSearchBeforeSearchParam() {
|
|
472
|
+
this.searchBeforeSearchParam = {};
|
|
473
|
+
},
|
|
474
|
+
popValueChanged (para) {
|
|
475
|
+
let reData = [];
|
|
476
|
+
let self = this;
|
|
477
|
+
let searchParam = Object.assign({},self.getSearchParam(),para);
|
|
478
|
+
self.synchroPost(self.myConfig.resources,self.myConfig.method,searchParam,function(data) {
|
|
479
|
+
if (data && data[self.myConfig.response]) {
|
|
480
|
+
reData = data[self.myConfig.response];
|
|
481
|
+
}
|
|
482
|
+
},null);
|
|
483
|
+
return reData;
|
|
484
|
+
},
|
|
485
|
+
getTotalCount() {
|
|
486
|
+
let total_results = '';
|
|
487
|
+
if (this.myConfig.pageConfig.total_results !== undefined) {
|
|
488
|
+
total_results = this.myConfig.pageConfig.total_results;
|
|
489
|
+
}
|
|
490
|
+
return total_results;
|
|
491
|
+
},
|
|
492
|
+
export(asyncExport,afterFun) {
|
|
493
|
+
if(this.data.length == 0){
|
|
494
|
+
this.alert('请先查询数据');
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
let _param = this.getSearchParam();
|
|
498
|
+
if (this.OmdUrl.maxRowNum) {
|
|
499
|
+
_param.maxrownum = this.OmdUrl.maxRowNum;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (this.OmdUrl.maxDataNum) {
|
|
503
|
+
_param.maxdatanum = this.OmdUrl.maxDataNum;
|
|
504
|
+
}
|
|
505
|
+
let modulecode = this.getModulecode();
|
|
506
|
+
if (modulecode) {
|
|
507
|
+
_param.modulecode = modulecode;
|
|
508
|
+
}
|
|
509
|
+
let dict = {};
|
|
510
|
+
dict.dictdata = {};
|
|
511
|
+
_param.fields =this.$Method.getGridField(this.myConfig.items,this.myConfig.separator,this.dictData, dict.dictdata);
|
|
512
|
+
if (!_param.fields) {
|
|
513
|
+
_param.fields = '';
|
|
514
|
+
}
|
|
515
|
+
// 添加总数
|
|
516
|
+
let totalCount = this.getTotalCount();
|
|
517
|
+
if (totalCount) {
|
|
518
|
+
_param.fields += ',totalCount'+ this.myConfig.separator + totalCount;
|
|
519
|
+
}
|
|
520
|
+
// 添加模块号
|
|
521
|
+
if (modulecode) {
|
|
522
|
+
_param.fields += ',modulecode'+ this.myConfig.separator + modulecode;
|
|
523
|
+
}
|
|
524
|
+
let exportMethod = this.myConfig.exportMethod;
|
|
525
|
+
if (asyncExport) {
|
|
526
|
+
exportMethod = 'asyncExport';
|
|
527
|
+
}
|
|
528
|
+
let _baseUrl = this.myConfig.resources.replace('rest', exportMethod);
|
|
529
|
+
let _self = this;
|
|
530
|
+
const encodedArray =this.zip(JSON.stringify(dict.dictdata));
|
|
531
|
+
_param.dictdata = encodeURIComponent(encodedArray);
|
|
532
|
+
if (asyncExport) {
|
|
533
|
+
this.asyncExport(_baseUrl,this.myConfig.method,_param,afterFun);
|
|
534
|
+
} else {
|
|
535
|
+
this.doExportExcel(_baseUrl, this.myConfig.method, _param,this.myConfig.exportType, _self);
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
zip (str) {
|
|
539
|
+
let binaryString = gzip(str, { to: 'string' });
|
|
540
|
+
return btoa(binaryString);
|
|
541
|
+
},
|
|
542
|
+
asyncExport(_baseUrl,method, _param,afterFun) {
|
|
543
|
+
let self = this;
|
|
544
|
+
self.synchroPost(_baseUrl,method,_param,function(data) {
|
|
545
|
+
if (data.flag === '1') {
|
|
546
|
+
if (afterFun) {
|
|
547
|
+
afterFun();
|
|
548
|
+
} else {
|
|
549
|
+
this.alert('文件正在生成,请稍后');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
},null);
|
|
553
|
+
},
|
|
554
|
+
initAsynExportConfig(columns,headname,newColumns) {
|
|
555
|
+
for (let i = 0; i < columns.length; i++) {
|
|
556
|
+
let column = this.$Method.copy(columns[i]);
|
|
557
|
+
if (column.visible !== false && column.isExport !== false) {
|
|
558
|
+
if (column.name) {
|
|
559
|
+
column.label = headname + column.label;
|
|
560
|
+
newColumns.push(column);
|
|
561
|
+
}
|
|
562
|
+
if (column.children) {
|
|
563
|
+
let culhead = headname + '(' + column.label + ')';
|
|
564
|
+
this.initAsynExportConfig(column.children,culhead,newColumns);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
setRowHighlight(index , flag) {
|
|
570
|
+
if (index > -1) {
|
|
571
|
+
let newRow = Object.assign({},this.data[index],{});
|
|
572
|
+
newRow._highlight = flag;
|
|
573
|
+
this.$nextTick(() => {
|
|
574
|
+
this.data.splice(index,1,newRow);
|
|
575
|
+
this.tempData.splice(index,1,newRow);
|
|
576
|
+
if (!this.myConfig.multiSelect) {
|
|
577
|
+
this.singleData.currentRow = this.$Method.copy(this.data[index]);
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
getSelection() {
|
|
583
|
+
if (this.myConfig.multiSelect === false) {
|
|
584
|
+
if (this.singleData.currentRow) {
|
|
585
|
+
return [this.singleData.currentRow];
|
|
586
|
+
} else {
|
|
587
|
+
return [];
|
|
588
|
+
}
|
|
589
|
+
} else {
|
|
590
|
+
if (this.myConfig.multiSelectGrid) {
|
|
591
|
+
return this.$Method.copy(this.multiSelectData);
|
|
592
|
+
} else {
|
|
593
|
+
return this.$refs.table.getSelection();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
setSelection(data) {
|
|
598
|
+
if (this.myConfig.multiSelectGrid) {
|
|
599
|
+
this.multiSelectData = [];
|
|
600
|
+
this.$nextTick(() => {
|
|
601
|
+
this.multiSelectData = data;
|
|
602
|
+
this.tempMultiSelectData = this.$Method.copy(this.multiSelectData);
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
moveToLeft() {
|
|
607
|
+
let data = this.$refs.multiSelectTable.getSelection();
|
|
608
|
+
if (data && data.length > 0) {
|
|
609
|
+
data.forEach(el => {
|
|
610
|
+
let index = this.multiSelectData.findIndex(el2 => el2[this.myConfig.responseId] === el[this.myConfig.responseId]);
|
|
611
|
+
if (index > -1) {
|
|
612
|
+
this.multiSelectData.splice(index, 1);
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
this.tempMultiSelectData = this.$Method.copy(this.multiSelectData);
|
|
617
|
+
this.rightActive = false;
|
|
618
|
+
},
|
|
619
|
+
moveToRight() {
|
|
620
|
+
let data = this.$refs.table.getSelection();
|
|
621
|
+
if (data && data.length > 0) {
|
|
622
|
+
data.forEach(el => {
|
|
623
|
+
if (this.myConfig.multiCheck) {
|
|
624
|
+
if (this.myConfig.multiCheck(this.multiSelectData, el)) {
|
|
625
|
+
delete el._customIndex;
|
|
626
|
+
delete el._checked;
|
|
627
|
+
this.multiSelectData.push(el);
|
|
628
|
+
}
|
|
629
|
+
} else {
|
|
630
|
+
let index = this.multiSelectData.findIndex(el2 => el2[this.myConfig.responseId] === el[this.myConfig.responseId]);
|
|
631
|
+
if (index === -1) {
|
|
632
|
+
delete el._customIndex;
|
|
633
|
+
delete el._checked;
|
|
634
|
+
this.multiSelectData.push(el);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
this.tempMultiSelectData = this.$Method.copy(this.multiSelectData);
|
|
640
|
+
},
|
|
641
|
+
multiInitColumn () {
|
|
642
|
+
let columns = [];
|
|
643
|
+
let items = this.myConfig.items;
|
|
644
|
+
if (this.myConfig.multiItems) {
|
|
645
|
+
items = this.myConfig.multiItems;
|
|
646
|
+
}
|
|
647
|
+
if (!items || items.length === 0) {
|
|
648
|
+
return columns;
|
|
649
|
+
}
|
|
650
|
+
this.initCheckColumn(columns);
|
|
651
|
+
this.initMultiIndexColumn(columns);
|
|
652
|
+
const length = items.length;
|
|
653
|
+
for (let i = 0; i < length; i++) {
|
|
654
|
+
if (items[i].visible !== false) {
|
|
655
|
+
//this.setColumn(i);
|
|
656
|
+
// 添加复杂列项的支持
|
|
657
|
+
this.initCommonColumn(items[i],columns);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
this.initExpandColumn(columns);
|
|
661
|
+
this.initOperColumn(columns);
|
|
662
|
+
let multiSoltTableColumns = [];
|
|
663
|
+
this.getSoltTableColumns(columns, multiSoltTableColumns);
|
|
664
|
+
this.multiSoltTableColumns = multiSoltTableColumns;
|
|
665
|
+
return columns;
|
|
666
|
+
},
|
|
667
|
+
customClearData() {
|
|
668
|
+
this.multiSelectData = [];
|
|
669
|
+
this.rightActive = false;
|
|
670
|
+
this.leftActive = false;
|
|
671
|
+
if (this.myConfig.dynamicColumnFlag) {
|
|
672
|
+
this.tableColumns = [];
|
|
673
|
+
this.soltTableColumns = [];
|
|
674
|
+
this.newRow = {};
|
|
675
|
+
this.total_summary = {};
|
|
676
|
+
if (this.myConfig.showSummary) {
|
|
677
|
+
Object.assign(this.myConfig,{'showSummary':false});
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
clearCondition() {
|
|
682
|
+
if (this.$refs.condition && this.$refs.condition.clear) {
|
|
683
|
+
this.$refs.condition.clear();
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
clearCurrentRow() {
|
|
687
|
+
if (this.$refs.table) {
|
|
688
|
+
this.$refs.table.clearCurrentRow();
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
delRow(index) {
|
|
692
|
+
this.data.splice(index, 1);
|
|
693
|
+
this.tempData = this.data;
|
|
694
|
+
},
|
|
695
|
+
updataRow(index,para) {
|
|
696
|
+
let row = Object.assign({}, this.data[index], para);
|
|
697
|
+
this.data.splice(index,1,row);
|
|
698
|
+
this.tempData = this.data;
|
|
699
|
+
},
|
|
700
|
+
initMultiIndexColumn(columns) {
|
|
701
|
+
let index = {};
|
|
702
|
+
index.type = 'index';
|
|
703
|
+
index.key = 'index';
|
|
704
|
+
index.width = 45;
|
|
705
|
+
index.title = '行号';
|
|
706
|
+
index.align = 'center';
|
|
707
|
+
columns.push(index);
|
|
708
|
+
},
|
|
709
|
+
makeDynamicColumn() {
|
|
710
|
+
let initData = [];
|
|
711
|
+
this.tableColumns = [];
|
|
712
|
+
this.soltTableColumns = [];
|
|
713
|
+
this.total_summary = {};
|
|
714
|
+
if (this.dynamicInitData && this.dynamicInitData[this.myConfig.response]) {
|
|
715
|
+
initData = this.$Method.copy(this.dynamicInitData[this.myConfig.response]);
|
|
716
|
+
let groupColumns = [];
|
|
717
|
+
groupColumns = this.$Method.copy(this.myConfig.dynameicColumnConfig.groupColumns);
|
|
718
|
+
|
|
719
|
+
let dynameicColumnNames = [];
|
|
720
|
+
if (this.myConfig.dynameicColumnConfig.dynameicColumnName) {
|
|
721
|
+
dynameicColumnNames = this.myConfig.dynameicColumnConfig.dynameicColumnName.split(',');
|
|
722
|
+
}
|
|
723
|
+
let dynameicColumnValue = [];
|
|
724
|
+
if (this.myConfig.dynameicColumnConfig.dynameicColumnValue) {
|
|
725
|
+
dynameicColumnValue = this.myConfig.dynameicColumnConfig.dynameicColumnValue.split(',');
|
|
726
|
+
}
|
|
727
|
+
let dynameicColumnValueTitle = [];
|
|
728
|
+
if (this.myConfig.dynameicColumnConfig.dynameicColumnValueTitle) {
|
|
729
|
+
dynameicColumnValueTitle = this.myConfig.dynameicColumnConfig.dynameicColumnValueTitle.split(',');
|
|
730
|
+
}
|
|
731
|
+
let fatherTemp = [];
|
|
732
|
+
dynameicColumnNames.forEach(el2 => {
|
|
733
|
+
let tmp = {};
|
|
734
|
+
tmp.name = el2;
|
|
735
|
+
fatherTemp.push(tmp);
|
|
736
|
+
});
|
|
737
|
+
let obj = {};
|
|
738
|
+
let endNodes = {};
|
|
739
|
+
let num = 0;
|
|
740
|
+
initData.forEach(el => {
|
|
741
|
+
let groupId = '';
|
|
742
|
+
groupColumns.forEach(el2 => {
|
|
743
|
+
groupId = groupId + el[el2] + '-' ;
|
|
744
|
+
});
|
|
745
|
+
if (groupId) {
|
|
746
|
+
groupId = groupId.substring(0,groupId.length - 1);
|
|
747
|
+
}
|
|
748
|
+
let dyId = '';
|
|
749
|
+
let fatherId = '';
|
|
750
|
+
dynameicColumnNames.forEach((el2,index) => {
|
|
751
|
+
dyId = dyId + el[el2] + '-';
|
|
752
|
+
if (!fatherTemp[index][el[el2]]) {
|
|
753
|
+
fatherTemp[index][el[el2]] = {};
|
|
754
|
+
fatherTemp[index][el[el2]].fatherId = fatherId;
|
|
755
|
+
fatherTemp[index][el[el2]].label=el[el2];
|
|
756
|
+
}
|
|
757
|
+
fatherId = el[el2];
|
|
758
|
+
if (index === dynameicColumnNames.length -1) {
|
|
759
|
+
fatherTemp[index][el[el2]].id = dyId.substring(0,dyId.length - 1);
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
if (dyId) {
|
|
763
|
+
dyId = dyId.substring(0,dyId.length - 1);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (!obj[groupId]) {
|
|
767
|
+
obj[groupId] = {};
|
|
768
|
+
obj[groupId].data = {};
|
|
769
|
+
groupColumns.forEach(el2 => {
|
|
770
|
+
obj[groupId].data[el2] = el[el2];
|
|
771
|
+
});
|
|
772
|
+
obj[groupId].columns = {};
|
|
773
|
+
}
|
|
774
|
+
if (!obj[groupId].columns[dyId]) {
|
|
775
|
+
if (dynameicColumnValue.length > 1) {
|
|
776
|
+
obj[groupId].columns[dyId] = {};
|
|
777
|
+
dynameicColumnValue.forEach(elv => {
|
|
778
|
+
obj[groupId].columns[dyId][elv] = el[elv];
|
|
779
|
+
});
|
|
780
|
+
} else {
|
|
781
|
+
obj[groupId].columns[dyId] = el[this.myConfig.dynameicColumnConfig.dynameicColumnValue];
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
if (!endNodes[dyId]) {
|
|
785
|
+
endNodes[dyId] = {};
|
|
786
|
+
endNodes[dyId].name = 'dy_col_' + num;
|
|
787
|
+
if (dynameicColumnValue.length > 1) {
|
|
788
|
+
endNodes[dyId].sum = {};
|
|
789
|
+
dynameicColumnValue.forEach(elv => {
|
|
790
|
+
endNodes[dyId].sum[elv] = el[elv];
|
|
791
|
+
});
|
|
792
|
+
} else {
|
|
793
|
+
endNodes[dyId].sum = 0;
|
|
794
|
+
}
|
|
795
|
+
num++;
|
|
796
|
+
}
|
|
797
|
+
if (dynameicColumnValue.length > 1) {
|
|
798
|
+
dynameicColumnValue.forEach(elv => {
|
|
799
|
+
endNodes[dyId].sum[elv] = Number(endNodes[dyId].sum[elv]) + Number(el[elv]) ;
|
|
800
|
+
});
|
|
801
|
+
} else {
|
|
802
|
+
endNodes[dyId].sum = Number(endNodes[dyId].sum)+ Number(el[this.myConfig.dynameicColumnConfig.dynameicColumnValue]);
|
|
803
|
+
}
|
|
804
|
+
});
|
|
805
|
+
let data = [];
|
|
806
|
+
for (let pro in obj) {
|
|
807
|
+
let tempData = {};
|
|
808
|
+
Object.assign(tempData, obj[pro].data);
|
|
809
|
+
let dynamic_sum = 0;
|
|
810
|
+
for (let pro2 in endNodes) {
|
|
811
|
+
if (dynameicColumnValue.length > 1) {
|
|
812
|
+
if (obj[pro].columns[pro2] !== undefined) {
|
|
813
|
+
dynameicColumnValue.forEach(el => {
|
|
814
|
+
let tmpname = endNodes[pro2].name + '_' +el;
|
|
815
|
+
tempData[tmpname] = obj[pro].columns[pro2][el];
|
|
816
|
+
dynamic_sum = dynamic_sum + Number(tempData[tmpname]);
|
|
817
|
+
});
|
|
818
|
+
} else {
|
|
819
|
+
dynameicColumnValue.forEach(el => {
|
|
820
|
+
let tmpname = endNodes[pro2].name + '_' +el;
|
|
821
|
+
tempData[tmpname] = 0;
|
|
822
|
+
dynamic_sum = dynamic_sum + Number(tempData[tmpname]);
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
} else {
|
|
826
|
+
if (obj[pro].columns[pro2] !== undefined) {
|
|
827
|
+
tempData[endNodes[pro2].name] = obj[pro].columns[pro2];
|
|
828
|
+
dynamic_sum = dynamic_sum + Number(tempData[endNodes[pro2].name]);
|
|
829
|
+
} else {
|
|
830
|
+
tempData[endNodes[pro2].name] = 0;
|
|
831
|
+
dynamic_sum = dynamic_sum + Number(tempData[endNodes[pro2].name]);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
tempData.dynamic_sum = dynamic_sum;
|
|
836
|
+
data.push(tempData);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
let columnsList = [];
|
|
840
|
+
this.makeDynamicColumnConfig(fatherTemp, 0, '', columnsList, endNodes,dynameicColumnValue,dynameicColumnValueTitle);
|
|
841
|
+
|
|
842
|
+
let temp = {};
|
|
843
|
+
if (this.myConfig.dynameicColumnConfig.dynameicColumnSumLable) {
|
|
844
|
+
temp.label = this.myConfig.dynameicColumnConfig.dynameicColumnSumLable;
|
|
845
|
+
} else {
|
|
846
|
+
temp.label = '动态合计';
|
|
847
|
+
}
|
|
848
|
+
temp.type='NumberBox';
|
|
849
|
+
temp.contentAlign = 'right';
|
|
850
|
+
temp.summary = true;
|
|
851
|
+
temp.name = 'dynamic_sum';
|
|
852
|
+
let width = this.$Method.getTextWidth(temp.label);
|
|
853
|
+
temp.width = width;
|
|
854
|
+
Object.assign(temp, this.myConfig.dynameicColumnConfig.dynameicColumnValuePro);
|
|
855
|
+
columnsList.push(temp);
|
|
856
|
+
let tableColumns = this.myConfig.items.concat(columnsList);
|
|
857
|
+
this.dynamicColumnConfig = this.$Method.copy(tableColumns);
|
|
858
|
+
this.initDynamicColumn(tableColumns);
|
|
859
|
+
let total_summary = {};
|
|
860
|
+
let dynamic_sum = 0;
|
|
861
|
+
for (let pro in endNodes) {
|
|
862
|
+
if (dynameicColumnValue.length > 1) {
|
|
863
|
+
dynameicColumnValue.forEach(el => {
|
|
864
|
+
let tmpName =endNodes[pro].name + '_' + el;
|
|
865
|
+
total_summary[tmpName] = endNodes[pro].sum[el];
|
|
866
|
+
dynamic_sum = dynamic_sum + Number(endNodes[pro].sum[el]);
|
|
867
|
+
});
|
|
868
|
+
} else {
|
|
869
|
+
total_summary[endNodes[pro].name] = endNodes[pro].sum;
|
|
870
|
+
dynamic_sum = dynamic_sum + Number(endNodes[pro].sum);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
total_summary.dynamic_sum = dynamic_sum;
|
|
874
|
+
|
|
875
|
+
let summaryColumn = [];
|
|
876
|
+
this.summaryColumn.forEach(el => {
|
|
877
|
+
if (total_summary[el] === undefined) {
|
|
878
|
+
summaryColumn.push(el);
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
if (summaryColumn.length > 0) {
|
|
882
|
+
data.forEach(el => {
|
|
883
|
+
summaryColumn.forEach(el2 => {
|
|
884
|
+
if (!total_summary[el2]) {
|
|
885
|
+
total_summary[el2] = 0;
|
|
886
|
+
}
|
|
887
|
+
total_summary[el2] = total_summary[el2] + Number(el[el2]);
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
this.data = data;
|
|
892
|
+
this.tempData = this.$Method.copy(data);
|
|
893
|
+
this.total_summary = Object.assign({}, {}, total_summary);
|
|
894
|
+
if (!this.myConfig.showSummary) {
|
|
895
|
+
Object.assign(this.myConfig,{'showSummary':true});
|
|
896
|
+
}
|
|
897
|
+
} else {
|
|
898
|
+
if (this.myConfig.showSummary) {
|
|
899
|
+
Object.assign(this.myConfig,{'showSummary':false});
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
initDynamicColumn(tableColumns) {
|
|
904
|
+
let newRow = {};
|
|
905
|
+
let summaryColumn = [];
|
|
906
|
+
let columns = [];
|
|
907
|
+
this.initCheckColumn(columns);
|
|
908
|
+
this.initOperColumn(columns);
|
|
909
|
+
this.initIndexColumn(columns);
|
|
910
|
+
const length = tableColumns.length;
|
|
911
|
+
for (let i = 0; i < length; i++) {
|
|
912
|
+
if (tableColumns[i].visible !== false) {
|
|
913
|
+
//this.setColumn(i);
|
|
914
|
+
// 添加复杂列项的支持
|
|
915
|
+
this.initCommonColumn(tableColumns[i],columns,summaryColumn,newRow);
|
|
916
|
+
} else {
|
|
917
|
+
if (tableColumns[i].defaultValue !== undefined) {
|
|
918
|
+
if (tableColumns[i].name) {
|
|
919
|
+
newRow[tableColumns[i].name] = tableColumns[i].defaultValue;
|
|
920
|
+
}
|
|
921
|
+
if (tableColumns[i].sname) {
|
|
922
|
+
newRow[tableColumns[i].sname] = tableColumns[i].defaultValue;
|
|
923
|
+
}
|
|
924
|
+
if (tableColumns[i].ename) {
|
|
925
|
+
newRow[tableColumns[i].ename] = tableColumns[i].defaultValue;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
this.total_summary = {};
|
|
931
|
+
this.newRow = deepCopy(newRow);
|
|
932
|
+
summaryColumn.push('dynamic_sum');
|
|
933
|
+
this.summaryColumn = deepCopy(summaryColumn);
|
|
934
|
+
this.tableColumns = deepCopy(columns);
|
|
935
|
+
let soltTableColumns = [];
|
|
936
|
+
this.getSoltTableColumns(columns,soltTableColumns);
|
|
937
|
+
this.soltTableColumns = soltTableColumns;
|
|
938
|
+
this.dynamicColumnItems = tableColumns;
|
|
939
|
+
},
|
|
940
|
+
makeDynamicColumnConfig (fatherTemp, index, id, items, endNodes,dynameicColumnValue,dynameicColumnValueTitle) {
|
|
941
|
+
let fahter = fatherTemp[index];
|
|
942
|
+
if (index === fatherTemp.length -1) {
|
|
943
|
+
for (let pro in fahter) {
|
|
944
|
+
if (pro === 'name') {
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
let temp = {};
|
|
948
|
+
temp.label = fahter[pro].label;
|
|
949
|
+
if (dynameicColumnValue.length > 1) {
|
|
950
|
+
temp.align = 'center';
|
|
951
|
+
temp.children = [];
|
|
952
|
+
dynameicColumnValue.forEach((el,index) => {
|
|
953
|
+
let temp2 = {};
|
|
954
|
+
temp2.type='NumberBox';
|
|
955
|
+
temp2.align = 'center';
|
|
956
|
+
temp2.contentAlign = 'right';
|
|
957
|
+
temp2.summary = true;
|
|
958
|
+
Object.assign(temp2, this.myConfig.dynameicColumnConfig.dynameicColumnValuePro);
|
|
959
|
+
temp2.label = dynameicColumnValueTitle[index];
|
|
960
|
+
let width = this.$Method.getTextWidth(temp2.label);
|
|
961
|
+
temp2.width = width;
|
|
962
|
+
temp2.name = endNodes[fahter[pro].id].name + '_' + el;
|
|
963
|
+
temp.children.push(temp2);
|
|
964
|
+
});
|
|
965
|
+
} else {
|
|
966
|
+
temp.type='NumberBox';
|
|
967
|
+
temp.align = 'center';
|
|
968
|
+
temp.contentAlign = 'right';
|
|
969
|
+
temp.summary = true;
|
|
970
|
+
let width = this.$Method.getTextWidth(temp.label);
|
|
971
|
+
temp.width = width;
|
|
972
|
+
if (endNodes[fahter[pro].id]) {
|
|
973
|
+
temp.name = endNodes[fahter[pro].id].name;
|
|
974
|
+
}
|
|
975
|
+
Object.assign(temp, this.myConfig.dynameicColumnConfig.dynameicColumnValuePro);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (id) {
|
|
979
|
+
if (fahter[pro].fatherId === id) {
|
|
980
|
+
items.push(temp);
|
|
981
|
+
items.sort((a, b) => {
|
|
982
|
+
return a > b;
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
} else {
|
|
986
|
+
items.push(temp);
|
|
987
|
+
items.sort((a, b) => {
|
|
988
|
+
return a > b;
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
} else {
|
|
994
|
+
for (let pro in fahter) {
|
|
995
|
+
if (pro === 'name') {
|
|
996
|
+
continue;
|
|
997
|
+
}
|
|
998
|
+
let temp = {};
|
|
999
|
+
temp.label = fahter[pro].label;
|
|
1000
|
+
temp.align = 'center';
|
|
1001
|
+
if (id) {
|
|
1002
|
+
if (fahter[pro].fatherId === id) {
|
|
1003
|
+
temp.children = [];
|
|
1004
|
+
this.makeDynamicColumnConfig(fatherTemp, index+1, pro, temp.children, endNodes,dynameicColumnValue,dynameicColumnValueTitle);
|
|
1005
|
+
items.push(temp);
|
|
1006
|
+
items.sort((a, b) => {
|
|
1007
|
+
return a > b;
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
} else {
|
|
1011
|
+
temp.children = [];
|
|
1012
|
+
this.makeDynamicColumnConfig(fatherTemp, index+1, pro, temp.children, endNodes,dynameicColumnValue,dynameicColumnValueTitle);
|
|
1013
|
+
items.push(temp);
|
|
1014
|
+
items.sort((a, b) => {
|
|
1015
|
+
return a > b;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
handleSummary({ columns }) {
|
|
1024
|
+
let sums = {};
|
|
1025
|
+
for (let tmp in this.newRow) {
|
|
1026
|
+
sums[tmp]={key:tmp,value:''};
|
|
1027
|
+
}
|
|
1028
|
+
let index = columns.findIndex(el => el.type === 'index');
|
|
1029
|
+
if (index > -1) {
|
|
1030
|
+
sums.index = {key:'index',value:''};
|
|
1031
|
+
}
|
|
1032
|
+
let index2 = columns.findIndex(el => el.type === 'selection');
|
|
1033
|
+
if (index2 > -1) {
|
|
1034
|
+
sums.selection = {key:'selection',value:''};
|
|
1035
|
+
}
|
|
1036
|
+
let items = [];
|
|
1037
|
+
if (this.myConfig.dynamicColumnFlag) {
|
|
1038
|
+
items = this.dynamicColumnItems;
|
|
1039
|
+
} else {
|
|
1040
|
+
items = this.config.items;
|
|
1041
|
+
}
|
|
1042
|
+
for (let pro in this.total_summary) {
|
|
1043
|
+
let configItems = {};
|
|
1044
|
+
this.findItemByName(items, pro, configItems);
|
|
1045
|
+
if (configItems.name) {
|
|
1046
|
+
let tmpValue = this.total_summary[pro];
|
|
1047
|
+
if (configItems.format !== undefined) {
|
|
1048
|
+
tmpValue = this.$Method.formatNumber(tmpValue,configItems.format,configItems.notzero);
|
|
1049
|
+
}
|
|
1050
|
+
sums[pro]={key:pro,value:tmpValue};
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
let firstkey = this.findFirst(columns);
|
|
1054
|
+
sums[firstkey] = {key:firstkey,value:this.myConfig.sumText};
|
|
1055
|
+
if (this.myConfig.customSummary){
|
|
1056
|
+
return this.myConfig.customSummary(sums);
|
|
1057
|
+
} else {
|
|
1058
|
+
return sums;
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
findFirst(columns) {
|
|
1062
|
+
let key = '';
|
|
1063
|
+
columns.some(el => {
|
|
1064
|
+
if (el.key !== 'selection' && el.key !== 'index' && el.key !== 'sumindex') {
|
|
1065
|
+
key = el.name;
|
|
1066
|
+
return true;
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
return key;
|
|
1070
|
+
},
|
|
1071
|
+
findItemByName(items, name, config) {
|
|
1072
|
+
if (items instanceof Array) {
|
|
1073
|
+
let flag = false;
|
|
1074
|
+
items.some(el => {
|
|
1075
|
+
if (el.children && el.children.length > 0) {
|
|
1076
|
+
flag = this.findItemByName(el.children, name, config);
|
|
1077
|
+
if (flag) {
|
|
1078
|
+
return true;
|
|
1079
|
+
}
|
|
1080
|
+
} else {
|
|
1081
|
+
if (el.name) {
|
|
1082
|
+
if (el.name === name) {
|
|
1083
|
+
Object.assign(config, el);
|
|
1084
|
+
flag = true;
|
|
1085
|
+
return true;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
return flag;
|
|
1091
|
+
} else {
|
|
1092
|
+
if (items.name) {
|
|
1093
|
+
if (items.name === name) {
|
|
1094
|
+
Object.assign(config, items);
|
|
1095
|
+
return true;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return false;
|
|
1100
|
+
},
|
|
1101
|
+
dynamicExportExcel() {
|
|
1102
|
+
let dynameicColumnNames = [];
|
|
1103
|
+
if (this.myConfig.dynameicColumnConfig.dynameicColumnName) {
|
|
1104
|
+
dynameicColumnNames = this.myConfig.dynameicColumnConfig.dynameicColumnName.split(',');
|
|
1105
|
+
}
|
|
1106
|
+
let headNum = dynameicColumnNames.length;
|
|
1107
|
+
let modulecode = this.$Method.getUrlParam('modulecode');
|
|
1108
|
+
if (!modulecode) {
|
|
1109
|
+
modulecode = this.$Method.getUrlParam('billmoduleid');
|
|
1110
|
+
}
|
|
1111
|
+
let fileName = this.$Method.formatDate(new Date(),'yyyyMMddhhmmss') +'(合计' + this.data.length+'条).xlsx';
|
|
1112
|
+
if (modulecode) {
|
|
1113
|
+
fileName = modulecode + '_' + fileName;
|
|
1114
|
+
}
|
|
1115
|
+
let tmpData = this.$Method.copy(this.data);
|
|
1116
|
+
this.dynamicColumnConfig.forEach(el => {
|
|
1117
|
+
if (el.type === 'ComboBox') {
|
|
1118
|
+
let valueField = 'code';
|
|
1119
|
+
let textField = 'name'
|
|
1120
|
+
if (el.valueField) {
|
|
1121
|
+
valueField = column.valueField;
|
|
1122
|
+
}
|
|
1123
|
+
if (el.textField) {
|
|
1124
|
+
textField = column.textField;
|
|
1125
|
+
}
|
|
1126
|
+
tmpData.forEach(el2 => {
|
|
1127
|
+
if (el2[el.name]) {
|
|
1128
|
+
if (el.data) {
|
|
1129
|
+
let index = el.data.findIndex(el3 => el3[valueField] === el2[el.name]);
|
|
1130
|
+
if (index > -1) {
|
|
1131
|
+
if (el.codeWithName === false) {
|
|
1132
|
+
el2[el.name] = el.data[index][textField];
|
|
1133
|
+
} else {
|
|
1134
|
+
el2[el.name] = '[' + el.data[index][valueField] + ']' + el.data[index][textField];
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
let newConfig = [];
|
|
1143
|
+
this.initAsynExportConfig(this.dynamicColumnConfig,'',newConfig);
|
|
1144
|
+
this.$Method.exportExcelStyle(newConfig,tmpData,headNum,fileName);
|
|
1145
|
+
},
|
|
1146
|
+
formatValue(index, column) {
|
|
1147
|
+
let value = '';
|
|
1148
|
+
let row = this.$Method.copy(this.tempData[index]);
|
|
1149
|
+
if (column.name) {
|
|
1150
|
+
value = row[column.name];
|
|
1151
|
+
}
|
|
1152
|
+
let config = column;
|
|
1153
|
+
let valueFormat = this.$Method.formatValue(value, row, config);
|
|
1154
|
+
let obj = {};
|
|
1155
|
+
obj.value = value;
|
|
1156
|
+
obj.row = row;
|
|
1157
|
+
obj.config = config;
|
|
1158
|
+
obj.valueFormat = valueFormat;
|
|
1159
|
+
if (column.formatValue) {
|
|
1160
|
+
return column.formatValue(obj);
|
|
1161
|
+
} else if (this.myConfig.formatValue) {
|
|
1162
|
+
return this.myConfig.formatValue(obj);
|
|
1163
|
+
} else {
|
|
1164
|
+
return valueFormat;
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
formatMulValue(index, column) {
|
|
1168
|
+
let value = '';
|
|
1169
|
+
let row = this.$Method.copy(this.tempMultiSelectData[index]);
|
|
1170
|
+
if (column.name) {
|
|
1171
|
+
value = row[column.name];
|
|
1172
|
+
}
|
|
1173
|
+
let config = column;
|
|
1174
|
+
return this.$Method.formatValue(value, row, config);
|
|
1175
|
+
},
|
|
1176
|
+
setCustomColumn(column) {
|
|
1177
|
+
column.slot = column.key;
|
|
1178
|
+
},
|
|
1179
|
+
onLinkTo(obj) {
|
|
1180
|
+
const column = this.findColumnConfig (obj.name,this.myConfig.items);
|
|
1181
|
+
this.addRowInfo(obj, column);
|
|
1182
|
+
return column.onLinkTo(obj);
|
|
1183
|
+
},
|
|
1184
|
+
addRowInfo(obj, column) {
|
|
1185
|
+
let index = obj.rowIndex;
|
|
1186
|
+
obj.rowinfo = {};
|
|
1187
|
+
obj.rowinfo.column = column;
|
|
1188
|
+
obj.rowinfo.index = index;
|
|
1189
|
+
if (index > -1) {
|
|
1190
|
+
obj.rowinfo.row = this.data[index];
|
|
1191
|
+
}
|
|
1192
|
+
let that = this;
|
|
1193
|
+
obj.rowinfo.gridObject = that;
|
|
1194
|
+
},
|
|
1195
|
+
doSumgroups(data,Sumgroups) {
|
|
1196
|
+
let tmp = [];
|
|
1197
|
+
Sumgroups.forEach(el => {
|
|
1198
|
+
if (el.data && el.data.length > 0) {
|
|
1199
|
+
let groupstr = el.group.split(',');
|
|
1200
|
+
let culkey='';
|
|
1201
|
+
let key = '';
|
|
1202
|
+
data.forEach((el2,index) => {
|
|
1203
|
+
key = '';
|
|
1204
|
+
groupstr.forEach(el3 => {
|
|
1205
|
+
key = key + el2[el3];
|
|
1206
|
+
});
|
|
1207
|
+
if (!culkey) {
|
|
1208
|
+
culkey = key;
|
|
1209
|
+
}
|
|
1210
|
+
if (culkey !== key) {
|
|
1211
|
+
let sumdata = el.data.find(el4 => {
|
|
1212
|
+
let key2 = '';
|
|
1213
|
+
groupstr.forEach(el5 => {
|
|
1214
|
+
key2 = key2 + el4[el5];
|
|
1215
|
+
});
|
|
1216
|
+
return key2 === culkey;
|
|
1217
|
+
});
|
|
1218
|
+
let tmpObj = {};
|
|
1219
|
+
tmpObj.index = index;
|
|
1220
|
+
tmpObj.sum = sumdata;
|
|
1221
|
+
if (el.showgroup) {
|
|
1222
|
+
let showgroup = el.showgroup.split(',');
|
|
1223
|
+
tmpObj.showgroup = showgroup;
|
|
1224
|
+
}
|
|
1225
|
+
tmpObj.group = groupstr;
|
|
1226
|
+
tmp.push(tmpObj);
|
|
1227
|
+
culkey = key;
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
if (tmp.length > 0) {
|
|
1233
|
+
let tmpData = [];
|
|
1234
|
+
data.forEach((el,index) => {
|
|
1235
|
+
let sumindex = index + 1;
|
|
1236
|
+
if (this.myConfig.showPage) {
|
|
1237
|
+
sumindex = sumindex + (this.myConfig.pageConfig.page_no - 1) * this.myConfig.pageConfig.page_size;
|
|
1238
|
+
}
|
|
1239
|
+
el.sumindex = sumindex + '';
|
|
1240
|
+
let tmpObj = tmp.find(el2 => el2.index === index);
|
|
1241
|
+
if (tmpObj) {
|
|
1242
|
+
if (this.myConfig.customSummaryGroup){
|
|
1243
|
+
tmpObj = this.myConfig.customSummaryGroup(tmpObj);
|
|
1244
|
+
}
|
|
1245
|
+
if (tmpObj.showgroup) {
|
|
1246
|
+
tmpObj.group.forEach(el2 => {
|
|
1247
|
+
let tmpIndex = tmpObj.showgroup.findIndex(el3 => el2 === el3);
|
|
1248
|
+
if (tmpIndex === -1) {
|
|
1249
|
+
tmpObj.sum[el2] = '';
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
tmpObj.sum.sumindex = '';
|
|
1254
|
+
tmpData.push(tmpObj.sum);
|
|
1255
|
+
tmpData.push(el);
|
|
1256
|
+
} else {
|
|
1257
|
+
tmpData.push(el);
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
return tmpData;
|
|
1261
|
+
} else {
|
|
1262
|
+
return data;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
mounted () {
|
|
1267
|
+
this.observer = elementResizeDetectorMaker();
|
|
1268
|
+
if (this.$refs.head) {
|
|
1269
|
+
this.observer.listenTo(this.$refs.head, this.setExtraHeight);
|
|
1270
|
+
}
|
|
1271
|
+
if (this.$refs.page) {
|
|
1272
|
+
this.observer.listenTo(this.$refs.page, this.setExtraHeight);
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
beforeUnmount() {
|
|
1276
|
+
if (this.$refs.head) {
|
|
1277
|
+
this.observer.removeListener(this.$refs.head, this.setExtraHeight);
|
|
1278
|
+
}
|
|
1279
|
+
if (this.$refs.page) {
|
|
1280
|
+
this.observer.removeListener(this.$refs.page, this.setExtraHeight);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
</script>
|