main
bibi 3 years ago
parent a200f3ca88
commit c9cfbd6f16

11
package-lock.json generated

@ -13,6 +13,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"less": "^4.1.2", "less": "^4.1.2",
"less-loader": "5.0.0", "less-loader": "5.0.0",
"momen": "^0.0.1-security",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
@ -9146,6 +9147,11 @@
"mkdirp": "bin/cmd.js" "mkdirp": "bin/cmd.js"
} }
}, },
"node_modules/momen": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/momen/-/momen-0.0.1-security.tgz",
"integrity": "sha512-pFEyYVJ8FmAj6+WfCRZGVJKFI9I7XHS8jy2LdTuOPR8Qiq72rXGajxToS9E62DuJ3v4sFwcv2GnOVlhDWoCjVg=="
},
"node_modules/moment": { "node_modules/moment": {
"version": "2.29.1", "version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
@ -21502,6 +21508,11 @@
"minimist": "^1.2.5" "minimist": "^1.2.5"
} }
}, },
"momen": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/momen/-/momen-0.0.1-security.tgz",
"integrity": "sha512-pFEyYVJ8FmAj6+WfCRZGVJKFI9I7XHS8jy2LdTuOPR8Qiq72rXGajxToS9E62DuJ3v4sFwcv2GnOVlhDWoCjVg=="
},
"moment": { "moment": {
"version": "2.29.1", "version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",

@ -10,7 +10,6 @@
"ant-design-vue": "^1.7.8", "ant-design-vue": "^1.7.8",
"axios": "^0.24.0", "axios": "^0.24.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.6",
"less": "^4.1.2", "less": "^4.1.2",
"less-loader": "5.0.0", "less-loader": "5.0.0",
"momen": "^0.0.1-security", "momen": "^0.0.1-security",

@ -2,7 +2,7 @@ import httpService from "@/request"
// 权限 角色 // 权限 角色
// 角色列表 // 角色列表
export function rolelist(params) { export function getrolelist(params) {
return httpService({ return httpService({
url: `/user/role/list`, url: `/user/role/list`,
method: 'get', method: 'get',

@ -3,8 +3,8 @@ 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 {Cascader} 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'
import 'ant-design-vue/dist/antd.css'; import 'ant-design-vue/dist/antd.css';
@ -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(Cascader); // Vue.use(Cascader);
import store from "@/store"; import store from "@/store";
import router from "@/permission"; import router from "@/permission";

@ -1,8 +1,7 @@
import store from '@/store' import store from '@/store'
export default { export default {
install: function (Vue) { install: function (Vue) {
const communityCode = store.getters.getCommunityCode; Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode +'/manage/user/upload/uploadTestMinioImg'
Vue.prototype.$upload = process.env.VUE_APP_URL + communityCode +'/manage/user/upload/uploadTestMinioImg'
Vue.prototype.ImgUrl = (src) => { Vue.prototype.ImgUrl = (src) => {
return process.env.VUE_APP_STATIC + src return process.env.VUE_APP_STATIC + src
} }

@ -18,7 +18,11 @@ export const columns = [
dataIndex: "roleNameList", dataIndex: "roleNameList",
width: "20%", width: "20%",
customRender: function (roleNameList) { customRender: function (roleNameList) {
return roleNameList.toString(); let arr = []
for (let item of roleNameList) {
arr.push(item.name)
}
return arr.toString()
}, },
}, },
{ {

@ -49,7 +49,7 @@ export default {
form:{ form:{
id: undefined, id: undefined,
name: '', name: '',
parentId: null, parentId: undefined,
authorityLevel: '', authorityLevel: '',
remakes: '', remakes: '',
}, },

@ -67,7 +67,7 @@
<script> <script>
import { columns, pagination, searchForm } from "./config.js"; import { columns, pagination, searchForm } from "./config.js";
import { rolelist, FindAllMenus, roleDel } from "@/api/basic/role"; import { getrolelist, FindAllMenus, roleDel } from "@/api/basic/role";
import addForm from "./form.vue"; import addForm from "./form.vue";
export default { export default {
components: { components: {
@ -107,7 +107,7 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
rolelist().then((res) => { getrolelist().then((res) => {
this.roleList = res.data; this.roleList = res.data;
}); });
}, },

@ -6,12 +6,15 @@
<!-- 角色列表 --> <!-- 角色列表 -->
<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
class="add-btn"
style="margin: 10px"
@click="add.show = true"
>新增角色</a-button >新增角色</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 afterroleList"
:key="index" :key="index"
:header="item.name" :header="item.name"
> >
@ -19,7 +22,7 @@
v-for="(rolechild, indexs) in item.childrenList" v-for="(rolechild, indexs) in item.childrenList"
class="role-card" class="role-card"
:key="indexs" :key="indexs"
@click='rolechoose(rolechild.id)' @click="rolechoose(rolechild.id)"
> >
<span class="role-li"> <span class="role-li">
<span>{{ rolechild.name || "无" }}</span> <span>{{ rolechild.name || "无" }}</span>
@ -77,35 +80,59 @@
<role-permissions></role-permissions> <role-permissions></role-permissions>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<a-modal <!-- <a-modal title="分配角色" :visible="send.show" @ok="sendSubmit" @cancel="sendClose">
请选择角色<el-cascader :options="roleList" :show-all-levels="false" :props="{ multiple: true, checkStrictly: true,value:'id',label:'name', children:'childrenList',disabled:'disabled'}" clearable ></el-cascader></a-modal> -->
<!-- 分配角色 -->
<a-drawer
title="分配角色" title="分配角色"
:width="720"
:visible="send.show" :visible="send.show"
@ok="sendSubmit" :body-style="{ paddingBottom: '80px' }"
@cancel="sendClose" @close="sendClose"
> >
请选择角色 <div class="drawer-content">
<el-cascader <div class="cardTitle">所有角色</div>
:options="roleList" <a-tree
:show-all-levels="false" v-model="tree.checkedKeys"
:props="{ multiple: true, checkStrictly: true,value:'id',label:'name', children:'childrenList',disabled:'disabled'}" checkable
clearable :expanded-keys="tree.expandedKeys"
@change="multiRole" :auto-expand-parent="tree.autoExpandParent"
></el-cascader> :selected-keys="tree.selectedKeys"
</a-modal> :tree-data="roleList"
:checkStrictly="true"
:replaceFields="{ children:'childrenList', title:'name', key:'id' }"
@expand="onExpand"
@select="onSelect"
@check="onCheck"
/>
</div>
<div class="drawer-footer">
<a-button :style="{ marginRight: '8px' }" @click="sendClose">
关闭
</a-button>
<a-button type="primary" @click="sendSubmit"> </a-button>
</div>
</a-drawer>
<!-- 新增角色 -->
<add-form <add-form
:show="add.show" :show="add.show"
:title="add.title" :title="add.title"
:list="roleList" :list="roleList"
@close="addClose" @close="addClose"
@success='success' @success="success"
:id='add.editId' :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, roleDel} from "@/api/basic/role"; import {
getrolelist,
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"; import addForm from "./depend/form.vue";
export default { export default {
@ -115,38 +142,48 @@ export default {
}, },
data() { data() {
return { return {
tree:{
expandedKeys: [],
autoExpandParent: true,
checkedKeys: [],
selectedKeys: [],
},
pagination, pagination,
columns, columns,
searchForm, searchForm,
add: { add: {
show: false, show: false,
title: "新增角色", title: "新增角色",
editId:null editId: null,
}, },
tableChoosed: [], tableChoosed: [],
roleList: [], roleList: [],
afterroleList: [],
tableData: [], // tableData: [], //
ActionsList: [], ActionsList: [],
send:{ send: {
show:false, show: false,
},
form: {
manageUserId: undefined,
roleId: "",
}, },
form:{
manageUserId:undefined,
roleId:''
}
}; };
}, },
watch: { watch: {
roleList: { afterroleList: {
handler(val) { handler(val) {
val.forEach((ele, index) => { val.forEach((ele, index) => {
if (ele.childrenList === undefined || ele.childrenList === null) { if (ele.childrenList === undefined || ele.childrenList === null) {
this.roleList[index].childrenList = [{disabled:true}]; this.afterroleList[index].childrenList = [{ disabled: true }];
} }
}); });
}, },
deep: true, deep: true,
}, },
'tree.checkedKeys'(val) {
// console.log('onCheck', val);
},
}, },
mounted() { mounted() {
this.getData(); this.getData();
@ -154,8 +191,9 @@ export default {
}, },
methods: { methods: {
getData() { getData() {
rolelist().then((res) => { getrolelist().then((res) => {
this.roleList = res.data; this.roleList = res.data;
this.afterroleList = JSON.parse(JSON.stringify(this.roleList))
}); });
}, },
getPeople() { getPeople() {
@ -168,18 +206,18 @@ export default {
this.tableData = res.data.rows; this.tableData = res.data.rows;
}); });
}, },
success(){ success() {
this.getData() this.getData();
}, },
addClose() { addClose() {
this.add.show = false; this.add.show = false;
this.add.editId = undefined; this.add.editId = undefined;
}, },
// //
editRole(id){ editRole(id) {
this.add.editId = id this.add.editId = id;
this.add.title = '修改角色' this.add.title = "修改角色";
this.add.show= true; this.add.show = true;
}, },
// //
delRole(id) { delRole(id) {
@ -188,18 +226,18 @@ export default {
// okText:'', // okText:'',
// cancelText:'', // cancelText:'',
icon: "", icon: "",
onOk:()=> { onOk: () => {
roleDel({roleId:id}).then(res=>{ roleDel({ roleId: id }).then((res) => {
if(res.code === 200){ if (res.code === 200) {
this.$message.success(res.msg) this.$message.success(res.msg);
this.getData() this.getData();
}else{ } else {
this.$message.error(res.msg) 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;
@ -227,36 +265,66 @@ export default {
pager.pageSize = pagination.pageSize; pager.pageSize = pagination.pageSize;
this.pagination = pager; this.pagination = pager;
}, },
sendRole(data){ sendRole(data) {
this.form.manageUserId = data.id this.form.manageUserId = data.id;
this.send.show = true let haveid = [];
}, for (let name of data.roleNameList) {
multiRole(data){ haveid.push(name.id);
let arr = []
for(let a of data){
if(a.length > 0){
for(let b of a){
arr.push(b);
}
}else{
arr.push(a);
} }
this.tree.checkedKeys = haveid
this.send.show = true;
},
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.tree.expandedKeys = expandedKeys;
this.tree.autoExpandParent = false;
},
onCheck(checkedKeys) {
const arr = []
this.tree.checkedKeys = checkedKeys;
for(let k of this.tree.checkedKeys.checked){
arr.push(k)
} }
this.form.roleId = arr.toString() this.form.roleId = arr.toString()
console.log(this.form.roleId);
}, },
async sendSubmit(){ onSelect(selectedKeys, info) {
const res = await assignRoles(this.form) console.log('onSelect', info);
if(res.code === 200){ this.tree.selectedKeys = selectedKeys;
this.$message.success(res.msg) },
this.getData() // multiRole(data){
}else{ // console.log(data);
this.$message.error(res.msg) // let arr = []
// for(let a of data){
// if(a.length > 0){
// for(let b of a){
// arr.push(b);
// }
// }else{
// arr.push(a);
// }
// }
// this.form.roleId = arr.toString()
// },
async sendSubmit() {
const res = await assignRoles(this.form);
if (res.code === 200) {
this.$message.success(res.msg);
this.getData();
} else {
this.$message.error(res.msg);
} }
}, },
sendClose(){ sendClose() {
this.form.manageUserId = undefined this.form.manageUserId = undefined;
this.send.show = false this.send.show = false;
}, },
// sendClose(){
// this.form.manageUserId = undefined
// this.send.show = false
// },
Actions(data) { Actions(data) {
console.log(data); console.log(data);
}, },

15958
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save