Commit bfaadc58 by 夏新然

日期插件bug

1 parent 8a39b869
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -8,8 +8,7 @@
<div class="picker-title">
<span class="pt-cancel" @click="cancel" :style="{ color: colorCancel }">{{textCancel}}</span>
<span class="pt-submit" @click="confirm" :style="{ color: colorConfirm }">{{textConfirm}}</span>
<!-- <h4 :style="{ color: colorTitle }">{{textTitle}}</h4> -->
<slot></slot>
<h4 :style="{ color: colorTitle }">{{textTitle}}</h4>
</div>
<div class="picker-panel">
<div class="picker-mask-top"></div>
......@@ -114,6 +113,7 @@ export default {
},
computed: {
proxyData () {
return this._dataGetter()
},
proxyAnchor () {
......@@ -139,6 +139,9 @@ export default {
},
_anchorGetter () {
// if(!this.pickerData){
// this.pickerData=this._dataGetter()
// }
let anchor = []
if (this.anchor.length) {
anchor = this.anchor
......@@ -150,13 +153,12 @@ export default {
anchor = this.anchor; break
}
}
anchor = anchor.map((item, i) => {
let index = 0
if (item.index) {
index = item.index
} else if (item.value) {
index = this.pickerData && this.pickerData[i] && this.pickerData[i].indexOf(item.value) > -1
index = this.pickerData && this.pickerData[i] && this.pickerData[i].indexOf(item.value) > -1
? this.pickerData[i].indexOf(item.value) : 0
} else {
index = item
......@@ -170,6 +172,8 @@ export default {
this.display = true
if (!this.wheels.length || this.dataChange) {
this.dataType === DATA_CASCADE && this._updatePickerData()
this.$nextTick(() => {
const wheelWrapper = this.$refs.wheelWrapper
this.pickerData.forEach((item, index) => {
......@@ -177,6 +181,8 @@ export default {
})
this._wheelToAnchor(this.proxyAnchor)
// this.$forceUpdate()
this.dataChange && this._destroyExtraWheels()
this.dataChange = false
})
......@@ -216,11 +222,10 @@ export default {
if (this.dataType !== DATA_CASCADE) {
return
}
this._updatePickerData(0)
const newIndex = this._getCurrentValue()[i].index
if (newIndex !== this.pickerAnchor[i]) {
this.pickerAnchor.splice(i, 1, newIndex)
this._updatePickerData(i + 1)
this._updatePickerData(i + 1,true)
}
},
......@@ -234,14 +239,11 @@ export default {
const value = []
this.wheels.forEach((wheel, i) => {
const j = wheel.getSelectedIndex()
console.log(j)
console.log( this.pickerData)
value.push({
index: j,
value: this.pickerData[i][j]
})
})
console.log(value)
return value
},
......@@ -254,6 +256,7 @@ export default {
this.pickerData.forEach((item, i) => {
this._createWheel(wheelWrapper, i)
})
this._wheelToAnchor(this.proxyAnchor)
this._destroyExtraWheels()
})
......@@ -272,7 +275,11 @@ export default {
}
},
_updatePickerData (wheelIndex = 0) {
_updatePickerData (wheelIndex = 0,flag) {
if(!flag){
this.pickerAnchor = this._anchorGetter()
}
let data = [...this.proxyData]
let i = 0
while (data) {
......@@ -281,11 +288,12 @@ export default {
data.forEach((item) => {
wheelData.push(item.value)
})
this.pickerData[i] = wheelData
this.pickerData.splice(i, 1, wheelData)
this.pickerAnchor[i] = wheelIndex === 0
? (this.pickerAnchor[i] < data.length ? this.pickerAnchor[i] || 0 : 0)
: this._reloadWheel(i, wheelData)
}
data = data.length ? data[this.pickerAnchor[i]].children : null
i++
}
......
......@@ -144,7 +144,7 @@
<span v-show="showList['date']['year']" :class="{'activeDateType':currentDateType=='year'}" @tap="dateClick('year')">年</span>
</div>
</awesome-picker>
<awesome-picker
<!-- <awesome-picker
ref="picker2"
:data="dateData"
:textConfirm="picker.textConfirm"
......@@ -156,7 +156,7 @@
<div class="typeBox">
<span v-show="showList['date']['week2']" class="activeDateType" @tap="dateClick('week')"></span>
</div>
</awesome-picker>
</awesome-picker> -->
</div>
</template>
......@@ -627,6 +627,11 @@
})
}
},
watch:{
currentDate(val){
console.log(val)
}
},
computed: {
i18n() {
return this.$t("index")
......@@ -891,7 +896,7 @@
})
this.dateData=JSON.parse(JSON.stringify(this.dayData))
this.currentDate=this.currentDay;
console.log(this.currentDate)
const date = new Date();
var year = date.getFullYear();
var monthIndex = date.getMonth();
......
......@@ -251,51 +251,51 @@
}
}
},
// {
// text:"周中周末对比分析",
// iconSrc:week,
// rArrow:arrow,
// src:'weekReport/weekReport',
// showList:{
// gateTab:true,
// mall:{
// obj:false,
// oneMall:true,
// moreMall:false,
// event:false
// },
// gate:{
// obj:false,
// oneMall:true,
// moreMall:false,
// oneGate:true,
// moreGate:false
// },
// floor:{
// obj:false,
// oneMall:true,
// moreMall:false,
// oneFloor:true,
// moreFloor:false
// },
// area:{
// obj:false,
// oneMall:true,
// moreMall:false,
// oneFloor:true,
// moreFloor:false,
// oneStore:true,
// moreStore:false
// },
// date:{
// day:false,
// week:true,
// month:false,
// year:false,
// week2:true
// }
// }
// },
{
text:"周中周末对比分析",
iconSrc:week,
rArrow:arrow,
src:'weekReport/weekReport',
showList:{
gateTab:true,
mall:{
obj:false,
oneMall:true,
moreMall:false,
event:false
},
gate:{
obj:false,
oneMall:true,
moreMall:false,
oneGate:true,
moreGate:false
},
floor:{
obj:false,
oneMall:true,
moreMall:false,
oneFloor:true,
moreFloor:false
},
area:{
obj:false,
oneMall:true,
moreMall:false,
oneFloor:true,
moreFloor:false,
oneStore:true,
moreStore:false
},
date:{
day:false,
week:true,
month:false,
year:false,
week2:true
}
}
},
{
text:"节假日活动对比",
iconSrc:active,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!