Commit 8e4946ef by zhaochengxiang

岗位新增关联关系

parent 8d657bef
......@@ -107,8 +107,8 @@ export function* deletePersonalCustomDirectory(payload) {
export function* existDataAsset(payload) {
return yield call(service.existDataAsset, payload);
}
export function* queryAllDirectoryAsTree() {
return yield call(service.queryAllDirectoryAsTree);
export function* queryAllDirectoryAsTree(payload) {
return yield call(service.queryAllDirectoryAsTree, payload);
}
export function* queryDirectoryTreeByMetadataId(payload) {
return yield call(service.queryDirectoryTreeByMetadataId, payload);
......
......@@ -136,8 +136,8 @@ export function existDataAsset(payload) {
return GetJSON("/dataassetmanager/directoryApi/existDataAsset", payload);
}
export function queryAllDirectoryAsTree() {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree");
export function queryAllDirectoryAsTree(payload) {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree", payload);
}
export function queryDirectoryTreeByMetadataId(payload) {
......
......@@ -124,7 +124,7 @@ export function Get(url, params) {
const templateType = getTemplateType();
return textplain.get(url, {
params: {...params, templateType}, cancelToken
params: {templateType, ...params}, cancelToken
}).then(
callback
)
......@@ -135,7 +135,7 @@ export function GetJSON(url, params) {
const templateType = getTemplateType();
return instance.get(url, {
params: {...params, templateType}, cancelToken,
params: {templateType, ...params}, cancelToken,
validateStatus: false
}).then(
callback
......@@ -147,7 +147,7 @@ export const GetJSONRaw = (url, params) => {
const templateType = getTemplateType();
return instanceRow.get(url, {
params: {...params, templateType}, cancelToken,
params: {templateType, ...params}, cancelToken,
validateStatus: false
}).then(
callback
......@@ -159,7 +159,7 @@ export function Delete(url, params) {
const templateType = getTemplateType();
return instance.delete(url, {
params: {...params, templateType}, cancelToken,
params: {templateType, ...params}, cancelToken,
}).then(
callback
)
......@@ -171,11 +171,11 @@ export function PostJSON(url, payload) {
const templateType = getTemplateType();
return IsArr(data) ? instance.post(url, data, {
params: {...params, templateType}, cancelToken
params: {templateType, ...params}, cancelToken
}).then(
callback
) : instance.post(url, null, {
params: {...params, templateType}, data, cancelToken
params: {templateType, ...params}, data, cancelToken
}).then(
callback
)
......@@ -187,7 +187,7 @@ export function Post(url, payload) {
const templateType = getTemplateType();
return textplain.post(url, null, {
params: {...params, templateType}, data, cancelToken
params: {templateType, ...params}, data, cancelToken
}).then(
callback
)
......@@ -202,7 +202,7 @@ export function PostFile(url, payload) {
formData.append('file', file);
});
return fileplain.post(url, formData, { params: {...params, templateType} } ).then(
return fileplain.post(url, formData, { params: {templateType, ...params} } ).then(
callback
)
}
......@@ -221,7 +221,7 @@ export const callFetchRaw = (method, url, options) => {
return axios.request({
method,
url,
params: {...params, templateType},
params: {templateType, ...params},
...config,
...reqConfig
})
......
......@@ -401,6 +401,5 @@ export function getDataModelerRole(user) {
}
export function isPostAsset(templateType) {
//zcx todo
return false
return templateType === 'post'
}
\ No newline at end of file
......@@ -1335,7 +1335,7 @@ const AssetAction = (props) => {
</Spin>
{
isPostAsset(assets?.templateType) ? <PostRelation /> : <React.Fragment>
isPostAsset(assets?.templateType) ? <div className='mt-2'><PostRelation /></div> : <React.Fragment>
<div>
<Divider orientation='left'>字段级资产目录信息</Divider>
</div>
......
......@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd';
import AssetAction from './AssetAction';
const AssetDetailDrawer = (props) => {
const { onCancel, visible, id, dirId, reference } = props;
const { onCancel, visible, id, dirId, reference, readonly = false } = props;
const [ form ] = Form.useForm();
......@@ -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);
}} />
}
......
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 { useDebounceEffect } from "ahooks"
import classnames from 'classnames'
......@@ -7,6 +7,7 @@ import classnames from 'classnames'
import Table from '../../ResizeableTable'
import { dispatch } from '../../../../model'
import { AssetItem } from './AssetTable'
import AssetDetailDrawer from "./AssetDetailDrawer";
import './select-asset.less'
......@@ -33,6 +34,11 @@ const FC = (props) => {
const [expandedKeys, setExpandedKeys] = React.useState([])
const [autoExpandParent, setAutoExpandParent] = React.useState(false)
const [users, setUsers] = React.useState()
const [detailParams, setDetailParams] = React.useState({
visible: false,
id: undefined,
dirId: undefined,
})
React.useEffect(() => {
getUsers()
......@@ -81,6 +87,24 @@ const FC = (props) => {
return undefined
}, [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(() => {
let [newColumns, newTableData] = [[], []]
......@@ -146,7 +170,7 @@ const FC = (props) => {
}
}
return [newColumns, newTableData, data?.total??0]
return [[...newColumns, actionCol], newTableData, data?.total??0]
}, [elements, data, loadingElements, users])
const setArgsByParams = React.useCallback((params) => {
......@@ -257,102 +281,121 @@ const FC = (props) => {
setNode(selectedNodes[0])
}
const onDetailClick = (record) => {
setDetailParams({
visible: true,
id: record?.id,
dirId: record?.dirId,
})
}
return (
<div className='post-select-asset'>
<Row>
<Col span={4}>
<Select
size='small'
loading={loadingTemplates}
value={currentTemplate?.type}
onChange={(val) => {
if (val) {
const index = (templates??[]).findIndex(item => item.type === val)
if (index !== -1) {
setCurrentTemplate(templates[index])
setNode()
<Row>
<Col span={4}>
<Select
size='small'
loading={loadingTemplates}
value={currentTemplate?.type}
onChange={(val) => {
if (val) {
const index = (templates??[]).findIndex(item => item.type === val)
if (index !== -1) {
setCurrentTemplate(templates[index])
setNode()
} else {
setCurrentTemplate()
setNode()
}
} else {
setCurrentTemplate()
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
onChange={(page,size) => {
setArgsByParams({ page, size })
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)
},
}}
current={args.page}
pageSize={args.size}
defaultCurrent={1}
total={total}
showTotal={() => `共${total??0}项`}
scroll={{ y: 'calc(80vh - 170px)' }}
/>
}
</Col>
</Row>
{
(total!==0) && <Pagination
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>
)
}
......
......@@ -37,10 +37,6 @@ const FC = (props) => {
const [autoExpandParent, setAutoExpandParent] = React.useState(false)
const [users, setUsers] = React.useState()
const [countMap, setCount] = React.useState()
const [detailParams, setDetailParams] = React.useState({
visible: false,
id: undefined,
})
const app = React.useContext(AppContext)
......@@ -108,13 +104,13 @@ const FC = (props) => {
render: (_, record) => {
return (
<Space>
<Button type='link' size='small'
onClick={() => { onDetailClick(record) }}
style={{ padding: 0 }}
>
<a onClick={(e) => {
e.stopPropagation();
onDetailClick(record);
}}>
详情
</Button>
</Space>
</a>
</Space>
)
}
}
......@@ -274,10 +270,7 @@ const FC = (props) => {
}
const onDetailClick = (record) => {
setDetailParams({
visible: true,
id: record?.id,
})
app?.openDetail?.({ service: record, isOnlyEnding: true })
}
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