|
...
|
...
|
@@ -2,29 +2,58 @@ |
|
|
|
import util from '../../../../utils/util'
|
|
|
|
module.exports = Behavior({
|
|
|
|
properties: {
|
|
|
|
pi: {
|
|
|
|
type: Number,
|
|
|
|
value:0,
|
|
|
|
}
|
|
|
|
ckdata:{
|
|
|
|
type:Object,
|
|
|
|
val:null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
|
|
|
|
spi:0
|
|
|
|
},
|
|
|
|
attached: function(){
|
|
|
|
|
|
|
|
observers: {
|
|
|
|
'ckdata': function() {
|
|
|
|
this.checkedDefEvent()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
gotoHere(){
|
|
|
|
this.data.index;
|
|
|
|
},
|
|
|
|
checked(e){
|
|
|
|
checked(e,hasCurrent=false){
|
|
|
|
let index=util.attr(e,'index')
|
|
|
|
let val=util.attr(e,'val')
|
|
|
|
let type=util.attr(e,'type')
|
|
|
|
this.setData({
|
|
|
|
let obj={
|
|
|
|
spi:index,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(hasCurrent){
|
|
|
|
let current=index-2
|
|
|
|
if(type=='date'){
|
|
|
|
current=current>10?10:current
|
|
|
|
}else if(type=='pnum'){
|
|
|
|
current=current>26?26:current
|
|
|
|
}
|
|
|
|
obj.current=current>-1?current:0
|
|
|
|
}
|
|
|
|
this.setData(obj)
|
|
|
|
this.triggerEvent('event',{index,val,type})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
checkedDefEvent(){
|
|
|
|
console.log('this.type',this.type)
|
|
|
|
let type=this.type
|
|
|
|
let ckdata = {}
|
|
|
|
if (!this.data.ckdata) {//初始化值
|
|
|
|
if(type == 'dur') return;
|
|
|
|
let index, val
|
|
|
|
if (type == 'pnum') {
|
|
|
|
index = 3
|
|
|
|
val = this.data.items[index]
|
|
|
|
} else if (type == 'date') {
|
|
|
|
index = 0
|
|
|
|
val = this.data.items[index]
|
|
|
|
}
|
|
|
|
ckdata = {index, val, type}
|
|
|
|
}else{
|
|
|
|
ckdata = this.data.ckdata
|
|
|
|
}
|
|
|
|
this.checked({currentTarget:{dataset:ckdata}},true)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|