报错逻辑修改

This commit is contained in:
2022-07-01 17:12:52 +08:00
parent 0b28cd8665
commit 0fc0e52af3
2 changed files with 29 additions and 7 deletions

View File

@@ -11,9 +11,10 @@
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">日期</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" v-model="val2">
<div class="filter-input filter-input_1 pointer" @click="show = true">{{date}}</div>
</div>
</div>
<van-calendar v-model="show" :min-date="minDate" :default-date="defaultDate" @confirm="onConfirm" />
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">工作时间()</div>
<div class="fxcol mgl20">
@@ -66,6 +67,7 @@
</template>
<script>
import { Calendar } from 'vant'
import {queryRunRecord, calculate, save} from '@config/getData1.js'
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
@@ -73,12 +75,12 @@ export default {
name: 'RunLogFill',
components: {
NavBar,
SearchBox
SearchBox,
[Calendar.name]: Calendar
},
data () {
return {
val1: '',
val2: '',
val3: '0',
val4: '0',
val5: '0',
@@ -88,6 +90,10 @@ export default {
val9: '',
robj: {},
form: {},
date: '',
show: false,
minDate: new Date(2000, 0, 1),
defaultDate: new Date(),
disabled1: false
}
},
@@ -97,7 +103,19 @@ export default {
}
next()
},
created () {
this.date = this.formatDate(new Date())
},
methods: {
formatDate (date) {
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return `${date.getFullYear()}-` + month + `-` + day
},
onConfirm (date) {
this.show = false
this.date = this.formatDate(date)
},
handleChange (e, type) {
if (type) {
this._queryRunRecord()
@@ -107,7 +125,7 @@ export default {
let res = await queryRunRecord(this.val1)
if (res.code === '1') {
this.robj = res.content
this.val2 = this.robj.run_date
this.date = this.robj.run_date
this.val3 = this.robj.run_times
this.val4 = this.robj.prepare_times
this.val5 = this.robj.error_times
@@ -120,9 +138,13 @@ export default {
}
},
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 = {
device_code: this.val1,
run_date: this.val2,
run_date: this.date,
run_times: this.val3,
prepare_times: this.val4,
error_times: this.val5,

View File

@@ -84,9 +84,9 @@ export default {
if (res.code === '1') {
this.dataList.map((el) => {
if (el.sparepart_only_id === this.val1) {
this.toast('报错')
} else {
this.dataList.push(res.content)
} else {
this.toast('关联设备不一致')
}
})
} else {