add
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
<h3>反馈处理</h3>
|
||||
<el-table :data="items" stripe>
|
||||
<el-table-column prop="id" label="编号" width="80" />
|
||||
<el-table-column prop="elderId" label="长者ID" />
|
||||
<el-table-column label="长者">
|
||||
<template slot-scope="scope">
|
||||
{{ elderName(scope.row.elderId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="typeTag(scope.row.type)">
|
||||
@@ -48,20 +52,39 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { feedbackList, feedbackUpdate } from "../../api";
|
||||
import { feedbackList, feedbackUpdate, eldersList } from "../../api";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
elders: [],
|
||||
elderMap: {},
|
||||
showReply: false,
|
||||
replyForm: { id: null, status: "PROCESSING", reply: "" }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.load();
|
||||
this.loadElders();
|
||||
},
|
||||
methods: {
|
||||
async loadElders() {
|
||||
try {
|
||||
const res = await eldersList();
|
||||
this.elders = res.data.data;
|
||||
const map = {};
|
||||
this.elders.forEach((elder) => {
|
||||
map[elder.id] = elder.name;
|
||||
});
|
||||
this.elderMap = map;
|
||||
} catch (e) {
|
||||
this.$message.error(e.message || "加载长者失败");
|
||||
}
|
||||
},
|
||||
elderName(id) {
|
||||
return this.elderMap[id] || `长者${id}`;
|
||||
},
|
||||
typeLabel(type) {
|
||||
if (type === "SUGGESTION") return "建议";
|
||||
if (type === "COMPLAINT") return "投诉";
|
||||
@@ -91,7 +114,7 @@ export default {
|
||||
const res = await feedbackList();
|
||||
this.items = res.data.data;
|
||||
} catch (e) {
|
||||
this.$message.error(e.message || "load failed");
|
||||
this.$message.error(e.message || "加载失败");
|
||||
}
|
||||
},
|
||||
openReply(row) {
|
||||
@@ -104,9 +127,10 @@ export default {
|
||||
this.showReply = false;
|
||||
this.load();
|
||||
} catch (e) {
|
||||
this.$message.error(e.message || "update failed");
|
||||
this.$message.error(e.message || "更新失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user