Browse Source

fix: 修改bug

100011797 3 years ago
parent
commit
a553200310

+ 2 - 3
src/pages/device/Firmware/Task/Detail/index.tsx

@@ -14,7 +14,6 @@ import { service } from '@/pages/device/Firmware';
 import styles from './index.less';
 import { model } from '@formily/reactive';
 import { useParams } from 'umi';
-import moment from 'moment';
 import Details from './Details/index';
 
 const colorMap = new Map();
@@ -176,14 +175,14 @@ const Detail = observer(() => {
       ellipsis: true,
       dataIndex: 'createTime',
       valueType: 'dateTime',
-      render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
+      // render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
     },
     {
       title: '完成时间',
       ellipsis: true,
       dataIndex: 'completeTime',
       valueType: 'dateTime',
-      render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
+      // render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
     },
     {
       title: '进度',

+ 3 - 3
src/pages/device/Firmware/index.tsx

@@ -2,7 +2,6 @@ import { PageContainer } from '@ant-design/pro-layout';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
 import { Popconfirm } from 'antd';
-import moment from 'moment';
 import { useRef, useState } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { DeleteOutlined, EditOutlined, NodeExpandOutlined, PlusOutlined } from '@ant-design/icons';
@@ -63,7 +62,7 @@ const Firmware = observer(() => {
         service.queryProduct().then((resp: any) =>
           (resp?.result || []).map((item: any) => ({
             label: item.name,
-            value: item.id,
+            value: item.name,
           })),
         ),
     },
@@ -96,7 +95,7 @@ const Firmware = observer(() => {
       align: 'center',
       ellipsis: true,
       valueType: 'dateTime',
-      render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
+      // render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
       // sorter: true,
       // defaultSortOrder: 'descend',
     },
@@ -189,6 +188,7 @@ const Firmware = observer(() => {
         tableStyle={{ minHeight }}
         search={false}
         params={param}
+        rowKey="id"
         columnEmptyText={''}
         headerTitle={
           <div>

+ 6 - 6
src/pages/device/Instance/Detail/Diagnose/Status/model.ts

@@ -9,6 +9,12 @@ StatusMap.set('success', require('/public/images/diagnose/status/success.png'));
 StatusMap.set('warning', require('/public/images/diagnose/status/warning.png'));
 StatusMap.set('loading', require('/public/images/diagnose/status/loading.png'));
 
+export const textColorMap = new Map();
+textColorMap.set('loading', 'black');
+textColorMap.set('error', 'red');
+textColorMap.set('success', 'green');
+textColorMap.set('warning', 'red');
+
 export type ListProps = {
   key: string;
   name: string;
@@ -23,12 +29,6 @@ export const list = [
   { key: 'message', text: '消息通信' },
 ];
 
-export const textColorMap = new Map();
-textColorMap.set('loading', 'black');
-textColorMap.set('error', 'red');
-textColorMap.set('success', 'green');
-textColorMap.set('warning', 'red');
-
 export const networkInitList: ListProps[] = [
   // {
   //   key: 'access',

+ 2 - 0
src/pages/device/Instance/Process/index.tsx

@@ -34,6 +34,8 @@ const Process = (props: Props) => {
           if (res.success) {
             dt += res.total;
             setCount(dt);
+          } else {
+            setErrMessage(res.message);
           }
           break;
         case 'sync':

+ 1 - 0
src/pages/link/Protocol/save/index.tsx

@@ -160,6 +160,7 @@ const Save = (props: Props) => {
             'x-decorator-props': {
               gridSpan: 2,
             },
+            default: 'jar',
             'x-component-props': {
               model: 'singular',
               itemStyle: {

+ 0 - 1
src/pages/link/Type/Detail/index.tsx

@@ -122,7 +122,6 @@ const Save = observer(() => {
         effects() {
           onFieldValueChange('type', (field, f) => {
             const value = (field as Field).value;
-            // console.log(field)
             if (f.modified) {
               f.deleteValuesIn('configuration');
               f.deleteValuesIn('cluster');

+ 14 - 2
src/pages/rule-engine/Alarm/Config/Save/input.tsx

@@ -74,22 +74,34 @@ const InputSave = (props: Props) => {
       address: {
         title: 'kafka地址',
         type: 'string',
-        required: true,
+        // required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
           placeholder: '请输入kafka地址',
         },
+        'x-validator': [
+          {
+            max: 64,
+            message: '最多可输入64个字符',
+          },
+        ],
       },
       topic: {
         title: 'topic',
         type: 'string',
-        required: true,
+        // required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
           placeholder: '请输入topic',
         },
+        'x-validator': [
+          {
+            max: 64,
+            message: '最多可输入64个字符',
+          },
+        ],
       },
       state: {
         title: '状态',

+ 14 - 2
src/pages/rule-engine/Alarm/Config/Save/output.tsx

@@ -71,22 +71,34 @@ const OutputSave = (props: Props) => {
       address: {
         title: 'kafka地址',
         type: 'string',
-        required: true,
+        // required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
           placeholder: '请输入kafka地址',
         },
+        'x-validator': [
+          {
+            max: 64,
+            message: '最多可输入64个字符',
+          },
+        ],
       },
       topic: {
         title: 'topic',
         type: 'string',
-        required: true,
+        // required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
           placeholder: '请输入topic',
         },
+        'x-validator': [
+          {
+            max: 64,
+            message: '最多可输入64个字符',
+          },
+        ],
       },
       state: {
         title: '状态',

+ 6 - 1
src/pages/rule-engine/Alarm/Configuration/index.tsx

@@ -21,6 +21,7 @@ import { Store } from 'jetlinks-store';
 import { getMenuPathByCode, MENUS_CODE } from '@/utils/menu';
 import { useHistory } from 'umi';
 import { onlyMessage } from '@/utils/util';
+import encodeQuery from '@/utils/encodeQuery';
 
 const service = new Service('alarm/config');
 
@@ -133,7 +134,11 @@ const Configuration = () => {
       ),
       valueType: 'select',
       request: async () => {
-        const res = await service.getScene({});
+        const res: any = await service.getScene(
+          encodeQuery({
+            sorts: { createTime: 'desc' },
+          }),
+        );
         if (res.status === 200) {
           return res.result.map((item: any) => ({ label: item.name, value: item.name }));
         }

+ 1 - 0
src/pages/system/Role/Detail/UserManage/BindUser.tsx

@@ -78,6 +78,7 @@ const BindUser = (props: Props) => {
         target="user"
         // pattern={'simple'}
         enableSave={false}
+        model="simple"
         onSearch={(data) => {
           // console.log(data);
           // 重置分页数据

+ 13 - 2
src/pages/system/Role/Detail/UserManage/index.tsx

@@ -8,7 +8,6 @@ import BindUser from './BindUser';
 import { service } from '@/pages/system/User/index';
 import { useParams } from 'umi';
 import Service from '@/pages/system/Role/service';
-import moment from 'moment';
 import SearchComponent from '@/components/SearchComponent';
 import { onlyMessage } from '@/utils/util';
 
@@ -49,7 +48,8 @@ const UserManage = () => {
       dataIndex: 'createTime',
       ellipsis: true,
       width: '200px',
-      render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
+      // render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
+      valueType: 'dateTime',
     },
     {
       title: '状态',
@@ -61,6 +61,17 @@ const UserManage = () => {
           text={record?.status === 1 ? '正常' : '禁用'}
         />
       ),
+      valueType: 'select',
+      valueEnum: {
+        1: {
+          text: '正常',
+          status: 1,
+        },
+        0: {
+          text: '禁用',
+          status: 0,
+        },
+      },
     },
     {
       title: intl.formatMessage({

+ 0 - 228
src/pages/system/Role/index copy.tsx

@@ -1,228 +0,0 @@
-import { PageContainer } from '@ant-design/pro-layout';
-import React, { useEffect, useRef } from 'react';
-import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
-import type { ActionType, ProColumns } from '@jetlinks/pro-table';
-import BaseCrud from '@/components/BaseCrud';
-import Service from './service';
-import { useIntl } from '@@/plugin-locale/localeExports';
-import { observer } from '@formily/react';
-import { history, useLocation } from 'umi';
-import { Store } from 'jetlinks-store';
-import SystemConst from '@/utils/const';
-import { CurdModel } from '@/components/BaseCrud/model';
-import { getButtonPermission, getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
-import { PermissionButton } from '@/components';
-import { onlyMessage } from '@/utils/util';
-
-export const service = new Service('role');
-
-const Role: React.FC = observer(() => {
-  const intl = useIntl();
-  const actionRef = useRef<ActionType>();
-  const permissionCode = 'system/Role';
-  const { permission } = PermissionButton.usePermission(permissionCode);
-
-  const columns: ProColumns<RoleItem>[] = [
-    // {
-    //   dataIndex: 'index',
-    //   valueType: 'indexBorder',
-    //   width: 48,
-    // },
-    {
-      title: intl.formatMessage({
-        id: 'pages.system.role.id',
-        defaultMessage: '标识',
-      }),
-      dataIndex: 'id',
-      // copyable: true,
-      ellipsis: true,
-      // sorter: true,
-      // defaultSortOrder: 'ascend',
-      formItemProps: {
-        rules: [
-          {
-            required: true,
-            message: '此项为必填项',
-          },
-        ],
-      },
-    },
-    {
-      title: intl.formatMessage({
-        id: 'pages.table.name',
-        defaultMessage: '名称',
-      }),
-      dataIndex: 'name',
-      // copyable: true,
-      ellipsis: true,
-      // tip: intl.formatMessage({
-      //   id: 'pages.system.userName.tips',
-      //   defaultMessage: '用户名过长会自动收缩',
-      // }),
-      formItemProps: {
-        rules: [
-          {
-            required: true,
-            message: '此项为必填项',
-          },
-        ],
-      },
-    },
-    {
-      title: intl.formatMessage({
-        id: 'pages.table.describe',
-        defaultMessage: '描述',
-      }),
-      ellipsis: true,
-      dataIndex: 'description',
-      filters: true,
-      onFilter: true,
-    },
-    {
-      title: intl.formatMessage({
-        id: 'pages.data.option',
-        defaultMessage: '操作',
-      }),
-      valueType: 'option',
-      width: 200,
-      render: (text, record) => [
-        <PermissionButton
-          key="editable"
-          tooltip={{
-            title: intl.formatMessage({
-              id: 'pages.data.option.edit',
-              defaultMessage: '编辑',
-            }),
-          }}
-          isPermission={permission.update}
-          style={{ padding: 0 }}
-          type="link"
-          onClick={() => {
-            history.push(`${getMenuPathByParams(MENUS_CODE['system/Role/Detail'], record.id)}`);
-          }}
-        >
-          <EditOutlined />
-        </PermissionButton>,
-        <PermissionButton
-          type="link"
-          key="delete"
-          style={{ padding: 0 }}
-          popConfirm={{
-            title: intl.formatMessage({
-              id: 'pages.system.role.option.delete',
-              defaultMessage: '确定要删除吗',
-            }),
-            onConfirm: async () => {
-              await service.remove(record.id);
-              onlyMessage(
-                intl.formatMessage({
-                  id: 'pages.data.option.success',
-                  defaultMessage: '操作成功!',
-                }),
-              );
-              actionRef.current?.reload();
-            },
-          }}
-          tooltip={{
-            title: intl.formatMessage({
-              id: 'pages.data.option.delete',
-              defaultMessage: '删除',
-            }),
-          }}
-          isPermission={permission.delete}
-        >
-          <DeleteOutlined />
-        </PermissionButton>,
-      ],
-    },
-  ];
-
-  const schema = {
-    type: 'object',
-    properties: {
-      name: {
-        title: intl.formatMessage({
-          id: 'pages.table.name',
-          defaultMessage: '角色名称',
-        }),
-        type: 'string',
-        'x-decorator': 'FormItem',
-        'x-component': 'Input',
-        'x-decorator-props': {},
-        name: 'name',
-        required: true,
-        'x-component-props': {
-          placeholder: '请输入角色名称',
-        },
-        'x-validator': [
-          {
-            max: 64,
-            message: '最多可输入64个字符',
-          },
-          {
-            required: true,
-            message: '请输入名称',
-          },
-        ],
-      },
-      description: {
-        type: 'string',
-        title: intl.formatMessage({
-          id: 'pages.table.describe',
-          defaultMessage: '描述',
-        }),
-        'x-decorator': 'FormItem',
-        'x-component': 'Input.TextArea',
-        'x-component-props': {
-          checkStrength: true,
-          placeholder: '请输入说明',
-        },
-        'x-decorator-props': {},
-        name: 'password',
-        required: false,
-        'x-validator': [
-          {
-            max: 200,
-            message: '最多可输入200个字符',
-          },
-        ],
-      },
-    },
-  };
-
-  const location = useLocation();
-
-  useEffect(() => {
-    if ((location as any).query?.save === 'true') {
-      CurdModel.add();
-    }
-    const subscription = Store.subscribe(SystemConst.BASE_UPDATE_DATA, (data) => {
-      if ((window as any).onTabSaveSuccess) {
-        (window as any).onTabSaveSuccess(data);
-        setTimeout(() => window.close(), 300);
-      } else {
-        history.push(`${getMenuPathByParams(MENUS_CODE['system/Role/Detail'], data.id)}`);
-      }
-    });
-    return () => subscription.unsubscribe();
-  }, []);
-
-  return (
-    <PageContainer>
-      <BaseCrud<RoleItem>
-        disableAdd={getButtonPermission('system/Role', ['add'])}
-        actionRef={actionRef}
-        moduleName="role"
-        columns={columns}
-        service={service}
-        search={false}
-        title={intl.formatMessage({
-          id: 'pages.system.role',
-          defaultMessage: '角色列表',
-        })}
-        schema={schema}
-      />
-    </PageContainer>
-  );
-});
-export default Role;