|
|
@ -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,15 +184,7 @@ |
|
|
|
</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 { |
|
|
|
data() { |
|
|
@ -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,28 +326,22 @@ |
|
|
|
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"> |
|
|
|
<style scoped> |
|
|
|
.el-select > .el-input { |
|
|
|
display: block; |
|
|
|
width: 300px; |
|
|
|