|
|
@@ -1,13 +1,41 @@
|
|
|
<template>
|
|
|
<div class="growth-records">
|
|
|
<el-card>
|
|
|
- <div slot="header"><span>成长记录</span></div>
|
|
|
+ <div slot="header">
|
|
|
+ <span>成长记录</span>
|
|
|
+ <el-select v-model="sourceFilter" placeholder="来源筛选" clearable size="small" style="float: right; width: 140px" @change="loadRecords">
|
|
|
+ <el-option label="全部" value="" />
|
|
|
+ <el-option label="手动创建" value="manual" />
|
|
|
+ <el-option label="测评录入" value="assessment" />
|
|
|
+ <el-option label="报告上传" value="upload" />
|
|
|
+ <el-option label="补充材料" value="supplement" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
<el-table :data="records" v-loading="loading" border stripe>
|
|
|
- <el-table-column prop="id" label="ID" width="80" />
|
|
|
- <el-table-column prop="childName" label="孩子" width="120" />
|
|
|
- <el-table-column prop="recordType" label="记录类型" width="120" />
|
|
|
- <el-table-column prop="content" label="内容" />
|
|
|
- <el-table-column prop="createdAt" label="记录时间" width="180" />
|
|
|
+ <el-table-column prop="id" label="ID" width="70" />
|
|
|
+ <el-table-column prop="childName" label="孩子" width="100" />
|
|
|
+ <el-table-column prop="sourceType" label="来源" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag size="mini" :type="sourceTagType(scope.row.sourceType)">{{ sourceLabel(scope.row.sourceType) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="recordTitle" label="标题" min-width="140" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="reportDate" label="报告日期" width="110" />
|
|
|
+ <el-table-column prop="danLevel" label="DAN等级" width="90" />
|
|
|
+ <el-table-column prop="overallScore" label="综合得分" width="90" />
|
|
|
+ <el-table-column prop="parentRecordId" label="主记录ID" width="90">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.parentRecordId">{{ scope.row.parentRecordId }}</span>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="isLatest" label="最新" width="60">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.isLatest === 1">✓</span>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createdAt" label="创建时间" width="170" />
|
|
|
</el-table>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
@@ -16,21 +44,41 @@
|
|
|
<script>
|
|
|
export default {
|
|
|
name: 'GrowthRecords',
|
|
|
- data() { return { loading: false, records: [] } },
|
|
|
- created() { this.loadRecords() },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ records: [],
|
|
|
+ sourceFilter: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.loadRecords()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ sourceLabel(type) {
|
|
|
+ var map = { manual: '手动创建', assessment: '测评录入', upload: '报告上传', supplement: '补充材料' }
|
|
|
+ return map[type] || (type || '-')
|
|
|
+ },
|
|
|
+ sourceTagType(type) {
|
|
|
+ var map = { manual: 'info', assessment: 'success', upload: 'warning', supplement: '' }
|
|
|
+ return map[type] || 'info'
|
|
|
+ },
|
|
|
async loadRecords() {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
- const baseURL = process.env.VUE_APP_BASE_API || ''
|
|
|
- const token = localStorage.getItem('token')
|
|
|
- const axios = this.$axios || (await import('axios')).default
|
|
|
- const res = await axios.post(baseURL + '/api/growth/record/list', {}, {
|
|
|
+ var baseURL = process.env.VUE_APP_BASE_API || ''
|
|
|
+ var token = localStorage.getItem('token')
|
|
|
+ var axios = this.$axios || (await import('axios')).default
|
|
|
+ var params = {}
|
|
|
+ if (this.sourceFilter) {
|
|
|
+ params.sourceType = this.sourceFilter
|
|
|
+ }
|
|
|
+ var res = await axios.post(baseURL + '/api/growth/record/list', params, {
|
|
|
headers: { Authorization: 'Bearer ' + token }
|
|
|
})
|
|
|
- this.records = res.data?.data || []
|
|
|
+ this.records = res.data && res.data.data ? res.data.data : (res.data || [])
|
|
|
} catch (e) {
|
|
|
- this.$message?.error?.('加载成长记录失败')
|
|
|
+ this.$message && this.$message.error && this.$message.error('加载成长记录失败')
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|