index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" @submit.native.prevent :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item prop="feedbackType">
  5. <el-select v-model="queryParams.feedbackType" placeholder="请选择反馈类型" clearable>
  6. <el-option v-for="dict in dict.type.feedback_type" :key="dict.value" :label="dict.label" :value="dict.value" />
  7. </el-select>
  8. </el-form-item>
  9. <el-form-item prop="userId">
  10. <el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter.native="handleQuery" />
  11. </el-form-item>
  12. <el-form-item prop="status">
  13. <el-select v-model="queryParams.status" placeholder="请选择反馈状态" clearable>
  14. <el-option v-for="dict in dict.type.feedback_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  19. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  20. </el-form-item>
  21. </el-form>
  22. <el-row :gutter="10" class="mb8">
  23. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  24. </el-row>
  25. <Page uri="/mapi/app/feedback/list" :request-params="queryParams" ref="pagination">
  26. <el-table-column label="用户ID" align="center" prop="userId" width="200px" />
  27. <el-table-column label="反馈类型" align="center" prop="feedbackType" width="200px">
  28. <template slot-scope="scope">
  29. <dict-tag :options="dict.type.feedback_type" :value="scope.row.feedbackType" />
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="反馈状态" align="center" prop="status" width="200px">
  33. <template slot-scope="scope">
  34. <dict-tag :options="dict.type.feedback_status" :value="scope.row.status" />
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="反馈内容" align="center" prop="content" show-overflow-tooltip />
  38. <el-table-column label="回复内容" align="center" prop="feedbackResult" show-overflow-tooltip />
  39. <el-table-column label="创建人" align="center" prop="createBy" />
  40. <el-table-column label="创建时间" align="center" prop="createTime" />
  41. <el-table-column label="修改人" align="center" prop="updateBy" />
  42. <el-table-column label="修改时间" align="center" prop="createTime" />
  43. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
  44. <template slot-scope="scope">
  45. <el-button type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['app:feedback:edit']" v-if="scope.row.status != '1'">回复</el-button>
  46. <!-- <el-button-->
  47. <!-- -->
  48. <!-- type="text"-->
  49. <!-- icon="el-icon-delete"-->
  50. <!-- @click="handleDelete(scope.row)"-->
  51. <!-- v-hasPermi="['app:feedback:remove']"-->
  52. <!-- >删除</el-button>-->
  53. </template>
  54. </el-table-column>
  55. </Page>
  56. <!-- 添加或修改APP意见反馈对话框 -->
  57. <el-dialog :title="title" :visible.sync="open" size="30%" append-to-body>
  58. <el-row :gutter="15">
  59. <el-form ref="form" :model="form" :rules="rules" label-width="100px" style="margin-left: 20px; margin-right: 20px">
  60. <el-col :span="24">
  61. <el-form-item label="回复内容">
  62. <el-input v-model="form.feedbackResult" type="textarea" placeholder="请输入回复内容" maxlength="500" :rows="8" style="width: 400px" show-word-limit />
  63. </el-form-item>
  64. </el-col>
  65. </el-form>
  66. </el-row>
  67. <div slot="footer" class="dialog-footer">
  68. <el-button type="primary" @click="submitForm" style="margin-left: 5%">提交</el-button>
  69. <el-button @click="cancel">取 消</el-button>
  70. </div>
  71. </el-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import { listFeedback, getFeedback, delFeedback, addFeedback, updateFeedback, updateFeedbackStatus } from '@/api/app/feedback'
  76. export default {
  77. name: 'Feedback',
  78. dicts: ['feedback_type', 'feedback_status'],
  79. data() {
  80. return {
  81. // 遮罩层
  82. loading: true,
  83. // 选中数组
  84. ids: [],
  85. // 非单个禁用
  86. single: true,
  87. // 非多个禁用
  88. multiple: true,
  89. // 显示搜索条件
  90. showSearch: true,
  91. // 总条数
  92. total: 0,
  93. // APP意见反馈表格数据
  94. feedbackList: [],
  95. // 弹出层标题
  96. title: '',
  97. // 是否显示弹出层
  98. open: false,
  99. // 查询参数
  100. queryParams: {
  101. feedbackType: null,
  102. content: null,
  103. userId: null,
  104. status: null
  105. },
  106. // 表单参数
  107. form: {},
  108. // 表单校验
  109. rules: {}
  110. }
  111. },
  112. created() {
  113. this.getList()
  114. },
  115. methods: {
  116. /** 查询APP意见反馈列表 */
  117. getList() {
  118. this.$nextTick(() => {
  119. this.$refs.pagination.handleSearch(true)
  120. })
  121. },
  122. // 取消按钮
  123. cancel() {
  124. this.open = false
  125. this.reset()
  126. },
  127. // 表单重置
  128. reset() {
  129. this.form = {
  130. id: null,
  131. feedbackType: null,
  132. feedbackResult: null,
  133. content: null,
  134. userId: null,
  135. status: null,
  136. createTime: null,
  137. updateById: null,
  138. updateBy: null,
  139. updateTime: null
  140. }
  141. this.resetForm('form')
  142. },
  143. /** 搜索按钮操作 */
  144. handleQuery() {
  145. this.getList()
  146. },
  147. /** 重置按钮操作 */
  148. resetQuery() {
  149. this.resetForm('queryForm')
  150. this.handleQuery()
  151. },
  152. // 多选框选中数据
  153. handleSelectionChange(selection) {
  154. this.ids = selection.map((item) => item.id)
  155. this.single = selection.length !== 1
  156. this.multiple = !selection.length
  157. },
  158. /** 新增按钮操作 */
  159. handleAdd() {
  160. this.reset()
  161. this.open = true
  162. this.title = '添加意见反馈'
  163. },
  164. /** 修改按钮操作 */
  165. handleUpdate(row) {
  166. this.reset()
  167. const id = row.id || this.ids
  168. getFeedback(id).then((response) => {
  169. this.form = response.data
  170. this.open = true
  171. this.title = '回复意见反馈'
  172. })
  173. },
  174. /** 提交按钮 */
  175. submitForm() {
  176. this.$refs['form'].validate((valid) => {
  177. if (valid) {
  178. if (this.form.id != null) {
  179. updateFeedback(this.form).then((response) => {
  180. this.$modal.msgSuccess('修改成功')
  181. this.open = false
  182. this.getList()
  183. })
  184. } else {
  185. addFeedback(this.form).then((response) => {
  186. this.$modal.msgSuccess('新增成功')
  187. this.open = false
  188. this.getList()
  189. })
  190. }
  191. }
  192. })
  193. },
  194. /** 删除按钮操作 */
  195. handleDelete(row) {
  196. const ids = row.id || this.ids
  197. this.$modal
  198. .confirm('是否确认删除APP意见反馈编号为"' + ids + '"的数据项?')
  199. .then(function () {
  200. return delFeedback(ids)
  201. })
  202. .then(() => {
  203. this.getList()
  204. this.$modal.msgSuccess('删除成功')
  205. })
  206. .catch(() => {})
  207. },
  208. /** 导出按钮操作 */
  209. handleExport() {
  210. this.download(
  211. 'mapi/app/feedback/export',
  212. {
  213. ...this.queryParams
  214. },
  215. `feedback_${new Date().getTime()}.xlsx`
  216. )
  217. },
  218. checkClose(done) {
  219. this.$confirm('是否关闭表单,关闭后数据将丢失?')
  220. .then(function () {
  221. done()
  222. })
  223. .then(() => {})
  224. .catch(() => {})
  225. },
  226. handleStatusChange(row) {
  227. let text = row.status === '0' ? '启用' : '停用'
  228. this.$confirm('确认要' + text + ' ' + row.name + ' 吗?')
  229. .then(function () {
  230. return updateFeedbackStatus(row.id, row.status)
  231. })
  232. .then(() => {
  233. this.$modal.msgSuccess(text + '成功')
  234. })
  235. .catch(function () {
  236. row.status = row.status === '0' ? '1' : '0'
  237. })
  238. }
  239. }
  240. }
  241. </script>