Commit 6c1061d5 by 潘建波

Merge branch 'fanxing' of http://git.keliuyun.com:55676/platform/fanxing_new into fanxing

2 parents 94965512 5fcce698
......@@ -17,7 +17,7 @@ service.interceptors.request.use(
}
if (config.method == 'get') {
config.params = {
// _t: Date.parse(new Date()) / 1000,
_t: Date.parse(new Date()) / 1000,
...config.params
}
}
......
......@@ -2,7 +2,7 @@ import api from '../index'
import baseUrl from '../baseUrl'
export default {
getUserList(params,id){
return api.get(`${baseUrl}/api/v1/auth/users/${id}`, params)
return api.get(`${baseUrl}/api/v1/auth/users`, params)
},
getRoleList(params,id) {
return api.get(`${baseUrl}/api/v1/auth/roles`, params)
......@@ -11,16 +11,13 @@ export default {
return api.post(`${baseUrl}/api/v1/auth/users`, params)
},
editUser(params,id) {
return api.post(`${baseUrl}/api/v1/devconf_fx/users/${id}`, params)
return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params)
},
resetPwd(params,id) {
return api.post(`${baseUrl}/api/v1/devconf_fx/users/${id}/reset`, params)
},
delUser(params,id){
return api.delete(`${baseUrl}/api/v1/devconf_fx/users/${id}`, params)
},
getMenuList(params){
return api.get(`${baseUrl}/api/v1/devconf_fx/menu/list`, params)
return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params)
},
addRole(params){
return api.post(`${baseUrl}/api/v1/auth/roles`, params)
......@@ -30,5 +27,14 @@ export default {
},
bindperms(params,id){
return api.post(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params)
},
getPerms(params,id){
return api.get(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params)
},
editRole(params,id){
return api.post(`${baseUrl}/api/v1/auth/roles/${id}`, params)
},
bindRole(params,id){
return api.post(`${baseUrl}/api/v1/auth/users/${id}/roles`, params)
}
}
\ No newline at end of file
......@@ -187,4 +187,13 @@
}
.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
margin-bottom: 4px;
}
/* 切换 */
.el-tabs__item{
height: 52px;
line-height:52px;
}
.home-box .el-tabs__nav .el-tabs__item{
width: 14%!important;
padding:0 28px!important;
}
\ No newline at end of file
......@@ -7,6 +7,15 @@ $border-color:#e5e5e5;
$title-color:#f4f4f4;
$title-backgroud:#f3f3f3;
$dialog-title:#3BB7FF;
.primaryButton{
background: $dialog-title!important;
border-color: $dialog-title!important;
}
.plainButton{
color:$dialog-title;
background: $white-back-color;
border-color: $dialog-title;
}
body{
margin: 0;
color: $font-color;
......@@ -32,6 +41,9 @@ a:active{
text-decoration:none;
/* 指正在点的链接*/
}
.big .el-radio__label,.big{
font-size: 16px!important;
}
.inputBox{
display: inline-block;
width: 150px;
......
......@@ -194,6 +194,13 @@ export const asyncRouterMap = [
},
component: resolve => require(["../views/ops/equipment_manage"], resolve),
},{
path: "/ops/system_manage",
name: "系统配置",
meta: {
icon: "el-icon-location"
},
component: resolve => require(["../views/ops/system_manage"], resolve),
},{
path: "/ops/user_manage",
name: "用户管理",
meta: {
......
......@@ -3,7 +3,7 @@
<div class="content">
<div style="padding: 20px 15px 20px 23px;">
<span style="float: right;">
<el-button type="info" @click="addRole">添加新用户</el-button>
<el-button type="info" @click="addRole">添加新角色</el-button>
</span>
<div style="clear: both;"></div>
</div>
......@@ -22,7 +22,7 @@
</el-table-column>
<el-table-column
align="center"
prop="role_name"
prop="name"
label="角色名">
</el-table-column>
<el-table-column
......@@ -67,7 +67,7 @@
</div>
<!-- 新增 -->
<el-dialog
title="新增用户"
title="新增角色"
:visible.sync="addVisible"
@open="openAddDialog"
width="30%">
......@@ -82,7 +82,7 @@
@current-change="treeChange"
show-checkbox
ref="addTree"
node-key="menu_unid"
node-key="unid"
:props="defaultProps">
</el-tree>
</el-form-item>
......@@ -95,23 +95,23 @@
</el-dialog>
<!-- 编辑 -->
<el-dialog
title="编辑用户"
title="编辑角色"
:visible.sync="editVisible"
width="30%">
<div class="maxHeight">
<el-form label-position="left" label-width="80px" :model="editForm" :rules="rules" ref="editForm" inline-message hide-required-asterisk>
<el-form-item label="角色选项" prop="role_unid">
<el-select v-model="editForm.role_unid" placeholder="请选择" :popper-append-to-body=false>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.role_name"
:value="item.role_unid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="user_name">
<el-input v-model="editForm.user_name"></el-input>
<el-form-item label="角色名" prop="role_name">
<el-input v-model="editForm.role_name"></el-input>
</el-form-item>
<el-form-item label="权限菜单" prop="menu_unids">
<el-tree
:data="treeData"
@current-change="treeChange"
show-checkbox
ref="editTree"
node-key="unid"
:props="defaultProps">
</el-tree>
</el-form-item>
</el-form>
</div>
......@@ -142,8 +142,8 @@
return{
treeData:[],
defaultProps: {
children: 'childs',
label: 'menu_name'
children: 'children',
label: 'name'
},
total:0,
page:1,
......@@ -195,13 +195,11 @@
},
getMenuList(){
this.treeData=[];
this.$api.ops.getMenuList({
limit: 9999,
offset: 0,
}).then((res)=>{
this.treeData = res;
}).catch((error)=>{
//获取菜单
this.$api.login.getMenus({
"shape":"tree"
}).then(res=>{
this.treeData = res.menu_tree[0].children;
})
},
getTableList(){
......@@ -251,10 +249,15 @@
});
},
editUser(index,row){
this.editForm.role_unid=row.role_unid;
this.editForm.user_name=row.user_name;
this.editUnid=row.unid;
this.editVisible=true;
this.$api.ops.getPerms({
},row.role_unid).then(res=>{
this.editForm.role_name=row.name;
res.list_data.forEach(item=>{
this.editForm.menu_unids.push(item.perm_unid)
})
this.editUnid=row.role_unid;
this.editVisible=true;
})
},
openAddDialog(){
this.$refs['addForm'].resetFields();
......@@ -267,15 +270,23 @@
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.addRole({name:this.addForm.role_name}).then(res=>{
if(!res.ecode){
// this.$api.ops.bindperms({})
this.$message({
type: 'success',
message: '添加成功!'
});
this.addVisible=false;
this.getTableList();
this.$api.ops.bindperms({perm_unids:this.addForm.menu_unids},res.role_unid).then(data=>{
if(!data.code){
this.$message({
type: 'success',
message: '添加成功!'
});
this.addVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: data.enote
});
}
})
}else{
this.$message({
type: 'error',
......@@ -290,27 +301,39 @@
},
editFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.editUser(this.editForm,this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
this.editForm.menu_unids=this.$refs.editTree.getCheckedKeys().sort((a, b) => { return a - b; });
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.editRole({name:this.editForm.role_name},this.editUnid).then(res=>{
if(!res.code){
this.$api.ops.bindperms({perm_unids:this.editForm.menu_unids},this.editUnid).then(data=>{
if(!data.code){
this.$message({
type: 'success',
message: '修改成功!'
});
this.addVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: data.enote
});
}
})
}else{
this.$message({
type: 'error',
message: res.enote
});
}
})
} else {
return false;
}
})
} else {
return false;
}
});
});
}
},
}
......
<template>
<div style="padding-left: 28px;">
<el-form ref="form" label-width="100px">
<!-- 手动校时 -->
<div class="lineBox big">
<el-radio v-model="radio" label="1">手动校时</el-radio>
</div>
<div class="radioContent">
<div class="lineBox">
<el-form-item label="当前时间:">
<span>2020-02-11 16:08:01</span>
</el-form-item>
</div>
<div class="lineBox">
<el-form-item label="设备时间:">
<el-date-picker
v-model="systemTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
<span style="margin-left: 30px;"> <el-checkbox v-model="syncTime">与计算机时间同步</el-checkbox></span>
<el-button type="primary" size="small" class="primaryButton rightButton">校时</el-button>
</el-form-item>
</div>
</div>
<div class="line"></div>
<!-- NTP校时 -->
<div class="lineBox big">
<el-radio v-model="radio" label="2">NTP校时</el-radio>
</div>
<div class="radioContent">
<div class="lineBox">
<el-form-item label="服务器地址:">
<span class="inputBox">
<el-input placeholder="请输入服务器地址" v-model="url"></el-input>
</span>
</el-form-item>
</div>
<div class="lineBox">
<el-form-item label="NTP端口:">
<span class="inputBox">
<el-input placeholder="请输入NTP端口" v-model="ntpPort"></el-input>
</span>
</el-form-item>
</div>
<div class="lineBox">
<el-radio v-model="ntpRadio" label="2">定时校时</el-radio>
</div>
<el-form ref="inlineform" label-width="100px" inline>
<div class="lineBox">
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
</div>
<div class="lineBox">
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label=" ">
<span>自动进行校时(可设置多个时间点,不得超过5个)</span>
</el-form-item>
</div>
</el-form>
<div class="lineBox">
<el-radio v-model="ntpRadio" label="2">周期校时</el-radio>
</div>
<div class="lineBox">
<el-form-item label="每隔:">
<span class="inputBox" style="width: 60px;">
<el-input placeholder="请输入NTP端口" v-model="ntpPort"></el-input>
</span>
<span style="margin-left: 14px;">秒,自动进行校时</span>
<el-button type="primary" size="small" class="primaryButton rightButton">保存设置</el-button>
</el-form-item>
</div>
</div>
</el-form>
</div>
</template>
<script>
export default {
data(){
return{
time:'',
url:'',
ntpPort:'',
activeName: 'first',
systemTime:'',
syncTime:false
}
},
components:{},
mounted(){},
methods:{
handleClick(tab, event) {
console.log(tab, event);
}
},
}
</script>
<style lang="scss" scoped>
.line{
height:1px;
background:rgba(232,232,232,1);
margin-top: 18px;
margin-bottom: 15px;
}
.lineBox{
padding: 12px 0 12px 50px;
}
.radioContent{
margin-left: 24px;
}
.rightButton{
float: right;
margin-right: 20%;
}
.inputBox{
width: 220px;
}
</style>
\ No newline at end of file
<template>
<div style="padding-left: 28px;">
<el-form ref="form" label-width="86px">
<!-- 恢复出厂设置 -->
<div class="lineBox big">
<i class="el-icon-share"></i>恢复出厂设置
</div>
<div class="radioContent">
<div class="lineBox">
<el-button type="primary" size="small" class="primaryButton">恢复出厂设置</el-button>
</div>
<div class="lineBox">
<span class="tip">恢复出厂设置说明:完全恢复设备参数到出厂设置</span>
</div>
</div>
<div class="line"></div>
<!-- 数据备份 -->
<div class="lineBox big">
<i class="el-icon-share"></i>数据备份
</div>
<div class="radioContent">
<div class="lineBox">
<span class="upTit">参数导入</span><span class="upTit2">选择导入文件</span>
<div class="upInput"><el-input v-model="selectFilename"></el-input></div>
<span style="display: inline-block;">
<el-upload
class="upload-demo"
ref="upload"
:on-change="fileChange"
:multiple="false"
:show-file-list="false"
action="https://jsonplaceholder.typicode.com/posts/"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary" class="primaryButton upButton">浏览</el-button>
<el-button size="small" type="primary" @click="submitUpload" plain class="plainButton">参数导入</el-button>
</el-upload>
</span>
</div>
<div class="lineBox">
<span class="upTit">参数导出</span><span class="upTit2"><el-button size="small" type="primary" class="primaryButton">参数导出</el-button></span>
</div>
</div>
<div class="line"></div>
<div class="lineBox big">
<i class="el-icon-share"></i>重启设置
</div>
<div class="radioContent">
<div class="lineBox">
<el-button size="small" type="primary" class="primaryButton">手动重启</el-button>
</div>
<div class="lineBox">
<el-checkbox v-model="openRestart">开启定时重启</el-checkbox>
</div>
<el-form ref="inlineform" label-width="100px" inline>
<div class="lineBox">
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
</div>
<div class="lineBox">
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label="每天:">
<el-time-select
v-model="time"
placeholder="选择时间">
</el-time-select>
</el-form-item>
<el-form-item label=" ">
<span>自动进行校时(可设置多个时间点,不得超过5个)</span>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" size="small" class="primaryButton rightButton">保存</el-button>
</el-form-item>
</div>
</el-form>
</div>
</el-form>
</div>
</template>
<script>
export default {
data(){
return{
openRestart:false,
selectFilename:'',
time:'',
url:'',
ntpPort:'',
activeName: 'first',
systemTime:'',
syncTime:false
}
},
components:{},
mounted(){},
methods:{
handleClick(tab, event) {
console.log(tab, event);
},
submitUpload(){
this.$refs.upload.submit();
},
fileChange(file,fileList){
console.log(file,fileList)
this.selectFilename=file.name;
}
},
}
</script>
<style lang="scss" scoped>
.upButton{
margin-right: 10px;
}
.upTit{
margin-right: 44px;
}
.upTit2{
margin-right: 6px;
}
.upInput{
display: inline-block;
width: 250px;
margin:0 12px;
}
.tip{
font-size:14px;
color:rgba(0,0,0,0.25);
}
.line{
height:1px;
background:rgba(232,232,232,1);
margin-top: 18px;
margin-bottom: 15px;
}
.lineBox{
padding: 12px 0 12px 50px;
}
.radioContent{
margin-left: 38px;
}
.rightButton{
float: right;
margin-right: 20%;
}
.inputBox{
width: 220px;
}
.big i{
font-size: 18px;
color: #CCCCCC;
margin-right:22px;
}
</style>
\ No newline at end of file
<template>
<div class="contentBox">
<div style="background: #FFFFFF;">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="校时设置" name="first">
<proofreadtime></proofreadtime>
</el-tab-pane>
<el-tab-pane label="系统维护" name="second">
<sytemset></sytemset>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import proofreadtime from './systemComponents/proofreadtime'
import sytemset from './systemComponents/sytemSet'
export default {
data(){
return{
activeName: 'first'
}
},
components:{
proofreadtime,sytemset
},
mounted(){},
methods:{
handleClick(tab, event) {
console.log(tab, event);
}
},
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
......@@ -21,13 +21,13 @@
label="序号">
</el-table-column>
<el-table-column
prop="user_name"
prop="username"
align="center"
label="用户名">
</el-table-column>
<el-table-column
align="center"
prop="role_name"
prop="roles[0].name"
label="角色名">
</el-table-column>
<el-table-column
......@@ -45,10 +45,10 @@
<el-tooltip content="编辑用户" placement="bottom" effect="light" :visible-arrow=false>
<span class="iconfont icon-xiugai editIcon" @click="editUser(scope.$index, scope.row)"></span>
</el-tooltip>
<span class="tableSpanBorder"></span>
<!-- <span class="tableSpanBorder"></span>
<el-tooltip content="重置密码" placement="bottom" effect="light" :visible-arrow=false>
<span class="iconfont icon-xiugai editIcon2" @click="reset(scope.$index, scope.row)"></span>
</el-tooltip>
</el-tooltip> -->
<span class="tableSpanBorder"></span>
<el-tooltip content="删除" placement="bottom" effect="light" :visible-arrow=false>
<span class="iconfont icon-detail delIcon" @click="delFun(scope.$index, scope.row)"></span>
......@@ -87,16 +87,19 @@
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.role_name"
:label="item.name"
:value="item.role_unid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="user_name">
<el-input v-model="addForm.user_name"></el-input>
<el-form-item label="用户名" prop="username">
<el-input v-model="addForm.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="user_password">
<el-input v-model="addForm.user_password" type="password"></el-input>
<el-form-item label="密码" prop="password">
<el-input v-model="addForm.password" type="password"></el-input>
</el-form-item>
<el-form-item label="确认新密码" prop="checkPass">
<el-input v-model="addForm.checkPass" type="checkPass"></el-input>
</el-form-item>
</el-form>
</div>
......@@ -113,18 +116,15 @@
<div>
<el-form label-position="left" label-width="80px" :model="editForm" :rules="rules" ref="editForm" inline-message hide-required-asterisk>
<el-form-item label="角色选项" prop="role_unid">
<el-select v-model="editForm.role_unid" placeholder="请选择" :popper-append-to-body=false>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.role_name"
:value="item.role_unid">
</el-option>
</el-select>
<el-select v-model="editForm.role_unid" placeholder="请选择" :popper-append-to-body=false>
<el-option
v-for="item in roleList"
:key="item.role_unid"
:label="item.name"
:value="item.role_unid">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="user_name">
<el-input v-model="editForm.user_name"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
......@@ -151,7 +151,7 @@
callback();
}
};
var checkPass = (rule, value, callback) => {
var validatePass = (rule, value, callback) => {
var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
if(!reg.test(value)){
callback(new Error('密码必须包含数字字母大于6位'));
......@@ -159,6 +159,15 @@
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.editForm.password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return{
total:0,
page:1,
......@@ -167,28 +176,30 @@
norm_type:"login",
role_unid:'',
username:'',
password:''
password:'',
checkPass:''
},
editForm:{
role_unid:'',
user_name:'',
},
editUnid:'',
tableData: [],
addVisible:false,
editVisible:false,
roleList:[],
userId:sessionStorage.getItem('user_unid'),
rules: {
role_unid: [
{ validator: checkRole, trigger: 'change' }
],
user_name: [
username: [
{ validator: checkUser, trigger: 'change' }
],
user_password: [
{ validator: checkPass, trigger: 'change' }
password: [
{ validator: validatePass, trigger: 'change' }
],
checkPass:[
{ validator: validatePass2, trigger: 'change' }
]
}
}
},
......@@ -217,7 +228,7 @@
this.$api.ops.getUserList({
limit: this.pageSize,
offset: offset,
},this.userId).then((res)=>{
}).then((res)=>{
this.total=res.total_num;
if(res.list_data==null){
......@@ -304,9 +315,8 @@
});
},
editUser(index,row){
this.editForm.role_unid=row.role_unid;
this.editForm.user_name=row.user_name;
this.editUnid=row.unid;
this.editForm.role_unid=row.roles[0].role_unid;
this.editUnid=row.user_unid;
this.editVisible=true;
},
openAddDialog(){
......@@ -318,14 +328,29 @@
addFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.addUser(this.addForm).then(res=>{
this.$api.ops.addUser({
norm_type:this.addForm.norm_type,
username:this.addForm.username,
password:this.addForm.password
}).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '添加成功!'
});
this.addVisible=false;
this.getTableList();
this.$api.ops.bindRole({
"role_unid":this.addForm.role_unid,
},res.user_unid).then(data=>{
if(!data.ecode){
this.$message({
type: 'success',
message: '添加成功!'
});
this.addVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '添加失败!'
});
}
})
}else{
this.$message({
type: 'error',
......@@ -342,23 +367,25 @@
editFun(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.$api.ops.editUser(this.editForm,this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
}
})
this.$api.ops.bindRole({
role_unid:this.editForm.role_unid
},this.editUnid).then(res=>{
if(!res.ecode){
this.$message({
type: 'success',
message: '修改成功!'
});
this.editVisible=false;
this.getTableList();
}else{
this.$message({
type: 'error',
message: '修改失败!'
});
}
})
} else {
return false;
return false;
}
});
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!