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; -webkit-text-fill-color:transparent;
} }
.head-title-tab{ .head-title-tab{
width: 40% ; max-width: 40% ;
padding-top: 23px; padding-top: 23px;
display: flex; display: flex;
} }

View File

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

View File

@ -4,12 +4,14 @@
北跨泾河-产发工程数字管理平台 北跨泾河-产发工程数字管理平台
</div> </div>
<div class="head-title-tab"> <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 == 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 == 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 == 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 == 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>视频管理</div>
<div class="header-btn-list"> <div class="header-btn-list">
<div class="header-btn-list-arrow"></div> <div class="header-btn-list-arrow"></div>
@ -25,16 +27,18 @@
</div> </div>
<div :class="nav == 7 ? 'head-nav active' : 'head-nav'" @click="pageJump(7, '#/engin')">工程管理</div> <div :class="nav == 7 ? 'head-nav active' : 'head-nav'" @click="pageJump(7, '#/engin')">工程管理</div>
</div> </div>
<div class="head-title-select" @mouseleave="hideScreenUlSel1" v-if="localStorage1"> <template v-if="!isTypeBuser">
<div class="head-select"> <div class="head-title-select" @mouseleave="hideScreenUlSel1" v-if="localStorage1">
<input type="text" :value="dept1" @click="showScreenUlSel1" placeholder="请选择公司" readonly> <div class="head-select">
<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>
</ul>
</el-collapse-transition>
</div> </div>
<el-collapse-transition> </template>
<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>
</ul>
</el-collapse-transition>
</div>
<div class="head-title-select" @mouseleave="hideScreenUlSel2" v-if="localStorage2"> <div class="head-title-select" @mouseleave="hideScreenUlSel2" v-if="localStorage2">
<div class="head-select"> <div class="head-select">
<input type="text" :value="dept2" @click="showScreenUlSel2" placeholder="请选择项目" readonly> <input type="text" :value="dept2" @click="showScreenUlSel2" placeholder="请选择项目" readonly>
@ -89,6 +93,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Cookies from 'js-cookie'
export default { export default {
props: { props: {
red: { red: {
@ -100,6 +105,7 @@ export default {
}, },
data() { data() {
return { return {
isTypeBuser: false,//,
nav: 1, nav: 1,
dept1: '', dept1: '',
dept2: '', dept2: '',
@ -135,29 +141,68 @@ export default {
this.setTitle(); this.setTitle();
this.timerID = setInterval(this.updateTime, 1000); this.timerID = setInterval(this.updateTime, 1000);
this.updateTime(); this.updateTime();
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(); this.init();
this.$api.dept.list(this.$store.getters.roleId).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();
});
}, },
methods: { methods: {
initMe(){ initMe() {
return new Promise(resolve=>{ return new Promise(resolve => {
let func=()=>{ let func = () => {
if(!this.$store.getters.roles||this.$store.getters.roles.length==0){ if (!this.$store.getters.roles || this.$store.getters.roles.length == 0) {
setTimeout(func,400); setTimeout(func, 400);
return; return;
} }
resolve(true); resolve(true);
}; };
func(); func();
}); });
}, },
doLogout() { doLogout() {
this.$confirm('确定注销并退出系统吗?', '提示', { this.$confirm('确定注销并退出系统吗?', '提示', {
@ -205,13 +250,28 @@ export default {
if (!this.localStorage2) { if (!this.localStorage2) {
this.localStorage2 = {} this.localStorage2 = {}
} }
this.dept1 = this.localStorage1?.text || ''; let tmp=this.localStorage1?.text || '';
this.dept2 = this.localStorage2?.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) { if (this.dept1) {
this.loadProject(true); this.loadProject(true);
} }
}, },
deptChange() { 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); let tmps = this.depts.filter(d => d.text == this.dept1);
if (tmps.length > 0) { if (tmps.length > 0) {
this.$bus.$emit("deptChange", tmps[0]) this.$bus.$emit("deptChange", tmps[0])
@ -269,7 +329,9 @@ export default {
this.loadProject(); this.loadProject();
}, },
loadProject(init) { loadProject(init) {
if (this.isTypeBuser) {
return;
}
this.$api.project.findProjectByDept(this.localStorage1.id).then(d => { this.$api.project.findProjectByDept(this.localStorage1.id).then(d => {
let objs = (d?.data || []).map(it => { let objs = (d?.data || []).map(it => {
it.text = it.projectName; it.text = it.projectName;
@ -288,7 +350,7 @@ export default {
setScreenLiSel2(item, init) { setScreenLiSel2(item, init) {
if (item) { if (item) {
this.showSel2 = false; this.showSel2 = false;
if (!init) { if (!init||!this.dept2) {
localStorage.setItem("data2", JSON.stringify(item)) localStorage.setItem("data2", JSON.stringify(item))
this.localStorage2 = JSON.parse(localStorage.getItem("data2")) this.localStorage2 = JSON.parse(localStorage.getItem("data2"))
this.$emit('itemdata', item); this.$emit('itemdata', item);
@ -322,7 +384,8 @@ export default {
}; };
</script> </script>
<style lang="less">.main-header { <style lang="less">
.main-header {
.head-title-tab { .head-title-tab {
.has-submenu { .has-submenu {
&:hover { &:hover {

View File

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

View File

@ -66,7 +66,7 @@ const user = {
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
let res=await getInfo() getInfo().then(res=>{
const user = res.user const user = res.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.png") : process.env.VUE_APP_BASE_API + user.avatar; 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是否是一个非空数组 if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
@ -85,8 +85,8 @@ const user = {
}).catch(error => { }).catch(error => {
reject(error) reject(error)
}) })
}, });
},
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -5,7 +5,7 @@ import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi"; import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from '@/plugins/cache' import cache from '@/plugins/cache'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import Cookies from 'js-cookie'
let downloadLoadingInstance; let downloadLoadingInstance;
// 是否显示重新登录 // 是否显示重新登录
export let isRelogin = { show: false }; export let isRelogin = { show: false };
@ -20,7 +20,7 @@ const service = axios.create({
}) })
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// 是否需要设置 token // 是否需要设置 token
const isToken = (config.headers || {}).isToken === false const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交 // 是否需要防止数据重复提交
@ -35,7 +35,7 @@ service.interceptors.request.use(config => {
config.params = {}; config.params = {};
config.url = url; config.url = url;
} }
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = { const requestObj = {
url: config.url, url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,