203 lines
4.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="barBox" :style="{'height': barBoxHeight + 'px'}">
<view class="fixedheader">
<headers :themeType="'white'" :showBack="true">
<view class="headerName">
不良记录
</view>
</headers>
</view>
</view>
<scroll-view :scroll-y="true" class="scrollBox" :style="{height: scrollHeight + 'px'}" v-if="listData.length > 0">
<view v-for="(item,index) in listData" :key="index">
<view class="itemBox">
<view class="itemLine">
<text class="itemLine-left">发生事项</text>
<text class="itemLine-right">{{item.ariseMatter || '--'}}</text>
</view>
<view class="itemLine">
<text class="itemLine-left">发生原因</text>
<text class="itemLine-right">{{item.ariseReason || '--'}}</text>
</view>
<view class="itemLine">
<text class="itemLine-left">发生时间</text>
<text class="itemLine-right">{{item.ariseTime || '--'}}</text>
</view>
<view class="itemLine">
<text class="itemLine-left">备注</text>
<text class="itemLine-right">{{item.remarks || '--'}}</text>
</view>
</view>
</view>
<view class="" style="height: 20rpx;"></view>
</scroll-view>
<view class="no_data" v-if="listData.length == 0">
<image src="/static/noData.png"></image>
<view>暂无数据</view>
</view>
<!-- <view class="noData" :style="{height: screenHeight + 'px'}" v-if="listData.length == 0">
暂无数据
</view> -->
</view>
</template>
<script>
export default {
data() {
return {
id: '',
projectId: '',
barBoxHeight: '',
scrollHeight: '',
listData: [],
};
},
onReady() {
this.getHeight()
},
onLoad(option) {
this.id = option.id
this.projectId = option.projectId
this.getListData()
},
methods: {
async getHeight() {
const query = uni.createSelectorQuery().in(this);
let fixedheaderHeight = 0
const fixedHeaderPromise = new Promise((resolve) => {
query.select('.fixedheader').boundingClientRect(data => {
fixedheaderHeight = data.height
console.log('fixedheaderHeight', data.height);
resolve();
}).exec();
});
let mobileTopHeight = 0
const systemInfoPromise = new Promise((resolve) => {
uni.getSystemInfo({
success(res) {
mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
resolve();
}
});
});
await fixedHeaderPromise;
await systemInfoPromise;
this.barBoxHeight = fixedheaderHeight + mobileTopHeight;
console.log('this.barBoxHeight', this.barBoxHeight);
let screenHeight = uni.getSystemInfoSync().screenHeight;
console.log('screenHeight', screenHeight);
this.scrollHeight = screenHeight - this.barBoxHeight;
console.log('this.scrollHeight', this.scrollHeight);
},
getListData(){
let data = {
enterpriseId: this.projectId,
}
this.sendRequest({
url: 'xmgl/enterpriseBadRecord/list',
method: 'post',
data: data,
success: res => {
console.log("enterpriseBadRecord", res);
this.listData = res.result
}
})
}
}
}
</script>
<style lang="scss" scoped>
.barBox {
// background-color: #5181F6;
background-color: #f6f6f6;
min-height: 100%;
height: 44px;
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
.headerName {
z-index: 1;
}
}
}
.scrollBox {
height: 100%;
width: 100%;
background-color: #f4f5fd;
// margin: 0 20rpx;
word-break: break-all;
.itemBox {
width: calc(100% - 40rpx);
min-height: 240rpx;
margin: 0 20rpx;
margin-top: 20rpx;
border: 1px solid rgba(219, 229, 255, 0.6);
border-radius: 20rpx;
padding: 30rpx 40rpx;
background-color: #fff;
box-shadow: 0px 8rpx 15rpx 0px rgba(219,229,255,0.6);
// background-color: darkred;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.itemLine{
display: flex;
flex-direction: row;
margin-bottom: 20rpx;
.itemLine-left{
width: 30%;
display: flex;
justify-content: flex-end;
}
.itemLine-right{
flex: 1;
}
}
.itemLine:last-child{
margin-bottom: 0;
}
}
}
.no_data{
position: fixed;
top: 35%;
// transform: translateY(-50%);
left: 50%;
transform: translateX(-50%);
padding-top: 60rpx;
text-align: center;
color: rgba(0,0,0,0.5);
font-size: 28rpx;
uni-image{
width: 162rpx;
height: 130rpx;
display: block;
margin: 0 auto;
margin-bottom: 40rpx;
}
}
.noData{
display: flex;
justify-content: center;
align-items: center;
font-size: 34px;
color: darkgray;
transform: translateY(-60px);
}
</style>