generalizationList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="generalizationListPanel">
  3. <search-layout>
  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 v-model="searchParams.fileName" multiple>
  19. <el-option
  20. v-for="item in fileNameList"
  21. :label="item.caption"
  22. :value="item.code"
  23. :key="item.code"
  24. >
  25. </el-option>
  26. </el-select>
  27. </template>
  28. <template slot="searchItem3">
  29. <span class="label">道路类型</span>
  30. <el-select
  31. v-model="searchParams.scenarioRoadType"
  32. multiple
  33. size="small"
  34. clearable
  35. >
  36. <el-option
  37. v-for="item in scenarioRoadTypeList"
  38. :label="item.caption"
  39. :value="item.code"
  40. :key="item.code"
  41. ></el-option>
  42. </el-select>
  43. </template>
  44. <template slot="searchBtn1">
  45. <el-button type="primary" @click="doSearch">查询</el-button>
  46. </template>
  47. <template slot="searchBtn2">
  48. <el-button type="primary" @click="doReset">重置</el-button>
  49. </template>
  50. </search-layout>
  51. <div class="myTabsBox myTabsBoxInline">
  52. <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
  53. <el-tab-pane label="公有" name="1"></el-tab-pane>
  54. <el-tab-pane label="私有" name="2"></el-tab-pane>
  55. </el-tabs>
  56. </div>
  57. <tableList
  58. ref="table"
  59. style="margin: 0"
  60. :columns="columns"
  61. :getDataWay="getDataWay"
  62. :pagination="pagination"
  63. :checkedData="checkedArr"
  64. :singleSelect="true"
  65. index
  66. selection
  67. >
  68. </tableList>
  69. <el-dialog
  70. :title="videoDiaTitle"
  71. :visible.sync="dialogVisible"
  72. width="690px"
  73. :close-on-click-modal="false"
  74. :close-on-press-escape="false"
  75. :before-close="diaClose"
  76. >
  77. <div class="videoBox">
  78. <video autoplay :src="videoSrc" controls></video>
  79. </div>
  80. </el-dialog>
  81. </div>
  82. </template>
  83. <script>
  84. import searchLayout from "@/components/grid/searchLayout";
  85. import tableList from "@/components/grid/TableList";
  86. import { mapState } from "vuex";
  87. export default {
  88. name: "generalizationList", // 泛化场景
  89. components: { searchLayout, tableList },
  90. data() {
  91. return {
  92. activeName: "2",
  93. searchParams: {
  94. //搜索参数
  95. sceneId: "", // 场景编号
  96. fileName: [], // 功能模块
  97. scenarioRoadType: [], // 道路类型
  98. share: "0",
  99. },
  100. fileNameList: [],
  101. scenarioRoadTypeList: [],
  102. // scenarioWeatherList: [],
  103. props: {
  104. multiple: true,
  105. label: "dictName",
  106. value: "dictCode",
  107. },
  108. columns: [
  109. //表格列
  110. {
  111. label: "场景编号",
  112. prop: "sceneId",
  113. },
  114. {
  115. label: "场景名称",
  116. prop: "scenarioName",
  117. },
  118. {
  119. label: "功能模块",
  120. prop: "fileName",
  121. },
  122. {
  123. label: "道路类型",
  124. prop: "scenarioRoadType",
  125. },
  126. ],
  127. pagination: {
  128. //分页使用
  129. currentPage: 1,
  130. pageSize: 10,
  131. position: "right",
  132. pageSizes: [10, 30, 50, 100, 200],
  133. layout: "sizes, total, prev, pager, next, jumper",
  134. },
  135. getDataWay: {
  136. //加载表格数据
  137. dataType: "url",
  138. type: "post",
  139. // firstRequest: false,
  140. data: this.$api.sceneLibrary.querySceneGeneralTemplateList,
  141. param: {
  142. share: "0",
  143. },
  144. },
  145. checkedArr: [],
  146. dialogVisible: false,
  147. autoplay: false,
  148. videoSrc: "",
  149. videoDiaTitle: "",
  150. };
  151. },
  152. computed: {
  153. ...mapState(["fileHost", "fileUrl"]),
  154. },
  155. methods: {
  156. doSearch() {
  157. this.searchParams.share = this.activeName === "1" ? "1" : "0";
  158. this.refreshList(this.searchParams);
  159. },
  160. //刷新table
  161. refreshList(param) {
  162. param
  163. ? this.$refs["table"].loadData(param)
  164. : this.$refs["table"].loadData();
  165. },
  166. doReset() {
  167. this.searchParams = {
  168. sceneId: "",
  169. fileName: [],
  170. scenarioRoadType: [],
  171. share: this.activeName === "1" ? "1" : "0",
  172. };
  173. this.doSearch();
  174. },
  175. pageControl(data) {
  176. this.activeName = data.name;
  177. this.doSearch();
  178. },
  179. viewRow(row) {
  180. this.dialogVisible = true;
  181. this.videoDiaTitle = row.naturalName;
  182. let url = "";
  183. if (process.env.VUE_APP_IS_DEV == "true") {
  184. url = this.fileHost + this.fileUrl;
  185. } else {
  186. url = this.fileUrl;
  187. }
  188. let token = localStorage.getItem("Authorization").split(" ")[1];
  189. this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`;
  190. this.autoplay = true;
  191. },
  192. delRow(row) {
  193. this.$confirm("确认是否删除?", "提示", {
  194. confirmButtonText: "确定",
  195. cancelButtonText: "取消",
  196. type: "warning",
  197. }).then(() => {
  198. this.$axios({
  199. method: "post",
  200. url: this.$api.sceneLibrary.deleteSceneNatural,
  201. data: {
  202. naturalId: row.naturalId,
  203. },
  204. }).then((res) => {
  205. if (res.code == 200) {
  206. this.$message.success("删除成功");
  207. } else {
  208. this.$message.error(res.message || "删除失败");
  209. }
  210. this.doSearch();
  211. });
  212. });
  213. },
  214. diaClose(done) {
  215. this.autoplay = false;
  216. this.videoSrc = "";
  217. done();
  218. },
  219. didUpload() {
  220. this.doSearch();
  221. },
  222. getFileNameList() {
  223. this.$axios({
  224. method: "post",
  225. url: this.$api.sceneLibrary.queryType,
  226. data: {},
  227. }).then((res) => {
  228. if (res.code == 200 && res.info) {
  229. let arr = [];
  230. res.info.forEach((item, i) => {
  231. arr[i] = {
  232. code: item,
  233. caption: item,
  234. };
  235. });
  236. this.fileNameList = arr;
  237. } else {
  238. this.$message.error(res.message || "获取功能模块列表失败");
  239. }
  240. });
  241. },
  242. },
  243. async mounted() {
  244. await this.$dicsListsInit({
  245. // scenarioWeatherList: "scenarioWeather",
  246. scenarioRoadTypeList: "scenarioRoadType",
  247. });
  248. this.getFileNameList();
  249. },
  250. };
  251. </script>
  252. <style lang='less' scoped>
  253. @import "../common/util.less";
  254. .generalizationListPanel {
  255. .inputBox {
  256. .label {
  257. min-width: 90px;
  258. }
  259. .el-input,
  260. .el-select {
  261. width: 230px;
  262. }
  263. }
  264. .myTabsBoxInline {
  265. .el-tabs {
  266. margin-top: 10px;
  267. }
  268. }
  269. }
  270. </style>