Procházet zdrojové kódy

Merge xyh

Next xyh
XieYongHong před 3 roky
rodič
revize
69f8ede685

+ 1 - 1
src/components/ProTableCard/CardItems/mediaDevice.tsx

@@ -42,7 +42,7 @@ export default (props: ProductCardProps) => {
             </div>
             <div>
               <label>通道数量</label>
-              <div className={'ellipsis'}>{props.channelNumber || ''}</div>
+              <div className={'ellipsis'}>{props.channelNumber || 0}</div>
             </div>
             <div>
               <label>型号</label>

+ 7 - 4
src/components/ProTableCard/CardItems/product.tsx

@@ -32,7 +32,10 @@ export const PermissionsMap = {
 
 export const handlePermissionsMap = (permissions?: string[]) => {
   return permissions && permissions.length
-    ? permissions.map((item) => PermissionsMap[item]).toString()
+    ? permissions
+        .filter((item) => item in PermissionsMap)
+        .map((item) => PermissionsMap[item])
+        .toString()
     : '';
 };
 
@@ -47,12 +50,12 @@ export const ExtraProductCard = (props: ProductCardProps) => {
       showTool={props.showTool}
       actions={props.actions}
       statusText={intl.formatMessage({
-        id: `pages.system.tenant.assetInformation.${props.state ? 'published' : 'unpublished'}`,
-        defaultMessage: '已发布',
+        id: `pages.device.product.status.${props.state ? 'enabled' : 'disabled'}`,
+        defaultMessage: '正常',
       })}
       statusNames={{
         0: StatusColorEnum.error,
-        1: StatusColorEnum.processing,
+        1: StatusColorEnum.success,
       }}
       className={props.className}
       onClick={props.onClick}

+ 1 - 0
src/components/ProTableCard/index.less

@@ -46,6 +46,7 @@
           margin-bottom: 12px;
 
           .card-item-header-name {
+            max-width: 100%;
             font-weight: bold;
             font-size: 16px;
           }

+ 23 - 11
src/components/SearchComponent/index.tsx

@@ -34,7 +34,7 @@ import _ from 'lodash';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import classnames from 'classnames';
 import { onlyMessage, randomString } from '@/utils/util';
-import useUrlState from '@ahooksjs/use-url-state';
+import { useHistory, useLocation } from 'umi';
 
 const ui2Server = (source: SearchTermsUI): SearchTermsServer => [
   { terms: source.terms1 },
@@ -151,11 +151,14 @@ const sortField = (field: ProColumns[]) => {
 const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   const { field, target, onSearch, defaultParam, enableSave = true, initParam, model } = props;
 
+  const _history = useHistory();
+  const _location = useLocation();
+
   /**
    * 过滤不参与搜索的数据 ?
    * TODO Refactor 依赖透明?
    */
-  const filterSearchTerm = (): ProColumns<T>[] =>
+  const filterSearchTerm = (): ProColumns<any>[] =>
     field
       .filter((item) => item.dataIndex)
       .filter((item) => !item.hideInSearch)
@@ -524,7 +527,6 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       });
   };
 
-  const [url, setUrl] = useUrlState();
   const handleSearch = async (type: boolean = true) => {
     const value = form.values;
     const filterTerms = (data: Partial<Term>[] | undefined) =>
@@ -549,28 +551,38 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       (value.terms2 && value.terms2.length && value.terms2?.some((item) => item.value))
     ) {
       if (type) {
-        setUrl({ q: JSON.stringify(value), target: props.target });
+        _history.push({
+          hash: _location.hash,
+          search: `q=${JSON.stringify(value)}&target=${props.target}`,
+        });
+        // setUrl({ q: JSON.stringify(value), target: props.target });
       }
     } else {
-      setUrl({ q: undefined, target: undefined });
+      _history.push({
+        hash: _location.hash,
+        search: '?',
+      });
     }
     onSearch({ terms: _temp });
   };
 
   useEffect(() => {
     // 防止页面下多个TabsTabPane中的查询组件共享路由中的参数
-    if (url.q && props.model !== 'simple') {
-      if (url.target) {
-        if (props.target && url.target === props.target) {
-          form.setValues(JSON.parse(url.q));
+    const params = new URLSearchParams(_location.search);
+    const q = params.get('q');
+    const _target = params.get('target');
+    if (q && props.model !== 'simple') {
+      if (_target) {
+        if (props.target && _target === props.target) {
+          form.setValues(JSON.parse(q));
           handleSearch(false);
         }
         return;
       }
-      form.setValues(JSON.parse(url.q));
+      form.setValues(JSON.parse(q));
       handleSearch(false);
     }
-  }, [url, props.target]);
+  }, [_location, props.target]);
 
   useEffect(() => {
     if (defaultParam) {

+ 1 - 0
src/pages/Northbound/DuerOS/Detail/index.tsx

@@ -277,6 +277,7 @@ const Save = () => {
               // },
               showSearch: true,
               showArrow: true,
+              disabled: id !== ':id',
               filterOption: (input: string, option: any) =>
                 option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
             },

+ 2 - 2
src/pages/device/DashBoard/index.tsx

@@ -283,8 +283,8 @@ const DeviceBoard = () => {
           grid: {
             top: '2%',
             bottom: '5%',
-            left: '4%',
-            right: '2%',
+            left: '50px',
+            right: '50px',
           },
           series: [
             {

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

@@ -426,9 +426,9 @@ const InstanceDetail = observer(() => {
         //     defaultMessage: '应用配置',
         //   })}
         // </Button>,
-        <img 
-        style={{marginRight:20,cursor: 'pointer'}}
-        src={require('/public/images/device/button.png')} 
+        <img
+          style={{ marginRight: 20, cursor: 'pointer' }}
+          src={require('/public/images/device/button.png')}
           onClick={() => {
             getDetail(params.id);
             service.getConfigMetadata(params.id).then((config) => {
@@ -437,7 +437,8 @@ const InstanceDetail = observer(() => {
                 message.success('操作成功!');
               }
             });
-          }}/>
+          }}
+        />,
         // <SyncOutlined
         //   onClick={() => {
         //     getDetail(params.id);

+ 109 - 114
src/pages/home/Api/index.tsx

@@ -1,131 +1,126 @@
 import { Button, Card, Col, Input, Popover, Row } from 'antd';
 import { useEffect, useState } from 'react';
 import { service } from '@/pages/system/Platforms';
-import Service from '../service'
+import Service from '../service';
 import * as moment from 'moment';
-import ApiPage from '@/pages/system/Platforms/Api/base'
+import ApiPage from '@/pages/system/Platforms/Api/base';
 
 const defaultHeight = 50;
 
-
 export default () => {
+  const api = new Service();
+  const [clientId, setClientId] = useState('');
+  const [secureKey, setSecureKey] = useState('');
+  const [sdkDetail, setSdkDetail] = useState<any>({});
 
-    const api = new Service()
-    const [clientId, setClientId] = useState('');
-    const [secureKey, setSecureKey] = useState('');
-    const [sdkDetail, setSdkDetail] = useState<any>({});
-
-    const getDetail = async (id: string) => {
-        const resp = await service.getDetail(id);
-        if (resp.status === 200) {
-            setClientId(resp.result?.id);
-            setSecureKey(resp.result?.secureKey);
-        }
-    };
+  const getDetail = async (id: string) => {
+    const resp = await service.getDetail(id);
+    if (resp.status === 200) {
+      setClientId(resp.result?.id);
+      setSecureKey(resp.result?.secureKey);
+    }
+  };
 
-    const getSDKDetail = async () => {
-        const resp = await service.getSdk();
-        if (resp.status === 200) {
-            setSdkDetail(resp.result[0]);
-        }
-    };
+  const getSDKDetail = async () => {
+    const resp = await service.getSdk();
+    if (resp.status === 200) {
+      setSdkDetail(resp.result[0]);
+    }
+  };
 
-    const downLoad = (url: string) => {
-        if (url) {
-            const downNode = document.createElement('a');
-            downNode.href = url;
-            downNode.download = `${moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')}.sdk`;
-            downNode.style.display = 'none';
-            downNode.setAttribute('target', '_blank');
-            document.body.appendChild(downNode);
-            downNode.click();
-            document.body.removeChild(downNode);
-        }
-    };
+  const downLoad = (url: string) => {
+    if (url) {
+      const downNode = document.createElement('a');
+      downNode.href = url;
+      downNode.download = `${moment(new Date()).format('YYYY-MM-DD-HH-mm-ss')}.sdk`;
+      downNode.style.display = 'none';
+      downNode.setAttribute('target', '_blank');
+      document.body.appendChild(downNode);
+      downNode.click();
+      document.body.removeChild(downNode);
+    }
+  };
 
-
-    useEffect(() => {
-        //  请求SDK下载地址
-        getSDKDetail();
-        api.userDetail().then(res => {
-            if (res.status === 200) {
-              api.apiDetail(
-                {
-                  "terms": [
-                    {
-                      "column": "userId",
-                      "value": res.result.id
-                    }
-                  ]
-                }
-              ).then(response => {
-                if (response.status === 200) {
-                  getDetail(response.result.data[0].id)
-                }
-              })
-            }
+  useEffect(() => {
+    //  请求SDK下载地址
+    getSDKDetail();
+    api.userDetail().then((res) => {
+      if (res.status === 200) {
+        api
+          .apiDetail({
+            terms: [
+              {
+                column: 'userId',
+                value: res.result.id,
+              },
+            ],
           })
-    }, []);
-
-
+          .then((response) => {
+            if (response.status === 200) {
+              getDetail(response.result.data[0].id);
+            }
+          });
+      }
+    });
+  }, []);
 
-    const downLoadJDK = (
-        <div>
-            <div
-                style={{
-                    width: 500,
-                    borderRadius: 2,
-                    marginBottom: 12,
-                }}
-            >
-                <Input.TextArea value={sdkDetail?.dependency} rows={6} readOnly />
-            </div>
-            <Button
-                type={'primary'}
-                style={{ width: '100%' }}
-                onClick={() => {
-                    downLoad(sdkDetail.sdk);
-                }}
-            >
-                jar下载
-            </Button>
-        </div>
-    );
+  const downLoadJDK = (
+    <div>
+      <div
+        style={{
+          width: 500,
+          borderRadius: 2,
+          marginBottom: 12,
+        }}
+      >
+        <Input.TextArea value={sdkDetail?.dependency} rows={6} readOnly />
+      </div>
+      <Button
+        type={'primary'}
+        style={{ width: '100%' }}
+        onClick={() => {
+          downLoad(sdkDetail.sdk);
+        }}
+      >
+        jar下载
+      </Button>
+    </div>
+  );
 
-    return (
-        <Row gutter={[16, 16]}>
-            <Col span={24}>
-                <Row gutter={16}>
-                    <Col span={12}>
-                        <Card title="基本信息">
-                            <div style={{ height: defaultHeight }}>
-                                <div>
-                                    <span style={{ fontWeight: 'bold', fontSize: 16 }}>clientId: </span>
-                                    {clientId}
-                                </div>
-                                <div>
-                                    <span style={{ fontWeight: 'bold', fontSize: 16 }}>secureKey: </span>
-                                    {secureKey}
-                                </div>
-                            </div>
-                        </Card>
-                    </Col>
-                    <Col span={12}>
-                        <Card title="SDK下载">
-                            <div style={{ height: defaultHeight }}>
-                                <Popover trigger="click" title={'POM依赖'} content={downLoadJDK}>
-                                    <Button> Java </Button>
-                                </Popover>
-                            </div>
-                        </Card>
-                    </Col>
-                </Row>
-            </Col>
-            <Col span={24}>
-                <Card title={'API文档'}>
-                    <ApiPage type={'authorize'} showDebugger={true} isShowGranted={true} showHome={true} />
-                </Card>
-            </Col>
+  return (
+    <Row gutter={[16, 16]}>
+      <Col span={24}>
+        <Row gutter={16}>
+          <Col span={12}>
+            <Card title="基本信息">
+              <div style={{ height: defaultHeight }}>
+                <div>
+                  <span style={{ fontWeight: 'bold', fontSize: 16 }}>clientId: </span>
+                  {clientId}
+                </div>
+                <div>
+                  <span style={{ fontWeight: 'bold', fontSize: 16 }}>secureKey: </span>
+                  {secureKey}
+                </div>
+              </div>
+            </Card>
+          </Col>
+          <Col span={12}>
+            <Card title="SDK下载">
+              <div style={{ height: defaultHeight }}>
+                <Popover trigger="click" title={'POM依赖'} content={downLoadJDK}>
+                  <Button> Java </Button>
+                </Popover>
+              </div>
+            </Card>
+          </Col>
         </Row>
-    );
+      </Col>
+      <Col span={24}>
+        <Card title={'API文档'}>
+          <ApiPage type={'authorize'} showDebugger={true} isShowGranted={true} showHome={true} />
+        </Card>
+      </Col>
+    </Row>
+  );
 };

+ 19 - 22
src/pages/home/index.tsx

@@ -4,7 +4,7 @@ import Comprehensive from './comprehensive';
 import Device from './device';
 import Init from './init';
 import Ops from './ops';
-import Api from './Api'
+import Api from './Api';
 import Service from './service';
 import { Skeleton } from 'antd';
 
@@ -13,7 +13,7 @@ const Home = () => {
   type ViewType = keyof typeof ViewMap;
   const [current, setCurrent] = useState<ViewType>('init'); // 默认为初始化
   const [loading, setLoading] = useState(true);
-  const [detail, setDetail] = useState<any>({})
+  const [detail, setDetail] = useState<any>({});
 
   const ViewMap = {
     init: <Init changeView={(value: ViewType) => setCurrent(value)} />,
@@ -33,35 +33,32 @@ const Home = () => {
         }
       }
     });
-
   }, []);
   useEffect(() => {
-    service.userDetail().then(res => {
+    service.userDetail().then((res) => {
       if (res.status === 200) {
-        service.apiDetail(
-          {
-            "terms": [
+        service
+          .apiDetail({
+            terms: [
               {
-                "column": "userId",
-                "value": res.result.id
-              }
-            ]
-          }
-        ).then(response => {
-          if (response.status === 200) {
-            setDetail(response.result?.data)
-          }
-        })
+                column: 'userId',
+                value: res.result.id,
+              },
+            ],
+          })
+          .then((response) => {
+            if (response.status === 200) {
+              setDetail(response.result?.data);
+            }
+          });
       }
-    })
-  }, [])
+    });
+  }, []);
 
   return (
     <PageContainer>
       <Skeleton loading={loading} active>
-        {
-          detail && detail.length > 0 ? <Api /> : <>{ViewMap[current]}</>
-        }
+        {detail && detail.length > 0 ? <Api /> : <>{ViewMap[current]}</>}
       </Skeleton>
     </PageContainer>
   );

+ 2 - 2
src/pages/home/service.ts

@@ -24,8 +24,8 @@ class Service {
   userDetail = () =>
     request(`/${SystemConst.API_BASE}/user/detail`, {
       method: 'GET',
-    })
-  apiDetail = (data:any) =>
+    });
+  apiDetail = (data: any) =>
     request(`/${SystemConst.API_BASE}/api-client/_query`, {
       method: 'POST',
       data,

+ 59 - 50
src/pages/link/DashBoard/index.less

@@ -1,62 +1,71 @@
-.link-dash-board {
-  .echarts-items {
-    position: relative;
-    display: flex;
-    gap: 24px;
-    margin-bottom: 24px;
-    padding: 24px;
-    background-color: #fff;
-
-    .echarts-item {
-      display: flex;
-      flex-grow: 1;
-      width: 0;
-      height: 160px;
-      padding: 16px;
+@media screen {
+  .link-dash-board {
+    .echarts-items {
+      position: relative;
+      display: grid;
+      grid-row-gap: 24px;
+      grid-column-gap: 24px;
+      grid-template-columns: 1fr 1fr 1fr 1fr;
+      margin-bottom: 24px;
+      padding: 24px;
       background-color: #fff;
-      border: 1px solid #e0e4e8;
 
-      .echarts-item-left {
+      .echarts-item {
         display: flex;
-        flex-direction: column;
-        width: 45%;
-      }
+        height: 150px;
+        padding: 16px;
+        background-color: #fff;
+        border: 1px solid #e0e4e8;
 
-      .echarts-item-right {
-        width: 55%;
-      }
+        .echarts-item-left {
+          display: flex;
+          flex-direction: column;
+          width: 45%;
+        }
 
-      .echarts-item-title {
-        margin-bottom: 8px;
-        color: rgba(#000, 0.6);
-        font-size: 16px;
-      }
+        .echarts-item-right {
+          width: 55%;
+        }
 
-      .echarts-item-value {
-        font-weight: bold;
-        font-size: 36px;
-      }
+        .echarts-item-title {
+          margin-bottom: 8px;
+          color: rgba(#000, 0.6);
+          font-size: 16px;
+        }
 
-      .echarts-item-bottom {
-        position: relative;
-        display: flex;
-        flex-direction: column;
-        flex-grow: 1;
-        justify-content: center;
-        height: 0;
-        padding-left: 12px;
-
-        &::before {
-          position: absolute;
-          top: 50%;
-          left: 0;
-          width: 4px;
-          height: 12px;
-          background-color: #ff595e;
-          transform: translateY(-50%);
-          content: ' ';
+        .echarts-item-value {
+          font-weight: bold;
+          font-size: 36px;
+        }
+
+        .echarts-item-bottom {
+          position: relative;
+          display: flex;
+          flex-direction: column;
+          flex-grow: 1;
+          justify-content: center;
+          height: 0;
+          padding-left: 12px;
+
+          &::before {
+            position: absolute;
+            top: 50%;
+            left: 0;
+            width: 4px;
+            height: 12px;
+            background-color: #ff595e;
+            transform: translateY(-50%);
+            content: ' ';
+          }
         }
       }
     }
   }
+
+  @media (max-width: 1400px) {
+    .echarts-items {
+      grid-template-rows: 1fr 1fr;
+      grid-template-columns: 1fr 1fr !important;
+    }
+  }
 }

+ 4 - 5
src/pages/link/DashBoard/index.tsx

@@ -245,8 +245,8 @@ export default () => {
         type: 'value',
       },
       grid: {
-        left: '80px',
-        right: '2%',
+        left: '50px',
+        right: '50px',
       },
       color: ['#979AFF'],
       series: Object.keys(data).length
@@ -293,7 +293,7 @@ export default () => {
       },
       grid: {
         left: '50px',
-        right: '2%',
+        right: '30px',
       },
       dataZoom: [
         {
@@ -352,7 +352,7 @@ export default () => {
       },
       grid: {
         left: '50px',
-        right: '2%',
+        right: '30px',
       },
       dataZoom: [
         {
@@ -638,7 +638,6 @@ export default () => {
         const cpu = value.cpu;
         const memory = value.memory;
         const disk = value.disk;
-        console.log(value);
         setTopValues({
           cpu: cpu.systemUsage,
           jvm: Number(((memory.jvmHeapUsage / 100) * (memory.jvmHeapTotal / 1024)).toFixed(1)),

+ 31 - 12
src/pages/media/DashBoard/index.tsx

@@ -68,6 +68,20 @@ export default () => {
     }
   };
 
+  const getInterval = (type: string) => {
+    switch (type) {
+      case 'year':
+        return '30d';
+      case 'month':
+      case 'week':
+        return '1d';
+      case 'hour':
+        return '1m';
+      default:
+        return '1h';
+    }
+  };
+
   const getEcharts = async (params: any) => {
     const resp = await service.getMulti([
       {
@@ -77,7 +91,7 @@ export default () => {
         dimension: 'agg',
         group: 'playCount',
         params: {
-          time: params.time.type === 'today' ? '1h' : '1d',
+          time: getInterval(params.time.type),
           from: moment(params.time.start).format('YYYY-MM-DD HH:mm:ss'),
           to: moment(params.time.end).format('YYYY-MM-DD HH:mm:ss'),
           limit: 30,
@@ -88,17 +102,21 @@ export default () => {
     if (resp.status === 200) {
       const xData: string[] = [];
       const sData: number[] = [];
-      resp.result.forEach((item: any) => {
-        xData.push(item.data.timeString);
-        sData.push(item.data.value);
-      });
+      resp.result
+        .sort((a: any, b: any) => b.data.timestamp - a.data.timestamp)
+        .forEach((item: any) => {
+          xData.push(item.data.timeString);
+          sData.push(item.data.value);
+        });
 
       setOptions({
         xAxis: {
           type: 'category',
-          boundaryGap: false,
           data: xData,
         },
+        tooltip: {
+          trigger: 'axis',
+        },
         yAxis: {
           type: 'value',
         },
@@ -106,12 +124,13 @@ export default () => {
           left: '4%',
           right: '2%',
           top: '2%',
-          bottom: '4%',
         },
+        color: ['#2F54EB'],
         series: [
           {
             data: sData,
             type: 'bar',
+            barWidth: 16,
           },
         ],
       });
@@ -125,15 +144,15 @@ export default () => {
     const timeStr = 'hh小时mm分钟ss秒';
 
     if (time) {
-      if (time >= 6000) {
-        hour = Math.trunc(time / (60 * 60));
+      if (time >= 60 * 60 * 1000) {
+        hour = Math.trunc(time / (60 * 60 * 1000));
       }
 
-      if (time >= 60) {
-        min = Math.trunc((time - hour * 60 * 60) / 60);
+      if (time >= 60 * 1000) {
+        min = Math.trunc((time - hour * 60 * 60 * 1000) / (60 * 1000));
       }
 
-      sec = time - hour * (60 * 60) - min * 60;
+      sec = Math.trunc((time - hour * (60 * 60 * 1000) - min * 60 * 1000) / 1000);
     }
 
     return timeStr

+ 1 - 1
src/pages/notice/Config/Log/index.tsx

@@ -66,7 +66,7 @@ const Log = observer(() => {
       dataIndex: 'action',
       title: '操作',
       valueType: 'option',
-      hideInSearch:true,
+      hideInSearch: true,
       render: (text, record) => [
         <a
           onClick={() => {

+ 1 - 1
src/pages/notice/Template/Log/index.tsx

@@ -65,7 +65,7 @@ const Log = observer(() => {
     {
       dataIndex: 'action',
       title: '操作',
-      hideInSearch:true,
+      hideInSearch: true,
       render: (text, record) => [
         <a
           key="info"

+ 2 - 2
src/pages/rule-engine/DashBoard/index.tsx

@@ -55,7 +55,7 @@ const Dashboard = observer(() => {
     dimension: 'agg',
     group: 'today',
     params: {
-      time: '1h',
+      time: '1d',
       // targetType: 'device',
       format: 'HH:mm:ss',
       from: moment(new Date(new Date().setHours(0, 0, 0, 0))).format('YYYY-MM-DD HH:mm:ss'),
@@ -71,7 +71,7 @@ const Dashboard = observer(() => {
     dimension: 'agg',
     group: 'thisMonth',
     params: {
-      time: '1d',
+      time: '1M',
       // targetType: 'device',
       format: 'yyyy-MM',
       limit: 1,

+ 3 - 2
src/pages/rule-engine/Scene/Save/action/VariableItems/user.tsx

@@ -164,7 +164,7 @@ export default (props: UserProps) => {
   };
 
   useEffect(() => {
-    if (props.type) {
+    if (props.type && source === 'relation') {
       const newTree = [...treeData];
       if (props.type === 'device') {
         queryRelationUsers().then((relationResp) => {
@@ -184,9 +184,10 @@ export default (props: UserProps) => {
           setTreeData(newTree);
         }
       }
+
       onchange(props.value?.source, '');
     }
-  }, [props.type]);
+  }, [props.type, source]);
 
   const filterOption = (input: string, option: any) => {
     return option.name ? option.name.toLowerCase().includes(input.toLowerCase()) : false;

+ 4 - 0
src/pages/rule-engine/Scene/Save/index.tsx

@@ -67,6 +67,10 @@ export default () => {
   const [actionsData, setActionsData] = useState<any[]>([]);
   const [isEdit, setIsEdit] = useState(false);
 
+  useEffect(() => {
+    FormModel = {};
+  }, []);
+
   const getDetail = useCallback(
     async (id: string) => {
       const resp = await service.detail(id);

+ 19 - 3
src/pages/system/Department/Assets/deivce/bind.tsx

@@ -117,8 +117,6 @@ const Bind = observer((props: Props) => {
     }
   }, [props.visible]);
 
-  console.log(AssetsModel);
-
   const getParams = (params: any) => {
     console.log(params);
     const _params: any = [
@@ -170,7 +168,25 @@ const Bind = observer((props: Props) => {
         field={columns}
         enableSave={false}
         model={'simple'}
-        defaultParam={getParams(AssetsModel.bindModal ? AssetsModel.params : {})}
+        defaultParam={getParams(
+          AssetsModel.bindModal
+            ? AssetsModel.params
+            : [
+                {
+                  column: 'id',
+                  termType: 'dim-assets$not',
+                  value: {
+                    assetType: 'device',
+                    targets: [
+                      {
+                        type: 'org',
+                        id: props.parentId,
+                      },
+                    ],
+                  },
+                },
+              ],
+        )}
         onSearch={async (data) => {
           actionRef.current?.reset?.();
           setSearchParam(data);

+ 4 - 1
src/pages/system/Department/Assets/product/bind.tsx

@@ -25,6 +25,7 @@ const Bind = observer((props: Props) => {
   const actionRef = useRef<ActionType>();
   const [searchParam, setSearchParam] = useState({});
   const saveRef = useRef<{ saveData: Function }>();
+  const [loading, setLoading] = useState(false);
 
   const columns: ProColumns<ProductItem>[] = [
     {
@@ -54,6 +55,7 @@ const Bind = observer((props: Props) => {
 
   const handleBind = () => {
     if (Models.bindKeys.length && saveRef.current) {
+      setLoading(true);
       saveRef.current?.saveData();
     } else {
       message.warn('请先勾选数据');
@@ -75,6 +77,7 @@ const Bind = observer((props: Props) => {
         onCancel={props.onCancel}
         width={'75vw'}
         title="绑定"
+        confirmLoading={loading}
       >
         <PermissionModal
           type="product"
@@ -88,7 +91,7 @@ const Bind = observer((props: Props) => {
             }
           }}
         />
-        <SearchComponent<ProductItem>
+        <SearchComponent
           field={columns}
           model={'simple'}
           enableSave={false}