list页面上进行设置
This commit is contained in:
parent
f669f852a1
commit
64abfd5ecd
|
|
@ -10,7 +10,7 @@ import Crop from 'oak-general-business/es/components/extraFile/crop';
|
|||
import Commit from 'oak-general-business/es/components/extraFile/commit';
|
||||
import CategorySelector from '../../category/selector';
|
||||
|
||||
export default function VditorComponent(
|
||||
export default function EditorComponent(
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'essay',
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
export default OakComponent({
|
||||
entity: 'essay',
|
||||
isList: false,
|
||||
// 这里可能存在bug,在list下面的single组件中如果不添加projection,会报错
|
||||
projection: {
|
||||
id: 1,
|
||||
// 相关labels
|
||||
// essayLabels$essay: {
|
||||
// $entity: 'essayLabels',
|
||||
// data: {
|
||||
// id: 1,
|
||||
// label: {
|
||||
// id: 1,
|
||||
// name: 1,
|
||||
// color: 1,
|
||||
// },
|
||||
// sequence: 1,
|
||||
// },
|
||||
// }
|
||||
},
|
||||
formData({ data }) {
|
||||
return {
|
||||
item: data,
|
||||
};
|
||||
}
|
||||
})
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import React from 'react';
|
||||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
||||
import Labels from '../../labels/list';
|
||||
|
||||
const EssayLabels = (
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'essay',
|
||||
false,
|
||||
{
|
||||
item: RowWithActions<EntityDict, 'essay'>;
|
||||
}
|
||||
>
|
||||
) => {
|
||||
return (
|
||||
<>
|
||||
{props.data.item && (
|
||||
<Labels
|
||||
essayId={props.data.item.id}
|
||||
oakPath={`${props.data.oakFullpath}.essayLabels$essay`}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default EssayLabels;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { essayProjection } from "@project/utils/projection";
|
||||
|
||||
export default OakComponent({
|
||||
entity: 'essay',
|
||||
isList: false,
|
||||
projection: essayProjection,
|
||||
formData({ data }) {
|
||||
return {
|
||||
item: data,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import { Form, Input } from 'antd';
|
||||
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
||||
import Crop from 'oak-general-business/es/components/extraFile/crop';
|
||||
import React from 'react';
|
||||
import CategorySelector from '../../category/selector';
|
||||
import Labels from '../../labels/list';
|
||||
|
||||
const EssayUpsert = (
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'essay',
|
||||
false,
|
||||
{
|
||||
item: RowWithActions<EntityDict, 'essay'>;
|
||||
}
|
||||
>
|
||||
) => {
|
||||
const { item, oakFullpath, oakEntity } = props.data;
|
||||
const { update, t } = props.methods;
|
||||
|
||||
return (
|
||||
<>
|
||||
{item && (
|
||||
<Form>
|
||||
<Form.Item label={t('essay:attr.title')}>
|
||||
<Input
|
||||
value={item?.title}
|
||||
onChange={(e) =>
|
||||
update({
|
||||
title: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('essay:attr.images')}>
|
||||
<Crop
|
||||
entity={oakEntity}
|
||||
entityId={item.id}
|
||||
oakPath={`${oakFullpath}.extraFile$entity`}
|
||||
maxNumber={1}
|
||||
accept='image/*'
|
||||
tag1='cover'
|
||||
enableCrop
|
||||
showRest
|
||||
showGrid
|
||||
rotationSlider
|
||||
aspectSlider
|
||||
aspect={16 / 9}
|
||||
cropQuality={0.8}
|
||||
enableCompross
|
||||
maxWidth={1920}
|
||||
maxHeight={1080}
|
||||
minWidth={1280}
|
||||
minHeight={720}
|
||||
></Crop>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('essay:attr.category')}>
|
||||
<CategorySelector
|
||||
oakPath='category-list'
|
||||
selectedId={item?.categoryId}
|
||||
onSelect={(id: string) => {
|
||||
update({
|
||||
categoryId: id,
|
||||
});
|
||||
}}
|
||||
></CategorySelector>
|
||||
</Form.Item>
|
||||
<Labels
|
||||
essayId={props.data.item.id}
|
||||
oakPath={`${props.data.oakFullpath}.essayLabels$essay`}
|
||||
/>
|
||||
</Form>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default EssayUpsert;
|
||||
|
|
@ -4,8 +4,7 @@
|
|||
"summary": "文章摘要",
|
||||
"author": "作者",
|
||||
"action":{
|
||||
"updateLabels": "修改标签",
|
||||
"createLabels": "新建标签"
|
||||
"setting": "设置"
|
||||
},
|
||||
"label": {
|
||||
"selectLabels": "选择标签"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import PageHeader from 'oak-frontend-base/es/components/pageHeader2';
|
|||
import Styles from './web.pc.module.less';
|
||||
import { Button, Tag } from 'antd';
|
||||
import Modal from 'antd/es/modal/Modal';
|
||||
import Labels from '@project/components/console/essay/labels';
|
||||
import EssayUpsert from '@project/components/console/essay/upsert';
|
||||
|
||||
const EssayList = (
|
||||
props: WebComponentProps<
|
||||
|
|
@ -165,18 +165,8 @@ const EssayList = (
|
|||
}[] = (row) => {
|
||||
return [
|
||||
{
|
||||
action: 'updateLabels',
|
||||
label: (
|
||||
row as RowWithActions<EntityDict, 'essay'> & {
|
||||
labels: {
|
||||
id: string;
|
||||
name: string;
|
||||
color: string;
|
||||
}[];
|
||||
}
|
||||
).labels.length
|
||||
? t('action.updateLabels')
|
||||
: t('action.createLabels'),
|
||||
action: 'setting',
|
||||
label: t('action.setting'),
|
||||
show: true,
|
||||
},
|
||||
];
|
||||
|
|
@ -198,7 +188,7 @@ const EssayList = (
|
|||
updateItem({}, row.id, 'publish');
|
||||
execute();
|
||||
break;
|
||||
case 'updateLabels':
|
||||
case 'setting':
|
||||
setUpsertId(row.id);
|
||||
setShowSelectLabels(true);
|
||||
break;
|
||||
|
|
@ -245,10 +235,10 @@ const EssayList = (
|
|||
onOk={() => setShowSelectLabels(false)}
|
||||
>
|
||||
{upsertId && (
|
||||
<Labels
|
||||
<EssayUpsert
|
||||
oakPath={`${oakFullpath}.${upsertId}`}
|
||||
oakId={upsertId}
|
||||
></Labels>
|
||||
></EssayUpsert>
|
||||
)}
|
||||
</Modal>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Reference in New Issue