visuddhinanda пре 2 година
родитељ
комит
8bc2193440
1 измењених фајлова са 46 додато и 11 уклоњено
  1. 46 11
      dashboard/src/components/term/TermEdit.tsx

+ 46 - 11
dashboard/src/components/term/TermEdit.tsx

@@ -37,6 +37,7 @@ export interface ITerm {
   channel?: string[];
   channel?: string[];
   channelId?: string;
   channelId?: string;
   lang?: string;
   lang?: string;
+  copy?: string;
 }
 }
 
 
 interface IWidget {
 interface IWidget {
@@ -124,6 +125,7 @@ const TermEditWidget = ({
           studioName: studioName,
           studioName: studioName,
           studioId: parentStudioId,
           studioId: parentStudioId,
           language: values.lang,
           language: values.lang,
+          copy: values.copy,
         };
         };
         console.log("value", newValue);
         console.log("value", newValue);
         let res: ITermResponse;
         let res: ITermResponse;
@@ -283,6 +285,7 @@ const TermEditWidget = ({
         <ChannelSelect
         <ChannelSelect
           channelId={channelId}
           channelId={channelId}
           parentChannelId={parentChannelId}
           parentChannelId={parentChannelId}
+          parentStudioId={parentStudioId}
           width="md"
           width="md"
           name="channel"
           name="channel"
           placeholder="通用于此Studio"
           placeholder="通用于此Studio"
@@ -295,18 +298,50 @@ const TermEditWidget = ({
         />
         />
         <ProFormDependency name={["channel"]}>
         <ProFormDependency name={["channel"]}>
           {({ channel }) => {
           {({ channel }) => {
-            console.log("channel", channel);
-
+            let noChange = true;
+            if (!channel || channel.length === 0 || channel[0] === "") {
+              if (!channelId || channelId === null || channelId === "") {
+                noChange = true;
+              } else {
+                noChange = false;
+              }
+            } else {
+              if (channel[0] === channelId) {
+                noChange = true;
+              } else {
+                noChange = false;
+              }
+            }
             return (
             return (
-              <LangSelect
-                disabled={
-                  channel
-                    ? channel.length === 0 || channel[0] === ""
-                      ? false
-                      : true
-                    : false
-                }
-              />
+              <Space>
+                <LangSelect
+                  disabled={
+                    channel
+                      ? channel.length === 0 || channel[0] === ""
+                        ? false
+                        : true
+                      : false
+                  }
+                />
+                <ProFormSelect
+                  initialValue={"move"}
+                  name="copy"
+                  allowClear={false}
+                  label=" "
+                  hidden={!id || noChange}
+                  placeholder="Please select other meanings"
+                  options={[
+                    {
+                      value: "move",
+                      label: "move",
+                    },
+                    {
+                      value: "copy",
+                      label: "copy",
+                    },
+                  ]}
+                />
+              </Space>
             );
             );
           }}
           }}
         </ProFormDependency>
         </ProFormDependency>