qa-regulatory-gwj-vue/src/views/system/group/centerUserInfo/index.vue

974 lines
33 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="app-container">
<el-container>
<!-- <el-aside width="300px" style="background-color:#fff">
<el-input
v-model="filterText"
placeholder="输入关键字进行过滤"
style="margin:10px 0"/>
<el-tree
v-loading="treeLoading"
ref="tree"
:data="treeData"
:props="defaultProps"
:filter-node-method="filterNode"
class="filter-tree"
@node-click="handleNodeClick"/>
</el-aside>-->
<el-main>
<div class="filter-container">
<div class="filter-lable w80">用户名称:</div>
<el-input v-model="keyUserName" clearable placeholder="搜索用户名" class="filter-item" style="width: 200px;"/>
<div class="filter-lable w80">人员类型:</div>
<el-select ref="refDeptLeven" v-model="keyJobLeven" clearable placeholder="请选择人员类型" class="filter-item"
style="width: 200px;">
<el-option v-for="item in userType" :key="item.id" :label="item.name"
:value="item.id"/>
</el-select>
<!-- <div class="filter-lable w80">行政区域:</div>-->
<!-- <el-cascader ref="shudi" v-model="keyShudi" :props="areaprops" clearable placeholder="请选择行政区域" style="width: 200px" />-->
<!-- <div class="filter-lable w80">单位类型:</div>-->
<!-- <el-select ref="refDeptType" v-model="keyDeptType" clearable placeholder="请选择单位类型" class="filter-item">-->
<!-- <el-option v-for="item in unitTypeList" :key="item.DICTIONARIES_ID" :label="item.NAME" :value="item.DICTIONARIES_ID" />-->
<!-- </el-select>-->
<div class="filter-lable w80">部门名称:</div>
<el-input v-model="keyDepeName" clearable placeholder="搜索部门名称" class="filter-item"
style="width: 200px;"/>
<!-- <div class="filter-lable w80">职务级别:</div>-->
<!-- <el-select ref="refJobLeven" v-model="keyJobLeven" clearable placeholder="请选择" class="filter-item">-->
<!-- <el-option v-for="item in jobTypeAllList" :key="item.DICTIONARIES_ID" :label="item.NAME" :value="item.DICTIONARIES_ID" />-->
<!-- </el-select>-->
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
搜索
</el-button>
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
重置
</el-button>
<!-- <el-button v-waves v-if="LOGIN_USER === '1'" class="filter-item" type="warning" icon="el-icon-warning"
size="mini" plain @click="resetPassword">
一键密码重置
</el-button>-->
</div>
<el-table
ref="multipleTable"
:data="varList"
:header-cell-style="{
'font-weight': 'bold',
'color': '#000'
}"
tooltip-effect="dark"
border
fit
highlight-current-row
>
<el-table-column
type="selection"
width="55"
align="center"/>
<el-table-column type="index" label="序号" width="50" align="center"/>
<el-table-column prop="USERNAME" label="用户名" align="center"/>
<el-table-column prop="NAME" label="姓名" align="center"/>
<el-table-column prop="USER_TYPE" label="用户类型" align="center">
<template slot-scope="{row}">
<span v-if="row.USER_TYPE =='0'">股份</span>
<span v-else-if="row.USER_TYPE =='1'">分公司</span>
<span v-else>相关方</span>
</template>
</el-table-column>
<!-- <el-table-column prop="SEX" label="性别"/>-->
<el-table-column prop="ORG_PATH" label="部门" align="center"/>
<el-table-column prop="CORPINFO_NAME" label="企业" align="center"/>
<el-table-column label="操作" align="center" width="120">
<template slot-scope="{row}">
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleRecord(row.USER_ID)">查看记录
</el-button>
</template>
</el-table-column>
</el-table>
<div class="page-btn-group">
<div/>
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList"/>
</div>
</el-main>
</el-container>
<el-dialog v-loading="editloading" :visible.sync="dialogFormRecord"
:title="dialogType === 'record'?'查看记录':'修改'" width="1800px">
<el-table
ref="multipleTable"
:data="recordList"
:header-cell-style="{
'font-weight': 'bold',
'color': '#000'
}"
tooltip-effect="dark"
border
fit
highlight-current-row
>
<el-table-column type="index" label="序号" width="50" align="center"/>
<el-table-column prop="NAME" label="用户名" align="center"/>
<el-table-column prop="CREATTIME" label="新增时间" align="center"/>
<el-table-column prop="CREATORNAME" label="新增人" align="center">
<template slot-scope="{row}">
<span>{{row.CREATORNAME ? row.CREATORNAME : row.NAMEX ? row.NAMEX : row.NAMER}}</span>
</template>
</el-table-column>
<el-table-column prop="REMARKS" label="记录" align="center"/>
</el-table>
</el-dialog>
<el-dialog v-loading="editloading" :visible.sync="dialogFormEdit" :title="dialogType==='editUser'?'修改':'新增'"
width="600px">
<el-form ref="form" :rules="rules" :model="pd" label-width="110px" style="width: 500px;">
<el-form-item label="角色" prop="ROLE_ID">
<el-select v-model="pd.ROLE_ID" multiple placeholder="请选择角色">
<el-option v-for="item in roleList" :key="item.role_ID" :label="item.role_NAME" :value="item.role_ID"/>
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="USERNAME">
<el-input v-model="pd.USERNAME" :disabled="dialogType == 'editUser'" placeholder="这里输入用户名..."
@blur="goCheck()"/>
</el-form-item>
<el-form-item label="姓名" prop="NAME">
<el-input v-model="pd.NAME" placeholder="这里输入姓名..."/>
</el-form-item>
<el-form-item v-if="dialogType != 'editUser'" label="密码" prop="PASSWORD">
<el-input v-model="pd.userPASSWORD" show-password placeholder="这里输入密码..."/>
</el-form-item>
<el-form-item label="身份证号" prop="USER_ID_CARD">
<el-input v-model="pd.USER_ID_CARD" placeholder="这里输入身份证号..." @blur="goCheck()"/>
</el-form-item>
<el-form-item label="性别" prop="SEX">
<el-radio v-model="pd.SEX" :label="'0'">男</el-radio>
<el-radio v-model="pd.SEX" :label="'1'">女</el-radio>
</el-form-item>
<el-form-item label="手机号" prop="PHONE">
<el-input v-model="pd.PHONE" placeholder="这里输入手机号..."/>
</el-form-item>
<!-- <el-form-item label="部门级别" prop="deptTypeID"> &lt;!&ndash;(目的是选择部门到这个级别) &ndash;&gt;-->
<!-- <el-select v-model="pd.deptTypeID" placeholder="请选择" class="filter-item" >-->
<!-- <el-option v-for="item in deptTypeLevenAllList" :key="item.BIANMA" :label="item.NAME" :value="item.DICTIONARIES_ID" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="单位部门" prop="DEPARTMENT_ID">
<SelectTree
v-if="dialogFormEdit"
ref="deptTree"
:clearable="false"
:options="deptTreeData"
:props="deptDefaultProps"
v-model="pd.DEPARTMENT_ID"
placeholder="请选择部门"
/>
</el-form-item>
<el-form-item label="行政区域" prop="shudi"> <!--河北省的就可以 -->
<el-cascader v-if="dialogFormEdit" id="shudi" ref="shudi" v-model="pd.shudi" :props="areaprops"
placeholder="请选择省市县" style="width: 100%"/>
</el-form-item>
<el-form-item label="职务级别" prop="JOB_LEVEL">
<el-select ref="refJobLevel" v-model="pd.JOB_LEVEL" placeholder="请选择" class="filter-item">
<el-option v-for="item in deptTypeLevenAllList" :key="item.BIANMA" :label="item.NAME"
:value="item.DICTIONARIES_ID"/>
</el-select>
</el-form-item>
<el-form-item label="民族" prop="NATION">
<el-select v-model="pd.NATION" placeholder="请选择" style="width: 100%;">
<el-option
v-for="item in uesrInfoDic.minzuList"
:key="item.DICTIONARIES_ID"
:label="item.NAME"
:value="item.DICTIONARIES_ID"/>
</el-select>
</el-form-item>
<!-- 相关方的业务需求,是否为审核人员.如果为是的情况,就是可以在入场培训中选择 -->
<el-form-item label="是否审核人员" prop="ISASSESS">
<el-radio v-model="pd.ISASSESS" :label="'1'">是</el-radio>
<el-radio v-model="pd.ISASSESS" :label="'0'">否</el-radio>
</el-form-item>
<el-form-item label="职务" prop="JOB">
<el-input v-model="pd.JOB" placeholder="这里输入职务..."/>
</el-form-item>
<el-form-item label="邮箱" prop="EMAIL">
<el-input v-model="pd.EMAIL" placeholder="这里输入邮箱..."/>
</el-form-item>
<el-form-item label="排序" prop="SORT">
<el-input v-model.number="pd.SORT" placeholder="这里输入排序..."/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="pd.BZ" type="textarea" placeholder="这里输入备注说明..."/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormEdit = false">取 消</el-button>
<el-button v-show="ISCHECK || dialogType === 'editUser'" type="primary" @click="confirm">确 定</el-button>
<el-button v-show="!ISCHECK && dialogType !== 'editUser'" type="primary" @click="goCheck"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import {requestFN} from '@/utils/request'
import waves from '@/directive/waves' // waves directive
import SelectTree from '@/components/SelectTree'
export default {
components: {Pagination, SelectTree},
directives: {waves},
data() {
var hasUser = (rule, value, callback) => {
if (this.dialogType != 'editUser') {
requestFN(
'/user/hasUser',
{
USERNAME: value,
tm: new Date().getTime()
}
).then((data) => {
if (data.result == 'success') {
callback()
} else {
callback(new Error('用户名重复'))
}
}).catch((e) => {
})
} else {
callback()
}
}
var hasEmail = (rule, value, callback) => {
if (value) {
requestFN(
'/user/hasEmail',
{
EMAIL: value,
USERNAME: this.pd.USERNAME
}
).then((data) => {
if (data.result == 'success') {
callback()
} else {
callback(new Error('邮箱重复'))
}
}).catch((e) => {
})
} else {
callback()
}
}
return {
LOGIN_USER: JSON.parse(sessionStorage.getItem('user')).USER_ID,
treeLoading: false,
treeData: [],
userType: [
{ id: '0', name: '股份' },
{ id: '1', name: '分公司' },
{ id: '2', name: '相关方' }
],
defaultProps: {
children: 'nodes',
label: 'name'
},
listQuery: {
page: 1,
limit: 20
},
total: 0,
varList: [],
recordList: [],
filterText: '',
keyUserName: '',
keyDeptLeven: '',
keyShudi: '',
keyDeptType: '',
keyDepeName: '',
keyJobLeven: '',
ISCHECK: false,
dialogFormEdit: false,
dialogFormRecord: false,
editloading: false,
dialogType: 'add',
USER_ID: '',
TYPE: '',
loading: true,
rules: {
EMAIL: [
{required: true, message: '请输入邮箱', trigger: 'blur'},
{
pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/,
message: '请输入正确的邮箱'
},
{validator: hasEmail, trigger: 'blur'}
],
ROLE_ID: [
{required: true, message: '角色不能为空', trigger: 'blur'}
],
USERNAME: [
{required: true, message: '用户名不能为空', trigger: 'blur'},
{
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
message: '用户名需使用手机号码格式'
},
{validator: hasUser, trigger: 'blur'}
],
NAME: [
{required: true, message: '姓名不能为空', trigger: 'blur'},
{min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur'}
],
SEX: [
{required: true, message: '请选择性别', trigger: 'blur'}
],
NATION: [
{required: true, message: '请选择民族', trigger: 'blur'}
],
PHONE: [
{required: true, message: '手机号不能为空', trigger: 'blur'},
{min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur'},
{
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
message: '请输入正确的手机号码'
}
],
deptTypeID: [
{required: true, message: '请选择部门级别', trigger: 'blur'}
],
shudi: [
{required: true, message: '请选择属地', trigger: 'blur'}
],
JOB_LEVEL: [
{required: true, message: '请选择职务级别', trigger: 'blur'}
],
DEPARTMENT_ID: [
{required: true, message: '请选择单位部门', trigger: 'blur'}
],
ISASSESS: [
{required: true, message: '请选择是否审核人员', trigger: 'blur'}
],
USER_ID_CARD: [{required: true, message: '身份证号不能为空', trigger: 'blur'},
{
pattern: /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(([0-2][1-9])|10|20|30|31)\d{3}(\d|X|x)$/,
message: '请输入正确的身份证号'
}
]
},
uesrInfoDic: {
minzuList: [], // 民族 0a0e406f27f74ee698fe9979d25f62dd
xingbieList: [], // 性别情况 21501808bbc344d593fbf9ccfe6c4531
},
pd: {
ROLE_ID: [], // 角色ID
USERNAME: '', // 用户名
NAME: '', // 姓名
userPASSWORD: 'Aa@123456789', // 密码
SEX: '', // 性别0男1女
PHONE: '', // 电话
deptTypeID: '', // 需要选择的部门级别,只有相等的时候可以
DEPARTMENT_ID: '', // 用户部门
shudi: '',
BZ: '', // 备注
EMAIL: '', // 邮箱
SORT: '', // 人员在部门中的排序
PROVINCE: '', // 所属省
CITY: '', // 所属市级
COUNTRY: '', // 所属区县
VILLAGE: '', // 所属乡镇
JOB_LEVEL: '', // 职务级别
ISASSESS: '',
JOB: '', // 职务
USER_ID_CARD: '', //身份证号
NATION: '' //民族
},
roleList: [],
multipleSelectionAll: [], // 所有选中的数据包含跨页数据
multipleSelection: [], // 当前页选中的数据
fromExcel: false, // 从excel导入权限
toExcel: false, // 导出到excel权限
add: false, // 新增按钮
del: false, // 删除按钮
edit: false, // 修改按钮
record: false, // 查看记录按钮
hasUserRet: false,
deptTypeLevenAllList: [], // 单位类型
jobTypeAllList: [], // 职务级别
deptTreeData: [], // 部门树数据,
userRecordInfo: {},
recordInfo: {},
deptDefaultProps: {
value: 'id',
children: 'nodes',
label: 'name'
},
unitTypeList: [],
areaprops: {
lazy: true,
lazyLoad(node, resolve) {
setTimeout(() => {
const areaLeven = node.level
var areaParID = ''
if (areaLeven == '0') {
areaParID = 'e725d2a91b8248f4b8f49889038df7de'
} else {
areaParID = node.data.id
}
requestFN(
'dictionaries/getLevels',
{DICTIONARIES_ID: areaParID}
).then((data) => {
const nodes = data.list.map(item => ({
value: item.DICTIONARIES_ID,
label: item.NAME.toString(),
id: item.DICTIONARIES_ID.toString(),
leaf: areaLeven > 2
}))
resolve(nodes) // 通过调用resolve将子节点数据返回通知组件数据加载完成
}).catch((e) => {
this.editloading = false
this.listLoading = false
})
}, 500)
}
}
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
}
},
created() {
this.getList(this.USER_ID)
this.hasButton()
this.getDict2('0a0e406f27f74ee698fe9979d25f62dd', 'minzuList')
this.getDict2('21501808bbc344d593fbf9ccfe6c4531', 'xingbieList')
this.getDict('3e057d284c294a48af32948d58e92e3d', 'deptTypeLevenAllList')
this.getDict('3f3a6ac41247438e91df2830765068ba', 'unitTypeList')
this.getDepartTreeList()
this.getDict('f1fbdf9a286342ae98e6a56bf823f221', 'jobTypeAllList')
this.goAddUser()
this.getTreeList()
},
methods: {
goPush(row) {
requestFN(
'user/goPush',
{
STATUS: row.STATUS,
BZ: row.BZ,
SKIN: row.SKIN,
PHONE: row.PHONE,
NUMBER: row.NUMBER,
ISMAIN: row.ISMAIN,
OPENID: row.APPID,
SORT: row.SORT,
LEARNERCATEGORY: row.LEARNERCATEGORY,
USERAVATARPREFIX: row.USERAVATARPREFIX,
USERAVATARURL: row.USERAVATARURL,
SHIFTDUTYONE: row.SHIFTDUTYONE,
SHIFTDUTYTWO: row.SHIFTDUTYTWO,
DURATION: row.DURATION,
WORKSTATUS: row.WORKSTATUS,
WORKPERIOD: row.WORKPERIOD,
PERSONNEL_TYPE: row.PERSONNEL_TYPE,
TITLE: row.TITLE,
ISSTATE: row.ISSTATE,
INCUMBENCY: row.INCUMBENCY,
WORKING_DATE: row.WORKING_DATE,
ENTRY_DATE: row.ENTRY_DATE,
TYPE_OF_WORK: row.TYPE_OF_WORK,
DUTIES: row.DUTIES,
DEGREE_OF_EDUCATION: row.DEGREE_OF_EDUCATION,
DATE_OF_BIRTH: row.DATE_OF_BIRTH,
POLITICAL_OUTLOOK: row.POLITICAL_OUTLOOK,
PROVINCE: row.PROVINCE,
CITY: row.CITY,
COUNTRY: row.COUNTRY,
VILLAGE: row.VILLAGE,
USER_ID: row.USER_ID,
CARD_NO: row.USER_ID_CARD,
USERNAME: row.USERNAME,
NAME: row.NAME,
CORPINFO_ID: row.CORPINFO_ID,
CORPINFO_NAME: row.CORPINFO_NAME || '',
DEPARTMENT_ID: row.DEPARTMENT_ID,
DEPARTMENT_NAME: row.DEPARTMENT_NAME,
EMAIL: row.EMAIL || '',
CARD_TYPE: '111',
CARD_TYPE_NAME: '身份证',
NATION: row.NATION_NAME || '',
SEX: row.SEX === '0' ? '男' : '女',
USER_TYPE: '1',
ISDELETE: row.ISDELETE
}
).then((data) => {
if (data.result === 'success') {
this.$message.success('推送成功')
this.getList()
} else {
this.$message.error('推送失败,' + data.msg)
}
}).catch((e) => {
this.listLoading = false
})
},
goCheck() {
if (this.pd.USER_ID_CARD && this.pd.USERNAME) {
const phoneJudge = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[0-9])\d{8}$/
const phoneResult = phoneJudge.test(this.pd.USERNAME)
const cardJudge = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
const cardResult = cardJudge.test(this.pd.USER_ID_CARD)
if (phoneResult && cardResult) {
console.log('格式校验通过')
requestFN(
'user/goCheck',
{
CARD_NO: this.pd.USER_ID_CARD,
USERNAME: this.pd.USERNAME
}
).then((data) => {
if (data.result === 'success') {
this.$message.success('验证通过')
this.ISCHECK = true
} else {
this.$message.error('验证失败,请确认身份证号与手机号是否正确')
this.ISCHECK = false
}
}).catch((e) => {
this.listLoading = false
this.ISCHECK = false
})
} else {
this.ISCHECK = false
}
} else {
this.ISCHECK = false
}
},
getList() {
this.listLoading = true
requestFN(
'/user/centerUserList?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{
keyUserName: this.keyUserName,
keyDeptLeven: this.keyDeptLeven,
keyShudi: this.keyShudi,
keyDeptType: this.keyDeptType,
keyDepeName: this.keyDepeName,
keyJobLeven: this.keyJobLeven,
DEPARTMENT_ID: this.DEPARTMENT_ID,
PROVINCE: this.keyShudi[0] || '',
CITY: this.keyShudi[1] || '',
COUNTRY: this.keyShudi[2] || '',
VILLAGE: this.keyShudi[3] || '',
ISPUSH: '0'
}
).then((data) => {
this.listLoading = false
this.varList = data.userList
this.total = data.page.totalResult
})
.catch((e) => {
this.listLoading = false
})
},
goKeyReset() {
this.keyUserName = ''
this.keyDeptLeven = ''
this.keyShudi = ''
this.keyDeptType = ''
this.keyDepeName = ''
this.keyJobLeven = ''
this.getList()
if (this.$refs.refDeptLeven) {
this.$refs.refDeptLeven.clearHandle()
}
if (this.$refs.shudi) {
this.$refs.shudi.clearHandle()
}
if (this.$refs.refDeptType) {
this.$refs.refDeptType.clearHandle()
}
if (this.$refs.refJobLeven) {
this.$refs.refJobLeven.clearHandle()
}
},
goAddUser() { // 点击添加用户的时候,获取角色
requestFN(
'/user/goAddUser',
{}
).then((data) => {
this.roleList = data.roleList
})
.catch((e) => {
})
},
unLockUser(id, name) {
this.$confirm('确定要解锁 [ 帐号:' + name + ' ] 吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/user/unLockUser',
{
USER_ID: id
}
).then(() => {
this.$message({
message: '解锁成功',
type: 'success'
})
this.listLoading = false
this.varList = []
this.listQuery.page = 1
this.getList()
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},
handleAdd() {
this.dialogFormEdit = true
this.ISCHECK = false
this.pd = {}
this.dialogType = 'saveUser'
this.pd.PASSWORD = 'Aa@123456789'
},
confirm() {
this.$refs.form.validate(valid => {
if (valid) {
this.listLoading = true
if (this.pd.ROLE_ID) {
var roleIDs = ''
this.pd.ROLE_ID.forEach((item) => {
roleIDs += item + ';'
})
this.pd.roleIDs = roleIDs
}
if (this.pd.shudi) {
this.pd.PROVINCE = this.pd.shudi[0]
this.pd.CITY = this.pd.shudi[1]
this.pd.COUNTRY = this.pd.shudi[2] || ''
this.pd.VILLAGE = this.pd.shudi[3] || ''
}
requestFN(
'/user/' + this.dialogType,
this.pd
).then((data) => {
this.listLoading = false
this.dialogFormEdit = false
this.varList = []
this.$refs.deptTree.clearHandle()
this.listQuery.page = 1
this.goPush(data.pd)
this.getList()
}).catch((e) => {
this.listLoading = false
})
} else {
return false
}
})
},
handleDelete(row) {
this.$confirm('确定要删除[' + row.USERNAME + ']吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/user/deleteUser',
{
USER_ID: row.USER_ID,
ISPUSH: row.ISPUSH
}
).then((data) => {
if (data.result == 'success') {
this.listLoading = false
this.getList()
}
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},
makeAll(msg) {
const _selectData = this.$refs.multipleTable.selection
if (_selectData == null || _selectData.length == 0) {
this.$message({
message: '请选中要删除的项...',
type: 'error'
})
return false
}
const ids = _selectData.map((item, index) => {
return item.USER_ID
}).join(',')
var tishi = ''
if (msg == '0') {
tishi = '确定要删除选中的数据吗?'
} else if (msg == '1') {
tishi = '确定要给选中的用户发送站内信吗?'
} else {
this.$message({
message: '请选择操作类型...',
type: 'error'
})
return false
}
this.$confirm(tishi, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (msg == '0') {
this.listLoading = true
requestFN(
'/user/deleteAllUser',
{
USER_IDS: ids
}
).then(() => {
this.listLoading = false
this.varList = []
this.listQuery.page = 1
this.$refs.multipleTable.clearSelection()
this.getList()
}).catch((e) => {
this.listLoading = false
})
}
}).catch(() => {
})
},
getQuery() {
this.$refs.multipleTable.clearSelection()
this.getList()
},
handleRecord(USER_ID) {
this.dialogType = 'record'
this.dialogFormRecord = true
requestFN(
'/user/getUserRecord',
{
USER_ID: USER_ID
}
).then((data) => {
if (data.result == 'success') {
this.recordList = data.varList
}
})
.catch((e) => {
this.listLoading = false
})
},
async handleEdit(row) {
this.dialogType = 'editUser'
this.pd = JSON.parse(JSON.stringify(row))
const areaRefID = []
if (this.pd.PROVINCE) {
areaRefID.push(this.pd.PROVINCE)
}
if (this.pd.CITY) {
areaRefID.push(this.pd.CITY)
}
if (this.pd.COUNTRY) {
areaRefID.push(this.pd.COUNTRY)
}
if (this.pd.VILLAGE) {
areaRefID.push(this.pd.VILLAGE)
}
this.$set(this.pd, 'shudi', areaRefID)
const refDeptLevelVal = {}
refDeptLevelVal.id = this.pd.deptLevenlID
const deptRefsValue = {}
deptRefsValue.id = this.pd.DEPARTMENT_ID
var arrString = []
if (this.pd.ROLE_ID != null && this.pd.ROLE_ID != '') {
arrString.push(this.pd.ROLE_ID)
}
if (this.pd.ROLE_IDS != null && this.pd.ROLE_IDS != '' && this.pd.ROLE_IDS != undefined && this.pd.ROLE_IDS != 'undefined') {
// 将字符串转换成数组,此时是字符串数组
this.pd.ROLE_IDS = this.pd.ROLE_IDS.substring(0, this.pd.ROLE_IDS.length - 1)
var arrList = this.pd.ROLE_IDS && this.pd.ROLE_IDS != '' ? this.pd.ROLE_IDS.split(';') : ''
// eslint-disable-next-line no-unused-vars
for (const item1 of arrList) { // 循环取出多个角色的ID
arrString.push(item1)
}
}
this.pd.ROLE_ID = arrString
this.dialogFormEdit = true
await this.$nextTick()
},
handleEditStatus(row, type) {
const typeName = type == '1' ? '禁用' : '启用'
this.$confirm('确定要' + typeName + '[' + row.USERNAME + ']吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/user/updateUserStatus',
{
USER_ID: row.USER_ID,
status: type
}
).then((data) => {
if (data.result == 'success') {
this.listLoading = false
this.goPush(row)
this.getList()
}
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},
hasButton: function () {
var keys = 'user:add,user:del,user:edit,fhSms,email,fromExcel,toExcel'
requestFN(
'/head/hasButton',
{
keys: keys, tm: new Date().getTime()
}
).then((data) => {
if (data.result == 'success') {
this.add = data.userfhadminadd // 增
this.del = data.userfhadmindel // 删
this.edit = data.userfhadminedit // 改
this.fromExcel = data.fromExcel // 从excel导入权限
this.toExcel = data.toExcel // 导出到excel权限
} else if (data.result == 'exception') {
// showException('按钮权限', data.exception)// 显示异常
}
})
.catch((e) => {
this.listLoading = false
})
},
// 获取数据字典数据
getDict(dicID, listName) {
requestFN(
'dictionaries/getLevels',
{DICTIONARIES_ID: dicID}
).then((data) => {
this[listName] = data.list
}).catch((e) => {
this.listLoading = false
})
},
// 获取数据字典数据
getDict2(dicID, listName) {
requestFN(
'dictionaries/getLevels',
{DICTIONARIES_ID: dicID}
).then((data) => {
this.uesrInfoDic[listName] = data.list
}).catch((e) => {
this.listLoading = false
})
},
getDepartTreeList() {
this.pd.DEPARTMENT_ID = ''
if (this.$refs.deptTree) {
this.$refs.deptTree.clearHandle()
}
return new Promise((resolve) => {
requestFN(
'/department/listTreeByType'
).then((data) => {
this.deptTreeData = JSON.parse(data.zTreeNodes)
resolve()
}).catch((e) => {
})
})
},
resetPwd(id, name) {
this.$confirm('是否重置密码为Aa@123456789?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/user/resetPwd',
{
USER_ID: id
}
).then(() => {
this.$message({
message: '重置成功',
type: 'success'
})
this.listLoading = false
this.varList = []
this.listQuery.page = 1
this.getList()
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
},
handleNodeClick(node, data, value) {
this.DEPARTMENT_ID = node.id
this.getList()
},
/*resetPassword() {
this.$confirm('一键重置密码,会将所有未修改过密码的用户进行密码重置重置,是否继续?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'/user/resetPwdAll',
{}
).then(() => {
this.$message({
message: '重置成功',
type: 'success'
})
this.listLoading = false
this.varList = []
this.listQuery.page = 1
this.getList()
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},*/
getTreeList() {
this.treeLoading = true
requestFN(
'/department/listTree',
{}
).then((data) => {
this.treeLoading = false
this.treeData = JSON.parse(data.zTreeNodes)
}).catch((e) => {
this.treeLoading = false
})
},
}
}
</script>