main
bibi 3 years ago
parent a8e7d91326
commit a200f3ca88

@ -3,7 +3,7 @@ import App from './App.vue'
import './styles/index.less';
import mixins from "@/mixins"
import Antd from 'ant-design-vue';
import ElementUI from 'element-ui';
import {Cascader} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
// import moment from 'moment';
import util from '@/utils/util.js'
@ -12,7 +12,7 @@ import 'ant-design-vue/dist/antd.css';
Vue.use(util);
Vue.use(Antd);
Vue.use(mixins);
Vue.use(ElementUI);
Vue.use(Cascader);
import store from "@/store";
import router from "@/permission";

@ -105,15 +105,6 @@ export default {
mounted() {
this.getData();
},
// computed: {
// items: function() {
// return this.roleList.forEach(ele=>{
// if(ele.childrenList===undefined||ele.childrenList===null){
// ele.childrenList = {name:''}
// }
// })
// }
// },
methods: {
getData() {
rolelist().then((res) => {
@ -151,21 +142,19 @@ export default {
// okText:'',
// cancelText:'',
icon: "",
onOk: async function () {
const res = await roleDel({roleId:id})
if(res.code === 200){
vm.$message.success(res.msg)
vm.getData()
}else{
vm.$message.error(res.msg)
}
},
onOk:()=> {
roleDel({roleId:id}).then(res=>{
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
}else{
this.$message.error(res.msg)
}
})
}
});
},
onExpand(expandedKeys) {
// console.log('onExpand', expandedKeys);
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
},

@ -6,6 +6,9 @@
<!-- 角色列表 -->
<a-col :span="5">
<div class="cardTitle">所有角色</div>
<a-button class="add-btn" style="margin: 10px" @click="add.show = true"
>新增角色</a-button
>
<a-collapse accordion @change="rolechange">
<a-collapse-panel
v-for="(item, index) in roleList"
@ -81,7 +84,6 @@
@cancel="sendClose"
>
请选择角色
<!-- <a-cascader :options="roleList" mode="multiple" :field-names="{ label: 'name', value: 'id', children: 'childrenList' }" placeholder="请选择" @change="onChange" style="width: 90%"/> -->
<el-cascader
:options="roleList"
:show-all-levels="false"
@ -90,22 +92,37 @@
@change="multiRole"
></el-cascader>
</a-modal>
<add-form
:show="add.show"
:title="add.title"
:list="roleList"
@close="addClose"
@success='success'
:id='add.editId'
></add-form>
</div>
</template>
<script>
import { columns, pagination, searchForm } from "./depend/config.js";
import { rolelist, listByRole, assignRoles} from "@/api/basic/role";
import { rolelist, listByRole, assignRoles, roleDel} from "@/api/basic/role";
import rolePermissions from "./depend/permissions.vue";
import addForm from "./depend/form.vue";
export default {
components: {
rolePermissions,
addForm,
},
data() {
return {
pagination,
columns,
searchForm,
add: {
show: false,
title: "新增角色",
editId:null
},
tableChoosed: [],
roleList: [],
tableData: [], //
@ -151,7 +168,38 @@ export default {
this.tableData = res.data.rows;
});
},
onChange(){},
success(){
this.getData()
},
addClose() {
this.add.show = false;
this.add.editId = undefined;
},
//
editRole(id){
this.add.editId = id
this.add.title = '修改角色'
this.add.show= true;
},
//
delRole(id) {
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
onOk:()=> {
roleDel({roleId:id}).then(res=>{
if(res.code === 200){
this.$message.success(res.msg)
this.getData()
}else{
this.$message.error(res.msg)
}
})
}
});
},
rolechange(data) {
if (data) {
this.searchForm.roleId = this.roleList[data].id;
@ -209,23 +257,6 @@ export default {
this.form.manageUserId = undefined
this.send.show = false
},
//
editRole(id){
this.add.editId = id
this.add.show= true;
},
//
delRole(data) {
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
onOk: function () {
console.log(data);
},
});
},
Actions(data) {
console.log(data);
},

Loading…
Cancel
Save