解决冲突

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

@@ -42,7 +42,7 @@ export const getEquipmentList = (tunnelId) => {
export const editTunnel = (data) => { export const editTunnel = (data) => {
return request({ return request({
url: '/tunnel/model/details', url: '/tunnel/model/details',
method: 'post', method: 'put',
data data
}) })
} }

View File

@@ -4,6 +4,7 @@ import { saveEquipment, initSceneData } from "../api/tunnelScene";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export const useModelSceneStore = defineStore("modelSceneData", () => { export const useModelSceneStore = defineStore("modelSceneData", () => {
let equipmentList = ref("[]"); let equipmentList = ref("[]");
let allEditList = ref({});
function initData(tunnelId = 1) { function initData(tunnelId = 1) {
initSceneData(tunnelId) initSceneData(tunnelId)
.then((res) => { .then((res) => {
@@ -43,12 +44,24 @@ export const useModelSceneStore = defineStore("modelSceneData", () => {
}); });
}); });
} }
function getTunnelEditAllList(tunnelId = 1) {
return new Promise((resolve, reject) => {
initSceneData(tunnelId)
.then((res) => {
allEditList.value = res.data;
resolve(JSON.parse(allEditList.value));
})
.catch((Error) => {
reject();
});
});
}
return { return {
equipmentList, equipmentList,
initData, initData,
saveSceneData, saveSceneData,
deleteEquipment, deleteEquipment,
getEquipmentList, getEquipmentList,
getTunnelEditAllList,
}; };
}); });

View File

@@ -1,8 +1,15 @@
<template> <template>
<div id="main"> <div id="main">
<div class="box-top"> <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="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 class="del-btn" @click="handleSave">
保存 保存
</div> </div>
@@ -26,34 +33,60 @@
</div> </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> </div>
</template> </template>
<script setup> <script setup>
import TunnelScene from "@/components/content/tunnelScene/TunnelScene.vue"; import TunnelScene from "@/components/content/tunnelScene/TunnelScene.vue";
import { getTunnelDetail } from "../../api/tunnelManage"; import { editTunnel, getTunnelDetail } from "@/api/tunnelManage";
import { reactive, computed } from "vue"; import { computed } from "vue";
import { useModelSceneStore } from "@/store/modelSceneStore";
const router = useRouter(); const router = useRouter();
const tunnelId = reactive(router.currentRoute.value.params.tunnelId) const tunnelId = reactive(router.currentRoute.value.params.tunnelId)
const store = useModelSceneStore();
const form = ref({ const form = ref({
tunnelName: '', tunnelName: '',
serialNumber: '', serialNumber: '',
totalLength: '', totalLength: '',
remarks: '' remarks: ''
}); });
const equipmentList = ref([])
onMounted(async () => {
equipmentList.value = await store.getEquipmentList();
})
const getTunnel = () => { const getTunnel = () => {
getTunnelDetail(tunnelId).then((res) => { getTunnelDetail(tunnelId).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
console.log('res', res)
form.value = res.data form.value = res.data
console.log('for', form.value)
} }
}); });
} }
getTunnel() 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#main { #main {
@@ -62,18 +95,63 @@ const tunnelLength = computed(() => form.value.totalLength);
width: 100%; width: 100%;
background-color: #072348; background-color: #072348;
.del-btn { .box-top {
position: absolute; display: flex;
top: 85px; align-items: center;
right: 80px; justify-content: space-between;
cursor: pointer;
font-size: 42px; .back-tunnel {
width: 180px; z-index: 2;
height: 80px; position: absolute;
line-height: 80px; top: 100px;
background: #08B7B8; //left: 80px;
border-radius: 11px; cursor: pointer;
padding-left: 50px; 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 { #tunnel-box {
@@ -83,8 +161,8 @@ const tunnelLength = computed(() => form.value.totalLength);
.edit-box { .edit-box {
z-index: 2; z-index: 2;
position: absolute; position: absolute;
top: 160px; top: 250px;
left: 70px; left: 80px;
width: 830px; width: 830px;
height: 500px; height: 500px;
background-image: url(@/assets/images/transducer/bg.png); background-image: url(@/assets/images/transducer/bg.png);
@@ -119,4 +197,3 @@ const tunnelLength = computed(() => form.value.totalLength);
} }
} }
</style> </style>

View File

@@ -34,7 +34,7 @@
<div>{{ item.info.tunnelName }}</div> <div>{{ item.info.tunnelName }}</div>
<div class="tunnel-icon"></div> <div class="tunnel-icon"></div>
<div>施工长度{{ item.info.constructionLength }}</div> <div>施工长度{{ item.info.constructionLength }}</div>
<div>实现长度{{ item.info.totalLength }}公里 <div>实现长度{{ item.info.totalLength }}
</div> </div>
</div> </div>
<div class="tunnel-add" @click="goToAddTunnel(item.siteId)"> <div class="tunnel-add" @click="goToAddTunnel(item.siteId)">
@@ -177,6 +177,7 @@ const handleClickSite = (type) => {
if (type.checked) { if (type.checked) {
siteIds.value.push(type.siteId) siteIds.value.push(type.siteId)
siteNameList.value.push(type.siteName) siteNameList.value.push(type.siteName)
} else { } else {
siteIds.value.map((item, index) => { siteIds.value.map((item, index) => {
if (item === type.siteId) { if (item === type.siteId) {
@@ -408,7 +409,7 @@ const handleCurrentChange = (val) => {
flex-wrap: wrap; flex-wrap: wrap;
padding-left: 100px; padding-left: 100px;
padding-right: 100px; padding-right: 100px;
justify-content: space-between; //justify-content: space-between;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
@@ -432,7 +433,7 @@ const handleCurrentChange = (val) => {
.site-box { .site-box {
margin-top: 122px; margin-top: 122px;
//margin-right: 1%; margin-right: 32px;
padding: 40px 50px; padding: 40px 50px;
width: 1250px; width: 1250px;
height: 750px; height: 750px;

View File

@@ -243,6 +243,7 @@ const pageInfo = reactive({
const total = ref(10); const total = ref(10);
const getList = () => { const getList = () => {
getTunnelList({ getTunnelList({
siteId:siteId,
...pageInfo ...pageInfo
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {

View File

@@ -114,7 +114,6 @@ onMounted(() => {
}); });
getUser() getUser()
getOtherInfo() getOtherInfo()
}); });
const getUser = () => { const getUser = () => {
getUserInfo().then(res => { getUserInfo().then(res => {
@@ -134,8 +133,8 @@ const getOtherInfo = () => {
} }
}); });
}; };
const getScreenInfo = async (id) => { const getScreenInfo = (id) => {
await getLargeScreen(id).then((res) => { getLargeScreen(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
largeScreenData.value = res.data; largeScreenData.value = res.data;
} }
@@ -146,7 +145,7 @@ const getTunnel = (id) => {
getTunnelBySiteId(id).then((res) => { getTunnelBySiteId(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
tunnelList.value = res.data tunnelList.value = res.data
getScreenInfo(res.data[0].value) // getScreenInfo(res.data[0].value)
} }
}); });
} }