392 lines
8.1 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 class="dangerbig-list">
<view class="fixedheader">
<headers class="" :showBack="true">
<view class="headerName">
文明施工周报
</view>
</headers>
<view class="uni-form-item" style="background-color: #ffffff;">
<input class="uni-input" name="searchName" v-model="searchName"
placeholder="请输入标题" />
<!-- <uni-icons2 class="search-icon" type="search" @click="loadData"></uni-icons2> -->
<button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button>
</view>
</view>
<view :style="{ 'padding-top': (statusBarHeight + 90) * 2 + 'rpx' }">
<view class="list" v-if="workList && workList.length>0">
<!-- @click="checkItem(item)" -->
<view class="list-item" v-for="(item,index) in workList" :key="index" >
<!-- <view class="list-title">
<view>
编号{{item.no}}
</view>
</view> -->
<view class="list-content">
<view class="list-info">
<view class="">
标题
</view>
<view class="">
{{item.title}}
</view>
</view>
<view class="list-info">
<view class="">
时间
</view>
<view class="">
{{item.createTime}}
</view>
</view>
<view class="list-info">
<view class="">
附件
</view>
<view style="color: #1684FC;" class="detail-data" @click="downloadFn(ele)" v-for="ele in item.image" :key="ele.id">
{{ele.name}}
</view>
</view>
</view>
</view>
<view class="loadMoreBox" v-if="isLoadMore">
<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
</view>
</view>
<view class="no-data" v-else>
<image class="img" src="/static/noData.png"></image>
<text class="txt">暂无数据</text>
</view>
</view>
</view>
</template>
<script>
import {
isJSON
} from '@/utils/tool.js'
export default {
data() {
return {
statusBarHeight: 0,
pageNo: 1,
pageSize: 10,
projectSn: "",
listData: [],
isLoadMore: false,
loadStatus: 'more',
workList: [],
workCategoryList: [{
id: 1,
workCategoryName: "EPC"
}, {
id: 2,
workCategoryName: "E+P+C"
}],
searchName: "",
}
},
onShow() {
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
},
onLoad() {
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
// this.initData()
this.getWorkList()
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getWorkList()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.listData = []
this.getWorkList()
},
methods: {
loadData() {
this.pageNo = 1
this.workList = []
this.getWorkList()
},
getWorkList() {
let data = {
title: this.searchName,
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectSn
}
this.sendRequest({
url: 'xmgl/sceneExposeSpecial/page',
method: 'get',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
// this.listData = res.result.records
// this.workList=this.workList.concat(res.result)
this.workList = this.workList.concat(res.result.records.map(item => {
return {
...item,
image: isJSON(item.fileUrl) ? JSON
.parse(item.fileUrl) : [],
}
}))
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
checkItem(val) {
console.log(val)
uni.navigateTo({
url: './detail?id=' + val.id
})
},
downloadFn(row) {
let that = this;
let src = row.url.includes('http://') ? row.url : that.url_config + 'image/' + row.url;
uni.downloadFile({
url: src, //仅为示例,并非真实的资源
success: (res) => {
console.log(res)
if (res.statusCode === 200) {
// uni.showToast({
// title:'下载成功'
// })
var filePath = res.tempFilePath;
if (!filePath) return
uni.openDocument({
filePath: filePath,
success: function(res) {
console.log(res);
console.log('打开文档成功');
uni.showToast({
title: '打开文档成功'
})
}
});
} else {
uni.showToast({
title: '下载失败'
})
}
}
});
},
}
}
</script>
<style lang="scss" scoped>
.uni-form-item {
position: relative;
// width: 100%;
// padding: 0 20rpx;
// height: 60rpx;
display: flex;
margin: 24rpx 40rpx;
background-color: #FFFFFF;
border-radius: 48rpx;
justify-content: space-between;
.search-icon {
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
}
.mini-btn {
width: 120rpx;
font-size: 24rpx;
border-radius: 100rpx;
margin: 0;
}
}
.uni-input {
flex: 1;
border-radius: 30rpx;
// margin: 20rpx 20rpx;
background-color: #ffffff;
height: 60rpx;
line-height: 60rpx;
padding: 0 40rpx;
font-size: 28rpx;
width: 65%;
}
.dangerbig-list {
min-height: 100%;
// background: #F6F6F6;
background-color: #F3F5F7;
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
background-color: #F3F5F7;
.headerName {
z-index: 1;
}
}
.list {
padding: 20rpx 0;
margin: 0 20rpx;
.list-item {
background: #fff;
margin-bottom: 20rpx;
// padding: 20rpx 0;
padding-top: 10rpx;
position: relative;
border-radius: 24rpx;
.list-title {
padding: 10rpx 40rpx;
// border-bottom: 4rpx solid #F6F6F6;
display: flex;
align-items: center;
justify-content: space-between;
color: #1A1A1A;
.tag {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
margin-right: 20rpx;
margin-left: -20rpx;
height: 32rpx;
}
.status1 {
background: #2b8df3;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status2 {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status3 {
background: #B22222;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status4 {
background: #ccc;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
}
.list-content {
margin-top: 14rpx;
padding-bottom: 20rpx;
border-bottom: 1px dashed #CCCCCC;
}
.list-info {
display: flex;
padding: 10rpx 40rpx;
margin-left: 40rpx;
font-size: 28rpx;
// border-bottom: 2rpx solid #F6F6F6;
color: #444444;
position: relative;
>view:first-child {
width: 220rpx;
}
>view:last-child {
flex: 1;
word-break: break-all;
}
}
.list-info::after {
content: '';
width: 15rpx;
height: 15rpx;
background-color: #007BF5;
border-radius: 50%;
border: 10rpx solid #EBF0FA;
position: absolute;
left: 0;
top: 14rpx;
// top: 50%;
// transform: translateY(-50%);
}
.info-status {
padding: 0 10rpx;
border: 1px solid #DD524D;
border-radius: 6rpx;
color: #DD524D;
margin-left: 10rpx;
}
}
}
.btn {
height: 96rpx;
width: 100%;
line-height: 96rpx;
text-align: center;
background: #4181FE;
color: #fff;
position: fixed;
bottom: 0;
left: 0;
}
.no-data {
text-align: center;
.img {
display: block;
height: 200rpx;
width: 200rpx;
margin: 0 auto;
margin-top: 560rpx;
margin-bottom: 60rpx;
}
.txt {
color: #CFC8CC;
}
}
}
</style>