wzyyy 3 years atrás
parent
commit
ce4c85742e

+ 4 - 4
config/proxy.ts

@@ -15,13 +15,13 @@ export default {
       // target: 'http://120.79.18.123:8844/',
       // ws: 'ws://120.79.18.123:8844/',
       // 测试环境
-      // target: 'http://120.77.179.54:8844/',
-      // ws: 'ws://120.77.179.54:8844/',
+      target: 'http://120.77.179.54:8844/',
+      ws: 'ws://120.77.179.54:8844/',
       // target: 'http://192.168.32.65:8850/',
       // ws: 'ws://192.168.32.65:8850/',
       //v2环境
-      ws: 'ws://47.109.52.230:8844',
-      target: 'http://47.109.52.230:8844',
+      // ws: 'ws://47.109.52.230:8844',
+      // target: 'http://47.109.52.230:8844',
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
     },

+ 4 - 2
src/components/SearchComponent/index.tsx

@@ -218,6 +218,9 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
               switch (_field?.valueType) {
                 case 'select':
                   let __option: { label: any; value: any }[] | FieldDataSource | undefined = [];
+                  f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                    state.value = 'eq';
+                  });
                   if (_field?.valueEnum) {
                     __option = Object.values(_field?.valueEnum || {}).map((item) => ({
                       label: item.text,
@@ -503,9 +506,8 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     <Menu className={styles.history}>
       {history.length > 0 ? (
         history.map((item: SearchHistory) => (
-          <Menu.Item onClick={() => handleHistory(item)} key={item.id || randomString(9)}>
+          <Menu.Item key={item.id || randomString(9)}>
             <div className={styles.list}>
-              <Typography.Text ellipsis={{ tooltip: item.name }}>{item.name}</Typography.Text>
               <Typography.Text
                 ellipsis={{ tooltip: item.name }}
                 onClick={() => handleHistory(item)}

+ 8 - 0
src/pages/device/Instance/Detail/Functions/form.tsx

@@ -168,6 +168,14 @@ export default (props: FunctionProps) => {
       title: '值',
       dataIndex: 'value',
       align: 'center',
+      formItemProps: {
+        rules: [
+          {
+            required: true,
+            message: '此项是必填项',
+          },
+        ],
+      },
       renderFormItem: (_, row: any) => {
         return getItemNode(row.record);
       },

+ 1 - 1
src/pages/device/Instance/Detail/Running/Event/index.tsx

@@ -128,7 +128,7 @@ const EventLog = (props: Props) => {
         // }}
       />
       <ProTable
-        size="small"
+        // size="small"
         rowKey="id"
         actionRef={actionRef}
         search={false}

+ 1 - 0
src/pages/device/Instance/Detail/Running/index.tsx

@@ -26,6 +26,7 @@ const Running = () => {
           const li = list.filter((i) => {
             return i?.name.indexOf(value) !== -1;
           });
+          console.log(li, value);
           setList(li);
         } else {
           setList(metadata?.events || []);

+ 18 - 3
src/pages/device/Instance/index.tsx

@@ -534,9 +534,11 @@ const Instance = () => {
             popConfirm={{
               title: '已启用的设备无法删除,确认删除选中的禁用状态设备?',
               onConfirm: () => {
+                const array: any = [];
                 InstanceModel.selectedRows.forEach((value, key) => {
                   if (value !== 'notActive') {
                     InstanceModel.selectedRows.delete(key);
+                    array.push(key);
                   }
                 });
                 if (!InstanceModel.selectedRows.size) return;
@@ -544,6 +546,7 @@ const Instance = () => {
                   if (resp.status === 200) {
                     onlyMessage('操作成功');
                     actionRef.current?.reset?.();
+                    setBindKeys(array);
                   }
                 });
               },
@@ -651,12 +654,24 @@ const Instance = () => {
         }
         rowKey="id"
         search={false}
+        tableAlertRender={({ selectedRowKeys }) => <div>已选择 {selectedRowKeys.length} 项</div>}
+        tableAlertOptionRender={() => {
+          return (
+            <a
+              onClick={() => {
+                setBindKeys([]);
+              }}
+            >
+              取消选择
+            </a>
+          );
+        }}
         pagination={{ pageSize: 10 }}
         rowSelection={{
           selectedRowKeys: bindKeys,
-          // onChange: (selectedRowKeys) => {
-          //   setBindKeys(selectedRowKeys);
-          // },
+          onChange: (selectedRowKeys) => {
+            setBindKeys(selectedRowKeys);
+          },
           onSelect: (record, selected) => {
             if (selected) {
               InstanceModel.selectedRows.set(record.id, record?.state?.value);

+ 3 - 3
src/pages/device/Product/Detail/Access/AccessConfig/index.tsx

@@ -58,8 +58,8 @@ const AccessConfig = (props: Props) => {
                 terms: [
                   {
                     column: 'provider',
-                    termType: 'eq',
-                    value: 'child-device',
+                    termType: 'in',
+                    value: 'child-device,edge-child-device',
                   },
                   {
                     column: 'state',
@@ -162,7 +162,7 @@ const AccessConfig = (props: Props) => {
             messageProtocol: currrent.protocol,
           };
           const metatdata = JSON.parse(productModel.current?.metadata || '{}');
-          if (obj.accessProvider === 'gb28181-2016') {
+          if (!productModel.current?.metadata) {
             const response = await service.getConfigView(
               obj?.messageProtocol || '',
               obj?.transportProtocol || '',

+ 1 - 1
src/pages/init-home/service.ts

@@ -51,7 +51,7 @@ class Service extends BaseService<any> {
   // 更新全部菜单
   // updateMenus = (data: any) =>
   //   request(`${SystemConst.API_BASE}/menu/_all`, { method: 'PATCH', data });
-  updateMenus = (data: any) => request(`${SystemConst.API_BASE}/menu`, { method: 'PATCH', data });
+  updateMenus = (data: any) => request(`${this.uri}/iot/_all`, { method: 'PATCH', data });
 
   // 添加角色
   addRole = (data: any) => request(`/${SystemConst.API_BASE}/role`, { method: 'POST', data });

+ 11 - 9
src/pages/notice/Config/Debug/index.tsx

@@ -232,15 +232,17 @@ const Debug = observer(() => {
     const resp = await service.debug(
       state?.current.id,
       templateId,
-      data.variableDefinitions?.reduce(
-        (previousValue: any, currentValue: { id: any; value: any }) => {
-          return {
-            ...previousValue,
-            [currentValue.id]: currentValue.value,
-          };
-        },
-        {},
-      ),
+      data.variableDefinitions
+        ? data.variableDefinitions?.reduce(
+            (previousValue: any, currentValue: { id: any; value: any }) => {
+              return {
+                ...previousValue,
+                [currentValue.id]: currentValue.value,
+              };
+            },
+            {},
+          )
+        : {},
     );
     if (resp.status === 200) {
       onlyMessage('操作成功!');

+ 7 - 1
src/pages/notice/Template/Debug/index.tsx

@@ -42,11 +42,11 @@ const Debug = observer(() => {
 
           onFieldReact('variableDefinitions.*.type', async (field) => {
             const value = (field as Field).value;
+
             const format = field.query('.value').take() as Field;
             const _id = field.query('.id').take() as Field;
 
             const configId = field.query('configId');
-
             if (format && value) {
               switch (value) {
                 case 'date':
@@ -78,6 +78,7 @@ const Debug = observer(() => {
             }
             if (variableRef.current) {
               const a = variableRef.current?.find((i: any) => i.id === _id.value);
+              console.log(a, 'a');
               const _configId = configId.value();
               const businessType = a?.expands?.businessType;
               if (id === 'dingTalk' || id === 'weixin') {
@@ -101,6 +102,11 @@ const Debug = observer(() => {
                       format.setComponent(Select);
                       format.setDataSource(tagList);
                       break;
+                    case 'file':
+                      format.setComponent(FUpload, {
+                        type: 'file',
+                      });
+                      break;
                   }
                 } else if (['tag', 'org', 'user'].includes(businessType)) {
                   format.setComponent(Select);

+ 41 - 1
src/pages/notice/Template/Detail/index.tsx

@@ -327,6 +327,29 @@ const Detail = observer(() => {
               form1.setValuesIn('variableDefinitions', _result);
             }
           });
+          onFieldValueChange('template.body', (field, form1) => {
+            const value = (field as Field).value;
+            console.log(value);
+            const idList = value.match(pattern)?.filter((i: string) => i);
+            form1.setFieldState('variableDefinitions', (state1) => {
+              state1.visible = !!idList && idList.length > 0;
+            });
+            if (form1.modified) {
+              // 获取缓存的KEY;
+              const oldKey = variableDefinitionsRef.current?.map((i) => i.id);
+              const newKey = [...new Set(idList)];
+              const _result = newKey.map((item: any) =>
+                oldKey?.includes(item)
+                  ? variableDefinitionsRef.current?.find((i) => i.id === item)
+                  : {
+                      id: item,
+                      type: 'string',
+                      format: '%s',
+                    },
+              );
+              form1.setValuesIn('variableDefinitions', _result);
+            }
+          });
           onFieldValueChange('variableDefinitions.*.*', (field) => {
             // 缓存编辑后的数据
             variableDefinitionsRef.current = field.query('variableDefinitions').value();
@@ -888,6 +911,12 @@ const Detail = observer(() => {
                         'x-component-props': {
                           placeholder: '请输入标题',
                         },
+                        'x-validator': [
+                          {
+                            max: 64,
+                            message: '最多可输入64个字符',
+                          },
+                        ],
                       },
                     },
                     'x-reactions': {
@@ -909,6 +938,12 @@ const Detail = observer(() => {
                         'x-decorator': 'FormItem',
                         'x-component-props': {
                           placeholder: '请输入标题',
+                          'x-validator': [
+                            {
+                              max: 64,
+                              message: '最多可输入64个字符',
+                            },
+                          ],
                         },
                       },
                       '{url:picUrl}': {
@@ -1326,13 +1361,18 @@ const Detail = observer(() => {
             column2: {
               type: 'void',
               'x-component': 'ArrayTable.Column',
-              'x-component-props': { title: '名称', width: '120px' },
+              'x-component-props': { title: '名称', minWidth: '120px' },
               properties: {
                 name: {
                   type: 'string',
                   'x-decorator': 'FormItem',
                   required: true,
                   'x-component': 'Input',
+                  'x-component-props': {
+                    style: {
+                      width: 100,
+                    },
+                  },
                   'x-validator': [
                     {
                       max: 64,

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

@@ -172,6 +172,10 @@ const Save = (props: Props) => {
                 required: true,
                 message: '请输入名称',
               },
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
             ],
           },
           targetType: {

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

@@ -407,7 +407,7 @@ const Configuration = () => {
               <PermissionButton
                 type="link"
                 tooltip={{
-                  title: record.state?.value === 'disabled' ? '删除' : '已启用,不能删除',
+                  title: record.state?.value === 'disabled' ? '删除' : '请先禁用该告警,再删除',
                 }}
                 disabled={record.state?.value !== 'disabled'}
                 popConfirm={{

+ 6 - 10
src/pages/rule-engine/Scene/Save/action/device/index.tsx

@@ -7,7 +7,7 @@ import TagModal from './tagModal';
 import { ItemGroup } from '@/pages/rule-engine/Scene/Save/components';
 import RelationSelect from './relationSelect';
 import encodeQuery from '@/utils/encodeQuery';
-import { isNoCommunity } from '@/utils/util';
+// import { isNoCommunity } from '@/utils/util';
 
 interface DeviceProps {
   name: number;
@@ -87,15 +87,11 @@ export default (props: DeviceProps) => {
 
   useEffect(() => {
     if (props.triggerType === 'device') {
-      if (isNoCommunity) {
-        setSourceList([
-          ...DefaultSourceOptions,
-          { label: '按关系', value: SourceEnum.relation },
-          { label: '按标签', value: SourceEnum.tag },
-        ]);
-      } else {
-        setSourceList([...DefaultSourceOptions, { label: '按标签', value: SourceEnum.tag }]);
-      }
+      setSourceList([
+        ...DefaultSourceOptions,
+        { label: '按关系', value: SourceEnum.relation },
+        { label: '按标签', value: SourceEnum.tag },
+      ]);
     } else {
       setSourceList(DefaultSourceOptions);
     }

+ 1 - 1
src/pages/system/Menu/service.ts

@@ -30,7 +30,7 @@ class Service extends BaseService<MenuItem> {
 
   // 更新全部菜单
   // updateMenus = (data: any) => request(`${this.uri}/_all`, { method: 'PATCH', data });
-  updateMenus = (data: any) => request(`${this.uri}`, { method: 'PATCH', data });
+  updateMenus = (data: any) => request(`${this.uri}/iot/_all`, { method: 'PATCH', data });
 
   getSystemPermission = () =>
     request(`${SystemConst.API_BASE}/system/resources/permission`, {