Browse Source

Merge branch 'dev-chaxun' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev-chaxun

shibei_master
jiangyy 4 years ago
parent
commit
76f4c90a0e
  1. 48
      src/assets/scss/common.scss
  2. 2
      src/js/store/index.js
  3. 89
      src/main.js
  4. 2
      src/views/main-content.vue
  5. 143
      src/views/main.vue

48
src/assets/scss/common.scss

@ -4,8 +4,8 @@
box-sizing: border-box;
}
body {
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial,
sans-serif;
font-size: $--font-size-base;
line-height: $base--line-height;
color: $--color-text-primary;
@ -35,7 +35,7 @@ img {
}
.clearfix:before,
.clearfix:after {
content: ' ';
content: " ";
display: table;
}
.clearfix:after {
@ -144,8 +144,8 @@ img {
background-color: transparent;
}
&-add {
> span > *[class*='el-icon-'],
> span > *[class*='icon'] {
> span > *[class*="el-icon-"],
> span > *[class*="icon"] {
vertical-align: middle;
font-size: 18px;
margin-right: 5px;
@ -201,6 +201,12 @@ img {
.aui-wrapper {
position: relative;
padding-top: $navbar--height;
&.z-iframe {
padding-top: 0;
.aui-content--tabs {
padding-top: 0;
}
}
}
/* Sidebar fold
@ -383,7 +389,7 @@ img {
&::after {
position: absolute;
content: '';
content: "";
right: 0;
top: 0;
bottom: 0;
@ -448,8 +454,8 @@ img {
}
}
&__search {
> *[class*='el-icon-'],
> *[class*='icon'] {
> *[class*="el-icon-"],
> *[class*="icon"] {
display: inline-block;
vertical-align: middle;
}
@ -572,9 +578,7 @@ img {
min-height: calc(#{$content--fill-height} - 2px);
}
> .aui-card--fill > .el-card__header + .el-card__body {
min-height: calc(
#{$content--fill-height} - #{$content--card-header-height} - 2px
);
min-height: calc(#{$content--fill-height} - #{$content--card-header-height} - 2px);
}
&--tabs {
padding: $content--tabs-header-height 0 0;
@ -646,7 +650,7 @@ img {
position: absolute;
bottom: 0;
left: 0;
content: '';
content: "";
width: 100%;
height: 2px;
background-color: $--color-primary;
@ -679,15 +683,10 @@ img {
min-height: calc(#{$content--fill-height-tabs} - 2px);
}
> .aui-card--fill > .el-card__header + .el-card__body {
min-height: calc(
#{$content--fill-height-tabs} - #{$content--card-header-height} -
2px
);
min-height: calc(#{$content--fill-height-tabs} - #{$content--card-header-height} - 2px);
}
&.is-iframe {
height: calc(
#{$content--fill-height-tabs} + #{$content--padding * 2}
);
height: calc(#{$content--fill-height-tabs} + #{$content--padding * 2});
margin: -$content--padding;
min-height: auto;
> .aui-card--fill {
@ -706,10 +705,7 @@ img {
background-color: #fff;
}
> .aui-card--fill > .el-card__header + .el-card__body {
height: calc(
#{$content--fill-height-tabs} - #{$content--card-header-height} -
2px
);
height: calc(#{$content--fill-height-tabs} - #{$content--card-header-height} - 2px);
}
}
}
@ -739,7 +735,7 @@ img {
/* Page
------------------------------ */
*[class*='aui-page__'] {
*[class*="aui-page__"] {
padding-top: 0;
.aui-content {
min-height: auto;
@ -751,9 +747,7 @@ img {
min-height: calc(100vh - #{$content--padding * 2} - 2px);
}
> .aui-card--fill > .el-card__header + .el-card__body {
min-height: calc(
100vh - #{$content--padding * 2} - #{$content--card-header-height} - 2px
);
min-height: calc(100vh - #{$content--padding * 2} - #{$content--card-header-height} - 2px);
}
}
}

2
src/js/store/index.js

@ -37,6 +37,8 @@ export default new Vuex.Store({
menuList: [],
activeName: "",
},
inIframe: window.self !== window.top,
},
modules: {
user,

89
src/main.js

@ -1,69 +1,76 @@
import Vue from 'vue'
import Element from 'element-ui'
import Vue from "vue";
import Element from "element-ui";
import App from '@/App'
import i18n from '@/i18n'
import router from '@/router'
import App from "@/App";
import i18n from "@/i18n";
import router from "@/router";
// import store1 from '@/store'
import '@/icons'
import '@/element-ui/theme/index.css'
import '@/assets/scss/aui.scss'
import http from '@/utils/request'
import renRadioGroup from '@/components/ren-radio-group'
import renSelect from '@/components/ren-select'
import renProcessMultiple from '@/components/ren-process-multiple'
import renProcessStart from '@/components/ren-process-start'
import renProcessRunning from '@/components/ren-process-running'
import renProcessDetail from '@/components/ren-process-detail'
import renDeptTree from '@/components/ren-dept-tree'
import renRegionTree from '@/components/ren-region-tree'
import cloneDeep from 'lodash/cloneDeep'
import "@/icons";
import "@/element-ui/theme/index.css";
import "@/assets/scss/aui.scss";
import http from "@/utils/request";
import renRadioGroup from "@/components/ren-radio-group";
import renSelect from "@/components/ren-select";
import renProcessMultiple from "@/components/ren-process-multiple";
import renProcessStart from "@/components/ren-process-start";
import renProcessRunning from "@/components/ren-process-running";
import renProcessDetail from "@/components/ren-process-detail";
import renDeptTree from "@/components/ren-dept-tree";
import renRegionTree from "@/components/ren-region-tree";
import cloneDeep from "lodash/cloneDeep";
// axios封装
import ajax from '@/js/ajax'
import ajax from "@/js/ajax";
// service
import service from '@/js/service'
import service from "@/js/service";
// vuex处理多个组件共享状态
import store from '@/js/store'
import store from "@/js/store";
//系统工具
import util from '@js/util'
import util from "@js/util";
import Cookies from "js-cookie";
import getQueryPara from "dai-js/modules/getQueryPara";
// 兼容token传参登录
if (getQueryPara("token")) {
Cookies.set("token", getQueryPara("token"));
}
window.app = Object.assign(
{},
{
util,
ajax,
service
service,
}
)
);
Vue.config.productionTip = false
Vue.config.productionTip = false;
Vue.use(renRadioGroup)
Vue.use(renSelect)
Vue.use(renDeptTree)
Vue.use(renRegionTree)
Vue.use(renProcessMultiple)
Vue.use(renProcessStart)
Vue.use(renProcessRunning)
Vue.use(renProcessDetail)
Vue.use(Element)
Vue.use(renRadioGroup);
Vue.use(renSelect);
Vue.use(renDeptTree);
Vue.use(renRegionTree);
Vue.use(renProcessMultiple);
Vue.use(renProcessStart);
Vue.use(renProcessRunning);
Vue.use(renProcessDetail);
Vue.use(Element);
Vue.use(Element, {
size: 'default',
i18n: (key, value) => i18n.t(key, value)
})
size: "default",
i18n: (key, value) => i18n.t(key, value),
});
// 挂载全局
Vue.prototype.$http = http
Vue.prototype.$http = http;
// Vue.prototype.$getDictLabel = getDictLabel
// 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)
window.SITE_CONFIG["storeState"] = cloneDeep(store.state);
new Vue({
i18n,
router,
store,
render: (h) => h(App)
}).$mount('#app')
render: (h) => h(App),
}).$mount("#app");

2
src/views/main-content.vue

@ -1,7 +1,7 @@
<template>
<main :class="['aui-content', { 'aui-content--tabs': $route.meta.isTab }]">
<!-- tab展示内容 -->
<template v-if="$route.meta.isTab">
<template v-if="$route.meta.isTab && !$store.state.inIframe">
<el-dropdown class="aui-content--tabs-tools">
<i class="el-icon-arrow-down"></i>
<el-dropdown-menu slot="dropdown"

143
src/views/main.vue

@ -7,186 +7,187 @@
{ 'aui-sidebar--fold': $store.state.sidebarFold },
{
'aui-sidebar--noside':
$store.state.sidebarActiveSubMenuList.length == 0
}
$store.state.sidebarActiveSubMenuList.length == 0,
},
{ 'z-iframe': $store.state.inIframe },
]"
>
<template v-if="!loading">
<main-navbar ref="ref_navbar" />
<main-sidebar />
<main-navbar ref="ref_navbar" v-if="!$store.state.inIframe" />
<main-sidebar v-if="!$store.state.inIframe" />
<div class="aui-content__wrapper">
<main-content
v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName"
/>
</div>
<main-theme-tools />
<main-theme-tools v-if="!$store.state.inIframe" />
</template>
</div>
</template>
<script>
import MainNavbar from './main-navbar'
import MainSidebar from './main-sidebar'
import MainContent from './main-content'
import MainThemeTools from './main-theme-tools'
import debounce from 'lodash/debounce'
import { mapGetters } from 'vuex'
import nextTick from 'dai-js/tools/nextTick'
import MainNavbar from "./main-navbar";
import MainSidebar from "./main-sidebar";
import MainContent from "./main-content";
import MainThemeTools from "./main-theme-tools";
import debounce from "lodash/debounce";
import { mapGetters } from "vuex";
import nextTick from "dai-js/tools/nextTick";
export default {
provide() {
return {
//
refresh() {
this.$store.state.contentIsNeedRefresh = true
this.$store.state.contentIsNeedRefresh = true;
this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false
})
}
}
this.$store.state.contentIsNeedRefresh = false;
});
},
};
},
data() {
return {
loading: true,
userType: localStorage.getItem('userType')
}
userType: localStorage.getItem("userType"),
};
},
components: {
MainNavbar,
MainSidebar,
MainContent,
MainThemeTools
MainThemeTools,
},
watch: {
$route: 'routeHandle'
$route: "routeHandle",
},
async created() {
this.windowResizeHandle()
this.routeHandle(this.$route)
if (localStorage.getItem('userType') === 'work') {
this.windowResizeHandle();
this.routeHandle(this.$route);
if (localStorage.getItem("userType") === "work") {
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false
})
this.loading = false;
});
} else {
Promise.all([this.getUserInfo()]).then(() => {
this.loading = false
})
this.loading = false;
});
}
},
computed: {},
methods: {
changeCustomerName(customerName) {
this.$refs['ref_navbar'].changeCustomerName(customerName)
this.$refs["ref_navbar"].changeCustomerName(customerName);
},
//
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement['clientWidth'] <= 992 || false
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener(
'resize',
"resize",
debounce(() => {
this.$store.state.sidebarFold =
document.documentElement['clientWidth'] <= 992 || false
document.documentElement["clientWidth"] <= 992 || false;
}, 150)
)
);
},
// ,
routeHandle(route) {
if (!route.meta.isTab) {
return false
return false;
}
var tab = this.$store.state.contentTabs.filter(
(item) => item.name === route.name
)[0]
)[0];
if (!tab) {
tab = {
...window.SITE_CONFIG['contentTabDefault'],
...window.SITE_CONFIG["contentTabDefault"],
...route.meta,
name: route.name,
params: { ...route.params },
query: { ...route.query }
}
query: { ...route.query },
};
this.$store.state.contentTabs =
this.$store.state.contentTabs.concat(tab)
this.$store.state.contentTabs.concat(tab);
}
this.$store.state.sidebarMenuActiveName = tab.menuId
this.$store.state.contentTabsActiveName = tab.name
this.syncLevelOneMenuActive(tab.menuId)
this.$store.state.sidebarMenuActiveName = tab.menuId;
this.$store.state.contentTabsActiveName = tab.name;
this.syncLevelOneMenuActive(tab.menuId);
},
async syncLevelOneMenuActive(menuId) {
await nextTick()
await nextTick();
console.log(
'*******************************',
"*******************************",
menuId,
this.$store.state.sidebarMenuList
)
);
const fn = (item) => {
if (item.id == menuId) {
return true
return true;
} else if (item.children.length > 0) {
return item.children.findIndex(fn) !== -1
return item.children.findIndex(fn) !== -1;
} else {
return false
return false;
}
}
let idx = this.$store.state.sidebarMenuList.findIndex(fn)
};
let idx = this.$store.state.sidebarMenuList.findIndex(fn);
this.$store.state.LevelOneMenuActiveName =
idx !== -1 ? this.$store.state.sidebarMenuList[idx].id : ''
idx !== -1 ? this.$store.state.sidebarMenuList[idx].id : "";
this.$store.state.sidebarActiveSubMenuList =
idx !== -1 ? this.$store.state.sidebarMenuList[idx].children : []
idx !== -1 ? this.$store.state.sidebarMenuList[idx].children : [];
},
//
getUserInfo() {
const url = '/epmetuser/operuser/queryOperUserDto'
const url = "/epmetuser/operuser/queryOperUserDto";
return this.$http
.get(url)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$store.state.user.id = res.data.id
this.$store.state.user.realName = res.data.realName
this.$store.state.user.superAdmin = res.data.superAdmin
this.$store.state.user.gender = data.gender
localStorage.setItem('customerId', '')
this.$store.state.user.id = res.data.id;
this.$store.state.user.realName = res.data.realName;
this.$store.state.user.superAdmin = res.data.superAdmin;
this.$store.state.user.gender = data.gender;
localStorage.setItem("customerId", "");
})
.catch(() => {})
.catch(() => {});
},
//
getWorkUserInfo() {
const url = '/epmetuser/customerstaff/staffbasicinfo'
let params = {}
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
window.app.ajax.post(
url,
params,
(data, rspMsg) => {
this.$store.state.user = { ...data }
console.log('user---hahha', this.$store.state.user)
this.$store.state.user = { ...data };
console.log("user---hahha", this.$store.state.user);
// this.$store.state.user.id = data.id
// this.$store.state.user.realName = data.realName
// this.$store.state.user.superAdmin = data.superAdmin
// this.$store.state.user.gender = data.gender
localStorage.setItem('roleList', data.roleList)
localStorage.setItem('customerId', data.customerId)
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
// this.$store.state.user.roleList = data.roleList
// this.$store.state.user.customerId = data.customerId
},
(rspMsg, data) => {
this.$message.error(rspMsg)
this.$message.error(rspMsg);
}
)
);
// return this.$http.get(url).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// }).catch(() => { })
}
}
}
},
},
};
</script>

Loading…
Cancel
Save