vue2-client 1.10.33 → 1.11.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.
- package/package.json +107 -107
- package/src/App.vue +196 -196
- package/src/base-client/components/common/XAddNativeForm/demo.vue +43 -43
- package/src/base-client/components/common/XAddReport/XAddReport.vue +207 -207
- package/src/base-client/components/common/XConversation/XConversation.vue +275 -263
- package/src/base-client/components/common/XForm/XForm.vue +393 -393
- package/src/base-client/components/common/XForm/XFormItem.vue +1248 -1248
- package/src/base-client/components/common/XFormCol/XFormCol.vue +157 -157
- package/src/base-client/components/common/XFormTable/XFormTable.vue +868 -856
- package/src/base-client/components/common/XIntervalPicker/XIntervalPicker.vue +121 -121
- package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +201 -201
- package/src/base-client/components/common/XReportGrid/XReport.vue +1079 -1070
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +46 -47
- package/src/base-client/components/common/XReportGrid/XReportDesign.vue +628 -628
- package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
- package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +1104 -1104
- package/src/base-client/components/common/XReportGrid/print.js +184 -184
- package/src/base-client/components/common/XTab/XTab.vue +233 -201
- package/src/base-client/components/common/XTable/XTable.vue +114 -195
- package/src/base-client/components/common/XTable/XTableWrapper.vue +240 -0
- package/src/base-client/components/layout/XPageView/RenderRow.vue +12 -11
- package/src/components/STable/index.js +12 -12
- package/src/components/cache/AKeepAlive.js +179 -179
- package/src/layouts/BlankView.vue +78 -78
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/router/async/router.map.js +148 -95
- package/src/utils/indexedDB.js +167 -216
- package/src/utils/microAppUtils.js +49 -49
- package/vue.config.js +6 -5
package/src/utils/indexedDB.js
CHANGED
|
@@ -1,256 +1,205 @@
|
|
|
1
|
-
// indexDB 存储
|
|
2
1
|
import { post } from '@vue2-client/services/api'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const DB_CONFIG = {
|
|
4
|
+
NAME: window.__MICRO_APP_NAME__ ? `view_${window.__MICRO_APP_NAME__}` : 'view',
|
|
5
|
+
STORE_NAME: 'metaCache',
|
|
6
|
+
VERSION: 1,
|
|
7
|
+
CURRENT_VERSION: 1
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const objectStore = transaction.objectStore('metaCache')
|
|
18
|
-
const request = objectStore.add({ key: 'alive', data: true })
|
|
10
|
+
class IndexedDBManager {
|
|
11
|
+
constructor () {
|
|
12
|
+
this.db = undefined
|
|
13
|
+
this.locks = {}
|
|
14
|
+
this.isInMicroApp = !!window.__MICRO_APP_NAME__
|
|
15
|
+
this.microAppName = window.__MICRO_APP_NAME__ || ''
|
|
16
|
+
this.indexedDB = window?.rawWindow?.indexedDB || window.indexedDB || window.webkitindexedDB
|
|
17
|
+
this.IDBKeyRange = window?.rawWindow?.IDBKeyRange || window.IDBKeyRange || window.webkitIDBKeyRange
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}).catch(e => {
|
|
25
|
-
console.error(e)
|
|
26
|
-
})
|
|
27
|
-
}
|
|
20
|
+
async openDatabase () {
|
|
21
|
+
try {
|
|
22
|
+
return await new Promise((resolve, reject) => {
|
|
23
|
+
const checkRequest = this.indexedDB.open(DB_CONFIG.NAME)
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
25
|
+
checkRequest.onsuccess = (e) => {
|
|
26
|
+
const db = e.target.result
|
|
27
|
+
const currentVersion = db.version
|
|
28
|
+
db.close()
|
|
29
|
+
|
|
30
|
+
DB_CONFIG.CURRENT_VERSION = Math.max(currentVersion, DB_CONFIG.VERSION)
|
|
31
|
+
const request = this.indexedDB.open(DB_CONFIG.NAME, DB_CONFIG.CURRENT_VERSION)
|
|
32
|
+
|
|
33
|
+
request.onerror = (e) => reject(e.currentTarget.error)
|
|
34
|
+
|
|
35
|
+
request.onsuccess = (e) => {
|
|
36
|
+
const db = e.target.result
|
|
37
|
+
if (!db.objectStoreNames.contains(DB_CONFIG.STORE_NAME)) {
|
|
38
|
+
db.close()
|
|
39
|
+
DB_CONFIG.CURRENT_VERSION++
|
|
40
|
+
this.upgradeDatabase(resolve, reject)
|
|
41
|
+
} else {
|
|
42
|
+
resolve(db)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
request.onupgradeneeded = (e) => {
|
|
47
|
+
const db = e.target.result
|
|
48
|
+
if (!db.objectStoreNames.contains(DB_CONFIG.STORE_NAME)) {
|
|
49
|
+
db.createObjectStore(DB_CONFIG.STORE_NAME, { keyPath: 'key' })
|
|
50
|
+
}
|
|
51
|
+
}
|
|
56
52
|
}
|
|
53
|
+
|
|
54
|
+
checkRequest.onerror = (e) => reject(e.currentTarget.error)
|
|
57
55
|
})
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('打开数据库失败:', error)
|
|
58
|
+
throw error
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
-
openDatabase () {
|
|
61
|
-
const self = this
|
|
60
|
+
}
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
async upgradeDatabase (resolve, reject) {
|
|
63
|
+
const request = this.indexedDB.open(DB_CONFIG.NAME, DB_CONFIG.CURRENT_VERSION)
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
request.onupgradeneeded = (e) => {
|
|
66
|
+
const db = e.target.result
|
|
67
|
+
if (!db.objectStoreNames.contains(DB_CONFIG.STORE_NAME)) {
|
|
68
|
+
db.createObjectStore(DB_CONFIG.STORE_NAME, { keyPath: 'key' })
|
|
68
69
|
}
|
|
70
|
+
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
resolve(event.target.result)
|
|
82
|
-
}
|
|
83
|
-
upgradeRequest.onerror = function (event) {
|
|
84
|
-
reject(event.currentTarget.error)
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
resolve(db)
|
|
72
|
+
request.onsuccess = (e) => resolve(e.target.result)
|
|
73
|
+
request.onerror = (e) => reject(e.currentTarget.error)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async openDB (callback) {
|
|
77
|
+
try {
|
|
78
|
+
if (this.db) {
|
|
79
|
+
const isAlive = await this.checkConnection()
|
|
80
|
+
if (isAlive) {
|
|
81
|
+
callback(this.db)
|
|
82
|
+
return
|
|
88
83
|
}
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
this.db = await this.openDatabase()
|
|
87
|
+
callback(this.db)
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error('数据库操作失败:', error)
|
|
90
|
+
if (error.message?.includes('version')) {
|
|
91
|
+
await this.recreateDatabase()
|
|
92
|
+
callback(this.db)
|
|
96
93
|
}
|
|
97
|
-
})
|
|
98
|
-
},
|
|
99
|
-
deleteDB: function (dbname) {
|
|
100
|
-
// 删除数据库
|
|
101
|
-
const self = this
|
|
102
|
-
self.indexedDB.deleteDatabase(dbname)
|
|
103
|
-
},
|
|
104
|
-
closeDB: function () {
|
|
105
|
-
const self = this
|
|
106
|
-
if (self.db) {
|
|
107
|
-
self.db.close()
|
|
108
94
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
self.openDB((res) => {
|
|
127
|
-
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').put({
|
|
128
|
-
key: key,
|
|
129
|
-
data: data
|
|
130
|
-
})
|
|
131
|
-
request.onerror = function () {
|
|
132
|
-
console.error('数据更新失败')
|
|
133
|
-
}
|
|
134
|
-
request.onsuccess = function () {
|
|
135
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async checkConnection () {
|
|
98
|
+
try {
|
|
99
|
+
const transaction = this.db.transaction([DB_CONFIG.STORE_NAME], 'readwrite')
|
|
100
|
+
const store = transaction.objectStore(DB_CONFIG.STORE_NAME)
|
|
101
|
+
await this.promisifyRequest(store.add({ key: 'alive', data: true }))
|
|
102
|
+
return true
|
|
103
|
+
} catch {
|
|
104
|
+
return false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
promisifyRequest (request) {
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
request.onsuccess = () => resolve(request.result)
|
|
111
|
+
request.onerror = () => reject(request.error)
|
|
136
112
|
})
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async getByWeb (key, url, params, callback, processFun) {
|
|
116
|
+
if (this.locks[key]) {
|
|
117
|
+
await this.locks[key]
|
|
118
|
+
return this.getByWeb(key, url, params, callback, processFun)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.locks[key] = (async () => {
|
|
122
|
+
try {
|
|
123
|
+
const data = await this.getData(key)
|
|
124
|
+
if (!data && url) {
|
|
125
|
+
const res = await post(url, params)
|
|
126
|
+
const processedData = processFun ? processFun(res) : res
|
|
127
|
+
|
|
128
|
+
if (process.env.NODE_ENV === 'production' || key !== 'webMobileConfig') {
|
|
129
|
+
await this.add(key, processedData)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
callback(processedData)
|
|
133
|
+
} else {
|
|
134
|
+
callback(data)
|
|
150
135
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const self = this
|
|
156
|
-
self.openDB((res) => {
|
|
157
|
-
const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
|
|
158
|
-
const request = store.getAll()
|
|
159
|
-
request.onerror = function () {
|
|
160
|
-
}
|
|
161
|
-
request.onsuccess = function (e) {
|
|
162
|
-
const result = e.target.result
|
|
163
|
-
if (typeof (callback) === 'function') {
|
|
164
|
-
callback(result)
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error('获取数据失败:', error)
|
|
138
|
+
if (process.env.NODE_ENV === 'production' && key !== 'webMobileConfig') {
|
|
139
|
+
await this.add(key, null)
|
|
165
140
|
}
|
|
141
|
+
callback(null)
|
|
166
142
|
}
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
locks[key]
|
|
173
|
-
this.getByWeb(key, url, params, callback, processFun)
|
|
174
|
-
})
|
|
175
|
-
return
|
|
143
|
+
})()
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
await this.locks[key]
|
|
147
|
+
} finally {
|
|
148
|
+
delete this.locks[key]
|
|
176
149
|
}
|
|
150
|
+
}
|
|
177
151
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
152
|
+
async getData (key) {
|
|
153
|
+
return new Promise((resolve) => {
|
|
154
|
+
this.openDB((db) => {
|
|
155
|
+
const store = db.transaction(DB_CONFIG.STORE_NAME, 'readwrite').objectStore(DB_CONFIG.STORE_NAME)
|
|
156
|
+
const request = store.get(key)
|
|
157
|
+
request.onsuccess = (e) => resolve(e.target.result?.data)
|
|
158
|
+
request.onerror = () => resolve(null)
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}
|
|
181
162
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
console.error(e)
|
|
190
|
-
}
|
|
191
|
-
resolve()
|
|
192
|
-
}).catch((e) => {
|
|
193
|
-
if (process.env.NODE_ENV === 'production' && key !== 'webMobileConfig') { self.add(key, null) }
|
|
194
|
-
callback(null)
|
|
195
|
-
resolve()
|
|
196
|
-
})
|
|
197
|
-
}
|
|
163
|
+
async add (key, data) {
|
|
164
|
+
this.openDB((db) => {
|
|
165
|
+
const store = db.transaction(DB_CONFIG.STORE_NAME, 'readwrite').objectStore(DB_CONFIG.STORE_NAME)
|
|
166
|
+
const request = store.add({ key, data })
|
|
167
|
+
request.onerror = () => this.update(key, data)
|
|
168
|
+
})
|
|
169
|
+
}
|
|
198
170
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
reject(e)
|
|
205
|
-
}
|
|
206
|
-
request.onsuccess = function (e) {
|
|
207
|
-
const result = e.target.result
|
|
208
|
-
if (!result && url) {
|
|
209
|
-
handlePostRequest()
|
|
210
|
-
} else {
|
|
211
|
-
callback(result.data)
|
|
212
|
-
resolve()
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
} catch (e) {
|
|
217
|
-
console.error('indexDb数据库操作错误', e)
|
|
218
|
-
handlePostRequest()
|
|
219
|
-
}
|
|
220
|
-
}).finally(() => {
|
|
221
|
-
delete locks[key]
|
|
171
|
+
async update (key, data) {
|
|
172
|
+
this.openDB((db) => {
|
|
173
|
+
const store = db.transaction(DB_CONFIG.STORE_NAME, 'readwrite').objectStore(DB_CONFIG.STORE_NAME)
|
|
174
|
+
const request = store.put({ key, data })
|
|
175
|
+
request.onerror = () => console.error('数据更新失败')
|
|
222
176
|
})
|
|
223
|
-
}
|
|
224
|
-
delete: function (key) {
|
|
225
|
-
const self = this
|
|
226
|
-
self.openDB((res) => {
|
|
227
|
-
// 删除某一条记录
|
|
228
|
-
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').delete(key)
|
|
177
|
+
}
|
|
229
178
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
request
|
|
234
|
-
|
|
179
|
+
async delete (key) {
|
|
180
|
+
this.openDB((db) => {
|
|
181
|
+
const store = db.transaction(DB_CONFIG.STORE_NAME, 'readwrite').objectStore(DB_CONFIG.STORE_NAME)
|
|
182
|
+
const request = store.delete(key)
|
|
183
|
+
request.onerror = () => console.error('数据删除失败')
|
|
235
184
|
})
|
|
236
|
-
}
|
|
237
|
-
clear: function (callback) {
|
|
238
|
-
const self = this
|
|
239
|
-
self.openDB((res) => {
|
|
240
|
-
// 删除存储空间全部记录
|
|
241
|
-
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').clear()
|
|
185
|
+
}
|
|
242
186
|
|
|
243
|
-
|
|
187
|
+
async clear (callback) {
|
|
188
|
+
this.openDB((db) => {
|
|
189
|
+
const store = db.transaction(DB_CONFIG.STORE_NAME, 'readwrite').objectStore(DB_CONFIG.STORE_NAME)
|
|
190
|
+
const request = store.clear()
|
|
191
|
+
request.onerror = () => {
|
|
244
192
|
console.error('数据删除失败')
|
|
245
193
|
callback()
|
|
246
194
|
}
|
|
247
|
-
request.onsuccess =
|
|
195
|
+
request.onsuccess = () => {
|
|
248
196
|
if (typeof callback === 'function') {
|
|
249
197
|
callback()
|
|
250
198
|
}
|
|
251
199
|
}
|
|
252
200
|
})
|
|
253
|
-
}
|
|
201
|
+
}
|
|
202
|
+
|
|
254
203
|
clearCache () {
|
|
255
204
|
if (this.indexedDB) {
|
|
256
205
|
this.clear(() => {
|
|
@@ -261,3 +210,5 @@ export const indexedDB = {
|
|
|
261
210
|
}
|
|
262
211
|
}
|
|
263
212
|
}
|
|
213
|
+
|
|
214
|
+
export const indexedDB = new IndexedDBManager()
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取 window 对象
|
|
3
|
-
* @returns {Window} window 对象
|
|
4
|
-
*/
|
|
5
|
-
export function getWindow () {
|
|
6
|
-
return window
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 获取当前子应用的 name
|
|
11
|
-
* @returns {string} 子应用的 name
|
|
12
|
-
*/
|
|
13
|
-
export function getMicroAppName () {
|
|
14
|
-
// 如果在微前端环境中运行,返回应用名称,否则返回 undefined
|
|
15
|
-
return window.__MICRO_APP_ENVIRONMENT__ ? window.__MICRO_APP_NAME__ : undefined
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 判断是否处于 microApp 环境
|
|
20
|
-
* @returns {boolean} 如果在 microApp 环境下返回 true,否则返回 false
|
|
21
|
-
*/
|
|
22
|
-
export function isMicroAppEnv () {
|
|
23
|
-
return window.__MICRO_APP_ENVIRONMENT__
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 发送事件给基座应用
|
|
28
|
-
* @param {Object} data 要传递的数据
|
|
29
|
-
* @param {Function} callBack 如果不是 microApp 环境时的回调函数
|
|
30
|
-
* @returns {*} 在 microApp 环境下返回 dispatch 的结果,否则执行 callBack
|
|
31
|
-
*/
|
|
32
|
-
export function microDispatch (data, callBack) {
|
|
33
|
-
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
34
|
-
return window.microApp.dispatch(data)
|
|
35
|
-
}
|
|
36
|
-
if (callBack) {
|
|
37
|
-
return callBack()
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 获取 microApp 的数据
|
|
43
|
-
* @returns {*} microApp 的数据,如果不在 microApp 环境下返回 undefined
|
|
44
|
-
*/
|
|
45
|
-
export function getMicroData () {
|
|
46
|
-
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
47
|
-
return window.microApp.getData()
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 获取 window 对象
|
|
3
|
+
* @returns {Window} window 对象
|
|
4
|
+
*/
|
|
5
|
+
export function getWindow () {
|
|
6
|
+
return window
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 获取当前子应用的 name
|
|
11
|
+
* @returns {string} 子应用的 name
|
|
12
|
+
*/
|
|
13
|
+
export function getMicroAppName () {
|
|
14
|
+
// 如果在微前端环境中运行,返回应用名称,否则返回 undefined
|
|
15
|
+
return window.__MICRO_APP_ENVIRONMENT__ ? window.__MICRO_APP_NAME__ : undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 判断是否处于 microApp 环境
|
|
20
|
+
* @returns {boolean} 如果在 microApp 环境下返回 true,否则返回 false
|
|
21
|
+
*/
|
|
22
|
+
export function isMicroAppEnv () {
|
|
23
|
+
return window.__MICRO_APP_ENVIRONMENT__
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 发送事件给基座应用
|
|
28
|
+
* @param {Object} data 要传递的数据
|
|
29
|
+
* @param {Function} callBack 如果不是 microApp 环境时的回调函数
|
|
30
|
+
* @returns {*} 在 microApp 环境下返回 dispatch 的结果,否则执行 callBack
|
|
31
|
+
*/
|
|
32
|
+
export function microDispatch (data, callBack) {
|
|
33
|
+
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
34
|
+
return window.microApp.dispatch(data)
|
|
35
|
+
}
|
|
36
|
+
if (callBack) {
|
|
37
|
+
return callBack()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 获取 microApp 的数据
|
|
43
|
+
* @returns {*} microApp 的数据,如果不在 microApp 环境下返回 undefined
|
|
44
|
+
*/
|
|
45
|
+
export function getMicroData () {
|
|
46
|
+
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
47
|
+
return window.microApp.getData()
|
|
48
|
+
}
|
|
49
|
+
}
|
package/vue.config.js
CHANGED
|
@@ -48,8 +48,8 @@ module.exports = {
|
|
|
48
48
|
// changeOrigin: true
|
|
49
49
|
// },
|
|
50
50
|
'/api/af-revenue/logic/openapi/': {
|
|
51
|
-
pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
|
|
52
|
-
target:
|
|
51
|
+
// pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
|
|
52
|
+
target: revenue,
|
|
53
53
|
changeOrigin: true
|
|
54
54
|
},
|
|
55
55
|
'/api/af-scada': {
|
|
@@ -57,8 +57,8 @@ module.exports = {
|
|
|
57
57
|
changeOrigin: true
|
|
58
58
|
},
|
|
59
59
|
'/api/af-revenue': {
|
|
60
|
-
pathRewrite: { '^/api/af-revenue/': '/' },
|
|
61
|
-
target:
|
|
60
|
+
// pathRewrite: { '^/api/af-revenue/': '/' },
|
|
61
|
+
target: revenue,
|
|
62
62
|
changeOrigin: true
|
|
63
63
|
},
|
|
64
64
|
'/api/af-liuli': {
|
|
@@ -183,7 +183,8 @@ module.exports = {
|
|
|
183
183
|
discardComments: { removeAll: true },
|
|
184
184
|
colormin: false,
|
|
185
185
|
}
|
|
186
|
-
]
|
|
186
|
+
],
|
|
187
|
+
ignoreOrder: true
|
|
187
188
|
}
|
|
188
189
|
}])
|
|
189
190
|
}
|