picture.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="联系方式" prop="concat">
  5. <el-input
  6. v-model="queryParams.concat"
  7. placeholder="请输入联系方式"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="状态" prop="status">
  14. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  15. <el-option label="待审核" value="SUBMIT"/>
  16. <el-option label="审核通过" value="PASS"/>
  17. <el-option label="审核未通过" value="NO_PASS"/>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  22. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <el-row :gutter="10" class="mb8">
  26. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  27. </el-row>
  28. <el-table border v-loading="loading" :data="commentList" @selection-change="handleSelectionChange">
  29. <el-table-column label="编号" align="center" prop="id" width="55"/>
  30. <el-table-column label="评论人名称" align="center" prop="name"/>
  31. <el-table-column label="评论内容" align="center" prop="content" show-overflow-tooltip="true"/>
  32. <el-table-column label="联系方式" align="center" prop="concat"/>
  33. <!-- <el-table-column label="评论的类型:PICTURE图片故事,GALLERY图库" align="center" prop="type"/>-->
  34. <el-table-column label="状态" align="center" prop="status">
  35. <template scope="scope">
  36. {{ getStatusName(scope.row.status) }}
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="备注" align="center" prop="remark"/>
  40. <!-- <el-table-column label="评论的外键,图片故事评论的话,就图片故事id,图库的话就图库id" align="center" prop="fkId"/>-->
  41. <el-table-column label="评论者IP" align="center" prop="ip"/>
  42. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
  43. <template slot-scope="scope">
  44. <el-button
  45. size="mini"
  46. type="text"
  47. icon="el-icon-edit"
  48. @click="handleUpdate(scope.row)"
  49. v-hasPermi="['system:comment:edit']"
  50. v-if="scope.row.status == 'SUBMIT'"
  51. >审核
  52. </el-button>
  53. <el-button
  54. size="mini"
  55. type="text"
  56. @click="handleAdd(scope.row)"
  57. >查看
  58. </el-button>
  59. <el-button
  60. size="mini"
  61. type="text"
  62. @click="handleDel(scope.row)"
  63. >删除
  64. </el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <pagination
  69. v-show="total>0"
  70. :total="total"
  71. :page.sync="queryParams.pageNum"
  72. :limit.sync="queryParams.pageSize"
  73. @pagination="getList"
  74. />
  75. <!-- 添加或修改评论信息对话框 -->
  76. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
  77. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  78. <el-form-item label="评论人" prop="name">
  79. <el-input v-model="form.name" placeholder="请输入评论人名称" readonly/>
  80. </el-form-item>
  81. <el-form-item label="评论内容">
  82. <el-input v-model="form.content" :min-height="192" readonly type="textarea"/>
  83. </el-form-item>
  84. <el-form-item label="联系方式" prop="concat">
  85. <el-input v-model="form.concat" placeholder="请输入联系方式" readonly/>
  86. </el-form-item>
  87. <el-form-item label="状态">
  88. <el-input :value="getStatusName(form.status)" readonly/>
  89. </el-form-item>
  90. <el-form-item label="主题" prop="fkId">
  91. <el-input v-model="form.title" placeholder="" readonly/>
  92. </el-form-item>
  93. <el-form-item label="评论者IP" prop="ip">
  94. <el-input v-model="form.ip" placeholder="请输入评论者IP" readonly/>
  95. </el-form-item>
  96. </el-form>
  97. <div slot="footer" class="dialog-footer" v-if="showEdit">
  98. <el-button type="primary" @click="submitForm('PASS')" size="small">通过</el-button>
  99. <el-button type="warning" @click="submitForm('NO_PASS')" size="small">不通过</el-button>
  100. <el-button @click="cancel" size="small">取 消</el-button>
  101. </div>
  102. </el-dialog>
  103. </div>
  104. </template>
  105. <script>
  106. import {approvalComment, getComment, listComment, delComment} from "@/api/system/comment";
  107. import Editor from '@/components/Editor';
  108. export default {
  109. name: "Comment",
  110. components: {Editor},
  111. data() {
  112. return {
  113. // 遮罩层
  114. loading: true,
  115. // 选中数组
  116. ids: [],
  117. // 非单个禁用
  118. single: true,
  119. // 非多个禁用
  120. multiple: true,
  121. // 显示搜索条件
  122. showSearch: true,
  123. // 总条数
  124. total: 0,
  125. // 评论信息表格数据
  126. commentList: [],
  127. // 弹出层标题
  128. title: "",
  129. // 是否显示弹出层
  130. open: false,
  131. // 查询参数
  132. queryParams: {
  133. pageNum: 1,
  134. pageSize: 10,
  135. name: null,
  136. content: null,
  137. concat: null,
  138. type: 'PICTURE',
  139. status: 'SUBMIT',
  140. fkId: null,
  141. ip: null
  142. },
  143. // 表单参数
  144. form: {},
  145. // 表单校验
  146. rules: {},
  147. showEdit: false
  148. };
  149. },
  150. created() {
  151. this.getList();
  152. },
  153. methods: {
  154. /** 查询评论信息列表 */
  155. getList() {
  156. this.loading = true;
  157. this.queryParams.type = 'PICTURE';
  158. listComment(this.queryParams).then(response => {
  159. this.commentList = response.rows;
  160. this.total = response.total;
  161. this.loading = false;
  162. });
  163. },
  164. // 取消按钮
  165. cancel() {
  166. this.open = false;
  167. this.reset();
  168. },
  169. // 表单重置
  170. reset() {
  171. this.form = {
  172. id: null,
  173. name: null,
  174. content: null,
  175. concat: null,
  176. type: 'PICTURE',
  177. status: 'SUBMIT',
  178. createBy: null,
  179. createTime: null,
  180. updateBy: null,
  181. updateTime: null,
  182. remark: null,
  183. ip: null
  184. };
  185. this.resetForm("form");
  186. },
  187. /** 搜索按钮操作 */
  188. handleQuery() {
  189. this.queryParams.pageNum = 1;
  190. this.queryParams.type = 'PICTURE';
  191. this.getList();
  192. },
  193. /** 重置按钮操作 */
  194. resetQuery() {
  195. this.resetForm("queryForm");
  196. this.handleQuery();
  197. },
  198. // 多选框选中数据
  199. handleSelectionChange(selection) {
  200. this.ids = selection.map(item => item.id)
  201. this.single = selection.length !== 1
  202. this.multiple = !selection.length
  203. },
  204. /** 修改按钮操作 */
  205. handleUpdate(row) {
  206. this.reset();
  207. const id = row.id || this.ids
  208. getComment(id).then(response => {
  209. this.form = response.data;
  210. this.open = true;
  211. this.title = "修改评论信息";
  212. this.showEdit = true;
  213. });
  214. }, /** 修改按钮操作 */
  215. handleAdd(row) {
  216. this.reset();
  217. const id = row.id || this.ids
  218. getComment(id).then(response => {
  219. this.form = response.data;
  220. this.open = true;
  221. this.title = "查看评论信息";
  222. this.showEdit = false;
  223. });
  224. },
  225. /** 提交按钮 */
  226. submitForm(status) {
  227. let formData = new FormData();
  228. formData.append("id", this.form.id);
  229. formData.append("status", status);
  230. approvalComment(formData).then(response => {
  231. this.msgSuccess("修改成功");
  232. this.open = false;
  233. this.getList();
  234. });
  235. },
  236. getStatusName(status) {
  237. let statusInfo = {
  238. SUBMIT: '待审核',
  239. PASS: '审核通过',
  240. NO_PASS: '审核未通过'
  241. };
  242. return statusInfo[status];
  243. },
  244. handleDel(row) {
  245. console.log(row);
  246. this.$confirm('确定删除该评论吗?', '警告').then(() => {
  247. delComment(row.id).then(() => {
  248. this.$message.success("删除成功!");
  249. this.handleQuery();
  250. }).catch((err) => {
  251. this.$message.error("删除失败!");
  252. })
  253. });
  254. }
  255. }
  256. };
  257. </script>