<template>
|
<view class="spot_index">
|
<u-navbar
|
title="点检列表"
|
bgColor="#1977FF"
|
:autoBack="true"
|
:placeholder="true"
|
leftIconColor="#FFFFFF"
|
:titleStyle="{
|
color: '#FFFFFF'
|
}">
|
<view slot="right">
|
<span @click="scanDevice()">点检</span>
|
</view>
|
</u-navbar>
|
<view class="header_semicircle"></view>
|
<scroll-view class="spot_content" :scroll-top="scrollTop" refresher-enabled="true" scroll-y="true" refresher-background="#EAEAEA"
|
@scrolltolower="scrolltoLower" :refresher-triggered="triggered" @refresherrefresh="refresherrefresh">
|
<view
|
class="spot_item"
|
v-for="item in spotList"
|
:key="item.id"
|
@click="navgetToDetail(item)">
|
<view class="spot_item_title">
|
<span>设备编号:{{item.bigNumber}}</span>
|
<span>详情</span>
|
</view>
|
<view class="spot_item_content">
|
<view class="">
|
<span class="label">设备名称:</span>
|
<span>{{item.bigDeviceName}}</span>
|
</view>
|
<view class="">
|
<span class="label">型号规格:</span>
|
<span>{{item.bigDeviceModel}}</span>
|
</view>
|
<view class="">
|
<span class="label">设备类型:</span>
|
<span>{{item.bigTypeStr}}</span>
|
</view>
|
<view class="">
|
<span class="label">点检时间:</span>
|
<span class="value">{{item.checkTime}}</span>
|
</view>
|
<view class="">
|
<span class="label">责任人:</span>
|
<span>{{item.adminUserName}}</span>
|
</view>
|
<view class="">
|
<span class="label">责任人电话:</span>
|
<span>{{item.adminUserPhone}}</span>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public';
|
export default {
|
data() {
|
return {
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
iconType: 'flower',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
showState: false,
|
columnData: [[{
|
label: '未匹配',
|
id: 1
|
},{
|
label: '匹配成功入模',
|
id: 2
|
},{
|
label: '匹配失败无法入模',
|
id: 3
|
}]],
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: '',
|
spotList: [{id: 1}, {id: 2}, {id: 3}],
|
}
|
},
|
onShow() {
|
this.searchData();
|
},
|
methods: {
|
// 查询模具质检列表
|
async searchSpotCheckList() {
|
const { data } = await this.$api.spot.searchSpotCheckList({
|
pageNum: this.pageNum,
|
pageSize: this.pageSize
|
})
|
return data;
|
},
|
// 查询信息
|
searchData() {
|
this.triggered = true;
|
this.spotList = [];
|
this.searchSpotCheckList().then(data => {
|
this.spotList = data.list;
|
this.loadPage = data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}).catch(() => {
|
this.triggered = false;
|
this.status = 'nomore';
|
uni.$u.toast('没有更数据了');
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchData();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
},1000)
|
return
|
} else {
|
this.pageNum += 1;
|
this.searchSpotCheckList().then((data) => {
|
this.loadPage = data.pages;
|
this.spotList.push(...data.list);
|
this.status = 'nomore';
|
})
|
}
|
}, 3000),
|
// 点检
|
scanDevice() {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
console.log(data.code);
|
if(data.code) {
|
uni.navigateTo({
|
url: './deviceSpot'
|
})
|
}
|
// that.$api.spot.scanCheckMould({
|
// mouldNum: data.code
|
// }).then((res) => {
|
// if(res.success) {
|
// uni.$u.toast('扫描完成!');
|
// console.log(res,'===');
|
// } else {
|
// uni.$u.toast(res.statusMsg);
|
// }
|
// })
|
uni.$off('scancodedate');
|
})
|
},
|
// 跳转详情
|
navgetToDetail(item) {
|
uni.navigateTo({
|
url: './spotDetail?id=' + item.id
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.spot_index {
|
position: relative;
|
width: 100%;
|
height: 100vh;
|
background: rgba(246, 246, 246, 1);
|
|
.header_semicircle {
|
width: 100%;
|
height: 100px;
|
background: #1977FF;
|
border-radius: 0 0 50% 50%;
|
}
|
|
.spot_content {
|
position: absolute;
|
top: 70px;
|
left: 50%;
|
transform: translateX(-50%);
|
display: flex;
|
flex-direction: column;
|
width: calc(100% - 30px);
|
height: calc(100% - 70px);
|
|
.spot_item {
|
padding: 10px;
|
margin: 12px 0;
|
// width: 100%;
|
height: 250px;
|
background: #FFFFFF;
|
border-radius: 6px;
|
box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.04);
|
|
&:first-child {
|
margin-top: 0;
|
}
|
|
.spot_item_title {
|
position: relative;
|
padding: 0 10px;
|
display: flex;
|
justify-content: space-between;
|
color: rgba(25, 119, 255, 1);
|
font-size: 16px;
|
|
&:before {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 0;
|
transform: translateY(-50%);
|
width: 3px;
|
height: 80%;
|
background-color: rgba(25, 119, 255, 1);
|
}
|
}
|
|
.spot_item_content {
|
display: flex;
|
flex-direction: column;
|
justify-content: space-around;
|
padding: 10px;
|
margin-top: 10px;
|
height: calc(90% - 30px);
|
background: rgba(25,119,255,0.04);
|
|
.label {
|
display: inline-block;
|
width: 100px;
|
color: #999999;
|
}
|
|
.value {
|
color: #1977FF;
|
}
|
}
|
}
|
}
|
}
|
</style>
|