main
bibi 3 years ago
parent 54c34fba28
commit a8e7d91326

@ -10,6 +10,7 @@
"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",

@ -9,6 +9,38 @@ export function rolelist(params) {
data: 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) { export function listByRole(params) {
return httpService({ return httpService({

@ -3,6 +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 ElementUI from 'element-ui';
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';
@ -10,6 +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);
import store from "@/store"; import store from "@/store";
import router from "@/permission"; import router from "@/permission";

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

@ -1,375 +1,138 @@
<template> <template>
<div>
<a-modal :title="title" :visible="show" @ok="addSubmit" @cancel="addClose">
<div> <div>
<a-form-model <a-form-model
title="1d2"
layout="vertical" layout="vertical"
ref="ruleForm" ref="ruleForm"
:model="form" :model="form"
:rules="rules" :rules="rules"
:wrapper-col="{ span: 18 }"
> >
<div>基本信息</div> <a-form-model-item label="角色名称" prop="name">
<a-divider></a-divider> <a-input v-model="form.name" placeholder="请输入角色名称" />
<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-form-model-item>
</a-col> <a-form-model-item label="上级角色" prop="parentId">
<a-col :span="12"> <a-select v-model="form.parentId" placeholder="请选择" >
<a-form-model-item label="性别" prop="sex"> <a-select-option :key="0" :value="0">无上级</a-select-option>
<a-select v-model="form.sex" placeholder="请选择性别"> <a-select-option v-for="item in rolelist" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
<a-select-option v-for="item in sexOption" :key="item.id">{{
item.name
}}</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> <a-form-model-item label="权限等级" prop="authorityLevel">
<a-col :span="12"> <a-input v-model.number="form.authorityLevel" placeholder="请选择" />
<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-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-form-model-item>
</a-col> <a-form-model-item label="备注" prop="remakes">
<a-col :span="12"> <a-textarea v-model="form.remakes" placeholder="请输入" />
<a-form-model-item label="薪资" prop="salary">
<a-input placeholder="请输入薪资" v-model="form.salary" />
</a-form-model-item> </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>
</a-col>
<a-col :span="12">
<a-form-model-item label="紧急联系电话" prop="emergencyContactNumber">
<a-input
placeholder="请输入紧急联系电话"
v-model="form.emergencyContactNumber"
/>
</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>
</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> </div>
</a-modal>
</div>
</template> </template>
<script> <script>
import { insertManageUser,departmentList,uploadManageUserIdCard } from "@/api/basic/department"; import { roleInsert, roleUpdate } from "@/api/basic/role";
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);
});
}
export default { export default {
name: "Vueform",
props: { props: {
type: { show: Boolean,
type: String, title: String,
default: "add", id: Number,
}, list:Array
},
watch: {
type: {
handler(val) {
if (val === "edit") {
console.log(1);
}
},
immediate: true,
},
}, },
data() { data() {
return { 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:{ rules:{
actualName: [ name: [{ required: true, message: '请输入', trigger: 'blur' }],
{ required: true, message: "请输入真实姓名", trigger: "blur" }, parentId: [{ required: true, message: '请选择', trigger: 'change' }],
], authorityLevel: [{ required: true, message: '请输入', trigger: 'blur' }],
sex: [{ required: true, message: "请选择性别", trigger: "change" }], remakes: [{ required: true, message: '请输入', trigger: 'blur' }],
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" },
],
}, },
fileList: [], form:{
id: undefined,
name: '',
parentId: null,
authorityLevel: '',
remakes: '',
},
rolelist:[],
editInfo:null
}; };
}, },
created() {
this.getData()
},
methods: { methods: {
getData(){ addSubmit() {
departmentList().then((res) => { if(this.form.id === undefined){
this.treeData = res.data; this.$refs.ruleForm.validate(async valid => {
}); if (valid) {
}, const res = await roleInsert(this.form)
//
submit() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return;
}
if (this.type === "add") {
insertManageUser(this.form).then((res) => {
if(res.code === 200){ if(res.code === 200){
this.$message.success(res.msg) this.$message.success(res.msg)
this.addClose()
this.success() this.success()
this.close() }else{
this.$message.error(res.msg)
}
} }
}); });
}else{ }else{
console.log(1); 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)
}
} }
}); });
}
}, },
// findId(list,id){
close() { list.forEach(item => {
this.$refs.ruleForm.resetFields(); if(item.id === id){
this.cascVal=[] this.editInfo = item
}else if(item.childrenList !== null && item.childrenList ){
this.findId(item.childrenList,id)
}else{
return
}
})
}, },
success(){ success(){
this.$emit('success') this.$emit('success')
}, },
async handlePreview(file) { addClose() {
if (!file.url && !file.preview) { this.$emit("close");
file.preview = await getBase64(file.originFileObj); this.$refs.ruleForm.resetFields();
} this.form.id = undefined;
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() { watch: {
this.previewVisible = false; list:{
handler(val){
this.rolelist = []
this.rolelist = val
}, },
handleChange({ fileList }) { deep:true
this.fileList = fileList;
}, },
u1pload(){ id:{
uploadManageUserIdCard().then((res) => {console.log(res);}) 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> </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>

@ -4,7 +4,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">新增角色</a-button> <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"
@ -16,16 +18,26 @@
class="role-card" class="role-card"
:key="indexs" :key="indexs"
> >
<div> <span class="role-li">
{{ rolechild.name }} <span>{{ rolechild.name || "无" }}</span>
</div> <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> </div>
</a-collapse-panel> </a-collapse-panel>
</a-collapse> </a-collapse>
</a-col> </a-col>
<!-- 人员表格 --> <!-- 人员表格 -->
<a-col :span="19"> <a-col :span="19">
<div class='treebox'> <div class="treebox">
<a-tree <a-tree
class="tree" class="tree"
v-model="checkedKeys" v-model="checkedKeys"
@ -42,15 +54,32 @@
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
<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 './config.js' import { columns, pagination, searchForm } from "./config.js";
import { rolelist,FindAllMenus } from "@/api/basic/role"; import { rolelist, FindAllMenus, roleDel } from "@/api/basic/role";
import addForm from "./form.vue";
export default { export default {
components: {
addForm,
},
data() { data() {
return { return {
add: {
show: false,
title: "新增角色",
editId:null
},
tableChoosed: [], tableChoosed: [],
roleList: [], roleList: [],
// //
@ -60,9 +89,9 @@ export default {
searchForm: searchForm, searchForm: searchForm,
expandedKeys: [], expandedKeys: [],
replaceFields: { replaceFields: {
children: 'childrenList', children: "childrenList",
title: 'name', title: "name",
key: 'id', key: "id",
}, },
autoExpandParent: true, autoExpandParent: true,
checkedKeys: [], checkedKeys: [],
@ -70,12 +99,21 @@ export default {
// //
tableData: [], tableData: [],
ActionsList: [], ActionsList: [],
menus:[] menus: [],
}; };
}, },
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) => {
@ -84,35 +122,65 @@ export default {
}, },
rolechange(data) { rolechange(data) {
if (data) { if (data) {
this.searchForm.roleId = this.roleList[data].id this.searchForm.roleId = this.roleList[data].id;
FindAllMenus({roleId:this.searchForm.roleId}).then(res=>{ FindAllMenus({ roleId: this.searchForm.roleId }).then((res) => {
this.menus = res.data 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{ }else{
this.searchForm.roleId = null vm.$message.error(res.msg)
} }
}, },
});
},
onExpand(expandedKeys) { onExpand(expandedKeys) {
console.log('onExpand', expandedKeys); // console.log('onExpand', expandedKeys);
// if not set autoExpandParent to false, if children expanded, parent can not collapse. // if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys. // or, you can remove all expanded children keys.
this.expandedKeys = expandedKeys; this.expandedKeys = expandedKeys;
this.autoExpandParent = false; this.autoExpandParent = false;
}, },
onCheck(checkedKeys) { onCheck(checkedKeys) {
console.log('onCheck', checkedKeys); // console.log('onCheck', checkedKeys);
this.checkedKeys = checkedKeys; this.checkedKeys = checkedKeys;
}, },
onSelect(selectedKeys, info) { onSelect(selectedKeys, info) {
console.log('onSelect', info); // console.log('onSelect', info);
this.selectedKeys = selectedKeys; this.selectedKeys = selectedKeys;
}, },
reset() { reset() {
this.searchForm.keyword ='' this.searchForm.keyword = "";
}, },
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination);
const pager = { ...this.pagination }; const pager = { ...this.pagination };
pager.current = pagination.current; pager.current = pagination.current;
pager.pageSize = pagination.pageSize; pager.pageSize = pagination.pageSize;
@ -139,9 +207,19 @@ export default {
}, },
watch: { watch: {
checkedKeys(val) { 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> </script>
@ -162,4 +240,18 @@ export default {
display: flex; display: flex;
margin-left: 20px; 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> </style>

@ -16,8 +16,25 @@
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)'
> >
<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> </div>
</a-collapse-panel> </a-collapse-panel>
</a-collapse> </a-collapse>
@ -26,9 +43,12 @@
<a-col :span="19"> <a-col :span="19">
<div class="search-box"> <div class="search-box">
<a-space size="large"> <a-space size="large">
<a-input v-model="searchForm.keyword" placeholder="请输入申请人/公司名" /> <a-input
<a-button type="primary" @click='getPeople'> </a-button> v-model="searchForm.keyword"
<a-button @click='reset'> </a-button> placeholder="请输入申请人/公司名"
/>
<a-button type="primary" @click="getPeople"> </a-button>
<a-button @click="reset"> </a-button>
</a-space> </a-space>
</div> </div>
<commonTable <commonTable
@ -41,7 +61,7 @@
> >
<template v-slot:actionBox="data"> <template v-slot:actionBox="data">
<a-space size="small"> <a-space size="small">
<a class="ant-dropdown-link" @click="detail(data)" <a class="ant-dropdown-link" @click="sendRole(data.data)"
>分配角色</a >分配角色</a
> >
</a-space> </a-space>
@ -54,16 +74,32 @@
<role-permissions></role-permissions> <role-permissions></role-permissions>
</a-tab-pane> </a-tab-pane>
</a-tabs> </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> </div>
</template> </template>
<script> <script>
import {columns,pagination,searchForm} from './depend/config.js' import { columns, pagination, searchForm } from "./depend/config.js";
import { rolelist,listByRole } from "@/api/basic/role"; import { rolelist, listByRole, assignRoles} from "@/api/basic/role";
import rolePermissions from './depend/permissions.vue' import rolePermissions from "./depend/permissions.vue";
export default { export default {
components: { components: {
rolePermissions rolePermissions,
}, },
data() { data() {
return { return {
@ -74,11 +110,30 @@ export default {
roleList: [], roleList: [],
tableData: [], // tableData: [], //
ActionsList: [], 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() { mounted() {
this.getData(); this.getData();
this.getPeople() this.getPeople();
}, },
methods: { methods: {
getData() { getData() {
@ -96,17 +151,26 @@ export default {
this.tableData = res.data.rows; this.tableData = res.data.rows;
}); });
}, },
onChange(){},
rolechange(data) { rolechange(data) {
if (data) { if (data) {
this.searchForm.roleId = this.roleList[data].id this.searchForm.roleId = this.roleList[data].id;
} else {
this.searchForm.roleId = null;
}
this.getPeople();
},
rolechoose(data) {
if (data) {
this.searchForm.roleId = data;
} else { } else {
this.searchForm.roleId = null this.searchForm.roleId = null;
} }
this.getPeople(); this.getPeople();
}, },
reset() { reset() {
this.searchForm.keyword ='' this.searchForm.keyword = "";
this.getPeople() this.getPeople();
}, },
handleTableChange(pagination) { handleTableChange(pagination) {
console.log(pagination); console.log(pagination);
@ -115,7 +179,43 @@ export default {
pager.pageSize = pagination.pageSize; pager.pageSize = pagination.pageSize;
this.pagination = pager; 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({ this.$confirm({
title: "是否删除", title: "是否删除",
// okText:'', // okText:'',
@ -147,4 +247,9 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.role-li {
display: flex;
justify-content: space-between;
width: 100%;
}
</style> </style>

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

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

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

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

@ -1880,6 +1880,13 @@ async-validator@^3.0.3:
resolved "https://registry.npmjs.org/async-validator/-/async-validator-3.5.2.tgz" resolved "https://registry.npmjs.org/async-validator/-/async-validator-3.5.2.tgz"
integrity sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ== 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: async@^2.6.2:
version "2.6.3" version "2.6.3"
resolved "https://registry.npmmirror.com/async/download/async-2.6.3.tgz" 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" eslint-visitor-keys "^1.0.0"
resolve "^1.12.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" 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" 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== 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" resolved "https://registry.nlark.com/deep-is/download/deep-is-0.1.4.tgz"
integrity sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE= integrity sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE=
deepmerge@^1.5.2: deepmerge@^1.2.0, deepmerge@^1.5.2:
version "1.5.2" version "1.5.2"
resolved "https://registry.nlark.com/deepmerge/download/deepmerge-1.5.2.tgz" resolved "https://registry.nlark.com/deepmerge/download/deepmerge-1.5.2.tgz"
integrity sha1-EEmdhohEza1P7ghC34x/bwyVp1M= 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" resolved "https://registry.npmmirror.com/electron-to-chromium/download/electron-to-chromium-1.3.901.tgz"
integrity sha512-ToJdV2vzwT2jeAsw8zIggTFllJ4Kxvwghk39AhJEHHlIxor10wsFI3wo69p8nFc0s/ATWBqugPv/k3nW4Y9Mww== 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: elliptic@^6.5.3:
version "6.5.4" version "6.5.4"
resolved "https://registry.nlark.com/elliptic/download/elliptic-6.5.4.tgz" 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" resolved "https://registry.nlark.com/normalize-url/download/normalize-url-3.3.0.tgz"
integrity sha1-suHE3E98bVd0PfczpPWXjRhlBVk= 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: npm-run-path@^2.0.0:
version "2.0.2" version "2.0.2"
resolved "https://registry.npmmirror.com/npm-run-path/download/npm-run-path-2.0.2.tgz" 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" resolved "https://registry.nlark.com/requires-port/download/requires-port-1.0.0.tgz"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= 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" version "1.5.1"
resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz" resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz"
integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==
@ -8043,6 +8067,11 @@ thread-loader@^2.1.3:
loader-utils "^1.1.0" loader-utils "^1.1.0"
neo-async "^2.6.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: through2@^2.0.0:
version "2.0.5" 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" 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