feat : 隧道模拟
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
<div class="back-icon"></div>
|
||||
<span>返回</span>
|
||||
</div>
|
||||
<div class="site-name">
|
||||
{{ siteName }}
|
||||
</div>
|
||||
<!-- <div class="site-name">-->
|
||||
<!-- {{ siteName }}-->
|
||||
<!-- </div>-->
|
||||
<tunnel-title/>
|
||||
<div class="all-del-btn" v-if="showOperation">
|
||||
<div class="all-btn" style=" margin-right: 40px;" v-if="showAddIcon" @click="handleAdd">
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content" >
|
||||
<div class="site-box" v-for="item in tunnelList" :key="item.tunnelId">
|
||||
<div class="site-box" v-for="item in tunnelList" :key="item.projectId">
|
||||
<div class="top">
|
||||
<span>{{ item.tunnelName }}</span>
|
||||
<span>施工长度{{ item.constructionLength }}米 隧道长度{{ item.totalLength }}米</span>
|
||||
@@ -31,10 +31,13 @@
|
||||
</div>
|
||||
<div class="box-center">
|
||||
<div>
|
||||
<!-- @click="handlePreview(item.tunnelId)"-->
|
||||
<div class="left-img"></div>
|
||||
<div style="display: flex;justify-content: center">
|
||||
<div class="edit-btn" @click.stop="handleGoToSimulateTunnel(item.tunnelId)">
|
||||
<div style="display: flex;justify-content: space-around">
|
||||
<!-- <div class="edit-btn" @click.stop="handleGoToEditTunnel(item.projectId)">-->
|
||||
<!-- <div class="edit-icon"></div>-->
|
||||
<!-- <div>编辑</div>-->
|
||||
<!-- </div>-->
|
||||
<div class="edit-btn" @click.stop="handleGoToSimulateTunnel(item.projectId)">
|
||||
<div class="edit-icon"></div>
|
||||
<div>去模拟</div>
|
||||
</div>
|
||||
@@ -44,7 +47,8 @@
|
||||
<div class="icons-block">
|
||||
<div v-for="equItem in iconsList" :key="item.icon" class="icon-text">
|
||||
<div :style="{ backgroundImage: 'url(' +getImageUrl(equItem.icon)+')' }" class="icon"></div>
|
||||
<span>{{ equItem.name }}:{{ item.tunnelEquipmentAmountInfo[equItem.type] }}</span>
|
||||
<span>{{ equItem.name }}:0</span>
|
||||
<!-- {{ item.tunnelEquipmentAmountInfo[equItem.type] }}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -52,7 +56,7 @@
|
||||
</div>
|
||||
<div class="site-box add-box" @click="handleAdd" v-if="showOperation">
|
||||
<div class="add-icon"></div>
|
||||
<div style="cursor: pointer">添加隧道</div>
|
||||
<div style="cursor: pointer">添加模拟隧道</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog :close-on-click-modal="false" v-model="isVisited" width="1958px">
|
||||
@@ -72,18 +76,21 @@
|
||||
<el-form-item label="施工长度" prop="constructionLength">
|
||||
<el-input type="number" v-model="form.constructionLength" placeholder="请输入施工长度"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="风机初始频率" prop="fanInitialFrequency">
|
||||
<el-input type="number" v-model="form.fanInitialFrequency" placeholder="请输入风机初始频率"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="爆破量级" prop="burstLevel">
|
||||
<el-input type="number" v-model="form.burstLevel" placeholder="请输入爆破量级"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否默认">
|
||||
<el-radio-group v-model="form.isDefault">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
<el-form-item label="序列号" prop="serialNumber">
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入序列号"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="风机初始频率" prop="fanInitialFrequency">-->
|
||||
<!-- <el-input type="number" v-model="form.fanInitialFrequency" placeholder="请输入风机初始频率"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="爆破量级" prop="burstLevel">-->
|
||||
<!-- <el-input type="number" v-model="form.burstLevel" placeholder="请输入爆破量级"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="是否默认">-->
|
||||
<!-- <el-radio-group v-model="form.isDefault">-->
|
||||
<!-- <el-radio :label="true">是</el-radio>-->
|
||||
<!-- <el-radio :label="false">否</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="隧道备注">
|
||||
<el-input v-model="form.remarks" placeholder="请输入隧道备注"/>
|
||||
</el-form-item>
|
||||
@@ -109,7 +116,13 @@
|
||||
|
||||
<script setup>
|
||||
import {ElLoading, ElMessage, ElMessageBox} from "element-plus";
|
||||
import {getTunnelList, addTunnel, deleteTunnel} from "@/api/tunnelManage";
|
||||
import {
|
||||
getTunnelList,
|
||||
deleteSimulateTunnel,
|
||||
addSimulateTunnel,
|
||||
getSimulateTunnelList,
|
||||
getTunnelDetail, getSimulateTunnelDetail
|
||||
} from "@/api/tunnelManage";
|
||||
import {getSiteDrawing, getSiteDetail} from "@/api/site";
|
||||
import TunnelTitle from "@/components/tunnelTitle/index.vue";
|
||||
import {getTunnelBySiteId} from "@/api/largeScreen";
|
||||
@@ -141,6 +154,7 @@ const formRules = ref({
|
||||
tunnelAlias: [{required: true, message: '请输入隧道简称', trigger: ['blur', 'change']}],
|
||||
totalLength: [{required: true, message: '请输入隧道长度', trigger: ['blur', 'change']}],
|
||||
constructionLength: [{required: true, message: '请输入施工长度', trigger: ['blur', 'change']}],
|
||||
serialNumber: [{required: true, message: '请输入序列号', trigger: ['blur', 'change']}],
|
||||
})
|
||||
const showFirst = ref(false)
|
||||
const showOperation = ref(true)
|
||||
@@ -196,10 +210,10 @@ const iconsList = ref([
|
||||
num: 0
|
||||
},
|
||||
])
|
||||
const title = ref('新增隧道')
|
||||
const title = ref('新增模拟隧道')
|
||||
const showNull = ref(false);
|
||||
const isVisited = ref(false);
|
||||
const tunnelIds = ref([])
|
||||
const projectIds = ref([])
|
||||
const tunnelNameList = ref([])
|
||||
const siteName = ref(localStorage.getItem('site'))
|
||||
const form = ref({
|
||||
@@ -226,67 +240,12 @@ const total = ref(0);
|
||||
onMounted(() => {
|
||||
showOperation.value = localStorage.getItem('roleKey') !== 'tunnel_admin';
|
||||
})
|
||||
const handleGoToSimulateTunnel = (tunnelId) => {
|
||||
router.push('/simulate/' + tunnelId)
|
||||
}
|
||||
const addSerialNumber = () => {
|
||||
serialNumberList.value.push({
|
||||
serialNumber: '',
|
||||
serialNumberType: '',
|
||||
})
|
||||
}
|
||||
const delSerialNumber = (index) => {
|
||||
serialNumberList.value.splice(index, 1)
|
||||
}
|
||||
const getSiteImg = () => {
|
||||
showNull.value = false
|
||||
getSiteDrawing(siteId).then((res) => {
|
||||
if (res.code === 1000) {
|
||||
if (res.data.drawingData === null) {
|
||||
// ElMessageBox.confirm('暂无图纸, 是否前往站点管理上传图纸?', '系统提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// router.push('/site/' + userId + '/' + localStorage.getItem('currentSiteId'))
|
||||
// }).catch(()=>{
|
||||
showNull.value = true
|
||||
// })
|
||||
} else {
|
||||
showNull.value = false
|
||||
siteImage.value = res.data.drawingData
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const clickHot = (id) => {
|
||||
console.log('点击热区===============')
|
||||
router.push('/' + id + '/' + siteId)
|
||||
}
|
||||
// const testArr=[]
|
||||
const clickHandler = (id) => {
|
||||
// let obj=e.offsetX+','+e.offsetY
|
||||
// testArr.push(obj)
|
||||
// console.log('正确数值',testArr.map(item=>item).join())
|
||||
// console.log('点击',e.offsetX+','+e.offsetY+',')
|
||||
// console.log('图纸', document.getElementById('imgModel').getBoundingClientRect().x,document.getElementById('imgModel').getBoundingClientRect().y)
|
||||
const handleGoToSimulateTunnel = (projectId) => {
|
||||
router.push('/simulate/' + projectId)
|
||||
}
|
||||
const handleGoSiteOrIndex = () => {
|
||||
if (type === 'bySite') {
|
||||
router.push('/site/' + userId + '/' + localStorage.getItem('currentSiteId'))
|
||||
} else if (type === 'byHome') {
|
||||
router.push('/' + 'siteToHome/' + siteId)
|
||||
}
|
||||
router.push('/')
|
||||
}
|
||||
//根据站点id获取隧道信息
|
||||
const getTunnel = (id) => {
|
||||
getSiteDetail(id).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
siteName.value = res.data.siteName
|
||||
}
|
||||
});
|
||||
}
|
||||
getTunnel(1)
|
||||
const getList = () => {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
@@ -294,8 +253,7 @@ const getList = () => {
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
customClass: 'allLoading'
|
||||
})
|
||||
getTunnelList({
|
||||
siteId: 1,
|
||||
getSimulateTunnelList({
|
||||
...pageInfo
|
||||
}).then(res => {
|
||||
if (res.code === 1000) {
|
||||
@@ -332,14 +290,13 @@ const handleSubmit = debounce((instance) => {
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
const data = {
|
||||
siteId: siteId,
|
||||
...form.value,
|
||||
tunnelGatewayDtoList: serialNumberList.value
|
||||
// tunnelGatewayDtoList: serialNumberList.value
|
||||
}
|
||||
// console.info("🚀 ~method:data -----", data)
|
||||
addTunnel(data).then(res => {
|
||||
console.info("🚀 ~method:data -----", data)
|
||||
addSimulateTunnel(data).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success('新增成功')
|
||||
ElMessage.success('新增模拟隧道成功')
|
||||
getList()
|
||||
isVisited.value = false
|
||||
} else {
|
||||
@@ -348,49 +305,21 @@ const handleSubmit = debounce((instance) => {
|
||||
})
|
||||
})
|
||||
}, 100)
|
||||
//预览隧道
|
||||
const handlePreview = (id) => {
|
||||
if (id) {
|
||||
getTunnelBySiteId(siteId).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
if (res.data.filter((item) => item.value == id).length === 0) {
|
||||
ElMessage.warning('当前预览的隧道未准备好, 不予展示, 请添加设备后再试!')
|
||||
} else {
|
||||
router.push('/' + id + '/' + siteId)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const handleGoToEditTunnel = (tunnelId) => {
|
||||
isEdit.value = true
|
||||
if (type === 'bySite') {
|
||||
router.push('/edit/' + tunnelId + '/bySite/' + userId)
|
||||
} else if (type === 'byHome') {
|
||||
router.push('/edit/' + tunnelId + '/byHome/' + userId)
|
||||
}
|
||||
}
|
||||
|
||||
const handleChooseAll = debounce(() => {
|
||||
tunnelList.value.map(item => {
|
||||
item.checked = !item.checked
|
||||
if (item.checked && !item.isDefault) {
|
||||
tunnelIds.value.push(item.tunnelId)
|
||||
projectIds.value.push(item.projectId)
|
||||
} else if (!item.checked && !item.isDefault) {
|
||||
tunnelIds.value.map((newItem, index) => {
|
||||
if (newItem === item.tunnelId) {
|
||||
tunnelIds.value.splice(index, 1)
|
||||
projectIds.value.map((newItem, index) => {
|
||||
if (newItem === item.projectId) {
|
||||
projectIds.value.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}, 100)
|
||||
const handleEditDevice = (tunnelId) => {
|
||||
if (type === 'bySite') {
|
||||
router.push('/device/' + tunnelId + '/bySite/' + userId)
|
||||
} else if (type === 'byHome') {
|
||||
router.push('/device/' + tunnelId + '/byHome/' + userId)
|
||||
}
|
||||
}
|
||||
const restFrom = () => {
|
||||
form.value = {
|
||||
tunnelName: '',
|
||||
@@ -406,9 +335,39 @@ const restFrom = () => {
|
||||
isDefault: false
|
||||
}
|
||||
}
|
||||
const getTunnel = async (projectId) => {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在加载系统资源...',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
customClass: 'allLoading'
|
||||
})
|
||||
await getSimulateTunnelDetail(projectId).then((res) => {
|
||||
if (res?.code === 1000) {
|
||||
form.value = res.data;
|
||||
}
|
||||
loading.close()
|
||||
});
|
||||
};
|
||||
const handleGoToEditTunnel = (projectId) => {
|
||||
restFrom()
|
||||
title.value = '编辑模拟隧道'
|
||||
getTunnel(projectId)
|
||||
isVisited.value = true
|
||||
serialNumberList.value = [
|
||||
// {
|
||||
// serialNumber: '',
|
||||
// serialNumberType:''
|
||||
// }
|
||||
]
|
||||
nextTick(() => {
|
||||
// 清空校验
|
||||
formInstance.value.clearValidate()
|
||||
})
|
||||
}
|
||||
const handleAdd = () => {
|
||||
restFrom()
|
||||
title.value = '新增隧道'
|
||||
title.value = '新增模拟隧道'
|
||||
isVisited.value = true
|
||||
serialNumberList.value = [
|
||||
// {
|
||||
@@ -426,12 +385,12 @@ const getImageUrl = (name) => {
|
||||
}
|
||||
const handleClickSite = (type) => {
|
||||
if (type.checked) {
|
||||
tunnelIds.value.push(type.tunnelId)
|
||||
projectIds.value.push(type.projectId)
|
||||
tunnelNameList.value.push(type.tunnelName)
|
||||
} else {
|
||||
tunnelIds.value.map((item, index) => {
|
||||
if (item === type.tunnelId) {
|
||||
tunnelIds.value.splice(index, 1)
|
||||
projectIds.value.map((item, index) => {
|
||||
if (item === type.projectId) {
|
||||
projectIds.value.splice(index, 1)
|
||||
}
|
||||
})
|
||||
tunnelNameList.value.map((item, index) => {
|
||||
@@ -442,7 +401,7 @@ const handleClickSite = (type) => {
|
||||
}
|
||||
}
|
||||
const handleMoreDelete = debounce(() => {
|
||||
if (tunnelIds.value.length === 0) {
|
||||
if (projectIds.value.length === 0) {
|
||||
ElMessage.warning('请先选择隧道进行删除')
|
||||
} else {
|
||||
ElMessageBox.confirm(`是否确定删除该隧道`, '系统提示', {
|
||||
@@ -451,11 +410,11 @@ const handleMoreDelete = debounce(() => {
|
||||
type: 'warning',
|
||||
customClass: 'delBox'
|
||||
}).then(() => {
|
||||
deleteTunnel(tunnelIds.value).then(res => {
|
||||
deleteSimulateTunnel(projectIds.value).then(res => {
|
||||
if (res.code === 1000) {
|
||||
ElMessage.success(res.msg)
|
||||
getList()
|
||||
tunnelIds.value = []
|
||||
projectIds.value = []
|
||||
tunnelNameList.value = []
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
|
||||
Reference in New Issue
Block a user