fstarter 2.10.42 → 2.10.46
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/.babelrc +6 -6
- package/.editorconfig +9 -9
- package/README.md +18 -18
- package/fstarter.iml +9 -0
- package/index.html +22 -22
- package/index.js +222 -222
- package/package.json +104 -104
- package/src/App.vue +38 -38
- package/src/i18n/en-US.js +35 -35
- package/src/i18n/zh-CN.js +35 -35
- package/src/main.js +87 -87
- package/src/plugins/assets/ak.js +948 -948
- package/src/plugins/assets/callNative.js +488 -488
- package/src/plugins/assets/compressImg.js +75 -75
- package/src/plugins/assets/config.js +106 -106
- package/src/plugins/assets/fileServer.js +469 -469
- package/src/plugins/assets/http.js +343 -343
- package/src/plugins/assets/ua.js +27 -27
- package/src/plugins/components/BSButton.vue +61 -61
- package/src/plugins/components/BSCascader.vue +465 -465
- package/src/plugins/components/BSCell.vue +48 -48
- package/src/plugins/components/BSDatePicker.vue +167 -165
- package/src/plugins/components/BSImage.vue +42 -42
- package/src/plugins/components/BSInput.vue +140 -140
- package/src/plugins/components/BSList.vue +81 -81
- package/src/plugins/components/BSPicCode.vue +96 -96
- package/src/plugins/components/BSPopup.vue +43 -43
- package/src/plugins/components/BSRadio.vue +97 -97
- package/src/plugins/components/BSSearch.vue +109 -109
- package/src/plugins/components/BSSelect.vue +144 -144
- package/src/plugins/components/BSSign.vue +454 -454
- package/src/plugins/components/BSStepper.vue +115 -115
- package/src/plugins/components/BSUpload.vue +92 -92
- package/src/plugins/components/BSUpload2.vue +382 -382
- package/src/plugins/components/BSVerCode.vue +131 -134
- package/src/plugins/components/BSViewer.vue +92 -92
- package/src/plugins/components/base.js +496 -496
- package/src/plugins/components/base2.js +489 -489
- package/src/plugins/lib/weixin.js +20 -20
- package/src/plugins/platform/index.js +7 -7
- package/src/plugins/platform/isp_phone.js +306 -306
- package/src/plugins/route/index.js +140 -140
- package/src/plugins/selector/index.js +342 -342
- package/src/plugins/service/index.js +81 -81
- package/src/plugins/services/callCamera.js +53 -53
- package/src/plugins/services/exit.js +36 -36
- package/src/plugins/services/face.js +69 -69
- package/src/plugins/services/faceInApp.js +31 -31
- package/src/plugins/services/getFaceResult.js +104 -104
- package/src/plugins/services/getMenus.js +40 -40
- package/src/plugins/services/getSystemData.js +128 -128
- package/src/plugins/services/getToken.js +79 -79
- package/src/plugins/services/getUserInfo.js +47 -47
- package/src/plugins/services/goSetPage.js +40 -40
- package/src/plugins/services/hideFhoneTitle.js +36 -36
- package/src/plugins/services/index.js +37 -37
- package/src/plugins/services/init.js +35 -35
- package/src/plugins/services/jumpView.js +40 -40
- package/src/plugins/services/logout.js +43 -43
- package/src/plugins/services/share.js +113 -113
- package/src/plugins/services/statusBarHeight.js +39 -39
- package/src/plugins/session/index.js +32 -32
- package/src/services/getAuthInfo.js +22 -22
- package/src/services/index.js +9 -9
- package/src/services/sendVerCode.js +23 -23
- package/src/views/auth.vue +354 -353
- package/src/views/auth2.vue +90 -90
- package/src/views/auth3.vue +148 -148
- package/src/views/auth4.vue +8979 -8979
- package/src/views/auth5.vue +50 -50
- package/src/views/components/BankSelect.vue +55 -55
- package/src/views/foot.vue +140 -140
- package/src/views/page.vue +219 -219
- package/src/views/shellFunc.vue +41 -41
- package/themes/basic.css +1 -1
- package/webpack.config.js +144 -144
|
@@ -1,489 +1,489 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
import { fromEvent } from 'rxjs';
|
|
3
|
-
import {take} from 'rxjs/operators';
|
|
4
|
-
import ak from '../assets/ak.js'
|
|
5
|
-
import service from '../service';
|
|
6
|
-
import session from '../session'
|
|
7
|
-
import config from '../assets/config.js'
|
|
8
|
-
import selector from "../selector";
|
|
9
|
-
import {ua} from "../assets/ua";
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
props: {
|
|
13
|
-
value: {
|
|
14
|
-
type: Object,
|
|
15
|
-
default: () => {
|
|
16
|
-
return {default:true}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
mod: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: () => {
|
|
22
|
-
return {default:true}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
cname:{
|
|
26
|
-
type: String
|
|
27
|
-
},
|
|
28
|
-
cusValidate:{
|
|
29
|
-
type: Function
|
|
30
|
-
},
|
|
31
|
-
textRender:{
|
|
32
|
-
type: Function
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
data() {
|
|
36
|
-
return {
|
|
37
|
-
fullName:undefined,
|
|
38
|
-
sname:undefined,
|
|
39
|
-
isExtend:false,
|
|
40
|
-
model:{
|
|
41
|
-
hiddenValidate:false,
|
|
42
|
-
validateResult:{
|
|
43
|
-
messages:[],
|
|
44
|
-
message:'',
|
|
45
|
-
isSuccess:true,
|
|
46
|
-
pending:false
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
modelData:{}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
mounted() {
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
if(!this.$parent.$data.isExtend){
|
|
56
|
-
this.processModel()
|
|
57
|
-
}*/
|
|
58
|
-
|
|
59
|
-
this.processModel()
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
methods: {
|
|
63
|
-
createDefaultModel2(){
|
|
64
|
-
|
|
65
|
-
let model2 = {
|
|
66
|
-
label: '',
|
|
67
|
-
tag:'',
|
|
68
|
-
data: {},
|
|
69
|
-
visible:true,
|
|
70
|
-
readonly: false,
|
|
71
|
-
disabled: false,
|
|
72
|
-
required: false,
|
|
73
|
-
clearable: true,
|
|
74
|
-
validateType: '',
|
|
75
|
-
validateGroup: '',
|
|
76
|
-
validateReg: '',
|
|
77
|
-
inputAlign: 'left',
|
|
78
|
-
validateToken: 0,
|
|
79
|
-
validateResult: {
|
|
80
|
-
messages: [],
|
|
81
|
-
message: '',
|
|
82
|
-
isSuccess: true,
|
|
83
|
-
pending: false
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if(this.$options.methods.createDefaultModel){
|
|
88
|
-
return Object.assign(this.$options.methods.createDefaultModel(),model2)
|
|
89
|
-
}else{
|
|
90
|
-
return model2
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
getGobalfullName(){
|
|
95
|
-
|
|
96
|
-
let sysflag = 'normal'
|
|
97
|
-
if(ua.isIspPhone){
|
|
98
|
-
sysflag = 'ispPhone'
|
|
99
|
-
}else if(ua.microMsg){
|
|
100
|
-
sysflag = 'microMsg'
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return config.sys.id + '.' + sysflag + '.' + this.fullName
|
|
104
|
-
},
|
|
105
|
-
saveLocalValue(val){
|
|
106
|
-
if('local_storage' in config.other && config.other.local_storage === 'true'){
|
|
107
|
-
let json = JSON.stringify(val)
|
|
108
|
-
localStorage.setItem(this.getGobalfullName(),json)
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
processModel(pmodel){
|
|
112
|
-
|
|
113
|
-
this.fullName = this.getCtlName(this)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
let hasValue = false
|
|
117
|
-
if(this.$props.mod.default === true){
|
|
118
|
-
this.modelData = this.createDefaultModel2()
|
|
119
|
-
}else{
|
|
120
|
-
let defaultModel = this.createDefaultModel2()
|
|
121
|
-
|
|
122
|
-
if(pmodel){
|
|
123
|
-
hasValue = 'value' in pmodel
|
|
124
|
-
this.modelData = Object.assign({},defaultModel,pmodel)
|
|
125
|
-
}else{
|
|
126
|
-
hasValue = 'value' in this.$props.mod
|
|
127
|
-
this.modelData = Object.assign({},defaultModel,this.$props.mod)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if('local_storage' in config.other && config.other.local_storage === 'true'){
|
|
132
|
-
if(!hasValue) {
|
|
133
|
-
let sv = localStorage.getItem(this.getGobalfullName())
|
|
134
|
-
if(!ak.utils.isEmpty(sv)){
|
|
135
|
-
this.modelData.value = JSON.parse(sv)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.modelData = this.locale(this.modelData)
|
|
141
|
-
this.model = ak.utils.cloneBySerialize(this.modelData)
|
|
142
|
-
|
|
143
|
-
if(!this.isExtend){
|
|
144
|
-
this.$set(session.regedit,this.fullName,{model:this.model,ctl:this,name:this.fullName})
|
|
145
|
-
selector.index_add(this.sname,this.fullName)
|
|
146
|
-
console.log('regedit component ' + this.fullName)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
getCtlName(ctl){
|
|
151
|
-
|
|
152
|
-
if(!ctl.$props)
|
|
153
|
-
return ''
|
|
154
|
-
|
|
155
|
-
let ctlName = ctl.$ak.utils.isEmpty(ctl.$props.cname) ? ctl.$data.vname : ctl.$props.cname
|
|
156
|
-
|
|
157
|
-
if(ctl.$data.isExtend){
|
|
158
|
-
return ''
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if(ak.utils.isEmpty(ctlName)){
|
|
162
|
-
ctlName = ak.utils.guid2()
|
|
163
|
-
}
|
|
164
|
-
ctlName = ctlName.replace(/RNUM/, ak.utils.guid2())
|
|
165
|
-
|
|
166
|
-
this.sname = ctlName
|
|
167
|
-
|
|
168
|
-
if(ak.utils.isEmpty(ctlName)){
|
|
169
|
-
return ''
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
let parentName_s = undefined
|
|
173
|
-
let parent = ctl.$parent
|
|
174
|
-
while(parent){
|
|
175
|
-
|
|
176
|
-
// console.log("fullname:" + parent.$options._componentTag + "----" + parent.$data.vname + "-----" + parent.$data.fullName)
|
|
177
|
-
if(!this.$ak.utils.isEmpty(parent.$data.fullName)){
|
|
178
|
-
parentName_s = parent.$data.fullName
|
|
179
|
-
break
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if(!(parent.$options.methods && Object.prototype.toString.call(parent.$options.methods.getCtlName) == "[object Function]")){
|
|
183
|
-
parent = parent.$parent
|
|
184
|
-
continue
|
|
185
|
-
}else if(parent.$data.isExtend){
|
|
186
|
-
parent = parent.$parent
|
|
187
|
-
continue
|
|
188
|
-
}else{
|
|
189
|
-
break
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if(parent){
|
|
195
|
-
|
|
196
|
-
let parentName = undefined
|
|
197
|
-
if(parentName_s){
|
|
198
|
-
parentName = parentName_s
|
|
199
|
-
}else{
|
|
200
|
-
parentName = parent.$options.methods.getCtlName.bind(parent)(parent)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
let parent2 = ctl.$parent
|
|
204
|
-
while(parent2){
|
|
205
|
-
|
|
206
|
-
if(!this.$ak.utils.isEmpty(parent2.$data.fullName)){
|
|
207
|
-
break
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if(!(parent2.$options.methods && Object.prototype.toString.call(parent2.$options.methods.getCtlName) == "[object Function]")){
|
|
211
|
-
|
|
212
|
-
parent2.$data.fullName = parentName
|
|
213
|
-
parent2 = parent2.$parent
|
|
214
|
-
continue
|
|
215
|
-
}else if(parent2.$data.isExtend){
|
|
216
|
-
|
|
217
|
-
parent2.$data.fullName = parentName
|
|
218
|
-
parent2 = parent2.$parent
|
|
219
|
-
continue
|
|
220
|
-
}else{
|
|
221
|
-
break
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if(ctl.$ak.utils.isEmpty(parentName)){
|
|
226
|
-
return ctlName
|
|
227
|
-
}else{
|
|
228
|
-
return parentName + '.' + ctlName
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
}else{
|
|
232
|
-
return ctlName
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
},
|
|
236
|
-
validate(useAll){
|
|
237
|
-
|
|
238
|
-
let firedvalidate = this.$ak.utils.isEmpty(useAll) ? false : useAll
|
|
239
|
-
let promiseV
|
|
240
|
-
|
|
241
|
-
this.model.validateResult.messages = []
|
|
242
|
-
this.model.validateResult.isSuccess = false
|
|
243
|
-
|
|
244
|
-
let value = this.model.value
|
|
245
|
-
|
|
246
|
-
if(this.$ak.utils.isEmpty(this.model.disabled) || !this.model.disabled){
|
|
247
|
-
|
|
248
|
-
if(this.model.required){
|
|
249
|
-
if(this.$ak.utils.isEmpty(value)){
|
|
250
|
-
|
|
251
|
-
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '不能为空',level:8})
|
|
252
|
-
this.settle(this)
|
|
253
|
-
return Promise.resolve()
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if(!this.$ak.utils.isEmpty(value)){
|
|
260
|
-
|
|
261
|
-
if(!this.model.validateType == ''){
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if(this.model.validateType == 'EMAIL'){
|
|
265
|
-
|
|
266
|
-
if(!this.$ak.utils.isEmail(value)){
|
|
267
|
-
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
this.settle(this)
|
|
271
|
-
|
|
272
|
-
}else if(this.model.validateType == 'MONEY'){
|
|
273
|
-
|
|
274
|
-
if(!this.$ak.utils.isEmail(value)){
|
|
275
|
-
|
|
276
|
-
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
this.settle(this)
|
|
280
|
-
|
|
281
|
-
}else if(this.model.validateType == 'REG'){
|
|
282
|
-
|
|
283
|
-
var reg = new RegExp(this.model.validateReg);
|
|
284
|
-
if(!reg.test(value)){
|
|
285
|
-
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
this.settle(this)
|
|
289
|
-
|
|
290
|
-
}else if(this.model.validateType == 'CUS'){
|
|
291
|
-
|
|
292
|
-
let validating = this.locale('lang.base.validate.validating')
|
|
293
|
-
this.model.validateResult.message = validating
|
|
294
|
-
this.model.validateResult.pending = true
|
|
295
|
-
|
|
296
|
-
let vc = this.$props.cusValidate.bind(this)
|
|
297
|
-
let self = this
|
|
298
|
-
let pro = vc({value:value,fullName:this.fullName},this.model)
|
|
299
|
-
|
|
300
|
-
if(Object.prototype.toString.call(pro) == "[object Promise]"){
|
|
301
|
-
|
|
302
|
-
promiseV = pro.then((res)=>{
|
|
303
|
-
|
|
304
|
-
if(!self.$ak.utils.isEmpty(res)){
|
|
305
|
-
res.id = this.fullName
|
|
306
|
-
self.model.validateResult.messages.push(res)
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
self.model.validateResult.pending = false
|
|
311
|
-
self.settle(self)
|
|
312
|
-
|
|
313
|
-
return Promise.resolve()
|
|
314
|
-
|
|
315
|
-
})
|
|
316
|
-
|
|
317
|
-
}else{
|
|
318
|
-
|
|
319
|
-
if(!self.$ak.utils.isEmpty(pro))
|
|
320
|
-
self.model.validateResult.messages.push(pro)
|
|
321
|
-
|
|
322
|
-
self.model.validateResult.pending = false
|
|
323
|
-
self.settle(self)
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
}else{
|
|
328
|
-
|
|
329
|
-
let validateTypeError = this.locale('lang.base.validate.validateTypeError')
|
|
330
|
-
this.model.validateResult.messages.push({'id': this.fullName ,message:validateTypeError,level:8})
|
|
331
|
-
this.settle(this)
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
}else{
|
|
335
|
-
this.settle(this)
|
|
336
|
-
}
|
|
337
|
-
}else{
|
|
338
|
-
|
|
339
|
-
this.model.validateResult.isSuccess = true
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if(promiseV)
|
|
344
|
-
return promiseV
|
|
345
|
-
else
|
|
346
|
-
return Promise.resolve()
|
|
347
|
-
|
|
348
|
-
},
|
|
349
|
-
settle(self){
|
|
350
|
-
|
|
351
|
-
let isSuccess = false
|
|
352
|
-
let message = ''
|
|
353
|
-
|
|
354
|
-
if(self.model.validateResult.messages.length > 0 ){
|
|
355
|
-
|
|
356
|
-
self.model.validateResult.messages.forEach((item, index) => {
|
|
357
|
-
|
|
358
|
-
isSuccess = isSuccess && item.level < 5
|
|
359
|
-
|
|
360
|
-
if(self.$ak.utils.isEmpty(message))
|
|
361
|
-
message = item.message
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
}else{
|
|
365
|
-
|
|
366
|
-
isSuccess = true
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
self.model.validateResult.isSuccess = isSuccess
|
|
371
|
-
self.model.validateResult.message = message
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
},
|
|
375
|
-
setEventString(id,name,attr,val,oldVal){
|
|
376
|
-
|
|
377
|
-
let event = {
|
|
378
|
-
'id':id,
|
|
379
|
-
'name':name,
|
|
380
|
-
'attr':attr,
|
|
381
|
-
'val':val,
|
|
382
|
-
'oldVal':oldVal
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
session.regeditc = JSON.stringify(event)
|
|
386
|
-
},
|
|
387
|
-
locale(obj){
|
|
388
|
-
|
|
389
|
-
if(Object.prototype.toString.call(obj) == '[object Object]'){
|
|
390
|
-
|
|
391
|
-
for(let key in obj){
|
|
392
|
-
obj[key] = this.locale(obj[key])
|
|
393
|
-
}
|
|
394
|
-
return obj
|
|
395
|
-
|
|
396
|
-
}else if(Object.prototype.toString.call(obj) == '[object Array]'){
|
|
397
|
-
|
|
398
|
-
for(let key in obj){
|
|
399
|
-
obj[key] = this.locale(obj[key])
|
|
400
|
-
}
|
|
401
|
-
return obj
|
|
402
|
-
|
|
403
|
-
}else if(Object.prototype.toString.call(obj) == '[object String]'){
|
|
404
|
-
|
|
405
|
-
if(this.$ak.utils.isEmpty(obj))
|
|
406
|
-
return ''
|
|
407
|
-
|
|
408
|
-
if(obj.startWith("lang.")){
|
|
409
|
-
return this.$t(obj)
|
|
410
|
-
}else{
|
|
411
|
-
return obj
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
}else{
|
|
415
|
-
return obj
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
},
|
|
419
|
-
reset(){
|
|
420
|
-
this.reset2(this.model,this.modelData)
|
|
421
|
-
},
|
|
422
|
-
reset2(dest,source){
|
|
423
|
-
|
|
424
|
-
for(var p in source){
|
|
425
|
-
|
|
426
|
-
if(Object.prototype.toString.call(source[p]) == "[object Object]"){
|
|
427
|
-
|
|
428
|
-
if(dest.hasOwnProperty(p)){
|
|
429
|
-
this.reset2(dest[p],source[p])
|
|
430
|
-
}
|
|
431
|
-
}else if(Object.prototype.toString.call(source[p]) == "[object Array]"){
|
|
432
|
-
|
|
433
|
-
if(dest.hasOwnProperty(p) && String(p) !== 'items'){
|
|
434
|
-
dest[p] = source[p];
|
|
435
|
-
}
|
|
436
|
-
}else{
|
|
437
|
-
if(dest.hasOwnProperty(p)){
|
|
438
|
-
dest[p] = source[p];
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
watch:{
|
|
447
|
-
|
|
448
|
-
'model.validateToken':{
|
|
449
|
-
handler(val,oldval){
|
|
450
|
-
if(oldval != undefined)
|
|
451
|
-
{
|
|
452
|
-
this.validate()
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
deep: false
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
},
|
|
459
|
-
computed: {
|
|
460
|
-
config(){
|
|
461
|
-
return config;
|
|
462
|
-
},
|
|
463
|
-
session(){
|
|
464
|
-
return session;
|
|
465
|
-
},
|
|
466
|
-
ctlClass() {
|
|
467
|
-
|
|
468
|
-
let ctlTag = this.$options._componentTag
|
|
469
|
-
if (this.model.readonly) {
|
|
470
|
-
return ctlTag + '_readonly'
|
|
471
|
-
}else if (this.model.disabled) {
|
|
472
|
-
return ctlTag + '_disabled'
|
|
473
|
-
}else {
|
|
474
|
-
return ctlTag + '_normal'
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
beforeDestroy() {
|
|
481
|
-
|
|
482
|
-
this.$delete(session.regedit,this.fullName)
|
|
483
|
-
selector.index_delete(this.sname,this.fullName)
|
|
484
|
-
},
|
|
485
|
-
destroyed() {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
}
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import { fromEvent } from 'rxjs';
|
|
3
|
+
import {take} from 'rxjs/operators';
|
|
4
|
+
import ak from '../assets/ak.js'
|
|
5
|
+
import service from '../service';
|
|
6
|
+
import session from '../session'
|
|
7
|
+
import config from '../assets/config.js'
|
|
8
|
+
import selector from "../selector";
|
|
9
|
+
import {ua} from "../assets/ua";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => {
|
|
16
|
+
return {default:true}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
mod: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {
|
|
22
|
+
return {default:true}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
cname:{
|
|
26
|
+
type: String
|
|
27
|
+
},
|
|
28
|
+
cusValidate:{
|
|
29
|
+
type: Function
|
|
30
|
+
},
|
|
31
|
+
textRender:{
|
|
32
|
+
type: Function
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
fullName:undefined,
|
|
38
|
+
sname:undefined,
|
|
39
|
+
isExtend:false,
|
|
40
|
+
model:{
|
|
41
|
+
hiddenValidate:false,
|
|
42
|
+
validateResult:{
|
|
43
|
+
messages:[],
|
|
44
|
+
message:'',
|
|
45
|
+
isSuccess:true,
|
|
46
|
+
pending:false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
modelData:{}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
mounted() {
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
if(!this.$parent.$data.isExtend){
|
|
56
|
+
this.processModel()
|
|
57
|
+
}*/
|
|
58
|
+
|
|
59
|
+
this.processModel()
|
|
60
|
+
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
createDefaultModel2(){
|
|
64
|
+
|
|
65
|
+
let model2 = {
|
|
66
|
+
label: '',
|
|
67
|
+
tag:'',
|
|
68
|
+
data: {},
|
|
69
|
+
visible:true,
|
|
70
|
+
readonly: false,
|
|
71
|
+
disabled: false,
|
|
72
|
+
required: false,
|
|
73
|
+
clearable: true,
|
|
74
|
+
validateType: '',
|
|
75
|
+
validateGroup: '',
|
|
76
|
+
validateReg: '',
|
|
77
|
+
inputAlign: 'left',
|
|
78
|
+
validateToken: 0,
|
|
79
|
+
validateResult: {
|
|
80
|
+
messages: [],
|
|
81
|
+
message: '',
|
|
82
|
+
isSuccess: true,
|
|
83
|
+
pending: false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if(this.$options.methods.createDefaultModel){
|
|
88
|
+
return Object.assign(this.$options.methods.createDefaultModel(),model2)
|
|
89
|
+
}else{
|
|
90
|
+
return model2
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
},
|
|
94
|
+
getGobalfullName(){
|
|
95
|
+
|
|
96
|
+
let sysflag = 'normal'
|
|
97
|
+
if(ua.isIspPhone){
|
|
98
|
+
sysflag = 'ispPhone'
|
|
99
|
+
}else if(ua.microMsg){
|
|
100
|
+
sysflag = 'microMsg'
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return config.sys.id + '.' + sysflag + '.' + this.fullName
|
|
104
|
+
},
|
|
105
|
+
saveLocalValue(val){
|
|
106
|
+
if('local_storage' in config.other && config.other.local_storage === 'true'){
|
|
107
|
+
let json = JSON.stringify(val)
|
|
108
|
+
localStorage.setItem(this.getGobalfullName(),json)
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
processModel(pmodel){
|
|
112
|
+
|
|
113
|
+
this.fullName = this.getCtlName(this)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
let hasValue = false
|
|
117
|
+
if(this.$props.mod.default === true){
|
|
118
|
+
this.modelData = this.createDefaultModel2()
|
|
119
|
+
}else{
|
|
120
|
+
let defaultModel = this.createDefaultModel2()
|
|
121
|
+
|
|
122
|
+
if(pmodel){
|
|
123
|
+
hasValue = 'value' in pmodel
|
|
124
|
+
this.modelData = Object.assign({},defaultModel,pmodel)
|
|
125
|
+
}else{
|
|
126
|
+
hasValue = 'value' in this.$props.mod
|
|
127
|
+
this.modelData = Object.assign({},defaultModel,this.$props.mod)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if('local_storage' in config.other && config.other.local_storage === 'true'){
|
|
132
|
+
if(!hasValue) {
|
|
133
|
+
let sv = localStorage.getItem(this.getGobalfullName())
|
|
134
|
+
if(!ak.utils.isEmpty(sv)){
|
|
135
|
+
this.modelData.value = JSON.parse(sv)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.modelData = this.locale(this.modelData)
|
|
141
|
+
this.model = ak.utils.cloneBySerialize(this.modelData)
|
|
142
|
+
|
|
143
|
+
if(!this.isExtend){
|
|
144
|
+
this.$set(session.regedit,this.fullName,{model:this.model,ctl:this,name:this.fullName})
|
|
145
|
+
selector.index_add(this.sname,this.fullName)
|
|
146
|
+
console.log('regedit component ' + this.fullName)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
},
|
|
150
|
+
getCtlName(ctl){
|
|
151
|
+
|
|
152
|
+
if(!ctl.$props)
|
|
153
|
+
return ''
|
|
154
|
+
|
|
155
|
+
let ctlName = ctl.$ak.utils.isEmpty(ctl.$props.cname) ? ctl.$data.vname : ctl.$props.cname
|
|
156
|
+
|
|
157
|
+
if(ctl.$data.isExtend){
|
|
158
|
+
return ''
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if(ak.utils.isEmpty(ctlName)){
|
|
162
|
+
ctlName = ak.utils.guid2()
|
|
163
|
+
}
|
|
164
|
+
ctlName = ctlName.replace(/RNUM/, ak.utils.guid2())
|
|
165
|
+
|
|
166
|
+
this.sname = ctlName
|
|
167
|
+
|
|
168
|
+
if(ak.utils.isEmpty(ctlName)){
|
|
169
|
+
return ''
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let parentName_s = undefined
|
|
173
|
+
let parent = ctl.$parent
|
|
174
|
+
while(parent){
|
|
175
|
+
|
|
176
|
+
// console.log("fullname:" + parent.$options._componentTag + "----" + parent.$data.vname + "-----" + parent.$data.fullName)
|
|
177
|
+
if(!this.$ak.utils.isEmpty(parent.$data.fullName)){
|
|
178
|
+
parentName_s = parent.$data.fullName
|
|
179
|
+
break
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if(!(parent.$options.methods && Object.prototype.toString.call(parent.$options.methods.getCtlName) == "[object Function]")){
|
|
183
|
+
parent = parent.$parent
|
|
184
|
+
continue
|
|
185
|
+
}else if(parent.$data.isExtend){
|
|
186
|
+
parent = parent.$parent
|
|
187
|
+
continue
|
|
188
|
+
}else{
|
|
189
|
+
break
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if(parent){
|
|
195
|
+
|
|
196
|
+
let parentName = undefined
|
|
197
|
+
if(parentName_s){
|
|
198
|
+
parentName = parentName_s
|
|
199
|
+
}else{
|
|
200
|
+
parentName = parent.$options.methods.getCtlName.bind(parent)(parent)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
let parent2 = ctl.$parent
|
|
204
|
+
while(parent2){
|
|
205
|
+
|
|
206
|
+
if(!this.$ak.utils.isEmpty(parent2.$data.fullName)){
|
|
207
|
+
break
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if(!(parent2.$options.methods && Object.prototype.toString.call(parent2.$options.methods.getCtlName) == "[object Function]")){
|
|
211
|
+
|
|
212
|
+
parent2.$data.fullName = parentName
|
|
213
|
+
parent2 = parent2.$parent
|
|
214
|
+
continue
|
|
215
|
+
}else if(parent2.$data.isExtend){
|
|
216
|
+
|
|
217
|
+
parent2.$data.fullName = parentName
|
|
218
|
+
parent2 = parent2.$parent
|
|
219
|
+
continue
|
|
220
|
+
}else{
|
|
221
|
+
break
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if(ctl.$ak.utils.isEmpty(parentName)){
|
|
226
|
+
return ctlName
|
|
227
|
+
}else{
|
|
228
|
+
return parentName + '.' + ctlName
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
}else{
|
|
232
|
+
return ctlName
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
},
|
|
236
|
+
validate(useAll){
|
|
237
|
+
|
|
238
|
+
let firedvalidate = this.$ak.utils.isEmpty(useAll) ? false : useAll
|
|
239
|
+
let promiseV
|
|
240
|
+
|
|
241
|
+
this.model.validateResult.messages = []
|
|
242
|
+
this.model.validateResult.isSuccess = false
|
|
243
|
+
|
|
244
|
+
let value = this.model.value
|
|
245
|
+
|
|
246
|
+
if(this.$ak.utils.isEmpty(this.model.disabled) || !this.model.disabled){
|
|
247
|
+
|
|
248
|
+
if(this.model.required){
|
|
249
|
+
if(this.$ak.utils.isEmpty(value)){
|
|
250
|
+
|
|
251
|
+
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '不能为空',level:8})
|
|
252
|
+
this.settle(this)
|
|
253
|
+
return Promise.resolve()
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if(!this.$ak.utils.isEmpty(value)){
|
|
260
|
+
|
|
261
|
+
if(!this.model.validateType == ''){
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if(this.model.validateType == 'EMAIL'){
|
|
265
|
+
|
|
266
|
+
if(!this.$ak.utils.isEmail(value)){
|
|
267
|
+
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
this.settle(this)
|
|
271
|
+
|
|
272
|
+
}else if(this.model.validateType == 'MONEY'){
|
|
273
|
+
|
|
274
|
+
if(!this.$ak.utils.isEmail(value)){
|
|
275
|
+
|
|
276
|
+
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
this.settle(this)
|
|
280
|
+
|
|
281
|
+
}else if(this.model.validateType == 'REG'){
|
|
282
|
+
|
|
283
|
+
var reg = new RegExp(this.model.validateReg);
|
|
284
|
+
if(!reg.test(value)){
|
|
285
|
+
this.model.validateResult.messages.push({'id': this.fullName ,message:this.locale(this.model.label) + '格式不正确',level:8})
|
|
286
|
+
|
|
287
|
+
}
|
|
288
|
+
this.settle(this)
|
|
289
|
+
|
|
290
|
+
}else if(this.model.validateType == 'CUS'){
|
|
291
|
+
|
|
292
|
+
let validating = this.locale('lang.base.validate.validating')
|
|
293
|
+
this.model.validateResult.message = validating
|
|
294
|
+
this.model.validateResult.pending = true
|
|
295
|
+
|
|
296
|
+
let vc = this.$props.cusValidate.bind(this)
|
|
297
|
+
let self = this
|
|
298
|
+
let pro = vc({value:value,fullName:this.fullName},this.model)
|
|
299
|
+
|
|
300
|
+
if(Object.prototype.toString.call(pro) == "[object Promise]"){
|
|
301
|
+
|
|
302
|
+
promiseV = pro.then((res)=>{
|
|
303
|
+
|
|
304
|
+
if(!self.$ak.utils.isEmpty(res)){
|
|
305
|
+
res.id = this.fullName
|
|
306
|
+
self.model.validateResult.messages.push(res)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
self.model.validateResult.pending = false
|
|
311
|
+
self.settle(self)
|
|
312
|
+
|
|
313
|
+
return Promise.resolve()
|
|
314
|
+
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
}else{
|
|
318
|
+
|
|
319
|
+
if(!self.$ak.utils.isEmpty(pro))
|
|
320
|
+
self.model.validateResult.messages.push(pro)
|
|
321
|
+
|
|
322
|
+
self.model.validateResult.pending = false
|
|
323
|
+
self.settle(self)
|
|
324
|
+
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
}else{
|
|
328
|
+
|
|
329
|
+
let validateTypeError = this.locale('lang.base.validate.validateTypeError')
|
|
330
|
+
this.model.validateResult.messages.push({'id': this.fullName ,message:validateTypeError,level:8})
|
|
331
|
+
this.settle(this)
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
}else{
|
|
335
|
+
this.settle(this)
|
|
336
|
+
}
|
|
337
|
+
}else{
|
|
338
|
+
|
|
339
|
+
this.model.validateResult.isSuccess = true
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if(promiseV)
|
|
344
|
+
return promiseV
|
|
345
|
+
else
|
|
346
|
+
return Promise.resolve()
|
|
347
|
+
|
|
348
|
+
},
|
|
349
|
+
settle(self){
|
|
350
|
+
|
|
351
|
+
let isSuccess = false
|
|
352
|
+
let message = ''
|
|
353
|
+
|
|
354
|
+
if(self.model.validateResult.messages.length > 0 ){
|
|
355
|
+
|
|
356
|
+
self.model.validateResult.messages.forEach((item, index) => {
|
|
357
|
+
|
|
358
|
+
isSuccess = isSuccess && item.level < 5
|
|
359
|
+
|
|
360
|
+
if(self.$ak.utils.isEmpty(message))
|
|
361
|
+
message = item.message
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
}else{
|
|
365
|
+
|
|
366
|
+
isSuccess = true
|
|
367
|
+
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
self.model.validateResult.isSuccess = isSuccess
|
|
371
|
+
self.model.validateResult.message = message
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
},
|
|
375
|
+
setEventString(id,name,attr,val,oldVal){
|
|
376
|
+
|
|
377
|
+
let event = {
|
|
378
|
+
'id':id,
|
|
379
|
+
'name':name,
|
|
380
|
+
'attr':attr,
|
|
381
|
+
'val':val,
|
|
382
|
+
'oldVal':oldVal
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
session.regeditc = JSON.stringify(event)
|
|
386
|
+
},
|
|
387
|
+
locale(obj){
|
|
388
|
+
|
|
389
|
+
if(Object.prototype.toString.call(obj) == '[object Object]'){
|
|
390
|
+
|
|
391
|
+
for(let key in obj){
|
|
392
|
+
obj[key] = this.locale(obj[key])
|
|
393
|
+
}
|
|
394
|
+
return obj
|
|
395
|
+
|
|
396
|
+
}else if(Object.prototype.toString.call(obj) == '[object Array]'){
|
|
397
|
+
|
|
398
|
+
for(let key in obj){
|
|
399
|
+
obj[key] = this.locale(obj[key])
|
|
400
|
+
}
|
|
401
|
+
return obj
|
|
402
|
+
|
|
403
|
+
}else if(Object.prototype.toString.call(obj) == '[object String]'){
|
|
404
|
+
|
|
405
|
+
if(this.$ak.utils.isEmpty(obj))
|
|
406
|
+
return ''
|
|
407
|
+
|
|
408
|
+
if(obj.startWith("lang.")){
|
|
409
|
+
return this.$t(obj)
|
|
410
|
+
}else{
|
|
411
|
+
return obj
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
}else{
|
|
415
|
+
return obj
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
},
|
|
419
|
+
reset(){
|
|
420
|
+
this.reset2(this.model,this.modelData)
|
|
421
|
+
},
|
|
422
|
+
reset2(dest,source){
|
|
423
|
+
|
|
424
|
+
for(var p in source){
|
|
425
|
+
|
|
426
|
+
if(Object.prototype.toString.call(source[p]) == "[object Object]"){
|
|
427
|
+
|
|
428
|
+
if(dest.hasOwnProperty(p)){
|
|
429
|
+
this.reset2(dest[p],source[p])
|
|
430
|
+
}
|
|
431
|
+
}else if(Object.prototype.toString.call(source[p]) == "[object Array]"){
|
|
432
|
+
|
|
433
|
+
if(dest.hasOwnProperty(p) && String(p) !== 'items'){
|
|
434
|
+
dest[p] = source[p];
|
|
435
|
+
}
|
|
436
|
+
}else{
|
|
437
|
+
if(dest.hasOwnProperty(p)){
|
|
438
|
+
dest[p] = source[p];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
},
|
|
446
|
+
watch:{
|
|
447
|
+
|
|
448
|
+
'model.validateToken':{
|
|
449
|
+
handler(val,oldval){
|
|
450
|
+
if(oldval != undefined)
|
|
451
|
+
{
|
|
452
|
+
this.validate()
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
deep: false
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
},
|
|
459
|
+
computed: {
|
|
460
|
+
config(){
|
|
461
|
+
return config;
|
|
462
|
+
},
|
|
463
|
+
session(){
|
|
464
|
+
return session;
|
|
465
|
+
},
|
|
466
|
+
ctlClass() {
|
|
467
|
+
|
|
468
|
+
let ctlTag = this.$options._componentTag
|
|
469
|
+
if (this.model.readonly) {
|
|
470
|
+
return ctlTag + '_readonly'
|
|
471
|
+
}else if (this.model.disabled) {
|
|
472
|
+
return ctlTag + '_disabled'
|
|
473
|
+
}else {
|
|
474
|
+
return ctlTag + '_normal'
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
},
|
|
480
|
+
beforeDestroy() {
|
|
481
|
+
|
|
482
|
+
this.$delete(session.regedit,this.fullName)
|
|
483
|
+
selector.index_delete(this.sname,this.fullName)
|
|
484
|
+
},
|
|
485
|
+
destroyed() {
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
}
|
|
489
|
+
}
|