trafficAccidentSimulationScene.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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. <template slot="searchItem27">
  97. <!-- <el-checkbox-group v-model="labels">
  98. <el-checkbox-button label="追尾" :key="1" class="labelA"
  99. >追尾</el-checkbox-button
  100. >
  101. <el-checkbox-button label="切入" :key="2" class="labelB"
  102. >目标车切入</el-checkbox-button
  103. >
  104. <el-checkbox-button
  105. label="沿弯道行驶"
  106. :key="3"
  107. class="labelC"
  108. >目标车沿弯道行驶</el-checkbox-button
  109. >
  110. <el-checkbox-button
  111. label="机动车-机动车冲突"
  112. :key="4"
  113. class="labelD"
  114. >机动车-机动车冲突</el-checkbox-button
  115. >
  116. </el-checkbox-group> -->
  117. <div class="labelsBox">
  118. <b class="labelA" @click="conditions(1)">追尾</b>
  119. <b class="labelB" @click="conditions(2)">目标车切入</b>
  120. <b class="labelC" @click="conditions(3)"
  121. >目标车沿弯道行驶</b
  122. >
  123. <b class="labelD" @click="conditions(4)"
  124. >机动车-机动车冲突</b
  125. >
  126. </div>
  127. </template>
  128. <template slot="searchBtn1">
  129. <el-button type="primary" @click="doSearch">查询</el-button>
  130. </template>
  131. <template slot="searchBtn2">
  132. <el-button type="primary" @click="doReset">重置</el-button>
  133. </template>
  134. </search-layout>
  135. <div class="btnsPanel">
  136. <el-button
  137. type="primary"
  138. plain
  139. icon="el-icon-delete"
  140. @click="delRows"
  141. >批量删除</el-button
  142. >
  143. </div>
  144. <tableList
  145. ref="table"
  146. style="margin: 0 30px"
  147. :columns="columns"
  148. :getDataWay="getDataWay"
  149. :pagination="pagination"
  150. :checkedData="checkedArr"
  151. selection
  152. index
  153. >
  154. <!-- <tableList
  155. ref="table"
  156. style="margin: 30px"
  157. :columns="columns"
  158. :getDataWay="getDataWay"
  159. :pagination="pagination"
  160. index
  161. > -->
  162. <el-table-column
  163. label="操作"
  164. slot="cgInfos"
  165. align="center"
  166. width="180"
  167. >
  168. <template v-slot="scope">
  169. <i
  170. @click="viewRow(scope.row)"
  171. class="el-icon-view elIcon cursor"
  172. title="查看"
  173. >
  174. </i>
  175. <i
  176. @click="delRow(scope.row)"
  177. class="el-icon-delete elIcon"
  178. title="删除"
  179. >
  180. </i>
  181. </template>
  182. </el-table-column>
  183. </tableList>
  184. <el-dialog
  185. :title="videoDiaTitle"
  186. :visible.sync="dialogVisible"
  187. width="690px"
  188. :close-on-click-modal="false"
  189. :close-on-press-escape="false"
  190. :before-close="diaClose"
  191. >
  192. <div class="videoBox">
  193. <video autoplay :src="videoSrc" controls></video>
  194. </div>
  195. </el-dialog>
  196. </div>
  197. </template>
  198. <script>
  199. import searchLayout from "@/components/grid/searchLayout";
  200. import tableList from "@/components/grid/TableList";
  201. import { mapState } from "vuex";
  202. export default {
  203. name: "trafficAccidentSimulationScenarioList", // 交通事故场景
  204. components: { searchLayout, tableList },
  205. data() {
  206. return {
  207. searchParams: {
  208. //搜索参数
  209. sceneName: "", //场景名称
  210. selfDriving: [], //自车驾驶行为
  211. targetDriving: [], //目标驾驶行为
  212. selfReaction: [], //自车反应行为
  213. conflictBehavior: [], //冲突行为
  214. conflictType: [], //冲突类型
  215. rearEndCollision: "", // 追尾
  216. cutIn: "", // 切入
  217. driveCurve: "", // 沿弯道行驶
  218. carConflict: "", // 机动车-机动车冲突
  219. share: "0",
  220. },
  221. labels: [],
  222. // selfDrivingList: [],
  223. // targetDrivingList: [],
  224. // selfReactionList: [],
  225. // conflictBehaviorList: [],
  226. // conflictTypeList: [],
  227. columns: [
  228. //表格列
  229. {
  230. label: "场景名称",
  231. prop: "sceneName",
  232. },
  233. {
  234. label: "自车驾驶行为",
  235. prop: "selfDriving",
  236. },
  237. {
  238. label: "目标驾驶行为",
  239. prop: "targetDriving",
  240. },
  241. {
  242. label: "自车反应行为",
  243. prop: "selfReaction",
  244. },
  245. {
  246. label: "冲突行为",
  247. prop: "conflictBehavior",
  248. },
  249. {
  250. label: "冲突类型",
  251. prop: "conflictType",
  252. },
  253. {
  254. label: "标签",
  255. prop: "label",
  256. },
  257. {
  258. label: "操作",
  259. prop: "cgInfos",
  260. template: true,
  261. },
  262. ],
  263. pagination: {
  264. //分页使用
  265. currentPage: 1,
  266. pageSize: 10,
  267. position: "right",
  268. pageSizes: [10, 30, 50, 100, 200],
  269. layout: "sizes, total, prev, pager, next, jumper",
  270. },
  271. getDataWay: {
  272. //加载表格数据
  273. dataType: "url",
  274. type: "post",
  275. // firstRequest: false,
  276. data: this.$api.sceneLibrary.querySceneAccidentList,
  277. param: {
  278. share: "0",
  279. },
  280. },
  281. dialogVisible: false,
  282. autoplay: false,
  283. videoSrc: "",
  284. objectPath: "",
  285. videoDiaTitle: "",
  286. checkedArr: [],
  287. };
  288. },
  289. props: {
  290. selfDrivingList: {
  291. type: Array,
  292. default: [],
  293. },
  294. targetDrivingList: {
  295. type: Array,
  296. default: [],
  297. },
  298. selfReactionList: {
  299. type: Array,
  300. default: [],
  301. },
  302. conflictBehaviorList: {
  303. type: Array,
  304. default: [],
  305. },
  306. conflictTypeList: {
  307. type: Array,
  308. default: [],
  309. },
  310. },
  311. computed: {
  312. ...mapState(["fileHost", "fileUrl"]),
  313. },
  314. methods: {
  315. doSearch() {
  316. /* this.searchParams.rearEndCollision = this.labels.includes("追尾")
  317. ? "追尾"
  318. : "";
  319. this.searchParams.cutIn = this.labels.includes("切入")
  320. ? "切入"
  321. : "";
  322. this.searchParams.driveCurve = this.labels.includes("沿弯道行驶")
  323. ? "沿弯道行驶"
  324. : "";
  325. this.searchParams.carConflict = this.labels.includes(
  326. "机动车-机动车冲突"
  327. )
  328. ? "机动车-机动车"
  329. : ""; */
  330. this.refreshList(this.searchParams);
  331. },
  332. //刷新table
  333. refreshList(param) {
  334. param
  335. ? this.$refs["table"].loadData(param)
  336. : this.$refs["table"].loadData();
  337. },
  338. doReset() {
  339. this.searchParams = {
  340. sceneName: "",
  341. selfDriving: [],
  342. targetDriving: [],
  343. selfReaction: [],
  344. conflictBehavior: [],
  345. conflictType: [],
  346. rearEndCollision: "",
  347. cutIn: "",
  348. driveCurve: "",
  349. carConflict: "",
  350. share: "0",
  351. };
  352. // this.labels = [];
  353. this.doSearch();
  354. },
  355. conditions(v) {
  356. switch (v) {
  357. case 1:
  358. if (!this.searchParams.conflictBehavior.includes("追尾")) {
  359. this.searchParams.conflictBehavior = [
  360. ...this.searchParams.conflictBehavior,
  361. "追尾",
  362. ];
  363. }
  364. break;
  365. case 2:
  366. if (!this.searchParams.targetDriving.includes("切入")) {
  367. this.searchParams.targetDriving = [
  368. ...this.searchParams.targetDriving,
  369. "切入",
  370. ];
  371. }
  372. break;
  373. case 3:
  374. if (
  375. !this.searchParams.targetDriving.includes("沿弯道行驶")
  376. ) {
  377. this.searchParams.targetDriving = [
  378. ...this.searchParams.targetDriving,
  379. "沿弯道行驶",
  380. ];
  381. }
  382. break;
  383. case 4:
  384. if (
  385. !this.searchParams.conflictType.includes(
  386. "机动车-机动车"
  387. )
  388. ) {
  389. this.searchParams.conflictType = [
  390. ...this.searchParams.conflictType,
  391. "机动车-机动车",
  392. ];
  393. }
  394. break;
  395. default:
  396. break;
  397. }
  398. },
  399. viewRow(row) {
  400. if (!row.videoAddress) {
  401. this.$message.warning("本场景无仿真视频");
  402. return;
  403. }
  404. this.dialogVisible = true;
  405. this.videoDiaTitle = row.sceneName;
  406. let url = "";
  407. if (process.env.VUE_APP_IS_DEV == "true") {
  408. url = this.fileHost + this.fileUrl;
  409. } else {
  410. url = this.fileUrl;
  411. }
  412. let token = localStorage.getItem("Authorization").split(" ")[1];
  413. this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`;
  414. this.autoplay = true;
  415. },
  416. delRow(row) {
  417. this.$confirm("确认是否删除?", "提示", {
  418. confirmButtonText: "确定",
  419. cancelButtonText: "取消",
  420. type: "warning",
  421. }).then(() => {
  422. this.$axios({
  423. method: "post",
  424. url: this.$api.sceneLibrary.deleteSceneAccident,
  425. data: {
  426. accidentId: row.accidentId,
  427. sceneName: row.sceneName,
  428. },
  429. }).then((res) => {
  430. if (res.code == 200) {
  431. this.$message.success("删除成功");
  432. } else {
  433. this.$message.error(res.message || "删除失败");
  434. }
  435. this.doSearch();
  436. });
  437. });
  438. },
  439. delRows() {
  440. let checkedArr = this.checkedArr;
  441. if (checkedArr.length <= 0) {
  442. this.$message.info("请先选择数据");
  443. return;
  444. }
  445. let arr = checkedArr.map((i) => i.sceneName);
  446. this.$confirm("确认是否批量删除?", "提示", {
  447. confirmButtonText: "确定",
  448. cancelButtonText: "取消",
  449. type: "warning",
  450. }).then(() => {
  451. this.$axios({
  452. method: "post",
  453. url: this.$api.sceneLibrary.batchDeleteSceneAccident,
  454. data: {
  455. sceneNameList: arr,
  456. },
  457. }).then((res) => {
  458. if (res.code == 200) {
  459. this.$message.success("删除成功");
  460. } else {
  461. this.$message.error(res.message || "删除失败");
  462. }
  463. this.doSearch();
  464. });
  465. });
  466. },
  467. diaClose(done) {
  468. this.autoplay = false;
  469. this.videoSrc = "";
  470. done();
  471. },
  472. openFileDia() {
  473. this.objectPath = Math.random().toString();
  474. this.$refs.fileDialog.fileVisible = true;
  475. },
  476. fileClose() {
  477. this.objectPath = "";
  478. this.doSearch();
  479. },
  480. },
  481. };
  482. </script>
  483. <style lang='less' scoped>
  484. @import "./common/util.less";
  485. .trafficAccidentSimulationScenarioListPanel {
  486. .inputBox {
  487. .radioBox {
  488. width: 340px;
  489. }
  490. .label {
  491. min-width: 90px;
  492. }
  493. }
  494. .btnsPanel {
  495. text-align: right;
  496. }
  497. }
  498. </style>