Commit ca14ed82 by changjin

联调接口

parent 533753ff
......@@ -57,7 +57,21 @@ export default {
{
name:'全部设备',
url:'/equipment/list',
id:'111'
id:'111',
btnList: [
{
name: '新增'
},
{
name: '修改'
},
{
name: '删除'
},
{
name: '查看'
},
]
},
{
name:'设备报警',
......@@ -192,10 +206,12 @@ export default {
that.changeMenu(info)
}
})
// this.getData()
this.menuActive = this.pageNameList[this.pageNameList.length - 1].pageName
},
update (){
var that = this
// this.getData()
this.changeMenu(this.items[0])
that.items.forEach(function (info, index) {
if (that.pageNameList[1].pageName === info.name) {
......@@ -205,6 +221,15 @@ export default {
this.menuActive = this.pageNameList[this.pageNameList.length - 1].pageName
},
methods: {
getData () {
this.$axios.get('/baseInfo/initPersonalMenu').then((res) =>{
if(res.data.code === '0') {
this.items = res.data.data.menuMap
console.log(this.items.MenuResponse)
window.sessionStorage.setItem('projectId',res.data.data.projectId)
}
})
},
changeMenu (menu, type) {
if (type && menu) {
console.log(menu.name)
......
......@@ -64,13 +64,6 @@ export default {
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
type: 'success',
confirmButtonText: '确定'
})
},
showAlert1: function (cont) {
this.$alert(cont, '温馨提示', {
type: 'error',
confirmButtonText: '确定'
})
}
......
......@@ -7,8 +7,8 @@
<el-col :span="11">
<el-form-item label="操作时间">
<el-date-picker
v-model="value1"
type="datetimerange"
v-model="searchForm.date"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
......@@ -17,11 +17,12 @@
</el-col>
<el-col :span="5">
<el-form-item label="日志类型">
<el-select v-model="searchForm.blockId" placeholder="请选择">
<el-option label="不限" value=""></el-option>
<el-option label="男" value="MAN"></el-option>
<el-option label="女" value="WOMAN"></el-option>
<el-option label="未知" value="SECRECY"></el-option>
<el-select v-model="searchForm.logType" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option label="查询" value="select"></el-option>
<el-option label="新增" value="add"></el-option>
<el-option label="修改" value="update"></el-option>
<el-option label="删除" value="delete"></el-option>
</el-select>
</el-form-item>
</el-col>
......@@ -37,12 +38,12 @@
<div class="title">日志列表</div>
<el-table :data="data.list">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="用户编码"></el-table-column>
<el-table-column prop="name" label="姓名"></el-table-column>
<el-table-column prop="name" label="操作者IP"></el-table-column>
<el-table-column prop="name" label="日志摘要"></el-table-column>
<el-table-column prop="name" label="日志类型"></el-table-column>
<el-table-column prop="actualTime" label="操作时间" ></el-table-column>
<el-table-column prop="accountCode" label="用户编码"></el-table-column>
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="operatorIp" label="操作者IP"></el-table-column>
<el-table-column prop="remarkDetail" width="280" label="日志摘要"></el-table-column>
<el-table-column prop="logType" label="日志类型"></el-table-column>
<el-table-column prop="logTime" label="操作时间" ></el-table-column>
</el-table>
<div class="block text-right mt20" v-if="data.page">
<el-pagination
......@@ -58,27 +59,34 @@
</template>
<script>
import moment from 'moment'
export default {
data: () => ({
loading: false,
searchForm:{
},
data:{
page: '1',
list:[
{
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}
]
},
searchForm:{},
data:{page:'1'},
size: '10',
value1: ''
value1: '',
projectId: ''
}),
created () {
this.projectId = window.sessionStorage.getItem('projectId')
this.getData()
},
methods: {
getData () {
this.$axios.post('/baseInfo/findLogPageInfo',{
p: this.data.page,
c: this.size,
projectId: this.projectId,
logType: this.searchForm.logType,
startLogTime: this.searchForm.date ? moment(new Date(this.searchForm.date[0]).getTime()).format('YYYY-MM-DD' + ' 00:00:00') : null,
endLogTime: this.searchForm.date ? moment(new Date(this.searchForm.date[1]).getTime()).format('YYYY-MM-DD' + ' 23:59:59') : null
}).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
}
})
},
handleSizeChange (val) {
this.size = val
this.getData()
......
......@@ -6,7 +6,7 @@
<el-form label-width="70px" :model="searchForm">
<el-col :span="7">
<el-form-item label="项目查询">
<el-input v-model="searchForm.customerName" placeholder="请输入项目名称"></el-input>
<el-input v-model="searchForm.projectName" placeholder="请输入项目名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="15" :offset="1">
......@@ -18,21 +18,21 @@
</div>
<div class="mainContent tableCont">
<div class="tabCont">
<el-button class="addBtn" @click="addBtn"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-button class="addBtn" @click="addBtn(0)"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-table :data="data.list">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="城市名称"></el-table-column>
<el-table-column prop="id" label="城市ID"></el-table-column>
<el-table-column prop="allocateName" label="项目名称"></el-table-column>
<el-table-column prop="allocateTime" label="项目ID"></el-table-column>
<el-table-column prop="setTime" label="主数据项目编码" ></el-table-column>
<el-table-column prop="actualTime" label="地块名称" ></el-table-column>
<el-table-column prop="actualTime" label="地块ID" ></el-table-column>
<el-table-column prop="actualTime" label="地块编码" ></el-table-column>
<el-table-column prop="cityName" label="城市名称"></el-table-column>
<el-table-column prop="cityId" label="城市ID"></el-table-column>
<el-table-column prop="projectName" label="项目名称"></el-table-column>
<el-table-column prop="projectId" label="项目ID"></el-table-column>
<el-table-column prop="mainProjectCode" label="主数据项目编码" ></el-table-column>
<el-table-column prop="massif" label="地块名称" ></el-table-column>
<el-table-column prop="massifId" label="地块ID" ></el-table-column>
<el-table-column prop="massifCode" label="地块编码" ></el-table-column>
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<span class="green line pointer" @click="addBtn()">修改</span>
<span class="red line ml10 pointer">删除</span>
<span class="green line pointer" @click="addBtn(1,scope.row)">修改</span>
<span class="red line ml10 pointer" @click="delBtn(scope.row.id)">删除</span>
</template>
</el-table-column>
</el-table>
......@@ -46,47 +46,47 @@
</div>
</div>
</div>
<el-dialog title="新增项目" :visible.sync="dialogVisible" width="45%">
<el-dialog :title="title" :visible.sync="dialogVisible" width="45%">
<el-row class="modelBox">
<el-form label-width="100px">
<el-form label-width="100px" :model="dataForm">
<el-col :span="12">
<el-form-item label="城市ID">
<el-input v-model="data.oldPwd"></el-input>
<el-input v-model="dataForm.cityId"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="城市名称" required>
<el-input v-model="data.oldPwd"></el-input>
<el-input v-model="dataForm.cityName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目ID">
<el-input v-model="data.oldPwd"></el-input>
<el-input v-model="dataForm.projectId"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" required>
<el-input v-model="data.oldPwd"></el-input>
<el-input v-model="dataForm.projectName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主数据项目编码">
<el-input v-model="data.newPwd"></el-input>
<el-input v-model="dataForm.mainProjectCode"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块ID">
<el-input v-model="data.newPwd"></el-input>
<el-input v-model="dataForm.massifId"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块名称" required>
<el-input v-model="data.newPwd"></el-input>
<el-input v-model="dataForm.massif"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块编码" required>
<el-input v-model="data.newPwd"></el-input>
<el-input v-model="dataForm.massifCode"></el-input>
</el-form-item>
</el-col>
</el-form>
......@@ -101,28 +101,98 @@
<script>
export default {
data: () => ({
loading: false,
searchForm:{},
dataForm: {},
dialogVisible: false,
data:{
page: '1',
list:[
{
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}, {
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}
]
},
type: '',
id: '',
data:{page:'1'},
size: '10',
title: ''
}),
created () {
this.getData()
},
methods: {
getData () {
this.$axios.post('/baseInfo/findProjectPageInfo',{
p: this.data.page,
c: this.size,
projectName: this.searchForm.projectName
}).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
}
})
},
submit () {
let that = this
if (!that.dataForm.cityName) {
that.showAlert('请输入城市名称~')
return false
}
if (!that.dataForm.projectName) {
that.showAlert('请输入项目名称~')
return false
}
if (!that.dataForm.massif) {
that.showAlert('请输入地块名称~')
return false
}
if (!that.dataForm.massifCode) {
that.showAlert('请输入地块编码~')
return false
}
let url
if (this.type === 0) {
url = '/baseInfo/addProject'
} else {
url = '/baseInfo/editProjectById'
}
that.$axios.post(url,{
"cityId": that.dataForm.cityId,
"cityName": that.dataForm.cityName,
"mainProjectCode": that.dataForm.mainProjectCode,
"massif": that.dataForm.massif,
"massifCode": that.dataForm.massifCode,
"massifId": that.dataForm.massifId,
"projectId": that.dataForm.projectId,
"projectName": that.dataForm.projectName,
"id": that.id
}).then((res) =>{
if(res.data.code === '0') {
if (this.type === 0) {
this.$message({message: '新增成功~',type: 'success'});
} else {
this.$message({message: '修改成功~',type: 'success'});
}
this.dialogVisible = false
that.getData()
} else {
if (this.type === 0) {
this.$message({message: '新增失败~',type: 'error'});
} else {
this.$message({message: '修改失败~',type: 'error'});
}
}
})
},
delBtn (id) {
this.$confirm('确定删除当前项目?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios.get('/baseInfo/deleteRrojectById?id=' + id).then((res) =>{
if(res.data.code === '0') {
this.$message({message: '删除成功~',type: 'success'});
this.getData()
} else {
this.$message({message: '删除失败~',type: 'error'});
}
})
}).catch(() => {})
},
handleSizeChange (val) {
this.size = val
this.getData()
......@@ -131,7 +201,24 @@ export default {
this.data.page = val
this.getData()
},
addBtn () {
addBtn (type,item) {
this.type = type
this.id = item.id
if (type === 0) {
this.title = '新增项目'
} else {
this.title = '修改项目'
this.dataForm = {
"cityId": item.cityId,
"cityName": item.cityName,
"projectId": item.projectId,
"projectName": item.projectName,
"mainProjectCode": item.mainProjectCode,
"massif": item.massif,
"massifCode": item.massifCode,
"massifId": item.massifId,
}
}
this.dialogVisible = true
},
showAlert: function (cont) {
......
<template>
<div class="mainContent">
<div class="title">新增角色</div>
<div class="title" v-if="roleId == '0'">新增角色</div>
<div class="title" v-if="roleId !== '0'">修改角色</div>
<el-row class="mt10">
<el-form label-width="70px" :model="data">
<el-col :span="7">
<el-form-item label="角色名称">
<el-input v-model="data.customerName"></el-input>
<el-form-item label="角色名称" required>
<el-input v-model="data.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="7" :offset="1">
......@@ -20,63 +21,20 @@
<el-col :span="24">
<el-form-item label="权限配置">
<div class="menuList">
<div class="menu">
<div><el-checkbox v-model="checked">设备管理</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">全部设备</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">属性</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">事件</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">设备报警</el-checkbox></div>
</div>
<div class="menu">
<div><el-checkbox v-model="checked">车辆管理</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">全部设备</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">属性</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">事件</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">设备报警</el-checkbox></div>
</div>
<div class="menu">
<div><el-checkbox v-model="checked">IOC后台管理</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">全部设备</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">属性</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">事件</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">设备报警</el-checkbox></div>
</div>
<div class="menu">
<div><el-checkbox v-model="checked">外部系统管理</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml10" v-model="checked">新增</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml10" v-model="checked">修改</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml10" v-model="checked">删除</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml10" v-model="checked">查看</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml10" v-model="checked">进入系统</el-checkbox></div>
</div>
<div class="menu">
<div><el-checkbox v-model="checked">系统设置</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">项目管理</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">新增</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">修改</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">删除</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">查看</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">角色管理</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">新增</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">修改</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">删除</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">查看</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">用户管理</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">新增</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">修改</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">删除</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">查看</el-checkbox></div>
<div><el-checkbox class="ml10" v-model="checked">日志管理</el-checkbox></div>
<div class="threeNode"><el-checkbox class="ml20" v-model="checked">查看</el-checkbox></div>
</div>
<div class="menu">
<div><el-checkbox v-model="checked">接口文档</el-checkbox></div>
<div class="menu" v-for="(item,index) in menuList" :key="index">
<div><el-checkbox v-model="item.checked" @change="choose1(item)">{{item.name}}</el-checkbox></div>
<div v-for="info in item.secondMenuList">
<div><el-checkbox class="ml10" @change="choose2(info,item)" v-model="info.checked">{{info.name}}</el-checkbox></div>
<div v-for="i in info.buttonList" class="threeNode">
<el-checkbox class="ml20" @change="choose3(i)"v-model="i.checked">{{i.name}}</el-checkbox>
</div>
</div>
</div>
</div>
</el-form-item>
</el-col>
<el-row class="mt30 text-center clear">
<el-button type="primary" class="mt20">保存</el-button>
<el-button type="primary" class="mt20" @click="submit">保存</el-button>
<el-button class="ml20 mt20" @click="goBack">返回</el-button>
</el-row>
</el-form>
......@@ -87,13 +45,114 @@
<script>
export default {
data: () => ({
loading: false,
data:{},
checked: false
checked: false,
roleId: [],
menuList: [],
menuIdList: []
}),
created () {
this.roleId = this.$route.params.id
this.projectId = window.sessionStorage.getItem('projectId')
this.getMenuList()
if (this.roleId !== '0') {
this.getData()
}
},
methods: {
//选择权限
choose1 (val) {
if (val.checked) {
val.secondMenuList.forEach(e=>{
e.checked = true
this.menuIdList.push(e.id)
})
this.menuIdList.push(val.id)
} else {
val.secondMenuList.forEach(e=>{
e.checked = false
})
}
console.log(this.menuIdList)
},
choose2 (val,item) {
if (val.checked) {
if (val.buttonList.length > 0) {
val.buttonList.forEach(e=>{
e.checked = true
this.menuIdList.push(e.id)
})
}
this.menuIdList.push(val.id)
if (this.menuIdList.length == item.seconMenuList.length) {
item.checked = true
}
} else {
if (val.buttonList.length > 0) {
val.buttonList.forEach(e=>{
e.checked = false
})
}
}
console.log(this.menuIdList)
},
// 获取详情
getData () {
this.$axios.get('/baseInfo/findRoleMenu?id=' + this.roleId).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
if (this.data.status == '0') {
this.data.status = false
} else {
this.data.status = true
}
}
})
},
// 获取菜单列表
getMenuList () {
this.$axios.get('/baseInfo/findAllMenu').then((res) =>{
if(res.data.code === '0') {
this.menuList = res.data.data
}
})
},
// 提交
submit () {
let that = this
if (!that.data.name) {
that.showAlert('请输入角色名称~')
return false
}
let url
if (this.roleId == '0') {
url = '/baseInfo/addRole'
} else {
url = '/baseInfo/editRole'
}
that.$axios.post(url,{
"status": that.data.status ? '1' : '0',
"name": that.data.name,
"projectId": that.projectId,
"roleMenuRequestIdList": that.menuIdList,
"id": that.roleId
}).then((res) =>{
if(res.data.code === '0') {
if (this.roleId == '0') {
this.$message({message: '新增成功~',type: 'success'});
} else {
this.$message({message: '修改成功~',type: 'success'});
}
this.$router.push('/system/roleList')
} else {
if (this.roleId == '0') {
this.$message({message: '新增失败~',type: 'error'});
} else {
this.$message({message: '修改失败~',type: 'error'});
}
}
})
},
goBack () {
this.$router.go(-1)
},
......@@ -114,7 +173,7 @@ export default {
.menuList{
.menu{
border: 1px solid #E9EFF3;
width: 100px;
width: 120px;
float: left;
padding: 5px 10px 10px 10px;
margin-right: 10px;
......
......@@ -6,7 +6,7 @@
<el-form label-width="70px" :model="searchForm">
<el-col :span="7">
<el-form-item label="角色名称">
<el-input v-model="searchForm.customerName" placeholder="请输入角色名称"></el-input>
<el-input v-model="searchForm.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="15" :offset="1">
......@@ -18,14 +18,14 @@
</div>
<div class="mainContent tableCont">
<div class="tabCont">
<el-button class="addBtn" @click="addBtn"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-button class="addBtn" @click="addBtn(0)"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-table :data="data.list">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="角色名称"></el-table-column>
<el-table-column prop="id" label="权限配置"></el-table-column>
<el-table-column prop="allocateName" label="创建时间"></el-table-column>
<el-table-column prop="allocateTime" label="创建人"></el-table-column>
<el-table-column prop="setTime" label="启用状态" >
<el-table-column prop="isConfig" label="权限配置"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column prop="createUser" label="创建人"></el-table-column>
<el-table-column label="启用状态" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
......@@ -36,8 +36,8 @@
</el-table-column>
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<span class="green line pointer" @click="addBtn()">修改</span>
<span class="red line ml10 pointer">删除</span>
<span class="green line pointer" @click="addBtn(scope.row.id)">修改</span>
<span class="red line ml10 pointer"@click="delBtn(scope.row.id)">删除</span>
</template>
</el-table-column>
</el-table>
......@@ -51,83 +51,55 @@
</div>
</div>
</div>
<el-dialog title="新增项目" :visible.sync="dialogVisible" width="45%">
<el-row class="modelBox">
<el-form label-width="100px">
<el-col :span="12">
<el-form-item label="城市ID">
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="城市名称" required>
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目ID">
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" required>
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主数据项目编码">
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块ID">
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块名称" required>
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块编码" required>
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer text-center">
<el-button type="primary" v-on:click="submit()">保存</el-button>
<el-button class="ml10" @click="dialogVisible = false">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data: () => ({
loading: false,
searchForm:{},
dialogVisible: false,
data:{
page: '1',
list:[
{
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}, {
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}
]
},
data:{page: '1',},
size: '10',
}),
created () {
this.projectId = window.sessionStorage.getItem('projectId')
this.getData()
},
methods: {
getData () {
this.$axios.post('/baseInfo/findRolePageInfo',{
p: this.data.page,
c: this.size,
projectId: this.projectId,
roleName: this.searchForm.roleName
}).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
res.data.data.list.forEach(item => {
if (item.status == '0') {
item.status = false
} else {
item.status = true
}
})
}
})
},
delBtn (id) {
this.$confirm('确定删除当前角色?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios.get('/baseInfo/deleteRoleById?id=' + id).then((res) =>{
if(res.data.code === '0') {
this.$message({message: '删除成功~',type: 'success'});
this.getData()
} else {
this.$message({message: '删除失败~',type: 'error'});
}
})
}).catch(() => {})
},
handleSizeChange (val) {
this.size = val
this.getData()
......@@ -136,8 +108,8 @@ export default {
this.data.page = val
this.getData()
},
addBtn () {
this.$router.push('/system/roleAdd')
addBtn (id) {
this.$router.push('/system/roleAdd/' + id)
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
......
<template>
<div class="mainContent">
<div class="title">新增用户</div>
<div class="title" v-if="userId == '0'">新增用户</div>
<div class="title" v-if="userId !== '0'">修改用户</div>
<el-form label-width="80px" :model="data" class="mt10">
<el-row>
<el-col :span="6">
<el-form-item label="用户编码" required>
<el-input v-model="data.customerName"></el-input>
<el-input v-model="data.accountCode"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="姓名" required>
<el-input v-model="data.customerName"></el-input>
<el-input v-model="data.userName"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="初始密码">
<el-input v-model="data.customerName" readonly placeholder="123456"></el-input>
<el-input readonly placeholder="123456"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="手机号" required>
<el-input v-model="data.customerName"></el-input>
<el-input v-model="data.phone" :maxlength="11"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="账号" required>
<el-input v-model="data.customerName"></el-input>
<el-input v-model="data.loginName"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="启用状态">
<el-switch
v-model="data.status"
v-model="data.accountStatus"
active-color="#DF9F01"
inactive-color="#929EAC">
</el-switch>
......@@ -43,25 +44,23 @@
<el-col :span="24">
<el-form-item label="角色" required>
<div class="border">
<el-checkbox v-model="checked">角色1</el-checkbox>
<el-checkbox v-model="checked">角色1</el-checkbox>
<el-checkbox v-model="checked">角色1</el-checkbox>
<el-checkbox v-model="checked">角色1</el-checkbox>
<el-checkbox-group v-model="roleIdList">
<el-checkbox v-for="role in roleList" :label="role.id" :key="role.id">{{role.name}}</el-checkbox>
</el-checkbox-group>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="兼职项目">
<div class="border">
<el-checkbox v-model="checked">北府一期</el-checkbox>
<el-checkbox v-model="checked">北府一期</el-checkbox>
<el-checkbox v-model="checked">北府一期</el-checkbox>
<el-checkbox v-model="checked">北府一期</el-checkbox>
<el-checkbox-group v-model="projectIdList">
<el-checkbox v-for="project in projectList" :label="project.id" :key="project.id">{{project.projectName}}</el-checkbox>
</el-checkbox-group>
</div>
</el-form-item>
</el-col>
<el-row class="mt30 text-center clear">
<el-button type="primary" class="mt20">保存</el-button>
<el-button type="primary" class="mt20" @click="submit()">保存</el-button>
<el-button class="ml20 mt20" @click="goBack">返回</el-button>
</el-row>
</el-form>
......@@ -71,16 +70,114 @@
<script>
export default {
data: () => ({
loading: false,
data:{},
checked: false
checked: false,
roleList: [],
projectList: [],
roleIdList: [],
projectIdList: []
}),
created () {
this.userId = this.$route.params.id
this.projectId = window.sessionStorage.getItem('projectId')
this.getRoleList()
this.getProjectList(this.projectId)
if (this.userId !== '0') {
this.getData()
}
},
methods: {
// 获取详情
getData () {
this.$axios.get('/baseInfo/findAccountById?id=' + this.userId).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
if (this.data.accountStatus == '0') {
this.data.accountStatus = false
} else {
this.data.accountStatus = true
}
this.roleIdList = this.data.roleList
this.projectIdList = this.data.projectListResponse
}
})
},
// 获取角色列表
getRoleList () {
this.$axios.get('/baseInfo/findRoleList').then((res) =>{
if(res.data.code === '0') {
this.roleList = res.data.data
}
})
},
// 获取项目列表
getProjectList (projectId) {
this.$axios.get('/baseInfo/findProjectList').then((res) =>{
if(res.data.code === '0') {
this.projectList = res.data.data
}
})
},
goBack () {
this.$router.go(-1)
},
// 提交
submit () {
let that = this
if (!that.data.accountCode) {
that.showAlert('请输入用户编码~')
return false
}
if (!that.data.userName) {
that.showAlert('请输入姓名~')
return false
}
if (!that.data.phone) {
that.showAlert('请输入手机号~')
return false
}
if (!that.data.loginName) {
that.showAlert('请输入账号~')
return false
}
if (this.roleIdList.length === 0) {
that.showAlert('请选择角色~')
return false
}
let url
if (this.userId == '0') {
url = '/baseInfo/addAccount'
} else {
url = '/baseInfo/editAccount'
}
that.$axios.post(url,{
"accountCode": that.data.accountCode,
"accountStatus": that.data.accountStatus ? '1' : '0',
"loginName": that.data.loginName,
"password": "123456",
"phone": that.data.phone,
"projectId": that.projectId,
"projectIdList": that.projectIdList,
"roleIdList": that.roleIdList,
"userName": that.data.userName,
"id": that.userId
}).then((res) =>{
if(res.data.code === '0') {
if (this.userId == '0') {
this.$message({message: '新增成功~',type: 'success'});
} else {
this.$message({message: '修改成功~',type: 'success'});
}
this.$router.push('/system/userList')
} else {
if (this.userId == '0') {
this.$message({message: '新增失败~',type: 'error'});
} else {
this.$message({message: '修改失败~',type: 'error'});
}
}
})
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
......
......@@ -6,27 +6,29 @@
<el-form label-width="70px" :model="searchForm">
<el-col :span="5">
<el-form-item label="角色">
<el-select v-model="searchForm.blockId" placeholder="请选择">
<el-option label="不限" value=""></el-option>
<el-option label="男" value="MAN"></el-option>
<el-option label="女" value="WOMAN"></el-option>
<el-option label="未知" value="SECRECY"></el-option>
<el-select v-model="searchForm.roleId" placeholder="请选择">
<el-option value="" label="全部">全部</el-option>
<el-option
v-for="item in roleList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="状态">
<el-select v-model="searchForm.blockId" placeholder="请选择">
<el-select v-model="searchForm.accountStatus" placeholder="请选择">
<el-option label="不限" value=""></el-option>
<el-option label="男" value="MAN"></el-option>
<el-option label="女" value="WOMAN"></el-option>
<el-option label="未知" value="SECRECY"></el-option>
<el-option label="已启用" value="1"></el-option>
<el-option label="已禁用" value="0"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关键词">
<el-input v-model="searchForm.customerName" placeholder="请输入姓名或用户编码"></el-input>
<el-input v-model="searchForm.keyWord" placeholder="请输入姓名或用户编码"></el-input>
</el-form-item>
</el-col>
<el-col :span="4" :offset="1">
......@@ -38,29 +40,37 @@
</div>
<div class="mainContent tableCont">
<div class="tabCont">
<el-button class="addBtn" @click="addBtn"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-button class="addBtn" @click="addBtn(0)"><img src="../../../../static/img/add.png" class="addIcon"><span>新增</span></el-button>
<el-table :data="data.list">
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="name" label="用户编码"></el-table-column>
<el-table-column prop="id" label="姓名"></el-table-column>
<el-table-column prop="allocateName" label="账号"></el-table-column>
<el-table-column prop="allocateName" label="手机号"></el-table-column>
<el-table-column prop="allocateName" label="角色"></el-table-column>
<el-table-column prop="allocateTime" label="兼职项目"></el-table-column>
<el-table-column prop="accountCode" label="用户编码"></el-table-column>
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="loginName" label="账号"></el-table-column>
<el-table-column prop="phone" label="手机号"></el-table-column>
<el-table-column prop="roleNames" label="角色">
<template slot-scope="scope">
<span v-for="(item, index) in scope.row.roleNames" :key="item">{{ index == scope.row.roleNames.length-1 && item || (item + ',') }}</span>
</template>
</el-table-column>
<el-table-column prop="allocateTime" label="兼职项目">
<template slot-scope="scope">
<span v-for="(item, index) in scope.row.projectNames" :key="item">{{ index == scope.row.projectNames.length-1 && item || (item + ',') }}</span>
</template>
</el-table-column>
<el-table-column prop="setTime" label="状态" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
v-model="scope.row.accountStatus"
active-color="#DF9F01"
inactive-color="#929EAC">
inactive-color="#929EAC" @change="changeStatus(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<span class="line pointer" @click="reset()">重置密码</span>
<span class="green ml10 line pointer" @click="addBtn()">修改</span>
<span class="red line ml10 pointer">删除</span>
<span class="line pointer" @click="resetPwd(scope.row.id)">重置密码</span>
<span class="green ml10 line pointer" @click="addBtn(scope.row.id)">修改</span>
<span class="red line ml10 pointer" @click="delBtn(scope.row.id)">删除</span>
</template>
</el-table-column>
</el-table>
......@@ -74,83 +84,96 @@
</div>
</div>
</div>
<el-dialog title="新增项目" :visible.sync="dialogVisible" width="45%">
<el-row class="modelBox">
<el-form label-width="100px">
<el-col :span="12">
<el-form-item label="城市ID">
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="城市名称" required>
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目ID">
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" required>
<el-input v-model="data.oldPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主数据项目编码">
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块ID">
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块名称" required>
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地块编码" required>
<el-input v-model="data.newPwd"></el-input>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer text-center">
<el-button type="primary" v-on:click="submit()">保存</el-button>
<el-button class="ml10" @click="dialogVisible = false">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data: () => ({
loading: false,
searchForm:{},
dialogVisible: false,
data:{
page: '1',
list:[
{
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}, {
name: '监控摄像001',
id: 'MZ902',
type: '监控设备'
}
]
},
size: '10',
roleList: []
}),
created () {
this.projectId = window.sessionStorage.getItem('projectId')
this.getData()
this.getRoleList(this.projectId)
},
methods: {
getRoleList (projectId) {
this.$axios.get('/baseInfo/findRoleListForSelect?projectId=' + projectId).then((res) =>{
if(res.data.code === '0') {
this.roleList = res.data.data
}
})
},
getData () {
this.$axios.post('/baseInfo/findAaccountPageInfo',{
p: this.data.page,
c: this.size,
projectId: this.projectId,
roleId: this.searchForm.roleId,
accountStatus: this.searchForm.accountStatus,
keyWord: this.searchForm.keyWord
}).then((res) =>{
if(res.data.code === '0') {
this.data = res.data.data
res.data.data.list.forEach(item => {
if (item.accountStatus == '0') {
item.accountStatus = false
} else {
item.accountStatus = true
}
})
}
})
},
// 重置密码
resetPwd (id) {
this.$confirm('确定要给当前用户重置密码?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios.get('/baseInfo/resetPassword?id=' + id).then((res) =>{
if(res.data.code === '0') {
this.$message({message: '重置成功~',type: 'success'});
this.getData()
} else {
this.$message({message: '重置失败~',type: 'success'});
}
})
}).catch(() => {})
},
// 修改用户状态
changeStatus (item) {
this.$axios.post('/baseInfo/editAccountStatusById',{
accountStatus: item.accountStatus ? '1' : '0',
id: item.id
}).then((res) =>{
if(res.data.code === '0') {
this.getData()
}
})
},
delBtn (id) {
this.$confirm('确定删除当前用户?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios.get('/baseInfo/deleteAccountById?id=' + id).then((res) =>{
if(res.data.code === '0') {
this.$message({message: '删除成功~',type: 'success'});
this.getData()
} else {
this.$message({message: '删除失败~',type: 'error'});
}
})
}).catch(() => {})
},
handleSizeChange (val) {
this.size = val
this.getData()
......@@ -159,8 +182,8 @@ export default {
this.data.page = val
this.getData()
},
addBtn () {
this.$router.push('/system/userAdd')
addBtn (id) {
this.$router.push('/system/userAdd/' + id)
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
......
......@@ -36,10 +36,7 @@ axios.interceptors.response.use(function (response) {
if (response.data.code === '0') {
return response
} else if (response.data.code === 'BASE_00004') {
alert('登录失效,请重新登录', '温馨提示', {
type: 'info',
confirmButtonText: '确定'
})
alert('登录失效,请重新登录', '温馨提示')
router.push('/login')
} else {
// 在添加其他的错误码判断
......
......@@ -226,10 +226,10 @@ export default new Router({
require(['../components/page/system/roleList.vue'], resolve)
},
{
path: '/system/roleAdd',
path: '/system/roleAdd/:id',
name: 'roleAdd',
meta: {
pageName: '新增角色'
pageName: '角色管理'
},
component: resolve =>
require(['../components/page/system/roleAdd.vue'], resolve)
......@@ -244,10 +244,10 @@ export default new Router({
require(['../components/page/system/userList.vue'], resolve)
},
{
path: '/system/userAdd',
path: '/system/userAdd/:id',
name: 'userAdd',
meta: {
pageName: '新增用户'
pageName: '用户管理'
},
component: resolve =>
require(['../components/page/system/userAdd.vue'], resolve)
......
......@@ -291,6 +291,9 @@ background-color:#bbb!important;
background-color: #DF9F01!important;
border-color: #DF9F01!important;
}
.el-date-table td.end-date span, .el-date-table td.start-date span{
color: #FFFFFF!important;
}
.el-tabs__active-bar,.el-radio__input.is-checked .el-radio__inner{
background-color: #DF9F01!important;
border-color: #DF9F01!important;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment