hear 3 лет назад
Родитель
Сommit
81b1478af1

+ 12 - 9
src/pages/device/Instance/Detail/Functions/form.tsx

@@ -66,15 +66,17 @@ export default (props: FunctionProps) => {
         return <MetadataJsonInput json={record.json} />;
       case 'date':
         return (
-          <>
-            {
-              // @ts-ignore
-              <DatePicker
-                format={record.format || 'YYYY-MM-DD HH:mm:ss'}
-                style={{ width: '100%' }}
-              />
-            }
-          </>
+          // <>
+          //   {
+          //     // @ts-ignore
+          //     <DatePicker
+          //       format={record.format || 'YYYY-MM-DD HH:mm:ss'}
+          //       style={{ width: '100%' }}
+          //     />
+          //   }
+          // </>
+          // @ts-ignore
+          <DatePicker format={'YYYY-MM-DD HH:mm:ss'} style={{ width: '100%' }} />
         );
       default:
         return <Input placeholder={'请输入' + name} />;
@@ -183,6 +185,7 @@ export default (props: FunctionProps) => {
   ];
 
   const handleDataSource = (data: any) => {
+    // console.log(data,1111)
     const array = [];
     const properties = data.valueType ? data.valueType.properties : data.inputs;
     for (const datum of properties) {

+ 21 - 0
src/pages/device/Instance/Detail/MapChannel/index.less

@@ -4,3 +4,24 @@
   justify-content: flex-end;
   margin-bottom: 10px;
 }
+.array-table {
+  .ant-formily-array-table
+    .ant-table
+    td
+    .ant-formily-item:not(.ant-formily-item-feedback-layout-popover)
+    .ant-formily-item-help {
+    position: inherit;
+    top: 100%;
+    z-index: 1;
+    width: 100%;
+    margin-top: 3px;
+    padding: 3px;
+    font-size: 12px;
+    background: #fff;
+    border-radius: 3px;
+    box-shadow: 0 0 10px #eee;
+    transform: translateY(0);
+    opacity: 1;
+    animation: none;
+  }
+}

+ 6 - 4
src/pages/device/Instance/Detail/MapChannel/index.tsx

@@ -246,7 +246,7 @@ const MapChannel = (props: Props) => {
                 title: (
                   <>
                     采集器
-                    <Tooltip title="边缘网关代理的真实物理设备">
+                    <Tooltip title="数据采集中配置的真实物理设备">
                       <QuestionCircleOutlined />
                     </Tooltip>
                   </>
@@ -458,9 +458,11 @@ const MapChannel = (props: Props) => {
               保存
             </Button>
           </div>
-          <FormProvider form={form}>
-            <SchemaField schema={schema} scope={{ useAsyncDataSource, getCollector, getPoint }} />
-          </FormProvider>
+          <div className="array-table">
+            <FormProvider form={form}>
+              <SchemaField schema={schema} scope={{ useAsyncDataSource, getCollector, getPoint }} />
+            </FormProvider>
+          </div>
         </>
       )}
       {visible && (

+ 9 - 6
src/pages/device/components/Metadata/Base/Edit/index.tsx

@@ -230,12 +230,15 @@ const Edit = observer((props: Props) => {
     properties: {
       type: {
         title: schemaTitleMapping[MetadataModel.type].title,
-        'x-validator': [
-          {
-            required: true,
-            message: `请选择${schemaTitleMapping[MetadataModel.type].title}`,
-          },
-        ],
+        'x-validator':
+          MetadataModel.type !== 'functions'
+            ? [
+                {
+                  required: true,
+                  message: `请选择${schemaTitleMapping[MetadataModel.type].title}`,
+                },
+              ]
+            : [],
         'x-decorator': 'FormItem',
         'x-component': 'Select',
         default: MetadataModel.type === 'events' ? 'object' : null,

+ 2 - 0
src/pages/link/DataCollect/components/Channel/index.tsx

@@ -62,6 +62,7 @@ export default observer((props: Props) => {
       title: '状态',
       dataIndex: 'state',
       valueType: 'select',
+      hideInSearch: true,
       valueEnum: {
         enabled: {
           text: '正常',
@@ -77,6 +78,7 @@ export default observer((props: Props) => {
       title: '运行状态',
       dataIndex: 'runningState',
       valueType: 'select',
+      hideInSearch: true,
       valueEnum: {
         running: {
           text: '运行中',

+ 24 - 23
src/pages/link/DataCollect/components/Tree/index.tsx

@@ -9,14 +9,14 @@ import {
 import { Button, Input, Tree, Space, Popconfirm, Tooltip } from 'antd';
 import { observer } from '@formily/react';
 import { model } from '@formily/reactive';
-import { BadgeStatus, Empty, PermissionButton } from '@/components';
+import { Empty, PermissionButton } from '@/components';
 import styles from './index.less';
 import service from '@/pages/link/DataCollect/service';
 import { useEffect } from 'react';
 import Save from '../../components/Channel/Save/index';
 import CollectorSave from '../../components/Device/Save/index';
 import { onlyMessage } from '@/utils/util';
-import { StatusColorEnum } from '@/components/BadgeStatus';
+// import { StatusColorEnum } from '@/components/BadgeStatus';
 import { useIntl } from '@@/plugin-locale/localeExports';
 
 const TreeModel = model<{
@@ -76,25 +76,25 @@ export default observer((props: Props) => {
     handleSearch(TreeModel.param);
   }, [TreeModel.param, props.reload]);
 
-  const getState = (record: Partial<ChannelItem>): { text: string; value: string } => {
-    if (record) {
-      if (record?.state?.value === 'enabled') {
-        return {
-          text: record?.runningState?.text || '',
-          value: record?.runningState?.value || '',
-        };
-      } else {
-        return {
-          text: '禁用',
-          value: 'disabled',
-        };
-      }
-    }
-    return {
-      text: '',
-      value: '',
-    };
-  };
+  // const getState = (record: Partial<ChannelItem>): { text: string; value: string } => {
+  //   if (record) {
+  //     if (record?.state?.value === 'enabled') {
+  //       return {
+  //         text: record?.runningState?.text || '',
+  //         value: record?.runningState?.value || '',
+  //       };
+  //     } else {
+  //       return {
+  //         text: '禁用',
+  //         value: 'disabled',
+  //       };
+  //     }
+  //   }
+  //   return {
+  //     text: '',
+  //     value: '',
+  //   };
+  // };
 
   return (
     <div>
@@ -146,7 +146,7 @@ export default observer((props: Props) => {
                       >
                         <img width={'20px'} style={{ marginRight: 5 }} src={channelImg} />
                         <div className={'ellipsis'}>
-                          <BadgeStatus
+                          {/* <BadgeStatus
                             status={
                               item && getState(item) && getState(item)?.value
                                 ? getState(item).value
@@ -160,7 +160,8 @@ export default observer((props: Props) => {
                               failed: StatusColorEnum.error,
                               stopped: StatusColorEnum.default,
                             }}
-                          />
+                          /> */}
+                          {item.name}
                         </div>
                       </div>
                       <div>