修改测试问题
This commit is contained in:
@@ -127,7 +127,7 @@ export default {
|
||||
checkedAll: false,
|
||||
checkedTotal: 0,
|
||||
sort: 0,
|
||||
array: ['发生时间', '暂降深度', '持续时间'],
|
||||
array: ['发生时间', '暂降幅值', '持续时间'],
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- <view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="openDrawer"
|
||||
>{{ select.engineeringName || '工程' }}
|
||||
</view> -->
|
||||
<picker @change="projectNameChange" @cancel="selectProject = false" :value="select.projectNameIndex"
|
||||
<picker @change="projectNameChange" @cancel="selectProject = false" :value="select.projectNameIndex"
|
||||
:range="projectList" range-key="text" v-if="store.params.engineerId">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }" @click="selectProject = true">
|
||||
{{
|
||||
@@ -39,7 +39,7 @@
|
||||
</view>
|
||||
</picker> -->
|
||||
</view>
|
||||
<view class="content device" >
|
||||
<view class="content device">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item v-for="(item, index) in deviceListFilter" :threshold="0"
|
||||
:right-options="item.isTop == 0 ? options1 : options12" @click="bindClick($event, item)">
|
||||
@@ -245,6 +245,8 @@ export default {
|
||||
engineeringId: this.store.params.engineerId,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
let arr = [
|
||||
{
|
||||
text: '全部项目',
|
||||
@@ -259,6 +261,7 @@ export default {
|
||||
}),
|
||||
]
|
||||
this.projectList = arr
|
||||
|
||||
uni.setStorageSync('projectList', arr)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="monitor-section-header">
|
||||
<view class="monitor-section-header mb16">
|
||||
<view class="section-title-row section-title-row--no-mb">
|
||||
<uni-icons type="settings" size="18" color="#376cf3" />
|
||||
<text class="section-title">已选展示指标</text>
|
||||
@@ -53,9 +53,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="monitor-search">
|
||||
<uni-search-bar v-model="filterKeyword" bgColor="#fff" placeholder="搜索项目、设备、监测点"
|
||||
cancelButton="none" />
|
||||
</view>
|
||||
|
||||
<view class="monitor-list">
|
||||
<view class="monitor-card card" v-for="(point, idx) in monitoringPoints" :key="idx">
|
||||
<view class="monitor-card card" v-for="(point, idx) in filteredMonitoringPoints" :key="idx">
|
||||
<view class="card-header">
|
||||
<view class="event-icon">
|
||||
<Cn-icon-transient name="监测点" />
|
||||
@@ -63,8 +67,8 @@
|
||||
<view class="card-header-info">
|
||||
<view class="point-name-row">
|
||||
<text class="point-name ellipsis">{{ point.pointName }}</text>
|
||||
<text class="event-tag" :class="point.runStatus == 1 ? 'lx-tag' : 'zx-tag'">
|
||||
{{ point.runStatus == 1 ? '离线' : '在线' }}
|
||||
<text class="event-tag" :class="point.runStatus == 0 ? 'zx-tag' : 'lx-tag'">
|
||||
{{ point.runStatus == 0 ? '在线' : '离线' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="meta-row">
|
||||
@@ -84,7 +88,7 @@
|
||||
</view>
|
||||
<view v-if="hasTPhaseData(child)" class="phase-single">
|
||||
<text class="phase-value-vertical phase-value-vertical--neutral">{{ child.T
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
<view v-else class="phase-vertical">
|
||||
<view class="phase-item-vertical">
|
||||
@@ -111,9 +115,9 @@
|
||||
<text>更多指标</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more v-if="listStatus == 'loading' || monitoringPoints.length > 0"
|
||||
<uni-load-more v-if="listStatus == 'loading' || filteredMonitoringPoints.length > 0"
|
||||
:status="listStatus"></uni-load-more>
|
||||
<Cn-empty v-else style="top: 35%"></Cn-empty>
|
||||
<Cn-empty v-else-if="listStatus !== 'loading'" style="top: 45%"></Cn-empty>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -175,29 +179,51 @@ export default {
|
||||
],
|
||||
selectedIndicators: [],
|
||||
phaseColors: [
|
||||
{ name: 'A相', color: '#F1B22E' },
|
||||
{ name: 'B相', color: '#2BA471' },
|
||||
{ name: 'A相', color: '#DAA520' },
|
||||
{ name: 'B相', color: '#2E8B57' },
|
||||
{ name: 'C相', color: '#D54941' },
|
||||
],
|
||||
monitoringPoints: [],
|
||||
filterKeyword: '',
|
||||
listStatus: 'noMore',
|
||||
lineDataRequestId: 0,
|
||||
showBackTop: false,
|
||||
indicatorPopupShow: false,
|
||||
skipRefreshOnShow: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredMonitoringPoints() {
|
||||
const keyword = (this.filterKeyword || '').trim().toLowerCase()
|
||||
if (!keyword) return this.monitoringPoints
|
||||
return this.monitoringPoints.filter((point) => {
|
||||
const projectName = String(point.projectName || '').toLowerCase()
|
||||
const deviceName = String(point.deviceName || '').toLowerCase()
|
||||
const pointName = String(point.pointName || '').toLowerCase()
|
||||
return (
|
||||
projectName.indexOf(keyword) !== -1 ||
|
||||
deviceName.indexOf(keyword) !== -1 ||
|
||||
pointName.indexOf(keyword) !== -1
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.showBackTop = e.scrollTop > 200
|
||||
},
|
||||
// 页面显示时同步工程名称
|
||||
// 页面显示时同步工程名称;从指标详情返回时不刷新
|
||||
onShow() {
|
||||
const engineering = uni.getStorageSync('engineering')
|
||||
const skipRefresh = this.skipRefreshOnShow
|
||||
this.skipRefreshOnShow = false
|
||||
if (engineering?.id) {
|
||||
this.engineeringName = engineering.name || ''
|
||||
this.engineeringId = engineering.id
|
||||
this.info()
|
||||
if (!skipRefresh) {
|
||||
this.info()
|
||||
}
|
||||
}
|
||||
if (this.targetLists.length) {
|
||||
if (this.targetLists.length && !skipRefresh) {
|
||||
this.loadSelectedIndicators()
|
||||
}
|
||||
},
|
||||
@@ -235,6 +261,7 @@ export default {
|
||||
loadLineData() {
|
||||
this.listStatus = 'loading'
|
||||
this.monitoringPoints = []
|
||||
this.filterKeyword = ''
|
||||
const requestId = ++this.lineDataRequestId
|
||||
const engineerId = this.engineeringId
|
||||
getLineDataByEngineer({ id: engineerId })
|
||||
@@ -265,6 +292,7 @@ export default {
|
||||
pointName: point.pointName || '',
|
||||
dataTime: point.dataTime || '',
|
||||
lineType: point.lineType,
|
||||
runStatus: point.runStatus,
|
||||
children: this.groupChildren(point.children || []),
|
||||
}))
|
||||
},
|
||||
@@ -401,6 +429,7 @@ export default {
|
||||
},
|
||||
// 跳转指标详情页,展示该监测点全部指标
|
||||
onMoreIndicators(point) {
|
||||
this.skipRefreshOnShow = true
|
||||
uni.setStorageSync('monitorPointDetail', {
|
||||
...point,
|
||||
engineeringName: this.engineeringName,
|
||||
@@ -614,7 +643,7 @@ export default {
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
padding: 0 10px 16rpx;
|
||||
padding: 0 10px 0rpx;
|
||||
}
|
||||
|
||||
.legend-row {
|
||||
@@ -640,6 +669,18 @@ export default {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.monitor-search {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
padding: 16rpx 10px 16rpx;
|
||||
background: #f7f8fa;
|
||||
|
||||
/deep/ .uni-searchbar {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.monitor-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -695,8 +736,8 @@ export default {
|
||||
flex-shrink: 0;
|
||||
padding: 4rpx 12rpx;
|
||||
font-size: 22rpx;
|
||||
color: #2ba471;
|
||||
background: #2ba47115;
|
||||
color: #2E8B57;
|
||||
background: #2E8B5715;
|
||||
border-radius: 8rpx;
|
||||
line-height: 1.2;
|
||||
}
|
||||
@@ -771,7 +812,7 @@ export default {
|
||||
}
|
||||
|
||||
.phase-value-vertical {
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
|
||||
&--neutral {
|
||||
@@ -880,4 +921,8 @@ export default {
|
||||
background-color: #ff3b3020;
|
||||
color: #ff3b30;
|
||||
}
|
||||
|
||||
/deep/ .uni-searchbar__box {
|
||||
justify-content: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<view class="event-desc">
|
||||
<text>统计时间:{{
|
||||
curSub == 0 ? item.startTime : item.startTime + ' 至 ' + item.endTime
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="event-action" v-if="!showNotGenerated(item)">
|
||||
@@ -54,7 +54,7 @@
|
||||
<view class="event-detail textBox" @touchmove.stop>
|
||||
<text v-if="!showNotGenerated(item)">{{
|
||||
item.overLimitDesc == '' ? '该监测点暂无指标越限' : item.overLimitDesc
|
||||
}}</text>
|
||||
}}</text>
|
||||
<text v-else>数据未生成,暂不支持下载</text>
|
||||
</view>
|
||||
<!-- <view class="downloadReport" @click="download">
|
||||
@@ -180,46 +180,14 @@ export default {
|
||||
timeType: this.selectValue.report,
|
||||
})
|
||||
.then((res) => {
|
||||
// 下载文件资源到本地
|
||||
const match = this.$config.static + res.data.match(/excelreport([^?]*)/)[1]
|
||||
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('下载成功')
|
||||
url: match,
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
this.openReportFile(downloadRes.tempFilePath)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
@@ -228,10 +196,19 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function (res) { },
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: '下载失败!',
|
||||
duration: 1000,
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
@@ -240,6 +217,72 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
openReportFile(tempFilePath) {
|
||||
const previewFile = (filePath) => {
|
||||
uni.hideLoading()
|
||||
uni.openDocument({
|
||||
filePath,
|
||||
fileType: 'xlsx',
|
||||
showMenu: true,
|
||||
success: () => {
|
||||
console.log('成功打开文件')
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('打开文件失败', err)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '预览失败',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// iOS 需保留 xlsx 后缀,saveFile 随机路径会导致 openDocument 失败
|
||||
if (plus.os.name === 'iOS') {
|
||||
const fileName = `harmonic_report_${Date.now()}.xlsx`
|
||||
plus.io.resolveLocalFileSystemURL(
|
||||
tempFilePath,
|
||||
(entry) => {
|
||||
plus.io.resolveLocalFileSystemURL(
|
||||
'_doc/',
|
||||
(docEntry) => {
|
||||
entry.copyTo(
|
||||
docEntry,
|
||||
fileName,
|
||||
(newEntry) => previewFile(newEntry.fullPath),
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
},
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
},
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
return
|
||||
}
|
||||
// #endif
|
||||
|
||||
uni.saveFile({
|
||||
tempFilePath,
|
||||
success: (data) => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
title: '下载成功!',
|
||||
duration: 1000,
|
||||
})
|
||||
setTimeout(() => previewFile(data.savedFilePath), 500)
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '保存失败!',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
// 下拉
|
||||
refresherrefresh() {
|
||||
this.triggered = true
|
||||
@@ -386,6 +429,7 @@ export default {
|
||||
box-shadow: 0 4rpx 16rpx rgba(55, 108, 243, 0.35);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/deep/ .segmented-control__text {
|
||||
line-height: 60rpx !important;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
<Cn-icon-transient name="监测点" />
|
||||
</view>
|
||||
<view class="card-header-info">
|
||||
<text class="point-name ellipsis">{{ pointInfo.pointName || '-' }}</text>
|
||||
<view class="point-name-row">
|
||||
<text class="point-name ellipsis">{{ pointInfo.pointName || '-' }}</text>
|
||||
<text class="event-tag ml10" :class="pointInfo.runStatus == 0 ? 'zx-tag' : 'lx-tag'">
|
||||
{{ pointInfo.runStatus == 0 ? '在线' : '离线' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="meta-row">
|
||||
<text v-if="pointInfo.engineeringName" class="meta-item ellipsis">
|
||||
工程:{{ pointInfo.engineeringName }}
|
||||
@@ -69,8 +74,8 @@ export default {
|
||||
return {
|
||||
pointInfo: {},
|
||||
phaseColors: [
|
||||
{ name: 'A相', color: '#F1B22E' },
|
||||
{ name: 'B相', color: '#2BA471' },
|
||||
{ name: 'A相', color: '#DAA520' },
|
||||
{ name: 'B相', color: '#2E8B57' },
|
||||
{ name: 'C相', color: '#D54941' },
|
||||
],
|
||||
}
|
||||
@@ -155,17 +160,25 @@ export default {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.point-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 8rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.point-name {
|
||||
display: block;
|
||||
// flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #333333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.meta-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: 1fr ;
|
||||
gap: 6rpx 12rpx;
|
||||
}
|
||||
|
||||
@@ -263,7 +276,7 @@ export default {
|
||||
}
|
||||
|
||||
.phase-value-vertical {
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
|
||||
&--neutral {
|
||||
@@ -282,4 +295,21 @@ export default {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.event-tag {
|
||||
flex-shrink: 0;
|
||||
font-size: 22rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.zx-tag {
|
||||
background-color: #10b98120;
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
.lx-tag {
|
||||
background-color: #ff3b3020;
|
||||
color: #ff3b30;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<Cn-filterCriteria @select="select" :showQianTree="false"> </Cn-filterCriteria>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" @scroll="onScroll" :scroll-top="scrollTop" scroll-with-animation
|
||||
@refresherrefresh="refresherrefresh" @scrolltolower="scrolltolower"
|
||||
:refresher-triggered="triggered" refresher-enabled="true" class="record event-list mt20"
|
||||
@refresherrefresh="refresherrefresh" @scrolltolower="scrolltolower" :refresher-triggered="triggered"
|
||||
refresher-enabled="true" 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 store.data" :key="index">
|
||||
<!-- 头部:图标 + 信息 + 操作 -->
|
||||
@@ -67,7 +67,7 @@
|
||||
<text>报告状态:</text>
|
||||
<text :style="{ color: item.isComplete == 1 ? '#10b981' : '#FF0000' }">{{
|
||||
item.isComplete == 1 ? '已完成' : '未完成'
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="device-body-item">
|
||||
<text>申请时间:</text>
|
||||
@@ -192,10 +192,17 @@ export default {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
title: '生成事件报告成功!',
|
||||
title: '生成报告成功!',
|
||||
duration: 1000,
|
||||
})
|
||||
this.store.reload()
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: err.message,
|
||||
duration: 1000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 下载报告
|
||||
@@ -208,46 +215,26 @@ export default {
|
||||
id: item.eventId,
|
||||
})
|
||||
.then((res) => {
|
||||
// 下载文件资源到本地
|
||||
const pathMatch = res.data.match(/excelreport([^?]*)/)
|
||||
if (!pathMatch) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: '文件地址无效',
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
const fileMeta = this.getReportFileMeta(pathMatch[1])
|
||||
const match = this.$config.static + pathMatch[1]
|
||||
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('下载成功')
|
||||
url: match,
|
||||
success: (downloadRes) => {
|
||||
if (downloadRes.statusCode === 200) {
|
||||
this.openReportFile(downloadRes.tempFilePath, fileMeta)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
@@ -256,10 +243,19 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function (res) { },
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: '下载失败!',
|
||||
duration: 1000,
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
@@ -268,6 +264,79 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
getReportFileMeta(filePath) {
|
||||
const lower = (filePath || '').toLowerCase()
|
||||
if (lower.endsWith('.doc')) {
|
||||
return { fileType: 'doc', ext: 'doc' }
|
||||
}
|
||||
return { fileType: 'docx', ext: 'docx' }
|
||||
},
|
||||
openReportFile(tempFilePath, fileMeta) {
|
||||
const previewFile = (filePath) => {
|
||||
uni.hideLoading()
|
||||
uni.openDocument({
|
||||
filePath,
|
||||
fileType: fileMeta.fileType,
|
||||
showMenu: true,
|
||||
success: () => {
|
||||
console.log('成功打开文件')
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('打开文件失败', err)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '预览失败',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// iOS 需保留 doc/docx 后缀,saveFile 随机路径会导致 openDocument 失败
|
||||
if (plus.os.name === 'iOS') {
|
||||
const fileName = `event_report_${Date.now()}.${fileMeta.ext}`
|
||||
plus.io.resolveLocalFileSystemURL(
|
||||
tempFilePath,
|
||||
(entry) => {
|
||||
plus.io.resolveLocalFileSystemURL(
|
||||
'_doc/',
|
||||
(docEntry) => {
|
||||
entry.copyTo(
|
||||
docEntry,
|
||||
fileName,
|
||||
(newEntry) => previewFile(newEntry.fullPath),
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
},
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
},
|
||||
() => previewFile(tempFilePath)
|
||||
)
|
||||
return
|
||||
}
|
||||
// #endif
|
||||
|
||||
uni.saveFile({
|
||||
tempFilePath,
|
||||
success: (data) => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
title: '下载成功!',
|
||||
duration: 1000,
|
||||
})
|
||||
setTimeout(() => previewFile(data.savedFilePath), 500)
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '保存失败!',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
// 刷新
|
||||
reload() {
|
||||
switch (this.curSub) {
|
||||
@@ -350,9 +419,9 @@ export default {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
line-height: 1.5;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// }
|
||||
@@ -418,6 +487,7 @@ export default {
|
||||
box-shadow: 0 4rpx 16rpx rgba(55, 108, 243, 0.35);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/deep/ .segmented-control__text {
|
||||
line-height: 60rpx !important;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
selectValue: {},
|
||||
devCount: [],
|
||||
sortIndex: 0,
|
||||
sortOptions: ['发生时间', '暂降深度', '持续时间'],
|
||||
sortOptions: ['发生时间', '暂降幅值', '持续时间'],
|
||||
}
|
||||
},
|
||||
onLoad() { },
|
||||
|
||||
Reference in New Issue
Block a user