Explorar o código

fix: bug#5636、5566、5667、4941、5643、5552、5358

xieyonghong %!s(int64=3) %!d(string=hai) anos
pai
achega
d37a6a3de0

+ 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;
           }

+ 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: [
             {

+ 4 - 4
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: [
         {

+ 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/rule-engine/DashBoard/index.tsx

@@ -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);