index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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="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="$router.push('/site/site/add')">新增站点</el-button>
  31. </div>
  32. <el-table v-loading="loading" :data="list" border>
  33. <el-table-column label="任务编号" prop="taskid" />
  34. <el-table-column label="任务模式" prop="workmode" />
  35. <el-table-column label="策略名称" prop="workmode" />
  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="水位" prop="workmode" />
  42. <el-table-column label="过水面积" prop="workmode" />
  43. <el-table-column label="瞬时流量(总)" prop="workmode" />
  44. <el-table-column label="当前状态">
  45. <template slot-scope="scope">
  46. <span class="status status-running" v-if="scope.row.status === 0">
  47. <span class="status-circle"></span>
  48. <span class="status-text">测流中</span>
  49. </span>
  50. <span class="status status-stopped" v-else-if="scope.row.status === 1">
  51. <span class="status-circle"></span>
  52. <span class="status-text">已终止</span>
  53. </span>
  54. <span class="status status-finished" v-else-if="scope.row.status === 2">
  55. <span class="status-circle"></span>
  56. <span class="status-text">已完成</span>
  57. </span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  61. <template slot-scope="scope">
  62. <template v-if="scope.row.status === 0">
  63. <el-button size="mini" type="text" icon="el-icon-edit" @click="goRealTime(scope.row)">实时动态</el-button>
  64. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">中止</el-button>
  65. </template>
  66. <template v-else-if="scope.row.status === 2">
  67. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">测流成果</el-button>
  68. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">导出</el-button>
  69. </template>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <pagination
  74. v-show="total>0"
  75. :total="total"
  76. :page.sync="queryParams.page"
  77. :limit.sync="queryParams.size"
  78. @pagination="getList"
  79. />
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import { listSite } from "@/api/site/site";
  85. import { listAchievements } from "@/api/analysis/achievement";
  86. export default {
  87. data() {
  88. return {
  89. siteId: '',
  90. siteList: [],
  91. queryParams: {
  92. page: 1,
  93. size: 10,
  94. },
  95. dateRange: [],
  96. siteTypeOptions: [
  97. { value: 1, label: '流量站' }
  98. ],
  99. loading: true,
  100. total: 0,
  101. list: []
  102. }
  103. },
  104. created() {
  105. this.init();
  106. },
  107. methods: {
  108. init() {
  109. this.loading = true;
  110. listSite({ page: 1, size: 1000 }).then(response => {
  111. this.siteList = response.data.records || [];
  112. if (this.siteList.length > 0) {
  113. this.siteId = this.siteList[0].siteId;
  114. this.getList();
  115. }
  116. }
  117. ).catch(() => {
  118. this.loading = false;
  119. });
  120. },
  121. handleQuery() {
  122. this.getList();
  123. },
  124. handleSiteChange(siteId) {
  125. this.siteId = siteId;
  126. this.getList();
  127. },
  128. resetQuery() {
  129. this.queryParams = {
  130. page: 1,
  131. size: 10,
  132. };
  133. this.getList();
  134. },
  135. getList() {
  136. this.loading = true;
  137. const data = this.addDateRange(this.queryParams, this.dateRange);
  138. data.siteId = this.siteId;
  139. listAchievements(data).then(response => {
  140. this.list = response.data.records;
  141. this.total = response.data.total;
  142. this.loading = false;
  143. }
  144. );
  145. },
  146. goRealTime(task) {
  147. this.$router.push(`/analysis/task/realtime/${task.siteId}/${task.taskid}`);
  148. },
  149. handleUpdate(site) {
  150. this.$router.push(`/site/site/edit/${site.siteId}`);
  151. },
  152. handleConfig(site) {
  153. this.$router.push(`/site/site/config/${site.siteId}`);
  154. },
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .status {
  160. display: flex;
  161. align-items: center;
  162. &-circle {
  163. width: 8px;
  164. height: 8px;
  165. border-radius: 50%;
  166. }
  167. &-text {
  168. margin-left: 6px;
  169. color: #54606C;
  170. }
  171. }
  172. .status-running .status-circle {
  173. background: #22C777;
  174. }
  175. .status-stopped .status-circle {
  176. background: #FA3C58;
  177. }
  178. .status-finished .status-circle {
  179. background: #8D99A4;
  180. }
  181. </style>