settleAccounts.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. ref="crud"
  5. :data="data"
  6. :option="option"
  7. :page.sync="page"
  8. :table-loading="loading"
  9. :before-open="beforeOpen"
  10. @row-del="rowDel"
  11. @size-change="sizeChange"
  12. @current-change="currentChange"
  13. @search-change="searchChange"
  14. @refresh-change="refreshChange"
  15. @cell-dblclick="cellDblclick"
  16. @on-load="getList"
  17. @saveColumn="saveColumn"
  18. >
  19. <template slot-scope="{row,index}" slot="menuLeft">
  20. <el-button
  21. icon="el-icon-printer"
  22. size="small"
  23. type="primary"
  24. @click.stop="openReport()"
  25. >报 表
  26. </el-button>
  27. </template>
  28. <template slot-scope="scope" slot="menu">
  29. <el-button
  30. type="text"
  31. icon="el-icon-edit"
  32. size="small"
  33. @click.stop="settleAccounts(scope.row, scope.index)"
  34. >编 辑
  35. </el-button>
  36. </template>
  37. </avue-crud>
  38. </basic-container>
  39. </template>
  40. <script>
  41. import option from "./configuration/settleAccounts.json";
  42. import { getList } from "@/api/workManagement/mainProject";
  43. export default {
  44. data() {
  45. return {
  46. loading: false,
  47. data: [],
  48. option: option,
  49. page: {
  50. currentPage: 1,
  51. total: 0,
  52. pageSize: 10
  53. }
  54. };
  55. },
  56. mounted() {
  57. option.height = window.innerHeight - 340 ;
  58. },
  59. methods: {
  60. getList(page,params={}) {
  61. this.loading = true;
  62. params.flag = 1;
  63. getList(page.currentPage, page.pageSize,params).then(res =>{
  64. this.data = res.data.data.records
  65. this.page.total = res.data.data.total
  66. this.loading = false
  67. })
  68. },
  69. //结算
  70. settleAccounts(row){
  71. this.$router.push({
  72. path: "/settleAccounts_detailsPage",
  73. query: {id: row.id},
  74. });
  75. },
  76. searchChange(params, done) {
  77. this.getList(this.page, params);
  78. done();
  79. },
  80. sizeChange(val) {
  81. this.page.pageSize = val;
  82. this.getList();
  83. },
  84. currentChange(val) {
  85. this.page.currentPage = val;
  86. this.getList();
  87. },
  88. refreshChange() {
  89. this.page.currentPage = 1;
  90. this.getList();
  91. },
  92. //删除列表后面的删除按钮触发触发(row, index, done)
  93. rowDel(row, index, done) {
  94. this.$confirm("确定将选择数据删除?", {
  95. confirmButtonText: "确定",
  96. cancelButtonText: "取消",
  97. type: "warning"
  98. }).then(() => {
  99. this.$message({
  100. type: "success",
  101. message: "操作成功!"
  102. });
  103. // 数据回调进行刷新
  104. done(row);
  105. });
  106. },
  107. cellDblclick(row, column, cell, event) {
  108. console.log(row, column, cell, event);
  109. this.$refs.crud.rowEdit(row);
  110. },
  111. saveColumn(row, column) {
  112. console.log(row, column);
  113. },
  114. }
  115. };
  116. </script>
  117. <style></style>