|
|
@@ -1,11 +1,36 @@
|
|
|
<template>
|
|
|
<ibps-container type="full" class="page">
|
|
|
- <ibps-crud ref="crud" style="width: 100%" :height="height" :data="listData" :toolbars="listConfig.toolbars" :search-form="listConfig.searchForm" :pk-key="pkKey" :columns="listConfig.columns" :row-handle="listConfig.rowHandle" :pagination="pagination" :loading="loading" display-field="用户管理" :display-field-data="listConfig.displayFieldData" @display-field-change="handleDisplayField" @header-dragend="handleHeaderDragend" @action-event="handleAction" @sort-change="handleSortChange" @pagination-change="handlePaginationChange" />
|
|
|
+ <ibps-crud
|
|
|
+ ref="crud"
|
|
|
+ style="width: 100%"
|
|
|
+ :height="height"
|
|
|
+ :data="listData"
|
|
|
+ :toolbars="listConfig.toolbars"
|
|
|
+ :search-form="listConfig.searchForm"
|
|
|
+ :pk-key="pkKey"
|
|
|
+ :columns="listConfig.columns"
|
|
|
+ :row-handle="listConfig.rowHandle"
|
|
|
+ :pagination="pagination"
|
|
|
+ :loading="loading"
|
|
|
+ display-field="用户管理"
|
|
|
+ :display-field-data="listConfig.displayFieldData"
|
|
|
+ @display-field-change="handleDisplayField"
|
|
|
+ @header-dragend="handleHeaderDragend"
|
|
|
+ @action-event="handleAction"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
+ @pagination-change="handlePaginationChange"
|
|
|
+ />
|
|
|
<!-- 新增、编辑、明细 -->
|
|
|
- <edit :id="editId" :title="title" :formType="formType" :visible="dialogFormVisible" :readonly="readonly" :span="span" @dialog-callback="search" @close="(visible) => (dialogFormVisible = visible)" />
|
|
|
+ <edit :id="editId" :title="title" :form-type="formType" :visible="dialogFormVisible" :readonly="readonly" :span="span" @dialog-callback="search" @close="(visible) => (dialogFormVisible = visible)" />
|
|
|
<!-- 重置密码 -->
|
|
|
<change-password :ids="changePasswordIds" :visible="changePasswordVisible" :title="$t('platform.org.employee.change-password.resetPassword')" is-reset :reg-open="true" @dialog-callback="search" @close="(visible) => (changePasswordVisible = visible)" />
|
|
|
<more-search ref="moreSearch" :title="moreSearchTitle" :visible="dialogMoreSearchVisible" party-type="employee" @callback="search" @close="(visible) => (dialogMoreSearchVisible = visible)" @action-event="handleMoreSearchAction" />
|
|
|
+ <import-table
|
|
|
+ :visible="importTableDialogVisible"
|
|
|
+ title="导入"
|
|
|
+ @close="(visible) => (importTableDialogVisible = visible)"
|
|
|
+ @action-event="handleImportTableActionEvent"
|
|
|
+ />
|
|
|
</ibps-container>
|
|
|
</template>
|
|
|
|
|
|
@@ -19,15 +44,23 @@ import ChangePassword from './change-password'
|
|
|
import CustomDataDisplayMixin from '@/business/platform/system/mixins/customDataDisplay'
|
|
|
import MoreSearch from './more-search'
|
|
|
import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
|
|
|
+import importTable from '@/business/platform/form/formrender/dynamic-form/components/import-table'
|
|
|
+import IbpsImport from '@/plugins/import'
|
|
|
+import { queryRoleScope } from '@/api/platform/org/role'
|
|
|
+import { create } from '@/api/platform/org/employee'
|
|
|
+import { encryptByAes } from '@/utils/encrypt'
|
|
|
export default {
|
|
|
components: {
|
|
|
Edit,
|
|
|
ChangePassword,
|
|
|
- MoreSearch
|
|
|
+ MoreSearch,
|
|
|
+ importTable
|
|
|
},
|
|
|
mixins: [CustomDataDisplayMixin],
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
+ defaultPwd: 'ISO17025',
|
|
|
+ importTableDialogVisible: false,
|
|
|
height: document.clientHeight,
|
|
|
title: '',
|
|
|
moreSearchTitle: '更多查询',
|
|
|
@@ -52,7 +85,8 @@ export default {
|
|
|
{ key: 'add' },
|
|
|
{ key: 'edit' },
|
|
|
{ key: 'remove' },
|
|
|
- { key: 'changePassword', label: this.$t('platform.org.employee.button.changePassword'), icon: 'el-icon-refresh' }
|
|
|
+ { key: 'changePassword', label: this.$t('platform.org.employee.button.changePassword'), icon: 'el-icon-refresh' },
|
|
|
+ { key: 'import' }
|
|
|
// { key: 'more', icon: 'ibps-icon-ellipsis-h' }
|
|
|
],
|
|
|
searchForm: {
|
|
|
@@ -90,7 +124,7 @@ export default {
|
|
|
columns: [
|
|
|
{ prop: 'name', label: this.$t('platform.org.employee.prop.name'), width: 120 },
|
|
|
{ prop: 'account', label: this.$t('platform.org.employee.prop.account'), width: 150 },
|
|
|
- //{ prop: 'wcAccount', label: this.$t('platform.org.employee.prop.wcAccount'),width:120},
|
|
|
+ // { prop: 'wcAccount', label: this.$t('platform.org.employee.prop.wcAccount'),width:120},
|
|
|
{ prop: 'orgName', label: this.$t('platform.org.employee.prop.orgPath'), sortable: false, width: 250 },
|
|
|
{ prop: 'qq', label: '客户单位名称', width: 250 },
|
|
|
{ prop: 'status', label: this.$t('platform.org.employee.prop.status'), tags: statusOptions, width: 100 },
|
|
|
@@ -197,7 +231,7 @@ export default {
|
|
|
dialogMoreSearchVisible: false
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ created () {
|
|
|
this.getOrg()
|
|
|
this.loadData()
|
|
|
this.loadDisplayField()
|
|
|
@@ -210,7 +244,7 @@ export default {
|
|
|
switchUser: 'ibps/user/switchUser'
|
|
|
}),
|
|
|
// 加载数据
|
|
|
- loadData() {
|
|
|
+ loadData () {
|
|
|
this.loading = true
|
|
|
queryPageList(this.getSearcFormData())
|
|
|
.then((response) => {
|
|
|
@@ -224,7 +258,7 @@ export default {
|
|
|
/**
|
|
|
* 获取格式化参数
|
|
|
*/
|
|
|
- getSearcFormData() {
|
|
|
+ getSearcFormData () {
|
|
|
const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
if (this.moreSearchParams) {
|
|
|
Object.assign(params, this.moreSearchParams)
|
|
|
@@ -234,14 +268,14 @@ export default {
|
|
|
/**
|
|
|
* 处理分页事件
|
|
|
*/
|
|
|
- handlePaginationChange(page) {
|
|
|
+ handlePaginationChange (page) {
|
|
|
ActionUtils.setPagination(this.pagination, page)
|
|
|
this.loadData()
|
|
|
},
|
|
|
/**
|
|
|
* 处理排序
|
|
|
*/
|
|
|
- handleSortChange(sort) {
|
|
|
+ handleSortChange (sort) {
|
|
|
ActionUtils.setSorts(this.sorts, sort)
|
|
|
this.loadData()
|
|
|
},
|
|
|
@@ -249,12 +283,12 @@ export default {
|
|
|
/**
|
|
|
* 获取显示字段
|
|
|
*/
|
|
|
- loadDisplayField() {
|
|
|
+ loadDisplayField () {
|
|
|
this.getCustomDataDisplay(this.listIdentity).then((data) => {
|
|
|
this.listConfig.displayFieldData = data
|
|
|
})
|
|
|
},
|
|
|
- handleHeaderDragend(newWidth, oldWidth, column, event) {
|
|
|
+ handleHeaderDragend (newWidth, oldWidth, column, event) {
|
|
|
const displayFieldData = this.listConfig.displayFieldData
|
|
|
for (let i = 0; i < displayFieldData.length; i++) {
|
|
|
const displayField = displayFieldData[i]
|
|
|
@@ -273,7 +307,7 @@ export default {
|
|
|
/**
|
|
|
* 保存显示字段
|
|
|
*/
|
|
|
- handleDisplayField(data, callback, hasMessage) {
|
|
|
+ handleDisplayField (data, callback, hasMessage) {
|
|
|
this.saveCustomDataDisplay(data, this.listIdentity)
|
|
|
.then((response) => {
|
|
|
if (hasMessage) ActionUtils.success(response.message)
|
|
|
@@ -286,13 +320,13 @@ export default {
|
|
|
/**
|
|
|
* 查询
|
|
|
*/
|
|
|
- search() {
|
|
|
+ search () {
|
|
|
this.loadData()
|
|
|
},
|
|
|
/**
|
|
|
* 处理按钮事件
|
|
|
*/
|
|
|
- handleAction(buttonKey, position, selection, data) {
|
|
|
+ handleAction (buttonKey, position, selection, data) {
|
|
|
switch (buttonKey) {
|
|
|
case 'search': // 查询
|
|
|
ActionUtils.setFirstPagination(this.pagination)
|
|
|
@@ -306,7 +340,7 @@ export default {
|
|
|
case 'edit': // 编辑
|
|
|
ActionUtils.selectedRecord(selection)
|
|
|
.then((id) => {
|
|
|
- this.handleEdit(id,false,'edit')
|
|
|
+ this.handleEdit(id, false, 'edit')
|
|
|
this.title = this.$t('common.title.edit', { title: this.$t('platform.org.employee.title') })
|
|
|
this.span = 13
|
|
|
})
|
|
|
@@ -347,6 +381,9 @@ export default {
|
|
|
case 'switchUser': // 切换用户
|
|
|
this.handleSwitchUser(data.account)
|
|
|
break
|
|
|
+ case 'import':
|
|
|
+ this.importTableDialogVisible = true
|
|
|
+ break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
@@ -354,10 +391,10 @@ export default {
|
|
|
/**
|
|
|
* 处理更多
|
|
|
*/
|
|
|
- handleMoreSearchParams() {
|
|
|
+ handleMoreSearchParams () {
|
|
|
this.dialogMoreSearchVisible = true
|
|
|
},
|
|
|
- handleMoreSearchAction(data) {
|
|
|
+ handleMoreSearchAction (data) {
|
|
|
ActionUtils.setFirstPagination(this.pagination)
|
|
|
this.moreSearchParams = data
|
|
|
this.loadData()
|
|
|
@@ -365,7 +402,7 @@ export default {
|
|
|
/**
|
|
|
* 处理编辑
|
|
|
*/
|
|
|
- handleEdit(editId, readonly = false,type = 'add') {
|
|
|
+ handleEdit (editId, readonly = false, type = 'add') {
|
|
|
this.editId = editId || ''
|
|
|
this.formType = type
|
|
|
this.dialogFormVisible = true
|
|
|
@@ -374,30 +411,30 @@ export default {
|
|
|
/**
|
|
|
* 处理重置密码
|
|
|
*/
|
|
|
- handlereChangePassword(ids) {
|
|
|
+ handlereChangePassword (ids) {
|
|
|
this.changePasswordIds = ids
|
|
|
this.changePasswordVisible = true
|
|
|
},
|
|
|
- handleRemove(ids) {
|
|
|
+ handleRemove (ids) {
|
|
|
// 删除数据
|
|
|
remove({ employeeIds: ids }).then((response) => {
|
|
|
ActionUtils.removeSuccessMessage()
|
|
|
this.search()
|
|
|
})
|
|
|
},
|
|
|
- handleActived(id) {
|
|
|
+ handleActived (id) {
|
|
|
active({ employeeId: id }).then((response) => {
|
|
|
ActionUtils.successMessage('激活成功!')
|
|
|
this.search()
|
|
|
})
|
|
|
},
|
|
|
- handleDisable(id) {
|
|
|
+ handleDisable (id) {
|
|
|
disable({ employeeId: id }).then((response) => {
|
|
|
ActionUtils.successMessage('禁用成功!')
|
|
|
this.search()
|
|
|
})
|
|
|
},
|
|
|
- handleSwitchUser(username) {
|
|
|
+ handleSwitchUser (username) {
|
|
|
this.switchUser(username).then(() => {
|
|
|
ActionUtils.successMessage('切换用户成功!')
|
|
|
// 由于已经加载过设置 需要清空缓存设置
|
|
|
@@ -406,19 +443,253 @@ export default {
|
|
|
this.$router.replace('/')
|
|
|
})
|
|
|
},
|
|
|
- //获取组织的数据
|
|
|
- getOrg(){
|
|
|
- let sql = `select * FROM ibps_party_org ORDER BY field(ORG_ALIAS_,'szslhyyjtxbzljcsys','glc','zhgls','jcs','kh')`
|
|
|
+ // 获取组织的数据
|
|
|
+ getOrg () {
|
|
|
+ const sql = `select * FROM ibps_party_org ORDER BY field(ORG_ALIAS_,'szslhyyjtxbzljcsys','glc','zhgls','jcs','kh')`
|
|
|
curdPost('sql', sql).then(res => {
|
|
|
- if(res.state == '200'){
|
|
|
+ if (res.state == '200') {
|
|
|
const datas = res.variables.data
|
|
|
- datas.forEach((item,index) => {
|
|
|
- this.$set(item,'value',item.ID_)
|
|
|
- this.$set(item,'label',item.NAME_)
|
|
|
+ datas.forEach((item, index) => {
|
|
|
+ this.$set(item, 'value', item.ID_)
|
|
|
+ this.$set(item, 'label', item.NAME_)
|
|
|
})
|
|
|
this.listConfig.searchForm.forms[3].options = datas
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ setValue (data) {
|
|
|
+ return Object.values(data).reduce((obj, item) => {
|
|
|
+ obj[item] = ''
|
|
|
+ return obj
|
|
|
+ }, {})
|
|
|
+ },
|
|
|
+ getKeys (data) {
|
|
|
+ return data.reduce((obj, item) => {
|
|
|
+ obj[item.label] = item.name
|
|
|
+ return obj
|
|
|
+ }, {})
|
|
|
+ },
|
|
|
+ // 导入用户
|
|
|
+ handleImportTableActionEvent (file, options) {
|
|
|
+ this.loading = false
|
|
|
+ const column = {
|
|
|
+ account: '账号',
|
|
|
+ username: '姓名',
|
|
|
+ gender: '性别',
|
|
|
+ post: '职称',
|
|
|
+ number: '工号',
|
|
|
+ dept: '组织',
|
|
|
+ role: '角色',
|
|
|
+ position: '岗位',
|
|
|
+ email: '邮箱',
|
|
|
+ mobile: '手机号码',
|
|
|
+ address: '地址',
|
|
|
+ unit: '单位名称'
|
|
|
+ // mainDept: '主部门'
|
|
|
+ }
|
|
|
+ const importColumn = Object.keys(column).map(key => {
|
|
|
+ return {
|
|
|
+ label: column[key],
|
|
|
+ name: key
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const importKeys = this.getKeys(importColumn)
|
|
|
+ const importValue = this.setValue(importKeys)
|
|
|
+ IbpsImport.xlsx(file, options).then(({ header, results }) => {
|
|
|
+ const list = []
|
|
|
+ results.forEach((item) => {
|
|
|
+ const data = JSON.parse(JSON.stringify(importValue))
|
|
|
+ for (const key in item) {
|
|
|
+ if (importKeys[key]) {
|
|
|
+ data[importKeys[key]] = item[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.push(data)
|
|
|
+ })
|
|
|
+ this.importTableDialogVisible = false
|
|
|
+ this.handleImportData(list)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRoleList () {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ queryRoleScope({
|
|
|
+ parameters: [],
|
|
|
+ requestPage: {
|
|
|
+ pageNo: 1,
|
|
|
+ limit: 2000
|
|
|
+ },
|
|
|
+ sorts: []
|
|
|
+ }).then(response => {
|
|
|
+ resolve(response.data.dataResult || [])
|
|
|
+ }).catch(error => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 组装导入数据
|
|
|
+ async handleImportData (list) {
|
|
|
+ const { deptList = [], positionList = [] } = this.$store.getters || {}
|
|
|
+ // const hasError = list.some(i => !i.dept || !i.role)
|
|
|
+ // if (hasError) {
|
|
|
+ // return this.$message.error('存在【组织】或【角色】异常的数据,请检查后再尝试!')
|
|
|
+ // }
|
|
|
+ console.log(list)
|
|
|
+ const roleList = await this.getRoleList()
|
|
|
+ const roleItem = {
|
|
|
+ pk: '',
|
|
|
+ ip: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ tenantId: null,
|
|
|
+ dataStatus: null,
|
|
|
+ dbType: null,
|
|
|
+ dsAlias: null,
|
|
|
+ partyType: null,
|
|
|
+ alias: null,
|
|
|
+ parentId: '266946423468851203',
|
|
|
+ path: null,
|
|
|
+ depth: null,
|
|
|
+ sn: null,
|
|
|
+ roleType: '普通员工',
|
|
|
+ subSystemId: '266946423468851203',
|
|
|
+ subSystemName: '深圳市金源信通17025实验室',
|
|
|
+ subSystemAlias: null,
|
|
|
+ icon: null,
|
|
|
+ type: 'role',
|
|
|
+ nocheck: false,
|
|
|
+ chkDisabled: false,
|
|
|
+ click: true,
|
|
|
+ title: '',
|
|
|
+ open: 'true',
|
|
|
+ source: '自有'
|
|
|
+ }
|
|
|
+ const posItem = {
|
|
|
+ 'pk': '',
|
|
|
+ 'ip': null,
|
|
|
+ 'createBy': null,
|
|
|
+ 'createTime': null,
|
|
|
+ 'updateBy': null,
|
|
|
+ 'updateTime': null,
|
|
|
+ 'tenantId': null,
|
|
|
+ 'dataStatus': null,
|
|
|
+ 'dbType': null,
|
|
|
+ 'dsAlias': null,
|
|
|
+ 'partyType': null,
|
|
|
+ 'parentId': null,
|
|
|
+ 'depth': null,
|
|
|
+ 'sn': null,
|
|
|
+ 'icon': null,
|
|
|
+ 'type': 'position',
|
|
|
+ 'nocheck': false,
|
|
|
+ 'chkDisabled': false,
|
|
|
+ 'click': true,
|
|
|
+ 'open': 'true',
|
|
|
+ 'hasChild': false
|
|
|
+ }
|
|
|
+ const createParams = []
|
|
|
+
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const item = list[i]
|
|
|
+ const temp = deptList.find(i => i.positionName === item.dept.trim().replace(/\r/g, ''))
|
|
|
+ const userItem = {
|
|
|
+ id: '',
|
|
|
+ account: item.account,
|
|
|
+ password: encryptByAes(this.defaultPwd, 'pwd'),
|
|
|
+ isSuper: 'N',
|
|
|
+ name: item.username,
|
|
|
+ status: 'actived',
|
|
|
+ gender: item.gender === '男' ? 'male' : 'female',
|
|
|
+ email: item.email,
|
|
|
+ photo: '',
|
|
|
+ mobile: item.mobile,
|
|
|
+ createTime: '',
|
|
|
+ attrItemList: [],
|
|
|
+ groupID: temp?.positionId || '',
|
|
|
+ userGroupItemList: [],
|
|
|
+ orgItem: {
|
|
|
+ id: temp?.positionId || '',
|
|
|
+ name: temp?.positionName || '',
|
|
|
+ pathName: temp?.path_name || ''
|
|
|
+ },
|
|
|
+ wxyhId: '',
|
|
|
+ jiNengZhiCheng: 'inside',
|
|
|
+ qq: item.unit,
|
|
|
+ jianDingZiGeZ: item.number,
|
|
|
+ address: item.address
|
|
|
+ }
|
|
|
+ const roleName = item.role.split('\n')
|
|
|
+ const deptName = item.position.split('\n')
|
|
|
+ const roleItemList = []
|
|
|
+ const posItemList = []
|
|
|
+ roleName.forEach(r => {
|
|
|
+ const temp = roleList.find(i => i.name === r.trim().replace(/\r/g, ''))
|
|
|
+ if (temp) {
|
|
|
+ roleItemList.push({
|
|
|
+ ...roleItem,
|
|
|
+ name: r,
|
|
|
+ id: temp.id,
|
|
|
+ roleNote: temp.roleNote,
|
|
|
+ roleAlias: temp.roleAlias
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ deptName.map(d => {
|
|
|
+ const temp = positionList.find(i => i.positionName === d.trim().replace(/\r/g, ''))
|
|
|
+ if (temp) {
|
|
|
+ posItemList.push({
|
|
|
+ ...posItem,
|
|
|
+ name: temp.positionName || '',
|
|
|
+ id: temp.positionId || '',
|
|
|
+ alias: temp.alias || '',
|
|
|
+ path: temp.path_id || '',
|
|
|
+ title: temp.positionName || ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const user = {
|
|
|
+ ...userItem,
|
|
|
+ positions: posItemList.map(i => i.id).join(','),
|
|
|
+ job: roleItemList.map(i => i.id).join(','),
|
|
|
+ posItemList,
|
|
|
+ roleItemList
|
|
|
+ }
|
|
|
+ const employee = {
|
|
|
+ partyEmployeePo: user,
|
|
|
+ user,
|
|
|
+ positionVoList: posItemList.map(p => ({
|
|
|
+ id: p.id,
|
|
|
+ name: p.name,
|
|
|
+ isMainPost: false,
|
|
|
+ isPrincipal: false
|
|
|
+ })),
|
|
|
+ roleVoList: roleItemList.map(r => ({
|
|
|
+ id: r.id,
|
|
|
+ name: r.name,
|
|
|
+ subSystemName: r.subSystemName,
|
|
|
+ source: r.source,
|
|
|
+ canDelete: true
|
|
|
+ })),
|
|
|
+ attrValueVoList: [],
|
|
|
+ userGroupPoList: []
|
|
|
+ }
|
|
|
+ createParams.push(employee)
|
|
|
+ }
|
|
|
+ console.log(createParams)
|
|
|
+ this.createEmployee(createParams)
|
|
|
+ },
|
|
|
+ createEmployee (paramList) {
|
|
|
+ if (!paramList || !paramList.length) {
|
|
|
+ this.search()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ create(paramList.shift()).then(res => {
|
|
|
+ this.createEmployee(paramList)
|
|
|
+ })
|
|
|
+ // paramList.forEach(vo => {
|
|
|
+ // create(vo)
|
|
|
+ // })
|
|
|
}
|
|
|
}
|
|
|
}
|