设备报修,设备列表
This commit is contained in:
130
pages/device/DeviceList.vue
Normal file
130
pages/device/DeviceList.vue
Normal 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>
|
||||
Reference in New Issue
Block a user