提交 1992e84b authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat:用户列表完善

上级 afec128f
......@@ -33,8 +33,17 @@
left join sys_role r on r.role_id = ur.role_id
left join sys_dept d on d.dept_id = u.dept_id
<where>
<if test="request.quick != null and request.name == null">
AND u.nick_name like CONCAT('%', #{request.quick},'%')
</if>
<if test="request.name != null">
AND u.name like CONCAT('%', #{request.name},'%')
AND u.nick_name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.enabled != null">
AND u.enabled = #{request.enabled}
</if>
<if test="request.deptId != null">
AND u.dept_id = #{request.deptId}
</if>
</where>
order by u.update_time desc
......
package io.dataease.controller.sys.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class UserGridRequest implements Serializable {
@ApiModelProperty("快速检索")
private String quick;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("组织")
private String deptId;
@ApiModelProperty("状态")
private String enabled;
}
<template>
<div>
<!-- <el-switch v-model="value" active-text="当前用户" /> -->
<treeselect
v-model="value"
:options="options"
:load-options="loadData"
style="width: 200px"
/>
</div>
</template>
<script>
import { ComplexCondition } from 'fit2cloud-ui/src/components/search-bar/model'
import { getDeptTree } from '@/api/system/dept'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
components: { Treeselect },
props: {
// eslint-disable-next-line vue/require-default-prop
field: String,
// eslint-disable-next-line vue/require-default-prop
label: String,
// eslint-disable-next-line vue/require-default-prop
defaultOperator: String
// eslint-disable-next-line vue/require-default-prop
// options: Array
// eslint-disable-next-line vue/require-default-prop
// loadData: Function
},
data() {
return {
value: undefined,
operator: 'dept',
operatorLabel: '组织',
options: null
}
},
computed: {
valueLabel() {
return this.value
}
},
// 自定义搜索控件的2个方法
methods: {
init() { // 初始化方法,在打开复合搜索界面时会被调用
// 例如清空之前填写的内容
this.value = undefined
},
getCondition() { // 点击确认时调用
const { field, label, operator, operatorLabel, value, valueLabel } = this
// 必须返回ComplexCondition类型的对象
return new ComplexCondition({ field, label, operator, operatorLabel, value, valueLabel })
},
// 获取弹窗内部门数据
loadData({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS) {
const _self = this
!this.options && getDeptTree('0').then(res => {
_self.options = res.data.map(node => _self.normalizer(node))
callback()
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
const _self = this
getDeptTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {
return _self.normalizer(obj)
})
callback()
})
}
},
normalizer(node) {
if (node.hasChildren) {
node.children = null
}
return {
id: node.deptId,
label: node.name,
children: node.children
}
}
}
}
</script>
<style scoped>
</style>
......@@ -11,17 +11,22 @@ import zhLocale from './zh'
import twLocale from './tw'
import esLocale from './es'
import jaLocale from './ja'
import fuZh from 'fit2cloud-ui/src/locale/lang/zh-CN' // 加载fit2cloud的内容
import fuEn from 'fit2cloud-ui/src/locale/lang/en_US' // 加载fit2cloud的内容
Vue.use(VueI18n)
const messages = {
en: {
...enLocale,
...elementEnLocale
...elementEnLocale,
...fuEn
},
zh: {
...zhLocale,
...elementZhLocale
...elementZhLocale,
...fuZh
},
tw: {
...twLocale,
......
......@@ -424,6 +424,7 @@ export default {
input_email: '请输入邮箱',
input_password: '请输入密码',
input_phone: '请输入电话号码',
input_roles: '请选择角色',
special_characters_are_not_supported: '不支持特殊字符',
mobile_number_format_is_incorrect: '手机号码格式不正确',
email_format_is_incorrect: '邮箱格式不正确',
......
import Cookies from 'js-cookie'
import Config from '@/settings'
const TokenKey = Config.TokenKey
export function getToken() {
......@@ -13,3 +14,4 @@ export function setToken(token) {
export function removeToken() {
return Cookies.remove(TokenKey)
}
......@@ -136,3 +136,17 @@ export function param2Obj(url) {
'"}'
)
}
export function formatCondition(param) {
if (!param) {
return null
}
const condition = {}
for (const key in param) {
if (Object.hasOwnProperty.call(param, key)) {
const element = param[key]
condition[element.field] = element.value
}
}
return condition
}
import store from '@/store'
export function checkPermission(pers) {
const permissions = store.getters.permissions
const hasPermission = pers.every(needP => {
const result = permissions.includes(needP)
return result
})
return hasPermission
}
......@@ -18,3 +18,5 @@ export function validUsername(str) {
const valid_map = ['admin', 'cyw']
return valid_map.indexOf(str.trim()) >= 0
}
export const PHONE_REGEX = '^1[3|4|5|7|8][0-9]{9}$'
<template>
<layout-content>
<complex-table
:data="data"
:columns="columns"
:buttons="buttons"
:header="header"
:search-config="searchConfig"
:pagination-config="paginationConfig"
@select="select"
@search="search"
>
<template #buttons>
<fu-table-button icon="el-icon-circle-plus-outline" :label="$t('user.create')" @click="add" />
</template>
<el-table-column type="selection" fix />
<el-table-column prop="username" label="ID" />
<el-table-column prop="nickName" :label="$t('commons.name')" width="200" />
<el-table-column prop="gender" label="性别" />
<el-table-column :show-overflow-tooltip="true" prop="phone" width="100" label="电话" />
<el-table-column :show-overflow-tooltip="true" width="135" prop="email" :label="$t('commons.email')" />
<el-table-column :show-overflow-tooltip="true" prop="dept" :label="$t('commons.organization')">
<template slot-scope="scope">
<div>{{ scope.row.dept.deptName }}</div>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')" width="120">
<template v-slot:default="scope">
<el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" inactive-color="#DCDFE6" @change="changeSwitch(scope.row)" />
</template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('commons.create_time')">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<fu-table-operations :buttons="buttons" label="操作" fix />
</complex-table>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import { userLists } from '@/api/system/user'
import ComplexTable from '@/components/business/complex-table'
import CustomCondition from './CustomCondtion'
// import { GridButton } from '@/components/GridButton'
// import { checkPermission } from '@/utils/permisstion'
const buttonClick = function(row) {
console.log(this.label + ': ' + row.id)
}
export default {
name: 'UserManagement',
components: { ComplexTable, LayoutContent },
data() {
return {
header: '',
columns: [],
buttons: [
{
label: '编辑', icon: 'el-icon-edit', click: this.edit
}, {
label: '执行', icon: 'el-icon-video-play', click: buttonClick
}, {
label: '删除', icon: 'el-icon-delete', type: 'danger', click: buttonClick
}, {
label: '删除(权限)', icon: 'el-icon-delete', type: 'danger', click: buttonClick
// show: checkPermission('editor') // 必须有editor权限才能看到
}, {
label: '复制', icon: 'el-icon-document-copy', click: buttonClick
}, {
label: '定时任务', icon: 'el-icon-timer', click: buttonClick
}
],
searchConfig: {
quickPlaceholder: '按 姓名/邮箱 搜索',
components: [
{ field: 'name', label: '姓名', component: 'FuComplexInput', defaultOperator: 'eq' },
{ field: 'email', label: 'Email', component: 'FuComplexInput' },
{
field: 'status',
label: '状态',
component: 'FuComplexSelect',
options: [
{ label: '运行中', value: 'Running' },
{ label: '成功', value: 'Success' },
{ label: '失败', value: 'Fail' }
],
multiple: true
},
{ field: 'create_time', label: '创建时间', component: 'FuComplexDateTime' },
{ field: 'user', component: CustomCondition } // 如何自定义搜索控件,看CustomCondition
]
},
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0
},
data: []
}
},
created() {
this.search()
},
methods: {
select(selection) {
console.log(selection)
},
edit(row) {
console.log('编辑: ', row)
},
add() {
},
search(condition) {
console.log(condition) // demo只查看搜索条件,没有搜索的实现
const { currentPage, pageSize } = this.paginationConfig
userLists(currentPage, pageSize, {}).then(response => {
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
})
}
}
}
</script>
<style scoped>
</style>
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论