New file |
| | |
| | | <template> |
| | | <div class="AsideBar"> |
| | | <!-- 二级侧边栏 --> |
| | | <el-aside width="200px" class="aside"> |
| | | <el-scrollbar> |
| | | <el-menu class="el-menu-vertical" :default-active="$route.path"> |
| | | <div v-for="item in asideList" :key="item.name"> |
| | | <span class="AsideBarTitle">{{item.name}}</span> |
| | | <el-menu-item v-for="child in item.children" :key="child.name" :index="child.index" class="firstMenu" |
| | | @click="Jump(child.index)"> |
| | | <span class="firstSpan">{{child.name}}</span> |
| | | </el-menu-item> |
| | | </div> |
| | | </el-menu> |
| | | </el-scrollbar> |
| | | </el-aside> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | menu: [ |
| | | { |
| | | name: '/home/system', children: [ |
| | | { |
| | | name: "基础设置", index: '/home/system/base', children: [ |
| | | { |
| | | name: '用户管理', index: '/home/system/user', |
| | | }, |
| | | { |
| | | name:'角色管理', index:'/home/system/role', |
| | | }, |
| | | { |
| | | name:'权限管理',index:'/home/system/authority', |
| | | }, |
| | | { |
| | | name:'部门管理',index:'/home/system/department', |
| | | } |
| | | ] |
| | | }, |
| | | { name: "平台设置", index: "/home/system/plateform", children: [ |
| | | { |
| | | name:'门户设置',index:'/home/system/portalSetting' |
| | | }, |
| | | { |
| | | name:'第三方接口管理',index:'/home/system/otherInterface' |
| | | } |
| | | ] }, |
| | | ], |
| | | } |
| | | ], |
| | | asideList: null, |
| | | } |
| | | }, |
| | | created() { |
| | | this.getAsideList(this.$route.path); |
| | | }, |
| | | watch: { |
| | | $route(to, from) { |
| | | this.getAsideList(to.fullPath); |
| | | } |
| | | }, |
| | | methods: { |
| | | getAsideList(path) { |
| | | let { menu } = this; |
| | | const that = this; |
| | | this.asideList = null; |
| | | menu.forEach(item => { |
| | | if (path.indexOf(item.name) !== -1) { |
| | | that.asideList = item.children; |
| | | } |
| | | }) |
| | | }, |
| | | Jump(path) { |
| | | this.$router.push(path); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scpoed> |
| | | .icon-padding { |
| | | padding-right: 10px; |
| | | } |
| | | |
| | | .aside { |
| | | background: #eaedf1; |
| | | color: black; |
| | | text-align: center; |
| | | box-sizing: border-box; |
| | | position: relative; |
| | | // 固定标题 |
| | | .siderbar-title { |
| | | position: fixed; |
| | | text-align: center; |
| | | margin: 0; |
| | | font-size: 26px; |
| | | width: 200px; |
| | | line-height: 66px; |
| | | top: 0; |
| | | left: 0; |
| | | z-index: 999; |
| | | // box-shadow: 0 -5px 5px #0ff inset; |
| | | } |
| | | |
| | | .el-scrollbar { |
| | | height: calc(100vh - 66px); |
| | | box-sizing: border-box; |
| | | |
| | | .el-menu { |
| | | border: 0; |
| | | .AsideBarTitle { |
| | | display: block; |
| | | line-height: 60px; |
| | | color: #999; |
| | | font-weight: 650; |
| | | background-color: #f2f2f2; |
| | | border-bottom: 1px solid #e4e4e4; |
| | | } |
| | | |
| | | .firstMenu { |
| | | background: #eaedf1; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | background-color: #eaedf1; |
| | | color: #666666; |
| | | border-bottom: 1px solid #e4e4e4; |
| | | |
| | | &:hover .firstSpan { |
| | | color: #1a87fe; |
| | | } |
| | | |
| | | .el-menu-item { |
| | | &:hover { |
| | | color: #22d3eb; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .is-active { |
| | | background-color: #fff; |
| | | color: #1a87fe; |
| | | } |
| | | } |
| | | |
| | | .el-scrollbar__wrap { |
| | | overflow-x: hidden; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div> |
| | | <!-- 头部 --> |
| | | <el-header> |
| | | <!-- 左侧菜单 --> |
| | | <div class="menuLeft"> |
| | | <div class="icon"> |
| | | <img style="width:30px;height:30px" |
| | | src="https://axure-file.lanhuapp.com/90466432-c999-4bf0-80b8-ee3f96a2099e__155eeb2ceaac89ec717869a050964a36.svg" |
| | | alt=""> |
| | | </div> |
| | | <div class="systemName">遂昌智慧执法平台</div> |
| | | <ul class="headerNav"> |
| | | <li v-for="(item,index) in nav" :key="item.name" :class="item.checked?'activeIndex':''" @click="handleChange(index)">{{item.name}}</li> |
| | | </ul> |
| | | </div> |
| | | <!-- 头部 --> |
| | | <el-header> |
| | | <!-- 右侧菜单 --> |
| | | <div class="menuRight"> |
| | | <div class="search"> |
| | | <el-input placeholder="请输入搜索内容" suffix-icon="el-icon-search" v-model="search"> |
| | | </el-input> |
| | | <div class="header-title"> |
| | | <div class="bell"> |
| | | <el-icon class="el-icon-bell" style="color: white"></el-icon> |
| | | </div> |
| | | <div class="userinfo userItem"> |
| | | <div class="userIcon"></div> |
| | | <span class="username">admin<i class="el-icon-arrow-down" style="margin-left:3px"></i></span> |
| | | <div class="userinfo"> |
| | | <div class="avatar"></div> |
| | | <span class="username">admin</span> |
| | | </div> |
| | | <div class="userMessage userBtn"><i class="el-icon-message-solid"></i></div> |
| | | <div class="userSetting userBtn"><i class="el-icon-s-tools"></i></div> |
| | | <div class="userLoginout userBtn" @click="loginout"><i class="el-icon-switch-button"></i></div> |
| | | <div class="loginout" @click="loginout">退出登录</div> |
| | | </div> |
| | | </el-header> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import hamburger from "@/components/hamburger"; |
| | | export default { |
| | | data() { |
| | | return { |
| | | opened: false, |
| | | search:'', |
| | | nav:[ |
| | | { |
| | | name:'驾驶舱', |
| | | checked:true, |
| | | }, |
| | | { |
| | | name:'视频查询', |
| | | checked:false, |
| | | }, |
| | | { |
| | | name:'执法管理', |
| | | checked:false, |
| | | } |
| | | ] |
| | | }; |
| | | }, |
| | | components: { |
| | | hamburger, |
| | | }, |
| | | methods: { |
| | | loginout() { |
| | | // 清除token |
| | | localStorage.clear(); |
| | | this.$router.push({ path: "/login" }); |
| | | }, |
| | | handleChange(idx){ |
| | | // 设置nav激活 |
| | | this.nav.forEach((item,index)=>{ |
| | | index==idx?item.checked = true:item.checked = false; |
| | | }) |
| | | localStorage.setItem('navIdx',idx); |
| | | methods:{ |
| | | loginout(){ |
| | | this.$router.push({path:"/login"}) |
| | | } |
| | | }, |
| | | mounted() { |
| | | const idx = localStorage.getItem("navIdx"); |
| | | if(idx){ |
| | | this.handleChange(idx); |
| | | } |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | * { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | <style lang="scss" > |
| | | .el-header { |
| | | background-color: rgb(0, 121, 254); |
| | | background-color: #071a38; |
| | | color: #333; |
| | | text-align: center; |
| | | line-height: 60px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | justify-content: flex-end; |
| | | padding: 0; |
| | | position: fixed; |
| | | width: 100%; |
| | | top: 0px; |
| | | z-index: 9999; |
| | | .menuLeft { |
| | | color: #fff; |
| | | |
| | | .icon { |
| | | margin: 0 20px; |
| | | } |
| | | |
| | | .systemName { |
| | | width: 185px; |
| | | font-weight: 650; |
| | | font-size: 18px; |
| | | } |
| | | |
| | | ul, |
| | | .icon { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | li { |
| | | list-style: none; |
| | | width: 100px; |
| | | &:hover{ |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .activeIndex { |
| | | height: 30px; |
| | | line-height: 30px; |
| | | border-radius: 20px; |
| | | background-color: #53a5ff; |
| | | } |
| | | |
| | | display: flex; |
| | | } |
| | | |
| | | .menuRight { |
| | | .header-title { |
| | | display: flex; |
| | | align-items: center; |
| | | width: 280px; |
| | | justify-content: space-evenly; |
| | | .search{ |
| | | .el-input{ |
| | | width: 200px; |
| | | margin: 0 10px; |
| | | } |
| | | .el-input__inner{ |
| | | height: 30px; |
| | | } |
| | | } |
| | | .userItem{ |
| | | width: 120px; |
| | | } |
| | | .userBtn{ |
| | | width: 60px; |
| | | color: #fff; |
| | | font-size: 20px; |
| | | .bell { |
| | | background-color: #00d1fa; |
| | | width: 25px; |
| | | height: 25px; |
| | | border-radius: 5px; |
| | | text-align: center; |
| | | line-height: 25px; |
| | | } |
| | | .userinfo { |
| | | width: 100xp; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | .userIcon { |
| | | width: 20px; |
| | | height: 20px; |
| | | .avatar { |
| | | width: 25px; |
| | | height: 25px; |
| | | border-radius: 50%; |
| | | background-image: url("@/assets/imgs/user/default-avatar.jpg"); |
| | | background-size: cover; |
| | | } |
| | | |
| | | .username { |
| | | margin: 0 5px; |
| | | color: #22d3eb; |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | |
| | | .loginout { |
| | | color: #22d3eb; |
| | | font-size: 14px; |
| | |
| | | <template> |
| | | <el-main> |
| | | <NavBar /> |
| | | <!-- <NavBar /> --> |
| | | <div class="content"> |
| | | <router-view></router-view> |
| | | <!-- 底部区域 --> |
| | | <MyFooter/> |
| | | <!-- <MyFooter/> --> |
| | | </div> |
| | | </el-main> |
| | | </template> |
| | |
| | | min-width: 1024px; |
| | | padding: 0; |
| | | .content { |
| | | background-color: #f0f2f5; |
| | | background-color: #070f22; |
| | | padding: 11px; |
| | | } |
| | | } |
| | |
| | | <template> |
| | | <div class="Menu"> |
| | | <!-- 菜单栏 --> |
| | | <el-aside width="200px" class="menu"> |
| | | <div> |
| | | <!-- 侧边导航栏 --> |
| | | <el-aside width="200px"> |
| | | <h2 class="siderbar-title">遂昌执法平台</h2> |
| | | <el-scrollbar class="MenuScroll"> |
| | | <el-scrollbar> |
| | | <!-- 路由 --> |
| | | <el-menu class="el-menu-vertical"> |
| | | <el-menu-item v-for="item in menu" :key="item.name" class="firstMenu" @click="Jump(item.index)"> |
| | | <el-menu router class="el-menu-vertical" :default-active="$route.path" > |
| | | <!-- 系统设置模块 --> |
| | | <el-submenu index="/home/system" class="firstMenu"> |
| | | <template slot="title" class="firstSpan"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon :icon-class="item.icon"></svg-icon> |
| | | <!-- <i class="el-icon-reading"></i> --> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="system"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">{{item.name}}</span> |
| | | <span class="fisrtSpan">系统设置</span> |
| | | </template> |
| | | </el-menu-item> |
| | | <!-- 基本设置 --> |
| | | <el-submenu index="/home/system/base" class="secondMenu"> |
| | | <template slot="title"> |
| | | <span class="secondSpan">基本设置</span> |
| | | </template> |
| | | <!-- 用户管理 --> |
| | | <el-submenu index="/home/system/base/user" class="thirdMenu"> |
| | | <template slot="title"> |
| | | <span class="thirdSpan">用户管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/system/user">用户列表</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 角色管理 --> |
| | | <el-submenu index="/home/system/base/role" class="thirdMenu"> |
| | | <template slot="title"> |
| | | <span class="thirdSpan">角色管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/system/role">角色管理列表</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 权限管理 --> |
| | | <el-submenu index="/home/system/base/authority" class="thirdMenu"> |
| | | <template slot="title"> |
| | | <span class="thirdSpan">权限管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/system/authority">设置权限</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 部门管理 --> |
| | | <el-submenu index="/home/system/base/department" class="thirdMenu"> |
| | | <template slot="title"> |
| | | <span class="thirdSpan">部门管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/system/department">部门管理</el-menu-item> |
| | | </el-submenu> |
| | | </el-submenu> |
| | | <!-- 平台设置 --> |
| | | <el-submenu index="/home/article/add" class="secondMenu"> |
| | | <template slot="title"> |
| | | <span class="secondSpan">平台设置</span> |
| | | </template> |
| | | <el-menu-item index="/home/system/portalSetting">门户设置</el-menu-item> |
| | | <el-menu-item index="/home/system/otherInterface">第三方接口管理</el-menu-item> |
| | | </el-submenu> |
| | | </el-submenu> |
| | | <!-- 运营管理模块 --> |
| | | <el-submenu index="/home/operate" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="operate"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">运营管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/article/add">执法管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">调度管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">店铺管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">车辆管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">图片管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">视频管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">消息管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">审核管理</el-menu-item> |
| | | <el-menu-item index="/home/article/add">短信管理</el-menu-item> |
| | | <el-menu-item index="/home/article">算法模型管理</el-menu-item> |
| | | <el-menu-item index="/home/article">日志管理</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 视频巡查模块 --> |
| | | <el-submenu index="/home/video" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="video"></svg-icon> |
| | | </span> |
| | | <span slot="title" class="fisrtSpan">视频巡查</span> |
| | | </template> |
| | | <el-menu-item index="/home/video">视频巡查</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 油烟信息查询模块 --> |
| | | <el-submenu index="/home/lampblack" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="intelligence"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">油烟信息查询</span> |
| | | </template> |
| | | <el-menu-item index="/home/article/add">预警研判</el-menu-item> |
| | | <el-menu-item index="/home/article">违规检索</el-menu-item> |
| | | <el-menu-item index="/home/article">趋势分析</el-menu-item> |
| | | <el-menu-item index="/home/article">数据统计</el-menu-item> |
| | | <el-menu-item index="/home/article">运行报告</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 执法管理模块 --> |
| | | <el-submenu index="/home/law" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="intelligence"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">执法管理</span> |
| | | </template> |
| | | <el-menu-item index="/home/article/add">预警研判</el-menu-item> |
| | | <el-menu-item index="/home/article">违规检索</el-menu-item> |
| | | <el-menu-item index="/home/article">趋势分析</el-menu-item> |
| | | <el-menu-item index="/home/article">数据统计</el-menu-item> |
| | | <el-menu-item index="/home/article">运行报告</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 智能巡查模块 --> |
| | | <el-submenu index="/home/intellect" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="intelligence"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">智能巡查</span> |
| | | </template> |
| | | <el-menu-item index="/home/article/add">预警研判</el-menu-item> |
| | | <el-menu-item index="/home/article">违规检索</el-menu-item> |
| | | <el-menu-item index="/home/article">趋势分析</el-menu-item> |
| | | <el-menu-item index="/home/article">数据统计</el-menu-item> |
| | | <el-menu-item index="/home/article">运行报告</el-menu-item> |
| | | </el-submenu> |
| | | <!-- 平台基本信息 --> |
| | | <el-submenu index="/home/info" class="firstMenu"> |
| | | <template slot="title"> |
| | | <span slot="prefix" class="icon-padding fisrtSpan"> |
| | | <svg-icon icon-class="intelligence"></svg-icon> |
| | | </span> |
| | | <span class="fisrtSpan">平台基本信息</span> |
| | | </template> |
| | | <el-menu-item index="/home/article/add">预警研判</el-menu-item> |
| | | <el-menu-item index="/home/article">违规检索</el-menu-item> |
| | | <el-menu-item index="/home/article">趋势分析</el-menu-item> |
| | | <el-menu-item index="/home/article">数据统计</el-menu-item> |
| | | <el-menu-item index="/home/article">运行报告</el-menu-item> |
| | | </el-submenu> |
| | | </el-menu> |
| | | </el-scrollbar> |
| | | </el-aside> |
| | |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | menu: [ |
| | | { |
| | | name: "系统设置", icon: "system", index: "/home/system", |
| | | }, |
| | | { |
| | | name: "运营管理", icon: "operate", index: "/home/operate", |
| | | }, |
| | | { |
| | | name: "视频巡查", icon: "video", index: "/home/video", |
| | | }, |
| | | { |
| | | name: "油烟信息查询", icon: "intelligence", index: "/home/lampblack", |
| | | }, |
| | | { |
| | | name: "执法管理", icon: "intelligence", index: "/home/law", |
| | | }, |
| | | { |
| | | name: "智能巡查", icon: "intelligence", index: "/home/intellect", |
| | | }, |
| | | { |
| | | name: "平台基本信息", icon: "intelligence", index: "/home/info", |
| | | } |
| | | ], |
| | | } |
| | | }, |
| | | methods:{ |
| | | Jump(url){ |
| | | this.$router.push(url); |
| | | } |
| | | } |
| | | |
| | | }; |
| | | </script> |
| | | |
| | |
| | | .icon-padding { |
| | | padding-right: 10px; |
| | | } |
| | | .menu { |
| | | .el-aside { |
| | | background: #07162e; |
| | | color: #e9eef3; |
| | | text-align: center; |
| | |
| | | top: 0; |
| | | left: 0; |
| | | z-index: 999; |
| | | background-color: #08162f; |
| | | // box-shadow: 0 -5px 5px #0ff inset; |
| | | } |
| | | |
| | | .MenuScroll { |
| | | .el-scrollbar { |
| | | height: calc(100vh - 66px); |
| | | box-sizing: border-box; |
| | | margin-top: 66px; |
| | | box-sizing: border-box; |
| | | .el-menu { |
| | | background: linear-gradient(#07162e, #0f2b56); |
| | | border: 0; |
| | | |
| | | .firstMenu { |
| | | background: #07162e; |
| | | background: #07162e; |
| | | text-align: left; |
| | | &:hover .fisrtSpan { |
| | | color: #fff; |
| | | &:hover .fisrtSpan{ |
| | | color: #22d3eb; |
| | | } |
| | | |
| | | span { |
| | | span,span { |
| | | color: #e9eef3; |
| | | } |
| | | |
| | | .el-menu-item { |
| | | color: #c3c3c4; |
| | | color: #e9eef3; |
| | | background-color: #07162e; |
| | | &:hover { |
| | | color: #fff; |
| | | background-color: #0c2c4c; |
| | | color: #22d3eb; |
| | | } |
| | | } |
| | | |
| | | .is-active { |
| | | background-color: #07162e; |
| | | color: #22d3eb; |
| | | } |
| | | } |
| | | |
| | | .secondMenu{ |
| | | &:hover .secondSpan{ |
| | | color: #22d3eb; |
| | | } |
| | | } |
| | | .thirdMenu{ |
| | | &:hover .thirdSpan{ |
| | | color: #22d3eb; |
| | | } |
| | | } |
| | | .is-active { |
| | | background-color: #07162e; |
| | | background-color: #092c4a; |
| | | } |
| | | } |
| | | |
| | | .el-scrollbar__wrap { |
| | | overflow-x: hidden; |
| | | } |
| | |
| | | <el-container id="body-wrapper"> |
| | | <!-- 侧边导航栏 --> |
| | | <Menu /> |
| | | <el-container> |
| | | <el-container class="content"> |
| | | <!-- 头部 --> |
| | | <Header /> |
| | | <!-- 内容区域 --> |
| | |
| | | margin-top: 60px; |
| | | } |
| | | |
| | | .my-el-container { |
| | | .content{ |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nickName" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <el-form-item class="optionItem" label="所属用户姓名:" prop="username"> |
| | | <el-input v-model="user.username" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.isDy"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.mobile" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.email" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.userType" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.departmentId" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 0, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const {user} = this; |
| | | console.log(user); |
| | | this.$axios.post('sccg/admin/register',{ |
| | | departmentId:user.departmentId, |
| | | email:user.email, |
| | | jsDy:user.isDy, |
| | | jobTitle:user.jobTitle, |
| | | mobile:user.mobile, |
| | | nickName:user.nickName, |
| | | password:user.password, |
| | | userType:user.userType, |
| | | username:user.username, |
| | | }).then(res=>{ |
| | | if(res.code === 200){ |
| | | this.refresh(); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | props:['refresh'] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="userList"> |
| | | <header> |
| | | <div class="headerTitle">数据筛选</div> |
| | | <div class="headerContent"> |
| | | <div class="search"> |
| | | <span>筛选条件:</span> |
| | | <el-input placeholder="请输入内容"></el-input> |
| | | <div class="findBtn"> |
| | | <el-button type="primary">查询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="addUser"> |
| | | <el-button type="primary">添加用户</el-button> |
| | | <el-button class="addBtn" type="primary" @click="dialogCreate = true">添加用户</el-button> |
| | | <el-dialog :visible.sync="dialogCreate" width="45%"> |
| | | <createUser :refresh="getUserList" /> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">数据列表</div> |
| | | <div class="mainContent"> |
| | | <el-table border ref="multipleTable" |
| | | :header-cell-style="{background:'#f5f5f5','font-size':'12px',color:'#666666','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" tooltip-effect="dark" style="width: 100%"> |
| | | <el-table ref="multipleTable" |
| | | :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"> |
| | | <el-table-column type="selection" width="55"> |
| | | </el-table-column> |
| | | <el-table-column label="用户ID" width="67"> |
| | | <template slot-scope="scope">{{ scope.row.id }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="用户名称" width="82"> |
| | | <el-table-column prop="nickName" label="用户名称" width="82"> |
| | | </el-table-column> |
| | | <el-table-column prop="true_name" label="所属姓名" width="76"> |
| | | <el-table-column prop="username" label="所属姓名" width="76"> |
| | | </el-table-column> |
| | | <el-table-column prop="phone" label="联系方式" width="81"> |
| | | <el-table-column prop="mobile" label="联系方式" width="81"> |
| | | </el-table-column> |
| | | <el-table-column prop="role" label="所属角色" width="87"> |
| | | <el-table-column prop="note" label="所属角色" width="87"> |
| | | </el-table-column> |
| | | <el-table-column prop="department" label="所属部门" width="80"> |
| | | <el-table-column prop="departName" label="所属部门" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="work" label="所属职务" width="83"> |
| | | <el-table-column prop="jobTitle" label="所属职务" width="83"> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" width="128"> |
| | | </el-table-column> |
| | | <el-table-column prop="is_open" label="启用" width="90"> |
| | | <el-table-column prop="status" label="启用" width="90"> |
| | | <template slot-scope="scope"> |
| | | <el-switch v-model="scope.row.is_open" active-color="##0079fe" inactive-color="#ff4949"> |
| | | <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关" |
| | | active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operation" label="操作" width="246"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini">编辑</el-button> |
| | | <el-button size="mini" type="danger">删除</el-button> |
| | | <div class="operation"> |
| | | <!-- <span @click="handleChangeRole(scope.row)">修改角色</span> --> |
| | | <span>查看</span> |
| | | <!-- <span>修改密码</span> --> |
| | | <!-- <span>删除</span> --> |
| | | <span>修改部门</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-dialog :visible.sync="dialogUpdate" width="45%"> |
| | | <updateUser /> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import createUser from "./createUser" |
| | | import updateUser from "./updateUser" |
| | | import helper from "@/utils/mydate.js" |
| | | export default { |
| | | components: { |
| | | createUser, updateUser |
| | | }, |
| | | data() { |
| | | return { |
| | | tableData: [ |
| | | { |
| | | createTime: '2016-05-02', |
| | | name: 'admin', |
| | | address: '上海市普陀区金沙江路 1518 弄', |
| | | role: '超级管理员', |
| | | is_open: true, |
| | | } |
| | | ] |
| | | tableData: [], |
| | | dialogCreate: false, |
| | | dialogUpdate: false, |
| | | user: '', |
| | | } |
| | | }, |
| | | created() { |
| | | this.getUserList(); |
| | | }, |
| | | methods: { |
| | | // 修改角色 |
| | | handleChangeRole(obj) { |
| | | this.dialogUpdate = true |
| | | this.user = obj; |
| | | // console.log(obj) |
| | | }, |
| | | // 修改用户状态 |
| | | handleChangeStatus(obj) { |
| | | let { id, status } = obj; |
| | | status == true ? status = 1 : status = 0; |
| | | console.log(id, status); |
| | | this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => { |
| | | console.log(res); |
| | | }) |
| | | }, |
| | | // 获取用户列表 |
| | | getUserList() { |
| | | const that = this; |
| | | this.dialogCreate = false; |
| | | // 获取所有用户信息 |
| | | this.$axios.get('sccg/admin/list').then(res => { |
| | | if (res.code === 200) { |
| | | res.data.records.forEach(item => { |
| | | item.createTime = helper(item.createTime); |
| | | item.status == 1 ? item.status = true : item.status = false; |
| | | }) |
| | | that.tableData = res.data.records; |
| | | } |
| | | }) |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | <style lang="scss"> |
| | | .userList { |
| | | text-align: left; |
| | | margin: 10px 20px; |
| | | color: #4b9bb7; |
| | | |
| | | header { |
| | | background-color: #fff; |
| | | |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | padding: 0 20px; |
| | | color: #666; |
| | | line-height: 50px; |
| | | border-bottom: 1px solid #f0f2f5; |
| | | } |
| | | background-color: #09152f; |
| | | |
| | | .headerContent { |
| | | padding: 0 40px; |
| | | display: flex; |
| | | line-height: 100px; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | .search { |
| | | display: flex; |
| | |
| | | .el-input { |
| | | flex: 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | .findBtn { |
| | | line-height: 100px; |
| | | margin-left: 15px; |
| | | display: flex; |
| | | align-items: center; |
| | | margin-top: -2px; |
| | | |
| | | .el-button { |
| | | padding: 12px 25px; |
| | | border-radius: 20px; |
| | | } |
| | | } |
| | | |
| | | .addBtn { |
| | | background-color: #eb5d01; |
| | | border: none; |
| | | border-radius: 20px; |
| | | padding: 12px 30px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | main { |
| | | background-color: #fff; |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding: 0 10px; |
| | | // padding: 0 40px; |
| | | padding-bottom: 50px; |
| | | |
| | | .mainTitle { |
| | | line-height: 60px; |
| | | } |
| | | .el-table{ |
| | | font-size: 10px; |
| | | } |
| | | } |
| | | |
| | | .el-table { |
| | | color: #4b9bb7; |
| | | font-size: 10px; |
| | | |
| | | .operation { |
| | | display: flex; |
| | | // justify-content: space-around; |
| | | color: #0079fe; |
| | | span{ |
| | | margin-left: 10px; |
| | | } |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table .warning-row { |
| | | background: #06122c; |
| | | } |
| | | .el-input__inner{ |
| | | background-color: #09152f; |
| | | } |
| | | .el-table .success-row { |
| | | background: #071f39; |
| | | } |
| | | .switchStyle .el-switch__label { |
| | | position: absolute; |
| | | display: none; |
| | | color: #fff; |
| | | } |
| | | .el-switch__core{ |
| | | background-color: rgba(166, 166, 166, 1) ; |
| | | } |
| | | .switchStyle .el-switch__label--left { |
| | | z-index: 9; |
| | | left: 20px; |
| | | } |
| | | .switchStyle .el-switch__label--right { |
| | | z-index: 9; |
| | | left: 4px; |
| | | } |
| | | .switchStyle .el-switch__label.is-active { |
| | | display: block; |
| | | } |
| | | .switchStyle.el-switch .el-switch__core, |
| | | .el-switch .el-switch__label { |
| | | width: 50px !important; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nick_name" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <!-- <el-form-item class="optionItem" label="所属用户姓名:" prop="true_name"> |
| | | <el-input v-model="user.true_name" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.member"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.phone" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.mail" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.type" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.department" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 1, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const that = this; |
| | | console.log(this.user); |
| | | // this.$axios.post('sccg/admin/register',that.user).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | } |
| | | }, |
| | | props:[] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nickName" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <el-form-item class="optionItem" label="所属用户姓名:" prop="username"> |
| | | <el-input v-model="user.username" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.isDy"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.mobile" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.email" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.userType" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.departmentId" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 0, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const {user} = this; |
| | | console.log(user); |
| | | this.$axios.post('sccg/admin/register',{ |
| | | departmentId:user.departmentId, |
| | | email:user.email, |
| | | jsDy:user.isDy, |
| | | jobTitle:user.jobTitle, |
| | | mobile:user.mobile, |
| | | nickName:user.nickName, |
| | | password:user.password, |
| | | userType:user.userType, |
| | | username:user.username, |
| | | }).then(res=>{ |
| | | if(res.code === 200){ |
| | | this.refresh(); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | props:['refresh'] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="userList"> |
| | | <header> |
| | | <div class="headerTitle">数据筛选</div> |
| | | <div class="headerContent"> |
| | | <div class="search"> |
| | | <span>筛选条件:</span> |
| | | <el-input placeholder="请输入内容"></el-input> |
| | | <div class="findBtn"> |
| | | <el-button type="primary">查询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="addUser"> |
| | | <el-button type="primary">添加用户</el-button> |
| | | <el-button class="addBtn" type="primary" @click="dialogCreate = true">添加用户</el-button> |
| | | <el-dialog :visible.sync="dialogCreate" width="45%"> |
| | | <createUser :refresh="getUserList" /> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">数据列表</div> |
| | | <div class="mainContent"> |
| | | <el-table border ref="multipleTable" |
| | | :header-cell-style="{background:'#f5f5f5','font-size':'12px',color:'#666666','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" tooltip-effect="dark" style="width: 100%"> |
| | | <el-table ref="multipleTable" |
| | | :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"> |
| | | <el-table-column type="selection" width="55"> |
| | | </el-table-column> |
| | | <el-table-column label="用户ID" width="67"> |
| | | <template slot-scope="scope">{{ scope.row.id }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="用户名称" width="82"> |
| | | <el-table-column prop="nickName" label="用户名称" width="82"> |
| | | </el-table-column> |
| | | <el-table-column prop="true_name" label="所属姓名" width="76"> |
| | | <el-table-column prop="username" label="所属姓名" width="76"> |
| | | </el-table-column> |
| | | <el-table-column prop="phone" label="联系方式" width="81"> |
| | | <el-table-column prop="mobile" label="联系方式" width="81"> |
| | | </el-table-column> |
| | | <el-table-column prop="role" label="所属角色" width="87"> |
| | | <el-table-column prop="note" label="所属角色" width="87"> |
| | | </el-table-column> |
| | | <el-table-column prop="department" label="所属部门" width="80"> |
| | | <el-table-column prop="departName" label="所属部门" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="work" label="所属职务" width="83"> |
| | | <el-table-column prop="jobTitle" label="所属职务" width="83"> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" width="128"> |
| | | </el-table-column> |
| | | <el-table-column prop="is_open" label="启用" width="90"> |
| | | <el-table-column prop="status" label="启用" width="90"> |
| | | <template slot-scope="scope"> |
| | | <el-switch v-model="scope.row.is_open" active-color="##0079fe" inactive-color="#ff4949"> |
| | | <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关" |
| | | active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operation" label="操作" width="246"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini">编辑</el-button> |
| | | <el-button size="mini" type="danger">删除</el-button> |
| | | <div class="operation"> |
| | | <!-- <span @click="handleChangeRole(scope.row)">修改角色</span> --> |
| | | <span>查看</span> |
| | | <!-- <span>修改密码</span> --> |
| | | <!-- <span>删除</span> --> |
| | | <span>修改部门</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-dialog :visible.sync="dialogUpdate" width="45%"> |
| | | <updateUser /> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import createUser from "./createUser" |
| | | import updateUser from "./updateUser" |
| | | import helper from "@/utils/mydate.js" |
| | | export default { |
| | | components: { |
| | | createUser, updateUser |
| | | }, |
| | | data() { |
| | | return { |
| | | tableData: [ |
| | | { |
| | | createTime: '2016-05-02', |
| | | name: 'admin', |
| | | address: '上海市普陀区金沙江路 1518 弄', |
| | | role: '超级管理员', |
| | | is_open: true, |
| | | } |
| | | ] |
| | | tableData: [], |
| | | dialogCreate: false, |
| | | dialogUpdate: false, |
| | | user: '', |
| | | } |
| | | }, |
| | | created() { |
| | | this.getUserList(); |
| | | }, |
| | | methods: { |
| | | // 修改角色 |
| | | handleChangeRole(obj) { |
| | | this.dialogUpdate = true |
| | | this.user = obj; |
| | | // console.log(obj) |
| | | }, |
| | | // 修改用户状态 |
| | | handleChangeStatus(obj) { |
| | | let { id, status } = obj; |
| | | status == true ? status = 1 : status = 0; |
| | | console.log(id, status); |
| | | this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => { |
| | | console.log(res); |
| | | }) |
| | | }, |
| | | // 获取用户列表 |
| | | getUserList() { |
| | | const that = this; |
| | | this.dialogCreate = false; |
| | | // 获取所有用户信息 |
| | | this.$axios.get('sccg/admin/list').then(res => { |
| | | if (res.code === 200) { |
| | | res.data.records.forEach(item => { |
| | | item.createTime = helper(item.createTime); |
| | | item.status == 1 ? item.status = true : item.status = false; |
| | | }) |
| | | that.tableData = res.data.records; |
| | | } |
| | | }) |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | <style lang="scss"> |
| | | .userList { |
| | | text-align: left; |
| | | margin: 10px 20px; |
| | | color: #4b9bb7; |
| | | |
| | | header { |
| | | background-color: #fff; |
| | | |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | padding: 0 20px; |
| | | color: #666; |
| | | line-height: 50px; |
| | | border-bottom: 1px solid #f0f2f5; |
| | | } |
| | | background-color: #09152f; |
| | | |
| | | .headerContent { |
| | | padding: 0 40px; |
| | | display: flex; |
| | | line-height: 100px; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | .search { |
| | | display: flex; |
| | |
| | | .el-input { |
| | | flex: 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | .findBtn { |
| | | line-height: 100px; |
| | | margin-left: 15px; |
| | | display: flex; |
| | | align-items: center; |
| | | margin-top: -2px; |
| | | |
| | | .el-button { |
| | | padding: 12px 25px; |
| | | border-radius: 20px; |
| | | } |
| | | } |
| | | |
| | | .addBtn { |
| | | background-color: #eb5d01; |
| | | border: none; |
| | | border-radius: 20px; |
| | | padding: 12px 30px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | main { |
| | | background-color: #fff; |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding: 0 10px; |
| | | // padding: 0 40px; |
| | | padding-bottom: 50px; |
| | | |
| | | .mainTitle { |
| | | line-height: 60px; |
| | | } |
| | | .el-table{ |
| | | font-size: 10px; |
| | | } |
| | | } |
| | | |
| | | .el-table { |
| | | color: #4b9bb7; |
| | | font-size: 10px; |
| | | |
| | | .operation { |
| | | display: flex; |
| | | // justify-content: space-around; |
| | | color: #0079fe; |
| | | span{ |
| | | margin-left: 10px; |
| | | } |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table .warning-row { |
| | | background: #06122c; |
| | | } |
| | | .el-input__inner{ |
| | | background-color: #09152f; |
| | | } |
| | | .el-table .success-row { |
| | | background: #071f39; |
| | | } |
| | | .switchStyle .el-switch__label { |
| | | position: absolute; |
| | | display: none; |
| | | color: #fff; |
| | | } |
| | | .el-switch__core{ |
| | | background-color: rgba(166, 166, 166, 1) ; |
| | | } |
| | | .switchStyle .el-switch__label--left { |
| | | z-index: 9; |
| | | left: 20px; |
| | | } |
| | | .switchStyle .el-switch__label--right { |
| | | z-index: 9; |
| | | left: 4px; |
| | | } |
| | | .switchStyle .el-switch__label.is-active { |
| | | display: block; |
| | | } |
| | | .switchStyle.el-switch .el-switch__core, |
| | | .el-switch .el-switch__label { |
| | | width: 50px !important; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nick_name" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <!-- <el-form-item class="optionItem" label="所属用户姓名:" prop="true_name"> |
| | | <el-input v-model="user.true_name" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.member"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.phone" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.mail" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.type" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.department" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 1, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const that = this; |
| | | console.log(this.user); |
| | | // this.$axios.post('sccg/admin/register',that.user).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | } |
| | | }, |
| | | props:[] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nickName" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <el-form-item class="optionItem" label="所属用户姓名:" prop="username"> |
| | | <el-input v-model="user.username" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.isDy"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.mobile" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.email" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.userType" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.departmentId" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 0, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const {user} = this; |
| | | console.log(user); |
| | | this.$axios.post('sccg/admin/register',{ |
| | | departmentId:user.departmentId, |
| | | email:user.email, |
| | | jsDy:user.isDy, |
| | | jobTitle:user.jobTitle, |
| | | mobile:user.mobile, |
| | | nickName:user.nickName, |
| | | password:user.password, |
| | | userType:user.userType, |
| | | username:user.username, |
| | | }).then(res=>{ |
| | | if(res.code === 200){ |
| | | this.refresh(); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | props:['refresh'] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="userList"> |
| | | <header> |
| | | <div class="headerTitle">数据筛选</div> |
| | | <div class="headerContent"> |
| | | <div class="search"> |
| | | <span>筛选条件:</span> |
| | | <el-input placeholder="请输入内容"></el-input> |
| | | <div class="findBtn"> |
| | | <el-button type="primary">查询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="addUser"> |
| | | <el-button type="primary">新建角色</el-button> |
| | | <el-button class="addBtn" type="primary" @click="dialogCreate = true">添加用户</el-button> |
| | | <el-dialog :visible.sync="dialogCreate" width="45%"> |
| | | <createUser :refresh="getUserList" /> |
| | | </el-dialog> |
| | | </div> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">数据列表</div> |
| | | <div class="mainContent"> |
| | | <el-table border ref="multipleTable" |
| | | :header-cell-style="{background:'#f5f5f5','font-size':'12px',color:'#666666','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" tooltip-effect="dark" style="width: 100%"> |
| | | <el-table ref="multipleTable" |
| | | :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"> |
| | | <el-table-column type="selection" width="55"> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="用户名称" width="82"> |
| | | <el-table-column label="用户ID" width="80"> |
| | | <template slot-scope="scope">{{ scope.row.id }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="true_name" label="角色类型" width="76"> |
| | | <el-table-column prop="nickName" label="用户名称" width="100"> |
| | | </el-table-column> |
| | | <el-table-column prop="phone" label="默认角色" width="81"> |
| | | <el-table-column prop="username" label="所属姓名" width="76"> |
| | | </el-table-column> |
| | | <el-table-column prop="role" label="备注" width="87"> |
| | | <el-table-column prop="mobile" label="联系方式" width="81"> |
| | | </el-table-column> |
| | | <el-table-column prop="is_open" label="状态" width="90"> |
| | | <el-table-column prop="note" label="所属角色" width="87"> |
| | | </el-table-column> |
| | | <el-table-column prop="departName" label="所属部门" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="jobTitle" label="所属职务" width="83"> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" width="128"> |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="启用" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-switch v-model="scope.row.is_open" active-color="##0079fe" inactive-color="#ff4949"> |
| | | <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关" |
| | | active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operation" label="操作" width="246" class="operation"> |
| | | <el-table-column prop="operation" label="操作" width="500"> |
| | | <template slot-scope="scope"> |
| | | <span>查看</span> |
| | | <span>权限设置</span> |
| | | <span>停用</span> |
| | | <div class="operation"> |
| | | <!-- <span @click="handleChangeRole(scope.row)">修改角色</span> --> |
| | | <span>查看</span> |
| | | <!-- <span>修改密码</span> --> |
| | | <!-- <span>删除</span> --> |
| | | <span>修改部门</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-dialog :visible.sync="dialogUpdate" width="45%"> |
| | | <updateUser /> |
| | | </el-dialog> |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import createUser from "./createUser" |
| | | import updateUser from "./updateUser" |
| | | import helper from "@/utils/mydate.js" |
| | | export default { |
| | | components: { |
| | | createUser, updateUser |
| | | }, |
| | | data() { |
| | | return { |
| | | tableData: [ |
| | | { |
| | | createTime: '2016-05-02', |
| | | name: 'admin', |
| | | address: '上海市普陀区金沙江路 1518 弄', |
| | | role: '超级管理员', |
| | | is_open: true, |
| | | } |
| | | ] |
| | | tableData: [], |
| | | dialogCreate: false, |
| | | dialogUpdate: false, |
| | | user: '', |
| | | } |
| | | }, |
| | | created() { |
| | | this.getUserList(); |
| | | }, |
| | | methods: { |
| | | // 修改角色 |
| | | handleChangeRole(obj) { |
| | | this.dialogUpdate = true |
| | | this.user = obj; |
| | | // console.log(obj) |
| | | }, |
| | | // 修改用户状态 |
| | | handleChangeStatus(obj) { |
| | | let { id, status } = obj; |
| | | status == true ? status = 1 : status = 0; |
| | | console.log(id, status); |
| | | this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => { |
| | | console.log(res); |
| | | }) |
| | | }, |
| | | // 获取用户列表 |
| | | getUserList() { |
| | | const that = this; |
| | | this.dialogCreate = false; |
| | | // 获取所有用户信息 |
| | | this.$axios.get('sccg/admin/list').then(res => { |
| | | if (res.code === 200) { |
| | | res.data.records.forEach(item => { |
| | | item.createTime = helper(item.createTime); |
| | | item.status == 1 ? item.status = true : item.status = false; |
| | | }) |
| | | that.tableData = res.data.records; |
| | | } |
| | | }) |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | <style lang="scss"> |
| | | .userList { |
| | | text-align: left; |
| | | margin: 10px 20px; |
| | | color: #4b9bb7; |
| | | |
| | | header { |
| | | background-color: #fff; |
| | | |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | padding: 0 20px; |
| | | color: #666; |
| | | line-height: 50px; |
| | | border-bottom: 1px solid #f0f2f5; |
| | | } |
| | | background-color: #09152f; |
| | | |
| | | .headerContent { |
| | | padding: 0 40px; |
| | | display: flex; |
| | | line-height: 100px; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | .search { |
| | | display: flex; |
| | |
| | | .el-input { |
| | | flex: 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | .findBtn { |
| | | line-height: 100px; |
| | | margin-left: 15px; |
| | | display: flex; |
| | | align-items: center; |
| | | margin-top: -2px; |
| | | |
| | | .el-button { |
| | | padding: 12px 25px; |
| | | border-radius: 20px; |
| | | } |
| | | } |
| | | |
| | | .addBtn { |
| | | background-color: #eb5d01; |
| | | border: none; |
| | | border-radius: 20px; |
| | | padding: 12px 30px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | main { |
| | | background-color: #fff; |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding: 0 10px; |
| | | // padding: 0 40px; |
| | | padding-bottom: 50px; |
| | | |
| | | .mainTitle { |
| | | line-height: 60px; |
| | | } |
| | | .el-table{ |
| | | font-size: 10px; |
| | | } |
| | | } |
| | | |
| | | .el-table { |
| | | color: #4b9bb7; |
| | | font-size: 10px; |
| | | .operation { |
| | | display: flex; |
| | | // justify-content: space-around; |
| | | color: #0079fe; |
| | | span{ |
| | | margin-left: 10px; |
| | | } |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table .warning-row { |
| | | background: #06122c; |
| | | } |
| | | .el-input__inner{ |
| | | background-color: #09152f; |
| | | } |
| | | .el-table .success-row { |
| | | background: #071f39; |
| | | } |
| | | .switchStyle .el-switch__label { |
| | | position: absolute; |
| | | display: none; |
| | | color: #fff; |
| | | } |
| | | .el-switch__core{ |
| | | background-color: rgba(166, 166, 166, 1) ; |
| | | } |
| | | .switchStyle .el-switch__label--left { |
| | | z-index: 9; |
| | | left: 20px; |
| | | } |
| | | .switchStyle .el-switch__label--right { |
| | | z-index: 9; |
| | | left: 4px; |
| | | } |
| | | .switchStyle .el-switch__label.is-active { |
| | | display: block; |
| | | } |
| | | .switchStyle.el-switch .el-switch__core, |
| | | .el-switch .el-switch__label { |
| | | width: 50px !important; |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="createUser"> |
| | | <header> |
| | | <div class="headerTitle">新增账户</div> |
| | | <div class="headerTip"> |
| | | <span>*</span> |
| | | <label>为必填项</label> |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">基础信息</div> |
| | | <div class="mainContent"> |
| | | <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" |
| | | label-position="right"> |
| | | <!-- 用户名称 --> |
| | | <el-form-item class="optionItem" label="用户名称:" prop="nickName"> |
| | | <el-input v-model="user.nick_name" placeholder="填写用户名称"></el-input> |
| | | </el-form-item> |
| | | <!-- 用户密码 --> |
| | | <el-form-item class="optionItems" label="用户密码:" prop="password"> |
| | | <el-input v-model="user.password" type="password" placeholder="请输入用户密码"></el-input> |
| | | </el-form-item> |
| | | <!-- 所属用户姓名 --> |
| | | <!-- <el-form-item class="optionItem" label="所属用户姓名:" prop="true_name"> |
| | | <el-input v-model="user.true_name" placeholder="请填写用户姓名"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 性别 --> |
| | | <!-- <el-form-item class="optionItem" label="性别:" prop="gender"> |
| | | <el-radio-group v-model="user.gender"> |
| | | <el-radio :label="1">男</el-radio> |
| | | <el-radio :label="2">女</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | <!-- 是否党员 --> |
| | | <el-form-item class="optionItem" label="是否党员:" prop="isDy"> |
| | | <el-radio-group v-model="user.member"> |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <!-- 所属手机号码 --> |
| | | <el-form-item class="optionItem" label="所属手机号码:" prop="mobile"> |
| | | <el-input v-model="user.phone" placeholder="请填写手机号码"></el-input> |
| | | </el-form-item> |
| | | <!-- 邮箱地址 --> |
| | | <el-form-item class="optionItem" label="邮箱地址:" prop="email"> |
| | | <el-input v-model="user.mail" placeholder="请填写邮箱地址"></el-input> |
| | | </el-form-item> |
| | | <!-- 选择角色 --> |
| | | <!-- <el-form-item class="optionItem" label="选择角色:" prop="role"> |
| | | <el-select v-model="user.role" placeholder="请选择所属角色"> |
| | | <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <!-- 用户类型 --> |
| | | <el-form-item class="optionItem" label="用户类型:" prop="userType"> |
| | | <el-select v-model="user.type" placeholder="请选择用户类型"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 座机/分机 --> |
| | | <el-form-item class="optionItem" label="座机/分机:" prop="zj"> |
| | | <div class="optionHandleSp"> |
| | | <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="电话区号"> |
| | | </el-input> |
| | | <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="电话号码"> |
| | | </el-input> |
| | | <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="分机号码"> |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <!-- 所属部门 --> |
| | | <el-form-item class="optionItem" label="所属部门:" prop="departmentId"> |
| | | <el-select v-model="user.department" placeholder="请选择所属部门"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.departName" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 当前职务 --> |
| | | <el-form-item class="optionItem" label="当前职务:" prop="jobTitle"> |
| | | <el-select v-model="user.work" placeholder="请选择当前职务"> |
| | | <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" |
| | | :disabled="item.disabled"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- 填写所属mac地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属mac地址:" prop="mac"> |
| | | <el-input v-model="user.mac" placeholder="请填写所属mac地址"></el-input> |
| | | </el-form-item> --> |
| | | <!-- 填写所属ip地址 --> |
| | | <!-- <el-form-item class="optionItem" label="填写所属ip地址:" prop="ip"> |
| | | <el-input v-model="user.ip" placeholder="请填写所属ip地址"></el-input> |
| | | </el-form-item> --> |
| | | <el-form-item class="optionBtn"> |
| | | <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交</el-button> |
| | | <el-button class="btn reset">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | </div> |
| | | </main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | const validateNickname = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户名称")); |
| | | } |
| | | }; |
| | | const validatePass = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | const rep = /^\w+$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串")); |
| | | } |
| | | } |
| | | }; |
| | | const validateTruename = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写用户姓名")); |
| | | } else { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的用户姓名"); |
| | | } |
| | | } |
| | | }; |
| | | const validatePhone = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写手机号码")); |
| | | } else { |
| | | const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ |
| | | if(!rep.test(value)){ |
| | | callback("请输入正确的手机号码"); |
| | | } |
| | | } |
| | | }; |
| | | const validateMail = (rule, value, callback) => { |
| | | if (value) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | if(!rep.test(value)){ |
| | | callback(new Error("请输入正确的邮箱")) |
| | | } |
| | | } |
| | | }; |
| | | const validateRole = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateType = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateDepartment = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateWork = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateMac = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const validateIp = (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error("请填写登录密码")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | user: { |
| | | nickName: '', |
| | | password: '', |
| | | username: '', |
| | | // gender: 1, |
| | | isDy: 1, |
| | | mobile: '', |
| | | email: '', |
| | | // role: null, |
| | | userType: null, |
| | | zj: { |
| | | areaNumber: '', |
| | | phoneNumber: "", |
| | | moreNumber: "", |
| | | }, |
| | | departmentId: null, |
| | | jobTitle: null, |
| | | // mac: '', |
| | | // ip: '', |
| | | }, |
| | | createUserRules: { |
| | | nickName: [ |
| | | { required: true, trigger: "blur", validator: validateNickname }, |
| | | ], |
| | | password: [ |
| | | { required: true, trigger: "blur", validator: validatePass }, |
| | | ], |
| | | username: [ |
| | | { required: true, trigger: "blur", validator: validateTruename }, |
| | | ], |
| | | // gender: [ |
| | | // { required: true, trigger: "blur" }, |
| | | // ], |
| | | isDy: [ |
| | | { required: true, trigger: "blur" }, |
| | | ], |
| | | mobile: [ |
| | | { required: true, trigger: "blur", validator: validatePhone }, |
| | | ], |
| | | email: [ |
| | | { required: false, trigger: "blur", validator: validateMail }, |
| | | ], |
| | | // role: [ |
| | | // { required: true, trigger: "blur", validator: validateRole }, |
| | | // ], |
| | | userType: [ |
| | | { required: true, trigger: "blur", validator: validateType }, |
| | | ], |
| | | zj: [ |
| | | { required: false, trigger: "blur" }, |
| | | ], |
| | | departmentId: [ |
| | | { required: true, trigger: "blur", validator: validateDepartment }, |
| | | ], |
| | | jobTitle: [ |
| | | { required: true, trigger: "blur", validator: validateWork }, |
| | | ], |
| | | // mac: [ |
| | | // { required: false, trigger: "blur", validator: validateMac }, |
| | | // ], |
| | | // ip: [ |
| | | // { required: false, trigger: "blur", validator: validateIp }, |
| | | // ], |
| | | }, |
| | | roleList: [ |
| | | { name: '角色1', value: 1 }, { name: '角色2', value: 2 } |
| | | ], |
| | | typeList: [] |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this ; |
| | | // 获取角色列表 |
| | | // this.$axios.get('') |
| | | // 获取用户类型列表 |
| | | // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | // 获取全部部门列表 |
| | | this.$axios.get('sccg/depart/page').then(res=>{ |
| | | that.typeList = res.data.records; |
| | | }) |
| | | }, |
| | | methods: { |
| | | handleUser() { |
| | | const that = this; |
| | | console.log(this.user); |
| | | // this.$axios.post('sccg/admin/register',that.user).then(res=>{ |
| | | // console.log(res); |
| | | // }) |
| | | } |
| | | }, |
| | | props:[] |
| | | } |
| | | </script> |
| | | <style lang="scss" scpoed> |
| | | .createUser { |
| | | border-radius: 1px; |
| | | // min-width: 1024px; |
| | | // min-height: 1450px; |
| | | background-color: #fff; |
| | | |
| | | header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | padding: 0 20px; |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | color: #666; |
| | | } |
| | | |
| | | .headerTip span { |
| | | color: #ff3b6c; |
| | | } |
| | | |
| | | .headerTip label { |
| | | color: #999999; |
| | | } |
| | | } |
| | | |
| | | main { |
| | | border-top: 1px solid #f0f2f5; |
| | | text-align: left; |
| | | padding: 0 55px; |
| | | .mainTitle { |
| | | // margin-left: 60px; |
| | | color: #666; |
| | | font-weight: 600; |
| | | line-height: 100px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .mainContent { |
| | | display: flex; |
| | | justify-content: center; |
| | | .el-form-item__content { |
| | | width: 400px; |
| | | |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .optionHandleSp{ |
| | | display: flex; |
| | | .areaNumber,.moreNumber{ |
| | | flex: 1; |
| | | } |
| | | .telNumber{ |
| | | flex: 2; |
| | | } |
| | | } |
| | | .optionBtn{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 80px; |
| | | .btn{ |
| | | padding: 12px 50px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="userList"> |
| | | <header> |
| | | <div class="headerTitle">数据筛选</div> |
| | | <div class="headerContent"> |
| | | <div class="search"> |
| | | <span>筛选条件:</span> |
| | | <el-input placeholder="请输入内容"></el-input> |
| | | <div class="findBtn"> |
| | | <el-button type="primary">查询</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="addUser"> |
| | | <el-button type="primary" @click="dialogCreate = true">添加用户</el-button> |
| | | <el-button class="addBtn" type="primary" @click="dialogCreate = true">添加用户</el-button> |
| | | <el-dialog :visible.sync="dialogCreate" width="45%"> |
| | | <createUser :refresh="getUserList" /> |
| | | </el-dialog> |
| | |
| | | </div> |
| | | </header> |
| | | <main> |
| | | <div class="mainTitle">数据列表</div> |
| | | <div class="mainContent"> |
| | | <el-table border ref="multipleTable" |
| | | :header-cell-style="{background:'#f5f5f5','font-size':'12px',color:'#666666','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" tooltip-effect="dark" style="width: 100%"> |
| | | <el-table ref="multipleTable" |
| | | :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}" |
| | | :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"> |
| | | <el-table-column type="selection" width="55"> |
| | | </el-table-column> |
| | | <el-table-column label="用户ID" width="67"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="status" label="启用" width="90"> |
| | | <template slot-scope="scope"> |
| | | <el-switch v-model="scope.row.status" active-color="#0079fe" inactive-color="#ff4949" @change="handleChangeStatus(scope.row)"> |
| | | <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关" |
| | | active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operation" label="操作" width="246"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | | <span @click="handleChangeRole(scope.row)">修改角色</span> |
| | | <!-- <span @click="handleChangeRole(scope.row)">修改角色</span> --> |
| | | <span>查看</span> |
| | | <span>修改密码</span> |
| | | <span>删除</span> |
| | | <!-- <span>修改密码</span> --> |
| | | <!-- <span>删除</span> --> |
| | | <span>修改部门</span> |
| | | </div> |
| | | </template> |
| | |
| | | // console.log(obj) |
| | | }, |
| | | // 修改用户状态 |
| | | handleChangeStatus(obj){ |
| | | let {id,status} = obj ; |
| | | status==true ? status=1:status=0; |
| | | console.log(id,status); |
| | | this.$axios.post(`sccg/admin/updateStatus/`+id+'?status='+status).then(res=>{ |
| | | handleChangeStatus(obj) { |
| | | let { id, status } = obj; |
| | | status == true ? status = 1 : status = 0; |
| | | console.log(id, status); |
| | | this.$axios.post(`sccg/admin/updateStatus/` + id + '?status=' + status).then(res => { |
| | | console.log(res); |
| | | }) |
| | | }, |
| | |
| | | if (res.code === 200) { |
| | | res.data.records.forEach(item => { |
| | | item.createTime = helper(item.createTime); |
| | | item.status==1 ? item.status = true:item.status = false; |
| | | item.status == 1 ? item.status = true : item.status = false; |
| | | }) |
| | | that.tableData = res.data.records; |
| | | } |
| | | }) |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | | return 'warning-row'; |
| | | } else { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | <style lang="scss"> |
| | | .userList { |
| | | text-align: left; |
| | | margin: 10px 20px; |
| | | color: #4b9bb7; |
| | | |
| | | header { |
| | | background-color: #fff; |
| | | |
| | | .headerTitle { |
| | | font-weight: 600; |
| | | padding: 0 20px; |
| | | color: #666; |
| | | line-height: 50px; |
| | | border-bottom: 1px solid #f0f2f5; |
| | | } |
| | | background-color: #09152f; |
| | | |
| | | .headerContent { |
| | | padding: 0 40px; |
| | | display: flex; |
| | | line-height: 100px; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | .search { |
| | | display: flex; |
| | |
| | | .el-input { |
| | | flex: 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | .findBtn { |
| | | line-height: 100px; |
| | | margin-left: 15px; |
| | | display: flex; |
| | | align-items: center; |
| | | margin-top: -2px; |
| | | |
| | | .el-button { |
| | | padding: 12px 25px; |
| | | border-radius: 20px; |
| | | } |
| | | } |
| | | |
| | | .addBtn { |
| | | background-color: #eb5d01; |
| | | border: none; |
| | | border-radius: 20px; |
| | | padding: 12px 30px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | main { |
| | | background-color: #fff; |
| | | background-color: #09152f; |
| | | margin-top: 20px; |
| | | padding: 0 10px; |
| | | // padding: 0 40px; |
| | | padding-bottom: 50px; |
| | | |
| | | .mainTitle { |
| | | line-height: 60px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table { |
| | | font-size: 10px; |
| | | .el-table { |
| | | color: #4b9bb7; |
| | | font-size: 10px; |
| | | |
| | | .operation { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | color: #0079fe; |
| | | |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .operation { |
| | | display: flex; |
| | | // justify-content: space-around; |
| | | color: #0079fe; |
| | | span{ |
| | | margin-left: 10px; |
| | | } |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .el-table .warning-row { |
| | | background: #06122c; |
| | | } |
| | | .el-input__inner{ |
| | | background-color: #09152f; |
| | | } |
| | | .el-table .success-row { |
| | | background: #071f39; |
| | | } |
| | | .switchStyle .el-switch__label { |
| | | position: absolute; |
| | | display: none; |
| | | color: #fff; |
| | | } |
| | | .el-switch__core{ |
| | | background-color: rgba(166, 166, 166, 1) ; |
| | | } |
| | | .switchStyle .el-switch__label--left { |
| | | z-index: 9; |
| | | left: 20px; |
| | | } |
| | | .switchStyle .el-switch__label--right { |
| | | z-index: 9; |
| | | left: 4px; |
| | | } |
| | | .switchStyle .el-switch__label.is-active { |
| | | display: block; |
| | | } |
| | | .switchStyle.el-switch .el-switch__core, |
| | | .el-switch .el-switch__label { |
| | | width: 50px !important; |
| | | } |
| | | </style> |