|
|
@ -1,8 +1,8 @@
|
|
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
|
|
import React, { useState, useEffect, useRef } from 'react'
|
|
|
|
import RowBox from '@/components/Box/RowBox'
|
|
|
|
import RowBox from '@/components/Box/RowBox'
|
|
|
|
import { Button, Card, Divider, Form, Input, InputNumber, message, Modal, Popconfirm, Select, Tooltip, Tree, TreeSelect, Upload } from 'antd'
|
|
|
|
import { Button, Card, Divider, Form, Input, InputNumber, message, Modal, Popconfirm, Select, Tooltip, Tree, TreeSelect, Upload } from 'antd'
|
|
|
|
import EditableTable from '@/components/NR_TableEditRow'
|
|
|
|
import EditableTable from '@/components/NR_TableEditRow'
|
|
|
|
import { DeleteOutlined, UploadOutlined, KeyOutlined, EditOutlined, EyeTwoTone, EyeInvisibleOutlined, EyeOutlined ,PictureOutlined,ClearOutlined } from '@ant-design/icons'
|
|
|
|
import { DeleteOutlined, UploadOutlined, KeyOutlined, EditOutlined, EyeTwoTone, EyeInvisibleOutlined, EyeOutlined, PictureOutlined, ClearOutlined } from '@ant-design/icons'
|
|
|
|
import CryptoJs, { MD5, SHA256 } from 'crypto-js';
|
|
|
|
import CryptoJs, { MD5, SHA256 } from 'crypto-js';
|
|
|
|
import { User, Module, Role, Organ } from '@/interfaces/interface'
|
|
|
|
import { User, Module, Role, Organ } from '@/interfaces/interface'
|
|
|
|
import ImportAndExport from '@/components/NR_ImportAndExport'
|
|
|
|
import ImportAndExport from '@/components/NR_ImportAndExport'
|
|
|
@ -15,444 +15,446 @@ import Events from '../events'
|
|
|
|
import ModuleService from '@/services/modules'
|
|
|
|
import ModuleService from '@/services/modules'
|
|
|
|
import { addOrganization, addUser, addUserToRole, deleteOrganization, deleteUser, getOrganizations, getRoles, getRolesByAccount, query, removeUserFromRole, updateOrganization, updateUser, updateUserList } from '../../user/role/service'
|
|
|
|
import { addOrganization, addUser, addUserToRole, deleteOrganization, deleteUser, getOrganizations, getRoles, getRolesByAccount, query, removeUserFromRole, updateOrganization, updateUser, updateUserList } from '../../user/role/service'
|
|
|
|
import FormSelectorInput from '@/components/iBKLinker/form/selector-input'
|
|
|
|
import FormSelectorInput from '@/components/iBKLinker/form/selector-input'
|
|
|
|
import { getTreeData,getTreeSelectData } from '@/utils/commoTool'
|
|
|
|
import { getTreeData, getTreeSelectData } from '@/utils/commoTool'
|
|
|
|
import { history } from 'umi'
|
|
|
|
import { history } from 'umi'
|
|
|
|
import { isArray } from 'lodash'
|
|
|
|
import { isArray } from 'lodash'
|
|
|
|
|
|
|
|
|
|
|
|
interface IManagementAccountEditor {
|
|
|
|
interface IManagementAccountEditor {
|
|
|
|
visible: boolean,
|
|
|
|
visible: boolean,
|
|
|
|
data?: any,
|
|
|
|
data?: any,
|
|
|
|
modules?: any[],
|
|
|
|
modules?: any[],
|
|
|
|
onComplete: (result: any) => void,
|
|
|
|
onComplete: (result: any) => void,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 账户表单
|
|
|
|
* 账户表单
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const ManagementAccountEditor : React.FC<IManagementAccountEditor> = (props) => {
|
|
|
|
const ManagementAccountEditor: React.FC<IManagementAccountEditor> = (props) => {
|
|
|
|
const thisViewName = "ManagementAccountEditor"
|
|
|
|
const thisViewName = "ManagementAccountEditor"
|
|
|
|
const $emitter: EventView = new EventView(thisViewName)
|
|
|
|
const $emitter: EventView = new EventView(thisViewName)
|
|
|
|
const encoder = useRef<"md5"|"sha256">(history.location.query?.encoder ? history.location.query?.encoder : "sha256")
|
|
|
|
const encoder = useRef<"md5" | "sha256">(history.location.query?.encoder ? history.location.query?.encoder : "sha256")
|
|
|
|
const [isLoading, setIsLoading] = useState<boolean>(false)
|
|
|
|
const [isLoading, setIsLoading] = useState<boolean>(false)
|
|
|
|
const [thisForm] = Form.useForm()
|
|
|
|
const [thisForm] = Form.useForm()
|
|
|
|
const activeData = useRef<User|undefined>(undefined)
|
|
|
|
const activeData = useRef<User | undefined>(undefined)
|
|
|
|
const [roleList, setRoleList] = useState<Role[]>([])
|
|
|
|
const [roleList, setRoleList] = useState<Role[]>([])
|
|
|
|
const [organList, setOrganList] = useState<Organ[]>([])
|
|
|
|
const [organList, setOrganList] = useState<Organ[]>([])
|
|
|
|
const originRoles = useRef<any[]>([])
|
|
|
|
const originRoles = useRef<any[]>([])
|
|
|
|
const selectOrgan = useRef<Organ|undefined>()
|
|
|
|
const selectOrgan = useRef<Organ | undefined>()
|
|
|
|
const multiTeamname = useRef<string|undefined>()
|
|
|
|
const multiTeamname = useRef<string | undefined>()
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
|
|
|
|
$emitter.subscribe(Events.accounts.org.selected, (organ?: Organ) => {
|
|
|
|
$emitter.subscribe(Events.accounts.org.selected, (organ?: Organ) => {
|
|
|
|
selectOrgan.current = organ
|
|
|
|
selectOrgan.current = organ
|
|
|
|
|
|
|
|
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
OrganName: selectOrgan.current ? selectOrgan.current.Name : undefined,
|
|
|
|
OrganName: selectOrgan.current ? selectOrgan.current.Name : undefined,
|
|
|
|
OrganID: selectOrgan.current ? selectOrgan.current.Guid : undefined,
|
|
|
|
OrganID: selectOrgan.current ? selectOrgan.current.Guid : undefined,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
return () => {
|
|
|
|
$emitter.dispose()
|
|
|
|
$emitter.dispose()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [])
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if(!props.data){
|
|
|
|
if (!props.data) {
|
|
|
|
thisForm.resetFields()
|
|
|
|
thisForm.resetFields()
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
OrganName: selectOrgan.current ? selectOrgan.current.Name : undefined,
|
|
|
|
OrganName: selectOrgan.current ? selectOrgan.current.Name : undefined,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else {
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
...props.data,
|
|
|
|
...props.data,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
getUserRole(props.data.LoginID)
|
|
|
|
getUserRole(props.data.LoginID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
activeData.current = {...props.data}
|
|
|
|
activeData.current = { ...props.data }
|
|
|
|
}, [props.data])
|
|
|
|
}, [props.data])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
if(props.visible){
|
|
|
|
if (props.visible) {
|
|
|
|
getRoleList()
|
|
|
|
getRoleList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [props.visible])
|
|
|
|
}, [props.visible])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
|
|
|
|
prepareData()
|
|
|
|
prepareData()
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
return () => {
|
|
|
|
$emitter.dispose()
|
|
|
|
$emitter.dispose()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [])
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getUserRole = async (loginId: string) => {
|
|
|
|
const getUserRole = async (loginId: string) => {
|
|
|
|
setIsLoading(true)
|
|
|
|
setIsLoading(true)
|
|
|
|
let roles: any[] = await getRolesByAccount(loginId)
|
|
|
|
let roles: any[] = await getRolesByAccount(loginId)
|
|
|
|
setIsLoading(false)
|
|
|
|
setIsLoading(false)
|
|
|
|
roles = !roles ? [] : roles
|
|
|
|
roles = !roles ? [] : roles
|
|
|
|
originRoles.current = [...roles]
|
|
|
|
originRoles.current = [...roles]
|
|
|
|
|
|
|
|
|
|
|
|
if(roles.length > 0){
|
|
|
|
if (roles.length > 0) {
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
role: roles.map((rr) => rr.RoleName),
|
|
|
|
role: roles.map((rr) => rr.RoleName),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else {
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
thisForm.setFieldsValue({
|
|
|
|
role: undefined,
|
|
|
|
role: undefined,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const getRoleList = async () => {
|
|
|
|
const getRoleList = async () => {
|
|
|
|
setIsLoading(true)
|
|
|
|
setIsLoading(true)
|
|
|
|
const roles: Role[] = await getRoles()
|
|
|
|
const roles: Role[] = await getRoles()
|
|
|
|
setIsLoading(false)
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
|
|
if (roles.length != 0) {
|
|
|
|
if (roles.length != 0) {
|
|
|
|
roles.map((item: any) => {
|
|
|
|
roles.map((item: any) => {
|
|
|
|
item.label = item.Name
|
|
|
|
item.label = item.Name
|
|
|
|
item.value = item.Name
|
|
|
|
item.value = item.Name
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setRoleList(roles)
|
|
|
|
setRoleList(roles)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const prepareData = async () => {
|
|
|
|
const prepareData = async () => {
|
|
|
|
setIsLoading(true)
|
|
|
|
setIsLoading(true)
|
|
|
|
let organs = await getOrganizations()
|
|
|
|
let organs = await getOrganizations()
|
|
|
|
setIsLoading(false)
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
|
|
organs = !organs ? [] : organs
|
|
|
|
organs = !organs ? [] : organs
|
|
|
|
setOrganList(organs.length != 0 ? getTreeSelectData(organs, '00000000-0000-0000-0000-000000000000','Guid', 'ParentID', 'Name','Name'): [])
|
|
|
|
setOrganList(organs.length != 0 ? getTreeSelectData(organs, '00000000-0000-0000-0000-000000000000', 'Guid', 'ParentID', 'Name', 'Name') : [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const userColumns = [
|
|
|
|
const userColumns = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"title": '序号',
|
|
|
|
"title": '序号',
|
|
|
|
"key": 'userId',
|
|
|
|
"key": 'userId',
|
|
|
|
"dataIndex": 'userId',
|
|
|
|
"dataIndex": 'userId',
|
|
|
|
"editable": false,
|
|
|
|
"editable": false,
|
|
|
|
"ellipsis": true,
|
|
|
|
"ellipsis": true,
|
|
|
|
"render": (userId: string, record: User, index: number) => {
|
|
|
|
"render": (userId: string, record: User, index: number) => {
|
|
|
|
return (index + 1).toString()
|
|
|
|
return (index + 1).toString()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
"title": '用户名',
|
|
|
|
"title": '用户名',
|
|
|
|
"key": 'Name',
|
|
|
|
"key": 'Name',
|
|
|
|
"dataIndex": 'Name',
|
|
|
|
"dataIndex": 'Name',
|
|
|
|
"ellipsis": true,
|
|
|
|
"ellipsis": true,
|
|
|
|
"editable": true,
|
|
|
|
"editable": true,
|
|
|
|
"rules": [{ required: true }, {
|
|
|
|
"rules": [{ required: true }, {
|
|
|
|
pattern: '^[\u4e00-\u9fa5]{0,}$',
|
|
|
|
pattern: '^[\u4e00-\u9fa5]{0,}$',
|
|
|
|
message: '用户名必须为汉字'
|
|
|
|
message: '用户名必须为汉字'
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
...getColumnSearchProps('Name')
|
|
|
|
...getColumnSearchProps('Name')
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
"title": '账号',
|
|
|
|
"title": '账号',
|
|
|
|
"key": 'LoginID',
|
|
|
|
"key": 'LoginID',
|
|
|
|
"dataIndex": 'LoginID',
|
|
|
|
"dataIndex": 'LoginID',
|
|
|
|
"ellipsis": true,
|
|
|
|
"ellipsis": true,
|
|
|
|
"editable": true,
|
|
|
|
"editable": true,
|
|
|
|
"rules": [{ required: true }, {
|
|
|
|
"rules": [{ required: true }, {
|
|
|
|
pattern: /^[a-zA-Z\d]+$/,
|
|
|
|
pattern: /^[a-zA-Z\d]+$/,
|
|
|
|
message: '账号为小写字母或数字'
|
|
|
|
message: '账号为小写字母或数字'
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
"title": '密码',
|
|
|
|
"title": '密码',
|
|
|
|
"key": 'Password2',
|
|
|
|
"key": 'Password2',
|
|
|
|
"dataIndex": 'Password2',
|
|
|
|
"dataIndex": 'Password2',
|
|
|
|
"ellipsis": true,
|
|
|
|
"ellipsis": true,
|
|
|
|
"editable": true,
|
|
|
|
"editable": true,
|
|
|
|
"render": (Password: string) => {
|
|
|
|
"render": (Password: string) => {
|
|
|
|
if (Password == null || Password.length == 0) {
|
|
|
|
if (Password == null || Password.length == 0) {
|
|
|
|
return '暂无'
|
|
|
|
return '暂无'
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return null
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"rules": [{
|
|
|
|
"rules": [{
|
|
|
|
pattern: '^[A-Za-z0-9]+$',
|
|
|
|
// pattern: '^[A-Za-z0-9]+$',
|
|
|
|
message: '密码只能由英文字母和数字组成'
|
|
|
|
pattern: '^[A-Za-z0-9@!-]+$',
|
|
|
|
}],
|
|
|
|
// message: '密码只能由英文字母和数字组成'
|
|
|
|
"inputComponent": <Input.Password iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
|
|
|
|
message: '密码只能包含数字字母和@!-'
|
|
|
|
/>
|
|
|
|
}],
|
|
|
|
}, {
|
|
|
|
"inputComponent": <Input.Password iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
|
|
|
|
"title": '邮箱',
|
|
|
|
/>
|
|
|
|
"key": 'Email',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'Email',
|
|
|
|
"title": '邮箱',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'Email',
|
|
|
|
"editable": true,
|
|
|
|
"dataIndex": 'Email',
|
|
|
|
"rules": [
|
|
|
|
"ellipsis": true,
|
|
|
|
{
|
|
|
|
"editable": true,
|
|
|
|
pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
|
|
|
|
"rules": [
|
|
|
|
message: '邮箱格式不正确',
|
|
|
|
{
|
|
|
|
}, {
|
|
|
|
pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
|
|
|
|
max: 50,
|
|
|
|
message: '邮箱格式不正确',
|
|
|
|
message: '邮箱不得超过50字符',
|
|
|
|
}, {
|
|
|
|
|
|
|
|
max: 50,
|
|
|
|
},
|
|
|
|
message: '邮箱不得超过50字符',
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
]
|
|
|
|
"title": '用户群组',
|
|
|
|
},
|
|
|
|
"key": 'OrganName',
|
|
|
|
{
|
|
|
|
"dataIndex": 'OrganName',
|
|
|
|
"title": '用户群组',
|
|
|
|
"editable": false,
|
|
|
|
"key": 'OrganName',
|
|
|
|
"ellipsis": true,
|
|
|
|
"dataIndex": 'OrganName',
|
|
|
|
// "inputComponent": <Select options={values}/>,
|
|
|
|
"editable": false,
|
|
|
|
"inputComponent": <TreeSelect
|
|
|
|
"ellipsis": true,
|
|
|
|
treeData={organList}
|
|
|
|
// "inputComponent": <Select options={values}/>,
|
|
|
|
/>,
|
|
|
|
"inputComponent": <TreeSelect
|
|
|
|
"rules": [{ required: true }],
|
|
|
|
treeData={organList}
|
|
|
|
"onFilter": (value: any, record: any) => record.OrganName != undefined && record.OrganName == value,
|
|
|
|
/>,
|
|
|
|
},
|
|
|
|
"rules": [{ required: true }],
|
|
|
|
{
|
|
|
|
"onFilter": (value: any, record: any) => record.OrganName != undefined && record.OrganName == value,
|
|
|
|
"title": '地址',
|
|
|
|
},
|
|
|
|
"key": 'Address',
|
|
|
|
{
|
|
|
|
"dataIndex": 'Address',
|
|
|
|
"title": '地址',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'Address',
|
|
|
|
"editable": true,
|
|
|
|
"dataIndex": 'Address',
|
|
|
|
}, {
|
|
|
|
"ellipsis": true,
|
|
|
|
"title": '备注',
|
|
|
|
"editable": true,
|
|
|
|
"key": 'Description',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'Description',
|
|
|
|
"title": '备注',
|
|
|
|
"editable": true,
|
|
|
|
"key": 'Description',
|
|
|
|
"ellipsis": true,
|
|
|
|
"dataIndex": 'Description',
|
|
|
|
"render": (Description: string) => {
|
|
|
|
"editable": true,
|
|
|
|
if (Description == null || Description.length == 0) {
|
|
|
|
"ellipsis": true,
|
|
|
|
return '无'
|
|
|
|
"render": (Description: string) => {
|
|
|
|
} else {
|
|
|
|
if (Description == null || Description.length == 0) {
|
|
|
|
return Description
|
|
|
|
return '无'
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
return Description
|
|
|
|
}, {
|
|
|
|
}
|
|
|
|
"title": '是否主管',
|
|
|
|
}
|
|
|
|
"key": 'Leader',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'Leader',
|
|
|
|
"title": '是否主管',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'Leader',
|
|
|
|
"inputComponent": <Select options={[
|
|
|
|
"dataIndex": 'Leader',
|
|
|
|
{
|
|
|
|
"ellipsis": true,
|
|
|
|
'label': "否",
|
|
|
|
"inputComponent": <Select options={[
|
|
|
|
'value': 0
|
|
|
|
{
|
|
|
|
}, {
|
|
|
|
'label': "否",
|
|
|
|
'label': "是",
|
|
|
|
'value': 0
|
|
|
|
'value': 1
|
|
|
|
}, {
|
|
|
|
}
|
|
|
|
'label': "是",
|
|
|
|
]} />,
|
|
|
|
'value': 1
|
|
|
|
"filters": [
|
|
|
|
}
|
|
|
|
{
|
|
|
|
]} />,
|
|
|
|
text: '是',
|
|
|
|
"filters": [
|
|
|
|
value: 1,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
text: '是',
|
|
|
|
{
|
|
|
|
value: 1,
|
|
|
|
text: '否',
|
|
|
|
},
|
|
|
|
value: 0,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
text: '否',
|
|
|
|
],
|
|
|
|
value: 0,
|
|
|
|
"filterMultiple": false,
|
|
|
|
},
|
|
|
|
"onFilter": (value: any, record: any) => record.Leader != undefined && record.Leader === value,
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
"filterMultiple": false,
|
|
|
|
"title": '登录次数',
|
|
|
|
"onFilter": (value: any, record: any) => record.Leader != undefined && record.Leader === value,
|
|
|
|
"key": 'LoginCount',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'LoginCount',
|
|
|
|
"title": '登录次数',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'LoginCount',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'LoginCount',
|
|
|
|
"title": '在线状态',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'LineState',
|
|
|
|
}, {
|
|
|
|
"dataIndex": 'LineState',
|
|
|
|
"title": '在线状态',
|
|
|
|
"ellipsis": true,
|
|
|
|
"key": 'LineState',
|
|
|
|
"render": (LineState: any) => {
|
|
|
|
"dataIndex": 'LineState',
|
|
|
|
return parseInt(LineState) == 1 ? '在线' : '离线'
|
|
|
|
"ellipsis": true,
|
|
|
|
},
|
|
|
|
"render": (LineState: any) => {
|
|
|
|
"filters": [
|
|
|
|
return parseInt(LineState) == 1 ? '在线' : '离线'
|
|
|
|
{
|
|
|
|
},
|
|
|
|
text: '在线',
|
|
|
|
"filters": [
|
|
|
|
value: 1,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
text: '在线',
|
|
|
|
{
|
|
|
|
value: 1,
|
|
|
|
text: '离线',
|
|
|
|
},
|
|
|
|
value: 0,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
text: '离线',
|
|
|
|
],
|
|
|
|
value: 0,
|
|
|
|
"filterMultiple": false,
|
|
|
|
},
|
|
|
|
"onFilter": (value: any, record: any) => record.LineState != undefined && record.LineState === value,
|
|
|
|
],
|
|
|
|
}
|
|
|
|
"filterMultiple": false,
|
|
|
|
]
|
|
|
|
"onFilter": (value: any, record: any) => record.LineState != undefined && record.LineState === value,
|
|
|
|
|
|
|
|
}
|
|
|
|
const submitData = async () => {
|
|
|
|
]
|
|
|
|
if(!activeData.current){
|
|
|
|
|
|
|
|
message.error("请选择一个账号")
|
|
|
|
const submitData = async () => {
|
|
|
|
return
|
|
|
|
if (!activeData.current) {
|
|
|
|
}
|
|
|
|
message.error("请选择一个账号")
|
|
|
|
|
|
|
|
return
|
|
|
|
await thisForm.validateFields()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let subvals = thisForm.getFieldsValue()
|
|
|
|
await thisForm.validateFields()
|
|
|
|
let values = {...activeData.current}
|
|
|
|
|
|
|
|
//let oldData = values.role ? (values.role.value ? values.role.value : values.role) : undefined
|
|
|
|
let subvals = thisForm.getFieldsValue()
|
|
|
|
|
|
|
|
let values = { ...activeData.current }
|
|
|
|
for(let s in subvals){
|
|
|
|
//let oldData = values.role ? (values.role.value ? values.role.value : values.role) : undefined
|
|
|
|
values[s] = subvals[s]
|
|
|
|
|
|
|
|
}
|
|
|
|
for (let s in subvals) {
|
|
|
|
|
|
|
|
values[s] = subvals[s]
|
|
|
|
if(subvals.Uid){
|
|
|
|
}
|
|
|
|
if(subvals.Password2 && subvals.Password2.length > 0){
|
|
|
|
|
|
|
|
|
|
|
|
if (subvals.Uid) {
|
|
|
|
switch(encoder.current){
|
|
|
|
if (subvals.Password2 && subvals.Password2.length > 0) {
|
|
|
|
case "md5":
|
|
|
|
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(MD5(subvals.Password2))
|
|
|
|
switch (encoder.current) {
|
|
|
|
break
|
|
|
|
case "md5":
|
|
|
|
case "sha256":
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(MD5(subvals.Password2))
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(SHA256(subvals.Password2))
|
|
|
|
case "sha256":
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(SHA256(subvals.Password2))
|
|
|
|
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await updateUser(values)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
await updateUser(values)
|
|
|
|
values.LineState = 0
|
|
|
|
}
|
|
|
|
values.LoginCount = 0
|
|
|
|
else {
|
|
|
|
values.Attributes = 0
|
|
|
|
values.LineState = 0
|
|
|
|
//先用MD5加密 再用base64编码
|
|
|
|
values.LoginCount = 0
|
|
|
|
// values.Password = CryptoJs.enc.Base64.stringify(MD5(values.Password))
|
|
|
|
values.Attributes = 0
|
|
|
|
switch(encoder.current){
|
|
|
|
//先用MD5加密 再用base64编码
|
|
|
|
case "md5":
|
|
|
|
// values.Password = CryptoJs.enc.Base64.stringify(MD5(values.Password))
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(MD5(values.Password2))
|
|
|
|
switch (encoder.current) {
|
|
|
|
break
|
|
|
|
case "md5":
|
|
|
|
case "sha256":
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(MD5(values.Password2))
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(SHA256(values.Password2))
|
|
|
|
case "sha256":
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
values.Password = CryptoJs.enc.Base64.stringify(SHA256(values.Password2))
|
|
|
|
|
|
|
|
break
|
|
|
|
await addUser(values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// values.Password2 = CryptoJs.enc.Base64.stringify(SHA256(values.Password2))
|
|
|
|
await addUser(values)
|
|
|
|
|
|
|
|
}
|
|
|
|
//console.log("add user", values)
|
|
|
|
// values.Password2 = CryptoJs.enc.Base64.stringify(SHA256(values.Password2))
|
|
|
|
|
|
|
|
|
|
|
|
// await addUser(values)
|
|
|
|
//console.log("add user", values)
|
|
|
|
|
|
|
|
|
|
|
|
//console.log("update list", values, subvals, roleList)
|
|
|
|
// await addUser(values)
|
|
|
|
if (subvals.role != undefined && roleList) {
|
|
|
|
|
|
|
|
if(originRoles.current && originRoles.current.length > 0){
|
|
|
|
//console.log("update list", values, subvals, roleList)
|
|
|
|
for(let ri = 0; ri < originRoles.current.length; ri++){
|
|
|
|
if (subvals.role != undefined && roleList) {
|
|
|
|
await removeUserFromRole({
|
|
|
|
if (originRoles.current && originRoles.current.length > 0) {
|
|
|
|
LoginId: values.LoginID,
|
|
|
|
for (let ri = 0; ri < originRoles.current.length; ri++) {
|
|
|
|
RoleName: originRoles.current[ri].RoleName,
|
|
|
|
await removeUserFromRole({
|
|
|
|
})
|
|
|
|
LoginId: values.LoginID,
|
|
|
|
}
|
|
|
|
RoleName: originRoles.current[ri].RoleName,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
if(isArray(subvals.role)){
|
|
|
|
}
|
|
|
|
for(let ri = 0; ri < subvals.role.length; ri++){
|
|
|
|
|
|
|
|
let subrole = subvals.role[ri]
|
|
|
|
if (isArray(subvals.role)) {
|
|
|
|
let roleData = subrole.value ? subrole.value : subrole//{...values.role}
|
|
|
|
for (let ri = 0; ri < subvals.role.length; ri++) {
|
|
|
|
|
|
|
|
let subrole = subvals.role[ri]
|
|
|
|
await addUserToRole({
|
|
|
|
let roleData = subrole.value ? subrole.value : subrole//{...values.role}
|
|
|
|
"role": {
|
|
|
|
|
|
|
|
"Name": roleData,
|
|
|
|
await addUserToRole({
|
|
|
|
"Description": roleData,
|
|
|
|
"role": {
|
|
|
|
},
|
|
|
|
"Name": roleData,
|
|
|
|
"accountRoleList": [
|
|
|
|
"Description": roleData,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
"LoginId": values.LoginID,
|
|
|
|
"accountRoleList": [
|
|
|
|
"RoleName": roleData
|
|
|
|
{
|
|
|
|
}
|
|
|
|
"LoginId": values.LoginID,
|
|
|
|
]
|
|
|
|
"RoleName": roleData
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
else{
|
|
|
|
}
|
|
|
|
let roleData = subvals.role.value ? subvals.role.value : subvals.role//{...values.role}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
await addUserToRole({
|
|
|
|
let roleData = subvals.role.value ? subvals.role.value : subvals.role//{...values.role}
|
|
|
|
"role": {
|
|
|
|
|
|
|
|
"Name": roleData,
|
|
|
|
await addUserToRole({
|
|
|
|
"Description": roleData,
|
|
|
|
"role": {
|
|
|
|
},
|
|
|
|
"Name": roleData,
|
|
|
|
"accountRoleList": [
|
|
|
|
"Description": roleData,
|
|
|
|
{
|
|
|
|
},
|
|
|
|
"LoginId": values.LoginID,
|
|
|
|
"accountRoleList": [
|
|
|
|
"RoleName": roleData
|
|
|
|
{
|
|
|
|
}
|
|
|
|
"LoginId": values.LoginID,
|
|
|
|
]
|
|
|
|
"RoleName": roleData
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
props.onComplete && props.onComplete(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
props.onComplete && props.onComplete(true)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<Modal title={"编辑模块"} visible={props.visible} onCancel={() => props.onComplete(false)} confirmLoading={isLoading} onOk={() => {
|
|
|
|
|
|
|
|
let subvals = thisForm.getFieldsValue()
|
|
|
|
return (
|
|
|
|
let values = {...activeData.current}
|
|
|
|
<Modal title={"编辑模块"} visible={props.visible} onCancel={() => props.onComplete(false)} confirmLoading={isLoading} onOk={() => {
|
|
|
|
|
|
|
|
let subvals = thisForm.getFieldsValue()
|
|
|
|
console.log("submit data", subvals, values)
|
|
|
|
let values = { ...activeData.current }
|
|
|
|
submitData()
|
|
|
|
|
|
|
|
}}>
|
|
|
|
console.log("submit data", subvals, values)
|
|
|
|
<Form form={thisForm} labelCol={{span: 6}} wrapperCol={{span: 18}}>
|
|
|
|
submitData()
|
|
|
|
{
|
|
|
|
}}>
|
|
|
|
userColumns.slice(1, 9).map((col: any) => (
|
|
|
|
<Form form={thisForm} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
|
|
|
|
<Form.Item name={col.dataIndex} label={col.title} rules={col.rules != undefined ? col.rules : []}>
|
|
|
|
{
|
|
|
|
{col.inputComponent != undefined ? col.inputComponent : <Input />}
|
|
|
|
userColumns.slice(1, 9).map((col: any) => (
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name={col.dataIndex} label={col.title} rules={col.rules != undefined ? col.rules : []}>
|
|
|
|
))
|
|
|
|
{col.inputComponent != undefined ? col.inputComponent : <Input />}
|
|
|
|
}
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="role" label="角色" >
|
|
|
|
))
|
|
|
|
<Select
|
|
|
|
}
|
|
|
|
mode={"multiple"}
|
|
|
|
<Form.Item name="role" label="角色" >
|
|
|
|
labelInValue
|
|
|
|
<Select
|
|
|
|
options={roleList}
|
|
|
|
mode={"multiple"}
|
|
|
|
/>
|
|
|
|
labelInValue
|
|
|
|
</Form.Item>
|
|
|
|
options={roleList}
|
|
|
|
<Form.Item name="OrganID" label="OrganID" style={{ display: 'none' }}>
|
|
|
|
/>
|
|
|
|
<Select />
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="OrganID" label="OrganID" style={{ display: 'none' }}>
|
|
|
|
<Form.Item name="Uid" label="Uid" style={{ display: 'none' }}>
|
|
|
|
<Select />
|
|
|
|
<Input />
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="Uid" label="Uid" style={{ display: 'none' }}>
|
|
|
|
<Form.Item name="Password" label="Password" style={{ display: 'none' }}>
|
|
|
|
<Input />
|
|
|
|
<Input type={"password"} />
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="Password" label="Password" style={{ display: 'none' }}>
|
|
|
|
<Form.Item name="WorkTeam" label="工作小组">
|
|
|
|
<Input type={"password"} />
|
|
|
|
<FormSelectorInput size='small'
|
|
|
|
</Form.Item>
|
|
|
|
count={1}
|
|
|
|
<Form.Item name="WorkTeam" label="工作小组">
|
|
|
|
placeholder='请选择工作组'
|
|
|
|
<FormSelectorInput size='small'
|
|
|
|
options={[
|
|
|
|
count={1}
|
|
|
|
{label: "默认", value: null},
|
|
|
|
placeholder='请选择工作组'
|
|
|
|
{label: "1/A班", value: "A"},
|
|
|
|
options={[
|
|
|
|
{label: "2/B班", value: "B"},
|
|
|
|
{ label: "默认", value: null },
|
|
|
|
{label: "3/C班", value: "C"},
|
|
|
|
{ label: "1/A班", value: "A" },
|
|
|
|
{label: "4/D班", value: "D"},
|
|
|
|
{ label: "2/B班", value: "B" },
|
|
|
|
]}
|
|
|
|
{ label: "3/C班", value: "C" },
|
|
|
|
onChanged={(value) => {
|
|
|
|
{ label: "4/D班", value: "D" },
|
|
|
|
let val: any = value && value.length > 0 ? value[0] : null
|
|
|
|
]}
|
|
|
|
multiTeamname.current = val
|
|
|
|
onChanged={(value) => {
|
|
|
|
}}
|
|
|
|
let val: any = value && value.length > 0 ? value[0] : null
|
|
|
|
/>
|
|
|
|
multiTeamname.current = val
|
|
|
|
</Form.Item>
|
|
|
|
}}
|
|
|
|
</Form>
|
|
|
|
/>
|
|
|
|
</Modal>
|
|
|
|
</Form.Item>
|
|
|
|
)
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default ManagementAccountEditor
|
|
|
|
export default ManagementAccountEditor
|