generalizationList.vue 9.0 KB

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