Bläddra i källkod

fix: 合并冲突

sun-chaochao 3 år sedan
förälder
incheckning
a853542b44

+ 20 - 8
src/components/ProTableCard/CardItems/AccessConfig/index.tsx

@@ -50,16 +50,28 @@ export default (props: AccessConfigCardProps) => {
               {props?.channelInfo?.name && (
                 <div className="server">
                   <div className="subTitle">{props?.channelInfo?.name}</div>
-                  <div className="serverItem">
-                    {props.channelInfo?.addresses.slice(0, 1).map((i: any, index: number) => (
-                      <div className="subItem" key={i.address + `_address${index}`}>
-                        <Tooltip placement="topLeft" title={i.address}>
+                  <Tooltip
+                    placement="topLeft"
+                    title={
+                      <div>
+                        {[...props.channelInfo?.addresses].map((i: any, index: number) => (
+                          <div key={i.address + `_address${index}`}>
+                            <Badge color={i.health === -1 ? 'red' : 'green'} />
+                            {i.address}
+                          </div>
+                        ))}
+                      </div>
+                    }
+                  >
+                    <div className="serverItem">
+                      {props.channelInfo?.addresses.slice(0, 1).map((i: any, index: number) => (
+                        <div className="subItem" key={i.address + `_address${index}`}>
                           <Badge color={i.health === -1 ? 'red' : 'green'} />
                           {i.address}
-                        </Tooltip>
-                      </div>
-                    ))}
-                  </div>
+                        </div>
+                      ))}
+                    </div>
+                  </Tooltip>
                 </div>
               )}
               {props.protocolDetail?.name && (

+ 23 - 2
src/pages/account/NotificationRecord/index.tsx

@@ -1,7 +1,7 @@
 import { useIntl } from '@/.umi/plugin-locale/localeExports';
 import PermissionButton from '@/components/PermissionButton';
 import SearchComponent from '@/components/SearchComponent';
-import { ReadOutlined, SearchOutlined } from '@ant-design/icons';
+import Icon, { SearchOutlined } from '@ant-design/icons';
 import { PageContainer } from '@ant-design/pro-layout';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
@@ -12,6 +12,7 @@ import Service from './service';
 import encodeQuery from '@/utils/encodeQuery';
 import { useDomFullHeight } from '@/hooks';
 import { onlyMessage } from '@/utils/util';
+import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon';
 
 export const service = new Service('notifications');
 
@@ -34,6 +35,25 @@ const NotificationRecord = () => {
     });
   }, []);
 
+  const ReadSvg = () => (
+    <svg
+      width="1em"
+      height="1em"
+      viewBox="0 0 24 24"
+      fill="none"
+      xmlns="http://www.w3.org/2000/svg"
+    >
+      <path
+        d="M12 18H6L2 22V2C2 2 2.9 2 4 2H20C21.1 2 22 2 22 2V11H20V4H4V16H12V18ZM23 14.34L21.59 12.93L17.35 17.17L15.23 15.05L13.82 16.46L17.34 20L23 14.34Z"
+        fill="currentColor"
+      />
+    </svg>
+  );
+
+  const ReadIcon = (props: Partial<CustomIconComponentProps>) => (
+    <Icon component={ReadSvg} {...props} />
+  );
+
   const columns: ProColumns<NotifitionRecord>[] = [
     {
       dataIndex: 'topicProvider',
@@ -112,7 +132,8 @@ const NotificationRecord = () => {
             },
           }}
         >
-          <ReadOutlined />
+          {/* <ReadOutlined /> */}
+          <ReadIcon />
         </PermissionButton>,
         <PermissionButton
           key={'action'}

+ 3 - 0
src/pages/account/NotificationRecord/mark_chat_read.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12 18H6L2 22V2C2 2 2.9 2 4 2H20C21.1 2 22 2 22 2V11H20V4H4V16H12V18ZM23 14.34L21.59 12.93L17.35 17.17L15.23 15.05L13.82 16.46L17.34 20L23 14.34Z" fill="#323232"/>
+</svg>

+ 29 - 28
src/pages/device/Instance/Detail/Config/index.tsx

