|
|
@@ -16,32 +16,45 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-table :data="plans" border stripe style="width:100%" :max-height="tableHeight">
|
|
|
- <el-table-column prop="id" label="方案ID" width="80" />
|
|
|
- <el-table-column prop="familyId" label="家庭ID" width="80" />
|
|
|
- <el-table-column prop="childId" label="孩子ID" width="80" />
|
|
|
- <el-table-column prop="name" label="方案名称" min-width="180" />
|
|
|
- <el-table-column label="状态" width="100">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tag :type="statusType(row.status)">{{ statusLabel(row.status) }}</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="进度" width="120">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ row.completedDays || 0 }} / {{ row.totalDays || '-' }} 天
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="source" label="来源" width="100" />
|
|
|
- <el-table-column prop="createdAt" label="创建时间" width="160" />
|
|
|
- <el-table-column prop="reviewedAt" label="审核时间" width="160" />
|
|
|
- <el-table-column label="操作" width="180">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-button size="mini" type="primary" @click="showDetail(row)">详情</el-button>
|
|
|
- <el-button v-if="row.status === 'generated'" size="mini" type="success" @click="handleApprove(row)">批准</el-button>
|
|
|
- <el-button v-if="row.status === 'reviewed'" size="mini" @click="handleActivate(row)">激活</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <div class="table-scroll-wrap">
|
|
|
+ <el-table :data="plans" border stripe style="width:100%" :max-height="tableHeight">
|
|
|
+ <el-table-column prop="id" label="方案ID" width="80" />
|
|
|
+ <el-table-column prop="familyId" label="家庭ID" width="80" />
|
|
|
+ <el-table-column prop="childId" label="孩子ID" width="80" />
|
|
|
+ <el-table-column prop="name" label="方案名称" min-width="180" />
|
|
|
+ <el-table-column prop="status" label="状态" width="100" sortable="custom" :sort-orders="['ascending','descending']">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="statusType(row.status)">{{ statusLabel(row.status) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="completedDays" label="进度" width="120" sortable="custom" :sort-orders="['ascending','descending']">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ {{ row.completedDays || 0 }} / {{ row.totalDays || '-' }} 天
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="source" label="来源" width="100" sortable="custom" :sort-orders="['ascending','descending']" />
|
|
|
+ <el-table-column prop="createdAt" label="创建时间" width="160" sortable="custom" :sort-orders="['ascending','descending']" / sortable="custom" :sort-orders="['ascending','descending']"
|
|
|
+ <el-table-column prop="reviewedAt" label="审核时间" width="160" sortable="custom" :sort-orders="['ascending','descending']" / sortable="custom" :sort-orders="['ascending','descending']"
|
|
|
+ <el-table-column label="操作" width="180" fixed="right">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button size="mini" type="primary" @click="showDetail(row)">详情</el-button>
|
|
|
+ <el-button v-if="row.status === 'generated'" size="mini" type="success" @click="handleApprove(row)">批准</el-button>
|
|
|
+ <el-button v-if="row.status === 'reviewed'" size="mini" @click="handleActivate(row)">激活</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <el-pagination
|
|
|
+ :current-page="page"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :total="total"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
+ style="margin-top: 16px; text-align: right;"
|
|
|
+ />
|
|
|
|
|
|
<el-dialog title="方案详情" :visible.sync="detailVisible" width="600px">
|
|
|
<el-form label-width="100px" v-if="currentPlan">
|
|
|
@@ -81,7 +94,12 @@ export default {
|
|
|
statusFilter: '',
|
|
|
familySearch: '',
|
|
|
detailVisible: false,
|
|
|
- currentPlan: null
|
|
|
+ currentPlan: null,
|
|
|
+ page: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ total: 0,
|
|
|
+ sortProp: '',
|
|
|
+ sortOrder: ''
|
|
|
}
|
|
|
},
|
|
|
created() { this.loadPlans() },
|
|
|
@@ -89,9 +107,31 @@ export default {
|
|
|
async loadPlans() {
|
|
|
const res = await listFamilyPlans({
|
|
|
status: this.statusFilter || null,
|
|
|
- familyId: this.familySearch ? Number(this.familySearch) : null
|
|
|
+ familyId: this.familySearch ? Number(this.familySearch) : null,
|
|
|
+ page: this.page,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ sortProp: this.sortProp,
|
|
|
+ sortOrder: this.sortOrder
|
|
|
})
|
|
|
- if (res.code === 200) this.plans = res.data || []
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.plans = (res.data && res.data.records) ? res.data.records : (res.data || [])
|
|
|
+ this.total = res.data && res.data.total ? res.data.total : this.plans.length
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.pageSize = val
|
|
|
+ this.page = 1
|
|
|
+ this.loadPlans()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page = val
|
|
|
+ this.loadPlans()
|
|
|
+ },
|
|
|
+ handleSortChange({ prop, order }) {
|
|
|
+ this.sortProp = prop
|
|
|
+ this.sortOrder = order
|
|
|
+ this.page = 1
|
|
|
+ this.loadPlans()
|
|
|
},
|
|
|
statusType(s) {
|
|
|
const map = { generated: 'warning', reviewed: 'primary', active: 'success', completed: 'info', rejected: 'danger' }
|
|
|
@@ -121,4 +161,5 @@ export default {
|
|
|
<style scoped>
|
|
|
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
|
|
.filters { display: flex; align-items: center; }
|
|
|
+.table-scroll-wrap { overflow-x: auto; }
|
|
|
</style>
|