mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-04-02 11:22:40 +08:00
代码优化,用户列表加“角色”显示
This commit is contained in:
parent
bae0dcfd96
commit
7c0519888a
@ -5,7 +5,7 @@
|
||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1642173275899,
|
||||
"updateTime" : 1643965494984,
|
||||
"lock" : "0",
|
||||
"method" : "GET",
|
||||
"path" : "/list",
|
||||
@ -14,15 +14,88 @@
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1643964929030,\n \"executeTime\": null\n}",
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null,
|
||||
"responseBodyDefinition" : {
|
||||
"name" : "",
|
||||
"value" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "code",
|
||||
"value" : "402",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "message",
|
||||
"value" : "凭证已过期",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "data",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1643964929030",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Long",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "executeTime",
|
||||
"value" : "null",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Object",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
},
|
||||
"optionMap" : { }
|
||||
}
|
||||
================================
|
||||
return db.page("""
|
||||
select
|
||||
distinct
|
||||
su.id,
|
||||
su.username,
|
||||
su.name,
|
||||
@ -30,10 +103,13 @@ return db.page("""
|
||||
su.phone,
|
||||
su.create_date,
|
||||
su.office_id,
|
||||
so.name office_name
|
||||
so.name office_name,
|
||||
(select group_concat(sr.name) from sys_role sr left join sys_user_role sur on sr.id = sur.role_id where sr.is_del = 0 and sur.user_id = su.id) roles
|
||||
from sys_user su
|
||||
left join sys_office so on su.office_id = so.id
|
||||
left join sys_user_role sur on su.id = sur.user_id
|
||||
where su.is_del = 0
|
||||
?{roleId, and sur.role_id in(#{roleId.split(',')})}
|
||||
?{officeId, and su.office_id in(#{officeId.split(',')})}
|
||||
?{username, and su.username like concat('%',#{username},'%')}
|
||||
?{name, and su.name like concat('%',#{name},'%')}
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 12 KiB |
@ -70,9 +70,9 @@ export default {
|
||||
reset() {
|
||||
for(var key in this.where){
|
||||
if(this.where[key] instanceof Object){
|
||||
this.where[key].value = ''
|
||||
this.where[key].value = null
|
||||
}else{
|
||||
this.where[key] = ''
|
||||
this.where[key] = null
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => this.$emit('search'))
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-select v-if="mbType === 'select'" v-model="selectValue" v-bind="el" :style="{ width }" placeholder="请选择" filterable clearable>
|
||||
<el-select v-if="mbType === 'select'" v-model="selectValue" v-bind="el" :style="{ width }" :placeholder="placeholder || '请选择'" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in selectList"
|
||||
:key="item.value"
|
||||
@ -68,6 +68,10 @@ export default {
|
||||
el: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -89,7 +93,7 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
selectValue(value) {
|
||||
if (this.el && this.el.multiple && !(this.value instanceof Array)) {
|
||||
if (this.el && this.el.multiple && value.length > 0) {
|
||||
value = value.join(',')
|
||||
}
|
||||
this.$emit('update:value', value)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
<el-table-column v-if="selection" align="center" type="selection" width="50" />
|
||||
|
||||
<el-table-column v-if="showNo" label="序号" prop="num" align="center" width="100">
|
||||
<el-table-column v-if="showNo" label="序号" prop="num" align="center" width="65">
|
||||
<template slot-scope="row">
|
||||
<span>{{ row.$index+1 }}</span>
|
||||
</template>
|
||||
|
@ -74,16 +74,16 @@ export default {
|
||||
return {
|
||||
permissionData: [{
|
||||
label: '全部',
|
||||
value: 0
|
||||
value: '0'
|
||||
}, {
|
||||
label: '自定义',
|
||||
value: 1
|
||||
value: '1'
|
||||
}, {
|
||||
label: '本级及子级',
|
||||
value: 2
|
||||
value: '2'
|
||||
}, {
|
||||
label: '本级',
|
||||
value: 3
|
||||
value: '3'
|
||||
}],
|
||||
tableOptions: {
|
||||
url: 'role/list',
|
||||
@ -182,7 +182,7 @@ export default {
|
||||
name: '',
|
||||
menus: '',
|
||||
offices: '',
|
||||
permission: 0,
|
||||
permission: '0',
|
||||
code: '',
|
||||
descRibe: ''
|
||||
}
|
||||
@ -201,7 +201,7 @@ export default {
|
||||
save() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$post('role/save', this.temp).then((response) => {
|
||||
this.$post('role/save', this.temp).then(() => {
|
||||
this.reloadTable()
|
||||
this.$refs.roleFormDialog.hide()
|
||||
this.$notify({
|
||||
|
@ -32,7 +32,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="选择角色" prop="roles">
|
||||
<mb-select v-model="temp.roles" url="role/list?size=999999" labelField="name" valueField="id" :el="{ multiple: true }" />
|
||||
<mb-select v-model="temp.roles" url="role/list?size=999999" placeholder="请选择角色" labelField="name" valueField="id" :el="{ multiple: true }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -84,7 +84,7 @@ export default {
|
||||
password: '',
|
||||
phone: '',
|
||||
isLogin: 0,
|
||||
roles: '',
|
||||
roles: null,
|
||||
officeId: null
|
||||
}
|
||||
},
|
||||
|
@ -68,6 +68,17 @@ export default {
|
||||
type: 'input',
|
||||
label: '姓名/昵称',
|
||||
value: ''
|
||||
},
|
||||
roleId: {
|
||||
type: 'select',
|
||||
label: '角色',
|
||||
value: null,
|
||||
properties: {
|
||||
url: 'role/list?size=999999',
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
el: { multiple: true }
|
||||
}
|
||||
}
|
||||
},
|
||||
cols: [
|
||||
@ -85,6 +96,10 @@ export default {
|
||||
field: 'officeName',
|
||||
title: '所属机构'
|
||||
},
|
||||
{
|
||||
field: 'roles',
|
||||
title: '角色'
|
||||
},
|
||||
{
|
||||
field: 'phone',
|
||||
title: '手机号',
|
||||
|
Loading…
x
Reference in New Issue
Block a user