设备报修,设备列表

This commit is contained in:
2023-11-08 16:46:40 +08:00
parent 4f1e36bdfb
commit 1590058849
6 changed files with 316 additions and 4 deletions

130
pages/device/DeviceList.vue Normal file
View File

@@ -0,0 +1,130 @@
<template>
<view class="zd_container">
<nav-bar :inner2="true" @goIn="goIn" title="设备列表查询"></nav-bar>
<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"
@handleChange="handleChange"
/>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>设备编码</th>
<th>设备名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.device_code === pkId}">
<td>{{e.device_code}}</td>
<td>{{e.device_name}}</td>
</tr>
</tbody>
</table>
</view>
</view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !pkId}" @tap="toSure">确认</button>
<button class="submit-button" @tap="searchList">查询</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryDevice2} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
dataList: [],
pkId: '',
pkObj: {},
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 30
};
},
methods: {
handleChange (e) {
this.dataList = []
this.pageNum = 1
this._queryDevice2(e)
},
searchList () {
this.dataList = []
this.pageNum = 1
this._queryDevice2(this.val1)
},
/** grid查询 */
async _queryDevice2 (e) {
let res = await queryDevice2(e, this.pageNum + '', this.pageSize + '')
this.totalCount = res.totalCount
if (res.totalCount > 0) {
const dataMap = res.data
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
} else {
this.dataList = []
}
if (this.totalCount == this.dataList.length) {
this.reload = false
this.status = 'noMore'
}
},
onReachBottom () {
if (this.totalCount > this.dataList.length) {
this.status = 'loading'
setTimeout(() => {
this.pageNum++
this._queryDevice2(this.val1)
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
},
toCheck (e) {
this.pkId = this.pkId === e.device_code ? '' : e.device_code
this.pkObj = this.pkId === e.device_code ? e : {}
},
toSure () {
if (!this.pkId) {
return
}
this.$store.dispatch('setPublicObj', this.pkObj)
this.goIn()
},
goIn () {
uni.navigateBack()
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,127 @@
<template>
<view class="zd_container">
<nav-bar title="设备报修"></nav-bar>
<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">
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val1" @tap="getMater">
</view>
</view>
<view class="filter_item">
<view class="filter_label">故障类型</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">故障等级</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">故障描述</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_textarea" v-model="val2">
</view>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !val1 || !index1 || !index2}" :disabled="disabled" @tap="toSure">报修</button>
<button class="submit-button" @tap="toCancle">清空</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {devicefaultclass, devicerepairrequest} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
options1: [],
index1: '',
options2: [{vlue: '01', text: '紧急'}, {vlue: '02', text: '一般'}, {vlue: '03', text: '不紧急'},],
index2: '',
disabled: false
};
},
onShow() {
if (this.$store.getters.publicObj) {
this.val1 = this.$store.getters.publicObj.device_name
this._devicefaultclass(this.$store.getters.publicObj.material_type_id)
}
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
methods: {
getMater () {
uni.navigateTo({
url: '/pages/device/DeviceList'
})
},
/** 选择器1 */
selectChange1(e) {
this.index1 = e
},
/** 选择器2 */
selectChange2(e) {
this.index2 = e
},
/** 故障类型下拉框查询 */
async _devicefaultclass (e) {
let res = await devicefaultclass(e)
res.data.map(el => {
this.$set(el, 'value', el.device_faultclass_id)
this.$set(el, 'text', el.device_faultclass_name)
})
this.options1 = [...res.data]
},
/** 确认 */
async toSure () {
this.disabled = true
if (!this.val1 || !this.index1 || !this.index2 ) {
this.disabled = false
return
}
try {
let res = await devicerepairrequest(this.$store.getters.publicObj.device_code, this.$store.getters.publicObj.devicerecord_id, this.$store.getters.publicObj.material_type_id, this.index1, this.index2, this.val2)
this.disabled = false
this.toCancle()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toCancle () {
this.val1 = ''
this.val2 = ''
this.index1 = ''
this.options1 = []
this.index2 = ''
this.$store.dispatch('setPublicObj', '')
}
}
}
</script>
<style lang="stylus">
</style>