Browse Source

完善功能管理

master
yunuo970428 2 years ago
parent
commit
53d1038d53
  1. 74
      anrui-system-ui/src/api/system/functional/functional.js
  2. 229
      anrui-system-ui/src/views/functional/functional.vue

74
anrui-system-ui/src/api/system/functional/functional.js

@ -1,84 +1,104 @@
import request from '@/utils/request'
import qs from 'qs'
//let tokens = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTm8iOiI2IiwiaXNzIjoiV0JLIiwiZXhwIjoxNjMwMDI3MDA3fQ.9bEgBzFW2g1CUT7s5VXxhNCa10cyU_WTCFeqpQje0iY'
let tokens = window.sessionStorage.getItem('token');
//获取菜单 分页列表
let tokens = window.sessionStorage.getItem('token')
// 获取菜单 分页列表
export function pageList(data) {
return request({
url: '/portal/v1/sysfunction/listAllVoForSource',
method: 'POST',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
//新增
// 新增
export function savePost(data) {
return request({
url: '/portal/v1/sysfunction/save',
method: 'POST',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
//模块名称
// 模块名称
export function sourceList(data) {
return request({
url: '/portal/v1/syssource/listAll',
method: 'POST',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
// 删除
export function delOrgroles(data) {
return request({
url: '/portal/v1/sysfunction/delBySids/'+ data.sid,
url: '/portal/v1/sysfunction/delBySids/' + data.sid,
method: 'get',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
// 修改
export function getSingleData(data){
export function getSingleData(data) {
return request({
url: '/portal/v1/sysfunction/fetchBySid/'+data.id,
url: '/portal/v1/sysfunction/fetchBySid/' + data.id,
method: 'get',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
export function putOrgroles(data){
export function putOrgroles(data) {
return request({
url: '/portal/v1/sysfunction/update/' +data.sid,
url: '/portal/v1/sysfunction/update/' + data.sid,
method: 'POST',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
// 功能是否可用状态
export function IsEnable(data){
export function IsEnable(data) {
return request({
url: '/portal/v1/sysfunction/updateIsEnable/' +data.sid+'/'+data.isEnable,
url: '/portal/v1/sysfunction/updateIsEnable/' + data.sid + '/' + data.isEnable,
method: 'POST',
data: data,
headers: {'Content-Type': 'application/json',
'token':tokens
headers: {
'Content-Type': 'application/json',
'token': tokens
}
})
}
// 获取模块下的菜单
export function getMenusForFunction(data) {
return request({
url: '/portal/v1/sysmenu/getMenusForFunction',
method: 'POST',
data: data,
headers: { 'Content-Type': 'application/json' }
})
}

229
anrui-system-ui/src/views/functional/functional.vue

@ -23,7 +23,6 @@
ref="multipleTable"
header-cell-class-name="table-header"
>
<!--<el-table-column label="序号" width="50px" type="index" align="center"></el-table-column>-->
<el-table-column prop="name" label="功能名称" width="200px" align="left"></el-table-column>
<el-table-column label="操作" width="280px" align="center">
<template slot-scope="scope">
@ -35,7 +34,6 @@
</template>
</el-table-column>
<el-table-column prop="actionUrl" label="url地址" width="200" align="center"></el-table-column>
<!--<el-table-column prop="sourceName" label="模块名称" align="center"></el-table-column>-->
<el-table-column prop="isEnable" label="是否可用" align="center">
<template slot-scope="scope">
<el-switch
@ -61,37 +59,46 @@
</td>
</tr>
<tr>
<td>功能名称</td>
<td>终端权限</td>
<td>
<el-input v-model="roleForm.name" style="width:300px"></el-input>
<el-radio-group v-model="roleForm.phoneFunction">
<el-radio label="0">pc端</el-radio>
<el-radio label="1">移动端</el-radio>
</el-radio-group>
</td>
</tr>
<tr>
<td>url地址</td>
<tr v-show="roleForm.phoneFunction == '0'">
<td>pc端功能ID</td>
<td>
<el-input v-model="roleForm.actionUrl" style="width:300px"></el-input>
<el-input clearable style="width:300px" v-model="roleForm.cId"></el-input>
</td>
</tr>
<tr v-show="roleForm.phoneFunction == '1'">
<td>移动端功能ID</td>
<td>
<el-input clearable style="width:300px" v-model="roleForm.funId"></el-input>
</td>
</tr>
<tr>
<td>模块名称</td>
<td>
<el-select v-model="roleForm.sourceSid" style="width:300px">
<el-option
v-for="(item, i) in sourceNameData"
:key="i"
:label="item.sourceName"
:value="item.sid">
</el-option>
<el-select v-model="roleForm.sourceSid" style="width:300px" @change="changeSource">
<el-option v-for="item in sourceNameData" :key="item.sid" :label="item.sourceName" :value="item.sid"></el-option>
</el-select>
</td>
</tr>
<tr>
<td>终端权限</td>
<td>url地址</td>
<td>
<el-select v-model="roleForm.actionUrl" filterable style="width:300px">
<el-option v-for="item in actionUrl_list" :key="item.sid" :label="item.name" :value="item.url"></el-option>
</el-select>
</td>
</tr>
<tr>
<td>功能名称</td>
<td>
<el-checkbox-group v-model="phoneFunction">
<el-checkbox label="0" name="type">pc端</el-checkbox>
<el-checkbox label="1" name="type">移动端</el-checkbox>
</el-checkbox-group>
<el-input v-model="roleForm.name" style="width:300px"></el-input>
</td>
</tr>
<tr>
@ -118,38 +125,46 @@
</td>
</tr>
<tr>
<td>功能名称</td>
<td>终端权限</td>
<td>
<el-input v-model="roleForm.name" style="width:300px"></el-input>
<el-radio-group v-model="roleForm.phoneFunction">
<el-radio label="0">pc端</el-radio>
<el-radio label="1">移动端</el-radio>
</el-radio-group>
</td>
</tr>
<tr>
<td>url地址</td>
<tr v-show="roleForm.phoneFunction == '0'">
<td>pc端功能ID</td>
<td>
<el-input clearable style="width:300px" v-model="roleForm.cId"></el-input>
</td>
</tr>
<tr v-show="roleForm.phoneFunction == '1'">
<td>移动端功能ID</td>
<td>
<el-input v-model="roleForm.actionUrl" style="width:300px"></el-input>
<el-input clearable style="width:300px" v-model="roleForm.funId"></el-input>
</td>
</tr>
<tr>
<td>模块名称</td>
<td>
<el-select v-model="roleForm.sourceSid" style="width:300px">
<el-option
v-for="(item, i) in sourceNameData"
:key="i"
:label="item.sourceName"
:value="item.sid">
</el-option>
<el-select v-model="roleForm.sourceSid" style="width:300px" @change="changeSource">
<el-option v-for="item in sourceNameData" :key="item.sid" :label="item.sourceName" :value="item.sid"></el-option>
</el-select>
</td>
</tr>
<tr>
<td>终端权限</td>
<td>url地址</td>
<td>
<el-checkbox-group v-model="phoneFunction" >
<!--<el-checkbox v-for="(item,index) in phoneFunctionData" :label="item.name"></el-checkbox>-->
<el-checkbox label="0" name="type">pc端</el-checkbox>
<el-checkbox label="1" name="type">移动端</el-checkbox>
</el-checkbox-group>
<el-select v-model="roleForm.actionUrl" filterable style="width:300px">
<el-option v-for="item in actionUrl_list" :key="item.sid" :label="item.name" :value="item.url"></el-option>
</el-select>
</td>
</tr>
<tr>
<td>功能名称</td>
<td>
<el-input v-model="roleForm.name" style="width:300px"></el-input>
</td>
</tr>
<tr>
@ -169,17 +184,9 @@
</template>
<script>
import {
pageList,
savePost,
sourceList,
delOrgroles,
getSingleData,
putOrgroles,
IsEnable
} from '@/api/system/functional/functional.js'
import { pageList, savePost, sourceList, delOrgroles, getSingleData, putOrgroles, IsEnable, getMenusForFunction } from '@/api/system/functional/functional.js'
export default {
export default {
data() {
return {
dialogTitle: '',
@ -190,67 +197,47 @@
parentSid: '0',
name: '',
actionUrl: '',
// controllerName:'',
sourceSid: '',
phoneFunction: '',
remarks: "",
remarks: '',
cId: '',
funId: ''
},
phoneFunction: [],
phoneFunctionData: [{
name: 'PC端',
id: '0'
}, {
name: '移动端',
id: '1'
}],
//
sourceNameData: [],
actionUrl_list: [],
formBackup: {},
search: {
name: ''
},
orgName: '',
roleTable: [],
editDialog: false,
//
loading: false,
defaultProps: {
children: 'children',
label: 'name'
},
orgdata: [], //
checkedId: [],
treedata: [],
// chace: [],
// roleDialog: false,
// Thisrow: {},
// orgListAll:[]
};
loading: false
}
},
mounted() {
this.formBackup = Object.assign({}, this.roleForm),
this.formBackup = Object.assign({}, this.roleForm)
this.getList()
this.getsourceList()
},
methods: {
//
getList() {
// let params = this.search
let params = {
name: this.search.name
}
pageList(params).then(res => {
pageList({ name: this.search.name }).then((res) => {
if (res.success) {
this.roleTable = res.data
}
console.log(res.data)
})
},
//
getsourceList() {
let params = {}
sourceList(params).then(res => {
sourceList({}).then((res) => {
if (res.success) {
this.sourceNameData = res.data
this.loading = false
}
})
},
handleClick(tab, event) {
@ -265,11 +252,15 @@
this.dialogTitle = '编辑'
this.editDialog = true
this.roleForm = Object.assign({}, row)
getSingleData({id: row.sid}).then(res => {
this.roleForm.parentName = res.data.parentName
this.roleForm.sourceSid = res.data.sourceSid
this.roleForm.sourceName = ''
this.phoneFunction = res.data.phoneFunction.split(",")
getSingleData({ id: row.sid }).then((res) => {
if (res.success) {
this.roleForm = res.data
}
})
getMenusForFunction(this.roleForm.sourceSid).then((resp) => {
if (resp.success) {
this.actionUrl_list = resp.data
}
})
},
addChildren(row) {
@ -291,40 +282,38 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delOrgroles({
sid: row.sid
}).then(res => {
delOrgroles({ sid: row.sid }).then((res) => {
if (res.success) {
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
});
this.$message({ showClose: true, type: 'success', message: '删除成功!' })
}
})
})
},
changeSource(value) {
const choose = this.sourceNameData.filter((item) => item.sid === value)
getMenusForFunction({ sourceSid: choose[0].sid }).then((res) => {
if (res.success) {
this.actionUrl_list = res.data
}
})
},
//
save() {
this.roleForm.phoneFunction = this.phoneFunction.toString()
if (this.roleForm.sid) {
putOrgroles(this.roleForm).then(res => {
if (res.code == '200') {
putOrgroles(this.roleForm).then((res) => {
if (res.success) {
this.getList()
this.editDialog = false
this.$message({
message: res.msg,
type: 'success'
})
this.$message({ showClose: true, message: res.msg, type: 'success' })
}
})
} else {
savePost(this.roleForm).then(res => {
if (res.code == '200') {
savePost(this.roleForm).then((res) => {
if (res.success) {
this.getList()
this.activeName = "roleList"
this.$message({
message: res.msg,
type: 'success'
})
this.activeName = 'roleList'
this.$message({ showClose: true, message: res.msg, type: 'success' })
}
})
}
@ -337,34 +326,28 @@
actionUrl: '',
sourceSid: '',
phoneFunction: '',
remarks: "",
remarks: '',
cId: '',
funId: ''
}
},
//
enabledChange(value, row) {
console.log(row);
IsEnable({
sid: row.sid,
isEnable:row.isEnable
}).then(res => {
this.$message({
type: 'success',
message: res.msg
});
IsEnable({ sid: row.sid, isEnable: row.isEnable }).then(res => {
this.$message({ showClose: true, type: 'success', message: res.msg })
})
}
}
};
}
</script>
<style scoped="scoped">
.el-select > .el-input {
<style scoped>
.el-select > .el-input {
display: block;
width: 300px;
}
}
.my-tabs {
.my-tabs {
margin-top: 10px;
}
}
</style>

Loading…
Cancel
Save