ocpview-plus 1.3.15 → 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.
- package/README.md +55 -43
- package/dist/ocpviewplus.min.esm.js +574 -482
- package/dist/ocpviewplus.min.js +9 -9
- package/dist/style.css +1 -1
- package/dist/styles/efviewplus.css +1 -1
- package/package.json +146 -146
- package/src/components/base/ContractPrintMixins.js +30 -30
- package/src/components/base/controlbase.vue +190 -190
- package/src/components/base/controlbox.vue +102 -102
- package/src/components/base/index.js +2 -2
- package/src/components/base/load.js +19 -19
- package/src/components/base/probase.js +220 -220
- package/src/components/base/size.js +78 -78
- package/src/components/billbox/billbox.vue +67 -67
- package/src/components/billbox/index.js +1 -1
- package/src/components/cascaderbox/cascaderbox.vue +184 -184
- package/src/components/cascaderbox/index.js +2 -2
- package/src/components/checkbox/checkbox.vue +75 -75
- package/src/components/checkbox/checkgroupbox.vue +103 -103
- package/src/components/checkbox/index.js +2 -2
- package/src/components/colorbox/colorbox.vue +43 -43
- package/src/components/colorbox/index.js +1 -1
- package/src/components/combobox/combobox.vue +219 -219
- package/src/components/combobox/index.js +1 -1
- package/src/components/conditionbox/conditionbase.vue +194 -194
- package/src/components/conditionbox/conditionbox.vue +62 -62
- package/src/components/conditionbox/conditionfilterbox.vue +479 -479
- package/src/components/conditionbox/conditionselectorbox.vue +237 -237
- package/src/components/conditionbox/index.js +4 -4
- package/src/components/conditionbox/queryconditionbox.vue +25 -25
- package/src/components/conditionbox/queryconditionboxbase.vue +123 -123
- package/src/components/conditionbox/searchconditionbox.vue +113 -113
- package/src/components/conditionbox/searchgrid.vue +391 -391
- package/src/components/datebox/DateBoxV1.vue +22 -22
- package/src/components/datebox/datebox.vue +129 -129
- package/src/components/datebox/daterangebox.vue +154 -154
- package/src/components/datebox/index.js +5 -5
- package/src/components/form/baseform.vue +676 -676
- package/src/components/form/detailsbox.vue +487 -487
- package/src/components/form/formbox.vue +28 -28
- package/src/components/form/formcardbox.vue +267 -267
- package/src/components/form/formcardbox2.vue +228 -228
- package/src/components/form/formcardgroupbox.vue +251 -251
- package/src/components/form/formcompro.js +18 -18
- package/src/components/form/formdetail.vue +128 -128
- package/src/components/form/formdetailtwo.vue +302 -302
- package/src/components/form/index.js +9 -9
- package/src/components/form/toolanchor.js +45 -45
- package/src/components/form/workform.vue +167 -167
- package/src/components/grid/basegrid.vue +1062 -1062
- package/src/components/grid/editgrid.vue +51 -51
- package/src/components/grid/editgridbase.vue +1062 -1062
- package/src/components/grid/editgridcard.vue +193 -193
- package/src/components/grid/expandrow.vue +137 -137
- package/src/components/grid/index.js +5 -5
- package/src/components/grid/viewgrid.vue +121 -121
- package/src/components/grid/viewgridbase.vue +1286 -1286
- package/src/components/icon/common-icon.vue +53 -53
- package/src/components/icon/eicon.vue +28 -28
- package/src/components/icon/icons.vue +42 -42
- package/src/components/icon/index.js +1 -1
- package/src/components/label/index.js +2 -2
- package/src/components/label/showtext.vue +94 -94
- package/src/components/load/loadcartoon.vue +227 -227
- package/src/components/map/index.js +1 -1
- package/src/components/map/mapbox.vue +348 -348
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanel.vue +184 -184
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTable.vue +838 -838
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlbox.vue +126 -126
- package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlboxNumberbox.vue +27 -27
- package/src/components/masterplate/RewriteBillListDetails/BillListPanel.vue +126 -126
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelQueryBar.vue +280 -280
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +346 -346
- package/src/components/masterplate/RewriteBillListDetails/index.vue +325 -325
- package/src/components/masterplate/RewriteBillListDetails/mixins/useVxeGridEditTypeKeydownEventHook.js +251 -251
- package/src/components/masterplate/RewriteListdetails/BillListPanelV2.vue +115 -115
- package/src/components/masterplate/RewriteListdetails/BillListPanelV2QueryBar.vue +24 -24
- package/src/components/masterplate/RewriteListdetails/BillListPanelV3.vue +121 -121
- package/src/components/masterplate/RewriteListdetails/BillListPanelV3QueryBar.vue +275 -275
- package/src/components/masterplate/RewriteListdetails/indexV2.vue +320 -320
- package/src/components/masterplate/RewriteListdetails/indexV3.vue +331 -331
- package/src/components/masterplate/appendix.vue +586 -586
- package/src/components/masterplate/approval.vue +863 -863
- package/src/components/masterplate/base.vue +1028 -1028
- package/src/components/masterplate/billasyncimport.vue +614 -614
- package/src/components/masterplate/billconditionbox.vue +223 -223
- package/src/components/masterplate/billconditionsbox.vue +427 -427
- package/src/components/masterplate/billdetailform.vue +1028 -1028
- package/src/components/masterplate/billimport.vue +301 -301
- package/src/components/masterplate/billquerygrid.vue +391 -391
- package/src/components/masterplate/billsinglegrid.vue +234 -234
- package/src/components/masterplate/birtreport.vue +185 -185
- package/src/components/masterplate/contractappendix.vue +688 -688
- package/src/components/masterplate/detailbtntoolbar.vue +311 -311
- package/src/components/masterplate/detailsbox.vue +386 -386
- package/src/components/masterplate/editgridcard.vue +292 -292
- package/src/components/masterplate/editgridcard2.vue +127 -127
- package/src/components/masterplate/formcard.vue +105 -105
- package/src/components/masterplate/formcardgroupbox.vue +167 -167
- package/src/components/masterplate/formdetailtwo.vue +366 -366
- package/src/components/masterplate/gridcolset.vue +226 -226
- package/src/components/masterplate/index.js +54 -54
- package/src/components/masterplate/layouttemplate.vue +51 -51
- package/src/components/masterplate/leftlistrightdetails.vue +581 -581
- package/src/components/masterplate/leftlistrightlist.vue +464 -464
- package/src/components/masterplate/lefttreerightdetails.vue +636 -636
- package/src/components/masterplate/levelreport.vue +510 -510
- package/src/components/masterplate/listbtntoolbar.vue +276 -276
- package/src/components/masterplate/listdetails.vue +768 -768
- package/src/components/masterplate/operlog.vue +272 -272
- package/src/components/masterplate/options.vue +110 -110
- package/src/components/masterplate/page.vue +102 -102
- package/src/components/masterplate/promptmessage.vue +73 -73
- package/src/components/masterplate/querybar.vue +490 -490
- package/src/components/masterplate/report.vue +357 -357
- package/src/components/masterplate/rowbtntoolbar.vue +126 -126
- package/src/components/masterplate/simpletree.vue +137 -137
- package/src/components/masterplate/simpleviewgrid.vue +144 -144
- package/src/components/mychart/bar/bar.vue +201 -201
- package/src/components/mychart/basechart.vue +190 -190
- package/src/components/mychart/complexmychart/barline.vue +153 -153
- package/src/components/mychart/gauge/gauge.vue +82 -82
- package/src/components/mychart/index.js +8 -8
- package/src/components/mychart/line/line.vue +201 -201
- package/src/components/mychart/liquidfill/liquidfill.vue +108 -108
- package/src/components/mychart/pie/pie.vue +95 -95
- package/src/components/mychart/radar/radar.vue +121 -121
- package/src/components/mychart/scatter/scatter.vue +75 -75
- package/src/components/numberbox/NumberBoxV1.vue +39 -39
- package/src/components/numberbox/append.js +11 -11
- package/src/components/numberbox/index.js +4 -4
- package/src/components/numberbox/numberbox.vue +302 -302
- package/src/components/numberbox/numberrangebox.vue +422 -422
- package/src/components/picturebox/filebox.vue +369 -369
- package/src/components/picturebox/index.js +2 -2
- package/src/components/picturebox/picturebox.vue +541 -541
- package/src/components/picturebox/uploadbox.vue +164 -164
- package/src/components/poptagbox/index.js +1 -1
- package/src/components/poptagbox/poptagbox.vue +388 -388
- package/src/components/poptextbox/index.js +1 -1
- package/src/components/poptextbox/poptextbox.vue +624 -624
- package/src/components/radiobox/index.js +1 -1
- package/src/components/radiobox/radiogroupbox.vue +75 -75
- package/src/components/richtextbox/editor.vue +150 -150
- package/src/components/richtextbox/index.js +1 -1
- package/src/components/richtextbox/richtextbox.vue +448 -448
- package/src/components/textbox/index.js +1 -1
- package/src/components/textbox/textbox.vue +97 -97
- package/src/components/timebox/index.js +1 -1
- package/src/components/timebox/timebox.vue +75 -75
- package/src/components/toolbar/ebutton.vue +169 -169
- package/src/components/toolbar/index.js +3 -3
- package/src/components/toolbar/toolbar.vue +445 -445
- package/src/components/tree/CompatTree.vue +297 -297
- package/src/components/tree/basetree.vue +1098 -1098
- package/src/components/tree/index.js +2 -2
- package/src/components/tree/treedata.vue +53 -53
- package/src/components/tree/treedatabase.vue +189 -189
- package/src/components/upload/billimport.vue +233 -233
- package/src/components/upload/index.js +1 -1
- package/src/components/videobox/index.js +1 -1
- package/src/components/videobox/uploadbox.vue +148 -148
- package/src/components/videobox/videobox.vue +503 -503
- package/src/components/wrichtextbox/editor.vue +219 -219
- package/src/components/wrichtextbox/index.js +1 -1
- package/src/components/wrichtextbox/wrichtextbox.vue +62 -62
- package/src/index.js +231 -231
- package/src/locale/format.js +51 -51
- package/src/locale/index.js +63 -63
- package/src/locale/lang/zh-CN.js +123 -123
- package/src/locale/lang/zh-TW.js +114 -114
- package/src/locale/lang/zh-UG.js +115 -115
- package/src/locale/lang.js +15 -15
- package/src/method/case/case.js +1274 -1274
- package/src/method/config/queryconfig.js +24 -24
- package/src/method/const/const.js +815 -815
- package/src/method/index.js +7 -7
- package/src/plugins/theme/theme-variable.css +114 -114
- package/src/plugins/vxeTable/index.js +241 -241
- package/src/plugins/vxeTable/renderer/components/TableFilterInput.vue +51 -51
- package/src/plugins/vxeTable/renderer/filter.js +32 -32
- package/src/static/excel/exportexcel.js +626 -626
- package/src/static/iview/coustom.js +462 -462
- package/src/store/index.js +18 -18
- package/src/store/modules/app.js +53 -53
- package/src/styles/README.md +3 -3
- package/src/styles/common.less +80 -80
- package/src/styles/components/anchor.less +74 -74
- package/src/styles/components/approval.less +135 -135
- package/src/styles/components/button.less +208 -208
- package/src/styles/components/card.less +51 -51
- package/src/styles/components/content.less +38 -38
- package/src/styles/components/font.less +313 -313
- package/src/styles/components/form.less +71 -71
- package/src/styles/components/iconfont/fonts/iconfont.less +1384 -1384
- package/src/styles/components/iconfont/fonts/iconfont.svg +703 -703
- package/src/styles/components/index.less +16 -16
- package/src/styles/components/input.less +290 -290
- package/src/styles/components/modal.less +203 -203
- package/src/styles/components/page.less +340 -340
- package/src/styles/components/select.less +361 -361
- package/src/styles/components/steps.less +367 -367
- package/src/styles/components/table.less +544 -544
- package/src/styles/components/tabs.less +249 -249
- package/src/styles/components/upload.less +82 -82
- package/src/styles/custom.less +67 -67
- package/src/styles/index.less +6 -6
- package/src/styles/pack.less +6 -6
- package/src/utils/EfuMessenger.js +155 -155
- package/src/utils/assist.js +353 -353
- package/src/utils/index.js +1 -1
- package/src/utils/random_str.js +10 -10
- package/src/components/masterplate/detailgridbox.vue +0 -386
|
@@ -1,465 +1,465 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :style="'background:#fff;overflow: hidden;height:' + clientHeight +'px'">
|
|
3
|
-
<div ref="head">
|
|
4
|
-
<Card :padding="0" style="padding-top:14px;padding-left:16px;padding-right:16px;border-radius:0px;" :bordered="false" dis-hover>
|
|
5
|
-
<ListBtnToolbar ref="menutoolbar" :config="menuToolbar" :moduleMethod="moduleMethod" @doAction="doAction"/>
|
|
6
|
-
<Divider style="margin-top:16px;margin-bottom:0px;" />
|
|
7
|
-
</Card>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="efuture-demo-split" :style="'height:' + clientHeight2 +'px'">
|
|
10
|
-
<Split v-model="myConfig.splitNum">
|
|
11
|
-
<template #left>
|
|
12
|
-
<div class="efuture-demo-split-pane" style="padding:14px 16px;">
|
|
13
|
-
<Card :padding="0" :bordered="false" dis-hover >
|
|
14
|
-
<p style="margin-bottom:10px;">
|
|
15
|
-
<span class="efuture-title-verticalline"/> <span style="font-size: 14px;font-weight:bold" v-text="myConfig.gridtitle" />
|
|
16
|
-
</p>
|
|
17
|
-
<div ref="para">
|
|
18
|
-
<Input :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 98%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
|
|
19
|
-
</div>
|
|
20
|
-
<SimpleViewGrid ref="grid" :config="myConfig.gridConfig" :dictData="dictData" @rowclick="gridClick"/>
|
|
21
|
-
</Card>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
<template #right>
|
|
25
|
-
<div class="efuture-demo-split-pane" style="padding:14px 16px;">
|
|
26
|
-
<Card v-for="tmp in myConfig.detailGridsConfig" :key="'detail_' + tmp.name" v-show="showDetail[tmp.name]" :padding="0" style="padding-left:6px;" :bordered="false" dis-hover >
|
|
27
|
-
<EditGridCardS :ref="tmp.name" :config="tmp" :dictData="dictData" style="padding-bottom:10px" />
|
|
28
|
-
</Card>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
</Split>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
import ListBtnToolbar from './listbtntoolbar.vue';
|
|
38
|
-
import EditGridCardS from './editgridcard.vue';
|
|
39
|
-
import elementResizeDetectorMaker from 'element-resize-detector';
|
|
40
|
-
export default {
|
|
41
|
-
name: 'mleftlistrightdetails',
|
|
42
|
-
components: { EditGridCardS,ListBtnToolbar },
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
myConfig: {
|
|
46
|
-
billKey: 'ph_key',
|
|
47
|
-
splitNum:0.33,
|
|
48
|
-
resources: '',
|
|
49
|
-
className: '',
|
|
50
|
-
gridtitle:'列表',
|
|
51
|
-
gridConfig: {}
|
|
52
|
-
},
|
|
53
|
-
showDetail:{},
|
|
54
|
-
menuToolbar: {
|
|
55
|
-
enablePermissions: true,
|
|
56
|
-
items: [
|
|
57
|
-
{
|
|
58
|
-
name: 'editData',
|
|
59
|
-
text: '编辑'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'saveData',
|
|
63
|
-
text: '保存'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'addData',
|
|
67
|
-
text: '新增明细'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'delData',
|
|
71
|
-
text: '删除明细'
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
ph_key: '',
|
|
76
|
-
searchValue:'',
|
|
77
|
-
searchPlaceholder:'请输入',
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
props: {
|
|
81
|
-
config: {
|
|
82
|
-
type: Object,
|
|
83
|
-
default: null
|
|
84
|
-
},
|
|
85
|
-
dictData: {
|
|
86
|
-
type: Object,
|
|
87
|
-
default: null
|
|
88
|
-
},
|
|
89
|
-
moduleMethod: {
|
|
90
|
-
type: Array,
|
|
91
|
-
default: () => {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
computed: {
|
|
97
|
-
clientHeight () {
|
|
98
|
-
return this.$Store.state.app.clientHeight;
|
|
99
|
-
},
|
|
100
|
-
clientHeight2() {
|
|
101
|
-
return this.$Store.state.app.clientHeight - 63;
|
|
102
|
-
},
|
|
103
|
-
clientHeight3() {
|
|
104
|
-
let size = this.myConfig.detailGridsConfig.length;
|
|
105
|
-
let height = (this.$Store.state.app.clientHeight - 63)/2;
|
|
106
|
-
return height;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
created() {
|
|
110
|
-
this.myConfig = Object.assign({}, this.myConfig, this.config);
|
|
111
|
-
this.myConfig.gridConfig.headStyle = '';
|
|
112
|
-
this.myConfig.gridConfig.onSelectionChange = this.gridOnSelectionChange;
|
|
113
|
-
this.myConfig.gridConfig.overrideData = this.gridOverrideData;
|
|
114
|
-
this.myConfig.gridConfig.showCondition = false;
|
|
115
|
-
this.myConfig.gridConfig.resources = this.myConfig.resources;
|
|
116
|
-
this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
|
|
117
|
-
this.myConfig.gridConfig.response = this.myConfig.response;
|
|
118
|
-
this.myConfig.gridConfig.height = 1;
|
|
119
|
-
this.myConfig.gridConfig.adjustHeight = 0;
|
|
120
|
-
this.myConfig.gridConfig.showBorder = true;
|
|
121
|
-
this.myConfig.gridConfig.showStripe = true;
|
|
122
|
-
this.myConfig.gridConfig.pageShowElevator = false;
|
|
123
|
-
this.myConfig.gridConfig.pageSize= 'small';
|
|
124
|
-
this.myConfig.gridConfig.showPage = true;
|
|
125
|
-
|
|
126
|
-
this.myConfig.gridConfig.generalOrientation = true;
|
|
127
|
-
|
|
128
|
-
if (this.myConfig.gridConfig.title) {
|
|
129
|
-
this.myConfig.gridtitle = this.myConfig.gridConfig.title;
|
|
130
|
-
}
|
|
131
|
-
let size = this.myConfig.detailGridsConfig.length;
|
|
132
|
-
this.myConfig.detailGridsConfig.forEach((el,index) => {
|
|
133
|
-
let curlName = el.name;
|
|
134
|
-
if (!el.name) {
|
|
135
|
-
el.name='detailgrid_' + index;
|
|
136
|
-
}
|
|
137
|
-
if (!el.title) {
|
|
138
|
-
let size = index + 1;
|
|
139
|
-
el.title = '明细(' + size +')' ;
|
|
140
|
-
}
|
|
141
|
-
el.adjustHeight = 0;
|
|
142
|
-
if (size > 1) {
|
|
143
|
-
el.height = 0.5;
|
|
144
|
-
el.adjustHeight = 124;
|
|
145
|
-
} else {
|
|
146
|
-
el.height = 1;
|
|
147
|
-
el.adjustHeight = 168;
|
|
148
|
-
}
|
|
149
|
-
el.width = 1;
|
|
150
|
-
el.adjustWidth = 0;
|
|
151
|
-
el.modetype = '2';
|
|
152
|
-
el.showBorder = true;
|
|
153
|
-
el.showStripe = true;
|
|
154
|
-
el.generalOrientation = true;
|
|
155
|
-
if (el.editItemMaxNum === undefined){
|
|
156
|
-
el.editItemMaxNum = 20;
|
|
157
|
-
}
|
|
158
|
-
if (curlName) {
|
|
159
|
-
this.showDetail[curlName] = true;
|
|
160
|
-
} else {
|
|
161
|
-
this.showDetail[el.name] = true;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
-
if (this.myConfig.gridConfig.multiSelect === undefined) {
|
|
166
|
-
this.myConfig.gridConfig.multiSelect = false;
|
|
167
|
-
}
|
|
168
|
-
let searchPlaceholder = '';
|
|
169
|
-
this.myConfig.gridConfig.items.forEach(el => {
|
|
170
|
-
if (el.type !== 'CheckBox') {
|
|
171
|
-
if (el.tooltip === undefined) {
|
|
172
|
-
el.tooltip = true;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (el.condition) {
|
|
176
|
-
searchPlaceholder = searchPlaceholder + el.label + '/';
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
if (searchPlaceholder) {
|
|
180
|
-
searchPlaceholder = searchPlaceholder.substring(0,searchPlaceholder.length - 1);
|
|
181
|
-
this.searchPlaceholder = this.searchPlaceholder + searchPlaceholder;
|
|
182
|
-
}
|
|
183
|
-
// 处理按钮
|
|
184
|
-
if (this.myConfig.menuToolbar && this.myConfig.menuToolbar.items) {
|
|
185
|
-
this.menuToolbar = this.$Method.copy(this.myConfig.menuToolbar);
|
|
186
|
-
}
|
|
187
|
-
this.menuToolbar.mainButton = 'editData';
|
|
188
|
-
this.menuToolbar.mainButtonText = '修改';
|
|
189
|
-
},
|
|
190
|
-
methods: {
|
|
191
|
-
search() {
|
|
192
|
-
this.myConfig.detailGridsConfig.forEach(el =>{
|
|
193
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
194
|
-
this.$refs[el.name][0].setData([]);
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
this.$refs.grid.clearSearchBeforeSearchParam();
|
|
198
|
-
this.$refs.grid.setSearchBeforeSearchParam(this.getSearchParam());
|
|
199
|
-
this.$refs.grid.refurbish();
|
|
200
|
-
},
|
|
201
|
-
getSearchParam() {
|
|
202
|
-
let para = {};
|
|
203
|
-
if (this.searchValue) {
|
|
204
|
-
para['$or'] = [];
|
|
205
|
-
this.myConfig.gridConfig.items.forEach(el => {
|
|
206
|
-
if(el.condition) {
|
|
207
|
-
let obj = {};
|
|
208
|
-
obj[el.name] = {'LIKE':'%' + this.searchValue + '%'};
|
|
209
|
-
para['$or'].push(obj);
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
}
|
|
213
|
-
return para;
|
|
214
|
-
},
|
|
215
|
-
refurbish(ph_key) {
|
|
216
|
-
if (ph_key) {
|
|
217
|
-
this.ph_key = ph_key;
|
|
218
|
-
} else {
|
|
219
|
-
this.ph_key = '';
|
|
220
|
-
}
|
|
221
|
-
this.$refs.grid.refurbish();
|
|
222
|
-
},
|
|
223
|
-
gridOnSelectionChange(rows) {
|
|
224
|
-
let obj = {};
|
|
225
|
-
obj.name = 'gridOnSelectionChange';
|
|
226
|
-
obj.para = rows;
|
|
227
|
-
this.$emit('doAction', obj);
|
|
228
|
-
},
|
|
229
|
-
fromGridOnSelectionChange(rows) {
|
|
230
|
-
let obj = {};
|
|
231
|
-
obj.name = 'fromGridOnSelectionChange';
|
|
232
|
-
obj.para = rows;
|
|
233
|
-
this.$emit('doAction', obj);
|
|
234
|
-
},
|
|
235
|
-
gridOverrideData(data) {
|
|
236
|
-
if (data && data.length > 0) {
|
|
237
|
-
let self = this;
|
|
238
|
-
this.$nextTick(() => {
|
|
239
|
-
let index = 0;
|
|
240
|
-
if (self.ph_key) {
|
|
241
|
-
let culIndex = data.findIndex(el => el[self.myConfig.billKey] === self.ph_key);
|
|
242
|
-
if (culIndex > -1) {
|
|
243
|
-
index = culIndex;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
self.$refs.grid.setRowHighlight(index, true);
|
|
247
|
-
self.ph_key = data[index][self.myConfig.billKey];
|
|
248
|
-
self.initFromGrid(data[index]);
|
|
249
|
-
self.$refs.menutoolbar.setAllReadOnly(true);
|
|
250
|
-
self.$refs.menutoolbar.setReadOnly('editData', false);
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
this.$refs.menutoolbar.setAllReadOnly(true);
|
|
254
|
-
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
255
|
-
}
|
|
256
|
-
return data;
|
|
257
|
-
},
|
|
258
|
-
gridClick(e) {
|
|
259
|
-
let obj = {};
|
|
260
|
-
let self = this;
|
|
261
|
-
obj.onOk = () => {
|
|
262
|
-
self.ph_key = e.ph_key;
|
|
263
|
-
self.initFromGrid(e);
|
|
264
|
-
self.$refs.menutoolbar.setAllReadOnly(true);
|
|
265
|
-
self.$refs.menutoolbar.setReadOnly('editData', false);
|
|
266
|
-
};
|
|
267
|
-
obj.onCancel = () => {
|
|
268
|
-
if (self.ph_key) {
|
|
269
|
-
let data = self.$refs.grid.getData();
|
|
270
|
-
let culIndex = data.findIndex(
|
|
271
|
-
el => el[self.myConfig.billKey] === self.ph_key
|
|
272
|
-
);
|
|
273
|
-
if (culIndex > -1) {
|
|
274
|
-
self.$refs.grid.clearCurrentRow();
|
|
275
|
-
self.$nextTick(() => {
|
|
276
|
-
self.$refs.grid.setRowHighlight(culIndex, true);
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
self.$refs.grid.clearCurrentRow();
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
this.checkData(obj);
|
|
284
|
-
},
|
|
285
|
-
getGrid() {
|
|
286
|
-
return this.$refs.grid;
|
|
287
|
-
},
|
|
288
|
-
getDetailGrids(name) {
|
|
289
|
-
if (this.$refs[name] && this.$refs[name][0]) {
|
|
290
|
-
return this.$refs[name][0];
|
|
291
|
-
}
|
|
292
|
-
return null;
|
|
293
|
-
},
|
|
294
|
-
getMenuToolbar() {
|
|
295
|
-
return this.$refs.menutoolbar;
|
|
296
|
-
},
|
|
297
|
-
initFromGrid(para) {
|
|
298
|
-
let data = this.getFromGridData(para);
|
|
299
|
-
if (this.$parent.setBillData) {
|
|
300
|
-
data = this.$parent.setBillData(data);
|
|
301
|
-
}
|
|
302
|
-
this.myConfig.detailGridsConfig.forEach(el => {
|
|
303
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
304
|
-
this.$refs[el.name][0].setData(data[el.name]);
|
|
305
|
-
this.$refs[el.name][0].setReadOnly(true);
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
if (this.$parent.initFromGridAfter) {
|
|
309
|
-
this.$parent.initFromGridAfter(data);
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
getFromGridData(para) {
|
|
313
|
-
if (this.$parent.getFormData) {
|
|
314
|
-
return this.$parent.getFormData(para);
|
|
315
|
-
}
|
|
316
|
-
let result = {};
|
|
317
|
-
let self = this;
|
|
318
|
-
let tmp = {};
|
|
319
|
-
if (!para[this.myConfig.billKey]) {
|
|
320
|
-
tmp[this.myConfig.billKey] = this.ph_key;
|
|
321
|
-
} else {
|
|
322
|
-
tmp[this.myConfig.billKey] = para[this.myConfig.billKey];
|
|
323
|
-
}
|
|
324
|
-
self.synchroPost(
|
|
325
|
-
self.myConfig.resources,
|
|
326
|
-
self.myConfig.classPrefix + '.get',
|
|
327
|
-
tmp,
|
|
328
|
-
function(data) {
|
|
329
|
-
result = data[self.myConfig.response];
|
|
330
|
-
}
|
|
331
|
-
);
|
|
332
|
-
return result;
|
|
333
|
-
},
|
|
334
|
-
doAction(obj) {
|
|
335
|
-
const method = obj.name;
|
|
336
|
-
const methodBefore = method + 'Before';
|
|
337
|
-
const methodAfter = method + 'After';
|
|
338
|
-
if (obj.name === 'editData') {
|
|
339
|
-
let flag = true;
|
|
340
|
-
if (this.$parent[methodBefore]) {
|
|
341
|
-
flag = this.$parent[methodBefore](obj);
|
|
342
|
-
}
|
|
343
|
-
if (flag) {
|
|
344
|
-
if (obj.name === 'editData') {
|
|
345
|
-
let tempData = this.$refs.grid.getSelection();
|
|
346
|
-
if (tempData.length === 0) {
|
|
347
|
-
this.alert('请先选中行');
|
|
348
|
-
return ;
|
|
349
|
-
}
|
|
350
|
-
this.myConfig.detailGridsConfig.forEach(el => {
|
|
351
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
352
|
-
this.$refs[el.name][0].setReadOnly(false);
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
this.$refs.menutoolbar.setAllReadOnly(false);
|
|
356
|
-
this.$refs.menutoolbar.setReadOnly('editData', true);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (this.$parent[methodAfter]) {
|
|
360
|
-
this.$parent[methodAfter]();
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
} else {
|
|
364
|
-
if (obj.name === 'saveData') {
|
|
365
|
-
let checkflag = false;
|
|
366
|
-
this.myConfig.detailGridsConfig.some(el => {
|
|
367
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
368
|
-
checkflag = this.$refs[el.name][0].checkValidate();
|
|
369
|
-
if (checkflag) {
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
if (checkflag) {
|
|
375
|
-
this.alert('必填项不允许为空');
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
obj.para = [];
|
|
379
|
-
obj.para.push(this.getChangeData());
|
|
380
|
-
}
|
|
381
|
-
obj.onOk = this.onOk;
|
|
382
|
-
let flag = true;
|
|
383
|
-
if (this.$parent[methodBefore]) {
|
|
384
|
-
flag = this.$parent[methodBefore](obj);
|
|
385
|
-
}
|
|
386
|
-
if (!flag) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
this.$emit('doAction', obj);
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
getChangeData() {
|
|
393
|
-
let tempData = this.$refs.grid.getSelection();
|
|
394
|
-
let tmp = Object.assign({},{},tempData[0]);
|
|
395
|
-
tmp.flag = 'U';
|
|
396
|
-
this.myConfig.detailGridsConfig.forEach(el => {
|
|
397
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
398
|
-
tmp[el.name] = this.$refs[el.name][0].getChangeData();
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
return tmp
|
|
402
|
-
},
|
|
403
|
-
onOk(action, data) {
|
|
404
|
-
if (action.name === 'saveData') {
|
|
405
|
-
this.ph_key = data[0][this.myConfig.billKey];
|
|
406
|
-
this.$refs.grid.refurbish({}, true);
|
|
407
|
-
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
408
|
-
this.$refs.menutoolbar.setReadOnly('saveData', true);
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
checkData(obj) {
|
|
412
|
-
let tempData = [];
|
|
413
|
-
this.myConfig.detailGridsConfig.forEach(el => {
|
|
414
|
-
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
415
|
-
let data = this.$refs[el.name][0].getChangeData();
|
|
416
|
-
tempData = tempData.concat(data);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
if (tempData && tempData.length>0) {
|
|
420
|
-
let self = this;
|
|
421
|
-
self.$Modal.confirm({
|
|
422
|
-
title: '确认',
|
|
423
|
-
content: '数据存在数据未确认,是否放弃?',
|
|
424
|
-
onOk: () => {
|
|
425
|
-
obj.onOk();
|
|
426
|
-
},
|
|
427
|
-
onCancel: () => {
|
|
428
|
-
if (obj.onCancel) {
|
|
429
|
-
obj.onCancel();
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
} else {
|
|
434
|
-
obj.onOk();
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
setOutsideHeight () {
|
|
438
|
-
let height = this.$refs.head.offsetHeight + this.$refs.para.offsetHeight + 63;
|
|
439
|
-
this.$refs.grid.setOutsideHeight(height);
|
|
440
|
-
},
|
|
441
|
-
setDetailVisible(name,value) {
|
|
442
|
-
let tmp = {};
|
|
443
|
-
tmp[name] = value;
|
|
444
|
-
this.showDetail = Object.assign({},this.showDetail,tmp);
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
mounted() {
|
|
448
|
-
this.observer = elementResizeDetectorMaker();
|
|
449
|
-
if (this.$refs.head) {
|
|
450
|
-
this.observer.listenTo(this.$refs.head, this.setOutsideHeight);
|
|
451
|
-
}
|
|
452
|
-
this.$nextTick(() => {
|
|
453
|
-
this.$refs.menutoolbar.setAllReadOnly(true);
|
|
454
|
-
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
455
|
-
this.refurbish();
|
|
456
|
-
|
|
457
|
-
});
|
|
458
|
-
},
|
|
459
|
-
beforeUnmount() {
|
|
460
|
-
if (this.$refs.head) {
|
|
461
|
-
this.observer.removeListener(this.$refs.head, this.setOutsideHeight);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
};
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="'background:#fff;overflow: hidden;height:' + clientHeight +'px'">
|
|
3
|
+
<div ref="head">
|
|
4
|
+
<Card :padding="0" style="padding-top:14px;padding-left:16px;padding-right:16px;border-radius:0px;" :bordered="false" dis-hover>
|
|
5
|
+
<ListBtnToolbar ref="menutoolbar" :config="menuToolbar" :moduleMethod="moduleMethod" @doAction="doAction"/>
|
|
6
|
+
<Divider style="margin-top:16px;margin-bottom:0px;" />
|
|
7
|
+
</Card>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="efuture-demo-split" :style="'height:' + clientHeight2 +'px'">
|
|
10
|
+
<Split v-model="myConfig.splitNum">
|
|
11
|
+
<template #left>
|
|
12
|
+
<div class="efuture-demo-split-pane" style="padding:14px 16px;">
|
|
13
|
+
<Card :padding="0" :bordered="false" dis-hover >
|
|
14
|
+
<p style="margin-bottom:10px;">
|
|
15
|
+
<span class="efuture-title-verticalline"/> <span style="font-size: 14px;font-weight:bold" v-text="myConfig.gridtitle" />
|
|
16
|
+
</p>
|
|
17
|
+
<div ref="para">
|
|
18
|
+
<Input :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 98%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
|
|
19
|
+
</div>
|
|
20
|
+
<SimpleViewGrid ref="grid" :config="myConfig.gridConfig" :dictData="dictData" @rowclick="gridClick"/>
|
|
21
|
+
</Card>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<template #right>
|
|
25
|
+
<div class="efuture-demo-split-pane" style="padding:14px 16px;">
|
|
26
|
+
<Card v-for="tmp in myConfig.detailGridsConfig" :key="'detail_' + tmp.name" v-show="showDetail[tmp.name]" :padding="0" style="padding-left:6px;" :bordered="false" dis-hover >
|
|
27
|
+
<EditGridCardS :ref="tmp.name" :config="tmp" :dictData="dictData" style="padding-bottom:10px" />
|
|
28
|
+
</Card>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
</Split>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import ListBtnToolbar from './listbtntoolbar.vue';
|
|
38
|
+
import EditGridCardS from './editgridcard.vue';
|
|
39
|
+
import elementResizeDetectorMaker from 'element-resize-detector';
|
|
40
|
+
export default {
|
|
41
|
+
name: 'mleftlistrightdetails',
|
|
42
|
+
components: { EditGridCardS,ListBtnToolbar },
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
myConfig: {
|
|
46
|
+
billKey: 'ph_key',
|
|
47
|
+
splitNum:0.33,
|
|
48
|
+
resources: '',
|
|
49
|
+
className: '',
|
|
50
|
+
gridtitle:'列表',
|
|
51
|
+
gridConfig: {}
|
|
52
|
+
},
|
|
53
|
+
showDetail:{},
|
|
54
|
+
menuToolbar: {
|
|
55
|
+
enablePermissions: true,
|
|
56
|
+
items: [
|
|
57
|
+
{
|
|
58
|
+
name: 'editData',
|
|
59
|
+
text: '编辑'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'saveData',
|
|
63
|
+
text: '保存'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'addData',
|
|
67
|
+
text: '新增明细'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'delData',
|
|
71
|
+
text: '删除明细'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
ph_key: '',
|
|
76
|
+
searchValue:'',
|
|
77
|
+
searchPlaceholder:'请输入',
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
props: {
|
|
81
|
+
config: {
|
|
82
|
+
type: Object,
|
|
83
|
+
default: null
|
|
84
|
+
},
|
|
85
|
+
dictData: {
|
|
86
|
+
type: Object,
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
89
|
+
moduleMethod: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default: () => {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
clientHeight () {
|
|
98
|
+
return this.$Store.state.app.clientHeight;
|
|
99
|
+
},
|
|
100
|
+
clientHeight2() {
|
|
101
|
+
return this.$Store.state.app.clientHeight - 63;
|
|
102
|
+
},
|
|
103
|
+
clientHeight3() {
|
|
104
|
+
let size = this.myConfig.detailGridsConfig.length;
|
|
105
|
+
let height = (this.$Store.state.app.clientHeight - 63)/2;
|
|
106
|
+
return height;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
created() {
|
|
110
|
+
this.myConfig = Object.assign({}, this.myConfig, this.config);
|
|
111
|
+
this.myConfig.gridConfig.headStyle = '';
|
|
112
|
+
this.myConfig.gridConfig.onSelectionChange = this.gridOnSelectionChange;
|
|
113
|
+
this.myConfig.gridConfig.overrideData = this.gridOverrideData;
|
|
114
|
+
this.myConfig.gridConfig.showCondition = false;
|
|
115
|
+
this.myConfig.gridConfig.resources = this.myConfig.resources;
|
|
116
|
+
this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
|
|
117
|
+
this.myConfig.gridConfig.response = this.myConfig.response;
|
|
118
|
+
this.myConfig.gridConfig.height = 1;
|
|
119
|
+
this.myConfig.gridConfig.adjustHeight = 0;
|
|
120
|
+
this.myConfig.gridConfig.showBorder = true;
|
|
121
|
+
this.myConfig.gridConfig.showStripe = true;
|
|
122
|
+
this.myConfig.gridConfig.pageShowElevator = false;
|
|
123
|
+
this.myConfig.gridConfig.pageSize= 'small';
|
|
124
|
+
this.myConfig.gridConfig.showPage = true;
|
|
125
|
+
|
|
126
|
+
this.myConfig.gridConfig.generalOrientation = true;
|
|
127
|
+
|
|
128
|
+
if (this.myConfig.gridConfig.title) {
|
|
129
|
+
this.myConfig.gridtitle = this.myConfig.gridConfig.title;
|
|
130
|
+
}
|
|
131
|
+
let size = this.myConfig.detailGridsConfig.length;
|
|
132
|
+
this.myConfig.detailGridsConfig.forEach((el,index) => {
|
|
133
|
+
let curlName = el.name;
|
|
134
|
+
if (!el.name) {
|
|
135
|
+
el.name='detailgrid_' + index;
|
|
136
|
+
}
|
|
137
|
+
if (!el.title) {
|
|
138
|
+
let size = index + 1;
|
|
139
|
+
el.title = '明细(' + size +')' ;
|
|
140
|
+
}
|
|
141
|
+
el.adjustHeight = 0;
|
|
142
|
+
if (size > 1) {
|
|
143
|
+
el.height = 0.5;
|
|
144
|
+
el.adjustHeight = 124;
|
|
145
|
+
} else {
|
|
146
|
+
el.height = 1;
|
|
147
|
+
el.adjustHeight = 168;
|
|
148
|
+
}
|
|
149
|
+
el.width = 1;
|
|
150
|
+
el.adjustWidth = 0;
|
|
151
|
+
el.modetype = '2';
|
|
152
|
+
el.showBorder = true;
|
|
153
|
+
el.showStripe = true;
|
|
154
|
+
el.generalOrientation = true;
|
|
155
|
+
if (el.editItemMaxNum === undefined){
|
|
156
|
+
el.editItemMaxNum = 20;
|
|
157
|
+
}
|
|
158
|
+
if (curlName) {
|
|
159
|
+
this.showDetail[curlName] = true;
|
|
160
|
+
} else {
|
|
161
|
+
this.showDetail[el.name] = true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
});
|
|
165
|
+
if (this.myConfig.gridConfig.multiSelect === undefined) {
|
|
166
|
+
this.myConfig.gridConfig.multiSelect = false;
|
|
167
|
+
}
|
|
168
|
+
let searchPlaceholder = '';
|
|
169
|
+
this.myConfig.gridConfig.items.forEach(el => {
|
|
170
|
+
if (el.type !== 'CheckBox') {
|
|
171
|
+
if (el.tooltip === undefined) {
|
|
172
|
+
el.tooltip = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (el.condition) {
|
|
176
|
+
searchPlaceholder = searchPlaceholder + el.label + '/';
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
if (searchPlaceholder) {
|
|
180
|
+
searchPlaceholder = searchPlaceholder.substring(0,searchPlaceholder.length - 1);
|
|
181
|
+
this.searchPlaceholder = this.searchPlaceholder + searchPlaceholder;
|
|
182
|
+
}
|
|
183
|
+
// 处理按钮
|
|
184
|
+
if (this.myConfig.menuToolbar && this.myConfig.menuToolbar.items) {
|
|
185
|
+
this.menuToolbar = this.$Method.copy(this.myConfig.menuToolbar);
|
|
186
|
+
}
|
|
187
|
+
this.menuToolbar.mainButton = 'editData';
|
|
188
|
+
this.menuToolbar.mainButtonText = '修改';
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
search() {
|
|
192
|
+
this.myConfig.detailGridsConfig.forEach(el =>{
|
|
193
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
194
|
+
this.$refs[el.name][0].setData([]);
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
this.$refs.grid.clearSearchBeforeSearchParam();
|
|
198
|
+
this.$refs.grid.setSearchBeforeSearchParam(this.getSearchParam());
|
|
199
|
+
this.$refs.grid.refurbish();
|
|
200
|
+
},
|
|
201
|
+
getSearchParam() {
|
|
202
|
+
let para = {};
|
|
203
|
+
if (this.searchValue) {
|
|
204
|
+
para['$or'] = [];
|
|
205
|
+
this.myConfig.gridConfig.items.forEach(el => {
|
|
206
|
+
if(el.condition) {
|
|
207
|
+
let obj = {};
|
|
208
|
+
obj[el.name] = {'LIKE':'%' + this.searchValue + '%'};
|
|
209
|
+
para['$or'].push(obj);
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
return para;
|
|
214
|
+
},
|
|
215
|
+
refurbish(ph_key) {
|
|
216
|
+
if (ph_key) {
|
|
217
|
+
this.ph_key = ph_key;
|
|
218
|
+
} else {
|
|
219
|
+
this.ph_key = '';
|
|
220
|
+
}
|
|
221
|
+
this.$refs.grid.refurbish();
|
|
222
|
+
},
|
|
223
|
+
gridOnSelectionChange(rows) {
|
|
224
|
+
let obj = {};
|
|
225
|
+
obj.name = 'gridOnSelectionChange';
|
|
226
|
+
obj.para = rows;
|
|
227
|
+
this.$emit('doAction', obj);
|
|
228
|
+
},
|
|
229
|
+
fromGridOnSelectionChange(rows) {
|
|
230
|
+
let obj = {};
|
|
231
|
+
obj.name = 'fromGridOnSelectionChange';
|
|
232
|
+
obj.para = rows;
|
|
233
|
+
this.$emit('doAction', obj);
|
|
234
|
+
},
|
|
235
|
+
gridOverrideData(data) {
|
|
236
|
+
if (data && data.length > 0) {
|
|
237
|
+
let self = this;
|
|
238
|
+
this.$nextTick(() => {
|
|
239
|
+
let index = 0;
|
|
240
|
+
if (self.ph_key) {
|
|
241
|
+
let culIndex = data.findIndex(el => el[self.myConfig.billKey] === self.ph_key);
|
|
242
|
+
if (culIndex > -1) {
|
|
243
|
+
index = culIndex;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
self.$refs.grid.setRowHighlight(index, true);
|
|
247
|
+
self.ph_key = data[index][self.myConfig.billKey];
|
|
248
|
+
self.initFromGrid(data[index]);
|
|
249
|
+
self.$refs.menutoolbar.setAllReadOnly(true);
|
|
250
|
+
self.$refs.menutoolbar.setReadOnly('editData', false);
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
this.$refs.menutoolbar.setAllReadOnly(true);
|
|
254
|
+
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
255
|
+
}
|
|
256
|
+
return data;
|
|
257
|
+
},
|
|
258
|
+
gridClick(e) {
|
|
259
|
+
let obj = {};
|
|
260
|
+
let self = this;
|
|
261
|
+
obj.onOk = () => {
|
|
262
|
+
self.ph_key = e.ph_key;
|
|
263
|
+
self.initFromGrid(e);
|
|
264
|
+
self.$refs.menutoolbar.setAllReadOnly(true);
|
|
265
|
+
self.$refs.menutoolbar.setReadOnly('editData', false);
|
|
266
|
+
};
|
|
267
|
+
obj.onCancel = () => {
|
|
268
|
+
if (self.ph_key) {
|
|
269
|
+
let data = self.$refs.grid.getData();
|
|
270
|
+
let culIndex = data.findIndex(
|
|
271
|
+
el => el[self.myConfig.billKey] === self.ph_key
|
|
272
|
+
);
|
|
273
|
+
if (culIndex > -1) {
|
|
274
|
+
self.$refs.grid.clearCurrentRow();
|
|
275
|
+
self.$nextTick(() => {
|
|
276
|
+
self.$refs.grid.setRowHighlight(culIndex, true);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
self.$refs.grid.clearCurrentRow();
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
this.checkData(obj);
|
|
284
|
+
},
|
|
285
|
+
getGrid() {
|
|
286
|
+
return this.$refs.grid;
|
|
287
|
+
},
|
|
288
|
+
getDetailGrids(name) {
|
|
289
|
+
if (this.$refs[name] && this.$refs[name][0]) {
|
|
290
|
+
return this.$refs[name][0];
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
},
|
|
294
|
+
getMenuToolbar() {
|
|
295
|
+
return this.$refs.menutoolbar;
|
|
296
|
+
},
|
|
297
|
+
initFromGrid(para) {
|
|
298
|
+
let data = this.getFromGridData(para);
|
|
299
|
+
if (this.$parent.setBillData) {
|
|
300
|
+
data = this.$parent.setBillData(data);
|
|
301
|
+
}
|
|
302
|
+
this.myConfig.detailGridsConfig.forEach(el => {
|
|
303
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
304
|
+
this.$refs[el.name][0].setData(data[el.name]);
|
|
305
|
+
this.$refs[el.name][0].setReadOnly(true);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
if (this.$parent.initFromGridAfter) {
|
|
309
|
+
this.$parent.initFromGridAfter(data);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
getFromGridData(para) {
|
|
313
|
+
if (this.$parent.getFormData) {
|
|
314
|
+
return this.$parent.getFormData(para);
|
|
315
|
+
}
|
|
316
|
+
let result = {};
|
|
317
|
+
let self = this;
|
|
318
|
+
let tmp = {};
|
|
319
|
+
if (!para[this.myConfig.billKey]) {
|
|
320
|
+
tmp[this.myConfig.billKey] = this.ph_key;
|
|
321
|
+
} else {
|
|
322
|
+
tmp[this.myConfig.billKey] = para[this.myConfig.billKey];
|
|
323
|
+
}
|
|
324
|
+
self.synchroPost(
|
|
325
|
+
self.myConfig.resources,
|
|
326
|
+
self.myConfig.classPrefix + '.get',
|
|
327
|
+
tmp,
|
|
328
|
+
function(data) {
|
|
329
|
+
result = data[self.myConfig.response];
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
return result;
|
|
333
|
+
},
|
|
334
|
+
doAction(obj) {
|
|
335
|
+
const method = obj.name;
|
|
336
|
+
const methodBefore = method + 'Before';
|
|
337
|
+
const methodAfter = method + 'After';
|
|
338
|
+
if (obj.name === 'editData') {
|
|
339
|
+
let flag = true;
|
|
340
|
+
if (this.$parent[methodBefore]) {
|
|
341
|
+
flag = this.$parent[methodBefore](obj);
|
|
342
|
+
}
|
|
343
|
+
if (flag) {
|
|
344
|
+
if (obj.name === 'editData') {
|
|
345
|
+
let tempData = this.$refs.grid.getSelection();
|
|
346
|
+
if (tempData.length === 0) {
|
|
347
|
+
this.alert('请先选中行');
|
|
348
|
+
return ;
|
|
349
|
+
}
|
|
350
|
+
this.myConfig.detailGridsConfig.forEach(el => {
|
|
351
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
352
|
+
this.$refs[el.name][0].setReadOnly(false);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
this.$refs.menutoolbar.setAllReadOnly(false);
|
|
356
|
+
this.$refs.menutoolbar.setReadOnly('editData', true);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (this.$parent[methodAfter]) {
|
|
360
|
+
this.$parent[methodAfter]();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
if (obj.name === 'saveData') {
|
|
365
|
+
let checkflag = false;
|
|
366
|
+
this.myConfig.detailGridsConfig.some(el => {
|
|
367
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
368
|
+
checkflag = this.$refs[el.name][0].checkValidate();
|
|
369
|
+
if (checkflag) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
if (checkflag) {
|
|
375
|
+
this.alert('必填项不允许为空');
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
obj.para = [];
|
|
379
|
+
obj.para.push(this.getChangeData());
|
|
380
|
+
}
|
|
381
|
+
obj.onOk = this.onOk;
|
|
382
|
+
let flag = true;
|
|
383
|
+
if (this.$parent[methodBefore]) {
|
|
384
|
+
flag = this.$parent[methodBefore](obj);
|
|
385
|
+
}
|
|
386
|
+
if (!flag) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
this.$emit('doAction', obj);
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
getChangeData() {
|
|
393
|
+
let tempData = this.$refs.grid.getSelection();
|
|
394
|
+
let tmp = Object.assign({},{},tempData[0]);
|
|
395
|
+
tmp.flag = 'U';
|
|
396
|
+
this.myConfig.detailGridsConfig.forEach(el => {
|
|
397
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
398
|
+
tmp[el.name] = this.$refs[el.name][0].getChangeData();
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
return tmp
|
|
402
|
+
},
|
|
403
|
+
onOk(action, data) {
|
|
404
|
+
if (action.name === 'saveData') {
|
|
405
|
+
this.ph_key = data[0][this.myConfig.billKey];
|
|
406
|
+
this.$refs.grid.refurbish({}, true);
|
|
407
|
+
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
408
|
+
this.$refs.menutoolbar.setReadOnly('saveData', true);
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
checkData(obj) {
|
|
412
|
+
let tempData = [];
|
|
413
|
+
this.myConfig.detailGridsConfig.forEach(el => {
|
|
414
|
+
if (this.$refs[el.name] && this.$refs[el.name][0]) {
|
|
415
|
+
let data = this.$refs[el.name][0].getChangeData();
|
|
416
|
+
tempData = tempData.concat(data);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
if (tempData && tempData.length>0) {
|
|
420
|
+
let self = this;
|
|
421
|
+
self.$Modal.confirm({
|
|
422
|
+
title: '确认',
|
|
423
|
+
content: '数据存在数据未确认,是否放弃?',
|
|
424
|
+
onOk: () => {
|
|
425
|
+
obj.onOk();
|
|
426
|
+
},
|
|
427
|
+
onCancel: () => {
|
|
428
|
+
if (obj.onCancel) {
|
|
429
|
+
obj.onCancel();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
} else {
|
|
434
|
+
obj.onOk();
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
setOutsideHeight () {
|
|
438
|
+
let height = this.$refs.head.offsetHeight + this.$refs.para.offsetHeight + 63;
|
|
439
|
+
this.$refs.grid.setOutsideHeight(height);
|
|
440
|
+
},
|
|
441
|
+
setDetailVisible(name,value) {
|
|
442
|
+
let tmp = {};
|
|
443
|
+
tmp[name] = value;
|
|
444
|
+
this.showDetail = Object.assign({},this.showDetail,tmp);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
mounted() {
|
|
448
|
+
this.observer = elementResizeDetectorMaker();
|
|
449
|
+
if (this.$refs.head) {
|
|
450
|
+
this.observer.listenTo(this.$refs.head, this.setOutsideHeight);
|
|
451
|
+
}
|
|
452
|
+
this.$nextTick(() => {
|
|
453
|
+
this.$refs.menutoolbar.setAllReadOnly(true);
|
|
454
|
+
this.$refs.menutoolbar.setReadOnly('editData', false);
|
|
455
|
+
this.refurbish();
|
|
456
|
+
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
beforeUnmount() {
|
|
460
|
+
if (this.$refs.head) {
|
|
461
|
+
this.observer.removeListener(this.$refs.head, this.setOutsideHeight);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
465
|
</script>
|