bibi 3 years ago
parent a8e7d91326
commit a200f3ca88

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

@ -105,15 +105,6 @@ export default {
mounted() { mounted() {
this.getData(); this.getData();
}, },
// computed: {
// items: function() {
// return this.roleList.forEach(ele=>{
// if(ele.childrenList===undefined||ele.childrenList===null){
// ele.childrenList = {name:''}
// }
// })
// }
// },
methods: { methods: {
getData() { getData() {
rolelist().then((res) => { rolelist().then((res) => {
@ -151,21 +142,19 @@ export default {
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "",
onOk: async function () { onOk:()=> {
const res = await roleDel({roleId:id}) roleDel({roleId:id}).then(res=>{
if(res.code === 200){ if(res.code === 200){
vm.$message.success(res.msg) this.$message.success(res.msg)
vm.getData() this.getData()
}else{ }else{
vm.$message.error(res.msg) this.$message.error(res.msg)
} }
}, })
}
}); });
}, },
onExpand(expandedKeys) { 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.expandedKeys = expandedKeys;
this.autoExpandParent = false; this.autoExpandParent = false;
}, },

@ -6,6 +6,9 @@
<!-- 角色列表 --> <!-- 角色列表 -->
<a-col :span="5"> <a-col :span="5">
<div class="cardTitle">所有角色</div> <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 accordion @change="rolechange">
<a-collapse-panel <a-collapse-panel
v-for="(item, index) in roleList" v-for="(item, index) in roleList"
@ -81,7 +84,6 @@
@cancel="sendClose" @cancel="sendClose"
> >
请选择角色 请选择角色
<!-- <a-cascader :options="roleList" mode="multiple" :field-names="{ label: 'name', value: 'id', children: 'childrenList' }" placeholder="请选择" @change="onChange" style="width: 90%"/> -->
<el-cascader <el-cascader
:options="roleList" :options="roleList"
:show-all-levels="false" :show-all-levels="false"
@ -90,22 +92,37 @@
@change="multiRole" @change="multiRole"
></el-cascader> ></el-cascader>
</a-modal> </a-modal>
<add-form
:show="add.show"
:title="add.title"
:list="roleList"
@close="addClose"
@success='success'
:id='add.editId'
></add-form>
</div> </div>
</template> </template>
<script> <script>
import { columns, pagination, searchForm } from "./depend/config.js"; 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 rolePermissions from "./depend/permissions.vue";
import addForm from "./depend/form.vue";
export default { export default {
components: { components: {
rolePermissions, rolePermissions,
addForm,
}, },
data() { data() {
return { return {
pagination, pagination,
columns, columns,
searchForm, searchForm,
add: {
show: false,
title: "新增角色",
editId:null
},
tableChoosed: [], tableChoosed: [],
roleList: [], roleList: [],
tableData: [], // tableData: [], //
@ -151,7 +168,38 @@ export default {
this.tableData = res.data.rows; 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) { rolechange(data) {
if (data) { if (data) {
this.searchForm.roleId = this.roleList[data].id; this.searchForm.roleId = this.roleList[data].id;
@ -209,23 +257,6 @@ export default {
this.form.manageUserId = undefined this.form.manageUserId = undefined
this.send.show = false 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) { Actions(data) {
console.log(data); console.log(data);
}, },

Loading…
Cancel
Save