2026-03-17 14:00:55 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="dateReport">
|
|
|
|
|
|
<view class="pd20">
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<uni-segmented-control :current="curSub" class="subsection" active-color="#376cf3" :values="subsectionList"
|
|
|
|
|
|
@clickItem="sectionChange" />
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<!-- 申请报告 -->
|
|
|
|
|
|
<view v-show="curSub == 0">
|
2026-03-17 14:00:55 +08:00
|
|
|
|
<!-- apply -->
|
2026-04-13 10:12:04 +08:00
|
|
|
|
<Apply ref="applyRef" :navHeight="navHeight" />
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 申请记录 -->
|
|
|
|
|
|
<view v-if="curSub == 1">
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<view class="filterCriteria">
|
|
|
|
|
|
<!-- 筛选条件 -->
|
|
|
|
|
|
<Cn-filterCriteria @select="select" :showQianTree="false"> </Cn-filterCriteria>
|
|
|
|
|
|
</view>
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<scroll-view scroll-y="true" @refresherrefresh="refresherrefresh" @scrolltolower="scrolltolower"
|
|
|
|
|
|
:refresher-triggered="triggered" refresher-enabled="true" class="record event-list mt20"
|
|
|
|
|
|
:style="{ height: 'calc(100vh - ' + (navHeight + height) + 'px)', overflow: 'auto' }">
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<uni-card class="event-item" :class="item.type" v-for="(item, index) in store.data" :key="index">
|
2026-03-17 14:00:55 +08:00
|
|
|
|
<!-- 头部:图标 + 信息 + 操作 -->
|
|
|
|
|
|
<view class="event-header">
|
2026-04-17 08:50:07 +08:00
|
|
|
|
<view class="event-icon">
|
|
|
|
|
|
<!-- :style="{ backgroundColor: item.isComplete == 1 ? '#10b98120' : '#FF000020' }" -->
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<!-- 动态图标:根据类型切换 -->
|
2026-04-17 08:50:07 +08:00
|
|
|
|
<!-- <uni-icons
|
2026-03-30 08:43:13 +08:00
|
|
|
|
custom-prefix="iconfont"
|
|
|
|
|
|
type="icon-baogaoguanli"
|
|
|
|
|
|
size="40"
|
|
|
|
|
|
:color="item.isComplete == 1 ? '#10b981' : '#FF0000'"
|
2026-04-17 08:50:07 +08:00
|
|
|
|
></uni-icons> -->
|
|
|
|
|
|
<Cn-icon-transient :name="`报告`" />
|
2026-03-30 08:43:13 +08:00
|
|
|
|
</view>
|
2026-03-17 14:00:55 +08:00
|
|
|
|
<view class="event-info">
|
|
|
|
|
|
<view class="event-title">
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<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">
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<view class="iconText boxClick" v-if="item.isComplete == 1" @click="download(item)">
|
|
|
|
|
|
<uni-icons type="arrow-down" color="#fff" size="16"></uni-icons>
|
2026-03-30 08:43:13 +08:00
|
|
|
|
</view>
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<view class="nav-menu nav-menu-btn boxClick"
|
|
|
|
|
|
v-else-if="userInfo.authorities === 'operation_manager'" @click="generate(item)">生成报告
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- 详情区域 -->
|
|
|
|
|
|
<view class="event-detail">
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<!-- <view class="device-body"> -->
|
|
|
|
|
|
<view class="device-body-item">
|
|
|
|
|
|
<text>申请人:</text>
|
|
|
|
|
|
<text>{{ item.applyUser }}</text>
|
|
|
|
|
|
</view>
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<view class="device-body-item">
|
|
|
|
|
|
<text>报告状态:</text>
|
|
|
|
|
|
<text :style="{ color: item.isComplete == 1 ? '#10b981' : '#FF0000' }">{{
|
|
|
|
|
|
item.isComplete == 1 ? '已完成' : '未完成'
|
|
|
|
|
|
}}</text>
|
|
|
|
|
|
</view>
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<view class="device-body-item">
|
|
|
|
|
|
<text>申请时间:</text>
|
|
|
|
|
|
<text>{{ item.time }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="device-body-item">
|
|
|
|
|
|
<text>暂降事件:</text>
|
|
|
|
|
|
<text>{{ item.eventNums }}次</text>
|
|
|
|
|
|
</view>
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-17 14:00:55 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<!-- <view class="device-body-item">
|
|
|
|
|
|
<text>申请时间:</text>
|
|
|
|
|
|
<text>{{ item.time }}</text>
|
|
|
|
|
|
</view> -->
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</view>
|
2026-03-30 08:43:13 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- </view> -->
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</uni-card>
|
2026-04-25 15:22:50 +08:00
|
|
|
|
<uni-load-more v-if="store.status == 'loading' || (store.data && store.data.length > 0)"
|
|
|
|
|
|
:status="store.status"></uni-load-more>
|
2026-03-30 08:43:13 +08:00
|
|
|
|
<Cn-empty v-else style="top: 30%"></Cn-empty>
|
2026-04-17 08:50:07 +08:00
|
|
|
|
</scroll-view>
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import Apply from './apply.vue'
|
2026-03-30 08:43:13 +08:00
|
|
|
|
import list from '@/common/js/list'
|
|
|
|
|
|
import { createEventReport, downloadEventReport } from '@/common/api/report.js'
|
2026-03-17 14:00:55 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
components: { Apply },
|
|
|
|
|
|
props: {
|
|
|
|
|
|
indexList: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => [],
|
|
|
|
|
|
},
|
|
|
|
|
|
total: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
// status: {
|
|
|
|
|
|
// type: String,
|
|
|
|
|
|
// default: 'more',
|
|
|
|
|
|
// },
|
|
|
|
|
|
navHeight: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2026-03-30 08:43:13 +08:00
|
|
|
|
mixins: [list],
|
2026-03-17 14:00:55 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: ['0'],
|
|
|
|
|
|
content: 123,
|
|
|
|
|
|
curSub: 0,
|
2026-03-30 08:43:13 +08:00
|
|
|
|
subsectionList: ['申请报告', '申请记录'],
|
2026-03-17 14:00:55 +08:00
|
|
|
|
form: {
|
|
|
|
|
|
type: 0,
|
|
|
|
|
|
lindId: '',
|
|
|
|
|
|
},
|
2026-04-17 08:50:07 +08:00
|
|
|
|
triggered: true,
|
2026-03-30 08:43:13 +08:00
|
|
|
|
userInfo: {},
|
|
|
|
|
|
height: 0,
|
|
|
|
|
|
selectValue: {},
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-04-25 15:22:50 +08:00
|
|
|
|
created() { },
|
2026-03-30 08:43:13 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
|
|
|
|
|
},
|
2026-03-17 14:00:55 +08:00
|
|
|
|
computed: {},
|
|
|
|
|
|
methods: {
|
2026-03-30 08:43:13 +08:00
|
|
|
|
setHeight() {
|
|
|
|
|
|
uni.createSelectorQuery()
|
|
|
|
|
|
.select('.filterCriteria')
|
|
|
|
|
|
.boundingClientRect((rect) => {
|
|
|
|
|
|
//
|
|
|
|
|
|
// #ifdef H5
|
2026-04-13 10:12:04 +08:00
|
|
|
|
this.height = rect?.height + 180 || 0
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef APP-PLUS
|
2026-04-13 10:12:04 +08:00
|
|
|
|
this.height = rect?.height + 110 || 0
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// #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
|
2026-04-24 09:13:17 +08:00
|
|
|
|
this.store.loadedCallback = () => {
|
|
|
|
|
|
this.setHeight()
|
|
|
|
|
|
}
|
2026-03-30 08:43:13 +08:00
|
|
|
|
this.store.reload()
|
|
|
|
|
|
},
|
|
|
|
|
|
async select(val) {
|
|
|
|
|
|
this.selectValue = val
|
|
|
|
|
|
await this.init()
|
2026-03-17 14:00:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
sectionChange(index) {
|
|
|
|
|
|
this.curSub = index.currentIndex
|
|
|
|
|
|
},
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// 生成报告
|
|
|
|
|
|
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,
|
2026-04-01 10:00:04 +08:00
|
|
|
|
})
|
|
|
|
|
|
.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
|
|
|
|
|
|
// 如果是安卓的话弹出提示
|
2026-03-30 08:43:13 +08:00
|
|
|
|
|
2026-04-01 10:00:04 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
mask: true,
|
|
|
|
|
|
title: '下载成功!',
|
|
|
|
|
|
duration: 1000,
|
2026-03-30 08:43:13 +08:00
|
|
|
|
})
|
2026-04-01 10:00:04 +08:00
|
|
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
//ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
//打开文档查看
|
|
|
|
|
|
uni.openDocument({
|
|
|
|
|
|
filePath: data.savedFilePath,
|
|
|
|
|
|
success: function (ress) {
|
|
|
|
|
|
console.log('成功打开文件')
|
|
|
|
|
|
},
|
|
|
|
|
|
fail() {
|
|
|
|
|
|
console.log('打开文件失败')
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('下载成功')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
mask: true,
|
|
|
|
|
|
title: '下载失败!',
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-04-25 15:22:50 +08:00
|
|
|
|
fail: function (res) { },
|
2026-04-01 10:00:04 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
mask: true,
|
|
|
|
|
|
title: err.message,
|
|
|
|
|
|
duration: 1000,
|
|
|
|
|
|
})
|
2026-03-30 08:43:13 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
2026-04-13 10:12:04 +08:00
|
|
|
|
// 刷新
|
|
|
|
|
|
reload() {
|
|
|
|
|
|
switch (this.curSub) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
this.$refs.applyRef.store.reload()
|
|
|
|
|
|
break
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
this.store && this.store.reload()
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-04-17 08:50:07 +08:00
|
|
|
|
// 下拉
|
|
|
|
|
|
refresherrefresh() {
|
|
|
|
|
|
this.triggered = true
|
|
|
|
|
|
uni.startPullDownRefresh()
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.triggered = false
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
},
|
|
|
|
|
|
// 上拉
|
|
|
|
|
|
scrolltolower() {
|
|
|
|
|
|
if (this.store.status != 'noMore') {
|
|
|
|
|
|
this.store.next && this.store.next()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-03-17 14:00:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch: {},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
@import '@/pages/message1/index.scss';
|
|
|
|
|
|
|
|
|
|
|
|
.event-detail {
|
|
|
|
|
|
display: grid;
|
2026-04-25 15:22:50 +08:00
|
|
|
|
grid-template-columns: 1.6fr 1fr;
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
2026-03-30 08:43:13 +08:00
|
|
|
|
|
|
|
|
|
|
// /deep/ .record {
|
|
|
|
|
|
// .uni-card__content {
|
|
|
|
|
|
// padding: 55rpx 20rpx 20rpx !important;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
.filterCriteria {
|
|
|
|
|
|
.nav {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
.choose1 {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
/deep/ .uni-checkbox-input {
|
|
|
|
|
|
width: 30rpx;
|
|
|
|
|
|
height: 30rpx;
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
|
}
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// .device-body {
|
|
|
|
|
|
// padding: 10rpx 20rpx 20rpx;
|
2026-03-17 14:00:55 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
.device-body-item {
|
2026-03-17 14:00:55 +08:00
|
|
|
|
display: flex;
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// justify-content: space-between;
|
2026-04-25 15:22:50 +08:00
|
|
|
|
font-size: 28rpx;
|
2026-03-30 08:43:13 +08:00
|
|
|
|
color: #666666;
|
|
|
|
|
|
line-height: 1.5;
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
// }
|
|
|
|
|
|
.iconText {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
width: 45rpx;
|
|
|
|
|
|
height: 45rpx;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
background-color: $uni-theme-color;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
.nav-menu {
|
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
|
padding: 6rpx 20rpx;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
|
background: #ebeaec;
|
|
|
|
|
|
color: #666;
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
&-active {
|
|
|
|
|
|
background: #dfe5f7;
|
|
|
|
|
|
color: $uni-theme-color;
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-03-30 08:43:13 +08:00
|
|
|
|
&-btn {
|
|
|
|
|
|
background: $uni-theme-color;
|
|
|
|
|
|
color: #fff;
|
2026-03-17 14:00:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-04-17 08:50:07 +08:00
|
|
|
|
.event-list {
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-04-17 08:50:07 +08:00
|
|
|
|
/* 图标区域(按类型区分背景色) */
|
|
|
|
|
|
.event-icon {
|
|
|
|
|
|
background-color: #376cf320;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-04-13 10:12:04 +08:00
|
|
|
|
.segmented-control {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
margin-right: 24rpx;
|
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
|
}
|
2026-04-25 15:22:50 +08:00
|
|
|
|
|
2026-04-24 09:13:17 +08:00
|
|
|
|
/deep/ .uni-scroll-view-refresher {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
2026-03-17 14:00:55 +08:00
|
|
|
|
</style>
|