Commit 54da180b3cd8c4c9f126c7bae6039835e5b5aed8

Authored by 曾柯
2 parents fde1e85d bc1e6cd3

Merge remote-tracking branch 'origin/master' into takeOffUpdate

src/pages/approval/ApprovalSetting/api.ts
1 1 import request from '@/utils/request';
2 2 import type { http } from '@/typing/http';
3   -import { Approval_HOST } from '@/utils/host';
  3 +import { Approval_HOST, OFFICE } from '@/utils/host';
4 4  
5 5 /**
6 6 * 审批配置分页列表
... ... @@ -60,3 +60,9 @@ export interface GetCanApproveRolesReq {
60 60 export function getCanApproveRoles(params: GetCanApproveRolesReq): http.PromiseResp<CommonApi.RoleCodeVO[]> {
61 61 return request.get(`${Approval_HOST}/erp/approval/config/approval/role/configurable`, { params });
62 62 }
  63 +/**
  64 + * 查询所有工作类型列表
  65 + */
  66 +export function getOfficeWordTypes(): http.PromiseResp<CommonApi.ShopRpTypeVO[]> {
  67 + return request.get(`${OFFICE}/erp/work/config/group/all/work/types`);
  68 +}
... ...
src/pages/approval/ApprovalSetting/subpages/components/DefaultFlowNewOrEdit.tsx
... ... @@ -17,6 +17,7 @@ import {
17 17 RPTypesSelector,
18 18 BizTypeSelector,
19 19 ShopBizTypeSelector,
  20 + OfficeWordTypeSelector,
20 21 } from './Selectors';
21 22 import { TriggerAll } from '@/pages/approval/FlowSetting/entity';
22 23 import { Condition_Type_Enum as TriggerType } from './PreSettingForm/entity';
... ... @@ -372,6 +373,9 @@ export default function DefaultSettingNewOrEdit(props: Props) {
372 373 {type === TriggerType['门店业态'] && (
373 374 <ShopBizTypeSelector visible={type === TriggerType['门店业态']} index={index} item={item} onChange={onConditionChange} />
374 375 )}
  376 + {type === TriggerType['工作类型'] && (
  377 + <OfficeWordTypeSelector visible={type === TriggerType['工作类型']} index={index} item={item} onChange={onConditionChange} />
  378 + )}
375 379 </FormItem>
376 380 );
377 381 })}
... ...
src/pages/approval/ApprovalSetting/subpages/components/PreSettingForm/entity.ts
... ... @@ -21,7 +21,8 @@ export enum Condition_Type_Enum {
21 21 '缴费申请款项',
22 22 '事项申请款项',
23 23 '报销类型',
24   - '门店业态'
  24 + '门店业态',
  25 + '工作类型'
25 26 }
26 27  
27 28 // 判断规则
... ...
src/pages/approval/ApprovalSetting/subpages/components/Selectors/OfficeWordTypeSelector.tsx 0 → 100644
  1 +import React, { useEffect, useState } from 'react';
  2 +import SelectorWithFull from '@/components/SelectorWithFull';
  3 +import useInitial from '@/hooks/useInitail';
  4 +import { getOfficeWordTypes } from '../../../api';
  5 +
  6 +interface Props {
  7 + visible: boolean;
  8 + index: number;
  9 + item: ApprovalSetting.ConditionVal;
  10 + readOnly?: boolean;
  11 + onChange: (item: ApprovalSetting.ConditionVal, value: any, index: number) => void;
  12 +}
  13 +
  14 +// 工作类型
  15 +export const OfficeWordTypeSelector = ({ visible, index, item, readOnly, onChange }: Props) => {
  16 + const { value } = item;
  17 + const originalData = JSON.parse(value || '{}');
  18 +
  19 + const [delay, setDelay] = useState(true);
  20 + const { data, setParams } = useInitial(getOfficeWordTypes, [], {}, delay);
  21 +
  22 + useEffect(() => {
  23 + if (visible) {
  24 + setDelay(false);
  25 + setParams({}, true);
  26 + }
  27 + }, [visible]);
  28 +
  29 + return (
  30 + <SelectorWithFull
  31 + showSearch
  32 + autoClearSearchValue={false}
  33 + treeNodeFilterProp="label"
  34 + maxTagCount={100}
  35 + disabled={readOnly}
  36 + labelInValue
  37 + value={
  38 + originalData.length > 0
  39 + ? originalData.map((i: any) => ({
  40 + value: i.idOrCode,
  41 + label: i.name,
  42 + }))
  43 + : []
  44 + }
  45 + multiple
  46 + placeholder="请选择工作类型或输入关键字筛选"
  47 + onChange={(value) => onChange(item, value, index)}
  48 + data={data.map((item) => ({ key: item.id, value: item.id, label: item.name }))}
  49 + />
  50 + );
  51 +};
... ...
src/pages/approval/ApprovalSetting/subpages/components/Selectors/index.ts
... ... @@ -14,3 +14,4 @@ export { BrandSelector } from &#39;./BrandSelector&#39;;
14 14 export { RPTypesSelector } from './RPTypesSelector';
15 15 export { BizTypeSelector } from './BizTypeSelector';
16 16 export { ShopBizTypeSelector } from './ShopBizTypeSelector';
  17 +export { OfficeWordTypeSelector } from './OfficeWordTypeSelector';
... ...
src/pages/approval/FlowSetting/subpages/ConditionSetting/components/CustomFlowNewOrEdit.tsx
... ... @@ -17,6 +17,7 @@ import {
17 17 RPTypesSelector,
18 18 BizTypeSelector,
19 19 ShopBizTypeSelector,
  20 + OfficeWordTypeSelector,
20 21 } from '@/pages/approval/ApprovalSetting/subpages/components/Selectors';
21 22 import { TriggerAll } from '@/pages/approval/FlowSetting/entity';
22 23 import { Condition_Type_Enum as TriggerType } from '@/pages/approval/ApprovalSetting/subpages/components/PreSettingForm/entity';
... ... @@ -385,6 +386,9 @@ export default function CustomFlowNewOrEdit(props: Props) {
385 386 {type === TriggerType['门店业态'] && (
386 387 <ShopBizTypeSelector visible={type === TriggerType['门店业态']} index={index} item={item} onChange={onConditionChange} />
387 388 )}
  389 + {type === TriggerType['工作类型'] && (
  390 + <OfficeWordTypeSelector visible={type === TriggerType['工作类型']} index={index} item={item} onChange={onConditionChange} />
  391 + )}
388 392 </FormItem>
389 393 );
390 394 })}
... ...