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