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.
Files changed (213) hide show
  1. package/README.md +55 -43
  2. package/dist/ocpviewplus.min.esm.js +574 -482
  3. package/dist/ocpviewplus.min.js +9 -9
  4. package/dist/style.css +1 -1
  5. package/dist/styles/efviewplus.css +1 -1
  6. package/package.json +146 -146
  7. package/src/components/base/ContractPrintMixins.js +30 -30
  8. package/src/components/base/controlbase.vue +190 -190
  9. package/src/components/base/controlbox.vue +102 -102
  10. package/src/components/base/index.js +2 -2
  11. package/src/components/base/load.js +19 -19
  12. package/src/components/base/probase.js +220 -220
  13. package/src/components/base/size.js +78 -78
  14. package/src/components/billbox/billbox.vue +67 -67
  15. package/src/components/billbox/index.js +1 -1
  16. package/src/components/cascaderbox/cascaderbox.vue +184 -184
  17. package/src/components/cascaderbox/index.js +2 -2
  18. package/src/components/checkbox/checkbox.vue +75 -75
  19. package/src/components/checkbox/checkgroupbox.vue +103 -103
  20. package/src/components/checkbox/index.js +2 -2
  21. package/src/components/colorbox/colorbox.vue +43 -43
  22. package/src/components/colorbox/index.js +1 -1
  23. package/src/components/combobox/combobox.vue +219 -219
  24. package/src/components/combobox/index.js +1 -1
  25. package/src/components/conditionbox/conditionbase.vue +194 -194
  26. package/src/components/conditionbox/conditionbox.vue +62 -62
  27. package/src/components/conditionbox/conditionfilterbox.vue +479 -479
  28. package/src/components/conditionbox/conditionselectorbox.vue +237 -237
  29. package/src/components/conditionbox/index.js +4 -4
  30. package/src/components/conditionbox/queryconditionbox.vue +25 -25
  31. package/src/components/conditionbox/queryconditionboxbase.vue +123 -123
  32. package/src/components/conditionbox/searchconditionbox.vue +113 -113
  33. package/src/components/conditionbox/searchgrid.vue +391 -391
  34. package/src/components/datebox/DateBoxV1.vue +22 -22
  35. package/src/components/datebox/datebox.vue +129 -129
  36. package/src/components/datebox/daterangebox.vue +154 -154
  37. package/src/components/datebox/index.js +5 -5
  38. package/src/components/form/baseform.vue +676 -676
  39. package/src/components/form/detailsbox.vue +487 -487
  40. package/src/components/form/formbox.vue +28 -28
  41. package/src/components/form/formcardbox.vue +267 -267
  42. package/src/components/form/formcardbox2.vue +228 -228
  43. package/src/components/form/formcardgroupbox.vue +251 -251
  44. package/src/components/form/formcompro.js +18 -18
  45. package/src/components/form/formdetail.vue +128 -128
  46. package/src/components/form/formdetailtwo.vue +302 -302
  47. package/src/components/form/index.js +9 -9
  48. package/src/components/form/toolanchor.js +45 -45
  49. package/src/components/form/workform.vue +167 -167
  50. package/src/components/grid/basegrid.vue +1062 -1062
  51. package/src/components/grid/editgrid.vue +51 -51
  52. package/src/components/grid/editgridbase.vue +1062 -1062
  53. package/src/components/grid/editgridcard.vue +193 -193
  54. package/src/components/grid/expandrow.vue +137 -137
  55. package/src/components/grid/index.js +5 -5
  56. package/src/components/grid/viewgrid.vue +121 -121
  57. package/src/components/grid/viewgridbase.vue +1286 -1286
  58. package/src/components/icon/common-icon.vue +53 -53
  59. package/src/components/icon/eicon.vue +28 -28
  60. package/src/components/icon/icons.vue +42 -42
  61. package/src/components/icon/index.js +1 -1
  62. package/src/components/label/index.js +2 -2
  63. package/src/components/label/showtext.vue +94 -94
  64. package/src/components/load/loadcartoon.vue +227 -227
  65. package/src/components/map/index.js +1 -1
  66. package/src/components/map/mapbox.vue +348 -348
  67. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanel.vue +184 -184
  68. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTable.vue +838 -838
  69. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlbox.vue +126 -126
  70. package/src/components/masterplate/RewriteBillListDetails/BillInfoPanelEditTableControlboxNumberbox.vue +27 -27
  71. package/src/components/masterplate/RewriteBillListDetails/BillListPanel.vue +126 -126
  72. package/src/components/masterplate/RewriteBillListDetails/BillListPanelQueryBar.vue +280 -280
  73. package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +346 -346
  74. package/src/components/masterplate/RewriteBillListDetails/index.vue +325 -325
  75. package/src/components/masterplate/RewriteBillListDetails/mixins/useVxeGridEditTypeKeydownEventHook.js +251 -251
  76. package/src/components/masterplate/RewriteListdetails/BillListPanelV2.vue +115 -115
  77. package/src/components/masterplate/RewriteListdetails/BillListPanelV2QueryBar.vue +24 -24
  78. package/src/components/masterplate/RewriteListdetails/BillListPanelV3.vue +121 -121
  79. package/src/components/masterplate/RewriteListdetails/BillListPanelV3QueryBar.vue +275 -275
  80. package/src/components/masterplate/RewriteListdetails/indexV2.vue +320 -320
  81. package/src/components/masterplate/RewriteListdetails/indexV3.vue +331 -331
  82. package/src/components/masterplate/appendix.vue +586 -586
  83. package/src/components/masterplate/approval.vue +863 -863
  84. package/src/components/masterplate/base.vue +1028 -1028
  85. package/src/components/masterplate/billasyncimport.vue +614 -614
  86. package/src/components/masterplate/billconditionbox.vue +223 -223
  87. package/src/components/masterplate/billconditionsbox.vue +427 -427
  88. package/src/components/masterplate/billdetailform.vue +1028 -1028
  89. package/src/components/masterplate/billimport.vue +301 -301
  90. package/src/components/masterplate/billquerygrid.vue +391 -391
  91. package/src/components/masterplate/billsinglegrid.vue +234 -234
  92. package/src/components/masterplate/birtreport.vue +185 -185
  93. package/src/components/masterplate/contractappendix.vue +688 -688
  94. package/src/components/masterplate/detailbtntoolbar.vue +311 -311
  95. package/src/components/masterplate/detailsbox.vue +386 -386
  96. package/src/components/masterplate/editgridcard.vue +292 -292
  97. package/src/components/masterplate/editgridcard2.vue +127 -127
  98. package/src/components/masterplate/formcard.vue +105 -105
  99. package/src/components/masterplate/formcardgroupbox.vue +167 -167
  100. package/src/components/masterplate/formdetailtwo.vue +366 -366
  101. package/src/components/masterplate/gridcolset.vue +226 -226
  102. package/src/components/masterplate/index.js +54 -54
  103. package/src/components/masterplate/layouttemplate.vue +51 -51
  104. package/src/components/masterplate/leftlistrightdetails.vue +581 -581
  105. package/src/components/masterplate/leftlistrightlist.vue +464 -464
  106. package/src/components/masterplate/lefttreerightdetails.vue +636 -636
  107. package/src/components/masterplate/levelreport.vue +510 -510
  108. package/src/components/masterplate/listbtntoolbar.vue +276 -276
  109. package/src/components/masterplate/listdetails.vue +768 -768
  110. package/src/components/masterplate/operlog.vue +272 -272
  111. package/src/components/masterplate/options.vue +110 -110
  112. package/src/components/masterplate/page.vue +102 -102
  113. package/src/components/masterplate/promptmessage.vue +73 -73
  114. package/src/components/masterplate/querybar.vue +490 -490
  115. package/src/components/masterplate/report.vue +357 -357
  116. package/src/components/masterplate/rowbtntoolbar.vue +126 -126
  117. package/src/components/masterplate/simpletree.vue +137 -137
  118. package/src/components/masterplate/simpleviewgrid.vue +144 -144
  119. package/src/components/mychart/bar/bar.vue +201 -201
  120. package/src/components/mychart/basechart.vue +190 -190
  121. package/src/components/mychart/complexmychart/barline.vue +153 -153
  122. package/src/components/mychart/gauge/gauge.vue +82 -82
  123. package/src/components/mychart/index.js +8 -8
  124. package/src/components/mychart/line/line.vue +201 -201
  125. package/src/components/mychart/liquidfill/liquidfill.vue +108 -108
  126. package/src/components/mychart/pie/pie.vue +95 -95
  127. package/src/components/mychart/radar/radar.vue +121 -121
  128. package/src/components/mychart/scatter/scatter.vue +75 -75
  129. package/src/components/numberbox/NumberBoxV1.vue +39 -39
  130. package/src/components/numberbox/append.js +11 -11
  131. package/src/components/numberbox/index.js +4 -4
  132. package/src/components/numberbox/numberbox.vue +302 -302
  133. package/src/components/numberbox/numberrangebox.vue +422 -422
  134. package/src/components/picturebox/filebox.vue +369 -369
  135. package/src/components/picturebox/index.js +2 -2
  136. package/src/components/picturebox/picturebox.vue +541 -541
  137. package/src/components/picturebox/uploadbox.vue +164 -164
  138. package/src/components/poptagbox/index.js +1 -1
  139. package/src/components/poptagbox/poptagbox.vue +388 -388
  140. package/src/components/poptextbox/index.js +1 -1
  141. package/src/components/poptextbox/poptextbox.vue +624 -624
  142. package/src/components/radiobox/index.js +1 -1
  143. package/src/components/radiobox/radiogroupbox.vue +75 -75
  144. package/src/components/richtextbox/editor.vue +150 -150
  145. package/src/components/richtextbox/index.js +1 -1
  146. package/src/components/richtextbox/richtextbox.vue +448 -448
  147. package/src/components/textbox/index.js +1 -1
  148. package/src/components/textbox/textbox.vue +97 -97
  149. package/src/components/timebox/index.js +1 -1
  150. package/src/components/timebox/timebox.vue +75 -75
  151. package/src/components/toolbar/ebutton.vue +169 -169
  152. package/src/components/toolbar/index.js +3 -3
  153. package/src/components/toolbar/toolbar.vue +445 -445
  154. package/src/components/tree/CompatTree.vue +297 -297
  155. package/src/components/tree/basetree.vue +1098 -1098
  156. package/src/components/tree/index.js +2 -2
  157. package/src/components/tree/treedata.vue +53 -53
  158. package/src/components/tree/treedatabase.vue +189 -189
  159. package/src/components/upload/billimport.vue +233 -233
  160. package/src/components/upload/index.js +1 -1
  161. package/src/components/videobox/index.js +1 -1
  162. package/src/components/videobox/uploadbox.vue +148 -148
  163. package/src/components/videobox/videobox.vue +503 -503
  164. package/src/components/wrichtextbox/editor.vue +219 -219
  165. package/src/components/wrichtextbox/index.js +1 -1
  166. package/src/components/wrichtextbox/wrichtextbox.vue +62 -62
  167. package/src/index.js +231 -231
  168. package/src/locale/format.js +51 -51
  169. package/src/locale/index.js +63 -63
  170. package/src/locale/lang/zh-CN.js +123 -123
  171. package/src/locale/lang/zh-TW.js +114 -114
  172. package/src/locale/lang/zh-UG.js +115 -115
  173. package/src/locale/lang.js +15 -15
  174. package/src/method/case/case.js +1274 -1274
  175. package/src/method/config/queryconfig.js +24 -24
  176. package/src/method/const/const.js +815 -815
  177. package/src/method/index.js +7 -7
  178. package/src/plugins/theme/theme-variable.css +114 -114
  179. package/src/plugins/vxeTable/index.js +241 -241
  180. package/src/plugins/vxeTable/renderer/components/TableFilterInput.vue +51 -51
  181. package/src/plugins/vxeTable/renderer/filter.js +32 -32
  182. package/src/static/excel/exportexcel.js +626 -626
  183. package/src/static/iview/coustom.js +462 -462
  184. package/src/store/index.js +18 -18
  185. package/src/store/modules/app.js +53 -53
  186. package/src/styles/README.md +3 -3
  187. package/src/styles/common.less +80 -80
  188. package/src/styles/components/anchor.less +74 -74
  189. package/src/styles/components/approval.less +135 -135
  190. package/src/styles/components/button.less +208 -208
  191. package/src/styles/components/card.less +51 -51
  192. package/src/styles/components/content.less +38 -38
  193. package/src/styles/components/font.less +313 -313
  194. package/src/styles/components/form.less +71 -71
  195. package/src/styles/components/iconfont/fonts/iconfont.less +1384 -1384
  196. package/src/styles/components/iconfont/fonts/iconfont.svg +703 -703
  197. package/src/styles/components/index.less +16 -16
  198. package/src/styles/components/input.less +290 -290
  199. package/src/styles/components/modal.less +203 -203
  200. package/src/styles/components/page.less +340 -340
  201. package/src/styles/components/select.less +361 -361
  202. package/src/styles/components/steps.less +367 -367
  203. package/src/styles/components/table.less +544 -544
  204. package/src/styles/components/tabs.less +249 -249
  205. package/src/styles/components/upload.less +82 -82
  206. package/src/styles/custom.less +67 -67
  207. package/src/styles/index.less +6 -6
  208. package/src/styles/pack.less +6 -6
  209. package/src/utils/EfuMessenger.js +155 -155
  210. package/src/utils/assist.js +353 -353
  211. package/src/utils/index.js +1 -1
  212. package/src/utils/random_str.js +10 -10
  213. package/src/components/masterplate/detailgridbox.vue +0 -386
