index.vue 8.4 KB

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