standardRegulationSimulationScenarioList.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div>
  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. maxlength="60"
  10. clearable
  11. placeholder="请输入"
  12. >
  13. </el-input>
  14. </template>
  15. <template slot="searchItem2">
  16. <span class="label">法规类型</span>
  17. <el-select v-model="searchParams.regulationType" multiple>
  18. <el-option
  19. v-for="item in regulationTypeList"
  20. :label="item.caption"
  21. :value="item.code"
  22. :key="item.code"
  23. ></el-option>
  24. </el-select>
  25. </template>
  26. <template slot="searchItem3">
  27. <span class="label">标准类型</span>
  28. <el-input
  29. v-model="searchParams.standardType"
  30. size="small"
  31. maxlength="60"
  32. clearable
  33. placeholder="请输入"
  34. >
  35. </el-input>
  36. </template>
  37. <template slot="searchItem27">
  38. <el-checkbox-group v-model="searchParams.c">
  39. <el-checkbox-button :label="1" :key="1" class="labelA"
  40. >绿灯</el-checkbox-button
  41. >
  42. <el-checkbox-button :label="2" :key="2" class="labelB"
  43. >桥梁</el-checkbox-button
  44. >
  45. <el-checkbox-button :label="3" :key="3" class="labelC"
  46. >晴天</el-checkbox-button
  47. >
  48. <el-checkbox-button :label="4" :key="4" class="labelD"
  49. >直道</el-checkbox-button
  50. >
  51. <el-checkbox-button :label="5" :key="5" class="labelC"
  52. >晴天</el-checkbox-button
  53. >
  54. <el-checkbox-button :label="6" :key="6" class="labelD"
  55. >直道</el-checkbox-button
  56. >
  57. </el-checkbox-group>
  58. </template>
  59. <template slot="searchBtn1">
  60. <el-button type="primary" @click="doSearch">查询</el-button>
  61. </template>
  62. <template slot="searchBtn2">
  63. <el-button type="primary" @click="doReset">重置</el-button>
  64. </template>
  65. </search-layout>
  66. <div class="btnsPanel">
  67. <el-button
  68. type="primary"
  69. plain
  70. icon="el-icon-upload"
  71. @click="openFileDia"
  72. >上传文件</el-button
  73. >
  74. </div>
  75. <file-dialog
  76. ref="fileDialog"
  77. type="2"
  78. :objectPath="objectPath"
  79. :api="$api.sceneLibrary.saveStandardsRegulations"
  80. @fileClose="fileClose"
  81. ></file-dialog>
  82. <tableList
  83. ref="table"
  84. style="margin: 30px"
  85. :columns="columns"
  86. :getDataWay="getDataWay"
  87. :pagination="pagination"
  88. index
  89. >
  90. <el-table-column label="标签" slot="asd" align="center">
  91. <template>
  92. <div class="labelPanel">
  93. <span class="labelBox labelA">绿灯</span>
  94. <span class="labelBox labelB">桥梁</span>
  95. <span class="labelBox labelC">晴天</span>
  96. <span class="labelBox labelD">直道</span>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. label="操作"
  102. slot="cgInfos"
  103. align="center"
  104. width="180"
  105. >
  106. <template v-slot="scope">
  107. <i
  108. @click="viewRow(scope.row)"
  109. class="el-icon-view elIcon cursor"
  110. title="查看"
  111. >
  112. </i>
  113. <i
  114. @click="delRow(scope.row)"
  115. class="el-icon-delete elIcon"
  116. title="删除"
  117. >
  118. </i>
  119. </template>
  120. </el-table-column>
  121. </tableList>
  122. <el-dialog
  123. :title="videoDiaTitle"
  124. :visible.sync="dialogVisible"
  125. width="690px"
  126. :close-on-click-modal="false"
  127. :close-on-press-escape="false"
  128. :before-close="diaClose"
  129. >
  130. <div class="videoBox">
  131. <video :autoplay="autoplay" :src="videoSrc"></video>
  132. </div>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import searchLayout from "@/components/grid/searchLayout";
  138. import tableList from "@/components/grid/TableList";
  139. import fileDialog from "./components/fileDialog";
  140. import { mapState } from "vuex";
  141. export default {
  142. name: "standardRegulationSimulationScenarioList", // 标准法规仿真场景
  143. components: { searchLayout, tableList, fileDialog },
  144. data() {
  145. return {
  146. searchParams: {
  147. //搜索参数
  148. sceneName: "", //场景名称
  149. regulationType: [], //法规类型
  150. standardType: "", //标准类型
  151. c: "", // 标签
  152. },
  153. regulationTypeList: [],
  154. columns: [
  155. //表格列
  156. {
  157. label: "场景名称",
  158. prop: "sceneName",
  159. },
  160. {
  161. label: "法规类型",
  162. prop: "regulationType",
  163. },
  164. {
  165. label: "标准类型",
  166. prop: "standardType",
  167. },
  168. {
  169. label: "标签",
  170. prop: "asd",
  171. template: true,
  172. },
  173. {
  174. label: "操作",
  175. prop: "cgInfos",
  176. template: true,
  177. // videoAddress
  178. },
  179. ],
  180. pagination: {
  181. //分页使用
  182. currentPage: 1,
  183. pageSize: 10,
  184. position: "right",
  185. pageSizes: [10, 30, 50, 100, 200],
  186. layout: "sizes, total, prev, pager, next, jumper",
  187. },
  188. getDataWay: {
  189. //加载表格数据
  190. dataType: "url",
  191. type: "post",
  192. // firstRequest: false,
  193. data: this.$api.sceneLibrary.queryStandardsRegulationsList,
  194. param: {},
  195. },
  196. dialogVisible: false,
  197. autoplay: false,
  198. videoSrc: "",
  199. objectPath: "",
  200. videoDiaTitle: "",
  201. };
  202. },
  203. computed: {
  204. ...mapState(["fileHost", "fileUrl"]),
  205. },
  206. methods: {
  207. doSearch() {
  208. this.refreshList(this.searchParams);
  209. },
  210. //刷新table
  211. refreshList(param) {
  212. param
  213. ? this.$refs["table"].loadData(param)
  214. : this.$refs["table"].loadData();
  215. },
  216. doReset() {
  217. this.searchParams = {
  218. sceneName: "",
  219. regulationType: [],
  220. standardType: "",
  221. };
  222. this.doSearch();
  223. },
  224. viewRow(row) {
  225. this.dialogVisible = true;
  226. this.videoDiaTitle = row.sceneName;
  227. let url = "";
  228. if (process.env.VUE_APP_IS_DEV == "true") {
  229. url = this.fileHost + this.fileUrl;
  230. } else {
  231. url = this.fileUrl;
  232. }
  233. let token = localStorage.getItem("Authorization").split(" ")[1];
  234. this.videoSrc = `${url}?objectName=${row.videoAddress}&access_token=${token}`;
  235. this.autoplay = true;
  236. },
  237. delRow(row) {
  238. this.$confirm("确认是否删除?", "提示", {
  239. confirmButtonText: "确定",
  240. cancelButtonText: "取消",
  241. type: "warning",
  242. }).then(() => {
  243. this.$axios({
  244. method: "post",
  245. url: this.$api.sceneLibrary.deleteStandardsRegulations,
  246. data: {
  247. regulationsId: row.regulationsId,
  248. },
  249. }).then((res) => {
  250. if (res.code == 200) {
  251. this.$message.success("删除成功");
  252. } else {
  253. this.$message.error(res.message || "删除失败");
  254. }
  255. this.doSearch();
  256. });
  257. });
  258. },
  259. diaClose(done) {
  260. this.autoplay = false;
  261. this.videoSrc = "";
  262. done();
  263. },
  264. openFileDia() {
  265. this.objectPath = Math.random().toString();
  266. this.$refs.fileDialog.fileVisible = true;
  267. },
  268. fileClose() {
  269. this.objectPath = "";
  270. this.doSearch();
  271. },
  272. },
  273. async mounted() {
  274. await this.$dicsListsInit({
  275. regulationTypeList: "regulationType",
  276. });
  277. },
  278. };
  279. </script>
  280. <style lang='less' scoped>
  281. @import "./common/util.less";
  282. .btnsPanel {
  283. text-align: right;
  284. }
  285. </style>