index.vue 4.0 KB

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