trafficAccidentSimulationScenarioList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <div class="trafficAccidentSimulationScenarioListPanel">
  3. <search-layout :needBox="true">
  4. <template slot="searchItem1">
  5. <span class="label">场景名称</span>
  6. <el-input
  7. v-model="searchParams.sceneName"
  8. size="small"
  9. clearable
  10. placeholder="请输入"
  11. maxlength="60"
  12. @keyup.enter.native="doSearch"
  13. >
  14. </el-input>
  15. </template>
  16. <template slot="searchItem2">
  17. <span class="label">自车驾驶行为</span>
  18. <el-select
  19. v-model="searchParams.selfDriving"
  20. multiple
  21. size="small"
  22. clearable
  23. >
  24. <el-option
  25. v-for="item in selfDrivingList"
  26. :label="item.caption"
  27. :value="item.code"
  28. :key="item.code"
  29. ></el-option>
  30. </el-select>
  31. </template>
  32. <template slot="searchItem3">
  33. <span class="label">目标驾驶行为</span>
  34. <el-select
  35. v-model="searchParams.targetDriving"
  36. multiple
  37. size="small"
  38. clearable
  39. >
  40. <el-option
  41. v-for="item in targetDrivingList"
  42. :label="item.caption"
  43. :value="item.code"
  44. :key="item.code"
  45. ></el-option>
  46. </el-select>
  47. </template>
  48. <template slot="searchItem4">
  49. <span class="label">自车反应行为</span>
  50. <el-select
  51. v-model="searchParams.selfReaction"
  52. multiple
  53. size="small"
  54. clearable
  55. >
  56. <el-option
  57. v-for="item in selfReactionList"
  58. :label="item.caption"
  59. :value="item.code"
  60. :key="item.code"
  61. ></el-option>
  62. </el-select>
  63. </template>
  64. <template slot="searchItem5">
  65. <span class="label">冲突行为</span>
  66. <el-select
  67. v-model="searchParams.conflictBehavior"
  68. multiple
  69. size="small"
  70. clearable
  71. >
  72. <el-option
  73. v-for="item in conflictBehaviorList"
  74. :label="item.caption"
  75. :value="item.code"
  76. :key="item.code"
  77. ></el-option>
  78. </el-select>
  79. </template>
  80. <template slot="searchItem6">
  81. <span class="label">冲突类型</span>
  82. <el-select
  83. v-model="searchParams.conflictType"
  84. multiple
  85. size="small"
  86. clearable
  87. >
  88. <el-option
  89. v-for="item in conflictTypeList"
  90. :label="item.caption"
  91. :value="item.code"
  92. :key="item.code"
  93. ></el-option>
  94. </el-select>
  95. </template>
  96. <!-- 复杂度 -->
  97. <template slot="searchItem6">
  98. <span class="label">复杂度</span>
  99. <el-input
  100. v-model="searchParams.minComplexity"
  101. size="small"
  102. clearable
  103. placeholder="请输入"
  104. maxlength="60"
  105. @keyup.enter.native="doSearch"
  106. style="width: 100px"
  107. >
  108. </el-input>
  109. <span class="dateSeparator">至</span>
  110. <el-input
  111. v-model="searchParams.maxComplexity"
  112. size="small"
  113. clearable
  114. placeholder="请输入"
  115. maxlength="60"
  116. @keyup.enter.native="doSearch"
  117. style="width: 100px"
  118. >
  119. </el-input>
  120. </template>
  121. <!-- 危险度 -->
  122. <template slot="searchItem7">
  123. <span class="label">危险度</span>
  124. <el-input
  125. v-model="searchParams.minRisk"
  126. size="small"
  127. clearable
  128. placeholder="请输入"
  129. maxlength="60"
  130. @keyup.enter.native="doSearch"
  131. style="width: 100px"
  132. >
  133. </el-input>
  134. <span class="dateSeparator">至</span>
  135. <el-input
  136. v-model="searchParams.maxRisk"
  137. size="small"
  138. clearable
  139. placeholder="请输入"
  140. maxlength="60"
  141. @keyup.enter.native="doSearch"
  142. style="width: 100px"
  143. >
  144. </el-input>
  145. </template>
  146. <template slot="searchItem7">
  147. <span class="label">复杂度等级</span>
  148. <el-select
  149. v-model="searchParams.complexityLevel"
  150. size="small"
  151. clearable
  152. >
  153. <el-option
  154. v-for="item in ['S', 'AA', 'A', 'B', 'C']"
  155. :label="item"
  156. :value="item"
  157. :key="item"
  158. ></el-option>
  159. </el-select>
  160. </template>
  161. <template slot="searchItem8">
  162. <span class="label">危险度等级</span>
  163. <el-select
  164. v-model="searchParams.riskLevel"
  165. size="small"
  166. clearable
  167. >
  168. <el-option
  169. v-for="item in ['S', 'AA', 'A', 'B', 'C']"
  170. :label="item"
  171. :value="item"
  172. :key="item"
  173. ></el-option>
  174. </el-select>
  175. </template>
  176. <template slot="searchItem27">
  177. <!-- <el-checkbox-group v-model="labels">
  178. <el-checkbox-button label="追尾" :key="1" class="labelA"
  179. >追尾</el-checkbox-button
  180. >
  181. <el-checkbox-button label="切入" :key="2" class="labelB"
  182. >目标车切入</el-checkbox-button
  183. >
  184. <el-checkbox-button
  185. label="沿弯道行驶"
  186. :key="3"
  187. class="labelC"
  188. >目标车沿弯道行驶</el-checkbox-button
  189. >
  190. <el-checkbox-button
  191. label="机动车-机动车冲突"
  192. :key="4"
  193. class="labelD"
  194. >机动车-机动车冲突</el-checkbox-button
  195. >
  196. </el-checkbox-group> -->
  197. <div class="labelsBox">
  198. <b class="labelA" @click="conditions(1)">追尾</b>
  199. <b class="labelB" @click="conditions(2)">目标车切入</b>
  200. <b class="labelC" @click="conditions(3)">目标车沿弯道行驶</b>
  201. <b class="labelD" @click="conditions(4)">机动车-机动车冲突</b>
  202. </div>
  203. </template>
  204. <template slot="searchBtn1">
  205. <el-button type="primary" @click="doSearch">查询</el-button>
  206. </template>
  207. <template slot="searchBtn2">
  208. <el-button type="primary" @click="doReset">重置</el-button>
  209. </template>
  210. </search-layout>
  211. <div class="myTabsBox">
  212. <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
  213. <el-tab-pane label="公有" name="1"></el-tab-pane>
  214. <el-tab-pane label="私有" name="2"></el-tab-pane>
  215. </el-tabs>
  216. </div>
  217. <tableList
  218. ref="table"
  219. style="margin: 0 30px 30px"
  220. :columns="columns"
  221. :getDataWay="getDataWay"
  222. :pagination="pagination"
  223. index
  224. >
  225. <el-table-column label="操作" slot="cgInfos" align="center" width="180">
  226. <template v-slot="scope">
  227. <i
  228. @click="viewRow(scope.row)"
  229. class="el-icon-view elIcon cursor"
  230. title="查看"
  231. >
  232. </i>
  233. <i @click="jumpScene(scope.row)" class="el-icon-document elIcon"></i>
  234. </template>
  235. </el-table-column>
  236. </tableList>
  237. <el-dialog
  238. :title="videoDiaTitle"
  239. :visible.sync="dialogVisible"
  240. width="690px"
  241. :close-on-click-modal="false"
  242. :close-on-press-escape="false"
  243. :before-close="diaClose"
  244. >
  245. <div class="videoBox">
  246. <video autoplay :src="videoSrc" controls></video>
  247. </div>
  248. </el-dialog>
  249. </div>
  250. </template>
  251. <script>
  252. import searchLayout from '@/components/grid/searchLayout'
  253. import tableList from '@/components/grid/TableList'
  254. import { mapState } from 'vuex'
  255. export default {
  256. name: 'trafficAccidentSimulationScenarioList', // 交通事故场景
  257. components: { searchLayout, tableList },
  258. data() {
  259. return {
  260. activeName: '2',
  261. searchParams: {
  262. //搜索参数
  263. sceneName: '', //场景名称
  264. selfDriving: [], //自车驾驶行为
  265. targetDriving: [], //目标驾驶行为
  266. selfReaction: [], //自车反应行为
  267. conflictBehavior: [], //冲突行为
  268. conflictType: [], //冲突类型
  269. rearEndCollision: '', // 追尾
  270. cutIn: '', // 切入
  271. driveCurve: '', // 沿弯道行驶
  272. carConflict: '', // 机动车-机动车冲突
  273. share: '0',
  274. minComplexity: '',
  275. maxComplexity: '',
  276. minRisk: '',
  277. maxRisk: '',
  278. complexityLevel: '',
  279. riskLevel: '',
  280. },
  281. labels: [],
  282. selfDrivingList: [],
  283. targetDrivingList: [],
  284. selfReactionList: [],
  285. conflictBehaviorList: [],
  286. conflictTypeList: [],
  287. columns: [
  288. //表格列
  289. {
  290. label: '场景名称',
  291. prop: 'sceneName',
  292. },
  293. {
  294. label: '自车驾驶行为',
  295. prop: 'selfDriving',
  296. },
  297. {
  298. label: '目标驾驶行为',
  299. prop: 'targetDriving',
  300. },
  301. {
  302. label: '自车反应行为',
  303. prop: 'selfReaction',
  304. },
  305. {
  306. label: '冲突行为',
  307. prop: 'conflictBehavior',
  308. },
  309. {
  310. label: '冲突类型',
  311. prop: 'conflictType',
  312. },
  313. {
  314. label: '标签',
  315. prop: 'label',
  316. },
  317. {
  318. label: '复杂度',
  319. prop: 'complexity',
  320. },
  321. {
  322. label: '复杂度等级',
  323. prop: 'complexityLevel',
  324. },
  325. {
  326. label: '危险度',
  327. prop: 'risk',
  328. },
  329. {
  330. label: '危险度等级',
  331. prop: 'riskLevel',
  332. },
  333. {
  334. label: '操作',
  335. prop: 'cgInfos',
  336. template: true,
  337. },
  338. ],
  339. pagination: {
  340. //分页使用
  341. currentPage: 1,
  342. pageSize: 10,
  343. position: 'right',
  344. pageSizes: [10, 30, 50, 100, 200],
  345. layout: 'sizes, total, prev, pager, next, jumper',
  346. },
  347. getDataWay: {
  348. //加载表格数据
  349. dataType: 'url',
  350. type: 'post',
  351. // firstRequest: false,
  352. data: this.$api.sceneLibrary.querySceneAccidentList,
  353. param: {
  354. share: '0',
  355. },
  356. },
  357. dialogVisible: false,
  358. autoplay: false,
  359. videoSrc: '',
  360. objectPath: '',
  361. videoDiaTitle: '',
  362. }
  363. },
  364. computed: {
  365. ...mapState(['fileHost', 'fileUrl']),
  366. },
  367. methods: {
  368. doSearch() {
  369. /* this.searchParams.rearEndCollision = this.labels.includes("追尾")
  370. ? "追尾"
  371. : "";
  372. this.searchParams.cutIn = this.labels.includes("切入")
  373. ? "切入"
  374. : "";
  375. this.searchParams.driveCurve = this.labels.includes("沿弯道行驶")
  376. ? "沿弯道行驶"
  377. : "";
  378. this.searchParams.carConflict = this.labels.includes(
  379. "机动车-机动车冲突"
  380. )
  381. ? "机动车-机动车"
  382. : ""; */
  383. this.searchParams.share = this.activeName === '1' ? '1' : '0'
  384. this.refreshList(this.searchParams)
  385. },
  386. //刷新table
  387. refreshList(param) {
  388. param
  389. ? this.$refs['table'].loadData(param)
  390. : this.$refs['table'].loadData()
  391. },
  392. jumpScene(row) {
  393. this.$store.commit('getSceneId', row.accidentId)
  394. this.$router.push({
  395. path: '/sceneEvaluation',
  396. query:{id:row.accidentId}
  397. })
  398. },
  399. doReset() {
  400. this.searchParams = {
  401. sceneName: '',
  402. selfDriving: [],
  403. targetDriving: [],
  404. selfReaction: [],
  405. conflictBehavior: [],
  406. conflictType: [],
  407. rearEndCollision: '',
  408. cutIn: '',
  409. driveCurve: '',
  410. carConflict: '',
  411. share: this.activeName === '1' ? '1' : '0',
  412. minComplexity: '',
  413. maxComplexity: '',
  414. minRisk: '',
  415. maxRisk: '',
  416. complexityLevel: '',
  417. riskLevel: '',
  418. }
  419. // this.labels = [];
  420. this.doSearch()
  421. },
  422. pageControl(data) {
  423. this.activeName = data.name
  424. this.doSearch()
  425. },
  426. conditions(v) {
  427. switch (v) {
  428. case 1:
  429. if (!this.searchParams.conflictBehavior.includes('追尾')) {
  430. this.searchParams.conflictBehavior = [
  431. ...this.searchParams.conflictBehavior,
  432. '追尾',
  433. ]
  434. }
  435. break
  436. case 2:
  437. if (!this.searchParams.targetDriving.includes('切入')) {
  438. this.searchParams.targetDriving = [
  439. ...this.searchParams.targetDriving,
  440. '切入',
  441. ]
  442. }
  443. break
  444. case 3:
  445. if (!this.searchParams.targetDriving.includes('沿弯道行驶')) {
  446. this.searchParams.targetDriving = [
  447. ...this.searchParams.targetDriving,
  448. '沿弯道行驶',
  449. ]
  450. }
  451. break
  452. case 4:
  453. if (!this.searchParams.conflictType.includes('机动车-机动车')) {
  454. this.searchParams.conflictType = [
  455. ...this.searchParams.conflictType,
  456. '机动车-机动车',
  457. ]
  458. }
  459. break
  460. default:
  461. break
  462. }
  463. },
  464. viewRow(row) {
  465. if (!row.videoAddress) {
  466. this.$message.warning('本场景无仿真视频')
  467. return
  468. }
  469. this.dialogVisible = true
  470. this.videoDiaTitle = row.sceneName
  471. let url = ''
  472. if (process.env.VUE_APP_IS_DEV == 'true') {
  473. url = this.fileHost + this.fileUrl
  474. } else {
  475. url = this.fileUrl
  476. }
  477. let token = localStorage.getItem('Authorization').split(' ')[1]
  478. this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`
  479. this.autoplay = true
  480. },
  481. delRow(row) {
  482. this.$confirm('确认是否删除?', '提示', {
  483. confirmButtonText: '确定',
  484. cancelButtonText: '取消',
  485. type: 'warning',
  486. }).then(() => {
  487. this.$axios({
  488. method: 'post',
  489. url: this.$api.sceneLibrary.deleteSceneAccident,
  490. data: {
  491. accidentId: row.accidentId,
  492. },
  493. }).then((res) => {
  494. if (res.code == 200) {
  495. this.$message.success('删除成功')
  496. } else {
  497. this.$message.error(res.message || '删除失败')
  498. }
  499. this.doSearch()
  500. })
  501. })
  502. },
  503. diaClose(done) {
  504. this.autoplay = false
  505. this.videoSrc = ''
  506. done()
  507. },
  508. openFileDia() {
  509. this.objectPath = Math.random().toString()
  510. this.$refs.fileDialog.fileVisible = true
  511. },
  512. fileClose() {
  513. this.objectPath = ''
  514. this.doSearch()
  515. },
  516. },
  517. async mounted() {
  518. await this.$dicsListsInit({
  519. selfDrivingList: 'selfDriving',
  520. targetDrivingList: 'targetDriving',
  521. selfReactionList: 'selfReaction',
  522. conflictBehaviorList: 'conflictBehavior',
  523. conflictTypeList: 'conflictType',
  524. })
  525. },
  526. }
  527. </script>
  528. <style lang='less' scoped>
  529. @import './common/util.less';
  530. .trafficAccidentSimulationScenarioListPanel {
  531. .inputBox {
  532. .radioBox {
  533. width: 340px;
  534. }
  535. .label {
  536. min-width: 90px;
  537. }
  538. }
  539. .btnsPanel {
  540. text-align: right;
  541. }
  542. }
  543. </style>