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,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
|
+
};
|
|
465
|
+
</script>
|