suggestions.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--用户数据-->
  5. <el-col :span="24" :xs="24">
  6. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  7. <el-form-item label="用户昵称" prop="memberNickName">
  8. <el-input
  9. v-model="queryParams.memberNickName"
  10. placeholder="请输入用户昵称"
  11. clearable
  12. style="width: 240px"
  13. @keyup.enter.native="handleQuery"
  14. />
  15. </el-form-item>
  16. <el-form-item label="类型" prop="type">
  17. <el-select v-model="queryParams.type" clearable placeholder="请选择状态">
  18. <el-option
  19. v-for="dict in dict.type.tourism_suggestions_type"
  20. :key="dict.value"
  21. :label="dict.label"
  22. :value="dict.value">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  28. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  29. </el-form-item>
  30. </el-form>
  31. <el-row :gutter="10" class="mb8">
  32. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  33. </el-row>
  34. <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
  35. <el-table-column type="index" label="编号" align="center" />
  36. <el-table-column label="用户昵称" align="center" key="memberNickName" prop="memberNickName" v-if="columns[0].visible" />
  37. <el-table-column label="类型" align="center" key="type" prop="type" v-if="columns[1].visible" :show-overflow-tooltip="true">
  38. <template slot-scope="scope">
  39. <dict-tag :options="dict.type.tourism_suggestions_type" :value="scope.row.type"/>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="留言内容" align="center" key="content" v-if="columns[2].visible" :show-overflow-tooltip="true">
  43. <template slot-scope="scope">
  44. <el-tooltip class="item" effect="dark" :content="scope.row.content" placement="top">
  45. <div style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
  46. <span style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{ scope.row.content }}</span>
  47. </div>
  48. </el-tooltip>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="留言时间" align="center" key="createTime" prop="createTime" v-if="columns[3].visible" />
  52. </el-table>
  53. <pagination
  54. v-show="total>0"
  55. :total="total"
  56. :page.sync="queryParams.pageNum"
  57. :limit.sync="queryParams.pageSize"
  58. @pagination="getList"
  59. />
  60. </el-col>
  61. </el-row>
  62. </div>
  63. </template>
  64. <script>
  65. import {
  66. listTableApi,
  67. delTableParamsApi,
  68. } from "@/api/CURD";
  69. export default {
  70. name: "User",
  71. dicts: ['tourism_suggestions_type'],
  72. components: {},
  73. data() {
  74. return {
  75. title: "投诉建议",// 通用标题
  76. configPermi: {
  77. add: ['system:user:edit'], // 新增权限
  78. details: ['system:user:details'], // 详情权限
  79. delect: ['system:user:remove'], // 删除权限
  80. edit: ['system:user:edit'], // 编辑权限
  81. upload: ['system:user:upload'],// 导入权限
  82. export: ['system:user:export'],// 导出权限
  83. },
  84. configUrl: {
  85. list: '/merchant/memberSuggestion/pageList', // 列表地址
  86. delect: '', // 删除地址
  87. upload: '',// 导入地址
  88. download:'', // 下载模板地址
  89. export: '',// 导出地址
  90. },
  91. // 遮罩层
  92. loading: true,
  93. // 选中数组
  94. ids: [],
  95. // 非单个禁用
  96. single: true,
  97. // 非多个禁用
  98. multiple: true,
  99. // 显示搜索条件
  100. showSearch: true,
  101. // 总条数
  102. total: 0,
  103. // 用户表格数据
  104. tableList: null,
  105. // 查询参数
  106. queryParams: {
  107. pageNum: 1,
  108. pageSize: 10,
  109. },
  110. dateRange: [],
  111. // 控制列表是否显示
  112. columns: [
  113. { key: 0, label: `用户昵称`, visible: true },
  114. { key: 2, label: `类型`, visible: true },
  115. { key: 3, label: `留言内容`, visible: true },
  116. { key: 4, label: `留言时间`, visible: true },
  117. ],
  118. };
  119. },
  120. created() {
  121. this.getList();
  122. },
  123. methods: {
  124. /** 查询用户列表 */
  125. getList() {
  126. this.loading = true;
  127. listTableApi(
  128. this.configUrl.list,
  129. this.addDateRange(
  130. this.queryParams,
  131. this.dateRange)).then(response => {
  132. this.tableList = response.data.rows;
  133. this.total = response.data.total;
  134. this.loading = false;
  135. }
  136. ).catch (error=>{
  137. console.error('获取列表失败!!!!',error)
  138. this.tableList = [];
  139. this.total = 0;
  140. this.loading = false
  141. })
  142. },
  143. /** 搜索按钮操作 */
  144. handleQuery() {
  145. this.queryParams.pageNum = 1;
  146. this.getList();
  147. },
  148. /** 重置按钮操作 */
  149. resetQuery() {
  150. this.dateRange = [];
  151. this.queryParams = {
  152. pageNum: 1,
  153. pageSize: 10,
  154. }
  155. this.handleQuery();
  156. },
  157. // 多选框选中数据
  158. handleSelectionChange(selection) {
  159. this.ids = selection.map(item => item.id);
  160. this.single = selection.length != 1;
  161. this.multiple = !selection.length;
  162. },
  163. /** 新增按钮操作 */
  164. handleAdd() {
  165. if(this.$refs.addAndEdit) {
  166. this.$refs.addAndEdit.initData(this.title + '新增', "ADD",{})
  167. }
  168. },
  169. /** 修改按钮操作 */
  170. handleUpdate(row) {
  171. if(this.$refs.addAndEdit) {
  172. this.$refs.addAndEdit.initData(this.title + '编辑', "EDITInit",{...row})
  173. }
  174. },
  175. handleDetails(row){
  176. if(this.$refs.detailsBox) {
  177. this.$refs.detailsBox.initData(this.title + '详情',"DEATILSInit", row)
  178. }
  179. },
  180. /** 删除按钮操作 */
  181. handleDelete(row) {
  182. const ids = row.id || this.ids;
  183. this.$modal.confirm('是否确认删除用户编号为"' + ids + '"的数据项?').then( () => {
  184. return delTableParamsApi(this.configUrl.delect,{
  185. id: ids
  186. });
  187. }).then(() => {
  188. this.getList();
  189. this.$modal.msgSuccess("删除成功");
  190. }).catch((e) => {
  191. console.error("删除失败====",e)
  192. });
  193. },
  194. /** 导出按钮操作 */
  195. handleExport() {
  196. this.download(this.configUrl.export, {
  197. ...this.queryParams
  198. }, `${this.title }_${new Date().getTime()}.xlsx`)
  199. },
  200. /** 导入按钮操作 */
  201. handleImport() {
  202. if(this.$refs.upload) {
  203. this.$refs.upload.initData({
  204. width: '400px',
  205. // 弹出层标题(用户导入)
  206. title: this.title + "导入",
  207. // 下载模板地址
  208. importTemplate: this.configUrl.download,
  209. // 上传的地址
  210. url: this.configUrl.upload
  211. })
  212. }
  213. },
  214. }
  215. };
  216. </script>