172 lines
3.8 KiB
Vue
172 lines
3.8 KiB
Vue
<template>
|
||
<view class="app">
|
||
<view class="item" v-for="item in list">
|
||
<view class="time">
|
||
{{item.date}}
|
||
</view>
|
||
<view class="name">
|
||
{{item.reportId}}
|
||
</view>
|
||
<view class="btn" v-if="item.existReport==1" @tap='lookReport(item)'>
|
||
<span>查看报告</span>
|
||
</view>
|
||
<view class="btn2" v-if="item.existReport==2">
|
||
<span>暂无报告</span>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
dyrecord,
|
||
dzrecord,
|
||
dyreport,
|
||
dzreport
|
||
} from '@/api/pagesC/testreport/index.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
list: [],
|
||
region: undefined,
|
||
};
|
||
},
|
||
onLoad() {
|
||
this.region = uni.getStorageSync('region')
|
||
if (this.region == 1) {
|
||
dzrecord('370785199502153071').then(res => {
|
||
res.data.forEach(e => {
|
||
e.existReport = Number(e.existReport)
|
||
})
|
||
this.list = res.data
|
||
})
|
||
} else if (this.region == 2) {
|
||
dyrecord('370785199502153071').then(res => {
|
||
res.data.forEach(e => {
|
||
e.existReport = Number(e.existReport)
|
||
})
|
||
this.list = res.data
|
||
})
|
||
}
|
||
},
|
||
methods: {
|
||
// 东营获取驿站报告接口:http://218.58.213.15:8009/fd/sh05/report/view/{reportId}
|
||
// 德州获取驿站报告接口:http://112.6.122.71:8009/fd/sh05/report/view/{reportId}
|
||
lookReport(item) {
|
||
if (this.region == 1) {
|
||
uni.downloadFile({
|
||
url: `http://112.6.122.71:8009/fd/sh05/report/download/${item.reportId}`,
|
||
success: function(res) {
|
||
console.log(res)
|
||
var filePath = res.tempFilePath;
|
||
uni.openDocument({
|
||
filePath: filePath,
|
||
showMenu: true,
|
||
fileType: 'pdf',
|
||
success: function(resp) {
|
||
console.log(resp)
|
||
console.log('打开文档成功');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
} else if (this.region == 2) {
|
||
uni.downloadFile({
|
||
url: `http://8.131.93.145:54098/fd/sh05/report/download/${item.reportId}`,
|
||
success: function(res) {
|
||
console.log(res)
|
||
var filePath = res.tempFilePath;
|
||
uni.openDocument({
|
||
filePath: filePath,
|
||
fileType: 'pdf',
|
||
showMenu: true,
|
||
success: function(resp) {
|
||
console.log(resp)
|
||
console.log('打开文档成功');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.app {
|
||
.item {
|
||
height: 200rpx;
|
||
width: 96%;
|
||
background-color: #fff;
|
||
border-radius: 5rpx;
|
||
margin: 20rpx auto 0;
|
||
position: relative;
|
||
overflow: hidden;
|
||
|
||
.btn2 {
|
||
/* 左上角飘带 */
|
||
background-color: #A4A0A0;
|
||
/* 左上角飘带的背景颜色 */
|
||
overflow: hidden;
|
||
white-space: nowrap;
|
||
/* 文字不换行*/
|
||
position: absolute;
|
||
/* 绝对定位 */
|
||
right: -60rpx;
|
||
top: 20rpx;
|
||
transform: rotate(45deg);
|
||
/* 旋转45°*/
|
||
box-shadow: 0 0 10rpx #888;
|
||
/* 飘带的阴影*/
|
||
}
|
||
|
||
.btn2 span {
|
||
border: 1rpx solid #A4A0A0;
|
||
color: #fff;
|
||
display: block;
|
||
font: bold 100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||
margin: 1rpx 0;
|
||
padding: 10rpx 50rpx;
|
||
text-align: center;
|
||
text-shadow: 0 0 5rpx #444;
|
||
}
|
||
|
||
.btn {
|
||
/* 左上角飘带 */
|
||
background-color: #FFA115;
|
||
/* 左上角飘带的背景颜色 */
|
||
overflow: hidden;
|
||
white-space: nowrap;
|
||
/* 文字不换行*/
|
||
position: absolute;
|
||
/* 绝对定位 */
|
||
right: -60rpx;
|
||
top: 20rpx;
|
||
transform: rotate(45deg);
|
||
/* 旋转45°*/
|
||
box-shadow: 0 0 10rpx #888;
|
||
/* 飘带的阴影*/
|
||
}
|
||
|
||
.btn span {
|
||
border: 1rpx solid #FFA115;
|
||
color: #fff;
|
||
display: block;
|
||
font: bold 100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||
margin: 1rpx 0;
|
||
padding: 10rpx 50rpx;
|
||
text-align: center;
|
||
text-shadow: 0 0 5rpx #444;
|
||
}
|
||
|
||
.name {
|
||
margin: 20rpx 0 0 20rpx;
|
||
}
|
||
|
||
.time {
|
||
margin: 20rpx 0 0 20rpx;
|
||
}
|
||
}
|
||
}
|
||
</style> |