index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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="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. <el-table v-loading="loading" :data="list" border max-height="300">
  30. <el-table-column label="序号" type="index" />
  31. <el-table-column label="站码" prop="id" />
  32. <el-table-column label="断面名称" prop="berthingName" />
  33. <el-table-column label="创建日期">
  34. <template slot-scope="scope">
  35. <span>{{ formatDateTime(scope.row.createTime) }}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="断面图" align="center">
  39. <template slot-scope="scope">
  40. <el-button size="mini" type="text" icon="el-icon-s-operation" @click="showSectionChart(scope.row)">查看</el-button>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  44. <template slot-scope="scope">
  45. <el-button size="mini" type="text" icon="el-icon-download" @click="download(scope.row)">导出</el-button>
  46. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. </div>
  51. <div class="hum-page-title" style="margin-top: 30px">断面图</div>
  52. <div class="hum-page-section">
  53. <ChartList ref="chart" />
  54. </div>
  55. <el-dialog title="断面图" :visible.sync="sectionChartVisible" width="60%" destroy-on-close>
  56. <SectionChart :sections="sections" />
  57. </el-dialog>
  58. </div>
  59. </template>
  60. <script>
  61. import { listSite } from "@/api/site/site";
  62. import { listSection, deleteSection } from "@/api/site/berthing";
  63. import ChartList from './chart-list';
  64. import SectionChart from './chart';
  65. export default {
  66. components: {
  67. ChartList,
  68. SectionChart,
  69. },
  70. data() {
  71. return {
  72. siteId: '',
  73. siteList: [],
  74. queryParams: {
  75. page: 1,
  76. size: 1000,
  77. },
  78. loading: true,
  79. total: 0,
  80. list: [],
  81. sections: [],
  82. sectionChartVisible: false,
  83. }
  84. },
  85. created() {
  86. this.init();
  87. },
  88. methods: {
  89. handleQuery() {
  90. this.getList()
  91. },
  92. resetQuery() {},
  93. init() {
  94. this.loading = true;
  95. listSite({ page: 1, size: 1000 }).then(response => {
  96. this.siteList = response.data.records || [];
  97. if (this.siteList.length > 0) {
  98. this.siteId = this.siteList[0].siteId;
  99. this.getList();
  100. }
  101. }
  102. ).catch(() => {
  103. this.loading = false;
  104. });
  105. },
  106. getList() {
  107. this.loading = true;
  108. listSection({ ...this.queryParams, siteId: this.siteId }).then(response => {
  109. const history = (response.data.records || []).filter(({ status }) => status === 0);
  110. this.$refs.chart.setOptions(history);
  111. this.list = history
  112. this.total = response.data.total;
  113. this.loading = false;
  114. }
  115. );
  116. },
  117. showSectionChart(section) {
  118. this.sectionChartVisible = true;
  119. this.sections = JSON.parse(section.positions);
  120. },
  121. download(section) {
  122. window.open(`${process.env.VUE_APP_BASE_API}/berthing/downFile/${section.berthingId}`, '_blank')
  123. },
  124. handleDelete(section) {
  125. this.$modal.confirm('是否确认删除断面名称为"' + section.berthingName + '"的数据项?').then(function() {
  126. return deleteSection(section.berthingId);
  127. }).then(() => {
  128. this.getList();
  129. this.$modal.msgSuccess("删除成功");
  130. }).catch(() => {});
  131. },
  132. }
  133. }
  134. </script>
  135. <style scoped>
  136. </style>