sensorModelThree.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <div class="sensorModelPanel">
  3. <model-list
  4. ref="modelList"
  5. class="modelList"
  6. :getListApi="getListApi"
  7. :showName="showName"
  8. @showInfo="showInfo"
  9. @addOne="addOne"
  10. @delOne="delOne"
  11. :curOne="curOne"
  12. ></model-list>
  13. <div class="contentPanel">
  14. <toolbarTab
  15. :isConnect="true"
  16. position="top"
  17. :subPageActiveName="subPageActiveName"
  18. :toolbarItem="subPageList"
  19. @toolbarClick="toolsControl"
  20. >
  21. </toolbarTab>
  22. <div class="tabContent">
  23. <form-camera
  24. v-show="subPageActiveName === 1"
  25. ref="form1"
  26. @getList="getList"
  27. @changeShare="changeShare"
  28. @showDone="showDone"
  29. @clearForm="addOne"
  30. @inputChange="inputChange"
  31. ></form-camera>
  32. <form-perfect-sensor
  33. v-show="subPageActiveName === 2"
  34. ref="form2"
  35. @getList="getList"
  36. @changeShare="changeShare"
  37. @showDone="showDone"
  38. @clearForm="addOne"
  39. @inputChange="inputChangeA"
  40. ></form-perfect-sensor>
  41. <form-laser-radar
  42. v-show="subPageActiveName === 3"
  43. ref="form3"
  44. @getList="getList"
  45. @changeShare="changeShare"
  46. @showDone="showDone"
  47. @clearForm="addOne"
  48. @inputChange="inputChange"
  49. ></form-laser-radar>
  50. <!-- <form-millimeter-wave-radar
  51. v-show="subPageActiveName === 4"
  52. ></form-millimeter-wave-radar> -->
  53. <form-gps
  54. v-show="subPageActiveName === 4"
  55. ref="form4"
  56. @getList="getList"
  57. @changeShare="changeShare"
  58. @clearForm="addOne"
  59. ></form-gps>
  60. <div class="model">
  61. <!-- <img :src="imgSrc" width="100%" /> -->
  62. <!-- <canvas-sensor
  63. v-show="subPageActiveName != 2"
  64. ref="canvasSensor"
  65. :coordinate="coordinate"
  66. ></canvas-sensor>
  67. <canvas-sensorA
  68. v-show="subPageActiveName === 2"
  69. ref="canvasSensorA"
  70. :coordinate="coordinateA"
  71. ></canvas-sensorA> -->
  72. <three-show
  73. ref="threeShow"
  74. :coordinate="coordinate"
  75. :coordinateA="coordinateA"
  76. :type="subPageActiveName"
  77. ></three-show>
  78. </div>
  79. </div>
  80. <div class="btns">
  81. <el-button
  82. type="primary"
  83. v-show="currentShare === '0' || currentShare === ''"
  84. @click="save(false)"
  85. >保存</el-button
  86. >
  87. <el-button
  88. type="primary"
  89. v-if="roleCode === '0' || roleCode === '1'"
  90. v-show="currentShare === '0'"
  91. @click="share"
  92. >分享</el-button
  93. >
  94. <el-button
  95. type="primary"
  96. v-show="currentShare === '0' || currentShare === '1'"
  97. @click="save(true)"
  98. >另存为</el-button
  99. >
  100. <el-button type="primary" plain @click="cancel">取消</el-button>
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import modelList from "./components/modelList.vue";
  107. import toolbarTab from "@/components/toolbar/toolbarTab";
  108. import { mapState } from "vuex";
  109. import formCamera from "./components/formCamera.vue";
  110. import formPerfectSensor from "./components/formPerfectSensor.vue";
  111. import formLaserRadar from "./components/formLaserRadar.vue";
  112. import formMillimeterWaveRadar from "./components/formMillimeterWaveRadar.vue";
  113. import formGps from "./components/formGps.vue";
  114. import canvasSensor from "./components/canvasSensorModel.vue";
  115. import canvasSensorA from "./components/canvasSensorModelA.vue";
  116. import threeShow from "./components/threeSensorModel.vue";
  117. export default {
  118. name: "sensorModel", // 传感器配置
  119. components: {
  120. modelList,
  121. toolbarTab,
  122. formCamera,
  123. formPerfectSensor,
  124. formLaserRadar,
  125. formMillimeterWaveRadar,
  126. formGps,
  127. canvasSensor,
  128. canvasSensorA,
  129. threeShow,
  130. },
  131. data() {
  132. return {
  133. getListApi: this.$api.modelLibrary.getCameraList,
  134. showName: "sensorName",
  135. subPageActiveName: 1,
  136. fromId: 1,
  137. imgSrc: require("@/assets/common/image/others/carTopView.png"),
  138. currentShare: "",
  139. coordinate: { f: 0, n: 0, h: 0, v: 0 }, // 存放传递给three的值
  140. coordinateA: { f: 0, n: 0, hl: 0, hr: 0, vt: 0, vb: 0 }, // 存放传递给three的值
  141. // coordinate: { r: 0, h: 0, n: 0 }, // 存放传递给canvas的值
  142. // coordinateA: { r: 0, n: 0, hl: 0, hr: 0 }, // 存放传递给完美传感器canvas的值
  143. // 用于当前选中项的展示
  144. curOne: {
  145. share: "",
  146. id: "",
  147. },
  148. };
  149. },
  150. computed: {
  151. ...mapState(["configTitleList", "roleCode"]),
  152. subPageList() {
  153. return [
  154. {
  155. type: "primary",
  156. plain: true,
  157. title: this.configTitleList[0],
  158. disabled: false,
  159. api: this.$api.modelLibrary.getCameraList,
  160. fromId: 1,
  161. },
  162. {
  163. type: "primary",
  164. plain: true,
  165. title: this.configTitleList[1],
  166. disabled: false,
  167. api: this.$api.modelLibrary.getOgtList,
  168. fromId: 2,
  169. },
  170. {
  171. type: "primary",
  172. plain: true,
  173. title: this.configTitleList[2],
  174. disabled: false,
  175. api: this.$api.modelLibrary.getLidarList,
  176. fromId: 3,
  177. },
  178. {
  179. type: "primary",
  180. plain: true,
  181. title: this.configTitleList[3],
  182. disabled: false,
  183. api: this.$api.modelLibrary.getGpsList,
  184. fromId: 4,
  185. },
  186. // {
  187. // type: "primary",
  188. // plain: true,
  189. // title: this.configTitleList[4],
  190. // disabled: false,
  191. // fromId: 5,
  192. // },
  193. ];
  194. },
  195. },
  196. methods: {
  197. toolsControl(item) {
  198. this.addOne();
  199. this.getListApi = item.api;
  200. this.subPageActiveName = item.fromId;
  201. this.$nextTick(() => {
  202. this.getList();
  203. });
  204. // this.$refs.canvasSensor.clear();
  205. // this.$refs.canvasSensorA.clear();
  206. this.coordinate = { f: 0, n: 0, h: 0, v: 0 };
  207. this.coordinateA = { f: 0, n: 0, hl: 0, hr: 0, vt: 0, vb: 0 };
  208. setTimeout(() => {
  209. this.$refs.threeShow.initContent();
  210. }, 0);
  211. this.curOne = {
  212. share: "",
  213. id: "",
  214. };
  215. },
  216. showInfo(id) {
  217. this.$refs[`form${this.subPageActiveName}`].showInfo(id);
  218. },
  219. getList() {
  220. this.$refs.modelList.getList();
  221. },
  222. save(isAdd) {
  223. this.$refs[`form${this.subPageActiveName}`].save(isAdd);
  224. },
  225. share() {
  226. this.$refs[`form${this.subPageActiveName}`].share();
  227. },
  228. cancel() {
  229. this.$refs[`form${this.subPageActiveName}`].cancel();
  230. // this.$refs.canvasSensor.clear();
  231. // this.$refs.canvasSensorA.clear();
  232. this.coordinate = { f: 0, n: 0, h: 0, v: 0 };
  233. this.coordinateA = { f: 0, n: 0, hl: 0, hr: 0, vt: 0, vb: 0 };
  234. setTimeout(() => {
  235. this.$refs.threeShow.initContent();
  236. }, 0);
  237. },
  238. changeShare(form) {
  239. // 根据form传回的share进行按钮展示
  240. this.currentShare = form.share;
  241. // 确定当前展示哪条数据
  242. this.curOne = {
  243. share: form.share,
  244. id: form.id,
  245. };
  246. },
  247. showDone() {
  248. this.$refs[`form${this.subPageActiveName}`].inputChange();
  249. },
  250. addOne() {
  251. this.$refs[
  252. `form${this.subPageActiveName}`
  253. ].$refs.form.resetFields();
  254. this.$refs[`form${this.subPageActiveName}`].form.sensorCode = "";
  255. this.$refs[`form${this.subPageActiveName}`].form.share = "";
  256. this.$refs[`form${this.subPageActiveName}`].form.id = "";
  257. this.currentShare = "";
  258. // this.$refs.canvasSensor.clear();
  259. // this.$refs.canvasSensorA.clear();
  260. this.coordinate = { f: 0, n: 0, h: 0, v: 0 };
  261. this.coordinateA = { f: 0, n: 0, hl: 0, hr: 0, vt: 0, vb: 0 };
  262. setTimeout(() => {
  263. this.$refs.threeShow.initContent();
  264. }, 0);
  265. this.curOne = {
  266. share: "",
  267. id: "",
  268. };
  269. },
  270. delOne(id) {
  271. const delApis = [
  272. this.$api.modelLibrary.delCameraById,
  273. this.$api.modelLibrary.delOgtById,
  274. this.$api.modelLibrary.delLidarById,
  275. this.$api.modelLibrary.delGpsById,
  276. ];
  277. this.$axios({
  278. method: "post",
  279. url: delApis[this.subPageActiveName - 1],
  280. data: {
  281. id,
  282. },
  283. }).then((res) => {
  284. if (res.code == 200) {
  285. this.$message.success("删除成功");
  286. this.$refs.modelList.getList();
  287. if (
  288. this.$refs[`form${this.subPageActiveName}`].form.id &&
  289. id ===
  290. this.$refs[`form${this.subPageActiveName}`].form.id
  291. ) {
  292. this.addOne();
  293. }
  294. if (id === this.curOne.id) {
  295. this.curOne = {
  296. share: "",
  297. id: "",
  298. };
  299. }
  300. } else {
  301. this.$message.error(res.message || "删除失败");
  302. }
  303. });
  304. },
  305. inputChange(data) {
  306. this.coordinate = data;
  307. setTimeout(() => {
  308. this.$refs.threeShow.initContent();
  309. }, 0);
  310. },
  311. inputChangeA(data) {
  312. this.coordinateA = data;
  313. setTimeout(() => {
  314. this.$refs.threeShow.initContent();
  315. }, 0);
  316. },
  317. },
  318. // mounted() {},
  319. };
  320. </script>
  321. <style lang='less' scoped>
  322. .sensorModelPanel {
  323. display: flex;
  324. flex: 1;
  325. padding: 15px 30px 30px;
  326. .modelList /deep/ .listPanel {
  327. min-height: 400px;
  328. height: calc(100vh - 200px);
  329. }
  330. .contentPanel {
  331. flex: 1;
  332. padding-left: 30px;
  333. }
  334. .tabContent {
  335. display: flex;
  336. padding-top: 15px;
  337. .model {
  338. flex: 1;
  339. min-width: 300px;
  340. // padding-left: 40px;
  341. padding-left: 6%;
  342. // padding-right: 3%;
  343. }
  344. }
  345. .btns {
  346. padding-top: 30px;
  347. padding-left: 390px;
  348. }
  349. /deep/ .el-tabs__item {
  350. width: 150px;
  351. }
  352. }
  353. </style>