Commit be9a0e36 by zhaochengxiang

资源草稿

parent 4b3260a7
...@@ -290,6 +290,10 @@ export function* resourceBatchEdit(payload) { ...@@ -290,6 +290,10 @@ export function* resourceBatchEdit(payload) {
return yield call(service.resourceBatchEdit, payload) return yield call(service.resourceBatchEdit, payload)
} }
export function* getResourceDraft(payload) {
return yield call(service.getResourceDraft, payload)
}
export function* getTasks(payload) { export function* getTasks(payload) {
return yield call(service.getTasks, payload) return yield call(service.getTasks, payload)
} }
\ No newline at end of file
...@@ -280,6 +280,10 @@ export function getPreviewRangeByDirId(payload) { ...@@ -280,6 +280,10 @@ export function getPreviewRangeByDirId(payload) {
return PostJSON("/dataassetmanager/resourceApi/batchEdit", payload) return PostJSON("/dataassetmanager/resourceApi/batchEdit", payload)
} }
export function getResourceDraft(payload) {
return GetJSON("/dataassetmanager/resourceApi/getDraft", payload)
}
export function getTasks(payload) { export function getTasks(payload) {
return GetJSON("/dataassetmanager/resource/taskApi/listTasksByPage", payload) return GetJSON("/dataassetmanager/resource/taskApi/listTasksByPage", payload)
} }
\ No newline at end of file
...@@ -38,8 +38,15 @@ ...@@ -38,8 +38,15 @@
} }
tr.@{ant-prefix}-table-expanded-row > td { tr.@{ant-prefix}-table-expanded-row > td {
background: #fff !important; padding: 0 !important;
background: #fff !important;
} }
tr.@{ant-prefix}-table-expanded-row {
.@{ant-prefix}-table {
margin: 0 !important;
}
}
.@{ant-prefix}-table-thead > tr > th { .@{ant-prefix}-table-thead > tr > th {
background-color: #F2F5FC !important; background-color: #F2F5FC !important;
......
...@@ -164,6 +164,11 @@ const AttributeRelationModal = (props) => { ...@@ -164,6 +164,11 @@ const AttributeRelationModal = (props) => {
const getRelAttrByModel = () => { const getRelAttrByModel = () => {
dispatch({ dispatch({
type: 'assetmanage.getRelAttrByModel', type: 'assetmanage.getRelAttrByModel',
payload: {
params: {
dataAssetType: getAssetType(type),
}
},
callback: data => { callback: data => {
let _fieldsValue = {}; let _fieldsValue = {};
(data||[]).forEach(item => { (data||[]).forEach(item => {
......
...@@ -3,6 +3,7 @@ import classNames from 'classnames' ...@@ -3,6 +3,7 @@ import classNames from 'classnames'
import { Tooltip, Typography, Space, Dropdown, Button, Menu, Checkbox, Input, Select, Modal } from 'antd' import { Tooltip, Typography, Space, Dropdown, Button, Menu, Checkbox, Input, Select, Modal } from 'antd'
import ResizeObserver from 'rc-resize-observer' import ResizeObserver from 'rc-resize-observer'
import { debounceTime, Subject } from 'rxjs' import { debounceTime, Subject } from 'rxjs'
import { DownOutlined, UpOutlined } from "@ant-design/icons"
import { defaultPage, usePage } from '../../../util/hooks/page' import { defaultPage, usePage } from '../../../util/hooks/page'
import Table from '../../../util/Component/Table' import Table from '../../../util/Component/Table'
...@@ -45,6 +46,7 @@ const FC = (props) => { ...@@ -45,6 +46,7 @@ const FC = (props) => {
const [compact, setCompact] = React.useState(false) const [compact, setCompact] = React.useState(false)
const [loading, setLoading] = React.useState(false) const [loading, setLoading] = React.useState(false)
const [loadingElements, setLoadingElements] = React.useState(false) const [loadingElements, setLoadingElements] = React.useState(false)
const [columns, setColumns] = React.useState()
const [elements, setElements] = React.useState() const [elements, setElements] = React.useState()
const [data, setData] = React.useState() const [data, setData] = React.useState()
const [total, setTotal] = React.useState() const [total, setTotal] = React.useState()
...@@ -287,7 +289,7 @@ const FC = (props) => { ...@@ -287,7 +289,7 @@ const FC = (props) => {
} }
] ]
const columns = React.useMemo(() => { React.useEffect(() => {
const newColumns = [] const newColumns = []
let index = 0 let index = 0
for (const element of elements??[]) { for (const element of elements??[]) {
...@@ -336,7 +338,7 @@ const FC = (props) => { ...@@ -336,7 +338,7 @@ const FC = (props) => {
newColumns.push(col) newColumns.push(col)
} }
return [...newColumns, ...notElementCol] setColumns([...newColumns, ...notElementCol])
}, [elements]) }, [elements])
const tableData = React.useMemo(() => { const tableData = React.useMemo(() => {
...@@ -850,6 +852,7 @@ const FC = (props) => { ...@@ -850,6 +852,7 @@ const FC = (props) => {
setArgsAndPage({ sortingStatus: value }) setArgsAndPage({ sortingStatus: value })
}} }}
style={{ width: 100 }} style={{ width: 100 }}
allowClear
> >
{ {
(sortStatus??[]).map((item, index) => { (sortStatus??[]).map((item, index) => {
...@@ -865,6 +868,7 @@ const FC = (props) => { ...@@ -865,6 +868,7 @@ const FC = (props) => {
setArgsAndPage({ resourceStatus: value }) setArgsAndPage({ resourceStatus: value })
}} }}
style={{ width: 100 }} style={{ width: 100 }}
allowClear
> >
{ {
(relatedMetadataStatus??[]).map((item, index) => { (relatedMetadataStatus??[]).map((item, index) => {
...@@ -948,7 +952,36 @@ const FC = (props) => { ...@@ -948,7 +952,36 @@ const FC = (props) => {
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows) setSelectedRows(selectedRows)
}, },
getCheckboxProps: (record) => ({
disabled: record.draft,
}),
}} }}
expandable={(data??[]).findIndex(item => item.resourceExtraAttribute?.existDraft) !== -1 ? {
expandedRowRender: (record) => (
<ExpandedRow
id={record.id}
columns={columns}
onRowClick={(event, value) => {
event.stopPropagation()
setRow(value)
onClick?.(value)
}}
/>
),
rowExpandable: (record) => record.resourceExtraAttribute?.existDraft,
expandIcon: ({ expanded, onExpand, record }) => {
if (!record.resourceExtraAttribute?.existDraft) return null
return expanded ? (
<UpOutlined onClick={e => onExpand(record, e)} />
) : (
<DownOutlined onClick={e => onExpand(record, e)} />
)
},
indentSize: 0,
columnWidth: 30,
} : null
}
/> />
</ResizeObserver> </ResizeObserver>
</div> </div>
...@@ -1054,4 +1087,58 @@ const FC = (props) => { ...@@ -1054,4 +1087,58 @@ const FC = (props) => {
) )
} }
export default FC export default FC
\ No newline at end of file
const ExpandedRow = ({ id, columns, onRowClick }) => {
const [loading, setLoading] = React.useState(false)
const [data, setData] = React.useState()
const tableData = React.useMemo(() => {
const newTableData = []
if (data) {
const newAsset = {...data}
let index = 0
for (const elementValue of (data?.elementValues??[])) {
newAsset[`element${++index}`] = elementValue
}
newTableData.push(newAsset)
}
return newTableData
}, [data])
React.useEffect(() => {
if (id) {
getDraft()
}
}, [id])
const getDraft = () => {
setLoading(true)
dispatch({
type: 'assetmanage.getResourceDraft',
payload: {
resourceId: id,
range: getAssetRange(ResourceManageReference)
},
callback: (data) => {
setLoading(false)
setData(data)
}
})
}
return (
<div style={{ padding: 10 }}>
<Table
loading={loading}
columns={columns}
dataSource={tableData}
pagination={false}
onRowClick={(event, value) => {
onRowClick?.(event, value)
}}
/>
</div>
)
}
\ 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