Files
hht-hl-one-uni/pages/device/CheckWork.vue

138 lines
3.3 KiB
Vue
Raw Normal View History

2023-09-05 14:31:28 +08:00
<template>
<view class="zd_container">
2023-09-08 18:11:22 +08:00
<nav-bar title="设备点检作业"></nav-bar>
2023-09-05 14:31:28 +08:00
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">设备</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val1"
2023-09-08 16:25:46 +08:00
:focused="true"
@handleChange="handleChange"
2023-09-05 14:31:28 +08:00
/>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>保养单</th>
<th>设备编号</th>
<th>设备名称</th>
<th>状态</th>
2023-09-08 18:16:02 +08:00
<th>类型</th>
2023-09-05 14:31:28 +08:00
<th>计划保养日期</th>
</tr>
</thead>
<tbody>
2023-09-08 16:25:46 +08:00
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.maint_code === pkId}">
<td>{{e.maint_code}}</td>
2023-09-05 14:31:28 +08:00
<td>{{e.device_code}}</td>
<td>{{e.device_name}}</td>
2023-09-08 16:25:46 +08:00
<td>{{e.invstatus_name}}</td>
2023-09-08 18:16:02 +08:00
<td>{{['计划点检', '临时点检'][Number(e.maintenancecycle) - 1]}}</td>
2023-09-05 14:31:28 +08:00
<td>{{e.plan_start_date}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
2023-09-08 16:25:46 +08:00
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure1">开始保养</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" @tap="toJump">结束保养</button>
2023-09-05 14:31:28 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2023-09-08 18:11:22 +08:00
import {sportcheckgetAllQuery, sportcheckbegin} from '@/utils/getData1.js'
2023-09-05 14:31:28 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
dataList: [],
pkId: '',
pkObj: {},
disabled: false
};
},
2023-09-11 16:02:09 +08:00
onShow () {
this._sportcheckgetAllQuery(this.val1)
},
2023-09-05 14:31:28 +08:00
methods: {
2023-09-08 16:25:46 +08:00
handleChange (e) {
2023-09-08 18:11:22 +08:00
this._sportcheckgetAllQuery(e)
2023-09-08 16:25:46 +08:00
},
/** grid查询 */
2023-09-08 18:11:22 +08:00
async _sportcheckgetAllQuery (e) {
let res = await sportcheckgetAllQuery(e)
2023-09-08 16:25:46 +08:00
res.data.map(el => {
if(el.invstatus === '01') {
this.$set(el, 'invstatus_name', '生成')
}
if(el.invstatus === '02') {
this.$set(el, 'invstatus_name', '提交')
}
if(el.invstatus === '03') {
this.$set(el, 'invstatus_name', '保养开始')
}
if(el.invstatus === '06') {
this.$set(el, 'invstatus_name', '保养结束')
}
if(el.invstatus === '99') {
this.$set(el, 'invstatus_name', '审核完毕')
}
})
this.dataList = [...res.data]
2023-09-05 14:31:28 +08:00
},
2023-09-08 16:25:46 +08:00
async toSure1 () {
2023-09-05 14:31:28 +08:00
this.disabled = true
2023-09-08 16:25:46 +08:00
if (!this.pkId) {
2023-09-05 14:31:28 +08:00
this.disabled = false
return
}
try {
2023-09-08 18:11:22 +08:00
let res = await sportcheckbegin(this.pkObj)
2023-09-05 14:31:28 +08:00
this.disabled = false
this.pkId = ''
this.pkObj = {}
2023-09-08 18:11:22 +08:00
this._sportcheckgetAllQuery(this.val1)
2023-09-05 14:31:28 +08:00
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
2023-09-08 16:25:46 +08:00
},
toCheck (e) {
this.pkId = this.pkId === e.maint_code ? '' : e.maint_code
this.pkObj = this.pkId === e.maint_code ? e : {}
},
toJump () {
if (this.pkId) {
this.$store.dispatch('setPublicObj', this.pkObj)
uni.navigateTo({
2023-09-08 18:11:22 +08:00
url: '/pages/device/CheckFill'
2023-09-08 16:25:46 +08:00
})
}
2023-09-05 14:31:28 +08:00
}
}
}
</script>
<style lang="stylus">
</style>