add
This commit is contained in:
76
frontend/src/views/admin/Feedback.vue
Normal file
76
frontend/src/views/admin/Feedback.vue
Normal file
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<div class="page-card">
|
||||
<h3>Feedback</h3>
|
||||
<el-table :data="items" stripe>
|
||||
<el-table-column prop="id" label="ID" width="80" />
|
||||
<el-table-column prop="elderId" label="Elder ID" />
|
||||
<el-table-column prop="type" label="Type" />
|
||||
<el-table-column prop="content" label="Content" />
|
||||
<el-table-column prop="status" label="Status" width="120" />
|
||||
<el-table-column label="Actions" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="openReply(scope.row)">Reply</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog title="Reply" :visible.sync="showReply">
|
||||
<el-form :model="replyForm" label-width="120px">
|
||||
<el-form-item label="Status">
|
||||
<el-select v-model="replyForm.status">
|
||||
<el-option label="New" value="NEW" />
|
||||
<el-option label="Processing" value="PROCESSING" />
|
||||
<el-option label="Closed" value="CLOSED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="Reply">
|
||||
<el-input v-model="replyForm.reply" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="showReply = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="saveReply">Save</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { feedbackList, feedbackUpdate } from "../../api";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
showReply: false,
|
||||
replyForm: { id: null, status: "PROCESSING", reply: "" }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.load();
|
||||
},
|
||||
methods: {
|
||||
async load() {
|
||||
try {
|
||||
const res = await feedbackList();
|
||||
this.items = res.data.data;
|
||||
} catch (e) {
|
||||
this.$message.error(e.message || "load failed");
|
||||
}
|
||||
},
|
||||
openReply(row) {
|
||||
this.replyForm = { id: row.id, status: row.status || "PROCESSING", reply: row.reply || "" };
|
||||
this.showReply = true;
|
||||
},
|
||||
async saveReply() {
|
||||
try {
|
||||
await feedbackUpdate(this.replyForm);
|
||||
this.showReply = false;
|
||||
this.load();
|
||||
} catch (e) {
|
||||
this.$message.error(e.message || "update failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user