generalizationScene.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <div class="generalizationScenarioListPanel">
  3. <search-layout :needBox="true">
  4. <template slot="searchItem1">
  5. <span class="label">场景编号</span>
  6. <el-input v-model="searchParams.sceneId" size="small" clearable placeholder="请输入" maxlength="60"
  7. @keyup.enter.native="doSearch">
  8. </el-input>
  9. </template>
  10. <template slot="searchItem2">
  11. <span class="label">功能模块</span>
  12. <el-select v-model="searchParams.fileName" multiple clearable size="small">
  13. <el-option v-for="item in fileNameList" :label="item.caption" :value="item.code"
  14. :key="item.code"></el-option>
  15. </el-select>
  16. </template>
  17. <template slot="searchItem3">
  18. <span class="label">道路类型</span>
  19. <el-select v-model="searchParams.scenarioRoadType" multiple size="small" clearable>
  20. <el-option v-for="item in scenarioRoadTypeList" :label="item.caption" :value="item.code"
  21. :key="item.code"></el-option>
  22. </el-select>
  23. </template>
  24. <template slot="searchItem4">
  25. <span class="label">场景简述</span>
  26. <el-input v-model="searchParams.scenarioResume" size="small" clearable placeholder="请输入" maxlength="300"
  27. @keyup.enter.native="doSearch">
  28. </el-input>
  29. </template>
  30. <template slot="searchBtn1">
  31. <el-button type="primary" @click="doSearch">查询</el-button>
  32. </template>
  33. <template slot="searchBtn2">
  34. <el-button type="primary" @click="doReset">重置</el-button>
  35. </template>
  36. </search-layout>
  37. <div class="btnsPanel">
  38. <el-button type="primary" plain icon="el-icon-delete" @click="delRows">批量删除</el-button>
  39. </div>
  40. <tableList ref="table" style="margin: 0 30px" :columns="columns" :getDataWay="getDataWay" :pagination="pagination"
  41. :checkedData="checkedArr" selection index>
  42. <el-table-column label="操作" slot="cgInfos" align="center" width="180">
  43. <template v-slot="scope">
  44. <i @click="viewRow(scope.row)" class="el-icon-view elIcon cursor" title="查看模板">
  45. </i>
  46. <i @click="delRow(scope.row)" class="el-icon-delete elIcon" title="删除">
  47. </i>
  48. </template>
  49. </el-table-column>
  50. </tableList>
  51. <el-dialog v-if="generalizationVisible" :visible.sync="generalizationVisible" title="泛化模板" width="90%"
  52. class="generalizationDia" :close-on-click-modal="false" :close-on-press-escape="false"
  53. :before-close="generalizationCancel">
  54. <div>
  55. <generalization-detail ref="generalizationDetail" :disabled="true" :id="generalizationId"
  56. :genUrlType="1"></generalization-detail>
  57. </div>
  58. </el-dialog>
  59. </div>
  60. </template>
  61. <script>
  62. import searchLayout from "@/components/grid/searchLayout";
  63. import tableList from "@/components/grid/TableList";
  64. import generalizationDetail from "@/views/sceneLibrary/components/generalizationDetail";
  65. import { mapState } from "vuex";
  66. export default {
  67. name: "generalizationScenarioList", // 泛化场景模板
  68. components: { searchLayout, tableList, generalizationDetail },
  69. data() {
  70. return {
  71. searchParams: {
  72. //搜索参数
  73. sceneId: "", // 场景编号
  74. fileName: [], // 功能模块
  75. scenarioRoadType: [], // 道路类型
  76. scenarioResume: "", // 场景简述
  77. share: "0",
  78. },
  79. labels: [],
  80. fileNameList: [],
  81. // scenarioWeatherList: [],
  82. props: {
  83. multiple: true,
  84. label: "dictName",
  85. value: "dictCode",
  86. },
  87. columns: [
  88. //表格列
  89. {
  90. label: "场景编号",
  91. prop: "sceneId",
  92. },
  93. {
  94. label: "场景名称",
  95. prop: "scenarioName",
  96. },
  97. {
  98. label: "功能模块",
  99. prop: "fileName",
  100. },
  101. {
  102. label: "道路类型",
  103. prop: "scenarioRoadType",
  104. },
  105. {
  106. label: "场景简述",
  107. prop: "scenarioResume",
  108. },
  109. {
  110. label: '复杂度',
  111. prop: 'complexity',
  112. },
  113. {
  114. label: '复杂度等级',
  115. prop: 'complexityLevel',
  116. },
  117. {
  118. label: '危险度',
  119. prop: 'risk',
  120. },
  121. {
  122. label: '危险度等级',
  123. prop: 'riskLevel',
  124. },
  125. {
  126. label: "操作",
  127. prop: "cgInfos",
  128. template: true,
  129. },
  130. ],
  131. pagination: {
  132. //分页使用
  133. currentPage: 1,
  134. pageSize: 10,
  135. position: "right",
  136. pageSizes: [10, 30, 50, 100, 200],
  137. layout: "sizes, total, prev, pager, next, jumper",
  138. },
  139. getDataWay: {
  140. //加载表格数据
  141. dataType: "url",
  142. type: "post",
  143. // firstRequest: false,
  144. data: this.$api.sceneLibrary.querySceneGeneralTemplateList,
  145. param: {
  146. share: "0",
  147. },
  148. },
  149. dialogVisible: false,
  150. autoplay: false,
  151. videoSrc: "",
  152. videoDiaTitle: "",
  153. generalizationVisible: false, // 泛化dialog
  154. generalizationId: "", // 泛化详情id
  155. checkedArr: [],
  156. };
  157. },
  158. props: {
  159. // scenarioWeatherList: {
  160. // type: Array,
  161. // default: [],
  162. // },
  163. scenarioRoadTypeList: {
  164. type: Array,
  165. default: [],
  166. },
  167. },
  168. computed: {
  169. ...mapState(["fileHost", "fileUrl"]),
  170. },
  171. methods: {
  172. doSearch() {
  173. this.refreshList(this.searchParams);
  174. },
  175. //刷新table
  176. refreshList(param) {
  177. param
  178. ? this.$refs["table"].loadData(param)
  179. : this.$refs["table"].loadData();
  180. },
  181. doReset() {
  182. this.searchParams = {
  183. sceneId: "",
  184. fileName: [],
  185. scenarioRoadType: [],
  186. scenarioResume: "",
  187. share: "0",
  188. };
  189. this.labels = [];
  190. this.doSearch();
  191. },
  192. viewRow(row) {
  193. this.generalizationId = row.id;
  194. this.generalizationVisible = true;
  195. },
  196. // viewRow(row) {
  197. // this.dialogVisible = true;
  198. // this.videoDiaTitle = row.naturalName;
  199. // let url = "";
  200. // if (process.env.VUE_APP_IS_DEV == "true") {
  201. // url = this.fileHost + this.fileUrl;
  202. // } else {
  203. // url = this.fileUrl;
  204. // }
  205. // let token = localStorage.getItem("Authorization").split(" ")[1];
  206. // this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`;
  207. // this.autoplay = true;
  208. // },
  209. delRow(row) {
  210. this.$confirm("确认是否删除?", "提示", {
  211. confirmButtonText: "确定",
  212. cancelButtonText: "取消",
  213. type: "warning",
  214. }).then(() => {
  215. this.$axios({
  216. method: "post",
  217. url: this.$api.sceneLibrary.deleteSceneGeneralTemplateById,
  218. data: {
  219. id: row.id,
  220. sceneId: row.sceneId,
  221. },
  222. }).then((res) => {
  223. if (res.code == 200) {
  224. this.$message.success("删除成功");
  225. } else {
  226. this.$message.error(res.message || "删除失败");
  227. }
  228. this.doSearch();
  229. });
  230. });
  231. },
  232. delRows() {
  233. let checkedArr = this.checkedArr;
  234. if (checkedArr.length <= 0) {
  235. this.$message.info("请先选择数据");
  236. return;
  237. }
  238. let arr = checkedArr.map((i) => i.sceneId);
  239. this.$confirm("确认是否批量删除?", "提示", {
  240. confirmButtonText: "确定",
  241. cancelButtonText: "取消",
  242. type: "warning",
  243. }).then(() => {
  244. this.$axios({
  245. method: "post",
  246. url: this.$api.sceneLibrary.deleteSceneGeneralTemplateByIds,
  247. data: {
  248. fhNameList: arr,
  249. },
  250. }).then((res) => {
  251. if (res.code == 200) {
  252. this.$message.success("删除成功");
  253. } else {
  254. this.$message.error(res.message || "删除失败");
  255. }
  256. this.doSearch();
  257. });
  258. });
  259. },
  260. diaClose(done) {
  261. this.autoplay = false;
  262. this.videoSrc = "";
  263. done();
  264. },
  265. didUpload() {
  266. this.doSearch();
  267. },
  268. getFileNameList() {
  269. this.$axios({
  270. method: "post",
  271. url: this.$api.sceneLibrary.queryType,
  272. data: {},
  273. }).then((res) => {
  274. if (res.code == 200 && res.info) {
  275. let arr = [];
  276. res.info.forEach((item, i) => {
  277. arr[i] = {
  278. code: item,
  279. caption: item,
  280. };
  281. });
  282. this.fileNameList = arr;
  283. } else {
  284. this.$message.error(res.message || "获取功能模块列表失败");
  285. }
  286. });
  287. },
  288. // 泛化-取消
  289. generalizationCancel() {
  290. this.generalizationVisible = false;
  291. },
  292. },
  293. mounted() {
  294. this.getFileNameList();
  295. },
  296. };
  297. </script>
  298. <style lang='less' scoped>
  299. @import "./common/util.less";
  300. .generalizationScenarioListPanel {
  301. .inputBox {
  302. .label {
  303. min-width: 90px;
  304. }
  305. }
  306. .btnsPanel {
  307. text-align: right;
  308. }
  309. .generalizationDia {
  310. /deep/ .el-dialog__body {
  311. position: relative;
  312. padding: 20px 60px;
  313. .changeBtn {
  314. position: absolute;
  315. top: 20px;
  316. right: 60px;
  317. }
  318. }
  319. }
  320. }
  321. </style>