ocpview-plus 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/dist/efviewplus.min.esm.js +99954 -0
  4. package/dist/efviewplus.min.js +142 -0
  5. package/dist/locale/lang.js +1 -0
  6. package/dist/locale/zh-CN.js +1 -0
  7. package/dist/locale/zh-TW.js +1 -0
  8. package/dist/locale/zh-UG.js +1 -0
  9. package/dist/style.css +9 -0
  10. package/dist/styles/efviewplus.css +1 -0
  11. package/package.json +144 -0
  12. package/src/components/base/controlbase.vue +191 -0
  13. package/src/components/base/controlbox.vue +102 -0
  14. package/src/components/base/index.js +3 -0
  15. package/src/components/base/load.js +20 -0
  16. package/src/components/base/probase.js +220 -0
  17. package/src/components/base/size.js +78 -0
  18. package/src/components/billbox/billbox.vue +68 -0
  19. package/src/components/billbox/index.js +2 -0
  20. package/src/components/cascaderbox/cascaderbox.vue +184 -0
  21. package/src/components/cascaderbox/index.js +2 -0
  22. package/src/components/checkbox/checkbox.vue +76 -0
  23. package/src/components/checkbox/checkgroupbox.vue +104 -0
  24. package/src/components/checkbox/index.js +3 -0
  25. package/src/components/colorbox/colorbox.vue +44 -0
  26. package/src/components/colorbox/index.js +2 -0
  27. package/src/components/combobox/combobox.vue +220 -0
  28. package/src/components/combobox/index.js +2 -0
  29. package/src/components/conditionbox/conditionbase.vue +195 -0
  30. package/src/components/conditionbox/conditionbox.vue +63 -0
  31. package/src/components/conditionbox/conditionfilterbox.vue +477 -0
  32. package/src/components/conditionbox/conditionselectorbox.vue +237 -0
  33. package/src/components/conditionbox/index.js +5 -0
  34. package/src/components/conditionbox/queryconditionbox.vue +26 -0
  35. package/src/components/conditionbox/queryconditionboxbase.vue +124 -0
  36. package/src/components/conditionbox/searchconditionbox.vue +114 -0
  37. package/src/components/conditionbox/searchgrid.vue +391 -0
  38. package/src/components/datebox/datebox.vue +129 -0
  39. package/src/components/datebox/daterangebox.vue +155 -0
  40. package/src/components/datebox/index.js +3 -0
  41. package/src/components/form/baseform.vue +677 -0
  42. package/src/components/form/detailsbox.vue +487 -0
  43. package/src/components/form/formbox.vue +29 -0
  44. package/src/components/form/formcardbox.vue +268 -0
  45. package/src/components/form/formcardgroupbox.vue +252 -0
  46. package/src/components/form/formcompro.js +19 -0
  47. package/src/components/form/formdetail.vue +129 -0
  48. package/src/components/form/formdetailtwo.vue +302 -0
  49. package/src/components/form/index.js +8 -0
  50. package/src/components/form/toolanchor.js +46 -0
  51. package/src/components/form/workform.vue +168 -0
  52. package/src/components/grid/basegrid.vue +1061 -0
  53. package/src/components/grid/editgrid.vue +51 -0
  54. package/src/components/grid/editgridbase.vue +947 -0
  55. package/src/components/grid/editgridcard.vue +193 -0
  56. package/src/components/grid/expandrow.vue +137 -0
  57. package/src/components/grid/index.js +6 -0
  58. package/src/components/grid/viewgrid.vue +122 -0
  59. package/src/components/grid/viewgridbase.vue +1284 -0
  60. package/src/components/icon/common-icon.vue +53 -0
  61. package/src/components/icon/eicon.vue +29 -0
  62. package/src/components/icon/icons.vue +42 -0
  63. package/src/components/icon/index.js +2 -0
  64. package/src/components/label/index.js +3 -0
  65. package/src/components/label/showtext.vue +95 -0
  66. package/src/components/load/loadcartoon.vue +228 -0
  67. package/src/components/map/index.js +2 -0
  68. package/src/components/map/mapbox.vue +348 -0
  69. package/src/components/masterplate/appendix.vue +586 -0
  70. package/src/components/masterplate/approval.vue +803 -0
  71. package/src/components/masterplate/base.vue +985 -0
  72. package/src/components/masterplate/billasyncimport.vue +614 -0
  73. package/src/components/masterplate/billconditionbox.vue +224 -0
  74. package/src/components/masterplate/billconditionsbox.vue +427 -0
  75. package/src/components/masterplate/billdetailform.vue +990 -0
  76. package/src/components/masterplate/billimport.vue +263 -0
  77. package/src/components/masterplate/billquerygrid.vue +316 -0
  78. package/src/components/masterplate/billsinglegrid.vue +234 -0
  79. package/src/components/masterplate/birtreport.vue +185 -0
  80. package/src/components/masterplate/detailbtntoolbar.vue +311 -0
  81. package/src/components/masterplate/detailsbox.vue +386 -0
  82. package/src/components/masterplate/editgridcard.vue +222 -0
  83. package/src/components/masterplate/editgridcard2.vue +109 -0
  84. package/src/components/masterplate/formcard.vue +106 -0
  85. package/src/components/masterplate/formcardgroupbox.vue +168 -0
  86. package/src/components/masterplate/formdetailtwo.vue +356 -0
  87. package/src/components/masterplate/gridcolset.vue +227 -0
  88. package/src/components/masterplate/index.js +23 -0
  89. package/src/components/masterplate/layouttemplate.vue +33 -0
  90. package/src/components/masterplate/leftlistrightdetails.vue +474 -0
  91. package/src/components/masterplate/leftlistrightlist.vue +465 -0
  92. package/src/components/masterplate/lefttreerightdetails.vue +619 -0
  93. package/src/components/masterplate/levelreport.vue +510 -0
  94. package/src/components/masterplate/listbtntoolbar.vue +257 -0
  95. package/src/components/masterplate/listdetails.vue +769 -0
  96. package/src/components/masterplate/operlog.vue +272 -0
  97. package/src/components/masterplate/options.vue +110 -0
  98. package/src/components/masterplate/page.vue +102 -0
  99. package/src/components/masterplate/promptmessage.vue +74 -0
  100. package/src/components/masterplate/querybar.vue +490 -0
  101. package/src/components/masterplate/report.vue +357 -0
  102. package/src/components/masterplate/rowbtntoolbar.vue +126 -0
  103. package/src/components/masterplate/simpletree.vue +129 -0
  104. package/src/components/masterplate/simpleviewgrid.vue +144 -0
  105. package/src/components/mychart/bar/bar.vue +202 -0
  106. package/src/components/mychart/basechart.vue +190 -0
  107. package/src/components/mychart/complexmychart/barline.vue +154 -0
  108. package/src/components/mychart/gauge/gauge.vue +83 -0
  109. package/src/components/mychart/index.js +9 -0
  110. package/src/components/mychart/line/line.vue +202 -0
  111. package/src/components/mychart/liquidfill/liquidfill.vue +109 -0
  112. package/src/components/mychart/pie/pie.vue +96 -0
  113. package/src/components/mychart/radar/radar.vue +122 -0
  114. package/src/components/mychart/scatter/scatter.vue +76 -0
  115. package/src/components/numberbox/append.js +11 -0
  116. package/src/components/numberbox/index.js +3 -0
  117. package/src/components/numberbox/numberbox.vue +303 -0
  118. package/src/components/numberbox/numberrangebox.vue +423 -0
  119. package/src/components/picturebox/filebox.vue +365 -0
  120. package/src/components/picturebox/index.js +3 -0
  121. package/src/components/picturebox/picturebox.vue +541 -0
  122. package/src/components/picturebox/uploadbox.vue +164 -0
  123. package/src/components/poptagbox/index.js +2 -0
  124. package/src/components/poptagbox/poptagbox.vue +389 -0
  125. package/src/components/poptextbox/index.js +2 -0
  126. package/src/components/poptextbox/poptextbox.vue +601 -0
  127. package/src/components/radiobox/index.js +2 -0
  128. package/src/components/radiobox/radiogroupbox.vue +76 -0
  129. package/src/components/richtextbox/editor.vue +150 -0
  130. package/src/components/richtextbox/index.js +2 -0
  131. package/src/components/richtextbox/richtextbox.vue +448 -0
  132. package/src/components/textbox/index.js +2 -0
  133. package/src/components/textbox/textbox.vue +98 -0
  134. package/src/components/timebox/index.js +2 -0
  135. package/src/components/timebox/timebox.vue +76 -0
  136. package/src/components/toolbar/ebutton.vue +169 -0
  137. package/src/components/toolbar/index.js +3 -0
  138. package/src/components/toolbar/toolbar.vue +446 -0
  139. package/src/components/tree/basetree.vue +725 -0
  140. package/src/components/tree/index.js +3 -0
  141. package/src/components/tree/treedata.vue +51 -0
  142. package/src/components/tree/treedatabase.vue +189 -0
  143. package/src/components/upload/billimport.vue +233 -0
  144. package/src/components/upload/index.js +2 -0
  145. package/src/components/videobox/index.js +2 -0
  146. package/src/components/videobox/uploadbox.vue +148 -0
  147. package/src/components/videobox/videobox.vue +503 -0
  148. package/src/components/wrichtextbox/editor.vue +219 -0
  149. package/src/components/wrichtextbox/index.js +2 -0
  150. package/src/components/wrichtextbox/wrichtextbox.vue +63 -0
  151. package/src/index.js +215 -0
  152. package/src/locale/format.js +51 -0
  153. package/src/locale/index.js +63 -0
  154. package/src/locale/lang/zh-CN.js +123 -0
  155. package/src/locale/lang/zh-TW.js +114 -0
  156. package/src/locale/lang/zh-UG.js +115 -0
  157. package/src/locale/lang.js +15 -0
  158. package/src/method/case/case.js +1180 -0
  159. package/src/method/config/queryconfig.js +24 -0
  160. package/src/method/const/const.js +815 -0
  161. package/src/method/index.js +8 -0
  162. package/src/static/excel/exportexcel.js +627 -0
  163. package/src/static/iview/coustom.js +463 -0
  164. package/src/store/index.js +19 -0
  165. package/src/store/modules/app.js +53 -0
  166. package/src/styles/README.md +3 -0
  167. package/src/styles/common.less +75 -0
  168. package/src/styles/components/anchor.less +74 -0
  169. package/src/styles/components/approval.less +136 -0
  170. package/src/styles/components/button.less +208 -0
  171. package/src/styles/components/card.less +51 -0
  172. package/src/styles/components/content.less +38 -0
  173. package/src/styles/components/font.less +314 -0
  174. package/src/styles/components/form.less +72 -0
  175. package/src/styles/components/iconfont/fonts/iconfont.less +1376 -0
  176. package/src/styles/components/iconfont/fonts/iconfont.svg +699 -0
  177. package/src/styles/components/iconfont/fonts/iconfont.ttf +0 -0
  178. package/src/styles/components/iconfont/fonts/iconfont.woff +0 -0
  179. package/src/styles/components/iconfont/fonts/iconfont.woff2 +0 -0
  180. package/src/styles/components/index.less +16 -0
  181. package/src/styles/components/input.less +290 -0
  182. package/src/styles/components/modal.less +203 -0
  183. package/src/styles/components/page.less +340 -0
  184. package/src/styles/components/select.less +361 -0
  185. package/src/styles/components/steps.less +367 -0
  186. package/src/styles/components/table.less +544 -0
  187. package/src/styles/components/tabs.less +249 -0
  188. package/src/styles/components/upload.less +83 -0
  189. package/src/styles/custom.less +67 -0
  190. package/src/styles/index.less +6 -0
  191. package/src/styles/pack.less +6 -0
  192. package/src/utils/EfuMessenger.js +155 -0
  193. package/src/utils/assist.js +353 -0
  194. package/src/utils/index.js +1 -0
  195. package/src/utils/random_str.js +10 -0
