sun-chaochao před 3 roky
rodič
revize
7eab2b46a9

+ 6 - 0
src/global.less

@@ -109,3 +109,9 @@ ol {
     display: flex;
   }
 }
+
+.tabs-full-active {
+  .ant-tabs-tab-active {
+    background-color: @primary-1;
+  }
+}

+ 9 - 19
src/pages/device/Instance/Detail/Log/index.tsx

@@ -5,38 +5,28 @@ import { Card, Input, Modal, Tooltip } from 'antd';
 import { SearchOutlined } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { InstanceModel, service } from '@/pages/device/Instance';
-import { useEffect, useRef, useState } from 'react';
+import { useRef, useState } from 'react';
 import SearchComponent from '@/components/SearchComponent';
 
 const Log = () => {
   const intl = useIntl();
 
-  const [type, setType] = useState<any>({});
   const actionRef = useRef<ActionType>();
   const [searchParams, setSearchParams] = useState<any>({});
 
-  useEffect(() => {
-    service.queryLogsType().then((resp) => {
-      if (resp.status === 200) {
-        const list = (resp.result as { text: string; value: string }[]).reduce(
-          (previousValue, currentValue) => {
-            previousValue[currentValue.value] = currentValue;
-            return previousValue;
-          },
-          {},
-        );
-        setType({ ...list });
-      }
-    });
-  }, []);
-
   const columns: ProColumns<LogItem>[] = [
     {
       title: '类型',
       dataIndex: 'type',
-      renderText: (text) => text.text,
+      renderText: (text) => text?.text,
       valueType: 'select',
-      valueEnum: { ...type },
+      request: () =>
+        service.queryLogsType().then((resp: any) =>
+          (resp?.result || []).map((item: any) => ({
+            label: item.text,
+            value: item.value,
+          })),
+        ),
     },
     {
       title: '时间',

+ 33 - 16
src/pages/device/Instance/Detail/Running/Property/index.tsx

@@ -1,4 +1,4 @@
-import { Col, Input, message, Pagination, Row, Space, Spin, Table } from 'antd';
+import { Col, Empty, Input, message, Pagination, Row, Space, Spin, Table } from 'antd';
 import CheckButton from '@/components/CheckButton';
 import { useCallback, useEffect, useRef, useState } from 'react';
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
@@ -250,19 +250,24 @@ const Property = (props: Props) => {
             }}
           />
         </div>
-        <div style={{ marginTop: '20px' }}>
-          {check ? (
-            <Row gutter={[16, 16]}>
-              {dataSource.data.map((item: any) => (
-                <Col {...ColResponsiveProps} key={item.id}>
-                  <PropertyCard data={item} value={item?.id ? propertyValue[item?.id] : '--'} />
-                </Col>
-              ))}
-            </Row>
-          ) : (
-            <Table pagination={false} columns={columns} dataSource={dataSource.data} rowKey="id" />
-          )}
-          {dataSource.data.length > 0 && (
+        {dataSource.data?.length > 0 ? (
+          <div style={{ marginTop: '20px' }}>
+            {check ? (
+              <Row gutter={[16, 16]}>
+                {dataSource.data.map((item: any) => (
+                  <Col {...ColResponsiveProps} key={item.id}>
+                    <PropertyCard data={item} value={item?.id ? propertyValue[item?.id] : '--'} />
+                  </Col>
+                ))}
+              </Row>
+            ) : (
+              <Table
+                pagination={false}
+                columns={columns}
+                dataSource={dataSource.data}
+                rowKey="id"
+              />
+            )}
             <div
               style={{
                 marginTop: '20px',
@@ -288,8 +293,20 @@ const Property = (props: Props) => {
                 }}
               />
             </div>
-          )}
-        </div>
+          </div>
+        ) : (
+          <div
+            style={{
+              height: 400,
+              display: 'flex',
+              alignItems: 'center',
+              width: '100%',
+              justifyContent: 'center',
+            }}
+          >
+            <Empty />
+          </div>
+        )}
       </Spin>
       {visible && (
         <EditProperty

+ 16 - 14
src/pages/device/Instance/Detail/Running/index.tsx

@@ -46,21 +46,23 @@ const Running = () => {
           <Empty />
         </div>
       ) : (
-        <Tabs
-          defaultActiveKey="1"
-          tabPosition="left"
-          style={{ minHeight: 600 }}
-          tabBarExtraContent={{ left: operations() }}
-        >
-          <Tabs.TabPane tab="属性" key="1">
-            <Property data={metadata?.properties || []} />
-          </Tabs.TabPane>
-          {list?.map((item) => (
-            <Tabs.TabPane tab={item.name} key={item.id}>
-              <Event data={item} />
+        <div className="tabs-full-active">
+          <Tabs
+            defaultActiveKey="1"
+            tabPosition="left"
+            style={{ minHeight: 600 }}
+            tabBarExtraContent={{ left: operations() }}
+          >
+            <Tabs.TabPane tab="属性" key="1">
+              <Property data={metadata?.properties || []} />
             </Tabs.TabPane>
-          ))}
-        </Tabs>
+            {list?.map((item) => (
+              <Tabs.TabPane tab={item.name} key={item.id}>
+                <Event data={item} />
+              </Tabs.TabPane>
+            ))}
+          </Tabs>
+        </div>
       )}
     </Card>
   );

+ 3 - 2
src/pages/system/Role/Detail/Permission/Allocate/MenuPermission.tsx

@@ -59,7 +59,7 @@ const MenuPermission = (props: Props) => {
           paddingLeft: (props?.level || 0) * 10,
           transition: 'background .3s',
           borderBottom: '1px solid #f0f0f0',
-          height: 50,
+          minHeight: 50,
         }}
         key={value?.id}
       >
@@ -118,7 +118,7 @@ const MenuPermission = (props: Props) => {
               {value?.name}
             </Checkbox>
           </div>
-          <div>
+          <div style={{ padding: 5 }}>
             {value.id === 'menu-permission' ? (
               <span style={{ fontWeight: value.id === 'menu-permission' ? 600 : 400 }}>
                 操作权限
@@ -156,6 +156,7 @@ const MenuPermission = (props: Props) => {
                   };
                   props.change(d);
                 }}
+                style={{ width: '100%' }}
                 options={(value?.buttons || []).map((i: any) => ({
                   label: i.name,
                   value: i.id,