@@ -143,34 +143,35 @@ const Config = () => {
       </div>
       <div>
         {(metadata || []).map((i) => (
-          <Descriptions
-            size="small"
-            column={3}
-            key={i.name}
-            bordered
-            title={<h4 style={{ fontSize: 15 }}>{i.name}</h4>}
-          >
-            {(i?.properties || []).map((item: any) => (
-              <Descriptions.Item
-                span={1}
-                label={
-                  item?.description ? (
-                    <div>
-                      <span style={{ marginRight: '10px' }}>{item.name}</span>
-                      <Tooltip title={item.description}>
-                        <QuestionCircleOutlined />
-                      </Tooltip>
-                    </div>
-                  ) : (
-                    item.name
-                  )
-                }
-                key={item.property}
-              >
-                {renderComponent(item)}
-              </Descriptions.Item>
-            ))}
-          </Descriptions>
+          <div key={i.name} style={{ marginBottom: 20 }}>
+            <Descriptions
+              size="small"
+              column={3}
+              bordered
+              title={<h4 style={{ fontSize: 15 }}>{i.name}</h4>}
+            >
+              {(i?.properties || []).map((item: any) => (
+                <Descriptions.Item
+                  span={1}
+                  label={
+                    item?.description ? (
+                      <div>
+                        <span style={{ marginRight: '10px' }}>{item.name}</span>
+                        <Tooltip title={item.description}>
+                          <QuestionCircleOutlined />
+                        </Tooltip>
+                      </div>
+                    ) : (
+                      item.name
+                    )
+                  }
+                  key={item.property}
+                >
+                  {renderComponent(item)}
+                </Descriptions.Item>
+              ))}
+            </Descriptions>
+          </div>
         ))}
       </div>
       {visible && (

+ 6 - 2
src/pages/device/Instance/Detail/MetadataMap/index.tsx

@@ -134,7 +134,6 @@ const MetadataMap = (props: Props) => {
           </span>
         );
       }
-
       if (!description) {
         return <EditableTable data={data} type={type} />;
       } else {
@@ -157,7 +156,12 @@ const MetadataMap = (props: Props) => {
   }, [props.type]);
 
   return (
-    <Card bordered={false} className="device-detail-metadataMap" style={{ minHeight }}>
+    <Card
+      bordered={false}
+      bodyStyle={{ padding: type === 'device' ? 24 : 0 }}
+      className="device-detail-metadataMap"
+      style={{ minHeight }}
+    >
       {renderComponent()}
     </Card>
   );

+ 1 - 0
src/pages/device/Instance/Detail/Running/Property/EditProperty.tsx

@@ -5,6 +5,7 @@ import { createSchemaField, FormProvider } from '@formily/react';
 import { service } from '@/pages/device/Instance';
 import { useParams } from 'umi';
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
+import { onlyMessage } from '@/utils/util';
 
 interface Props {
   data: Partial<PropertyMetadata>;

+ 2 - 2
src/pages/device/Instance/Detail/Running/Property/Indicators.tsx

@@ -180,10 +180,10 @@ const Indicators = (props: Props) => {
       service.queryMetric(InstanceModel.detail.id || '', data.id || '').then((resp) => {
         if (resp.status === 200) {
           if ((resp?.result || []).length > 0) {
-            const list = resp.result.map((item: any) => {
+            const list = resp?.result.map((item: any) => {
               return {
                 ...item,
-                value: item.value.split(','),
+                value: Array.isArray(item?.value) ? item?.value : item?.value?.split(','),
               };
             });
             setMetrics(list);

+ 59 - 21
src/pages/device/Instance/Detail/Running/Property/index.tsx

@@ -1,9 +1,14 @@
-import { Col, Empty, Input, Pagination, Row, Space, Spin, Table } from 'antd';
+import { Col, Empty, Input, Pagination, Row, Space, Spin, Table, Tooltip } from 'antd';
 import CheckButton from '@/components/CheckButton';
 import { useCallback, useEffect, useRef, useState } from 'react';
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
 import PropertyCard from './PropertyCard';
-import { EditOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons';
+import {
+  ClockCircleOutlined,
+  EditOutlined,
+  SyncOutlined,
+  UnorderedListOutlined,
+} from '@ant-design/icons';
 import { InstanceModel, service } from '@/pages/device/Instance';
 import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
 import { map } from 'rxjs/operators';
@@ -14,6 +19,7 @@ import styles from './index.less';
 import { groupBy, throttle, toArray } from 'lodash';
 import PropertyTable from './PropertyTable';
 import { onlyMessage } from '@/utils/util';
+import Indicators from './Indicators';
 
 interface Props {
   data: Partial<PropertyMetadata>[];
@@ -44,6 +50,7 @@ const Property = (props: Props) => {
     pageSize: 8,
     currentPage: 0,
   });
+  const [indicatorVisible, setIndicatorVisible] = useState<boolean>(false);
   const [loading, setLoading] = useState<boolean>(true);
 
   const [check, setCheck] = useState<boolean>(true);
@@ -83,30 +90,53 @@ const Property = (props: Props) => {
       key: 'action',
       render: (text: any, record: any) => (
         <Space size="middle">
-          {(record.expands?.readOnly === false || record.expands?.readOnly === 'false') && (
+          {record.expands?.type?.includes('write') && (
+            <Tooltip placement="top" title="设置属性至设备">
+              <a
+                onClick={() => {
+                  setVisible(true);
+                }}
+              >
+                <EditOutlined />
+              </a>
+            </Tooltip>
+          )}
+          {(record.expands?.metrics || []).length > 0 &&
+            ['int', 'long', 'float', 'double', 'string', 'boolean', 'date'].includes(
+              record.valueType?.type || '',
+            ) && (
+              <Tooltip placement="top" title="指标">
+                <a
+                  onClick={() => {
+                    setIndicatorVisible(true);
+                    setCurrentInfo(record);
+                  }}
+                >
+                  <ClockCircleOutlined />
+                </a>
+              </Tooltip>
+            )}
+          {record.expands?.type?.includes('read') && (
+            <Tooltip placement="top" title="获取最新属性值">
+              <a
+                onClick={() => {
+                  refreshProperty(record?.id);
+                }}
+              >
+                <SyncOutlined />
+              </a>
+            </Tooltip>
+          )}
+          <Tooltip placement="top" title="详情">
             <a
               onClick={() => {
-                setVisible(true);
+                setCurrentInfo(record);
+                setInfoVisible(true);
               }}
             >
-              <EditOutlined />
+              <UnorderedListOutlined />
             </a>
-          )}
-          <a
-            onClick={() => {
-              refreshProperty(record?.id);
-            }}
-          >
-            <SyncOutlined />
-          </a>
-          <a
-            onClick={() => {
-              setCurrentInfo(record);
-              setInfoVisible(true);
-            }}
-          >
-            <UnorderedListOutlined />
-          </a>
+          </Tooltip>
         </Space>
       ),
     },
@@ -318,6 +348,14 @@ const Property = (props: Props) => {
         />
       )}
       {infoVisible && <PropertyLog data={currentInfo} close={() => setInfoVisible(false)} />}
+      {indicatorVisible && (
+        <Indicators
+          data={currentInfo}
+          onCancel={() => {
+            setIndicatorVisible(false);
+          }}
+        />
+      )}
     </div>
   );
 };

+ 1 - 0
src/pages/device/Product/Detail/Access/AccessConfig/index.tsx

@@ -129,6 +129,7 @@ const AccessConfig = (props: Props) => {
         <SearchComponent
           field={columns}
           enableSave={false}
+          model="simple"
           onSearch={(data: any) => {
             const dt = {
               pageSize: 4,

+ 80 - 64
src/pages/device/Product/Detail/index.tsx

@@ -33,6 +33,76 @@ const ProductDetail = observer(() => {
   const location = useLocation();
   const history = useHistory();
 
+  const initList = [
+    {
+      key: 'base',
+      tab: intl.formatMessage({
+        id: 'pages.device.productDetail.base',
+        defaultMessage: '配置信息',
+      }),
+      component: (
+        <BaseInfo
+          onJump={(type) => {
+            if (type) {
+              setMode(type);
+            }
+          }}
+        />
+      ),
+    },
+    {
+      key: 'metadata',
+      tab: (
+        <>
+          {intl.formatMessage({
+            id: 'pages.device.instanceDetail.metadata',
+            defaultMessage: '物模型',
+          })}
+          <Tooltip
+            title={
+              <>
+                属性:
+                <br />
+                用于描述设备运行时具体信息和状态。
+                <br />
+                功能:
+                <br />
+                指设备可供外部调用的指令或方法。
+                <br />
+                事件:
+                <br />
+                设备运行时,主动上报给云端的信息。
+                <br />
+                标签:
+                <br />
+                统一为设备添加拓展字段,添加后将在设备信息页显示。
+              </>
+            }
+          >
+            <QuestionCircleOutlined style={{ marginLeft: 5 }} />
+          </Tooltip>
+        </>
+      ),
+      component: <Metadata type="product" />,
+    },
+    {
+      key: 'access',
+      tab: '设备接入',
+      component: <Access />,
+    },
+  ];
+
+  const pList = [
+    'websocket-server',
+    'http-server-gateway',
+    'udp-device-gateway',
+    'coap-server-gateway',
+    'mqtt-client-gateway',
+    'mqtt-server-gateway',
+    'tcp-server-gateway',
+  ];
+  const [list, setList] = useState<any[]>([...initList]);
+
   const { minHeight } = useDomFullHeight('.product-detail-body');
 
   const { permission } = PermissionButton.usePermission('device/Product');
@@ -74,6 +144,16 @@ const ProductDetail = observer(() => {
         const metadata: DeviceMetadata = JSON.parse(data.metadata);
         MetadataAction.insert(metadata);
       }
+      if (data?.accessProvider && pList.includes(data?.accessProvider)) {
+        setList([
+          ...initList,
+          {
+            key: 'metadata-map',
+            tab: '物模型映射',
+            component: <MetadataMap type="product" />,
+          },
+        ]);
+      }
       service.instanceCount(encodeQuery({ terms: { productId: param?.id } })).then((res: any) => {
         if (res.status === 200) {
           productModel.current = { ...data, count: res.result };
@@ -146,70 +226,6 @@ const ProductDetail = observer(() => {
     return subscription.unsubscribe;
   }, [changeDeploy, param.id]);
 
-  const list = [
-    {
-      key: 'base',
-      tab: intl.formatMessage({
-        id: 'pages.device.productDetail.base',
-        defaultMessage: '配置信息',
-      }),
-      component: (
-        <BaseInfo
-          onJump={(type) => {
-            if (type) {
-              setMode(type);
-            }
-          }}
-        />
-      ),
-    },
-    {
-      key: 'metadata',
-      tab: (
-        <>
-          {intl.formatMessage({
-            id: 'pages.device.instanceDetail.metadata',
-            defaultMessage: '物模型',
-          })}
-          <Tooltip
-            title={
-              <>
-                属性:
-                <br />
-                用于描述设备运行时具体信息和状态。
-                <br />
-                功能:
-                <br />
-                指设备可供外部调用的指令或方法。
-                <br />
-                事件:
-                <br />
-                设备运行时,主动上报给云端的信息。
-                <br />
-                标签:
-                <br />
-                统一为设备添加拓展字段,添加后将在设备信息页显示。
-              </>
-            }
-          >
-            <QuestionCircleOutlined style={{ marginLeft: 5 }} />
-          </Tooltip>
-        </>
-      ),
-      component: <Metadata type="product" />,
-    },
-    {
-      key: 'access',
-      tab: '设备接入',
-      component: <Access />,
-    },
-    {
-      key: 'metadata-map',
-      tab: '物模型映射',
-      component: <MetadataMap type="product" />,
-    },
-  ];
-
   useEffect(() => {
     const { state } = location;
     if (state && state?.tab) {

+ 29 - 15
src/pages/link/AccessConfig/Detail/Access/index.tsx

@@ -307,22 +307,36 @@ const Access = (props: Props) => {
                         </Tooltip>
                       </div>
                       <div className={styles.cardContent}>
-                        <div
-                          style={{
-                            width: '100%',
-                            height: '20px',
-                            display: 'flex',
-                            flexDirection: 'column',
-                            alignItems: 'center',
-                            justifyContent: 'center',
-                          }}
-                        >
-                          {item.addresses.slice(0, 1).map((i: any) => (
-                            <div className={styles.item} key={i.address}>
-                              <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
+                        <Tooltip
+                          placement="topLeft"
+                          title={
+                            <div>
+                              {[...item.addresses].map((i: any) => (
+                                <div key={i.address}>
+                                  <Badge color={i.health === -1 ? 'red' : 'green'} />
+                                  {i.address}
+                                </div>
+                              ))}
                             </div>
-                          ))}
-                        </div>
+                          }
+                        >
+                          <div
+                            style={{
+                              width: '100%',
+                              height: '20px',
+                              display: 'flex',
+                              flexDirection: 'column',
+                              alignItems: 'center',
+                              justifyContent: 'center',
+                            }}
+                          >
+                            {item.addresses.slice(0, 1).map((i: any) => (
+                              <div className={styles.item} key={i.address}>
+                                <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
+                              </div>
+                            ))}
+                          </div>
+                        </Tooltip>
                         <div className={styles.desc}>
                           <Tooltip
                             placement="topLeft"

+ 141 - 125
src/pages/link/AccessConfig/index.tsx

@@ -20,7 +20,7 @@ const AccessConfig = () => {
   const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
   const { permission } = PermissionButton.usePermission('link/AccessConfig');
 
-  const { minHeight } = useDomFullHeight(`.link-accessConfig`);
+  const { minHeight } = useDomFullHeight(`.link-accessConfig`, 36);
 
   const columns: ProColumns<any>[] = [
     {
@@ -102,133 +102,149 @@ const AccessConfig = () => {
           handleSearch(dt);
         }}
       />
-      <Card className={'link-accessConfig'} style={{ minHeight }}>
-        <div style={{ width: '100%', display: 'flex', justifyContent: 'flex-start' }}>
-          <PermissionButton
-            isPermission={permission.add}
-            onClick={() => {
-              history.push(`${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}`);
-            }}
-            key="button"
-            type="primary"
-          >
-            新增
-          </PermissionButton>
-        </div>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={12}>
-                <AccessConfigCard
-                  {...item}
-                  actions={[
-                    <PermissionButton
-                      isPermission={permission.update}
-                      onClick={() => {
-                        history.push(
-                          `${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}?id=${
-                            item.id
-                          }`,
-                        );
-                      }}
-                      key="button"
-                      type="link"
-                    >
-                      <EditOutlined />
-                      编辑
-                    </PermissionButton>,
-                    <PermissionButton
-                      type={'link'}
-                      key={'state'}
-                      style={{ padding: 0 }}
-                      popConfirm={{
-                        title: `确认${item.state.value !== 'disabled' ? '禁用' : '启用'}`,
-                        onConfirm: () => {
-                          if (item.state.value !== 'disabled') {
-                            service.shutDown(item.id).then((resp) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch(param);
-                              }
-                            });
-                          } else {
-                            service.startUp(item.id).then((resp) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch(param);
+      <Card>
+        <div style={{ position: 'relative', minHeight }} className={'link-accessConfig'}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            <div style={{ width: '100%', display: 'flex', justifyContent: 'flex-start' }}>
+              <PermissionButton
+                isPermission={permission.add}
+                onClick={() => {
+                  history.push(`${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}`);
+                }}
+                key="button"
+                type="primary"
+              >
+                新增
+              </PermissionButton>
+            </div>
+            {dataSource?.data.length > 0 ? (
+              <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
+                {(dataSource?.data || []).map((item: any) => (
+                  <Col key={item.id} span={12}>
+                    <AccessConfigCard
+                      {...item}
+                      actions={[
+                        <PermissionButton
+                          isPermission={permission.update}
+                          onClick={() => {
+                            history.push(
+                              `${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}?id=${
+                                item.id
+                              }`,
+                            );
+                          }}
+                          key="button"
+                          type="link"
+                        >
+                          <EditOutlined />
+                          编辑
+                        </PermissionButton>,
+                        <PermissionButton
+                          type={'link'}
+                          key={'state'}
+                          style={{ padding: 0 }}
+                          popConfirm={{
+                            title: `确认${item.state.value !== 'disabled' ? '禁用' : '启用'}`,
+                            onConfirm: () => {
+                              if (item.state.value !== 'disabled') {
+                                service.shutDown(item.id).then((resp) => {
+                                  if (resp.status === 200) {
+                                    onlyMessage('操作成功!');
+                                    handleSearch(param);
+                                  }
+                                });
+                              } else {
+                                service.startUp(item.id).then((resp) => {
+                                  if (resp.status === 200) {
+                                    onlyMessage('操作成功!');
+                                    handleSearch(param);
+                                  }
+                                });
                               }
-                            });
-                          }
-                        },
-                      }}
-                      isPermission={permission.action}
-                      tooltip={{
-                        title: item.state.value !== 'disabled' ? '禁用' : '启用',
-                      }}
-                    >
-                      {item.state.value !== 'disabled' ? <StopOutlined /> : <PlayCircleOutlined />}
-                      {item.state.value !== 'disabled' ? '禁用' : '启用'}
-                    </PermissionButton>,
-                    <PermissionButton
-                      isPermission={permission.delete}
-                      disabled={item.state.value !== 'disabled'}
-                      tooltip={{
-                        title: item.state.value !== 'disabled' ? '请先禁用,再删除' : '',
-                      }}
-                      popConfirm={{
-                        title: '确认删除',
-                        disabled: item.state.value !== 'disabled',
-                        onConfirm: () => {
-                          service.remove(item.id).then((resp: any) => {
-                            if (resp.status === 200) {
-                              onlyMessage('操作成功!');
-                              handleSearch(param);
-                            } else {
-                              onlyMessage(resp?.message || '操作失败', 'error');
-                            }
-                          });
-                        },
-                      }}
-                      key="delete"
-                      type="link"
-                    >
-                      <DeleteOutlined />
-                    </PermissionButton>,
-                  ]}
-                />
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <div style={{ height: minHeight - 150 }}>
-            <Empty />
+                            },
+                          }}
+                          isPermission={permission.action}
+                          tooltip={{
+                            title: item.state.value !== 'disabled' ? '禁用' : '启用',
+                          }}
+                        >
+                          {item.state.value !== 'disabled' ? (
+                            <StopOutlined />
+                          ) : (
+                            <PlayCircleOutlined />
+                          )}
+                          {item.state.value !== 'disabled' ? '禁用' : '启用'}
+                        </PermissionButton>,
+                        <PermissionButton
+                          isPermission={permission.delete}
+                          disabled={item.state.value !== 'disabled'}
+                          tooltip={{
+                            title: item.state.value !== 'disabled' ? '请先禁用,再删除' : '',
+                          }}
+                          popConfirm={{
+                            title: '确认删除',
+                            disabled: item.state.value !== 'disabled',
+                            onConfirm: () => {
+                              service.remove(item.id).then((resp: any) => {
+                                if (resp.status === 200) {
+                                  onlyMessage('操作成功!');
+                                  handleSearch(param);
+                                } else {
+                                  onlyMessage(resp?.message || '操作失败', 'error');
+                                }
+                              });
+                            },
+                          }}
+                          key="delete"
+                          type="link"
+                        >
+                          <DeleteOutlined />
+                        </PermissionButton>,
+                      ]}
+                    />
+                  </Col>
+                ))}
+              </Row>
+            ) : (
+              <div style={{ height: minHeight - 150 }}>
+                <Empty />
+              </div>
+            )}
           </div>
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+          {dataSource.data.length > 0 && (
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'flex-end',
+                position: 'absolute',
+                width: '100%',
+                bottom: 0,
               }}
-            />
-          </div>
-        )}
+            >
+              <Pagination
+                showSizeChanger
+                size="small"
+                className={'pro-table-card-pagination'}
+                total={dataSource?.total || 0}
+                current={dataSource?.pageIndex + 1}
+                onChange={(page, size) => {
+                  handleSearch({
+                    ...param,
+                    pageIndex: page - 1,
+                    pageSize: size,
+                  });
+                }}
+                pageSizeOptions={[10, 20, 50, 100]}
+                pageSize={dataSource?.pageSize}
+                showTotal={(num) => {
+                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+                }}
+              />
+            </div>
+          )}
+        </div>
       </Card>
     </PageContainer>
   );

+ 119 - 102
src/pages/media/Stream/index.tsx

@@ -26,7 +26,7 @@ const Stream = () => {
   const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
   const permissionCode = 'media/Stream';
   const { permission } = PermissionButton.usePermission(permissionCode);
-  const { minHeight } = useDomFullHeight(`.stream`);
+  const { minHeight } = useDomFullHeight(`.stream`, 36);
 
   const columns: ProColumns<StreamItem>[] = [
     {
@@ -77,108 +77,125 @@ const Stream = () => {
           });
         }}
       />
-      <Card className="stream" style={{ minHeight }}>
-        {dataSource.data.length > 0 ? (
-          <>
-            <PermissionButton
-              isPermission={permission.add}
-              onClick={() => {
-                history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
-                StreamModel.current = {};
-              }}
-              key="button"
-              icon={<PlusOutlined />}
-              type="primary"
-            >
-              新增
-            </PermissionButton>
-            <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
-              {(dataSource?.data || []).map((item: any) => (
-                <Col key={item.id} span={12}>
-                  <StreamCard
-                    {...item}
-                    actions={[
-                      <PermissionButton
-                        isPermission={permission.update}
-                        onClick={() => {
-                          history.push(
-                            `${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'], item.id)}`,
-                          );
-                          StreamModel.current = { ...item };
-                        }}
-                        key="button"
-                        type="link"
-                      >
-                        <EditOutlined />
-                        编辑
-                      </PermissionButton>,
-                      <PermissionButton
-                        isPermission={permission.delete}
-                        popConfirm={{
-                          title: '确认删除',
-                          onConfirm: () => {
-                            service.remove(item.id).then((resp: any) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch({ pageSize: 10, terms: [] });
-                              }
-                            });
-                          },
-                        }}
-                        key="delete"
-                        type="link"
-                      >
-                        <DeleteOutlined />
-                      </PermissionButton>,
-                    ]}
-                  />
-                </Col>
-              ))}
-            </Row>
-            <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-              <Pagination
-                showSizeChanger
-                size="small"
-                className={'pro-table-card-pagination'}
-                total={dataSource?.total || 0}
-                current={dataSource?.pageIndex + 1}
-                onChange={(page, size) => {
-                  handleSearch({
-                    ...param,
-                    pageIndex: page - 1,
-                    pageSize: size,
-                  });
-                }}
-                pageSizeOptions={[10, 20, 50, 100]}
-                pageSize={dataSource?.pageSize}
-                showTotal={(num) => {
-                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-                }}
+      <Card>
+        <div className="stream" style={{ position: 'relative', minHeight }}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            {dataSource.data.length > 0 ? (
+              <div>
+                <div>
+                  <PermissionButton
+                    isPermission={permission.add}
+                    onClick={() => {
+                      history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
+                      StreamModel.current = {};
+                    }}
+                    key="button"
+                    icon={<PlusOutlined />}
+                    type="primary"
+                  >
+                    新增
+                  </PermissionButton>
+                  <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
+                    {(dataSource?.data || []).map((item: any) => (
+                      <Col key={item.id} span={12}>
+                        <StreamCard
+                          {...item}
+                          actions={[
+                            <PermissionButton
+                              isPermission={permission.update}
+                              onClick={() => {
+                                history.push(
+                                  `${getMenuPathByParams(
+                                    MENUS_CODE['media/Stream/Detail'],
+                                    item.id,
+                                  )}`,
+                                );
+                                StreamModel.current = { ...item };
+                              }}
+                              key="button"
+                              type="link"
+                            >
+                              <EditOutlined />
+                              编辑
+                            </PermissionButton>,
+                            <PermissionButton
+                              isPermission={permission.delete}
+                              popConfirm={{
+                                title: '确认删除',
+                                onConfirm: () => {
+                                  service.remove(item.id).then((resp: any) => {
+                                    if (resp.status === 200) {
+                                      onlyMessage('操作成功!');
+                                      handleSearch({ pageSize: 10, terms: [] });
+                                    }
+                                  });
+                                },
+                              }}
+                              key="delete"
+                              type="link"
+                            >
+                              <DeleteOutlined />
+                            </PermissionButton>,
+                          ]}
+                        />
+                      </Col>
+                    ))}
+                  </Row>
+                </div>
+              </div>
+            ) : (
+              <Empty
+                style={{ marginTop: '10%' }}
+                description={
+                  <span>
+                    暂无数据,请先
+                    <Button
+                      type="link"
+                      disabled={getButtonPermission('media/Stream', ['add'])}
+                      onClick={() => {
+                        history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
+                        StreamModel.current = {};
+                      }}
+                    >
+                      新增流媒体服务
+                    </Button>
+                  </span>
+                }
               />
-            </div>
-          </>
-        ) : (
-          <Empty
-            style={{ marginTop: '10%' }}
-            description={
-              <span>
-                暂无数据,请先
-                <Button
-                  type="link"
-                  disabled={getButtonPermission('media/Stream', ['add'])}
-                  onClick={() => {
-                    history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
-                    StreamModel.current = {};
-                  }}
-                >
-                  新增流媒体服务
-                </Button>
-              </span>
-            }
-          />
-        )}
+            )}
+          </div>
+          <div
+            style={{
+              display: 'flex',
+              justifyContent: 'flex-end',
+              position: 'absolute',
+              bottom: 0,
+              width: '100%',
+            }}
+          >
+            <Pagination
+              showSizeChanger
+              size="small"
+              className={'pro-table-card-pagination'}
+              total={dataSource?.total || 0}
+              current={dataSource?.pageIndex + 1}
+              onChange={(page, size) => {
+                handleSearch({
+                  ...param,
+                  pageIndex: page - 1,
+                  pageSize: size,
+                });
+              }}
+              pageSizeOptions={[10, 20, 50, 100]}
+              pageSize={dataSource?.pageSize}
+              showTotal={(num) => {
+                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+              }}
+            />
+          </div>
+        </div>
       </Card>
     </PageContainer>
   );

+ 0 - 181
src/pages/rule-engine/Alarm/Log/TabComponent/index copy.less

@@ -1,181 +0,0 @@
-@import '~antd/es/style/themes/default.less';
-
-@alarm-log-padding-left: 60px;
-
-.ellipsis {
-  width: 100%;
-  overflow: hidden;
-  white-space: nowrap;
-  text-overflow: ellipsis;
-}
-
-.alarm-log-card {
-  .alarm-log-item {
-    display: flex;
-    margin-bottom: 20px;
-
-    .alarm-log-title {
-      position: relative;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      width: 15%;
-      padding: 10px;
-      overflow: hidden;
-      color: @primary-color;
-      background-color: #f0f2f3;
-      .alarm-log-level {
-        position: absolute;
-        top: 10px;
-        right: -12px;
-        display: flex;
-        justify-content: center;
-        width: 100px;
-        padding: 2px 0;
-        color: white;
-        background-color: red;
-        transform: skewX(45deg);
-        .alarm-log-text {
-          transform: skewX(-45deg);
-        }
-      }
-      .alarm-log-title-text {
-        margin: 0 10px;
-        .ellipsis();
-      }
-    }
-    .alarm-log-content {
-      display: flex;
-      align-items: center;
-      justify-content: space-between;
-      width: 87%;
-      padding: 20px;
-      background: url('/images/alarm/background.png') no-repeat;
-      background-size: 100% 100%;
-
-      .alarm-log-data {
-        display: flex;
-        align-items: center;
-        min-width: 60%;
-        max-width: 100%;
-
-        .alarm-log-image {
-          display: flex;
-          align-items: center;
-          padding-right: @alarm-log-padding-left;
-          border-right: 1px solid rgba(0, 0, 0, 0.09);
-
-          .alarm-type {
-            width: 40px;
-
-            .name {
-              color: #000;
-              font-size: 18px;
-            }
-
-            .text {
-              margin-top: 8px;
-              color: #666;
-              font-size: 14px;
-              .ellipsis();
-            }
-          }
-        }
-        .alarm-log-right {
-          display: flex;
-          justify-content: space-between;
-          width: 50%;
-          padding-left: @alarm-log-padding-left;
-
-          .alarm-log-time {
-            max-width: 165px;
-
-            .log-title {
-              margin-top: 8px;
-              color: #666;
-              font-size: 12px;
-            }
-
-            .context {
-              margin-top: 8px;
-              color: rgba(#000, 0.85);
-              font-size: 14px;
-              .ellipsis();
-            }
-          }
-
-          .alarm-log-status {
-            margin-left: @alarm-log-padding-left;
-          }
-        }
-      }
-      .alarm-log-actions {
-        .alarm-log-action {
-          display: flex;
-          justify-content: center;
-          width: 72px;
-          height: 72px;
-          background-color: #fff;
-          border: 1px solid @primary-color;
-
-          .btn {
-            display: flex;
-            flex-direction: column;
-            align-items: center;
-            justify-content: center;
-            width: 72px;
-            height: 72px;
-            .icon {
-              margin-bottom: 5px;
-              color: @primary-color;
-              font-size: 25px;
-            }
-
-            div {
-              color: @primary-color;
-              font-size: 12px;
-            }
-          }
-        }
-
-        .alarm-log-action:hover {
-          background-color: @primary-color;
-
-          .icon,
-          div {
-            color: #fff;
-          }
-        }
-        .alarm-log-disabled {
-          display: flex;
-          justify-content: center;
-          width: 72px;
-          height: 72px;
-          border: 1px solid rgba(0, 0, 0, 0.25);
-          .btn {
-            display: flex;
-            flex-direction: column;
-            align-items: center;
-            justify-content: center;
-            width: 72px;
-            height: 72px;
-            .icon {
-              margin-bottom: 5px;
-              color: rgba(0, 0, 0, 0.25);
-              font-size: 25px;
-            }
-
-            div {
-              color: rgba(0, 0, 0, 0.25);
-              font-size: 12px;
-            }
-          }
-        }
-      }
-    }
-  }
-
-  .alarm-log-item:hover {
-    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
-  }
-}

+ 0 - 307
src/pages/rule-engine/Alarm/Log/TabComponent/index copy.tsx

@@ -1,307 +0,0 @@
-import SearchComponent from '@/components/SearchComponent';
-import { FileFilled, FileTextFilled, ToolFilled } from '@ant-design/icons';
-import type { ProColumns } from '@jetlinks/pro-table';
-import { Badge, Button, Card, Col, Empty, Pagination, Row, Space, Tooltip } from 'antd';
-import { useEffect, useState } from 'react';
-import './index.less';
-import SolveComponent from '../SolveComponent';
-import SolveLog from '../SolveLog';
-import { AlarmLogModel } from '../model';
-import moment from 'moment';
-import { observer } from '@formily/reactive-react';
-import { service } from '@/pages/rule-engine/Alarm/Log';
-import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
-import { useHistory } from 'umi';
-import PermissionButton from '@/components/PermissionButton';
-import classNames from 'classnames';
-
-interface Props {
-  type: string;
-}
-
-const imgMap = new Map();
-imgMap.set('product', require('/public/images/alarm/product.png'));
-imgMap.set('device', require('/public/images/alarm/device.png'));
-imgMap.set('other', require('/public/images/alarm/other.png'));
-imgMap.set('org', require('/public/images/alarm/org.png'));
-
-const titleMap = new Map();
-titleMap.set('product', '产品');
-titleMap.set('device', '设备');
-titleMap.set('other', '其他');
-titleMap.set('org', '部门');
-
-const colorMap = new Map();
-colorMap.set(1, '#E50012');
-colorMap.set(2, '#FF9457');
-colorMap.set(3, '#FABD47');
-colorMap.set(4, '#999999');
-colorMap.set(5, '#C4C4C4');
-
-const TabComponent = observer((props: Props) => {
-  const { permission } = PermissionButton.usePermission('rule-engine/Alarm/Log');
-  const columns: ProColumns<any>[] = [
-    {
-      title: '名称',
-      dataIndex: 'alarmName',
-    },
-    {
-      title: '最近告警时间',
-      dataIndex: 'alarmTime',
-      valueType: 'dateTime',
-    },
-    {
-      title: '状态',
-      dataIndex: 'state',
-      valueType: 'select',
-      valueEnum: {
-        warning: {
-          text: '告警中',
-          status: 'warning',
-        },
-        normal: {
-          text: '无告警',
-          status: 'normal',
-        },
-      },
-    },
-  ];
-
-  const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
-  const history = useHistory<Record<string, string>>();
-
-  const [dataSource, setDataSource] = useState<any>({
-    data: [],
-    pageSize: 10,
-    pageIndex: 0,
-    total: 0,
-  });
-
-  const handleSearch = (params: any) => {
-    setParam(params);
-    const terms = [...params.terms];
-    if (props.type !== 'all') {
-      terms.push({
-        termType: 'eq',
-        column: 'targetType',
-        value: props.type,
-        type: 'and',
-      });
-    }
-    service
-      .query({
-        ...params,
-        terms: [...terms],
-        sorts: [{ name: 'alarmTime', order: 'desc' }],
-      })
-      .then((resp) => {
-        if (resp.status === 200) {
-          setDataSource(resp.result);
-        }
-      });
-  };
-
-  useEffect(() => {
-    handleSearch(param);
-  }, [props.type]);
-
-  return (
-    <div className="alarm-log-card">
-      <SearchComponent<any>
-        field={columns}
-        target="alarm-log"
-        onSearch={(data) => {
-          const dt = {
-            pageSize: 10,
-            terms: [...data?.terms],
-          };
-          handleSearch(dt);
-        }}
-      />
-      <Card>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={24} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={24}>
-                <div className="alarm-log-item">
-                  <div className="alarm-log-title">
-                    <div
-                      className="alarm-log-level"
-                      style={{ backgroundColor: colorMap.get(item.level) }}
-                    >
-                      <div className="alarm-log-text">
-                        {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)?.title ||
-                          item.level}
-                      </div>
-                    </div>
-                    <div className="alarm-log-title-text">
-                      <Tooltip placement="topLeft" title={item.alarmName}>
-                        {item.alarmName}
-                      </Tooltip>
-                    </div>
-                  </div>
-                  <div className="alarm-log-content">
-                    <div className="alarm-log-data">
-                      <div className="alarm-log-image">
-                        <img
-                          width={88}
-                          height={88}
-                          src={imgMap.get(props.type)}
-                          alt={''}
-                          style={{ marginRight: 20 }}
-                        />
-                        <div className="alarm-type">
-                          <div className="name">{titleMap.get(item.targetType)}</div>
-                          <div className="text">
-                            <Tooltip placement="topLeft" title={item.targetName}>
-                              {item.targetName}
-                            </Tooltip>
-                          </div>
-                        </div>
-                      </div>
-                      <div className="alarm-log-right">
-                        <div className="alarm-log-time">
-                          <div className="log-title">最近告警时间</div>
-                          <div className="context">
-                            {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
-                          </div>
-                        </div>
-                        <div
-                          className="alarm-log-time alarm-log-status"
-                          style={{ paddingLeft: 10 }}
-                        >
-                          <div className="log-title">状态</div>
-                          <div className="context">
-                            <Badge status={item.state.value === 'warning' ? 'error' : 'default'} />
-                            <span
-                              style={{
-                                color: item.state.value === 'warning' ? '#E50012' : 'black',
-                              }}
-                            >
-                              {item.state.text}
-                            </span>
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                    <div className="alarm-log-actions">
-                      <Space>
-                        {item.state.value === 'warning' && (
-                          <div
-                            className={classNames(
-                              permission.action ? 'alarm-log-action' : 'alarm-log-disabled',
-                            )}
-                          >
-                            <Tooltip title={permission.action ? '' : '暂无权限,请联系管理员'}>
-                              <Button
-                                type={'link'}
-                                disabled={!permission.action}
-                                onClick={() => {
-                                  AlarmLogModel.solveVisible = true;
-                                  AlarmLogModel.current = item;
-                                }}
-                              >
-                                <div className="btn">
-                                  <ToolFilled className="icon" />
-                                  <div>告警处理</div>
-                                </div>
-                              </Button>
-                            </Tooltip>
-                          </div>
-                        )}
-                        <div className="alarm-log-action">
-                          <Button
-                            type={'link'}
-                            onClick={() => {
-                              AlarmLogModel.current = item;
-                              const url = getMenuPathByParams(
-                                MENUS_CODE['rule-engine/Alarm/Log/Detail'],
-                                item.id,
-                              );
-                              history.push(url);
-                            }}
-                          >
-                            <div className="btn">
-                              <FileFilled className="icon" />
-                              <div>告警日志</div>
-                            </div>
-                          </Button>
-                        </div>
-                        <div className="alarm-log-action">
-                          <Button
-                            type={'link'}
-                            onClick={() => {
-                              AlarmLogModel.logVisible = true;
-                              AlarmLogModel.current = item;
-                            }}
-                          >
-                            <div className="btn">
-                              <FileTextFilled className="icon" />
-                              <div>处理记录</div>
-                            </div>
-                          </Button>
-                        </div>
-                      </Space>
-                    </div>
-                  </div>
-                </div>
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <Empty />
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-              }}
-            />
-          </div>
-        )}
-      </Card>
-      {AlarmLogModel.solveVisible && (
-        <SolveComponent
-          close={() => {
-            AlarmLogModel.solveVisible = false;
-            AlarmLogModel.current = {};
-          }}
-          reload={() => {
-            AlarmLogModel.solveVisible = false;
-            AlarmLogModel.current = {};
-            handleSearch(param);
-          }}
-          data={AlarmLogModel.current}
-        />
-      )}
-      {AlarmLogModel.logVisible && (
-        <SolveLog
-          close={() => {
-            AlarmLogModel.logVisible = false;
-            AlarmLogModel.current = {};
-          }}
-          data={AlarmLogModel.current}
-        />
-      )}
-    </div>
-  );
-});
-
-export default TabComponent;

+ 126 - 100
src/pages/rule-engine/Alarm/Log/TabComponent/index.tsx

@@ -14,6 +14,7 @@ import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
 import { useHistory } from 'umi';
 import classNames from 'classnames';
 import { useDomFullHeight } from '@/hooks';
+import PermissionButton from '@/components/PermissionButton';
 
 interface Props {
   type: string;
@@ -39,7 +40,9 @@ colorMap.set(4, '#999999');
 colorMap.set(5, '#C4C4C4');
 
 const TabComponent = observer((props: Props) => {
-  const { minHeight } = useDomFullHeight(`.alarmLog`);
+  const { minHeight } = useDomFullHeight(`.alarmLog`, 36);
+  const { permission } = PermissionButton.usePermission('rule-engine/Alarm/Log');
+
   const columns: ProColumns<any>[] = [
     {
       title: '名称',
@@ -106,21 +109,30 @@ const TabComponent = observer((props: Props) => {
   }, [props.type]);
 
   const tools = (record: any) => [
-    <Button
-      type={'link'}
+    <Tooltip
       key={'solve'}
-      style={{ padding: 0 }}
-      disabled={record.state.value === 'normal'}
-      onClick={() => {
-        AlarmLogModel.solveVisible = true;
-        AlarmLogModel.current = record;
-      }}
+      title={
+        !permission.action
+          ? '暂无权限,请联系管理员'
+          : record.state?.value === 'normal'
+          ? '无告警'
+          : ''
+      }
     >
-      <Tooltip title={record.state?.value === 'normal' ? '无告警' : ''}>
+      <Button
+        type={'link'}
+        key={'solve'}
+        style={{ padding: 0 }}
+        disabled={record.state.value === 'normal' || !permission.action}
+        onClick={() => {
+          AlarmLogModel.solveVisible = true;
+          AlarmLogModel.current = record;
+        }}
+      >
         <ToolFilled />
         告警处理
-      </Tooltip>
-    </Button>,
+      </Button>
+    </Tooltip>,
     <Button
       type={'link'}
       style={{ padding: 0 }}
@@ -180,104 +192,118 @@ const TabComponent = observer((props: Props) => {
           handleSearch(dt);
         }}
       />
-      <Card className="alarmLog" style={{ minHeight }}>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={[24, 24]} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={12}>
-                <div className={classNames('iot-card')}>
-                  <div className={'card-warp'}>
-                    <div className={classNames('card-content')}>
-                      <div
-                        style={{ fontSize: 20, fontWeight: 700, marginBottom: 20 }}
-                        className="ellipsis"
-                      >
-                        <Tooltip title={item.alarmName}>
-                          <a>{item.alarmName}</a>
-                        </Tooltip>
-                      </div>
-                      <div className="alarm-log-context">
-                        <div className="context-left">
-                          <div className="context-img">
-                            <img width={70} height={70} src={defaultImage} alt={''} />
+      <Card>
+        <div className="alarmLog" style={{ minHeight, position: 'relative' }}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            {dataSource?.data.length > 0 ? (
+              <Row gutter={[24, 24]} style={{ marginTop: 10 }}>
+                {(dataSource?.data || []).map((item: any) => (
+                  <Col key={item.id} span={12}>
+                    <div className={classNames('iot-card')}>
+                      <div className={'card-warp'}>
+                        <div className={classNames('card-content')}>
+                          <div
+                            style={{ fontSize: 20, fontWeight: 700, marginBottom: 20 }}
+                            className="ellipsis"
+                          >
+                            <Tooltip title={item.alarmName}>
+                              <a style={{ cursor: 'default' }}>{item.alarmName}</a>
+                            </Tooltip>
                           </div>
-                          <div className="left-item">
-                            <div className="left-item-title">{titleMap.get(item.targetType)}</div>
-                            <div className="left-item-value ellipsis">
-                              <Tooltip placement="topLeft" title={item.targetName}>
-                                {item.targetName}
-                              </Tooltip>
+                          <div className="alarm-log-context">
+                            <div className="context-left">
+                              <div className="context-img">
+                                <img width={70} height={70} src={defaultImage} alt={''} />
+                              </div>
+                              <div className="left-item">
+                                <div className="left-item-title">
+                                  {titleMap.get(item.targetType)}
+                                </div>
+                                <div className="left-item-value ellipsis">
+                                  <Tooltip placement="topLeft" title={item.targetName}>
+                                    {item.targetName}
+                                  </Tooltip>
+                                </div>
+                              </div>
                             </div>
-                          </div>
-                        </div>
-                        <div className="context-right">
-                          <div className="right-item">
-                            <div className="right-item-title">最近告警时间</div>
-                            <div className="right-item-value ellipsis">
-                              {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
+                            <div className="context-right">
+                              <div className="right-item">
+                                <div className="right-item-title">最近告警时间</div>
+                                <div className="right-item-value ellipsis">
+                                  {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
+                                </div>
+                              </div>
+                              <div className="right-item">
+                                <div className="right-item-title">状态</div>
+                                <div className="right-item-value">
+                                  <Badge
+                                    status={item.state.value === 'warning' ? 'error' : 'default'}
+                                  />
+                                  <span
+                                    style={{
+                                      color: item.state.value === 'warning' ? '#E50012' : 'black',
+                                    }}
+                                  >
+                                    {item.state.text}
+                                  </span>
+                                </div>
+                              </div>
                             </div>
                           </div>
-                          <div className="right-item">
-                            <div className="right-item-title">状态</div>
-                            <div className="right-item-value">
-                              <Badge
-                                status={item.state.value === 'warning' ? 'error' : 'default'}
-                              />
-                              <span
-                                style={{
-                                  color: item.state.value === 'warning' ? '#E50012' : 'black',
-                                }}
-                              >
-                                {item.state.text}
-                              </span>
+                          <div
+                            className={'alarm-log-state'}
+                            style={{ backgroundColor: colorMap.get(item.level) }}
+                          >
+                            <div className={'card-state-content'}>
+                              {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)
+                                ?.title || item.level}
                             </div>
                           </div>
                         </div>
                       </div>
-                      <div
-                        className={'alarm-log-state'}
-                        style={{ backgroundColor: colorMap.get(item.level) }}
-                      >
-                        <div className={'card-state-content'}>
-                          {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)?.title ||
-                            item.level}
-                        </div>
-                      </div>
+                      <div className={'card-tools'}>{getAction(tools(item))}</div>
                     </div>
-                  </div>
-                  <div className={'card-tools'}>{getAction(tools(item))}</div>
-                </div>
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <Empty style={{ marginTop: '10%' }} />
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-              }}
-            />
+                  </Col>
+                ))}
+              </Row>
+            ) : (
+              <Empty style={{ marginTop: '10%' }} />
+            )}
           </div>
-        )}
+          {dataSource.data.length > 0 && (
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'flex-end',
+                position: 'absolute',
+                bottom: 0,
+                width: '100%',
+              }}
+            >
+              <Pagination
+                showSizeChanger
+                size="small"
+                className={'pro-table-card-pagination'}
+                total={dataSource?.total || 0}
+                current={dataSource?.pageIndex + 1}
+                onChange={(page, size) => {
+                  handleSearch({
+                    ...param,
+                    pageIndex: page - 1,
+                    pageSize: size,
+                  });
+                }}
+                pageSizeOptions={[10, 20, 50, 100]}
+                pageSize={dataSource?.pageSize}
+                showTotal={(num) => {
+                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+                }}
+              />
+            </div>
+          )}
+        </div>
       </Card>
       {AlarmLogModel.solveVisible && (
         <SolveComponent

+ 4 - 2
src/pages/system/DataSource/Management/EditTable.tsx

@@ -121,12 +121,13 @@ const EditTable = (props: Props) => {
               'x-component-props': { title: '长度' },
               properties: {
                 length: {
-                  type: 'string',
+                  type: 'number',
                   'x-decorator': 'FormItem',
                   'x-component': 'NumberPicker',
                   'x-component-props': {
                     placeholder: '请输入长度',
                   },
+                  default: 0,
                   'x-validator': [
                     // {
                     //   required: true,
@@ -147,12 +148,13 @@ const EditTable = (props: Props) => {
               'x-component-props': { title: '精度' },
               properties: {
                 scale: {
-                  type: 'string',
+                  type: 'number',
                   'x-decorator': 'FormItem',
                   'x-component': 'NumberPicker',
                   'x-component-props': {
                     placeholder: '请输入精度',
                   },
+                  default: 0,
                   'x-validator': [
                     // {
                     //   required: true,

+ 13 - 1
src/pages/system/DataSource/Save/index.tsx

@@ -1,5 +1,5 @@
 import { Form, FormGrid, FormItem, Input, Password, Select } from '@formily/antd';
-import { createForm } from '@formily/core';
+import { createForm, onFieldValueChange } from '@formily/core';
 import type { ISchema } from '@formily/react';
 import { createSchemaField } from '@formily/react';
 import { Modal } from 'antd';
@@ -17,6 +17,18 @@ const Save = (props: Props) => {
   const form = createForm({
     validateFirst: true,
     initialValues: props.data,
+    effects: () => {
+      onFieldValueChange('typeId', (field, form1) => {
+        if (field.modified) {
+          form1.setFieldState('description', (state) => {
+            state.value = '';
+          });
+          form1.setFieldState('shareConfig.*', (state) => {
+            state.value = '';
+          });
+        }
+      });
+    },
   });
 
   const SchemaField = createSchemaField({