123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <div class="sensorModelPanel">
- <model-list
- ref="modelList"
- class="modelList"
- :getListApi="getListApi"
- :showName="showName"
- @showInfo="showInfo"
- @addOne="addOne"
- @delOne="delOne"
- ></model-list>
- <div class="contentPanel">
- <toolbarTab
- :isConnect="true"
- position="top"
- :subPageActiveName="subPageActiveName"
- :toolbarItem="subPageList"
- @toolbarClick="toolsControl"
- >
- </toolbarTab>
- <div class="tabContent">
- <form-camera
- v-show="subPageActiveName === 1"
- ref="form1"
- @getList="getList"
- @changeShare="changeShare"
- @clearForm="addOne"
- ></form-camera>
- <form-perfect-sensor
- v-show="subPageActiveName === 2"
- ref="form2"
- @getList="getList"
- @changeShare="changeShare"
- @clearForm="addOne"
- ></form-perfect-sensor>
- <form-laser-radar
- v-show="subPageActiveName === 3"
- ref="form3"
- @getList="getList"
- @changeShare="changeShare"
- @clearForm="addOne"
- ></form-laser-radar>
- <!-- <form-millimeter-wave-radar
- v-show="subPageActiveName === 4"
- ></form-millimeter-wave-radar> -->
- <form-gps
- v-show="subPageActiveName === 4"
- ref="form4"
- @getList="getList"
- @changeShare="changeShare"
- @clearForm="addOne"
- ></form-gps>
- <div class="model">
- <img :src="imgSrc" width="100%" />
- </div>
- </div>
- <div class="btns">
- <el-button
- type="primary"
- v-show="currentShare === '0' || currentShare === ''"
- @click="save(false)"
- >保存</el-button
- >
- <el-button
- type="primary"
- v-show="currentShare === '0'"
- @click="share"
- >分享</el-button
- >
- <el-button
- type="primary"
- v-show="currentShare === '0' || currentShare === '1'"
- @click="save(true)"
- >另存为</el-button
- >
- <el-button type="primary" plain @click="cancel">取消</el-button>
- </div>
- </div>
- </div>
- </template>
- <script>
- import modelList from "./components/modelList.vue";
- import toolbarTab from "@/components/toolbar/toolbarTab";
- import { mapState } from "vuex";
- import formCamera from "./components/formCamera.vue";
- import formPerfectSensor from "./components/formPerfectSensor.vue";
- import formLaserRadar from "./components/formLaserRadar.vue";
- import formMillimeterWaveRadar from "./components/formMillimeterWaveRadar.vue";
- import formGps from "./components/formGps.vue";
- export default {
- name: "sensorModel", // 传感器模型
- components: {
- modelList,
- toolbarTab,
- formCamera,
- formPerfectSensor,
- formLaserRadar,
- formMillimeterWaveRadar,
- formGps,
- },
- data() {
- return {
- getListApi: this.$api.modelLibrary.getCameraList,
- showName: "sensorName",
- subPageActiveName: 1,
- fromId: 1,
- imgSrc: require("@/assets/common/image/others/carTopView.png"),
- currentShare: "",
- };
- },
- computed: {
- ...mapState(["configTitleList"]),
- subPageList() {
- return [
- {
- type: "primary",
- plain: true,
- title: this.configTitleList[0],
- disabled: false,
- api: this.$api.modelLibrary.getCameraList,
- fromId: 1,
- },
- {
- type: "primary",
- plain: true,
- title: this.configTitleList[1],
- disabled: false,
- api: this.$api.modelLibrary.getOgtList,
- fromId: 2,
- },
- {
- type: "primary",
- plain: true,
- title: this.configTitleList[2],
- disabled: false,
- api: this.$api.modelLibrary.getLidarList,
- fromId: 3,
- },
- {
- type: "primary",
- plain: true,
- title: this.configTitleList[3],
- disabled: false,
- api: this.$api.modelLibrary.getGpsList,
- fromId: 4,
- },
- // {
- // type: "primary",
- // plain: true,
- // title: this.configTitleList[4],
- // disabled: false,
- // fromId: 5,
- // },
- ];
- },
- },
- methods: {
- toolsControl(item) {
- this.addOne();
- this.getListApi = item.api;
- this.subPageActiveName = item.fromId;
- this.$nextTick(() => {
- this.getList();
- });
- },
- showInfo(id) {
- this.$refs[`form${this.subPageActiveName}`].showInfo(id);
- },
- getList() {
- this.$refs.modelList.getList();
- },
- save(isAdd) {
- this.$refs[`form${this.subPageActiveName}`].save(isAdd);
- },
- share() {
- this.$refs[`form${this.subPageActiveName}`].share();
- },
- cancel() {
- this.$refs[`form${this.subPageActiveName}`].cancel();
- },
- changeShare(share) {
- // 根据form传回的share进行按钮展示
- this.currentShare = share;
- },
- addOne() {
- this.$refs[
- `form${this.subPageActiveName}`
- ].$refs.form.resetFields();
- this.$refs[`form${this.subPageActiveName}`].form.sensorCode = "";
- this.$refs[`form${this.subPageActiveName}`].form.share = "";
- this.$refs[`form${this.subPageActiveName}`].form.id = "";
- this.currentShare = "";
- },
- delOne(id) {
- const delApis = [
- this.$api.modelLibrary.delCameraById,
- this.$api.modelLibrary.delOgtById,
- this.$api.modelLibrary.delLidarById,
- this.$api.modelLibrary.delGpsById,
- ];
- this.$axios({
- method: "post",
- url: delApis[this.subPageActiveName - 1],
- data: {
- id,
- },
- }).then((res) => {
- if (res.code == 200) {
- this.$message.success("删除成功");
- this.$refs.modelList.getList();
- if (
- this.$refs[`form${this.subPageActiveName}`].form.id &&
- id ===
- this.$refs[`form${this.subPageActiveName}`].form.id
- ) {
- this.addOne();
- }
- } else {
- this.$message.error(res.message || "删除失败");
- }
- });
- },
- },
- // mounted() {},
- };
- </script>
- <style lang='less' scoped>
- .sensorModelPanel {
- display: flex;
- flex: 1;
- padding: 15px 30px 30px;
- .modelList /deep/ .listPanel {
- min-height: 400px;
- height: calc(100vh - 200px);
- }
- .contentPanel {
- flex: 1;
- padding-left: 30px;
- }
- .tabContent {
- display: flex;
- padding-top: 15px;
- .model {
- flex: 1;
- min-width: 300px;
- // padding-left: 40px;
- padding-left: 6%;
- padding-right: 3%;
- }
- }
- .btns {
- padding-top: 30px;
- padding-left: 390px;
- }
- /deep/ .el-tabs__item {
- width: 150px;
- }
- }
- </style>
|