350 lines
11 KiB
Java
350 lines
11 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>
|
|
<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>
|
|
<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-col>
|
|
</span>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
|
|
<!-- 操作按钮区域 -->
|
|
<div class="table-operator">
|
|
<!-- <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>-->
|
|
<div @click="handleExportXls($t('userInformation'))" class="operator-text">
|
|
<a-icon type="export" :rotate="-90"/>
|
|
{{$t('export')}}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- table区域-begin -->
|
|
<div>
|
|
<!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"-->
|
|
<a-table
|
|
ref="table"
|
|
rowKey="id"
|
|
:columns="columns"
|
|
:dataSource="dataSource"
|
|
:pagination="ipagination"
|
|
:loading="loading"
|
|
@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>
|
|
</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-card>
|
|
</template>
|
|
|
|
<script>
|
|
import UserModal from './modules/UserModal'
|
|
import PasswordModal from './modules/PasswordModal'
|
|
import { 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'
|
|
|
|
export default {
|
|
name: 'UserList',
|
|
mixins: [JeroListMixin],
|
|
components: {
|
|
UserModal,
|
|
PasswordModal,
|
|
JInput,
|
|
UserRecycleBinModal,
|
|
JSuperQuery
|
|
},
|
|
data() {
|
|
return {
|
|
description: this.$t('freezePasManagementPage'),
|
|
queryParam: {},
|
|
recycleBinVisible: false,
|
|
columns: [
|
|
{
|
|
title: this.$t('serialNumber'),
|
|
dataIndex: '',
|
|
key: 'rowIndex',
|
|
width: 20,
|
|
align: 'center',
|
|
customRender: function(t, r, index) {
|
|
return parseInt(index) + 1
|
|
}
|
|
},
|
|
{
|
|
title: this.$t('userAccount'),
|
|
align: 'center',
|
|
dataIndex: 'username',
|
|
width: 120,
|
|
sorter: true
|
|
},
|
|
{
|
|
title: this.$t('userName'),
|
|
align: 'center',
|
|
width: 100,
|
|
dataIndex: 'realname'
|
|
},
|
|
{
|
|
title: this.$t('EmployeeNumber'),
|
|
align: 'center',
|
|
width: 100,
|
|
dataIndex: 'workNo'
|
|
},
|
|
{
|
|
title: this.$t('EmployeeType'),
|
|
align: 'center',
|
|
width: 100,
|
|
dataIndex: 'workerType_dictText'
|
|
},
|
|
{
|
|
title: this.$t('department'),
|
|
align: 'center',
|
|
width: 180,
|
|
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,
|
|
dataIndex: 'status_dictText'
|
|
}
|
|
// {
|
|
// title: this.$t('operation'),
|
|
// dataIndex: 'action',
|
|
// scopedSlots: {customRender: 'action'},
|
|
// align: "center",
|
|
// width: 170
|
|
// }
|
|
],
|
|
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',
|
|
exportXlsUrl: '/sys/user/exportXls',
|
|
importExcelUrl: 'sys/user/importExcel'
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
importExcelUrl: function() {
|
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
|
}
|
|
},
|
|
methods: {
|
|
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)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
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> |