wzyyy 3 vuotta sitten
vanhempi
commit
42595d11be

+ 5 - 31
src/pages/device/Instance/index.tsx

@@ -519,38 +519,12 @@ const Instance = () => {
         onSearch={(data) => {
           actionRef.current?.reset?.();
           setSearchParams(data);
-          const terms1 = data.terms[0]?.terms?.map((e) => {
-            if (e.column === 'classifiedId') {
-              return {
-                column: 'productId$product-info',
-                value: [e],
-              };
-            } else {
-              return e;
-            }
-          });
-          if (data.terms && data.terms.length === 2) {
-            const terms2 = data.terms[1]?.terms?.map((e) => {
-              if (e.column === 'classifiedId') {
-                return {
-                  column: 'productId$product-info',
-                  value: [e],
-                };
-              } else {
-                return e;
-              }
-            });
-            setSearchParams({
-              ...searchParams,
-              terms: [{ terms: terms1 }, { terms: terms2, type: data.terms[1].type }],
-            });
-          } else {
-            setSearchParams({
-              ...searchParams,
-              terms: [{ terms: terms1 }],
-            });
-          }
         }}
+        // onReset={() => {
+        //   // 重置分页及搜索参数
+        //   actionRef.current?.reset?.();
+        //   setSearchParams({});
+        // }}
       />
       <ProTableCard<DeviceInstance>
         columns={columns}

+ 1 - 1
src/pages/device/Instance/service.ts

@@ -356,7 +356,7 @@ class Service extends BaseService<DeviceInstance> {
       method: 'POST',
       data,
     });
-  public queryMetadatabyId = (data: any) =>
+  public queryModbusabyId = (data: any) =>
     request(`/${SystemConst.API_BASE}/modbus/master/_query/no-paging`, {
       method: 'POST',
       data,

+ 1 - 1
src/pages/device/Product/Save/index.tsx

@@ -272,7 +272,7 @@ const Save = (props: Props) => {
         </Row>
         <Row>
           <Col span={24}>
-            <Form.Item label={'分类'} name={'classifiedId'}>
+            <Form.Item label={'产品分类'} name={'classifiedId'}>
               <TreeSelect
                 showSearch
                 allowClear

+ 95 - 110
src/pages/media/Stream/index.tsx

@@ -1,10 +1,10 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import SearchComponent from '@/components/SearchComponent';
 import type { ProColumns } from '@jetlinks/pro-table';
-import { Button, Card, Col, Empty, Pagination, Row } from 'antd';
+import { Card, Col, Empty, Pagination, Row } from 'antd';
 import { useEffect, useState } from 'react';
 import Service from '@/pages/media/Stream/service';
-import { getButtonPermission, getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
+import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
 import { useHistory } from 'umi';
 import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
 import { model } from '@formily/reactive';
@@ -80,121 +80,106 @@ const Stream = () => {
       <Card>
         <div className="stream" style={{ position: 'relative', minHeight }}>
           <div style={{ height: '100%', paddingBottom: 48 }}>
+            <div>
+              <PermissionButton
+                isPermission={permission.add}
+                onClick={() => {
+                  history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
+                  StreamModel.current = {};
+                }}
+                key="button"
+                icon={<PlusOutlined />}
+                type="primary"
+              >
+                新增
+              </PermissionButton>
+            </div>
             {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>
+                <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>
             ) : (
-              <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>
-                }
-              />
+              <Empty style={{ marginTop: '10%' }} />
             )}
           </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} 条`;
+          {dataSource.data.length > 0 && (
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'flex-end',
+                position: 'absolute',
+                bottom: 0,
+                width: '100%',
               }}
-            />
-          </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>

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

@@ -53,7 +53,7 @@ const Dashboard = observer(() => {
     group: 'today',
     params: {
       time: '1h',
-      targetType: 'device',
+      // targetType: 'device',
       format: 'HH:mm:ss',
       from: moment(new Date(new Date().setHours(0, 0, 0, 0))).format('YYYY-MM-DD HH:mm:ss'),
       to: 'now',
@@ -69,7 +69,7 @@ const Dashboard = observer(() => {
     group: 'thisMonth',
     params: {
       time: '1d',
-      targetType: 'device',
+      // targetType: 'device',
       format: 'yyyy-MM',
       limit: 1,
       from: 'now-1M',
@@ -204,7 +204,7 @@ const Dashboard = observer(() => {
       dimension: 'agg',
       group: 'alarmTrend',
       params: {
-        targetType: 'device', // product、device、org、other
+        targetType: params.targetType, // product、device、org、other
         format: format,
         time: time,
         // from: 'now-1y', // now-1d、now-1w、now-1M、now-1y