Forráskód Böngészése

fix: bug#9451、9452、9460、9446、8331、9454、8496、8532、8841、9419、9474、9373

xieyonghong 3 éve
szülő
commit
5cad5f0139

+ 3 - 3
src/pages/device/components/Empty/index.tsx

@@ -14,11 +14,11 @@ export default () => {
 
   if (!isIndependent) {
     if (!permission.update) {
-      description = <span>请联系管理员配置物模型属性</span>;
+      description = <span>请联系管理员配置对应产品的物模型功能</span>;
     } else {
       description = (
         <span>
-          暂无数据, 请前往产品配置
+          请配置对应产品的
           <Button
             style={{ margin: 0, padding: '0 4px' }}
             type={'link'}
@@ -26,7 +26,7 @@ export default () => {
               history.push(`${path}?key=metadata`);
             }}
           >
-            物模型
+            物模型属性功能
           </Button>
         </span>
       );

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

@@ -562,6 +562,7 @@ const Edit = observer((props: Props) => {
             'x-component': 'Select',
             enum: PropertySource,
             'x-visible': props.type === 'product',
+            default: 'device',
           },
           'virtualRule.type': {
             type: 'string',

+ 2 - 2
src/pages/device/components/Metadata/Base/index.tsx

@@ -93,7 +93,7 @@ const BaseMetadata = observer((props: Props) => {
             }
           }}
           tooltip={{
-            title: operateLimits('add', type) ? '暂不支持' : '编辑',
+            title: operateLimits('updata', type) ? '当前的存储方式不支持编辑' : '编辑',
           }}
         >
           <EditOutlined />
@@ -211,7 +211,7 @@ const BaseMetadata = observer((props: Props) => {
             icon={<PlusOutlined />}
             type="primary"
             tooltip={{
-              title: operateLimits('add', type) ? '暂不支持' : '新增',
+              title: operateLimits('add', type) ? '当前的存储方式不支持新增' : '新增',
             }}
           >
             {intl.formatMessage({

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

@@ -40,7 +40,7 @@ const Cat = observer((props: Props) => {
       } else {
         service.detail(id).then((resp) => {
           setLoading(false);
-          productModel.current = resp.result;
+          // productModel.current = resp.result;
           setValue(resp.result.metadata);
         });
       }

+ 2 - 0
src/pages/iot-card/CardManagement/ExportModal.tsx

@@ -6,6 +6,7 @@ import moment from 'moment';
 
 type ExportModalType = {
   onCancel: () => void;
+  onOk: () => void;
   keys: string[];
 };
 
@@ -26,6 +27,7 @@ const ExportModal = (props: ExportModalType) => {
           `物联卡管理-${moment(new Date()).format('YYYY/MM/DD HH:mm:ss')}`,
           type.current,
         );
+        props.onOk?.();
       }
     });
   };

+ 3 - 0
src/pages/iot-card/CardManagement/index.tsx

@@ -507,6 +507,9 @@ const CardManagementNode = () => {
           onCancel={() => {
             setExportVisible(false);
           }}
+          onOk={() => {
+            setExportVisible(false);
+          }}
         />
       )}
       {importVisible && (

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

@@ -113,10 +113,7 @@ const Template = observer(() => {
           tooltip={{ title: '导出' }}
           isPermission={templatePermission.export}
           onClick={() => {
-            downloadObject(
-              record,
-              `${record.name}-${moment(new Date()).format('YYYY/MM/DD HH:mm:ss')}`,
-            );
+            downloadObject(record, `${record.name}-${moment(new Date()).format('YYYY_MM_DD')}`);
           }}
         >
           <ArrowDownOutlined />

+ 1 - 1
src/pages/rule-engine/Scene/Save/action/DeviceOutput/index.tsx

@@ -184,7 +184,7 @@ export default observer((props: Props) => {
   }, [props.value]);
 
   useEffect(() => {
-    const item = FormModel.current?.branches?.[0].then?.[0]?.actions?.[0].device?.productId;
+    const item = FormModel.current?.branches?.[0].then?.[0]?.actions?.[0]?.device?.productId;
     formProductIdRef.current = item;
     // console.log('---------', FormModel.current.options?.trigger?.name)
   }, []);

+ 5 - 3
src/pages/system/Department/Tree/tree.tsx

@@ -154,10 +154,10 @@ export default (props: TreeProps) => {
 
       dig(searchTree);
 
-      const arr = ArrayToTree([...treeArray.values()]);
+      const arr = ArrayToTree(cloneDeep([...treeArray.values()]));
       setTreeData(arr);
     } else {
-      setTreeData([...TreeMap.values()]);
+      setTreeData(ArrayToTree(cloneDeep([...TreeMap.values()])));
     }
   };
 
@@ -271,7 +271,9 @@ export default (props: TreeProps) => {
         type="primary"
         isPermission={permission.add}
         onClick={() => {
-          setData({ sortIndex: treeData && treeData.length + 1 });
+          const sortIndex =
+            treeData && treeData.length ? treeData[treeData.length - 1].sortIndex + 1 : 1;
+          setData({ sortIndex });
           setVisible(true);
           setTreeDataList(treeData);
         }}

+ 1 - 0
src/pages/system/Department/save.tsx

@@ -98,6 +98,7 @@ const Save = <T extends object>(props: SaveModalProps<T>) => {
           if (item) {
             if (item.children && item.children.length) {
               f.setFieldState(typeFiled.query('.sortIndex'), async (state) => {
+                console.log(item.children);
                 state.value = item.children[item.children.length - 1].sortIndex + 1;
               });
             } else {

+ 1 - 1
src/pages/system/Menu/Detail/edit.tsx

@@ -337,7 +337,7 @@ export default (props: EditProps) => {
                 saveData();
               }}
               loading={loading}
-              isPermission={getOtherPermission(['add', 'update'])}
+              isPermission={getOtherPermission(['update'])}
             >
               {intl.formatMessage({
                 // id: `pages.data.option.${disabled ? 'edit' : 'save'}`,

+ 23 - 22
src/pages/system/Menu/Setting/baseMenu.ts

@@ -56,7 +56,7 @@ export default [
         permissions: [],
         children: [
           {
-            code: 'notice',
+            code: 'notice/Config',
             name: '通知配置',
             owner: 'iot',
             //parentId: '1',
@@ -208,7 +208,7 @@ export default [
             ],
           },
           {
-            code: 'notice',
+            code: 'notice/Template',
             name: '通知模板',
             owner: 'iot',
             //parentId: '1',
@@ -1024,16 +1024,16 @@ export default [
                   },
                 ],
               },
-              {
-                id: 'action',
-                name: '启/禁用',
-                permissions: [
-                  {
-                    permission: 'protocol-supports',
-                    actions: ['enable', 'disable', 'query', 'save'],
-                  },
-                ],
-              },
+              // {
+              //   id: 'action',
+              //   name: '启/禁用',
+              //   permissions: [
+              //     {
+              //       permission: 'protocol-supports',
+              //       actions: ['enable', 'disable', 'query', 'save'],
+              //     },
+              //   ],
+              // },
               {
                 id: 'delete',
                 name: '删除',
@@ -3299,16 +3299,17 @@ export default [
               },
             ],
           },
-          {
-            id: 'setting',
-            name: '配置',
-            permissions: [
-              {
-                permission: 'menu',
-                actions: ['query', 'save', 'grant'],
-              },
-            ],
-          },
+          // 超管才具备该权限
+          // {
+          //   id: 'setting',
+          //   name: '配置',
+          //   permissions: [
+          //     {
+          //       permission: 'menu',
+          //       actions: ['query', 'save', 'grant'],
+          //     },
+          //   ],
+          // },
           {
             id: 'update',
             name: '编辑',

+ 8 - 4
src/pages/system/User/Save/index.tsx

@@ -23,6 +23,7 @@ import { service } from '@/pages/system/User';
 import { Modal, PermissionButton } from '@/components';
 import usePermissions from '@/hooks/permission';
 import { onlyMessage } from '@/utils/util';
+import { getMenuPathByCode } from '@/utils/menu';
 
 interface Props {
   model: 'add' | 'edit' | 'query';
@@ -43,6 +44,9 @@ const Save = (props: Props) => {
 
   const getOrg = () => service.queryOrgList({ paging: false });
 
+  const departmentPath = getMenuPathByCode('system/Department');
+  const rolePath = getMenuPathByCode('system/Role');
+
   const useAsyncDataSource = (api: any) => (field: Field) => {
     field.loading = true;
     api(field).then(
@@ -342,9 +346,9 @@ const Save = (props: Props) => {
                   type="primary"
                   ghost
                   style={{ padding: '0 8px' }}
-                  isPermission={rolePermission.add}
+                  isPermission={rolePermission.add && !!rolePath}
                   onClick={() => {
-                    const tab: any = window.open(`${origin}/#/system/role?save=true`);
+                    const tab: any = window.open(`${origin}/#${rolePath}?save=true`);
                     tab!.onTabSaveSuccess = (value: any) => {
                       form.setFieldState('roleIdList', async (state) => {
                         state.dataSource = await getRole().then((resp) =>
@@ -390,9 +394,9 @@ const Save = (props: Props) => {
                   type="primary"
                   ghost
                   style={{ padding: '0 8px' }}
-                  isPermission={deptPermission.add}
+                  isPermission={deptPermission.add && !!departmentPath}
                   onClick={() => {
-                    const tab: any = window.open(`${origin}/#/system/department?save=true`);
+                    const tab: any = window.open(`${origin}/#${departmentPath}?save=true`);
                     tab!.onTabSaveSuccess = (value: any) => {
                       form.setFieldState('orgIdList', async (state) => {
                         state.dataSource = await getOrg().then((resp) =>

+ 1 - 1
src/utils/util.ts

@@ -54,7 +54,7 @@ export const downloadObject = (record: Record<string, any>, fileName: string, fo
   // 创建隐藏的可下载链接
   const ghostLink = document.createElement('a');
   ghostLink.download = `${record?.name || ''}${fileName}_${moment(new Date()).format(
-    format || 'YYYY/MM/DD HH:mm:ss',
+    format || 'YYYY_MM_DD',
   )}.json`;
   ghostLink.style.display = 'none';
   //字符串内容转成Blob地址