组织机构
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { instance as request } from '@/utils/request'
|
||||
|
||||
export default {
|
||||
// 新增|编辑
|
||||
sysOrgAddUser (data) {
|
||||
return request({
|
||||
url: '/api/sys/org/saveOrUpdate',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
// // 用户启用或禁用
|
||||
// sysUserIsUse (data) {
|
||||
// return request({
|
||||
// url: `/api/sys/user/isUse/${data.USID}/${data.type}`,
|
||||
// method: 'POST'
|
||||
// })
|
||||
// },
|
||||
// 获取所有部门
|
||||
sysOrgList (data) {
|
||||
return request({
|
||||
url: '/api/sys/org',
|
||||
method: 'GET',
|
||||
params: data
|
||||
})
|
||||
},
|
||||
// 删除部门
|
||||
sysOrgDelete (data) {
|
||||
return request({
|
||||
url: '/api/sys/org/delete',
|
||||
method: 'POST',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,15 @@ const routes = [
|
||||
crumb: ['角色管理']
|
||||
}
|
||||
},
|
||||
// 组织机构管理
|
||||
{
|
||||
path: 'Org',
|
||||
name: 'Org',
|
||||
component: () => import('../../views/System/Org.vue'),
|
||||
meta: {
|
||||
crumb: ['组织机构管理']
|
||||
}
|
||||
},
|
||||
// // 角色管理
|
||||
// {
|
||||
// path: 'mail',
|
||||
|
||||
@@ -0,0 +1,541 @@
|
||||
<template>
|
||||
<div class="content-height system-user">
|
||||
<div class="title">
|
||||
<span>组织机构管理</span>
|
||||
</div>
|
||||
<div class="search">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<div class="search-box-left">
|
||||
<label>部门名称:</label>
|
||||
<el-input v-model="q.orgName" placeholder="请输入部门名称"></el-input>
|
||||
<!-- <label>角色名:</label>-->
|
||||
<!-- <el-select v-model="q.roleName" class="icon-auth" placeholder="请选择角色名">-->
|
||||
<!-- <el-option label="全部" value=""></el-option>-->
|
||||
<!-- <template v-for="item in roleList">-->
|
||||
<!-- <el-option :label="item.rname" :value="item.rname" :key="item.rid"></el-option>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-select>-->
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4" align="right">
|
||||
<div class="search-box-right">
|
||||
<el-button type="primary" @click="search">查询</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<div class="operate-box">
|
||||
<el-button @click="add">新增部门</el-button>
|
||||
<el-button @click="getSelectUser">批量删除</el-button>
|
||||
<!-- <el-button @click="downloadTemp">模板下载</el-button>-->
|
||||
<!-- <el-upload-->
|
||||
<!-- class="upload-demo"-->
|
||||
<!-- action="/library/api/sys/user/import"-->
|
||||
<!-- :show-file-list="false"-->
|
||||
<!-- :on-success="uploadPDFSuccess"-->
|
||||
<!-- style="display: inline-block;margin-right: 10px;margin-left: 10px;">-->
|
||||
<!-- <el-button @click="newAddFunc">批量导入</el-button>-->
|
||||
<!-- </el-upload>-->
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="table">
|
||||
<vxe-table ref="userTable" :data="tableData" :empty-render="{name: 'NotData'}" align="center" border stripe
|
||||
v-table-min-height="'calc(100vh - 320px)'">
|
||||
<vxe-column show-overflow type="checkbox" width="77"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow type="seq" title="序号" width="77">
|
||||
<template #default="{ row, rowIndex }">
|
||||
{{ rowIndex + (q.pageNo - 1) * q.pageSize + 1 }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="orgCode" title="部门编码"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="orgName" title="部门名称"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="orgLevel" title="部门级别"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="orgShortName" title="部门简称"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="attribution" title="归属地"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="bmdm14" title="部门14位码"></vxe-column>
|
||||
<vxe-column show-overflow show-header-overflow field="updateTime" title="更新时间"></vxe-column>
|
||||
<!-- <vxe-column show-overflow show-header-overflow title="启用/禁用" width="100" fixed="right">-->
|
||||
<!-- <template #default="{ row }">-->
|
||||
<!-- <el-switch v-model="row.ISUSE" active-value="1" inactive-value="0"-->
|
||||
<!-- @change="(val) => sysUserIsUse(val, row)"></el-switch>-->
|
||||
<!-- </template>-->
|
||||
<!-- </vxe-column>-->
|
||||
<vxe-column show-overflow show-header-overflow title="操作" width="200" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="text" @click="openRowData('view', row)">查看</el-button>
|
||||
<el-button type="text" @click="openRowData('modify', row)">编辑</el-button>
|
||||
<el-button type="text" class="del-btn" @click="deleteRow(row)">删除</el-button>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="q.pageNo"
|
||||
:page-sizes="[5, 10, 20]"
|
||||
:page-size="q.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"/>
|
||||
</div>
|
||||
<!-- 新增/编辑/查看 用户 -->
|
||||
<el-dialog :title="dialogTitle + '部门'" :visible.sync="dialogUser" width="750px" :close-on-click-modal="false"
|
||||
:close-on-press-escape="false" modal-append-to-body append-to-body>
|
||||
<div class="user-form">
|
||||
<el-form :model="form" label-width="186px" :disabled="mode === 'view'">
|
||||
<el-form-item label="部门名称:" required>
|
||||
<el-input v-model="form.orgName" maxlength="50" show-word-limit placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码:" required>
|
||||
<el-input v-model="form.orgCode" maxlength="10" show-word-limit placeholder="请输入部门编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门级别:" required>
|
||||
<el-input v-model="form.orgLevel" maxlength="2" show-word-limit placeholder="请输入部门级别"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父部门编码:" required>
|
||||
<el-input v-model="form.supOrgCode" maxlength="10" show-word-limit placeholder="请输入父部门编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门简称:" required>
|
||||
<el-input v-model="form.orgShortName" maxlength="10" show-word-limit placeholder="请输入部门简称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="归属地:" required>
|
||||
<el-input v-model="form.attribution" maxlength="10" show-word-limit placeholder="请输入归属地"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门14位码:" required>
|
||||
<el-input v-model="form.bmdm14" maxlength="10" show-word-limit placeholder="部门14位码"></el-input>
|
||||
</el-form-item>
|
||||
<!--<el-form-item label="密码:" :required="mode === 'add'" v-if="mode !== 'view'">-->
|
||||
<!--<el-input v-model="form.password" maxlength="20" type="password" placeholder="请输入密码"></el-input>-->
|
||||
<!--</el-form-item>-->
|
||||
<!--<el-form-item label="确认密码:" :required="mode === 'add'" v-if="mode !== 'view'">-->
|
||||
<!--<el-input v-model="repassword" maxlength="20" type="password" placeholder="请确认密码"></el-input>-->
|
||||
<!--</el-form-item>-->
|
||||
<!-- <el-form-item label="手机号:">-->
|
||||
<!-- <el-input v-model="form.orgCode" placeholder="请输入手机号"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="部门:">-->
|
||||
<!-- <el-input v-model="form.department" maxlength="50" show-word-limit placeholder="请输入部门"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="邮箱:">-->
|
||||
<!-- <el-input v-model="form.email" placeholder="请输入邮箱"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="角色:" required>-->
|
||||
<!-- <el-select v-model="form.roleIdList[0]" class="icon-auth" placeholder="请选择角色">-->
|
||||
<!-- <template v-for="item in roleList">-->
|
||||
<!-- <el-option :label="item.rname" :value="item.rid" :key="item.rid"></el-option>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="姓名:" required>-->
|
||||
<!-- <el-input v-model="form.usname" maxlength="20" show-word-limit placeholder="请输入姓名"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<div class="done">
|
||||
<el-button v-if="mode !== 'view'" type="primary" @click="sysOrgAddOrg">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Base64 } from 'js-base64'
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
data () {
|
||||
return {
|
||||
q: {
|
||||
orgName: '', // 用户名
|
||||
// roleName: '', // 角色名称
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
total: 0,
|
||||
tableData: [],
|
||||
mode: '',
|
||||
dialogUser: false,
|
||||
form: {
|
||||
orgName: '', // 部门名称
|
||||
orgCode: '', // 部门编码
|
||||
orgLevel: '', // 部门级别
|
||||
supOrgCode: '', // 父部门编码
|
||||
orgShortName: '', // 部门简称
|
||||
attribution: '', //归属地
|
||||
bmdm14: '', // 部门14位码
|
||||
// roleIdList: [''] // 角色
|
||||
},
|
||||
repassword: '',
|
||||
roleList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search () {
|
||||
this.q.pageNo = 1
|
||||
this.sysOrgList()
|
||||
},
|
||||
// 获取所有用户
|
||||
sysOrgList () {
|
||||
this.$api.user.sysOrgList(this.q).then(({ data }) => {
|
||||
this.tableData = data.records
|
||||
this.total = data.total
|
||||
this.q.pageNo = data.current
|
||||
this.q.pageSize = data.size
|
||||
if (!data.records.length && this.q.pageNo !== 1) {
|
||||
this.q.pageNo = 1
|
||||
this.sysOrgList()
|
||||
}
|
||||
})
|
||||
},
|
||||
// 重置
|
||||
reset () {
|
||||
this.q = {
|
||||
orgName: '', // 部门名称
|
||||
// roleName: '', // 角色名称
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
}
|
||||
this.total = 0
|
||||
this.tableData = []
|
||||
this.sysOrgList()
|
||||
},
|
||||
// 单页数据量
|
||||
handleSizeChange (val) {
|
||||
this.q.pageSize = val
|
||||
this.q.pageNo = 1
|
||||
this.sysOrgList()
|
||||
},
|
||||
// 第几页
|
||||
handleCurrentChange (val) {
|
||||
this.q.pageNo = val
|
||||
this.sysOrgList()
|
||||
},
|
||||
// 新增
|
||||
add () {
|
||||
this.mode = 'add'
|
||||
this.form = {
|
||||
orgName: '', // 部门名称
|
||||
orgCode: '', // 部门编码
|
||||
orgLevel: '', // 部门级别
|
||||
supOrgCode: '', // 父部门编码
|
||||
orgShortName: '', // 部门简称
|
||||
attribution: '', //归属地
|
||||
bmdm14: '', // 部门14位码
|
||||
// roleIdList: [''] // 角色
|
||||
}
|
||||
this.repassword = ''
|
||||
this.dialogUser = true
|
||||
},
|
||||
// // 启用/禁用
|
||||
// sysUserIsUse (val, row) {
|
||||
// this.$confirm(val === '0' ? '此操作将禁用所选用户, 是否继续?' : '此操作将启用所选用户, 是否继续?', '提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// }).then(() => {
|
||||
// this.$api.user.sysUserIsUse({ USID: row.USID, type: val }).then(_ => {
|
||||
// this.$message.success('操作成功')
|
||||
// this.sysUserList()
|
||||
// })
|
||||
// }).catch(() => {
|
||||
// row.ISUSE = val === '1' ? '0' : '1'
|
||||
// })
|
||||
// },
|
||||
// 删除
|
||||
deleteRow (row) {
|
||||
this.deleteOrg(row.USID)
|
||||
},
|
||||
// 验证
|
||||
checkUserForm () {
|
||||
if (this.mode === 'add') {
|
||||
if (!this.form.account || !(/^[a-zA-Z0-9]*$/.test(this.form.account))) {
|
||||
return this.$message.warning('用户名只能为纯数字、纯字母或字母数字组合') && false
|
||||
}
|
||||
// // 密码
|
||||
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
|
||||
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
|
||||
// }
|
||||
// if (this.repassword !== this.form.password) {
|
||||
// return this.$message.warning('请检查密码') && false;
|
||||
// }
|
||||
}
|
||||
if (this.mode === 'modify') {
|
||||
// if (this.form.password || this.repassword) {
|
||||
// // 密码
|
||||
// if (!(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/.test(this.form.password))) {
|
||||
// return this.$message.warning('密码至少8个字符,至少1个大写字母,1个小写字母,1个数字') && false;
|
||||
// }
|
||||
// if (this.repassword !== this.form.password) {
|
||||
// return this.$message.warning('请检查密码') && false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (this.form.cellPhoneNumber && !(/^1[3|4|5|7|8|9][0-9]{9}$/.test(this.form.cellPhoneNumber))) {
|
||||
return this.$message.warning('请检查手机号') && false
|
||||
}
|
||||
if (this.form.email && !(/^[\w-.]+@[a-z\d-]+(\.[a-z\d-]+)*\.[a-z\d]{2,6}$/i.test(this.form.email))) {
|
||||
return this.$message.warning('请检查邮箱') && false
|
||||
}
|
||||
if (!this.form.roleIdList[0]) {
|
||||
return this.$message.warning('请选择角色') && false
|
||||
}
|
||||
if (!this.form.usname) {
|
||||
return this.$message.warning('请输入姓名') && false
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 新增用户
|
||||
sysOrgAddOrg () {
|
||||
if (!this.checkUserForm()) return
|
||||
const data = JSON.parse(JSON.stringify(this.form))
|
||||
data.orgName = this.$JSEncrypt(data.orgName)
|
||||
// data.password = this.$JSEncrypt(data.password)
|
||||
const jsonData = JSON.stringify(data)
|
||||
this.$api.user.sysUserAddUser(Base64.encodeURI(jsonData)).then(_ => {
|
||||
this.$message.success('操作成功')
|
||||
this.dialogUser = false
|
||||
this.reset()
|
||||
})
|
||||
},
|
||||
// 编辑查看用户
|
||||
openRowData (mode, row) {
|
||||
this.mode = mode
|
||||
this.form = {
|
||||
orgName: row.orgName, // 部门名称
|
||||
orgLevel: row.orgLevel, // 部门级别
|
||||
supOrgCode: row.supOrgCode, // 父部门编码
|
||||
orgShortName: row.orgShortName, // 部门简称
|
||||
id: row.id, // ID
|
||||
attribution: row.attribution, // 归属地
|
||||
bmdm14: row.bmdm14 // 部门14位码
|
||||
}
|
||||
this.repassword = ''
|
||||
this.dialogUser = true
|
||||
},
|
||||
newAddFunc () {
|
||||
|
||||
},
|
||||
// uploadPDFSuccess (response, file, fileList) {
|
||||
// if (response.ok) {
|
||||
// this.$message.success('导入成功')
|
||||
// this.reset()
|
||||
// } else {
|
||||
// this.$message.error(response.message)
|
||||
// }
|
||||
// },
|
||||
// downloadTemp () {
|
||||
// window.open('/library/api/sys/user/template')
|
||||
// },
|
||||
// 多选部门
|
||||
getSelectOrg () {
|
||||
const users = this.$refs.userTable.getCheckboxRecords()
|
||||
if (!users.length) {
|
||||
return this.$message.warning('请选择数据后在进行操作')
|
||||
}
|
||||
const ids = users.map(item => item.USID).join(',')
|
||||
this.deleteUser(ids)
|
||||
},
|
||||
// 删除用户
|
||||
deleteOrg (ids) {
|
||||
this.$confirm('此操作将删除所选用户, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$api.org.sysOrgDelete({ ids }).then(_ => {
|
||||
this.$message.success('操作成功')
|
||||
this.sysOrgList()
|
||||
})
|
||||
})
|
||||
},
|
||||
// 角色列表
|
||||
getSysOrg () {
|
||||
this.$api.role.getSysOrg().then(({ data }) => {
|
||||
this.roleList = data
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
computed: {
|
||||
dialogTitle () {
|
||||
switch (this.mode) {
|
||||
case 'add':
|
||||
return '新增'
|
||||
case 'modify':
|
||||
return '编辑'
|
||||
case 'view':
|
||||
return '查看'
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.sysOrgList()
|
||||
this.getSysOrg()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.system-user {
|
||||
.title {
|
||||
border-bottom: 1px solid #EBEEF5;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
margin: 0 18px 0 22px;
|
||||
|
||||
span {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
.search-box-left {
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
label {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #595959;
|
||||
margin-right: 5px;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.year {
|
||||
::v-deep .el-input__inner {
|
||||
padding: 0 15px !important;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-input {
|
||||
width: 167px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1366px) {
|
||||
::v-deep .el-input {
|
||||
width: 135px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-button {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.search-box-right {
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
padding-right: 14px;
|
||||
}
|
||||
|
||||
.operate-box {
|
||||
padding-left: 13px;
|
||||
padding-bottom: 11px;
|
||||
padding-top: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
margin: 0 14px 0 13px;
|
||||
|
||||
::v-deep .el-pagination {
|
||||
margin-top: 13px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.user-form {
|
||||
padding-top: 26px;
|
||||
|
||||
::v-deep .el-form {
|
||||
padding-right: 79px;
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 10px;
|
||||
|
||||
.el-form-item__label {
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
.el-input__inner {
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.el-input__inner,
|
||||
.el-textarea__inner {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #434343;
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-date-editor {
|
||||
width: 100%;
|
||||
|
||||
.el-input__inner {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.el-input__suffix {
|
||||
font-size: 16px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-auth {
|
||||
.el-icon-arrow-up {
|
||||
margin-top: 2px;
|
||||
transform: rotateZ(0) !important;
|
||||
}
|
||||
|
||||
.el-icon-arrow-up:before {
|
||||
content: '';
|
||||
background: url("../../assets/imgs/icon-user.png") no-repeat center center;
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 14px;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.done {
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
|
||||
::v-deep .el-button {
|
||||
width: 80px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user