499 lines
17 KiB
Java
499 lines
17 KiB
Java
<template>
|
|
<a-card :bordered="false">
|
|
|
|
<!-- 查询区域 -->
|
|
<div class="table-page-search-wrapper">
|
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
|
<a-row :gutter="24">
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('account')">
|
|
<span>{{$t('account')}}</span>
|
|
</div>
|
|
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('account')"
|
|
v-model="queryParam.username"></j-input>
|
|
</div>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('RealName')">
|
|
<span>{{$t('RealName')}}</span>
|
|
</div>
|
|
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('RealName')"
|
|
v-model="queryParam.realname"></j-input>
|
|
</div>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('EmployeeNumber')">
|
|
<span>{{$t('EmployeeNumber')}}</span>
|
|
</div>
|
|
<j-input class="box-input" :placeholder="$t('PleaseEnter')+$t('EmployeeNumber')"
|
|
v-model="queryParam.workNo"></j-input>
|
|
</div>
|
|
</a-col>
|
|
<template v-if="toggleSearchStatus">
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('EmployeeType')">
|
|
<span>{{$t('EmployeeType')}}</span>
|
|
</div>
|
|
<j-dict-select-tag class="box-input" v-model="queryParam.workerType"
|
|
:placeholder="$t('pleaseSelect')+$t('EmployeeType')"
|
|
:type="'select'"
|
|
:triggerChange="false" dictCode="worker_type"/>
|
|
</div>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('status')">
|
|
<span>{{$t('status')}}</span>
|
|
</div>
|
|
<a-select class="box-input" v-model="queryParam.status"
|
|
:placeholder="$t('pleaseSelect')+$t('status')">
|
|
<a-select-option value="">{{$t('pleaseSelect')}}</a-select-option>
|
|
<a-select-option value="1">{{$t('normal')}}</a-select-option>
|
|
<a-select-option value="2">{{$t('frozen')}}</a-select-option>
|
|
</a-select>
|
|
</div>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<div class="box-title-text">
|
|
<div class="title-text" :title="$t('Theorganization')">
|
|
<span>{{ $t('Theorganization') }}</span>
|
|
</div>
|
|
<a-tree-select
|
|
tree-node-filter-prop="title"
|
|
v-model="queryParam.orgCode"
|
|
:maxTagCount="1"
|
|
show-search
|
|
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
|
class="box-input"
|
|
style="width: 100%"
|
|
:tree-data="CategoryTreeList"
|
|
:placeholder="$t('PleaseSelect')+$t('Theorganization')"
|
|
/>
|
|
<!-- <j-dict-select-tag class="box-input" v-model="queryParam.technologyTerritory"-->
|
|
<!-- :placeholder="$t('PleaseSelect')+$t('technicalField')"-->
|
|
<!-- :type="'select'"-->
|
|
<!-- :triggerChange="false" :dictCode="'duty_territory'"/>-->
|
|
</div>
|
|
</a-col>
|
|
</template>
|
|
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
|
<a-col :md="6" :sm="24">
|
|
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
|
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
|
<a @click="handleToggleSearch" style="margin-left: 8px">
|
|
{{ toggleSearchStatus ? $t('open') : $t('away') }}
|
|
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
|
</a>
|
|
</a-col>
|
|
</span>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
|
|
<!-- 操作按钮区域 -->
|
|
<div class="table-operator">
|
|
<!-- <div @click="handleAdd" class="operator-text">-->
|
|
<!-- <a-icon type="plus"/>-->
|
|
<!-- {{$t('addUser')}}-->
|
|
<!-- </div>-->
|
|
<!-- <a-button @click="handleAdd" type="primary" icon="plus">{{$t('addUser')}}</a-button>-->
|
|
<!-- <a-button type="primary" icon="download" @click="handleExportXls($t('userInformation'))">{{$t('export')}}</a-button>-->
|
|
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
|
|
<!-- <a-button type="primary" icon="import">{{$t('import')}}</a-button>-->
|
|
<!-- </a-upload>-->
|
|
<!-- <a-button type="primary" icon="hdd" @click="recycleBinVisible=true">{{$t('recycleBin')}}</a-button>-->
|
|
<a-button type="primary" icon="hdd" @click="RoleAssignment" v-has="'sys:user:role'">{{$t('RoleAssignment')}}</a-button>
|
|
<!-- <a-button type="primary" icon="hdd" @click="departmentAllocation" v-has="'sys:user:depart'">{{$t('DepartmentAllocation')}}</a-button>-->
|
|
<!-- <div @click="handleExportXls($t('userInformation'))" class="operator-text">-->
|
|
<!-- <a-icon type="export" :rotate="-90"/>-->
|
|
<!-- {{$t('export')}}-->
|
|
<!-- </div>-->
|
|
</div>
|
|
|
|
<!-- table区域-begin -->
|
|
<div>
|
|
<a-table
|
|
ref="table"
|
|
rowKey="id"
|
|
:scroll="{x: '100%'}"
|
|
:columns="columns"
|
|
:dataSource="dataSource"
|
|
:pagination="ipagination"
|
|
:loading="loading"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
@change="handleTableChange">
|
|
|
|
<template slot="avatarslot" slot-scope="text, record, index">
|
|
<div class="anty-img-wrap">
|
|
<a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
|
|
</div>
|
|
</template>
|
|
<span slot="action" slot-scope="text, record">
|
|
<a @click="handleEdit(record)" style='margin-right: 10px' v-has="'sys:user:detail'">{{$t('See')}}</a>
|
|
<!-- <a @click="resetPassword(record)" v-has="'sys:user:resetpass'">{{$t('resetPassword')}}</a>-->
|
|
</span>
|
|
|
|
</a-table>
|
|
</div>
|
|
<!-- table区域-end -->
|
|
|
|
<user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
|
|
|
|
<password-modal ref="passwordmodal" @ok="passwordModalOk"></password-modal>
|
|
|
|
<!-- 用户回收站 -->
|
|
<user-recycle-bin-modal :visible.sync="recycleBinVisible" @ok="modalFormOk"/>
|
|
<!-- 角色配置 -->
|
|
<a-modal v-model="rolevisible" :title="$t('RoleAssignment')" width='650px' :footer="null">
|
|
<role-assignment v-if='rolevisible' :selectedRowKeysArray='selectedRowKeys' @rolevisible='rolevisibleMethods'></role-assignment>
|
|
</a-modal>
|
|
<!-- 部门配置 -->
|
|
<a-modal v-model="departmentvisible" :title="$t('DepartmentAllocation')" width='650px' :footer="null">
|
|
<department-allocation v-if='departmentvisible' :selectedRowKeysArray='selectedRowKeys' @departmentvisible='departmentvisibleMethods'></department-allocation>
|
|
</a-modal>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import RoleAssignment from './modules/RoleAssignment'
|
|
import DepartmentAllocation from './modules/departmentAllocation'
|
|
import UserModal from './modules/UserModal'
|
|
import PasswordModal from './modules/PasswordModal'
|
|
import {getAction, putAction, getFileAccessHttpUrl } from '@/api/manage'
|
|
import { frozenBatch } from '@/api/api'
|
|
import { JeroListMixin } from '@/mixins/JeroListMixin'
|
|
import JInput from '@/components/jero/JInput'
|
|
import UserRecycleBinModal from './modules/UserRecycleBinModal'
|
|
import JSuperQuery from '@/components/jero/JSuperQuery'
|
|
import axios from 'axios'
|
|
import Vue from 'vue'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
export default {
|
|
name: 'UserList',
|
|
mixins: [JeroListMixin],
|
|
components: {
|
|
DepartmentAllocation,
|
|
RoleAssignment,
|
|
UserModal,
|
|
PasswordModal,
|
|
JInput,
|
|
UserRecycleBinModal,
|
|
JSuperQuery
|
|
},
|
|
data() {
|
|
return {
|
|
token:Vue.ls.get(ACCESS_TOKEN),
|
|
description: this.$t('freezePasManagementPage'),
|
|
queryParam: {},
|
|
recycleBinVisible: false,
|
|
toggleSearchStatus:false,
|
|
rolevisible: false, // 角色配置得弹框
|
|
departmentvisible: false, // 部门配置得弹框
|
|
selectedRowKeys: [],
|
|
selectedRowKeysvalue: [],
|
|
CategoryTreeList:[],
|
|
ipagination: {
|
|
current: 1,
|
|
pageSize: 10,
|
|
pageSizeOptions: ['10', '30', '50', '100'],
|
|
showTotal: (total, range) => {
|
|
return range[0] + '-' + range[1] + ' 共' + total + '条'
|
|
},
|
|
showQuickJumper: true,
|
|
showSizeChanger: true,
|
|
total: 0
|
|
},
|
|
columns: [
|
|
{
|
|
title: this.$t('serialNumber'),
|
|
dataIndex: '',
|
|
key: 'rowIndex',
|
|
width: 50,
|
|
ellipsis: true,
|
|
align: 'center',
|
|
customRender: function(t, r, index) {
|
|
return parseInt(index) + 1
|
|
}
|
|
},
|
|
{
|
|
title: this.$t('userAccount'),
|
|
align: 'center',
|
|
dataIndex: 'username',
|
|
ellipsis: true,
|
|
width: 120,
|
|
sorter: true
|
|
},
|
|
{
|
|
title: this.$t('userName'),
|
|
align: 'center',
|
|
width: 100,
|
|
ellipsis: true,
|
|
dataIndex: 'realname'
|
|
},
|
|
{
|
|
title: this.$t('EmployeeNumber'),
|
|
align: 'center',
|
|
width: 100,
|
|
ellipsis: true,
|
|
dataIndex: 'workNo'
|
|
},
|
|
{
|
|
title: this.$t('EmployeeType'),
|
|
align: 'center',
|
|
width: 100,
|
|
ellipsis: true,
|
|
dataIndex: 'workerType_dictText'
|
|
},
|
|
{
|
|
title: this.$t('department'),
|
|
align: 'center',
|
|
width: 180,
|
|
ellipsis: true,
|
|
dataIndex: 'orgCodeTxt'
|
|
},
|
|
// {
|
|
// title: '生日',
|
|
// align: "center",
|
|
// width: 100,
|
|
// dataIndex: 'birthday'
|
|
// },
|
|
// {
|
|
// title: '负责部门',
|
|
// align: "center",
|
|
// width: 180,
|
|
// dataIndex: 'departIds_dictText'
|
|
// },
|
|
{
|
|
title: this.$t('status'),
|
|
align: 'center',
|
|
width: 80,
|
|
ellipsis: true,
|
|
dataIndex: 'status_dictText'
|
|
},
|
|
{
|
|
title: this.$t('operation'),
|
|
dataIndex: 'action',
|
|
scopedSlots: {customRender: 'action'},
|
|
align: "center",
|
|
width: 80
|
|
}
|
|
],
|
|
superQueryFieldList: [
|
|
{ type: 'input', value: 'username', text: this.$t('userAccount') },
|
|
{ type: 'input', value: 'realname', text: this.$t('userName') },
|
|
{ type: 'select', value: 'sex', text: this.$t('Gender'), dictCode: 'sex' }
|
|
],
|
|
url: {
|
|
syncUser: '/act/process/extActProcess/doSyncUser',
|
|
list: '/sys/user/page',
|
|
delete: '/sys/user/delete',
|
|
deleteBatch: '/sys/user/deleteBatch',
|
|
getSysCategoryTree: '/sys/sysDepart/queryTreeList',
|
|
exportXlsUrl: '/sys/user/exportXls',
|
|
importExcelUrl: 'sys/user/importExcel'
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
importExcelUrl: function() {
|
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getSysCategoryTree()
|
|
},
|
|
methods: {
|
|
// 重置密码
|
|
resetPassword(val) {
|
|
let _this = this
|
|
axios({
|
|
url: `/jero-boot/sys/user/updatePassword?username=${val.username}`,
|
|
method: 'get',
|
|
transformRequest: [function (data) {
|
|
let ret = ''
|
|
for (let it in data) {
|
|
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
|
}
|
|
return ret
|
|
}],
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
'X-Access-Token':_this.token
|
|
}
|
|
})
|
|
.then( (res) =>{
|
|
if (res.data.success) {
|
|
_this.$message.success(res.data.result)
|
|
}else{
|
|
_this.$message.warning(res.data.result)
|
|
}
|
|
})
|
|
.catch( (error) =>{
|
|
console.log(error);
|
|
});
|
|
},
|
|
onSelectChange(val,value) {
|
|
this.selectedRowKeys = val
|
|
this.selectedRowKeysvalue = value
|
|
},
|
|
// 部门配置
|
|
departmentAllocation() {
|
|
if(this.selectedRowKeys.length == 0) {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
} else {
|
|
this.departmentvisible = true
|
|
}
|
|
},
|
|
// 角色配置
|
|
RoleAssignment: function(){
|
|
if(this.selectedRowKeys.length == 0) {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
} else {
|
|
this.rolevisible = true
|
|
}
|
|
},
|
|
rolevisibleMethods(val) {
|
|
this.rolevisible = val
|
|
this.selectedRowKeys = []
|
|
},
|
|
departmentvisibleMethods(val) {
|
|
this.departmentvisible = val
|
|
this.selectedRowKeys = []
|
|
},
|
|
getAvatarView: function(avatar) {
|
|
return getFileAccessHttpUrl(avatar)
|
|
},
|
|
|
|
batchFrozen: function(status) {
|
|
if (this.selectedRowKeys.length <= 0) {
|
|
this.$message.warning(this.$t('pleaseSelect') + this.$t('aRcord'))
|
|
return false
|
|
} else {
|
|
let ids = ''
|
|
let that = this
|
|
let isAdmin = false
|
|
that.selectionRows.forEach(function(row) {
|
|
if (row.username == 'admin') {
|
|
isAdmin = true
|
|
}
|
|
})
|
|
if (isAdmin) {
|
|
that.$message.warning(this.$t('operationAllowedAccount'))
|
|
return
|
|
}
|
|
that.selectedRowKeys.forEach(function(val) {
|
|
ids += val + ','
|
|
})
|
|
that.$confirm({
|
|
title: this.$t('confirm') + this.$t('operation'),
|
|
content: this.whether + (status == 1 ? this.$t('thaw') : this.$t('frozen')) + this.$t('selectedAccount'),
|
|
onOk: function() {
|
|
frozenBatch({ ids: ids, status: status }).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.message)
|
|
that.loadData()
|
|
that.onClearSelected()
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
getSysCategoryTree() {
|
|
getAction(this.url.getSysCategoryTree, {}).then((res) => {
|
|
if (res.success) {
|
|
this.CategoryTreeList = res.result
|
|
} else {
|
|
this.CategoryTreeList = []
|
|
}
|
|
})
|
|
},
|
|
handleMenuClick(e) {
|
|
if (e.key == 1) {
|
|
this.batchDel()
|
|
} else if (e.key == 2) {
|
|
this.batchFrozen(2)
|
|
} else if (e.key == 3) {
|
|
this.batchFrozen(1)
|
|
}
|
|
},
|
|
handleFrozen: function(id, status, username) {
|
|
let that = this
|
|
//TODO 后台校验管理员角色
|
|
if ('admin' == username) {
|
|
that.$message.warning(this.$t('adminDoNotAllowOperation'))
|
|
return
|
|
}
|
|
frozenBatch({ ids: id, status: status }).then((res) => {
|
|
if (res.success) {
|
|
that.$message.success(res.message)
|
|
that.loadData()
|
|
} else {
|
|
that.$message.warning(res.message)
|
|
}
|
|
})
|
|
},
|
|
handleChangePassword(username) {
|
|
this.$refs.passwordmodal.show(username)
|
|
},
|
|
passwordModalOk() {
|
|
//TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
@import '~@assets/less/common.less';
|
|
|
|
.box-title-text {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.title-text {
|
|
width: 20%;
|
|
min-width: 90px;
|
|
color: #000F16;
|
|
display: inline-block;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin-right: 16px;
|
|
margin-top: 3px;
|
|
text-align: right;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.box-input {
|
|
display: inline-block;
|
|
width: 70%;
|
|
height: 38px;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
.box-button {
|
|
height: 38px;
|
|
/*margin-top: 2px;*/
|
|
}
|
|
|
|
</style>
|
|
<style>
|
|
.box-input .ant-select-selection {
|
|
height: 38px !important;
|
|
}
|
|
|
|
.box-input .ant-select-selection__rendered {
|
|
line-height: 38px;
|
|
}
|
|
</style> |