index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="hum-page-container">
  3. <div class="hum-page-title">断面管理</div>
  4. <div class="hum-page-main">
  5. <div class="hum-page-search">
  6. <el-form :model="queryParams" size="large" ref="queryForm" label-position="top">
  7. <el-row :gutter="30">
  8. <el-col :span="6">
  9. <el-form-item label="选择站点">
  10. <el-select v-model="siteId" placeholder="请选择站点" @change="getList">
  11. <el-option
  12. v-for="item in siteList"
  13. :key="item.siteId"
  14. :label="item.siteName"
  15. :value="item.siteId">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="6">
  21. <el-form-item class="hum-page-search-action">
  22. <el-button type="primary" @click="handleQuery">查询</el-button>
  23. <el-button @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-col>
  26. </el-row>
  27. </el-form>
  28. </div>
  29. <div class="hum-page-action">
  30. <el-button type="primary" @click="$router.push(`/site/section/add?siteId=${siteId}`)">新增断面</el-button>
  31. </div>
  32. <el-table v-loading="loading" :data="list" border>
  33. <el-table-column label="站码" prop="id" />
  34. <el-table-column label="站点名称" prop="siteName" />
  35. <el-table-column label="断面名称" prop="berthingName" />
  36. <el-table-column label="创建日期">
  37. <template slot-scope="scope">
  38. <span>{{ formatDateTime(scope.row.createTime) }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  42. <template slot-scope="scope">
  43. <el-button
  44. size="mini"
  45. type="text"
  46. icon="el-icon-s-operation"
  47. @click="handleUpdate(scope.row)"
  48. >断面图</el-button>
  49. <el-button
  50. v-if="scope.$index > 0"
  51. size="mini"
  52. type="text"
  53. icon="el-icon-delete"
  54. @click="handleUpdate(scope.row)"
  55. >删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import { listSite } from "@/api/site/site";
  64. import { listSection } from "@/api/site/berthing";
  65. export default {
  66. data() {
  67. return {
  68. siteId: '',
  69. siteList: [],
  70. queryParams: {
  71. page: 1,
  72. size: 1000,
  73. },
  74. loading: true,
  75. total: 0,
  76. list: []
  77. }
  78. },
  79. created() {
  80. this.init();
  81. },
  82. methods: {
  83. handleQuery() {
  84. this.getList()
  85. },
  86. resetQuery() {},
  87. init() {
  88. this.loading = true;
  89. listSite({ page: 1, size: 1000 }).then(response => {
  90. this.siteList = response.data.records || [];
  91. if (this.siteList.length > 0) {
  92. this.siteId = this.siteList[0].siteId;
  93. this.getList();
  94. }
  95. }
  96. ).catch(() => {
  97. this.loading = false;
  98. });
  99. },
  100. getList() {
  101. this.loading = true;
  102. listSection({ ...this.queryParams, siteId: this.siteId }).then(response => {
  103. this.list = response.data.records;
  104. this.total = response.data.total;
  105. this.loading = false;
  106. }
  107. );
  108. },
  109. handleUpdate(site) {
  110. this.$router.push(`/site/site/edit/${site.siteId}`);
  111. },
  112. handleDelete(site) {
  113. this.$router.push(`/site/site/config/${site.siteId}`);
  114. },
  115. }
  116. }
  117. </script>
  118. <style scoped>
  119. </style>