index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索工作栏 -->
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="大队id" prop="deptid">
  6. <el-select v-model="queryParams.deptid" placeholder="请选择大队id" clearable size="small">
  7. <el-option label="请选择字典生成" value="" />
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  12. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  13. </el-form-item>
  14. </el-form>
  15. <!-- 操作工具栏 -->
  16. <el-row :gutter="10" class="mb8">
  17. <el-col :span="1.5">
  18. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  19. v-hasPermi="['backend:S9-tongji:create']">新增</el-button>
  20. </el-col>
  21. <el-col :span="1.5">
  22. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
  23. v-hasPermi="['backend:S9-tongji:export']">导出</el-button>
  24. </el-col>
  25. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  26. </el-row>
  27. <!-- 列表 -->
  28. <el-table v-loading="loading" :data="list">
  29. <el-table-column label="id" align="center" prop="id" />
  30. <el-table-column label="大队id" align="center" prop="deptid" />
  31. <el-table-column label="小单位总数" align="center" prop="s9orgtotal" />
  32. <el-table-column label="自查总数" align="center" prop="selfscan" />
  33. <el-table-column label="活跃度" align="center" prop="actnums" />
  34. <el-table-column label="自查数" align="center" prop="scantotal" />
  35. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  36. <template v-slot="scope">
  37. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  38. v-hasPermi="['backend:S9-tongji:update']">修改</el-button>
  39. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  40. v-hasPermi="['backend:S9-tongji:delete']">删除</el-button>
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. <!-- 分页组件 -->
  45. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  46. @pagination="getList"/>
  47. <!-- 对话框(添加 / 修改) -->
  48. <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
  49. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  50. <el-form-item label="大队id" prop="deptid">
  51. <el-select v-model="form.deptid" placeholder="请选择大队id">
  52. <el-option label="请选择字典生成" value="" />
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="小单位总数" prop="s9orgtotal">
  56. <el-input v-model="form.s9orgtotal" placeholder="请输入小单位总数" />
  57. </el-form-item>
  58. <el-form-item label="自查总数" prop="selfscan">
  59. <el-input v-model="form.selfscan" placeholder="请输入自查总数" />
  60. </el-form-item>
  61. <el-form-item label="活跃度" prop="actnums">
  62. <el-input v-model="form.actnums" placeholder="请输入活跃度" />
  63. </el-form-item>
  64. <el-form-item label="自查数" prop="scantotal">
  65. <el-input v-model="form.scantotal" placeholder="请输入自查数" />
  66. </el-form-item>
  67. </el-form>
  68. <div slot="footer" class="dialog-footer">
  69. <el-button type="primary" @click="submitForm">确 定</el-button>
  70. <el-button @click="cancel">取 消</el-button>
  71. </div>
  72. </el-dialog>
  73. </div>
  74. </template>
  75. <script>
  76. import { createS9Tongji, updateS9Tongji, deleteS9Tongji, getS9Tongji, getS9TongjiPage, exportS9TongjiExcel } from "@/api/backend/s9Tongji";
  77. export default {
  78. name: "S9Tongji",
  79. components: {
  80. },
  81. data() {
  82. return {
  83. // 遮罩层
  84. loading: true,
  85. // 导出遮罩层
  86. exportLoading: false,
  87. // 显示搜索条件
  88. showSearch: true,
  89. // 总条数
  90. total: 0,
  91. // 各大队9小单位统计列表
  92. list: [],
  93. // 弹出层标题
  94. title: "",
  95. // 是否显示弹出层
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. pageNo: 1,
  100. pageSize: 10,
  101. deptid: null,
  102. },
  103. // 表单参数
  104. form: {},
  105. // 表单校验
  106. rules: {
  107. }
  108. };
  109. },
  110. created() {
  111. this.getList();
  112. },
  113. methods: {
  114. /** 查询列表 */
  115. getList() {
  116. this.loading = true;
  117. // 执行查询
  118. getS9TongjiPage(this.queryParams).then(response => {
  119. this.list = response.data.list;
  120. this.total = response.data.total;
  121. this.loading = false;
  122. });
  123. },
  124. /** 取消按钮 */
  125. cancel() {
  126. this.open = false;
  127. this.reset();
  128. },
  129. /** 表单重置 */
  130. reset() {
  131. this.form = {
  132. id: undefined,
  133. deptid: undefined,
  134. s9orgtotal: undefined,
  135. selfscan: undefined,
  136. actnums: undefined,
  137. scantotal: undefined,
  138. };
  139. this.resetForm("form");
  140. },
  141. /** 搜索按钮操作 */
  142. handleQuery() {
  143. this.queryParams.pageNo = 1;
  144. this.getList();
  145. },
  146. /** 重置按钮操作 */
  147. resetQuery() {
  148. this.resetForm("queryForm");
  149. this.handleQuery();
  150. },
  151. /** 新增按钮操作 */
  152. handleAdd() {
  153. this.reset();
  154. this.open = true;
  155. this.title = "添加各大队9小单位统计";
  156. },
  157. /** 修改按钮操作 */
  158. handleUpdate(row) {
  159. this.reset();
  160. const id = row.id;
  161. getS9Tongji(id).then(response => {
  162. this.form = response.data;
  163. this.open = true;
  164. this.title = "修改各大队9小单位统计";
  165. });
  166. },
  167. /** 提交按钮 */
  168. submitForm() {
  169. this.$refs["form"].validate(valid => {
  170. if (!valid) {
  171. return;
  172. }
  173. // 修改的提交
  174. if (this.form.id != null) {
  175. updateS9Tongji(this.form).then(response => {
  176. this.$modal.msgSuccess("修改成功");
  177. this.open = false;
  178. this.getList();
  179. });
  180. return;
  181. }
  182. // 添加的提交
  183. createS9Tongji(this.form).then(response => {
  184. this.$modal.msgSuccess("新增成功");
  185. this.open = false;
  186. this.getList();
  187. });
  188. });
  189. },
  190. /** 删除按钮操作 */
  191. handleDelete(row) {
  192. const id = row.id;
  193. this.$modal.confirm('是否确认删除各大队9小单位统计编号为"' + id + '"的数据项?').then(function() {
  194. return deleteS9Tongji(id);
  195. }).then(() => {
  196. this.getList();
  197. this.$modal.msgSuccess("删除成功");
  198. }).catch(() => {});
  199. },
  200. /** 导出按钮操作 */
  201. handleExport() {
  202. // 处理查询参数
  203. let params = {...this.queryParams};
  204. params.pageNo = undefined;
  205. params.pageSize = undefined;
  206. this.$modal.confirm('是否确认导出所有各大队9小单位统计数据项?').then(() => {
  207. this.exportLoading = true;
  208. return exportS9TongjiExcel(params);
  209. }).then(response => {
  210. this.$download.excel(response, '各大队9小单位统计.xls');
  211. this.exportLoading = false;
  212. }).catch(() => {});
  213. }
  214. }
  215. };
  216. </script>