update code

dev-login
haha 2023-10-10 23:35:16 +08:00
parent 31ff21451f
commit af0a0131ec
6 changed files with 112 additions and 46 deletions

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;
}

View File

@ -2,9 +2,9 @@
import request from '@/utils/request'
// 查询流程表单列表
const list=(roleId)=> {
const list=()=> {
return request({
url: 'bgscreen/dept/list?roleId='+(roleId||1),
url: 'bgscreen/dept/list',
method: 'get'
})
}

View File

@ -4,12 +4,14 @@
北跨泾河-产发工程数字管理平台
</div>
<div class="head-title-tab">
<div :class="nav == 1 ? 'head-nav active' : 'head-nav'" @click="pageJump(1, '#/')">项目概况</div>
<div v-if="!isTypeBuser" :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 :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>
@ -25,6 +27,7 @@
</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>
@ -35,6 +38,7 @@
</ul>
</el-collapse-transition>
</div>
</template>
<div class="head-title-select" @mouseleave="hideScreenUlSel2" v-if="localStorage2">
<div class="head-select">
<input type="text" :value="dept2" @click="showScreenUlSel2" placeholder="请选择项目" readonly>
@ -89,6 +93,7 @@
<script>
import { mapGetters } from 'vuex'
import Cookies from 'js-cookie'
export default {
props: {
red: {
@ -100,6 +105,7 @@ export default {
},
data() {
return {
isTypeBuser: false,//,
nav: 1,
dept1: '',
dept2: '',
@ -135,16 +141,55 @@ export default {
this.setTitle();
this.timerID = setInterval(this.updateTime, 1000);
this.updateTime();
this.init();
this.$api.dept.list(this.$store.getters.roleId).then(d => {
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.$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: {
initMe() {
@ -205,13 +250,28 @@ export default {
if (!this.localStorage2) {
this.localStorage2 = {}
}
this.dept1 = this.localStorage1?.text || '';
this.dept2 = this.localStorage2?.text || '';
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() {
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])
@ -269,7 +329,9 @@ export default {
this.loadProject();
},
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;
@ -288,7 +350,7 @@ export default {
setScreenLiSel2(item, init) {
if (item) {
this.showSel2 = false;
if (!init) {
if (!init||!this.dept2) {
localStorage.setItem("data2", JSON.stringify(item))
this.localStorage2 = JSON.parse(localStorage.getItem("data2"))
this.$emit('itemdata', item);
@ -322,7 +384,8 @@ export default {
};
</script>
<style lang="less">.main-header {
<style lang="less">
.main-header {
.head-title-tab {
.has-submenu {
&:hover {

View File

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

View File

@ -66,7 +66,7 @@ const user = {
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise(async (resolve, reject) => {
let res=await getInfo()
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是否是一个非空数组
@ -85,8 +85,8 @@ const user = {
}).catch(error => {
reject(error)
})
});
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {

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 };