姜玉琦 2023-10-14 18:29:27 +08:00
commit 9fd0564069
20 changed files with 667 additions and 225 deletions

View File

@ -16,11 +16,13 @@
"emittery": "^0.8.1",
"file-saver": "2.0.5",
"js-cookie": "^3.0.5",
"nprogress": "0.2.0",
"less": "^4.1.3",
"less-loader": "^11.1.3",
"lodash.debounce": "^4.0.8",
"logt": "^1.4.1",
"vue": "^2.6.14",
"vuex": "3.6.0",
"vue-router": "^3.1.3"
},
"devDependencies": {

View File

@ -69,7 +69,7 @@ table{
-webkit-text-fill-color:transparent;
}
.head-title-tab{
width: 40% ;
max-width: 40% ;
padding-top: 23px;
display: flex;
}
@ -165,8 +165,7 @@ table{
width: 45%;
text-align: center;
}
.head-title-weather{
width: 55%;
.head-title-weather{
display: flex;
align-items: center;
}

View File

@ -8,7 +8,7 @@
<title>北跨泾河-产发工程数字管理平台-大屏</title>
<link rel="stylesheet" href="https://cdn.makalu.cc/css/element-ui/index.css">
<link rel="stylesheet" href="css/largeScreenLayout.css">
<link rel="stylesheet" href="css/largeScreenStyle.css">
<link rel="stylesheet" href="css/largeScreenStyle.css?v=2023101401">
<link rel="stylesheet" href="css/sichuanTibet.css">
<script type="text/javascript" src="http://api.map.baidu.com/api?type=webgl&v=1.0&ak=qmQNEi1qbFX628WfMt4imhdT87RbCRzK"></script>
<script src="https://cdn.makalu.cc/js/vue/vue.js"></script>

View File

@ -0,0 +1,47 @@
import request from '@/utils/request'
// 登录方法
function login(username, password, code, uuid) {
const data = {
username,
password,
code,
uuid
}
return request({
url: '/login',
headers: {
isToken: false
},
method: 'post',
data: data
})
}
// 获取用户详细信息
function getInfo() {
return request({
url: '/getInfo',
method: 'get'
})
}
// 退出方法
function logout() {
return request({
url: '/logout',
method: 'post'
})
}
export {
login,
logout,
getInfo
}
export default {
login,
logout,
getInfo
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,259 +1,381 @@
<template>
<div :class="red?'head-title red-head':'head-title'" class="main-header">
<div class="head-title-label">
<div :class="red ? 'head-title red-head' : 'head-title'" class="main-header">
<div class="head-title-label">
北跨泾河-产发工程数字管理平台
</div>
<div class="head-title-tab">
<div v-if="!isTypeBuser" :class="nav == 1 ? 'head-nav active' : 'head-nav'" @click="pageJump(1, '#/')">
</div>
<div class="head-title-tab">
<div :class="nav==1?'head-nav active':'head-nav'" @click="pageJump(1,'#/')"></div>
<div :class="nav==2?'head-nav active':'head-nav'" @click="pageJump(2,'#/detail')"></div>
<div :class="nav==3?'head-nav active':'head-nav'" @click="pageJump(3,'#/safety')"></div>
<div :class="nav==4?'head-nav active':'head-nav'" @click="pageJump(4,'#/quality')"></div>
<div :class="nav==5?'head-nav active':'head-nav'" @click="pageJump(5,'#/progress')"></div>
<div :class="nav==61||nav==62?'head-nav active':'head-nav'" style="position: relative;" class="has-submenu">
<div>视频管理</div>
<div class="header-btn-list">
<div class="header-btn-list-arrow"></div>
<div class="header-btn-list-item" style="width: 276px;"><div class="header-btn-list-padding">
<button type="button" :class="nav==61?'active':''" class="sub-btn" @click="pageJump(61,'#/video')"></button>
<button type="button" :class="nav==62?'active':''" class="sub-btn" @click="pageJump(62,'#/aiVideo')">AI</button></div></div></div>
</div>
<div :class="nav==7?'head-nav active':'head-nav'" @click="pageJump(7,'#/engin')"></div>
<div :class="nav == 2 ? 'head-nav active' : 'head-nav'" @click="pageJump(2, '#/detail')">项目详情</div>
<div :class="nav == 3 ? 'head-nav active' : 'head-nav'" @click="pageJump(3, '#/safety')">安全管理</div>
<div :class="nav == 4 ? 'head-nav active' : 'head-nav'" @click="pageJump(4, '#/quality')">质量管理</div>
<div :class="nav == 5 ? 'head-nav active' : 'head-nav'" @click="pageJump(5, '#/progress')">进度管理</div>
<div :class="nav == 61 || nav == 62 ? 'head-nav active' : 'head-nav'" style="position: relative;"
class="has-submenu">
<div>视频管理</div>
<div class="header-btn-list">
<div class="header-btn-list-arrow"></div>
<div class="header-btn-list-item" style="width: 276px;">
<div class="header-btn-list-padding">
<button type="button" :class="nav == 61 ? 'active' : ''" class="sub-btn"
@click="pageJump(61, '#/video')">视频监控</button>
<button type="button" :class="nav == 62 ? 'active' : ''" class="sub-btn"
@click="pageJump(62, '#/aiVideo')">AI识别监控</button>
</div>
</div>
</div>
</div>
<div :class="nav == 7 ? 'head-nav active' : 'head-nav'" @click="pageJump(7, '#/engin')">工程管理</div>
</div>
<template v-if="!isTypeBuser">
<div class="head-title-select" @mouseleave="hideScreenUlSel1" v-if="localStorage1">
<div class="head-select">
<input type="text" :value="dept1" @click="showScreenUlSel1" placeholder="请选择公司" readonly>
<input type="text" :value="dept1" @click="showScreenUlSel1" placeholder="请选择公司" readonly>
</div>
<el-collapse-transition>
<ul class="header-screen-ul" v-show="showSel1" ref="selectUl">
<li v-for="item in depts" @click="setScreenLiSel1(item)" :title="item.text" >{{item.text}}</li>
<li v-for="item in depts" @click="setScreenLiSel1(item)" :title="item.text">{{ item.text }}</li>
</ul>
</el-collapse-transition>
</div>
<div class="head-title-select" @mouseleave="hideScreenUlSel2" v-if="localStorage2">
<div class="head-select">
<input type="text" :value="dept2" @click="showScreenUlSel2" placeholder="请选择项目" readonly>
</div>
<el-collapse-transition>
<ul class="header-screen-ul" v-show="showSel2" ref="selectUl">
<li v-for="item in data" @click="setScreenLiSel2(item)" :title="item.text">{{item.text}}</li>
</ul>
</el-collapse-transition>
</template>
<div class="head-title-select" @mouseleave="hideScreenUlSel2" v-if="localStorage2">
<div class="head-select">
<input type="text" :value="dept2" @click="showScreenUlSel2" placeholder="请选择项目" readonly>
</div>
<div class="head-title-date">
<div class="head-title-time">
<div class="head-title-date-con">{{date}}</div>
<div class="head-title-time-con">{{time}}</div>
</div>
<div class="head-title-weather">
<img :src="condCode">
<span>{{condTxt}}</span>
<span>{{temperature}}</span>
</div>
</div>
<i class="set-fullscreen set-font-size" style="margin-left: 16px;position: absolute;top: 4px;right: 16px;" @click="toggleFullScreen">
<svg class="icon" v-if="!isFullScreen" style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3304"><path d="M145.066667 85.333333h153.6c25.6 0 42.666667-17.066667 42.666666-42.666666S324.266667 0 298.666667 0H34.133333C25.6 0 17.066667 8.533333 8.533333 17.066667 0 25.6 0 34.133333 0 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666666s42.666667-17.066667 42.666666-42.666666V145.066667l230.4 230.4c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733334L145.066667 85.333333z m170.666666 563.2L162.133333 802.133333l-76.8 76.8V725.333333C85.333333 699.733333 68.266667 682.666667 42.666667 682.666667s-42.666667 17.066667-42.666667 42.666666v256c0 25.6 17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666666-42.666667s-17.066667-42.666667-42.666666-42.666666H145.066667l76.8-76.8 153.6-153.6c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0z m665.6 34.133334c-25.6 0-42.666667 17.066667-42.666666 42.666666v153.6l-76.8-76.8-153.6-153.6c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733334l153.6 153.6 76.8 76.8H725.333333c-25.6 0-42.666667 17.066667-42.666666 42.666666s17.066667 42.666667 42.666666 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666666z m0-682.666667h-256c-25.6 0-42.666667 17.066667-42.666666 42.666667s17.066667 42.666667 42.666666 42.666666h153.6l-76.8 76.8-153.6 153.6c-17.066667 17.066667-17.066667 42.666667 0 59.733334 17.066667 17.066667 42.666667 17.066667 59.733334 0l153.6-153.6 76.8-76.8v153.6c0 25.6 17.066667 42.666667 42.666666 42.666666s42.666667-17.066667 42.666667-42.666666v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z" fill="" p-id="3305"></path></svg>
<svg class="icon" v-else style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3952"><path d="M384 597.333333h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h153.6L17.066667 947.2c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733333 0L341.333333 742.4v153.6c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z m358.4 85.333334h153.6c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667V742.4l264.533333 264.533333c17.066667 17.066667 42.666667 17.066667 59.733333 0 17.066667-17.066667 17.066667-42.666667 0-59.733333L742.4 682.666667zM640 426.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667H742.4L1006.933333 76.8c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733333 0L682.666667 281.6V128c0-25.6-17.066667-42.666667-42.666667-42.666667s-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667z m-256-341.333334c-25.6 0-42.666667 17.066667-42.666667 42.666667v153.6L76.8 8.533333C59.733333 0 25.6 0 8.533333 8.533333 0 25.6 0 59.733333 8.533333 76.8L281.6 341.333333H128c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z" p-id="3953"></path></svg>
</i>
<el-collapse-transition>
<ul class="header-screen-ul" v-show="showSel2" ref="selectUl">
<li v-for="item in data" @click="setScreenLiSel2(item)" :title="item.text">{{ item.text }}</li>
</ul>
</el-collapse-transition>
</div>
<div class="head-title-date">
<div class="head-title-time" v-if="1 == 2">
<div class="head-title-date-con">{{ date }}</div>
<div class="head-title-time-con">{{ time }}</div>
</div>
<div class="head-title-weather">
<img :src="condCode">
<span>{{ condTxt }}</span>
<span>{{ temperature }}</span>
</div>
<div class="header-title-user" style="margin-left:12px;">
{{ getName() }}
<i @click="doLogout" title="退出" style="margin-left:12px;cursor: pointer;">
<svg class="icon"
style=" width:20px;height: 20px;vertical-align: middle;fill: currentColor;overflow: hidden;"
viewBox="0 0 1072 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3432">
<path
d="M1057.279808 548.106418a47.221004 47.221004 0 0 1-7.674052 5.499737l-198.681223 199.525368a51.160351 51.160351 0 0 1-72.366316-72.340736l117.157204-117.668807L357.38063 562.763858a51.160351 51.160351 0 1 1 0-102.320701l540.713747 0.409282-119.58732-120.226824a51.160351 51.160351 0 0 1 72.366316-72.366316l199.83233 200.753216a48.09073 48.09073 0 0 1 6.574105 4.37421 54.511354 54.511354 0 0 1 0 74.719693zM972.046664 256.543579a51.160351 51.160351 0 0 1-51.160351-51.160351v-10.564612c-1.50923-72.289576-20.259499-91.85841-100.197547-92.421174l-627.430541 0.332542c-75.154555 2.148735-89.760835 24.173266-89.760835 101.885839L102.320701 157.57388l0.332543 685.369639c3.862606 61.597062 25.580175 77.968375 103.139267 77.968374l-103.088107-0.665084v1.099947l818.565612-0.409283-0.204642-66.943318-0.460443 66.227074-103.216007 0.690664c83.08441 0 102.0649-19.133971 103.59971-92.523494v-10.564612a51.160351 51.160351 0 0 1 102.320701 0L1023.386076 869.725962H1023.207015v51.160351a102.320701 102.320701 0 0 1-102.320702 102.320702h-54.357873l-709.849866 0.358122V1023.207015H102.320701a102.09048 102.09048 0 0 1-101.860258-97.767431L0 101.911419A102.03932 102.03932 0 0 1 97.74185 0.460443L921.244436 0A102.320701 102.320701 0 0 1 1023.207015 102.320701v51.160351h0.179061L1023.207015 205.383228a51.160351 51.160351 0 0 1-51.160351 51.160351zM102.320701 102.781145v0.179061l31.438036-0.204642H102.320701zM834.246259 102.320701l86.307512 0.588344 0.460443 66.227075L921.218855 102.320701z"
fill="#0090FF" p-id="3433"></path>
</svg>
</i>
</div>
</div>
<i class="set-fullscreen set-font-size" style="margin-left: 16px;position: absolute;top: 30px;right: 24px;"
@click="toggleFullScreen">
<svg class="icon" v-if="!isFullScreen"
style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3304">
<path
d="M145.066667 85.333333h153.6c25.6 0 42.666667-17.066667 42.666666-42.666666S324.266667 0 298.666667 0H34.133333C25.6 0 17.066667 8.533333 8.533333 17.066667 0 25.6 0 34.133333 0 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666666s42.666667-17.066667 42.666666-42.666666V145.066667l230.4 230.4c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733334L145.066667 85.333333z m170.666666 563.2L162.133333 802.133333l-76.8 76.8V725.333333C85.333333 699.733333 68.266667 682.666667 42.666667 682.666667s-42.666667 17.066667-42.666667 42.666666v256c0 25.6 17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666666-42.666667s-17.066667-42.666667-42.666666-42.666666H145.066667l76.8-76.8 153.6-153.6c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0z m665.6 34.133334c-25.6 0-42.666667 17.066667-42.666666 42.666666v153.6l-76.8-76.8-153.6-153.6c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733334l153.6 153.6 76.8 76.8H725.333333c-25.6 0-42.666667 17.066667-42.666666 42.666666s17.066667 42.666667 42.666666 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666666z m0-682.666667h-256c-25.6 0-42.666667 17.066667-42.666666 42.666667s17.066667 42.666667 42.666666 42.666666h153.6l-76.8 76.8-153.6 153.6c-17.066667 17.066667-17.066667 42.666667 0 59.733334 17.066667 17.066667 42.666667 17.066667 59.733334 0l153.6-153.6 76.8-76.8v153.6c0 25.6 17.066667 42.666667 42.666666 42.666666s42.666667-17.066667 42.666667-42.666666v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z"
fill="" p-id="3305"></path>
</svg>
<svg class="icon" v-else style="width: 24px; vertical-align: middle;fill: currentColor;overflow: hidden;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3952">
<path
d="M384 597.333333h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h153.6L17.066667 947.2c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733333 0L341.333333 742.4v153.6c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z m358.4 85.333334h153.6c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667h-256c-25.6 0-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667s42.666667-17.066667 42.666667-42.666667V742.4l264.533333 264.533333c17.066667 17.066667 42.666667 17.066667 59.733333 0 17.066667-17.066667 17.066667-42.666667 0-59.733333L742.4 682.666667zM640 426.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667s-17.066667-42.666667-42.666667-42.666667H742.4L1006.933333 76.8c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733333 0L682.666667 281.6V128c0-25.6-17.066667-42.666667-42.666667-42.666667s-42.666667 17.066667-42.666667 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666667z m-256-341.333334c-25.6 0-42.666667 17.066667-42.666667 42.666667v153.6L76.8 8.533333C59.733333 0 25.6 0 8.533333 8.533333 0 25.6 0 59.733333 8.533333 76.8L281.6 341.333333H128c-25.6 0-42.666667 17.066667-42.666667 42.666667s17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z"
p-id="3953"></path>
</svg>
</i>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import Cookies from 'js-cookie'
export default {
props: {
red:{
type:String
props: {
red: {
type: String
},
item:{
type:Number
item: {
type: Number
},
},
data() {
return {
nav:1,
dept1:'',
dept2:'',
showSel1:false,
showSel2:false,
data:[],
depts:[],
timerID:undefined,
isTypeBuser: false,//,
nav: 1,
dept1: '',
dept2: '',
showSel1: false,
showSel2: false,
data: [],
depts: [],
timerID: undefined,
time: '',
date: '',
week:'',
selDept:'',
week: '',
selDept: '',
localStorage1: JSON.parse(localStorage.getItem("data1")),
localStorage2: JSON.parse(localStorage.getItem("data2")),
isFullScreen:false,
temperature:20,
condTxt:'',
condCode:'',
isFullScreen: false,
temperature: 20,
condTxt: '',
condCode: '',
}
},
mounted(){
async mounted() {
window.headerApp = this
await this.initMe();
this.getWeather();
if(location.hash.indexOf("#/detail")>=0){this.nav=2;}
else if(location.hash.indexOf("#/safety")>=0){this.nav=3;}
else if(location.hash.indexOf("#/quality")>=0){this.nav=4;}
else if(location.hash.indexOf("#/progress")>=0){this.nav=5;}
else if(location.hash.indexOf("#/video")>=0){this.nav=61;}
else if(location.hash.indexOf("#/aiVideo")>=0){this.nav=62;}
else if(location.hash.indexOf("#/engin")>=0){this.nav=7;}
else{this.nav=1;}
if (location.hash.indexOf("#/detail") >= 0) { this.nav = 2; }
else if (location.hash.indexOf("#/safety") >= 0) { this.nav = 3; }
else if (location.hash.indexOf("#/quality") >= 0) { this.nav = 4; }
else if (location.hash.indexOf("#/progress") >= 0) { this.nav = 5; }
else if (location.hash.indexOf("#/video") >= 0) { this.nav = 61; }
else if (location.hash.indexOf("#/aiVideo") >= 0) { this.nav = 62; }
else if (location.hash.indexOf("#/engin") >= 0) { this.nav = 7; }
else { this.nav = 1; }
this.setTitle();
this.timerID = setInterval(this.updateTime, 1000);
this.updateTime();
this.init()
this.$api.dept.list().then(d=>{
this.$root.hasInitHeader=true;
this.depts=[{text:'产发集团',id:0},...(d?.data||[]).map(it=>{
it.text=it.deptName;
it.id=it.deptId;
return it;
})]
this.deptChange();
});
let roleId = +this.$store.getters.roleId;
Cookies.remove("__ids__");
if ([5, 6, 7, 15, 16, 17, 99].includes(roleId)) {
this.isTypeBuser = true;
if (this.$route.name == "index") {
this.$router.push("/detail");
}
this.$api.project.findProjectByDept(-1).then(d => {
let objs = (d?.data || []).map(it => {
it.text = it.projectName;
return it;
}).filter(it => +it.progressVisible == 0);
this.data = [{ id: 0, text: '所有项目' }, ...objs];
let dept={id:0,text:''};
this.$root.dept=dept;
this.$root.hasInitHeader=true;
this.$bus.$emit("deptChange", dept)
this.$root._prjIds=objs.map(it=>it.id);
Cookies.set("__ids__",objs.map(it=>it.id).join(","));
this.$bus.$emit("loadProjects", this.data);
this.$root.projects = this.data;
if (this.data.length > 0) {
this.setScreenLiSel2(this.data[0], true);
} else {
this.setScreenLiSel2(null);
}
});
} else {
this.isTypeBuser = false;
this.$api.dept.list().then(d => {
this.$root.hasInitHeader = true;
if (roleId < 3) {
this.depts = [{ text: '产发集团', id: 0 }, ...(d?.data || []).map(it => {
it.text = it.deptName;
it.id = it.deptId;
return it;
})]
} else {
this.depts = [...(d?.data || []).map(it => {
it.text = it.deptName;
it.id = it.deptId;
return it;
})]
}
this.deptChange();
});
}
this.$root.isTypeBuser = this.isTypeBuser;
this.init();
},
methods: {
getWeather(){
let url=`https://widget-api.heweather.net/s6/plugin/view?key=fcd4fc1e48a144a483b7af74284229b8&location=CN101110101&lang=zh`;
this.$api.http.get(url).then(d=>{
let info=d?.data?.now||{};
this.temperature=info.tmp||20;
this.condTxt=info.cond_txt||'晴';
this.condCode=info.cond_code||100;
this.condCode=`//widget-s.qweather.net/img/plugin/190516/icon/c/${this.condCode}n.png`
initMe() {
return new Promise(resolve => {
let func = () => {
if (!this.$store.getters.roles || this.$store.getters.roles.length == 0) {
setTimeout(func, 400);
return;
}
resolve(true);
};
func();
});
},
toggleFullScreen(){
let el=document.body;
this.$toggleFullScreen(el);
setTimeout(()=>{
this.isFullScreen=document.fullscreenElement==el;
},400);
doLogout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/';
})
}).catch(() => { });
},
init(){
try{
this.localStorage1=JSON.parse(localStorage.getItem("data1"))
this.localStorage2=JSON.parse(localStorage.getItem("data2"))
}catch(e){
getName() {
return this.$store?.getters?.nickName || '';
},
getWeather() {
let url = `https://widget-api.heweather.net/s6/plugin/view?key=fcd4fc1e48a144a483b7af74284229b8&location=CN101110101&lang=zh`;
this.$api.http.get(url).then(d => {
let info = d?.data?.now || {};
this.temperature = info.tmp || 20;
this.condTxt = info.cond_txt || '晴';
this.condCode = info.cond_code || 100;
this.condCode = `//widget-s.qweather.net/img/plugin/190516/icon/c/${this.condCode}n.png`
});
},
toggleFullScreen() {
let el = document.body;
this.$toggleFullScreen(el);
setTimeout(() => {
this.isFullScreen = document.fullscreenElement == el;
}, 400);
},
init() {
try {
this.localStorage1 = JSON.parse(localStorage.getItem("data1"))
this.localStorage2 = JSON.parse(localStorage.getItem("data2"))
} catch (e) {
}
if(!this.localStorage1){
this.localStorage1={
if (!this.localStorage1) {
this.localStorage1 = {
}
}
if(!this.localStorage2){
this.localStorage2={}
if (!this.localStorage2) {
this.localStorage2 = {}
}
this.dept1=this.localStorage1?.text||'';
this.dept2=this.localStorage2?.text||'';
if(this.dept1){
let tmp=this.localStorage1?.text || '';
if(!tmp || !this.depts.find(d=>d.text==tmp)){
if(this.depts.length>0){
tmp=this.depts[0].text;
}else{
tmp="";
}
}
this.dept1 = tmp;
this.dept2 = tmp;
if (this.dept1) {
this.loadProject(true);
}
},
deptChange(){
let tmps=this.depts.filter(d=>d.text==this.dept1);
if(tmps.length>0){
this.$bus.$emit("deptChange",tmps[0])
this.$root.dept=tmps[0];
deptChange() {
if(!this.dept1){
if(this.depts.length>0){
this.dept1=this.depts[0].text;
this.loadProject(true);
}
}
let tmps = this.depts.filter(d => d.text == this.dept1);
if (tmps.length > 0) {
this.$bus.$emit("deptChange", tmps[0])
this.$root.dept = tmps[0];
}
},
setTitle(){
let titls=['','项目概况','项目详情','安全管理','质量管理','进度管理','视频管理','工程管理']
let title=titls[this.nav];
if(title){
window.document.title=title;
}else{
window.document.title='北跨泾河-产发工程数字管理平台-大屏';
}
setTitle() {
let titls = ['', '项目概况', '项目详情', '安全管理', '质量管理', '进度管理', '视频管理', '工程管理']
let title = titls[this.nav];
if (title) {
window.document.title = title;
} else {
window.document.title = '北跨泾河-产发工程数字管理平台-大屏';
}
},
//
pageJump(n,url){
this.nav=n;
this.setTitle();
if(url){
location.href = url
}else{
this.$notify({
title: '提示',
message: '页面开发中,敬请期待!',
type: 'warning'
});
}
pageJump(n, url) {
this.nav = n;
this.setTitle();
if (url) {
location.href = url
} else {
this.$notify({
title: '提示',
message: '页面开发中,敬请期待!',
type: 'warning'
});
}
},
showScreenUlSel1(){
showScreenUlSel1() {
this.showSel1 = true
},
showScreenUlSel2(){
showScreenUlSel2() {
this.showSel2 = true
},
hideScreenUlSel1(){
hideScreenUlSel1() {
this.showSel1 = false
},
hideScreenUlSel2(){
hideScreenUlSel2() {
this.showSel2 = false
},
setScreenLiSel1(item){
localStorage.setItem("data1",JSON.stringify(item))
this.localStorage1=JSON.parse(localStorage.getItem("data1"))
this.$emit('itemdata',item);
setScreenLiSel1(item) {
localStorage.setItem("data1", JSON.stringify(item))
this.localStorage1 = JSON.parse(localStorage.getItem("data1"))
this.$emit('itemdata', item);
this.showSel1 = false
this.dept1=item.text;
this.dept1 = item.text;
this.deptChange();
this.loadProject();
},
loadProject(init){
this.$api.project.findProjectByDept( this.localStorage1.id).then(d=>{
let objs=(d?.data||[]).map(it=>{
it.text=it.projectName;
return it;
}).filter(it=>+it.progressVisible==0);
this.data=[{id:0,text:'所有项目'},...objs];
this.$bus.$emit("loadProjects",this.data);
this.$root.projects=this.data;
if(this.data.length>0){
this.setScreenLiSel2(this.data[0],init);
}else{
this.setScreenLiSel2(null);
loadProject(init) {
if (this.isTypeBuser) {
return;
}
this.$api.project.findProjectByDept(this.localStorage1.id).then(d => {
let objs = (d?.data || []).map(it => {
it.text = it.projectName;
return it;
}).filter(it => +it.progressVisible == 0);
this.data = [{ id: 0, text: '所有项目' }, ...objs];
this.$bus.$emit("loadProjects", this.data);
this.$root.projects = this.data;
if (this.data.length > 0) {
this.setScreenLiSel2(this.data[0], init);
} else {
this.setScreenLiSel2(null);
}
});
});
},
setScreenLiSel2(item,init){
if(item){
setScreenLiSel2(item, init) {
if (item) {
this.showSel2 = false;
if(!init){
localStorage.setItem("data2",JSON.stringify(item))
this.localStorage2=JSON.parse(localStorage.getItem("data2"))
this.$emit('itemdata',item);
this.dept2=item.text;
if (!init||!this.dept2) {
localStorage.setItem("data2", JSON.stringify(item))
this.localStorage2 = JSON.parse(localStorage.getItem("data2"))
this.$emit('itemdata', item);
this.dept2 = item.text;
}
this.$root.project=this.localStorage2;
this.$bus.$emit("projectChange",this.localStorage2);
}else{
this.$root.project = this.localStorage2;
this.$bus.$emit("projectChange", this.localStorage2);
} else {
localStorage.removeItem("data2");
this.localStorage2={};
this.localStorage2 = {};
this.showSel2 = false;
this.dept2='';
this.dept2 = '';
}
},
//
updateTime(){
updateTime() {
var cd = new Date();
this.time = this.zeroPadding(cd.getHours(), 2) + ':' + this.zeroPadding(cd.getMinutes(), 2) + ':' + this.zeroPadding(cd.getSeconds(), 2);
this.date = this.zeroPadding(cd.getFullYear(), 4) + '年' + this.zeroPadding(cd.getMonth()+1, 2) + '月' + this.zeroPadding(cd.getDate(), 2)+'日';
this.date = this.zeroPadding(cd.getFullYear(), 4) + '年' + this.zeroPadding(cd.getMonth() + 1, 2) + '月' + this.zeroPadding(cd.getDate(), 2) + '日';
},
zeroPadding(num, digit) {
var zero = '';
for(var i = 0; i < digit; i++) {
for (var i = 0; i < digit; i++) {
zero += '0';
}
return (zero + num).slice(-digit);
@ -264,27 +386,28 @@ export default {
</script>
<style lang="less">
.main-header{
.head-title-tab{
.has-submenu{
&:hover{
.header-btn-list{
.main-header {
.head-title-tab {
.has-submenu {
&:hover {
.header-btn-list {
display: block;
}
}
}
.header-btn-list{
display: none;
.header-btn-list-item{
.sub-btn{
&.active{
color:#fff;
.header-btn-list {
display: none;
.header-btn-list-item {
.sub-btn {
&.active {
color: #fff;
}
}
}
}
}
}
}
}
</style>
}</style>

View File

@ -1,11 +1,14 @@
import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'
import './permission'
import './pages/init.js'
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')

View File

@ -463,7 +463,10 @@ export default {
},
mounted() {
window.xapp = this;
this.$nextTick(() => {
this.$nextTick(() => {
if(this.$root.isTypeBuser){
this.$router.push("/detail");
}
this.loading = true;
});
this.$bus.$on("loadProjects", debounce(prjs => {

View File

@ -485,22 +485,50 @@ export default {
}
});
} else {
//
this.$api.attendance.getWorkAttendanceList(this.dept?.id||0,this.projectInfo?.id||0).then(d => {
this.laborPersonnelTotal=0;
this.laborPersonnelData=[{text: "劳务人员", value: 0},{text: "监理人员", value: 0},{text: "总包人员", value: 0}];
if(d.rows.length>0 && d.rows[0]!=null){
this.laborPersonnelData=[];
this.laborPersonnelTotal += d.rows[0].servicePersonnel;
this.laborPersonnelData.push({text: "劳务人员", value: d.rows[0].servicePersonnel});
this.laborPersonnelTotal += d.rows[0].supervisorPersonnel;
this.laborPersonnelData.push({text: "监理人员", value: d.rows[0].supervisorPersonnel});
this.laborPersonnelTotal += d.rows[0].contractorPersonnel;
this.laborPersonnelData.push({text: "总包人员", value: d.rows[0].contractorPersonnel});
}
});
this.loadAttendanceData();
}
},
getProjectId(cb) {
let func = () => {
let prjId = this.projectInfo?.id||0;
if (prjId == 0) {
if (!this.projects||this.projects.length == 0) {
setTimeout(func, 100);
} else {
cb && cb(this.projects[1].id);
}
} else {
cb && cb(prjId);
}
}
func();
},
loadAttendanceData(){
this.getProjectId(id => {
let data={
subDeptId:this.dept.id||0,
projectId:id||0,
attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD")
}
this.$api.attendance.groupByComany(data).then(d=>{
let tmps=d.data||[];
const func=(ids)=>{
let sum=0;
tmps.filter(it=>ids.includes(it.companyTypeId)).map(it=>it.id).forEach(it=>{
sum+=it*1;
})
return sum;
}
this.laborPersonnelTotal = 0;
this.laborPersonnelData = [{ text: "劳务人员", value: func(["2","3"]) }, { text: "监理人员", value: func(["8"]) }, { text: "总包人员", value: func(["1"]) }];
this.laborPersonnelData.forEach(it=>{
this.laborPersonnelTotal += it.value;
})
this.elDeptWorks++;
});
});
},
getProjectInsuranceList(){
this.$api.insurance.getProjectInsuranceList(this.dept?.id||0,this.projectInfo?.id||0).then(d => {
this.insuranceDataList=[];

View File

@ -89,7 +89,7 @@
</el-col>
<el-col :span="fontSize==2?12:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">送检时间:</span>
<div class="div-text">{{ it.checkTime|dateFormat }}</div>
<div class="div-text">{{ it.checkTime|formatDate }}</div>
</el-col>
<el-col :span="fontSize==2?12:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">检测结果:</span>
@ -107,7 +107,7 @@
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">提交时间:</span>
<div class="div-text">{{ it.createTime|dateFormat }}</div>
<div class="div-text">{{ it.createTime|formatDate }}</div>
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data" v-if="it.updateBy">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">登记结果用户:</span>
@ -115,7 +115,7 @@
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data" v-if="it.updateTime">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">登记结果时间:</span>
<div class="div-text">{{ it.updateTime|dateFormat }}</div>
<div class="div-text">{{ it.updateTime|formatDate }}</div>
</el-col>
</div>
</div>

View File

@ -70,7 +70,7 @@
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">测量时间:</span>
<div class="div-text">{{ it.measureTime|dateFormat }}</div>
<div class="div-text">{{ it.measureTime|formatDate }}</div>
</el-col>
<el-col :span="fontSize==2?12:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">测量点位:</span>
@ -97,7 +97,7 @@
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">提交时间:</span>
<div class="div-text">{{ it.createTime|dateFormat }}</div>
<div class="div-text">{{ it.createTime|formatDate }}</div>
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data" v-if="it.updateBy">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">登记结果用户:</span>
@ -105,7 +105,7 @@
</el-col>
<el-col :span="fontSize==2?24:12" class="item-data" v-if="it.updateTime">
<img src="images/title_icon.png"><span class="sp-lbl sp-lbl2">登记结果时间:</span>
<div class="div-text">{{ it.updateTime|dateFormat }}</div>
<div class="div-text">{{ it.updateTime|formatDate }}</div>
</el-col>
</div>
</div>

View File

@ -131,4 +131,20 @@
}
}
}
}
.el-message-box{
background-color: rgba(1, 169, 255,0.5);
border: solid 1px rgba(1, 169, 255,1);
}
.el-message-box__title{
color: #000;
}
.el-message-box__btns{
text-align: center;
}
.el-message-box__content{
color: #fff;
}
.head-title-tab{
white-space: nowrap;
}

57
src/permission.js 100644
View File

@ -0,0 +1,57 @@
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
const whiteList = []
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
} else {
if (store.getters.roles.length === 0) {
isRelogin.show = true
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
next();
}).catch(err => {
store.dispatch('LogOut').then(() => {
Message.error(err)
next({ path: '/' })
})
})
} else {
next()
}
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
//next(`/login?redirect=#/index`) // 否则全部重定向到登录页
let base="/";
if(location.host.indexOf("localhost")>=0){
base="/jhapp/"
}
location.href=base+"#/login?redirect=/jhbs/#/";
NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done()
})

View File

@ -0,0 +1,13 @@
const getters = {
token: state => state.user.token,
avatar: state => state.user.avatar,
userId: state => state.user.userId,
name: state => state.user.name,
dept:state=>state.user.dept,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
nickName:state=>state.user.nickName,
roleId:state=>state.user.roleId,
permissions: state => state.user.permissions,
}
export default getters

17
src/store/index.js 100644
View File

@ -0,0 +1,17 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import getters from './getters'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
user
},
getters
})
export default store

View File

@ -0,0 +1,118 @@
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
state: {
token: getToken(),
userId:'',
name: '',
nickName:'',
roleId:0,
avatar: '',
dept:null,
roles: [],
permissions: []
},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
},
SET_USER_ID: (state, id) => {
state.userId = id
},
SET_NAME: (state, name) => {
state.name = name
},
SET_NICKNAME: (state, nickName) => {
state.nickName = nickName
},
SET_ROLEID: (state, roleId) => {
state.roleId = roleId
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
SET_DEPT: (state, dept) => {
state.dept = dept
}
},
actions: {
// 登录
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise(async (resolve, reject) => {
getInfo().then(res=>{
const user = res.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.png") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_USER_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_NICKNAME', user.nickName)
commit('SET_ROLEID', res.roleId)
commit("SET_DEPT",user.dept);
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
})
});
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit("SET_DEPT",null);
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
removeToken()
resolve()
}).catch(error => {
reject(error)
})
})
},
// 前端 登出
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()
resolve()
})
}
}
}
export default user

View File

@ -5,7 +5,7 @@ import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver'
import Cookies from 'js-cookie'
let downloadLoadingInstance;
// 是否显示重新登录
export let isRelogin = { show: false };
@ -20,7 +20,7 @@ const service = axios.create({
})
// request拦截器
service.interceptors.request.use(config => {
service.interceptors.request.use(config => {
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
@ -35,7 +35,7 @@ service.interceptors.request.use(config => {
config.params = {};
config.url = url;
}
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
@ -51,7 +51,6 @@ service.interceptors.request.use(config => {
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
//console.warn(`[${s_url}]: ` + message+",",config,s_url)
console.warn("--->",s_data,requestObj.data,s_url)
return Promise.reject(new Error(message))
} else {
@ -81,7 +80,7 @@ service.interceptors.response.use(res => {
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false;
if(location.href.indexOf("localhost")>=0){
//location.href = `/#/login?redirect=${encodeURIComponent("http://localhost:3000/jhbs/")}`;
//location.href = `/#/login?redirect=${encodeURIComponent("/jhbs/")}`;
location.href=`http://localhost/#/login?redirect=${encodeURI('http://localhost:3000/jhbs/')}`
}else{
location.href = `/#/login?redirect=${encodeURIComponent("/jhbs/")}`;

View File

@ -1,7 +1,7 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath :'./' ,
publicPath :'/jhbs' ,
productionSourceMap:false,
devServer: {
host: '0.0.0.0',
@ -15,6 +15,13 @@ module.exports = defineConfig({
'^/jhapi/profile':'/'
}
},
'/jhapp':{
target: `http://62.234.3.186/`,
changeOrigin: true,
pathRewrite: {
'^/jhapp':'/'
}
},
'/cesium':{
target: `http://62.234.3.186/cesium/`,
changeOrigin: true,
@ -23,8 +30,8 @@ module.exports = defineConfig({
}
},
'/jhapi':{
target: `http://62.234.3.186/jhapi/`,
//target: `http://127.0.0.1:8090/jhapi/`,
//target: `http://62.234.3.186/jhapi/`,
target: `http://127.0.0.1:8090/jhapi/`,
changeOrigin: true,
pathRewrite: {
'^/jhapi':'/'

View File

@ -4450,6 +4450,11 @@ npm-run-path@^4.0.1:
dependencies:
path-key "^3.0.0"
nprogress@0.2.0:
version "0.2.0"
resolved "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"
integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==
nth-check@^2.0.1:
version "2.1.1"
resolved "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz"
@ -6001,6 +6006,11 @@ vue@^2.6.14:
"@vue/compiler-sfc" "2.7.14"
csstype "^3.1.0"
vuex@3.6.0:
version "3.6.0"
resolved "https://registry.npmmirror.com/vuex/-/vuex-3.6.0.tgz#95efa56a58f7607c135b053350833a09e01aa813"
integrity sha512-W74OO2vCJPs9/YjNjW8lLbj+jzT24waTo2KShI8jLvJW8OaIkgb3wuAMA7D+ZiUxDOx3ubwSZTaJBip9G8a3aQ==
watchpack@^2.4.0:
version "2.4.0"
resolved "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.0.tgz"