index.vue 9.0 KB

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