Commit 9d4af7fd by zhaochengxiang

替换ownerowner

parent a161ac14
......@@ -99,4 +99,8 @@ export function* release(payload) {
export function* getSmartBiUrl(payload) {
return yield call(pds.getSmartBiUrl, payload)
}
export function* getOwners() {
return yield call(pds.getOwners)
}
\ No newline at end of file
......@@ -100,5 +100,7 @@ export function getSmartBiUrl(payload) {
return Get(`/${payload.url}`);
}
export function getOwners() {
return GetJSON("/informationmanagement/userData/findAll")
}
import React, { useState, useEffect } from 'react';
import { Modal, Button, Form, Descriptions, Space, Spin } from 'antd';
import { dispatch } from '../../../../model';
import SelectUsers from './SelectUsers';
import './ExchangeOwner.less';
const FC = ({ visible, id, onCancel }) => {
const [service, setService] = useState(undefined);
const [loading, setLoading] = useState(false);
const [owners, setOwners] = useState(undefined);
const [currentOwner, setCurrentOwner] = useState(undefined);
useEffect(() => {
if (visible) {
getService();
getOwners();
}
}, [visible, id])
const getService = () => {
setLoading(true);
dispatch({
type: 'pds.getDataService',
payload: {
id
},
callback: (data) => {
setLoading(false);
setService(data);
setCurrentOwner(data?.provider?.owner);
},
error: () => {
setLoading(false);
}
})
}
const getOwners = () => {
dispatch({
type: 'pds.getOwners',
callback: (data) => {
setOwners(data);
},
error: () => {
}
})
}
const onOwnerChange = (value) => {
setCurrentOwner(value);
}
const cancel = () => {
reset();
onCancel?.();
}
const onOk = () => {
onCancel?.(true);
}
const reset = () => {
setService(undefined);
setLoading(false);
}
const footer = [
<Button
key="0"
onClick={cancel}
>
取消
</Button>,
<Button
key="1"
type="primary"
onClick={onOk}
>
确定
</Button>,
];
return (
<Modal
className='exchange-owner'
forceRender
visible={visible}
title='替换Owner'
width={800}
onCancel={cancel}
footer={footer}
>
<Spin spinning={loading}>
<Descriptions title={<Space>
<div style={{ height: 18, width: 3, background: 'rgb(2, 105, 172)' }}></div>
<div>基本信息</div>
</Space>}>
<Descriptions.Item label="数据服务名称">{service?.name}</Descriptions.Item>
<Descriptions.Item label="数据服务技术名称">{service?.cnName}</Descriptions.Item>
<Descriptions.Item label="数据服务描述">{service?.remark}</Descriptions.Item>
</Descriptions>
<Descriptions title={<Space>
<div style={{ height: 18, width: 3, background: 'rgb(2, 105, 172)' }}></div>
<div>提供方信息</div>
</Space>} />
<Space>
<div>数据提供服务方Owner:</div>
<div style={{ width: 200 }}>
<SelectUsers type='edit' users={owners} value={currentOwner} onChange={onOwnerChange} />
</div>
</Space>
</Spin>
</Modal>
)
}
export default FC;
\ No newline at end of file
.exchange-owner {
.yy-descriptions-header {
margin-bottom: 5px;
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"
import ResizeObserver from 'rc-resize-observer';
import ServiceDetail from './ServiceDetailModal';
import SampleModal from './SampleModal';
import ExchangeOwnerModal from './ExchangeOwner';
import { dispatch } from '../../../../model';
import { showMessage, getQueryParam, paginate, isSzseEnv, formatDate, getDataModelerRole } from '../../../../util';
......@@ -146,7 +147,7 @@ const ModelTable = (props) => {
const [ subData, setSubData ] = useState([]);
const [ serviceDetailParams, setServiceDetailParams ] = useState({ visible: false, id: '' })
const [ sampleParams, setSampleParams ] = useState({ visible: false, service: undefined });
const [ exchangeOwnerParams, setExchangeOwnerParams ] = useState({ visible: false, id: undefined });
const app = useContext(AppContext);
......@@ -785,6 +786,8 @@ const ModelTable = (props) => {
window.open(data)
}
})
} else if (key === 'exchangeOwner') {
setExchangeOwnerParams({ visible: true, id: currentItem?.id });
}
}
......@@ -796,6 +799,12 @@ const ModelTable = (props) => {
setSampleParams({ visible: false, service: undefined });
}
const onExchangeOwnerClose = (refresh = false) => {
setExchangeOwnerParams({ visible: false, id: undefined });
refresh && onChange?.();
}
const mergedColumns = () => {
let newColumns = [...columns];
// if ((modelId||'')==='' && (view==='state'||(keyword||'')!=='')) {
......@@ -961,6 +970,11 @@ const ModelTable = (props) => {
跳转至电子表格
</RcItem>
}
{
getDataModelerRole(user)!==DataModelerRoleReader && view!=='grant' && <RcItem id="exchangeOwner" onClick={handleItemClick}>
替换Owner
</RcItem>
}
{/* {
getDataModelerRole(user)!==DataModelerRoleReader &&currentItem?.deployable && <RcItem id='createTable' onClick={handleItemClick}>
建表
......@@ -970,6 +984,7 @@ const ModelTable = (props) => {
</RcMenu>
<ServiceDetail visible={serviceDetailParams.visible} id={serviceDetailParams.id} onClose={onServiceDetailClose} />
<SampleModal visible={sampleParams.visible} service={sampleParams.service} onCancel={onSampleClose} />
<ExchangeOwnerModal visible={exchangeOwnerParams.visible} id={exchangeOwnerParams.id} onCancel={onExchangeOwnerClose} />
{ contextHolder }
</div>
......
import React from "react"
import {Select} from "antd"
const {Option} = Select
const SelectUser:React.FC=(props)=>{
const {value,onChange,users,type,} = props
const change=(value)=>{
onChange&&onChange(value)
}
if(type==='edit'){
return(
<Select
style={{width:'100%'}}
showSearch
value={value}
onChange={change}
allowClear
filterOption={(inputvalue,option)=>{
if(inputvalue){
console.log(option)
try {
if(option.children.includes(inputvalue)||option.value.includes(inputvalue)){
return true
}else{
return false
}
} catch (error) {
return true
}
}else{
return true
}
}}
>
{
users?.map((item)=>{
return(
<Option vlaue={item.pernr} key={item.pernr}>{`${item.nachn}(${item.pernr})`}</Option>
)
})
}
</Select>
)
}else if(type==='detail'){
try {
const user = users?.filter((item)=>(item.pernr===value))
return `${user[0].nachn}(${user[0].pernr})`
} catch (error) {
return value
}
}else{
return null
}
}
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