|
@@ -1,7 +1,6 @@
|
|
|
import {
|
|
import {
|
|
|
ModalForm,
|
|
ModalForm,
|
|
|
ProForm,
|
|
ProForm,
|
|
|
- ProFormDependency,
|
|
|
|
|
ProFormInstance,
|
|
ProFormInstance,
|
|
|
ProFormSelect,
|
|
ProFormSelect,
|
|
|
ProFormText,
|
|
ProFormText,
|
|
@@ -78,14 +77,6 @@ const RelationEditWidget = ({
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
- const verbOptions = _verb.map((item) => {
|
|
|
|
|
- return {
|
|
|
|
|
- value: item,
|
|
|
|
|
- label: intl.formatMessage({
|
|
|
|
|
- id: `dict.fields.type.${item}.label`,
|
|
|
|
|
- }),
|
|
|
|
|
- };
|
|
|
|
|
- });
|
|
|
|
|
return (
|
|
return (
|
|
|
<ModalForm<IRelation>
|
|
<ModalForm<IRelation>
|
|
|
title={title}
|
|
title={title}
|
|
@@ -101,6 +92,7 @@ const RelationEditWidget = ({
|
|
|
onFinish={async (values) => {
|
|
onFinish={async (values) => {
|
|
|
let data = values;
|
|
let data = values;
|
|
|
data.from = { spell: values.fromSpell, case: values.fromCase };
|
|
data.from = { spell: values.fromSpell, case: values.fromCase };
|
|
|
|
|
+ data.to = { spell: values.toSpell, case: values.toCase };
|
|
|
let res: IRelationResponse;
|
|
let res: IRelationResponse;
|
|
|
if (typeof id === "undefined") {
|
|
if (typeof id === "undefined") {
|
|
|
res = await post<IRelationRequest, IRelationResponse>(
|
|
res = await post<IRelationRequest, IRelationResponse>(
|
|
@@ -131,7 +123,7 @@ const RelationEditWidget = ({
|
|
|
const res = await get<IRelationResponse>(`/v2/relation/${id}`);
|
|
const res = await get<IRelationResponse>(`/v2/relation/${id}`);
|
|
|
console.log("relation get", res);
|
|
console.log("relation get", res);
|
|
|
if (res.ok) {
|
|
if (res.ok) {
|
|
|
- setTitle(res.data.name);
|
|
|
|
|
|
|
+ setTitle(res.data.name + "dd");
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
id: id,
|
|
id: id,
|
|
@@ -141,6 +133,8 @@ const RelationEditWidget = ({
|
|
|
fromCase: res.data.from?.case,
|
|
fromCase: res.data.from?.case,
|
|
|
fromSpell: res.data.from?.spell,
|
|
fromSpell: res.data.from?.spell,
|
|
|
to: res.data.to,
|
|
to: res.data.to,
|
|
|
|
|
+ toCase: res.data.to?.case,
|
|
|
|
|
+ toSpell: res.data.to?.spell,
|
|
|
match: res.data.match ? res.data.match : undefined,
|
|
match: res.data.match ? res.data.match : undefined,
|
|
|
category: res.data.category,
|
|
category: res.data.category,
|
|
|
};
|
|
};
|
|
@@ -161,25 +155,23 @@ const RelationEditWidget = ({
|
|
|
label={intl.formatMessage({ id: "forms.fields.name.label" })}
|
|
label={intl.formatMessage({ id: "forms.fields.name.label" })}
|
|
|
/>
|
|
/>
|
|
|
</ProForm.Group>
|
|
</ProForm.Group>
|
|
|
- <ProForm.Group title="from">
|
|
|
|
|
- <GrammarSelect />
|
|
|
|
|
|
|
+ <ProForm.Group title="从">
|
|
|
|
|
+ <GrammarSelect name="fromCase" />
|
|
|
<ProFormText
|
|
<ProFormText
|
|
|
width="md"
|
|
width="md"
|
|
|
name="fromSpell"
|
|
name="fromSpell"
|
|
|
label={intl.formatMessage({ id: "buttons.spell" })}
|
|
label={intl.formatMessage({ id: "buttons.spell" })}
|
|
|
/>
|
|
/>
|
|
|
</ProForm.Group>
|
|
</ProForm.Group>
|
|
|
- <ProForm.Group>
|
|
|
|
|
- <ProFormSelect
|
|
|
|
|
- options={verbOptions}
|
|
|
|
|
- fieldProps={{
|
|
|
|
|
- mode: "tags",
|
|
|
|
|
- }}
|
|
|
|
|
|
|
+ <ProForm.Group title="连接到">
|
|
|
|
|
+ <GrammarSelect name="toCase" />
|
|
|
|
|
+ <ProFormText
|
|
|
width="md"
|
|
width="md"
|
|
|
- name="to"
|
|
|
|
|
- allowClear={false}
|
|
|
|
|
- label={intl.formatMessage({ id: "forms.fields.to.label" })}
|
|
|
|
|
|
|
+ name="toSpell"
|
|
|
|
|
+ label={intl.formatMessage({ id: "buttons.spell" })}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ </ProForm.Group>
|
|
|
|
|
+ <ProForm.Group>
|
|
|
<ProFormSelect
|
|
<ProFormSelect
|
|
|
options={["gender", "number", "case"].map((item) => {
|
|
options={["gender", "number", "case"].map((item) => {
|
|
|
return {
|
|
return {
|
|
@@ -195,8 +187,6 @@ const RelationEditWidget = ({
|
|
|
allowClear={false}
|
|
allowClear={false}
|
|
|
label={intl.formatMessage({ id: "forms.fields.match.label" })}
|
|
label={intl.formatMessage({ id: "forms.fields.match.label" })}
|
|
|
/>
|
|
/>
|
|
|
- </ProForm.Group>
|
|
|
|
|
- <ProForm.Group>
|
|
|
|
|
<ProFormText
|
|
<ProFormText
|
|
|
width="md"
|
|
width="md"
|
|
|
name="category"
|
|
name="category"
|