Files
hht-xinrui-mes/src/pages/xinrui/equipment/MaintainResults.vue

143 lines
4.1 KiB
Vue
Raw Normal View History

2022-06-27 10:21:54 +08:00
<template>
<section>
<nav-bar :inner="true" title="保养结果填报"></nav-bar>
<section class="content mgt186">
<div class="filter-wraper">
2022-07-01 09:54:17 +08:00
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">设备</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" disabled v-model="val1">
</div>
</div>
2022-06-27 10:21:54 +08:00
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">保养单</div>
<div class="fxcol mgl20">
2022-07-01 09:54:17 +08:00
<input type="text" class="filter-input filter-scan-input" disabled v-model="val2">
2022-06-27 10:21:54 +08:00
</div>
</div>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>是否完成</th>
</tr>
2022-06-30 15:25:40 +08:00
<tr v-for="e in dataList" :key="e.maint_dtl_id">
2022-06-27 10:21:54 +08:00
<td>
<for-dropdown-menu
2022-06-30 15:25:40 +08:00
:value="e.isfinish"
:id="e.maint_dtl_id"
2022-06-27 10:21:54 +08:00
@getValue="getValue">
</for-dropdown-menu>
</td>
</tr>
</table>
</div>
<div class="slide">
<table class="layout-t">
<tr>
<th>保养项目名称</th>
<th>保养等级</th>
<th>保养内容</th>
<th>要求</th>
</tr>
2022-06-30 15:25:40 +08:00
<tr v-for="e in dataList" :key="e.maint_dtl_id" @click="toCheck(e)" :class="{'checked': e.maint_dtl_id === pkId}">
<td>{{e.maint_item_name}}</td>
<td>{{e.item_level}}</td>
<td>{{e.contents}}</td>
<td>{{e.requirement}}</td>
2022-06-27 10:21:54 +08:00
</tr>
</table>
</div>
</div>
</section>
<section class="submit-bar">
2022-06-30 15:25:40 +08:00
<button class="btn submit-button" :class="{'btn-disabled': dataList.length === 0}" :disabled="disabled1" @click="toSure">确认</button>
<button class="btn submit-button" @click="toCancle">取消</button>
2022-06-27 10:21:54 +08:00
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
import ForDropdownMenu from '@components/ForDropdownMenu.vue'
2022-06-30 15:25:40 +08:00
import {queryMaintenanceDtl, dtlConfirm} from '@config/getData2.js'
2022-06-27 10:21:54 +08:00
export default {
name: 'MaintainResults',
components: {
NavBar,
SearchBox,
ForDropdownMenu
},
data () {
return {
2022-06-30 15:25:40 +08:00
val1: JSON.stringify(this.$store.getters.materObj) !== '{}' ? this.$store.getters.materObj.device_code : '',
val2: JSON.stringify(this.$store.getters.materObj) !== '{}' ? this.$store.getters.materObj.maint_code : '',
dataList: [],
2022-06-27 10:21:54 +08:00
pkId: '',
2022-06-30 15:25:40 +08:00
pkObj: {},
disabled1: false
2022-06-27 10:21:54 +08:00
}
},
2022-06-30 15:25:40 +08:00
mounted () {
this._queryMaintenanceDtl()
},
2022-06-27 10:21:54 +08:00
methods: {
toCheck (e) {
2022-06-30 15:25:40 +08:00
this.pkId = this.pkId === e.maint_dtl_id ? '' : e.maint_dtl_id
this.pkObj = this.pkId === e.maint_dtl_id ? e : {}
2022-06-27 10:21:54 +08:00
},
getValue (p) {
this.dataList.map(el => {
2022-06-30 15:25:40 +08:00
if (el.maint_dtl_id === p[0]) {
el.isfinish = p[1]
2022-06-27 10:21:54 +08:00
}
})
2022-06-30 15:25:40 +08:00
},
/** 明细查询 */
async _queryMaintenanceDtl () {
let res = await queryMaintenanceDtl(this.$store.getters.materObj)
if (res.code === '1') {
this.dataList = [...res.content.rows]
} else {
this.Dialog(res.desc)
}
},
async _dtlConfirm () {
try {
let res = await dtlConfirm(this.dataList)
if (res.code === '1') {
this.toast(res.desc)
2022-07-01 09:54:17 +08:00
this.toCancle()
2022-06-30 15:25:40 +08:00
} else {
this.Dialog(res.desc)
}
this.disabled1 = false
this.disabled2 = false
} catch (e) {
this.disabled1 = false
this.disabled2 = false
}
},
toSure () {
this.disabled1 = true
if (!this.dataList.length) {
this.disabled1 = false
return
}
this._dtlConfirm()
},
toCancle () {
2022-07-01 09:54:17 +08:00
this.$store.dispatch('materObj', {})
this.$router.back()
2022-06-27 10:21:54 +08:00
}
}
}
</script>
<style lang="stylus" scoped>
.mgb140
margin-bottom 1.4rem
</style>