generalizationScenarioList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="generalizationScenarioListPanel">
  3. <search-layout :needBox="true">
  4. <template slot="searchItem1">
  5. <span class="label">场景类型编号</span>
  6. <el-input
  7. v-model="searchParams.sceneId"
  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.fileName"
  20. multiple
  21. size="small"
  22. clearable
  23. >
  24. <el-option
  25. v-for="item in fileNameList"
  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.scenarioRoadType"
  36. multiple
  37. size="small"
  38. clearable
  39. >
  40. <el-option
  41. v-for="item in scenarioRoadTypeList"
  42. :label="item.caption"
  43. :value="item.code"
  44. :key="item.code"
  45. ></el-option>
  46. </el-select>
  47. </template>
  48. <!-- <template slot="searchItem3">
  49. <span class="label">天气</span>
  50. <el-select
  51. v-model="searchParams.scenarioWeather"
  52. multiple
  53. size="small"
  54. clearable
  55. >
  56. <el-option
  57. v-for="item in scenarioWeatherList"
  58. :label="item.caption"
  59. :value="item.code"
  60. :key="item.code"
  61. ></el-option>
  62. </el-select>
  63. </template> -->
  64. <!-- <template slot="searchItem4">
  65. <span class="label">场景发生时刻</span>
  66. <el-time-picker
  67. v-model="searchParams.scenarioTime"
  68. value-format="HH:mm:ss"
  69. placeholder="请选择"
  70. >
  71. </el-time-picker>
  72. </template> -->
  73. <template slot="searchBtn1">
  74. <el-button type="primary" @click="doSearch">查询</el-button>
  75. </template>
  76. <template slot="searchBtn2">
  77. <el-button type="primary" @click="doReset">重置</el-button>
  78. </template>
  79. </search-layout>
  80. <div class="myTabsBox">
  81. <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
  82. <el-tab-pane label="公有" name="1"></el-tab-pane>
  83. <el-tab-pane label="私有" name="2"></el-tab-pane>
  84. </el-tabs>
  85. </div>
  86. <tableList
  87. ref="table"
  88. style="margin: 0 30px 30px"
  89. :columns="columns"
  90. :getDataWay="getDataWay"
  91. :pagination="pagination"
  92. index
  93. >
  94. <el-table-column
  95. label="操作"
  96. slot="cgInfos"
  97. align="center"
  98. width="180"
  99. >
  100. <template v-slot="scope">
  101. <span @click="viewRow(scope.row)" class="elIcon">
  102. 查看模板
  103. </span>
  104. </template>
  105. </el-table-column>
  106. </tableList>
  107. <el-dialog
  108. v-if="generalizationVisible"
  109. :visible.sync="generalizationVisible"
  110. :title="generalizationDiaTitle"
  111. width="90%"
  112. class="generalizationDia"
  113. :close-on-click-modal="false"
  114. :close-on-press-escape="false"
  115. :before-close="generalizationCancel"
  116. >
  117. <div>
  118. <generalization-detail
  119. ref="generalizationDetail"
  120. :disabled="true"
  121. :id="generalizationId"
  122. :genUrlType="1"
  123. ></generalization-detail>
  124. </div>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import searchLayout from "@/components/grid/searchLayout";
  130. import tableList from "@/components/grid/TableList";
  131. import generalizationDetail from "./components/generalizationDetail";
  132. import { mapState } from "vuex";
  133. export default {
  134. name: "generalizationScenarioList", // 泛化场景模板
  135. components: { searchLayout, tableList, generalizationDetail },
  136. data() {
  137. return {
  138. activeName: "2",
  139. searchParams: {
  140. //搜索参数
  141. sceneId: "", // 场景类型编号
  142. fileName: [], // 功能模块
  143. scenarioRoadType: [], // 道路类型
  144. share: "0",
  145. // scenarioWeather: [], // 天气
  146. // scenarioTime: "", // 场景发生时刻
  147. },
  148. fileNameList: [],
  149. scenarioRoadTypeList: [],
  150. // scenarioWeatherList: [],
  151. props: {
  152. multiple: true,
  153. label: "dictName",
  154. value: "dictCode",
  155. },
  156. columns: [
  157. //表格列
  158. {
  159. label: "编号",
  160. prop: "sceneId",
  161. },
  162. {
  163. label: "场景名称",
  164. prop: "scenarioName",
  165. },
  166. {
  167. label: "功能模块",
  168. prop: "fileName",
  169. },
  170. {
  171. label: "道路类型",
  172. prop: "scenarioRoadType",
  173. },
  174. {
  175. label: "场景简述",
  176. prop: "scenarioResume",
  177. },
  178. // {
  179. // label: "场景发生时刻",
  180. // prop: "scenarioTime",
  181. // },
  182. // {
  183. // label: "天气",
  184. // prop: "scenarioWeather",
  185. // },
  186. {
  187. label: "操作",
  188. prop: "cgInfos",
  189. template: true,
  190. },
  191. ],
  192. pagination: {
  193. //分页使用
  194. currentPage: 1,
  195. pageSize: 10,
  196. position: "right",
  197. pageSizes: [10, 30, 50, 100, 200],
  198. layout: "sizes, total, prev, pager, next, jumper",
  199. },
  200. getDataWay: {
  201. //加载表格数据
  202. dataType: "url",
  203. type: "post",
  204. // firstRequest: false,
  205. data: this.$api.sceneLibrary.querySceneGeneralTemplateList,
  206. param: {
  207. share: "0",
  208. },
  209. },
  210. generalizationVisible: false, // 泛化dialog
  211. generalizationId: "", // 泛化详情id
  212. generalizationDiaTitle: "",
  213. };
  214. },
  215. computed: {
  216. ...mapState(["fileHost", "fileUrl"]),
  217. },
  218. methods: {
  219. doSearch() {
  220. this.searchParams.share = this.activeName === "1" ? "1" : "0";
  221. this.refreshList(this.searchParams);
  222. },
  223. //刷新table
  224. refreshList(param) {
  225. param
  226. ? this.$refs["table"].loadData(param)
  227. : this.$refs["table"].loadData();
  228. },
  229. doReset() {
  230. this.searchParams = {
  231. sceneId: "",
  232. fileName: [],
  233. scenarioRoadType: [],
  234. share: this.activeName === "1" ? "1" : "0",
  235. // scenarioWeather: [],
  236. // scenarioTime: "",
  237. };
  238. this.doSearch();
  239. },
  240. pageControl(data) {
  241. this.activeName = data.name;
  242. this.doSearch();
  243. },
  244. viewRow(row) {
  245. this.generalizationId = row.id;
  246. this.generalizationDiaTitle = "泛化场景 " + row.sceneId;
  247. this.generalizationVisible = true;
  248. },
  249. getFileNameList() {
  250. this.$axios({
  251. method: "post",
  252. url: this.$api.sceneLibrary.queryType,
  253. data: {},
  254. }).then((res) => {
  255. if (res.code == 200 && res.info) {
  256. let arr = [];
  257. res.info.forEach((item, i) => {
  258. arr[i] = {
  259. code: item,
  260. caption: item,
  261. };
  262. });
  263. this.fileNameList = arr;
  264. } else {
  265. this.$message.error(res.message || "获取功能模块列表失败");
  266. }
  267. });
  268. },
  269. // 泛化-取消
  270. generalizationCancel() {
  271. this.generalizationVisible = false;
  272. },
  273. },
  274. async mounted() {
  275. await this.$dicsListsInit({
  276. // scenarioWeatherList: "scenarioWeather",
  277. scenarioRoadTypeList: "scenarioRoadType",
  278. });
  279. this.getFileNameList();
  280. },
  281. };
  282. </script>
  283. <style lang='less' scoped>
  284. @import "./common/util.less";
  285. .generalizationScenarioListPanel {
  286. .inputBox {
  287. .label {
  288. min-width: 90px;
  289. }
  290. }
  291. .btnsPanel {
  292. text-align: right;
  293. }
  294. .generalizationDia {
  295. /deep/ .el-dialog__body {
  296. position: relative;
  297. padding: 20px 60px;
  298. .changeBtn {
  299. position: absolute;
  300. top: 20px;
  301. right: 60px;
  302. }
  303. }
  304. }
  305. }
  306. </style>