设备报修,设备列表

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

View File

@@ -119,7 +119,7 @@ uni-button:after {
}
.filter_item {
display: flex;
align-items: center;
align-items: flex-start;
width: 100%;
margin-bottom: 10rpx;
}
@@ -166,12 +166,12 @@ uni-button:after {
.filter_input_wraper {
/* flex: 1; */
width: calc(100% - 170rpx);
height: 80rpx;
min-height: 80rpx;
padding: 5rpx 0;
margin-left: 30rpx;
display: flex;
justify-content: flex-start;
align-items: center;
align-items: flex-start;
}
.filter_input_wraper_1 {
height: 30rpx;

View File

@@ -125,6 +125,22 @@
}
}
,{
"path" : "pages/device/RepairReport",
"style": {
"navigationStyle": "custom"
}
}
,{
"path" : "pages/device/DeviceList",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
}
],
"globalStyle": {
// "pageOrientation": "landscape",

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>

View File

@@ -51,7 +51,8 @@
{menu_id: '2', name: '设备维修作业', path: '/pages/device/RepairWork'},
{menu_id: '3', name: '设备点检作业', path: '/pages/device/CheckWork'},
{menu_id: '4', name: '设备润滑作业', path: '/pages/device/LubricateWork'},
{menu_id: '5', name: '设备保养作业', path: '/pages/device/MaintainWork'}
{menu_id: '5', name: '设备保养作业', path: '/pages/device/MaintainWork'},
{menu_id: '6', name: '设备报修', path: '/pages/device/RepairReport'}
]}
],
show: false,

View File

@@ -132,3 +132,41 @@ export const deviceManageGetDtl = (code, type, jcode) => request({
}
})
/**
* 设备报修
*/
// 1.1设备列表
export const queryDevice2 = (code, page, size) => request({
url:'api/devicemaintenanceplanmst/queryDevice3',
data: {
device_code: code,
page: page,
size: size
}
})
// export const queryDevice2 = (code, page, size) => {
// let res = {
// data: [{device_code: 'code', device_name: 'device_name', devicerecord_id: 'devicerecord_id', material_type_id: 'material_type_id'}],
// totalCount: 1
// }
// return res
// }
// 1.2故障类型
export const devicefaultclass = (id) => request({
url:'api/devicefaultclass/dtl3',
data: {
material_type_id: id
}
})
// 1.3报修
export const devicerepairrequest = (code, id, mid, did, lev, desc) => request({
url:'api/devicerepairrequest',
data: {
device_code: code,
devicerecord_id: id,
material_type_id: mid,
device_faultclass_id: did,
fault_level: lev,
fault_desc: desc
}
})