fix: display of action logs table data
This commit is contained in:
parent
c5b8b44a12
commit
3c18ecc796
@ -256,7 +256,7 @@ export function LinkToField(props: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function LinkToFieldLink(props) {
|
export function LinkToFieldLink(props) {
|
||||||
const { data, isArr, itemIndex, ctx, parent, schema, schema: { title, labelField, viewName, name, target, collection_name } } = props;
|
const { data, isArr, itemIndex, ctx = {}, parent, schema, schema: { title, labelField, viewName, name, target, collection_name } } = props;
|
||||||
// const [data, setData] = useState(props.data||{});
|
// const [data, setData] = useState(props.data||{});
|
||||||
return (
|
return (
|
||||||
<span className={'link-to-field-tag'}>
|
<span className={'link-to-field-tag'}>
|
||||||
@ -266,7 +266,6 @@ export function LinkToFieldLink(props) {
|
|||||||
Drawer.open({
|
Drawer.open({
|
||||||
title: data[labelField],
|
title: data[labelField],
|
||||||
content: ({resolve, closeWithConfirm}) => {
|
content: ({resolve, closeWithConfirm}) => {
|
||||||
// console.log({ctx, parent, data, props, schema});
|
|
||||||
const { index, mutate, dataSource, onChange } = ctx;
|
const { index, mutate, dataSource, onChange } = ctx;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@ -275,6 +274,9 @@ export function LinkToFieldLink(props) {
|
|||||||
closeWithConfirm && closeWithConfirm(true);
|
closeWithConfirm && closeWithConfirm(true);
|
||||||
}}
|
}}
|
||||||
noRequest={!!onChange} onFinish={(values) => {
|
noRequest={!!onChange} onFinish={(values) => {
|
||||||
|
if (typeof index === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let items = [...dataSource];
|
let items = [...dataSource];
|
||||||
const parentData = {...parent};
|
const parentData = {...parent};
|
||||||
set(parentData, isArr ? [name, itemIndex] : [name], values);
|
set(parentData, isArr ? [name, itemIndex] : [name], values);
|
||||||
@ -403,12 +405,23 @@ export function LogField(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function LogFieldValue(props) {
|
export function LogFieldValue(props) {
|
||||||
const { value, schema, data } = props;
|
const { value, data } = props;
|
||||||
return (
|
return (
|
||||||
<div>{JSON.stringify(value)}</div>
|
<Field data={data} viewType={'table'} schema={data.field} value={value}/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function JsonField(props) {
|
||||||
|
const { value } = props;
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
return (
|
||||||
|
<pre style={{maxWidth: 300, maxHeight: 200}}>
|
||||||
|
{JSON.stringify(value, null, 2)}
|
||||||
|
</pre>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function ChinaRegion(props: any) {
|
export function ChinaRegion(props: any) {
|
||||||
const { schema, value } = props;
|
const { schema, value } = props;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
@ -446,6 +459,7 @@ registerFieldComponents({
|
|||||||
'logs.field': LogField,
|
'logs.field': LogField,
|
||||||
'logs.fieldValue': LogFieldValue,
|
'logs.fieldValue': LogFieldValue,
|
||||||
chinaRegion: ChinaRegion,
|
chinaRegion: ChinaRegion,
|
||||||
|
json: JsonField,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function Field(props: any) {
|
export default function Field(props: any) {
|
||||||
|
@ -53,4 +53,15 @@ export default {
|
|||||||
title: '查看'
|
title: '查看'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
views_v2: [
|
||||||
|
{
|
||||||
|
type: 'table',
|
||||||
|
name: 'table',
|
||||||
|
fields: [
|
||||||
|
'field',
|
||||||
|
'before',
|
||||||
|
'after',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
} as TableOptions;
|
} as TableOptions;
|
||||||
|
Loading…
Reference in New Issue
Block a user