Merge pull request '邓洁: 修改细节' (#233) from dengjie into dev
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/233
This commit is contained in:
@@ -129,7 +129,7 @@ body,
|
||||
}
|
||||
|
||||
.current-user {
|
||||
margin-top: 26px;
|
||||
margin-top: 13px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<div class="edit-box">
|
||||
<el-form :model="form" :label-position="right" label-width="188px">
|
||||
<el-form-item label="隧道名称">
|
||||
<el-input v-model="form.tunnelName" placeholder="请输入隧道名称" />
|
||||
<el-input v-model="form.tunnelName" placeholder="请输入隧道名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="序列号">
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入序列号" />
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入序列号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="隧道长度">
|
||||
<el-input type="number" v-model="form.totalLength" placeholder="请输入隧道长度" />
|
||||
<el-input type="number" v-model="form.totalLength" placeholder="请输入隧道长度"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否默认">
|
||||
<el-radio-group v-model="form.isDefault">
|
||||
@@ -29,22 +29,22 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="隧道备注">
|
||||
<el-input v-model="form.remarks" placeholder="请输入隧道备注" />
|
||||
<el-input v-model="form.remarks" placeholder="请输入隧道备注"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 这里就导入正常的编辑模式,就是我们之前写的部分 -->
|
||||
<tunnel-scene id="tunnel-box" :isedit="true" :tunnelId="tunnelId" :form="form" ref="tunnelScene"
|
||||
:tunnelLength="tunnelLength" />
|
||||
:tunnelLength="tunnelLength"/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import TunnelScene from "@/components/content/tunnelScene/TunnelScene.vue";
|
||||
import { editTunnel, getTunnelDetail } from "@/api/tunnelManage";
|
||||
import { computed, provide } from "vue";
|
||||
import { useModelSceneStore } from "@/store/modelSceneStore";
|
||||
import { ElMessage } from "element-plus";
|
||||
import {editTunnel, getTunnelDetail} from "@/api/tunnelManage";
|
||||
import {computed, provide, toRaw} from "vue";
|
||||
import {useModelSceneStore} from "@/store/modelSceneStore";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {initSceneData} from "../../api/tunnelScene";
|
||||
|
||||
const router = useRouter();
|
||||
@@ -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,49 +61,54 @@ 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 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,
|
||||
isDefault: form.value.isDefault,
|
||||
modelEquipmentList: await modelStore.initModelDataPreview(tunnelId),
|
||||
};
|
||||
editTunnel(data).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
ElMessage.success(res.msg);
|
||||
router.push("/tunnel/" + form.value.siteId + "/" + type + "/" + userId);
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
});
|
||||
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: constructionLength.value,
|
||||
tunnelLength: form.value.totalLength,
|
||||
isDefault: form.value.isDefault,
|
||||
modelEquipmentList: modelEquipmentList.value,
|
||||
};
|
||||
editTunnel(data).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
ElMessage.success(res.msg);
|
||||
router.push("/tunnel/" + form.value.siteId + "/" + type + "/" + userId);
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
const handleSave = () => {
|
||||
getTunnelInfo()
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -178,7 +178,7 @@ const handleClickSite = (type) => {
|
||||
}
|
||||
}
|
||||
const goToAddTunnel = (siteId) => {
|
||||
router.push('/tunnel/' + siteId+'/s'+'/'+userId)
|
||||
router.push('/tunnel/' + siteId+'/bySite'+'/'+userId)
|
||||
}
|
||||
|
||||
//重置from表单
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -282,7 +282,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) {
|
||||
|
||||
Reference in New Issue
Block a user