FeedbackManagement.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-view">
  5. <el-select
  6. class="filter-view-item"
  7. v-model="listQuery.pageVo.typeOfFeedback"
  8. placeholder="Type of Feedbacks"
  9. @change="handleFilter"
  10. clearable>
  11. <el-option
  12. v-for="(item,index) in typeOptions"
  13. :key="index"
  14. :label="item.name"
  15. :value="item.value" />
  16. </el-select>
  17. </div>
  18. </div>
  19. <el-table
  20. v-loading="listLoading"
  21. :data="tableList"
  22. style="width: 100%;">
  23. <el-table-column
  24. label="ID"
  25. align="center"
  26. min-width="60">
  27. <template slot-scope="{row}">
  28. <a class="link-type" href="javascript:void(0);" @click="viewFeedback(row)">{{ row.feedbackPk }}</a>
  29. </template>
  30. </el-table-column>
  31. <el-table-column
  32. label="Type of Feedback"
  33. align="center"
  34. min-width="150">
  35. <template slot-scope="{row}">
  36. <span>{{ row.typeOfFeedback }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column
  40. label="Feedback"
  41. align="center"
  42. min-width="180">
  43. <template slot-scope="{row}">
  44. <span>{{ row.feedback }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. label="Status"
  49. align="center"
  50. min-width="120">
  51. <template slot-scope="{row}">
  52. <span :class="{readYes: row.readStatus}">{{ row.readStatus ? "Read" : "Unread" }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column
  56. label="Reply Count"
  57. align="center"
  58. min-width="120">
  59. <template slot-scope="{row}">
  60. <span>{{ "0" }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column
  64. label="Feedback Time"
  65. align="center"
  66. min-width="140">
  67. <template slot-scope="{row}">
  68. <span>{{ row.feedbackTime }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. label="Action"
  73. align="center"
  74. min-width="80">
  75. <template slot-scope="{row}">
  76. <TableAction
  77. :showEdit="false"
  78. @delete="deleteFeedback(row)"/>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <div class="right">
  83. <Pagination
  84. v-show="total > 0"
  85. :total="total"
  86. :page.sync="listQuery.pageNo"
  87. :limit.sync="listQuery.pageSize"
  88. @pagination="getList" />
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import Pagination from '@/components/Pagination'
  94. import TableAction from '@/components/TableAction.vue'
  95. import feedback from '../../http/api/feedback'
  96. export default {
  97. components: { Pagination, TableAction },
  98. data() {
  99. return {
  100. listLoading: false,
  101. tableList: [],
  102. total: 0,
  103. listQuery: {
  104. pageNo: 1,
  105. pageSize: 10,
  106. pageVo: {
  107. criteria: "",
  108. typeOfFeedback: ""
  109. }
  110. },
  111. typeOptions: []
  112. }
  113. },
  114. created() {
  115. this.getTypeOptions();
  116. this.getList();
  117. },
  118. methods: {
  119. handleFilter() {
  120. this.listQuery.pageNo = 1;
  121. this.getList();
  122. },
  123. getTypeOptions() {
  124. feedback.getFeedbackTypes().then(res => {
  125. if (res.data) {
  126. this.typeOptions = res.data
  127. }
  128. }).catch(error => {
  129. this.$message({
  130. message: error,
  131. type: 'error'
  132. })
  133. })
  134. },
  135. getList() {
  136. this.listLoading = true;
  137. feedback.getFeedbackPages(this.listQuery).then(res => {
  138. this.listLoading = false;
  139. this.total = res.total;
  140. this.tableList = res.data
  141. }).catch(error => {
  142. this.listLoading = false;
  143. this.total = 0;
  144. this.tableList = [];
  145. this.$message({
  146. message: error,
  147. type: 'error'
  148. })
  149. })
  150. },
  151. viewFeedback(row) {
  152. //this.$store.commit('provider/SET_Feedback', row)
  153. this.$router.push({path: '/support-management/feedback/'+row.feedbackPk})
  154. },
  155. deleteFeedback(row) {
  156. this.$confirm('Are you sure you want to delete this feedback?', 'Delete', {
  157. confirmButtonText: 'OK',
  158. cancelButtonText: 'Cancel',
  159. type: 'warning'
  160. }).then(res => {
  161. this.handleDeleteFeedback(row.feedbackPk)
  162. })
  163. },
  164. handleDeleteFeedback(id) {
  165. feedback.deleteFeedback(id).then(res => {
  166. this.$message({
  167. message: 'Delete feedback successfully',
  168. type: 'success'
  169. });
  170. this.listLoading = true;
  171. this.getList();
  172. }).catch(err => {
  173. this.$message({
  174. message: err,
  175. type: 'error'
  176. })
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped="scoped">
  183. @import '../../styles/variables.scss';
  184. .readYes {
  185. color: $panGreen;
  186. }
  187. </style>