联调app
This commit is contained in:
@@ -10,57 +10,106 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 申请报表 -->
|
||||
<view v-if="curSub == 0">
|
||||
<!-- 申请报告 -->
|
||||
<view v-show="curSub == 0">
|
||||
<!-- apply -->
|
||||
<Apply :navHeight="navHeight"/>
|
||||
<Apply :navHeight="navHeight" />
|
||||
</view>
|
||||
|
||||
<!-- 申请记录 -->
|
||||
<view v-if="curSub == 1">
|
||||
<view class="filterCriteria">
|
||||
<!-- 筛选条件 -->
|
||||
<Cn-filterCriteria @select="select" :showQianTree="false"> </Cn-filterCriteria>
|
||||
</view>
|
||||
<view
|
||||
class="record event-list"
|
||||
v-if="eventList.length != 0"
|
||||
:style="{ height: 'calc(100vh - ' + (navHeight + 56) + 'px)', overflow: 'auto' }"
|
||||
class="record event-list mt20"
|
||||
:style="{ height: 'calc(100vh - ' + (navHeight + height) + 'px)', overflow: 'auto' }"
|
||||
>
|
||||
<!-- 循环渲染事件项 -->
|
||||
<uni-card class="event-item" :class="item.type" v-for="(item, index) in eventList" :key="index">
|
||||
<view class="title" :class="item.status == 1 ? 'completed' : 'incomplete'">
|
||||
<view> {{ item.status == 1 ? '已完成' : '未完成' }} </view>
|
||||
</view>
|
||||
<uni-card class="event-item" :class="item.type" v-for="(item, index) in store.data" :key="index">
|
||||
<!-- 头部:图标 + 信息 + 操作 -->
|
||||
<view class="event-header">
|
||||
<view
|
||||
class="event-icon"
|
||||
:style="{ backgroundColor: item.isComplete == 1 ? '#10b98120' : '#FF000020' }"
|
||||
>
|
||||
<!-- 动态图标:根据类型切换 -->
|
||||
<uni-icons
|
||||
custom-prefix="iconfont"
|
||||
type="icon-baogaoguanli"
|
||||
size="40"
|
||||
:color="item.isComplete == 1 ? '#10b981' : '#FF0000'"
|
||||
></uni-icons>
|
||||
</view>
|
||||
<view class="event-info">
|
||||
<view class="event-title">
|
||||
<text class="event-id">{{ item.id }}</text>
|
||||
<text class="event-tags">{{ item.tag }}</text>
|
||||
<text class="event-id">{{ item.lineName }}</text>
|
||||
</view>
|
||||
<view class="event-desc">
|
||||
<text>工程名称:{{ item.engineeringName }}</text>
|
||||
<text>项目名称:{{ item.projectName }}</text>
|
||||
<text>设备名称:{{ item.deviceName }}</text>
|
||||
<!-- <text>申请时间:{{ item.time }}</text>
|
||||
<text>事件数:{{ item.eventNums }}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="event-action">
|
||||
<view class="iconText" v-if="item.isComplete == 1" @click="download(item)"
|
||||
><uni-icons type="arrow-down" color="#fff" size="16"></uni-icons>
|
||||
</view>
|
||||
<view
|
||||
class="nav-menu nav-menu-btn"
|
||||
v-else-if="userInfo.authorities === 'operation_manager'"
|
||||
@click="generate(item)"
|
||||
>生成报告
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 详情区域 -->
|
||||
<view class="event-detail">
|
||||
<text>申请人:xxx</text>
|
||||
<text>电话号码:18888888888</text>
|
||||
</view>
|
||||
<view class="downloadReport">
|
||||
<!-- <u-icon :name="item.status == 1 ? 'download' : 'upload'" color="#376cf3" size="40"></u-icon> -->
|
||||
<uni-icons
|
||||
:type="item.status == 1 ? 'download' : 'upload'"
|
||||
size="16"
|
||||
color="#376cf3"
|
||||
></uni-icons>
|
||||
<!-- <view class="device-body"> -->
|
||||
<view class="device-body-item">
|
||||
<text>申请人:</text>
|
||||
<text>{{ item.applyUser }}</text>
|
||||
</view>
|
||||
<view class="device-body-item">
|
||||
<text>申请时间:</text>
|
||||
<text>{{ item.time }}</text>
|
||||
</view>
|
||||
<view class="device-body-item">
|
||||
<text>暂降事件:</text>
|
||||
<text>{{ item.eventNums }}次</text>
|
||||
</view>
|
||||
<view class="device-body-item">
|
||||
<text>申请状态:</text>
|
||||
<text
|
||||
:style="{ color: item.isComplete == 1 ? '#10b981' : '#FF0000' }"
|
||||
style="font-weight: 700"
|
||||
>{{ item.isComplete == 1 ? '已完成' : '未完成' }}</text
|
||||
>
|
||||
</view>
|
||||
|
||||
{{ item.status == 1 ? '下载报告' : '生成报告' }}
|
||||
<!-- <view class="device-body-item">
|
||||
<text>申请时间:</text>
|
||||
<text>{{ item.time }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- </view> -->
|
||||
</uni-card>
|
||||
<uni-load-more :status="status"></uni-load-more>
|
||||
<uni-load-more
|
||||
v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
|
||||
:status="store.status"
|
||||
></uni-load-more>
|
||||
<Cn-empty v-else style="top: 30%"></Cn-empty>
|
||||
</view>
|
||||
<Cn-empty v-else></Cn-empty>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import Apply from './apply.vue'
|
||||
import list from '@/common/js/list'
|
||||
import { createEventReport, downloadEventReport } from '@/common/api/report.js'
|
||||
export default {
|
||||
components: { Apply },
|
||||
props: {
|
||||
@@ -81,99 +130,205 @@ export default {
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
mixins: [list],
|
||||
data() {
|
||||
return {
|
||||
value: ['0'],
|
||||
content: 123,
|
||||
curSub: 0,
|
||||
subsectionList: ['申请报表', '申请记录'],
|
||||
subsectionList: ['申请报告', '申请记录'],
|
||||
form: {
|
||||
type: 0,
|
||||
lindId: '',
|
||||
},
|
||||
status: 'noMore',
|
||||
eventList: [
|
||||
{
|
||||
id: '测试监测点',
|
||||
tag: '2026-01-23至2026-01-23',
|
||||
status: '1',
|
||||
},
|
||||
{
|
||||
id: '测试监测点',
|
||||
tag: '2026-01-23至2026-01-23',
|
||||
status: '0',
|
||||
},
|
||||
],
|
||||
userInfo: {},
|
||||
height: 0,
|
||||
selectValue: {},
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
mounted() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
scrolltolower() {
|
||||
this.$emit('scrolltolower')
|
||||
setHeight() {
|
||||
uni.createSelectorQuery()
|
||||
.select('.filterCriteria')
|
||||
.boundingClientRect((rect) => {
|
||||
//
|
||||
// #ifdef H5
|
||||
this.height = rect?.height + 115 || 0
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.height = rect?.height + 10 || 0
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/cs-report-boot/csAppReport/getApplicationReport')
|
||||
this.store.params.startTime = this.$util.getMonthFirstAndLastDay(this.selectValue.date).firstDay
|
||||
this.store.params.endTime = this.$util.getMonthFirstAndLastDay(this.selectValue.date).lastDay
|
||||
this.store.loadedCallback = () => {}
|
||||
this.store.reload()
|
||||
},
|
||||
async select(val) {
|
||||
this.selectValue = val
|
||||
await this.init()
|
||||
this.setHeight()
|
||||
},
|
||||
getHeight() {},
|
||||
|
||||
sectionChange(index) {
|
||||
this.curSub = index.currentIndex
|
||||
},
|
||||
// 生成报告
|
||||
generate(item) {
|
||||
uni.showLoading({
|
||||
title: '生成中,请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
createEventReport({
|
||||
id: item.eventId,
|
||||
}).then((res) => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
title: '生成事件报告成功!',
|
||||
duration: 1000,
|
||||
})
|
||||
this.store.reload()
|
||||
})
|
||||
},
|
||||
// 下载报告
|
||||
download(item) {
|
||||
uni.showLoading({
|
||||
title: '下载中,请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
downloadEventReport({
|
||||
id: item.eventId,
|
||||
}).then((res) => {
|
||||
// 下载文件资源到本地
|
||||
uni.downloadFile({
|
||||
url: res.data, // 后端返回的线上文件路径
|
||||
success: function (res) {
|
||||
if (res.statusCode === 200) {
|
||||
// 文件到本地
|
||||
uni.saveFile({
|
||||
tempFilePath: res.tempFilePath, //临时路径
|
||||
success: function (data) {
|
||||
var savedFilePath = data.savedFilePath
|
||||
// 在app端执行
|
||||
// #ifdef APP-PLUS
|
||||
let osname = plus.os.name
|
||||
// 如果是安卓的话弹出提示
|
||||
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
title: '下载成功!',
|
||||
duration: 1000,
|
||||
})
|
||||
|
||||
// #endif
|
||||
//ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名
|
||||
setTimeout(() => {
|
||||
//打开文档查看
|
||||
uni.openDocument({
|
||||
filePath: data.savedFilePath,
|
||||
success: function (ress) {
|
||||
console.log('成功打开文件')
|
||||
},
|
||||
fail() {
|
||||
console.log('打开文件失败')
|
||||
},
|
||||
})
|
||||
}, 500)
|
||||
},
|
||||
})
|
||||
console.log('下载成功')
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
mask: true,
|
||||
title: '下载失败!',
|
||||
duration: 1000,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function (res) {},
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/pages/message1/index.scss';
|
||||
.event-title {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.event-tags {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.event-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: 1fr 1.2fr;
|
||||
}
|
||||
.downloadReport {
|
||||
width: 100%;
|
||||
background: #376cf320;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
color: #376cf3;
|
||||
font-weight: 600;
|
||||
border-radius: 15rpx;
|
||||
margin-top: 10rpx;
|
||||
|
||||
// /deep/ .record {
|
||||
// .uni-card__content {
|
||||
// padding: 55rpx 20rpx 20rpx !important;
|
||||
// }
|
||||
// }
|
||||
.filterCriteria {
|
||||
.nav {
|
||||
background-color: #fff;
|
||||
}
|
||||
.choose1 {
|
||||
background-color: #fff;
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
/deep/ .uni-checkbox-input {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
// .device-body {
|
||||
// padding: 10rpx 20rpx 20rpx;
|
||||
|
||||
.device-body-item {
|
||||
display: flex;
|
||||
// justify-content: space-between;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
// }
|
||||
.iconText {
|
||||
display: flex;
|
||||
width: 45rpx;
|
||||
height: 45rpx;
|
||||
border-radius: 50%;
|
||||
background-color: $uni-theme-color;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
width: calc(100% - 36rpx);
|
||||
// margin: 0 10px;
|
||||
top: 0;
|
||||
border-radius: 4px 4px 0 0;
|
||||
padding: 2px 10px;
|
||||
.nav-menu {
|
||||
height: 40rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-weight: 700;
|
||||
}
|
||||
.completed {
|
||||
background: #e1f3d8;
|
||||
color: #67c23a;
|
||||
}
|
||||
.incomplete {
|
||||
background: #fde2e2;
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
/deep/ .record {
|
||||
.uni-card__content {
|
||||
padding: 55rpx 20rpx 20rpx !important;
|
||||
border-radius: 8rpx;
|
||||
line-height: 40rpx;
|
||||
background: #ebeaec;
|
||||
color: #666;
|
||||
&-active {
|
||||
background: #dfe5f7;
|
||||
color: $uni-theme-color;
|
||||
}
|
||||
&-btn {
|
||||
background: $uni-theme-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user