index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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="title">
  5. <el-input
  6. v-model="queryParams.title"
  7. placeholder="请输入反馈标题"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="提交人ID" prop="createBy">
  14. <el-input
  15. v-model="queryParams.createBy"
  16. placeholder="请输入提交人ID"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. icon="el-icon-plus"
  32. size="mini"
  33. @click="handleAdd"
  34. v-hasPermi="['system:feedbackinfo:add']"
  35. >新增</el-button>
  36. </el-col>
  37. <el-col :span="1.5">
  38. <el-button
  39. type="success"
  40. icon="el-icon-edit"
  41. size="mini"
  42. :disabled="single"
  43. @click="handleUpdate"
  44. v-hasPermi="['system:feedbackinfo:edit']"
  45. >修改</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. icon="el-icon-delete"
  51. size="mini"
  52. :disabled="multiple"
  53. @click="handleDelete"
  54. v-hasPermi="['system:feedbackinfo:remove']"
  55. >删除</el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="warning"
  60. icon="el-icon-download"
  61. size="mini"
  62. @click="handleExport"
  63. v-hasPermi="['system:feedbackinfo:export']"
  64. >导出</el-button>
  65. </el-col>
  66. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  67. </el-row>
  68. <el-table v-loading="loading" :data="feedbackinfoList" @selection-change="handleSelectionChange">
  69. <el-table-column type="selection" width="55" align="center" />
  70. <el-table-column label="id" align="center" prop="id" v-if="false"/>
  71. <el-table-column label="反馈标题" align="center" prop="title" />
  72. <el-table-column label="反馈内容" align="center" prop="contents" />
  73. <el-table-column label="提交人ID" align="center" prop="createBy" />
  74. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  75. <template slot-scope="scope">
  76. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="反馈意见" align="center" prop="opinions" />
  80. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  81. <template slot-scope="scope">
  82. <el-button
  83. size="mini"
  84. type="text"
  85. icon="el-icon-edit"
  86. @click="handleUpdate(scope.row)"
  87. v-hasPermi="['system:feedbackinfo:edit']"
  88. >修改</el-button>
  89. <el-button
  90. size="mini"
  91. type="text"
  92. icon="el-icon-delete"
  93. @click="handleDelete(scope.row)"
  94. v-hasPermi="['system:feedbackinfo:remove']"
  95. >删除</el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination
  100. v-show="total>0"
  101. :total="total"
  102. :page.sync="queryParams.pageNum"
  103. :limit.sync="queryParams.pageSize"
  104. @pagination="getList"
  105. />
  106. <!-- 添加或修改信息反馈对话框 -->
  107. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  108. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  109. <el-form-item label="反馈标题" prop="title">
  110. <el-input v-model="form.title" placeholder="请输入反馈标题" />
  111. </el-form-item>
  112. <el-form-item label="反馈内容" prop="contents">
  113. <el-input v-model="form.contents" placeholder="请输入反馈内容" />
  114. </el-form-item>
  115. <el-form-item label="反馈意见" prop="opinions">
  116. <el-input v-model="form.opinions" placeholder="请输入反馈意见" />
  117. </el-form-item>
  118. </el-form>
  119. <div slot="footer" class="dialog-footer">
  120. <el-button type="primary" @click="submitForm">确 定</el-button>
  121. <el-button @click="cancel">取 消</el-button>
  122. </div>
  123. </el-dialog>
  124. </div>
  125. </template>
  126. <script>
  127. import { listFeedbackinfo, getFeedbackinfo, delFeedbackinfo, addFeedbackinfo, updateFeedbackinfo, exportFeedbackinfo } from "@/api/system/feedbackinfo";
  128. export default {
  129. name: "Feedbackinfo",
  130. data() {
  131. return {
  132. // 遮罩层
  133. loading: true,
  134. // 选中数组
  135. ids: [],
  136. // 非单个禁用
  137. single: true,
  138. // 非多个禁用
  139. multiple: true,
  140. // 显示搜索条件
  141. showSearch: true,
  142. // 总条数
  143. total: 0,
  144. // 信息反馈表格数据
  145. feedbackinfoList: [],
  146. // 弹出层标题
  147. title: "",
  148. // 是否显示弹出层
  149. open: false,
  150. // 查询参数
  151. queryParams: {
  152. pageNum: 1,
  153. pageSize: 10,
  154. title: null,
  155. createBy: null,
  156. },
  157. // 表单参数
  158. form: {},
  159. // 表单校验
  160. rules: {
  161. }
  162. };
  163. },
  164. created() {
  165. this.getList();
  166. },
  167. methods: {
  168. /** 查询信息反馈列表 */
  169. getList() {
  170. this.loading = true;
  171. listFeedbackinfo(this.queryParams).then(response => {
  172. this.feedbackinfoList = response.rows;
  173. this.total = response.total;
  174. this.loading = false;
  175. });
  176. },
  177. // 取消按钮
  178. cancel() {
  179. this.open = false;
  180. this.reset();
  181. },
  182. // 表单重置
  183. reset() {
  184. this.form = {
  185. id: null,
  186. title: null,
  187. contents: null,
  188. createBy: null,
  189. createTime: null,
  190. opinions: null,
  191. updateTime: null
  192. };
  193. this.resetForm("form");
  194. },
  195. /** 搜索按钮操作 */
  196. handleQuery() {
  197. this.queryParams.pageNum = 1;
  198. this.getList();
  199. },
  200. /** 重置按钮操作 */
  201. resetQuery() {
  202. this.resetForm("queryForm");
  203. this.handleQuery();
  204. },
  205. // 多选框选中数据
  206. handleSelectionChange(selection) {
  207. this.ids = selection.map(item => item.id)
  208. this.single = selection.length!==1
  209. this.multiple = !selection.length
  210. },
  211. /** 新增按钮操作 */
  212. handleAdd() {
  213. this.reset();
  214. this.open = true;
  215. this.title = "添加信息反馈";
  216. },
  217. /** 修改按钮操作 */
  218. handleUpdate(row) {
  219. this.reset();
  220. const id = row.id || this.ids
  221. getFeedbackinfo(id).then(response => {
  222. this.form = response.data;
  223. this.open = true;
  224. this.title = "修改信息反馈";
  225. });
  226. },
  227. /** 提交按钮 */
  228. submitForm() {
  229. this.$refs["form"].validate(valid => {
  230. if (valid) {
  231. if (this.form.id != null) {
  232. updateFeedbackinfo(this.form).then(response => {
  233. if (response.code === 200) {
  234. this.msgSuccess("修改成功");
  235. this.open = false;
  236. this.getList();
  237. }
  238. });
  239. } else {
  240. addFeedbackinfo(this.form).then(response => {
  241. if (response.code === 200) {
  242. this.msgSuccess("新增成功");
  243. this.open = false;
  244. this.getList();
  245. }
  246. });
  247. }
  248. }
  249. });
  250. },
  251. /** 删除按钮操作 */
  252. handleDelete(row) {
  253. const ids = row.id || this.ids;
  254. this.$confirm('是否确认删除信息反馈编号为"' + ids + '"的数据项?', "警告", {
  255. confirmButtonText: "确定",
  256. cancelButtonText: "取消",
  257. type: "warning"
  258. }).then(function() {
  259. return delFeedbackinfo(ids);
  260. }).then(() => {
  261. this.getList();
  262. this.msgSuccess("删除成功");
  263. }).catch(function() {});
  264. },
  265. /** 导出按钮操作 */
  266. handleExport() {
  267. const queryParams = this.queryParams;
  268. this.$confirm('是否确认导出所有信息反馈数据项?', "警告", {
  269. confirmButtonText: "确定",
  270. cancelButtonText: "取消",
  271. type: "warning"
  272. }).then(function() {
  273. return exportFeedbackinfo(queryParams);
  274. }).then(response => {
  275. this.download(response.msg);
  276. }).catch(function() {});
  277. }
  278. }
  279. };
  280. </script>