<template>
|
<view class="product_monitor">
|
<scroll-view
|
scroll-y="true"
|
class="product_bear_scroll"
|
:scroll-top="scrollTop"
|
refresher-enabled="true"
|
refresher-background="#EAEAEA"
|
:refresher-triggered="triggeredBear"
|
@refresherpulling="refresherrefreshBear"
|
@scrolltolower="scrolltoLowerBear">
|
<view class="product_bear">
|
<view class="product_bear_headers">钢筋笼生产数据</view>
|
<view class="product_bear_lists" v-for="(item,index) in productBears" :key="index">
|
<view class="product_list_headers">
|
<view class="prodeuct_headers_titles">{{item.proName}}</view>
|
<view class="prodeuct_headers_titles1"><span>尺寸:</span>{{item.sizeName}}</view>
|
</view>
|
<view class="product_list_main">
|
<view class="product_main_rows">
|
<view class="product_rows_text">
|
<span style="position:absolute;top:26px;left:5px;">块号</span>
|
<span style="position:absolute;top:3px;left:38px">配筋</span>
|
</view>
|
<view class="product_rows_datas" v-for="(iten,rebarIndex) in item.hasDtos" :key="rebarIndex">{{iten.has}}</view>
|
</view>
|
<view class="product_main_columns">
|
<view class="product_columns_one">
|
<view class="product_columns_titles" v-for="(block,index) in item.blokDtos" :key="blockIndex">{{block.blockName}}</view>
|
</view>
|
<template>
|
<view style="display: flex; flex-direction: column; flex: 1;" v-for="(hasItem,hasIndex) in item.hasDtos" :key="hasIndex">
|
<view class="product_columns_datas" v-for="(blockItem,blockIndex) in item.blokDtos" :key="blockIndex">
|
{{showCounts(item.info, hasItem, blockItem)}}
|
</view>
|
</view>
|
</template>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="product_ring">
|
<view class="product_ring_headers">管片成环统计</view>
|
<view style="overflow: auto;">
|
<view class="product_ring_main" v-for="(itemRing,indexRing) in ringsList" :key="indexRing">
|
<view class="product_ring_title">{{itemRing&&itemRing.proName}}</view>
|
<view class="product_ring_datas">{{itemRing&&itemRing.inventory}}环</view>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="statusBear" :icon-type="iconType" :load-text="loadTextBear" />
|
</scroll-view>
|
</view>
|
</template>
|
|
<script>
|
import { throttle } from '../../plugins/public.js';
|
export default{
|
data(){
|
return{
|
pageNum: 1,
|
pageSize: 1000000000,
|
loadPage: 0,
|
productBears:[
|
],//钢筋笼生产数据
|
ringsList:[],//管片成环统计
|
scrollTop: 0,
|
triggeredBear: true,
|
statusBear: 'loading',
|
loadTextBear: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
}
|
},
|
onLoad() {
|
this.searchProductRebarLists()
|
},
|
methods:{
|
//查询钢筋笼生产数据
|
searchProductRebarLists(){
|
this.triggeredBear = true;
|
this.productBears = [];
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.searchProjectSize(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
let arr = []
|
res.data.list.map((iten) => {
|
arr.push({
|
proId:iten.proId,
|
sizeId:iten.sizeId
|
})
|
})
|
this.getRingsNum(arr)
|
this.productBears = res.data.list.map((item) => {
|
this.getBlockData(item.proId).then((data) => {
|
this.$set(item, 'blokDtos', data.blokDtos || []);
|
this.$set(item, 'hasDtos', data.hasDtos || []);
|
})
|
this.getLoopData(item).then((data) => {
|
this.$set(item, 'info', data.info || []);
|
this.$set(item, 'looping', data.looping || []);
|
})
|
return item;
|
});
|
this.loadPage = res.data.pages;
|
this.triggeredBear = false;
|
this.status = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
},
|
//对应获得数据
|
showCounts(infoData, hasItem, blockItem) {
|
if(infoData) {
|
infoData = infoData.flat(Infinity);
|
const dataList = infoData.filter(item =>
|
item.reinforcementId === hasItem.hasSteel && item.blockNum === blockItem.blockNum
|
)
|
if(dataList && dataList[0]) {
|
return dataList[0].inventory
|
} else {
|
return 0;
|
}
|
}
|
},
|
//获取管片环数
|
getRingsNum(item){
|
this.$api.reboSystem.searchRingNumbers({paramDtos:item}).then(res=>{
|
this.ringsList = res.data
|
})
|
},
|
//获得钢筋笼和块号
|
async getBlockData(proId) {
|
const { data } = await this.$api.reboSystem.searchProjectBears(proId)
|
return data
|
},
|
//获得钢筋笼和块号对应的数据
|
async getLoopData(item) {
|
const { data } = await this.$api.reboSystem.searchRing({
|
proId:item.proId,sizeId:item.sizeId
|
})
|
return data;
|
},
|
//自定义下拉刷新
|
refresherrefreshBear: throttle(function() {
|
this.statusBear = 'loading';
|
this.pageNum = 1;
|
this.searchProductRebarLists();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLowerBear: throttle(function() {
|
this.statusBear = 'loading';
|
if(this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.statusBear = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
},1000)
|
return
|
} else {
|
this.pageNum+=1
|
let params = {
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
}
|
this.$api.reboSystem.searchProjectSize(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
let arrAdd = []
|
arrAdd = res.data.list.map((item) => {
|
this.getBlockData(item.proId).then((data) => {
|
this.$set(item, 'blokDtos', data.blokDtos || []);
|
this.$set(item, 'hasDtos', data.hasDtos || []);
|
})
|
this.getLoopData(item).then((data) => {
|
this.$set(item, 'info', data.info || []);
|
this.$set(item, 'looping', data.looping || []);
|
})
|
return item;
|
});
|
this.productBears.push(...arrAdd)
|
this.loadPage = res.data.pages;
|
this.triggeredBear = false;
|
this.statusBear = 'nomore';
|
}else{
|
uni.$u.toast(res.statusMsg);
|
}
|
}).catch((err) => {
|
uni.$u.toast('请检查网络服务或联系管理员!')
|
})
|
}
|
}, 1500),
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.product_monitor{
|
height: 100vh;
|
padding: 10px 15px;
|
background-color: #fff;
|
|
.product_bear_scroll{
|
height: 88%;
|
.product_bear{
|
// height: 80%;
|
|
.product_bear_headers{
|
padding-top: 10px;
|
padding-left: 12px;
|
color: rgba(51, 51, 51, 1);
|
font-size: 17px;
|
font-weight: bold;
|
position: relative;
|
&::before{
|
content: "";
|
position: absolute;
|
top: 11px;
|
left: 0;
|
width: 2px;
|
height: 16px;
|
background-color: rgba(25, 119, 255, 1);
|
}
|
}
|
|
.product_bear_lists{
|
padding-top: 10px;
|
.product_list_headers{
|
height: 60px;
|
padding-left: 12px;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-around;
|
border-radius: 2px;
|
background-color: rgba(108, 146, 249, .16);
|
.prodeuct_headers_titles{
|
color: rgba(25, 119, 255, 1);
|
font-size: 17px;
|
font-weight: bold;
|
}
|
.prodeuct_headers_titles1{
|
color: rgba(51, 51, 51, 1);
|
font-size: 15px;
|
font-weight: 500;
|
}
|
}
|
|
.product_list_main{
|
padding-top: 10px;
|
.product_main_rows{
|
height: 50px;
|
display: flex;
|
border-radius: 2px;
|
background-color: rgba(108, 146, 249, 1);
|
.product_rows_text{
|
span{
|
color: rgba(255, 255, 255, .92);
|
}
|
position: relative;
|
flex: none;
|
width: 100px;
|
height: 50px;
|
&::before{
|
content: '';
|
width: 85px;
|
height: 2px;
|
background: rgba(255, 255, 255, .19);
|
position: absolute;
|
top: 22px;
|
left: -13px;
|
transform: rotateZ(38deg);
|
}
|
}
|
.product_rows_datas{
|
display: flex;
|
flex: 1;
|
align-items: center;
|
justify-content: center;
|
font-size: 17px;
|
font-weight: bold;
|
color: rgba(255, 255, 255, .92);
|
}
|
}
|
.product_main_columns{
|
display: flex;
|
text-align: center;
|
.product_columns_one{
|
display: flex;
|
flex-direction: column;
|
|
.product_columns_titles{
|
color: rgba(25, 119, 255, 1);
|
font-size: 15px;
|
font-weight: 500;
|
width: 100px;
|
line-height: 50px;
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
&:nth-child(even){
|
background-color: rgba(108, 146, 249, .12);
|
border-top-left-radius: 2px;
|
border-bottom-left-radius: 2px;
|
}
|
}
|
}
|
.product_columns_datas{
|
display: flex;
|
flex: 1;
|
align-items: center;
|
justify-content: center;
|
color: rgba(102, 102, 102, 1);
|
font-size: 15px;
|
font-weight: 500;
|
&:nth-child(even){
|
background-color: rgba(108, 146, 249, .12);
|
// border-radius: 2px;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
.product_ring{
|
// height: 200px;
|
margin-bottom: 20px;
|
|
.product_ring_headers{
|
padding-top: 10px;
|
padding-left: 12px;
|
color: rgba(51, 51, 51, 1);
|
font-size: 17px;
|
font-weight: bold;
|
position: relative;
|
&::before{
|
content: "";
|
position: absolute;
|
top: 11px;
|
left: 0;
|
width: 2px;
|
height: 16px;
|
background-color: rgba(25, 119, 255, 1);
|
}
|
}
|
.product_ring_main{
|
margin-top: 10px;
|
padding-left: 10px;
|
line-height:40px;
|
border-radius: 2px;
|
background-color: rgba(108, 146, 249, .12);
|
.product_ring_title{
|
font-size: 17px;
|
font-weight: bold;
|
color: rgba(51, 51, 51, .92);
|
}
|
.product_ring_datas{
|
font-size: 20px;
|
color: rgba(25, 119, 255, 1);
|
font-weight: bold;
|
}
|
}
|
}
|
}
|
</style>
|