zhgdyun/src/views/projectAdmin/projectIndex.vue

507 lines
15 KiB
Vue
Raw Normal View History

2022-06-08 14:51:11 +08:00
<template>
<!-- 项目首页 -->
<div class="fullHeight">
2023-06-07 18:25:22 +08:00
<vhead :titleName="projectName" :showR="true"></vhead>
2022-06-08 14:51:11 +08:00
<div class="pageContainer">
<div class="pageDataContainer">
2022-06-08 14:51:11 +08:00
<vue-scroll>
<div
class="projectIndexBox"
ref="artList"
@scroll="scrollGet($event)"
>
2022-06-08 14:51:11 +08:00
<!-- <div class="module_title">{{$t('message.homeLayout.existingProducts')}}</div> -->
<div class="projectIndex" id="projectIndex">
<div
class="moduleBox"
v-for="(item, index) in list"
:key="index"
v-if="item.operation"
>
<div
class="module_title"
v-if="
index == 0 || list[index - 1].labelName != item.labelName
"
>
2022-06-08 14:51:11 +08:00
{{ item.labelName }}
</div>
<div
class="module canclick"
:class="{ hovers: item.operation }"
@click="itemClick(item, index)"
ref="refName"
>
<img
v-if="iconType == 1"
:src="
require('../../assets/images/menu/' +
item.moduleIcon +
'.png')
"
class="icon"
/>
2023-06-26 16:24:12 +08:00
<img
v-if="iconType == 2 && item.bigModuleIcon"
:src="
require('../../assets/images/menu/' +
item.bigModuleIcon +
'.png')
"
2023-06-26 16:24:12 +08:00
style="margin-bottom: 10px"
class="icon"
/>
2022-06-08 14:51:11 +08:00
<div class="title_wrap">
<div class="head1">{{ item.moduleName }}</div>
<div class="subhead">{{ item.moduleDesc }}</div>
<!-- {{$t('message.projectIndex.moudleName1')}} -->
</div>
</div>
</div>
</div>
<div v-if="showNotBuyMoudle">
<div class="module_title">
2023-06-26 16:24:12 +08:00
{{ $t('message.homeLayout.ununlockedProducts') }}
2022-06-08 14:51:11 +08:00
</div>
<div class="projectIndex">
2023-06-26 16:24:12 +08:00
<div
class="module"
:class="{ hovers: item.operation }"
v-for="(item, index) in list"
:key="index"
@click="itemClick(item, index)"
v-if="!item.operation"
>
<img
v-if="iconType == 1"
:src="
require('../../assets/images/menu/' +
item.moduleIcon2 +
'.png')
"
class="icon"
/>
2023-06-26 16:24:12 +08:00
<img
v-if="iconType == 2 && item.bigModuleIcon"
:src="
require('../../assets/images/menu/' +
item.bigModuleIcon +
'.png')
"
2023-06-26 16:24:12 +08:00
style="margin-bottom: 10px; opacity: 0.2"
class="icon"
/>
2022-06-08 14:51:11 +08:00
<div class="title_wrap grey">
<div class="head1">{{ item.moduleName }}</div>
<div class="subhead">{{ item.moduleDesc }}</div>
<!-- {{$t('message.projectIndex.moudleName1')}} -->
</div>
</div>
</div>
</div>
</div>
</vue-scroll>
</div>
</div>
</div>
</template>
<script>
import { getProjectInfoBySn } from '@/assets/js/api/overview'
import vhead from '@/components/header'
2022-06-28 13:46:23 +08:00
import axios from 'axios'
import { getProjectDetail } from '@/assets/js/api/baseInfo.js'
import { getProjectModuleList, getAllModuleApi } from '@/assets/js/api/jxjadmin.js'
import { getSafeyHatSessionApi } from '@/assets/js/api/demo'
import { getDockingUrlApi } from '@/assets/js/api/configManage'
2022-06-08 14:51:11 +08:00
export default {
name: 'projectIndex',
2022-06-08 14:51:11 +08:00
components: { vhead },
data() {
return {
firstIn: 0,
2023-06-26 16:24:12 +08:00
selfScrollTop: 0,
projectSn: '',
baseURL: '',
projectNumber: null,
projectName: '',
2022-06-08 14:51:11 +08:00
list: [],
showNotBuyMoudle: showNotBuyMoudle,
brIndex: '',
2023-07-27 18:28:05 +08:00
iconType: '1',
allList: [],
}
2022-06-08 14:51:11 +08:00
},
2023-07-27 18:28:05 +08:00
watch: {
userInfo(newValue) {
// console.log('新值',newValue);
this.allList = newValue.menuAuthority.moduleList
this.getAllModule(this.allList)
2023-07-27 18:28:05 +08:00
},
2023-07-27 18:28:05 +08:00
// realAllList(newValue) {
// this.list = newValue
// }
},
computed: {
userInfo() {
return this.$store.state.userInfo;
},
realAllList() {
return this.list
},
data() {
return this.$store.state.menuList;
},
2023-07-27 18:28:05 +08:00
},
async created() {
this.isFirstLogin = !sessionStorage.getItem('isFirstLogin');
2022-11-08 10:59:30 +08:00
this.projectSn = this.$store.state.projectSn
this.baseURL = this.$http.defaults.baseURL
2023-06-07 18:25:22 +08:00
if (localStorage.getItem('systemInfo')) {
this.iconType = JSON.parse(localStorage.getItem('systemInfo')).iconType
? JSON.parse(localStorage.getItem('systemInfo')).iconType
: '1'
2022-06-08 14:51:11 +08:00
}
console.log(this.iconType, 'iconType,iconTypeiconTypeiconTypeiconTypeiconType')
2023-07-27 18:28:05 +08:00
this.allList = this.$store.state.userInfo.menuAuthority.moduleList
await this.getAllModule(this.allList)
await this.getDataDateils()
await this.getProjectNumber()
},
2023-07-27 18:28:05 +08:00
async mounted() {
2023-07-27 18:28:05 +08:00
// if(this.firstIn == 0) {
// this.firstIn ++
// this.$router.go(0)
// }
// this.$forceUpdate()
2023-07-27 18:28:05 +08:00
},
activated() {
this.$refs.artList.scrollTop = this.selfScrollTop
2022-06-08 14:51:11 +08:00
},
methods: {
scrollGet(e) {
this.selfScrollTop = this.$refs.artList.scrollTop
},
2023-06-07 18:25:22 +08:00
getSafeyHatSession() {
let data = {}
data.projectSn = this.projectSn
getSafeyHatSessionApi(data).then(res => {
console.log('安全帽跳转', res)
// {
// "success":true,
// "message":"操作成功!",
// "code":200,
// "result":{
// "msg_code":"GetSucc",
// "session_id":"d3a3c4d17c46e29dab9c9178d5b380c5",
// "userName":"rdys_test",
// "status":true,
// "token":"d3a3c4d17c46e29dab9c9178d5b380c5"
// },
// "timestamp":1634904162951
// }
// 此处注释是因为免登陆 传projectId到后端
if (res.code == 200) {
this.url = 'https://caps.runde.pro/login#token=' + res.result.token + '&user_name=' + res.result.userName + '&target=home'
// let url = 'https://caps.runde.pro/login#token='+ res.result.token + '&user_name=' + res.result.userName + '&target=home'
2023-06-07 18:25:22 +08:00
window.open(this.url)
}
})
},
getProjectNumber() {
let data = {
projectSn: this.projectSn
}
getProjectInfoBySn(data).then(res => {
2023-06-07 18:25:22 +08:00
console.log('------------', res.result.projectNumber)
this.projectNumber = res.result.projectNumber
2023-06-07 18:25:22 +08:00
})
},
// 全景成像测距
getPanoramicRanging() {
axios({
method: 'GET',
2023-06-07 18:25:22 +08:00
// url:'http://182.90.224.237:8070/xmgl/docking/url',
// url:'http://182.90.224.237:7000/xmgl/docking/url',
url: `${this.$http.defaults.baseURL}${'xmgl/docking/url'}`,
params: {
projectNumber: this.projectNumber
2023-06-07 18:25:22 +08:00
}
}).then(res => {
2023-06-07 18:25:22 +08:00
console.log('全景成像测距', res)
let toUrl = res.data.find(item => {
2023-06-07 18:25:22 +08:00
if (this.projectNumber == item.jinqianmaosn) {
return item.url
2022-07-15 09:47:14 +08:00
}
2023-06-07 18:25:22 +08:00
})
window.open(toUrl.url)
})
},
2023-06-26 16:24:12 +08:00
itemClick(item, index) {
2023-06-07 18:25:22 +08:00
console.log('item', index)
2023-06-26 16:24:12 +08:00
2022-06-08 14:51:11 +08:00
// console.log(item,this.$store.state.userInfo.account)
if (item.moduleName == '智能安全帽系统') {
2022-06-28 13:46:23 +08:00
this.getSafeyHatSession()
this.$message.success(this.$t('message.projectIndex.tips3'))//即将跳转新页面
2023-06-07 18:25:22 +08:00
// 次数更改因为原来跳转的是星璇 无法显示 所以更改跳转到 润德 龙光同一个页面
// let NodeRSA = require("node-rsa");
// //请求参数
// let params = JSON.stringify({
// account: this.$store.state.userInfo.account,
// page_flag: 3,
// });
// //公钥
// const pubKey = `
// -----BEGIN PUBLIC KEY-----
// MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcmP0ug4NTHwW2oeHxheZjmYPDxVGFP770eECdLwRtaH0pPWvsXG6MSO/kCzgjEVEo1K1bvRxkkasQRu02fhI+gsZa8wvVeo3s4zJDA48Oj99JAXsx56/WN1RlNh+tsXcH9oQWy3gbX5cDkheuVZj8gsV7Ez59Ucj4e78zNJrUDwIDAQAB
// -----END PUBLIC KEY-----`;
// let publicKey = new NodeRSA(pubKey);
// let async_key = publicKey.encrypt(params, 'base64')
setTimeout(() => {
window.open("https://caps.runde.pro")
}, 1000)
2023-06-07 18:25:22 +08:00
// window.open("http://58.210.96.206:91/async_danzhou.html?async_key="+async_key)
// window.location.href = "http://58.210.96.206:91/async_danzhou.html?async_key="+async_key;
2022-06-28 13:46:23 +08:00
}
if (item.moduleName == '全景成像测距') {
2023-06-07 18:25:22 +08:00
this.getPanoramicRanging()
2022-06-08 14:51:11 +08:00
}
if (item.moduleName == '智能穿戴管理系统') {
2023-06-07 18:25:22 +08:00
this.getSafeyHatSession()
2022-06-08 14:51:11 +08:00
}
if (item.moduleName == '智能穿戴管理系统') {
return
2022-06-08 14:51:11 +08:00
}
if (item.moduleName == '智能安全帽系统') {
this.getSafeyHatSession()
2022-06-08 14:51:11 +08:00
}
if (!item.operation) {
this.$message.error(this.$t('message.projectIndex.tips1'))
return
2022-06-08 14:51:11 +08:00
}
2022-07-15 09:47:14 +08:00
if (item.menuList && item.menuList.length > 0 && item.moduleName != '全景成像测距') {
let arr = item.menuList,
arr2 = []
arr.forEach(element => {
2022-06-08 14:51:11 +08:00
if (element.menuEquipment == 0) {
arr2.push(element)
2022-06-08 14:51:11 +08:00
}
})
this.$store.commit('setMenuList', arr2)
this.$store.commit('setIsShowBackIndex', true)
this.$store.commit('setMoudle', item)
if (arr2[0].target == '_blank') {
2023-06-07 18:25:22 +08:00
let routeUrl = ''
if (arr2[0].path.indexOf('http') != -1) {
routeUrl = arr2[0].path
} else {
2022-06-08 14:51:11 +08:00
let url = this.$router.resolve({
path: arr2[0].path
})
2023-06-07 18:25:22 +08:00
routeUrl = url.href
2022-06-08 14:51:11 +08:00
}
window.open(routeUrl, '_blank')
2022-06-08 14:51:11 +08:00
} else {
2023-06-07 18:25:22 +08:00
if (arr2[0].path == '' || arr2[0].path.indexOf('/') == -1) {
this.$router.push(arr2[0].menuList[0].path)
2023-06-07 18:25:22 +08:00
} else {
this.$router.push(arr2[0].path)
2022-06-08 14:51:11 +08:00
}
}
} else if (item.moduleName == '全景成像测距' || item.moduleName == '智能安全帽系统') {
// this.$message.success(this.$t('message.projectIndex.tips3'))//即将跳转新页面
} else {
this.$message.error(this.$t('message.projectIndex.tips2'))
2022-06-08 14:51:11 +08:00
}
2023-06-07 18:25:22 +08:00
window._paq.push(['trackEvent', '点击', item.moduleName, '进入' + item.moduleName])
2022-06-08 14:51:11 +08:00
},
//获取详情
getDataDateils() {
let data = {
projectSn: this.projectSn
}
getProjectDetail(data).then(res => {
2022-06-08 14:51:11 +08:00
// console.log(res);
if (res.code == 200) {
this.projectName = res.result.projectName
document.title = this.projectName
this.$store.commit('setProDetail', res.result)
2022-06-08 14:51:11 +08:00
}
})
2022-06-08 14:51:11 +08:00
},
//为了展示未解锁产品,所以需要查询所有模块
getAllModule(half) {
getAllModuleApi({ moduleType: 2 }).then(res => {
2022-06-08 14:51:11 +08:00
if (res.success) {
let all = res.result
2023-07-27 18:28:05 +08:00
// console.log('allallallallall', all)
// console.log('halfhalfhalfhalf',half)
2022-06-08 14:51:11 +08:00
all.forEach((element, index) => {
all[index].operation = false
half.forEach(element2 => {
2022-06-08 14:51:11 +08:00
if (element2.moduleId == element.moduleId) {
all[index].operation = true
all[index].menuList = element2.menuList
2022-06-08 14:51:11 +08:00
}
})
})
this.list = all
this.$forceUpdate()
console.log(this.list, "权限数据")
2022-06-08 14:51:11 +08:00
this.$nextTick(() => {
let projectIndex = document.getElementById('projectIndex')
let array = document.getElementsByClassName('module_title')
2022-06-08 14:51:11 +08:00
console.log(array)
for (let index = 0; index < array.length; index++) {
let newElement = document.createElement('div')
2023-06-07 18:25:22 +08:00
newElement.style = 'width: 100%; height: 1px'
projectIndex.insertBefore(newElement, array[index].parentNode)
2022-06-08 14:51:11 +08:00
}
})
2022-06-08 14:51:11 +08:00
}
})
2022-06-08 14:51:11 +08:00
},
insertAfter(newElement, targetElement) {
// newElement是要追加的元素 targetElement 是指定元素的位置
let parent = targetElement.parentNode // 找到指定元素的父节点
2022-06-08 14:51:11 +08:00
if (parent.lastChild == targetElement) {
// 判断指定元素的是否是节点中的最后一个位置 如果是的话就直接使用appendChild方法
parent.appendChild(newElement, targetElement)
2022-06-08 14:51:11 +08:00
} else {
parent.insertBefore(newElement, targetElement.nextSibling)
2022-06-08 14:51:11 +08:00
}
}
2022-06-08 14:51:11 +08:00
//获取项目解锁的模块
// getProjectModule(projectSn) {
// getProjectModuleList({ projectSn: this.$store.state.projectSn }).then(
// (result) => {
// if (result.success) {
// let half = result.result;
2022-06-08 14:51:11 +08:00
// this.getAllModule(half);
// }
// }
// );
// },
}
}
2022-06-08 14:51:11 +08:00
</script>
<style lang="less" scoped>
.pageContainer {
height: calc(100% - 61px);
background: rgba(247, 249, 255, 0.9);
font-family: '思源黑体';
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.projectIndexBox {
max-width: 1360px;
margin: auto;
width: 100%;
2023-06-26 16:24:12 +08:00
overflow-y: scroll;
height: calc(100% - 61px);
2022-06-08 14:51:11 +08:00
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
// @media screen and (max-width: 1630px) {
// .projectIndex .module {
// margin-right: 26px !important;
// }
// }
.projectIndex {
width: 100%;
display: flex;
align-items: flex-end;
box-sizing: border-box;
flex-wrap: wrap;
margin-bottom: 8px;
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.module:nth-child(4n) {
margin-right: 0;
}
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.module_title {
margin-left: -10px;
border-left: 2px solid #4a8bff;
padding-left: 8px;
margin-bottom: 20px;
font-size: 14px;
// width: 1360px;
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.module {
width: 310px;
// height: 124px;
box-sizing: border-box;
// border-radius: 3px;
// box-shadow: 0px 2px 9px 0px rgba(0, 0, 0, 0.07);
// display: flex;
// align-items: center;
margin-bottom: 24px;
padding: 30px 10px 32px;
font-size: 17px;
margin-right: 30px;
text-align: center;
border: 1px solid rgba(18, 41, 75, 0.1);
height: 174px;
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
&.canclick:hover {
cursor: pointer;
// border-color: rgba(74, 139, 255, 0.9);
background-color: rgba(196, 208, 255, 0.17);
// box-shadow: 0px 5px 9px 3px rgba(74, 139, 255, 0.2);
}
.head1 {
// opacity: 0.8;
font-weight: bold;
font-size: 16px;
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.icon {
width: 56px;
height: 56px;
// width: 45px;
// height: 45px;
// margin-right: 20px;
display: block;
margin: 0 auto 0px;
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.subhead {
opacity: 0.8;
font-size: 12px;
margin-top: 15px;
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.grey * {
opacity: 0.3;
}
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.hovers {
cursor: pointer;
}
2023-06-07 18:25:22 +08:00
2022-06-08 14:51:11 +08:00
.moduleBox {
// vertical-align: baseline;
// float: left;\
// display: inline-block;
}
2023-06-26 16:24:12 +08:00
::-webkit-scrollbar {
width: 0 !important;
}
::-webkit-scrollbar {
width: 0 !important;
height: 0;
}
</style>