standardRegulationSimulationScenarioList.vue 11 KB

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