This commit is contained in:
gtz
2022-11-07 08:45:49 +08:00
commit 4d1231adc2
1222 changed files with 194552 additions and 0 deletions

View File

@@ -0,0 +1,284 @@
<!--
* @Author: zwq
* @Date: 2021-04-06 19:33:11
* @LastEditors: gtz
* @LastEditTime: 2022-07-25 10:36:54
* @Description:
-->
<template>
<div class="app-container">
<el-container>
<el-aside>
<side-tree v-if="menuList.length>0" :menu-list="menuList" @getOrganization="getOrganization" />
</el-aside>
<el-main style="border:2px solid #E4E4E4;border-radius:10px;margin-left:10px">
<el-form
ref="dataForm"
:model="dataForm"
:inline="true"
size="medium"
label-width="100px"
label-position="left"
>
<el-form-item label-width="60px" :label="$t('userManage.orgName')+''">
<span style="margin: 0 5px;color:#1890FF">{{ dataForm.orgName }}</span>
</el-form-item>
<el-form-item :label="$t('userManage.userName')+''" prop="name">
<el-input v-model="dataForm.name" :placeholder="['placeholder.input', $t('userManage.userName')] | i18nFilterForm" clearable :style="{width: '100%'}" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:top-btn-config="topBtnConfig"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
:page="dataForm.current"
:limit="dataForm.size"
@clickTopBtn="clickTopBtn"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination v-show="total > 0" :total="total" :page.sync="dataForm.page" :limit.sync="dataForm.limit" @pagination="getList" />
<add-user-form :visible.sync="showDialog" @refreshDataList="getList" />
<edit-user-form :visible.sync="showEditDialog" :target-info="{id: curEditId}" @refreshDataList="getList" />
<assign-Role :visible.sync="AssignRoleDialog" :user-id="userId" @refreshDataList="getList" />
</el-main>
</el-container>
</div>
</template>
<script>
import sideTree from '../system-manage/sideTree'
import { getOrgList } from '@/api/org'
import AddUserForm from './AddUserForm'
import EditUserForm from './EditUser'
import AssignRole from './AssignRole'
import BaseTable from '@/components/BaseTable'
// edit here
import { getUserList, delUser } from '@/api/user'
import { getRoleList } from '@/api/role'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import dataDict from '@/filters/DataDict'
import i18n from '@/lang'
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
// edit here
const tableBtn = [{
type: 'edit',
btnName: 'btn.edit'
}, {
type: 'EmPower',
btnName: i18n.t('userManage.AssignRole')
}, {
type: 'delete',
btnName: 'btn.delete'
}]
// birthday
// orgId
// sex
// code
// remark
const tableProps = [{
prop: 'name',
label: i18n.t('userManage.userName'),
align: 'center'
}, {
prop: 'email',
label: i18n.t('userManage.email'),
align: 'center'
}, {
prop: 'mobile',
label: i18n.t('userManage.mobile'),
align: 'center'
},
// {
// prop: 'birthday',
// label: i18n.t('userManage.birthday'),
// align: 'center'
// },
{
prop: 'orgName',
label: i18n.t('userManage.orgName'),
align: 'center'
},
{
prop: 'roleName',
label: i18n.t('roleManage.roleName'),
align: 'center'
},
// {
// prop: 'sex',
// label: i18n.t('userManage.sex'),
// align: 'center',
// filter: dataDict('sex')
// },
{
prop: 'code',
label: i18n.t('userManage.code'),
align: 'center'
}, {
prop: 'enabled',
label: i18n.t('userManage.status'),
align: 'center',
filter: dataDict('enableState')
}, {
prop: 'remark',
label: i18n.t('userManage.remark'),
align: 'center'
}]
export default {
components: { sideTree, Pagination, BaseTable, MethodBtn, AddUserForm, EditUserForm, AssignRole },
data() {
return {
topBtnConfig,
menuList: [],
tableBtn,
tableProps,
list: [],
total: 0,
trueWidth: 120,
listLoading: true,
showDialog: false,
curEditId: null,
userId: '',
showEditDialog: false,
AssignRoleDialog: false,
defaultProps: {
children: 'children',
label: 'label'
},
roleNameOptions: [],
dataForm: {
name: '',
sex: '',
roleName: '',
orgId: '',
orgName: '',
current: 1,
size: 20
},
sexOptions: [{
'label': '全部',
'value': ''
}, {
'label': '男',
'value': 1
}, {
'label': '女',
'value': 2
}]
}
},
created() {
this.getOrgList()
this.getList()
},
methods: {
async getOrgList() {
// edit here
const params = {
current: 1,
size: 500
}
this.roleNameOptions.splice(0, this.roleNameOptions.length)
const res = await getRoleList(params)
if (res.code === 0) {
this.roleNameOptions = res.data
}
this.menuList.splice(0, this.menuList.length)
const res1 = await getOrgList(params)
if (res1.code === 0) {
this.menuList = res1.data.records
}
},
getOrganization(data) {
this.dataForm.orgId = data.id
this.dataForm.orgName = data.name
this.getList()
},
handleClick(raw) {
switch (raw.type) {
case 'delete':
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
confirmButtonText: i18n.t('btn.confirm'),
cancelButtonText: i18n.t('btn.cancel'),
type: 'warning'
}).then(async() => {
// 走接口
const result = await delUser({
id: raw.data.id
})
if (result.code === 0) {
this.$message({
type: 'success',
message: i18n.t('deleteMsgBox.doneMsg')
})
this.getList()
}
})
break
case 'edit':
this.showEditDialog = true
this.curEditId = raw.data.id
break
case 'EmPower':
this.AssignRoleDialog = true
this.userId = raw.data.id
break
}
},
async getList() {
this.listLoading = true
// edit here
const res = await getUserList(this.dataForm)
if (res.code === 0) {
this.list = res.data.records
this.list.forEach(item => {
item.roleName = item.stringList.toString()
})
this.total = res.data.total
this.listLoading = false
}
},
btnClick(val) {
this.headFormValue = val
// 如果点击的是搜索栏的其他按钮在这里继续写判断
if (this.headFormValue.btnName === 'search') {
this.getList()
}
},
clickTopBtn(val) {
if (val === 'add') {
this.showDialog = true// 新增
}
}
}
}
</script>
<style scoped>
.el-container >>> .el-aside{
border:2px solid #E4E4E4;
border-radius:10px;
background-color: white;
min-height:550px;
width:30%;
padding-top:20px
}
</style>