index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="hum-page-container">
  3. <div class="hum-page-title">停泊点策略管理</div>
  4. <div class="hum-page-section">
  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="handleSiteChange">
  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="handleAdd">新增策略</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="planid" />
  36. <el-table-column label="起测水位" prop="wlevel" />
  37. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  38. <template slot-scope="scope">
  39. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
  40. <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>-->
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. </div>
  45. <div class="hum-page-title" style="margin-top: 30px">断面图</div>
  46. <div class="hum-page-section">
  47. <ChartList ref="chart" :plain="plain" />
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { getConfig, listSite } from "@/api/site/site";
  53. import { deletePlainPoint, getSiteSection, listPlainPoint } from "@/api/site/berthing";
  54. import ChartList from './chart-list';
  55. export default {
  56. components: {
  57. ChartList
  58. },
  59. data() {
  60. return {
  61. siteId: '',
  62. siteList: [],
  63. plain: {
  64. wlevelmax: 0,
  65. wlevelmin: 0,
  66. list: [],
  67. sections: [],
  68. },
  69. queryParams: {
  70. page: 1,
  71. size: 1000,
  72. },
  73. loading: true,
  74. total: 0,
  75. list: []
  76. }
  77. },
  78. created() {
  79. this.init();
  80. },
  81. methods: {
  82. handleQuery() {
  83. this.getList()
  84. },
  85. resetQuery() {},
  86. init() {
  87. this.loading = true;
  88. listSite({ page: 1, size: 1000 }).then(response => {
  89. this.siteList = response.data.records || [];
  90. if (this.siteList.length > 0) {
  91. this.siteId = this.siteList[0].siteId;
  92. this.getList();
  93. this.loadConfig();
  94. this.loadSection();
  95. }
  96. }
  97. ).catch(() => {
  98. this.loading = false;
  99. });
  100. },
  101. getList() {
  102. this.loading = true;
  103. listPlainPoint({ ...this.queryParams, siteId: this.siteId }).then(response => {
  104. this.list = response.data.records;
  105. this.total = response.data.total;
  106. this.plain.list = response.data.records;
  107. this.loading = false;
  108. }
  109. );
  110. },
  111. loadConfig() {
  112. getConfig(this.siteId).then((res) => {
  113. const { wlevelmax, wlevelmin } = res.data || {};
  114. this.plain.wlevelmax = wlevelmax;
  115. this.plain.wlevelmin = wlevelmin;
  116. })
  117. },
  118. loadSection() {
  119. getSiteSection(this.siteId).then((res) => {
  120. const { positions } = res.data || {};
  121. this.plain.sections = JSON.parse(positions) || [];
  122. })
  123. },
  124. handleSiteChange(siteId) {
  125. this.siteId = siteId;
  126. this.$refs.chart.chart.clear();
  127. this.getList();
  128. this.loadConfig();
  129. this.loadSection();
  130. },
  131. handleAdd() {
  132. this.$router.push(`/site/plain/point/add?siteId=${this.siteId}`);
  133. },
  134. handleUpdate(plain) {
  135. this.$router.push(`/site/plain/point/edit/${plain.stopId}`);
  136. },
  137. handleDelete(plain) {
  138. this.$modal.confirm('是否确认删除策略编号为"' + plain.planid + '"的数据项?').then(function() {
  139. return deletePlainPoint(plain.stopId);
  140. }).then(() => {
  141. this.getList();
  142. this.$modal.msgSuccess("删除成功");
  143. }).catch(() => {});
  144. },
  145. }
  146. }
  147. </script>
  148. <style scoped>
  149. </style>