zhgdyun/src/views/projectAdmin/projectIndex.vue

523 lines
16 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">
2024-02-19 10:19:06 +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">
2024-03-30 11:51:22 +08:00
<template
v-for="(item, index) in list">
<div
style="width: 100%;height: 1px;"
v-if="
index == 0 ||
(index > 0 && list[index - 1].labelName != item.labelName)
"
></div>
2024-02-19 10:19:06 +08:00
<div
class="moduleBox"
v-if="item.operation"
>
<div
class="module_title"
v-if="
2024-03-30 11:51:22 +08:00
index == 0 ||
(index > 0 && list[index - 1].labelName != item.labelName)
2024-02-19 10:19:06 +08:00
"
>
2022-06-08 14:51:11 +08:00
{{ item.labelName }}
</div>
2024-02-19 10:19:06 +08:00
<div
class="module canclick"
:class="{ hovers: item.operation }"
@click="itemClick(item, index)"
ref="refName"
>
<img
2024-04-13 22:51:12 +08:00
v-if="iconType == 1 && item.moduleIcon "
2024-02-19 10:19:06 +08:00
: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"
2024-02-19 10:19:06 +08:00
: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>
2024-03-30 11:51:22 +08:00
</template>
2022-06-08 14:51:11 +08:00
</div>
<div v-if="showNotBuyMoudle">
<div class="module_title">
2024-02-19 10:19:06 +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"
>
2024-02-19 10:19:06 +08:00
<img
2024-04-08 20:22:14 +08:00
v-if="iconType == 1 && item.moduleIcon2"
2024-02-19 10:19:06 +08:00
: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"
2024-02-19 10:19:06 +08:00
: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>
2024-02-19 10:19:06 +08:00
import { getProjectInfoBySn } from "@/assets/js/api/overview";
import vhead from "@/components/header";
import axios from "axios";
import { getProjectDetail } from "@/assets/js/api/baseInfo.js";
import {
getProjectModuleList,
getAllModuleApi,
2024-04-08 19:12:10 +08:00
getNewUserAllModulePageApi
2024-02-19 10:19:06 +08:00
} 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 {
2024-02-19 10:19:06 +08:00
name: "projectIndex",
2022-06-08 14:51:11 +08:00
components: { vhead },
data() {
return {
2023-06-26 16:24:12 +08:00
selfScrollTop: 0,
2024-02-19 10:19:06 +08:00
projectSn: "",
baseURL: "",
projectNumber: "",
projectName: "",
2022-06-08 14:51:11 +08:00
list: [],
showNotBuyMoudle: showNotBuyMoudle,
2024-02-19 10:19:06 +08:00
brIndex: "",
iconType: "1",
};
2022-06-08 14:51:11 +08:00
},
2024-02-19 10:19:06 +08:00
created() {
this.projectSn = this.$store.state.projectSn;
this.baseURL = this.$http.defaults.baseURL;
2023-07-27 18:28:05 +08:00
},
2024-02-19 10:19:06 +08:00
mounted() {
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
}
2024-02-19 10:19:06 +08:00
console.log(this.iconType);
this.getDataDateils();
// if(this.$store.state.userInfo.accountType==5){
// this.getProjectModule()
// }else{
var arr = this.$store.state.userInfo.menuAuthority.moduleList;
this.getAllModule(arr);
this.getProjectNumber();
2023-07-27 18:28:05 +08:00
// }
},
activated() {
2024-02-19 10:19:06 +08:00
this.$refs.artList.scrollTop = this.selfScrollTop;
2022-06-08 14:51:11 +08:00
},
methods: {
scrollGet(e) {
2024-03-30 11:51:22 +08:00
// console.log("滚动触发的事件", e.srcElement.scrollTop, e.target.scrollTop);
2024-02-19 10:19:06 +08:00
this.selfScrollTop = this.$refs.artList.scrollTop;
},
2023-06-07 18:25:22 +08:00
getSafeyHatSession() {
2024-02-19 10:19:06 +08:00
let data = {};
data.projectSn = this.projectSn;
getSafeyHatSessionApi(data).then((res) => {
console.log("安全帽跳转", res);
2023-06-07 18:25:22 +08:00
// {
// "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) {
2024-02-19 10:19:06 +08:00
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'
2024-02-19 10:19:06 +08:00
window.open(this.url);
2023-06-07 18:25:22 +08:00
}
2024-02-19 10:19:06 +08:00
});
2023-06-07 18:25:22 +08:00
},
getProjectNumber() {
let data = {
2024-02-19 10:19:06 +08:00
projectSn: this.projectSn,
};
getProjectInfoBySn(data).then((res) => {
console.log("------------", res.result.projectNumber);
this.projectNumber = res.result.projectNumber;
});
2023-06-07 18:25:22 +08:00
},
// 全景成像测距
getPanoramicRanging() {
axios({
2024-02-19 10:19:06 +08:00
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',
2024-02-19 10:19:06 +08:00
url: `${this.$http.defaults.baseURL}${"xmgl/docking/url"}`,
2023-06-07 18:25:22 +08:00
params: {
2024-02-19 10:19:06 +08:00
projectNumber: this.projectNumber,
},
}).then((res) => {
console.log("全景成像测距", res);
let toUrl = res.data.find((item) => {
2023-06-07 18:25:22 +08:00
if (this.projectNumber == item.jinqianmaosn) {
2024-02-19 10:19:06 +08:00
return item.url;
2022-07-15 09:47:14 +08:00
}
2024-02-19 10:19:06 +08:00
});
window.open(toUrl.url);
});
2023-06-07 18:25:22 +08:00
},
2023-06-26 16:24:12 +08:00
itemClick(item, index) {
2024-02-19 10:19:06 +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)
2024-02-19 10:19:06 +08:00
if (item.moduleName == "智能安全帽系统") {
this.getSafeyHatSession();
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-----`;
2024-02-19 10:19:06 +08:00
// var publicKey = new NodeRSA(pubKey);
// var async_key = publicKey.encrypt(params, 'base64')
2023-06-07 18:25:22 +08:00
// window.open("http://58.210.96.206:91/async_danzhou.html?async_key="+async_key)
2024-02-19 10:19:06 +08:00
// // window.location.href = "http://58.210.96.206:91/async_danzhou.html?async_key="+async_key;
2022-06-28 13:46:23 +08:00
}
2024-02-19 10:19:06 +08:00
if (item.moduleName == "全景成像测距") {
this.getPanoramicRanging();
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
if (item.moduleName == "智能穿戴管理系统") {
this.getSafeyHatSession();
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
if (item.moduleName == "智能穿戴管理系统") {
return;
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
if (item.moduleName == "智能安全帽系统") {
this.getSafeyHatSession();
2022-06-08 14:51:11 +08:00
}
if (!item.operation) {
2024-02-19 10:19:06 +08:00
this.$message.error(this.$t("message.projectIndex.tips1"));
return;
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
if (
item.menuList &&
item.menuList.length > 0 &&
item.moduleName != "全景成像测距"
) {
var arr = item.menuList,
arr2 = [];
arr.forEach((element) => {
2022-06-08 14:51:11 +08:00
if (element.menuEquipment == 0) {
2024-02-19 10:19:06 +08:00
arr2.push(element);
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
});
this.$store.commit("setMenuList", arr2);
this.$store.commit("setIsShowBackIndex", true);
this.$store.commit("setMoudle", item);
if (arr2[0].target == "_blank") {
let routeUrl = "";
if (arr2[0].path.indexOf("http") != -1) {
routeUrl = arr2[0].path;
2023-06-07 18:25:22 +08:00
} else {
2022-06-08 14:51:11 +08:00
let url = this.$router.resolve({
2024-02-19 10:19:06 +08:00
path: arr2[0].path,
});
routeUrl = url.href;
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
window.open(routeUrl, "_blank");
2022-06-08 14:51:11 +08:00
} else {
2024-02-19 10:19:06 +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 {
2024-02-19 10:19:06 +08:00
this.$router.push(arr2[0].path);
2022-06-08 14:51:11 +08:00
}
}
2024-02-19 10:19:06 +08:00
} else if (
item.moduleName == "全景成像测距" ||
item.moduleName == "智能安全帽系统"
) {
this.$message.success(this.$t("message.projectIndex.tips3"));
} else {
2024-02-19 10:19:06 +08:00
this.$message.error(this.$t("message.projectIndex.tips2"));
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
window._paq.push([
"trackEvent",
"点击",
item.moduleName,
"进入" + item.moduleName,
]);
2022-06-08 14:51:11 +08:00
},
//获取详情
getDataDateils() {
let data = {
2024-02-19 10:19:06 +08:00
projectSn: this.projectSn,
};
getProjectDetail(data).then((res) => {
2022-06-08 14:51:11 +08:00
// console.log(res);
if (res.code == 200) {
2024-02-19 10:19:06 +08:00
this.projectName = res.result.projectName;
document.title = this.projectName;
this.$store.commit("setProDetail", res.result);
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
});
2022-06-08 14:51:11 +08:00
},
//为了展示未解锁产品,所以需要查询所有模块
getAllModule(half) {
2024-04-13 22:51:12 +08:00
console.log(666)
2024-04-08 19:12:10 +08:00
// 新用户功能模块
if(this.$store.state.userInfo.accountType == 10){
getNewUserAllModulePageApi({
projectSn: this.projectSn,
2024-04-13 22:51:12 +08:00
userId: this.$store.state.userInfo.userId,
moduleType: 2,
2024-04-08 19:12:10 +08:00
}).then((res) => {
if (res.success) {
var all = res.result.moduleList;
console.log("all", all);
all.forEach((element, index) => {
all[index].operation = false;
res.result.menuList.forEach((element2) => {
2024-04-13 22:51:12 +08:00
console.log(element2,77888)
2024-04-08 19:12:10 +08:00
if (element2.moduleId == element.moduleId) {
all[index].operation = true;
}
});
});
2024-04-08 20:22:14 +08:00
console.log("all111", all);
2024-04-08 19:12:10 +08:00
this.list = all;
}
});
} else {
getAllModuleApi({
2024-03-30 11:51:22 +08:00
moduleType: 2,
styleType: this.$store.state.userInfo.styleType,
}).then((res) => {
2022-06-08 14:51:11 +08:00
if (res.success) {
2024-02-19 10:19:06 +08:00
var all = res.result;
console.log("all", all);
2022-06-08 14:51:11 +08:00
all.forEach((element, index) => {
2024-02-19 10:19:06 +08:00
all[index].operation = false;
half.forEach((element2) => {
2022-06-08 14:51:11 +08:00
if (element2.moduleId == element.moduleId) {
2024-02-19 10:19:06 +08:00
all[index].operation = true;
all[index].menuList = element2.menuList;
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
});
});
this.list = all;
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
});
2024-04-08 19:12:10 +08:00
}
2022-06-08 14:51:11 +08:00
},
insertAfter(newElement, targetElement) {
// newElement是要追加的元素 targetElement 是指定元素的位置
2024-02-19 10:19:06 +08:00
var parent = targetElement.parentNode; // 找到指定元素的父节点
2022-06-08 14:51:11 +08:00
if (parent.lastChild == targetElement) {
// 判断指定元素的是否是节点中的最后一个位置 如果是的话就直接使用appendChild方法
2024-02-19 10:19:06 +08:00
parent.appendChild(newElement, targetElement);
2022-06-08 14:51:11 +08:00
} else {
2024-02-19 10:19:06 +08:00
parent.insertBefore(newElement, targetElement.nextSibling);
2022-06-08 14:51:11 +08:00
}
2024-02-19 10:19:06 +08:00
},
2022-06-08 14:51:11 +08:00
//获取项目解锁的模块
// getProjectModule(projectSn) {
// getProjectModuleList({ projectSn: this.$store.state.projectSn }).then(
// (result) => {
// if (result.success) {
2024-02-19 10:19:06 +08:00
// var half = result.result;
2022-06-08 14:51:11 +08:00
// this.getAllModule(half);
// }
// }
// );
// },
2024-02-19 10:19:06 +08:00
},
};
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);
2024-02-19 10:19:06 +08:00
font-family: "思源黑体";
2022-06-08 14:51:11 +08:00
}
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>