解决冲突

This commit is contained in:
Hcat
2023-12-26 23:47:50 +08:00
6 changed files with 125 additions and 34 deletions

View File

@@ -1,8 +1,15 @@
<template>
<div id="main">
<div class="box-top">
<div class="back-tunnel" @click="router.back(-1)">
<div class="back-icon"></div>
<span>返回</span>
</div>
<div class="tunnel-title"></div>
<div class="top-right">
<div class="btn-right">
<div class="del-btn" @click="handleGotoDevice">
设备管理
</div>
<div class="del-btn" @click="handleSave">
保存
</div>
@@ -26,34 +33,60 @@
</div>
<!-- 这里就导入正常的编辑模式就是我们之前写的部分 -->
<tunnel-scene id="tunnel-box" :isedit="true" :tunnelId="tunnelId" :tunnelLength="tunnelLength" />
<tunnel-scene id="tunnel-box" :isedit="true" :tunnelId="tunnelId" ref="tunnelScene" :tunnelLength="tunnelLength" />
</div>
</template>
<script setup>
import TunnelScene from "@/components/content/tunnelScene/TunnelScene.vue";
import { getTunnelDetail } from "../../api/tunnelManage";
import { reactive, computed } from "vue";
import { editTunnel, getTunnelDetail } from "@/api/tunnelManage";
import { computed } from "vue";
import { useModelSceneStore } from "@/store/modelSceneStore";
const router = useRouter();
const tunnelId = reactive(router.currentRoute.value.params.tunnelId)
const store = useModelSceneStore();
const form = ref({
tunnelName: '',
serialNumber: '',
totalLength: '',
remarks: ''
});
const equipmentList = ref([])
onMounted(async () => {
equipmentList.value = await store.getEquipmentList();
})
const getTunnel = () => {
getTunnelDetail(tunnelId).then((res) => {
if (res?.code === 1000) {
console.log('res', res)
form.value = res.data
console.log('for', form.value)
}
});
}
getTunnel()
const tunnelLength = computed(() => form.value.totalLength);
const tunnelLength = computed(() => form.value.totalLength);
const handleGotoDevice = () => {
router.push('/device/' + tunnelId)
}
const handleSave = () => {
const data = {
tunnelId: tunnelId,
tunnelName: form.value.tunnelName,
serialNumber: form.value.serialNumber,
remarks: form.value.remarks,
// constructionLength:form.value.constructionLength,
constructionLength: 500,
tunnelLength: form.value.totalLength,
tunnelThreeConfig: JSON.stringify(equipmentList.value),
}
console.log('data', data, form.value.tunnelLength)
editTunnel(data).then((res) => {
if (res?.code === 1000) {
console.log('re---s', res)
// form.value=res.data
}
});
}
</script>
<style lang="scss" scoped>
#main {
@@ -62,18 +95,63 @@ const tunnelLength = computed(() => form.value.totalLength);
width: 100%;
background-color: #072348;
.del-btn {
position: absolute;
top: 85px;
right: 80px;
cursor: pointer;
font-size: 42px;
width: 180px;
height: 80px;
line-height: 80px;
background: #08B7B8;
border-radius: 11px;
padding-left: 50px;
.box-top {
display: flex;
align-items: center;
justify-content: space-between;
.back-tunnel {
z-index: 2;
position: absolute;
top: 100px;
//left: 80px;
cursor: pointer;
margin: 0 0 0 80px;
display: flex;
align-items: center;
width: 180px;
height: 80px;
line-height: 70px;
border-radius: 11px;
border: 2px solid #08B7B8;
font-size: 42px;
color: #FFFFFF;
.back-icon {
margin-right: 20px;
margin-left: 23px;
width: 35px;
height: 35px;
background-image: url('@/assets/images/site/zdgl_icon_fh.png');
}
}
.btn-right {
display: flex;
z-index: 2;
position: absolute;
top: 100px;
right: 80px;
.del-btn {
&:first-child {
width: 220px;
margin-right: 40px;
}
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
width: 180px;
height: 80px;
border-radius: 11px;
border: 2px solid #08B7B8;
color: #FFFFFF;
font-size: 42px;
}
}
}
#tunnel-box {
@@ -83,8 +161,8 @@ const tunnelLength = computed(() => form.value.totalLength);
.edit-box {
z-index: 2;
position: absolute;
top: 160px;
left: 70px;
top: 250px;
left: 80px;
width: 830px;
height: 500px;
background-image: url(@/assets/images/transducer/bg.png);
@@ -119,4 +197,3 @@ const tunnelLength = computed(() => form.value.totalLength);
}
}
</style>