修改calc

This commit is contained in:
2022-07-14 15:49:41 +08:00
parent 736ab18caf
commit c4880a5a21

View File

@@ -60,8 +60,8 @@
</div> </div>
</section> </section>
<section class="submit-bar"> <section class="submit-bar">
<button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': (JSON.stringify(robj) == '{}') }" @click="calculate">计算</button> <button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': (JSON.stringify(robj) == '{}') }" @click="toCount">计算</button>
<button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': (JSON.stringify(robj) == '{}') }" @click="save">保存</button> <button class="btn submit-button" :disabled="disabled2" :class="{'btn-disabled': (JSON.stringify(robj) == '{}') }" @click="toSave">保存</button>
</section> </section>
</section> </section>
</template> </template>
@@ -94,7 +94,8 @@ export default {
show: false, show: false,
minDate: new Date(2000, 0, 1), minDate: new Date(2000, 0, 1),
defaultDate: new Date(), defaultDate: new Date(),
disabled1: false disabled1: false,
disabled2: false
} }
}, },
beforeRouteLeave (to, from, next) { beforeRouteLeave (to, from, next) {
@@ -138,10 +139,6 @@ export default {
} }
}, },
calform () { calform () {
if (!(this.val3 >= 0 && this.val4 >= 0 && this.val5 >= 0 && this.val6 >= 0 && this.val7 >= 0 && this.val8 >= 0)) {
this.toast('值须>=0')
return
}
this.form = { this.form = {
device_code: this.val1, device_code: this.val1,
run_date: this.date, run_date: this.date,
@@ -154,6 +151,26 @@ export default {
oee_value: this.val9 oee_value: this.val9
} }
}, },
toCount () {
if (JSON.stringify(this.robj) === '{}') {
return
}
if (!(this.val3 >= 0 && this.val4 >= 0 && this.val5 >= 0 && this.val6 >= 0 && this.val7 >= 0 && this.val8 >= 0)) {
this.toast('值须>=0')
return
}
this.calculate()
},
toSave () {
if (JSON.stringify(this.robj) === '{}') {
return
}
if (!(this.val3 >= 0 && this.val4 >= 0 && this.val5 >= 0 && this.val6 >= 0 && this.val7 >= 0 && this.val8 >= 0)) {
this.toast('值须>=0')
return
}
this.save()
},
async calculate () { async calculate () {
this.disabled1 = true this.disabled1 = true
this.calform() this.calform()
@@ -174,7 +191,7 @@ export default {
} }
}, },
async save () { async save () {
this.disabled1 = true this.disabled2 = true
this.calform() this.calform()
try { try {
let res = await save(this.form) let res = await save(this.form)
@@ -186,9 +203,9 @@ export default {
} else { } else {
this.Dialog(res.desc) this.Dialog(res.desc)
} }
this.disabled1 = false this.disabled2 = false
} catch (error) { } catch (error) {
this.disabled1 = false this.disabled2 = false
} }
} }
} }