@@ -0,0 +1,1180 @@
1
+ import axios from 'axios';
2
+ import $ from 'jquery';
3
+ import Cookies from 'js-cookie';
4
+ import md5 from 'js-md5';
5
+ import { Modal } from 'view-ui-plus'
6
+
7
+ // async synchro
8
+
9
+ let caseMethod = {};
10
+
11
+ let OmdUrl = {};
12
+ OmdUrl.eid = '0';
13
+ OmdUrl.uid = '0';
14
+ OmdUrl.uname = 'future';
15
+ OmdUrl.format = 'json';
16
+ OmdUrl.appKey = 'mall';
17
+ OmdUrl.portalkey = 'congou';
18
+ OmdUrl.checktoken = 'Y';
19
+ OmdUrl.ver = '1.0';
20
+ OmdUrl.signMethod = 'MD5';
21
+ OmdUrl.secret = '';
22
+ OmdUrl.omp = '/mall-work-webin/rest';
23
+ OmdUrl.mall = '/mall-work-webin/rest';
24
+ OmdUrl.mss = '/mall-work-webin/rest';
25
+ OmdUrl.portal = '/mall-portal-rest/portalesb/ocmrest';
26
+ OmdUrl.mdm = '/ocm-mdm-webin/rest';
27
+ OmdUrl.omc = '/omc-tags-webin/rest';
28
+ OmdUrl.member = '/omc-membership-webin/rest';
29
+ OmdUrl.accnt = '/omc-accnt-webin/rest';
30
+ OmdUrl.work = '/omc-work-webin/rest';
31
+ OmdUrl.investment = '/mall-investment-webin/rest';
32
+ OmdUrl.uploadfile ='/mss-sysconf-boot/upload';
33
+ OmdUrl.delfile ='/mss-sysconf-boot/delete?filekey=';
34
+ OmdUrl.downfile = '/mss-sysconf-boot/download?filekey=';
35
+ OmdUrl.getfile = '/mss-sysconf-boot/filedata?';
36
+ OmdUrl.amp = '/ampOpenapiService/';
37
+ OmdUrl.uidespath = OmdUrl.amp;
38
+ OmdUrl.helpUrl = 'docs.sjhgo.com';
39
+ OmdUrl.mallmdm = '/mall-mdm-webin/rest';
40
+ OmdUrl.mallmaster = '/mall-master-webin/rest';
41
+ OmdUrl.portal = OmdUrl.mallmdm;
42
+ OmdUrl.uiConfigExpire = 24;
43
+ OmdUrl.fairyConfigExpire = 24;
44
+ OmdUrl.dictExpire = 24;
45
+ OmdUrl.operbilllog = '/mss-sysconf-query/rest';
46
+ //测试
47
+ //OmdUrl.startHelp = 'Y';
48
+ //OmdUrl.helpType = '13';
49
+ //OmdUrl.portal = '/mall-master-webin/rest';
50
+ //OmdUrl.mdm = '/mall-master-webin/rest';
51
+
52
+ OmdUrl.getCurHelpUrl = function (that) {
53
+ var curHelpUrl = '';
54
+ if (that.OmdUrl.startHelp === 'Y') {
55
+ if (that.OmdUrl.helpType) {
56
+ var modulecodeHelp = that.$Method.getUrlParam('helpindex');
57
+ var modulecodeHelpUrl = that.$Method.getLocalStorage('modulecodeHelp_' + that.OmdUrl.helpType + '_' + modulecodeHelp);
58
+ if (modulecodeHelpUrl) {
59
+ return modulecodeHelpUrl;
60
+ }
61
+ if (modulecodeHelp) {
62
+ var helpUrl = that.OmdUrl.helpUrl;
63
+ if (!helpUrl) {
64
+ if (that.getHelpdocumenturl) {
65
+ helpUrl = that.getHelpdocumenturl();
66
+ }
67
+ }
68
+ if (helpUrl) {
69
+ let helpId = that.getHelpId(that.OmdUrl.helpType, modulecodeHelp);
70
+ if (helpId) {
71
+ curHelpUrl ='http://' + helpUrl + '/web/#/p/' + helpId;
72
+ } else {
73
+ curHelpUrl = 'http://' + helpUrl + '/web/#/' + that.OmdUrl.helpType + '?page_id=' + modulecodeHelp;
74
+ }
75
+ }
76
+ that.$Method.setLocalStorage('modulecodeHelp_' +that.OmdUrl.helpType + '_' + modulecodeHelp,curHelpUrl,that.OmdUrl.uiConfigExpire)
77
+ }
78
+ }
79
+ }
80
+ return curHelpUrl;
81
+ };
82
+
83
+ caseMethod.OmdUrl = OmdUrl;
84
+
85
+ caseMethod.alert = function (_strerr, _title, _flag) {
86
+ if (!_flag) {
87
+ _flag = '1';
88
+ }
89
+ if (_strerr && typeof _strerr === 'string') {
90
+ _strerr = _strerr.replace(new RegExp('</xmp>', 'gi'), '</txmp>');
91
+ _strerr = _strerr.replace(new RegExp('<xmp', 'gi'), '<txmp');
92
+ _strerr = '<xmp style="margin: 0;white-space:break-spaces;">' +_strerr + '</xmp>';
93
+ }
94
+ _flag = _flag + '';
95
+ if (_flag === '2') {
96
+ Modal.error({
97
+ title: '系统警告',
98
+ content: '<div style="word-wrap:break-word">' + _strerr + '</div>'
99
+ });
100
+ } else if (_flag === '3') {
101
+ if (!_title) {
102
+ _title = '成功';
103
+ }
104
+ Modal.success({
105
+ title:_title,
106
+ content: '<div style="word-wrap:break-word">' + _strerr + '</div>'
107
+ });
108
+ } else {
109
+ if (!_title) {
110
+ _title = '提醒';
111
+ }
112
+ Modal.warning({
113
+ title: _title,
114
+ content: '<div style="word-wrap:break-word">' + _strerr + '</div>'
115
+ });
116
+ }
117
+ };
118
+
119
+
120
+
121
+
122
+ function getCommonUrlParam (_self, _param, _type) {
123
+ let token = caseMethod.getToken();
124
+ let end_id = caseMethod.getEnt_id();
125
+ let para = _param;
126
+ if (!para) {
127
+ para = {};
128
+ }
129
+ let portalkey = _self.OmdUrl.portalkey;
130
+ if (!caseMethod.getUrlParam('portalkey')) {
131
+ portalkey = caseMethod.getUrlParam('portalkey');
132
+ }
133
+ if (caseMethod.getUrlParam('srvkey') === 'cloud') {
134
+ portalkey = 'cloud';
135
+ }
136
+ if (_type === '1') {
137
+ let url = '';
138
+ if (token && token.trim() !== '') {
139
+ url = url + '&ent_id=' + end_id + '&token=' + token + '&timestamp=' + new Date().getTime() + '&format=' + _self.OmdUrl.format + '&app_key=' + _self.OmdUrl.appKey + '&portalkey=' + portalkey + '&ver=' + _self.OmdUrl.ver;
140
+ if (_self.OmdUrl.signMethod.trim().length !== 0 && _self.OmdUrl.secret.trim().length != 0) {
141
+ url = url + '&sign_method=' + _self.OmdUrl.signMethod + '&sign=';
142
+ let secret = _self.OmdUrl.appKey+'='+_self.OmdUrl.secret+'&body='+JSON.stringify(para).toString()+'&token='+token;
143
+ if (_self.OmdUrl.getMd5 !== undefined) {
144
+ secret = _self.OmdUrl.getMd5(para, token);
145
+ }
146
+ url = url+ md5(secret);
147
+ }
148
+ } else {
149
+ let _session = { 'ent_id': end_id, 'user_id': _self.OmdUrl.uid, 'user_code': _self.OmdUrl.uid, 'user_name': _self.OmdUrl.uname };
150
+ url = url + '&session=' + JSON.stringify(_session);
151
+ }
152
+ return url;
153
+ } else {
154
+ let temp = {};
155
+ if (token && token.trim() !== '') {
156
+ temp.ent_id = end_id;
157
+ temp.token = token;
158
+ temp.timestamp = new Date().getTime();
159
+ temp.format = _self.OmdUrl.format;
160
+ temp.app_key = _self.OmdUrl.appKey;
161
+ temp.ver = _self.OmdUrl.ver;
162
+ temp.portalkey = portalkey;
163
+ temp.sign_method = _self.OmdUrl.signMethod;
164
+ let secret = _self.OmdUrl.appKey+'='+_self.OmdUrl.secret+'&body='+JSON.stringify(para).toString()+'&token='+token;
165
+ if (_self.OmdUrl.getMd5 !== undefined) {
166
+ secret = _self.OmdUrl.getMd5(para, token);
167
+ }
168
+ temp.sign = md5(secret);
169
+ } else {
170
+ let _session = { 'ent_id': end_id, 'user_id': _self.OmdUrl.uid,'user_code': _self.OmdUrl.uid, 'user_name': _self.OmdUrl.uname };
171
+ temp.session = JSON.stringify(_session);
172
+ }
173
+ return temp;
174
+ }
175
+ }
176
+ function basePost (url, method, postdata, _self , _type) {
177
+ let temp = {};
178
+ if (method) {
179
+ temp.method = method;
180
+ }
181
+ let comtemp = getCommonUrlParam(_self, postdata, '2');
182
+ for (let v in comtemp) {
183
+ temp[v]=comtemp[v];
184
+ }
185
+ if (!postdata) {
186
+ postdata = {};
187
+ }
188
+
189
+ let menuCode = caseMethod.getUrlParam('menuCode');
190
+ if (menuCode) {
191
+ temp.menuCode = menuCode;
192
+ }
193
+ if (_type === 'get') {
194
+ return new Promise((resolve, reject) => {
195
+ axios.get(url, postdata, {
196
+ params: temp
197
+ })
198
+ .then(response => {
199
+ resolve(response.data);
200
+ }, err => {
201
+ reject(err);
202
+ })
203
+ .catch((error) => {
204
+ reject(error);
205
+ });
206
+ });
207
+ } else {
208
+ return new Promise((resolve, reject) => {
209
+ axios.post(url, postdata, {
210
+ params: temp
211
+ })
212
+ .then(response => {
213
+ resolve(response.data);
214
+ }, err => {
215
+ reject(err);
216
+ })
217
+ .catch((error) => {
218
+ reject(error);
219
+ });
220
+ });
221
+ }
222
+
223
+ }
224
+
225
+ function successRequest (data, _successFunc, _failFunc, _errorFunc, _self) {
226
+ let obj = null;
227
+ try {
228
+ if (typeof data === 'string') {
229
+ obj = JSON.parse(data);
230
+ } else {
231
+ obj = data;
232
+ }
233
+ if (parseInt(obj.returncode) === 0) { // 请求处理成功
234
+ try {
235
+ if (_successFunc) {
236
+ _successFunc(obj.data);
237
+ }
238
+ } catch (e) {
239
+ if (_self.$Spin) {
240
+ _self.$Spin.hide();
241
+ }
242
+ _self.$nextTick(() => {
243
+ setTimeout(() => {
244
+ _self.alert(e, null, 2);
245
+ }, 1000);
246
+ });
247
+ }
248
+ return;
249
+ } else if (parseInt(obj.returncode) > 0) {
250
+ if (_failFunc) {
251
+ try {
252
+ _failFunc(obj.data);
253
+ } catch (e) {
254
+ if (_self.$Spin) {
255
+ _self.$Spin.hide();
256
+ }
257
+ _self.$nextTick(() => {
258
+ setTimeout(() => {
259
+ _self.alert(e, null, 2);
260
+ }, 1000);
261
+ });
262
+ }
263
+ return;
264
+ } else {
265
+ throw obj.data; // 业务处理错误
266
+ }
267
+ } else {
268
+ if (_errorFunc) {
269
+ try {
270
+ _errorFunc(obj.data);
271
+ } catch (e) {
272
+ if (_self.$Spin) {
273
+ _self.$Spin.hide();
274
+ }
275
+ _self.$nextTick(() => {
276
+ setTimeout(() => {
277
+ _self.alert(e, null, 2);
278
+ }, 1000);
279
+ });
280
+ }
281
+ return;
282
+ } else {
283
+ throw obj.data; // 系统异常
284
+ }
285
+ }
286
+ } catch (e) {
287
+ if (_self.$Spin) {
288
+ _self.$Spin.hide();
289
+ }
290
+ _self.$nextTick(() => {
291
+ setTimeout(() => {
292
+ if (typeof data === 'string') {
293
+ _self.alert(e + '<br/>' + data, null, 2);
294
+ } else {
295
+ _self.alert(e, null, 2);
296
+ }
297
+ }, 1000);
298
+ });
299
+ }
300
+ }
301
+ caseMethod.asyncPost = function (url, method, postdata, _successFunc, _failFunc, _errorFunc, _type) {
302
+ let _self = this;
303
+ if (!url.startsWith('/')) {
304
+ url = '/' + url;
305
+ }
306
+ basePost(url, method, postdata, _self, _type).then(function (data) {
307
+ return successRequest(data, _successFunc, _failFunc, null, _self);
308
+ }, function (err) {
309
+ if (_failFunc) {
310
+ _failFunc(err);
311
+ } else {
312
+ if (_self.$Spin) {
313
+ _self.$Spin.hide();
314
+ }
315
+ _self.$nextTick(() => {
316
+ setTimeout(() => {
317
+ _self.alert(err.message + '<br/>' + err.response.data, null, '2');
318
+ }, 1000);
319
+ });
320
+ }
321
+ }).catch((err) => {
322
+ if (_errorFunc) {
323
+ _errorFunc(err);
324
+ } else {
325
+ if (_self.$Spin) {
326
+ _self.$Spin.hide();
327
+ }
328
+ let error = JSON.stringify(err);
329
+ _self.$nextTick(() => {
330
+ setTimeout(() => {
331
+ _self.alert(error, null, '2');
332
+ }, 1000);
333
+ });
334
+ return false;
335
+ }
336
+ });
337
+ };
338
+ // 判断是否为IE浏览器
339
+ // function isIE () { return !!(window.ActiveXObject || 'ActiveXObject' in window); }
340
+
341
+ function getresturl (_baseUrl, _method, _param, _self) {
342
+ let url = '';
343
+ if (_method) {
344
+ url = 'method=' + _method;
345
+ } else {
346
+ url = 'method=';
347
+ }
348
+ let tempUrl = getCommonUrlParam(_self, _param, '1');
349
+ url = url + tempUrl;
350
+ if (_baseUrl && _baseUrl.indexOf('?') != -1) {
351
+ url = _baseUrl + '&' + url;
352
+ } else {
353
+ url = _baseUrl + '?' + url;
354
+ }
355
+
356
+ let menuCode = caseMethod.getUrlParam('menuCode');
357
+ if (menuCode) {
358
+ url = url + '&menuCode=' + menuCode;
359
+ }
360
+
361
+ return encodeURI(url);
362
+ }
363
+
364
+ caseMethod.getResturl = getresturl;
365
+ caseMethod.synchroPost = function ( _baseUrl, _method, _param, _successFunc, _failFunc, _errorFunc, _type) {
366
+ let _self = this;
367
+ let tempType = 'POST';
368
+ if (_type) {
369
+ tempType = _type;
370
+ }
371
+ let url = getresturl(_baseUrl, _method, _param, _self);
372
+ if (!url.startsWith('/')) {
373
+ url = '/' + url;
374
+ }
375
+ $.ajaxSetup({cache: false});
376
+ let post = {
377
+ type: tempType,
378
+ contentType: 'text/plain; charset=UTF-8',
379
+ async: false,
380
+ dataType: 'JSON',
381
+ processData: false,
382
+ success: function (data) {
383
+ return successRequest(data, _successFunc, _failFunc, _errorFunc, _self);
384
+ },
385
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
386
+ if (_self.$Spin) {
387
+ _self.$Spin.hide();
388
+ }
389
+ try {
390
+ let error = JSON.stringify(errorThrown);
391
+ _self.alert(error, null, '2');
392
+ } catch (e) {
393
+ setTimeout(() => {
394
+ _self.alert(errorThrown, null, '2');
395
+ }, 1000);
396
+ }
397
+
398
+ return false;// 系统异常
399
+ }
400
+ };
401
+ if (!_param) {
402
+ _param = {};
403
+ }
404
+ if (tempType === 'POST') {
405
+ post.data = JSON.stringify(_param);
406
+ } else {
407
+ delete post.data;
408
+ }
409
+ $.ajax(url, post);
410
+ };
411
+ caseMethod.getOmdUrlConfig = function (_self) {
412
+ $.ajax({
413
+ url: '/amp-glod/config.json',
414
+ type: 'GET',
415
+ dataType: 'json',
416
+ success: function(data) {
417
+ let pageData=data;
418
+ let obj = {};
419
+ if (pageData) {
420
+ for (let pro in pageData) {
421
+ if (pageData[pro] instanceof Array) {
422
+ pageData[pro].forEach(el => {
423
+ obj[el.name] = el.value;
424
+ });
425
+ } else {
426
+ obj[pro] = pageData[pro];
427
+ }
428
+ }
429
+ }
430
+ _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, obj);
431
+ }
432
+ });
433
+ };
434
+ caseMethod.getPortalConfig = function (_self) {
435
+ $.ajax({
436
+ url: '/ampOpenapiService?method=usercenter.portal.getConfig',
437
+ type: 'POST',
438
+ data: {},
439
+ dataType: 'json',
440
+ success: function(res) {
441
+ if (res.returncode == 0) {
442
+ if (res.data) {
443
+ if (res.data.OmdUrl) {
444
+ let OmdUrl = JSON.parse(res.data.OmdUrl);
445
+ _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, OmdUrl);
446
+ }
447
+ _self.config.globalProperties.portalConfig = res.data;
448
+ }
449
+ }
450
+ }
451
+ });
452
+ }
453
+
454
+ function getCongouCookie(value) {
455
+ if (!value)
456
+ return '';
457
+ try {
458
+ let v = JSON.parse(value);
459
+ v = v.state;
460
+ if (v) {
461
+ return v.split(':')[1];
462
+ } else {
463
+ return value;
464
+ }
465
+ } catch (e) {
466
+ return value;
467
+ }
468
+ }
469
+
470
+ caseMethod.getUserCode = function (v) {
471
+ let that = null;
472
+ if (!v) {
473
+ that = this;
474
+ } else {
475
+ that = v;
476
+ }
477
+ let token = caseMethod.getToken(v);
478
+ let portalkey = '';
479
+ let usercode = '';
480
+ portalkey = that.portalkey;
481
+ usercode = that.OmdUrl.uid;
482
+ if (token) {
483
+ if(portalkey == 'congou'){
484
+ usercode = getCongouCookie(Cookies.get('user_code'));
485
+ }
486
+ else
487
+ {
488
+ if (Cookies.get('user_code')) {
489
+ usercode = Cookies.get('user_code');
490
+ }
491
+ }
492
+ }
493
+ return usercode;
494
+ };
495
+
496
+ caseMethod.getUserName = function (v) {
497
+ let that = null;
498
+ if (!v) {
499
+ that = this;
500
+ } else {
501
+ that = v;
502
+ }
503
+ let token = caseMethod.getToken(v);
504
+ let portalkey = '';
505
+ let username = '';
506
+ portalkey = that.portalkey;
507
+ username = '[' + that.OmdUrl.uid + ']' + that.OmdUrl.uname;
508
+ if (token) {
509
+ if(portalkey == 'congou'){
510
+ username = '[' + getCongouCookie(Cookies.get('user_code')) + ']' + getCongouCookie(Cookies.get('user_name'));
511
+ }
512
+ else
513
+ {
514
+ if (Cookies.get('user_code')) {
515
+ username = '[' + Cookies.get('user_code') + ']' +Cookies.get('user_name');
516
+ }
517
+ }
518
+ }
519
+ return username;
520
+ };
521
+
522
+ caseMethod.getPortalMkt =function() {
523
+ let obj = {};
524
+ obj.shopId = Cookies.get('shopId');
525
+ obj.shopCode = Cookies.get('shopCode');
526
+ obj.shopName = Cookies.get('shopName');
527
+ return obj;
528
+ },
529
+ caseMethod.getSession = function() {
530
+ let obj = {};
531
+ let user_name = caseMethod.getUserName();
532
+ let user_code = caseMethod.getUserCode();
533
+ let user_id = Cookies.get('user_id');
534
+ let ent_id = caseMethod.getEnt_id();
535
+ let token = caseMethod.getToken();
536
+ if (user_name) {
537
+ obj['user_name'] = user_name;
538
+ } else {
539
+ obj['user_name'] = '';
540
+ }
541
+ if (user_code) {
542
+ obj['user_code'] = user_code;
543
+ } else {
544
+ obj['user_code'] = '';
545
+ }
546
+ if (user_id) {
547
+ obj['user_id'] = user_id;
548
+ } else {
549
+ obj['user_id'] = '';
550
+ }
551
+ if (ent_id) {
552
+ obj['ent_id'] = ent_id;
553
+ } else {
554
+ obj['ent_id'] = '';
555
+ }
556
+ if (token) {
557
+ obj['token'] = token;
558
+ } else {
559
+ obj['token'] = '';
560
+ }
561
+ return JSON.stringify(obj);
562
+ };
563
+
564
+ caseMethod.getUrlParam = function (name) {
565
+ let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象
566
+
567
+ let list = window.location.href.split('?');
568
+ let r = '';
569
+ if (list.length > 1) {
570
+ r = list[1].match(reg); // 匹配目标参数
571
+ }
572
+ if (!r) {
573
+ if (list.length > 2) {
574
+ r = list[2].match(reg); // 匹配目标参数
575
+ }
576
+ }
577
+ if (r) return decodeURI(r[2]); return ''; // 返回参数值
578
+ };
579
+
580
+ caseMethod.initGlobal = function (_self, _obj, isInitUser) {
581
+ let OmdUrl = {};
582
+ if (!_self.config.globalProperties.OmdUrl) {
583
+ _self.config.globalProperties.OmdUrl = {};
584
+ }
585
+ if (_obj) {
586
+ OmdUrl = Object.assign({},_self.config.globalProperties.OmdUrl, _obj);
587
+ }
588
+ let portalkey = caseMethod.getUrlParam('portalkey');
589
+ if (portalkey) {
590
+ OmdUrl.portalkey = portalkey;
591
+ }
592
+ OmdUrl.eid = caseMethod.getEnt_id(_self.config.globalProperties);
593
+
594
+ OmdUrl.modulecode = caseMethod.getUrlParam('modulecode');
595
+ if (! OmdUrl.modulecode) {
596
+ OmdUrl.modulecode = caseMethod.getUrlParam('billmoduleid');
597
+ }
598
+ OmdUrl.helpindex = caseMethod.getUrlParam('helpindex');
599
+ OmdUrl.billmoduleid =_self.config.globalProperties.modulecode;
600
+ OmdUrl.openbillno = caseMethod.getUrlParam('billno');
601
+ OmdUrl.opentaskid = caseMethod.getUrlParam('taskid');
602
+ OmdUrl.nocheck = caseMethod.getUrlParam('nocheck')?caseMethod.getUrlParam('nocheck'):'N';
603
+ _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, OmdUrl);
604
+ // caseMethod.getOmdUrlConfig(_self);
605
+ caseMethod.getPortalConfig(_self);
606
+
607
+ };
608
+
609
+ caseMethod.getUserModuleMethod = function (curlmodulecode) {
610
+ let reModuleMethod = null;
611
+ let token = caseMethod.getToken();
612
+ if (!token) {
613
+ return reModuleMethod;
614
+ }
615
+
616
+ let modulecode = '';
617
+ if (curlmodulecode) {
618
+ modulecode = curlmodulecode;
619
+ } else {
620
+ modulecode = caseMethod.getUrlParam('modulecode');
621
+ if (!modulecode) {
622
+ return reModuleMethod;
623
+ }
624
+ }
625
+ let portalUrl = '/mall-portal-rest/portalesb/ocmrest';
626
+ if (this.OmdUrl && this.OmdUrl.portal) {
627
+ portalUrl = this.OmdUrl.portal;
628
+ }
629
+ let srvkey = caseMethod.getUrlParam('srvkey');
630
+ if (srvkey === 'cloud') {
631
+ portalUrl = this.OmdUrl.mdm;
632
+ }
633
+
634
+ let param = {};
635
+ param.token = token;
636
+ param.modulecode = modulecode;
637
+ this.synchroPost(portalUrl, 'runtime.modulesrivce.getUserModuleMethod',param, function(data) {
638
+ reModuleMethod = data;
639
+ }, null);
640
+ return reModuleMethod;
641
+
642
+ };
643
+ caseMethod.checkModuleByToken = function () {
644
+ let powerflag = false;
645
+ let token = caseMethod.getToken();
646
+ if (!token) {
647
+ return powerflag;
648
+ }
649
+ let modulecode = caseMethod.getUrlParam('modulecode');
650
+ if (!modulecode) {
651
+ return powerflag;
652
+ }
653
+ if (!location.pathname) {
654
+ return powerflag;
655
+ }
656
+ if(this.portalkey != 'congou') {
657
+ return powerflag;
658
+ }
659
+
660
+ let portalUrl = '/mall-portal-rest/portalesb/ocmrest';
661
+ if (this.OmdUrl.portal) {
662
+ portalUrl = this.OmdUrl.portal;
663
+ }
664
+
665
+ let pathname = location.pathname;
666
+
667
+ let searchParam = {
668
+ 'token': token,
669
+ 'modulecode': modulecode,
670
+ 'execmodule': pathname
671
+ };
672
+ let srvkey = caseMethod.getUrlParam('srvkey');
673
+ if (srvkey === 'cloud') {
674
+ portalUrl = this.OmdUrl.mdm;
675
+ }
676
+ let method = 'runtime.modulesrivce.checkmodulebytoken';
677
+ this.synchroPost(portalUrl, method, searchParam, function(data) {
678
+ if (data.flag === '-1') {
679
+ powerflag = true;
680
+ }
681
+ }, null);
682
+ return powerflag;
683
+ };
684
+
685
+ /*
686
+ caseMethod.getDict = function(str, _fields) {
687
+ let fields = 'code,name';
688
+ if (_fields) {
689
+ fields = _fields;
690
+ }
691
+ let dictkey = str.split(',');
692
+ let _dicData = {};
693
+ let str2 = [];
694
+ for (let pro of dictkey) {
695
+ let data = this.$Method.getLocalStorage('dictkey_' + pro);
696
+ if (data) {
697
+ _dicData[pro] = data;
698
+ } else {
699
+ str2.push(pro);
700
+ }
701
+ }
702
+ if (str2.length > 0) {
703
+ let searchParam = {
704
+ fields: fields,
705
+ dict_group_code: str2.join(',')
706
+ };
707
+ let self = this;
708
+ this.synchroPost(this.OmdUrl.omp, 'omp.work.dict.getbydictgroupcode', searchParam,function(data) {
709
+ for (let pro of str2) {
710
+ self.$Method.setLocalStorage('dictkey_' + pro , data[pro], self.OmdUrl.dictExpire);
711
+ _dicData[pro] = data[pro];
712
+ }
713
+ }, null);
714
+ }
715
+ return _dicData;
716
+ };
717
+ */
718
+
719
+ caseMethod.getDict = function(str, _fields) {
720
+ let fields = 'code,name';
721
+ if (_fields) {
722
+ fields = _fields;
723
+ }
724
+ let _dicData = {};
725
+ let searchParam = {
726
+ fields: fields,
727
+ dict_group_code:str
728
+ };
729
+ this.synchroPost(this.OmdUrl.omp, 'omp.work.dict.getbydictgroupcode', searchParam,function(data) {
730
+ _dicData = data;
731
+ }, null);
732
+ return _dicData;
733
+ };
734
+
735
+ caseMethod.setQueryConfig = function(obj) {
736
+ Object.assign(this.query.Config, obj);
737
+ };
738
+ caseMethod.getQueryConfig = function (selectkey) {
739
+ let config = null;
740
+ if (this.query.Config[selectkey]) {
741
+ config = JSON.parse(JSON.stringify(this.query.Config[selectkey]));
742
+ } else {
743
+ config = {};
744
+ }
745
+ if (config.width === undefined) {
746
+ if (config.isTree) {
747
+ config.width = 0.3;
748
+ } else {
749
+ config.width = 0.4;
750
+ }
751
+ }
752
+ if (config.height === undefined) {
753
+ config.height = 0.6;
754
+ }
755
+ if (config.responseId === undefined) {
756
+ config.responseId = config.responseCode;
757
+ }
758
+ if (config.manualLoad === undefined) {
759
+ config.manualLoad = true;
760
+ }
761
+ if (config.multiSelect === undefined) {
762
+ config.multiSelect = false;
763
+ }
764
+
765
+ if (config.showCondition === undefined) {
766
+ config.showCondition = true;
767
+ }
768
+ /*if (config.isTree) {
769
+ config.popControl = 'SimpleTree';
770
+ } else {
771
+ config.popControl = 'SimpleViewGrid';
772
+ }*/
773
+ if (config.isConfig) {
774
+ return config;
775
+ } else {
776
+ if (this.query.customQueryConfig) {
777
+ return this.query.customQueryConfig(config);
778
+ } else {
779
+ return config;
780
+ }
781
+ }
782
+
783
+ };
784
+ caseMethod.getBillmoduleid = function(billtype) {
785
+ let billmoduleid = '';
786
+ let searchParam = {'billtype':billtype,'order_field' : 'modeid'};
787
+ let method = 'mss.base.billmain.search';
788
+ this.synchroPost(this.OmdUrl.mall, method,searchParam, function(data) {
789
+ if(data && data.billmain && data.billmain.length >0){
790
+ billmoduleid =data.billmain[0].modeid;
791
+ }
792
+ },null);
793
+ return billmoduleid;
794
+ };
795
+ caseMethod.getBilltype = function(billmoduleid) {
796
+ let billtype = '';
797
+ let searchParam = {'modeid':billmoduleid};
798
+ let method = 'mss.base.billmain.search';
799
+ this.synchroPost(this.OmdUrl.mall, method,searchParam, function(data) {
800
+ if(data && data.billmain && data.billmain.length >0){
801
+ billtype =data.billmain[0].billtype;
802
+ }
803
+ },null);
804
+ return billtype;
805
+ };
806
+ caseMethod.getHelpdocumenturl = function() {
807
+ let url = '';
808
+ let searchParam = {'queryid':'select_fgetmanapara','mpmkt':'00','mpcode':'HELPDOCUMENTURL'};
809
+ let method = 'mss.work.report.query';
810
+ this.synchroPost(this.OmdUrl.mall, method,searchParam, function(data) {
811
+ if(data && data.report && data.report.length >0){
812
+ url =data.report[0].mpvalue;
813
+ }
814
+ },null);
815
+ return url;
816
+ };
817
+ caseMethod.getHelpId = function(helpType,helpIndex) {
818
+ let helpId = '';
819
+ let para = {};
820
+ para.helpType = helpType;
821
+ para.helpIndex = helpIndex;
822
+ this.synchroPost(this.OmdUrl.amp, 'usercenter.helpconfig.getHelpId', para, function(data) {
823
+ if(data && data.helpId){
824
+ helpId = data.helpId
825
+ }
826
+ },function(data) {
827
+ helpId= '';
828
+ },function(data) {
829
+ helpId= '';
830
+ });
831
+ return helpId;
832
+ };
833
+
834
+
835
+ caseMethod.getConditionValue = function (name, value, calculator, config) {
836
+ let condition = {};
837
+ if (calculator === '==') {
838
+ if (config.type === 'DateBox') {
839
+ condition[name] = {};
840
+ let temp = {};
841
+ temp['>='] = value;
842
+ if (config.vtype === 'month') {
843
+ temp['<'] = this.$Method.getNextMonthFirstDay(value);
844
+ } else {
845
+ temp['<'] = this.$Method.getTomorrow(value);
846
+ }
847
+ condition[name] = temp;
848
+ } else {
849
+ if (name === 'inputer' || name === 'auditor' || name === 'canceler') {
850
+ let temp1 = {};
851
+ temp1[name] = {'==':value};
852
+ let temp2 = {};
853
+ temp2[name+'_name'] = {'LIKE': '[%]' + value};
854
+ condition['$or'] = [];
855
+ condition['$or'].push(temp1);
856
+ condition['$or'].push(temp2);
857
+ } else {
858
+ condition[name] = {};
859
+ if (value.value !== undefined) {
860
+ condition[name][calculator] = value.value;
861
+ } else {
862
+ condition[name][calculator] = value;
863
+ }
864
+ }
865
+ }
866
+ }
867
+
868
+ if (calculator === 'LIKE') {
869
+ condition[name] = {};
870
+ condition[name][calculator] = '%' + value + '%';
871
+ }
872
+
873
+ if (calculator !== 'LIKE' && calculator !== '==') {
874
+ condition[name] = {};
875
+ condition[name][calculator] = value;
876
+ }
877
+ return condition;
878
+ };
879
+ caseMethod.getHelpUrl = function() {
880
+ let url = '';
881
+ if (this.helpindex) {
882
+ let helpUrl = '';
883
+ if (this.OmdUrl.helpUrl) {
884
+ helpUrl = this.OmdUrl.helpUrl;
885
+ } else {
886
+ helpUrl = this.getHelpdocumenturl();
887
+ }
888
+ if (helpUrl) {
889
+ url = 'http://'+helpUrl+'/web/#/'+this.OmdUrl.helpType+'?page_id='+ this.helpindex;
890
+ }
891
+ }
892
+ return url;
893
+
894
+ };
895
+ caseMethod.getEnt_id = function(_self) {
896
+ let ent_id = '';
897
+ let portalkey = '';
898
+ if (_self) {
899
+ ent_id = _self.OmdUrl.eid;
900
+ portalkey = _self.OmdUrl.portalkey;
901
+ } else {
902
+ ent_id = this.OmdUrl.eid;
903
+ portalkey = this.OmdUrl.portalkey;
904
+ }
905
+ if (Cookies.get('ent_id') !== undefined && Cookies.get('ent_id') !== '') {
906
+ ent_id = Cookies.get('ent_id');
907
+ } else {
908
+ let temp = caseMethod.getUrlParam('ent_id');
909
+ if (temp !== undefined && temp !== '') {
910
+ ent_id = temp;
911
+ }
912
+ }
913
+ if (portalkey === 'cloud') {
914
+ let lock_entid = caseMethod.getUrlParam('lock_entid');
915
+ if (lock_entid !== undefined && lock_entid !== '') {
916
+ ent_id = lock_entid;
917
+ }
918
+ }
919
+
920
+ return ent_id;
921
+ };
922
+ caseMethod.getToken = function(_self) {
923
+ let token = '';
924
+ if (!_self) {
925
+ if (this.token) {
926
+ token = this.token;
927
+ }
928
+ } else {
929
+ if (_self.token) {
930
+ token = _self.token;
931
+ }
932
+ }
933
+ if (Cookies.get('token')) {
934
+ token = Cookies.get('token');
935
+ } else {
936
+ let temp = caseMethod.getUrlParam('token');
937
+ if (temp) {
938
+ token = temp;
939
+ }
940
+ }
941
+ return token;
942
+ };
943
+ caseMethod.getModulecode= function () {
944
+ let modulecode = '';
945
+ modulecode = caseMethod.getUrlParam('modulecode');
946
+ if (!modulecode) {
947
+ modulecode = caseMethod.getUrlParam('billmoduleid');
948
+ }
949
+ return modulecode;
950
+ };
951
+ caseMethod.downloadFile = function(url, that) {
952
+
953
+ if (!url) {
954
+ return;
955
+ }
956
+
957
+ let xhr = new XMLHttpRequest();
958
+
959
+ xhr.open('GET', url, true); // 也可以使用POST方式,根据接口
960
+
961
+ xhr.responseType = 'blob'; // 返回类型blob
962
+
963
+ // 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
964
+
965
+ xhr.onload = function () {
966
+ // 请求完成
967
+ if (this.status === 200) {
968
+ // 返回200
969
+ let blob = this.response;
970
+ let reader = new FileReader();
971
+ let headerStr = decodeURI(this.getResponseHeader('content-disposition'));
972
+ let filename = headerStr.replace('attachment;filename*=UTF-8\'\'','');
973
+ filename = filename.replace('attachment;filename=','');
974
+ // let filename = this.getAllResponseHeaders().split(';')[2].split('\n')[0].split('filename=')[1];
975
+ reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
976
+ filename = decodeURIComponent(filename);
977
+ //去除空格
978
+ filename = filename.replace(/\ +/g,'');
979
+ //去除换行回车
980
+ filename = filename.replace(/[\r\n]/g,'');
981
+ reader.onload = function () {
982
+
983
+ // 转换完成,创建一个a标签用于下载
984
+
985
+ let a = document.createElement('a');
986
+
987
+ a.download = filename;
988
+
989
+
990
+ //a.href = e.target.result;
991
+ a.href = URL.createObjectURL(blob);
992
+
993
+ $('body').append(a); // 修复firefox中无法触发click
994
+ that.$Spin.hide();
995
+ a.click();
996
+
997
+ $(a).remove();
998
+
999
+ };
1000
+
1001
+ } else {
1002
+ that.$Spin.hide();
1003
+ that.alert('导出失败');
1004
+ }
1005
+
1006
+ };
1007
+
1008
+ // 发送ajax请求
1009
+
1010
+ xhr.send(new Blob());
1011
+
1012
+ };
1013
+
1014
+ caseMethod.exportExcelback = function (that) {
1015
+ if (that.child) {
1016
+ setTimeout(that.exportExcelback(that),100);
1017
+ } else {
1018
+ that.$Spin.hide();
1019
+ }
1020
+ };
1021
+
1022
+ caseMethod.doExportExcel = function(_baseUrl,_method,_param,exportType,that){
1023
+ let url = _baseUrl;
1024
+ //filetyep:1 导出文件XlS filetype:2 导出文件XLSX 默认为2
1025
+ //_param.filetype = "1";
1026
+ if (!_param) {
1027
+ _param = {};
1028
+ }
1029
+ url = getresturl(url, _method, _param, that);
1030
+ let _paramStr = JSON.stringify(_param);
1031
+ _paramStr = _paramStr.replaceAll('#','%23');
1032
+ _paramStr = _paramStr.replaceAll('&','%26');
1033
+ _paramStr = _paramStr.replaceAll('+','%2B');
1034
+ //_paramStr = _paramStr.replaceAll(':','%3A');
1035
+ url = encodeURI(url + '&param=' + _paramStr);
1036
+ let userid = Cookies.get('user_id');
1037
+ let user_code = Cookies.get('user_code');
1038
+ if (userid) {
1039
+ url=url+encodeURI('&user_id='+userid);
1040
+ }
1041
+ if (user_code) {
1042
+ url=url+encodeURI('&user_code='+user_code);
1043
+ }
1044
+ that.$Spin.show({
1045
+ render: (h) => {
1046
+ return h('div', '导出中...,请勿关闭!');
1047
+ }
1048
+ });
1049
+ if (!exportType) {
1050
+ exportType = '2';
1051
+ }
1052
+ if(exportType === '2'){
1053
+ caseMethod.downloadFile(url, that);
1054
+ } else {
1055
+ const child = window.open(url,'_blank');
1056
+ var loop = setInterval(function () {
1057
+ if (child.closed) {
1058
+ that.$Spin.hide();
1059
+ clearInterval(loop);
1060
+ }
1061
+ }, 100);
1062
+ // setTimeout(caseMethod.exportExcelback(that),100);
1063
+ }
1064
+ };
1065
+
1066
+ caseMethod.doExportReport= function(_baseUrl,_method,_param,that){
1067
+ let url = _baseUrl;
1068
+ if (!_param) {
1069
+ _param = {};
1070
+ }
1071
+ url = getresturl(url, _method, _param, that);
1072
+ let _paramStr = JSON.stringify(_param);
1073
+ _paramStr = _paramStr.replaceAll('#','%23');
1074
+ _paramStr = _paramStr.replaceAll('&','%26');
1075
+ _paramStr = _paramStr.replaceAll('+','%2B');
1076
+ url = encodeURI(url + '&param=' + _paramStr);
1077
+ that.$Spin.show({
1078
+ render: (h) => {
1079
+ return h('div', '导出中...,请勿关闭!');
1080
+ }
1081
+ });
1082
+ caseMethod.downloadFile(url, that);
1083
+ };
1084
+
1085
+ caseMethod.getFilesInfo = function(billno, billmoduleid,notdelfile,scenetype, callBackMethod) {
1086
+ let usercode = caseMethod.getUserCode();
1087
+ let username = caseMethod.getUserName();
1088
+ let token = caseMethod.getToken();
1089
+ let url = OmdUrl.getfile + 'billno=' + billno + '&billmoduleid=' + billmoduleid+'&scenetype=' + scenetype;
1090
+ let userInfo = '&usercode=' + usercode + '&username=' + username+'&token=' + token;
1091
+ if (notdelfile !== 'Y') {
1092
+ userInfo = userInfo + '&notdelfile=N';
1093
+ } else {
1094
+ userInfo = userInfo + '&notdelfile=Y';
1095
+ }
1096
+ userInfo = encodeURI(userInfo);
1097
+ caseMethod.synchroPost(url, '', {}, (result) => {
1098
+ let data = [];
1099
+ if (result && result.length > 0) {
1100
+ result.forEach(el => {
1101
+ let obj = Object.assign({},{},el);
1102
+ obj.filename = el.filename;
1103
+ obj.filekey = el.filekey;
1104
+ obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo;
1105
+ obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo;
1106
+ obj.title = obj.filename;
1107
+ obj.url = obj.downUrl;
1108
+ obj.modflag = el.modflag;
1109
+ data.push(obj);
1110
+ });
1111
+ }
1112
+ callBackMethod(data);
1113
+ }, null, null, 'get');
1114
+ };
1115
+
1116
+ caseMethod.getFilesInfoByIdkey = function(idkey, callBackMethod) {
1117
+ let usercode = caseMethod.getUserCode();
1118
+ let username = caseMethod.getUserName();
1119
+ let token = caseMethod.getToken();
1120
+ let url = OmdUrl.getfile + 'idkey=' + idkey;
1121
+ let userInfo = '&usercode=' + usercode + '&username=' + username +'&token=' + token;
1122
+ userInfo = encodeURI(userInfo);
1123
+ caseMethod.synchroPost(url, '', {}, (result) => {
1124
+ let data = [];
1125
+ if (result && result.length > 0) {
1126
+ result.forEach(el => {
1127
+ let obj = Object.assign({},{},el);
1128
+ obj.filename = el.filename;
1129
+ obj.filekey = el.filekey;
1130
+ obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo;
1131
+ obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo;
1132
+ obj.title = obj.filename;
1133
+ obj.url = obj.downUrl;
1134
+ obj.modflag = el.modflag;
1135
+ data.push(obj);
1136
+ });
1137
+ }
1138
+ callBackMethod(data);
1139
+ }, null, null, 'get');
1140
+ };
1141
+ caseMethod.getFileInfo = function(filekey,callBackMethod) {
1142
+ let usercode = caseMethod.getUserCode();
1143
+ let username = caseMethod.getUserName();
1144
+ let token = caseMethod.getToken();
1145
+ let url = OmdUrl.getfile + 'filekey=' + filekey;
1146
+ let userInfo = '&usercode=' + usercode + '&username=' + username +'&token=' + token;
1147
+ userInfo = encodeURI(userInfo);
1148
+ caseMethod.synchroPost(url, '', {}, (result) => {
1149
+ let data = [];
1150
+ if (result && result.length > 0) {
1151
+ result.forEach(el => {
1152
+ let obj = Object.assign({},{},el);
1153
+ obj.filename = el.filename;
1154
+ obj.filekey = el.filekey;
1155
+ obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo;
1156
+ obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo;
1157
+ obj.title = obj.filename;
1158
+ obj.url = obj.downUrl;
1159
+ obj.modflag = el.modflag;
1160
+ data.push(obj);
1161
+ });
1162
+ }
1163
+ callBackMethod(data);
1164
+ }, null, null, 'get');
1165
+ };
1166
+ caseMethod.setUrlSuffix = function(url,self) {
1167
+ let srvkey = caseMethod.getUrlParam('srvkey');
1168
+ let token = caseMethod.getUrlParam('token');
1169
+ let user_code = caseMethod.getUrlParam('usercode');
1170
+ let portalkey = caseMethod.getUrlParam('portalkey')
1171
+ if (url) {
1172
+ if (url.indexOf('?') != -1) {
1173
+ return url +'&token='+token + '&srvkey=' + srvkey + '&app_key=' +self.OmdUrl.appKey + '&secret=' + self.OmdUrl.secret + '&portalkey=' + portalkey + '&usercode=' + user_code;
1174
+ } else {
1175
+ return url +'?token='+token + '&srvkey=' + srvkey + '&app_key=' +self.OmdUrl.appKey + '&secret=' + self.OmdUrl.secret + '&portalkey=' + portalkey + '&usercode=' + user_code;
1176
+ }
1177
+ }
1178
+ return url;
1179
+ }
1180
+ export default caseMethod;