155 lines
5.9 KiB
Vue
155 lines
5.9 KiB
Vue
<template>
|
||
<view class="page" :class="{ big: isH5 }">
|
||
<view class="panel">
|
||
<view class="title">综合报告历史</view>
|
||
<view class="subtitle">按创建时间倒序展示该人员的综合报告。</view>
|
||
</view>
|
||
|
||
<view class="panel">
|
||
<view class="section-title">查询</view>
|
||
<input class="input" v-model="keyword" placeholder="请输入姓名/编号" />
|
||
<button class="btn" type="primary" :disabled="loading" @click="onSearch">查询历史</button>
|
||
<view v-if="errorMsg" class="error">{{ errorMsg }}</view>
|
||
</view>
|
||
|
||
<view v-if="loading" class="placeholder">加载中...</view>
|
||
<view v-else class="list">
|
||
<view v-if="rows.length === 0" class="placeholder">暂无数据</view>
|
||
<view v-else>
|
||
<view class="item" v-for="row in rows" :key="row.reportId" @click="openDetail(row)">
|
||
<view class="item-title">{{ row.reportTitle || ('综合报告#' + row.reportId) }}</view>
|
||
<view class="item-desc">创建:{{ formatTime(row.createTime) }}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { request } from '../../utils/request'
|
||
import { listComprehensiveReportsByUserId } from '../../api/psychology/comprehensiveReport'
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
isH5: false,
|
||
keyword: '',
|
||
loading: false,
|
||
errorMsg: '',
|
||
selectedUserId: null,
|
||
rows: []
|
||
}
|
||
},
|
||
onLoad() {
|
||
try {
|
||
const info = uni.getSystemInfoSync()
|
||
const p = info ? (info.uniPlatform || info.platform) : ''
|
||
this.isH5 = p === 'web' || p === 'h5'
|
||
} catch (e) {
|
||
this.isH5 = false
|
||
}
|
||
},
|
||
methods: {
|
||
formatTime(val) {
|
||
if (!val) return '—'
|
||
try {
|
||
const d = new Date(val)
|
||
if (isNaN(d.getTime())) return '—'
|
||
const y = d.getFullYear()
|
||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||
const day = String(d.getDate()).padStart(2, '0')
|
||
const hh = String(d.getHours()).padStart(2, '0')
|
||
const mm = String(d.getMinutes()).padStart(2, '0')
|
||
return `${y}-${m}-${day} ${hh}:${mm}`
|
||
} catch (e) {
|
||
return '—'
|
||
}
|
||
},
|
||
async onSearch() {
|
||
this.errorMsg = ''
|
||
this.loading = true
|
||
this.rows = []
|
||
this.selectedUserId = null
|
||
try {
|
||
const userRes = await request({
|
||
url: `/psychology/assessment/student/options?keyword=${encodeURIComponent(this.keyword || '')}&limit=1`,
|
||
method: 'GET'
|
||
})
|
||
const userData = userRes && userRes.data ? userRes.data : null
|
||
if (!userData || userData.code !== 200) {
|
||
this.errorMsg = (userData && userData.msg) ? userData.msg : '查询失败'
|
||
this.loading = false
|
||
return
|
||
}
|
||
const list = userData.data || []
|
||
if (!list.length) {
|
||
this.errorMsg = '未找到匹配人员'
|
||
this.loading = false
|
||
return
|
||
}
|
||
this.selectedUserId = list[0].userId
|
||
|
||
const repRes = await listComprehensiveReportsByUserId(this.selectedUserId)
|
||
const repData = repRes && repRes.data ? repRes.data : null
|
||
if (!repData || repData.code !== 200) {
|
||
this.errorMsg = (repData && repData.msg) ? repData.msg : '获取列表失败'
|
||
this.loading = false
|
||
return
|
||
}
|
||
this.rows = repData.data || []
|
||
this.loading = false
|
||
} catch (e) {
|
||
this.loading = false
|
||
this.errorMsg = e && e.message ? e.message : '网络错误'
|
||
}
|
||
},
|
||
openDetail(row) {
|
||
if (!row || !row.reportId) return
|
||
uni.navigateTo({ url: `/pages/comprehensive/detail?reportId=${encodeURIComponent(row.reportId)}` })
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.page { min-height: 100vh; padding: 32rpx; box-sizing: border-box; background: #f6f7fb; }
|
||
.page.big {
|
||
padding: 14rpx 14rpx 120rpx;
|
||
background-image:
|
||
radial-gradient(1100rpx 520rpx at 50% 14%, rgba(43, 107, 255, 0.30) 0%, rgba(6, 16, 40, 0.0) 65%),
|
||
linear-gradient(180deg, rgba(5, 11, 24, 0.90) 0%, rgba(8, 20, 45, 0.85) 42%, rgba(6, 16, 40, 0.92) 100%),
|
||
url('/static/bg.png');
|
||
background-size: auto, auto, cover;
|
||
background-position: center, center, center;
|
||
background-repeat: no-repeat, no-repeat, no-repeat;
|
||
}
|
||
.panel { background: #fff; border-radius: 20rpx; padding: 24rpx; border: 1px solid rgba(0,0,0,0.05); margin-bottom: 24rpx; }
|
||
.title { font-size: 36rpx; font-weight: 700; color: #1f2329; }
|
||
.subtitle { margin-top: 10rpx; font-size: 24rpx; color: #646a73; line-height: 36rpx; }
|
||
.section-title { margin-top: 8rpx; font-size: 28rpx; font-weight: 700; color: #1f2329; margin-bottom: 16rpx; }
|
||
.input { width: 100%; background: #f7f8fa; border-radius: 16rpx; padding: 26rpx 22rpx; font-size: 32rpx; line-height: 44rpx; min-height: 92rpx; box-sizing: border-box; margin-bottom: 16rpx; border: 1px solid rgba(0,0,0,0.05); }
|
||
.btn { width: 100%; }
|
||
.list { margin-top: 8rpx; }
|
||
.item { background: #fff; border-radius: 20rpx; padding: 24rpx; border: 1px solid rgba(0,0,0,0.05); margin-bottom: 18rpx; }
|
||
.item-title { font-size: 28rpx; font-weight: 700; color: #1f2329; }
|
||
.item-desc { margin-top: 10rpx; font-size: 24rpx; color: #646a73; }
|
||
.placeholder { height: 240rpx; border-radius: 20rpx; background: #fff; border: 1px dashed rgba(0,0,0,0.15); display: flex; align-items: center; justify-content: center; color: #8f959e; font-size: 24rpx; }
|
||
.error { margin-top: 14rpx; font-size: 24rpx; color: #ff4d4f; line-height: 36rpx; }
|
||
.page.big .panel,
|
||
.page.big .item,
|
||
.page.big .placeholder {
|
||
border: 1px solid rgba(116, 216, 255, 0.22);
|
||
background: linear-gradient(180deg, rgba(10, 18, 38, 0.75) 0%, rgba(5, 10, 22, 0.55) 100%);
|
||
box-shadow: 0 12rpx 24rpx rgba(0, 0, 0, 0.35);
|
||
}
|
||
.page.big .title,
|
||
.page.big .section-title,
|
||
.page.big .item-title { color: rgba(235, 248, 255, 0.92); }
|
||
.page.big .subtitle,
|
||
.page.big .item-desc,
|
||
.page.big .placeholder { color: rgba(201, 242, 255, 0.65); }
|
||
.page.big .placeholder { border-style: solid; }
|
||
.page.big .input { background: rgba(7, 13, 28, 0.35); border-color: rgba(116, 216, 255, 0.18); color: rgba(235, 248, 255, 0.92); }
|
||
.page.big .btn[type="primary"] { background: linear-gradient(90deg, rgba(116, 216, 255, 0.95) 0%, rgba(43, 107, 255, 0.92) 100%); color: #0b1226; }
|
||
</style>
|