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,1028 +1,1028 @@
1
- <template>
2
- <div style="background:#fff;">
3
- <div ref="headarea">
4
- <Affix>
5
- <slot name="toolbar"></slot>
6
- <Anchor v-if="showAnchorLink" ref="anchorobject" style="position:absolute;z-index:99;right:0px;top:64px;width:200px" :affix="false" :show-ink="false" @on-select="anchorChange" @on-change="anchorChange" offset-top="5" :container="'div#' + headid" :bounds="2" >
7
- <AnchorLink v-for="temp in curlAnchorData" :key="'anchor_' + temp.id" :href="temp.id" :class="anchorid == temp.id?'ivu-anchor-link-active':''" v-show="temp.visible" :title="temp.name" style="margin-bottom:5px;margin-top:5px"/>
8
- </Anchor>
9
- </Affix>
10
- </div>
11
- <Card :padding="0" :bordered="false" style="padding-top:0px;padding-left:16px;padding-right:16px;padding-bottom:14px;" dis-hover>
12
- <div :id="headid" :style="style2" @scroll="handleScroll">
13
- <div v-for="(item,index) in myConfig.formsConfig.items" :id="item.divId" :key="item.divId" v-show="headVisible[index].visible">
14
- <Formcard :ref="item.name" :config="item" :dictData="dictData" @doAction="doAction" >
15
- </Formcard>
16
- </div>
17
- <div v-for="(temp2,index) in detailConfig.items" :key="temp2.divId" :id="temp2.divId" v-show="detailVisible[index].visible" >
18
- <EditGridCardS v-if="temp2.type === 'EditGridCard'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
19
- <DetailsBoxs v-if="temp2.type === 'DetailsBox'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
20
- <FormCardBox v-if="temp2.type === 'FormCardBox'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
21
- <AppendixBoxs v-if="temp2.type === 'AppendixBox'" :ref="temp2.name" :config="temp2" :modulecode="modulecode" @doAction="doAction"/>
22
- <FormCardBox2 v-if="temp2.type === 'FormCardBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
23
- <AppendixBoxs2 v-if="temp2.type === 'AppendixBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData" :modulecode="modulecode" @handleSuccessAfter="handleSuccessAfter" @doAction="doAction"/>
24
- </div>
25
- </div>
26
- </Card>
27
- </div>
28
- </template>
29
- <script>
30
- import elementResizeDetectorMaker from 'element-resize-detector'
31
- import EditGridCardS from './editgridcard.vue';
32
- import DetailsBoxs from './detailsbox.vue';
33
- import AppendixBoxs from './appendix.vue';
34
- import AppendixBoxs2 from './contractappendix.vue';
35
- import FormCardBox2 from '../form/formcardbox2.vue';
36
- import random from '../../utils/random_str';
37
- import Formcard from './formcard.vue';
38
- export default {
39
- name:'mbilldetailform',
40
- components:{AppendixBoxs2, Formcard,EditGridCardS,DetailsBoxs,AppendixBoxs,FormCardBox2},
41
- data () {
42
- return {
43
- curlEditObject:'',
44
- title:'单据详情',
45
- singleForm:{},
46
- readOnly:false,
47
- showAnchorLink:false,
48
- operVisible:true,
49
- approvalVisible:true,
50
- rowBtnVisible:false,
51
- showBtnToolbar:true,
52
- anchorData:[],
53
- curlAnchorData:[],
54
- myConfig:{
55
- saveModel:'whole', // whole整体保存,part局部
56
- adjustHeight:0,
57
- showApprovalLog:false,
58
- approvalConfig:{}
59
- },
60
- detailVisible:[],
61
- headVisible:[],
62
- menuToolbar:{
63
-
64
- },
65
- logName:[],
66
- anchorid:'',
67
- detailConfig:{},
68
- offsetTop: 64,
69
- editFlag:false,
70
- extraHeight:0,
71
- outsideHeight:0,
72
- modulecode:'',
73
- billAppendixConfig:{
74
- showAppendix:false,
75
- appendixKey:'billno',
76
- showAppendix2:false
77
- },
78
- billapprovalUrl:'',
79
- showAffix:true,
80
- headid:'mainbody'
81
-
82
- };
83
- },
84
- created () {
85
- this.myConfig = Object.assign({}, this.myConfig, this.config);
86
- if (this.myConfig.showBtnToolbar !== undefined) {
87
- this.showBtnToolbar = this.myConfig.showBtnToolbar;
88
- }
89
- let modetype = '1';
90
- if (this.myConfig.modetype !== undefined) {
91
- modetype = this.myConfig.modetype;
92
- }
93
- this.headid = this.headid + this.getRandom(6);
94
- if (this.myConfig.formsConfig.items.length > 0){
95
- this.headVisible = [];
96
- if (!this.myConfig.formsConfig.lineNum) {
97
- this.myConfig.formsConfig.lineNum = 3;
98
- }
99
- this.myConfig.formsConfig.items.forEach((el, index) => {
100
- if (el.name === undefined) {
101
- el.name = 'headForm_' + index;
102
- }
103
- if (el.showEffectValue === undefined) {
104
- if (this.myConfig.showEffectValue) {
105
- el.showEffectValue = this.myConfig.showEffectValue;
106
- }
107
- }
108
- if (el.lineNum === undefined) {
109
- el.lineNum = this.myConfig.formsConfig.lineNum;
110
- }
111
- if (el.labelWidth === undefined) {
112
- if (el.lineNum === 3) {
113
- el.labelWidth = 120;
114
- }
115
- if (el.lineNum === 4) {
116
- el.labelWidth = 100;
117
- }
118
- }
119
- if (!el.title && index === 0) {
120
- el.title = this.title;
121
- }
122
- el.type = 'FormCardBox';
123
- el.modetype = modetype;
124
- el.divId = 'headForm_' + this.getRandom() + '_' + index;
125
- this.headVisible.push({refname:el.name,visible:true});
126
- this.anchorData.push({id:'#'+el.divId ,name:el.title,visible:true,refname:el.name,isHead:true});
127
- });
128
- }
129
-
130
- if (this.myConfig.billDetailConfig !== undefined) {
131
- this.detailConfig = Object.assign({}, this.detailConfig, this.myConfig.billDetailConfig);
132
- this.detailVisible = [];
133
- if (this.detailConfig.items) {
134
- this.detailConfig.items.forEach((el, index) => {
135
- if (el.type === 'EditGridCard') {
136
- el.generalOrientation = true;
137
- if (el.dynamicHeight === undefined) {
138
- el.dynamicHeight = true;
139
- }
140
- if (el.height === undefined) {
141
- if (el.dynamicHeight !== false) {
142
- el.height = 260;
143
- } else {
144
- el.height = 260;
145
- }
146
- }
147
- el.showBorder = true;
148
- if (el.editItemMaxNum === undefined){
149
- el.editItemMaxNum = 20;
150
- }
151
- }
152
- el.modetype = modetype;
153
- if (el.showEffectValue === undefined) {
154
- if (this.myConfig.showEffectValue) {
155
- el.showEffectValue = this.myConfig.showEffectValue;
156
- }
157
- }
158
- if (el.showEffectValue) {
159
- if (el.effectKey === undefined) {
160
- if (this.myConfig.effectKey) {
161
- el.effectKey = this.myConfig.effectKey;
162
- }
163
- }
164
- }
165
- el.divId = 'detail_'+ this.getRandom() + '_'+ index;
166
- this.detailVisible.push({refname:el.name,visible:true});
167
- this.anchorData.push({id:'#'+ el.divId, name:el.title,refname:el.name,visible:true,isHead:false});
168
- });
169
- }
170
- }
171
- if (this.myConfig.billAppendixConfig) {
172
- this.billAppendixConfig = Object.assign({}, this.billAppendixConfig, this.myConfig.billAppendixConfig);
173
- }
174
-
175
- if (this.myConfig.modulecode !== undefined) {
176
- this.modulecode = this.myConfig.modulecode;
177
- }
178
-
179
- if (this.billAppendixConfig.showAppendix) {
180
- let tmp = Object.assign({}, {}, this.billAppendixConfig);
181
- tmp.type = 'AppendixBox';
182
- tmp.name = 'detail_appenndix';
183
- tmp.title = '附件';
184
- tmp.beforeUpload = this.beforeUpload;
185
- tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
186
- this.detailConfig.items.push(tmp);
187
- this.detailVisible.push({refname:tmp.name,visible:true});
188
- this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title,refname:tmp.name,visible:true});
189
- } else if (this.billAppendixConfig.showAppendix2) {
190
- let tmp = Object.assign({}, {}, this.billAppendixConfig);
191
- tmp.type = 'AppendixBox2';
192
- tmp.name = 'detail_appenndix2';
193
- tmp.title = '附件';
194
- tmp.beforeUpload = this.beforeUpload;
195
- tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
196
- this.detailConfig.items.push(tmp);
197
- this.detailVisible.push({refname:tmp.name,visible:true});
198
- this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title,refname:tmp.name,visible:true});
199
- }
200
-
201
- if (this.myConfig.showAnchorLink !== undefined) {
202
- this.showAnchorLink = this.myConfig.showAnchorLink;
203
- }
204
- },
205
- computed:{
206
- style2 () {
207
- let height = this.$Store.state.app.clientHeight;
208
- if (this.extraHeight) {
209
- height = height - Number(this.extraHeight);
210
- }
211
- if (this.outsideHeight) {
212
- height = height - Number(this.outsideHeight);
213
- }
214
- height = height - 40;
215
- if (this.showAnchorLink) {
216
- return 'overflow-y: auto;height:' + height + 'px;overflow-x: hidden;padding-right:200px;';
217
- } else {
218
- return 'overflow-y: auto;height:' + height + 'px;overflow-x: hidden;';
219
- }
220
- }
221
- },
222
-
223
- methods:{
224
- getCurlAnchorData() {
225
- let tmp = [];
226
- this.anchorData.forEach(el => {
227
- if (el.visible) {
228
- tmp.push(el);
229
- }
230
- });
231
- return tmp;
232
- },
233
- getRandom() {
234
- return random(8);
235
- },
236
- beforeUpload() {
237
- if (this.billAppendixConfig.showAppendix) {
238
- if (this.$refs.detail_appenndix && this.$refs.detail_appenndix[0]) {
239
- let data = this.getData();
240
- let billno = data[this.billAppendixConfig.appendixKey];
241
- let billmoduleid = data.billmoduleid;
242
- this.$refs.detail_appenndix[0].setData(billno,billmoduleid);
243
- }
244
- }
245
- // else if (this.billAppendixConfig.showAppendix2) {
246
- // if (this.$refs.detail_appenndix2 && this.$refs.detail_appenndix2[0]) {
247
- // let data = this.getData();
248
- // let billno = data[this.billAppendixConfig.appendixKey];
249
- // let billmoduleid = data.billmoduleid;
250
- // this.$refs.detail_appenndix2[0].setData(billno,billmoduleid);
251
- // }
252
- // }
253
- },
254
- doAction (obj) {
255
- if (obj.name === 'editGrid' || obj.name === 'cancelGrid') {
256
- this[obj.name](obj);
257
- } else {
258
- if (obj.name === 'addData') {
259
- this.curlEditObject = '';
260
- }
261
- this.$emit('doAction' , obj);
262
- }
263
- },
264
- doRowBtn () {
265
- if (this.myConfig.rowBtnMethod) {
266
- let obj = {};
267
- obj.name = this.myConfig.rowBtnMethod;
268
- this.$emit('doAction' , obj);
269
- }
270
- },
271
- anchorClick(id) {
272
- let temp = this.anchorData.find(el => el.id === id);
273
- if (temp && temp.refname) {
274
- if (this.$refs[temp.refname]) {
275
- if (this.$refs[temp.refname] instanceof Array) {
276
- if (this.$refs[temp.refname][0]) {
277
- if (this.$refs[temp.refname][0].setShowGrid) {
278
- this.$refs[temp.refname][0].setShowGrid(true);
279
- } else {
280
- this.setShowForm(true,temp.refname);
281
- }
282
- }
283
- } else {
284
- if (this.$refs[temp.refname].setShowGrid) {
285
- this.$refs[temp.refname].setShowGrid(true);
286
- } else {
287
- this.setShowForm(true);
288
- }
289
- }
290
- } else {
291
- this.setShowForm(true,temp.refname);
292
- }
293
- }
294
- },
295
- setShowForm(value, name) {
296
- if (this.$refs[name] && this.$refs[name][0]) {
297
- this.$refs[name][0].setShowForm(value)
298
- }
299
- },
300
- handleScroll(e) {
301
- if (this.readOnly) {
302
- return;
303
- }
304
- this.anchorData.forEach(el => {
305
- if (!el.isHead) {
306
- if (this.$refs[el.refname] && this.$refs[el.refname][0] && this.$refs[el.refname][0].cancelCellEditing) {
307
- this.$refs[el.refname][0].cancelCellEditing();
308
- }
309
- }
310
- });
311
- },
312
- anchorChange(id) {
313
- this.$nextTick(() => {
314
- if (id !== '#') {
315
- let index = this.anchorData.findIndex(el => el.id === id);
316
- if (index === -1) {
317
- this.anchorid = this.anchorData[0].id;
318
- document.getElementById(this.headid).scrollTop = 5;
319
- this.anchorClick(this.anchorid);
320
- } else {
321
- this.anchorid = id;
322
- this.anchorClick(this.anchorid);
323
- }
324
-
325
- } else {
326
- this.anchorid = this.anchorData[0].id;
327
- document.getElementById(this.headid).scrollTop = 5;
328
- }
329
- });
330
- },
331
- setVisibleCommon(name , value) {
332
- let index = this.anchorData.findIndex(el2 => el2.refname === name);
333
- if (index > -1) {
334
- let temp = Object.assign({}, this.anchorData[index], {visible:value});
335
- this.anchorData.splice(index ,1, temp);
336
- if (!this.anchorData[index].isHead) {
337
- if (this.detailVisible && this.detailVisible.length > 0) {
338
- let indexConfig = this.detailVisible.findIndex(el3 => el3.refname === name);
339
- if (indexConfig > -1) {
340
- let config = Object.assign({}, this.detailVisible[indexConfig], {visible:value});
341
- this.detailVisible.splice(indexConfig ,1, config);
342
- }
343
- }
344
- } else {
345
- if (this.headVisible && this.headVisible.length > 0) {
346
- let indexConfig = this.headVisible.findIndex(el3 => el3.refname === name);
347
- if (indexConfig > -1) {
348
- let config = Object.assign({}, this.headVisible[indexConfig], {visible:value});
349
- this.headVisible.splice(indexConfig ,1, config);
350
- }
351
- }
352
- }
353
- }
354
- this.resetAnchor();
355
- },
356
- setRowBtnVisible(value) {
357
- this.rowBtnVisible = value;
358
- },
359
- setEffectData(data) {
360
- this.myConfig.formsConfig.items.forEach(el => {
361
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
362
- this.$refs[el.name][0].setEffectData(data);
363
- }
364
- });
365
- if (this.detailConfig.items) {
366
- this.detailConfig.items.forEach(el => {
367
- if (data[el.name]) {
368
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
369
- if (el.type === 'DetailsBox') {
370
- let tempDetailData = this.setDetailsBox(el, data);
371
- this.$refs[el.name][0].setEffectData(tempDetailData);
372
- } else {
373
- if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
374
- if (data[el.name].length > 0) {
375
- this.$refs[el.name][0].setEffectData(data[el.name][0]);
376
- } else {
377
- this.$refs[el.name][0].clearData();
378
- }
379
- } else {
380
- this.$refs[el.name][0].setEffectData(data[el.name]);
381
- }
382
- }
383
- }
384
- } else {
385
- if (this.config.response === el.name) {
386
- if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
387
- let temp = {};
388
- if (el.items) {
389
- el.items.forEach(el2 => {
390
- if (el2.name) {
391
- temp[el2.name] = data[el2.name];
392
- }
393
- if (el2.sname) {
394
- temp[el2.sname] = data[el2.sname];
395
- }
396
- if (el2.ename) {
397
- temp[el2.ename] = data[el2.ename];
398
- }
399
- if (el2.textName) {
400
- temp[el2.textName] = data[el2.textName];
401
- }
402
- });
403
- }
404
- this.$refs[el.name][0].setEffectData(temp);
405
- }
406
- } else {
407
- if (el.type !== 'AppendixBox' || el.type !== 'AppendixBox2') {
408
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
409
- this.$refs[el.name][0].setEffectData([]);
410
- }
411
- }
412
- }
413
- }
414
- });
415
- }
416
- },
417
- setData(data) {
418
- this.myConfig.formsConfig.items.forEach(el => {
419
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
420
- this.$refs[el.name][0].setData(data);
421
- }
422
- });
423
- if (this.detailConfig.items) {
424
- this.detailConfig.items.forEach(el => {
425
- if (data[el.name]) {
426
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
427
- if (el.type === 'DetailsBox') {
428
- let tempDetailData = this.setDetailsBox(el, data);
429
- this.$refs[el.name][0].setData(tempDetailData);
430
- } else {
431
- if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
432
- if (data[el.name].length > 0) {
433
- this.$refs[el.name][0].setData(data[el.name][0]);
434
- } else {
435
- this.$refs[el.name][0].clearData();
436
- }
437
- } else {
438
- this.$refs[el.name][0].setData(data[el.name]);
439
- }
440
- }
441
- }
442
- } else {
443
- if (this.config.response === el.name) {
444
- if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
445
- let temp = {};
446
- if (el.items) {
447
- el.items.forEach(el2 => {
448
- if (el2.name) {
449
- temp[el2.name] = data[el2.name];
450
- }
451
- if (el2.sname) {
452
- temp[el2.sname] = data[el2.sname];
453
- }
454
- if (el2.ename) {
455
- temp[el2.ename] = data[el2.ename];
456
- }
457
- if (el2.textName) {
458
- temp[el2.textName] = data[el2.textName];
459
- }
460
- });
461
- }
462
- this.$refs[el.name][0].setData(temp);
463
- }
464
- } else {
465
- if (el.type !== 'AppendixBox' || el.type !== 'AppendixBox2') {
466
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
467
- this.$refs[el.name][0].setData([]);
468
- }
469
- }
470
- }
471
- }
472
- });
473
- }
474
- if (this.billAppendixConfig.showAppendix) {
475
- if (this.$refs.detail_appenndix && this.$refs.detail_appenndix[0]) {
476
- let billno = data[this.billAppendixConfig.appendixKey];
477
- let billmoduleid = data.billmoduleid
478
- this.$refs.detail_appenndix[0].setData(billno,billmoduleid);
479
- }
480
- } else if (this.billAppendixConfig.showAppendix2) {
481
- if (this.$refs.detail_appenndix2 && this.$refs.detail_appenndix2[0]) {
482
- let billno = data[this.billAppendixConfig.appendixKey];
483
- let billmoduleid = data.billmoduleid
484
- this.$refs.detail_appenndix2[0].setData(billno,billmoduleid);
485
- }
486
- }
487
- this.$nextTick(() => {
488
- this.resetAnchor();
489
- this.curlEditObject = '';
490
- });
491
- },
492
- setDetailsBox(el, data) {
493
- let form = data[el.name];
494
- if (el.gridConfig.items && el.gridConfig.items.length > 0 && el.gridName) {
495
- let gridData = data[el.gridName];
496
- if (form && form.length > 0) {
497
- form.forEach(el2 => {
498
- el2[el.gridName] = [];
499
- if (gridData) {
500
- gridData.forEach(el3 => {
501
- if (el2[el.uniqueKeys] === el3[el.uniqueKeys]) {
502
- el2[el.gridName].push(el3);
503
- }
504
- });
505
- }
506
- });
507
- }
508
- }
509
- return form;
510
- },
511
- getChangeData (detialsname) {
512
- let data = this.getHeadData();
513
- for (let pro in data) {
514
- if (data[pro] instanceof Array) {
515
- if (data[pro].length === 0) {
516
- delete data[pro];
517
- } else {
518
- let temp = [];
519
- data[pro].forEach(el => {
520
- if (el.flag !== undefined) {
521
- temp.push(el);
522
- }
523
- });
524
- if (temp.length > 0) {
525
- data[pro] = temp;
526
- } else {
527
- delete data[pro];
528
- }
529
- }
530
- }
531
- }
532
- if (!data[this.myConfig.billKey]) {
533
- data.flag = 'I';
534
- } else {
535
- data.flag = 'U';
536
- }
537
-
538
- if (this.detailConfig.items) {
539
- if (detialsname) {
540
- let name = [];
541
- if (detialsname instanceof Array) {
542
- name = detialsname;
543
- } else {
544
- name.push(detialsname);
545
- }
546
- name.forEach(el => {
547
- let config = this.detailConfig.items.find(el2 => el2.name === el);
548
- if (config) {
549
- this.getCommonChangeData(data, config);
550
- }
551
- });
552
- this.detailConfig.items.forEach(el => {
553
- let index = name.findIndex(el2 => el.name === el2);
554
- if (index === -1) {
555
- if (el.gridName) {
556
- delete data[el.gridName];
557
- }
558
- delete data[el.name];
559
- }
560
- });
561
- } else {
562
- this.detailConfig.items.forEach(el => {
563
- this.getCommonChangeData(data, el);
564
- });
565
- }
566
- }
567
- return data;
568
- },
569
- getCommonChangeData(data, el) {
570
- if (el.name === 'detail_appenndix' || el.name === 'detail_appenndix2') {
571
- return;
572
- }
573
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
574
- if (el.type === 'DetailsBox') {
575
- Object.assign(data, this.getDetailsBox(el));
576
- } else if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
577
- if (this.config.response === el.name) {
578
- Object.assign(data, this.getFormCardBox(el));
579
- } else {
580
- let temp = this.getFormCardBox(el,true);
581
- if (!temp[this.myConfig.billKey]) {
582
- temp.flag = 'I';
583
- } else {
584
- temp.flag = 'U';
585
- }
586
- data[el.name] = [temp];
587
- }
588
- } else {
589
- data[el.name] = this.$refs[el.name][0].getChangeData();
590
- }
591
- }
592
- },
593
- getFormCardBox (el, flag) {
594
- let data = this.$refs[el.name][0].getData();
595
- if (flag) {
596
- return data;
597
- }
598
- let obj = {};
599
- if (el.items) {
600
- el.items.forEach(el2 => {
601
- if (el2.name) {
602
- obj[el2.name] = data[el2.name];
603
- }
604
- if (el2.sname) {
605
- obj[el2.sname] = data[el2.sname];
606
- }
607
- if (el2.ename) {
608
- obj[el2.ename] = data[el2.ename];
609
- }
610
- if (el2.textName) {
611
- obj[el2.textName] = data[el2.textName];
612
- }
613
- });
614
- }
615
- return obj;
616
- },
617
- getDetailsBox(el) {
618
- let name = el.name;
619
- let form = this.$refs[name][0].getChangeData();
620
- let obj = {};
621
- if (el.gridConfig.items && el.gridConfig.items.length > 0 && el.gridName) {
622
- let gridData = [];
623
- if (form && form.length > 0) {
624
- form.forEach(el2 => {
625
- if (el2[el.gridName] && el2[el.gridName].length > 0) {
626
- if (el2.flag !== 'D') {
627
- el2[el.gridName].forEach(el3 => {
628
- if (el3.flag !== undefined) {
629
- gridData.push(el3);
630
- }
631
- });
632
- } else {
633
- el2[el.gridName].forEach(el3 => {
634
- if (el3['ph_key'] !== undefined && el3['ph_key']) {
635
- el3.flag = 'D';
636
- gridData.push(el3);
637
- } else {
638
- if (el3[this.myConfig.billKey] !== undefined && el3[this.myConfig.billKey]) {
639
- el3.flag = 'D';
640
- gridData.push(el3);
641
- }
642
- }
643
- });
644
- }
645
- }
646
- delete el2[el.gridName];
647
- });
648
- }
649
- if (gridData.length > 0) {
650
- obj[el.gridName] = gridData;
651
- } else {
652
- obj[el.gridName] = [];
653
- }
654
- }
655
- if (form.index) {
656
- delete form.index;
657
- }
658
- obj[el.name] = form;
659
- return obj;
660
- },
661
- getData() {
662
- let data = this.getHeadData();
663
- if (this.detailConfig.items) {
664
- this.detailConfig.items.forEach(el => {
665
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
666
- if (this.config.response === el.name) {
667
- let tempData = this.$refs[el.name][0].getData();
668
- let temp = {};
669
- if (el.items) {
670
- el.items.forEach(el2 => {
671
- if (el2.name) {
672
- temp[el2.name] = tempData[el2.name];
673
- }
674
- if (el2.sname) {
675
- temp[el2.sname] = tempData[el2.sname];
676
- }
677
- if (el2.ename) {
678
- temp[el2.ename] = tempData[el2.ename];
679
- }
680
- if (el2.textName) {
681
- temp[el2.textName] = tempData[el2.textName];
682
- }
683
- });
684
- }
685
- Object.assign(data,temp);
686
- } else {
687
- data[el.name] = this.$refs[el.name][0].getData();
688
- }
689
-
690
- }
691
- });
692
- }
693
- return data;
694
- },
695
- getDetailData(name) {
696
- let data = [];
697
- if (this.$refs[name] && this.$refs[name][0]) {
698
- data = this.$refs[name][0].getData();
699
- }
700
- return data;
701
- },
702
- setReadOnly(value) {
703
- this.readOnly = value;
704
- this.myConfig.formsConfig.items.forEach(el => {
705
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
706
- this.$refs[el.name][0].setFormReadOnly(value);
707
- }
708
- });
709
- if (this.detailConfig.items) {
710
- this.detailConfig.items.forEach(el => {
711
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
712
- if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
713
- this.$refs[el.name][0].setFormReadOnly(value);
714
- } else {
715
- this.$refs[el.name][0].setReadOnly(value);
716
- }
717
-
718
- }
719
- });
720
- }
721
- },
722
- isChange (){
723
- if (this.readOnly) {
724
- return false;
725
- }
726
- let flag = false;
727
- this.myConfig.formsConfig.items.forEach(el => {
728
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
729
- if (!flag) {
730
- flag = this.$refs[el.name][0].isChange();
731
- }
732
- }
733
- });
734
- if (!flag) {
735
- if (this.detailConfig.items) {
736
- this.detailConfig.items.forEach(el => {
737
- if (!flag) {
738
- if (el.name !== 'detail_appenndix' || el.name !== 'detail_appenndix2') {
739
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
740
- flag = this.$refs[el.name][0].isChange();
741
- }
742
- }
743
- }
744
- });
745
- }
746
- }
747
- return flag;
748
- },
749
- isEdit () {
750
- let flag = false;
751
- if (this.detailConfig.items) {
752
- this.detailConfig.items.some(el => {
753
- if (el.type === 'DetailsBox') {
754
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
755
- if (this.myConfig.modeType === 'part') {
756
- if (el.name !== this.curlEditObject) {
757
- flag = this.$refs[el.name][0].isEdit();
758
- }
759
- } else {
760
- flag = this.$refs[el.name][0].isEdit();
761
- }
762
- }
763
- }
764
- if (flag) {
765
- return true;
766
- }
767
- });
768
- }
769
- return flag;
770
- },
771
- clearData() {
772
- this.billno = '';
773
- this.billstatus = '';
774
- //this.$refs.form.clearData();
775
- this.myConfig.formsConfig.items.forEach(el => {
776
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
777
- this.$refs[el.name][0].clearData();
778
- }
779
- });
780
- if (this.detailConfig.items) {
781
- this.detailConfig.items.forEach(el => {
782
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
783
- this.$refs[el.name][0].clearData();
784
- }
785
- });
786
- }
787
- this.resetAnchor();
788
- },
789
- checkValidate () {
790
- let flag = false;
791
- this.myConfig.formsConfig.items.some((el,index) => {
792
- if (this.headVisible[index].visible) {
793
- flag = this.checkCommonValidate(el)
794
- }
795
- if (flag) {
796
- return true;
797
- }
798
- });
799
- if (!flag) {
800
- if (this.detailConfig.items) {
801
- this.detailConfig.items.some((el,index) => {
802
- if (!flag) {
803
- if (this.detailVisible[index].visible) {
804
- flag = this.checkCommonValidate(el);
805
- }
806
- if (flag) {
807
- return true;
808
- }
809
- }
810
- });
811
-
812
- }
813
- }
814
- return flag;
815
- },
816
- checkCommonValidate(el) {
817
- let flag = false;
818
- if (this.$refs[el.name] && this.$refs[el.name][0] && this.$refs[el.name][0].checkValidate) {
819
- if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
820
- this.$refs[el.name][0].checkValidate();
821
- flag = this.$refs[el.name][0].isError();
822
- } else {
823
- flag = this.$refs[el.name][0].checkValidate();
824
- }
825
- }
826
- return flag;
827
-
828
- },
829
- getForm (name) {
830
- if (this.$refs[name] && this.$refs[name][0]) {
831
- return this.$refs[name][0];
832
- } else {
833
- return null;
834
- }
835
- },
836
- getDetail(name) {
837
- if (this.$refs[name] && this.$refs[name][0]) {
838
- return this.$refs[name][0];
839
- } else {
840
- return null;
841
- }
842
- },
843
- getDetailTitle(name) {
844
- let index = this.anchorData.findIndex(el => el.refname === name);
845
- if (index > -1) {
846
- return this.anchorData[index].name;
847
- }
848
- return '';
849
- },
850
- editObjectBefore(name) {
851
- if (this.curlEditObject) {
852
- if (name && name === this.curlEditObject) {
853
- return true;
854
- } else {
855
- this.alert('存在数据未保存');
856
- return false;
857
- }
858
- }
859
- return true;
860
- },
861
- editForm(obj) {
862
- this.curlEditObject = obj.formname;
863
- },
864
- cancelForm() {
865
- this.curlEditObject = '';
866
- },
867
- editGrid(obj) {
868
- this.curlEditObject = obj.gridname;
869
- },
870
- cancelGrid() {
871
- this.curlEditObject = '';
872
- },
873
- setAllBtnReadOnly(value) {
874
- this.myConfig.formsConfig.items.forEach(el => {
875
- this.getForm(el.name).setBtnReadOnly(value);
876
- });
877
- if (this.detailConfig.items) {
878
- this.detailConfig.items.forEach(el => {
879
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
880
- if (this.config.response !== el.name) {
881
- this.$refs[el.name][0].setBtnReadOnly(value);
882
- }
883
- }
884
- });
885
- }
886
- },
887
- setBtnReadOnly(name, value) {
888
- this.myConfig.formsConfig.items.forEach(el => {
889
- if (el.name === name) {
890
- this.getForm(el.name).setBtnReadOnly(value);
891
- }
892
- });
893
- if (this.detailConfig.items) {
894
- this.detailConfig.items.forEach(el => {
895
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
896
- if (this.config.response !== el.name && el.name === name) {
897
- this.$refs[el.name][0].setBtnReadOnly(value);
898
- }
899
- }
900
- });
901
- }
902
- },
903
- setVisible (name,value) {
904
- this.setVisibleCommon(name, value);
905
- },
906
- setExtraHeight () {
907
- let height = 0;
908
- if (this.$refs.headarea) {
909
- height = this.$refs.headarea.offsetHeight;
910
- }
911
- this.extraHeight = height;
912
- },
913
- setOutsideHeight(value) {
914
- this.outsideHeight = value;
915
- },
916
- delAppenndix() {
917
- if (this.billAppendixConfig.showAppendix) {
918
- this.$refs.detail_appenndix[0].dellAllfile();
919
- } else if (this.billAppendixConfig.showAppendix2) {
920
- this.$refs.detail_appenndix2[0].dellAllfile();
921
- }
922
- },
923
- updateAllfile() {
924
- if (this.billAppendixConfig.showAppendix) {
925
- if (this.billAppendixConfig.notdelfile) {
926
- this.$refs.detail_appenndix[0].updateAllfile();
927
- }
928
- } else if (this.billAppendixConfig.showAppendix2) {
929
- if (this.billAppendixConfig.notdelfile) {
930
- this.$refs.detail_appenndix2[0].updateAllfile();
931
- }
932
- }
933
- },
934
- getHeadData() {
935
- let obj = {};
936
- this.myConfig.formsConfig.items.forEach((el,index) => {
937
- if (this.$refs[el.name] && this.$refs[el.name][0]) {
938
- if (index === 0) {
939
- Object.assign(obj, this.$refs[el.name][0].getData());
940
- } else {
941
- let data = this.$refs[el.name][0].getData();
942
- if (el.items) {
943
- el.items.forEach(el2 => {
944
- if (el2.name) {
945
- obj[el2.name] = data[el2.name];
946
- }
947
- if (el2.sname) {
948
- obj[el2.sname] = data[el2.sname];
949
- }
950
- if (el2.ename) {
951
- obj[el2.ename] = data[el2.ename];
952
- }
953
- if (el2.textName) {
954
- obj[el2.textName] = data[el2.textName];
955
- }
956
- });
957
- }
958
- }
959
- }
960
- });
961
- return obj;
962
- },
963
- getApprovalData() {
964
- let data = this.getHeadData();
965
- let obj = {};
966
- obj.billno = data.billno;
967
- obj.billmoduleid = data.billmoduleid;
968
- obj.billstatus = data.billstatus;
969
- obj.statusName = obj.billstatus;
970
- if (this.dictData.BILLSTATUS) {
971
- let tmp = this.dictData.BILLSTATUS.find(el => el.code === obj.billstatus);
972
- if (tmp) {
973
- obj.statusName = tmp.name;
974
- }
975
- }
976
- return obj;
977
- },
978
- resetAnchor() {
979
- if (this.showAnchorLink) {
980
- this.showAnchorLink = false;
981
- let self = this;
982
- this.$nextTick(() => {
983
- self.curlAnchorData = self.getCurlAnchorData();
984
- self.showAnchorLink = true;
985
- self.$nextTick(() => {
986
- if (!self.anchorid) {
987
- self.anchorid = self.anchorData[0].id;
988
- }
989
- self.anchorChange(self.anchorid)
990
- });
991
- });
992
- }
993
- },
994
- handleSuccessAfter(response, file, fileList) {
995
- this.$emit('handleSuccessAfter' , response, file, fileList);
996
- }
997
- },
998
- props:{
999
- config: {
1000
- type:Object,
1001
- default:null
1002
- },
1003
- dictData: {
1004
- type: Object,
1005
- default: () => {
1006
- return {};
1007
- }
1008
- },
1009
- moduleMethod:{
1010
- type:Array,
1011
- default: () => {
1012
- return [];
1013
- }
1014
- }
1015
- },
1016
- mounted () {
1017
- this.observer = elementResizeDetectorMaker();
1018
- if (this.$refs.headarea) {
1019
- this.observer.listenTo(this.$refs.headarea, this.setExtraHeight);
1020
- }
1021
- },
1022
- beforeUnmount() {
1023
- if (this.$refs.headarea) {
1024
- this.observer.removeListener(this.$refs.headarea, this.setExtraHeight);
1025
- }
1026
- }
1027
- };
1028
- </script>
1
+ <template>
2
+ <div style="background:#fff;">
3
+ <div ref="headarea">
4
+ <Affix>
5
+ <slot name="toolbar"></slot>
6
+ <Anchor v-if="showAnchorLink" ref="anchorobject" style="position:absolute;z-index:99;right:0px;top:64px;width:200px" :affix="false" :show-ink="false" @on-select="anchorChange" @on-change="anchorChange" offset-top="5" :container="'div#' + headid" :bounds="2" >
7
+ <AnchorLink v-for="temp in curlAnchorData" :key="'anchor_' + temp.id" :href="temp.id" :class="anchorid == temp.id?'ivu-anchor-link-active':''" v-show="temp.visible" :title="temp.name" style="margin-bottom:5px;margin-top:5px"/>
8
+ </Anchor>
9
+ </Affix>
10
+ </div>
11
+ <Card :padding="0" :bordered="false" style="padding-top:0px;padding-left:16px;padding-right:16px;padding-bottom:14px;" dis-hover>
12
+ <div :id="headid" :style="style2" @scroll="handleScroll">
13
+ <div v-for="(item,index) in myConfig.formsConfig.items" :id="item.divId" :key="item.divId" v-show="headVisible[index].visible">
14
+ <Formcard :ref="item.name" :config="item" :dictData="dictData" @doAction="doAction" >
15
+ </Formcard>
16
+ </div>
17
+ <div v-for="(temp2,index) in detailConfig.items" :key="temp2.divId" :id="temp2.divId" v-show="detailVisible[index].visible" >
18
+ <EditGridCardS v-if="temp2.type === 'EditGridCard'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
19
+ <DetailsBoxs v-if="temp2.type === 'DetailsBox'" :ref="temp2.name" :config="temp2" :dictData="dictData" @doAction="doAction"/>
20
+ <FormCardBox v-if="temp2.type === 'FormCardBox'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
21
+ <AppendixBoxs v-if="temp2.type === 'AppendixBox'" :ref="temp2.name" :config="temp2" :modulecode="modulecode" @doAction="doAction"/>
22
+ <FormCardBox2 v-if="temp2.type === 'FormCardBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData"/>
23
+ <AppendixBoxs2 v-if="temp2.type === 'AppendixBox2'" :ref="temp2.name" :config="temp2" :dictData="dictData" :modulecode="modulecode" @handleSuccessAfter="handleSuccessAfter" @doAction="doAction"/>
24
+ </div>
25
+ </div>
26
+ </Card>
27
+ </div>
28
+ </template>
29
+ <script>
30
+ import elementResizeDetectorMaker from 'element-resize-detector'
31
+ import EditGridCardS from './editgridcard.vue';
32
+ import DetailsBoxs from './detailsbox.vue';
33
+ import AppendixBoxs from './appendix.vue';
34
+ import AppendixBoxs2 from './contractappendix.vue';
35
+ import FormCardBox2 from '../form/formcardbox2.vue';
36
+ import random from '../../utils/random_str';
37
+ import Formcard from './formcard.vue';
38
+ export default {
39
+ name:'mbilldetailform',
40
+ components:{AppendixBoxs2, Formcard,EditGridCardS,DetailsBoxs,AppendixBoxs,FormCardBox2},
41
+ data () {
42
+ return {
43
+ curlEditObject:'',
44
+ title:'单据详情',
45
+ singleForm:{},
46
+ readOnly:false,
47
+ showAnchorLink:false,
48
+ operVisible:true,
49
+ approvalVisible:true,
50
+ rowBtnVisible:false,
51
+ showBtnToolbar:true,
52
+ anchorData:[],
53
+ curlAnchorData:[],
54
+ myConfig:{
55
+ saveModel:'whole', // whole整体保存,part局部
56
+ adjustHeight:0,
57
+ showApprovalLog:false,
58
+ approvalConfig:{}
59
+ },
60
+ detailVisible:[],
61
+ headVisible:[],
62
+ menuToolbar:{
63
+
64
+ },
65
+ logName:[],
66
+ anchorid:'',
67
+ detailConfig:{},
68
+ offsetTop: 64,
69
+ editFlag:false,
70
+ extraHeight:0,
71
+ outsideHeight:0,
72
+ modulecode:'',
73
+ billAppendixConfig:{
74
+ showAppendix:false,
75
+ appendixKey:'billno',
76
+ showAppendix2:false
77
+ },
78
+ billapprovalUrl:'',
79
+ showAffix:true,
80
+ headid:'mainbody'
81
+
82
+ };
83
+ },
84
+ created () {
85
+ this.myConfig = Object.assign({}, this.myConfig, this.config);
86
+ if (this.myConfig.showBtnToolbar !== undefined) {
87
+ this.showBtnToolbar = this.myConfig.showBtnToolbar;
88
+ }
89
+ let modetype = '1';
90
+ if (this.myConfig.modetype !== undefined) {
91
+ modetype = this.myConfig.modetype;
92
+ }
93
+ this.headid = this.headid + this.getRandom(6);
94
+ if (this.myConfig.formsConfig.items.length > 0){
95
+ this.headVisible = [];
96
+ if (!this.myConfig.formsConfig.lineNum) {
97
+ this.myConfig.formsConfig.lineNum = 3;
98
+ }
99
+ this.myConfig.formsConfig.items.forEach((el, index) => {
100
+ if (el.name === undefined) {
101
+ el.name = 'headForm_' + index;
102
+ }
103
+ if (el.showEffectValue === undefined) {
104
+ if (this.myConfig.showEffectValue) {
105
+ el.showEffectValue = this.myConfig.showEffectValue;
106
+ }
107
+ }
108
+ if (el.lineNum === undefined) {
109
+ el.lineNum = this.myConfig.formsConfig.lineNum;
110
+ }
111
+ if (el.labelWidth === undefined) {
112
+ if (el.lineNum === 3) {
113
+ el.labelWidth = 120;
114
+ }
115
+ if (el.lineNum === 4) {
116
+ el.labelWidth = 100;
117
+ }
118
+ }
119
+ if (!el.title && index === 0) {
120
+ el.title = this.title;
121
+ }
122
+ el.type = 'FormCardBox';
123
+ el.modetype = modetype;
124
+ el.divId = 'headForm_' + this.getRandom() + '_' + index;
125
+ this.headVisible.push({refname:el.name,visible:true});
126
+ this.anchorData.push({id:'#'+el.divId ,name:el.title,visible:true,refname:el.name,isHead:true});
127
+ });
128
+ }
129
+
130
+ if (this.myConfig.billDetailConfig !== undefined) {
131
+ this.detailConfig = Object.assign({}, this.detailConfig, this.myConfig.billDetailConfig);
132
+ this.detailVisible = [];
133
+ if (this.detailConfig.items) {
134
+ this.detailConfig.items.forEach((el, index) => {
135
+ if (el.type === 'EditGridCard') {
136
+ el.generalOrientation = true;
137
+ if (el.dynamicHeight === undefined) {
138
+ el.dynamicHeight = true;
139
+ }
140
+ if (el.height === undefined) {
141
+ if (el.dynamicHeight !== false) {
142
+ el.height = 260;
143
+ } else {
144
+ el.height = 260;
145
+ }
146
+ }
147
+ el.showBorder = true;
148
+ if (el.editItemMaxNum === undefined){
149
+ el.editItemMaxNum = 20;
150
+ }
151
+ }
152
+ el.modetype = modetype;
153
+ if (el.showEffectValue === undefined) {
154
+ if (this.myConfig.showEffectValue) {
155
+ el.showEffectValue = this.myConfig.showEffectValue;
156
+ }
157
+ }
158
+ if (el.showEffectValue) {
159
+ if (el.effectKey === undefined) {
160
+ if (this.myConfig.effectKey) {
161
+ el.effectKey = this.myConfig.effectKey;
162
+ }
163
+ }
164
+ }
165
+ el.divId = 'detail_'+ this.getRandom() + '_'+ index;
166
+ this.detailVisible.push({refname:el.name,visible:true});
167
+ this.anchorData.push({id:'#'+ el.divId, name:el.title,refname:el.name,visible:true,isHead:false});
168
+ });
169
+ }
170
+ }
171
+ if (this.myConfig.billAppendixConfig) {
172
+ this.billAppendixConfig = Object.assign({}, this.billAppendixConfig, this.myConfig.billAppendixConfig);
173
+ }
174
+
175
+ if (this.myConfig.modulecode !== undefined) {
176
+ this.modulecode = this.myConfig.modulecode;
177
+ }
178
+
179
+ if (this.billAppendixConfig.showAppendix) {
180
+ let tmp = Object.assign({}, {}, this.billAppendixConfig);
181
+ tmp.type = 'AppendixBox';
182
+ tmp.name = 'detail_appenndix';
183
+ tmp.title = '附件';
184
+ tmp.beforeUpload = this.beforeUpload;
185
+ tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
186
+ this.detailConfig.items.push(tmp);
187
+ this.detailVisible.push({refname:tmp.name,visible:true});
188
+ this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title,refname:tmp.name,visible:true});
189
+ } else if (this.billAppendixConfig.showAppendix2) {
190
+ let tmp = Object.assign({}, {}, this.billAppendixConfig);
191
+ tmp.type = 'AppendixBox2';
192
+ tmp.name = 'detail_appenndix2';
193
+ tmp.title = '附件';
194
+ tmp.beforeUpload = this.beforeUpload;
195
+ tmp.divId = 'detail_'+ this.getRandom() + '_'+ this.detailConfig.items.length;
196
+ this.detailConfig.items.push(tmp);
197
+ this.detailVisible.push({refname:tmp.name,visible:true});
198
+ this.anchorData.push({id:'#'+ tmp.divId, name:tmp.title,refname:tmp.name,visible:true});
199
+ }
200
+
201
+ if (this.myConfig.showAnchorLink !== undefined) {
202
+ this.showAnchorLink = this.myConfig.showAnchorLink;
203
+ }
204
+ },
205
+ computed:{
206
+ style2 () {
207
+ let height = this.$Store.state.app.clientHeight;
208
+ if (this.extraHeight) {
209
+ height = height - Number(this.extraHeight);
210
+ }
211
+ if (this.outsideHeight) {
212
+ height = height - Number(this.outsideHeight);
213
+ }
214
+ height = height - 40;
215
+ if (this.showAnchorLink) {
216
+ return 'overflow-y: auto;height:' + height + 'px;overflow-x: hidden;padding-right:200px;';
217
+ } else {
218
+ return 'overflow-y: auto;height:' + height + 'px;overflow-x: hidden;';
219
+ }
220
+ }
221
+ },
222
+
223
+ methods:{
224
+ getCurlAnchorData() {
225
+ let tmp = [];
226
+ this.anchorData.forEach(el => {
227
+ if (el.visible) {
228
+ tmp.push(el);
229
+ }
230
+ });
231
+ return tmp;
232
+ },
233
+ getRandom() {
234
+ return random(8);
235
+ },
236
+ beforeUpload() {
237
+ if (this.billAppendixConfig.showAppendix) {
238
+ if (this.$refs.detail_appenndix && this.$refs.detail_appenndix[0]) {
239
+ let data = this.getData();
240
+ let billno = data[this.billAppendixConfig.appendixKey];
241
+ let billmoduleid = data.billmoduleid;
242
+ this.$refs.detail_appenndix[0].setData(billno,billmoduleid);
243
+ }
244
+ }
245
+ // else if (this.billAppendixConfig.showAppendix2) {
246
+ // if (this.$refs.detail_appenndix2 && this.$refs.detail_appenndix2[0]) {
247
+ // let data = this.getData();
248
+ // let billno = data[this.billAppendixConfig.appendixKey];
249
+ // let billmoduleid = data.billmoduleid;
250
+ // this.$refs.detail_appenndix2[0].setData(billno,billmoduleid);
251
+ // }
252
+ // }
253
+ },
254
+ doAction (obj) {
255
+ if (obj.name === 'editGrid' || obj.name === 'cancelGrid') {
256
+ this[obj.name](obj);
257
+ } else {
258
+ if (obj.name === 'addData') {
259
+ this.curlEditObject = '';
260
+ }
261
+ this.$emit('doAction' , obj);
262
+ }
263
+ },
264
+ doRowBtn () {
265
+ if (this.myConfig.rowBtnMethod) {
266
+ let obj = {};
267
+ obj.name = this.myConfig.rowBtnMethod;
268
+ this.$emit('doAction' , obj);
269
+ }
270
+ },
271
+ anchorClick(id) {
272
+ let temp = this.anchorData.find(el => el.id === id);
273
+ if (temp && temp.refname) {
274
+ if (this.$refs[temp.refname]) {
275
+ if (this.$refs[temp.refname] instanceof Array) {
276
+ if (this.$refs[temp.refname][0]) {
277
+ if (this.$refs[temp.refname][0].setShowGrid) {
278
+ this.$refs[temp.refname][0].setShowGrid(true);
279
+ } else {
280
+ this.setShowForm(true,temp.refname);
281
+ }
282
+ }
283
+ } else {
284
+ if (this.$refs[temp.refname].setShowGrid) {
285
+ this.$refs[temp.refname].setShowGrid(true);
286
+ } else {
287
+ this.setShowForm(true);
288
+ }
289
+ }
290
+ } else {
291
+ this.setShowForm(true,temp.refname);
292
+ }
293
+ }
294
+ },
295
+ setShowForm(value, name) {
296
+ if (this.$refs[name] && this.$refs[name][0]) {
297
+ this.$refs[name][0].setShowForm(value)
298
+ }
299
+ },
300
+ handleScroll(e) {
301
+ if (this.readOnly) {
302
+ return;
303
+ }
304
+ this.anchorData.forEach(el => {
305
+ if (!el.isHead) {
306
+ if (this.$refs[el.refname] && this.$refs[el.refname][0] && this.$refs[el.refname][0].cancelCellEditing) {
307
+ this.$refs[el.refname][0].cancelCellEditing();
308
+ }
309
+ }
310
+ });
311
+ },
312
+ anchorChange(id) {
313
+ this.$nextTick(() => {
314
+ if (id !== '#') {
315
+ let index = this.anchorData.findIndex(el => el.id === id);
316
+ if (index === -1) {
317
+ this.anchorid = this.anchorData[0].id;
318
+ document.getElementById(this.headid).scrollTop = 5;
319
+ this.anchorClick(this.anchorid);
320
+ } else {
321
+ this.anchorid = id;
322
+ this.anchorClick(this.anchorid);
323
+ }
324
+
325
+ } else {
326
+ this.anchorid = this.anchorData[0].id;
327
+ document.getElementById(this.headid).scrollTop = 5;
328
+ }
329
+ });
330
+ },
331
+ setVisibleCommon(name , value) {
332
+ let index = this.anchorData.findIndex(el2 => el2.refname === name);
333
+ if (index > -1) {
334
+ let temp = Object.assign({}, this.anchorData[index], {visible:value});
335
+ this.anchorData.splice(index ,1, temp);
336
+ if (!this.anchorData[index].isHead) {
337
+ if (this.detailVisible && this.detailVisible.length > 0) {
338
+ let indexConfig = this.detailVisible.findIndex(el3 => el3.refname === name);
339
+ if (indexConfig > -1) {
340
+ let config = Object.assign({}, this.detailVisible[indexConfig], {visible:value});
341
+ this.detailVisible.splice(indexConfig ,1, config);
342
+ }
343
+ }
344
+ } else {
345
+ if (this.headVisible && this.headVisible.length > 0) {
346
+ let indexConfig = this.headVisible.findIndex(el3 => el3.refname === name);
347
+ if (indexConfig > -1) {
348
+ let config = Object.assign({}, this.headVisible[indexConfig], {visible:value});
349
+ this.headVisible.splice(indexConfig ,1, config);
350
+ }
351
+ }
352
+ }
353
+ }
354
+ this.resetAnchor();
355
+ },
356
+ setRowBtnVisible(value) {
357
+ this.rowBtnVisible = value;
358
+ },
359
+ setEffectData(data) {
360
+ this.myConfig.formsConfig.items.forEach(el => {
361
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
362
+ this.$refs[el.name][0].setEffectData(data);
363
+ }
364
+ });
365
+ if (this.detailConfig.items) {
366
+ this.detailConfig.items.forEach(el => {
367
+ if (data[el.name]) {
368
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
369
+ if (el.type === 'DetailsBox') {
370
+ let tempDetailData = this.setDetailsBox(el, data);
371
+ this.$refs[el.name][0].setEffectData(tempDetailData);
372
+ } else {
373
+ if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
374
+ if (data[el.name].length > 0) {
375
+ this.$refs[el.name][0].setEffectData(data[el.name][0]);
376
+ } else {
377
+ this.$refs[el.name][0].clearData();
378
+ }
379
+ } else {
380
+ this.$refs[el.name][0].setEffectData(data[el.name]);
381
+ }
382
+ }
383
+ }
384
+ } else {
385
+ if (this.config.response === el.name) {
386
+ if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
387
+ let temp = {};
388
+ if (el.items) {
389
+ el.items.forEach(el2 => {
390
+ if (el2.name) {
391
+ temp[el2.name] = data[el2.name];
392
+ }
393
+ if (el2.sname) {
394
+ temp[el2.sname] = data[el2.sname];
395
+ }
396
+ if (el2.ename) {
397
+ temp[el2.ename] = data[el2.ename];
398
+ }
399
+ if (el2.textName) {
400
+ temp[el2.textName] = data[el2.textName];
401
+ }
402
+ });
403
+ }
404
+ this.$refs[el.name][0].setEffectData(temp);
405
+ }
406
+ } else {
407
+ if (el.type !== 'AppendixBox' || el.type !== 'AppendixBox2') {
408
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
409
+ this.$refs[el.name][0].setEffectData([]);
410
+ }
411
+ }
412
+ }
413
+ }
414
+ });
415
+ }
416
+ },
417
+ setData(data) {
418
+ this.myConfig.formsConfig.items.forEach(el => {
419
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
420
+ this.$refs[el.name][0].setData(data);
421
+ }
422
+ });
423
+ if (this.detailConfig.items) {
424
+ this.detailConfig.items.forEach(el => {
425
+ if (data[el.name]) {
426
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
427
+ if (el.type === 'DetailsBox') {
428
+ let tempDetailData = this.setDetailsBox(el, data);
429
+ this.$refs[el.name][0].setData(tempDetailData);
430
+ } else {
431
+ if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
432
+ if (data[el.name].length > 0) {
433
+ this.$refs[el.name][0].setData(data[el.name][0]);
434
+ } else {
435
+ this.$refs[el.name][0].clearData();
436
+ }
437
+ } else {
438
+ this.$refs[el.name][0].setData(data[el.name]);
439
+ }
440
+ }
441
+ }
442
+ } else {
443
+ if (this.config.response === el.name) {
444
+ if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
445
+ let temp = {};
446
+ if (el.items) {
447
+ el.items.forEach(el2 => {
448
+ if (el2.name) {
449
+ temp[el2.name] = data[el2.name];
450
+ }
451
+ if (el2.sname) {
452
+ temp[el2.sname] = data[el2.sname];
453
+ }
454
+ if (el2.ename) {
455
+ temp[el2.ename] = data[el2.ename];
456
+ }
457
+ if (el2.textName) {
458
+ temp[el2.textName] = data[el2.textName];
459
+ }
460
+ });
461
+ }
462
+ this.$refs[el.name][0].setData(temp);
463
+ }
464
+ } else {
465
+ if (el.type !== 'AppendixBox' || el.type !== 'AppendixBox2') {
466
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
467
+ this.$refs[el.name][0].setData([]);
468
+ }
469
+ }
470
+ }
471
+ }
472
+ });
473
+ }
474
+ if (this.billAppendixConfig.showAppendix) {
475
+ if (this.$refs.detail_appenndix && this.$refs.detail_appenndix[0]) {
476
+ let billno = data[this.billAppendixConfig.appendixKey];
477
+ let billmoduleid = data.billmoduleid
478
+ this.$refs.detail_appenndix[0].setData(billno,billmoduleid);
479
+ }
480
+ } else if (this.billAppendixConfig.showAppendix2) {
481
+ if (this.$refs.detail_appenndix2 && this.$refs.detail_appenndix2[0]) {
482
+ let billno = data[this.billAppendixConfig.appendixKey];
483
+ let billmoduleid = data.billmoduleid
484
+ this.$refs.detail_appenndix2[0].setData(billno,billmoduleid);
485
+ }
486
+ }
487
+ this.$nextTick(() => {
488
+ this.resetAnchor();
489
+ this.curlEditObject = '';
490
+ });
491
+ },
492
+ setDetailsBox(el, data) {
493
+ let form = data[el.name];
494
+ if (el.gridConfig.items && el.gridConfig.items.length > 0 && el.gridName) {
495
+ let gridData = data[el.gridName];
496
+ if (form && form.length > 0) {
497
+ form.forEach(el2 => {
498
+ el2[el.gridName] = [];
499
+ if (gridData) {
500
+ gridData.forEach(el3 => {
501
+ if (el2[el.uniqueKeys] === el3[el.uniqueKeys]) {
502
+ el2[el.gridName].push(el3);
503
+ }
504
+ });
505
+ }
506
+ });
507
+ }
508
+ }
509
+ return form;
510
+ },
511
+ getChangeData (detialsname) {
512
+ let data = this.getHeadData();
513
+ for (let pro in data) {
514
+ if (data[pro] instanceof Array) {
515
+ if (data[pro].length === 0) {
516
+ delete data[pro];
517
+ } else {
518
+ let temp = [];
519
+ data[pro].forEach(el => {
520
+ if (el.flag !== undefined) {
521
+ temp.push(el);
522
+ }
523
+ });
524
+ if (temp.length > 0) {
525
+ data[pro] = temp;
526
+ } else {
527
+ delete data[pro];
528
+ }
529
+ }
530
+ }
531
+ }
532
+ if (!data[this.myConfig.billKey]) {
533
+ data.flag = 'I';
534
+ } else {
535
+ data.flag = 'U';
536
+ }
537
+
538
+ if (this.detailConfig.items) {
539
+ if (detialsname) {
540
+ let name = [];
541
+ if (detialsname instanceof Array) {
542
+ name = detialsname;
543
+ } else {
544
+ name.push(detialsname);
545
+ }
546
+ name.forEach(el => {
547
+ let config = this.detailConfig.items.find(el2 => el2.name === el);
548
+ if (config) {
549
+ this.getCommonChangeData(data, config);
550
+ }
551
+ });
552
+ this.detailConfig.items.forEach(el => {
553
+ let index = name.findIndex(el2 => el.name === el2);
554
+ if (index === -1) {
555
+ if (el.gridName) {
556
+ delete data[el.gridName];
557
+ }
558
+ delete data[el.name];
559
+ }
560
+ });
561
+ } else {
562
+ this.detailConfig.items.forEach(el => {
563
+ this.getCommonChangeData(data, el);
564
+ });
565
+ }
566
+ }
567
+ return data;
568
+ },
569
+ getCommonChangeData(data, el) {
570
+ if (el.name === 'detail_appenndix' || el.name === 'detail_appenndix2') {
571
+ return;
572
+ }
573
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
574
+ if (el.type === 'DetailsBox') {
575
+ Object.assign(data, this.getDetailsBox(el));
576
+ } else if (el.type === 'FormCardBox'|| el.type === 'FormCardBox2') {
577
+ if (this.config.response === el.name) {
578
+ Object.assign(data, this.getFormCardBox(el));
579
+ } else {
580
+ let temp = this.getFormCardBox(el,true);
581
+ if (!temp[this.myConfig.billKey]) {
582
+ temp.flag = 'I';
583
+ } else {
584
+ temp.flag = 'U';
585
+ }
586
+ data[el.name] = [temp];
587
+ }
588
+ } else {
589
+ data[el.name] = this.$refs[el.name][0].getChangeData();
590
+ }
591
+ }
592
+ },
593
+ getFormCardBox (el, flag) {
594
+ let data = this.$refs[el.name][0].getData();
595
+ if (flag) {
596
+ return data;
597
+ }
598
+ let obj = {};
599
+ if (el.items) {
600
+ el.items.forEach(el2 => {
601
+ if (el2.name) {
602
+ obj[el2.name] = data[el2.name];
603
+ }
604
+ if (el2.sname) {
605
+ obj[el2.sname] = data[el2.sname];
606
+ }
607
+ if (el2.ename) {
608
+ obj[el2.ename] = data[el2.ename];
609
+ }
610
+ if (el2.textName) {
611
+ obj[el2.textName] = data[el2.textName];
612
+ }
613
+ });
614
+ }
615
+ return obj;
616
+ },
617
+ getDetailsBox(el) {
618
+ let name = el.name;
619
+ let form = this.$refs[name][0].getChangeData();
620
+ let obj = {};
621
+ if (el.gridConfig.items && el.gridConfig.items.length > 0 && el.gridName) {
622
+ let gridData = [];
623
+ if (form && form.length > 0) {
624
+ form.forEach(el2 => {
625
+ if (el2[el.gridName] && el2[el.gridName].length > 0) {
626
+ if (el2.flag !== 'D') {
627
+ el2[el.gridName].forEach(el3 => {
628
+ if (el3.flag !== undefined) {
629
+ gridData.push(el3);
630
+ }
631
+ });
632
+ } else {
633
+ el2[el.gridName].forEach(el3 => {
634
+ if (el3['ph_key'] !== undefined && el3['ph_key']) {
635
+ el3.flag = 'D';
636
+ gridData.push(el3);
637
+ } else {
638
+ if (el3[this.myConfig.billKey] !== undefined && el3[this.myConfig.billKey]) {
639
+ el3.flag = 'D';
640
+ gridData.push(el3);
641
+ }
642
+ }
643
+ });
644
+ }
645
+ }
646
+ delete el2[el.gridName];
647
+ });
648
+ }
649
+ if (gridData.length > 0) {
650
+ obj[el.gridName] = gridData;
651
+ } else {
652
+ obj[el.gridName] = [];
653
+ }
654
+ }
655
+ if (form.index) {
656
+ delete form.index;
657
+ }
658
+ obj[el.name] = form;
659
+ return obj;
660
+ },
661
+ getData() {
662
+ let data = this.getHeadData();
663
+ if (this.detailConfig.items) {
664
+ this.detailConfig.items.forEach(el => {
665
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
666
+ if (this.config.response === el.name) {
667
+ let tempData = this.$refs[el.name][0].getData();
668
+ let temp = {};
669
+ if (el.items) {
670
+ el.items.forEach(el2 => {
671
+ if (el2.name) {
672
+ temp[el2.name] = tempData[el2.name];
673
+ }
674
+ if (el2.sname) {
675
+ temp[el2.sname] = tempData[el2.sname];
676
+ }
677
+ if (el2.ename) {
678
+ temp[el2.ename] = tempData[el2.ename];
679
+ }
680
+ if (el2.textName) {
681
+ temp[el2.textName] = tempData[el2.textName];
682
+ }
683
+ });
684
+ }
685
+ Object.assign(data,temp);
686
+ } else {
687
+ data[el.name] = this.$refs[el.name][0].getData();
688
+ }
689
+
690
+ }
691
+ });
692
+ }
693
+ return data;
694
+ },
695
+ getDetailData(name) {
696
+ let data = [];
697
+ if (this.$refs[name] && this.$refs[name][0]) {
698
+ data = this.$refs[name][0].getData();
699
+ }
700
+ return data;
701
+ },
702
+ setReadOnly(value) {
703
+ this.readOnly = value;
704
+ this.myConfig.formsConfig.items.forEach(el => {
705
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
706
+ this.$refs[el.name][0].setFormReadOnly(value);
707
+ }
708
+ });
709
+ if (this.detailConfig.items) {
710
+ this.detailConfig.items.forEach(el => {
711
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
712
+ if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
713
+ this.$refs[el.name][0].setFormReadOnly(value);
714
+ } else {
715
+ this.$refs[el.name][0].setReadOnly(value);
716
+ }
717
+
718
+ }
719
+ });
720
+ }
721
+ },
722
+ isChange (){
723
+ if (this.readOnly) {
724
+ return false;
725
+ }
726
+ let flag = false;
727
+ this.myConfig.formsConfig.items.forEach(el => {
728
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
729
+ if (!flag) {
730
+ flag = this.$refs[el.name][0].isChange();
731
+ }
732
+ }
733
+ });
734
+ if (!flag) {
735
+ if (this.detailConfig.items) {
736
+ this.detailConfig.items.forEach(el => {
737
+ if (!flag) {
738
+ if (el.name !== 'detail_appenndix' || el.name !== 'detail_appenndix2') {
739
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
740
+ flag = this.$refs[el.name][0].isChange();
741
+ }
742
+ }
743
+ }
744
+ });
745
+ }
746
+ }
747
+ return flag;
748
+ },
749
+ isEdit () {
750
+ let flag = false;
751
+ if (this.detailConfig.items) {
752
+ this.detailConfig.items.some(el => {
753
+ if (el.type === 'DetailsBox') {
754
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
755
+ if (this.myConfig.modeType === 'part') {
756
+ if (el.name !== this.curlEditObject) {
757
+ flag = this.$refs[el.name][0].isEdit();
758
+ }
759
+ } else {
760
+ flag = this.$refs[el.name][0].isEdit();
761
+ }
762
+ }
763
+ }
764
+ if (flag) {
765
+ return true;
766
+ }
767
+ });
768
+ }
769
+ return flag;
770
+ },
771
+ clearData() {
772
+ this.billno = '';
773
+ this.billstatus = '';
774
+ //this.$refs.form.clearData();
775
+ this.myConfig.formsConfig.items.forEach(el => {
776
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
777
+ this.$refs[el.name][0].clearData();
778
+ }
779
+ });
780
+ if (this.detailConfig.items) {
781
+ this.detailConfig.items.forEach(el => {
782
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
783
+ this.$refs[el.name][0].clearData();
784
+ }
785
+ });
786
+ }
787
+ this.resetAnchor();
788
+ },
789
+ checkValidate () {
790
+ let flag = false;
791
+ this.myConfig.formsConfig.items.some((el,index) => {
792
+ if (this.headVisible[index].visible) {
793
+ flag = this.checkCommonValidate(el)
794
+ }
795
+ if (flag) {
796
+ return true;
797
+ }
798
+ });
799
+ if (!flag) {
800
+ if (this.detailConfig.items) {
801
+ this.detailConfig.items.some((el,index) => {
802
+ if (!flag) {
803
+ if (this.detailVisible[index].visible) {
804
+ flag = this.checkCommonValidate(el);
805
+ }
806
+ if (flag) {
807
+ return true;
808
+ }
809
+ }
810
+ });
811
+
812
+ }
813
+ }
814
+ return flag;
815
+ },
816
+ checkCommonValidate(el) {
817
+ let flag = false;
818
+ if (this.$refs[el.name] && this.$refs[el.name][0] && this.$refs[el.name][0].checkValidate) {
819
+ if (el.type === 'FormCardBox' || el.type === 'FormCardBox2') {
820
+ this.$refs[el.name][0].checkValidate();
821
+ flag = this.$refs[el.name][0].isError();
822
+ } else {
823
+ flag = this.$refs[el.name][0].checkValidate();
824
+ }
825
+ }
826
+ return flag;
827
+
828
+ },
829
+ getForm (name) {
830
+ if (this.$refs[name] && this.$refs[name][0]) {
831
+ return this.$refs[name][0];
832
+ } else {
833
+ return null;
834
+ }
835
+ },
836
+ getDetail(name) {
837
+ if (this.$refs[name] && this.$refs[name][0]) {
838
+ return this.$refs[name][0];
839
+ } else {
840
+ return null;
841
+ }
842
+ },
843
+ getDetailTitle(name) {
844
+ let index = this.anchorData.findIndex(el => el.refname === name);
845
+ if (index > -1) {
846
+ return this.anchorData[index].name;
847
+ }
848
+ return '';
849
+ },
850
+ editObjectBefore(name) {
851
+ if (this.curlEditObject) {
852
+ if (name && name === this.curlEditObject) {
853
+ return true;
854
+ } else {
855
+ this.alert('存在数据未保存');
856
+ return false;
857
+ }
858
+ }
859
+ return true;
860
+ },
861
+ editForm(obj) {
862
+ this.curlEditObject = obj.formname;
863
+ },
864
+ cancelForm() {
865
+ this.curlEditObject = '';
866
+ },
867
+ editGrid(obj) {
868
+ this.curlEditObject = obj.gridname;
869
+ },
870
+ cancelGrid() {
871
+ this.curlEditObject = '';
872
+ },
873
+ setAllBtnReadOnly(value) {
874
+ this.myConfig.formsConfig.items.forEach(el => {
875
+ this.getForm(el.name).setBtnReadOnly(value);
876
+ });
877
+ if (this.detailConfig.items) {
878
+ this.detailConfig.items.forEach(el => {
879
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
880
+ if (this.config.response !== el.name) {
881
+ this.$refs[el.name][0].setBtnReadOnly(value);
882
+ }
883
+ }
884
+ });
885
+ }
886
+ },
887
+ setBtnReadOnly(name, value) {
888
+ this.myConfig.formsConfig.items.forEach(el => {
889
+ if (el.name === name) {
890
+ this.getForm(el.name).setBtnReadOnly(value);
891
+ }
892
+ });
893
+ if (this.detailConfig.items) {
894
+ this.detailConfig.items.forEach(el => {
895
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
896
+ if (this.config.response !== el.name && el.name === name) {
897
+ this.$refs[el.name][0].setBtnReadOnly(value);
898
+ }
899
+ }
900
+ });
901
+ }
902
+ },
903
+ setVisible (name,value) {
904
+ this.setVisibleCommon(name, value);
905
+ },
906
+ setExtraHeight () {
907
+ let height = 0;
908
+ if (this.$refs.headarea) {
909
+ height = this.$refs.headarea.offsetHeight;
910
+ }
911
+ this.extraHeight = height;
912
+ },
913
+ setOutsideHeight(value) {
914
+ this.outsideHeight = value;
915
+ },
916
+ delAppenndix() {
917
+ if (this.billAppendixConfig.showAppendix) {
918
+ this.$refs.detail_appenndix[0].dellAllfile();
919
+ } else if (this.billAppendixConfig.showAppendix2) {
920
+ this.$refs.detail_appenndix2[0].dellAllfile();
921
+ }
922
+ },
923
+ updateAllfile() {
924
+ if (this.billAppendixConfig.showAppendix) {
925
+ if (this.billAppendixConfig.notdelfile) {
926
+ this.$refs.detail_appenndix[0].updateAllfile();
927
+ }
928
+ } else if (this.billAppendixConfig.showAppendix2) {
929
+ if (this.billAppendixConfig.notdelfile) {
930
+ this.$refs.detail_appenndix2[0].updateAllfile();
931
+ }
932
+ }
933
+ },
934
+ getHeadData() {
935
+ let obj = {};
936
+ this.myConfig.formsConfig.items.forEach((el,index) => {
937
+ if (this.$refs[el.name] && this.$refs[el.name][0]) {
938
+ if (index === 0) {
939
+ Object.assign(obj, this.$refs[el.name][0].getData());
940
+ } else {
941
+ let data = this.$refs[el.name][0].getData();
942
+ if (el.items) {
943
+ el.items.forEach(el2 => {
944
+ if (el2.name) {
945
+ obj[el2.name] = data[el2.name];
946
+ }
947
+ if (el2.sname) {
948
+ obj[el2.sname] = data[el2.sname];
949
+ }
950
+ if (el2.ename) {
951
+ obj[el2.ename] = data[el2.ename];
952
+ }
953
+ if (el2.textName) {
954
+ obj[el2.textName] = data[el2.textName];
955
+ }
956
+ });
957
+ }
958
+ }
959
+ }
960
+ });
961
+ return obj;
962
+ },
963
+ getApprovalData() {
964
+ let data = this.getHeadData();
965
+ let obj = {};
966
+ obj.billno = data.billno;
967
+ obj.billmoduleid = data.billmoduleid;
968
+ obj.billstatus = data.billstatus;
969
+ obj.statusName = obj.billstatus;
970
+ if (this.dictData.BILLSTATUS) {
971
+ let tmp = this.dictData.BILLSTATUS.find(el => el.code === obj.billstatus);
972
+ if (tmp) {
973
+ obj.statusName = tmp.name;
974
+ }
975
+ }
976
+ return obj;
977
+ },
978
+ resetAnchor() {
979
+ if (this.showAnchorLink) {
980
+ this.showAnchorLink = false;
981
+ let self = this;
982
+ this.$nextTick(() => {
983
+ self.curlAnchorData = self.getCurlAnchorData();
984
+ self.showAnchorLink = true;
985
+ self.$nextTick(() => {
986
+ if (!self.anchorid) {
987
+ self.anchorid = self.anchorData[0].id;
988
+ }
989
+ self.anchorChange(self.anchorid)
990
+ });
991
+ });
992
+ }
993
+ },
994
+ handleSuccessAfter(response, file, fileList) {
995
+ this.$emit('handleSuccessAfter' , response, file, fileList);
996
+ }
997
+ },
998
+ props:{
999
+ config: {
1000
+ type:Object,
1001
+ default:null
1002
+ },
1003
+ dictData: {
1004
+ type: Object,
1005
+ default: () => {
1006
+ return {};
1007
+ }
1008
+ },
1009
+ moduleMethod:{
1010
+ type:Array,
1011
+ default: () => {
1012
+ return [];
1013
+ }
1014
+ }
1015
+ },
1016
+ mounted () {
1017
+ this.observer = elementResizeDetectorMaker();
1018
+ if (this.$refs.headarea) {
1019
+ this.observer.listenTo(this.$refs.headarea, this.setExtraHeight);
1020
+ }
1021
+ },
1022
+ beforeUnmount() {
1023
+ if (this.$refs.headarea) {
1024
+ this.observer.removeListener(this.$refs.headarea, this.setExtraHeight);
1025
+ }
1026
+ }
1027
+ };
1028
+ </script>