w-web-sso 1.0.13 → 1.0.15
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/db/wsso/ips/data.mdb +0 -0
- package/db/wsso/ips/lock.mdb +0 -0
- package/db/wsso/tokens/data.mdb +0 -0
- package/db/wsso/tokens/lock.mdb +0 -0
- package/db/wsso/users/data.mdb +0 -0
- package/db/wsso/users/lock.mdb +0 -0
- package/dist/css/{app.03a2f95c.css → app.e4367a2b.css} +1 -1
- package/dist/index.tmp +6 -2
- package/dist/js/app-legacy.4ebeee34.js +2 -0
- package/dist/js/app-legacy.4ebeee34.js.map +1 -0
- package/dist/js/app.d1707f92.js +2 -0
- package/dist/js/app.d1707f92.js.map +1 -0
- package/dist/js/chunk-vendors-legacy.7380957a.js +15 -0
- package/dist/js/chunk-vendors-legacy.7380957a.js.map +1 -0
- package/dist/js/chunk-vendors.7380957a.js +15 -0
- package/dist/js/chunk-vendors.7380957a.js.map +1 -0
- package/dist/w-web-sso.umd.js +2 -2
- package/dist/w-web-sso.umd.js.map +1 -1
- package/docs/WWebSso.html +4 -112
- package/docs/WWebSso.mjs.html +460 -111
- package/docs/index.html +1 -1
- package/g.getSettings.mjs +0 -1
- package/g.initialData.mjs +8 -10
- package/g.mjs +0 -0
- package/package.json +7 -6
- package/public/index.html +13 -0
- package/server/WWebSso.mjs +459 -110
- package/server/procCore.mjs +871 -277
- package/server/procProtect.mjs +746 -0
- package/server/procStaInfor.mjs +393 -0
- package/server/provideUsers.mjs +0 -1
- package/server/srlog.mjs +12 -0
- package/server/staLogs/staIp.callWorker.mjs +35 -0
- package/server/staLogs/staIp.mjs +118 -0
- package/server/staLogs/staIp.shellWorker.mjs +18 -0
- package/server/staLogs/staToken.callWorker.mjs +35 -0
- package/server/staLogs/staToken.mjs +118 -0
- package/server/staLogs/staToken.shellWorker.mjs +18 -0
- package/server/staLogs/staUserAccountLogin.callWorker.mjs +35 -0
- package/server/staLogs/staUserAccountLogin.mjs +136 -0
- package/server/staLogs/staUserAccountLogin.shellWorker.mjs +18 -0
- package/server/staLogs/test_staIp.mjs +27 -0
- package/server/staLogs/test_staToken.mjs +27 -0
- package/server/staLogs/test_staUserAccountLogin.mjs +30 -0
- package/settings.json +15 -1
- package/src/components/Layout.vue +70 -15
- package/src/components/LayoutContent.vue +35 -33
- package/src/components/LayoutContentIps.vue +757 -0
- package/src/components/LayoutContentStaInfor.vue +917 -0
- package/src/components/LayoutContentTokens.vue +961 -0
- package/src/components/{LayoutContentInfor.vue → LayoutContentUserInfor.vue} +366 -73
- package/src/components/LayoutContentUsers.vue +21 -34
- package/src/components/PageLogin.vue +1 -1
- package/src/components/VeUser.vue.txt +9 -10
- package/src/components/ruleGroup.vue.txt +5 -6
- package/src/main.js +7 -13
- package/src/plugins/mLang.mjs +853 -520
- package/src/plugins/mShare.mjs +141 -3
- package/src/plugins/mUI.mjs +30 -21
- package/src/schema/index.mjs +2 -0
- package/src/schema/tables/ips.mjs +0 -9
- package/src/schema/tables/tokens.mjs +5 -1
- package/src/schema/tables/users.mjs +2 -14
- package/src/store/mutations.mjs +3 -3
- package/src/store/types.mjs +1 -1
- package/srv.mjs +55 -38
- package/_/350/246/217/345/212/203.md +0 -275
- package/dist/js/app-legacy.d468ef7f.js +0 -2
- package/dist/js/app-legacy.d468ef7f.js.map +0 -1
- package/dist/js/app.d468ef7f.js +0 -2
- package/dist/js/app.d468ef7f.js.map +0 -1
- package/dist/js/chunk-vendors-legacy.f51f58bb.js +0 -13
- package/dist/js/chunk-vendors-legacy.f51f58bb.js.map +0 -1
- package/dist/js/chunk-vendors.f51f58bb.js +0 -13
- package/dist/js/chunk-vendors.f51f58bb.js.map +0 -1
- package/src/components/LayoutContentSettings.vue +0 -1248
|
@@ -1,1248 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
style="height:100%;"
|
|
4
|
-
v-domresize
|
|
5
|
-
@domresize="resizePanel"
|
|
6
|
-
:changeParams="changeParams"
|
|
7
|
-
>
|
|
8
|
-
|
|
9
|
-
<div
|
|
10
|
-
style="background:#fff;"
|
|
11
|
-
v-domresize
|
|
12
|
-
@domresize="resizeHead"
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
<!-- 標題區 -->
|
|
16
|
-
<div style="padding:10px 10px 10px 20px;">
|
|
17
|
-
<div :style="`display:flex; align-items:center; padding:${drawer?'5px':'5px 5px 5px 20px'};`">
|
|
18
|
-
|
|
19
|
-
<WIcon
|
|
20
|
-
:icon="mdiCogOutline"
|
|
21
|
-
:color="'#000'"
|
|
22
|
-
:size="32"
|
|
23
|
-
></WIcon>
|
|
24
|
-
|
|
25
|
-
<div style="padding-left:12px;">
|
|
26
|
-
|
|
27
|
-
<div style="font-size:1.4rem; color:#000;">
|
|
28
|
-
{{$t('mmSettings')}}
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div style="padding-top:2px; font-size:0.8rem; color:#666;">
|
|
32
|
-
{{$t('mmSettingsMsg')}}
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<template
|
|
43
|
-
v-if="!isLoading"
|
|
44
|
-
>
|
|
45
|
-
|
|
46
|
-
<template v-if="true">
|
|
47
|
-
bbb
|
|
48
|
-
</template>
|
|
49
|
-
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<div
|
|
53
|
-
style="padding:10px 15px; font-size:0.8rem;"
|
|
54
|
-
v-else
|
|
55
|
-
>
|
|
56
|
-
{{$t('waitingData')}}
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
</div>
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
<script>
|
|
63
|
-
import { mdiCogOutline, mdiVectorPolylinePlus, mdiCheckboxMarkedCircle, mdiCloudUploadOutline, mdiTrashCanOutline, mdiTableHeadersEye, mdiPlus, mdiPencilOutline, mdiContentCopy } from '@mdi/js/mdi.js'
|
|
64
|
-
import JSON5 from 'json5'
|
|
65
|
-
import ot from 'dayjs'
|
|
66
|
-
import get from 'lodash-es/get.js'
|
|
67
|
-
import set from 'lodash-es/set.js'
|
|
68
|
-
import each from 'lodash-es/each.js'
|
|
69
|
-
import size from 'lodash-es/size.js'
|
|
70
|
-
import filter from 'lodash-es/filter.js'
|
|
71
|
-
import sortBy from 'lodash-es/sortBy.js'
|
|
72
|
-
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
73
|
-
import haskey from 'wsemi/src/haskey.mjs'
|
|
74
|
-
import isestr from 'wsemi/src/isestr.mjs'
|
|
75
|
-
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
76
|
-
import isnum from 'wsemi/src/isnum.mjs'
|
|
77
|
-
import istime from 'wsemi/src/istime.mjs'
|
|
78
|
-
import istimeTZ from 'wsemi/src/istimeTZ.mjs'
|
|
79
|
-
import isEmail from 'wsemi/src/isEmail.mjs'
|
|
80
|
-
import cdbl from 'wsemi/src/cdbl.mjs'
|
|
81
|
-
import cstr from 'wsemi/src/cstr.mjs'
|
|
82
|
-
import arrPull from 'wsemi/src/arrPull.mjs'
|
|
83
|
-
import domShowInputDatatime from 'wsemi/src/domShowInputDatatime.mjs'
|
|
84
|
-
import WIcon from 'w-component-vue/src/components/WIcon.vue'
|
|
85
|
-
import WSwitch from 'w-component-vue/src/components/WSwitch.vue'
|
|
86
|
-
import WButtonCircle from 'w-component-vue/src/components/WButtonCircle.vue'
|
|
87
|
-
import WPopup from 'w-component-vue/src/components/WPopup.vue'
|
|
88
|
-
import WInputCheckbox from 'w-component-vue/src/components/WInputCheckbox.vue'
|
|
89
|
-
import WAggridVueDyn from 'w-component-vue/src/components/WAggridVueDyn.vue'
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export default {
|
|
93
|
-
components: {
|
|
94
|
-
WIcon,
|
|
95
|
-
WSwitch,
|
|
96
|
-
WButtonCircle,
|
|
97
|
-
WPopup,
|
|
98
|
-
WInputCheckbox,
|
|
99
|
-
WAggridVueDyn,
|
|
100
|
-
},
|
|
101
|
-
props: {
|
|
102
|
-
drawer: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
default: false,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
data: function() {
|
|
108
|
-
return {
|
|
109
|
-
mdiCogOutline,
|
|
110
|
-
mdiVectorPolylinePlus,
|
|
111
|
-
mdiCheckboxMarkedCircle,
|
|
112
|
-
mdiCloudUploadOutline,
|
|
113
|
-
mdiTrashCanOutline,
|
|
114
|
-
mdiTableHeadersEye,
|
|
115
|
-
mdiPlus,
|
|
116
|
-
mdiPencilOutline,
|
|
117
|
-
mdiContentCopy,
|
|
118
|
-
|
|
119
|
-
ttt: '',
|
|
120
|
-
|
|
121
|
-
panelWidth: 100,
|
|
122
|
-
panelHeight: 100,
|
|
123
|
-
headHeight: 100,
|
|
124
|
-
|
|
125
|
-
isLoading: true,
|
|
126
|
-
firstSetting: true,
|
|
127
|
-
showIsEditable: false,
|
|
128
|
-
isEditable: false,
|
|
129
|
-
// isModified: false,
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
mounted: function() {
|
|
134
|
-
// console.log('mounted')
|
|
135
|
-
|
|
136
|
-
let vo = this
|
|
137
|
-
|
|
138
|
-
// //註冊至$dg供使用
|
|
139
|
-
// vo.$dg.toggleItemIsAdminById = vo.toggleItemIsAdminById
|
|
140
|
-
// vo.$dg.toggleItemIsVerifiedById = vo.toggleItemIsVerifiedById
|
|
141
|
-
// vo.$dg.toggleItemIsActiveById = vo.toggleItemIsActiveById
|
|
142
|
-
// vo.$dg.modifyItemPasswordById = vo.modifyItemPasswordById
|
|
143
|
-
// vo.$dg.modifyItemTimeVerifiedById = vo.modifyItemTimeVerifiedById
|
|
144
|
-
// vo.$dg.modifyItemTimeExpiredById = vo.modifyItemTimeExpiredById
|
|
145
|
-
// vo.$dg.modifyItemTimeBlockedById = vo.modifyItemTimeBlockedById
|
|
146
|
-
|
|
147
|
-
//firstSetting
|
|
148
|
-
if (vo.firstSetting) {
|
|
149
|
-
// console.log('webInfor', vo.webInfor)
|
|
150
|
-
|
|
151
|
-
let showModeEditUsers = get(vo, 'webInfor.showModeEditUsers', '')
|
|
152
|
-
vo.showIsEditable = showModeEditUsers === 'y'
|
|
153
|
-
let modeEditUsers = get(vo, 'webInfor.modeEditUsers', '')
|
|
154
|
-
vo.isEditable = modeEditUsers === 'y'
|
|
155
|
-
|
|
156
|
-
// vo.widthUsersName = get(vo, 'webInfor.widthUsersName', '')
|
|
157
|
-
// vo.widthUsersEmail = get(vo, 'webInfor.widthUsersEmail', '')
|
|
158
|
-
// vo.widthUsersDescription = get(vo, 'webInfor.widthUsersDescription', '')
|
|
159
|
-
|
|
160
|
-
vo.firstSetting = false
|
|
161
|
-
}
|
|
162
|
-
vo.isEditable = true //bbb
|
|
163
|
-
|
|
164
|
-
//token
|
|
165
|
-
let token = vo.userToken
|
|
166
|
-
// console.log('token', token)
|
|
167
|
-
|
|
168
|
-
// //getUsersList
|
|
169
|
-
// vo.$fapi.getUsersList(token)
|
|
170
|
-
// .then((res) => {
|
|
171
|
-
// // console.log(res)
|
|
172
|
-
// res = sortBy(res, 'order')
|
|
173
|
-
// vo.users = res
|
|
174
|
-
// })
|
|
175
|
-
// .catch((err) => {
|
|
176
|
-
// console.log(err)
|
|
177
|
-
// vo.errMsg = vo.$t('getDataError')
|
|
178
|
-
// })
|
|
179
|
-
// .finally(() => {
|
|
180
|
-
// vo.isLoading = false
|
|
181
|
-
// })
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
computed: {
|
|
185
|
-
|
|
186
|
-
webInfor: function() {
|
|
187
|
-
let wi = get(this, `$store.state.webInfor`)
|
|
188
|
-
return wi
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
userToken: function() {
|
|
192
|
-
let vo = this
|
|
193
|
-
return get(vo, `$store.state.userToken`)
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
changeParams: function() {
|
|
197
|
-
// console.log('computed changeParams')
|
|
198
|
-
|
|
199
|
-
let vo = this
|
|
200
|
-
|
|
201
|
-
// //trigger
|
|
202
|
-
// let isEditable = vo.isEditable
|
|
203
|
-
|
|
204
|
-
// //items
|
|
205
|
-
// let items = cloneDeep(vo.users)
|
|
206
|
-
|
|
207
|
-
// //save
|
|
208
|
-
// vo.items = items
|
|
209
|
-
|
|
210
|
-
// //genOpt
|
|
211
|
-
// vo.genOpt({ isEditable })
|
|
212
|
-
|
|
213
|
-
// //isLoading
|
|
214
|
-
// vo.isLoading = false
|
|
215
|
-
|
|
216
|
-
return ''
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
// contentHeight: function() {
|
|
220
|
-
// let vo = this
|
|
221
|
-
|
|
222
|
-
// //h
|
|
223
|
-
// let h = vo.panelHeight - vo.headHeight
|
|
224
|
-
// h = Math.max(h, 0)
|
|
225
|
-
|
|
226
|
-
// return h
|
|
227
|
-
// },
|
|
228
|
-
|
|
229
|
-
// hasItemsCheck: function() {
|
|
230
|
-
// let vo = this
|
|
231
|
-
|
|
232
|
-
// //h
|
|
233
|
-
// let b = size(vo.itemsCheck) > 0
|
|
234
|
-
|
|
235
|
-
// return b
|
|
236
|
-
// },
|
|
237
|
-
|
|
238
|
-
// hasItemCheckOne: function() {
|
|
239
|
-
// let vo = this
|
|
240
|
-
|
|
241
|
-
// //h
|
|
242
|
-
// let b = size(vo.itemsCheck) === 1
|
|
243
|
-
|
|
244
|
-
// return b
|
|
245
|
-
// },
|
|
246
|
-
|
|
247
|
-
// errItemsByAccount: function() {
|
|
248
|
-
// let vo = this
|
|
249
|
-
|
|
250
|
-
// //rows
|
|
251
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
252
|
-
|
|
253
|
-
// //kpErr
|
|
254
|
-
// let kpErr = {}
|
|
255
|
-
// let kpAccount = {}
|
|
256
|
-
// each(rows, (v, k) => {
|
|
257
|
-
|
|
258
|
-
// //account
|
|
259
|
-
// let account = get(v, 'account', '')
|
|
260
|
-
|
|
261
|
-
// //check
|
|
262
|
-
// if (!isestr(account)) {
|
|
263
|
-
|
|
264
|
-
// //kpErr
|
|
265
|
-
// kpErr[account] = vo.$t(`userAccountEmpty`)
|
|
266
|
-
|
|
267
|
-
// return true //跳出換下一個
|
|
268
|
-
// }
|
|
269
|
-
|
|
270
|
-
// //check
|
|
271
|
-
// if (haskey(kpAccount, account)) {
|
|
272
|
-
|
|
273
|
-
// //kpErr
|
|
274
|
-
// kpErr[account] = vo.$t(`userAccountDuplicate`)
|
|
275
|
-
|
|
276
|
-
// return true //跳出換下一個
|
|
277
|
-
// }
|
|
278
|
-
|
|
279
|
-
// //kpAccount
|
|
280
|
-
// kpAccount[account] = true
|
|
281
|
-
|
|
282
|
-
// })
|
|
283
|
-
|
|
284
|
-
// return kpErr
|
|
285
|
-
// },
|
|
286
|
-
|
|
287
|
-
// errItemsByEmail: function() {
|
|
288
|
-
// let vo = this
|
|
289
|
-
|
|
290
|
-
// //rows
|
|
291
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
292
|
-
|
|
293
|
-
// //kpErr
|
|
294
|
-
// let kpErr = {}
|
|
295
|
-
// let kpEmail = {}
|
|
296
|
-
// each(rows, (v, k) => {
|
|
297
|
-
|
|
298
|
-
// //email
|
|
299
|
-
// let email = get(v, 'email', '')
|
|
300
|
-
|
|
301
|
-
// //check
|
|
302
|
-
// if (!isestr(email)) {
|
|
303
|
-
|
|
304
|
-
// //kpErr
|
|
305
|
-
// kpErr[email] = vo.$t(`userEmailEmpty`)
|
|
306
|
-
|
|
307
|
-
// return true //跳出換下一個
|
|
308
|
-
// }
|
|
309
|
-
|
|
310
|
-
// //check
|
|
311
|
-
// if (!isEmail(email)) {
|
|
312
|
-
|
|
313
|
-
// //kpErr
|
|
314
|
-
// kpErr[email] = vo.$t(`userEmailError`)
|
|
315
|
-
|
|
316
|
-
// return true //跳出換下一個
|
|
317
|
-
// }
|
|
318
|
-
|
|
319
|
-
// //check
|
|
320
|
-
// if (haskey(kpEmail, email)) {
|
|
321
|
-
|
|
322
|
-
// //kpErr
|
|
323
|
-
// kpErr[email] = vo.$t(`userEmailDuplicate`)
|
|
324
|
-
|
|
325
|
-
// return true //跳出換下一個
|
|
326
|
-
// }
|
|
327
|
-
|
|
328
|
-
// //kpEmail
|
|
329
|
-
// kpEmail[email] = true
|
|
330
|
-
|
|
331
|
-
// })
|
|
332
|
-
|
|
333
|
-
// return kpErr
|
|
334
|
-
// },
|
|
335
|
-
|
|
336
|
-
// errItemsByRedir: function() {
|
|
337
|
-
// let vo = this
|
|
338
|
-
|
|
339
|
-
// //rows
|
|
340
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
341
|
-
|
|
342
|
-
// //kpErr
|
|
343
|
-
// let kpErr = {}
|
|
344
|
-
// each(rows, (v, k) => {
|
|
345
|
-
|
|
346
|
-
// //redir
|
|
347
|
-
// let redir = get(v, 'redir', '')
|
|
348
|
-
|
|
349
|
-
// //check
|
|
350
|
-
// if (!isestr(redir)) {
|
|
351
|
-
|
|
352
|
-
// //kpErr
|
|
353
|
-
// kpErr[redir] = vo.$t(`userRedirEmpty`)
|
|
354
|
-
|
|
355
|
-
// return true //跳出換下一個
|
|
356
|
-
// }
|
|
357
|
-
|
|
358
|
-
// })
|
|
359
|
-
|
|
360
|
-
// return kpErr
|
|
361
|
-
// },
|
|
362
|
-
|
|
363
|
-
// isError: function() {
|
|
364
|
-
// let vo = this
|
|
365
|
-
|
|
366
|
-
// let c = ''
|
|
367
|
-
// let b = false
|
|
368
|
-
// b = iseobj(vo.errItemsByAccount)
|
|
369
|
-
// if (b) {
|
|
370
|
-
// c = vo.$t('errInAccounts')
|
|
371
|
-
// return c
|
|
372
|
-
// }
|
|
373
|
-
// b = iseobj(vo.errItemsByEmail)
|
|
374
|
-
// if (b) {
|
|
375
|
-
// c = vo.$t('errInEmails')
|
|
376
|
-
// return c
|
|
377
|
-
// }
|
|
378
|
-
// b = iseobj(vo.errItemsByRedir)
|
|
379
|
-
// if (b) {
|
|
380
|
-
// c = vo.$t('errInRedir')
|
|
381
|
-
// return c
|
|
382
|
-
// }
|
|
383
|
-
|
|
384
|
-
// return ''
|
|
385
|
-
// },
|
|
386
|
-
|
|
387
|
-
// kpHead: function() {
|
|
388
|
-
// let vo = this
|
|
389
|
-
|
|
390
|
-
// let kp = {
|
|
391
|
-
// 'id': vo.$t('id'),
|
|
392
|
-
// 'order': vo.$t('order'),
|
|
393
|
-
// 'account': vo.$t('account'),
|
|
394
|
-
// 'password': vo.$t('password'),
|
|
395
|
-
// 'name': vo.$t('name'),
|
|
396
|
-
// 'email': vo.$t('email'),
|
|
397
|
-
// 'description': vo.$t('description'),
|
|
398
|
-
// 'from': vo.$t('from'),
|
|
399
|
-
// 'redir': vo.$t('redir'),
|
|
400
|
-
// 'isAdmin': vo.$t('isAdmin'),
|
|
401
|
-
// 'isVerified': vo.$t('isVerified'),
|
|
402
|
-
// 'timeVerified': vo.$t('timeVerified'),
|
|
403
|
-
// 'timeExpired': vo.$t('timeExpired'),
|
|
404
|
-
// 'timeBlocked': vo.$t('timeBlocked'),
|
|
405
|
-
// 'userId': vo.$t('userId'),
|
|
406
|
-
// 'timeCreate': vo.$t('timeCreate'),
|
|
407
|
-
// 'userIdUpdate': vo.$t('userIdUpdate'),
|
|
408
|
-
// 'timeUpdate': vo.$t('timeUpdate'),
|
|
409
|
-
// 'isActive': vo.$t('isActive'),
|
|
410
|
-
// }
|
|
411
|
-
|
|
412
|
-
// return kp
|
|
413
|
-
// },
|
|
414
|
-
|
|
415
|
-
},
|
|
416
|
-
methods: {
|
|
417
|
-
|
|
418
|
-
resizePanel: function(msg) {
|
|
419
|
-
// console.log('methods resizePanel', msg)
|
|
420
|
-
|
|
421
|
-
let vo = this
|
|
422
|
-
|
|
423
|
-
//panelWidth, panelHeight
|
|
424
|
-
vo.panelWidth = msg.snew.offsetWidth
|
|
425
|
-
vo.panelHeight = msg.snew.offsetHeight
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
|
|
429
|
-
resizeHead: function(msg) {
|
|
430
|
-
// console.log('methods resizeHead', msg)
|
|
431
|
-
|
|
432
|
-
let vo = this
|
|
433
|
-
|
|
434
|
-
//headHeight
|
|
435
|
-
vo.headHeight = msg.snew.offsetHeight
|
|
436
|
-
|
|
437
|
-
},
|
|
438
|
-
|
|
439
|
-
// getHead: function(key) {
|
|
440
|
-
// // console.log('methods getHead', key)
|
|
441
|
-
|
|
442
|
-
// let vo = this
|
|
443
|
-
|
|
444
|
-
// let head = get(vo, `kpHead.${key}`, '')
|
|
445
|
-
|
|
446
|
-
// return head
|
|
447
|
-
// },
|
|
448
|
-
|
|
449
|
-
// genOpt: function() {
|
|
450
|
-
// // console.log('methods genOpt')
|
|
451
|
-
|
|
452
|
-
// let vo = this
|
|
453
|
-
|
|
454
|
-
// //default
|
|
455
|
-
// vo.itemsCheck = []
|
|
456
|
-
|
|
457
|
-
// //opt
|
|
458
|
-
// let opt = null
|
|
459
|
-
// if (size(vo.items) > 0) {
|
|
460
|
-
|
|
461
|
-
// //ks
|
|
462
|
-
// let ks = vo.tabKeys
|
|
463
|
-
// // console.log('ks', ks)
|
|
464
|
-
|
|
465
|
-
// //kpHead
|
|
466
|
-
// let kpHead = vo.kpHead
|
|
467
|
-
|
|
468
|
-
// //kpCellEditable, kpRowDrag, kpHeadCheckBox
|
|
469
|
-
// let kpCellEditable = {}
|
|
470
|
-
// let kpRowDrag = {}
|
|
471
|
-
// let kpHeadCheckBox = {}
|
|
472
|
-
// if (vo.isEditable) {
|
|
473
|
-
// kpCellEditable = {
|
|
474
|
-
// 'account': true,
|
|
475
|
-
// 'name': true,
|
|
476
|
-
// 'email': true,
|
|
477
|
-
// 'description': true,
|
|
478
|
-
// 'from': true,
|
|
479
|
-
// 'redir': true,
|
|
480
|
-
// }
|
|
481
|
-
// kpRowDrag = {
|
|
482
|
-
// 'account': true,
|
|
483
|
-
// }
|
|
484
|
-
// kpHeadCheckBox = {
|
|
485
|
-
// 'account': true,
|
|
486
|
-
// }
|
|
487
|
-
// }
|
|
488
|
-
|
|
489
|
-
// //kpHeadHide
|
|
490
|
-
// let kpHeadHide = {
|
|
491
|
-
// 'id': true,
|
|
492
|
-
// 'order': true,
|
|
493
|
-
// }
|
|
494
|
-
// if (true) {
|
|
495
|
-
// let tabKeysHide = arrPull(vo.tabKeysPick, vo.tabKeysShow)
|
|
496
|
-
// each(tabKeysHide, (k) => {
|
|
497
|
-
// kpHeadHide[k] = true
|
|
498
|
-
// })
|
|
499
|
-
// }
|
|
500
|
-
|
|
501
|
-
// //opt
|
|
502
|
-
// opt = {
|
|
503
|
-
// language: vo.$t('aggridLanguage'),
|
|
504
|
-
// rows: vo.items,
|
|
505
|
-
// keys: ks,
|
|
506
|
-
// kpHead,
|
|
507
|
-
// // autoFitColumn: true,
|
|
508
|
-
// defCellEditable: false, //vo.isEditable
|
|
509
|
-
// defHeadFilter: true,
|
|
510
|
-
// defCellAlignH: 'left',
|
|
511
|
-
// kpHeadHide,
|
|
512
|
-
// kpHeadFixLeft: {
|
|
513
|
-
// 'account': true,
|
|
514
|
-
// },
|
|
515
|
-
// defHeadMinWidth: 150,
|
|
516
|
-
// kpHeadWidth: {
|
|
517
|
-
// // 'name': isnum(vo.widthUsersName) ? cdbl(vo.widthUsersName) : 200,
|
|
518
|
-
// // 'email': isnum(vo.widthUsersEmail) ? cdbl(vo.widthUsersEmail) : 300,
|
|
519
|
-
// // 'description': isnum(vo.widthUsersDescription) ? cdbl(vo.widthUsersDescription) : 300,
|
|
520
|
-
// // 'cgrups': 300,
|
|
521
|
-
// // 'isAdmin': 100,
|
|
522
|
-
// // 'isActive': 100,
|
|
523
|
-
// // 'timeCreate': 220,
|
|
524
|
-
// // 'timeUpdate': 220,
|
|
525
|
-
// },
|
|
526
|
-
// kpHeadFilterType: {
|
|
527
|
-
// 'id': 'text',
|
|
528
|
-
// 'order': 'text',
|
|
529
|
-
// 'account': 'text',
|
|
530
|
-
// 'password': 'text',
|
|
531
|
-
// 'name': 'text',
|
|
532
|
-
// 'email': 'text',
|
|
533
|
-
// 'description': 'text',
|
|
534
|
-
// 'from': 'text',
|
|
535
|
-
// 'redir': 'text',
|
|
536
|
-
// 'isAdmin': 'text',
|
|
537
|
-
// 'isVerified': 'text',
|
|
538
|
-
// 'timeVerified': 'text',
|
|
539
|
-
// 'timeExpired': 'text',
|
|
540
|
-
// 'timeBlocked': 'text',
|
|
541
|
-
// 'userId': 'text',
|
|
542
|
-
// 'timeCreate': 'text',
|
|
543
|
-
// 'userIdUpdate': 'text',
|
|
544
|
-
// 'timeUpdate': 'text',
|
|
545
|
-
// 'isActive': 'text',
|
|
546
|
-
// },
|
|
547
|
-
// kpCellEditable,
|
|
548
|
-
// kpRowDrag,
|
|
549
|
-
// kpHeadCheckBox,
|
|
550
|
-
// kpHeadFilter: {
|
|
551
|
-
// 'password': false,
|
|
552
|
-
// },
|
|
553
|
-
// kpHeadSort: {
|
|
554
|
-
// 'password': false,
|
|
555
|
-
// },
|
|
556
|
-
// kpHeadFocusHighlight: { //雖然效果不完全, 但因按鈕與cell有padding可被點擊, 故還是需要開啟
|
|
557
|
-
// 'password': false,
|
|
558
|
-
// 'timeVerified': false,
|
|
559
|
-
// 'timeExpired': false,
|
|
560
|
-
// 'timeBlocked': false,
|
|
561
|
-
// },
|
|
562
|
-
// kpCellRender: {
|
|
563
|
-
// 'account': (v) => {
|
|
564
|
-
// // console.log('kpCellRender account', v)
|
|
565
|
-
|
|
566
|
-
// //err
|
|
567
|
-
// let err = get(vo.errItemsByAccount, v, '')
|
|
568
|
-
// // console.log(v, err)
|
|
569
|
-
|
|
570
|
-
// //check
|
|
571
|
-
// if (isestr(err)) {
|
|
572
|
-
// v = `
|
|
573
|
-
// <span title="${err}">
|
|
574
|
-
// <span style="color:#F57C00;">${cstr(v)}</span>
|
|
575
|
-
// <img style="vertical-align:sub; width:16px; height:16px;" src="${vo.$ui.getIcon('warning')}" />
|
|
576
|
-
// </span>
|
|
577
|
-
// `
|
|
578
|
-
// }
|
|
579
|
-
|
|
580
|
-
// return v
|
|
581
|
-
// },
|
|
582
|
-
// 'password': (v, k, r) => {
|
|
583
|
-
// // console.log('kpCellRender password', v, k, r)
|
|
584
|
-
|
|
585
|
-
// //id
|
|
586
|
-
// let id = get(r, 'id', '')
|
|
587
|
-
// // console.log('id', id, k, r)
|
|
588
|
-
|
|
589
|
-
// // `
|
|
590
|
-
// let t = `
|
|
591
|
-
// <div onclick="event.stopPropagation();event.preventDefault();" onmousedown="event.stopPropagation();event.preventDefault();">
|
|
592
|
-
// <button style="width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;" onclick="$vo.$dg.modifyItemPasswordById('${id}')">${vo.$t('userResetPassword')}</button>
|
|
593
|
-
// </div>
|
|
594
|
-
// `
|
|
595
|
-
|
|
596
|
-
// return t
|
|
597
|
-
// },
|
|
598
|
-
// 'email': (v) => {
|
|
599
|
-
// // console.log('kpCellRender email', v)
|
|
600
|
-
|
|
601
|
-
// //err
|
|
602
|
-
// let err = get(vo.errItemsByEmail, v, '')
|
|
603
|
-
// // console.log(v, err)
|
|
604
|
-
|
|
605
|
-
// //check
|
|
606
|
-
// if (isestr(err)) {
|
|
607
|
-
// v = `
|
|
608
|
-
// <span title="${err}">
|
|
609
|
-
// <span style="color:#F57C00;">${cstr(v)}</span>
|
|
610
|
-
// <img style="vertical-align:sub; width:16px; height:16px;" src="${vo.$ui.getIcon('warning')}" />
|
|
611
|
-
// </span>
|
|
612
|
-
// `
|
|
613
|
-
// }
|
|
614
|
-
|
|
615
|
-
// return v
|
|
616
|
-
// },
|
|
617
|
-
// 'redir': (v) => {
|
|
618
|
-
// // console.log('kpCellRender redir', v)
|
|
619
|
-
|
|
620
|
-
// //err
|
|
621
|
-
// let err = get(vo.errItemsByRedir, v, '')
|
|
622
|
-
// // console.log(v, err)
|
|
623
|
-
|
|
624
|
-
// //check
|
|
625
|
-
// if (isestr(err)) {
|
|
626
|
-
// v = `
|
|
627
|
-
// <span title="${err}">
|
|
628
|
-
// <span style="color:#F57C00;">${cstr(v)}</span>
|
|
629
|
-
// <img style="vertical-align:sub; width:16px; height:16px;" src="${vo.$ui.getIcon('warning')}" />
|
|
630
|
-
// </span>
|
|
631
|
-
// `
|
|
632
|
-
// }
|
|
633
|
-
|
|
634
|
-
// return v
|
|
635
|
-
// },
|
|
636
|
-
// 'isAdmin': (v, k, r) => {
|
|
637
|
-
// // console.log('kpCellRender isAdmin', v, k, r)
|
|
638
|
-
|
|
639
|
-
// //id
|
|
640
|
-
// let id = get(r, 'id', '')
|
|
641
|
-
// // console.log('id', id, k, r)
|
|
642
|
-
|
|
643
|
-
// let t = `
|
|
644
|
-
// <input type="checkbox" ${v === 'y' ? 'checked' : ''} onclick="$vo.$dg.toggleItemIsAdminById('${id}')" ${vo.isEditable ? '' : 'disabled'} />
|
|
645
|
-
// `
|
|
646
|
-
|
|
647
|
-
// return t
|
|
648
|
-
// },
|
|
649
|
-
// 'isVerified': (v, k, r) => {
|
|
650
|
-
// // console.log('kpCellRender isAdmin', v, k, r)
|
|
651
|
-
|
|
652
|
-
// //id
|
|
653
|
-
// let id = get(r, 'id', '')
|
|
654
|
-
// // console.log('id', id, k, r)
|
|
655
|
-
|
|
656
|
-
// let t = `
|
|
657
|
-
// <input type="checkbox" ${v === 'y' ? 'checked' : ''} onclick="$vo.$dg.toggleItemIsVerifiedById('${id}')" ${vo.isEditable ? '' : 'disabled'} />
|
|
658
|
-
// `
|
|
659
|
-
|
|
660
|
-
// return t
|
|
661
|
-
// },
|
|
662
|
-
// 'isActive': (v, k, r) => {
|
|
663
|
-
// // console.log('kpCellRender isActive', v, k, r)
|
|
664
|
-
|
|
665
|
-
// //id
|
|
666
|
-
// let id = get(r, 'id', '')
|
|
667
|
-
// // console.log('id', id, k, r)
|
|
668
|
-
|
|
669
|
-
// let t = `
|
|
670
|
-
// <input type="checkbox" ${v === 'y' ? 'checked' : ''} onclick="$vo.$dg.toggleItemIsActiveById('${id}')" ${vo.isEditable ? '' : 'disabled'} />
|
|
671
|
-
// `
|
|
672
|
-
|
|
673
|
-
// return t
|
|
674
|
-
// },
|
|
675
|
-
// 'timeVerified': (v, k, r) => {
|
|
676
|
-
// // console.log('kpCellRender timeVerified', v, k, r)
|
|
677
|
-
|
|
678
|
-
// //id
|
|
679
|
-
// let id = get(r, 'id', '')
|
|
680
|
-
// // console.log('id', id, k, r)
|
|
681
|
-
|
|
682
|
-
// //vv, vm
|
|
683
|
-
// let vv = ''
|
|
684
|
-
// let vm = vo.$t('userTimeEmpty')
|
|
685
|
-
// if (istimeTZ(v)) { //原始數據為timeTZ格式
|
|
686
|
-
// let vt = ot(v)
|
|
687
|
-
// vv = vt.format('YYYY-MM-DDTHH:mm')
|
|
688
|
-
// vm = vt.format('YYYY-MM-DD HH:mm')
|
|
689
|
-
// }
|
|
690
|
-
// // console.log('vv', vv)
|
|
691
|
-
// // console.log('vm', vm)
|
|
692
|
-
|
|
693
|
-
// // `
|
|
694
|
-
// let t = `
|
|
695
|
-
// <div onclick="event.stopPropagation();event.preventDefault();" onmousedown="event.stopPropagation();event.preventDefault();">
|
|
696
|
-
// <button style="width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;" onclick="$vo.$dg.modifyItemTimeVerifiedById(this,'${vv}','${id}')">${vm}</button>
|
|
697
|
-
// </div>
|
|
698
|
-
// `
|
|
699
|
-
|
|
700
|
-
// return t
|
|
701
|
-
// },
|
|
702
|
-
// 'timeExpired': (v, k, r) => {
|
|
703
|
-
// // console.log('kpCellRender timeExpired', v, k, r)
|
|
704
|
-
|
|
705
|
-
// //id
|
|
706
|
-
// let id = get(r, 'id', '')
|
|
707
|
-
// // console.log('id', id, k, r)
|
|
708
|
-
|
|
709
|
-
// //vv, vm
|
|
710
|
-
// let vv = ''
|
|
711
|
-
// let vm = vo.$t('userTimeEmpty')
|
|
712
|
-
// if (istimeTZ(v)) { //原始數據為timeTZ格式
|
|
713
|
-
// let vt = ot(v)
|
|
714
|
-
// vv = vt.format('YYYY-MM-DDTHH:mm')
|
|
715
|
-
// vm = vt.format('YYYY-MM-DD HH:mm')
|
|
716
|
-
// }
|
|
717
|
-
// // console.log('vv', vv)
|
|
718
|
-
// // console.log('vm', vm)
|
|
719
|
-
|
|
720
|
-
// // `
|
|
721
|
-
// let t = `
|
|
722
|
-
// <div onclick="event.stopPropagation();event.preventDefault();" onmousedown="event.stopPropagation();event.preventDefault();">
|
|
723
|
-
// <button style="width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;" onclick="$vo.$dg.modifyItemTimeExpiredById(this,'${vv}','${id}')">${vm}</button>
|
|
724
|
-
// </div>
|
|
725
|
-
// `
|
|
726
|
-
|
|
727
|
-
// return t
|
|
728
|
-
// },
|
|
729
|
-
// 'timeBlocked': (v, k, r) => {
|
|
730
|
-
// // console.log('kpCellRender timeBlocked', v, k, r)
|
|
731
|
-
|
|
732
|
-
// //id
|
|
733
|
-
// let id = get(r, 'id', '')
|
|
734
|
-
// // console.log('id', id, k, r)
|
|
735
|
-
|
|
736
|
-
// //vv, vm
|
|
737
|
-
// let vv = ''
|
|
738
|
-
// let vm = vo.$t('userTimeEmpty')
|
|
739
|
-
// if (istimeTZ(v)) { //原始數據為timeTZ格式
|
|
740
|
-
// let vt = ot(v)
|
|
741
|
-
// vv = vt.format('YYYY-MM-DDTHH:mm')
|
|
742
|
-
// vm = vt.format('YYYY-MM-DD HH:mm')
|
|
743
|
-
// }
|
|
744
|
-
// // console.log('vv', vv)
|
|
745
|
-
// // console.log('vm', vm)
|
|
746
|
-
|
|
747
|
-
// // `
|
|
748
|
-
// let t = `
|
|
749
|
-
// <div onclick="event.stopPropagation();event.preventDefault();" onmousedown="event.stopPropagation();event.preventDefault();">
|
|
750
|
-
// <button style="width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;" onclick="$vo.$dg.modifyItemTimeBlockedById(this,'${vv}','${id}')">${vm}</button>
|
|
751
|
-
// </div>
|
|
752
|
-
// `
|
|
753
|
-
|
|
754
|
-
// return t
|
|
755
|
-
// },
|
|
756
|
-
// },
|
|
757
|
-
// rowsChange: (rs) => {
|
|
758
|
-
// // console.log('rowsChange', rs)
|
|
759
|
-
// // console.log('rowsChange cloneDeep(vo.opt.rows)', cloneDeep(vo.opt.rows))
|
|
760
|
-
|
|
761
|
-
// //isModified
|
|
762
|
-
// vo.isModified = true
|
|
763
|
-
|
|
764
|
-
// },
|
|
765
|
-
// rowChecked: (rs) => {
|
|
766
|
-
// // console.log('rowChecked', rs)
|
|
767
|
-
// // console.log('rowChecked cloneDeep(vo.opt.rows)', cloneDeep(vo.opt.rows))
|
|
768
|
-
|
|
769
|
-
// //save itemsCheck
|
|
770
|
-
// vo.itemsCheck = cloneDeep(rs)
|
|
771
|
-
|
|
772
|
-
// },
|
|
773
|
-
// }
|
|
774
|
-
// // console.log('opt', opt)
|
|
775
|
-
|
|
776
|
-
// }
|
|
777
|
-
|
|
778
|
-
// //save
|
|
779
|
-
// vo.opt = opt
|
|
780
|
-
|
|
781
|
-
// },
|
|
782
|
-
|
|
783
|
-
// refresh: function() {
|
|
784
|
-
// let vo = this
|
|
785
|
-
|
|
786
|
-
// //cmp
|
|
787
|
-
// let cmp = get(vo, '$refs.rftable.$refs.$self')
|
|
788
|
-
// // console.log('cmp', cmp)
|
|
789
|
-
|
|
790
|
-
// //refresh, 因set不會觸發kpCellRender, 故須另外調用組件函數refresh, 進而觸發kpCellRender, 使能更新數據
|
|
791
|
-
// cmp.refresh()
|
|
792
|
-
|
|
793
|
-
// },
|
|
794
|
-
|
|
795
|
-
// toggleTabKeys: function() {
|
|
796
|
-
// let vo = this
|
|
797
|
-
|
|
798
|
-
// //cmp
|
|
799
|
-
// let cmp = get(vo, '$refs.rftable.$refs.$self')
|
|
800
|
-
// // console.log('cmp', cmp)
|
|
801
|
-
|
|
802
|
-
// //showKeys
|
|
803
|
-
// cmp.showKeys(vo.tabKeysShow)
|
|
804
|
-
// // console.log('tabKeysShow', vo.tabKeysShow)
|
|
805
|
-
|
|
806
|
-
// },
|
|
807
|
-
|
|
808
|
-
// modifyItemPasswordById: function(id) {
|
|
809
|
-
// // console.log('modifyItemPasswordById', id)
|
|
810
|
-
|
|
811
|
-
// let vo = this
|
|
812
|
-
|
|
813
|
-
// vo.$alert(`尚待開發`, { type: 'error' }) //bbb
|
|
814
|
-
|
|
815
|
-
// // //k
|
|
816
|
-
// // let k = 'password'
|
|
817
|
-
|
|
818
|
-
// // //check
|
|
819
|
-
// // if (!isestr(id)) {
|
|
820
|
-
// // vo.$alert(`${vo.$t('userEditNoUserId')}`, { type: 'error' })
|
|
821
|
-
// // return
|
|
822
|
-
// // }
|
|
823
|
-
|
|
824
|
-
// // //rows
|
|
825
|
-
// // let rows = get(vo, 'opt.rows', [])
|
|
826
|
-
|
|
827
|
-
// // //find
|
|
828
|
-
// // let r = null
|
|
829
|
-
// // let kr = null
|
|
830
|
-
// // each(rows, (v, k) => {
|
|
831
|
-
// // if (get(v, 'id', '') === id) {
|
|
832
|
-
// // r = v
|
|
833
|
-
// // kr = k
|
|
834
|
-
// // return false //跳出
|
|
835
|
-
// // }
|
|
836
|
-
// // })
|
|
837
|
-
|
|
838
|
-
// // //check
|
|
839
|
-
// // if (!iseobj(r)) {
|
|
840
|
-
// // vo.$alert(`${vo.$t('userEditNoUserData')}`, { type: 'error' })
|
|
841
|
-
// // return
|
|
842
|
-
// // }
|
|
843
|
-
|
|
844
|
-
// // //v
|
|
845
|
-
// // let _v = get(r, k, 'n')
|
|
846
|
-
// // let v = _v === 'y' ? 'n' : 'y'
|
|
847
|
-
// // // console.log(k, v)
|
|
848
|
-
|
|
849
|
-
// // //set
|
|
850
|
-
// // set(vo, `opt.rows[${kr}].${k}`, v)
|
|
851
|
-
// // // console.log('vo.opt.rows[kr]', cloneDeep(vo.opt.rows[kr]))
|
|
852
|
-
|
|
853
|
-
// // //refresh
|
|
854
|
-
// // vo.refresh()
|
|
855
|
-
|
|
856
|
-
// // //isModified
|
|
857
|
-
// // vo.isModified = true
|
|
858
|
-
|
|
859
|
-
// },
|
|
860
|
-
|
|
861
|
-
// toggleItemByKeyAndId: function(key, id) {
|
|
862
|
-
// // console.log('toggleItemByKeyAndId', key, id)
|
|
863
|
-
|
|
864
|
-
// let vo = this
|
|
865
|
-
|
|
866
|
-
// //check
|
|
867
|
-
// if (!isestr(id)) {
|
|
868
|
-
// vo.$alert(`${vo.$t('userEditNoUserId')}`, { type: 'error' })
|
|
869
|
-
// return
|
|
870
|
-
// }
|
|
871
|
-
|
|
872
|
-
// //rows
|
|
873
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
874
|
-
|
|
875
|
-
// //find
|
|
876
|
-
// let r = null
|
|
877
|
-
// let kr = null
|
|
878
|
-
// each(rows, (v, k) => {
|
|
879
|
-
// if (get(v, 'id', '') === id) {
|
|
880
|
-
// r = v
|
|
881
|
-
// kr = k
|
|
882
|
-
// return false //跳出
|
|
883
|
-
// }
|
|
884
|
-
// })
|
|
885
|
-
|
|
886
|
-
// //check
|
|
887
|
-
// if (!iseobj(r)) {
|
|
888
|
-
// vo.$alert(`${vo.$t('userEditNoUserData')}`, { type: 'error' })
|
|
889
|
-
// return
|
|
890
|
-
// }
|
|
891
|
-
|
|
892
|
-
// //v
|
|
893
|
-
// let _v = get(r, key, 'n')
|
|
894
|
-
// let v = _v === 'y' ? 'n' : 'y'
|
|
895
|
-
// // console.log(key, v)
|
|
896
|
-
|
|
897
|
-
// //set
|
|
898
|
-
// set(vo, `opt.rows[${kr}].${key}`, v)
|
|
899
|
-
// // console.log('vo.opt.rows[kr]', cloneDeep(vo.opt.rows[kr]))
|
|
900
|
-
|
|
901
|
-
// //refresh
|
|
902
|
-
// vo.refresh()
|
|
903
|
-
|
|
904
|
-
// //isModified
|
|
905
|
-
// vo.isModified = true
|
|
906
|
-
|
|
907
|
-
// },
|
|
908
|
-
|
|
909
|
-
// toggleItemIsAdminById: function(id) {
|
|
910
|
-
// // console.log('toggleItemIsAdminById', id)
|
|
911
|
-
|
|
912
|
-
// let vo = this
|
|
913
|
-
|
|
914
|
-
// //toggleItemByKeyAndId
|
|
915
|
-
// vo.toggleItemByKeyAndId('isAdmin', id)
|
|
916
|
-
|
|
917
|
-
// },
|
|
918
|
-
|
|
919
|
-
// toggleItemIsVerifiedById: function(id) {
|
|
920
|
-
// // console.log('toggleItemIsVerifiedById', id)
|
|
921
|
-
|
|
922
|
-
// let vo = this
|
|
923
|
-
|
|
924
|
-
// //toggleItemByKeyAndId
|
|
925
|
-
// vo.toggleItemByKeyAndId('isVerified', id)
|
|
926
|
-
|
|
927
|
-
// },
|
|
928
|
-
|
|
929
|
-
// toggleItemIsActiveById: function(id) {
|
|
930
|
-
// // console.log('toggleItemIsActiveById', id)
|
|
931
|
-
|
|
932
|
-
// let vo = this
|
|
933
|
-
|
|
934
|
-
// //toggleItemByKeyAndId
|
|
935
|
-
// vo.toggleItemByKeyAndId('isActive', id)
|
|
936
|
-
|
|
937
|
-
// },
|
|
938
|
-
|
|
939
|
-
// modifyItemByKeyAndId: function(key, ele, t, id) {
|
|
940
|
-
// // console.log('modifyItemTimeVerifiedById', ele, t, id)
|
|
941
|
-
|
|
942
|
-
// let vo = this
|
|
943
|
-
|
|
944
|
-
// //check
|
|
945
|
-
// if (!isestr(id)) {
|
|
946
|
-
// vo.$alert(`${vo.$t('userEditNoUserId')}`, { type: 'error' })
|
|
947
|
-
// return
|
|
948
|
-
// }
|
|
949
|
-
|
|
950
|
-
// //timePrev
|
|
951
|
-
// let timePrev = ''
|
|
952
|
-
// if (istime(t)) {
|
|
953
|
-
// timePrev = t
|
|
954
|
-
// }
|
|
955
|
-
|
|
956
|
-
// //domShowInputDatatime
|
|
957
|
-
// let type = 'datetime-local' //'datetime-local', 'date'
|
|
958
|
-
// domShowInputDatatime(timePrev, { eleRef: ele, type })
|
|
959
|
-
// .then((timeNew) => {
|
|
960
|
-
// // console.log(k, 'timeNew', timeNew)
|
|
961
|
-
|
|
962
|
-
// //rows
|
|
963
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
964
|
-
|
|
965
|
-
// //find
|
|
966
|
-
// let r = null
|
|
967
|
-
// let kr = null
|
|
968
|
-
// each(rows, (v, k) => {
|
|
969
|
-
// if (get(v, 'id', '') === id) {
|
|
970
|
-
// r = v
|
|
971
|
-
// kr = k
|
|
972
|
-
// return false //跳出
|
|
973
|
-
// }
|
|
974
|
-
// })
|
|
975
|
-
|
|
976
|
-
// //check
|
|
977
|
-
// if (!iseobj(r)) {
|
|
978
|
-
// vo.$alert(`${vo.$t('userEditNoUserData')}`, { type: 'error' })
|
|
979
|
-
// return
|
|
980
|
-
// }
|
|
981
|
-
|
|
982
|
-
// //v
|
|
983
|
-
// let vt = ot(timeNew, 'YYYY-MM-DDTHH:mm') //domShowInputDatatime數據為年月日時分
|
|
984
|
-
// let v = vt.format('YYYY-MM-DDTHH:mm:ssZ') //轉回原始數據為timeTZ格式
|
|
985
|
-
// // console.log('v', v)
|
|
986
|
-
|
|
987
|
-
// //set
|
|
988
|
-
// set(vo, `opt.rows[${kr}].${key}`, v)
|
|
989
|
-
// // console.log('vo.opt.rows[kr]', cloneDeep(vo.opt.rows[kr]))
|
|
990
|
-
|
|
991
|
-
// //refresh
|
|
992
|
-
// vo.refresh()
|
|
993
|
-
|
|
994
|
-
// //isModified
|
|
995
|
-
// vo.isModified = true
|
|
996
|
-
|
|
997
|
-
// })
|
|
998
|
-
|
|
999
|
-
// },
|
|
1000
|
-
|
|
1001
|
-
// modifyItemTimeVerifiedById: function(ele, t, id) {
|
|
1002
|
-
// // console.log('modifyItemTimeVerifiedById', ele, t, id)
|
|
1003
|
-
|
|
1004
|
-
// let vo = this
|
|
1005
|
-
|
|
1006
|
-
// //modifyItemByKeyAndId
|
|
1007
|
-
// vo.modifyItemByKeyAndId('timeVerified', ele, t, id)
|
|
1008
|
-
|
|
1009
|
-
// },
|
|
1010
|
-
|
|
1011
|
-
// modifyItemTimeExpiredById: function(ele, t, id) {
|
|
1012
|
-
// // console.log('modifyItemTimeExpiredById', ele, t, id)
|
|
1013
|
-
|
|
1014
|
-
// let vo = this
|
|
1015
|
-
|
|
1016
|
-
// //modifyItemByKeyAndId
|
|
1017
|
-
// vo.modifyItemByKeyAndId('timeExpired', ele, t, id)
|
|
1018
|
-
|
|
1019
|
-
// },
|
|
1020
|
-
|
|
1021
|
-
// modifyItemTimeBlockedById: function(ele, t, id) {
|
|
1022
|
-
// // console.log('modifyItemTimeBlockedById', ele, t, id)
|
|
1023
|
-
|
|
1024
|
-
// let vo = this
|
|
1025
|
-
|
|
1026
|
-
// //modifyItemByKeyAndId
|
|
1027
|
-
// vo.modifyItemByKeyAndId('timeBlocked', ele, t, id)
|
|
1028
|
-
|
|
1029
|
-
// },
|
|
1030
|
-
|
|
1031
|
-
// addItem: function() {
|
|
1032
|
-
// // console.log('method addItem')
|
|
1033
|
-
|
|
1034
|
-
// let vo = this
|
|
1035
|
-
|
|
1036
|
-
// //cloneDeep
|
|
1037
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
1038
|
-
|
|
1039
|
-
// //cloneDeep
|
|
1040
|
-
// rows = cloneDeep(rows)
|
|
1041
|
-
|
|
1042
|
-
// //r
|
|
1043
|
-
// let r = vo.$ds.users.funNew()
|
|
1044
|
-
// r.name = vo.$s.getNameNew(rows, 'name', '', vo.$t('userAddNameNew'))
|
|
1045
|
-
// r.userId = `{${vo.$t('userAddIdNew')}}`
|
|
1046
|
-
// r.timeCreate = `{${vo.$t('userAddIdNew')}}`
|
|
1047
|
-
// r.userIdUpdate = `{${vo.$t('userAddIdNew')}}`
|
|
1048
|
-
// r.timeUpdate = `{${vo.$t('userAddIdNew')}}`
|
|
1049
|
-
// // console.log('r', r)
|
|
1050
|
-
|
|
1051
|
-
// //添加至最首
|
|
1052
|
-
// rows = [
|
|
1053
|
-
// r,
|
|
1054
|
-
// ...rows,
|
|
1055
|
-
// ]
|
|
1056
|
-
|
|
1057
|
-
// //save
|
|
1058
|
-
// vo.users = cloneDeep(rows) //直接更新由getUsersList取得的users, 連帶驅動computed重算, 故不用另外更新vo.items與vo.opt.rows
|
|
1059
|
-
// // console.log('cloneDeep(vo.users)', cloneDeep(vo.users))
|
|
1060
|
-
|
|
1061
|
-
// //isModified
|
|
1062
|
-
// vo.isModified = true
|
|
1063
|
-
|
|
1064
|
-
// },
|
|
1065
|
-
|
|
1066
|
-
// copyItem: function() {
|
|
1067
|
-
// // console.log('method copyItem')
|
|
1068
|
-
|
|
1069
|
-
// let vo = this
|
|
1070
|
-
|
|
1071
|
-
// //check
|
|
1072
|
-
// if (size(vo.itemsCheck) !== 1) {
|
|
1073
|
-
// console.log(`size(vo.itemsCheck) !== 1`, vo.itemsCheck)
|
|
1074
|
-
// vo.$alert(`${vo.$t('anUnexpectedErrorOccurred')}`, { type: 'error' })
|
|
1075
|
-
// return
|
|
1076
|
-
// }
|
|
1077
|
-
|
|
1078
|
-
// //cloneDeep
|
|
1079
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
1080
|
-
|
|
1081
|
-
// //cloneDeep
|
|
1082
|
-
// rows = cloneDeep(rows)
|
|
1083
|
-
|
|
1084
|
-
// //find
|
|
1085
|
-
// let tar = vo.itemsCheck[0]
|
|
1086
|
-
// let tarId = get(tar, 'data.id', '')
|
|
1087
|
-
// let row = null
|
|
1088
|
-
// each(rows, (v) => {
|
|
1089
|
-
// let id = get(v, 'id', '')
|
|
1090
|
-
// if (id === tarId) {
|
|
1091
|
-
// row = v
|
|
1092
|
-
// return false //跳出
|
|
1093
|
-
// }
|
|
1094
|
-
// })
|
|
1095
|
-
// // console.log('tar', tar)
|
|
1096
|
-
// // console.log('row', row)
|
|
1097
|
-
|
|
1098
|
-
// //check
|
|
1099
|
-
// if (!iseobj(row)) {
|
|
1100
|
-
// console.log(`!iseobj(row)`, row)
|
|
1101
|
-
// vo.$alert(`${vo.$t('anUnexpectedErrorOccurred')}`, { type: 'error' })
|
|
1102
|
-
// return
|
|
1103
|
-
// }
|
|
1104
|
-
|
|
1105
|
-
// //r
|
|
1106
|
-
// let r = cloneDeep(row)
|
|
1107
|
-
// // let nameOld = r.name
|
|
1108
|
-
// let _r = vo.$ds.users.funNew()
|
|
1109
|
-
// r.id = _r.id //使用新建方式預先產生id避免重複
|
|
1110
|
-
// // r.name = vo.$s.getNameNew(rows, 'name', nameOld, vo.$t('userCopyNameNew'))
|
|
1111
|
-
// r.userId = `{${vo.$t('userAddIdNew')}}`
|
|
1112
|
-
// r.timeCreate = `{${vo.$t('userAddIdNew')}}`
|
|
1113
|
-
// r.userIdUpdate = `{${vo.$t('userAddIdNew')}}`
|
|
1114
|
-
// r.timeUpdate = `{${vo.$t('userAddIdNew')}}`
|
|
1115
|
-
// // console.log('r', r)
|
|
1116
|
-
|
|
1117
|
-
// //添加至最首
|
|
1118
|
-
// rows = [
|
|
1119
|
-
// r,
|
|
1120
|
-
// ...rows,
|
|
1121
|
-
// ]
|
|
1122
|
-
|
|
1123
|
-
// //save
|
|
1124
|
-
// vo.users = cloneDeep(rows) //直接更新由getUsersList取得的users, 連帶驅動computed重算, 故不用另外更新vo.items與vo.opt.rows
|
|
1125
|
-
// // console.log('cloneDeep(vo.users)', cloneDeep(vo.users))
|
|
1126
|
-
|
|
1127
|
-
// //isModified
|
|
1128
|
-
// vo.isModified = true
|
|
1129
|
-
|
|
1130
|
-
// },
|
|
1131
|
-
|
|
1132
|
-
// deleteItemsCheck: function() {
|
|
1133
|
-
// // console.log('method deleteItemsCheck')
|
|
1134
|
-
|
|
1135
|
-
// let vo = this
|
|
1136
|
-
|
|
1137
|
-
// //check
|
|
1138
|
-
// if (size(vo.itemsCheck) === 0) {
|
|
1139
|
-
// console.log(`size(vo.itemsCheck) === 0`, vo.itemsCheck)
|
|
1140
|
-
// vo.$alert(`${vo.$t('anUnexpectedErrorOccurred')}`, { type: 'error' })
|
|
1141
|
-
// return
|
|
1142
|
-
// }
|
|
1143
|
-
|
|
1144
|
-
// //cloneDeep
|
|
1145
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
1146
|
-
|
|
1147
|
-
// //cloneDeep
|
|
1148
|
-
// rows = cloneDeep(rows)
|
|
1149
|
-
|
|
1150
|
-
// //filter
|
|
1151
|
-
// each(vo.itemsCheck, (v) => {
|
|
1152
|
-
// // console.log('v', v)
|
|
1153
|
-
// let id = get(v, 'data.id', '')
|
|
1154
|
-
// if (!isestr(id)) {
|
|
1155
|
-
// console.log(`invalid id`)
|
|
1156
|
-
// return true //跳出換下一個
|
|
1157
|
-
// }
|
|
1158
|
-
// rows = filter(rows, (vv) => {
|
|
1159
|
-
// return vv.id !== id
|
|
1160
|
-
// })
|
|
1161
|
-
// })
|
|
1162
|
-
|
|
1163
|
-
// //clear
|
|
1164
|
-
// vo.itemsCheck = []
|
|
1165
|
-
|
|
1166
|
-
// //save
|
|
1167
|
-
// vo.users = cloneDeep(rows) //直接更新由getUsersList取得的users, 連帶驅動computed重算, 故不用另外更新vo.items與vo.opt.rows
|
|
1168
|
-
// // console.log('cloneDeep(vo.users)', cloneDeep(vo.users))
|
|
1169
|
-
|
|
1170
|
-
// //isModified
|
|
1171
|
-
// vo.isModified = true
|
|
1172
|
-
|
|
1173
|
-
// },
|
|
1174
|
-
|
|
1175
|
-
// saveUsers: function() {
|
|
1176
|
-
// // console.log('method saveUsers')
|
|
1177
|
-
|
|
1178
|
-
// let vo = this
|
|
1179
|
-
|
|
1180
|
-
// async function core() {
|
|
1181
|
-
// let errTemp = null
|
|
1182
|
-
|
|
1183
|
-
// //show loading
|
|
1184
|
-
// vo.$ui.updateLoading(true)
|
|
1185
|
-
|
|
1186
|
-
// //check
|
|
1187
|
-
// if (isestr(vo.isError)) {
|
|
1188
|
-
// vo.$alert(`${vo.isError}`, { type: 'error' })
|
|
1189
|
-
// return
|
|
1190
|
-
// }
|
|
1191
|
-
|
|
1192
|
-
// //rows
|
|
1193
|
-
// let rows = get(vo, 'opt.rows', [])
|
|
1194
|
-
|
|
1195
|
-
// //check
|
|
1196
|
-
// if (size(rows) === 0) {
|
|
1197
|
-
// vo.$alert(`${vo.$t('userAddEmpty')}`, { type: 'error' })
|
|
1198
|
-
// return
|
|
1199
|
-
// }
|
|
1200
|
-
|
|
1201
|
-
// //token
|
|
1202
|
-
// let token = vo.userToken
|
|
1203
|
-
// // console.log('token', token)
|
|
1204
|
-
|
|
1205
|
-
// //updateUsersList
|
|
1206
|
-
// await vo.$fapi.updateUsersList(token, rows)
|
|
1207
|
-
// .catch((err) => {
|
|
1208
|
-
// errTemp = err
|
|
1209
|
-
// })
|
|
1210
|
-
|
|
1211
|
-
// //check
|
|
1212
|
-
// if (errTemp !== null) {
|
|
1213
|
-
// vo.$alert(`${vo.$t('userSaveUsersFail')}: ${errTemp}`, { type: 'error' })
|
|
1214
|
-
// return
|
|
1215
|
-
// }
|
|
1216
|
-
|
|
1217
|
-
// //isModified
|
|
1218
|
-
// vo.isModified = false
|
|
1219
|
-
|
|
1220
|
-
// //alert
|
|
1221
|
-
// vo.$alert(vo.$t('userSaveUsersSuccess'))
|
|
1222
|
-
|
|
1223
|
-
// }
|
|
1224
|
-
|
|
1225
|
-
// //core
|
|
1226
|
-
// core()
|
|
1227
|
-
// // .then((res) => {
|
|
1228
|
-
// // console.log('then', res)
|
|
1229
|
-
// // })
|
|
1230
|
-
// .catch((err) => {
|
|
1231
|
-
// console.log('catch', err)
|
|
1232
|
-
// vo.$alert(vo.$t('anUnexpectedErrorOccurred'), { type: 'error' })
|
|
1233
|
-
// })
|
|
1234
|
-
// .finally(() => {
|
|
1235
|
-
|
|
1236
|
-
// //hide loading
|
|
1237
|
-
// vo.$ui.updateLoading(false)
|
|
1238
|
-
|
|
1239
|
-
// })
|
|
1240
|
-
|
|
1241
|
-
// },
|
|
1242
|
-
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
</script>
|
|
1246
|
-
|
|
1247
|
-
<style scoped>
|
|
1248
|
-
</style>
|