Browse Source

fdsf

shibei_master
dai 4 years ago
parent
commit
3498f7498e
  1. 589
      src/assets/scss/main-shuju.scss
  2. 51
      src/js/store/index.js
  3. 121
      src/router/index.js
  4. 7
      src/store/index.js
  5. 7
      src/views/components/editResi.vue
  6. 1
      src/views/components/resiSearch.vue
  7. 11
      src/views/main-navbar.vue
  8. 95
      src/views/main-shuju/main-content.vue
  9. 148
      src/views/main-shuju/main-navbar-update-password-work.vue
  10. 246
      src/views/main-shuju/main-navbar.vue
  11. 157
      src/views/main-shuju/main.vue
  12. 16
      src/views/main-sidebar.vue
  13. 1
      src/views/main.vue
  14. 64
      src/views/modules/base/resi.vue
  15. 4
      src/views/pages/indexWork.vue

589
src/assets/scss/main-shuju.scss

@ -0,0 +1,589 @@
@import "~@/element-ui/theme-variables.scss";
@import "./variables.scss";
// $navbar--height: 60px;
/* Reset element-ui
------------------------------ */
.g-bd {
.el-card + .el-card {
margin-top: 15px;
}
.el-input__prefix .el-input__icon {
display: inline-block;
vertical-align: middle;
}
.el-date-editor .el-range-separator {
width: 8%;
}
.el-table th {
color: $--color-text-primary;
background-color: $--background-color-base;
}
.el-pagination {
margin-top: 15px;
text-align: right;
}
.el-table__expand-icon {
display: inline-block;
width: 14px;
vertical-align: middle;
margin-right: 5px;
}
}
/* Common
------------------------------ */
// 图标
.icon-svg {
width: 1em;
height: 1em;
fill: currentColor;
vertical-align: middle;
overflow: hidden;
}
// 卡片
.aui-card--fill .el-card__header {
height: $content--card-header-height;
line-height: $content--card-header-height - 36px;
}
.aui-card__title {
font-size: 16px;
}
// 表单
.aui-form__label-icon {
display: inline-block;
margin: 0 3px;
vertical-align: middle;
font-size: 18px;
color: $--color-text-secondary;
}
// 按钮
.aui-button--dashed {
border-style: dashed;
&:focus,
&:hover {
background-color: transparent;
}
&-add {
> span > *[class*="el-icon-"],
> span > *[class*="icon"] {
vertical-align: middle;
font-size: 18px;
margin-right: 5px;
}
}
}
/* Layout
------------------------------ */
.g-bd {
position: relative;
padding-top: $navbar--height;
/* Sidebar fold
------------------------------ */
&.z-sidebar--fold {
.navbar {
&__header,
&__brand {
width: $sidebar--width-fold;
}
&__brand {
&-lg {
display: none;
}
&-mini {
display: inline-block;
}
}
&__icon-menu--switch {
transform: rotateZ(180deg);
}
}
.aui-sidebar {
&__inner {
width: $sidebar--width-fold + 20px;
}
&,
&__menu {
width: $sidebar--width-fold;
}
&__menu > li > .el-submenu__title {
text-align: center;
}
&__menu-icon {
margin-right: 0;
font-size: 18px;
}
}
.g-cnt {
&__wrapper {
margin-left: $sidebar--width-fold;
}
&--tabs > .el-tabs > .el-tabs__header {
left: $sidebar--width-fold;
}
}
}
&.z-sidebar--noside {
.aui-sidebar {
display: none !important;
}
.g-cnt {
&__wrapper {
margin-left: 0 !important;
}
&--tabs > .el-tabs > .el-tabs__header {
left: 0 !important;
}
}
}
}
/* Navbar
------------------------------ */
.m-navbar {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 1030;
display: flex;
align-items: stretch;
height: $navbar--height;
// background-color: $--color-primary;
// box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05);
background: linear-gradient(180deg, #00023f, #176dec);
box-shadow: 0px 3px 16px 0px rgba(187, 187, 227, 0.35);
.navbar--colorful {
.navbar__body {
background-color: transparent;
}
.navbar__menu {
> .el-menu-item,
> .el-submenu > .el-submenu__title {
color: #fff;
&:focus,
&:hover {
color: #fff;
background-color: mix(#000, $--color-primary, 15%);
}
}
> .el-menu-item.is-active,
> .el-submenu.is-active > .el-submenu__title {
color: #fff;
&:focus,
&:hover {
color: #fff;
}
}
.el-menu-item i,
.el-submenu__title i,
.el-menu-item svg,
.el-submenu__title svg,
.el-menu-item .el-dropdown {
color: #fff !important;
}
.el-button {
color: #fff;
background-color: transparent;
}
}
.navbar__search {
&-txt {
.el-input__inner {
color: #fff;
border-color: #fff;
&::-webkit-input-placeholder {
color: #fff;
}
}
}
}
}
.navbar__header {
position: relative;
width: $sidebar--width;
height: $navbar--height;
transition: width 0.3s;
}
.navbar__brand {
display: flex;
justify-content: center;
align-items: center;
padding: 5px;
margin: 0;
width: 100%;
height: 100%;
font-size: 24px;
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
transition: width 0.3s;
font-family: FZZCHJW;
font-weight: normal;
color: #ffffff;
background: linear-gradient(0deg, #03c7ff 24.609375%, #ffffff 81.0791015625%);
-webkit-background-clip: text;
-webkit-text-fill-color: rgba(#fff, 0.7);
&-lg,
&-mini {
max-width: 100%;
color: #fff;
cursor: pointer;
&:focus,
&:hover {
color: #fff;
text-decoration: none;
}
}
&-mini {
display: none;
}
}
.navbar__body {
position: relative;
display: flex;
flex: 1;
// background-color: #fff;
background-color: transparent;
// overflow: hidden;
}
.navbar__menu {
background-color: transparent;
border-bottom: 0 !important;
a:focus,
a:hover {
text-decoration: none;
}
&.z-div {
.el-menu-item {
position: relative;
&.is-active {
&::before {
position: absolute;
content: "";
display: block;
bottom: -6px;
left: 0;
right: 0;
margin: 0 auto;
width: 50px;
height: 4px;
border: 0;
border-radius: 0 0 2px 2px;
background: #1effff;
}
}
&:last-child {
&::after {
display: none;
}
}
&::after {
position: absolute;
content: "";
right: 0;
top: 0;
bottom: 0;
margin: auto 0;
width: 1px;
height: 18px;
background-color: rgba(#ffffff, 0.6);
}
}
}
.el-menu-item,
.el-submenu > .el-submenu__title {
height: $navbar--height;
padding: 0 15px;
line-height: $navbar--height;
border-color: transparent !important;
color: #fff;
}
.el-menu-item.is-active,
.el-submenu.is-active > .el-submenu__title {
color: #fff;
font-weight: bold;
&:focus,
&:hover {
}
}
.el-menu-item {
&:focus,
&:hover {
background-color: transparent !important;
.navbar__icon-menu {
color: #fff;
}
.el-dropdown {
color: #fff;
.el-icon-arrow-down {
transform: rotateZ(180deg);
}
}
}
* {
vertical-align: initial;
}
.navbar__icon-menu {
vertical-align: middle;
font-size: 16px;
}
.el-dropdown {
color: #fff;
.el-icon-arrow-down {
width: auto;
font-size: 12px;
margin: 0 0 0 5px;
transition: transform 0.3s;
}
}
}
.el-badge {
display: inline;
z-index: 2;
&__content {
line-height: 16px;
}
}
}
.navbar__search {
> *[class*="el-icon-"],
> *[class*="icon"] {
display: inline-block;
vertical-align: middle;
}
&-txt {
width: 0;
transition: width 0.3s, margin-left 0.3s;
&.is-show {
width: 210px;
margin-left: 8px;
}
.el-input__inner {
height: $navbar--height - 20px;
padding: 0;
line-height: $navbar--height - 20px;
border-color: $--color-text-primary;
border-top: 0;
border-right: 0;
border-left: 0;
border-radius: 0;
background: transparent;
}
}
}
.navbar__avatar {
.el-dropdown-link {
> img {
width: 36px;
height: auto;
margin-right: 5px;
border-radius: 100%;
vertical-align: middle;
}
}
}
}
/* Content
------------------------------ */
.g-cnt {
position: relative;
padding: $content--padding;
min-height: calc(100vh - #{$navbar--height});
background-color: #000;
&__wrapper {
position: relative;
margin-left: $sidebar--width;
min-height: calc(100vh - #{$navbar--height});
background-color: $content--background-color;
transition: margin-left 0.3s;
}
> .aui-card--fill > .el-card__body {
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);
}
&--tabs {
padding: $content--tabs-header-height 0 0;
}
&--tabs-tools {
position: fixed;
top: $navbar--height;
right: 0;
z-index: 931;
min-width: $content--tabs-header-height;
height: $content--tabs-header-height;
padding: 0 12px;
text-align: center;
font-size: 16px;
line-height: $content--tabs-header-height;
background-color: $--background-color-base;
cursor: pointer;
}
&--tabs-icon-nav {
display: inline-block;
vertical-align: middle;
font-size: 16px;
}
> .el-tabs {
> .el-tabs__header {
position: fixed;
top: $navbar--height;
left: $sidebar--width;
right: 0;
z-index: 930;
padding: 0 55px 0 15px;
margin: 0;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
background-color: #fff;
transition: left 0.3s;
> .el-tabs__nav-wrap {
margin-bottom: 0;
&:after {
display: none;
}
> .el-tabs__nav-next,
> .el-tabs__nav-prev {
line-height: $content--tabs-header-height;
}
> .el-tabs__nav-scroll > .el-tabs__nav {
& > .el-tabs__active-bar {
display: none;
}
& > .el-tabs__item {
height: $content--tabs-header-height;
padding: 0 15px;
line-height: $content--tabs-header-height;
border: 0;
color: $--color-text-regular;
&:focus,
&:hover,
&.is-active {
color: $--color-text-primary;
background-color: $--background-color-base;
&:after {
display: block;
}
> .el-icon-close {
color: $--color-text-primary;
}
}
&:after {
display: none;
position: absolute;
bottom: 0;
left: 0;
content: "";
width: 100%;
height: 2px;
background-color: $--color-primary;
}
+ .el-tabs__item {
margin-left: 1px;
}
> .el-icon-close {
width: 14px;
margin-left: 15px;
color: $--color-text-secondary;
}
> i.icon {
display: inline-block;
vertical-align: middle;
font-size: 18px;
}
}
}
}
}
> .el-tabs__content {
padding: $content--padding;
.el-loading-mask {
z-index: 830;
}
> .el-tab-pane {
min-height: calc(#{$content--fill-height-tabs});
> .aui-card--fill > .el-card__body {
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);
}
&.is-iframe {
height: calc(#{$content--fill-height-tabs} + #{$content--padding * 2});
margin: -$content--padding;
min-height: auto;
> .aui-card--fill {
background-color: transparent;
}
> .aui-card--fill > .el-card__header {
background-color: #fff;
}
> .aui-card--fill > .el-card__body {
height: calc(#{$content--fill-height-tabs} - 2px);
margin: $content--padding;
min-height: auto;
border: $--border-base;
border-color: $--border-color-lighter;
border-radius: $--border-radius-base;
background-color: #fff;
}
> .aui-card--fill > .el-card__header + .el-card__body {
height: calc(#{$content--fill-height-tabs} - #{$content--card-header-height} - 2px);
}
}
}
}
}
// quill富文本编辑器
.ql-toolbar {
line-height: 20px;
&.ql-snow {
border-color: $--border-color-base;
}
.ql-formats {
margin: 0 5px;
}
}
.ql-container {
height: 150px;
&.ql-snow {
border-color: $--border-color-base;
}
}
}
.el-loading-mask {
z-index: 5001 !important;
}
/* Page
------------------------------ */
*[class*="aui-page__"] {
padding-top: 0;
.aui-content {
min-height: auto;
&__wrapper {
min-height: 100vh;
margin-left: 0;
}
> .aui-card--fill > .el-card__body {
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);
}
}
}

51
src/js/store/index.js

@ -1,49 +1,54 @@
import Vue from 'vue'
import Vuex from 'vuex'
import cloneDeep from 'lodash/cloneDeep'
import user from './modules/user'
import app from './modules/app'
import tagsView from './modules/tagsView'
import Vue from "vue";
import Vuex from "vuex";
import cloneDeep from "lodash/cloneDeep";
import user from "./modules/user";
import app from "./modules/app";
import tagsView from "./modules/tagsView";
Vue.use(Vuex)
Vue.use(Vuex);
export default new Vuex.Store({
namespaced: true,
state: {
// 导航条, 布局风格, defalut(白色) / colorful(鲜艳)
navbarLayoutType: 'colorful',
navbarLayoutType: "colorful",
// 侧边栏, 布局皮肤, default(白色) / dark(黑色)
sidebarLayoutSkin: 'dark',
sidebarLayoutSkin: "dark",
// 侧边栏, 折叠状态
sidebarFold: false,
// 侧边栏, 菜单
sidebarMenuList: [],
sidebarMenuActiveName: '',
LevelOneMenuActiveName: '',
sidebarMenuActiveName: "",
LevelOneMenuActiveName: "",
sidebarActiveSubMenuList: [],
// 内容, 是否需要刷新
contentIsNeedRefresh: false,
// 内容, 标签页(默认添加首页)
contentTabs: [
{
...window.SITE_CONFIG['contentTabDefault'],
'name': 'home',
'title': 'home'
}
...window.SITE_CONFIG["contentTabDefault"],
name: "home",
title: "home",
},
],
contentTabsActiveName: 'home'
contentTabsActiveName: "home",
mainShuju: {
menuList: [],
activeName: "",
},
},
modules: {
user,
app,
tagsView
tagsView,
},
mutations: {
// 重置vuex本地储存状态
resetStore (state) {
resetStore(state) {
Object.keys(state).forEach((key) => {
state[key] = cloneDeep(window.SITE_CONFIG['storeState'][key])
})
}
}
})
state[key] = cloneDeep(window.SITE_CONFIG["storeState"][key]);
});
},
},
});

121
src/router/index.js

@ -67,16 +67,30 @@ export const moduleRoutes = {
component: () => import('@/views/modules/home'),
name: 'home',
meta: {
title: '页',
title: '页',
isTab: true
}
},
{
path: '/work-setpwd',
component: () => import('@/views/modules/workPc/setpwd'),
name: 'work-setpwd',
}
]
}
// 模块路由(基于主入口布局页面) 可视化数据
export const moduleShujuRoutes = {
path: '/',
component: () => import('@/views/main-shuju/main'),
name: 'main-shuju',
redirect: {
name: 'home2'
},
meta: {
title: '主入口布局'
},
children: [{
path: '/home2',
component: () => import('@/views/modules/home'),
name: 'home2',
meta: {
title: '修改密码',
title: '主页2',
isTab: true
}
}
@ -123,7 +137,7 @@ const router = new Router({
scrollBehavior: () => ({
y: 0
}),
routes: pageRoutes.concat(moduleRoutes)
routes: pageRoutes.concat(moduleRoutes, moduleShujuRoutes)
})
router.beforeEach((to, from, next) => {
@ -136,22 +150,6 @@ router.beforeEach((to, from, next) => {
return next()
}
// 获取字典列表, 添加并全局变量保存
// http
// .get('/sys/dict/type/all')
// .then(({ data: res }) => {
// if (res.code !== 0) {
// return
// }
// window.SITE_CONFIG['dictList'] = res.data
// })
// .catch(() => {})
// 获取菜单列表, 添加并全局变量保存
const userType = localStorage.getItem('userType')
if (userType === 'work') {
const customerId = localStorage.getItem('customerId')
console.log('customerId:', customerId)
// if(customerId==='1e68188b8f7e9ab15658c164bd5b3676'){
@ -212,7 +210,7 @@ router.beforeEach((to, from, next) => {
if (res.code !== 0) {
// Vue.prototype.$message.error(res.msg)
return next({
name: 'loginWork'
name: 'login'
})
}
window.SITE_CONFIG['menuList'] = res.data
@ -225,7 +223,7 @@ router.beforeEach((to, from, next) => {
})
.catch(() => {
next({
name: 'loginWork'
name: 'login'
})
})
// }
@ -234,7 +232,6 @@ router.beforeEach((to, from, next) => {
// 1e68188b8f7e9ab15658c164bd5b3676
} else {
http
.get('/oper/access/menu/nav')
.then(({
@ -246,8 +243,21 @@ router.beforeEach((to, from, next) => {
name: 'login'
})
}
window.SITE_CONFIG['menuList'] = res.data
fnAddDynamicMenuRoutes(window.SITE_CONFIG['menuList'])
window.SITE_CONFIG['menuShujuList'] = [
{
icon: "icon-setting",
id: "2",
name: "基础信息",
url: "shequ/index"
},
{
icon: "icon-setting",
id: "3",
name: "人员预警",
url: "base/resi"
}
]
fnAddDynamicMenuRoutes2(window.SITE_CONFIG['menuShujuList'])
// next({ ...to, replace: true })
next({
...to,
@ -259,7 +269,6 @@ router.beforeEach((to, from, next) => {
name: 'login'
})
})
}
})
/**
@ -337,4 +346,56 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) {
window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = true
}
function fnAddDynamicMenuRoutes2(menuList = [], routes = []) {
var temp = []
for (var i = 0; i < menuList.length; i++) {
if (menuList[i].children && menuList[i].children.length >= 1) {
temp = temp.concat(menuList[i].children)
continue
}
// 组装路由
var route = {
path: '',
component: null,
name: '',
meta: {
...window.SITE_CONFIG['contentTabDefault'],
menuId: menuList[i].id,
title: menuList[i].name
}
}
// eslint-disable-next-line
let URL = (menuList[i].url || '').replace(/{{([^}}]+)?}}/g, (s1, s2) =>
eval(s2)
) // URL支持{{ window.xxx }}占位符变量
if (isURL(URL)) {
route['path'] = route['name'] = `i-${menuList[i].id}`
route['meta']['iframeURL'] = URL
} else {
URL = URL.replace(/^\//, '').replace(/_/g, '-')
route['path'] = route['name'] = URL.replace(/\//g, '-')
route['component'] = () => import(`@/views/modules/${URL}`)
}
routes.push(route)
}
if (temp.length >= 1) {
return fnAddDynamicMenuRoutes2(temp, routes)
}
// 添加路由
router.addRoutes([{
...moduleShujuRoutes,
name: 'main-dynamic-menu-shuju',
children: routes
},
{
path: '*',
redirect: {
name: '404'
}
}
])
window.SITE_CONFIG['dynamicMenuRoutesShuju'] = routes
window.SITE_CONFIG['dynamicMenuRoutesShujuHasAdded'] = true
}
export default router

7
src/store/index.js

@ -27,7 +27,12 @@ export default new Vuex.Store({
'title': 'home'
}
],
contentTabsActiveName: 'home'
contentTabsActiveName: 'home',
mainShuju: {
menuList: [],
activeName: "",
},
},
modules: {
user

7
src/views/components/editResi.vue

@ -472,7 +472,6 @@ export default {
this.addList = [...this.mutiList]
// console.log('addList----111', this.addList)
}
// } this.addList.push(this.addCount++)
if (this.fixed) {
this.getGridList()
this.getValiheList()
@ -483,11 +482,6 @@ export default {
},
methods: {
initForm () {
// console.log('formInfo', this.formInfo)
// if (Object.keys(this.formInfo).length > 0) {
// this.form = { ...this.formInfo }
// return
// }
this.formList.forEach(async item => {
if (item.optionSourceType === 'remote') {
await this.getOptionsLists(item.optionSourceValue).then(res => {
@ -575,6 +569,7 @@ export default {
// console.log('handlerMuscForm----000', this.$refs['baseForms' + item.row || item][0].handleForm())
arr.push([ ...this.$refs['baseForms' + item.row][0].handleForm() ])
})
if (arr.length === 0) return arr
let arr2 = arr.reduce(function (a, b) { return a.concat(b) })
let hash = {}
let i = 0

1
src/views/components/resiSearch.vue

@ -516,6 +516,7 @@ export default {
margin-bottom: 20px;
}
.resi-search {
padding-right: 140px;
.el-col {
text-align: right;
}

11
src/views/main-navbar.vue

@ -40,13 +40,18 @@
</el-menu>
<el-menu
v-if="userType == 'work'"
:default-active="$store.state.LevelOneMenuActiveName"
:unique-opened="true"
:collapseTransition="false"
mode="horizontal"
class="aui-navbar__menu mr-auto z-div"
>
<el-menu-item
@click="toIndexPage"
>
<span>首页</span>
</el-menu-item>
<el-menu-item
v-for="(menu, idx) in $store.state.sidebarMenuList"
:key="menu.id"
@ -100,7 +105,6 @@
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-if="userType == 'work'"
@click.native="updatePasswordHandle()"
>{{ $t('updatePassword.title') }}</el-dropdown-item
>
@ -158,6 +162,9 @@ export default {
}
},
methods: {
toIndexPage(){
this.$router.replace('/indexWork')
},
// menuId()
gotoRouteHandle(menuId, idx) {
var route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(

95
src/views/main-shuju/main-content.vue

@ -0,0 +1,95 @@
<template>
<main :class="['aui-content']">
<!-- 其他方式, 展示内容 -->
<template>
<keep-alive>
<router-view />
</keep-alive>
</template>
</main>
</template>
<script>
import { isURL } from '@/utils/validate'
import Cookie from 'js-cookie'
export default {
data () {
return {
iframeUrl: '',
token: '',
customerId: ''
}
},
created () {
// this.$nextTick(() => {
// this.sendMessage()
// })
this.token = Cookie.get('token')
this.customerId = localStorage.getItem('customerId')
},
methods: {
changeCustomerName (customerName) {
this.$emit('changeCustomerName', customerName)
},
// tabs, iframe
tabIsIframe (url) {
// this.appendIframe(url)
this.iframeUrl = url + '?token=' + Cookie.get('token') + '&customerId=' + localStorage.getItem('customerId')
return isURL(url)
},
// tabs, tab
tabSelectedHandle (tab) {
tab = this.$store.state.contentTabs.filter(item => item.name === tab.name)[0]
if (tab) {
this.$router.push({
'name': tab.name,
'params': { ...tab.params },
'query': { ...tab.query }
})
}
},
// tabs, tab
tabRemoveHandle (tabName) {
if (tabName === 'home') {
return false
}
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
if (this.$store.state.contentTabs.length <= 0) {
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = 'home'
return false
}
// tab
if (tabName === this.$store.state.contentTabsActiveName) {
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]
this.$router.push({
name: tab.name,
params: { ...tab.params },
query: { ...tab.query }
})
}
},
// tabs,
tabsCloseOtherHandle () {
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => {
return item.name === 'home' || item.name === this.$store.state.contentTabsActiveName
})
},
// tabs,
tabsCloseAllHandle () {
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name === 'home')
this.$router.push({ name: 'home' })
},
sendMessage () {
// const iframe = this.$refs.iframes.contentWindow
const iframe = document.getElementsByClassName('iframes')[0].contentWindow
console.log('iframe', iframe)
// iframe.postMessage({
// token: Cookie.get('token'),
// customerId: localStorage.getItem('customerId')
// }, '*')
iframe.postMessage({ name: 'lalalal' }, '*')
},
}
}
</script>

148
src/views/main-shuju/main-navbar-update-password-work.vue

@ -0,0 +1,148 @@
<template>
<el-dialog
:visible.sync="visible"
:title="$t('updatePassword.title')"
:close-on-click-modal="false"
:close-on-press-escape="false"
:append-to-body="true"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
label-width="120px"
>
<el-form-item :label="$t('updatePassword.username')">
<span>{{ $store.state.user.realName }}</span>
</el-form-item>
<!-- <el-form-item prop="password" :label="$t('updatePassword.password')">
<el-input
v-model="dataForm.password"
type="password"
:placeholder="$t('updatePassword.password')"
></el-input>
</el-form-item> -->
<el-form-item
prop="newPassword"
:label="$t('updatePassword.newPassword')"
>
<el-input
v-model="dataForm.newPassword"
type="password"
:placeholder="$t('updatePassword.newPassword')"
></el-input>
</el-form-item>
<el-form-item
prop="confirmPassword"
:label="$t('updatePassword.confirmPassword')"
>
<el-input
v-model="dataForm.confirmPassword"
type="password"
:placeholder="$t('updatePassword.confirmPassword')"
></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{
$t('confirm')
}}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
import { clearLoginInfo } from '@/utils'
export default {
data() {
return {
visible: false,
dataForm: {
password: '',
newPassword: '',
confirmPassword: ''
}
}
},
computed: {
dataRule() {
var validateConfirmPassword = (rule, value, callback) => {
if (this.dataForm.newPassword !== value) {
return callback(
new Error(this.$t('updatePassword.validate.confirmPassword'))
)
}
callback()
}
return {
// password: [
// {
// required: true,
// message: this.$t('validate.required'),
// trigger: 'blur'
// }
// ],
newPassword: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
],
confirmPassword: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
},
{ validator: validateConfirmPassword, trigger: 'blur' }
]
}
}
},
methods: {
init() {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
},
//
dataFormSubmitHandle: debounce(
function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http
.post('/gov/mine/mine/resetpassword', {
newPassword: this.dataForm.newPassword,
confirmNewPassword: this.dataForm.confirmPassword
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
clearLoginInfo()
this.$router.replace({ name: 'loginWork' })
}
})
})
.catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
}
}
</script>

246
src/views/main-shuju/main-navbar.vue

@ -0,0 +1,246 @@
<template>
<div>
<nav
v-if="showHeader"
class="m-navbar"
>
<div class="navbar__header">
<h1 class="navbar__brand" @click="$router.push({ name: 'home' })">
<a class="navbar__brand-lg" href="javascript:;">{{
userType === 'work' ? customerName : $t('brand.lg')
}}</a>
<a class="navbar__brand-mini" href="javascript:;">{{
$t('brand.mini')
}}</a>
</h1>
</div>
<div class="navbar__body">
<el-menu class="navbar__menu mr-auto" mode="horizontal">
<el-menu-item
index="1"
@click="$store.state.sidebarFold = !$store.state.sidebarFold"
>
<svg
class="
icon-svg
navbar__icon-menu navbar__icon-menu--switch
"
aria-hidden="true"
>
<use xlink:href="#icon-outdent"></use>
</svg>
</el-menu-item>
<el-menu-item index="2" @click="refresh()">
<svg class="icon-svg navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-sync"></use>
</svg>
</el-menu-item>
</el-menu>
<el-menu
:default-active="$store.state.mainShuju.activeName"
:unique-opened="true"
:collapseTransition="false"
mode="horizontal"
class="navbar__menu mr-auto z-div"
>
<el-menu-item
@click="toIndexPage"
>
<span>首页</span>
</el-menu-item>
<el-menu-item
v-for="(menu, idx) in $store.state.mainShuju.menuList"
:key="menu.id"
:menu="menu"
:index="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
</el-menu-item>
</el-menu>
<el-menu class="navbar__menu" mode="horizontal">
<!-- <el-menu-item index="1">
<el-dropdown placement="bottom"
:show-timeout="0">
<el-button size="mini">{{ $t('_lang') }}</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(val, key) in i18nMessages"
:key="key"
@click.native="$i18n.locale = key">{{ val._lang }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item> -->
<!-- <el-menu-item index="2">
<a href="//www.renren.io/"
target="_blank">
<svg class="icon-svg navbar__icon-menu"
aria-hidden="true">
<use xlink:href="#icon-earth"></use>
</svg>
</a>
</el-menu-item> -->
<el-menu-item index="3"
@click="fullscreenHandle()">
<svg class="icon-svg navbar__icon-menu"
aria-hidden="true">
<use xlink:href="#icon-fullscreen"></use>
</svg>
</el-menu-item>
<el-menu-item index="4" class="navbar__avatar">
<el-dropdown placement="bottom" :show-timeout="0">
<span class="el-dropdown-link">
<img
v-if="$store.state.user.gender === '2'"
src="~@/assets/img/staff-default-avatar-girl.png"
/>
<img v-else src="~@/assets/img/staff-default-avatar-boy.png" />
<span>{{ $store.state.user.realName }}</span>
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="updatePasswordHandle()"
>{{ $t('updatePassword.title') }}</el-dropdown-item
>
<el-dropdown-item @click.native="logoutHandle()">{{
$t('logout')
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
</el-menu>
</div>
<!-- 弹窗, 修改密码 -->
<update-password-work
v-if="updatePassowrdVisible"
ref="updatePassowrd"
></update-password-work>
</nav>
<nav v-else class="navbar main-line"></nav>
</div>
</template>
<script>
import { messages } from '@/i18n'
import { mapGetters } from 'vuex'
import screenfull from 'screenfull'
import UpdatePasswordWork from './main-navbar-update-password-work'
import { clearLoginInfo } from '@/utils'
export default {
inject: ['refresh'],
data() {
return {
showHeader: true,
i18nMessages: messages,
updatePassowrdVisible: false,
customerName: localStorage.getItem('customerName')
}
},
components: {
UpdatePasswordWork
},
created() {
let platformToken = localStorage.getItem('showHeader') || ''
if (
typeof platformToken !== 'undefined' &&
platformToken !== 'undefined' &&
platformToken !== ''
) {
this.showHeader = false
}
console.log('=============================', this.userType)
this.$store.state.mainShuju.menuList = window.SITE_CONFIG['menuShujuList']
},
computed: {
userType() {
return localStorage.getItem('userType')
}
},
methods: {
toIndexPage(){
this.$router.replace('/indexWork')
},
// menuId()
gotoRouteHandle(menuId, idx) {
var route = window.SITE_CONFIG['dynamicMenuRoutesShuju'].filter(
(item) => item.meta.menuId === menuId
)[0]
if (route) {
this.$router.push({ name: route.name })
}
this.$store.state.mainShuju.activeName = menuId
},
changeCustomerName(customerName) {
this.customerName = localStorage.getItem('customerName')
},
//
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t('fullscreen.prompt'),
type: 'warning',
duration: 500
})
}
screenfull.toggle()
},
//
updatePasswordHandle() {
this.updatePassowrdVisible = true
this.$nextTick(() => {
this.$refs.updatePassowrd.init()
})
},
// 退
logoutHandle() {
this.$confirm(
this.$t('prompt.info', { handle: this.$t('logout') }),
this.$t('prompt.title'),
{
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}
)
.then(() => {
//
// tabs,
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(
(item) => item.name === 'home2'
)
this.$http
.post('/auth/login/logout')
.then(({ data: res }) => {
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg)
}
}
clearLoginInfo()
this.$router.push({ name: 'login' })
})
.catch(() => {})
})
.catch(() => {})
}
}
}
</script>
<style lang="scss" scoped>
.main-line {
height: 50px;
background: #eeeeee;
}
</style>
<style lang="scss" src="@/assets/scss/main-shuju.scss" scoped></style>

157
src/views/main-shuju/main.vue

@ -0,0 +1,157 @@
<template>
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
'g-bd',
{ 'z-sidebar--fold': $store.state.sidebarFold },
{
'z-sidebar--noside':true
}
]"
>
<template v-if="!loading">
<main-navbar ref="ref_navbar" />
<div class="g-cnt">
<main-content
v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName"
/>
</div>
</template>
</div>
</template>
<script>
import MainNavbar from './main-navbar'
import MainContent from './main-content'
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.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false
})
}
}
},
data() {
return {
loading: true,
userType: localStorage.getItem('userType')
}
},
components: {
MainNavbar,
MainContent,
},
watch: {
$route: 'routeHandle'
},
async created() {
this.windowResizeHandle()
this.routeHandle(this.$route)
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false
})
},
computed: {},
methods: {
changeCustomerName(customerName) {
this.$refs['ref_navbar'].changeCustomerName(customerName)
},
//
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement['clientWidth'] <= 992 || false
window.addEventListener(
'resize',
debounce(() => {
this.$store.state.sidebarFold =
document.documentElement['clientWidth'] <= 992 || false
}, 150)
)
},
// ,
routeHandle(route) {
if (!route.meta.isTab) {
return false
}
var tab = this.$store.state.contentTabs.filter(
(item) => item.name === route.name
)[0]
if (!tab) {
tab = {
...window.SITE_CONFIG['contentTabDefault'],
...route.meta,
name: route.name,
params: { ...route.params },
query: { ...route.query }
}
this.$store.state.contentTabs =
this.$store.state.contentTabs.concat(tab)
}
this.$store.state.mainShuju.activeName = tab.menuId
this.$store.state.mainShuju.contentTabsActiveName = tab.name
},
//
getUserInfo() {
const url = '/epmetuser/operuser/queryOperUserDto'
return this.$http
.get(url)
.then(({ data: res }) => {
if (res.code !== 0) {
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', '')
})
.catch(() => {})
},
//
getWorkUserInfo() {
const url = '/epmetuser/customerstaff/staffbasicinfo'
let params = {}
window.app.ajax.post(
url,
params,
(data, rspMsg) => {
this.$store.state.user = { ...data }
// 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)
// this.$store.state.user.roleList = data.roleList
// this.$store.state.user.customerId = data.customerId
},
(rspMsg, data) => {
this.$message.error(rspMsg)
}
)
// return this.$http.get(url).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// }).catch(() => { })
}
}
}
</script>
<style lang="scss" src="@/assets/scss/main-shuju.scss"></style>

16
src/views/main-sidebar.vue

@ -4,27 +4,11 @@
>
<div class="aui-sidebar__inner">
<el-menu
v-if="userType !== 'work'"
:default-active="$store.state.sidebarMenuActiveName"
:collapse="$store.state.sidebarFold"
:unique-opened="true"
:collapseTransition="false"
class="aui-sidebar__menu"
>
<sub-menu
v-for="menu in $store.state.sidebarMenuList"
:key="menu.id"
:menu="menu"
/>
</el-menu>
<el-menu
:default-active="$store.state.sidebarMenuActiveName"
:collapse="$store.state.sidebarFold"
:unique-opened="true"
:collapseTransition="false"
class="aui-sidebar__menu"
v-else
>
<sub-menu
v-for="menu in $store.state.sidebarActiveSubMenuList"

1
src/views/main.vue

@ -7,7 +7,6 @@
{ 'aui-sidebar--fold': $store.state.sidebarFold },
{
'aui-sidebar--noside':
userType == 'work' &&
$store.state.sidebarActiveSubMenuList.length == 0
}
]"

64
src/views/modules/base/resi.vue

@ -11,6 +11,7 @@
</div>
<el-table
:data="tableData"
v-loading="tableLoading"
border
style="width: 100%"
class="resi-table">
@ -25,7 +26,7 @@
:prop="item.columnName"
:label="item.label"
align="center"
width="180">
:width="item.itemType === 'radio' ? 80 : 180">
<template slot-scope="scope">
<span>{{ handleFilterSpan(scope.row, item)}}</span>
</template>
@ -85,7 +86,7 @@
</div>
<div class="resi-btns">
<el-button size="small" @click="handlerCancle">取消</el-button>
<el-button type="primary" size="small" @click="handleSUbmit">提交</el-button>
<el-button type="primary" size="small" :loading="btnLoading" @click="handleSUbmit">提交</el-button>
</div>
</el-dialog>
@ -111,7 +112,7 @@
</div>
<div class="resi-btns">
<el-button size="small" @click="handlerEditCancle">取消</el-button>
<el-button v-if="!disabled" type="primary" size="small" @click="handleEditSUbmit">提交</el-button>
<el-button v-if="!disabled" type="primary" size="small" :loading="btnLoading" @click="handleEditSUbmit">提交</el-button>
</div>
</el-dialog>
@ -130,6 +131,8 @@ export default {
},
data () {
return {
tableLoading: false,
btnLoading: false,
disabled: false,
pageLoading: false,
dialogEditVisible: false,
@ -266,8 +269,8 @@ export default {
},
async handleEdit (row) {
this.disabled = false
await this.getFormList()
this.getrowInfo(row.icResiUserId)
await this.getFormList('edit')
await this.getrowInfo(row.icResiUserId)
},
async handleAdd () {
await this.getFormList()
@ -400,8 +403,9 @@ export default {
})
this.dialogVisible = false
},
submitAdd (arr) {
this.$http
async submitAdd (arr) {
this.btnLoading = true
await this.$http
.post('/epmetuser/icresiuser/add', arr)
.then(({ data: res }) => {
if (res.code !== 0) {
@ -420,12 +424,15 @@ export default {
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
},
submitEdit (arr) {
this.$http
async submitEdit (arr) {
this.btnLoading = true
await this.$http
.post('/epmetuser/icresiuser/edit', arr)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.$message.success('提交成功')
@ -441,6 +448,7 @@ export default {
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
},
getTableHeader () {
this.$http
@ -456,14 +464,15 @@ export default {
return this.$message.error('网络错误')
})
},
getTableData () {
async getTableData () {
this.tableLoading = true
let params = {
formCode: 'resi_base_info',
pageNo: this.currentPage,
pageSize: this.pageSize,
conditions: this.conditions
}
this.$http
await this.$http
.post('/epmetuser/icresiuser/listresi', params)
.then(({ data: res }) => {
if (res.code !== 0) {
@ -476,6 +485,7 @@ export default {
.catch(() => {
return this.$message.error('网络错误')
})
this.tableLoading = false
},
getrowInfo (id) {
let params = {
@ -588,7 +598,7 @@ export default {
return this.$message.error('网络错误')
})
},
async getFormList () {
async getFormList (type) {
await this.$http
.post('/oper/customize/icform/getcustomerform', { formCode: 'resi_base_info', dynamic: true })
.then(({ data: res }) => {
@ -598,23 +608,25 @@ export default {
console.log('获取详情成功getFormList')
let { itemList, groupList } = res.data
this.activeName = 'group' + res.data.groupList[0].groupId
itemList.forEach(async item => {
if (item.optionSourceType === 'remote') {
await this.getOptionsList(item.optionSourceValue).then(res => {
item.options = res
})
}
})
groupList.forEach(item => {
item.itemList.forEach(async n => {
n.tableName = item.tableName
if (n.optionSourceType === 'remote') {
await this.getOptionsList(n.optionSourceValue).then(res => {
n.options = res
if (type !== 'edit') {
itemList.forEach(async item => {
if (item.optionSourceType === 'remote') {
await this.getOptionsList(item.optionSourceValue).then(res => {
item.options = res
})
}
})
})
groupList.forEach(item => {
item.itemList.forEach(async n => {
n.tableName = item.tableName
if (n.optionSourceType === 'remote') {
await this.getOptionsList(n.optionSourceValue).then(res => {
n.options = res
})
}
})
})
}
this.formList = itemList
this.tabsList = groupList
}

4
src/views/pages/indexWork.vue

@ -51,9 +51,9 @@ export default {
methods: {
handleClickItem(k) {
if (k == 1) {
this.$router.replace({ name: 'home' })
this.$router.replace({ name: 'main' })
} else if (k == 2) {
this.$router.replace({ name: 'home' })
this.$router.replace({ name: 'main-shuju' })
}
},

Loading…
Cancel
Save