@@ -1,636 +1,636 @@
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
- <Row v-if="showCondition">
19
- <ControlBox ref="condition" style="width: 100%;margin-top:10xp;margin-bottom:10px" :config="conditionConfig" ></ControlBox>
20
- </Row>
21
- <Row>
22
- <Input :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 100%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
23
- </Row>
24
- </div>
25
- <TreeBox v-show="showTree" ref="tree" :config="myConfig.treeConfig" @onSelectChange="selectChange" />
26
- <SimpleViewGrid v-show="!showTree" ref="grid" :config="myConfig.gridConfig" :dictData="dictData" @rowclick="gridClick"/>
27
- </Card>
28
- </div>
29
- </template>
30
- <template #right>
31
- <div class="efuture-demo-split-pane" style="padding:14px 0px;">
32
- <Card :padding="0" :bordered="false" dis-hover >
33
- <BillDetailForm ref="form" :config="myConfig.detailConfig" :dictData="dictData" />
34
- </Card>
35
- </div>
36
- </template>
37
- </Split>
38
- </div>
39
- </div>
40
- </template>
41
-
42
- <script>
43
- import ListBtnToolbar from './listbtntoolbar.vue';
44
- import BillDetailForm from '@/components/masterplate/billdetailform.vue';
45
- import elementResizeDetectorMaker from 'element-resize-detector';
46
- export default {
47
- name:'mlefttreerightdetails',
48
- components:{ListBtnToolbar, BillDetailForm},
49
- data () {
50
- return {
51
- myConfig:{
52
- gridtitle:'列表',
53
- billKey:'ph_key',
54
- splitNum:0.25,
55
- resources:'',
56
- className:'',
57
- formTitle:'详情',
58
- adjustHeight:200,
59
- treeConfig:{},
60
- gridConfig:{},
61
- },
62
- conditionConfig:{},
63
-
64
- rootNode:{},
65
- levelData:[],
66
- menuToolbar:{
67
- enablePermissions:true
68
- },
69
- searchPlaceholder:'请输入编码或名称',
70
- showTree:true,
71
- ph_key:'',
72
- treeSeletedNode:[],
73
- searchValue:'',
74
- headHeight:63,
75
- conditionValue:''
76
- };
77
- },
78
- props:{
79
- config: {
80
- type:Object,
81
- default:null
82
- },
83
- dictData: {
84
- type: Object,
85
- default:null
86
- },
87
- moduleMethod:{
88
- type:Array,
89
- default: () => {
90
- return [];
91
- }
92
- }
93
- },
94
- computed: {
95
- clientHeight () {
96
- return this.$Store.state.app.clientHeight;
97
- },
98
- clientHeight2() {
99
- return this.$Store.state.app.clientHeight - this.headHeight;
100
- }
101
- },
102
- created () {
103
- this.myConfig = Object.assign({},this.myConfig, this.config);
104
- this.myConfig.gridConfig.onSelectionChange = this.gridOnSelectionChange;
105
- this.myConfig.gridConfig.overrideData = this.gridOverrideData;
106
- this.myConfig.gridConfig.showCondition = false;
107
- this.myConfig.gridConfig.resources = this.myConfig.resources;
108
- this.myConfig.gridConfig.tableSize ='small';
109
- this.myConfig.gridConfig.showBorder = false;
110
- this.myConfig.gridConfig.pageShowSizer = false;
111
- this.myConfig.gridConfig.generalOrientation = true;
112
- this.myConfig.gridConfig.height = 1;
113
- this.myConfig.gridConfig.adjustHeight = 0;
114
- if (this.myConfig.gridConfig.title !== undefined) {
115
- this.myConfig.gridtitle = this.myConfig.gridConfig.title;
116
- }
117
- if (!this.myConfig.gridConfig.method) {
118
- this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
119
- }
120
- if (!this.myConfig.gridConfig.response) {
121
- this.myConfig.gridConfig.response = this.myConfig.response;
122
- }
123
-
124
- this.myConfig.gridConfig.multiSelect = false;
125
- if (this.myConfig.treeConfig.items) {
126
- this.myConfig.gridConfig.items = this.$Method.copy(this.myConfig.treeConfig.items);
127
- }
128
- if (this.myConfig.treeConfig.treeCondition) {
129
- this.conditionConfig = Object.assign({},this.conditionConfig,this.myConfig.treeConfig.treeCondition);
130
- if (this.conditionConfig.dictkey) {
131
- if (!this.conditionConfig.data) {
132
- this.conditionConfig.data = this.$Method.copy(this.dictData[this.conditionConfig.dictkey]);
133
- }
134
- }
135
- if (this.conditionConfig.valueChanged) this.conditionConfig.onChange = this.$Method.copy(this.conditionConfig.valueChanged);
136
- this.conditionConfig.valueChanged = this.conditionValueChanged;
137
- this.showCondition = true;
138
- }
139
-
140
- if (this.myConfig.treeConfig.searchParam) {
141
- this.myConfig.gridConfig.searchParam = {};
142
- Object.assign(this.myConfig.gridConfig.searchParam, this.myConfig.treeConfig.searchParam);
143
- }
144
-
145
-
146
- // 处理树
147
- this.myConfig.treeConfig.resources = this.myConfig.resources;
148
- if (!this.myConfig.treeConfig.method) {
149
- this.myConfig.treeConfig.method = this.myConfig.classPrefix + '.search';
150
- }
151
- if (!this.myConfig.treeConfig.response) {
152
- this.myConfig.treeConfig.response = this.myConfig.response;
153
- }
154
- this.myConfig.treeConfig.showCondition = false;
155
- this.myConfig.treeConfig.showTitle = false;
156
- this.myConfig.treeConfig.bordered = false;
157
- this.myConfig.treeConfig.disHover = true;
158
- this.myConfig.treeConfig.height = 1;
159
- this.myConfig.treeConfig.adjustHeight = 0;
160
- this.myConfig.treeConfig.selectedRoot = true;
161
- if (this.myConfig.treeConfig.showCodeWithName === undefined) {
162
- this.myConfig.treeConfig.showCodeWithName = true;
163
- }
164
- if(this.myConfig.treeConfig.setTreeNodeIcon !== undefined) {
165
- this.setCustomTreeNodeIcon = this.myConfig.treeConfig.setTreeNodeIcon;
166
- }
167
- this.myConfig.treeConfig.setTreeNodeIcon = this.setTreeNodeIcon;
168
-
169
- // 处理按钮
170
- if (this.myConfig.menuToolbar !== undefined) {
171
- this.menuToolbar = Object.assign({}, this.menuToolbar, this.myConfig.menuToolbar);
172
- }
173
- this.menuToolbar.mainButton = 'editData';
174
- this.menuToolbar.mainButtonText = '修改';
175
- this.myConfig.detailConfig.modetype = '2';
176
- this.myConfig.detailConfig.billKey = this.myConfig.billKey;
177
- this.myConfig.detailConfig.showAnchorLink = false;
178
- this.myConfig.detailConfig.response = this.myConfig.response;
179
- this.myConfig.detailConfig.adjustHeight = 0;
180
- this.myConfig.detailConfig.resources = this.myConfig.resources;
181
- },
182
- methods:{
183
- selectChange (e) {
184
- let obj = {};
185
- let self = this;
186
- obj.onOk = () => {
187
- if (e && e.length > 0) {
188
- self.$refs.menutoolbar.setAllReadOnly(true);
189
- self.treeSeletedNode = self.$Method.copy(e);
190
- self.initForm(e[0]);
191
- } else {
192
- self.doCanCel();
193
- this.$refs.menutoolbar.setAllReadOnly(true);
194
- if (this.treeSeletedNode.length > 0) {
195
- this.initForm(this.treeSeletedNode[0]);
196
- }
197
- }
198
- };
199
- obj.onCancel = () => {
200
- self.doCanCel();
201
- };
202
- this.checkData(obj);
203
- },
204
- search () {
205
- let obj = this.getSearchParam();
206
- this.treeSeletedNode = [];
207
- if (!this.searchValue) {
208
- this.showTree = true;
209
- } else {
210
- obj['$or'] = [];
211
- let code = {};
212
- code[this.myConfig.treeConfig.responseCode] = {'LIKE':'%' + this.searchValue + '%'};
213
- obj['$or'].push(code);
214
- let name = {};
215
- code[this.myConfig.treeConfig.responseName] = {'LIKE':'%' + this.searchValue + '%'};
216
- obj['$or'].push(name);
217
- this.$refs.grid.clearSearchBeforeSearchParam();
218
- this.$refs.grid.setSearchBeforeSearchParam(obj);
219
- this.$refs.grid.refurbish();
220
- this.showTree = false;
221
- }
222
- },
223
- getSearchParam () {
224
- let searchParam = this.$Method.copy(this.myConfig.treeConfig.searchParam);
225
- if (!searchParam) {
226
- searchParam = {};
227
- }
228
- return searchParam;
229
- },
230
- refurbish () {
231
- this.treeSeletedNode = [];
232
- this.initTree();
233
- },
234
- gridOnSelectionChange(rows) {
235
- let obj = {};
236
- obj.name = 'gridOnSelectionChange';
237
- obj.para = rows;
238
- this.$emit('doAction', obj);
239
- },
240
- gridOverrideData (data) {
241
- if (data && data.length > 0) {
242
- let self = this;
243
- this.$nextTick(() => {
244
- let index = 0;
245
- if (self.treeSeletedNode.length > 0) {
246
- let culIndex = data.findIndex(el => el[self.myConfig.billKey]=== self.treeSeletedNode[0][self.myConfig.billKey]);
247
- if (culIndex > -1) {
248
- index = culIndex;
249
- }
250
- }
251
- self.$refs.grid.setRowHighlight(index,true);
252
- self.ph_key = data[index].ph_key;
253
- self.initForm(data[index]);
254
- self.$refs.form.setReadOnly(true);
255
- self.$refs.menutoolbar.setAllReadOnly(false);
256
- self.$refs.menutoolbar.setReadOnly('saveData', true);
257
- });
258
- } else {
259
- this.$refs.form.clearData();
260
- this.$refs.form.setReadOnly(true);
261
- this.$refs.menutoolbar.setAllReadOnly(true);
262
- }
263
-
264
- return data;
265
- },
266
- gridClick(e) {
267
- let obj = {};
268
- let self = this;
269
- obj.onOk = () => {
270
- self.treeSeletedNode = [e];
271
- self.initForm(e);
272
- };
273
- obj.onCancel = () => {
274
- self.doCanCel();
275
- };
276
- this.checkData(obj);
277
- },
278
- doCanCel () {
279
- this.$nextTick(() => {
280
- if (this.showTree) {
281
- this.$refs.tree.setData(this.treeSeletedNode);
282
- } else {
283
- this.$refs.grid.setAllRowHighlight(false);
284
- let data = self.$refs.grid.getData();
285
- let index = data.findIndex(el => el[self.myConfig.billKey] === self.treeSeletedNode[0][self.myConfig.billKey]);
286
- if (index > -1) {
287
- this.$refs.grid.setRowHighlight(index, true);
288
- } else {
289
- this.$refs.grid.clearCurrentRow();
290
- }
291
- }
292
- });
293
-
294
- },
295
- getForm() {
296
- return this.$refs.form;
297
- },
298
- getGrid() {
299
- return this.$refs.grid;
300
- },
301
- getTree() {
302
- return this.$refs.tree;
303
- },
304
- getMenuToolbar() {
305
- return this.$refs.menutoolbar;
306
- },
307
- quickChagne () {
308
- this.search();
309
- },
310
- initTree(flag) {
311
- this.$refs.tree.refurbish();
312
- this.$nextTick(() => {
313
- if (this.treeSeletedNode.length > 0) {
314
- this.$refs.tree.setData(this.treeSeletedNode);
315
- }
316
- if (!flag) {
317
- this.initForm(this.treeSeletedNode[0]);
318
- }
319
- });
320
- },
321
- updateTree(data,flag) {
322
- this.$refs.tree.updaeNode(data,'U');
323
- },
324
- initForm (para) {
325
- this.$refs.form.clearData();
326
- let data = {};
327
- this.$refs.menutoolbar.setAllReadOnly(true);
328
- if (!para) {
329
- return;
330
- }
331
- let rootNode = this.$refs.tree.getRootNode();
332
- if (para[this.myConfig.treeConfig.idField] === rootNode[this.myConfig.treeConfig.idField]) {
333
- data = this.$Method.copy(rootNode);
334
- this.$refs.menutoolbar.setReadOnly(['addChildData'], false);
335
- } else {
336
- data = this.getFormData(para);
337
- if (this.$refs.tree.isChildren(para)) {
338
- this.$refs.menutoolbar.setReadOnly(['editData','addSelfData','addChildData'], false);
339
- } else {
340
- this.$refs.menutoolbar.setReadOnly(['editData','addSelfData','addChildData','delData'], false);
341
- }
342
- }
343
- if (this.$parent.setBillData) {
344
- data = this.$parent.setBillData(data);
345
- }
346
- this.$refs.form.setData(data);
347
- this.$nextTick(() => {
348
- this.$refs.form.setReadOnly(true);
349
- });
350
- if (this.$parent.initFormAfter) {
351
- this.$parent.initFormAfter(data);
352
- }
353
- },
354
- getFormData (para) {
355
- if (this.$parent.getFormData) {
356
- return this.$parent.getFormData(para);
357
- } else {
358
- let result = {};
359
- let self = this;
360
- let tmp = {};
361
- if (!para[this.myConfig.billKey]) {
362
- tmp[this.myConfig.billKey] = this.ph_key;
363
- } else {
364
- tmp[this.myConfig.billKey] = para[this.myConfig.billKey];
365
- }
366
- self.synchroPost(self.myConfig.resources,self.myConfig.classPrefix+'.get', tmp, function (data) {
367
- result = data[self.config.response];
368
- });
369
- return result;
370
- }
371
- },
372
- doAction(obj) {
373
- const method = obj.name;
374
- const methodBefore = method + 'Before';
375
- const methodAfter = method + 'After';
376
- if (obj.name === 'addSelfData' || obj.name === 'addChildData' || obj.name === 'editData' ) {
377
- let flag = true;
378
- let temp = {};
379
- if (this.$parent[methodBefore]) {
380
- flag = this.$parent[methodBefore](temp);
381
- }
382
- if (flag) {
383
- if (obj.name === 'addSelfData' || obj.name === 'addChildData') {
384
- this.$refs.form.setReadOnly(false);
385
- this.$refs.form.clearData();
386
- this.$refs.form.setData(temp);
387
- this.$refs.menutoolbar.setAllReadOnly(true);
388
- this.$refs.menutoolbar.setReadOnly('saveData', false);
389
- }
390
- if (obj.name === 'editData') {
391
- if (this.treeSeletedNode.length === 0) {
392
- this.alert('请先选择节点');
393
- return false;
394
- }
395
-
396
- let obj = this.$refs.tree.getRootNode();
397
- if (obj[this.myConfig.treeConfig.responseCode] === this.treeSeletedNode[0][this.myConfig.treeConfig.responseCode]) {
398
- this.alert('当前节点不允许修改');
399
- return false;
400
- }
401
-
402
- this.$refs.form.setReadOnly(false);
403
-
404
- this.$refs.menutoolbar.setReadOnly('editData', true);
405
- this.$refs.menutoolbar.setReadOnly('saveData', false);
406
- }
407
-
408
- if (this.$parent[methodAfter]) {
409
- this.$parent[methodAfter]();
410
- }
411
- }
412
- } else {
413
- if (obj.name === 'saveData') {
414
- let flag = this.$refs.form.checkValidate();
415
- if (flag) {
416
- this.alert('必填项不允许为空');
417
- return false;
418
- }
419
- flag = this.$refs.form.isEdit();
420
- if (flag) {
421
- this.alert('存在数据未确认');
422
- return false;
423
- }
424
- let data = this.$refs.form.getChangeData();
425
- obj.para = [];
426
- obj.para.push(data);
427
-
428
- }
429
- if (obj.name === 'delData') {
430
- let tempData = this.$refs.form.getData();
431
- tempData.flag = 'D';
432
- obj.para = tempData;
433
- }
434
- obj.onOk = this.onOk;
435
- let flag = true;
436
- if (this.$parent[methodBefore]) {
437
- flag = this.$parent[methodBefore](obj);
438
- }
439
- if (!flag) {
440
- return;
441
- }
442
- if (obj.name === 'delData') {
443
- let text = '保存';
444
- if (obj.name === 'delData') {
445
- text = '删除';
446
- }
447
- let self = this;
448
- self.$Modal.confirm({
449
- title:'确认',
450
- content:'是否确认'+text+'数据?',
451
- onOk:() => {
452
- self.$emit('doAction', obj);
453
- }
454
- });
455
- } else {
456
- this.$emit('doAction', obj);
457
- }
458
- }
459
- },
460
- onOk (action, data) {
461
- if (action.name === 'saveData') {
462
- this.$refs.menutoolbar.setAllReadOnly(true);
463
- this.initForm(data[0]);
464
- this.$refs.form.setReadOnly(true);
465
- let temp = this.$refs.form.getData();
466
- this.treeSeletedNode =[temp];
467
- //this.initTree(true);
468
- this.$refs.tree.updateNode(temp,'U');
469
- if (!this.showTree) {
470
- this.$refs.grid.refurbish();
471
- }
472
- this.$refs.menutoolbar.setReadOnly(['addSelfData','addChildData','editData'], false);
473
- }
474
- if (action.name === 'delData') {
475
- this.$refs.tree.updateNode(this.treeSeletedNode[0],'D');
476
- this.treeSeletedNode = [];
477
- this.$refs.form.setReadOnly(true);
478
- this.$refs.form.clearData();
479
- if (!this.showTree) {
480
- this.$refs.grid.refurbish();
481
- }
482
- this.$refs.menutoolbar.setReadOnly(['addSelfData','addChildData','editData'], false);
483
- }
484
- },
485
- checkData (obj) {
486
- let tempflag = false;
487
- tempflag = this.$refs.form.isEdit();
488
- if (tempflag) {
489
- let self = this;
490
- self.$Modal.confirm({
491
- title:'确认',
492
- content:'数据存在数据未确认,是否放弃?',
493
- onOk:() => {
494
- this.checkChangeData(obj);
495
- },
496
- onCancel:() => {
497
- if (obj.onCancel) {
498
- obj.onCancel();
499
- }
500
- }
501
- });
502
- } else {
503
- this.checkChangeData(obj);
504
- }
505
- },
506
- checkChangeData(obj) {
507
- let flag = false;
508
- flag = this.$refs.form.isChange();
509
- if (flag) {
510
- let self = this;
511
- self.$Modal.confirm({
512
- title:'确认',
513
- content:'数据有修改未保存,是否放弃修改?',
514
- onOk:() => {
515
- if (obj.onOk) {
516
- obj.onOk();
517
- }
518
- },
519
- onCancel:() => {
520
- if (obj.onCancel) {
521
- obj.onCancel();
522
- }
523
- }
524
- });
525
- } else {
526
- if (obj.onOk) {
527
- obj.onOk();
528
- }
529
- }
530
- },
531
- setTreeAndGridAndFormHeight() {
532
- let height = this.$refs.head.offsetHeight + this.$refs.para.offsetHeight + 62;
533
- this.$refs.tree.setOutsideHeight(height);
534
- this.$refs.grid.setOutsideHeight(height);
535
- let height2 = this.$refs.head.offsetHeight;
536
- this.$refs.form.setOutsideHeight(height2);
537
- },
538
- setTreeNodeIcon(params, obj) {
539
-
540
- const hasChildren =
541
- params.data.children &&
542
- params.data.children.length > 0
543
-
544
- if (hasChildren) {
545
- if (params.data.expand) {
546
- obj.type = '_custom-wenjianzhankai'
547
- } else {
548
- obj.type = '_custom-wenjianshouqi'
549
- }
550
- } else {
551
- obj.type = '_custom-yemian'
552
- }
553
-
554
- if (this.setCustomTreeNodeIcon) {
555
- obj = this.setCustomTreeNodeIcon(params, obj)
556
- }
557
-
558
- return obj
559
- },
560
- getSelectedNode() {
561
- let obj = {};
562
- if (this.treeSeletedNode.length > 0) {
563
- obj = this.$Method.copy(this.treeSeletedNode[0]);
564
- }
565
- return obj;
566
- },
567
- getChangeData() {
568
- return this.$refs.form.getChangeData();
569
- },
570
- setDetailVisible(name,value) {
571
- this.$refs.form.setVisible(name, value);
572
- },
573
- getTreeCondition() {
574
- return this.$refs.condition;
575
- },
576
- conditionValueChanged(e) {
577
- let flag = true;
578
- if (this.conditionConfig.onChange) flag = this.conditionConfig.onChange(e);
579
- if (flag === undefined) flag = true;
580
- if (!flag) return flag;
581
-
582
- this.$nextTick(() => {
583
- let tmp = {};
584
- let self = this;
585
- tmp.onOk = () => {
586
- let para = {};
587
- let value = self.$refs.condition.getValue();
588
- if (value) {
589
- para[self.conditionConfig.name] = value;
590
- }
591
- self.searchValue = '';
592
- self.showTree = true;
593
- self.treeSeletedNode = [];
594
- self.$refs.form.clearData();
595
- self.$refs.menutoolbar.setAllReadOnly(true);
596
- self.$refs.form.setReadOnly(true);
597
- self.$refs.tree.refurbish(para);
598
- self.conditionValue = value;
599
- };
600
- tmp.onCancel = () => {
601
- self.$refs.condition.setValue(self.conditionValue);
602
- }
603
- self.checkData(tmp);
604
- });
605
- return true;
606
- }
607
- },
608
- mounted () {
609
- this.observer = elementResizeDetectorMaker();
610
- if (this.$refs.head) {
611
- this.observer.listenTo(this.$refs.head, this.setTreeAndGridAndFormHeight);
612
- }
613
- if (this.$refs.para) {
614
- this.observer.listenTo(this.$refs.para, this.setTreeAndGridAndFormHeight);
615
- }
616
- this.headHeight = this.$refs.head.offsetHeight;
617
- this.$nextTick(() => {
618
- this.$refs.form.setReadOnly(true);
619
- this.$refs.menutoolbar.setAllReadOnly(false);
620
- this.refurbish();
621
- });
622
- },
623
- beforeUnmount() {
624
- if (this.$refs.head) {
625
- this.observer.removeListener(this.$refs.head, this.setTreeAndGridAndFormHeight);
626
- }
627
- if (this.$refs.para) {
628
- this.observer.removeListener(this.$refs.para, this.setTreeAndGridAndFormHeight);
629
- }
630
- }
631
- };
632
- </script>
633
-
634
- <style>
635
-
636
- </style>
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
+ <Row v-if="showCondition">
19
+ <ControlBox ref="condition" style="width: 100%;margin-top:10xp;margin-bottom:10px" :config="conditionConfig" ></ControlBox>
20
+ </Row>
21
+ <Row>
22
+ <Input :placeholder="searchPlaceholder" v-model="searchValue" search style="width: 100%;margin-top:10xp;margin-bottom:10px" @on-search="search" @on-enter="search"/>
23
+ </Row>
24
+ </div>
25
+ <TreeBox v-show="showTree" ref="tree" :config="myConfig.treeConfig" @onSelectChange="selectChange" />
26
+ <SimpleViewGrid v-show="!showTree" ref="grid" :config="myConfig.gridConfig" :dictData="dictData" @rowclick="gridClick"/>
27
+ </Card>
28
+ </div>
29
+ </template>
30
+ <template #right>
31
+ <div class="efuture-demo-split-pane" style="padding:14px 0px;">
32
+ <Card :padding="0" :bordered="false" dis-hover >
33
+ <BillDetailForm ref="form" :config="myConfig.detailConfig" :dictData="dictData" />
34
+ </Card>
35
+ </div>
36
+ </template>
37
+ </Split>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ import ListBtnToolbar from './listbtntoolbar.vue';
44
+ import BillDetailForm from '@/components/masterplate/billdetailform.vue';
45
+ import elementResizeDetectorMaker from 'element-resize-detector';
46
+ export default {
47
+ name:'mlefttreerightdetails',
48
+ components:{ListBtnToolbar, BillDetailForm},
49
+ data () {
50
+ return {
51
+ myConfig:{
52
+ gridtitle:'列表',
53
+ billKey:'ph_key',
54
+ splitNum:0.25,
55
+ resources:'',
56
+ className:'',
57
+ formTitle:'详情',
58
+ adjustHeight:200,
59
+ treeConfig:{},
60
+ gridConfig:{},
61
+ },
62
+ conditionConfig:{},
63
+
64
+ rootNode:{},
65
+ levelData:[],
66
+ menuToolbar:{
67
+ enablePermissions:true
68
+ },
69
+ searchPlaceholder:'请输入编码或名称',
70
+ showTree:true,
71
+ ph_key:'',
72
+ treeSeletedNode:[],
73
+ searchValue:'',
74
+ headHeight:63,
75
+ conditionValue:''
76
+ };
77
+ },
78
+ props:{
79
+ config: {
80
+ type:Object,
81
+ default:null
82
+ },
83
+ dictData: {
84
+ type: Object,
85
+ default:null
86
+ },
87
+ moduleMethod:{
88
+ type:Array,
89
+ default: () => {
90
+ return [];
91
+ }
92
+ }
93
+ },
94
+ computed: {
95
+ clientHeight () {
96
+ return this.$Store.state.app.clientHeight;
97
+ },
98
+ clientHeight2() {
99
+ return this.$Store.state.app.clientHeight - this.headHeight;
100
+ }
101
+ },
102
+ created () {
103
+ this.myConfig = Object.assign({},this.myConfig, this.config);
104
+ this.myConfig.gridConfig.onSelectionChange = this.gridOnSelectionChange;
105
+ this.myConfig.gridConfig.overrideData = this.gridOverrideData;
106
+ this.myConfig.gridConfig.showCondition = false;
107
+ this.myConfig.gridConfig.resources = this.myConfig.resources;
108
+ this.myConfig.gridConfig.tableSize ='small';
109
+ this.myConfig.gridConfig.showBorder = false;
110
+ this.myConfig.gridConfig.pageShowSizer = false;
111
+ this.myConfig.gridConfig.generalOrientation = true;
112
+ this.myConfig.gridConfig.height = 1;
113
+ this.myConfig.gridConfig.adjustHeight = 0;
114
+ if (this.myConfig.gridConfig.title !== undefined) {
115
+ this.myConfig.gridtitle = this.myConfig.gridConfig.title;
116
+ }
117
+ if (!this.myConfig.gridConfig.method) {
118
+ this.myConfig.gridConfig.method = this.myConfig.classPrefix + '.search';
119
+ }
120
+ if (!this.myConfig.gridConfig.response) {
121
+ this.myConfig.gridConfig.response = this.myConfig.response;
122
+ }
123
+
124
+ this.myConfig.gridConfig.multiSelect = false;
125
+ if (this.myConfig.treeConfig.items) {
126
+ this.myConfig.gridConfig.items = this.$Method.copy(this.myConfig.treeConfig.items);
127
+ }
128
+ if (this.myConfig.treeConfig.treeCondition) {
129
+ this.conditionConfig = Object.assign({},this.conditionConfig,this.myConfig.treeConfig.treeCondition);
130
+ if (this.conditionConfig.dictkey) {
131
+ if (!this.conditionConfig.data) {
132
+ this.conditionConfig.data = this.$Method.copy(this.dictData[this.conditionConfig.dictkey]);
133
+ }
134
+ }
135
+ if (this.conditionConfig.valueChanged) this.conditionConfig.onChange = this.$Method.copy(this.conditionConfig.valueChanged);
136
+ this.conditionConfig.valueChanged = this.conditionValueChanged;
137
+ this.showCondition = true;
138
+ }
139
+
140
+ if (this.myConfig.treeConfig.searchParam) {
141
+ this.myConfig.gridConfig.searchParam = {};
142
+ Object.assign(this.myConfig.gridConfig.searchParam, this.myConfig.treeConfig.searchParam);
143
+ }
144
+
145
+
146
+ // 处理树
147
+ this.myConfig.treeConfig.resources = this.myConfig.resources;
148
+ if (!this.myConfig.treeConfig.method) {
149
+ this.myConfig.treeConfig.method = this.myConfig.classPrefix + '.search';
150
+ }
151
+ if (!this.myConfig.treeConfig.response) {
152
+ this.myConfig.treeConfig.response = this.myConfig.response;
153
+ }
154
+ this.myConfig.treeConfig.showCondition = false;
155
+ this.myConfig.treeConfig.showTitle = false;
156
+ this.myConfig.treeConfig.bordered = false;
157
+ this.myConfig.treeConfig.disHover = true;
158
+ this.myConfig.treeConfig.height = 1;
159
+ this.myConfig.treeConfig.adjustHeight = 0;
160
+ this.myConfig.treeConfig.selectedRoot = true;
161
+ if (this.myConfig.treeConfig.showCodeWithName === undefined) {
162
+ this.myConfig.treeConfig.showCodeWithName = true;
163
+ }
164
+ if(this.myConfig.treeConfig.setTreeNodeIcon !== undefined) {
165
+ this.setCustomTreeNodeIcon = this.myConfig.treeConfig.setTreeNodeIcon;
166
+ }
167
+ this.myConfig.treeConfig.setTreeNodeIcon = this.setTreeNodeIcon;
168
+
169
+ // 处理按钮
170
+ if (this.myConfig.menuToolbar !== undefined) {
171
+ this.menuToolbar = Object.assign({}, this.menuToolbar, this.myConfig.menuToolbar);
172
+ }
173
+ this.menuToolbar.mainButton = 'editData';
174
+ this.menuToolbar.mainButtonText = '修改';
175
+ this.myConfig.detailConfig.modetype = '2';
176
+ this.myConfig.detailConfig.billKey = this.myConfig.billKey;
177
+ this.myConfig.detailConfig.showAnchorLink = false;
178
+ this.myConfig.detailConfig.response = this.myConfig.response;
179
+ this.myConfig.detailConfig.adjustHeight = 0;
180
+ this.myConfig.detailConfig.resources = this.myConfig.resources;
181
+ },
182
+ methods:{
183
+ selectChange (e) {
184
+ let obj = {};
185
+ let self = this;
186
+ obj.onOk = () => {
187
+ if (e && e.length > 0) {
188
+ self.$refs.menutoolbar.setAllReadOnly(true);
189
+ self.treeSeletedNode = self.$Method.copy(e);
190
+ self.initForm(e[0]);
191
+ } else {
192
+ self.doCanCel();
193
+ this.$refs.menutoolbar.setAllReadOnly(true);
194
+ if (this.treeSeletedNode.length > 0) {
195
+ this.initForm(this.treeSeletedNode[0]);
196
+ }
197
+ }
198
+ };
199
+ obj.onCancel = () => {
200
+ self.doCanCel();
201
+ };
202
+ this.checkData(obj);
203
+ },
204
+ search () {
205
+ let obj = this.getSearchParam();
206
+ this.treeSeletedNode = [];
207
+ if (!this.searchValue) {
208
+ this.showTree = true;
209
+ } else {
210
+ obj['$or'] = [];
211
+ let code = {};
212
+ code[this.myConfig.treeConfig.responseCode] = {'LIKE':'%' + this.searchValue + '%'};
213
+ obj['$or'].push(code);
214
+ let name = {};
215
+ code[this.myConfig.treeConfig.responseName] = {'LIKE':'%' + this.searchValue + '%'};
216
+ obj['$or'].push(name);
217
+ this.$refs.grid.clearSearchBeforeSearchParam();
218
+ this.$refs.grid.setSearchBeforeSearchParam(obj);
219
+ this.$refs.grid.refurbish();
220
+ this.showTree = false;
221
+ }
222
+ },
223
+ getSearchParam () {
224
+ let searchParam = this.$Method.copy(this.myConfig.treeConfig.searchParam);
225
+ if (!searchParam) {
226
+ searchParam = {};
227
+ }
228
+ return searchParam;
229
+ },
230
+ refurbish () {
231
+ this.treeSeletedNode = [];
232
+ this.initTree();
233
+ },
234
+ gridOnSelectionChange(rows) {
235
+ let obj = {};
236
+ obj.name = 'gridOnSelectionChange';
237
+ obj.para = rows;
238
+ this.$emit('doAction', obj);
239
+ },
240
+ gridOverrideData (data) {
241
+ if (data && data.length > 0) {
242
+ let self = this;
243
+ this.$nextTick(() => {
244
+ let index = 0;
245
+ if (self.treeSeletedNode.length > 0) {
246
+ let culIndex = data.findIndex(el => el[self.myConfig.billKey]=== self.treeSeletedNode[0][self.myConfig.billKey]);
247
+ if (culIndex > -1) {
248
+ index = culIndex;
249
+ }
250
+ }
251
+ self.$refs.grid.setRowHighlight(index,true);
252
+ self.ph_key = data[index].ph_key;
253
+ self.initForm(data[index]);
254
+ self.$refs.form.setReadOnly(true);
255
+ self.$refs.menutoolbar.setAllReadOnly(false);
256
+ self.$refs.menutoolbar.setReadOnly('saveData', true);
257
+ });
258
+ } else {
259
+ this.$refs.form.clearData();
260
+ this.$refs.form.setReadOnly(true);
261
+ this.$refs.menutoolbar.setAllReadOnly(true);
262
+ }
263
+
264
+ return data;
265
+ },
266
+ gridClick(e) {
267
+ let obj = {};
268
+ let self = this;
269
+ obj.onOk = () => {
270
+ self.treeSeletedNode = [e];
271
+ self.initForm(e);
272
+ };
273
+ obj.onCancel = () => {
274
+ self.doCanCel();
275
+ };
276
+ this.checkData(obj);
277
+ },
278
+ doCanCel () {
279
+ this.$nextTick(() => {
280
+ if (this.showTree) {
281
+ this.$refs.tree.setData(this.treeSeletedNode);
282
+ } else {
283
+ this.$refs.grid.setAllRowHighlight(false);
284
+ let data = self.$refs.grid.getData();
285
+ let index = data.findIndex(el => el[self.myConfig.billKey] === self.treeSeletedNode[0][self.myConfig.billKey]);
286
+ if (index > -1) {
287
+ this.$refs.grid.setRowHighlight(index, true);
288
+ } else {
289
+ this.$refs.grid.clearCurrentRow();
290
+ }
291
+ }
292
+ });
293
+
294
+ },
295
+ getForm() {
296
+ return this.$refs.form;
297
+ },
298
+ getGrid() {
299
+ return this.$refs.grid;
300
+ },
301
+ getTree() {
302
+ return this.$refs.tree;
303
+ },
304
+ getMenuToolbar() {
305
+ return this.$refs.menutoolbar;
306
+ },
307
+ quickChagne () {
308
+ this.search();
309
+ },
310
+ initTree(flag) {
311
+ this.$refs.tree.refurbish();
312
+ this.$nextTick(() => {
313
+ if (this.treeSeletedNode.length > 0) {
314
+ this.$refs.tree.setData(this.treeSeletedNode);
315
+ }
316
+ if (!flag) {
317
+ this.initForm(this.treeSeletedNode[0]);
318
+ }
319
+ });
320
+ },
321
+ updateTree(data,flag) {
322
+ this.$refs.tree.updaeNode(data,'U');
323
+ },
324
+ initForm (para) {
325
+ this.$refs.form.clearData();
326
+ let data = {};
327
+ this.$refs.menutoolbar.setAllReadOnly(true);
328
+ if (!para) {
329
+ return;
330
+ }
331
+ let rootNode = this.$refs.tree.getRootNode();
332
+ if (para[this.myConfig.treeConfig.idField] === rootNode[this.myConfig.treeConfig.idField]) {
333
+ data = this.$Method.copy(rootNode);
334
+ this.$refs.menutoolbar.setReadOnly(['addChildData'], false);
335
+ } else {
336
+ data = this.getFormData(para);
337
+ if (this.$refs.tree.isChildren(para)) {
338
+ this.$refs.menutoolbar.setReadOnly(['editData','addSelfData','addChildData'], false);
339
+ } else {
340
+ this.$refs.menutoolbar.setReadOnly(['editData','addSelfData','addChildData','delData'], false);
341
+ }
342
+ }
343
+ if (this.$parent.setBillData) {
344
+ data = this.$parent.setBillData(data);
345
+ }
346
+ this.$refs.form.setData(data);
347
+ this.$nextTick(() => {
348
+ this.$refs.form.setReadOnly(true);
349
+ });
350
+ if (this.$parent.initFormAfter) {
351
+ this.$parent.initFormAfter(data);
352
+ }
353
+ },
354
+ getFormData (para) {
355
+ if (this.$parent.getFormData) {
356
+ return this.$parent.getFormData(para);
357
+ } else {
358
+ let result = {};
359
+ let self = this;
360
+ let tmp = {};
361
+ if (!para[this.myConfig.billKey]) {
362
+ tmp[this.myConfig.billKey] = this.ph_key;
363
+ } else {
364
+ tmp[this.myConfig.billKey] = para[this.myConfig.billKey];
365
+ }
366
+ self.synchroPost(self.myConfig.resources,self.myConfig.classPrefix+'.get', tmp, function (data) {
367
+ result = data[self.config.response];
368
+ });
369
+ return result;
370
+ }
371
+ },
372
+ doAction(obj) {
373
+ const method = obj.name;
374
+ const methodBefore = method + 'Before';
375
+ const methodAfter = method + 'After';
376
+ if (obj.name === 'addSelfData' || obj.name === 'addChildData' || obj.name === 'editData' ) {
377
+ let flag = true;
378
+ let temp = {};
379
+ if (this.$parent[methodBefore]) {
380
+ flag = this.$parent[methodBefore](temp);
381
+ }
382
+ if (flag) {
383
+ if (obj.name === 'addSelfData' || obj.name === 'addChildData') {
384
+ this.$refs.form.setReadOnly(false);
385
+ this.$refs.form.clearData();
386
+ this.$refs.form.setData(temp);
387
+ this.$refs.menutoolbar.setAllReadOnly(true);
388
+ this.$refs.menutoolbar.setReadOnly('saveData', false);
389
+ }
390
+ if (obj.name === 'editData') {
391
+ if (this.treeSeletedNode.length === 0) {
392
+ this.alert('请先选择节点');
393
+ return false;
394
+ }
395
+
396
+ let obj = this.$refs.tree.getRootNode();
397
+ if (obj[this.myConfig.treeConfig.responseCode] === this.treeSeletedNode[0][this.myConfig.treeConfig.responseCode]) {
398
+ this.alert('当前节点不允许修改');
399
+ return false;
400
+ }
401
+
402
+ this.$refs.form.setReadOnly(false);
403
+
404
+ this.$refs.menutoolbar.setReadOnly('editData', true);
405
+ this.$refs.menutoolbar.setReadOnly('saveData', false);
406
+ }
407
+
408
+ if (this.$parent[methodAfter]) {
409
+ this.$parent[methodAfter]();
410
+ }
411
+ }
412
+ } else {
413
+ if (obj.name === 'saveData') {
414
+ let flag = this.$refs.form.checkValidate();
415
+ if (flag) {
416
+ this.alert('必填项不允许为空');
417
+ return false;
418
+ }
419
+ flag = this.$refs.form.isEdit();
420
+ if (flag) {
421
+ this.alert('存在数据未确认');
422
+ return false;
423
+ }
424
+ let data = this.$refs.form.getChangeData();
425
+ obj.para = [];
426
+ obj.para.push(data);
427
+
428
+ }
429
+ if (obj.name === 'delData') {
430
+ let tempData = this.$refs.form.getData();
431
+ tempData.flag = 'D';
432
+ obj.para = tempData;
433
+ }
434
+ obj.onOk = this.onOk;
435
+ let flag = true;
436
+ if (this.$parent[methodBefore]) {
437
+ flag = this.$parent[methodBefore](obj);
438
+ }
439
+ if (!flag) {
440
+ return;
441
+ }
442
+ if (obj.name === 'delData') {
443
+ let text = '保存';
444
+ if (obj.name === 'delData') {
445
+ text = '删除';
446
+ }
447
+ let self = this;
448
+ self.$Modal.confirm({
449
+ title:'确认',
450
+ content:'是否确认'+text+'数据?',
451
+ onOk:() => {
452
+ self.$emit('doAction', obj);
453
+ }
454
+ });
455
+ } else {
456
+ this.$emit('doAction', obj);
457
+ }
458
+ }
459
+ },
460
+ onOk (action, data) {
461
+ if (action.name === 'saveData') {
462
+ this.$refs.menutoolbar.setAllReadOnly(true);
463
+ this.initForm(data[0]);
464
+ this.$refs.form.setReadOnly(true);
465
+ let temp = this.$refs.form.getData();
466
+ this.treeSeletedNode =[temp];
467
+ //this.initTree(true);
468
+ this.$refs.tree.updateNode(temp,'U');
469
+ if (!this.showTree) {
470
+ this.$refs.grid.refurbish();
471
+ }
472
+ this.$refs.menutoolbar.setReadOnly(['addSelfData','addChildData','editData'], false);
473
+ }
474
+ if (action.name === 'delData') {
475
+ this.$refs.tree.updateNode(this.treeSeletedNode[0],'D');
476
+ this.treeSeletedNode = [];
477
+ this.$refs.form.setReadOnly(true);
478
+ this.$refs.form.clearData();
479
+ if (!this.showTree) {
480
+ this.$refs.grid.refurbish();
481
+ }
482
+ this.$refs.menutoolbar.setReadOnly(['addSelfData','addChildData','editData'], false);
483
+ }
484
+ },
485
+ checkData (obj) {
486
+ let tempflag = false;
487
+ tempflag = this.$refs.form.isEdit();
488
+ if (tempflag) {
489
+ let self = this;
490
+ self.$Modal.confirm({
491
+ title:'确认',
492
+ content:'数据存在数据未确认,是否放弃?',
493
+ onOk:() => {
494
+ this.checkChangeData(obj);
495
+ },
496
+ onCancel:() => {
497
+ if (obj.onCancel) {
498
+ obj.onCancel();
499
+ }
500
+ }
501
+ });
502
+ } else {
503
+ this.checkChangeData(obj);
504
+ }
505
+ },
506
+ checkChangeData(obj) {
507
+ let flag = false;
508
+ flag = this.$refs.form.isChange();
509
+ if (flag) {
510
+ let self = this;
511
+ self.$Modal.confirm({
512
+ title:'确认',
513
+ content:'数据有修改未保存,是否放弃修改?',
514
+ onOk:() => {
515
+ if (obj.onOk) {
516
+ obj.onOk();
517
+ }
518
+ },
519
+ onCancel:() => {
520
+ if (obj.onCancel) {
521
+ obj.onCancel();
522
+ }
523
+ }
524
+ });
525
+ } else {
526
+ if (obj.onOk) {
527
+ obj.onOk();
528
+ }
529
+ }
530
+ },
531
+ setTreeAndGridAndFormHeight() {
532
+ let height = this.$refs.head.offsetHeight + this.$refs.para.offsetHeight + 62;
533
+ this.$refs.tree.setOutsideHeight(height);
534
+ this.$refs.grid.setOutsideHeight(height);
535
+ let height2 = this.$refs.head.offsetHeight;
536
+ this.$refs.form.setOutsideHeight(height2);
537
+ },
538
+ setTreeNodeIcon(params, obj) {
539
+
540
+ const hasChildren =
541
+ params.data.children &&
542
+ params.data.children.length > 0
543
+
544
+ if (hasChildren) {
545
+ if (params.data.expand) {
546
+ obj.type = '_custom-wenjianzhankai'
547
+ } else {
548
+ obj.type = '_custom-wenjianshouqi'
549
+ }
550
+ } else {
551
+ obj.type = '_custom-yemian'
552
+ }
553
+
554
+ if (this.setCustomTreeNodeIcon) {
555
+ obj = this.setCustomTreeNodeIcon(params, obj)
556
+ }
557
+
558
+ return obj
559
+ },
560
+ getSelectedNode() {
561
+ let obj = {};
562
+ if (this.treeSeletedNode.length > 0) {
563
+ obj = this.$Method.copy(this.treeSeletedNode[0]);
564
+ }
565
+ return obj;
566
+ },
567
+ getChangeData() {
568
+ return this.$refs.form.getChangeData();
569
+ },
570
+ setDetailVisible(name,value) {
571
+ this.$refs.form.setVisible(name, value);
572
+ },
573
+ getTreeCondition() {
574
+ return this.$refs.condition;
575
+ },
576
+ conditionValueChanged(e) {
577
+ let flag = true;
578
+ if (this.conditionConfig.onChange) flag = this.conditionConfig.onChange(e);
579
+ if (flag === undefined) flag = true;
580
+ if (!flag) return flag;
581
+
582
+ this.$nextTick(() => {
583
+ let tmp = {};
584
+ let self = this;
585
+ tmp.onOk = () => {
586
+ let para = {};
587
+ let value = self.$refs.condition.getValue();
588
+ if (value) {
589
+ para[self.conditionConfig.name] = value;
590
+ }
591
+ self.searchValue = '';
592
+ self.showTree = true;
593
+ self.treeSeletedNode = [];
594
+ self.$refs.form.clearData();
595
+ self.$refs.menutoolbar.setAllReadOnly(true);
596
+ self.$refs.form.setReadOnly(true);
597
+ self.$refs.tree.refurbish(para);
598
+ self.conditionValue = value;
599
+ };
600
+ tmp.onCancel = () => {
601
+ self.$refs.condition.setValue(self.conditionValue);
602
+ }
603
+ self.checkData(tmp);
604
+ });
605
+ return true;
606
+ }
607
+ },
608
+ mounted () {
609
+ this.observer = elementResizeDetectorMaker();
610
+ if (this.$refs.head) {
611
+ this.observer.listenTo(this.$refs.head, this.setTreeAndGridAndFormHeight);
612
+ }
613
+ if (this.$refs.para) {
614
+ this.observer.listenTo(this.$refs.para, this.setTreeAndGridAndFormHeight);
615
+ }
616
+ this.headHeight = this.$refs.head.offsetHeight;
617
+ this.$nextTick(() => {
618
+ this.$refs.form.setReadOnly(true);
619
+ this.$refs.menutoolbar.setAllReadOnly(false);
620
+ this.refurbish();
621
+ });
622
+ },
623
+ beforeUnmount() {
624
+ if (this.$refs.head) {
625
+ this.observer.removeListener(this.$refs.head, this.setTreeAndGridAndFormHeight);
626
+ }
627
+ if (this.$refs.para) {
628
+ this.observer.removeListener(this.$refs.para, this.setTreeAndGridAndFormHeight);
629
+ }
630
+ }
631
+ };
632
+ </script>
633
+
634
+ <style>
635
+
636
+ </style>