@smart100/spu-web-plugin 0.0.9 → 0.0.13

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.
@@ -0,0 +1,46 @@
1
+ export class Step {
2
+ statusMap: Array<string> = [
3
+ 'initial',
4
+ 'ready',
5
+ 'running',
6
+ 'ext_readyrun',
7
+ 'ext_running',
8
+ 'success',
9
+ 'error',
10
+ 'cancel'
11
+ ]
12
+ statusTextMap: Array<string> = [
13
+ '',
14
+ '已加入导出队列,等待导出',
15
+ '文件下载中',
16
+ '图片处理中',
17
+ '图片处理中',
18
+ '导出完成',
19
+ '导出失败',
20
+ '任务已取消'
21
+ ]
22
+ status = 0
23
+ statusName = 'initial'
24
+ statusText = ''
25
+
26
+ next () {
27
+ this.go(this.statusMap[this.status + 1])
28
+ }
29
+
30
+ go (statusName: string) {
31
+ const status = this.statusMap.findIndex((item) => {
32
+ return item === statusName
33
+ })
34
+ if (status < 0) {
35
+ console.error(`不存在 ${statusName} 状态`)
36
+ } else {
37
+ this.status = status
38
+ this.statusName = this.statusMap[this.status]
39
+ this.statusText = this.statusTextMap[this.status]
40
+ }
41
+ }
42
+
43
+ current () {
44
+ return this.statusName
45
+ }
46
+ }
@@ -0,0 +1,343 @@
1
+ import SpuExpandexp from './index'
2
+
3
+ import icon_excel from './icons/icon_excel.png'
4
+ import icon_csv from './icons/icon_csv.png'
5
+ import icon_pdf from './icons/icon_pdf.png'
6
+ import icon_zip from './icons/icon_zip.png'
7
+
8
+ // console.log(icon_csv)
9
+
10
+ export default (ele: SpuExpandexp) => {
11
+ return `
12
+ <style>
13
+ :host {
14
+ display: block;
15
+ width: 100%;
16
+ height: 100%;
17
+ position: fixed;
18
+ top: 0;
19
+ left: 0px;
20
+ right: 0px;
21
+ bottom: 0px;
22
+ z-index: 1;
23
+ }
24
+
25
+ .hide {
26
+ display: none!important;
27
+ }
28
+
29
+ .spu-expandexp {
30
+ width: 100%;
31
+ height: 100%;
32
+ background-color: rgba(0, 0, 0, 0.5);
33
+ overflow: auto;
34
+ }
35
+
36
+
37
+ .modal {
38
+ width: 80%;
39
+ max-width: 800px;
40
+ min-width: 500px;
41
+ margin: 50px auto 0;
42
+ border-radius: 2px;
43
+ overflow: hidden;
44
+ }
45
+ .modal-th {
46
+ height: 40px;
47
+ background-color: #409eff;
48
+ }
49
+ .modal-th .title {
50
+ float: left;
51
+ line-height: 40px;
52
+ color: #fff;
53
+ font-size: 16px;
54
+ margin-left: 16px;
55
+ }
56
+ .modal-th .close {
57
+ float: right;
58
+ line-height: 40px;
59
+ height: 40px;
60
+ width: 40px;
61
+ color: #fff;
62
+ font-size: 16px;
63
+ text-align: center;
64
+ cursor: pointer;
65
+ }
66
+ .modal-tb {
67
+ padding: 16px;
68
+ background-color: #fff;
69
+ }
70
+
71
+ .export {}
72
+ .export-wait {
73
+ line-height: 32px;
74
+ height: 32px;
75
+ text-align: center;
76
+ background-color: rgba(255, 73, 73, .1);
77
+ color: #333;
78
+ }
79
+ .export-wait span {
80
+ color: red;
81
+ margin: 0 4px;
82
+ }
83
+ .export-tit {
84
+ line-height: 32px;
85
+ height: 32px;
86
+ }
87
+
88
+ .export-sel {
89
+ margin-bottom: 12px;
90
+ }
91
+ .export-sel-title {
92
+ margin-bottom: 12px;
93
+ }
94
+ .export-sel-con {
95
+ display: flex;
96
+ }
97
+ .export-sel-con-item {
98
+ display: flex;
99
+ align-items: center;
100
+ margin-right: 32px;
101
+ cursor: pointer;
102
+ }
103
+ .export-sel-con-item label {
104
+ font-size: 14px;
105
+ font-weight: bold;
106
+ cursor: pointer;
107
+ }
108
+ .export-sel-con-item input {
109
+ cursor: pointer;
110
+ margin: 4px;
111
+ }
112
+
113
+ .export-section-wrap {}
114
+ .export-section {
115
+ border: 1px solid #ddd;
116
+ padding: 12px;
117
+ }
118
+
119
+ .export-file {
120
+ height: 28px;
121
+ line-height: 28px;
122
+ display: flex;
123
+ justify-content: space-between;
124
+ // margin-bottom: 12px;
125
+ }
126
+ .export-file-l {
127
+ flex: 1;
128
+ display: flex;
129
+ align-items: center;
130
+ font-size: 14px;
131
+ }
132
+ .export-file-l-img {
133
+ flex: none;
134
+ display: block;
135
+ height: 20px;
136
+ width: 20px;
137
+ margin-right: 4px;
138
+ background-size: cover;
139
+ background-position: center center;
140
+ background-repeat: no-repeat;
141
+ }
142
+ .export-file-l-img.excel {
143
+ background-image: url(${icon_excel});
144
+ }
145
+ .export-file-l-img.csv {
146
+ background-image: url(${icon_csv});
147
+ }
148
+ .export-file-l-img.pdf {
149
+ background-image: url(${icon_pdf});
150
+ }
151
+ .export-file-l-img.zip {
152
+ background-image: url(${icon_zip});
153
+ }
154
+ .export-file-l-filename {
155
+ flex: 1;
156
+ }
157
+ .export-file-l-filesize {
158
+ flex: none;
159
+ }
160
+ .export-file-r {
161
+ display: flex;
162
+ width: 80px;
163
+ flex-direction: row-reverse;
164
+ }
165
+ .export-file-r-download {
166
+ line-height: 26px;
167
+ border-radius: 3px;
168
+ background-color: #67c23a;
169
+ border: 1px solid #67c23a;
170
+ color: #fff;
171
+ padding: 0 12px;
172
+ font-size: 14px;
173
+ cursor: pointer;
174
+ }
175
+ .export-file-r-download:hover {
176
+ background: #85ce61;
177
+ border-color: #85ce61;
178
+ }
179
+ .export-file-r-cancel {
180
+ line-height: 26px;
181
+ width: 26px;
182
+ border-radius: 14px;
183
+ color: #f56c6c;
184
+ background: #fef0f0;
185
+ border: 1px solid #fbc4c4;
186
+ text-align: center;
187
+ font-size: 14px;
188
+ cursor: pointer;
189
+ }
190
+ .export-file-r-cancel:hover {
191
+ background: #f56c6c;
192
+ border-color: #f56c6c;
193
+ color: #fff;
194
+ }
195
+
196
+
197
+
198
+ .export-progress {
199
+ display: flex;
200
+ justify-content: center;
201
+ align-items: center;
202
+ height: 30px;
203
+ }
204
+ .export-progress-outer {
205
+ flex: 1;
206
+ height: 8px;
207
+ background-color: #EBEEF5;
208
+ overflow: hidden;
209
+ position: relative;
210
+ vertical-align: middle;
211
+ }
212
+ .export-progress-inner {
213
+ animation-duration: 3s;
214
+ height: 100%;
215
+ width: 0;
216
+ background-color: #417AE7;
217
+ -webkit-transition: width .6s ease;
218
+ transition: width .6s ease;
219
+ }
220
+ .export-progress-inner.error {
221
+ background: red;
222
+ }
223
+ .export-progress-inner.success {
224
+ background: #67C23A;
225
+ }
226
+ .export-progress-text {
227
+ flex: none;
228
+ width: 50px;
229
+ font-size: 14px;
230
+ line-height: 30px;
231
+ text-align: right;
232
+ }
233
+
234
+
235
+
236
+ .export-result {
237
+ height: 28px;
238
+ line-height: 28px;
239
+ text-align: right;
240
+ font-size: 12px;
241
+ padding: 0px 8px;
242
+ }
243
+ .export-result.error {
244
+ background: #fdf1ef;
245
+ white-space: nowrap;
246
+ text-overflow: ellipsis;
247
+ overflow: hidden;
248
+ }
249
+ .export-result.success {
250
+ background: #e5f7f3;
251
+ }
252
+
253
+
254
+ .export-tip {
255
+ height: 28px;
256
+ line-height: 28px;
257
+ margin-top: 8px;
258
+ font-size: 12px;
259
+ text-align: right;
260
+ color: #999;
261
+ }
262
+
263
+ .export-btnwrap {
264
+ margin-top: 12px;
265
+ display: flex;
266
+ flex-direction: row-reverse;
267
+ }
268
+ .btn {
269
+ line-height: 38px;
270
+ line-height: 38px;
271
+ border: 1px solid #409eff;
272
+ background-color: #409eff;
273
+ border-radius: 5px;
274
+ color: #fff;
275
+ padding: 0 20px;
276
+ font-size: 16px;
277
+ cursor: pointer;
278
+ }
279
+ .btn:hover {
280
+ background: #66b1ff;
281
+ border-color: #66b1ff;
282
+ }
283
+ </style>
284
+
285
+ <div class="spu-expandexp">
286
+ <div class="modal">
287
+ <div class="modal-th">
288
+ <div class="title">
289
+ 数据导出
290
+ </div>
291
+ <div class="close">
292
+ x
293
+ </div>
294
+ </div>
295
+ <div class="modal-tb">
296
+ <div class="export">
297
+ <div class="export-wait hide">
298
+ 导出等待队列中:还有<span></span>位,请耐心稍等...
299
+ </div>
300
+
301
+ <div class="export-sel hide">
302
+ <div class="export-sel-title">请选择导出内容</div>
303
+ <div class="export-sel-con"></div>
304
+ </div>
305
+
306
+ <div class="export-section-wrap hide">
307
+ <div class="export-tit"></div>
308
+ <div class="export-section">
309
+ <div class="export-file">
310
+ <div class="export-file-l">
311
+ <div class="export-file-l-img"></div>
312
+ <span class="export-file-l-filename"></span>
313
+ <span class="export-file-l-filesize"></span>
314
+ </div>
315
+ <div class="export-file-r">
316
+ <div class="export-file-r-download hide">下载</div>
317
+ <div class="export-file-r-cancel hide">x</div>
318
+ </div>
319
+ </div>
320
+
321
+ <div class="export-progress">
322
+ <div class="export-progress-outer">
323
+ <div class="export-progress-inner"></div>
324
+ </div>
325
+ <div class="export-progress-text"></div>
326
+ </div>
327
+
328
+ <div class="export-result hide"></div>
329
+
330
+ <div class="export-tip hide">您可以随时关闭该弹框,之后在导入导出列表中查看结果。</div>
331
+ </div>
332
+ </div>
333
+
334
+ <div class="export-btnwrap">
335
+ <div class="btn">导出</div>
336
+ </div>
337
+
338
+ </div>
339
+ </div>
340
+ </div>
341
+ </div>
342
+ `
343
+ }
@@ -0,0 +1,91 @@
1
+ export const dealCostTime = (val: number) => {
2
+ // const $t = useI18n().t
3
+ // 1000 * 60 * 1 + 1000 *58 + 500 //1分58.5秒
4
+ // val = 1000 * 60 * 60 * 2 + 1000 * 60 * 1 + 1000 *58 + 500 // 两小时1分58.5秒
5
+ if (val < 1000) {
6
+ return '1' + '秒'
7
+ } else if (val >= 1000 && val < 1000 * 60) {
8
+ return `${(val / 1000).toFixed(2)}` + '秒'
9
+ } else if (val >= 1000 * 60 && val < 1000 * 60 * 60) {
10
+ // return `${moment
11
+ // .duration((val / (1000 * 60)).toFixed(2), 'minute')
12
+ // .locale('zh_CN')
13
+ // .humanize()}`
14
+ return Math.floor(val / (1000 * 60)) + '分' + Math.ceil((val % (1000 * 60)) / 1000) + '秒'
15
+ } else {
16
+ // return `${moment
17
+ // .duration((val / (1000 * 60 * 60)).toFixed(2), 'hour')
18
+ // .locale('zh_CN')
19
+ // .humanize()}`
20
+ return (
21
+ Math.floor(val / (1000 * 60 * 60)) +
22
+ '时' +
23
+ Math.floor((val % (1000 * 60 * 60)) / (1000 * 60)) +
24
+ '分' +
25
+ Math.ceil((val % (1000 * 60)) / 1000) +
26
+ '秒'
27
+ )
28
+ }
29
+ }
30
+
31
+ export const fixFileName = (sheetname: string, type: string, exportcontent: string) => {
32
+ let fileName = sheetname && sheetname.replace('.xlsx', '').replace('.csv', '')
33
+ if (exportcontent === 'link') {
34
+ fileName = fileName + '.zip'
35
+ } else {
36
+ if (parseInt(type) === 1) {
37
+ fileName = fileName + '.xlsx'
38
+ } else if (parseInt(type) === 2) {
39
+ fileName = fileName + '.csv'
40
+ } else if (parseInt(type) === 3) {
41
+ fileName = fileName + '.pdf'
42
+ }
43
+ }
44
+ return fileName
45
+ }
46
+
47
+ export const dealResultMessage = (item: any) => {
48
+ if (!item.errorfileurl && !item.fatalerrormsg) {
49
+ // 成功
50
+ return `成功导出${item.exptotalitem}条数据,耗时${dealCostTime(+item.finishdate - +item.initdate)}`
51
+ } else if (item.fatalerrormsg) {
52
+ return `${item.fatalerrormsg}`
53
+ } else {
54
+ return `总计${item.exptotalitem}条数据,成功${item.expsuctotalitem}条,失败${
55
+ item.exptotalitem - item.expsuctotalitem
56
+ }条,耗时${dealCostTime(+item.finishdate - +item.initdate)}`
57
+ }
58
+ }
59
+
60
+ export const sizeUnit = (val: number) => {
61
+ if (!val) {
62
+ return '0kb'
63
+ }
64
+ if (val < 1024) {
65
+ return `${val}b`
66
+ } else if (val >= 1024 && val < 1024 * 1024) {
67
+ return `${(val / 1024).toFixed(2)}kb`
68
+ } else {
69
+ return `${(val / (1024 * 1024)).toFixed(2)}mb`
70
+ }
71
+ }
72
+
73
+ // 兼容 val 为数字如4000 或者 4kb
74
+ export const dealFileSize = (val: number | string): string => {
75
+ if (val === '' || val === null) {
76
+ return ''
77
+ } else if (val === 0 || val === '0') {
78
+ return '0kb'
79
+ } else if (Number(val)) {
80
+ val = Number(val)
81
+ if (val < 1024) {
82
+ return `${val}b`
83
+ } else if (val >= 1024 && val < 1024 * 1024) {
84
+ return `${(val / 1024).toFixed(2)}kb`
85
+ } else {
86
+ return `${(val / (1024 * 1024)).toFixed(2)}mb`
87
+ }
88
+ } else {
89
+ return val.toString()
90
+ }
91
+ }
@@ -0,0 +1,7 @@
1
+ // import SpuLoadding from './loadding'
2
+ // import SpuExpandexp from './expandexp'
3
+
4
+ export default {
5
+ // SpuLoadding,
6
+ // SpuExpandexp
7
+ }
@@ -0,0 +1,152 @@
1
+ const styletext = `
2
+ :host {
3
+ width: 100%;
4
+ height: 100%;
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ z-index: 10000;
9
+ background-color: rgba(255, 255, 255, 0.2);
10
+ }
11
+ :host .spu-loadding {
12
+ width: 100%;
13
+ height: 100%;
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ }
18
+
19
+ :host .spu-loadding-icon {
20
+ width: 24px;
21
+ height: 24px;
22
+ background-size: cover;
23
+ background-position: center center;
24
+ background-repeat: no-repeat;
25
+ background-image: url(data:image/gif;base64,R0lGODlhIAAgALMAAP///7Ozs/v7+9bW1uHh4fLy8rq6uoGBgTQ0NAEBARsbG8TExJeXl/39/VRUVAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBQAAACwAAAAAIAAgAAAE5xDISSlLrOrNp0pKNRCdFhxVolJLEJQUoSgOpSYT4RowNSsvyW1icA16k8MMMRkCBjskBTFDAZyuAEkqCfxIQ2hgQRFvAQEEIjNxVDW6XNE4YagRjuBCwe60smQUDnd4Rz1ZAQZnFAGDd0hihh12CEE9kjAEVlycXIg7BAsMB6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YEvpJivxNaGmLHT0VnOgGYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHQjYKhKP1oZmADdEAAAh+QQFBQAAACwAAAAAGAAXAAAEchDISasKNeuJFKoHs4mUYlJIkmjIV54Soypsa0wmLSnqoTEtBw52mG0AjhYpBxioEqRNy8V0qFzNw+GGwlJki4lBqx1IBgjMkRIghwjrzcDti2/Gh7D9qN774wQGAYOEfwCChIV/gYmDho+QkZKTR3p7EQAh+QQFBQAAACwBAAAAHQAOAAAEchDISWdANesNHHJZwE2DUSEo5SjKKB2HOKGYFLD1CB/DnEoIlkti2PlyuKGEATMBaAACSyGbEDYD4zN1YIEmh0SCQQgYehNmTNNaKsQJXmBuuEYPi9ECAU/UFnNzeUp9VBQEBoFOLmFxWHNoQw6RWEocEQAh+QQFBQAAACwHAAAAGQARAAAEaRDICdZZNOvNDsvfBhBDdpwZgohBgE3nQaki0AYEjEqOGmqDlkEnAzBUjhrA0CoBYhLVSkm4SaAAWkahCFAWTU0A4RxzFWJnzXFWJJWb9pTihRu5dvghl+/7NQmBggo/fYKHCX8AiAmEEQAh+QQFBQAAACwOAAAAEgAYAAAEZXCwAaq9ODAMDOUAI17McYDhWA3mCYpb1RooXBktmsbt944BU6zCQCBQiwPB4jAihiCK86irTB20qvWp7Xq/FYV4TNWNz4oqWoEIgL0HX/eQSLi69boCikTkE2VVDAp5d1p0CW4RACH5BAUFAAAALA4AAAASAB4AAASAkBgCqr3YBIMXvkEIMsxXhcFFpiZqBaTXisBClibgAnd+ijYGq2I4HAamwXBgNHJ8BEbzgPNNjz7LwpnFDLvgLGJMdnw/5DRCrHaE3xbKm6FQwOt1xDnpwCvcJgcJMgEIeCYOCQlrF4YmBIoJVV2CCXZvCooHbwGRcAiKcmFUJhEAIfkEBQUAAAAsDwABABEAHwAABHsQyAkGoRivELInnOFlBjeM1BCiFBdcbMUtKQdTN0CUJru5NJQrYMh5VIFTTKJcOj2HqJQRhEqvqGuU+uw6AwgEwxkOO55lxIihoDjKY8pBoThPxmpAYi+hKzoeewkTdHkZghMIdCOIhIuHfBMOjxiNLR4KCW1ODAlxSxEAIfkEBQUAAAAsCAAOABgAEgAABGwQyEkrCDgbYvvMoOF5ILaNaIoGKroch9hacD3MFMHUBzMHiBtgwJMBFolDB4GoGGBCACKRcAAUWAmzOWJQExysQsJgWj0KqvKalTiYPhp1LBFTtp10Is6mT5gdVFx1bRN8FTsVCAqDOB9+KhEAIfkEBQUAAAAsAgASAB0ADgAABHgQyEmrBePS4bQdQZBdR5IcHmWEgUFQgWKaKbWwwSIhc4LonsXhBSCsQoOSScGQDJiWwOHQnAxWBIYJNXEoFCiEWDI9jCzESey7GwMM5doEwW4jJoypQQ743u1WcTV0CgFzbhJ5XClfHYd/EwZnHoYVDgiOfHKQNREAIfkEBQUAAAAsAAAPABkAEQAABGeQqUQruDjrW3vaYCZ5X2ie6EkcKaooTAsi7ytnTq046BBsNcTvItz4AotMwKZBIC6H6CVAJaCcT0CUBTgaTg5nTCu9GKiDEMPJg5YBBOpwlnVzLwtqyKnZagZWahoMB2M3GgsHSRsRACH5BAUFAAAALAEACAARABgAAARcMKR0gL34npkUyyCAcAmyhBijkGi2UW02VHFt33iu7yiDIDaD4/erEYGDlu/nuBAOJ9Dvc2EcDgFAYIuaXS3bbOh6MIC5IAP5Eh5fk2exC4tpgwZyiyFgvhEMBBEAIfkEBQUAAAAsAAACAA4AHQAABHMQyAnYoViSlFDGXBJ808Ep5KRwV8qEg+pRCOeoioKMwJK0Ekcu54h9AoghKgXIMZgAApQZcCCu2Ax2O6NUud2pmJcyHA4L0uDM/ljYDCnGfGakJQE5YH0wUBYBAUYfBIFkHwaBgxkDgX5lgXpHAXcpBIsRADs=);
26
+ }
27
+ `
28
+
29
+ const template = `
30
+ <div class="spu-loadding">
31
+ <div class="spu-loadding-icon"></div>
32
+ </div>
33
+ `
34
+
35
+ export default class SpuLoadding extends HTMLElement {
36
+
37
+ static componentName: string = 'spu-loadding'
38
+ static register () {
39
+ if (!window.customElements.get(SpuLoadding.componentName)) {
40
+ window.customElements.define(SpuLoadding.componentName, SpuLoadding)
41
+ }
42
+ }
43
+
44
+ isuseshadow = true
45
+ // isuseshadow = false
46
+ shadow: ShadowRoot | null = null
47
+ constructor () {
48
+ super()
49
+ }
50
+
51
+ // 当自定义元素第一次被连接到文档DOM时被调用。
52
+ connectedCallback () {
53
+ // console.log('connectedCallback')
54
+ const templateElem = document.createElement('template')
55
+ templateElem.innerHTML = template
56
+ const content = templateElem.content.cloneNode(true)
57
+
58
+ if (this.isuseshadow) {
59
+ this.shadow = this.attachShadow({ mode: 'open' })
60
+ this.shadow.append(content)
61
+ this.appendStyle()
62
+
63
+
64
+ // this.shadow.querySelector('.spu-loadding').addEventListener('click', () => {
65
+ // console.log(this)
66
+ // console.log(this.isuseshadow)
67
+ // console.log(this.shadow)
68
+ // })
69
+ // this.addEventListener('click', () => {
70
+ // console.log(this)
71
+ // console.log(this.isuseshadow)
72
+ // console.log(this.shadow)
73
+ // })
74
+
75
+ } else {
76
+ this.append(content)
77
+ this.appendStyle()
78
+
79
+ // this.addEventListener('click', () => {
80
+ // console.log(this)
81
+ // console.log(this.isuseshadow)
82
+ // console.log(this.shadow)
83
+ // })
84
+ }
85
+ }
86
+
87
+ // 当组件从 DOM 文档移除后调用。
88
+ disconnectedCallback () {
89
+ // console.log('disconnectedCallback')
90
+ // setTimeout(() => {
91
+ // console.log(this)
92
+ // }, 100)
93
+ }
94
+
95
+ createStyleEle () {
96
+ var styleElement = document.createElement('style')
97
+ styleElement.type = 'text/css'
98
+ styleElement.id = SpuLoadding.componentName
99
+ styleElement.innerHTML = styletext
100
+ return styleElement
101
+ }
102
+
103
+ appendStyle () {
104
+ if (this.isuseshadow) {
105
+ const style = this.createStyleEle()
106
+ this.shadow!.appendChild(style)
107
+ } else {
108
+ if (!document.getElementById(SpuLoadding.componentName)) {
109
+ const style = this.createStyleEle()
110
+ document.getElementsByTagName('head')[0].appendChild(style)
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+
117
+
118
+ class Loadding {
119
+ count = 0
120
+
121
+ ele: null | HTMLElement = null
122
+
123
+ constructor () {
124
+ SpuLoadding.register()
125
+ }
126
+
127
+ open () {
128
+ this.count++
129
+ if (!this.ele) {
130
+ this.ele = document.createElement('spu-loadding')
131
+ // console.log(this.ele)
132
+ document.body.appendChild(this.ele)
133
+ }
134
+ }
135
+
136
+ close () {
137
+ this.count--
138
+ if (this.count <= 0) {
139
+ this.count = 0
140
+ if (this.ele) {
141
+ document.body.removeChild(this.ele)
142
+ this.ele = null
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ const loadding = new Loadding()
149
+
150
+ export {
151
+ loadding
152
+ }