邓洁: 修改细节

This commit is contained in:
邓洁
2024-01-12 14:51:06 +08:00
parent 2926e46351
commit 9b5ca77651
5 changed files with 58 additions and 51 deletions

View File

@@ -129,7 +129,7 @@ body,
}
.current-user {
margin-top: 26px;
margin-top: 13px;
display: flex;
align-items: center;

View File

@@ -42,7 +42,7 @@
<script setup>
import TunnelScene from "@/components/content/tunnelScene/TunnelScene.vue";
import {editTunnel, getTunnelDetail} from "@/api/tunnelManage";
import { computed, provide } from "vue";
import {computed, provide, toRaw} from "vue";
import {useModelSceneStore} from "@/store/modelSceneStore";
import {ElMessage} from "element-plus";
import {initSceneData} from "../../api/tunnelScene";
@@ -52,6 +52,8 @@ const tunnelId = reactive(router.currentRoute.value.params.tunnelId);
const userId = reactive(router.currentRoute.value.params.userId);
const type = reactive(router.currentRoute.value.params.type);
const modelStore = useModelSceneStore();
const constructionLength = ref(null)
const modelEquipmentList = ref(null)
const form = ref({
tunnelName: "",
serialNumber: "",
@@ -59,40 +61,41 @@ const form = ref({
isDefault: false,
remarks: "",
});
const getTunnel = () => {
const getTunnel = (type) => {
getTunnelDetail(tunnelId).then((res) => {
if (res?.code === 1000) {
form.value = res.data;
console.log('form.value ',form.value )
if (type == 1) {
constructionLength.value = res.data.constructionLength
}
}
});
};
getTunnel();
const tunnelLength = computed(() => form.value.totalLength);
const handleGotoDevice = () => {
if (type === 's') {
router.push('/device/' + tunnelId + '/s/' + userId)
} else if (type === 'i') {
router.push('/device/' + tunnelId + '/i/' + userId)
if (type === 'bySite') {
router.push('/device/' + tunnelId + '/bySite/' + userId)
} else if (type === 'byHome') {
router.push('/device/' + tunnelId + '/byHome/' + userId)
}
};
const handleGoTunnelMgr = () => {
router.push("/tunnel/" + form.value.siteId + "/" + type + "/" + userId);
};
const handleSave = async () => {
if(form.value.constructionLength==null){
form.value.constructionLength=0
}
const getTunnelInfo = () => {
initSceneData(tunnelId).then((res) => {
constructionLength.value = res.data.constructionLength
modelEquipmentList.value = JSON.parse(res.data.tunnelThreeConfig)
const data = {
tunnelId: tunnelId,
tunnelName: form.value.tunnelName,
serialNumber: form.value.serialNumber,
remarks: form.value.remarks,
constructionLength: form.value.constructionLength,
// constructionLength: 500,
constructionLength: constructionLength.value,
tunnelLength: form.value.totalLength,
isDefault: form.value.isDefault,
modelEquipmentList: await modelStore.initModelDataPreview(tunnelId),
modelEquipmentList: modelEquipmentList.value,
};
editTunnel(data).then((res) => {
if (res?.code === 1000) {
@@ -102,6 +105,10 @@ const handleSave = async () => {
ElMessage.error(res.msg);
}
});
})
}
const handleSave = () => {
getTunnelInfo()
};
</script>
<style lang="scss" scoped>

View File

@@ -178,7 +178,7 @@ const handleClickSite = (type) => {
}
}
const goToAddTunnel = (siteId) => {
router.push('/tunnel/' + siteId+'/s'+'/'+userId)
router.push('/tunnel/' + siteId+'/bySite'+'/'+userId)
}
//重置from表单

View File

@@ -205,9 +205,9 @@ onMounted(() => {
showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin';
})
const handleGoSiteOrIndex = () => {
if (type === 's') {
if (type === 'bySite') {
router.push('/site/' + userId)
} else if (type === 'i') {
} else if (type === 'byHome') {
router.push('/')
}
}
@@ -267,10 +267,10 @@ const handlePreview = (id) => {
}
const handleGoToEditTunnel = (tunnelId) => {
isEdit.value = true
if (type === 's') {
router.push('/edit/' + tunnelId + '/s/' + userId)
} else if (type === 'i') {
router.push('/edit/' + tunnelId + '/i/' + userId)
if (type === 'bySite') {
router.push('/edit/' + tunnelId + '/bySite/' + userId)
} else if (type === 'byHome') {
router.push('/edit/' + tunnelId + '/byHome/' + userId)
}
}
const handleChooseAll = () => {
@@ -288,10 +288,10 @@ const handleChooseAll = () => {
})
}
const handleEditDevice = (tunnelId) => {
if (type === 's') {
router.push('/device/' + tunnelId + '/s/' + userId)
} else if (type === 'i') {
router.push('/device/' + tunnelId + '/i/' + userId)
if (type === 'bySite') {
router.push('/device/' + tunnelId + '/bySite/' + userId)
} else if (type === 'byHome') {
router.push('/device/' + tunnelId + '/byHome/' + userId)
}
}
const restFrom = () => {

View File

@@ -278,7 +278,7 @@ const manageSelect = (index) => {
}
} else if (index == '隧道管理') {
if (currentSiteId.value && currentUserId.value) {
router.push("/tunnel/" + currentSiteId.value + '/i' + '/' + currentUserId.value);
router.push("/tunnel/" + currentSiteId.value + '/byHome/'+ currentUserId.value);
}
} else if (index == '用户管理') {
if (currentSiteId.value) {