|
|
@@ -0,0 +1,87 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-card shadow="never">
|
|
|
+ <div slot="header">
|
|
|
+ <span>管家分配管理</span>
|
|
|
+ </div>
|
|
|
+ <el-table v-loading="loading" :data="records" border stripe>
|
|
|
+ <el-table-column prop="id" label="ID" width="80" />
|
|
|
+ <el-table-column prop="familyId" label="家庭ID" width="100" />
|
|
|
+ <el-table-column prop="butlerNickname" label="管家" min-width="140" />
|
|
|
+ <el-table-column prop="butlerUserId" label="管家用户ID" width="110" />
|
|
|
+ <el-table-column prop="level" label="订阅级别" width="100">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="row.level === 'L2' ? 'warning' : 'info'" size="small">{{ row.level }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="绑定时间" width="170">
|
|
|
+ <template slot-scope="{ row }">{{ formatTime(row.assignedAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="120" fixed="right">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button size="mini" type="danger" @click="onUnassign(row)">强制解绑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ style="margin-top: 16px; text-align: right;"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :current-page.sync="pageNum"
|
|
|
+ @current-change="loadData"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getButlerAssignments, unassignButler } from '@/api/butler'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'ButlerAssignments',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ records: [],
|
|
|
+ total: 0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ formatTime(iso) {
|
|
|
+ if (!iso) return '-'
|
|
|
+ return iso.substring(0, 19).replace('T', ' ')
|
|
|
+ },
|
|
|
+ loadData() {
|
|
|
+ this.loading = true
|
|
|
+ getButlerAssignments({ pageNum: this.pageNum, pageSize: this.pageSize })
|
|
|
+ .then(res => {
|
|
|
+ const data = res.data || {}
|
|
|
+ this.records = data.records || []
|
|
|
+ this.total = data.total || 0
|
|
|
+ })
|
|
|
+ .finally(() => { this.loading = false })
|
|
|
+ },
|
|
|
+ onUnassign(row) {
|
|
|
+ this.$confirm(
|
|
|
+ `确定解除家庭 ${row.familyId} 与管家「${row.butlerNickname}」的绑定?`,
|
|
|
+ '强制解绑',
|
|
|
+ { type: 'warning' }
|
|
|
+ ).then(() => unassignButler({ assignmentId: row.id }))
|
|
|
+ .then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('已解绑')
|
|
|
+ this.loadData()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '操作失败')
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|