Explorar o código

添加 match支持

visuddhinanda %!s(int64=2) %!d(string=hai) anos
pai
achega
a2e9e7ab28

+ 18 - 0
dashboard/src/components/admin/relation/RelationEdit.tsx

@@ -141,6 +141,7 @@ const RelationEditWidget = ({
                   fromCase: res.data.from?.case,
                   fromSpell: res.data.from?.spell,
                   to: res.data.to,
+                  match: res.data.match,
                   category: res.data.category,
                 };
               } else {
@@ -179,6 +180,23 @@ const RelationEditWidget = ({
           allowClear={false}
           label={intl.formatMessage({ id: "forms.fields.to.label" })}
         />
+        <ProFormSelect
+          options={["gender", "number", "case"].map((item) => {
+            return {
+              value: item,
+              label: item,
+            };
+          })}
+          fieldProps={{
+            mode: "tags",
+          }}
+          width="md"
+          name="match"
+          allowClear={false}
+          label={intl.formatMessage({ id: "forms.fields.match.label" })}
+        />
+      </ProForm.Group>
+      <ProForm.Group>
         <ProFormText
           width="md"
           name="category"

+ 1 - 0
dashboard/src/locales/zh-Hans/forms.ts

@@ -69,6 +69,7 @@ const items = {
   "forms.fields.nickname.label": "昵称",
   "forms.fields.editor.label": "编辑者",
   "forms.fields.category.label": "分类",
+  "forms.fields.match.label": "匹配方式",
 };
 
 export default items;

+ 13 - 1
dashboard/src/pages/admin/relation/list.tsx

@@ -50,6 +50,7 @@ export interface IRelationRequest {
   case?: string | null;
   from?: IFrom | null;
   to?: string[];
+  match?: string[];
   category?: string;
   category_channel?: string;
   category_term?: ITerm;
@@ -85,6 +86,7 @@ export interface IRelation {
   fromCase?: string[];
   fromSpell?: string;
   to?: string[];
+  match?: string[];
   category?: string;
   category_channel?: string;
   category_term?: ITerm;
@@ -94,7 +96,6 @@ export interface IRelation {
 }
 const Widget = () => {
   const intl = useIntl(); //i18n
-  const terms = useAppSelector(getTerm);
 
   const showDeleteConfirm = (id?: string, title?: string) => {
     Modal.confirm({
@@ -240,6 +241,16 @@ const Widget = () => {
               ));
             },
           },
+          {
+            title: intl.formatMessage({
+              id: "forms.fields.match.label",
+            }),
+            dataIndex: "to",
+            key: "to",
+            render: (text, row, index, action) => {
+              return row.match?.map((item, id) => <Tag key={id}>{item}</Tag>);
+            },
+          },
           {
             title: intl.formatMessage({
               id: "forms.fields.category.label",
@@ -377,6 +388,7 @@ const Widget = () => {
               case: item.case,
               from: item.from,
               to: item.to,
+              match: item.match,
               category: item.category,
               category_channel: item.category_channel,
               category_term: item.category_term,