Просмотр исходного кода

feat(types): 修改wise-cost-util版本号

LuoHaoxuan 3 лет назад
Родитель
Сommit
7cc9686e4f
3 измененных файлов с 32 добавлено и 34 удалено
  1. 1 1
      wise-cost-util/package.json
  2. 30 32
      wise-cost-util/src/businessForm.ts
  3. 1 1
      wise-cost-util/src/index.ts

+ 1 - 1
wise-cost-util/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/wise-cost-util",
-  "version": "1.1.8",
+  "version": "1.1.9",
   "description": "wise-cost项目前后端业务通用工具包",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

+ 30 - 32
wise-cost-util/src/businessForm.ts

@@ -1,39 +1,37 @@
-import {uniq} from 'lodash'
-import { IMatterNode} from '@sc/types';
+import { uniq } from 'lodash';
+import { IMatterNode } from '@sc/types';
 
 // 获取表单必填的字段名称
 export const getRequiredFields = (data: any, nameList: string[] = []) => {
-    if (!data) return [];
-    for (const key in data.properties) {
-      if (data.properties[key].name) {
-        if (data.properties[key].required) nameList.push(data.properties[key].name);
-      } else getRequiredFields(data.properties[key], nameList);
-    }
-    return uniq(nameList);
-  };
+  if (!data) return [];
+  for (const key in data.properties) {
+    if (data.properties[key].name) {
+      if (data.properties[key].required) nameList.push(data.properties[key].name);
+    } else getRequiredFields(data.properties[key], nameList);
+  }
+  return uniq(nameList);
+};
 
-
-  // 获取可编辑的表单
-  export const getEditAbleForms = (data: IMatterNode[]) => {
-    const forms: any[] = [];
-    data.forEach(d => {
-      d.components.forEach(c => {
-        if (c.name === 'form' && c.permission.editable) {
-          forms.push(c.data);
-        }
-      });
+// 获取可编辑的表单
+export const getEditAbleForms = (data: IMatterNode[]) => {
+  const forms: any[] = [];
+  data.forEach(d => {
+    d.components.forEach(c => {
+      if (c.name === 'form' && c.permission.editable) {
+        forms.push(c.data);
+      }
     });
-    return forms;
-  };
-
+  });
+  return forms;
+};
 
-  // 获取所有表单的所有必填字段
+// 获取所有表单的所有必填字段
 export const getAllRequiredFields = (matters: IMatterNode[]) => {
-    const forms = getEditAbleForms(matters);
-    if (!forms.length) return [];
-    const requiredFieldNames: string[] = [];
-    forms.forEach(form => {
-      requiredFieldNames.push(...getRequiredFields(form));
-    });
-    return requiredFieldNames;
-  };
+  const forms = getEditAbleForms(matters);
+  if (!forms.length) return [];
+  const requiredFieldNames: string[] = [];
+  forms.forEach(form => {
+    requiredFieldNames.push(...getRequiredFields(form));
+  });
+  return requiredFieldNames;
+};

+ 1 - 1
wise-cost-util/src/index.ts

@@ -6,4 +6,4 @@ export * from './material';
 export * from './process';
 export * from './threeInOneProcess';
 export * from './rationInst';
-export * from './businessForm'
+export * from './businessForm';