w-web-perm 1.0.12 → 1.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.
- package/.vscode/launch.json +0 -1
- package/README.md +0 -1
- package/dist/css/app.f22995d1.css +1 -0
- package/dist/index.tmp +1 -1
- package/dist/js/app-legacy.82274c39.js +2 -0
- package/dist/js/app-legacy.82274c39.js.map +1 -0
- package/dist/js/app.82274c39.js +2 -0
- package/dist/js/app.82274c39.js.map +1 -0
- package/dist/js/chunk-vendors-legacy.d89048a8.js +13 -0
- package/dist/js/chunk-vendors-legacy.d89048a8.js.map +1 -0
- package/dist/js/chunk-vendors.d89048a8.js +13 -0
- package/dist/js/chunk-vendors.d89048a8.js.map +1 -0
- package/dist/w-web-perm.umd.js +2 -2
- package/dist/w-web-perm.umd.js.map +1 -1
- package/docs/WWebPerm.html +2 -2
- package/docs/WWebPerm.mjs.html +212 -64
- package/docs/index.html +1 -1
- package/g.backupDb.mjs +1 -1
- package/g.initialData.mjs +211 -111
- package/g.initialTestData.mjs +2 -1
- package/g.mjs +0 -0
- package/g.provideGrups.mjs +87 -0
- package/g.providePemis.mjs +43 -0
- package/g.provideTargets.mjs +20 -13
- package/g.provideUsers.mjs +45 -13
- package/package.json +8 -8
- package/script.txt +5 -5
- package/server/WWebPerm.mjs +211 -63
- package/server/provideGrups.mjs +64 -0
- package/server/{provideRuleGroups.mjs → providePemis.mjs} +14 -15
- package/server/provideTargets.mjs +8 -5
- package/server/provideUsers.mjs +9 -9
- package/src/App.vue +16 -3
- package/src/components/Layout.vue +13 -5
- package/src/components/LayoutContent.vue +31 -16
- package/src/components/LayoutContentGrups.vue +793 -0
- package/src/components/LayoutContentPemis.vue +793 -0
- package/src/components/LayoutContentTargets.vue +481 -307
- package/src/components/LayoutContentUsers.vue +796 -291
- package/src/components/VeCgrups.vue +926 -0
- package/src/components/VeCpemis.vue +926 -0
- package/src/components/VeCrules.vue +820 -0
- package/src/main.js +2 -2
- package/src/perm.mjs +5 -5
- package/src/plugins/mShare.mjs +444 -153
- package/src/plugins/mUI.mjs +37 -19
- package/src/schema/gi.mjs +1 -1
- package/src/schema/index.mjs +4 -2
- package/src/schema/tables/grups.mjs +154 -0
- package/src/schema/tables/{ruleGroups.mjs → pemis.mjs} +27 -16
- package/src/schema/tables/targets.mjs +49 -16
- package/src/schema/tables/users.mjs +55 -27
- package/src/store/mutations.mjs +375 -150
- package/srv.mjs +2 -2
- package/tableTags-web-perm.json +1 -1
- package/dist/css/app.f6c50bec.css +0 -1
- package/dist/js/app-legacy.767522f1.js +0 -2
- package/dist/js/app-legacy.767522f1.js.map +0 -1
- package/dist/js/app.767522f1.js +0 -2
- package/dist/js/app.767522f1.js.map +0 -1
- package/dist/js/chunk-vendors-legacy.b0d63e17.js +0 -13
- package/dist/js/chunk-vendors-legacy.b0d63e17.js.map +0 -1
- package/dist/js/chunk-vendors.b0d63e17.js +0 -13
- package/dist/js/chunk-vendors.b0d63e17.js.map +0 -1
- package/g.provideRuleGroups.mjs +0 -56
- package/src/components/LayoutContentGroups.vue +0 -671
- package/src/components/VeUser.vue +0 -446
- package/src/components/ruleGroup.vue +0 -645
|
@@ -1,645 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:changeGroup="changeGroup"
|
|
4
|
-
v-if="treeBlocks!==null"
|
|
5
|
-
>
|
|
6
|
-
|
|
7
|
-
<div
|
|
8
|
-
style=""
|
|
9
|
-
v-domresize
|
|
10
|
-
@domresize="resizeHead"
|
|
11
|
-
v-if="showHead"
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
<div
|
|
15
|
-
style="padding:15px; border-bottom:1px solid #ddd;"
|
|
16
|
-
v-if="editable"
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
<div style="padding:5px 0px; display:flex; align-items:center;">
|
|
20
|
-
<div style="padding-right:5px; font-size:0.9rem; color:#888;">
|
|
21
|
-
{{$t('name')}}:
|
|
22
|
-
</div>
|
|
23
|
-
<div style="">
|
|
24
|
-
<WText
|
|
25
|
-
style="width:300px;"
|
|
26
|
-
:value="getName(group)"
|
|
27
|
-
@input="(v)=>{updateProp('name',v)}"
|
|
28
|
-
></WText>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div style="padding:5px 0px; display:flex; align-items:center;">
|
|
33
|
-
<div style="padding-right:5px; font-size:0.9rem; color:#888;">
|
|
34
|
-
{{$t('description')}}:
|
|
35
|
-
</div>
|
|
36
|
-
<div style="">
|
|
37
|
-
<WText
|
|
38
|
-
style="width:300px;"
|
|
39
|
-
:value="getDescription(group)"
|
|
40
|
-
@input="(v)=>{updateProp('description',v)}"
|
|
41
|
-
></WText>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div
|
|
48
|
-
style="padding:15px; border-bottom:1px solid #ddd;"
|
|
49
|
-
v-else
|
|
50
|
-
>
|
|
51
|
-
|
|
52
|
-
<div style="font-size:1.2rem; white-space:nowrap;">
|
|
53
|
-
{{group.name}}
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div style="color:#888; font-size:0.8rem; white-space:nowrap;">
|
|
57
|
-
{{getDescription(group)}}
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<div
|
|
63
|
-
style="display:flex; align-items:center; padding:20px 15px 15px 15px; background:#eee; border-bottom:1px solid #ddd;"
|
|
64
|
-
v-if="false"
|
|
65
|
-
>
|
|
66
|
-
|
|
67
|
-
<div style="margin-right:10px;">{{$t('allDefaults')}}:</div>
|
|
68
|
-
|
|
69
|
-
<div style="margin-right:10px; display:flex; align-items:center;">
|
|
70
|
-
<div style="margin-right:5px;">{{$t('show')}}</div>
|
|
71
|
-
<div>
|
|
72
|
-
<WSwitch
|
|
73
|
-
:value="defaultShow"
|
|
74
|
-
@input="(b)=>{setDefaultShow(b)}"
|
|
75
|
-
></WSwitch>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div style="margin-right:10px; display:flex; align-items:center;">
|
|
80
|
-
<div style="margin-right:5px;">{{$t('active')}}</div>
|
|
81
|
-
<div>
|
|
82
|
-
<WSwitch
|
|
83
|
-
:value="defaultActive"
|
|
84
|
-
@input="(b)=>{setDefaultActive(b)}"
|
|
85
|
-
></WSwitch>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<WTree
|
|
94
|
-
:viewHeightMax="treeHeight"
|
|
95
|
-
:indent="0.5"
|
|
96
|
-
:iconToggleColor="'#666'"
|
|
97
|
-
:iconToggleBackgroundColor="'transparent'"
|
|
98
|
-
:iconToggleBackgroundColorHover="'transparent'"
|
|
99
|
-
:data="treeBlocks"
|
|
100
|
-
>
|
|
101
|
-
<template v-slot:item="props">
|
|
102
|
-
<div style="display:flex; align-items:center; min-height:34px;">
|
|
103
|
-
|
|
104
|
-
<div style="">
|
|
105
|
-
{{props.data.text}}
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
</div>
|
|
109
|
-
<div style="position:absolute; top:5px; right:15px;">
|
|
110
|
-
|
|
111
|
-
<div style="margin-left:10px; display:inline-block;" v-if="editable">
|
|
112
|
-
|
|
113
|
-
<WButtonCircle
|
|
114
|
-
:icon="mdiEyeCheck"
|
|
115
|
-
:iconSize="18"
|
|
116
|
-
:paddingStyle="{v:4,h:4}"
|
|
117
|
-
:shadow="false"
|
|
118
|
-
:tooltip="$t('showChildren')"
|
|
119
|
-
:backgroundColor="'rgba(200,200,200,0.2)'"
|
|
120
|
-
:backgroundColorHover="'rgba(255,150,100,0.2)'"
|
|
121
|
-
:backgroundColorFocus="'rgba(255,150,100,0.2)'"
|
|
122
|
-
:iconColor="'#444'"
|
|
123
|
-
:iconColorHover="'#EF6C00'"
|
|
124
|
-
:iconColorFocus="'#EF6C00'"
|
|
125
|
-
@click="treeToogleShowAndActive(props.data,true,'show')"
|
|
126
|
-
></WButtonCircle>
|
|
127
|
-
|
|
128
|
-
<WButtonCircle
|
|
129
|
-
:icon="mdiEyeOff"
|
|
130
|
-
:iconSize="18"
|
|
131
|
-
:paddingStyle="{v:4,h:4}"
|
|
132
|
-
:shadow="false"
|
|
133
|
-
:tooltip="$t('hideChildren')"
|
|
134
|
-
:backgroundColor="'rgba(200,200,200,0.2)'"
|
|
135
|
-
:backgroundColorHover="'rgba(255,150,100,0.2)'"
|
|
136
|
-
:backgroundColorFocus="'rgba(255,150,100,0.2)'"
|
|
137
|
-
:iconColor="'#444'"
|
|
138
|
-
:iconColorHover="'#EF6C00'"
|
|
139
|
-
:iconColorFocus="'#EF6C00'"
|
|
140
|
-
@click="treeToogleShowAndActive(props.data,false,'show')"
|
|
141
|
-
></WButtonCircle>
|
|
142
|
-
|
|
143
|
-
<WButtonCircle
|
|
144
|
-
:icon="mdiEyedropper"
|
|
145
|
-
:iconSize="18"
|
|
146
|
-
:paddingStyle="{v:4,h:4}"
|
|
147
|
-
:shadow="false"
|
|
148
|
-
:tooltip="$t('activateChildren')"
|
|
149
|
-
:backgroundColor="'rgba(200,200,200,0.2)'"
|
|
150
|
-
:backgroundColorHover="'rgba(255,150,100,0.2)'"
|
|
151
|
-
:backgroundColorFocus="'rgba(255,150,100,0.2)'"
|
|
152
|
-
:iconColor="'#444'"
|
|
153
|
-
:iconColorHover="'#EF6C00'"
|
|
154
|
-
:iconColorFocus="'#EF6C00'"
|
|
155
|
-
@click="treeToogleShowAndActive(props.data,true,'active')"
|
|
156
|
-
></WButtonCircle>
|
|
157
|
-
|
|
158
|
-
<WButtonCircle
|
|
159
|
-
:icon="mdiEyedropperOff"
|
|
160
|
-
:iconSize="18"
|
|
161
|
-
:paddingStyle="{v:4,h:4}"
|
|
162
|
-
:shadow="false"
|
|
163
|
-
:tooltip="$t('deactivateChildren')"
|
|
164
|
-
:backgroundColor="'rgba(200,200,200,0.2)'"
|
|
165
|
-
:backgroundColorHover="'rgba(255,150,100,0.2)'"
|
|
166
|
-
:backgroundColorFocus="'rgba(255,150,100,0.2)'"
|
|
167
|
-
:iconColor="'#444'"
|
|
168
|
-
:iconColorHover="'#EF6C00'"
|
|
169
|
-
:iconColorFocus="'#EF6C00'"
|
|
170
|
-
@click="treeToogleShowAndActive(props.data,false,'active')"
|
|
171
|
-
></WButtonCircle>
|
|
172
|
-
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<div style="margin-left:10px; display:inline-block;">
|
|
176
|
-
<div style="display:flex; align-items:center;">
|
|
177
|
-
<div style="margin-right:3px; font-size:0.8rem;">{{$t('show')}}</div>
|
|
178
|
-
<WCheckbox
|
|
179
|
-
:checkedIconColor="'yellow darken-4'"
|
|
180
|
-
:uncheckedIconColor="'yellow darken-4'"
|
|
181
|
-
:value="getShow(props.data)"
|
|
182
|
-
:editable="editable"
|
|
183
|
-
@input="toogleShow(props.data)"
|
|
184
|
-
></WCheckbox>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div style="margin-left:10px; display:inline-block;">
|
|
189
|
-
<div style="display:flex; align-items:center;">
|
|
190
|
-
<div style="margin-right:3px; font-size:0.8rem;">{{$t('active')}}</div>
|
|
191
|
-
<WCheckbox
|
|
192
|
-
:checkedIconColor="'yellow darken-4'"
|
|
193
|
-
:uncheckedIconColor="'yellow darken-4'"
|
|
194
|
-
:value="getActive(props.data)"
|
|
195
|
-
:editable="editable"
|
|
196
|
-
@input="toogleActive(props.data)"
|
|
197
|
-
></WCheckbox>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
</div>
|
|
202
|
-
</template>
|
|
203
|
-
>
|
|
204
|
-
</WTree>
|
|
205
|
-
|
|
206
|
-
</div>
|
|
207
|
-
</template>
|
|
208
|
-
|
|
209
|
-
<script>
|
|
210
|
-
import { mdiEyeCheck, mdiEyeOff, mdiEyedropper, mdiEyedropperOff } from '@mdi/js/mdi.js'
|
|
211
|
-
import JSON5 from 'json5'
|
|
212
|
-
import get from 'lodash-es/get.js'
|
|
213
|
-
import set from 'lodash-es/set.js'
|
|
214
|
-
import each from 'lodash-es/each.js'
|
|
215
|
-
import size from 'lodash-es/size.js'
|
|
216
|
-
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
217
|
-
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
218
|
-
import isobj from 'wsemi/src/isobj.mjs'
|
|
219
|
-
import isestr from 'wsemi/src/isestr.mjs'
|
|
220
|
-
import haskey from 'wsemi/src/haskey.mjs'
|
|
221
|
-
import debounce from 'wsemi/src/debounce.mjs'
|
|
222
|
-
import WButtonCircle from 'w-component-vue/src/components/WButtonCircle.vue'
|
|
223
|
-
import WTree from 'w-component-vue/src/components/WTree.vue'
|
|
224
|
-
import WCheckbox from 'w-component-vue/src/components/WCheckbox.vue'
|
|
225
|
-
import WText from 'w-component-vue/src/components/WText.vue'
|
|
226
|
-
import { getTreeBlocks } from '../plugins/mShare.mjs'
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
export default {
|
|
230
|
-
components: {
|
|
231
|
-
WButtonCircle,
|
|
232
|
-
WTree,
|
|
233
|
-
WCheckbox,
|
|
234
|
-
WText,
|
|
235
|
-
},
|
|
236
|
-
props: {
|
|
237
|
-
height: {
|
|
238
|
-
type: Number,
|
|
239
|
-
default: 100,
|
|
240
|
-
},
|
|
241
|
-
group: {
|
|
242
|
-
type: Object,
|
|
243
|
-
default: () => {},
|
|
244
|
-
},
|
|
245
|
-
showHead: {
|
|
246
|
-
type: Boolean,
|
|
247
|
-
default: true,
|
|
248
|
-
},
|
|
249
|
-
editable: {
|
|
250
|
-
type: Boolean,
|
|
251
|
-
default: false,
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
data: function() {
|
|
255
|
-
return {
|
|
256
|
-
dbc: debounce(),
|
|
257
|
-
|
|
258
|
-
mdiEyeCheck,
|
|
259
|
-
mdiEyeOff,
|
|
260
|
-
mdiEyedropper,
|
|
261
|
-
mdiEyedropperOff,
|
|
262
|
-
|
|
263
|
-
headHeight: 100,
|
|
264
|
-
|
|
265
|
-
groupTrans: null,
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
computed: {
|
|
270
|
-
|
|
271
|
-
changeGroup: function() {
|
|
272
|
-
// console.log('computed changeGroup')
|
|
273
|
-
|
|
274
|
-
let vo = this
|
|
275
|
-
|
|
276
|
-
//save
|
|
277
|
-
let group = cloneDeep(vo.group)
|
|
278
|
-
|
|
279
|
-
//save rules
|
|
280
|
-
let rules = JSON5.parse(group.crules)
|
|
281
|
-
group.rules = rules
|
|
282
|
-
// console.log('rules', rules)
|
|
283
|
-
|
|
284
|
-
//delete
|
|
285
|
-
delete group.crules
|
|
286
|
-
|
|
287
|
-
//save
|
|
288
|
-
vo.groupTrans = group
|
|
289
|
-
// console.log('group', group)
|
|
290
|
-
|
|
291
|
-
return ''
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
treeHeight: function() {
|
|
295
|
-
let vo = this
|
|
296
|
-
|
|
297
|
-
//h
|
|
298
|
-
let h = vo.height - vo.headHeight
|
|
299
|
-
h = Math.max(h, 0)
|
|
300
|
-
|
|
301
|
-
return h
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
targets: function() {
|
|
305
|
-
return get(this, `$store.state.targets`)
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
treeBlocks: function() {
|
|
309
|
-
// console.log('computed treeBlocks')
|
|
310
|
-
|
|
311
|
-
let vo = this
|
|
312
|
-
|
|
313
|
-
//check
|
|
314
|
-
if (size(vo.targets) === 0) {
|
|
315
|
-
return null
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
//getTreeBlocks
|
|
319
|
-
let r = getTreeBlocks(vo.targets)
|
|
320
|
-
|
|
321
|
-
return r
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
defaultShow: function() {
|
|
325
|
-
let r = get(this.groupTrans, 'rules.___all___.show', 'n')
|
|
326
|
-
return r === 'y'
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
defaultActive: function() {
|
|
330
|
-
let r = get(this.groupTrans, 'rules.___all___.active', 'n')
|
|
331
|
-
return r === 'y'
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
methods: {
|
|
336
|
-
|
|
337
|
-
resizeHead: function(msg) {
|
|
338
|
-
// console.log('methods resizeHead', msg)
|
|
339
|
-
|
|
340
|
-
let vo = this
|
|
341
|
-
|
|
342
|
-
//headHeight
|
|
343
|
-
vo.headHeight = msg.snew.offsetHeight
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
getName: function(g) {
|
|
348
|
-
// console.log('methods getName', g)
|
|
349
|
-
|
|
350
|
-
//r
|
|
351
|
-
let r = get(g, 'name', '')
|
|
352
|
-
|
|
353
|
-
//check
|
|
354
|
-
if (!isestr(r)) {
|
|
355
|
-
r = '無名稱'
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return r
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
getDescription: function(g) {
|
|
362
|
-
// console.log('methods getDescription', g)
|
|
363
|
-
|
|
364
|
-
//r
|
|
365
|
-
let r = get(g, 'description', '')
|
|
366
|
-
|
|
367
|
-
//check
|
|
368
|
-
if (!isestr(r)) {
|
|
369
|
-
r = '無說明'
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return r
|
|
373
|
-
},
|
|
374
|
-
|
|
375
|
-
setDefaultShow: function(b) {
|
|
376
|
-
let r = b ? 'y' : 'n'
|
|
377
|
-
return set(this.groupTrans, 'rules.___all___.show', r)
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
setDefaultActive: function(b) {
|
|
381
|
-
let r = b ? 'y' : 'n'
|
|
382
|
-
return set(this.groupTrans, 'rules.___all___.active', r)
|
|
383
|
-
},
|
|
384
|
-
|
|
385
|
-
getShowAndActive: function(item, key, def) {
|
|
386
|
-
// console.log('getShowAndActive', item, key, def)
|
|
387
|
-
|
|
388
|
-
let vo = this
|
|
389
|
-
|
|
390
|
-
//rules
|
|
391
|
-
let rules = get(vo.groupTrans, 'rules', null)
|
|
392
|
-
|
|
393
|
-
//rule
|
|
394
|
-
let rule = null
|
|
395
|
-
if (haskey(rules, item.id)) {
|
|
396
|
-
rule = rules[item.id]
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
//r
|
|
400
|
-
let r = get(rule, key, null)
|
|
401
|
-
// console.log(item.id, r, def)
|
|
402
|
-
|
|
403
|
-
//b
|
|
404
|
-
let b = def
|
|
405
|
-
if (r === 'y' || r === 'n') { //若權限內有定義則優先使用(覆蓋)
|
|
406
|
-
b = r === 'y'
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return b
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
getShow: function(item) {
|
|
413
|
-
// console.log('getShow', item)
|
|
414
|
-
|
|
415
|
-
let vo = this
|
|
416
|
-
|
|
417
|
-
//def
|
|
418
|
-
let def = vo.defaultShow
|
|
419
|
-
|
|
420
|
-
//getShowAndActive
|
|
421
|
-
let b = vo.getShowAndActive(item, 'show', def)
|
|
422
|
-
|
|
423
|
-
return b
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
getActive: function(item) {
|
|
427
|
-
// console.log('getActive', item)
|
|
428
|
-
|
|
429
|
-
let vo = this
|
|
430
|
-
|
|
431
|
-
//def
|
|
432
|
-
let def = vo.defaultActive
|
|
433
|
-
|
|
434
|
-
//getShowAndActive
|
|
435
|
-
let b = vo.getShowAndActive(item, 'active', def)
|
|
436
|
-
|
|
437
|
-
return b
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
getDefaultShowAndActive: function(key) {
|
|
441
|
-
if (key === 'show') {
|
|
442
|
-
return this.defaultShow
|
|
443
|
-
}
|
|
444
|
-
return this.defaultActive
|
|
445
|
-
},
|
|
446
|
-
|
|
447
|
-
toogleShowAndActive: function(id, b, key) {
|
|
448
|
-
// console.log('toogleShowAndActive', id, b, key)
|
|
449
|
-
|
|
450
|
-
let vo = this
|
|
451
|
-
|
|
452
|
-
//def
|
|
453
|
-
let def = vo.getDefaultShowAndActive(key)
|
|
454
|
-
|
|
455
|
-
//groupTrans
|
|
456
|
-
let groupTrans = cloneDeep(vo.groupTrans)
|
|
457
|
-
|
|
458
|
-
//cb
|
|
459
|
-
let cb = b ? 'y' : 'n'
|
|
460
|
-
|
|
461
|
-
//rules
|
|
462
|
-
let rules = get(vo.groupTrans, 'rules', null)
|
|
463
|
-
|
|
464
|
-
//rule
|
|
465
|
-
let rule = null
|
|
466
|
-
if (haskey(rules, id)) {
|
|
467
|
-
rule = rules[id]
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
//r
|
|
471
|
-
let r = get(rule, key, null)
|
|
472
|
-
|
|
473
|
-
//toogle
|
|
474
|
-
if (r === 'y' || r === 'n') { //若權限內有定義則優先使用(覆蓋)
|
|
475
|
-
// console.log('權限內有定義')
|
|
476
|
-
|
|
477
|
-
//check
|
|
478
|
-
if (b === def) { //欲切換值與預設值相同
|
|
479
|
-
|
|
480
|
-
//delete
|
|
481
|
-
delete rule[key]
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
|
|
486
|
-
//save rule
|
|
487
|
-
rule[key] = cb
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
// console.log('權限內無定義')
|
|
494
|
-
|
|
495
|
-
//check
|
|
496
|
-
if (b === def) { //欲切換值與預設值相同, 不變更
|
|
497
|
-
// console.log('不變更')
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
|
|
501
|
-
//save rule
|
|
502
|
-
if (isobj(rule)) {
|
|
503
|
-
rule[key] = cb
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
rule = {
|
|
507
|
-
[key]: cb,
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
//check
|
|
516
|
-
if (iseobj(rule)) {
|
|
517
|
-
|
|
518
|
-
//save rule
|
|
519
|
-
groupTrans.rules[id] = rule
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
|
|
524
|
-
//delete rule
|
|
525
|
-
delete groupTrans.rules[id]
|
|
526
|
-
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
//save groupTrans
|
|
530
|
-
vo.groupTrans = groupTrans
|
|
531
|
-
// console.log('groupTrans', cloneDeep(vo.groupTrans))
|
|
532
|
-
|
|
533
|
-
//emitGroupDebounce
|
|
534
|
-
vo.emitGroupDebounce()
|
|
535
|
-
|
|
536
|
-
},
|
|
537
|
-
|
|
538
|
-
toogleShow: function(item) {
|
|
539
|
-
// console.log('toogleShow', item)
|
|
540
|
-
|
|
541
|
-
let vo = this
|
|
542
|
-
|
|
543
|
-
//check
|
|
544
|
-
if (!vo.editable) {
|
|
545
|
-
return
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
//b
|
|
549
|
-
let b = !vo.getShow(item)
|
|
550
|
-
|
|
551
|
-
//toogleShowAndActive
|
|
552
|
-
vo.toogleShowAndActive(item.id, b, 'show')
|
|
553
|
-
|
|
554
|
-
},
|
|
555
|
-
|
|
556
|
-
toogleActive: function(item) {
|
|
557
|
-
// console.log('toogleActive', item)
|
|
558
|
-
|
|
559
|
-
let vo = this
|
|
560
|
-
|
|
561
|
-
//check
|
|
562
|
-
if (!vo.editable) {
|
|
563
|
-
return
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
//b
|
|
567
|
-
let b = !vo.getActive(item)
|
|
568
|
-
|
|
569
|
-
//toogleShowAndActive
|
|
570
|
-
vo.toogleShowAndActive(item.id, b, 'active')
|
|
571
|
-
|
|
572
|
-
},
|
|
573
|
-
|
|
574
|
-
treeToogleShowAndActive: function(item, b, key) {
|
|
575
|
-
// console.log('treeToogleShowAndActive', item, b, key)
|
|
576
|
-
|
|
577
|
-
let vo = this
|
|
578
|
-
|
|
579
|
-
//self
|
|
580
|
-
vo.toogleShowAndActive(item.id, b, key)
|
|
581
|
-
|
|
582
|
-
//children
|
|
583
|
-
each(item.children, (v) => {
|
|
584
|
-
vo.treeToogleShowAndActive(v, b, key)
|
|
585
|
-
})
|
|
586
|
-
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
updateProp: function(key, value) {
|
|
590
|
-
// console.log('methods updateProp', key, value)
|
|
591
|
-
|
|
592
|
-
let vo = this
|
|
593
|
-
|
|
594
|
-
//groupTrans
|
|
595
|
-
let groupTrans = cloneDeep(vo.groupTrans)
|
|
596
|
-
|
|
597
|
-
//save value
|
|
598
|
-
groupTrans[key] = value
|
|
599
|
-
|
|
600
|
-
//save groupTrans
|
|
601
|
-
vo.groupTrans = groupTrans
|
|
602
|
-
// console.log('groupTrans', cloneDeep(vo.groupTrans))
|
|
603
|
-
|
|
604
|
-
//emitGroupDebounce
|
|
605
|
-
vo.emitGroupDebounce()
|
|
606
|
-
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
emitGroupDebounce: function() {
|
|
610
|
-
//console.log('methods emitGroupDebounce')
|
|
611
|
-
|
|
612
|
-
let vo = this
|
|
613
|
-
|
|
614
|
-
//dbc
|
|
615
|
-
vo.dbc(() => {
|
|
616
|
-
|
|
617
|
-
//emitGroup
|
|
618
|
-
vo.emitGroup()
|
|
619
|
-
|
|
620
|
-
})
|
|
621
|
-
|
|
622
|
-
},
|
|
623
|
-
|
|
624
|
-
emitGroup: function() {
|
|
625
|
-
//console.log('methods emitGroup')
|
|
626
|
-
|
|
627
|
-
let vo = this
|
|
628
|
-
|
|
629
|
-
//groupTrans
|
|
630
|
-
let groupTrans = cloneDeep(vo.groupTrans)
|
|
631
|
-
|
|
632
|
-
//save crules
|
|
633
|
-
groupTrans.crules = JSON.stringify(vo.groupTrans.rules)
|
|
634
|
-
|
|
635
|
-
//emit
|
|
636
|
-
vo.$emit('update', groupTrans)
|
|
637
|
-
|
|
638
|
-
},
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
</script>
|
|
643
|
-
|
|
644
|
-
<style scoped>
|
|
645
|
-
</style>
|