trafficAccidentSimulationScene.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  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. clearable
  22. size="small"
  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. clearable
  38. size="small"
  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. clearable
  54. size="small"
  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. clearable
  70. size="small"
  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. clearable
  86. size="small"
  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="searchItem6">
  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="searchItem8">
  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="btnsPanel">
  212. <el-button type="primary" plain icon="el-icon-delete" @click="delRows"
  213. >批量删除</el-button
  214. >
  215. </div>
  216. <tableList
  217. ref="table"
  218. style="margin: 0 30px"
  219. :columns="columns"
  220. :getDataWay="getDataWay"
  221. :pagination="pagination"
  222. :checkedData="checkedArr"
  223. selection
  224. index
  225. >
  226. <!-- <tableList
  227. ref="table"
  228. style="margin: 30px"
  229. :columns="columns"
  230. :getDataWay="getDataWay"
  231. :pagination="pagination"
  232. index
  233. > -->
  234. <el-table-column label="操作" slot="cgInfos" align="center" width="180">
  235. <template v-slot="scope">
  236. <i
  237. @click="viewRow(scope.row)"
  238. class="el-icon-view elIcon cursor"
  239. title="查看"
  240. >
  241. </i>
  242. <i
  243. @click="delRow(scope.row)"
  244. class="el-icon-delete elIcon"
  245. title="删除"
  246. >
  247. </i>
  248. </template>
  249. </el-table-column>
  250. </tableList>
  251. <el-dialog
  252. :title="videoDiaTitle"
  253. :visible.sync="dialogVisible"
  254. width="690px"
  255. :close-on-click-modal="false"
  256. :close-on-press-escape="false"
  257. :before-close="diaClose"
  258. >
  259. <div class="videoBox">
  260. <video autoplay :src="videoSrc" controls></video>
  261. </div>
  262. </el-dialog>
  263. </div>
  264. </template>
  265. <script>
  266. import searchLayout from '@/components/grid/searchLayout'
  267. import tableList from '@/components/grid/TableList'
  268. import { mapState } from 'vuex'
  269. export default {
  270. name: 'trafficAccidentSimulationScenarioList', // 交通事故场景
  271. components: { searchLayout, tableList },
  272. data() {
  273. return {
  274. searchParams: {
  275. //搜索参数
  276. sceneName: '', //场景名称
  277. selfDriving: [], //自车驾驶行为
  278. targetDriving: [], //目标驾驶行为
  279. selfReaction: [], //自车反应行为
  280. conflictBehavior: [], //冲突行为
  281. conflictType: [], //冲突类型
  282. rearEndCollision: '', // 追尾
  283. cutIn: '', // 切入
  284. driveCurve: '', // 沿弯道行驶
  285. carConflict: '', // 机动车-机动车冲突
  286. share: '0',
  287. minComplexity: '',
  288. maxComplexity: '',
  289. minRisk: '',
  290. maxRisk: '',
  291. complexityLevel: '',
  292. riskLevel: '',
  293. },
  294. labels: [],
  295. // selfDrivingList: [],
  296. // targetDrivingList: [],
  297. // selfReactionList: [],
  298. // conflictBehaviorList: [],
  299. // conflictTypeList: [],
  300. columns: [
  301. //表格列
  302. {
  303. label: '场景名称',
  304. prop: 'sceneName',
  305. },
  306. {
  307. label: '自车驾驶行为',
  308. prop: 'selfDriving',
  309. },
  310. {
  311. label: '目标驾驶行为',
  312. prop: 'targetDriving',
  313. },
  314. {
  315. label: '自车反应行为',
  316. prop: 'selfReaction',
  317. },
  318. {
  319. label: '冲突行为',
  320. prop: 'conflictBehavior',
  321. },
  322. {
  323. label: '冲突类型',
  324. prop: 'conflictType',
  325. },
  326. {
  327. label: '标签',
  328. prop: 'label',
  329. },
  330. {
  331. label: '复杂度',
  332. prop: 'complexity',
  333. },
  334. {
  335. label: '复杂度等级',
  336. prop: 'complexityLevel',
  337. },
  338. {
  339. label: '危险度',
  340. prop: 'risk',
  341. },
  342. {
  343. label: '危险度等级',
  344. prop: 'riskLevel',
  345. },
  346. {
  347. label: '操作',
  348. prop: 'cgInfos',
  349. template: true,
  350. },
  351. ],
  352. pagination: {
  353. //分页使用
  354. currentPage: 1,
  355. pageSize: 10,
  356. position: 'right',
  357. pageSizes: [10, 30, 50, 100, 200],
  358. layout: 'sizes, total, prev, pager, next, jumper',
  359. },
  360. getDataWay: {
  361. //加载表格数据
  362. dataType: 'url',
  363. type: 'post',
  364. // firstRequest: false,
  365. data: this.$api.sceneLibrary.querySceneAccidentList,
  366. param: {
  367. share: '0',
  368. },
  369. },
  370. dialogVisible: false,
  371. autoplay: false,
  372. videoSrc: '',
  373. objectPath: '',
  374. videoDiaTitle: '',
  375. checkedArr: [],
  376. }
  377. },
  378. props: {
  379. selfDrivingList: {
  380. type: Array,
  381. default: [],
  382. },
  383. targetDrivingList: {
  384. type: Array,
  385. default: [],
  386. },
  387. selfReactionList: {
  388. type: Array,
  389. default: [],
  390. },
  391. conflictBehaviorList: {
  392. type: Array,
  393. default: [],
  394. },
  395. conflictTypeList: {
  396. type: Array,
  397. default: [],
  398. },
  399. },
  400. computed: {
  401. ...mapState(['fileHost', 'fileUrl']),
  402. },
  403. methods: {
  404. doSearch() {
  405. /* this.searchParams.rearEndCollision = this.labels.includes("追尾")
  406. ? "追尾"
  407. : "";
  408. this.searchParams.cutIn = this.labels.includes("切入")
  409. ? "切入"
  410. : "";
  411. this.searchParams.driveCurve = this.labels.includes("沿弯道行驶")
  412. ? "沿弯道行驶"
  413. : "";
  414. this.searchParams.carConflict = this.labels.includes(
  415. "机动车-机动车冲突"
  416. )
  417. ? "机动车-机动车"
  418. : ""; */
  419. this.refreshList(this.searchParams)
  420. },
  421. //刷新table
  422. refreshList(param) {
  423. param
  424. ? this.$refs['table'].loadData(param)
  425. : this.$refs['table'].loadData()
  426. },
  427. doReset() {
  428. this.searchParams = {
  429. sceneName: '',
  430. selfDriving: [],
  431. targetDriving: [],
  432. selfReaction: [],
  433. conflictBehavior: [],
  434. conflictType: [],
  435. rearEndCollision: '',
  436. cutIn: '',
  437. driveCurve: '',
  438. carConflict: '',
  439. share: '0',
  440. minComplexity: '',
  441. maxComplexity: '',
  442. minRisk: '',
  443. maxRisk: '',
  444. complexityLevel: '',
  445. riskLevel: '',
  446. }
  447. // this.labels = [];
  448. this.doSearch()
  449. },
  450. conditions(v) {
  451. switch (v) {
  452. case 1:
  453. if (!this.searchParams.conflictBehavior.includes('追尾')) {
  454. this.searchParams.conflictBehavior = [
  455. ...this.searchParams.conflictBehavior,
  456. '追尾',
  457. ]
  458. }
  459. break
  460. case 2:
  461. if (!this.searchParams.targetDriving.includes('切入')) {
  462. this.searchParams.targetDriving = [
  463. ...this.searchParams.targetDriving,
  464. '切入',
  465. ]
  466. }
  467. break
  468. case 3:
  469. if (!this.searchParams.targetDriving.includes('沿弯道行驶')) {
  470. this.searchParams.targetDriving = [
  471. ...this.searchParams.targetDriving,
  472. '沿弯道行驶',
  473. ]
  474. }
  475. break
  476. case 4:
  477. if (!this.searchParams.conflictType.includes('机动车-机动车')) {
  478. this.searchParams.conflictType = [
  479. ...this.searchParams.conflictType,
  480. '机动车-机动车',
  481. ]
  482. }
  483. break
  484. default:
  485. break
  486. }
  487. },
  488. viewRow(row) {
  489. if (!row.videoAddress) {
  490. this.$message.warning('本场景无仿真视频')
  491. return
  492. }
  493. this.dialogVisible = true
  494. this.videoDiaTitle = row.sceneName
  495. let url = ''
  496. if (process.env.VUE_APP_IS_DEV == 'true') {
  497. url = this.fileHost + this.fileUrl
  498. } else {
  499. url = this.fileUrl
  500. }
  501. let token = localStorage.getItem('Authorization').split(' ')[1]
  502. this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`
  503. this.autoplay = true
  504. },
  505. delRow(row) {
  506. this.$confirm('确认是否删除?', '提示', {
  507. confirmButtonText: '确定',
  508. cancelButtonText: '取消',
  509. type: 'warning',
  510. }).then(() => {
  511. this.$axios({
  512. method: 'post',
  513. url: this.$api.sceneLibrary.deleteSceneAccident,
  514. data: {
  515. accidentId: row.accidentId,
  516. sceneName: row.sceneName,
  517. },
  518. }).then((res) => {
  519. if (res.code == 200) {
  520. this.$message.success('删除成功')
  521. } else {
  522. this.$message.error(res.message || '删除失败')
  523. }
  524. this.doSearch()
  525. })
  526. })
  527. },
  528. delRows() {
  529. let checkedArr = this.checkedArr
  530. if (checkedArr.length <= 0) {
  531. this.$message.info('请先选择数据')
  532. return
  533. }
  534. let arr = checkedArr.map((i) => i.sceneName)
  535. this.$confirm('确认是否批量删除?', '提示', {
  536. confirmButtonText: '确定',
  537. cancelButtonText: '取消',
  538. type: 'warning',
  539. }).then(() => {
  540. this.$axios({
  541. method: 'post',
  542. url: this.$api.sceneLibrary.batchDeleteSceneAccident,
  543. data: {
  544. sceneNameList: arr,
  545. },
  546. }).then((res) => {
  547. if (res.code == 200) {
  548. this.$message.success('删除成功')
  549. } else {
  550. this.$message.error(res.message || '删除失败')
  551. }
  552. this.doSearch()
  553. })
  554. })
  555. },
  556. diaClose(done) {
  557. this.autoplay = false
  558. this.videoSrc = ''
  559. done()
  560. },
  561. openFileDia() {
  562. this.objectPath = Math.random().toString()
  563. this.$refs.fileDialog.fileVisible = true
  564. },
  565. fileClose() {
  566. this.objectPath = ''
  567. this.doSearch()
  568. },
  569. },
  570. }
  571. </script>
  572. <style lang='less' scoped>
  573. @import './common/util.less';
  574. .trafficAccidentSimulationScenarioListPanel {
  575. .inputBox {
  576. .radioBox {
  577. width: 340px;
  578. }
  579. .label {
  580. min-width: 90px;
  581. }
  582. }
  583. .btnsPanel {
  584. text-align: right;
  585. }
  586. }
  587. </style>