n20-common-lib 2.22.56 → 2.22.58
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 +1 -1
- package/src/components/AdvancedFilter/filterItem.vue +1 -0
- package/src/components/ApprovalButtons/index.vue +24 -24
- package/src/components/ApprovalButtons/indexApp.vue +24 -24
- package/src/components/ApprovalRecord/approvalImg.vue +2 -1
- package/src/components/LoginSetting/setItem.vue +20 -18
- package/src/utils/asyncGetRelaNos.js +14 -5
- package/src/utils/permission-storage-worker.v1.js +23 -0
- package/src/utils/permissionStorage.js +138 -0
- package/theme/fonts/OpenSans-Regular.629a55a7.ttf +0 -0
- package/theme/fonts/OpenSans-Semibold.33f225b8.ttf +0 -0
- package/theme/fonts/iconfont.1871f864.ttf +0 -0
- package/theme/fonts/iconfont.38d4b428.woff +0 -0
- package/theme/fonts/iconfont.7ddd3bd8.woff +0 -0
- package/theme/fonts/iconfont.b56977e8.woff2 +0 -0
- package/theme/fonts/iconfont.ca8ecaf4.woff2 +0 -0
- package/theme/fonts/iconfont.f0839d3b.ttf +0 -0
package/package.json
CHANGED
|
@@ -162,39 +162,39 @@
|
|
|
162
162
|
</div>
|
|
163
163
|
<!-- 审批按钮 -->
|
|
164
164
|
<div v-if="authList.includes('byAddTask') && !addTaskList.length" class="text-c">
|
|
165
|
-
<el-button type="primary" @click="showAdvancePop">{{ btnsNames['approval'] }}</el-button>
|
|
166
|
-
<el-button type="primary" @click="approvalToV = true">{{ btnsNames['approval'] }}{{ '至' | $lc }}</el-button>
|
|
167
|
-
<el-button plain @click="rejectToB">{{ btnsNames['rejectTo'] }}</el-button>
|
|
168
|
-
<el-button plain @click="rejectFn">{{ btnsNames['reject'] }}</el-button>
|
|
169
|
-
<el-button type="danger" plain @click="discardFn">{{ btnsNames['discard'] }}</el-button>
|
|
165
|
+
<el-button type="primary" @click="showAdvancePop">{{ $lc(btnsNames['approval']) }}</el-button>
|
|
166
|
+
<el-button type="primary" @click="approvalToV = true">{{ $lc(btnsNames['approval']) }}{{ '至' | $lc }}</el-button>
|
|
167
|
+
<el-button plain @click="rejectToB">{{ $lc(btnsNames['rejectTo']) }}</el-button>
|
|
168
|
+
<el-button plain @click="rejectFn">{{ $lc(btnsNames['reject']) }}</el-button>
|
|
169
|
+
<el-button type="danger" plain @click="discardFn">{{ $lc(btnsNames['discard']) }}</el-button>
|
|
170
170
|
<el-button plain @click="goFrom">{{ '返 回' | $lc }}</el-button>
|
|
171
171
|
</div>
|
|
172
172
|
|
|
173
173
|
<div v-else-if="!authList.includes('byAddTask')" class="text-c">
|
|
174
174
|
<!-- 特殊会签按钮 START -->
|
|
175
175
|
<el-button v-if="authList.includes('pass')" type="primary" @click="checkFlowFn">{{
|
|
176
|
-
btnsNames['pass']
|
|
176
|
+
$lc(btnsNames['pass'])
|
|
177
177
|
}}</el-button>
|
|
178
|
-
<el-button v-if="authList.includes('refuse')" plain @click="rejectFn">{{ btnsNames['refuse'] }}</el-button>
|
|
179
|
-
<el-button v-if="authList.includes('takeOff')" plain @click="qjFn">{{ btnsNames['takeOff'] }}</el-button>
|
|
178
|
+
<el-button v-if="authList.includes('refuse')" plain @click="rejectFn">{{ $lc(btnsNames['refuse']) }}</el-button>
|
|
179
|
+
<el-button v-if="authList.includes('takeOff')" plain @click="qjFn">{{ $lc(btnsNames['takeOff']) }}</el-button>
|
|
180
180
|
<!-- END -->
|
|
181
181
|
<el-button v-if="authList.includes('approval')" type="primary" @click="showAdvancePop">{{
|
|
182
|
-
btnsNames['approval']
|
|
182
|
+
$lc(btnsNames['approval'])
|
|
183
183
|
}}</el-button>
|
|
184
184
|
<el-button v-if="authList.includes('approval') && nextApproval && nextBtn" type="primary" @click="approvalNext">
|
|
185
|
-
{{ btnsNames['approval'] }}{{ '并审批下一条' | $lc }}</el-button
|
|
185
|
+
{{ $lc(btnsNames['approval']) }}{{ '并审批下一条' | $lc }}</el-button
|
|
186
186
|
>
|
|
187
187
|
<el-button v-if="showApprovalTo && showApproveTo" type="primary" @click="approvalToV = true"
|
|
188
|
-
>{{ btnsNames['approval'] }}{{ '至' | $lc }}</el-button
|
|
188
|
+
>{{ $lc(btnsNames['approval']) }}{{ '至' | $lc }}</el-button
|
|
189
189
|
>
|
|
190
|
-
<el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{ btnsNames['rejectTo'] }}</el-button>
|
|
191
|
-
<el-button v-if="authList.includes('reject')" plain @click="rejectFn">{{ btnsNames['reject'] }}</el-button>
|
|
190
|
+
<el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{ $lc(btnsNames['rejectTo']) }}</el-button>
|
|
191
|
+
<el-button v-if="authList.includes('reject')" plain @click="rejectFn">{{ $lc(btnsNames['reject']) }}</el-button>
|
|
192
192
|
<el-button v-if="authList.includes('rejectPre')" plain @click="rejectPreFn">{{
|
|
193
|
-
btnsNames['rejectPre']
|
|
193
|
+
$lc(btnsNames['rejectPre'])
|
|
194
194
|
}}</el-button>
|
|
195
195
|
|
|
196
196
|
<el-button v-if="authList.includes('discard')" type="danger" plain @click="discardFn">{{
|
|
197
|
-
btnsNames['discard']
|
|
197
|
+
$lc(btnsNames['discard'])
|
|
198
198
|
}}</el-button>
|
|
199
199
|
<el-button plain @click="goFrom">{{ '返 回' | $lc }}</el-button>
|
|
200
200
|
</div>
|
|
@@ -515,14 +515,14 @@ export default {
|
|
|
515
515
|
checkSum: 0,
|
|
516
516
|
mustUploadWidget: false,
|
|
517
517
|
btnsNames: {
|
|
518
|
-
pass:
|
|
519
|
-
refuse:
|
|
520
|
-
takeOff:
|
|
521
|
-
reject:
|
|
522
|
-
rejectPre:
|
|
523
|
-
approval:
|
|
524
|
-
discard:
|
|
525
|
-
rejectTo:
|
|
518
|
+
pass: '通过',
|
|
519
|
+
refuse: '拒绝',
|
|
520
|
+
takeOff: '请假',
|
|
521
|
+
reject: '驳回至申请人',
|
|
522
|
+
rejectPre: '驳回至上一节点',
|
|
523
|
+
approval: '批 准',
|
|
524
|
+
discard: '作 废',
|
|
525
|
+
rejectTo: '驳回至'
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
},
|
|
@@ -714,7 +714,7 @@ export default {
|
|
|
714
714
|
// 自定义按钮
|
|
715
715
|
if (data.customBtnName && data.customBtnName.length > 0) {
|
|
716
716
|
data.customBtnName.forEach((item) => {
|
|
717
|
-
this.btnsNames
|
|
717
|
+
this.$set(this.btnsNames, item.key, item.optionName)
|
|
718
718
|
})
|
|
719
719
|
}
|
|
720
720
|
let { taskDefKey, menuAuthority } = data
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
</div>
|
|
118
118
|
<!-- 审批按钮 -->
|
|
119
119
|
<div v-if="authList.includes('byAddTask') && !addTaskList.length" class="text-c">
|
|
120
|
-
<el-button type="primary" @click="showAdvancePop">{{ btnsNames['approval'] }}</el-button>
|
|
121
|
-
<!-- <el-button type="primary" @click="approvalToV = true">{{ btnsNames['approval'] }}{{ '至' | $lc }}</el-button>
|
|
122
|
-
<el-button plain @click="rejectToB">{{ btnsNames['rejectTo'] }}</el-button> -->
|
|
123
|
-
<el-button plain @click="rejectFn">{{ btnsNames['reject'] }}</el-button>
|
|
124
|
-
<!-- <el-button type="danger" plain @click="discardFn">{{ btnsNames['discard'] }}</el-button>
|
|
120
|
+
<el-button type="primary" @click="showAdvancePop">{{ $lc(btnsNames['approval']) }}</el-button>
|
|
121
|
+
<!-- <el-button type="primary" @click="approvalToV = true">{{ $lc(btnsNames['approval']) }}{{ '至' | $lc }}</el-button>
|
|
122
|
+
<el-button plain @click="rejectToB">{{ $lc(btnsNames['rejectTo']) }}</el-button> -->
|
|
123
|
+
<el-button plain @click="rejectFn">{{ $lc(btnsNames['reject']) }}</el-button>
|
|
124
|
+
<!-- <el-button type="danger" plain @click="discardFn">{{ $lc(btnsNames['discard']) }}</el-button>
|
|
125
125
|
<el-button plain @click="goFrom">{{ '返 回' | $lc }}</el-button> -->
|
|
126
126
|
</div>
|
|
127
127
|
|
|
@@ -129,30 +129,30 @@
|
|
|
129
129
|
<div v-if="!approveBtns" style="text-align: center; font-size: 18px">{{ $lc('请点击左上角返回处,进入OA待办页面') }}</div>
|
|
130
130
|
<!-- 特殊会签按钮 START -->
|
|
131
131
|
<el-button v-if="authList.includes('pass')" type="primary" @click="checkFlowFn">{{
|
|
132
|
-
btnsNames['pass']
|
|
132
|
+
$lc(btnsNames['pass'])
|
|
133
133
|
}}</el-button>
|
|
134
|
-
<el-button v-if="authList.includes('refuse')" plain @click="rejectFn">{{ btnsNames['refuse'] }}</el-button>
|
|
135
|
-
<el-button v-if="authList.includes('takeOff')" plain @click="qjFn">{{ btnsNames['takeOff'] }}</el-button>
|
|
134
|
+
<el-button v-if="authList.includes('refuse')" plain @click="rejectFn">{{ $lc(btnsNames['refuse']) }}</el-button>
|
|
135
|
+
<el-button v-if="authList.includes('takeOff')" plain @click="qjFn">{{ $lc(btnsNames['takeOff']) }}</el-button>
|
|
136
136
|
<!-- END -->
|
|
137
137
|
<el-button v-if="authList.includes('approval') && approveBtns" type="primary" @click="showAdvancePop">{{
|
|
138
|
-
btnsNames['approval']
|
|
138
|
+
$lc(btnsNames['approval'])
|
|
139
139
|
}}</el-button>
|
|
140
140
|
<!-- <el-button v-if="authList.includes('approval') && nextApproval && nextBtn" type="primary" @click="approvalNext">
|
|
141
|
-
{{ btnsNames['approval'] }}{{ '并审批下一条' | $lc }}</el-button
|
|
141
|
+
{{ $lc(btnsNames['approval']) }}{{ '并审批下一条' | $lc }}</el-button
|
|
142
142
|
>
|
|
143
143
|
<el-button v-if="showApprovalTo" type="primary" @click="approvalToV = true"
|
|
144
|
-
>{{ btnsNames['approval'] }}{{ '至' | $lc }}</el-button
|
|
144
|
+
>{{ $lc(btnsNames['approval']) }}{{ '至' | $lc }}</el-button
|
|
145
145
|
>
|
|
146
|
-
<el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{ btnsNames['rejectTo'] }}</el-button> -->
|
|
146
|
+
<el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{ $lc(btnsNames['rejectTo']) }}</el-button> -->
|
|
147
147
|
<el-button v-if="authList.includes('reject') && approveBtns" plain @click="rejectFn">{{
|
|
148
|
-
btnsNames['reject']
|
|
148
|
+
$lc(btnsNames['reject'])
|
|
149
149
|
}}</el-button>
|
|
150
150
|
<!-- <el-button v-if="authList.includes('rejectPre')" plain @click="rejectPreFn">{{
|
|
151
|
-
btnsNames['rejectPre']
|
|
151
|
+
$lc(btnsNames['rejectPre'])
|
|
152
152
|
}}</el-button>
|
|
153
153
|
|
|
154
154
|
<el-button v-if="authList.includes('discard')" type="danger" plain @click="discardFn">{{
|
|
155
|
-
btnsNames['discard']
|
|
155
|
+
$lc(btnsNames['discard'])
|
|
156
156
|
}}</el-button>
|
|
157
157
|
<el-button plain @click="goFrom">{{ '返 回' | $lc }}</el-button> -->
|
|
158
158
|
</div>
|
|
@@ -471,14 +471,14 @@ export default {
|
|
|
471
471
|
checkSum: 0,
|
|
472
472
|
mustUploadWidget: false,
|
|
473
473
|
btnsNames: {
|
|
474
|
-
pass:
|
|
475
|
-
refuse:
|
|
476
|
-
takeOff:
|
|
477
|
-
reject:
|
|
478
|
-
rejectPre:
|
|
479
|
-
approval:
|
|
480
|
-
discard:
|
|
481
|
-
rejectTo:
|
|
474
|
+
pass: '通过',
|
|
475
|
+
refuse: '拒绝',
|
|
476
|
+
takeOff: '请假',
|
|
477
|
+
reject: '驳回',
|
|
478
|
+
rejectPre: '驳回至上一节点',
|
|
479
|
+
approval: '批 准',
|
|
480
|
+
discard: '作 废',
|
|
481
|
+
rejectTo: '驳回至'
|
|
482
482
|
},
|
|
483
483
|
approveBtns: true
|
|
484
484
|
}
|
|
@@ -620,7 +620,7 @@ export default {
|
|
|
620
620
|
// 自定义按钮
|
|
621
621
|
if (data.customBtnName && data.customBtnName.length > 0) {
|
|
622
622
|
data.customBtnName.forEach((item) => {
|
|
623
|
-
this.btnsNames
|
|
623
|
+
this.$set(this.btnsNames, item.key, item.optionName)
|
|
624
624
|
})
|
|
625
625
|
}
|
|
626
626
|
let { taskDefKey, menuAuthority } = data
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
import axios from '../../utils/axios'
|
|
11
|
+
import { $lc } from '../../utils/i18n/index.js'
|
|
11
12
|
import flowImg from './approvalImgPro/index.vue'
|
|
12
13
|
let hasQ004_1 = true
|
|
13
14
|
|
|
@@ -47,7 +48,7 @@ export default {
|
|
|
47
48
|
)
|
|
48
49
|
.then(({ data }) => {
|
|
49
50
|
if (data) {
|
|
50
|
-
let file = new File([data], $lc(
|
|
51
|
+
let file = new File([data], $lc('流程图.svg'), {
|
|
51
52
|
type: 'image/svg+xml'
|
|
52
53
|
})
|
|
53
54
|
this.blobUrl = URL.createObjectURL(file)
|
|
@@ -71,7 +71,9 @@
|
|
|
71
71
|
prop="LOGIN_BG_TYPE"
|
|
72
72
|
:rules="{ required: true, message: $lc('背景模式不能为空'), trigger: 'change' }"
|
|
73
73
|
>
|
|
74
|
-
<label class="m-r"
|
|
74
|
+
<label class="m-r"
|
|
75
|
+
><span class="m-r-ss" style="color: var(--color-danger)">*</span>{{ $lc('背景模式') }}</label
|
|
76
|
+
>
|
|
75
77
|
<el-radio-group v-model="form.LOGIN_BG_TYPE">
|
|
76
78
|
<el-radio label="dark">{{ $lc('深色背景') }}</el-radio>
|
|
77
79
|
<el-radio label="light">{{ $lc('浅色背景') }}</el-radio>
|
|
@@ -179,7 +181,7 @@
|
|
|
179
181
|
>
|
|
180
182
|
<span slot="label"
|
|
181
183
|
><span>{{ '登录方式设置' | $lc }}</span
|
|
182
|
-
><span class="color-danger m-l-s f-s-s">({{ $lc('至少选择一种登录方式')
|
|
184
|
+
><span class="color-danger m-l-s f-s-s">({{ $lc('至少选择一种登录方式') }})</span></span
|
|
183
185
|
>
|
|
184
186
|
<el-checkbox-group v-model="systemItem.LOGIN_MODE">
|
|
185
187
|
<el-checkbox v-for="item in plainOptions" :key="item.value" :label="item.value">{{
|
|
@@ -239,56 +241,56 @@ export default {
|
|
|
239
241
|
SYSTEM_LIST: [
|
|
240
242
|
{
|
|
241
243
|
NO: 'CSZHYW',
|
|
242
|
-
NAME: $lc(
|
|
244
|
+
NAME: $lc('财司综合业务系统'),
|
|
243
245
|
ICON: '',
|
|
244
246
|
LOGIN_MODE: [],
|
|
245
247
|
OPEN: true
|
|
246
248
|
},
|
|
247
249
|
{
|
|
248
250
|
NO: 'CSYWGL',
|
|
249
|
-
NAME: $lc(
|
|
251
|
+
NAME: $lc('财司业务管理系统'),
|
|
250
252
|
ICON: '',
|
|
251
253
|
LOGIN_MODE: [],
|
|
252
254
|
OPEN: false
|
|
253
255
|
},
|
|
254
256
|
{
|
|
255
257
|
NO: 'CSFZJC',
|
|
256
|
-
NAME: $lc(
|
|
258
|
+
NAME: $lc('财司辅助决策系统'),
|
|
257
259
|
ICON: '',
|
|
258
260
|
LOGIN_MODE: [],
|
|
259
261
|
OPEN: false
|
|
260
262
|
},
|
|
261
263
|
{
|
|
262
264
|
NO: 'CSWY',
|
|
263
|
-
NAME: $lc(
|
|
265
|
+
NAME: $lc('财司网银系统'),
|
|
264
266
|
ICON: '',
|
|
265
267
|
LOGIN_MODE: [],
|
|
266
268
|
OPEN: false
|
|
267
269
|
},
|
|
268
270
|
{
|
|
269
271
|
NO: 'JTZL',
|
|
270
|
-
NAME: $lc(
|
|
272
|
+
NAME: $lc('财司直连平台系统'),
|
|
271
273
|
ICON: '',
|
|
272
274
|
LOGIN_MODE: [],
|
|
273
275
|
OPEN: false
|
|
274
276
|
},
|
|
275
277
|
{
|
|
276
278
|
NO: 'JRWG',
|
|
277
|
-
NAME: $lc(
|
|
279
|
+
NAME: $lc('金融网关系统'),
|
|
278
280
|
ICON: '',
|
|
279
281
|
LOGIN_MODE: [],
|
|
280
282
|
OPEN: false
|
|
281
283
|
},
|
|
282
284
|
{
|
|
283
285
|
NO: 'JTSKYWGK',
|
|
284
|
-
NAME: $lc(
|
|
286
|
+
NAME: $lc('集团司库业务管控系统'),
|
|
285
287
|
ICON: '',
|
|
286
288
|
LOGIN_MODE: [],
|
|
287
289
|
OPEN: false
|
|
288
290
|
},
|
|
289
291
|
{
|
|
290
292
|
NO: 'JTSKSJFX',
|
|
291
|
-
NAME: $lc(
|
|
293
|
+
NAME: $lc('集团数据分析系统'),
|
|
292
294
|
ICON: '',
|
|
293
295
|
LOGIN_MODE: [],
|
|
294
296
|
OPEN: false
|
|
@@ -296,10 +298,10 @@ export default {
|
|
|
296
298
|
]
|
|
297
299
|
},
|
|
298
300
|
plainOptions: [
|
|
299
|
-
{ label: $lc(
|
|
300
|
-
{ label: $lc(
|
|
301
|
-
{ label: $lc(
|
|
302
|
-
{ label: $lc(
|
|
301
|
+
{ label: $lc('账户密码登录'), value: 'account' },
|
|
302
|
+
{ label: $lc('手机验证码登录'), value: 'pthon' },
|
|
303
|
+
{ label: $lc('二维码扫码登录'), value: 'qrcode' },
|
|
304
|
+
{ label: $lc('账户密码验证码登录'), value: 'accountPthon' }
|
|
303
305
|
],
|
|
304
306
|
systemItem: undefined,
|
|
305
307
|
key_1: 0,
|
|
@@ -332,7 +334,7 @@ export default {
|
|
|
332
334
|
try {
|
|
333
335
|
this.form[k] = k === 'LOGIN_URL' ? obj.pmValue : JSON.parse(obj.pmValue)
|
|
334
336
|
} catch (error) {
|
|
335
|
-
console.error(k + $lc(
|
|
337
|
+
console.error(k + $lc('解析错误'))
|
|
336
338
|
}
|
|
337
339
|
}
|
|
338
340
|
} else {
|
|
@@ -343,7 +345,7 @@ export default {
|
|
|
343
345
|
try {
|
|
344
346
|
this.$set(this.form.SYSTEM_LIST, i, JSON.parse(obj.pmValue))
|
|
345
347
|
} catch (error) {
|
|
346
|
-
console.error('SYSTEM_LIST[' + item.NO + $lc(
|
|
348
|
+
console.error('SYSTEM_LIST[' + item.NO + $lc(']解析错误'))
|
|
347
349
|
}
|
|
348
350
|
}
|
|
349
351
|
})
|
|
@@ -361,7 +363,7 @@ export default {
|
|
|
361
363
|
async save() {
|
|
362
364
|
let vPro = this.$refs['form'].validate()
|
|
363
365
|
vPro.catch(() => {
|
|
364
|
-
this.$message.error($lc(
|
|
366
|
+
this.$message.error($lc('必填项不能为空'))
|
|
365
367
|
})
|
|
366
368
|
await vPro
|
|
367
369
|
let data = []
|
|
@@ -400,7 +402,7 @@ export default {
|
|
|
400
402
|
let secondsToGo = 5
|
|
401
403
|
this.$message({
|
|
402
404
|
type: 'success',
|
|
403
|
-
message: `${$lc(
|
|
405
|
+
message: `${$lc('设置成功,系统将在')} ${secondsToGo} ${$lc('秒后退出到登录页面.')}`
|
|
404
406
|
})
|
|
405
407
|
const interval = setInterval(() => {
|
|
406
408
|
secondsToGo -= 1
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from './axios'
|
|
2
2
|
import { getItem, setItem } from './storageEdit'
|
|
3
|
+
import { persistPermissionItems } from './permissionStorage'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @description: 按需/按模块 加载权限
|
|
@@ -76,13 +77,21 @@ async function asyncGetRelaNos(appNo, rns) {
|
|
|
76
77
|
// 将 ssCltrelaNos 重新赋值给 ssCltrelaNos ,并将 ssCltrelaNos 重新写回到 sessionStorage 中
|
|
77
78
|
// 将 oRelaNos 重新赋值给 ssRelaNosG ,并将 ssRelaNosG 重新写回到 sessionStorage 中
|
|
78
79
|
// 如果需要同步,则将 isSync 写回到 sessionStorage 中
|
|
79
|
-
setItem('relaNos', ssRelaNos, isSync)
|
|
80
|
-
setItem('cltrelaNos', ssCltrelaNos, isSync)
|
|
81
|
-
|
|
82
80
|
let ssRelaNosG = getItem('relaNosGlobal')
|
|
83
81
|
ssRelaNosG.push(...oRelaNos)
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
|
|
83
|
+
if (isSync) {
|
|
84
|
+
await persistPermissionItems([
|
|
85
|
+
{ key: 'relaNos', value: ssRelaNos },
|
|
86
|
+
{ key: 'cltrelaNos', value: ssCltrelaNos },
|
|
87
|
+
{ key: 'relaNosGlobal', value: ssRelaNosG }
|
|
88
|
+
])
|
|
89
|
+
sessionStorage.setItem('isSync', isSync)
|
|
90
|
+
} else {
|
|
91
|
+
setItem('relaNos', ssRelaNos, false)
|
|
92
|
+
setItem('cltrelaNos', ssCltrelaNos, false)
|
|
93
|
+
setItem('relaNosGlobal', ssRelaNosG, false)
|
|
94
|
+
}
|
|
86
95
|
} catch (error) {
|
|
87
96
|
// 如果请求失败,从已加载列表中移除该模块
|
|
88
97
|
const index = RLFM.indexOf(appNo)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import LZString from 'lz-string'
|
|
2
|
+
|
|
3
|
+
self.onmessage = function ({ data }) {
|
|
4
|
+
if (
|
|
5
|
+
!data ||
|
|
6
|
+
(typeof data.id !== 'number' && typeof data.id !== 'string') ||
|
|
7
|
+
typeof data.value !== 'string'
|
|
8
|
+
) {
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
self.postMessage({
|
|
14
|
+
id: data.id,
|
|
15
|
+
compressed: LZString.compressToBase64(data.value)
|
|
16
|
+
})
|
|
17
|
+
} catch (error) {
|
|
18
|
+
self.postMessage({
|
|
19
|
+
id: data.id,
|
|
20
|
+
error: error && error.message ? error.message : 'Compression failed'
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import PermissionStorageWorker from 'worker-loader?filename=js/permission-storage-worker.[contenthash:8].js!./permission-storage-worker.v1.js'
|
|
2
|
+
import { setItem } from './storageEdit'
|
|
3
|
+
|
|
4
|
+
const LARGE_STORAGE_THRESHOLD = 524288
|
|
5
|
+
const WORKER_TIMEOUT = 30000
|
|
6
|
+
let compressionWorker = null
|
|
7
|
+
let requestSequence = 0
|
|
8
|
+
const pendingRequests = new Map()
|
|
9
|
+
|
|
10
|
+
function rejectPendingRequests(error) {
|
|
11
|
+
pendingRequests.forEach(({ reject, timeoutId }) => {
|
|
12
|
+
clearTimeout(timeoutId)
|
|
13
|
+
reject(error)
|
|
14
|
+
})
|
|
15
|
+
pendingRequests.clear()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function disposeWorker(error) {
|
|
19
|
+
if (compressionWorker) {
|
|
20
|
+
compressionWorker.terminate()
|
|
21
|
+
compressionWorker = null
|
|
22
|
+
}
|
|
23
|
+
rejectPendingRequests(error)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getCompressionWorker() {
|
|
27
|
+
if (compressionWorker) return compressionWorker
|
|
28
|
+
if (typeof Worker === 'undefined') return null
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
compressionWorker = new PermissionStorageWorker()
|
|
32
|
+
} catch (error) {
|
|
33
|
+
compressionWorker = null
|
|
34
|
+
return null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
compressionWorker.onmessage = ({ data }) => {
|
|
38
|
+
if (!data) return
|
|
39
|
+
|
|
40
|
+
const pending = pendingRequests.get(data.id)
|
|
41
|
+
if (!pending) return
|
|
42
|
+
|
|
43
|
+
clearTimeout(pending.timeoutId)
|
|
44
|
+
pendingRequests.delete(data.id)
|
|
45
|
+
|
|
46
|
+
if (data.error || typeof data.compressed !== 'string') {
|
|
47
|
+
pending.reject(new Error(data.error || 'Invalid compression result'))
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
pending.resolve(data.compressed)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compressionWorker.onerror = () => {
|
|
55
|
+
disposeWorker(new Error('Permission compression worker failed'))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return compressionWorker
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function compressInWorker(value) {
|
|
62
|
+
const worker = getCompressionWorker()
|
|
63
|
+
if (!worker) {
|
|
64
|
+
return Promise.reject(
|
|
65
|
+
new Error('Permission compression worker is unavailable')
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const id = ++requestSequence
|
|
71
|
+
const timeoutId = setTimeout(() => {
|
|
72
|
+
if (!pendingRequests.has(id)) return
|
|
73
|
+
disposeWorker(new Error('Permission compression worker timed out'))
|
|
74
|
+
}, WORKER_TIMEOUT)
|
|
75
|
+
|
|
76
|
+
pendingRequests.set(id, { resolve, reject, timeoutId })
|
|
77
|
+
worker.postMessage({ id, value })
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function writeCompressedValue(key, compressed) {
|
|
82
|
+
const storage = window.sessionStorage
|
|
83
|
+
const rawSetItem = storage._setItem
|
|
84
|
+
const rawRemoveItem = storage._removeItem
|
|
85
|
+
|
|
86
|
+
if (
|
|
87
|
+
typeof rawSetItem !== 'function' ||
|
|
88
|
+
typeof rawRemoveItem !== 'function'
|
|
89
|
+
) {
|
|
90
|
+
throw new Error('Extended Storage API is unavailable')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
rawSetItem.call(storage, `${key}:[LZ]`, compressed)
|
|
95
|
+
rawRemoveItem.call(storage, key)
|
|
96
|
+
} catch (error) {
|
|
97
|
+
// A previous uncompressed value can consume the remaining quota.
|
|
98
|
+
rawRemoveItem.call(storage, key)
|
|
99
|
+
rawSetItem.call(storage, `${key}:[LZ]`, compressed)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function persistItem({ key, value, serialized }) {
|
|
104
|
+
if (
|
|
105
|
+
typeof serialized !== 'string' ||
|
|
106
|
+
serialized.length <= LARGE_STORAGE_THRESHOLD
|
|
107
|
+
) {
|
|
108
|
+
window.sessionStorage.setItem(key, serialized)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
const compressed = await compressInWorker(serialized)
|
|
114
|
+
writeCompressedValue(key, compressed)
|
|
115
|
+
} catch (error) {
|
|
116
|
+
// Preserve the existing synchronous behavior when Worker is unavailable.
|
|
117
|
+
setItem(key, value, true)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Persist permission objects with the same cache keys and LZ storage format
|
|
123
|
+
* used by n20-common-lib, while moving large compression work off main thread.
|
|
124
|
+
*/
|
|
125
|
+
export async function persistPermissionItems(items) {
|
|
126
|
+
const serializedItems = items.map(({ key, value }) => {
|
|
127
|
+
window[`_keep_${key}`] = value
|
|
128
|
+
return {
|
|
129
|
+
key,
|
|
130
|
+
value,
|
|
131
|
+
serialized: JSON.stringify(value)
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
for (const item of serializedItems) {
|
|
136
|
+
await persistItem(item)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|