Kaynağa Gözat

fix(bug): metadata

lind 3 yıl önce
ebeveyn
işleme
013cd763f6

+ 2 - 0
src/components/Upload/index.tsx

@@ -15,6 +15,7 @@ interface Props {
   type?: 'file' | 'image';
   placeholder: string;
   display?: string;
+  beforeUpload: any;
 }
 
 type FileProperty = {
@@ -91,6 +92,7 @@ const FUpload = connect((props: Props) => {
   });
   return (
     <Upload
+      beforeUpload={props.beforeUpload}
       listType={map.get(props.type || 'image')?.type}
       action={`/${SystemConst.API_BASE}/file/static`}
       headers={{

+ 6 - 2
src/pages/device/components/Metadata/Import/index.tsx

@@ -137,6 +137,7 @@ const Import = (props: Props) => {
               formatOnPaste: true,
               type: 'file',
               beforeUpload: (file: any) => {
+                console.log(file, 'fff');
                 const reader = new FileReader();
                 reader.readAsText(file);
                 reader.onload = (json) => {
@@ -182,6 +183,7 @@ const Import = (props: Props) => {
     if (data.metadata === 'alink') {
       service.convertMetadata('to', 'alink', data.import).subscribe({
         next: async (meta) => {
+          message.success('导入成功');
           await service.modify(param.id, { metadata: JSON.stringify(meta) });
         },
         error: () => {
@@ -189,10 +191,12 @@ const Import = (props: Props) => {
         },
       });
     } else {
-      await service.modify(param.id, { metadata: data[data.type] });
+      const resp = await service.modify(param.id, { metadata: data[data.type] });
+      if (resp.status === '200') {
+        message.success('导入成功');
+      }
     }
     Store.set(SystemConst.GET_METADATA, true);
-    message.success('导入成功');
     props.close();
   };
   return (

+ 9 - 0
src/pages/rule-engine/Alarm/Configuration/index.tsx

@@ -36,6 +36,15 @@ const Configuration = () => {
     {
       title: '类型',
       dataIndex: 'targetType',
+      renderText: (text: string) => {
+        const map = {
+          product: '产品',
+          device: '设备',
+          org: '部门',
+          other: '其他',
+        };
+        return map[text];
+      },
     },
     {
       title: '告警级别',