VersionManage.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="version-manage">
  3. <div class="part-box part-box-pad">
  4. <el-button type="primary" @click="addVersion">新增版本</el-button>
  5. </div>
  6. <div class="part-box part-box-pad">
  7. <el-table :data="dataList">
  8. <el-table-column type="index" label="序号"></el-table-column>
  9. <el-table-column
  10. prop="clientVersion"
  11. label="客户端版本"
  12. ></el-table-column>
  13. <el-table-column
  14. prop="softVersion"
  15. label="服务端版本"
  16. ></el-table-column>
  17. <el-table-column
  18. class-name="action-column"
  19. label="操作"
  20. fixed="right"
  21. width="100"
  22. >
  23. <template slot-scope="scope">
  24. <el-button
  25. class="btn-primary"
  26. type="text"
  27. @click="toEdit(scope.row)"
  28. >管理</el-button
  29. >
  30. <el-button
  31. class="btn-danger"
  32. type="text"
  33. @click="toDelete(scope.row)"
  34. >删除</el-button
  35. >
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <div class="part-page">
  40. <el-pagination
  41. background
  42. layout="total, sizes, prev, pager, next, jumper"
  43. :pager-count="5"
  44. :current-page="current"
  45. :total="total"
  46. :page-size="size"
  47. @current-change="toPage"
  48. @size-change="pageSizeChange"
  49. >
  50. </el-pagination>
  51. </div>
  52. </div>
  53. <modify-version ref="modifyVersion"></modify-version>
  54. </div>
  55. </template>
  56. <script>
  57. import ModifyVersion from "../components/ModifyVersion.vue";
  58. import { versionList, versionDelete } from "@/modules/admin/api";
  59. export default {
  60. name: "version-manage",
  61. components: {
  62. ModifyVersion,
  63. },
  64. data() {
  65. return {
  66. dataList: [],
  67. current: 1,
  68. size: this.GLOBAL.pageSize,
  69. total: 0,
  70. curRow: {},
  71. };
  72. },
  73. mounted() {
  74. this.getList();
  75. },
  76. methods: {
  77. async getList() {
  78. const datas = {
  79. pageNumber: this.current,
  80. pageSize: this.size,
  81. };
  82. const data = await versionList(datas);
  83. this.dataList = data.records;
  84. this.total = data.total;
  85. },
  86. toPage(page) {
  87. this.current = page;
  88. this.getList();
  89. },
  90. addVersion() {
  91. this.curRow = {};
  92. this.$refs.modifyVersion.open();
  93. },
  94. toEdit(row) {
  95. this.curRow = row;
  96. this.$refs.modifyVersion.open();
  97. },
  98. toDelete(row) {
  99. this.$confirm("确定删除该版本吗?", "提示", {
  100. confirmButtonText: "确定",
  101. cancelButtonText: "取消",
  102. type: "warning",
  103. })
  104. .then(async () => {
  105. await versionDelete(row.id);
  106. this.$message.success("删除成功");
  107. this.getList();
  108. })
  109. .catch(() => {});
  110. },
  111. },
  112. };
  113. </script>