Commit 8e4946ef by zhaochengxiang

岗位新增关联关系

parent 8d657bef
...@@ -107,8 +107,8 @@ export function* deletePersonalCustomDirectory(payload) { ...@@ -107,8 +107,8 @@ export function* deletePersonalCustomDirectory(payload) {
export function* existDataAsset(payload) { export function* existDataAsset(payload) {
return yield call(service.existDataAsset, payload); return yield call(service.existDataAsset, payload);
} }
export function* queryAllDirectoryAsTree() { export function* queryAllDirectoryAsTree(payload) {
return yield call(service.queryAllDirectoryAsTree); return yield call(service.queryAllDirectoryAsTree, payload);
} }
export function* queryDirectoryTreeByMetadataId(payload) { export function* queryDirectoryTreeByMetadataId(payload) {
return yield call(service.queryDirectoryTreeByMetadataId, payload); return yield call(service.queryDirectoryTreeByMetadataId, payload);
......
...@@ -136,8 +136,8 @@ export function existDataAsset(payload) { ...@@ -136,8 +136,8 @@ export function existDataAsset(payload) {
return GetJSON("/dataassetmanager/directoryApi/existDataAsset", payload); return GetJSON("/dataassetmanager/directoryApi/existDataAsset", payload);
} }
export function queryAllDirectoryAsTree() { export function queryAllDirectoryAsTree(payload) {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree"); return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree", payload);
} }
export function queryDirectoryTreeByMetadataId(payload) { export function queryDirectoryTreeByMetadataId(payload) {
......
...@@ -124,7 +124,7 @@ export function Get(url, params) { ...@@ -124,7 +124,7 @@ export function Get(url, params) {
const templateType = getTemplateType(); const templateType = getTemplateType();
return textplain.get(url, { return textplain.get(url, {
params: {...params, templateType}, cancelToken params: {templateType, ...params}, cancelToken
}).then( }).then(
callback callback
) )
...@@ -135,7 +135,7 @@ export function GetJSON(url, params) { ...@@ -135,7 +135,7 @@ export function GetJSON(url, params) {
const templateType = getTemplateType(); const templateType = getTemplateType();
return instance.get(url, { return instance.get(url, {
params: {...params, templateType}, cancelToken, params: {templateType, ...params}, cancelToken,
validateStatus: false validateStatus: false
}).then( }).then(
callback callback
...@@ -147,7 +147,7 @@ export const GetJSONRaw = (url, params) => { ...@@ -147,7 +147,7 @@ export const GetJSONRaw = (url, params) => {
const templateType = getTemplateType(); const templateType = getTemplateType();
return instanceRow.get(url, { return instanceRow.get(url, {
params: {...params, templateType}, cancelToken, params: {templateType, ...params}, cancelToken,
validateStatus: false validateStatus: false
}).then( }).then(
callback callback
...@@ -159,7 +159,7 @@ export function Delete(url, params) { ...@@ -159,7 +159,7 @@ export function Delete(url, params) {
const templateType = getTemplateType(); const templateType = getTemplateType();
return instance.delete(url, { return instance.delete(url, {
params: {...params, templateType}, cancelToken, params: {templateType, ...params}, cancelToken,
}).then( }).then(
callback callback
) )
...@@ -171,11 +171,11 @@ export function PostJSON(url, payload) { ...@@ -171,11 +171,11 @@ export function PostJSON(url, payload) {
const templateType = getTemplateType(); const templateType = getTemplateType();
return IsArr(data) ? instance.post(url, data, { return IsArr(data) ? instance.post(url, data, {
params: {...params, templateType}, cancelToken params: {templateType, ...params}, cancelToken
}).then( }).then(
callback callback
) : instance.post(url, null, { ) : instance.post(url, null, {
params: {...params, templateType}, data, cancelToken params: {templateType, ...params}, data, cancelToken
}).then( }).then(
callback callback
) )
...@@ -187,7 +187,7 @@ export function Post(url, payload) { ...@@ -187,7 +187,7 @@ export function Post(url, payload) {
const templateType = getTemplateType(); const templateType = getTemplateType();
return textplain.post(url, null, { return textplain.post(url, null, {
params: {...params, templateType}, data, cancelToken params: {templateType, ...params}, data, cancelToken
}).then( }).then(
callback callback
) )
...@@ -202,7 +202,7 @@ export function PostFile(url, payload) { ...@@ -202,7 +202,7 @@ export function PostFile(url, payload) {
formData.append('file', file); formData.append('file', file);
}); });
return fileplain.post(url, formData, { params: {...params, templateType} } ).then( return fileplain.post(url, formData, { params: {templateType, ...params} } ).then(
callback callback
) )
} }
...@@ -221,7 +221,7 @@ export const callFetchRaw = (method, url, options) => { ...@@ -221,7 +221,7 @@ export const callFetchRaw = (method, url, options) => {
return axios.request({ return axios.request({
method, method,
url, url,
params: {...params, templateType}, params: {templateType, ...params},
...config, ...config,
...reqConfig ...reqConfig
}) })
......
...@@ -401,6 +401,5 @@ export function getDataModelerRole(user) { ...@@ -401,6 +401,5 @@ export function getDataModelerRole(user) {
} }
export function isPostAsset(templateType) { export function isPostAsset(templateType) {
//zcx todo return templateType === 'post'
return false
} }
\ No newline at end of file
...@@ -1335,7 +1335,7 @@ const AssetAction = (props) => { ...@@ -1335,7 +1335,7 @@ const AssetAction = (props) => {
</Spin> </Spin>
{ {
isPostAsset(assets?.templateType) ? <PostRelation /> : <React.Fragment> isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation /></div> : <React.Fragment>
<div> <div>
<Divider orientation='left'>字段级资产目录信息</Divider> <Divider orientation='left'>字段级资产目录信息</Divider>
</div> </div>
......
...@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd'; ...@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd';
import AssetAction from './AssetAction'; import AssetAction from './AssetAction';
const AssetDetailDrawer = (props) => { const AssetDetailDrawer = (props) => {
const { onCancel, visible, id, dirId, reference } = props; const { onCancel, visible, id, dirId, reference, readonly = false } = props;
const [ form ] = Form.useForm(); const [ form ] = Form.useForm();
...@@ -21,7 +21,7 @@ const AssetDetailDrawer = (props) => { ...@@ -21,7 +21,7 @@ const AssetDetailDrawer = (props) => {
}} }}
> >
{ {
visible && <AssetAction reference={reference} form={form} id={id} dirId={dirId} action='detail' onChange={() => { visible && <AssetAction reference={reference} form={form} id={id} dirId={dirId} action='detail' readonly={readonly} onChange={() => {
onCancel?.(true); onCancel?.(true);
}} /> }} />
} }
......
import React from 'react' import React from 'react'
import { Row, Col, Spin, Tree, Input, Tooltip, Typography, Select, Pagination } from 'antd' import { Row, Col, Spin, Tree, Input, Tooltip, Typography, Select, Pagination, Space, Button } from 'antd'
import produce from 'immer' import produce from 'immer'
import { useDebounceEffect } from "ahooks" import { useDebounceEffect } from "ahooks"
import classnames from 'classnames' import classnames from 'classnames'
...@@ -7,6 +7,7 @@ import classnames from 'classnames' ...@@ -7,6 +7,7 @@ import classnames from 'classnames'
import Table from '../../ResizeableTable' import Table from '../../ResizeableTable'
import { dispatch } from '../../../../model' import { dispatch } from '../../../../model'
import { AssetItem } from './AssetTable' import { AssetItem } from './AssetTable'
import AssetDetailDrawer from "./AssetDetailDrawer";
import './select-asset.less' import './select-asset.less'
...@@ -33,6 +34,11 @@ const FC = (props) => { ...@@ -33,6 +34,11 @@ const FC = (props) => {
const [expandedKeys, setExpandedKeys] = React.useState([]) const [expandedKeys, setExpandedKeys] = React.useState([])
const [autoExpandParent, setAutoExpandParent] = React.useState(false) const [autoExpandParent, setAutoExpandParent] = React.useState(false)
const [users, setUsers] = React.useState() const [users, setUsers] = React.useState()
const [detailParams, setDetailParams] = React.useState({
visible: false,
id: undefined,
dirId: undefined,
})
React.useEffect(() => { React.useEffect(() => {
getUsers() getUsers()
...@@ -81,6 +87,24 @@ const FC = (props) => { ...@@ -81,6 +87,24 @@ const FC = (props) => {
return undefined return undefined
}, [treeData]) }, [treeData])
const actionCol = {
title: '操作',
dataIndex: 'action',
width: 80,
render: (_, record) => {
return (
<Space>
<a onClick={(e) => {
e.stopPropagation();
onDetailClick(record);
}}>
详情
</a>
</Space>
)
}
}
const [columns, tableData, total] = React.useMemo(() => { const [columns, tableData, total] = React.useMemo(() => {
let [newColumns, newTableData] = [[], []] let [newColumns, newTableData] = [[], []]
...@@ -146,7 +170,7 @@ const FC = (props) => { ...@@ -146,7 +170,7 @@ const FC = (props) => {
} }
} }
return [newColumns, newTableData, data?.total??0] return [[...newColumns, actionCol], newTableData, data?.total??0]
}, [elements, data, loadingElements, users]) }, [elements, data, loadingElements, users])
const setArgsByParams = React.useCallback((params) => { const setArgsByParams = React.useCallback((params) => {
...@@ -257,102 +281,121 @@ const FC = (props) => { ...@@ -257,102 +281,121 @@ const FC = (props) => {
setNode(selectedNodes[0]) setNode(selectedNodes[0])
} }
const onDetailClick = (record) => {
setDetailParams({
visible: true,
id: record?.id,
dirId: record?.dirId,
})
}
return ( return (
<div className='post-select-asset'> <div className='post-select-asset'>
<Row> <Row>
<Col span={4}> <Col span={4}>
<Select <Select
size='small' size='small'
loading={loadingTemplates} loading={loadingTemplates}
value={currentTemplate?.type} value={currentTemplate?.type}
onChange={(val) => { onChange={(val) => {
if (val) { if (val) {
const index = (templates??[]).findIndex(item => item.type === val) const index = (templates??[]).findIndex(item => item.type === val)
if (index !== -1) { if (index !== -1) {
setCurrentTemplate(templates[index]) setCurrentTemplate(templates[index])
setNode() setNode()
} else {
setCurrentTemplate()
setNode()
}
} else { } else {
setCurrentTemplate() setCurrentTemplate()
setNode() setNode()
} }
} else {
setCurrentTemplate()
setNode()
}
}}
style={{ width: 100, marginBottom: 10 }}
>
{(templates??[]).map(item => (
<Select.Option key={item.id} value={item.type}>{item.name}</Select.Option>
))}
</Select>
<Spin spinning={loadingTreeData}>
<Tree
className='tree'
showLine
showIcon={false}
autoExpandParent={autoExpandParent}
treeData={treeData1}
selectedKeys={node?[node.nodeId]:[]}
expandedKeys={expandedKeys}
onSelect={onTreeSelect}
onExpand={onTreeExpand}
/>
</Spin>
</Col>
<Col span={20}>
<div
style={{
display: 'flex',
padding: '0px 0px 15px',
alignItems: 'center',
justifyContent: 'flex-end',
}}>
<Input size="middle"
placeholder="请输入资产目录要素值"
value={args.keyword}
bordered={true} allowClear
onChange={(e) => {
setArgsByParams({ keyword: e.target.value, page: 1 })
}}
style={{ width: 200 }}
/>
</div>
<Table
size='small'
rowKey='id'
extraColWidth={32}
loading={loading||loadingElements}
columns={columns}
dataSource={tableData}
pagination={false}
rowSelection={{
selectedRowKeys: (selectedRows??[]).map(item => item.id),
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows)
},
}}
scroll={{ y: 'calc(80vh - 170px)' }}
/>
{
(total!==0) && <Pagination
style={{
textAlign: 'center',
marginTop: 15,
}} }}
showSizeChanger style={{ width: 100, marginBottom: 10 }}
onChange={(page,size) => { >
setArgsByParams({ page, size }) {(templates??[]).map(item => (
<Select.Option key={item.id} value={item.type}>{item.name}</Select.Option>
))}
</Select>
<Spin spinning={loadingTreeData}>
<Tree
className='tree'
showLine
showIcon={false}
autoExpandParent={autoExpandParent}
treeData={treeData1}
selectedKeys={node?[node.nodeId]:[]}
expandedKeys={expandedKeys}
onSelect={onTreeSelect}
onExpand={onTreeExpand}
/>
</Spin>
</Col>
<Col span={20}>
<div
style={{
display: 'flex',
padding: '0px 0px 15px',
alignItems: 'center',
justifyContent: 'flex-end',
}}>
<Input size="middle"
placeholder="请输入资产目录要素值"
value={args.keyword}
bordered={true} allowClear
onChange={(e) => {
setArgsByParams({ keyword: e.target.value, page: 1 })
}}
style={{ width: 200 }}
/>
</div>
<Table
size='small'
rowKey='id'
extraColWidth={32}
loading={loading||loadingElements}
columns={columns}
dataSource={tableData}
pagination={false}
rowSelection={{
selectedRowKeys: (selectedRows??[]).map(item => item.id),
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows)
},
}} }}
current={args.page} scroll={{ y: 'calc(80vh - 170px)' }}
pageSize={args.size}
defaultCurrent={1}
total={total}
showTotal={() => `共${total??0}项`}
/> />
} {
</Col> (total!==0) && <Pagination
</Row> style={{
textAlign: 'center',
marginTop: 15,
}}
showSizeChanger
onChange={(page,size) => {
setArgsByParams({ page, size })
}}
current={args.page}
pageSize={args.size}
defaultCurrent={1}
total={total}
showTotal={() => `共${total??0}项`}
/>
}
</Col>
</Row>
<AssetDetailDrawer
{...detailParams}
readonly={true}
onCancel={() => {
setDetailParams({
visible: false,
id: undefined,
dirId: undefined,
})
}}
/>
</div> </div>
) )
} }
......
...@@ -37,10 +37,6 @@ const FC = (props) => { ...@@ -37,10 +37,6 @@ const FC = (props) => {
const [autoExpandParent, setAutoExpandParent] = React.useState(false) const [autoExpandParent, setAutoExpandParent] = React.useState(false)
const [users, setUsers] = React.useState() const [users, setUsers] = React.useState()
const [countMap, setCount] = React.useState() const [countMap, setCount] = React.useState()
const [detailParams, setDetailParams] = React.useState({
visible: false,
id: undefined,
})
const app = React.useContext(AppContext) const app = React.useContext(AppContext)
...@@ -108,13 +104,13 @@ const FC = (props) => { ...@@ -108,13 +104,13 @@ const FC = (props) => {
render: (_, record) => { render: (_, record) => {
return ( return (
<Space> <Space>
<Button type='link' size='small' <a onClick={(e) => {
onClick={() => { onDetailClick(record) }} e.stopPropagation();
style={{ padding: 0 }} onDetailClick(record);
> }}>
详情 详情
</Button> </a>
</Space> </Space>
) )
} }
} }
...@@ -274,10 +270,7 @@ const FC = (props) => { ...@@ -274,10 +270,7 @@ const FC = (props) => {
} }
const onDetailClick = (record) => { const onDetailClick = (record) => {
setDetailParams({ app?.openDetail?.({ service: record, isOnlyEnding: true })
visible: true,
id: record?.id,
})
} }
return ( return (
......
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