Browse Source

fix(bug): bug#5487、5349、5203、5160、5066、5012、5000、5541、5232

xieyonghong 3 years atrás
parent
commit
54f944e52e

+ 7 - 2
src/app.tsx

@@ -171,7 +171,12 @@ export const request: RequestConfig = {
       history.push('/user/login');
       return;
     }
-    if (response.status === 400 || response.status === 500 || response.status === 404) {
+    if (
+      response.status === 400 ||
+      response.status === 500 ||
+      response.status === 404 ||
+      response.status === 403
+    ) {
       // 添加clone() 避免后续其它地方用response.text()时报错
       response
         .clone()
@@ -180,7 +185,7 @@ export const request: RequestConfig = {
           if (resp) {
             notification.error({
               key: 'error',
-              message: JSON.parse(resp).message || '服务器内部错误!',
+              message: JSON.parse(resp || '{}').message || '服务器内部错误!',
             });
           } else {
             response

+ 1 - 0
src/components/FRuleEditor/Editor/index.tsx

@@ -90,6 +90,7 @@ interface Props {
 const Editor = (props: Props) => {
   const editorRef = useRef<monacoEditor.editor.IStandaloneCodeEditor>();
   const editorDidMountHandle = (editor: monacoEditor.editor.IStandaloneCodeEditor) => {
+    editor.getAction('editor.action.formatDocument').run();
     editorRef.current = editor;
   };
 

+ 1 - 0
src/components/FormItems/MetadataJsonInput/index.tsx

@@ -55,6 +55,7 @@ export default (props: MetaDataJsonInputProps) => {
   };
 
   const editorDidMountHandle = (editor: any) => {
+    editor.getAction('editor.action.formatDocument').run();
     editor.onDidContentSizeChange?.(() => {
       editor.getAction('editor.action.formatDocument').run();
     });

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

@@ -49,7 +49,7 @@ export const typeList = {
     aliyunSms: '阿里云短信',
   },
   email: {
-    embedded: '默认',
+    embedded: '邮件',
   },
   webhook: {
     http: 'webhook',

+ 1 - 0
src/pages/device/Command/cat/index.tsx

@@ -24,6 +24,7 @@ const Cat = (props: Props) => {
         height={300}
         language={'json'}
         editorDidMount={(editor) => {
+          editor.getAction('editor.action.formatDocument').run();
           editor.onDidContentSizeChange?.(() => {
             editor.getAction('editor.action.formatDocument').run();
             // .finally(() => {

+ 1 - 0
src/pages/device/Instance/Detail/Functions/AdvancedMode.tsx

@@ -80,6 +80,7 @@ export default (props: FunctionProps) => {
 
   const editorDidMountHandle = (editor: any) => {
     monacoRef.current = editor;
+    editor.getAction('editor.action.formatDocument').run();
     editor.onDidContentSizeChange?.(() => {
       editor.getAction('editor.action.formatDocument').run();
     });

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

@@ -335,7 +335,7 @@ const Product = observer(() => {
       // hideInSearch: true,
     },
     {
-      dataIndex: 'categoryId',
+      dataIndex: 'classifiedId',
       title: '分类',
       valueType: 'treeSelect',
       hideInTable: true,

+ 1 - 0
src/pages/device/components/Metadata/Cat/index.tsx

@@ -98,6 +98,7 @@ const Cat = observer((props: Props) => {
                 language="json"
                 value={value}
                 editorDidMount={(editor) => {
+                  editor.getAction('editor.action.formatDocument').run();
                   editor.onDidScrollChange?.(() => {
                     editor.getAction('editor.action.formatDocument').run();
                   });

+ 1 - 1
src/pages/home/index.tsx

@@ -9,7 +9,7 @@ import Service from './service';
 export const service = new Service();
 const Home = () => {
   type ViewType = keyof typeof ViewMap;
-  const [current, setCurrent] = useState<ViewType>('comprehensive');
+  const [current, setCurrent] = useState<ViewType>('init'); // 默认为初始化
 
   const ViewMap = {
     init: <Init changeView={(value: ViewType) => setCurrent(value)} />,

+ 1 - 1
src/pages/media/Device/Save/index.tsx

@@ -276,7 +276,7 @@ const Save = () => {
                             buttonStyle="solid"
                             options={[
                               { label: 'UDP', value: 'UDP' },
-                              { label: 'TCP', value: 'TCP_PASSIVE' },
+                              { label: 'TCP被动', value: 'TCP_PASSIVE' },
                             ]}
                           />
                         </Form.Item>

+ 31 - 24
src/pages/notice/Template/Debug/index.tsx

@@ -74,20 +74,25 @@ const Debug = observer(() => {
               const a = variableRef.current?.find((i: any) => i.id === _id.value);
               const _configId = configId.value();
               const businessType = a?.expands?.businessType;
-              if (id === 'dingTalk' && _configId) {
-                switch (businessType) {
-                  case 'org':
-                    // 获取org
-                    const orgList = await service.dingTalk.getDepartments(_configId);
-                    format.setComponent(Select);
-                    format.setDataSource(orgList);
-                    break;
-                  case 'user':
-                    // 获取user
-                    const userList = await service.dingTalk.getUser(_configId);
-                    format.setComponent(Select);
-                    format.setDataSource(userList);
-                    break;
+              if (id === 'dingTalk' || id === 'weixin') {
+                if (_configId) {
+                  switch (businessType) {
+                    case 'org':
+                      // 获取org
+                      const orgList = await service[id].getDepartments(_configId);
+                      format.setComponent(Select);
+                      format.setDataSource(orgList);
+                      break;
+                    case 'user':
+                      // 获取user
+                      const userList = await service[id].getUser(_configId);
+                      format.setComponent(Select);
+                      format.setDataSource(userList);
+                      break;
+                  }
+                } else if (businessType === 'org' || businessType === 'user') {
+                  format.setComponent(Select);
+                  format.setDataSource([]);
                 }
               }
             }
@@ -100,16 +105,18 @@ const Debug = observer(() => {
   useEffect(() => {
     // const data = state.current;
     // 从后端接口来获取变量参数
-    service.getVariableDefinitions(state.current?.id || '').then((resp) => {
-      const _template = resp.result;
-      if (_template?.variableDefinitions?.length > 0) {
-        variableRef.current = _template?.variableDefinitions;
-        form.setFieldState('variableDefinitions', (state1) => {
-          state1.visible = true;
-          state1.value = _template?.variableDefinitions;
-        });
-      }
-    });
+    if (state.current?.id) {
+      service.getVariableDefinitions(state.current?.id || '').then((resp) => {
+        const _template = resp.result;
+        if (_template?.variableDefinitions?.length > 0) {
+          variableRef.current = _template?.variableDefinitions;
+          form.setFieldState('variableDefinitions', (state1) => {
+            state1.visible = true;
+            state1.value = _template?.variableDefinitions;
+          });
+        }
+      });
+    }
   }, [state.current, state.debug]);
 
   const SchemaField = createSchemaField({

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

@@ -103,7 +103,9 @@ const Template = observer(() => {
     {
       dataIndex: 'provider',
       title: '通知方式',
-      renderText: (text, record) => typeList[record.type][record.provider],
+      renderText: (text, record) => {
+        return typeList[record.type][record.provider];
+      },
       valueType: 'select',
       valueEnum: list[id],
     },

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

@@ -58,11 +58,11 @@
         }
 
         .new-alarm-item-content {
-          flex-grow: 1;
+          width: ~'calc(100% - 360px)';
         }
 
         .new-alarm-item-state {
-          width: 110px;
+          width: 90px;
           text-align: center;
 
           .error {