浏览代码

chore: 明细增加真实姓名

xyh 2 年之前
父节点
当前提交
0bf463b7d2

+ 1 - 6
packages/app/src/components/table-search-provider/index.tsx

@@ -1,5 +1,4 @@
 import {TableSearchAction, useTableSearchContextReducer} from '@hooks';
-import {ErrorBoundary} from '@components';
 import {Dispatch, ReactElement, ReactNode} from 'react';
 import {Context} from 'use-context-selector';
 
@@ -17,11 +16,7 @@ function TableSearchProvider<T extends Record<string, unknown>>({
   const {Provider} = context;
   const value = useTableSearchContextReducer(state);
 
-  return (
-    <ErrorBoundary>
-      <Provider value={value}>{children}</Provider>
-    </ErrorBoundary>
-  );
+  return <Provider value={value}>{children}</Provider>;
 }
 
 export default TableSearchProvider;

+ 1 - 1
packages/app/src/hooks/use-table-search-event/index.ts

@@ -25,7 +25,7 @@ export function useTableSearchEvent<T>(
 
 export function useTableSearchToolEvents<T>(
   context: Context<TableSearchContext<T>>,
-  payload: Partial<T>,
+  payload: T,
   options: {searchCallback?: () => void; resetCallback?: () => void} = {},
 ) {
   const dispatch = useContextSection(context, state => state[1]);

+ 2 - 0
packages/app/src/models/request/materialBind.ts

@@ -19,4 +19,6 @@ export type GetMaterialBindrListParams = {
   wllbCode: string;
   /** 用户名称 */
   userName: string;
+  /** 真实姓名 */
+  realName: string;
 } & ListParams;

+ 2 - 0
packages/app/src/models/request/rawMaterial.ts

@@ -20,6 +20,8 @@ export type GetWarehousingFlowingListParams = {
   wbs: string;
   /** 供应商编号 */
   supplierId: string;
+  /** 真实姓名 */
+  realName: string;
 } & ListParams;
 
 /** 半成品出库流水 */

+ 2 - 1
packages/app/src/pages/container-scrap/filter/index.tsx

@@ -8,9 +8,10 @@ const Filter: FC = function () {
   const [{dates, start, end}, setDates] = useRangeDate();
   const {isSearching} = useContextSection(searchContext, state => state[0]);
   const [fields, {onChange, resetState}] = useFilterField({operationName: ''}, true);
+  const containerName = useContextSection(context, state => state[0].containerName);
   const [, {onSearch, onReset}] = useTableSearchToolEvents(
     context,
-    {...fields, startTime: start, endTime: end},
+    {...fields, startTime: start, endTime: end, containerName},
     {resetCallback: resetState},
   );
 

+ 3 - 3
packages/app/src/pages/container/filter/index.tsx

@@ -9,7 +9,7 @@ const Filter: FC = function () {
     {
       department: '',
       type: '',
-      name: '',
+      containerName: '',
       code: '',
     },
     true,
@@ -31,8 +31,8 @@ const Filter: FC = function () {
         <FilterField
           name='containerName'
           label='容器名称'
-          value={fields.name}
-          onChange={onChange('name')}
+          value={fields.containerName}
+          onChange={onChange('containerName')}
         />
         <FilterField
           name='containerType'

+ 8 - 3
packages/app/src/pages/inventory-detail/filter/index.tsx

@@ -9,9 +9,14 @@ const Filter: FC = function () {
     {wllbCode: '', name: '', accountSleeve: ''},
     true,
   );
-  const [, {onSearch, onReset}] = useTableSearchToolEvents(context, fields, {
-    resetCallback: resetState,
-  });
+  const uuid = useContextSection(context, state => state[0].uuid);
+  const [, {onSearch, onReset}] = useTableSearchToolEvents(
+    context,
+    {...fields, uuid},
+    {
+      resetCallback: resetState,
+    },
+  );
   const {isSearching} = useContextSection(searchContext, state => state[0]);
 
   return (

+ 8 - 3
packages/app/src/pages/inventory-log/filter/index.tsx

@@ -14,9 +14,14 @@ const Filter: FC = function () {
     },
     true,
   );
-  const [, {onSearch, onReset}] = useTableSearchToolEvents(context, fields, {
-    resetCallback: resetState,
-  });
+  const uuid = useContextSection(context, state => state[0].uuid);
+  const [, {onSearch, onReset}] = useTableSearchToolEvents(
+    context,
+    {...fields, uuid},
+    {
+      resetCallback: resetState,
+    },
+  );
   const isSearching = useContextSection(searchContext, state => state[0].isSearching);
 
   return (

+ 1 - 0
packages/app/src/pages/material-bind/context.ts

@@ -8,5 +8,6 @@ export const contextState: OriginalListParams<GetMaterialBindrListParams> = {
   materialName: '',
   wllbCode: '',
   userName: '',
+  realName: '',
 };
 export const context = createTableSearchContext(contextState);

+ 7 - 0
packages/app/src/pages/material-bind/filter/index.tsx

@@ -9,6 +9,7 @@ const Filter: FC = function () {
     materialName: '',
     wllbCode: '',
     userName: '',
+    realName: '',
   });
   const {isSearching} = useContextSection(searchContext, state => state[0]);
   const [, {onSearch, onReset}] = useTableSearchToolEvents(context, fields);
@@ -34,6 +35,12 @@ const Filter: FC = function () {
           onChange={onChange('userName')}
           name='userName'
         />
+        <FilterField
+          value={fields.realName}
+          label='真实姓名'
+          onChange={onChange('realName')}
+          name='realName'
+        />
         <FilterButtonGroup onSearch={onSearch} isSearching={isSearching} onReset={onReset} />
       </FilterFieldWrapper>
     </Card>

+ 1 - 0
packages/app/src/pages/material-bind/table/hooks.tsx

@@ -9,6 +9,7 @@ const tableColumns: ColumnsType<MaterialBindListData> = [
   {title: '物料编号', dataIndex: 'wllbCode', key: 'wllbCode', width: MIDDLE_TABLE_WIDTH},
   {title: '物料名称', dataIndex: 'materialName', key: 'materialName', width: HUGE_TABLE_WIDTH},
   {title: '用户名称', dataIndex: 'userName', key: 'userName', width: MIDDLE_TABLE_WIDTH},
+  {title: '真实姓名', dataIndex: 'realName', key: 'realName', width: MIDDLE_TABLE_WIDTH},
   {title: '修改人', dataIndex: 'modifyUser', key: 'modifyUser', width: NORMAL_TABLE_WIDTH},
   {title: '修改时间', dataIndex: 'modifyTime', key: 'modifyTime', width: MIDDLE_TABLE_WIDTH},
 ];

+ 2 - 0
packages/app/src/pages/quality/filter/index.tsx

@@ -11,6 +11,8 @@ const Filter: FC = function () {
       materialId: '',
       materialName: '',
       wbs: '',
+      supplierId: '',
+      companyNumber: '',
     },
     true,
   );

+ 1 - 0
packages/app/src/pages/raw-in-stream/context.ts

@@ -14,5 +14,6 @@ export const contextState: OriginalListParams<GetWarehousingFlowingListParams> =
   storageCode: '',
   storageLocationName: '',
   supplierId: '',
+  realName: '',
 };
 export const context = createTableSearchContext(contextState);

+ 1 - 0
packages/app/src/pages/raw-in-stream/filter/index.tsx

@@ -23,6 +23,7 @@ const Filter: FC = function () {
       storageCode: '',
       storageLocationName: '',
       supplierId: '',
+      realName: '',
     },
     true,
   );

+ 2 - 1
packages/app/src/pages/raw-in-stream/filter/state.ts

@@ -6,7 +6,8 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
   ['2', {label: '供应商', type: 'keySelect', value: 'supplierId', selectKey: '供应商/客户'}],
   ['3', {label: 'WBS编号', type: 'field', value: 'wbs'}],
   ['4', {label: '操作人', type: 'field', value: 'userName'}],
-  ['5', {label: '入库时间', type: 'date', value: 'startTime'}],
+  ['5', {label: '真实姓名', type: 'field', value: 'realName'}],
+  ['6', {label: '入库时间', type: 'date', value: 'startTime'}],
 ]);
 
 export const fixedMap: MapValue<typeof contextState>[] = [

+ 6 - 0
packages/app/src/pages/raw-in-stream/table/index.tsx

@@ -64,6 +64,12 @@ const columns: ColumnsType<WarehousingListData> = [
     key: 'userName',
     width: NORMAL_TABLE_WIDTH,
   },
+  {
+    title: '真实姓名',
+    dataIndex: 'realName',
+    key: 'realName',
+    width: NORMAL_TABLE_WIDTH,
+  },
   {
     title: '类型',
     dataIndex: 'type',

+ 1 - 0
packages/app/src/pages/relocation-order/filter/index.tsx

@@ -24,6 +24,7 @@ const Filter: FC = function () {
       warehouseTransferType: '',
       materialCode: '',
       companyCode: '',
+      askGoodsWarehouseId: '',
     },
     true,
   );

+ 1 - 0
packages/app/src/pages/stock/filter/index.tsx

@@ -13,6 +13,7 @@ const Filter: FC = function () {
       companyCode: '',
       customerCode: '',
       wbs: '',
+      supplierId: '',
     },
     true,
   );

+ 2 - 2
packages/app/src/pages/user/filter/state.ts

@@ -2,7 +2,7 @@ import {FilterGroupMap, MapValue} from '@components';
 import {contextState} from '../context';
 
 export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
-  ['1', {label: '真实姓名', type: 'field', value: 'realName'}],
+  ['1', {label: '用户编号', type: 'field', value: 'code'}],
   ['2', {label: '所在部门', type: 'keySelect', value: 'department', selectKey: '部门字典'}],
   ['3', {label: '角色名称', type: 'field', value: 'role'}],
   ['4', {label: '邮箱', type: 'field', value: 'email'}],
@@ -10,6 +10,6 @@ export const sourceMap: FilterGroupMap<typeof contextState> = new Map([
 ]);
 
 export const fixedMap: MapValue<typeof contextState>[] = [
-  {label: '用户编号', type: 'field', value: 'code'},
   {label: '用户名称', type: 'field', value: 'userName'},
+  {label: '真实姓名', type: 'field', value: 'realName'},
 ];

+ 1 - 1
packages/app/src/routes/routes.tsx

@@ -191,5 +191,5 @@ export const PutInStorageWithOther = lazy(
   () => import(/* webpackChunkName: "putInStorageWithOther" */ '@pages/stock-in'),
 );
 export const PutOutStorageWithOther = lazy(
-  () => import(/** webpackChunkName: "putOutStorageWithOther" */ '@pages/stock-out'),
+  () => import(/* webpackChunkName: "putOutStorageWithOther" */ '@pages/stock-out'),
 );

+ 33 - 0
packages/app/src/utils/filter-options/index.test.ts

@@ -0,0 +1,33 @@
+import {filterOptions} from '.';
+
+describe('filterOptions', function () {
+  it('声明', function () {
+    expect(filterOptions).toBeDefined();
+    expect(filterOptions).toBeInstanceOf(Function);
+  });
+
+  it('结果测试', function () {
+    let result = filterOptions('', {label: 'ceshi', value: 'ceshi'});
+    expect(result).toBeTruthy();
+
+    result = filterOptions('ce', {label: 'ceshi', value: 'ceshi'});
+    expect(result).toBeTruthy();
+
+    result = filterOptions('cedd', {label: 'ceshi', value: 'ceshi'});
+    expect(result).toBeFalsy();
+
+    result = filterOptions('ceshi', {label: 'ceshi', value: 'ceshi'});
+    expect(result).toBeTruthy();
+
+    result = filterOptions('ceshi2', {label: 'ceshi', value: 'ceshi'});
+    expect(result).toBeFalsy();
+  });
+
+  it('测试null', function () {
+    let result = filterOptions('', {label: null, value: void 0});
+    expect(result).toBeTruthy();
+
+    result = filterOptions('1234', {label: null, value: void 0});
+    expect(result).toBeFalsy();
+  });
+});

+ 5 - 2
packages/app/src/utils/filter-options/index.ts

@@ -1,3 +1,6 @@
-export function filterOptions(input: string, options?: {label: string; value: string}) {
-  return (options?.label.toLowerCase() ?? '').includes(input.toLowerCase());
+export function filterOptions(
+  input: string,
+  options?: {label?: string | null; value?: string | null},
+) {
+  return (options?.label?.toLowerCase() ?? '').includes(input.toLowerCase());
 }