simulationHome.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="multimodeSimulation">
  3. <search-layout :needBox="true">
  4. <template slot="searchItem1">
  5. <span class="label">项目ID</span>
  6. <el-input
  7. v-model="searchParams.projectId"
  8. size="small"
  9. clearable
  10. placeholder="请输入"
  11. maxlength="60"
  12. >
  13. </el-input>
  14. </template>
  15. <template slot="searchItem1">
  16. <span class="label">项目名称</span>
  17. <el-input
  18. v-model="searchParams.projectName"
  19. size="small"
  20. clearable
  21. placeholder="请输入"
  22. maxlength="60"
  23. >
  24. </el-input>
  25. </template>
  26. <template slot="searchItem4">
  27. <span class="label">项目进度</span>
  28. <el-select
  29. v-model="searchParams.projectStatus"
  30. size="small"
  31. clearable
  32. placeholder="请输入"
  33. maxlength="60"
  34. >
  35. <el-option
  36. v-for="(item, idx) in [
  37. { label: '未开始', value: '0' },
  38. { label: '运行中', value: '1' },
  39. { label: '已终止', value: '2' },
  40. { label: '已完成', value: '3' },
  41. ]"
  42. :label="item.label"
  43. :value="item.value"
  44. :key="idx"
  45. ></el-option>
  46. </el-select>
  47. </template>
  48. <template slot="searchBtn1">
  49. <el-button type="primary" @click="doSearch">查询</el-button>
  50. </template>
  51. <template slot="searchBtn2">
  52. <!-- <el-button type="primary" @click="doReset">重置</el-button> -->
  53. </template>
  54. </search-layout>
  55. <div></div>
  56. <div style="display: flex; justify-content: end; margin: 20px 50px">
  57. <el-button
  58. class="addBtn"
  59. icon="el-icon-circle-plus-outline"
  60. @click="mapConfig"
  61. type="primary"
  62. >地图管理</el-button>
  63. <el-button
  64. class="addBtn"
  65. icon="el-icon-circle-plus-outline"
  66. @click="addConfig"
  67. type="primary"
  68. >新增</el-button
  69. >
  70. </div>
  71. <tableList
  72. ref="table"
  73. style="margin: 0 30px 30px"
  74. :columns="simulationColumns"
  75. :getDataWay="getDataWay"
  76. :pagination="pagination"
  77. index
  78. >
  79. <el-table-column label="操作" slot="cgInfos" align="center" width="180">
  80. <template v-slot="scope">
  81. <!-- <span v-if="scope.row.projectStatus==1" @click="" class="elIcon"> 查看 </span> -->
  82. <span
  83. v-if="scope.row.projectStatus == '3'"
  84. @click="jumpDetailPage('preview',scope.row.id)"
  85. class="elIcon"
  86. >
  87. 查看
  88. </span>
  89. <span
  90. v-if="scope.row.projectStatus == '0'"
  91. @click="jumpDetailPage('edit',scope.row.id)"
  92. class="elIcon"
  93. >
  94. 编辑
  95. </span>
  96. <span @click="downloadTask(scope.row)" v-if="scope.row.projectStatus == '3'" class="elIcon">
  97.  下载
  98. </span>
  99. <span @click="deleteById(scope.row)" class="elIcon"> 删除 </span>
  100. <span
  101. v-if="scope.row.projectStatus == '2'"
  102. @click="updateTask(scope.row)"
  103. class="elIcon"
  104. >
  105. 终止
  106. </span>
  107. <span
  108. v-if="scope.row.projectStatus == '0'"
  109. @click="updateTask(scope.row)"
  110. class="elIcon"
  111. >
  112. 运行
  113. </span>
  114. </template>
  115. </el-table-column>
  116. </tableList>
  117. </div>
  118. </template>
  119. <script>
  120. import searchLayout from '@/components/grid/searchLayout'
  121. import tableList from '@/components/grid/TableList'
  122. import { mapState } from 'vuex'
  123. export default {
  124. name: 'simulationHome', // 多模式仿真
  125. components: { searchLayout, tableList },
  126. data() {
  127. return {
  128. searchParams: {
  129. projectId: '', // 项目id
  130. projectName: '', // 项目名称
  131. projectStatus: '', // 项目进度
  132. },
  133. // 多模式仿真表头
  134. simulationColumns: [
  135. {
  136. label: '项目ID',
  137. prop: 'id',
  138. },
  139. {
  140. label: '项目名称',
  141. prop: 'projectName',
  142. },
  143. {
  144. label: '场景数量',
  145. prop: 'sceneNums',
  146. },
  147. {
  148. label: '创建时间',
  149. prop: 'createTime',
  150. },
  151. {
  152. label: '进度',
  153. prop: 'projectStatusValue',
  154. },
  155. {
  156. label: '操作',
  157. prop: 'cgInfos',
  158. template: true,
  159. },
  160. ],
  161. pagination: {
  162. //分页使用
  163. currentPage: 1,
  164. pageSize: 10,
  165. position: 'right',
  166. pageSizes: [10, 30, 50, 100, 200],
  167. layout: 'sizes, total, prev, pager, next, jumper',
  168. },
  169. getDataWay: {
  170. //加载表格数据
  171. dataType: 'url',
  172. type: 'post',
  173. data: this.$api.multimode.queryMulationList,
  174. param: {},
  175. },
  176. }
  177. },
  178. methods: {
  179. refreshList(param) {
  180. param
  181. ? this.$refs['table'].loadData(param)
  182. : this.$refs['table'].loadData()
  183. },
  184. doSearch() {
  185. this.refreshList({ ...this.searchParams })
  186. },
  187. doReset() {
  188. this.searchParams = {
  189. projectId: '', // 项目id
  190. projectName: '', // 项目名称
  191. projectStatus: '', // 项目进度
  192. }
  193. this.refreshList()
  194. },
  195. // 仿真任务状态更新
  196. updateTask(row) {
  197. const { id, projectStatus } = row
  198. this.$axios({
  199. method: 'post',
  200. url: this.$api.multimode.updateMulationStatus,
  201. data: {
  202. projectId: id,
  203. projectStatus: projectStatus == 0 || 2 ? 1 : 2,
  204. },
  205. }).then((res) => {
  206. if (res.code == 200) {
  207. this.$message.success('状态更新成功')
  208. this.doSearch()
  209. } else {
  210. this.$message.error(res.message || '更新失败')
  211. }
  212. })
  213. },
  214. // 删除仿真列表
  215. deleteById(row) {
  216. this.$axios({
  217. method: 'post',
  218. url: this.$api.multimode.deleteMulationById,
  219. data: { projectId: row.id },
  220. }).then((res) => {
  221. if (res.code == 200) {
  222. this.$message.success('删除成功')
  223. this.doSearch()
  224. } else {
  225. this.$message.error(res.message || '删除失败')
  226. }
  227. })
  228. },
  229. // 下载仿真任务
  230. downloadTask(row){
  231. this.$axios({
  232. method: 'get',
  233. url: `${this.$api.multimode.downloadMulation}?projectId=${row.id}`,
  234. responseType: "blob",
  235. }).then((res) => {
  236. this.$blobZipDown(res,row.projectName)
  237. })
  238. },
  239. addConfig() {
  240. this.$router.push({
  241. path: '/simulationEdit',
  242. query: { mode: 'add' },
  243. })
  244. },
  245. // 跳转地图管理
  246. mapConfig(){
  247. this.$router.push({
  248. path: '/simulationMap',
  249. })
  250. },
  251. jumpDetailPage(mode,id) {
  252. this.$router.push({
  253. path: '/simulationEdit',
  254. query: { mode,id },
  255. })
  256. },
  257. },
  258. }
  259. </script>
  260. <style lang='less' scoped>
  261. // @import './common/util.less';
  262. .naturalDrivingScenarioListPanel {
  263. .inputBox {
  264. .label {
  265. min-width: 75px;
  266. }
  267. }
  268. .btnsPanel {
  269. text-align: right;
  270. }
  271. }
  272. </style>