فهرست منبع

feat(wise-cost-util): 增加判断人材机大类方法

vian 5 سال پیش
والد
کامیت
ddebc4297a
1فایلهای تغییر یافته به همراه18 افزوده شده و 1 حذف شده
  1. 18 1
      wise-cost-util/src/glj.ts

+ 18 - 1
wise-cost-util/src/glj.ts

@@ -1,4 +1,4 @@
-import { IBaseGlj, IInfoPriceItem, TaxType } from '@sc/types';
+import { GljType, IBaseGlj, IInfoPriceItem, TaxType } from '@sc/types';
 
 export const getInfoMarketPrice = (info: IInfoPriceItem, taxType: TaxType) => {
   // 1: 一般计税 2: 简易计税
@@ -25,3 +25,20 @@ export const getIndex = (obj: IBaseGlj, pops = ['code', 'name', 'specs', 'unit',
   index = arr.join('|-|');
   return index;
 };
+
+// 是否是人工
+export const isLabour = (type: GljType) => {
+  return type === GljType.LABOUR;
+};
+
+// 是否是材料
+export const isMaterial = (type: GljType) => {
+  const rootType = +String(type).charAt(0);
+  return rootType === 2;
+};
+
+// 是否是机械
+export const isMachine = (type: GljType) => {
+  const rootType = +String(type).charAt(0);
+  return rootType === 3;
+};