fix: Issues #218, Time value Change done.

This commit is contained in:
chiayin
2024-03-26 17:08:51 +08:00
parent ef3bab3592
commit 394b535118
3 changed files with 32 additions and 8 deletions

View File

@@ -405,6 +405,7 @@ export default {
// 打開 rule 檔要顯示儲存的選項、規則、時間
conformanceTempReportData: {
handler: function(newValue) {
console.log('conformanceTempReportData', newValue);
setTimeout(() => {
if(newValue !== null) {
const rule = newValue.rule;

View File

@@ -1,8 +1,9 @@
<template>
<!-- select:{{ select }} -->
<div class="flex justify-between items-center" id="cyp-timerange">
<Durationjs :max="minVuemax" :min="minVuemin" :size="'min'" :updateMax="updateMax" @total-seconds="minTotalSeconds"></Durationjs>
<Durationjs :max="minVuemax" :min="minVuemin" :size="'min'" :updateMax="updateMax" @total-seconds="minTotalSeconds" :value="durationMin"></Durationjs>
<span>~</span>
<Durationjs :max="maxVuemax" :min="maxVuemin" :size="'max'" @total-seconds="maxTotalSeconds"></Durationjs>
<Durationjs :max="maxVuemax" :min="maxVuemin" :size="'max'" @total-seconds="maxTotalSeconds" :value="durationMax"></Durationjs>
</div>
</template>
<script>
@@ -23,6 +24,8 @@ export default {
maxVuemin: 0,
maxVuemax: 0,
updateMax: null,
durationMin: null,
durationMax: null,
}
},
components: {
@@ -81,8 +84,15 @@ export default {
},
created() {
if(this.select){
// 缺:
// 1. 外面傳入的原始資料最大最小值
// 2. isSubmit 的值
// this.timeData = {min: 63320, max: 1489525};
this.timeData = this.select;
this.setTimeValue();
// console.log('select',this.select);
// this.durationMin = 70000;
// this.durationMax = 84700;
}
}
}

View File

@@ -63,6 +63,13 @@ export default {
default: false,
required: true,
},
value: {
type: Number,
required: false,
validator(value) {
return value >= 0;
},
}
},
data() {
return {
@@ -200,6 +207,7 @@ export default {
actionUpDown(input, goUp, selectIt = false) {
const tUnit = input.dataset.tunit;
let newVal = parseInt(input.value, 10);
newVal = isNaN(newVal) ? 0 : newVal;
// if (newVal <= 0 || newVal > this.tUnits[tUnit].max) {
@@ -311,22 +319,28 @@ export default {
*/
async createData() {
let size = this.size;
if (this.maxTotal !== await null && this.minTotal !== await null) {
switch (size) {
case 'max':
this.secondToDate(this.minTotal, 'min');
this.secondToDate(this.maxTotal, 'max');
this.totalSeconds = this.maxTotal;
this.totalSeconds = this.maxTotal;
if(this.value !== null) {
this.totalSeconds = this.value;
this.secondToDate(this.value);
}
break;
case 'min':
this.secondToDate(this.maxTotal, 'max');
this.secondToDate(this.minTotal, 'min');
this.totalSeconds = this.minTotal;
break;
default:
this.totalSeconds = this.minTotal;
if(this.value !== null) {
this.totalSeconds = this.value;
this.secondToDate(this.value);
}
break;
}
// this.$emit('total-seconds', this.totalSeconds);
}
},
},
@@ -357,7 +371,6 @@ export default {
},
}
},
};
</script>
<style scoped>