vue2-client 1.8.339 → 1.8.341
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/.env +1 -1
- package/package.json +1 -1
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +1 -1
- package/src/base-client/components/common/XTable/XTable.vue +20 -10
- package/src/base-client/components/system/LogDetailsView/LogDetailsView.vue +7 -7
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +10 -10
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +1 -1
- package/src/components/STable/index.js +23 -4
- package/src/pages/Example/index.vue +51 -64
- package/src/utils/indexedDB.js +15 -14
package/.env
CHANGED
|
@@ -14,6 +14,6 @@ VUE_APP_SINGLEVALUE_KEY=admin.singlevalue
|
|
|
14
14
|
VUE_APP_DIVISIONSOHCHINA=admin.divisionsohchina
|
|
15
15
|
VUE_APP_WEB_CONFIG_KEY=admin.webconfig
|
|
16
16
|
VUE_APP_API_BASE_URL=http://123.60.214.109:8405
|
|
17
|
-
VUE_APP_SYSTEM_NAME=af-
|
|
17
|
+
VUE_APP_SYSTEM_NAME=af-revenue
|
|
18
18
|
VUE_APP_LOGIN_VERSION=V4
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -170,7 +170,7 @@ export default {
|
|
|
170
170
|
change (value) {
|
|
171
171
|
if (this.readOnlyDivisions && !this.divisionsChange) {
|
|
172
172
|
// 如果省市区街道信息禁止修改
|
|
173
|
-
if (this.divisions.str && !this.addressInput.startsWith(this.divisions.str)) {
|
|
173
|
+
if (this.addressInput.includes('省') && this.addressInput.includes('市') && this.divisions.str && !this.addressInput.startsWith(this.divisions.str)) {
|
|
174
174
|
this.addressInput = this.addressObj.address
|
|
175
175
|
this.$message.info('省市区街道信息请从选择新地址以变更')
|
|
176
176
|
return
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
|
|
48
48
|
<a-tooltip title="汇总" placement="bottom">
|
|
49
49
|
<a-button @click="showDrawer">
|
|
50
|
-
<a-icon :style="iconStyle" type="
|
|
50
|
+
<a-icon :style="iconStyle" type="project"/>
|
|
51
51
|
</a-button>
|
|
52
52
|
</a-tooltip>
|
|
53
53
|
<a-tooltip title="重新查询" placement="bottom">
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
:rowSelection="rowSelection"
|
|
76
76
|
:scroll="{ x: scrollXWidth, y: scrollYHeight }"
|
|
77
77
|
:showPagination="showPagination"
|
|
78
|
+
:setScrollYHeight="setScrollYHeight"
|
|
78
79
|
size="default"
|
|
79
80
|
>
|
|
80
81
|
<template
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
:title="f.title + ':'"
|
|
155
156
|
:value="f.value"
|
|
156
157
|
:precision="2"
|
|
157
|
-
style="margin-right: 50px"
|
|
158
|
+
style="margin-right: 50px"/>
|
|
158
159
|
</div>
|
|
159
160
|
</template>
|
|
160
161
|
</a-drawer>
|
|
@@ -177,7 +178,14 @@ import { formatDate } from '@vue2-client/utils/util'
|
|
|
177
178
|
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
178
179
|
import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
|
|
179
180
|
import { exportJson } from '@vue2-client/utils/excel/Export2Excel'
|
|
180
|
-
import {
|
|
181
|
+
import {
|
|
182
|
+
exportData,
|
|
183
|
+
query,
|
|
184
|
+
querySummary,
|
|
185
|
+
queryWithResource,
|
|
186
|
+
remove,
|
|
187
|
+
asyncRunTask
|
|
188
|
+
} from '@vue2-client/services/api/common'
|
|
181
189
|
import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
|
|
182
190
|
import { Modal } from 'ant-design-vue'
|
|
183
191
|
import { post } from '@vue2-client/services/api'
|
|
@@ -350,7 +358,6 @@ export default {
|
|
|
350
358
|
...mapState('setting', ['compatible'])
|
|
351
359
|
},
|
|
352
360
|
mounted () {
|
|
353
|
-
this.setScrollYHeight({}) // 初始化时也调用一次,确保加载时高度正确
|
|
354
361
|
window.addEventListener('resize', this.handleResize)
|
|
355
362
|
},
|
|
356
363
|
beforeDestroy () {
|
|
@@ -450,8 +457,6 @@ export default {
|
|
|
450
457
|
this.clearRowKeys()
|
|
451
458
|
}
|
|
452
459
|
this.$emit('afterQuery', result, requestParameters.conditionParams)
|
|
453
|
-
// 设置表格高度为固定值
|
|
454
|
-
this.setScrollYHeight({ type: 'default' })
|
|
455
460
|
return result
|
|
456
461
|
},
|
|
457
462
|
/**
|
|
@@ -503,18 +508,20 @@ export default {
|
|
|
503
508
|
},
|
|
504
509
|
setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
|
|
505
510
|
this.$nextTick(() => {
|
|
511
|
+
const curDocument = window?.rawDocument || document
|
|
506
512
|
if (typeof extraHeight == 'undefined') {
|
|
507
513
|
// 默认底部分页32 + 边距48
|
|
508
514
|
extraHeight = 48 + 32
|
|
509
515
|
}
|
|
510
516
|
let tHeader = null
|
|
511
517
|
if (id) {
|
|
512
|
-
tHeader =
|
|
518
|
+
tHeader = curDocument.getElementById(id) ? curDocument.getElementById(id).getElementsByClassName('ant-table-thead')[0] : null
|
|
513
519
|
} else {
|
|
514
|
-
tHeader =
|
|
520
|
+
tHeader = curDocument.getElementsByClassName('ant-table-thead')[0]
|
|
515
521
|
}
|
|
516
522
|
// 表格内容距离顶部的距离
|
|
517
523
|
let tHeaderBottom = 0
|
|
524
|
+
console.log(tHeader, tHeader.getBoundingClientRect())
|
|
518
525
|
if (tHeader) {
|
|
519
526
|
tHeaderBottom = tHeader.getBoundingClientRect().bottom
|
|
520
527
|
}
|
|
@@ -532,12 +539,15 @@ export default {
|
|
|
532
539
|
if (tHeader) {
|
|
533
540
|
modalElement = tHeader.closest('.ant-modal-body')
|
|
534
541
|
} else {
|
|
535
|
-
modalElement =
|
|
542
|
+
modalElement = curDocument.querySelector('.ant-modal-body')
|
|
536
543
|
}
|
|
544
|
+
console.log(modalElement)
|
|
537
545
|
if (modalElement) {
|
|
538
546
|
const modalRect = modalElement.getBoundingClientRect()
|
|
539
547
|
// 48 是 modal 通常的边距 32 是分页
|
|
540
|
-
|
|
548
|
+
const innerHeight = window?.rawWindow?.innerHeight || window.innerHeight || 0
|
|
549
|
+
console.log(tHeaderBottom, modalRect.bottom)
|
|
550
|
+
extraHeight = innerHeight - modalRect.bottom + 32 + 48
|
|
541
551
|
}
|
|
542
552
|
}
|
|
543
553
|
// 窗体高度-表格内容顶部的高度-表格内容底部的高度
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
87
|
<!-- actions -->
|
|
88
|
-
<template
|
|
88
|
+
<template #extra>
|
|
89
89
|
<a-button-group style="margin-right: 4px;">
|
|
90
90
|
<a-button type="dashed" @click="initView" :loading="loadLogDetails">刷新</a-button>
|
|
91
91
|
</a-button-group>
|
|
@@ -137,26 +137,26 @@ import { mapState } from 'vuex'
|
|
|
137
137
|
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
138
138
|
|
|
139
139
|
const statusIconMap = {
|
|
140
|
-
|
|
140
|
+
待办的: {
|
|
141
141
|
icon: 'info-circle',
|
|
142
142
|
style: 'color: #fe7300;'
|
|
143
143
|
},
|
|
144
|
-
|
|
144
|
+
进行中: {
|
|
145
145
|
icon: 'clock-circle',
|
|
146
146
|
style: 'color: #2d81d7;'
|
|
147
147
|
},
|
|
148
|
-
|
|
148
|
+
已完成: {
|
|
149
149
|
icon: 'check-circle',
|
|
150
150
|
style: 'color:#4baf50;'
|
|
151
151
|
},
|
|
152
|
-
|
|
152
|
+
已关闭: {
|
|
153
153
|
icon: 'issues-close',
|
|
154
154
|
style: 'color:#ec0019;'
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
const eventIconMap = {
|
|
159
|
-
|
|
159
|
+
开始处理事件: {
|
|
160
160
|
icon: 'forward',
|
|
161
161
|
style: 'color: #fe7300;'
|
|
162
162
|
},
|
|
@@ -168,7 +168,7 @@ const eventIconMap = {
|
|
|
168
168
|
icon: 'issues-close',
|
|
169
169
|
style: 'color:#ec0019;'
|
|
170
170
|
},
|
|
171
|
-
|
|
171
|
+
已完成对事件的处理: {
|
|
172
172
|
icon: 'check-circle',
|
|
173
173
|
style: 'color:#4baf50;'
|
|
174
174
|
}
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
</div>
|
|
93
93
|
</div>
|
|
94
94
|
<!-- 按钮 -->
|
|
95
|
-
<template
|
|
95
|
+
<template #extra>
|
|
96
96
|
<a-button-group style="margin-right: 4px;">
|
|
97
97
|
<a-popover placement="bottomLeft" title="开始处理">
|
|
98
98
|
<template slot="content">
|
|
@@ -122,20 +122,20 @@
|
|
|
122
122
|
<a-card :bordered="false" style="margin-top: 40px">
|
|
123
123
|
<a-steps :current="step" :direction="'horizontal'">
|
|
124
124
|
<a-step>
|
|
125
|
-
<template
|
|
126
|
-
<template
|
|
125
|
+
<template #title><span>待处理</span></template>
|
|
126
|
+
<template #description>
|
|
127
127
|
<div>工单已提交,等待处理<div>{{ format(details.created_time,'yyyy-MM-dd hh:mm:ss') }}</div></div>
|
|
128
128
|
</template>
|
|
129
129
|
</a-step>
|
|
130
130
|
<a-step>
|
|
131
|
-
<template
|
|
132
|
-
<template
|
|
131
|
+
<template #title><span>处理中</span></template>
|
|
132
|
+
<template #description>
|
|
133
133
|
<div v-if="step >= 1"><strong>{{ details.name }}</strong> 处理中...<div>{{ format(details.confirm_time,'yyyy-MM-dd hh:mm:ss') }}</div></div>
|
|
134
134
|
</template>
|
|
135
135
|
</a-step>
|
|
136
136
|
<a-step>
|
|
137
|
-
<template
|
|
138
|
-
<template
|
|
137
|
+
<template #title><span>{{ getStatus() }}</span></template>
|
|
138
|
+
<template #description>
|
|
139
139
|
<div v-if="step >= 2">{{ format(details.finished_time,'yyyy-MM-dd hh:mm:ss') }}</div>
|
|
140
140
|
</template>
|
|
141
141
|
</a-step>
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
},
|
|
533
533
|
// 转移工单确认后逻辑
|
|
534
534
|
handleTransferOk () {
|
|
535
|
-
this.$refs
|
|
535
|
+
this.$refs.transmitFormRef.validate().then(() => {
|
|
536
536
|
post(TicketDetailsViewApi.transferTicketToOthers, {
|
|
537
537
|
ticketId: this.ticketId,
|
|
538
538
|
endTime: this.format(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
|
@@ -548,7 +548,7 @@
|
|
|
548
548
|
5
|
|
549
549
|
)
|
|
550
550
|
this.fileList = []
|
|
551
|
-
this.$refs
|
|
551
|
+
this.$refs.transmitFormRef.resetFields()
|
|
552
552
|
} else {
|
|
553
553
|
this.$message.error('工单已被他人处理或关闭,请刷新再试', 5)
|
|
554
554
|
}
|
|
@@ -563,7 +563,7 @@
|
|
|
563
563
|
// 转移工单取消后逻辑
|
|
564
564
|
handleTransferCancel () {
|
|
565
565
|
this.transVisible = false
|
|
566
|
-
this.$refs
|
|
566
|
+
this.$refs.transmitFormRef.resetFields()
|
|
567
567
|
},
|
|
568
568
|
// 关闭抽屉时回调
|
|
569
569
|
onClose () {
|
package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue
CHANGED
|
@@ -114,7 +114,7 @@ function getBase64 (file) {
|
|
|
114
114
|
const AStepItemGroup = AStepItem.Group
|
|
115
115
|
const DetailListItem = DetailList.Item
|
|
116
116
|
export default {
|
|
117
|
-
name: '
|
|
117
|
+
name: 'SubmitTicketSuccess',
|
|
118
118
|
components: { AStepItemGroup, AStepItem, DetailListItem, DetailList, Result },
|
|
119
119
|
data () {
|
|
120
120
|
return {
|
|
@@ -26,6 +26,10 @@ export default {
|
|
|
26
26
|
type: Function,
|
|
27
27
|
required: true
|
|
28
28
|
},
|
|
29
|
+
setScrollYHeight: {
|
|
30
|
+
type: Function,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
29
33
|
pageNum: {
|
|
30
34
|
type: Number,
|
|
31
35
|
default: 1
|
|
@@ -191,8 +195,10 @@ export default {
|
|
|
191
195
|
}
|
|
192
196
|
this.localDataSource = r.data // 返回结果中的数组数据
|
|
193
197
|
this.localLoading = false
|
|
198
|
+
this.setScrollYHeight({ type: 'default' })
|
|
194
199
|
}, () => {
|
|
195
200
|
this.localLoading = false
|
|
201
|
+
this.setScrollYHeight({ type: 'default' })
|
|
196
202
|
})
|
|
197
203
|
}
|
|
198
204
|
},
|
|
@@ -332,10 +338,23 @@ export default {
|
|
|
332
338
|
<a-col flex="0 0">
|
|
333
339
|
<a-pagination
|
|
334
340
|
total={this.localPagination.total}
|
|
335
|
-
onChange={(page, pageSize) =>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
onChange={(page, pageSize) => {
|
|
342
|
+
this.pageSize = pageSize
|
|
343
|
+
this.pageNum = page
|
|
344
|
+
this.loadData({
|
|
345
|
+
current: page,
|
|
346
|
+
pageSize: pageSize
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
onShowSizeChange={(page, pageSize) => {
|
|
351
|
+
this.pageSize = pageSize
|
|
352
|
+
this.pageNum = page
|
|
353
|
+
this.loadData({
|
|
354
|
+
current: page,
|
|
355
|
+
pageSize: pageSize
|
|
356
|
+
})
|
|
357
|
+
}
|
|
339
358
|
}
|
|
340
359
|
show-total={(total, range) => range[0] === range[1] ? `${range[0]} | 共 ${total} 项` : `${range[0]}-${range[1]} | 共 ${total} 项`}
|
|
341
360
|
default-current={this.localPagination.current}
|
|
@@ -1,84 +1,71 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a-card
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<a-card :bordered="false">
|
|
3
|
+
<x-form-table
|
|
4
|
+
title="示例表单查询"
|
|
5
|
+
:queryParamsName="queryParamsName"
|
|
6
|
+
:fixedAddForm="fixedAddForm"
|
|
7
|
+
@action="action"
|
|
8
|
+
ref="xFormTable">
|
|
9
|
+
</x-form-table>
|
|
10
|
+
<a-drawer
|
|
11
|
+
title="详情信息"
|
|
12
|
+
placement="right"
|
|
13
|
+
:destroy-on-close="true"
|
|
14
|
+
width="85vw"
|
|
15
|
+
:closable="false"
|
|
16
|
+
:visible="detailVisible"
|
|
17
|
+
@close="onClose">
|
|
18
|
+
<span>
|
|
19
|
+
详情表单内容
|
|
20
|
+
</span>
|
|
21
|
+
</a-drawer>
|
|
9
22
|
</a-card>
|
|
10
23
|
</template>
|
|
11
24
|
|
|
12
25
|
<script>
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
// import Demo from '@vue2-client/base-client/components/common/XDescriptions/demo.vue'
|
|
16
|
-
// import Demo from '@vue2-client/base-client/components/common/AddressSearchCombobox/demo.vue'
|
|
17
|
-
// import Demo from '@vue2-client/base-client/components/common/XFormTable/demo.vue'
|
|
18
|
-
// import Demo from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
|
|
19
|
-
import Demo1 from '@vue2-client/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue'
|
|
20
|
-
import XFormTable from '@vue2-client/base-client/components/common/XFormTable'
|
|
26
|
+
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
|
|
27
|
+
import { mapState } from 'vuex'
|
|
21
28
|
|
|
22
29
|
export default {
|
|
23
|
-
name: '
|
|
30
|
+
name: 'ChargeQuery',
|
|
24
31
|
components: {
|
|
25
|
-
Demo1,
|
|
26
|
-
XReport,
|
|
27
32
|
XFormTable
|
|
28
33
|
},
|
|
29
|
-
mounted () {
|
|
30
|
-
},
|
|
31
34
|
data () {
|
|
32
35
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: '已检数',
|
|
44
|
-
key: 'doneNum'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: '未检数',
|
|
48
|
-
key: 'todoNum'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: '安检率',
|
|
52
|
-
key: 'ratio',
|
|
53
|
-
type: 'percent'
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
descData: {
|
|
57
|
-
totalUser: 1000,
|
|
58
|
-
totalResidentArea: 6,
|
|
59
|
-
doneNum: 800,
|
|
60
|
-
todoNum: 200,
|
|
61
|
-
ratio: 80
|
|
62
|
-
},
|
|
63
|
-
dataContent: {
|
|
64
|
-
c_id: '1240d022903c46c8a510b1f9e61f1ca2',
|
|
65
|
-
c_usertype: '民用',
|
|
66
|
-
c_plantype: '预约计划',
|
|
67
|
-
c_checker: 'wd7',
|
|
68
|
-
c_total: 2,
|
|
69
|
-
c_done: 1,
|
|
70
|
-
c_ratio: 50,
|
|
71
|
-
c_planname: '状态测试',
|
|
72
|
-
c_month: 8,
|
|
73
|
-
todoNum: 1,
|
|
74
|
-
totalResidentArea: 1
|
|
75
|
-
}
|
|
36
|
+
// 查询配置名称
|
|
37
|
+
queryParamsName: 'ChargeQueryCRUD',
|
|
38
|
+
// 新增表单固定值
|
|
39
|
+
fixedAddForm: {},
|
|
40
|
+
// 是否显示详情抽屉
|
|
41
|
+
detailVisible: false,
|
|
42
|
+
// 当前记录
|
|
43
|
+
record: {}
|
|
76
44
|
}
|
|
77
45
|
},
|
|
46
|
+
created () {
|
|
47
|
+
},
|
|
48
|
+
mounted () {
|
|
49
|
+
console.log('==当前登录人', this.currUser)
|
|
50
|
+
},
|
|
78
51
|
methods: {
|
|
79
|
-
|
|
52
|
+
action (record, id, actionType) {
|
|
53
|
+
this.detailVisible = true
|
|
54
|
+
console.log('触发了详情操作', record, id, actionType)
|
|
55
|
+
},
|
|
56
|
+
onClose () {
|
|
57
|
+
this.detailVisible = false
|
|
58
|
+
// 关闭详情之后重新查询表单
|
|
59
|
+
this.$refs.xFormTable.refreshTable(true)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
...mapState('account', { currUser: 'user' }),
|
|
64
|
+
...mapState('setting', { isMobile: 'isMobile' })
|
|
65
|
+
},
|
|
80
66
|
}
|
|
81
67
|
</script>
|
|
68
|
+
|
|
82
69
|
<style scoped>
|
|
83
70
|
|
|
84
71
|
</style>
|
package/src/utils/indexedDB.js
CHANGED
|
@@ -3,11 +3,12 @@ import { post } from '@vue2-client/services/api'
|
|
|
3
3
|
|
|
4
4
|
// 避免重复请求相同配置key的锁
|
|
5
5
|
const locks = {}
|
|
6
|
+
let currentDbVersion = 1
|
|
6
7
|
|
|
7
8
|
export const indexedDB = {
|
|
8
9
|
db: undefined,
|
|
9
|
-
indexedDB: window.indexedDB || window.webkitindexedDB,
|
|
10
|
-
IDBKeyRange: window.IDBKeyRange || window.webkitIDBKeyRange, // 键范围
|
|
10
|
+
indexedDB: window?.rawWindow?.indexedDB || window.indexedDB || window.webkitindexedDB,
|
|
11
|
+
IDBKeyRange: window?.rawWindow?.IDBKeyRange || window.IDBKeyRange || window.webkitIDBKeyRange, // 键范围
|
|
11
12
|
openDB: function (callback) {
|
|
12
13
|
const self = this
|
|
13
14
|
if (self.db) {
|
|
@@ -56,10 +57,11 @@ export const indexedDB = {
|
|
|
56
57
|
})
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
|
-
openDatabase
|
|
60
|
+
openDatabase () {
|
|
60
61
|
const self = this
|
|
62
|
+
|
|
61
63
|
return new Promise((resolve, reject) => {
|
|
62
|
-
const request = self.indexedDB.open('view',
|
|
64
|
+
const request = self.indexedDB.open('view', currentDbVersion)
|
|
63
65
|
|
|
64
66
|
request.onerror = function (e) {
|
|
65
67
|
reject(e.currentTarget.error)
|
|
@@ -67,20 +69,19 @@ export const indexedDB = {
|
|
|
67
69
|
|
|
68
70
|
request.onsuccess = function (e) {
|
|
69
71
|
const db = e.target.result
|
|
70
|
-
// 检查并创建 metaCache 对象存储空间
|
|
71
72
|
if (!db.objectStoreNames.contains('metaCache')) {
|
|
72
|
-
const version = db.version + 1
|
|
73
73
|
db.close()
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
currentDbVersion = db.version + 1
|
|
75
|
+
const upgradeRequest = self.indexedDB.open('view', currentDbVersion)
|
|
76
|
+
upgradeRequest.onupgradeneeded = function (event) {
|
|
77
|
+
const upgradeDb = event.target.result
|
|
78
|
+
upgradeDb.createObjectStore('metaCache', { keyPath: 'key' })
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
resolve(
|
|
80
|
+
upgradeRequest.onsuccess = function (event) {
|
|
81
|
+
resolve(event.target.result)
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
reject(
|
|
83
|
+
upgradeRequest.onerror = function (event) {
|
|
84
|
+
reject(event.currentTarget.error)
|
|
84
85
|
}
|
|
85
86
|
} else {
|
|
86
87
|
resolve(db)
|