main
bibi 3 years ago
parent 54c34fba28
commit a8e7d91326

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

@ -9,6 +9,38 @@ export function rolelist(params) {
data: params,
})
}
// 新增角色
export function roleInsert(params) {
return httpService({
url: `/user/role/insert`,
method: 'post',
data: params,
})
}
// 编辑角色
export function roleUpdate(params) {
return httpService({
url: `/user/role/update`,
method: 'post',
data: params,
})
}
// 分配角色
export function assignRoles(params) {
return httpService({
url: `/user/role/assignRoles`,
method: 'post',
data: params,
})
}
// 删除角色
export function roleDel(params) {
return httpService({
url: `user/role/delete`,
method: 'post',
data: params,
})
}
// 角色-----员工列表
export function listByRole(params) {
return httpService({

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

@ -24,9 +24,8 @@ function filterRequestData(obj) {
return o;
}
//创建axios的实例
const communityCode = store.getters.getCommunityCode;
const httpService = axios.create({
baseURL: process.env.VUE_APP_URL+ communityCode +'/manage',// TODO:具体的配置可以根据项目情况而来
baseURL: process.env.VUE_APP_URL ,// TODO:具体的配置可以根据项目情况而来
timeout: 5000
})
@ -38,6 +37,7 @@ httpService.interceptors.request.use(config => {
config.headers['Content-Type'] = "application/json";
config.headers['manage-login-token'] = store.getters.getToken;
// config.headers['device-type'] = "web";
config.baseURL = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage'
if(config.method === 'post') {
config.data = rqData;
} else {

@ -1,375 +1,138 @@
<template>
<div>
<a-form-model
title="1d2"
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
:wrapper-col="{ span: 18 }"
>
<div>基本信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="真实姓名" prop="actualName">
<a-input v-model="form.actualName" placeholder="请输入真实姓名" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="性别" prop="sex">
<a-select v-model="form.sex" placeholder="请选择性别">
<a-select-option v-for="item in sexOption" :key="item.id">{{
item.name
}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="身份证号" prop="idCard">
<a-input v-model="form.idCard" placeholder="请输入身份证号" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item ref="tel" label="手机号" prop="tel">
<a-input
v-model="form.tel"
placeholder="请输入手机号"
@blur="
() => {
$refs.tel.onFieldBlur();
}
"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="出生日期" prop="birthday">
<a-date-picker v-model="form.birthday" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="密码" prop="password">
<a-input
type="password"
placeholder="不输入默认为手机号后6位"
v-model="form.password"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="电子邮箱" prop="email">
<a-input placeholder="请输入电子邮箱" v-model="form.email" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="居住地址" prop="address">
<a-input placeholder="请输入居住地址" v-model="form.address" />
</a-form-model-item>
</a-col>
身份证照片
<a-upload
:action="`${$baseUrl}/user/upload/uploadManageUserIdCard`"
:headers="uploadHeaders"
list-type="picture-card"
:file-list="fileList"
@preview="handlePreview"
@change="handleChange"
>
<div v-if="fileList.length < 2">
<a-icon type="plus" />
<div class="ant-upload-text">点击上传</div>
</div>
</a-upload>
<span style="color: #00000073"
>单张最多不超过4M最多上传2张支持JPG,PNG格式</span
<a-modal :title="title" :visible="show" @ok="addSubmit" @cancel="addClose">
<div>
<a-form-model
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
>
</a-row>
<div>入职信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="岗位" prop='departmentIdPath'>
<a-cascader
:field-names="{
label: 'name',
value: 'id',
children: 'childList',
}"
:options="treeData"
placeholder="请选择"
change-on-select
@change="onChange"
v-model="cascVal"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="入职时间" prop="entryDate">
<a-date-picker
placeholder="请选择入职时间"
v-model="form.entryDate"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="薪资" prop="salary">
<a-input placeholder="请输入薪资" v-model="form.salary" />
<a-form-model-item label="角色名称" prop="name">
<a-input v-model="form.name" placeholder="请输入角色名称" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<div>上传资料</div>
<a-upload
:action="`${$baseUrl}/user/upload/uploadManageUserData`"
:headers="uploadHeaders"
list-type="picture"
:default-file-list="fileList"
>
<a-button> <a-icon type="upload"/> 点击上传 </a-button>
</a-upload>
<span style="color: #00000073">支持上传PNGJPG,PDF文件</span>
</a-col>
</a-row>
<div style="margin-top: 20px">联系信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="紧急联系人" prop="emergencyContact">
<a-input
placeholder="请输入紧急联系人"
v-model="form.emergencyContact"
/>
<a-form-model-item label="上级角色" prop="parentId">
<a-select v-model="form.parentId" placeholder="请选择" >
<a-select-option :key="0" :value="0">无上级</a-select-option>
<a-select-option v-for="item in rolelist" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="紧急联系电话" prop="emergencyContactNumber">
<a-input
placeholder="请输入紧急联系电话"
v-model="form.emergencyContactNumber"
/>
<a-form-model-item label="权限等级" prop="authorityLevel">
<a-input v-model.number="form.authorityLevel" placeholder="请选择" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
label="紧急联系地址"
prop="emergencyContactAddress"
>
<a-input
placeholder="请输入紧急联系地址"
v-model="form.emergencyContactAddress"
/>
<a-form-model-item label="备注" prop="remakes">
<a-textarea v-model="form.remakes" placeholder="请输入" />
</a-form-model-item>
</a-col>
</a-row>
<div @click="u1pload"></div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="婚姻状态" prop="maritalStatus">
<a-select
placeholder="请选择婚姻状态"
v-model="form.maritalStatus"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="民族" prop="nation">
<a-select placeholder="请输入民族" v-model="form.nation" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="政治面貌" prop="politicalOutlook">
<a-select
placeholder="请选择政治面貌"
v-model="form.politicalOutlook"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="户口类型" prop="accountType">
<a-select placeholder="请选择类型" v-model="form.accountType" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="remake">
<a-textarea
v-model="form.remake"
placeholder="请输入备注"
></a-textarea>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-form-model>
</div>
</a-modal>
</div>
</template>
<script>
import { insertManageUser,departmentList,uploadManageUserIdCard } from "@/api/basic/department";
import store from "@/store";
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
import { roleInsert, roleUpdate } from "@/api/basic/role";
export default {
name: "Vueform",
props: {
type: {
type: String,
default: "add",
},
},
watch: {
type: {
handler(val) {
if (val === "edit") {
console.log(1);
}
},
immediate: true,
},
show: Boolean,
title: String,
id: Number,
list:Array
},
data() {
return {
previewVisible: false,
previewImage: "",
treeData:[],
cascVal:[],
uploadHeaders: {
"manage-login-token": store.getters.getToken,
'Content-Type': 'multipart/form-data'
},
sexOption: [
{
id: 1,
name: "男",
},
{
id: 2,
name: "女",
},
{
id: 3,
name: "保密",
},
],
form: {
actualName: "",
sex: null,
idCard: "",
tel: "",
birthday: "",
password: "",
email: "",
address: "",
idCardImgUrls: "",
departmentId: "",
departmentIdPath: "",
positionId: "",
entryDate: "",
salary: "",
dataImgUrls: "",
emergencyContact: "",
emergencyContactNumber: "",
emergencyContactAddress: "",
maritalStatus: "",
nation: "",
politicalOutlook: "",
accountType: "",
remake: "",
rules:{
name: [{ required: true, message: '请输入', trigger: 'blur' }],
parentId: [{ required: true, message: '请选择', trigger: 'change' }],
authorityLevel: [{ required: true, message: '请输入', trigger: 'blur' }],
remakes: [{ required: true, message: '请输入', trigger: 'blur' }],
},
rules: {
actualName: [
{ required: true, message: "请输入真实姓名", trigger: "blur" },
],
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
idCard: [
{ required: true, message: "请输入身份证号", trigger: "blur" },
],
tel: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ min: 11, max: 11, message: "手机号只能为11位", trigger: "blur" },
],
entryDate: [
{ required: true, message: "请选择入职时间", trigger: "change" },
],
form:{
id: undefined,
name: '',
parentId: null,
authorityLevel: '',
remakes: '',
},
fileList: [],
rolelist:[],
editInfo:null
};
},
created() {
this.getData()
},
methods: {
getData(){
departmentList().then((res) => {
this.treeData = res.data;
});
},
//
submit() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return;
}
if (this.type === "add") {
insertManageUser(this.form).then((res) => {
if(res.code===200){
addSubmit() {
if(this.form.id === undefined){
this.$refs.ruleForm.validate(async valid => {
if (valid) {
const res = await roleInsert(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.addClose()
this.success()
this.close()
}else{
this.$message.error(res.msg)
}
});
} else {
console.log(1);
}
});
}
});
}else{
this.$refs.ruleForm.validate(async valid => {
if (valid) {
const res = await roleUpdate(this.form)
if(res.code === 200){
this.$message.success(res.msg)
this.addClose()
this.success()
}else{
this.$message.error(res.msg)
}
}
});
}
},
//
close() {
this.$refs.ruleForm.resetFields();
this.cascVal=[]
findId(list,id){
list.forEach(item => {
if(item.id === id){
this.editInfo = item
}else if(item.childrenList !== null && item.childrenList ){
this.findId(item.childrenList,id)
}else{
return
}
})
},
success(){
this.$emit('success')
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
onChange(data) {
// data [1,2,2]
// yyyy-mm-dd hh:mm:ss
let _data = JSON.parse(JSON.stringify(data))
this.form.positionId = _data.pop() //2
this.form.departmentId = _data[_data.length-1] //[1,2]==>2
let str = ''
// 1:2:
for (let i = 0; i < _data.length; i++) {
str += _data[i]+':'
}
// 0:1:2:
this.form.departmentIdPath = '0:'+ str
},
handleCancel() {
this.previewVisible = false;
addClose() {
this.$emit("close");
this.$refs.ruleForm.resetFields();
this.form.id = undefined;
},
handleChange({ fileList }) {
this.fileList = fileList;
},
watch: {
list:{
handler(val){
this.rolelist = []
this.rolelist = val
},
deep:true
},
u1pload(){
uploadManageUserIdCard().then((res) => {console.log(res);})
id:{
handler(val){
if(val){
this.form.id = val
this.findId(this.rolelist,val)
console.log(this.editInfo);
this.form.name = this.editInfo.name
this.form.parentId = this.editInfo.parentId
this.form.authorityLevel = this.editInfo.authorityLevel
this.form.remakes = this.editInfo.remakes
}else if( val === undefined ){
this.form.id = undefined
}
},
}
},
}
};
</script>
<style lang="less" scoped>
</style>
<style>
</style>

@ -1,167 +0,0 @@
<template>
<div>
<a-row>
<!-- 角色列表 -->
<a-col :span="5">
<div class="cardTitle">所有角色</div>
<a-collapse accordion @change="rolechange">
<a-collapse-panel
v-for="(item, index) in roleList"
:key="index"
:header="item.name"
>
<div
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
:key="indexs"
>
<div>
{{ rolechild.name }}
</div>
</div>
</a-collapse-panel>
</a-collapse>
</a-col>
<!-- 人员表格 -->
<a-col :span="19" class="tree-box">
<div v-for="menu,index in menus" :key="index" class='tree'>
<span>{{menu.name}}</span>
<a-tree
:title="menu.name"
v-model="checkedKeys"
checkable
:replace-fields="replaceFields"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:selected-keys="selectedKeys"
:tree-data="menu.childrenList"
@expand="onExpand"
@select="onSelect"
@check="onCheck"
/>
</div>
</a-col>
</a-row>
</div>
</template>
<script>
import {columns,pagination,searchForm} from './config.js'
import { rolelist,FindAllMenus } from "@/api/basic/role";
export default {
data() {
return {
tableChoosed: [],
roleList: [],
//
pagination: pagination,
//
columns: columns,
searchForm:searchForm,
expandedKeys: [],
replaceFields: {
children: 'childrenList',
title: 'name',
key: 'id',
},
autoExpandParent: true,
checkedKeys: [],
selectedKeys: [],
//
tableData: [],
ActionsList: [ ],
menus:[]
};
},
mounted() {
this.getData();
},
methods: {
getData() {
rolelist().then((res) => {
this.roleList = res.data;
});
},
rolechange(data){
if(data){
this.searchForm.roleId = this.roleList[data].id
FindAllMenus({roleId:this.searchForm.roleId}).then(res=>{
this.menus = res.data
})
}else{
this.searchForm.roleId = null
}
},
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;
},
onCheck(checkedKeys) {
console.log('onCheck', checkedKeys);
this.checkedKeys = checkedKeys;
},
onSelect(selectedKeys, info) {
console.log('onSelect', info);
this.selectedKeys = selectedKeys;
},
reset(){
this.searchForm.keyword =''
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
this.pagination = pager;
},
del(data) {
this.$confirm({
title: "是否删除",
// okText:'',
// cancelText:'',
icon: "",
onOk: function () {
console.log(data);
},
});
},
Actions(data) {
console.log(data);
},
selectionChoosed(data) {
console.log(data);
this.tableChoosed = data;
},
},
// watch:{
// checkedKeys(val) {
// console.log('onCheck', val);
// },
// }
};
</script>
<style lang="less" scoped>
.role-card {
line-height: 30px;
font-size: 16px;
cursor: pointer;
border-bottom: 1px solid #d9d9d9;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
}
.tree-box{
padding-left: 50px;
display: flex;
.tree{
width:15%;
}
}
</style>

@ -1,118 +1,186 @@
<template>
<div>
<a-row>
<!-- 角色列表 -->
<a-col :span="5">
<div class="cardTitle">所有角色</div>
<a-button class='add-btn' style="margin:10px">新增角色</a-button>
<a-collapse accordion @change="rolechange">
<a-collapse-panel
v-for="(item, index) in roleList"
:key="index"
:header="item.name"
>
<div
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
:key="indexs"
>
<div>
{{ rolechild.name }}
</div>
</div>
</a-collapse-panel>
</a-collapse>
</a-col>
<!-- 人员表格 -->
<a-col :span="19">
<div class='treebox'>
<a-tree
class="tree"
v-model="checkedKeys"
checkable
:replace-fields="replaceFields"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:selected-keys="selectedKeys"
:tree-data="menus"
@expand="onExpand"
@select="onSelect"
@check="onCheck"
/>
<a-row>
<!-- 角色列表 -->
<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"
:key="index"
:header="item.name"
>
<div
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
:key="indexs"
>
<span class="role-li">
<span>{{ rolechild.name || "无" }}</span>
<span v-show="rolechild.name"
><a-button type="link" icon="form" @click="editRole(rolechild.id)">
</a-button>
<a-button
type="link"
style="color: #ff4d4f"
icon="delete"
@click="delRole(rolechild.id)"
></a-button
></span>
</span>
</div>
</a-col>
</a-row>
</a-collapse-panel>
</a-collapse>
</a-col>
<!-- 人员表格 -->
<a-col :span="19">
<div class="treebox">
<a-tree
class="tree"
v-model="checkedKeys"
checkable
:replace-fields="replaceFields"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:selected-keys="selectedKeys"
:tree-data="menus"
@expand="onExpand"
@select="onSelect"
@check="onCheck"
/>
</div>
</a-col>
</a-row>
<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 './config.js'
import { rolelist,FindAllMenus } from "@/api/basic/role";
import { columns, pagination, searchForm } from "./config.js";
import { rolelist, FindAllMenus, roleDel } from "@/api/basic/role";
import addForm from "./form.vue";
export default {
components: {
addForm,
},
data() {
return {
add: {
show: false,
title: "新增角色",
editId:null
},
tableChoosed: [],
roleList: [],
//
pagination: pagination,
//
columns: columns,
searchForm:searchForm,
searchForm: searchForm,
expandedKeys: [],
replaceFields: {
children: 'childrenList',
title: 'name',
key: 'id',
children: "childrenList",
title: "name",
key: "id",
},
autoExpandParent: true,
checkedKeys: [],
selectedKeys: [],
//
tableData: [],
ActionsList: [ ],
menus:[]
ActionsList: [],
menus: [],
};
},
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) => {
this.roleList = res.data;
});
},
rolechange(data){
if(data){
this.searchForm.roleId = this.roleList[data].id
FindAllMenus({roleId:this.searchForm.roleId}).then(res=>{
this.menus = res.data
})
}else{
this.searchForm.roleId = null
rolechange(data) {
if (data) {
this.searchForm.roleId = this.roleList[data].id;
FindAllMenus({ roleId: this.searchForm.roleId }).then((res) => {
this.menus = res.data;
});
} else {
this.searchForm.roleId = null;
}
},
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) {
var vm = this;
this.$confirm({
title: "是否删除",
// 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)
}
},
});
},
onExpand(expandedKeys) {
console.log('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;
},
onCheck(checkedKeys) {
console.log('onCheck', checkedKeys);
// console.log('onCheck', checkedKeys);
this.checkedKeys = checkedKeys;
},
onSelect(selectedKeys, info) {
console.log('onSelect', info);
// console.log('onSelect', info);
this.selectedKeys = selectedKeys;
},
reset(){
this.searchForm.keyword =''
reset() {
this.searchForm.keyword = "";
},
handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination };
pager.current = pagination.current;
pager.pageSize = pagination.pageSize;
@ -137,11 +205,21 @@ export default {
this.tableChoosed = data;
},
},
watch:{
watch: {
checkedKeys(val) {
console.log('onCheck', val);
// console.log('onCheck', val);
},
}
roleList: {
handler(val) {
val.forEach((ele, index) => {
if (ele.childrenList === undefined || ele.childrenList === null) {
this.roleList[index].childrenList = [{}];
}
});
},
deep: true,
},
},
};
</script>
@ -155,11 +233,25 @@ export default {
display: flex;
justify-content: space-between;
}
/deep/.ant-tree ul{
/deep/.ant-tree ul {
width: 200px;
}
.tree{
.tree {
display: flex;
margin-left: 20px;
}
.role-card {
line-height: 30px;
font-size: 16px;
cursor: pointer;
border-bottom: 1px solid #d9d9d9;
margin-bottom: 10px;
display: flex;
justify-content: space-between;
}
.role-li {
display: flex;
justify-content: space-between;
width: 100%;
}
</style>

@ -16,8 +16,25 @@
v-for="(rolechild, indexs) in item.childrenList"
class="role-card"
:key="indexs"
@click='rolechoose(rolechild.id)'
>
<span>{{ rolechild.name }}</span>
<span class="role-li">
<span>{{ rolechild.name || "无" }}</span>
<span v-show="rolechild.name"
><a-button
type="link"
icon="form"
@click="editRole(rolechild.id)"
>
</a-button>
<a-button
type="link"
style="color: #ff4d4f"
icon="delete"
@click="delRole(rolechild.id)"
></a-button
></span>
</span>
</div>
</a-collapse-panel>
</a-collapse>
@ -26,9 +43,12 @@
<a-col :span="19">
<div class="search-box">
<a-space size="large">
<a-input v-model="searchForm.keyword" placeholder="请输入申请人/公司名" />
<a-button type="primary" @click='getPeople'> </a-button>
<a-button @click='reset'> </a-button>
<a-input
v-model="searchForm.keyword"
placeholder="请输入申请人/公司名"
/>
<a-button type="primary" @click="getPeople"> </a-button>
<a-button @click="reset"> </a-button>
</a-space>
</div>
<commonTable
@ -41,7 +61,7 @@
>
<template v-slot:actionBox="data">
<a-space size="small">
<a class="ant-dropdown-link" @click="detail(data)"
<a class="ant-dropdown-link" @click="sendRole(data.data)"
>分配角色</a
>
</a-space>
@ -51,19 +71,35 @@
</a-row>
</a-tab-pane>
<a-tab-pane key="2" tab="角色权限设置" force-render>
<role-permissions></role-permissions>
<role-permissions></role-permissions>
</a-tab-pane>
</a-tabs>
<a-modal
title="分配角色"
:visible="send.show"
@ok="sendSubmit"
@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"
:props="{ multiple: true, checkStrictly: true,value:'id',label:'name', children:'childrenList',disabled:'disabled'}"
clearable
@change="multiRole"
></el-cascader>
</a-modal>
</div>
</template>
<script>
import {columns,pagination,searchForm} from './depend/config.js'
import { rolelist,listByRole } from "@/api/basic/role";
import rolePermissions from './depend/permissions.vue'
import { columns, pagination, searchForm } from "./depend/config.js";
import { rolelist, listByRole, assignRoles} from "@/api/basic/role";
import rolePermissions from "./depend/permissions.vue";
export default {
components:{
rolePermissions
components: {
rolePermissions,
},
data() {
return {
@ -72,13 +108,32 @@ export default {
searchForm,
tableChoosed: [],
roleList: [],
tableData: [], //
tableData: [], //
ActionsList: [],
send:{
show:false,
},
form:{
manageUserId:undefined,
roleId:''
}
};
},
watch: {
roleList: {
handler(val) {
val.forEach((ele, index) => {
if (ele.childrenList === undefined || ele.childrenList === null) {
this.roleList[index].childrenList = [{disabled:true}];
}
});
},
deep: true,
},
},
mounted() {
this.getData();
this.getPeople()
this.getPeople();
},
methods: {
getData() {
@ -86,27 +141,36 @@ export default {
this.roleList = res.data;
});
},
getPeople(){
getPeople() {
listByRole({
pageNum:this.pagination.current,
size:this.pagination.pageSize,
roleId:this.searchForm.roleId,
keyword:this.searchForm.keyword,
pageNum: this.pagination.current,
size: this.pagination.pageSize,
roleId: this.searchForm.roleId,
keyword: this.searchForm.keyword,
}).then((res) => {
this.tableData = res.data.rows;
});
},
rolechange(data){
if(data){
this.searchForm.roleId = this.roleList[data].id
}else{
this.searchForm.roleId = null
onChange(){},
rolechange(data) {
if (data) {
this.searchForm.roleId = this.roleList[data].id;
} else {
this.searchForm.roleId = null;
}
this.getPeople();
},
rolechoose(data) {
if (data) {
this.searchForm.roleId = data;
} else {
this.searchForm.roleId = null;
}
this.getPeople();
},
reset(){
this.searchForm.keyword =''
this.getPeople()
reset() {
this.searchForm.keyword = "";
this.getPeople();
},
handleTableChange(pagination) {
console.log(pagination);
@ -115,7 +179,43 @@ export default {
pager.pageSize = pagination.pageSize;
this.pagination = pager;
},
del(data) {
sendRole(data){
this.form.manageUserId = data.id
this.send.show = true
},
multiRole(data){
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(){
this.form.manageUserId = undefined
this.send.show = false
},
//
editRole(id){
this.add.editId = id
this.add.show= true;
},
//
delRole(data) {
this.$confirm({
title: "是否删除",
// okText:'',
@ -147,4 +247,9 @@ export default {
display: flex;
justify-content: space-between;
}
.role-li {
display: flex;
justify-content: space-between;
width: 100%;
}
</style>

@ -259,7 +259,7 @@ export default {
this.$confirm({
title: "是否删除",
icon: "",
onOk: function () {
onOk: ()=>{
buildingDel({buildingIds:ids}).then(res=>{
if(res.code === 200){
this.$message.success(res.msg)

@ -167,7 +167,7 @@ export default {
// okText:'',
// cancelText:'',
icon: "",
onOk: async function () {
onOk: async() =>{
const res = await review({
estateReviewId: estateReviewId,
operate: operate,

@ -383,7 +383,7 @@ export default {
this.$confirm({
title: "是否删除",
icon: "",
onOk: function () {
onOk:() =>{
houseDel({estateIds:ids}).then(res=>{
if(res.code === 200){
this.$message.success(res.msg)

@ -47,6 +47,13 @@
</a-row>
</div>
<div class="login-input" v-else-if="activeName === '2'">
<a-select
placeholder="请选择小区"
v-model="communityCode"
>
<a-select-option value="123456">华西村</a-select-option>
<a-select-option value="1234">地球村</a-select-option>
</a-select>
<a-input placeholder="请输入手机号码" v-model="form.tel"></a-input>
<a-input
placeholder="请输入验证码"
@ -62,7 +69,7 @@
<a-button
type="primary"
@click="login"
style="width: 90%; margin: 30px"
style="width: 90%; margin-left: 30px;margin-top:20px;margin-bottom:10px"
>
登录
</a-button>
@ -198,6 +205,7 @@ export default {
tel: "",
code: "",
},
communityCode:undefined,
rules: {
tel: [
{
@ -228,9 +236,15 @@ export default {
},
};
},
mounted() {
created() {
this.keyupEnter();
this.setCommunityCode(123456);
},
watch: {
communityCode:{
handler(value){
this.setCommunityCode(value);
}
}
},
methods: {
// enter
@ -243,7 +257,11 @@ export default {
};
},
login() {
loginTel(this.form).then(res=>{
if(this.communityCode===undefined) {
this.$message.error('先选择小区')
return
}
loginTel(this.form).then((res) => {
if (res.code === 200) {
this.$message.success(res.msg);
// token
@ -252,14 +270,18 @@ export default {
} else {
this.$message.error(res.msg);
}
})
});
},
//
getCode() {
if(this.communityCode===undefined) {
this.$message.error('先选择小区')
return
}
console.log(this.getCommunityCode);
sendTelCode(this.form).then((res) => {
if (res) {
// this.$message.success("");
this.$message.success(res.msg +' ' +res.data);
this.$message.success(res.msg + " " + res.data);
}
});
},
@ -355,5 +377,13 @@ export default {
width: 90%;
margin: 25px;
}
/deep/.ant-select {
border: 0px;
border-bottom: 1px solid #f4eded;
border-radius: 0;
width: 90%;
margin-left: 25px;
margin-bottom: 10px;
}
}
</style>

@ -1880,6 +1880,13 @@ async-validator@^3.0.3:
resolved "https://registry.npmjs.org/async-validator/-/async-validator-3.5.2.tgz"
integrity sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ==
async-validator@~1.8.1:
version "1.8.5"
resolved "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz#dc3e08ec1fd0dddb67e60842f02c0cd1cec6d7f0"
integrity sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==
dependencies:
babel-runtime "6.x"
async@^2.6.2:
version "2.6.3"
resolved "https://registry.npmmirror.com/async/download/async-2.6.3.tgz"
@ -1939,7 +1946,7 @@ babel-eslint@^10.1.0:
eslint-visitor-keys "^1.0.0"
resolve "^1.12.0"
babel-helper-vue-jsx-merge-props@^2.0.3:
babel-helper-vue-jsx-merge-props@^2.0.0, babel-helper-vue-jsx-merge-props@^2.0.3:
version "2.0.3"
resolved "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz"
integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==
@ -3162,7 +3169,7 @@ deep-is@~0.1.3:
resolved "https://registry.nlark.com/deep-is/download/deep-is-0.1.4.tgz"
integrity sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE=
deepmerge@^1.5.2:
deepmerge@^1.2.0, deepmerge@^1.5.2:
version "1.5.2"
resolved "https://registry.nlark.com/deepmerge/download/deepmerge-1.5.2.tgz"
integrity sha1-EEmdhohEza1P7ghC34x/bwyVp1M=
@ -3447,6 +3454,18 @@ electron-to-chromium@^1.3.896:
resolved "https://registry.npmmirror.com/electron-to-chromium/download/electron-to-chromium-1.3.901.tgz"
integrity sha512-ToJdV2vzwT2jeAsw8zIggTFllJ4Kxvwghk39AhJEHHlIxor10wsFI3wo69p8nFc0s/ATWBqugPv/k3nW4Y9Mww==
element-ui@^2.15.6:
version "2.15.6"
resolved "https://registry.npmjs.org/element-ui/-/element-ui-2.15.6.tgz#c9609add35af5a686a4b7685dc1d757c75e01df3"
integrity sha512-rcYXEKd/j2G0AgficAOk1Zd1AsnHRkhmrK4yLHmNOiimU2JfsywgfKUjMoFuT6pQx0luhovj8lFjpE4Fnt58Iw==
dependencies:
async-validator "~1.8.1"
babel-helper-vue-jsx-merge-props "^2.0.0"
deepmerge "^1.2.0"
normalize-wheel "^1.0.1"
resize-observer-polyfill "^1.5.0"
throttle-debounce "^1.0.1"
elliptic@^6.5.3:
version "6.5.4"
resolved "https://registry.nlark.com/elliptic/download/elliptic-6.5.4.tgz"
@ -5979,6 +5998,11 @@ normalize-url@^3.0.0:
resolved "https://registry.nlark.com/normalize-url/download/normalize-url-3.3.0.tgz"
integrity sha1-suHE3E98bVd0PfczpPWXjRhlBVk=
normalize-wheel@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz#aec886affdb045070d856447df62ecf86146ec45"
integrity sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=
npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.npmmirror.com/npm-run-path/download/npm-run-path-2.0.2.tgz"
@ -7226,7 +7250,7 @@ requires-port@^1.0.0:
resolved "https://registry.nlark.com/requires-port/download/requires-port-1.0.0.tgz"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
resize-observer-polyfill@^1.5.1:
resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz"
integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==
@ -8043,6 +8067,11 @@ thread-loader@^2.1.3:
loader-utils "^1.1.0"
neo-async "^2.6.0"
throttle-debounce@^1.0.1:
version "1.1.0"
resolved "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz#51853da37be68a155cb6e827b3514a3c422e89cd"
integrity sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==
through2@^2.0.0:
version "2.0.5"
resolved "https://registry.npm.taobao.org/through2/download/through2-2.0.5.tgz?cache=0&sync_timestamp=1593480386934&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fthrough2%2Fdownload%2Fthrough2-2.0.5.tgz"

Loading…
Cancel
Save