Commit bb00d951 by fanyj

tijiao

parent 0cca2a3c
......@@ -94,7 +94,8 @@ const config = {
pdataservice:`${Api}/pdataservice`,
dbmanager: `${Api}/dbmanager`,
datasource:`${Api}/metadataharvester/datasource`,
classifier:`${Api}/classifier`
classifier:`${Api}/classifier`,
syncdata:`${Api}/syncdata`,
}
}
......
......@@ -2,10 +2,12 @@ import metaManageService from "./metaManageService"
import metaAdminManageService from "./metaAdminManageService"
import metaUserManageService from "./metaUserManageService"
import assetsActionManageService from "./assetsActionManageService"
import usersService from "./usersService"
export {
metaManageService,
metaAdminManageService,
metaUserManageService,
assetsActionManageService
assetsActionManageService,
usersService
}
\ No newline at end of file
// import {request} from "@/utils"
import request from "@/utils/request"
import qs from "qs"
import config from "@/commons"
const {api:{authservice,metaRepo,syncdata}} =config
class usersService{
async getUserInfo(payload:any,autotip=false){
const {params,roleId} = payload
let result = await request({ url: `${authservice}/users`, method: "get", data: params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getSystemInDomain(payload:any,autotip=false){
let result = await request({ url: `${authservice}/domains/${payload}/systems`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async saveSystem(payload:any,autotip=false){
const {domainId,params,data} = payload
let result = await request({ url: `${authservice}/domains/${domainId}/systems`, method: "post" ,params,data },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUsers(payload:any,autotip=false){
let result = await request({ url: `${authservice}/users`, method: "get" ,data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addUser(payload:any,autotip=false){
const {params,data} = payload
let result = await request({ url: `${authservice}/users`, method: "post" ,params,data },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async updateUser(payload:any,autotip=false){
const {params,data,userId} = payload
let result = await request({ url: `${authservice}/users/${userId}`, method: "post" ,params,data },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserDomain(payload:any,autotip=false){
let result = await request({ url: `${authservice}/users/${payload}/domains`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserCatalog(payload:any,autotip=false){
let result = await request({ url: `${authservice}/users/${payload}/catalogs`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserOwnSystem(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/grantedScopes`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserOwnSystemOrder(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/grantedCatalogs`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserMenu(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/features`, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserMenuDetail(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/features/detail`, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getDataRoles(payload:any,autotip=false){
let result = await request({ url: `${authservice}/dataRoles`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUsersWithDataRolesAndGroup(payload:any,autotip=false){
let result = await request({ url: `${authservice}/users/find`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserGroup(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserGroupByUserId(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/findByJoinedUserId`, method: "get" ,data:payload},autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getDataRolesByUserId(domainId:any,payload:any,autotip=false){
let result = await request({ url: `${authservice}/domains/${domainId}/dataRoles/findByUserId`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async saveAndUpdateGroup(payload:any,autotip=false){
if(payload?.id){
let result = await request({ url: `${authservice}/userGroups/${payload.id}`,data:payload, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}else{
let result = await request({ url: `${authservice}/userGroups`,data:payload, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
}
async saveGroupUsers(payload:any,autotip=false){
const {userGroupId,data} = payload
let result = await request({ url: `${authservice}/userGroups/${userGroupId}/users/sync`, method: "post",data:qs.stringify(data) },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async saveGroupRoles(payload:any,autotip=false){
const {userGroupId,data} = payload
let result = await request({ url: `${authservice}/userGroups/${userGroupId}/dataRoles/sync`, method: "post",data:qs.stringify(data) },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getRoleList(payload:any,autotip=false){
let result = await request({ url: `${authservice}/dataRoles`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getRoleById(payload:any,autotip=false){
let result = await request({ url: `${authservice}/dataRoles/${payload}`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async saveRoles(payload:any,autotip=false){
const {params,body} = payload
if(body.id){
if(body.authorities){
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}`, method: "post",data:body },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}else{
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/rename`, method: "post",data:body },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
}else{
let result = await request({ url: `${authservice}/dataRoles`, method: "post",data:body },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
}
async deleteRoles(payload:any,autotip=false){
let result = await request({ url: `${authservice}/dataRoles/${payload.dataRoleId}`, method: "delete" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserInRoles(payload:any,autotip=false){
const {params,body} = payload
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/users`, method: "post",data:qs.stringify(body) },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addUserInRoles(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/users/${params.userId}`, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addUsersInRole(payload:any,autotip=false){
const {params,roleId} = payload
let result = await request({ url: `${authservice}/dataRoles/${roleId}/users/sync`,data:qs.stringify(params), method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteUserInRoles(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/users/${params.userId}`, method: "delete" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getGroupInRoles(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/findByGrantedDataRoles`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addGroupInRoles(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/dataRoles`, method: "post",params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteGroupInRoles(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/dataRoles`, method: "delete",params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserInGroup(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/${payload}/users`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getRolesInGroup(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/${payload}/dataRoles`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addRoleInGroup(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/dataRoles/grant`, method: "post",params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteRoleInGroup(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/dataRoles/revoke`, method: "delete",params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteGroups(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/${payload.userGroupIds}`, method: "delete" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserWithGroup(payload:any,autotip=false){
let result = await request({ url: `${authservice}/userGroups/findByJoinedUserId`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserWithRole(payload:any,autotip=false){
const {params,data} = payload
let result = await request({ url: `${authservice}/users/${data.userId}/dataRoles`, method: "get",data },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addUserWithGroup(payload:any,autotip=false){
const {params,data} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/users`, method: "post",data:qs.stringify(data) },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteUserWithGroup(payload:any,autotip=false){
const {params,data} = payload
let result = await request({ url: `${authservice}/userGroups/${params.userGroupId}/users`, method: "delete",params:params },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async addUserWithRole(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/users/${params.userId}`, method: "post" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteUserWithRole(payload:any,autotip=false){
const {params} = payload
let result = await request({ url: `${authservice}/dataRoles/${params.dataRoleId}/users/${params.userId}`, method: "delete" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getAllApp(payload:any,autotip=false){
let result = await request({ url: `${authservice}/apps`, method: "get" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async deleteUser(payload:any,autotip=false){
let result = await request({ url: `${authservice}/users/${payload}`, method: "delete" },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async swapsystem(payload:any,autotip=false){
let result = await request({ url: `${authservice}/domains/${payload.domainId}/systems/swapDisplayOrder`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async countUser(payload:any,autotip=false){
let result = await request({ url: `${authservice}/stats/userCounts`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async countUseUser(payload:any,autotip=false){
let result = await request({ url: `${syncdata}/static/totalUserCount`, method: "get",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserAdmitSystem(payload:any,autotip=false){
let result = await request({ url: `${metaRepo}/rest/system/listAllSystem`, method: "post",data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserAdmitBtnByMenu(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/menu/:menuItemId/options`, method: "get",urldata:payload,data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async updatePassword(payload:any,autotip=false){
let result = await request({ url: `${authservice}/personal/resetPassword`, method: "post" ,data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async getUserById(payload:any,autotip=false){
const {data,userId} = payload
let result = await request({ url: `${authservice}/users/${userId}`, method: "get" ,data },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
async syncUserData(payload:any,autotip=false){
let result = await request({ url: `${syncdata}/syncData`, method: "post" ,data:payload },autotip).then(data=>{
return data;
}).catch(error=>{
return error
})
return result;
}
}
export default new usersService();
\ No newline at end of file
......@@ -18,7 +18,7 @@ import Table from '../../ResizeableTable';
import SubsribeButton from './subscribe-button';
import { CancelSvg, EditSvg, SaveSvg, FullScreenSvg, CancelFullScreenSvg } from './AssetSvg';
import SelectUser from '../../Model/Component/SelectUsers';
import SelectUser from '../Component/SelectUser';
import SelectFilter from '../../Model/Component/SelectFilter';
import { checkDataAssetEditable } from '../../../../service/dataassetmanager';
import download from '../../../../util/download';
......@@ -789,6 +789,7 @@ const getResourceTag = () => {
// };
const elementEditComponent = (element) => {
console.log(element)
if (element.selectMode==='单选') {
return (
<Select
......@@ -806,18 +807,26 @@ const getResourceTag = () => {
)
}
if(element.name==='数据负责人'||element.name==='数据管家'){
return <SelectUser item={element} />
}
if (element.selectMode==='多选') return <MultipleSelect element={element}/>;
return <Input disabled={element.manualMaintain==='否'} />;
}
const elementDetailComponent = (item, publishedItem) => {
return <span>
if(item.name==='数据负责人'||item.name==='数据管家'){
return <SelectUser value={item.value} item={item} readOnly={true} terms={terms} />
}else{
return <span>
<Typography.Text>{highlightSearchContentByTerms(item.value||'', terms)}</Typography.Text>
{
publishedItem?.value && publishedItem?.value!==item.value && <Typography.Text className='ml-2' type='danger'><del>{publishedItem?.value}</del></Typography.Text>
}
</span>;
}
}
const onExportClick = () => {
......@@ -1037,7 +1046,7 @@ const getResourceTag = () => {
<Divider orientation='left'>字段级资源目录信息</Divider>
</div>
<Button size='small' onClick={()=>{comparemodal.openModal()}}>对比</Button>
{action!=='add'&&<Button size='small' onClick={()=>{comparemodal.openModal()}}>对比</Button>}
</div>
{
......
import { useSetState } from "ahooks"
import React, { useEffect } from "react"
import {Select} from "antd"
import { usersService } from "@/services"
import { httpUtil } from "@/utils"
import { highlightSearchContentByTerms } from '../../../../util';
const SelectUser:React.FC<any>=(props)=>{
const {value,onChange,item,readOnly=false,terms=[]} = props
const [state,setState] = useSetState({
usermap:{},
userlist:[],
loading:false,
})
useEffect(()=>{
if(item.name){
getusers()
}
},[item])
const getusers=async()=>{
const id = 1
setState({loading:true})
const result:any = await usersService.getUserInRoles({params:{dataRoleId:id}})
if(httpUtil.checkSuccess(result,1)){
let obj = {};
let list = [];
result.data.forEach((item)=>{
const label = `${item.name}(${item.dname})`;
obj[item.name] = label;
list.push({value:item.name,label})
})
setState({loading:false,userlist:list,usermap:obj})
}else{
setState({loading:false,userlist:[],usermap:{}})
}
}
if(readOnly){
return <span>{highlightSearchContentByTerms(state.usermap[value],terms)}</span>
}else{
return(
<Select
options={state.userlist}
loading={state.loading}
value={value}
onChange={onChange}
style={{width:'100%'}}
showSearch
filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}
/>
)
}
}
export default SelectUser
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment