Commit 0c0e3cb670ff68c71c03ffaf1faa8c03a26dee1a

Authored by jiangwei
2 parents 7fbfbb61 3207e9dc

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

Showing 198 changed files with 2220 additions and 624 deletions

Too many changes to show.

To preserve performance only 100 of 198 files are displayed.

config/routers/performance.ts 100644 → 100755
... ... @@ -13,7 +13,7 @@ export default [
13 13 },
14 14 /** 绩效组设置==》编辑新增 */
15 15 {
16   - path: "morax/kpiGroupSetting/edit/:id?/:read?",
  16 + path: "morax/kpiGroupSetting/edit/:id?/:read?/:type?",
17 17 component: "./performance/KpiGroupSetting/EditComfirm/index",
18 18 },
19 19 {
... ... @@ -50,7 +50,7 @@ export default [
50 50 },
51 51 /** 薪酬组设置==》编辑新增 */
52 52 {
53   - path: "morax/compensateGroupConfig/edit/:id?/:read?",
  53 + path: "morax/compensateGroupConfig/edit/:id?/:read?/:type?",
54 54 component: "./performance/CompensateGroupConfig/EditComfirm/index",
55 55 },
56 56  
... ...
src/pages/attendance/Attend/subpages/NoClock/api.ts
1 1 import { http } from "@/typing/http";
2 2 import request from "@/utils/request";
3 3 import { ATTENDANCE_HOST, EHR_HOST } from '@/utils/host';
  4 +import { PageParams } from '@/typing/common';
4 5  
5 6 type P<T> = http.PromiseResp<T>;
6 7 type Page<T> = http.PromisePageResp<T>;
... ... @@ -33,4 +34,43 @@ export function saveApi(params?: Post) {
33 34 /**删除免打卡岗位 {requestType: "paramString"}*/
34 35 export function deleteApi(postId?:number) {
35 36 return request.post(`${ATTENDANCE_HOST}/setting/clock/in/exclude/remove?postId=${postId}`, postId);
  37 +}
  38 +
  39 +/** 查询指定打卡门店 */
  40 +export interface WhiteVO {
  41 + userId: number
  42 + userName: string
  43 + workShopName: string //在职门店名称
  44 + postName: string //岗位名称
  45 + authShops: Array<Shop>
  46 + id?: number
  47 +}
  48 +
  49 +export type Shop = {
  50 + id: number
  51 + name: string
  52 +}
  53 +export function fetchWhilteList(params: PageParams): Page<WhiteVO> {
  54 + return request.get(`${ATTENDANCE_HOST}/clock/in/specify/shop/list`, {params});
  55 +}
  56 +
  57 +/** 查询可授权门店 */
  58 +export function fetchShopList(userId: number): P<Shop[]> {
  59 + return request.get(`${ATTENDANCE_HOST}/clock/in/specify/shop/scope/shops`, {params: {userId}});
  60 +}
  61 +
  62 +/** 保存指定打卡门店 */
  63 +export interface ShopSO {
  64 + id?: number
  65 + userId: number
  66 + userName: string
  67 + authShopIds: number[]
  68 +}
  69 +export function saveShopApi(params?: ShopSO) {
  70 + return request.post(`${ATTENDANCE_HOST}/clock/in/specify/shop/save`, params);
  71 +}
  72 +
  73 +/** 删除指定打卡门店 */
  74 +export function deleteShopApi(id?: number) {
  75 + return request.post(`${ATTENDANCE_HOST}/clock/in/specify/shop/delete`, {id});
36 76 }
37 77 \ No newline at end of file
... ...
src/pages/attendance/Attend/subpages/NoClock/components/Modal.tsx
... ... @@ -33,7 +33,7 @@ function CreateModal(props: Props) {
33 33 setLoading(true);
34 34 })
35 35 .catch((err) => {
36   - message.error("岗位已存在", err);
  36 + message.error("岗位已存在", err.message);
37 37 });
38 38 }
39 39  
... ...
src/pages/attendance/Attend/subpages/NoClock/components/NoClock.tsx 0 → 100644
  1 +import useInitial from '@/hooks/useInitail';
  2 +import { PageHeaderWrapper } from '@ant-design/pro-layout';
  3 +import { Button, Card, message, Popconfirm, Row, Table } from 'antd';
  4 +import React, { useState } from 'react';
  5 +import * as API from '../api';
  6 +import Modal from "./Modal";
  7 +
  8 +const Column = Table.Column;
  9 +
  10 +const NoClock = () => {
  11 + const {data, loading, setLoading} = useInitial(API.fetchList, [], '');
  12 + const [visiable, setVisiable]=useState(false);
  13 + const onDelete = (row: any) => {
  14 + API.deleteApi(row.postId)
  15 + .then((res) => {
  16 + message.success("删除成功");
  17 + setLoading(true);
  18 + })
  19 + .catch((err) => {
  20 + message.error("删除失败", err);
  21 + });
  22 + };
  23 + return (
  24 + <div>
  25 + <Card>
  26 + <Row style={{ justifyContent: "flex-end", marginBottom: 20 }}>
  27 + <Button type="primary" onClick={() => setVisiable(true)}>
  28 + 添加岗位
  29 + </Button>
  30 + </Row>
  31 + <Table
  32 + dataSource={data}
  33 + rowKey="postId"
  34 + loading={loading}
  35 + pagination={false}
  36 + >
  37 + <Column title="岗位名称" dataIndex="postName" />
  38 + <Column
  39 + title="操作"
  40 + align="center"
  41 + render={(text, row: any) => (
  42 + <Popconfirm
  43 + title="是否删除"
  44 + onConfirm={() => onDelete(row)}
  45 + okText="确定"
  46 + cancelText="取消"
  47 + >
  48 + <Button type="link" danger>
  49 + 删除
  50 + </Button>
  51 + </Popconfirm>
  52 + )}
  53 + />
  54 + </Table>
  55 + </Card>
  56 + <Modal
  57 + visiable={visiable}
  58 + setVisiable={setVisiable}
  59 + setLoading={setLoading}
  60 + />
  61 + </div>
  62 + );
  63 +};
  64 +
  65 +export default NoClock;
0 66 \ No newline at end of file
... ...
src/pages/attendance/Attend/subpages/NoClock/components/Shop.tsx 0 → 100644
  1 +import React, { useEffect, useState } from 'react';
  2 +import { Modal, Table} from "antd";
  3 +import * as API from '../api';
  4 +
  5 +const Column = Table.Column;
  6 +
  7 +interface Props {
  8 + visible: boolean,
  9 + onCancel: Function,
  10 + item: API.WhiteVO
  11 +}
  12 +
  13 +export default function Index(props: Props) {
  14 + const { visible, onCancel, item } = props;
  15 +
  16 + return (
  17 + <Modal
  18 + title="门店信息"
  19 + width="50%"
  20 + visible={visible}
  21 + maskClosable={false}
  22 + onCancel={() => onCancel()}
  23 + onOk={() => onCancel()}
  24 + >
  25 + <Table
  26 + dataSource={item.authShops}
  27 + rowKey="id"
  28 + pagination={false}
  29 + scroll={{ y: 500 }}
  30 + >
  31 + <Column title="门店" dataIndex="name" align="center" />
  32 + </Table>
  33 + </Modal>
  34 + );
  35 +}
... ...
src/pages/attendance/Attend/subpages/NoClock/components/WhiteList.tsx 0 → 100644
  1 +import usePagination from '@/hooks/usePagination';
  2 +import { Button, Card, message, Popconfirm, Row, Table, Input } from "antd";
  3 +import React, { useState } from "react";
  4 +import * as API from "../api";
  5 +import WhiteModal from "./WhiteListModal";
  6 +import Shop from './Shop';
  7 +import _ from "lodash";
  8 +
  9 +const Column = Table.Column;
  10 +const { Search } = Input;
  11 +
  12 +const NoClock = () => {
  13 + const { list, loading, setLoading, paginationConfig, setParams } = usePagination(API.fetchWhilteList, {});
  14 + const [content, setContent] = useState({data: {} as API.WhiteVO, visiable: false});
  15 + const [shop, setShop] = useState({data: {} as API.WhiteVO, visiable: false});
  16 +
  17 + const onDelete = (row: API.WhiteVO) => {
  18 + API.deleteShopApi(row.id)
  19 + .then((res) => {
  20 + message.success("删除成功");
  21 + setLoading(true);
  22 + })
  23 + .catch((err) => {
  24 + message.error("删除失败", err);
  25 + });
  26 + };
  27 +
  28 + const onSearch = _.debounce(
  29 + (param) => setParams({ keywords: param }, true),
  30 + 800
  31 + );
  32 +
  33 + return (
  34 + <div>
  35 + <Card>
  36 + <Row style={{ justifyContent: "space-between", marginBottom: 20 }}>
  37 + <Search
  38 + style={{ width: 250 }}
  39 + placeholder="请输入员工名称"
  40 + allowClear
  41 + enterButton="搜索"
  42 + onSearch={onSearch}
  43 + />
  44 + <Button
  45 + type="primary"
  46 + onClick={() => setContent({ data: {} as API.WhiteVO, visiable: true })}
  47 + >
  48 + 新增
  49 + </Button>
  50 + </Row>
  51 + <Table
  52 + dataSource={list}
  53 + rowKey="postId"
  54 + loading={loading}
  55 + pagination={paginationConfig}
  56 + >
  57 + <Column
  58 + title="人员"
  59 + dataIndex="userName"
  60 + render={(text, record: API.WhiteVO) => (
  61 + <div>
  62 + <div>姓名:{record.userName}</div>
  63 + <div>在职门店:{record.workShopName}</div>
  64 + <div>岗位:{record.postName || "--"}</div>
  65 + </div>
  66 + )}
  67 + />
  68 + <Column
  69 + title="授权打卡白名单门店"
  70 + dataIndex="authShops"
  71 + render={(text, _item: API.WhiteVO) => (
  72 + <a
  73 + onClick={() => {
  74 + setShop({ data: _item, visiable: true });
  75 + }}
  76 + style={{ color: "#4189FD" }}
  77 + >
  78 + 查看
  79 + </a>
  80 + )}
  81 + />
  82 + <Column
  83 + title="操作"
  84 + align="center"
  85 + render={(text, row: API.WhiteVO) => (
  86 + <>
  87 + <a
  88 + onClick={() => {
  89 + setContent({ data: row, visiable: true });
  90 + }}
  91 + >
  92 + 编辑
  93 + </a>
  94 + <Popconfirm
  95 + title="是否删除"
  96 + onConfirm={() => onDelete(row)}
  97 + okText="确定"
  98 + cancelText="取消"
  99 + >
  100 + <Button type="link" danger>
  101 + 删除
  102 + </Button>
  103 + </Popconfirm>
  104 + </>
  105 + )}
  106 + />
  107 + </Table>
  108 + </Card>
  109 + <WhiteModal
  110 + visiable={content.visiable}
  111 + item={content.data}
  112 + onCancel={() => setContent({ ...content, visiable: false })}
  113 + setLoading={setLoading}
  114 + />
  115 + <Shop
  116 + visible={shop.visiable}
  117 + item={shop.data}
  118 + onCancel={() => setShop({ ...shop, visiable: false })}
  119 + />
  120 + </div>
  121 + );
  122 +};
  123 +
  124 +export default NoClock;
... ...
src/pages/attendance/Attend/subpages/NoClock/components/WhiteListModal.tsx 0 → 100644
  1 +import React, { useEffect, useState } from "react";
  2 +import { Modal, Form, message, Select } from "antd";
  3 +import * as API from "../api";
  4 +import _ from 'lodash'
  5 +import MemberSelect from '@/components/MemberSelect';
  6 +import { LabelValueType } from "rc-tree-select/lib/interface";
  7 +
  8 +const FormItem = Form.Item;
  9 +
  10 +interface Props {
  11 + visiable: boolean;
  12 + onCancel: Function;
  13 + item: API.WhiteVO;
  14 + setLoading: (value: boolean) => any;
  15 +}
  16 +
  17 +function CreateModal(props: Props) {
  18 + const { visiable, onCancel, setLoading, item } = props;
  19 + const [form] = Form.useForm();
  20 + const [shopData, setShopData] = useState<API.Shop[]>([]);
  21 +
  22 + useEffect(() => {
  23 + if (Object.keys(item).length > 0) {
  24 + visiable && API
  25 + .fetchShopList(item.userId)
  26 + .then((res) => {
  27 + setShopData(res.data || []);
  28 + form.setFieldsValue({
  29 + user: [{ value: item.userId, label: item.userName }],
  30 + shop: item.authShops.map((v) => ({
  31 + value: v.id,
  32 + label: v.name,
  33 + })),
  34 + });
  35 + })
  36 + .catch((e) => {
  37 + message.error(e.message);
  38 + });
  39 + } else {
  40 + form.resetFields();
  41 + }
  42 + }, [visiable]);
  43 +
  44 + const getShop = async (user?: LabelValueType) => {
  45 + if (!user?.value) return;
  46 + try {
  47 + const res = await API.fetchShopList(user.value as number);
  48 + setShopData(res.data || []);
  49 + form.setFieldsValue({shop: undefined})
  50 + } catch (e: any) {
  51 + message.error(e.message);
  52 + }
  53 + };
  54 +
  55 + function submit(_item: any) {
  56 + // console.log('iiii', _item)
  57 + const params = {
  58 + id: item.id,
  59 + userId: _item.user[0].value,
  60 + userName: _item.user[0].label,
  61 + authShopIds: _item.shop.map((v: any) => v.value)
  62 + };
  63 + // console.log('pppppp', params)
  64 + API.saveShopApi(params)
  65 + .then((res) => {
  66 + message.success("保存成功");
  67 + onCancel();
  68 + setLoading(true);
  69 + })
  70 + .catch((err) => {
  71 + message.error(err.message);
  72 + });
  73 + }
  74 +
  75 + const onShopSearch = (v: any) => {};
  76 + return (
  77 + <Modal
  78 + title={item.id ? "编辑白名单" : "添加白名单"}
  79 + visible={visiable}
  80 + onOk={form.submit}
  81 + onCancel={() => onCancel()}
  82 + >
  83 + <Form
  84 + form={form}
  85 + onFinish={submit}
  86 + labelCol={{ span: 6 }}
  87 + wrapperCol={{ span: 15 }}
  88 + >
  89 + <FormItem name="user" label="人员名称" rules={[{ required: true }]}>
  90 + <MemberSelect
  91 + onChange={(value) => getShop(value[0] as LabelValueType)}
  92 + labelInValue
  93 + />
  94 + </FormItem>
  95 + <FormItem name="shop" label="门店名称" rules={[{ required: true }]}>
  96 + <Select
  97 + labelInValue
  98 + placeholder="请选择人员后再选择门店"
  99 + mode="multiple"
  100 + onSearch={onShopSearch}
  101 + showSearch
  102 + filterOption={(input: any, option: any) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
  103 + >
  104 + {shopData.map((item: any) => (
  105 + <Select.Option value={item.id} key={item.id}>
  106 + {item.name}
  107 + </Select.Option>
  108 + ))}
  109 + </Select>
  110 + </FormItem>
  111 + </Form>
  112 + </Modal>
  113 + );
  114 +}
  115 +
  116 +export default CreateModal;
... ...
src/pages/attendance/Attend/subpages/NoClock/index.less 0 → 100644
  1 +@import '~antd/lib/style/themes/default.less';
  2 +
  3 +.active {
  4 + color: @primary-color;
  5 + font-size: 20px;
  6 +}
  7 +
  8 +.no_active {
  9 + color: #333;
  10 + font-size: 16px;
  11 +}
0 12 \ No newline at end of file
... ...
src/pages/attendance/Attend/subpages/NoClock/index.tsx
1   -import useInitial from '@/hooks/useInitail';
2 1 import { PageHeaderWrapper } from '@ant-design/pro-layout';
3   -import { Button, Card, message, Popconfirm, Row, Table } from 'antd';
  2 +import { Card } from 'antd';
4 3 import React, { useState } from 'react';
5   -import * as API from './api';
6   -import Modal from "./components/Modal";
  4 +import NoClock from "./components/NoClock";
  5 +import WhiteList from './components/WhiteList'
  6 +import styles from './index.less';
7 7  
8   -const Column = Table.Column;
9   -
10   -const NoClock = () => {
11   - const {data, loading, setLoading} = useInitial(API.fetchList, [], '');
12   - const [visiable, setVisiable]=useState(false);
13   - const onDelete = (row: any) => {
14   - API.deleteApi(row.postId)
15   - .then((res) => {
16   - message.success("删除成功");
17   - setLoading(true);
18   - })
19   - .catch((err) => {
20   - message.error("删除失败", err);
21   - });
22   - };
  8 +const Index = () => {
  9 + const [key, setKey] = useState('noclock')
23 10 return (
24   - <PageHeaderWrapper title="免打卡设置">
  11 + <PageHeaderWrapper title="打卡白名单设置">
25 12 <Card>
26   - <Row style={{ justifyContent: "flex-end", marginBottom: 20 }}>
27   - <Button type="primary" onClick={() => setVisiable(true)}>
28   - 添加岗位
29   - </Button>
30   - </Row>
31   - <Table
32   - dataSource={data}
33   - rowKey="postId"
34   - loading={loading}
35   - pagination={false}
36   - >
37   - <Column title="岗位名称" dataIndex="postName" />
38   - <Column
39   - title="操作"
40   - align="center"
41   - render={(text, row: any) => (
42   - <Popconfirm
43   - title="是否删除"
44   - onConfirm={() => onDelete(row)}
45   - okText="确定"
46   - cancelText="取消"
47   - >
48   - <Button type="link" danger>
49   - 删除
50   - </Button>
51   - </Popconfirm>
52   - )}
53   - />
54   - </Table>
  13 + <div style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-around', marginBottom: '10px'}}>
  14 + <div
  15 + className={key == "noclock" ? styles.active : styles.no_active}
  16 + onClick={() => setKey("noclock")}
  17 + >
  18 + 免打卡设置
  19 + </div>
  20 + <div
  21 + className={key == "whitelist" ? styles.active : styles.no_active}
  22 + onClick={() => setKey("whitelist")}
  23 + >
  24 + 打卡白名单设置
  25 + </div>
  26 + </div>
  27 + {key == "noclock" ? <NoClock /> : <WhiteList />}
55 28 </Card>
56   - <Modal
57   - visiable={visiable}
58   - setVisiable={setVisiable}
59   - setLoading={setLoading}
60   - />
61 29 </PageHeaderWrapper>
62 30 );
63 31 };
64 32  
65   -export default NoClock;
66 33 \ No newline at end of file
  34 +export default Index;
67 35 \ No newline at end of file
... ...
src/pages/ehr/Authentication/Settings/components/List.tsx
... ... @@ -2,7 +2,7 @@
2 2 * @Author: wangqiang@feewee.cn
3 3 * @Date: 2022-11-25 09:11:08
4 4 * @LastEditors: wangqiang@feewee.cn
5   - * @LastEditTime: 2023-02-02 16:33:42
  5 + * @LastEditTime: 2023-02-06 14:38:40
6 6 */
7 7 import SortableTable from "@/pages/ehr/AuthenticationSetting/CertifySetting/components/SortTable";
8 8 import {
... ... @@ -171,11 +171,14 @@ export default function AuthenticationSettingsList() {
171 171 render: (record: EHrAuthenticationSettings.ListVO) => (
172 172 <>
173 173 <a
174   - onClick={() => setModalInfo({
  174 + onClick={(e) => {
  175 + e.stopPropagation();
  176 + setModalInfo({
175 177 visible: true,
176 178 id: record.id,
177 179 viewDetail: true,
178   - })}
  180 + });
  181 + }}
179 182 >
180 183 详情
181 184 </a>
... ...
src/pages/ehr/ProgramOfStudy/Settings/components/AuthList.tsx
... ... @@ -2,12 +2,22 @@
2 2 * @Author: wangqiang@feewee.cn
3 3 * @Date: 2022-11-21 17:55:35
4 4 * @LastEditors: wangqiang@feewee.cn
5   - * @LastEditTime: 2023-01-04 14:21:38
  5 + * @LastEditTime: 2023-02-06 14:26:04
6 6 */
7   -import { Button, Card, Divider, Empty, Form, Input, Popconfirm, Row } from "antd";
  7 +import {
  8 + Button,
  9 + Card,
  10 + Divider,
  11 + Empty,
  12 + Form,
  13 + Input,
  14 + Popconfirm,
  15 + Row,
  16 +} from "antd";
8 17 import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
9 18 import React from "react";
10 19 import { checkNull } from "@/utils/validate";
  20 +import { useStore } from "../index";
11 21  
12 22 interface Props {
13 23 value?: EHrProgramOfStudySettings.AuthItem[];
... ... @@ -113,6 +123,8 @@ interface AuthItemProps {
113 123 }
114 124  
115 125 function AuthItem({ value, onChange, disabled }: AuthItemProps) {
  126 + const { form } = useStore();
  127 +
116 128 return (
117 129 <>
118 130 <Row
... ... @@ -120,17 +132,20 @@ function AuthItem({ value, onChange, disabled }: AuthItemProps) {
120 132 style={{ display: "flex", flexDirection: "row" }}
121 133 >
122 134 <span>实操项目:</span>
123   - <Input.TextArea
  135 + <Input
124 136 allowClear
125 137 placeholder="请输入实操项目"
126 138 style={{ flex: 1 }}
127   - autoSize={{ minRows: 2 }}
  139 + // autoSize={{ minRows: 2 }}
128 140 readOnly={disabled}
129 141 bordered={!disabled}
130 142 value={value?.authName}
  143 + showCount
  144 + maxLength={32}
131 145 onChange={(e) => onChange && onChange({ ...value, authName: e.target.value })}
132 146 />
133 147 </Row>
  148 + <div style={{ height: 5 }} />
134 149 <Row
135 150 justify="space-between"
136 151 style={{ display: "flex", flexDirection: "row" }}
... ... @@ -145,6 +160,7 @@ function AuthItem({ value, onChange, disabled }: AuthItemProps) {
145 160 suffix="&nbsp;&nbsp;分"
146 161 value={value?.authScore}
147 162 onChange={(e) => onChange && onChange({ ...value, authScore: e.target.value })}
  163 + onBlur={() => form.validateFields(["authList"])}
148 164 />
149 165 </Row>
150 166 </>
... ...
src/pages/order3/AddValueTaskConfig/api.ts
... ... @@ -4,6 +4,7 @@ import { ORDER3 } from &#39;@/utils/host&#39;;
4 4 import { PageParams } from '@/typing/common';
5 5  
6 6 interface Params extends PageParams {
  7 + addedValueType?: number // 附加值类型
7 8 }
8 9  
9 10 export interface ShopVo {
... ... @@ -22,6 +23,7 @@ export interface ListResult {
22 23 beginTime?: number // 开始时间
23 24 endTime?: number // 结束时间
24 25 enable?: boolean // 启用/禁用
  26 + addedValueType?: number // 附加值类型
25 27 }
26 28  
27 29 /** 查询附加值任务配置服务列表 */
... ...
src/pages/order3/AddValueTaskConfig/components/EditModal.tsx
1 1 import React, { useState, useEffect } from 'react';
2   -import { Modal, Button, message, Form, InputNumber, DatePicker } from 'antd';
  2 +import { Modal, Button, message, Form, InputNumber, DatePicker, Radio } from 'antd';
3 3 import {useStore} from '../index';
4 4 import {ListResult, saveConfigApi} from '../api';
5   -import { debounce } from 'lodash';
  5 +import { debounce, isNil } from 'lodash';
6 6 import ShopSelectNew from '@/components/ShopSelectNew';
7 7 import moment from 'moment';
  8 +import '../index.less';
8 9  
9 10 const { RangePicker } = DatePicker;
10 11  
11 12 export default function DetailModal() {
12 13 const {currentData, setCurrentData, setLoading} = useStore();
13 14 const [confirm, setConfirm] = useState<boolean>(false);
  15 + const [type, setType] = useState<number>(1);
14 16 const [form] = Form.useForm();
15 17  
16 18 useEffect(() => {
17 19 if (currentData.visible && currentData.data.id) {
18 20 handleSetValue();
  21 + } else {
  22 + form.setFieldsValue({addedValueType: 1});
19 23 }
20 24 }, [currentData.visible]);
21 25  
  26 + const handleChangeType = (value: number) => {
  27 + setType(value);
  28 + if (value === 2) {
  29 + form.setFieldsValue({
  30 + tciOutputValueRatio: 100,
  31 + vciOutputValueRatio: 100,
  32 + jcxOutputValueRatio: 100,
  33 + decoOutputValueRatio: 100,
  34 + });
  35 + } else if (value === 1) {
  36 + form.setFieldsValue({
  37 + tciOutputValueRatio: 0,
  38 + vciOutputValueRatio: 0,
  39 + jcxOutputValueRatio: 0,
  40 + decoOutputValueRatio: 0,
  41 + });
  42 + }
  43 + };
  44 +
22 45 const handleCancel = () => {
23 46 form.resetFields();
24 47 setCurrentData({visible: false, data: {}, title: ""});
  48 + setType(1);
25 49 };
26 50  
27 51 const handleSetValue = () => {
... ... @@ -32,8 +56,10 @@ export default function DetailModal() {
32 56 jcxOutputValueRatio: currentData.data?.jcxOutputValueRatio,
33 57 decoOutputValueRatio: currentData.data?.decoOutputValueRatio,
34 58 shopList: currentData.data?.shopList?.map((v: any) => ({value: v.shopId, label: v.shopName})) || [],
35   - rangeDate: [moment(currentData.data.beginTime), moment(currentData.data.endTime)]
  59 + rangeDate: [moment(currentData.data.beginTime), moment(currentData.data.endTime)],
  60 + addedValueType: currentData?.data.addedValueType
36 61 });
  62 + setType(currentData.data?.addedValueType || 1);
37 63 };
38 64  
39 65 const onFinish = async () => {
... ... @@ -49,7 +75,8 @@ export default function DetailModal() {
49 75 decoOutputValueRatio: params.decoOutputValueRatio,
50 76 shopList: params.shopList.map((v: any) => ({shopId: v.value, shopName: v.label})),
51 77 beginTime: moment(params.rangeDate[0]).valueOf(),
52   - endTime: moment(params.rangeDate[1]).valueOf()
  78 + endTime: moment(params.rangeDate[1]).valueOf(),
  79 + addedValueType: params.addedValueType
53 80 };
54 81 saveConfigApi(_params)
55 82 .then(res => {
... ... @@ -83,8 +110,14 @@ export default function DetailModal() {
83 110 labelAlign="left"
84 111 style={{marginLeft: 30, marginRight: 30}}
85 112 >
  113 + <Form.Item name="addedValueType">
  114 + <Radio.Group onChange={(e) => handleChangeType(e.target.value)} defaultValue={1} buttonStyle="solid">
  115 + <Radio.Button value={1}>按毛利计算</Radio.Button>
  116 + <Radio.Button value={2}>按产值计算</Radio.Button>
  117 + </Radio.Group>
  118 + </Form.Item>
86 119 <Form.Item
87   - label="单车附加值任务"
  120 + label={type === 1 ? "单车附加值毛利目标" : "单车附加值产值目标"}
88 121 name="addedValueTask"
89 122 rules={[{ required: true, message: "请输入" }]}
90 123 >
... ... @@ -97,32 +130,27 @@ export default function DetailModal() {
97 130 parser={(value: string) => value?.replace('元/台', '')}
98 131 />
99 132 </Form.Item>
  133 + <div className="addValue_wrapper"><span className="addvalue_text">&#65290;</span><span>产值构成:</span></div>
100 134 <Form.Item
101   - label="计算装潢附加值:装潢产值"
102   - name="decoOutputValueRatio"
103   - rules={[{ required: true, message: "请输入" }]}
104   - >
105   - <InputNumber
106   - style={{width: '100%'}}
107   - controls={false}
108   - min={0}
109   - max={100}
110   - formatter={(value: any) => `${value}%`}
111   - precision={2}
112   - parser={(value?: string) => value?.replace('%', '')}
113   - />
114   - </Form.Item>
115   - <Form.Item
116   - label="计算顾问保险附加值:"
  135 + label={type === 1 ? "1.计算保险毛利" : "1.计算保险产值:"}
117 136 >
118 137 <Form.Item
119   - label="商业险产值"
  138 + label={<span className="addValue_label">商业险金额 x</span>}
120 139 name="vciOutputValueRatio"
121   - rules={[{ required: true, message: "请输入" }]}
  140 + colon={false}
  141 + rules={[({ getFieldValue }) => ({
  142 + validator(_, value) {
  143 + if (isNil(value)) {
  144 + return Promise.reject(new Error('请输入'));
  145 + }
  146 + return Promise.resolve();
  147 + },
  148 + })]}
122 149 >
123 150 <InputNumber
124 151 style={{width: '100%'}}
125 152 controls={false}
  153 + disabled={type === 2}
126 154 min={0}
127 155 max={100}
128 156 formatter={(value: any) => `${value}%`}
... ... @@ -131,13 +159,22 @@ export default function DetailModal() {
131 159 />
132 160 </Form.Item>
133 161 <Form.Item
134   - label="交强险产值"
  162 + label={<span className="addValue_label">交强险金额 x</span>}
  163 + colon={false}
135 164 name="tciOutputValueRatio"
136   - rules={[{ required: true, message: "请输入" }]}
  165 + rules={[({ getFieldValue }) => ({
  166 + validator(_, value) {
  167 + if (isNil(value)) {
  168 + return Promise.reject(new Error('请输入'));
  169 + }
  170 + return Promise.resolve();
  171 + },
  172 + })]}
137 173 >
138 174 <InputNumber
139 175 style={{width: '100%'}}
140 176 controls={false}
  177 + disabled={type === 2}
141 178 min={0}
142 179 max={100}
143 180 formatter={(value: any) => `${value}%`}
... ... @@ -146,13 +183,22 @@ export default function DetailModal() {
146 183 />
147 184 </Form.Item>
148 185 <Form.Item
149   - label="驾意险产值"
  186 + label={<span className="addValue_label">驾意险金额 x</span>}
  187 + colon={false}
150 188 name="jcxOutputValueRatio"
151   - rules={[{ required: true, message: "请输入" }]}
  189 + rules={[({ getFieldValue }) => ({
  190 + validator(_, value) {
  191 + if (isNil(value)) {
  192 + return Promise.reject(new Error('请输入'));
  193 + }
  194 + return Promise.resolve();
  195 + },
  196 + })]}
152 197 >
153 198 <InputNumber
154 199 style={{width: '100%'}}
155 200 controls={false}
  201 + disabled={type === 2}
156 202 min={0}
157 203 max={100}
158 204 formatter={(value: any) => `${value}%`}
... ... @@ -162,6 +208,36 @@ export default function DetailModal() {
162 208 </Form.Item>
163 209 </Form.Item>
164 210 <Form.Item
  211 + label={<span style={{fontSize: '14px'}}><span style={{color: "#333"}}>2.{type === 1 ? "计算装潢毛利" : "计算装潢产值"}:</span><span className="addValue_label">装潢金额 x</span></span>}
  212 + colon={false}
  213 + name="decoOutputValueRatio"
  214 + rules={[({ getFieldValue }) => ({
  215 + validator(_, value) {
  216 + if (isNil(value)) {
  217 + return Promise.reject(new Error('请输入'));
  218 + }
  219 + return Promise.resolve();
  220 + },
  221 + })]}
  222 + >
  223 + <InputNumber
  224 + style={{width: '100%'}}
  225 + controls={false}
  226 + disabled={type === 2}
  227 + min={0}
  228 + max={100}
  229 + formatter={(value: any) => `${value}%`}
  230 + precision={2}
  231 + parser={(value?: string) => value?.replace('%', '')}
  232 + />
  233 + </Form.Item>
  234 + <div style={{marginBottom: '25px'}}>
  235 + <span style={{color: "#333", fontSize: '14px'}}>3.其他附加值:</span>
  236 + <span style={{color: "#F4333C", fontSize: '14px'}}>分期附加费</span>
  237 + <span style={{color: "#999", fontSize: '12px'}}>(包含服务费、GPS费、抵押上户费、解除抵押费)</span>
  238 + <span style={{color: "#F4333C", fontSize: '14px'}}>和全款上户费要按实收计算</span>
  239 + </div>
  240 + <Form.Item
165 241 label="适用门店"
166 242 name="shopList"
167 243 rules={[{ required: true, message: "请输入" }]}
... ...
src/pages/order3/AddValueTaskConfig/components/List.tsx
... ... @@ -5,9 +5,13 @@ import {ShopVo, banConfigApi, ListResult} from &#39;../api&#39;;
5 5 import { isNil } from 'lodash';
6 6 import moment from 'moment';
7 7  
  8 +interface Props {
  9 + addedValueType?: number // 附加值类型
  10 +}
  11 +
8 12 const Column = Table.Column;
9 13  
10   -export default function LargeList() {
  14 +export default function LargeList({addedValueType} : Props) {
11 15 const {list, paginationConfig, loading, setLoading, setCurrentData, setShopData} = useStore();
12 16  
13 17 const handleDeleteConfig = (id?:number) => {
... ... @@ -36,29 +40,29 @@ export default function LargeList() {
36 40 <Table
37 41 dataSource={list}
38 42 loading={loading}
39   - rowKey="shopId"
  43 + rowKey="id"
40 44 pagination={paginationConfig}
41 45 >
42 46 <Column
43   - title="单车附加值任务"
  47 + title="单车附加值目标"
44 48 dataIndex="addedValueTask"
45 49 align="left"
46   - render={(_text) => (isNil(_text) ? '-' : `${_text}元/台`)}
  50 + render={(_text) => (isNil(_text) ? '-' : <span style={{color: "#FF921C", fontSize: '14px'}}>{_text}元<span style={{color: "#333"}}>/台</span></span>)}
47 51 />
48 52 <Column
49   - title="计算顾问保险附加值"
  53 + title={addedValueType === 1 ? "计算保险毛利" : "计算保险产值"}
50 54 dataIndex="addedValueTask"
51 55 align="left"
52 56 render={(_text, record: ListResult) => (
53 57 <div style={{display: 'flex', flexDirection: 'column'}}>
54   - <span>商业险产值*{record.vciOutputValueRatio}%</span>
55   - <span>交强险产值*{record.tciOutputValueRatio}%</span>
  58 + <span>商业险金额*{record.vciOutputValueRatio}%</span>
  59 + <span>交强险金额*{record.tciOutputValueRatio}%</span>
56 60 <span>架意险产值*{record.jcxOutputValueRatio}%</span>
57 61 </div>
58 62 )}
59 63 />
60   - <Column
61   - title="计算装潢附加值"
  64 + <Column
  65 + title={addedValueType === 1 ? "计算装潢毛利" : "计算装潢产值"}
62 66 dataIndex="decoOutputValueRatio"
63 67 align="left"
64 68 render={(_text, record: ListResult) => `装潢产值*${_text}%`}
... ...
src/pages/order3/AddValueTaskConfig/components/ShopModal.tsx
... ... @@ -19,7 +19,7 @@ export default function Index() {
19 19 >
20 20 <List
21 21 size="large"
22   - style={{height: '300px', overflow: 'scroll'}}
  22 + style={{maxHeight: '300px', overflow: 'scroll'}}
23 23 dataSource={shopData?.data || []}
24 24 renderItem={(item: any) => <List.Item style={{justifyContent: 'center'}}>{item.shopName}</List.Item>}
25 25 />
... ...
src/pages/order3/AddValueTaskConfig/index.less 0 → 100644
  1 +.addValue_wrapper {
  2 + margin-bottom: 10px;
  3 + display: flex;
  4 + align-items: center;
  5 +}
  6 +
  7 +.addvalue_text {
  8 + color: #ff4d4f;
  9 + font-size: 14px;
  10 + transform: scale(0.75);
  11 + margin-right: 1px;
  12 + margin-left: -3px;
  13 +}
  14 +
  15 +.addValue_label {
  16 + font-size: 14px;
  17 + font-weight: 400;
  18 + color: #333;
  19 +}
0 20 \ No newline at end of file
... ...
src/pages/order3/AddValueTaskConfig/index.tsx
1   -import React from 'react';
2   -import { Card, Button, Row, Col, Input } from 'antd';
  1 +import React, { useState, useEffect } from 'react';
  2 +import { Card, Button, Row, Col, Input, Radio, DatePicker } from 'antd';
3 3 import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 4 import { createStore } from '@/hooks/moz';
5 5 import store from './store';
... ... @@ -7,11 +7,17 @@ import List from &#39;./components/List&#39;;
7 7 import EditMoadal from './components/EditModal';
8 8 import ShopModal from './components/ShopModal';
9 9 import { debounce } from 'lodash';
  10 +import moment from 'moment';
10 11  
11 12 export const { Provider, useStore } = createStore(store);
12 13  
13 14 function AddValueTaskConfig() {
14 15 const {setCurrentData, setParams, innerParams} = useStore();
  16 + const [type, setType] = useState<number>(1);
  17 +
  18 + useEffect(() => {
  19 + setParams({...innerParams, addedValueType: type}, true);
  20 + }, [type]);
15 21  
16 22 function handleAdd() {
17 23 setCurrentData({visible: true, title: "新增", data: {}});
... ... @@ -20,17 +26,34 @@ function AddValueTaskConfig() {
20 26 const handleSearch = debounce((text?: string) => {
21 27 setParams({...innerParams, shopName: text}, true);
22 28 }, 380);
  29 +
  30 + const handleChangeType = (value?: number) => {
  31 + setType(value || 1);
  32 + };
  33 +
  34 + const handleChangeDate = (value?: any) => {
  35 + setParams({...innerParams, beginTime: value && moment(value).startOf('month').valueOf() || undefined}, true);
  36 + };
23 37  
24 38 return (
25 39 <PageHeaderWrapper title="附加值任务配置">
26 40 <Card>
  41 + <Row style={{marginBottom: 20}}>
  42 + <Radio.Group onChange={(e) => handleChangeType(e.target.value)} defaultValue={1} buttonStyle="solid">
  43 + <Radio.Button value={1}>按毛利计算</Radio.Button>
  44 + <Radio.Button value={2}>按产值计算</Radio.Button>
  45 + </Radio.Group>
  46 + </Row>
27 47 <Row justify="space-between" style={{ marginBottom: 20 }}>
28   - <Col><Input placeholder="请输入门店名称" allowClear onChange={(e) => handleSearch(e.target.value)} /></Col>
  48 + <Row>
  49 + <Col><Input placeholder="请输入门店名称" allowClear onChange={(e) => handleSearch(e.target.value)} /></Col>
  50 + <Col><DatePicker onChange={(e) => handleChangeDate(e)} style={{marginLeft: 15}} placeholder="请选择生效时间" picker="month" format="YYYY-MM" /></Col>
  51 + </Row>
29 52 <Col>
30 53 <Button type="primary" onClick={handleAdd}>新增</Button>
31 54 </Col>
32 55 </Row>
33   - <List />
  56 + <List addedValueType={type} />
34 57 </Card>
35 58 <EditMoadal />
36 59 <ShopModal />
... ...
src/pages/order3/AddValueTaskConfig/store.ts
... ... @@ -14,7 +14,7 @@ interface ShopData {
14 14 }
15 15  
16 16 export default function useStore() {
17   - const { list, setParams, setLoading, loading, paginationConfig, innerParams } = usePagination(getConfigListApi, {pageSize: 10, current: 1});
  17 + const { list, setParams, setLoading, loading, paginationConfig, innerParams } = usePagination(getConfigListApi, {pageSize: 10, current: 1, addedValueType: 1});
18 18 const [currentData, setCurrentData] = useState<CurrentData>({visible: false, title: "新增", data: {}});
19 19 const [shopData, setShopData] = useState<ShopData>({visible: false, data: []});
20 20 return {
... ...
src/pages/performance/AftersaleItemSetting/api.ts 100644 → 100755
src/pages/performance/AftersaleItemSetting/components/CreateModal.tsx 100644 → 100755
src/pages/performance/AftersaleItemSetting/entity.ts 100644 → 100755
src/pages/performance/AftersaleItemSetting/index.tsx 100644 → 100755
src/pages/performance/AftersaleItemSetting/interface.d.ts 100644 → 100755
src/pages/performance/AftersalePerformance/api.ts 100644 → 100755
src/pages/performance/AftersalePerformance/components/CreateGroup.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/components/MemberSelect.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/components/Operate.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/components/PerforItem/AddIndice.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/components/PerforItem/index.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/index.tsx 100644 → 100755
src/pages/performance/AftersalePerformance/interface.d.ts 100644 → 100755
src/pages/performance/AftersaleSalary/api.ts 100644 → 100755
src/pages/performance/AftersaleSalary/components/MemberListModal.tsx 100644 → 100755
src/pages/performance/AftersaleSalary/components/MemberaddModal.tsx 100644 → 100755
src/pages/performance/AftersaleSalary/components/SaveGroupModal.tsx 100644 → 100755
src/pages/performance/AftersaleSalary/index.tsx 100644 → 100755
src/pages/performance/AftersaleSalary/interface.d.ts 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/api.ts 100644 → 100755
... ... @@ -50,6 +50,10 @@ interface IndicatorParams{
50 50 export function queryDetailListApi(id: number): http.PromiseResp<CompensateConfig.GroupListItems> {
51 51 return request.get(`${MORAX_HOST}/erp/salary/group/detail`, { params: { id } });
52 52 }
  53 +// 查询草稿详情
  54 +export function draftQueryDetailListApi(id: number): http.PromiseResp<CompensateConfig.GroupListItems> {
  55 + return request.get(`${MORAX_HOST}/erp/setting-draft/salary-detail`, { params: { id } });
  56 +}
53 57  
54 58 /**
55 59 * 查询岗位下门店
... ... @@ -78,9 +82,9 @@ export function queryIndicatorsApi(): http.PromiseResp&lt;KpiGroupSetteing.Indicato
78 82 return request.get(`${MORAX_HOST}/erp/salary/group/all-indicator`);
79 83 }
80 84 /**
81   - * 绩效组保存
  85 + * 薪酬组保存
82 86 * http://testgate.feewee.cn/morax/erp/salary/group/save
83 87 */
84   -export function saveKpiGroupConfig(params: CompensateConfig.SalaryGroupSaveParams): http.PromiseResp<any> {
85   - return request.post(`${MORAX_HOST}/erp/salary/group/save`, params);
  88 +export function saveSalaryGroupConfig(params: CompensateConfig.SalaryGroupSaveParams, submit: number): http.PromiseResp<any> {
  89 + return request.post(`${MORAX_HOST}/erp/salary/group/save/${submit}`, params);
86 90 }
87 91 \ No newline at end of file
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddCommissionParamsModal.tsx 100644 → 100755
... ... @@ -35,7 +35,7 @@ export default function AddCommissionParamsModal(props: Props) {
35 35 const percent = /^\d\.([1-9]{1,2}|[0-9][1-9])$|^[1-9]\d{0,1}(\.\d{1,2}){0,1}$|^100(\.0{1,2}){0,1}$/;
36 36 const Momney = /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/;
37 37 const [form] = Form.useForm();
38   - const { selectedIndicators, setSelectedIndicators, setCommissionParamAlias } = useStore();
  38 + const { selectedIndicators, setSelectedIndicators } = useStore();
39 39  
40 40 const [isTarget, setIsTarget] = useState(false);
41 41 // console.log(form);
... ... @@ -157,7 +157,6 @@ export default function AddCommissionParamsModal(props: Props) {
157 157 setItemId(Option.key);
158 158 setId(Option.key);
159 159 setIndicatorName(Option.children);
160   - setCommissionParamAlias(Option.children);
161 160 }}
162 161 showSearch
163 162 optionFilterProp="children"
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddCondModal.tsx 100644 → 100755
... ... @@ -23,7 +23,7 @@ interface Props {
23 23 }
24 24 type Commission = KpiGroupSetteing.CommissionParams;
25 25 export default function AddCondModal(props: Props) {
26   - const { selectedIndicatorsConds, setSelectedIndicatorsConds, setPreconditionAlias } = useStore();
  26 + const { selectedIndicatorsConds, setSelectedIndicatorsConds } = useStore();
27 27 const percent = /^\d\.([1-9]{1,2}|[0-9][1-9])$|^[1-9]\d{0,1}(\.\d{1,2}){0,1}$|^100(\.0{1,2}){0,1}$/;
28 28 const Momney = /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/;
29 29 const [form] = Form.useForm();
... ... @@ -157,7 +157,6 @@ export default function AddCondModal(props: Props) {
157 157 setId(Option.key);
158 158 setIndicatorName(Option.children);
159 159 setDataType(Option.dataType);
160   - setPreconditionAlias(Option.children);
161 160 }}
162 161 showSearch
163 162 optionFilterProp="children"
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddIndicatorsModal.tsx 100644 → 100755
... ... @@ -28,8 +28,6 @@ interface Props {
28 28 export default function CreateModal(props: Props) {
29 29 const [form] = Form.useForm();
30 30 const {
31   - isPercent,
32   - setIsPercent,
33 31 ladderParamAlias,
34 32 setLadderParamAlias,
35 33 commissionParamAlias,
... ... @@ -39,6 +37,8 @@ export default function CreateModal(props: Props) {
39 37 } = useStore();
40 38 const { visible, onCancel, onOk, currentItem, indicatorsList = [], postId, shopIds, fixData, setFixData } = props;
41 39  
  40 + // 是否为百分比
  41 + const [isPercent, setIsPercent] = useState<number>(0);
42 42 // 存储选择计算方式
43 43 const [calType, setCalType] = useState<number>();
44 44 // 判断占比相加是否为100
... ... @@ -49,8 +49,7 @@ export default function CreateModal(props: Props) {
49 49  
50 50 const [id, setItemId] = useState<number>();
51 51 useEffect(() => {
52   - if (visible && currentItem.id) {
53   - setItemId(currentItem.id);
  52 + if (visible && currentItem.name) {
54 53 setLadderParamAlias(currentItem.ladderParamAlias);
55 54 setCommissionParamAlias(currentItem.commissionParamAlias);
56 55 setPreconditionAlias(currentItem.preconditionAlias);
... ... @@ -69,7 +68,7 @@ export default function CreateModal(props: Props) {
69 68 ..._res,
70 69 });
71 70 }
72   - if (!currentItem.id) {
  71 + if (!currentItem.name) {
73 72 setCondsVisible(false);
74 73 }
75 74 }, [visible]);
... ... @@ -125,11 +124,11 @@ export default function CreateModal(props: Props) {
125 124 function handSubmit(fieldsValue: any) {
126 125 const pa: any = transformDTO(fieldsValue);
127 126 // 校验标准分不能大于绩效分值
128   - if (id) {
129   - pa.id = id;
130   - } else {
131   - pa.id = pa.name;
132   - }
  127 + // if (id) {
  128 + // pa.id = id;
  129 + // } else {
  130 + // pa.id = pa.name;
  131 + // }
133 132 if (pa?.ladderParams && pa?.ladderParams.length > 0) {
134 133 pa.ladderParamAlias = ladderParamAlias;
135 134 }
... ... @@ -157,7 +156,11 @@ export default function CreateModal(props: Props) {
157 156 ladderHundred = pa?.ladderParams.reduce((data: number, item: any) => {
158 157 return data + item.proportion;
159 158 }, 0);
160   - pa.laddersType = isPercent;
  159 + if (isPercent == 0) {
  160 + pa.laddersType = currentItem.laddersType;
  161 + } else {
  162 + pa.laddersType = isPercent;
  163 + }
161 164 }
162 165 if (!pa?.ladderParams || pa?.ladderParams.length === 0) {
163 166 pa.laddersType = 2;
... ... @@ -295,7 +298,7 @@ export default function CreateModal(props: Props) {
295 298 };
296 299 return (
297 300 <Modal
298   - title={`${currentItem.id ? "编辑" : "新增"}薪酬项目`}
  301 + title={`${currentItem.name ? "编辑" : "新增"}薪酬项目`}
299 302 visible={visible}
300 303 maskClosable={false}
301 304 afterClose={() => {
... ... @@ -493,7 +496,7 @@ export default function CreateModal(props: Props) {
493 496 rules={[{ required: true, message: "请配置阶梯" }]}
494 497 style={{ width: "100%" }}
495 498 >
496   - <TotalAmount visible isPercent={isPercent} />
  499 + <TotalAmount visible isPercent={isPercent} laddersType={currentItem.laddersType} />
497 500 </Form.Item>
498 501 </>
499 502 );
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddLadderParamsModal.tsx 100644 → 100755
... ... @@ -24,10 +24,10 @@ export default function AddLadderParamsModal(props: Props) {
24 24 const percent = /^\d\.([1-9]{1,2}|[0-9][1-9])$|^[1-9]\d{0,1}(\.\d{1,2}){0,1}$|^100(\.0{1,2}){0,1}$/;
25 25 const Momney = /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/;
26 26 const [form] = Form.useForm();
27   - const { selectedIndicatorsLadder, setSelectedIndicatorsLadder, setLadderParamAlias } = useStore();
  27 + const { selectedIndicatorsLadder, setSelectedIndicatorsLadder } = useStore();
28 28  
29 29 const [isTarget, setIsTarget] = useState(false);
30   - const [dataType, setDataType] = useState<number>();
  30 + const [dataType, setDataType] = useState<number>(2);
31 31 // console.log(form);
32 32 const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId } = props;
33 33 const [delay, setDelay] = useState(true);
... ... @@ -104,8 +104,13 @@ export default function AddLadderParamsModal(props: Props) {
104 104 function handSubmit(fieldsValue: any) {
105 105 const pa: any = transformDTO(fieldsValue);
106 106 pa.targetType = targetType;
107   - pa.dataType = dataType;
108   - // console.log("100pa", pa);
  107 + if (comItem.dataType) {
  108 + pa.dataType = comItem.dataType;
  109 + }
  110 + if (!comItem.dataType) {
  111 + pa.dataType = dataType;
  112 + }
  113 + console.log("100pa", pa);
109 114 const newItemId = pa.indicatorCode;
110 115 // 编辑时,不需要push id
111 116 if (!comItem.indicatorCode) {
... ... @@ -146,7 +151,6 @@ export default function AddLadderParamsModal(props: Props) {
146 151 setId(Option.key);
147 152 setIndicatorName(Option.children);
148 153 setDataType(Option.dataType);
149   - setLadderParamAlias(Option.children);
150 154 }}
151 155 showSearch
152 156 optionFilterProp="children"
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/CommissionParams.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/Conds.tsx 100644 → 100755
... ... @@ -32,7 +32,7 @@ type Commission = KpiGroupSetteing.CommissionParams;
32 32 const Conds = ({ postId, shopIds, value, onChange, setItemId, isHundred }: Props) => {
33 33 const [addComVisible, setAddComVisible] = useState(false);
34 34 const [one, setOne] = useState(0);
35   - const { readOnly, selectedIndicatorsConds, setSelectedIndicatorsConds, preconditionAlias, setPreconditionAlias } = useStore();
  35 + const { readOnly, selectedIndicatorsConds, setSelectedIndicatorsConds } = useStore();
36 36 const [tableData, setTableData] = useState<Commission[]>(value || []);
37 37 // 查看得分阶梯
38 38 const [ladderVisible, setladderVisible] = useState(false);
... ... @@ -139,12 +139,6 @@ const Conds = ({ postId, shopIds, value, onChange, setItemId, isHundred }: Props
139 139 </Button>
140 140 </div>
141 141 }
142   - title={
143   - <div style={{ display: "flex", justifyContent: "flex-start", width: 500 }}>
144   - 前置条件指标名称:
145   - <Input value={preconditionAlias} onChange={(e) => setPreconditionAlias(e.target.value)} />
146   - </div>
147   - }
148 142 >
149 143 <Table
150 144 bordered
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/FixedCommission.tsx 100644 → 100755
... ... @@ -230,7 +230,7 @@ const FixedCommission = ({ onChange, readOnly, visible, type, fixData, setFixDat
230 230 setSeriesModal({ visible: false });
231 231 };
232 232  
233   - const _Ok = (pa: any) => {
  233 + const _Ok = (pa: { series: number; stairValue: number }) => {
234 234 if (fixData && fixData.length > 0) {
235 235 const newData = [...fixData, { ...pa }];
236 236 onChange && onChange(newData);
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/IndivatorsTable.tsx 100644 → 100755
... ... @@ -82,10 +82,10 @@ const IndivatorsTable = ({ value, onChange, postId, shopIds }: Props) =&gt; {
82 82 }, [value]);
83 83  
84 84 // 编辑
85   - const onEdit = (record: Item) => {
  85 + const onEdit = (record: Item, index: number) => {
86 86 setVisible(true);
87   - setCurrentItem({ ...record });
88   - console.log(record);
  87 + setCurrentItem({ ...record, index });
  88 + console.log({ ...record, index });
89 89 if (record.commissionParams) {
90 90 setSelectedIndicators((record.commissionParams || []).map((item) => item.indicatorCode));
91 91 }
... ... @@ -100,10 +100,10 @@ const IndivatorsTable = ({ value, onChange, postId, shopIds }: Props) =&gt; {
100 100 // 删除
101 101 const _onDelete = (record: Item, index: number) => {
102 102 const tempData = [...(value || [])];
103   - const res = tempData.filter((item) => item.id !== record.id);
  103 + tempData.splice(index, 1); // splice直接修改原数组,不会返回新数组
104 104 //已选指标项同步删除
105 105 selectedSalaryIds.splice(index, 1);
106   - onChange && onChange([...res]);
  106 + onChange && onChange([...tempData]);
107 107 };
108 108 // 查看目标设置
109 109 const lookTar = (record: any) => {
... ... @@ -172,7 +172,7 @@ const IndivatorsTable = ({ value, onChange, postId, shopIds }: Props) =&gt; {
172 172 key: "operation",
173 173 render: (_: any, record: Item, index: number) => (
174 174 <Space split={<Divider type="vertical" />}>
175   - <Typography.Link onClick={() => onEdit(record)}>编辑</Typography.Link>
  175 + <Typography.Link onClick={() => onEdit(record, index)}>编辑</Typography.Link>
176 176 <Typography.Link onClick={() => _onDelete(record, index)}>删除</Typography.Link>
177 177 </Space>
178 178 ),
... ... @@ -209,11 +209,11 @@ const IndivatorsTable = ({ value, onChange, postId, shopIds }: Props) =&gt; {
209 209 fixData={fixData}
210 210 setFixData={setFixData}
211 211 onOk={(values) => {
212   - if (!currentItem.id) {
  212 + if (!currentItem.name) {
213 213 tableData.push(values);
214 214 onChange && onChange(tableData);
215 215 } else {
216   - const res = tableData.map((item) => (item.id === currentItem.id ? { ...values } : item));
  216 + const res = tableData.map((item, index) => (index === currentItem.index ? { ...values } : item));
217 217 onChange && onChange(res);
218 218 }
219 219 }}
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/LadderParams.tsx 100644 → 100755
... ... @@ -31,7 +31,7 @@ interface Props {
31 31 type Commission = KpiGroupSetteing.CommissionParams;
32 32 const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundredLadder }: Props) => {
33 33 const [addComVisible, setAddComVisible] = useState(false);
34   - const { selectedIndicatorsLadder, readOnly, ladderParamAlias, setLadderParamAlias } = useStore();
  34 + const { selectedIndicatorsLadder, readOnly } = useStore();
35 35 const [tableData, setTableData] = useState<Commission[]>(value || []);
36 36 // 参数
37 37 const [comItem, setComItem] = useState<Commission>({});
... ... @@ -142,12 +142,6 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundredLa
142 142 </Button>
143 143 </div>
144 144 }
145   - title={
146   - <div style={{ display: "flex", justifyContent: "flex-start", width: 500 }}>
147   - 阶梯指标名称:
148   - <Input value={ladderParamAlias} onChange={(e) => setLadderParamAlias(e.target.value)} />
149   - </div>
150   - }
151 145 >
152 146 <Table
153 147 bordered
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/LadderTable.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/PersonRatingList.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/SeriesModal.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/SingleAmount.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/StarRatingList.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/TargetModal.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/EditComfirm/components/TotalAmount.tsx 100644 → 100755
... ... @@ -17,7 +17,8 @@ interface Props {
17 17 type?: number; //2 查看得分阶梯
18 18 setladderVisible?: Function;
19 19 salaryCode?: string;
20   - isPercent:number;
  20 + isPercent?: number;
  21 + laddersType?: number;
21 22 }
22 23  
23 24 interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
... ... @@ -30,7 +31,17 @@ interface EditableCellProps extends React.HTMLAttributes&lt;HTMLElement&gt; {
30 31 children: React.ReactNode;
31 32 }
32 33  
33   -const TotalAmount = ({ value, onChange, readOnly, visible, type, setladderVisible, salaryCode, isPercent }: Props) => {
  34 +const TotalAmount = ({
  35 + laddersType,
  36 + value,
  37 + onChange,
  38 + readOnly,
  39 + visible,
  40 + type,
  41 + setladderVisible,
  42 + salaryCode,
  43 + isPercent,
  44 +}: Props) => {
34 45 const EditableCell: React.FC<EditableCellProps> = ({
35 46 editing,
36 47 dataIndex,
... ... @@ -186,14 +197,38 @@ const TotalAmount = ({ value, onChange, readOnly, visible, type, setladderVisibl
186 197 title: "阶梯值下限(≥)",
187 198 dataIndex: "stairMin",
188 199 width: "25%",
189   - render: (value: number) => value + (isPercent == 2 ? "%" : ""),
  200 + render: (value: number) => {
  201 + if (isPercent == 2) {
  202 + return value + "%";
  203 + } else if (isPercent == 1) {
  204 + return value;
  205 + } else if (isPercent == 0 && laddersType == 2) {
  206 + return value + "%";
  207 + } else {
  208 + return value;
  209 + }
  210 + },
190 211 },
191 212 {
192 213 title: "阶梯值上限(<)",
193 214 dataIndex: "stairMax",
194 215 width: "25%",
195 216 editable: true,
196   - render: (value: number) => (value ? (value + (isPercent == 2 ? "%" : "")): ""),
  217 + render: (value: number) => {
  218 + if (value) {
  219 + if (isPercent == 2) {
  220 + return value + "%";
  221 + } else if (isPercent == 1) {
  222 + return value;
  223 + } else if (isPercent == 0 && laddersType == 2) {
  224 + return value + "%";
  225 + } else {
  226 + return value;
  227 + }
  228 + } else {
  229 + return "";
  230 + }
  231 + },
197 232 },
198 233 ],
199 234 },
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/index.tsx 100644 → 100755
... ... @@ -3,7 +3,7 @@ import { Card, Popconfirm, Row, Button, message, Result, Form, Select, Radio, In
3 3 import { FeeweeFileAccept, FeeweeFileChange } from "@/utils/getFidFile";
4 4 import { common } from "@/typing/common";
5 5 import { PlusOutlined } from "@ant-design/icons";
6   -import { IMGURL } from "@/utils";
  6 +import { IMGURL } from "@/utils";
7 7 import { PageHeaderWrapper } from "@ant-design/pro-layout";
8 8 import { createStore } from "@/hooks/moz";
9 9 import { history } from "umi";
... ... @@ -11,7 +11,7 @@ import store from &quot;./store&quot;;
11 11 import PersonModal from "../components/PersonModal";
12 12 import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
13 13 import * as api from "./api";
14   -import { ShopList, saveKpiGroupConfig } from "./api";
  14 +import { ShopList, saveSalaryGroupConfig } from "./api";
15 15 import IndivatorsTable from "./components/IndivatorsTable";
16 16 import FeeweeUpload from "@/components/FeeweeUpload";
17 17 import { transformDTO, transformFormData } from "../entity";
... ... @@ -23,10 +23,11 @@ const { Option } = Select;
23 23  
24 24 interface Props extends common.ConnectProps {}
25 25 function Index(props: Props) {
26   - const { postList, detailError, configId, setId, data, readOnly, setReadOnly, setSelectedSalaryIds } = useStore();
  26 + const { postList, detailError, setSubmit, configId, setId, data, readOnly, setReadOnly, setSelectedSalaryIds } =
  27 + useStore();
27 28 const [form] = Form.useForm();
28 29 const { match } = props;
29   - const { id, read } = match.params;
  30 + const { id, read, type } = match.params;
30 31  
31 32 // 选择岗位id
32 33 const [postId, setPostId] = useState<number>();
... ... @@ -42,10 +43,12 @@ function Index(props: Props) {
42 43 shopIds: "",
43 44 });
44 45  
45   -
46   - useEffect(() => {
47   - setReadOnly(read === undefined ? false : read !== "false");
48   - }, [read]);
  46 + useEffect(() => {
  47 + setSubmit(type);
  48 + }, [type]);
  49 + useEffect(() => {
  50 + setReadOnly(read === undefined ? false : read !== "false");
  51 + }, [read]);
49 52  
50 53 useEffect(() => {
51 54 setId(id);
... ... @@ -55,7 +58,7 @@ function Index(props: Props) {
55 58 useEffect(() => {
56 59 if (configId && data) {
57 60 const res = transformFormData(data);
58   - console.log('res', res);
  61 + console.log("res", res);
59 62 form.setFieldsValue({
60 63 ...res,
61 64 });
... ... @@ -83,24 +86,33 @@ function Index(props: Props) {
83 86 }
84 87 }, [data.postId]);
85 88  
86   - function handSubmit(fieldsValue: any) {
87   - const _shopIds: number[] = fieldsValue.shop.map((item:any) => item.value);
88   - const res = transformDTO(fieldsValue);
89   - const _shopNames = fieldsValue.shop.map((item: any) => item.label);
90   - const pa = { ...res, id: configId, shopNames: _shopNames };
91   - console.log("总的提交表单pa", pa);
92   - setSaveLoading(true);
93   - saveKpiGroupConfig(pa)
94   - .then((res) => {
95   - setSaveLoading(false);
96   - message.success("操作成功");
97   - setSaveLoading(false);
98   - history.goBack();
99   - })
100   - .catch((e) => {
101   - setSaveLoading(false);
102   - message.error(e.message);
103   - });
  89 + function handSubmit(submit: number) {
  90 + form.validateFields().then((values) => {
  91 + const _shopIds: number[] = values.shop.map((item: any) => item.value);
  92 + const res = transformDTO(values);
  93 + const _shopNames = values.shop.map((item: any) => item.label);
  94 + let pa = null;
  95 + if (type == 1) {
  96 + pa = { ...res, force: true, id: Number(configId), shopNames: _shopNames };
  97 + } else if (type == 2) {
  98 + pa = { ...res, force: true, draftId: Number(configId), shopNames: _shopNames };
  99 + } else {
  100 + pa = { ...res, force: true, shopNames: _shopNames };
  101 + }
  102 + console.log("总的提交表单pa", pa);
  103 + setSaveLoading(true);
  104 + saveSalaryGroupConfig(pa, submit)
  105 + .then((res) => {
  106 + setSaveLoading(false);
  107 + message.success("操作成功");
  108 + setSaveLoading(false);
  109 + history.goBack();
  110 + })
  111 + .catch((e) => {
  112 + setSaveLoading(false);
  113 + message.error(e.message);
  114 + });
  115 + });
104 116 }
105 117  
106 118 // 根据岗位查门店
... ... @@ -142,7 +154,7 @@ function Index(props: Props) {
142 154 initialValues={{
143 155 projects: [],
144 156 }}
145   - onFinish={handSubmit}
  157 + // onFinish={handSubmit}
146 158 >
147 159 <Form.Item label="薪酬组名称" name="name" rules={[{ required: true, message: "请输入薪酬组名称" }]}>
148 160 <Input />
... ... @@ -282,12 +294,29 @@ function Index(props: Props) {
282 294 返回
283 295 </Button>
284 296 {!readOnly && (
285   - <Popconfirm title="确定完成,提交后不可更改?" onConfirm={form.submit} okText="确定" cancelText="取消">
286   - <Button type="primary" size="large" style={{ width: 200 }} loading={saveLoading}>
  297 + <Popconfirm
  298 + title="确定完成,提交后不可更改?"
  299 + onConfirm={() => handSubmit(1)}
  300 + okText="确定"
  301 + cancelText="取消"
  302 + >
  303 + <Button type="primary" size="large" style={{ marginRight: 50, width: 200 }} loading={saveLoading}>
287 304 提交
288 305 </Button>
289 306 </Popconfirm>
290 307 )}
  308 + {!readOnly && (
  309 + <Popconfirm
  310 + title="确定完成,提交后不可更改?"
  311 + onConfirm={() => handSubmit(2)}
  312 + okText="确定"
  313 + cancelText="取消"
  314 + >
  315 + <Button type="primary" size="large" style={{ width: 200 }} loading={saveLoading}>
  316 + 保存草稿
  317 + </Button>
  318 + </Popconfirm>
  319 + )}
291 320 </Row>
292 321  
293 322 <PersonModal item={personModal} setPersonModal={setPersonModal} />
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/store.ts 100644 → 100755
... ... @@ -6,15 +6,19 @@ import { getAllPostListApi } from &quot;@/common/api&quot;;
6 6  
7 7 export default function useStore() {
8 8 const [configId, setId] = useState<number>(0);
  9 + const [submit, setSubmit] = useState<number>(1);
9 10 const { list: postList } = usePagination(getAllPostListApi, { pageSize: 999 }, {});
10 11 const [delay, setDelay] = useState(true);
11   - const { data, errMsg: detailError, setParams } = useInitail(api.queryDetailListApi, {}, {}, delay);
  12 + const {
  13 + data,
  14 + errMsg: detailError,
  15 + setParams,
  16 + } = useInitail(submit == 1 ? api.queryDetailListApi : api.draftQueryDetailListApi, {}, {}, delay);
12 17 const [readOnly, setReadOnly] = useState(false);
13 18  
14 19 const [selectedSalaryIds, setSelectedSalaryIds] = useState<number[]>([]);
15 20 const [selectedSeriesIds, setSelectedSeriesIds] = useState<number[]>([]);
16   - // 是否为百分比
17   - const [isPercent, setIsPercent] = useState<number>(2);
  21 +
18 22 // 保存已经配置过阶梯的指标的id
19 23 const [selectedIndicators, setSelectedIndicators] = useState<string[]>([]);
20 24 const [selectedIndicatorsConds, setSelectedIndicatorsConds] = useState<string[]>([]);
... ... @@ -48,13 +52,12 @@ export default function useStore() {
48 52 setSelectedIndicatorsConds,
49 53 selectedIndicatorsLadder,
50 54 setSelectedIndicatorsLadder,
51   - isPercent,
52   - setIsPercent,
53 55 ladderParamAlias,
54 56 setLadderParamAlias,
55 57 commissionParamAlias,
56 58 setCommissionParamAlias,
57 59 preconditionAlias,
58 60 setPreconditionAlias,
  61 + setSubmit,
59 62 };
60 63 }
... ...
src/pages/performance/CompensateGroupConfig/api.ts 100644 → 100755
1 1 import request from "@/utils/request";
2 2 import { DALARAN, MORAX_HOST } from "@/utils/host";
3 3 import { http } from "@/typing/http";
4   -import { CompensateConfig } from '@/pages/performance/CompensateGroupConfig/interface';
  4 +import { CompensateConfig } from "@/pages/performance/CompensateGroupConfig/interface";
  5 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
5 6  
6 7 export interface PageParams {
7 8 current?: number;
... ... @@ -45,15 +46,28 @@ export interface SaveDTO {
45 46 /** 门店名称 */
46 47 shopNames?: string[];
47 48 /** 全部门店 */
48   - allShop?: boolean
  49 + allShop?: boolean;
49 50 }
50 51  
51 52 /** 薪酬项配置列表
52 53 test: GET http://testgate.feewee.cn/morax/erp/salary/group/page
53 54 */
54   -export function salaryGroupApi(params: CompensateConfig.GroupListParams): http.PromisePageResp<CompensateConfig.GroupListItems> {
  55 +export function salaryGroupApi(
  56 + params: CompensateConfig.GroupListParams
  57 +): http.PromisePageResp<CompensateConfig.GroupListItems> {
55 58 return request.get(`${MORAX_HOST}/erp/salary/group/page`, {
56   - params
  59 + params,
  60 + });
  61 +}
  62 +
  63 +/** 薪酬项配置列表
  64 +test: GET http://testgate.feewee.cn/morax/erp/salary/group/page
  65 + */
  66 +export function salaryGroupDraftApi(
  67 + params: CompensateConfig.GroupListParams
  68 +): http.PromisePageResp<CompensateConfig.GroupListItems> {
  69 + return request.get(`${MORAX_HOST}/erp/setting-draft/salary-page`, {
  70 + params,
57 71 });
58 72 }
59 73  
... ... @@ -61,16 +75,41 @@ export function salaryGroupApi(params: CompensateConfig.GroupListParams): http.P
61 75 * 实时查询薪酬组人员
62 76 * http://testgate.feewee.cn/morax/erp/salary/group/real-time/staffs
63 77 */
64   -export function fetchRealtimeStaffs(params: CompensateConfig.RealTimeParams): http.PromiseResp<CompensateConfig.RealTimePersonItems[]> {
65   - return request.get(`${MORAX_HOST}/erp/salary/group/real-time/staffs`, { params
66   -});
  78 +export function fetchRealtimeStaffs(
  79 + params: CompensateConfig.RealTimeParams
  80 +): http.PromiseResp<CompensateConfig.RealTimePersonItems[]> {
  81 + return request.get(`${MORAX_HOST}/erp/salary/group/real-time/staffs`, { params });
67 82 }
68 83  
69 84 /**
70 85 *查询绩效组人员(列表)
71 86 * http://testgate.feewee.cn/morax/erp/salary/group/staffs
72 87 */
73   -export function fetchGroupConfigStaffs(params: CompensateConfig.GroupConfigParams): http.PromisePageResp<KpiGroupSetteing.RealTimePersonItems> {
74   - return request.get(`${MORAX_HOST}erp/salary/group/staffs`, { params
75   -});
76   -}
77 88 \ No newline at end of file
  89 +export function fetchGroupConfigStaffs(
  90 + params: CompensateConfig.GroupConfigParams
  91 +): http.PromisePageResp<KpiGroupSetteing.RealTimePersonItems> {
  92 + return request.get(`${MORAX_HOST}erp/salary/group/staffs`, { params });
  93 +}
  94 +
  95 +/**
  96 + *删除草稿,审批不通过
  97 + * http://testgate.feewee.cn/morax/erp/setting-draft/del
  98 + */
  99 +export function deleteSalaryGroup(params: CompensateConfig.DeleteKpiGroup) {
  100 + return request.get(`${MORAX_HOST}/erp/setting-draft/del`, { params });
  101 +}
  102 +
  103 +/**
  104 + *禁用薪酬组
  105 + * http://testgate.feewee.cn/morax/erp/salary/group/disable
  106 + */
  107 +export function salaryGroupEnable(params: CompensateConfig.DeleteKpiGroup) {
  108 + return request.get(`${MORAX_HOST}/erp/salary/group/disable`, { params });
  109 +}
  110 +/**
  111 + *撤销审批
  112 + * http://testgate.feewee.cn/morax/erp/setting-draft/cancel
  113 + */
  114 +export function quashSalaryGroup(params: CompensateConfig.DeleteKpiGroup) {
  115 + return request.get(`${MORAX_HOST}/erp/setting-draft/cancel`, { params });
  116 +}
... ...
src/pages/performance/CompensateGroupConfig/components/DraftFilter.tsx 0 → 100755
  1 +import React from "react";
  2 +import { Row, Select, Radio } from "antd";
  3 +import _ from "lodash";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { getAllPostListApi, authShopListApi } from "@/common/api";
  6 +import useInitial from "@/hooks/useInitail";
  7 +import { StatusDraftData } from "@/pages/performance/entity";
  8 +
  9 +const { Option } = Select;
  10 +interface Props {
  11 + setParams: any;
  12 + innerParams: any;
  13 +}
  14 +
  15 +const RadioButton = Radio.Button;
  16 +const RadioGroup = Radio.Group;
  17 +
  18 +export default function Filter({ setParams, innerParams }: Props) {
  19 + const { list } = usePagination(getAllPostListApi, { pageSize: 999 });
  20 + const { data } = useInitial(authShopListApi, [], "");
  21 +
  22 + return (
  23 + <Row justify="start" style={{ marginBottom: 20 }}>
  24 + <Select
  25 + allowClear
  26 + placeholder="请选择门店"
  27 + style={{ width: 250, marginRight: 10, marginBottom: 10 }}
  28 + onChange={(value) => {
  29 + setParams({ shopId: value }, true);
  30 + }}
  31 + showSearch
  32 + optionFilterProp="children"
  33 + >
  34 + {data.map((item) => (
  35 + <Option value={item.rangeValue} key={item.rangeValue}>
  36 + {item.rangeName}
  37 + </Option>
  38 + ))}
  39 + </Select>
  40 + <Select
  41 + allowClear
  42 + placeholder="请选择岗位"
  43 + style={{ width: 250, marginRight: 10, marginBottom: 10 }}
  44 + onChange={(value) => {
  45 + setParams({ postId: value }, true);
  46 + }}
  47 + showSearch
  48 + optionFilterProp="children"
  49 + >
  50 + {list.map((item) => (
  51 + <Option value={item.id} key={item.id}>
  52 + {item.postName}
  53 + </Option>
  54 + ))}
  55 + </Select>
  56 + <RadioGroup
  57 + defaultValue={2}
  58 + buttonStyle="solid"
  59 + size="middle"
  60 + onChange={(e) => {
  61 + console.log("选中状态", e);
  62 + setParams({ status: e.target.value }, true);
  63 + }}
  64 + >
  65 + {StatusDraftData.map((item) => (
  66 + <RadioButton value={item.value}>{item.label}</RadioButton>
  67 + ))}
  68 + </RadioGroup>
  69 + </Row>
  70 + );
  71 +}
... ...
src/pages/performance/CompensateGroupConfig/components/DraftList.tsx 0 → 100755
  1 +import React, { useState } from "react";
  2 +import { PageHeaderWrapper } from "@ant-design/pro-layout";
  3 +import { Button, Card, Table, Row, Space, Typography, Divider, Popconfirm, message } from "antd";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { history } from "umi";
  6 +import { deleteSalaryGroup, quashSalaryGroup, salaryGroupDraftApi } from "../api";
  7 +import DraftFilter from "./DraftFilter";
  8 +import { DraftStatusEnum } from "../entity";
  9 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
  10 +import EmployeesModal from "./EmployeesModal";
  11 +import { CompensateConfig } from "@/pages/performance/CompensateGroupConfig/interface";
  12 +import moment from "moment";
  13 +import ShopModal from "./ShopModal";
  14 +import DetailModal from "../../KpiGroupSetting/components/DetailModal";
  15 +
  16 +const Column = Table.Column;
  17 +interface Props {
  18 + type: number;
  19 +}
  20 +
  21 +export default ({ type }: Props) => {
  22 + const { loading, list, paginationConfig, setParams, innerParams } = usePagination(salaryGroupDraftApi, { status: 2, type: 3 });
  23 + // 查看适用员工
  24 + const [employeeModal, setEmployeeModal] = useState<{
  25 + visible: boolean;
  26 + record?: CompensateConfig.GroupListItems;
  27 + }>({
  28 + visible: false,
  29 + record: {},
  30 + });
  31 + const [visibleDetail, setVisibleDetail] = useState(false);
  32 + const [item, setItem] = useState<any>({});
  33 + const [shopModal, setShopModal] = useState<{
  34 + visible: boolean;
  35 + record?: CompensateConfig.GroupListItems;
  36 + }>({
  37 + visible: false,
  38 + record: {},
  39 + });
  40 +
  41 + const _onCancel = () => {
  42 + setEmployeeModal({ visible: false });
  43 + };
  44 + const shopOnCancel = () => {
  45 + setShopModal({ visible: false });
  46 + };
  47 +
  48 + //删除
  49 + const onDelet = async (id: number) => {
  50 + const pa = { id };
  51 + try {
  52 + const { success } = await deleteSalaryGroup(pa);
  53 + if (success) {
  54 + message.success("删除成功", 5);
  55 + // 重新刷新列表
  56 + setParams({ ...innerParams }, true);
  57 + }
  58 + } catch (error: any) {
  59 + message.error(error.message);
  60 + }
  61 + };
  62 +
  63 + //撤销审批
  64 + const onQuash = async (id: number) => {
  65 + const pa = { id };
  66 + try {
  67 + const { success } = await quashSalaryGroup(pa);
  68 + if (success) {
  69 + message.success("撤销审批成功", 5);
  70 + // 重新刷新列表
  71 + setParams({ ...innerParams }, true);
  72 + }
  73 + } catch (error: any) {
  74 + message.error(error.message);
  75 + }
  76 + };
  77 +
  78 + return (
  79 + <>
  80 + <Row justify="space-between" style={{ marginBottom: 10 }}>
  81 + <DraftFilter setParams={setParams} innerParams={innerParams} />
  82 +
  83 + <Button
  84 + type="primary"
  85 + onClick={() => {
  86 + history.push(`/morax/compensateGroupConfig/edit`);
  87 + }}
  88 + >
  89 + 新增
  90 + </Button>
  91 + </Row>
  92 + <Table loading={loading} rowKey={(row) => `id${row.id}`} dataSource={list} pagination={paginationConfig}>
  93 + <Column title="薪酬组名称" dataIndex="name" align="center" render={(name) => name || ""} />
  94 + <Column title="岗位" dataIndex="postName" align="center" />
  95 + <Column
  96 + title="薪酬项目(项)"
  97 + dataIndex="projectNum"
  98 + align="center"
  99 + render={(name) => <span>{name || "--"}</span>}
  100 + />
  101 + <Column
  102 + title="适用门店"
  103 + dataIndex="shopNames"
  104 + align="center"
  105 + render={(_: any, record: CompensateConfig.GroupListItems) => (
  106 + <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
  107 + 查看
  108 + </Button>
  109 + )}
  110 + />
  111 + <Column
  112 + title="适用员工"
  113 + align="center"
  114 + render={(_: any, record: CompensateConfig.GroupListItems) => (
  115 + <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
  116 + 查看
  117 + </Button>
  118 + )}
  119 + />
  120 + <Column
  121 + title="状态"
  122 + align="center"
  123 + dataIndex="status"
  124 + render={(text: number) => (text ? DraftStatusEnum[text] : "--")}
  125 + />
  126 + <Column
  127 + title="生效时间"
  128 + align="center"
  129 + dataIndex="beginTime"
  130 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  131 + />
  132 + <Column
  133 + title="失效时间"
  134 + align="center"
  135 + dataIndex="overTime"
  136 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  137 + />
  138 + <Column
  139 + title="操作"
  140 + width={180}
  141 + align="center"
  142 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => {
  143 + console.log(record);
  144 + return (
  145 + <Space split={<Divider type="vertical" />}>
  146 + {record.draftStatus == 2 || record.draftStatus == 3 ? (
  147 + <Typography.Link
  148 + onClick={() => {
  149 + setVisibleDetail(true);
  150 + setItem(record);
  151 + }}
  152 + >
  153 + 流程进度
  154 + </Typography.Link>
  155 + ) : null}
  156 + {record.draftStatus == 2 ? (
  157 + <Typography.Link
  158 + onClick={() => {
  159 + history.push(`/morax/compensateGroupConfig/edit/${record.draftId}/true/${type}`);
  160 + }}
  161 + >
  162 + 查看
  163 + </Typography.Link>
  164 + ) : null}
  165 + {record.draftStatus == 3 || record.draftStatus == 1 || record.draftStatus == 5 ? (
  166 + <Typography.Link
  167 + onClick={() => {
  168 + history.push(`/morax/compensateGroupConfig/edit/${record.draftId}/false/${type}`);
  169 + }}
  170 + >
  171 + {`${record.draftStatus == 3 ? "重新" : ""}编辑`}
  172 + </Typography.Link>
  173 + ) : null}
  174 +
  175 + {record.draftStatus == 3 || record.draftStatus == 1 || record.draftStatus == 5 ? (
  176 + <Popconfirm
  177 + title="确定删除,提交后不可更改?"
  178 + onConfirm={() => onDelet(record.draftId)}
  179 + okText="确定"
  180 + cancelText="取消"
  181 + >
  182 + <Typography.Link>删除</Typography.Link>
  183 + </Popconfirm>
  184 + ) : null}
  185 + {record.draftStatus == 2 ? (
  186 + <Popconfirm
  187 + title="确定撤销审批,提交后不可更改?"
  188 + onConfirm={() => onQuash(record.draftId)}
  189 + okText="确定"
  190 + cancelText="取消"
  191 + >
  192 + <Typography.Link>撤销审批</Typography.Link>
  193 + </Popconfirm>
  194 + ) : null}
  195 + </Space>
  196 + );
  197 + }}
  198 + />
  199 + </Table>
  200 + <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
  201 + <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  202 + <DetailModal visible={visibleDetail} item={item} onCancel={() => setVisibleDetail(false)} />
  203 + </>
  204 + );
  205 +};
... ...
src/pages/performance/CompensateGroupConfig/components/EmployeesModal.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/components/Filter.tsx 100644 → 100755
1 1 import React from "react";
2   -import { Row, Select } from "antd";
  2 +import { Row, Select, Radio } from "antd";
3 3 import _ from "lodash";
4 4 import usePagination from "@/hooks/usePagination";
5 5 import { getAllPostListApi, authShopListApi } from "@/common/api";
... ... @@ -12,6 +12,9 @@ interface Props {
12 12 innerParams: any;
13 13 }
14 14  
  15 +const RadioButton = Radio.Button;
  16 +const RadioGroup = Radio.Group;
  17 +
15 18 export default function Filter({ setParams, innerParams }: Props) {
16 19 const { list } = usePagination(getAllPostListApi, { pageSize: 999 });
17 20 const { data } = useInitial(authShopListApi, [], "");
... ... @@ -50,21 +53,19 @@ export default function Filter({ setParams, innerParams }: Props) {
50 53 </Option>
51 54 ))}
52 55 </Select>
53   - <Select
54   - allowClear
55   - placeholder="请选择状态"
56   - style={{ width: 250, marginRight: 10, marginBottom: 10 }}
57   - value={innerParams.status}
58   - onChange={(value) => {
59   - setParams({ status: value }, true);
  56 + <RadioGroup
  57 + defaultValue={3}
  58 + buttonStyle="solid"
  59 + size="middle"
  60 + onChange={(e) => {
  61 + console.log("选中状态", e);
  62 + setParams({ status: e.target.value }, true);
60 63 }}
61 64 >
62 65 {StatusData.map((item) => (
63   - <Option value={item.value} key={item.value}>
64   - {item.label}
65   - </Option>
  66 + <RadioButton value={item.value}>{item.label}</RadioButton>
66 67 ))}
67   - </Select>
  68 + </RadioGroup>
68 69 </Row>
69 70 );
70 71 }
... ...
src/pages/performance/CompensateGroupConfig/components/NormalList.tsx 0 → 100755
  1 +import React, { useState } from "react";
  2 +import { PageHeaderWrapper } from "@ant-design/pro-layout";
  3 +import { Button, Card, Table, Row, Space, Typography, Divider, Popconfirm, message } from "antd";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { history } from "umi";
  6 +import { salaryGroupApi, salaryGroupEnable } from "../api";
  7 +import Filter from "./Filter";
  8 +import { StatusEnum } from "../entity";
  9 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
  10 +import EmployeesModal from "./EmployeesModal";
  11 +import { CompensateConfig } from "@/pages/performance/CompensateGroupConfig/interface";
  12 +import moment from "moment";
  13 +import ShopModal from "./ShopModal";
  14 +import DetailModal from "../../KpiGroupSetting/components/DetailModal";
  15 +
  16 +const Column = Table.Column;
  17 +interface Props {
  18 + type: number;
  19 +}
  20 +
  21 +export default ({ type }: Props) => {
  22 + const { loading, list, paginationConfig, setParams, innerParams } = usePagination(salaryGroupApi, { status: 3 });
  23 + // 查看适用员工
  24 + const [employeeModal, setEmployeeModal] = useState<{
  25 + visible: boolean;
  26 + record?: CompensateConfig.GroupListItems;
  27 + }>({
  28 + visible: false,
  29 + record: {},
  30 + });
  31 + const [visibleDetail, setVisibleDetail] = useState(false);
  32 + const [item, setItem] = useState<any>({});
  33 + const [shopModal, setShopModal] = useState<{
  34 + visible: boolean;
  35 + record?: CompensateConfig.GroupListItems;
  36 + }>({
  37 + visible: false,
  38 + record: {},
  39 + });
  40 +
  41 + const _onCancel = () => {
  42 + setEmployeeModal({ visible: false });
  43 + };
  44 + const shopOnCancel = () => {
  45 + setShopModal({ visible: false });
  46 + };
  47 +
  48 + // 禁用
  49 + const indicatorEnable = async (id: number) => {
  50 + const pa = { id };
  51 + try {
  52 + const { success } = await salaryGroupEnable(pa);
  53 + if (success) {
  54 + message.success("禁用成功", 5);
  55 + // 重新刷新列表
  56 + setParams({ ...innerParams }, true);
  57 + }
  58 + } catch (error: any) {
  59 + message.error(error.message);
  60 + }
  61 + };
  62 +
  63 + return (
  64 + <>
  65 + <Row justify="space-between" style={{ marginBottom: 10 }}>
  66 + <Filter setParams={setParams} innerParams={innerParams} />
  67 +
  68 + <Button
  69 + type="primary"
  70 + onClick={() => {
  71 + history.push(`/morax/compensateGroupConfig/edit`);
  72 + }}
  73 + >
  74 + 新增
  75 + </Button>
  76 + </Row>
  77 + <Table loading={loading} rowKey={(row) => `id${row.id}`} dataSource={list} pagination={paginationConfig}>
  78 + <Column title="薪酬组名称" dataIndex="name" align="center" render={(name) => name || ""} />
  79 + <Column title="岗位" dataIndex="postName" align="center" />
  80 + <Column
  81 + title="薪酬项目(项)"
  82 + dataIndex="projectNum"
  83 + align="center"
  84 + render={(name) => <span>{name || "--"}</span>}
  85 + />
  86 + <Column
  87 + title="适用门店"
  88 + dataIndex="shopNames"
  89 + align="center"
  90 + render={(_: any, record: CompensateConfig.GroupListItems) => (
  91 + <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
  92 + 查看
  93 + </Button>
  94 + )}
  95 + />
  96 + <Column
  97 + title="适用员工"
  98 + align="center"
  99 + render={(_: any, record: CompensateConfig.GroupListItems) => (
  100 + <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
  101 + 查看
  102 + </Button>
  103 + )}
  104 + />
  105 + <Column
  106 + title="状态"
  107 + align="center"
  108 + dataIndex="status"
  109 + render={(text: number) => (text ? StatusEnum[text] : "--")}
  110 + />
  111 + <Column
  112 + title="生效时间"
  113 + align="center"
  114 + dataIndex="beginTime"
  115 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  116 + />
  117 + <Column
  118 + title="失效时间"
  119 + align="center"
  120 + dataIndex="overTime"
  121 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  122 + />
  123 + {/* `/morax/compensateGroupConfig/edit/${record.id}/true` */}
  124 + <Column
  125 + title="操作"
  126 + width={180}
  127 + align="center"
  128 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => {
  129 + return (
  130 + <Space split={<Divider type="vertical" />}>
  131 + {/* {record.status === 3 ? null : (
  132 + <Typography.Link
  133 + onClick={() => {
  134 + setVisibleDetail(true);
  135 + setItem(record);
  136 + }}
  137 + >
  138 + 流程进度
  139 + </Typography.Link>
  140 + )} */}
  141 + {record.status === 4 ? (
  142 + <Typography.Link
  143 + onClick={() => {
  144 + history.push(`/morax/compensateGroupConfig/edit/${record.id}/true/${type}`); // 通过传过来的type以斜杠形式放在url中,再来判断调用哪的详情
  145 + }}
  146 + >
  147 + 查看
  148 + </Typography.Link>
  149 + ) : null}
  150 + {record.status === 2 || record.status === 3 ? (
  151 + <Typography.Link
  152 + onClick={() => {
  153 + history.push(`/morax/compensateGroupConfig/edit/${record.id}/false/${type}`);
  154 + }}
  155 + >
  156 + 编辑
  157 + </Typography.Link>
  158 + ) : null}
  159 + {record.status == 2 || record.status == 3 ? (
  160 + <Popconfirm
  161 + title="确定禁用,提交后不可更改?"
  162 + onConfirm={() => indicatorEnable(record.id)}
  163 + okText="确定"
  164 + cancelText="取消"
  165 + >
  166 + <Typography.Link>禁用</Typography.Link>
  167 + </Popconfirm>
  168 + ) : null}
  169 + {/* {record.status !== 1 ? null : (
  170 + <Typography.Link
  171 + onClick={() => {
  172 + console.log("撤销审批");
  173 + }}
  174 + >
  175 + 撤销审批
  176 + </Typography.Link>
  177 + )} */}
  178 + </Space>
  179 + );
  180 + }}
  181 + />
  182 + </Table>
  183 + <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
  184 + <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  185 + <DetailModal visible={visibleDetail} item={item} onCancel={() => setVisibleDetail(false)} />
  186 + </>
  187 + );
  188 +};
... ...
src/pages/performance/CompensateGroupConfig/components/PersonModal.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/components/Rule1.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/components/ShopModal.tsx 100644 → 100755
src/pages/performance/CompensateGroupConfig/entity.ts 100644 → 100755
1 1 import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
  2 +import office from "config/routers/office";
2 3 import _ from "lodash";
3 4  
4 5 // roleType 适用角色类型; 1: 全部角色 2:全部管理角色 3: 自定义(See: 适用角色类型枚举)
... ... @@ -59,6 +60,13 @@ export enum StatusEnum {
59 60 "生效中",
60 61 "已失效",
61 62 }
  63 +export enum DraftStatusEnum {
  64 + "未发布" = 1,
  65 + "审批中" = 2,
  66 + "审批不通过" = 3,
  67 + "审批同意" = 4,
  68 + "撤销审批" = 5,
  69 +}
62 70  
63 71 export const Approval_Status = [
64 72 {
... ... @@ -126,10 +134,12 @@ const setMaxValue = (indicators: any[]) =&gt; {
126 134 const _length = item.settings.length;
127 135 if (_length > 0 && (item.calMethod === 6 || item.calMethod === 3)) {
128 136 item.settings[_length - 1].stairMax = 65536;
  137 + // if (item.calMethod === 6 || item.calMethod === 3) {
129 138 item.settings.forEach((i, idx) => {
130 139 item.settings[idx].stairKey = item.salaryProjectId;
131 140 item.settings[idx].stairKeyDesc = item.salaryProjectName;
132 141 });
  142 + // }
133 143 }
134 144 }
135 145 });
... ...
src/pages/performance/CompensateGroupConfig/index.tsx 100644 → 100755
1 1 import React, { useState } from "react";
2 2 import { PageHeaderWrapper } from "@ant-design/pro-layout";
3   -import { Button, Card, Table, Row, Space, Typography, Divider } from "antd";
4   -import usePagination from "@/hooks/usePagination";
5   -import { history } from "umi";
6   -import { salaryGroupApi } from "./api";
7   -import Filter from "./components/Filter";
8   -import { StatusEnum } from "./entity";
9   -import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
10   -import EmployeesModal from "./components/EmployeesModal";
11   -import { CompensateConfig } from "@/pages/performance/CompensateGroupConfig/interface";
12   -import moment from "moment";
13   -import ShopModal from "./components/ShopModal";
14   -
15   -const Column = Table.Column;
  3 +import { Card, Radio, Divider } from "antd";
  4 +import NormalList from "./components/NormalList";
  5 +import DraftList from "./components/DraftList";
16 6  
17 7 export default () => {
18   - const { loading, list, paginationConfig, setParams, innerParams } = usePagination(salaryGroupApi, { status: 3 });
19   - // 查看适用员工
20   - const [employeeModal, setEmployeeModal] = useState<{
21   - visible: boolean;
22   - record?: CompensateConfig.GroupListItems;
23   - }>({
24   - visible: false,
25   - record: {},
26   - });
27   - const [shopModal, setShopModal] = useState<{
28   - visible: boolean;
29   - record?: CompensateConfig.GroupListItems;
30   - }>({
31   - visible: false,
32   - record: {},
33   - });
34   -
35   - const _onCancel = () => {
36   - setEmployeeModal({ visible: false });
37   - };
38   - const shopOnCancel = () => {
39   - setShopModal({ visible: false });
40   - };
41   -
  8 + const [type, setType] = useState<number>(1);
42 9 return (
43 10 <PageHeaderWrapper title="薪酬组配置">
44 11 <Card>
45   - <Row justify="space-between" style={{ marginBottom: 10 }}>
46   - <Filter setParams={setParams} innerParams={innerParams} />
47   -
48   - <Button
49   - type="primary"
50   - onClick={() => {
51   - history.push(`/morax/compensateGroupConfig/edit`);
52   - }}
53   - >
54   - 新增
55   - </Button>
56   - </Row>
57   - <Table loading={loading} rowKey={(row) => `id${row.id}`} dataSource={list} pagination={paginationConfig}>
58   - <Column title="薪酬组名称" dataIndex="name" align="center" render={(name) => name || ""} />
59   - <Column title="岗位" dataIndex="postName" align="center" />
60   - <Column
61   - title="薪酬项目(项)"
62   - dataIndex="projectNum"
63   - align="center"
64   - render={(name) => <span>{name || "--"}</span>}
65   - />
66   - <Column
67   - title="适用门店"
68   - dataIndex="shopNames"
69   - align="center"
70   - render={(_: any, record: CompensateConfig.GroupListItems) => (
71   - <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
72   - 查看
73   - </Button>
74   - )}
75   - />
76   - <Column
77   - title="适用员工"
78   - align="center"
79   - render={(_: any, record: CompensateConfig.GroupListItems) => (
80   - <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
81   - 查看
82   - </Button>
83   - )}
84   - />
85   - <Column
86   - title="状态"
87   - align="center"
88   - dataIndex="status"
89   - render={(text: number) => (text ? StatusEnum[text] : "--")}
90   - />
91   - <Column
92   - title="生效时间"
93   - align="center"
94   - dataIndex="beginTime"
95   - render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
96   - />
97   - <Column
98   - title="失效时间"
99   - align="center"
100   - dataIndex="overTime"
101   - render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
102   - />
103   - <Column
104   - title="操作"
105   - align="center"
106   - render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
107   - <Space split={<Divider type="vertical" />}>
108   - <Typography.Link
109   - onClick={() => {
110   - history.push(`/morax/compensateGroupConfig/edit/${record.id}/true`);
111   - }}
112   - >
113   - 查看
114   - </Typography.Link>
115   - {record.status === 1 ? null : (
116   - <Typography.Link
117   - onClick={() => {
118   - history.push(`/morax/compensateGroupConfig/edit/${record.id}/false`);
119   - }}
120   - >
121   - 编辑
122   - </Typography.Link>
123   - )}
124   - </Space>
125   - )}
126   - />
127   - </Table>
128   - <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
129   - <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  12 + <Radio.Group defaultValue={type} buttonStyle="solid" size="large" onChange={(e) => setType(e.target.value)}>
  13 + <Radio.Button value={1}>薪酬组</Radio.Button>
  14 + <Radio.Button value={2}>草稿</Radio.Button>
  15 + </Radio.Group>
  16 + <Divider />
  17 + {type == 1 ? <NormalList type={type} /> : <DraftList type={type} />}
130 18 </Card>
131 19 </PageHeaderWrapper>
132 20 );
... ...
src/pages/performance/CompensateGroupConfig/interface.d.ts 100644 → 100755
... ... @@ -2,6 +2,9 @@ import Enum from &#39;@/utils/enum&#39;;
2 2  
3 3 declare namespace CompensateConfig {
4 4  
  5 + interface DeleteKpiGroup {
  6 + id: number
  7 + }
5 8 interface BasePageParams {
6 9 current: number;
7 10 pageSize: number;
... ... @@ -111,6 +114,8 @@ declare namespace CompensateConfig {
111 114 }
112 115 // 配置薪酬项目
113 116 interface Item {
  117 + laddersType: number;
  118 + index: number
114 119 targets: any[];
115 120 ladderParamAlias: string;
116 121 commissionParamAlias: string;
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/api.ts 100644 → 100755
... ... @@ -44,6 +44,10 @@ export interface ShopList {
44 44 export function queryDetailListApi(id: number): http.PromiseResp<KpiGroupSetteing.KpiGroupDetail> {
45 45 return request.get(`${MORAX_HOST}/erp/kpi/group-config`, { params: { id } });
46 46 }
  47 +// 查询草稿详情
  48 +export function draftQueryDetailListApi(id: number): http.PromiseResp<KpiGroupSetteing.KpiGroupDetail> {
  49 + return request.get(`${MORAX_HOST}/erp/setting-draft/kpi-detail`, { params: { id } });
  50 +}
47 51  
48 52 /**
49 53 * 查询岗位下门店
... ... @@ -68,6 +72,6 @@ export function queryPostIndicatorApi(params?: { postId: number; shopIds: string
68 72 * 绩效组保存
69 73 * http://testgate.feewee.cn/morax/erp/kpi/group-config
70 74 */
71   -export function saveKpiGroupConfig(params: KpiGroupSetteing.KpiGroupSaveParams): http.PromiseResp<any> {
72   - return request.post(`${MORAX_HOST}/erp/kpi/group-config`, params);
  75 +export function saveKpiGroupConfig(params: KpiGroupSetteing.KpiGroupSaveParams, submit: number): http.PromiseResp<any> {
  76 + return request.post(`${MORAX_HOST}/erp/kpi/group-config/${submit}`, params);
73 77 }
74 78 \ No newline at end of file
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddCommissionParamsModal.tsx 100644 → 100755
... ... @@ -34,12 +34,7 @@ export default function AddCommissionParamsModal(props: Props) {
34 34 const percent = /^\d\.([1-9]{1,2}|[0-9][1-9])$|^[1-9]\d{0,1}(\.\d{1,2}){0,1}$|^100(\.0{1,2}){0,1}$/;
35 35 const Momney = /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/;
36 36 const [form] = Form.useForm();
37   - const {
38   - selectedIndicators,
39   - setParamAlias,
40   - setSelectedIndicatorsLadder,
41   - selectedIndicatorsLadder,
42   - } = useStore();
  37 + const { selectedIndicators, setParamAlias, setSelectedIndicators } = useStore();
43 38  
44 39 const [isTarget, setIsTarget] = useState(false);
45 40 // console.log(form);
... ... @@ -69,6 +64,7 @@ export default function AddCommissionParamsModal(props: Props) {
69 64 if (indicatorsList && indicatorsList.length > 0 && !comItem.indicatorCode) {
70 65 const res = indicatorsList.filter((item) => !selectedIndicators.find((y) => y === item.indicatorCode));
71 66 setNewIndicators([...res]);
  67 + console.log("selectedIndicators", selectedIndicators);
72 68 }
73 69 if (addComVisible && comItem.indicatorCode) {
74 70 const indTar = indicatorsList.find((item) => item.indicatorCode == comItem.indicatorCode)?.targetType;
... ... @@ -121,9 +117,9 @@ export default function AddCommissionParamsModal(props: Props) {
121 117 const newItemId = pa.indicatorCode;
122 118 // 编辑时,不需要push id
123 119 if (!comItem.indicatorCode) {
124   - const tmpIds = [...selectedIndicatorsLadder];
  120 + const tmpIds = [...selectedIndicators];
125 121 tmpIds.push(newItemId);
126   - setSelectedIndicatorsLadder([...tmpIds]);
  122 + setSelectedIndicators([...tmpIds]);
127 123 } else {
128 124 pa.indicatorCode = comItem.indicatorCode;
129 125 pa.indicatorId = comItem.indicatorId;
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddCondModal.tsx 100644 → 100755
... ... @@ -161,11 +161,7 @@ export default function AddCondModal(props: Props) {
161 161 optionFilterProp="children"
162 162 >
163 163 {newIndicators.map((item) => (
164   - <Option
165   - value={item.indicatorCode}
166   - key={item.id}
167   - targetType={item.targetType}
168   - >
  164 + <Option value={item.indicatorCode} key={item.id} targetType={item.targetType}>
169 165 {item.indicatorName}
170 166 </Option>
171 167 ))}
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddIndicatorsModal.tsx 100644 → 100755
... ... @@ -27,8 +27,11 @@ interface Props {
27 27 export default function AddIndicatorsModal(props: Props) {
28 28 const [form] = Form.useForm();
29 29 // console.log(form);
30   - const { paramAlias, setParamAlias, isPercent, setIsPercent } = useStore();
  30 + const { paramAlias, setParamAlias } = useStore();
  31 +
  32 + // 是否为百分比
31 33 const { visible, onCancel, postId, shopIds, onOk, currentItem, comItem } = props;
  34 + const [isPercent, setIsPercent] = useState<number>(0);
32 35 const [delay, setDelay] = useState(true);
33 36 // 显示前置条件
34 37 const [condsVisible, setCondsVisible] = useState(false);
... ... @@ -51,14 +54,14 @@ export default function AddIndicatorsModal(props: Props) {
51 54 setDelay(false);
52 55 }
53 56 // 修改
54   - if (visible && currentItem.id) {
55   - setItemId(currentItem.id);
  57 + if (visible && currentItem.name) {
  58 + // setItemId(currentItem.id);
56 59 setParamAlias(currentItem.paramAlias);
57 60 form.setFieldsValue({
58 61 ...currentItem,
59 62 });
60 63 }
61   - if (currentItem.conds && currentItem.conds.length > 0) {
  64 + if (currentItem.conds) {
62 65 setCondsVisible(true);
63 66 } else {
64 67 setCondsVisible(false);
... ... @@ -94,9 +97,13 @@ export default function AddIndicatorsModal(props: Props) {
94 97 console.log(fieldsValue);
95 98 const pa: any = transformDTO(fieldsValue);
96 99 // pa.targetType = targetType;
97   - pa.id = id;
  100 + // pa.id = id;
98 101 pa.paramAlias = paramAlias;
99   - pa.laddersType = isPercent;
  102 + if (isPercent == 0) {
  103 + pa.laddersType = currentItem.laddersType;
  104 + } else {
  105 + pa.laddersType = isPercent;
  106 + }
100 107 console.log("大", pa);
101 108 let hundred = 0;
102 109 if (pa?.commissionParams) {
... ... @@ -170,7 +177,7 @@ export default function AddIndicatorsModal(props: Props) {
170 177 console.log("isPercent", isPercent);
171 178 return (
172 179 <Modal
173   - title={`${currentItem.id ? "编辑" : "新增"}指标`}
  180 + title={`${currentItem.name ? "编辑" : "新增"}指标`}
174 181 visible={visible}
175 182 maskClosable={false}
176 183 afterClose={() => {
... ... @@ -208,7 +215,7 @@ export default function AddIndicatorsModal(props: Props) {
208 215 </Option>
209 216 </Select>
210 217 </Form.Item>
211   - <div style={{ marginLeft: 220, marginBottom: 20 }}>
  218 + <div style={{ marginLeft: 218, marginBottom: 20 }}>
212 219 <span>是否添加前置条件设置:</span>
213 220 <Radio.Group
214 221 onChange={(e) => {
... ... @@ -244,7 +251,7 @@ export default function AddIndicatorsModal(props: Props) {
244 251 label="台阶得分阶梯"
245 252 rules={[{ required: true, message: "台阶得分阶梯" }]}
246 253 >
247   - <LadderTable visible isPercent={isPercent} />
  254 + <LadderTable visible isPercent={isPercent} laddersType={currentItem.laddersType} />
248 255 </Form.Item>
249 256 </>
250 257 ) : getFieldValue("scoreWay") === 2 ? (
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddLadderParamsModal.tsx 100644 → 100755
... ... @@ -27,7 +27,7 @@ export default function AddLadderParamsModal(props: Props) {
27 27 const { selectedIndicatorsLadder, setSelectedIndicatorsLadder, paramAlias, setParamAlias } = useStore();
28 28  
29 29 const [isTarget, setIsTarget] = useState(false);
30   - const [dataType, setDataType] = useState<number>();
  30 + const [dataType, setDataType] = useState<number>(2);
31 31 // console.log(form);
32 32 const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId } = props;
33 33 const [delay, setDelay] = useState(true);
... ... @@ -55,7 +55,6 @@ export default function AddLadderParamsModal(props: Props) {
55 55 if (indicatorsList && indicatorsList.length > 0 && !comItem.indicatorCode) {
56 56 const res = indicatorsList.filter((item) => !selectedIndicatorsLadder.find((y) => y === item.indicatorCode));
57 57 setNewIndicators([...res]);
58   - console.log(selectedIndicatorsLadder);
59 58 }
60 59 if (addComVisible && comItem.indicatorCode) {
61 60 const indTar = indicatorsList.find((item) => item.indicatorCode == comItem.indicatorCode)?.targetType;
... ... @@ -68,6 +67,7 @@ export default function AddLadderParamsModal(props: Props) {
68 67 ladderParams: {
69 68 value: comItem.indicatorCode,
70 69 label: comItem.indicatorName,
  70 + dataType: comItem.dataType,
71 71 },
72 72 });
73 73 }
... ... @@ -104,7 +104,13 @@ export default function AddLadderParamsModal(props: Props) {
104 104 function handSubmit(fieldsValue: any) {
105 105 const pa: any = transformDTO(fieldsValue);
106 106 pa.targetType = targetType;
107   - pa.dataType = dataType;
  107 + // console.log("11119999", fieldsValue);
  108 + if (comItem.dataType) {
  109 + pa.dataType = comItem.dataType;
  110 + }
  111 + if (!comItem.dataType) {
  112 + pa.dataType = dataType;
  113 + }
108 114 // console.log("100pa", pa);
109 115 const newItemId = pa.indicatorCode;
110 116 // 编辑时,不需要push id
... ... @@ -123,7 +129,7 @@ export default function AddLadderParamsModal(props: Props) {
123 129 return (
124 130 <Modal
125 131 visible={addComVisible}
126   - title={`${comItem.indicatorCode ? "编辑" : "新增"}固定得分指标`}
  132 + title={`${comItem.indicatorCode ? "编辑" : "新增"}台阶得分指标`}
127 133 maskClosable={false}
128 134 afterClose={() => {
129 135 form.resetFields();
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/CommissionParams.tsx 100644 → 100755
... ... @@ -145,8 +145,8 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr
145 145 </div>
146 146 }
147 147 title={
148   - <div style={{ display: "flex", justifyContent: "flex-start", width: 500 }}>
149   - 提成指标名称:
  148 + <div style={{ display: "flex", justifyContent: "flex-start", width: 300 }}>
  149 + X=
150 150 <Input value={paramAlias} onChange={(e) => setParamAlias(e.target.value)} />
151 151 </div>
152 152 }
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/CondLaddersTable.tsx 100644 → 100755
... ... @@ -202,14 +202,13 @@ const LadderTable = ({ value, onChange, readOnly, visible, type, setladderVisibl
202 202 dataIndex: "upper",
203 203 width: "20%",
204 204 editable: true,
205   - render: (value: number) => (value && value !== 65536 ? value + "%" : ""),
  205 + render: (value: number) => ((value && value !== 65536) ? (value + "%") : ""),
206 206 },
207 207 {
208   - title: "绩效分",
  208 + title: "标准分",
209 209 dataIndex: "scorePercent",
210 210 width: "15%",
211 211 editable: true,
212   - render: (value: number) => (value == 100 ? "全额计算" : (`${value}%`)),
213 212 },
214 213 {
215 214 title: "操作",
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/Conds.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/EditComfirm/components/CreatelModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/EditComfirm/components/IndivatorsTable.tsx 100644 → 100755
... ... @@ -70,10 +70,10 @@ const IndivatorsTable = ({ value, onChange, personModal }: Props) =&gt; {
70 70 }, [value]);
71 71  
72 72 // 编辑
73   - const onEdit = (record: Item) => {
  73 + const onEdit = (record: Item, index:number) => {
74 74 setVisible(true);
75   - setCurrentItem({ ...record });
76   - console.log(record);
  75 + setCurrentItem({ ...record, index });
  76 + console.log({ ...record, index });
77 77 if (record.commissionParams) {
78 78 setSelectedIndicators((record.commissionParams || []).map((item) => item.indicatorCode));
79 79 }
... ... @@ -101,10 +101,10 @@ const IndivatorsTable = ({ value, onChange, personModal }: Props) =&gt; {
101 101 // 删除
102 102 const _onDelete = (record: Item, index: number) => {
103 103 const tempData = [...(value || [])];
104   - const res = tempData.filter((item) => item.id !== record.id);
  104 + tempData.splice(index, 1);// splice直接修改原数组,不会返回新数组
105 105 //已选指标项同步删除
106 106 selectedIndicators.splice(index, 1);
107   - onChange && onChange([...res]);
  107 + onChange && onChange([...tempData]);
108 108 };
109 109 const columns = [
110 110 {
... ... @@ -174,7 +174,7 @@ const IndivatorsTable = ({ value, onChange, personModal }: Props) =&gt; {
174 174 key: "operation",
175 175 render: (_: any, record: Item, index: number) => (
176 176 <Space split={<Divider type="vertical" />}>
177   - <Typography.Link onClick={() => onEdit(record)}>编辑</Typography.Link>
  177 + <Typography.Link onClick={() => onEdit(record, index)}>编辑</Typography.Link>
178 178 <Typography.Link onClick={() => _onDelete(record, index)}>删除</Typography.Link>
179 179 </Space>
180 180 ),
... ... @@ -209,11 +209,11 @@ const IndivatorsTable = ({ value, onChange, personModal }: Props) =&gt; {
209 209 postId={postId}
210 210 shopIds={shopIds}
211 211 onOk={(values) => {
212   - if (!currentItem.id) {
  212 + if (!currentItem.name) {
213 213 tableData.push(values);
214 214 onChange && onChange(tableData);
215 215 } else {
216   - const res = tableData.map((item) => (item.id === currentItem.id ? { ...values } : item));
  216 + const res = tableData.map((item, index) => (index === currentItem.index ? { ...values } : item));
217 217 onChange && onChange(res);
218 218 }
219 219 }}
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/LadderParams.tsx 100644 → 100755
... ... @@ -143,8 +143,8 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundred }
143 143 </div>
144 144 }
145 145 title={
146   - <div style={{ display: "flex", justifyContent: "flex-start", width: 500 }}>
147   - 阶梯指标名称:
  146 + <div style={{ display: "flex", justifyContent: "flex-start", width: 300 }}>
  147 + X=
148 148 <Input value={paramAlias} onChange={(e) => setParamAlias(e.target.value)} />
149 149 </div>
150 150 }
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/LadderTable.tsx 100644 → 100755
1 1 import React, { useState, useEffect } from "react";
2   -import {
3   - Table,
4   - Input,
5   - InputNumber,
6   - Popconfirm,
7   - Form,
8   - Typography,
9   - Button,
10   - message,
11   - Space,
12   - Divider,
13   - Modal,
14   -} from "antd";
  2 +import { Table, Input, InputNumber, Popconfirm, Form, Typography, Button, message, Space, Divider, Modal } from "antd";
15 3 import { cloneDeep } from "lodash";
16 4  
17 5 interface Item {
... ... @@ -28,7 +16,8 @@ interface Props {
28 16 visible?: boolean;
29 17 type?: number; //2 查看得分阶梯
30 18 setladderVisible?: Function;
31   - isPercent: number;
  19 + isPercent?: number;
  20 + laddersType?: number;
32 21 }
33 22  
34 23 interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
... ... @@ -51,7 +40,8 @@ const EditableCell: React.FC&lt;EditableCellProps&gt; = ({
51 40 children,
52 41 ...restProps
53 42 }) => {
54   - const inputNode = inputType === "number" ? <InputNumber precision={dataIndex === "upper" ? 2 : 0} min={0} /> : <Input />;
  43 + const inputNode =
  44 + inputType === "number" ? <InputNumber precision={dataIndex === "upper" ? 2 : 0} min={0} /> : <Input />;
55 45  
56 46 return (
57 47 <td {...restProps}>
... ... @@ -81,7 +71,7 @@ const EditableCell: React.FC&lt;EditableCellProps&gt; = ({
81 71 );
82 72 };
83 73  
84   -const LadderTable = ({ value, onChange, readOnly, visible, type, setladderVisible, isPercent }: Props) => {
  74 +const LadderTable = ({ value, onChange, readOnly, visible, type, setladderVisible, isPercent, laddersType }: Props) => {
85 75 const EditableCell: React.FC<EditableCellProps> = ({
86 76 editing,
87 77 dataIndex,
... ... @@ -235,14 +225,38 @@ const LadderTable = ({ value, onChange, readOnly, visible, type, setladderVisibl
235 225 title: "区间下限(≥)",
236 226 dataIndex: "lower",
237 227 width: "20%",
238   - render: (value: number) => value + (isPercent == 2 ? "%" : ""),
  228 + render: (value: number) => {
  229 + if (isPercent == 2) {
  230 + return value + "%";
  231 + } else if (isPercent == 1) {
  232 + return value;
  233 + } else if (isPercent == 0 && laddersType == 2) {
  234 + return value + "%";
  235 + } else {
  236 + return value;
  237 + }
  238 + },
239 239 },
240 240 {
241 241 title: "区间上限(<)",
242 242 dataIndex: "upper",
243 243 width: "20%",
244 244 editable: true,
245   - render: (value: number) => (value ? value + (isPercent == 2 ? "%" : "") : ""),
  245 + render: (value: number) => {
  246 + if (value) {
  247 + if (isPercent == 2) {
  248 + return value + "%";
  249 + } else if (isPercent == 1) {
  250 + return value;
  251 + } else if (isPercent == 0 && laddersType == 2) {
  252 + return value + "%";
  253 + } else {
  254 + return value;
  255 + }
  256 + } else {
  257 + return "";
  258 + }
  259 + },
246 260 },
247 261 {
248 262 title: "标准分",
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/components/PersonRatingList.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/EditComfirm/components/StarRatingList.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/EditComfirm/components/TargetModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/EditComfirm/index.tsx 100644 → 100755
... ... @@ -27,16 +27,30 @@ const { Option } = Select;
27 27  
28 28 interface Props extends common.ConnectProps {}
29 29 function Index(props: Props) {
30   - const { postList, detailError, configId, setId, data, readOnly, setReadOnly, setSelectedIndicators, paramAlias, setParamAlias } = useStore();
  30 + const {
  31 + postList,
  32 + detailError,
  33 + configId,
  34 + setId,
  35 + data,
  36 + readOnly,
  37 + setReadOnly,
  38 + setSelectedIndicators,
  39 + paramAlias,
  40 + setParamAlias,
  41 + setSubmit,
  42 + } = useStore();
31 43  
32 44 const [form] = Form.useForm();
33 45 const { match } = props;
34   -
35   - const { id, read } = match.params;
36   -
  46 + console.log(match);
  47 + const { id, read, type } = match.params;
37 48 useEffect(() => {
38 49 setReadOnly(read === undefined ? false : read !== "false");
39 50 }, [read]);
  51 + useEffect(() => {
  52 + setSubmit(type);
  53 + }, [type]);
40 54 // 选择岗位id
41 55 const [postId, setPostId] = useState<number>();
42 56 const [saveLoading, setSaveLoading] = useState<boolean>(false);
... ... @@ -63,7 +77,7 @@ function Index(props: Props) {
63 77 form.setFieldsValue({
64 78 ...res,
65 79 });
66   - console.log('res', data);
  80 + console.log("res", data);
67 81 // setSelectedIndicators((res.indicators || []).map((item) => item.indicatorId));
68 82 // 回显
69 83 if (data.shopIds?.length > 0 && data.postId) {
... ... @@ -83,26 +97,35 @@ function Index(props: Props) {
83 97 getDealerList(data.postId);
84 98 }
85 99 }, [data.postId]);
  100 + console.log("shopList", shopList);
86 101  
87   - function handSubmit(fieldsValue: any) {
88   - console.log('fieldsValue', fieldsValue);
89   - const _shopIds: number[] = fieldsValue.shop.map((item:any) => item.value);
90   - const res = transformDTO(fieldsValue);
91   - const _shopNames = fieldsValue.shop.map((item: any) => item.label);
92   - const pa = { ...res, force: true, id: Number(configId), shopNames: _shopNames };
93   - console.log(pa);
94   - setSaveLoading(true);
95   - saveKpiGroupConfig(pa)
96   - .then((res) => {
97   - setSaveLoading(false);
98   - message.success("操作成功");
99   - setSaveLoading(false);
100   - history.goBack();
101   - })
102   - .catch((e) => {
103   - setSaveLoading(false);
104   - message.error(e.message);
105   - });
  102 + function handSubmit(submit: number) {
  103 + form.validateFields().then((values) => {
  104 + const _shopIds: number[] = values.shop.map((item: any) => item.value);
  105 + const res = transformDTO(values);
  106 + const _shopNames = values.shop.map((item: any) => item.label);
  107 + let pa = null;
  108 + if (type == 1) {
  109 + pa = { ...res, force: true, id: Number(configId), shopNames: _shopNames };
  110 + } else if (type == 2) {
  111 + pa = { ...res, force: true, draftId: Number(configId), shopNames: _shopNames };
  112 + } else {
  113 + pa = { ...res, force: true, shopNames: _shopNames };
  114 + }
  115 + console.log(pa);
  116 + setSaveLoading(true);
  117 + saveKpiGroupConfig(pa, submit)
  118 + .then((res) => {
  119 + setSaveLoading(false);
  120 + message.success("操作成功");
  121 + setSaveLoading(false);
  122 + history.goBack();
  123 + })
  124 + .catch((e) => {
  125 + setSaveLoading(false);
  126 + message.error(e.message);
  127 + });
  128 + });
106 129 }
107 130  
108 131 // 根据岗位查门店
... ... @@ -144,7 +167,7 @@ function Index(props: Props) {
144 167 initialValues={{
145 168 indicators: [],
146 169 }}
147   - onFinish={handSubmit}
  170 + // onFinish={() => handSubmit}
148 171 >
149 172 <Form.Item label="绩效组名称" name="name" rules={[{ required: true, message: "请输入绩效组名称" }]}>
150 173 <Input />
... ... @@ -243,6 +266,21 @@ function Index(props: Props) {
243 266 <Radio.Group
244 267 onChange={(e) => {
245 268 const way = e.target.value;
  269 + console.log("计算方式:", way);
  270 + // switch (way) {
  271 + // case 1:
  272 + // form.setFieldsValue({
  273 + // starLadders: [{ level: 4, lower: 0 }, { level: 3 }, { level: 2 }, { level: 1 }],
  274 + // });
  275 + // break;
  276 + // case 2:
  277 + // form.setFieldsValue({
  278 + // starLadders: [{ level: 1, lower: 0 }, { level: 2 }, { level: 3 }, { level: 4 }],
  279 + // });
  280 + // break;
  281 + // default:
  282 + // break;
  283 + // }
246 284 if (way !== data.starEvaluationType) {
247 285 switch (way) {
248 286 case 1:
... ... @@ -321,12 +359,29 @@ function Index(props: Props) {
321 359 返回
322 360 </Button>
323 361 {!readOnly && (
324   - <Popconfirm title="确定完成,提交后不可更改?" onConfirm={form.submit} okText="确定" cancelText="取消">
325   - <Button type="primary" size="large" style={{ width: 200 }} loading={saveLoading}>
  362 + <Popconfirm
  363 + title="确定完成,提交后不可更改?"
  364 + onConfirm={() => handSubmit(1)}
  365 + okText="确定"
  366 + cancelText="取消"
  367 + >
  368 + <Button type="primary" size="large" style={{ marginRight: 50, width: 200 }} loading={saveLoading}>
326 369 提交
327 370 </Button>
328 371 </Popconfirm>
329 372 )}
  373 + {!readOnly && (
  374 + <Popconfirm
  375 + title="确定完成,提交后不可更改?"
  376 + onConfirm={() => handSubmit(2)}
  377 + okText="确定"
  378 + cancelText="取消"
  379 + >
  380 + <Button type="primary" size="large" style={{ width: 200 }} loading={saveLoading}>
  381 + 保存草稿
  382 + </Button>
  383 + </Popconfirm>
  384 + )}
330 385 </Row>
331 386  
332 387 <PersonModal item={personModal} setPersonModal={setPersonModal} />
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/store.ts 100644 → 100755
... ... @@ -6,12 +6,11 @@ import { getAllPostListApi } from &quot;@/common/api&quot;;
6 6  
7 7 export default function useStore() {
8 8 const [configId, setId] = useState<number>(0);
  9 + const [submit, setSubmit] = useState<number>(1);
9 10 const { list: postList } = usePagination(getAllPostListApi, { pageSize: 999 }, {});
10 11 const [delay, setDelay] = useState(true);
11   - const { data, errMsg: detailError, setParams } = useInitail(api.queryDetailListApi, {}, {}, delay);
  12 + const { data, errMsg: detailError, setParams } = useInitail(submit == 1 ? api.queryDetailListApi : api.draftQueryDetailListApi, {}, {}, delay);
12 13 const [readOnly, setReadOnly] = useState(false);
13   - // 是否为百分比
14   - const [isPercent, setIsPercent] = useState<number>(2);
15 14  
16 15 // 保存已经配置过阶梯的指标的id
17 16 const [selectedIndicators, setSelectedIndicators] = useState<string[]>([]);
... ... @@ -39,10 +38,9 @@ export default function useStore() {
39 38 paramAlias,
40 39 setParamAlias,
41 40 selectedIndicatorsConds,
42   - setSelectedIndicatorsConds, //台阶得分指标库
  41 + setSelectedIndicatorsConds, //前置得分指标库
43 42 selectedIndicatorsLadder,
44   - setSelectedIndicatorsLadder, //前置条件指标库
45   - isPercent,
46   - setIsPercent
  43 + setSelectedIndicatorsLadder, //台阶条件指标库
  44 + setSubmit,
47 45 };
48 46 }
... ...
src/pages/performance/KpiGroupSetting/api.ts 100644 → 100755
... ... @@ -55,6 +55,13 @@ export function kpiGroupApi(params: KpiGroupSetteing.KpiGroupListParams): http.P
55 55 return request.get(`${MORAX_HOST}/erp/kpi/group-config/page`, {params});
56 56 }
57 57  
  58 +/** 绩效组列表(草稿)
  59 + * http://testgate.feewee.cn/morax/erp/setting-draft/kpi-page
  60 + */
  61 +export function kpiGroupDraftApi(params: KpiGroupSetteing.KpiGroupListParams): http.PromisePageResp<KpiGroupSetteing.KpiGroupListItems> {
  62 + return request.get(`${MORAX_HOST}/erp/setting-draft/kpi-page`, { params });
  63 +}
  64 +
58 65 /**
59 66 * 实时查询绩效组人员
60 67 * http://testgate.feewee.cn/morax/erp/kpi/real-time/staffs
... ... @@ -71,4 +78,26 @@ export function kpiGroupApi(params: KpiGroupSetteing.KpiGroupListParams): http.P
71 78 export function fetchGroupConfigStaffs(params: KpiGroupSetteing.GroupConfigParams): http.PromisePageResp<KpiGroupSetteing.RealTimePersonItems> {
72 79 return request.get(`${MORAX_HOST}/erp/kpi/group-config/staffs`, { params
73 80 });
  81 +}
  82 +/**
  83 + *删除草稿,审批不通过
  84 + * http://testgate.feewee.cn/morax/erp/setting-draft/del
  85 + */
  86 +export function deleteKpiGroup(params: KpiGroupSetteing.DeleteKpiGroup) {
  87 + return request.get(`${MORAX_HOST}/erp/setting-draft/del`, { params });
  88 +}
  89 +
  90 +/**
  91 + *禁用绩效组
  92 + * http://testgate.feewee.cn/morax/erp/kpi/group-config/disable
  93 + */
  94 +export function kpiGroupEnable(params: KpiGroupSetteing.DeleteKpiGroup) {
  95 + return request.get(`${MORAX_HOST}/erp/kpi/group-config/disable`, { params });
  96 +}
  97 +/**
  98 + *撤销审批
  99 + * http://testgate.feewee.cn/morax/erp/setting-draft/cancel
  100 + */
  101 +export function quashKpiGroup(params: KpiGroupSetteing.DeleteKpiGroup) {
  102 + return request.get(`${MORAX_HOST}/erp/setting-draft/cancel`, { params });
74 103 }
75 104 \ No newline at end of file
... ...
src/pages/performance/KpiGroupSetting/components/DetailModal.tsx 0 → 100755
  1 +import React, { useState, useEffect, useMemo } from "react";
  2 +import { Button, Modal } from "antd";
  3 +import ApprovalProgress from "@/components/ApprovalProgress";
  4 +
  5 +interface Props {
  6 + visible: boolean;
  7 + onCancel: Function;
  8 + item: any;
  9 +}
  10 +
  11 +export default function DetailModal(props: Props) {
  12 + const { visible, onCancel, item } = props;
  13 +
  14 + return (
  15 + <Modal
  16 + title={`${item.name ? item.name + "-" : ""}审批进度`}
  17 + open={visible}
  18 + maskClosable={false}
  19 + onCancel={() => onCancel()}
  20 + footer={<Button onClick={() => onCancel()}>取消</Button>}
  21 + destroyOnClose
  22 + >
  23 + <ApprovalProgress orderNo={item.approvalNo} />
  24 + </Modal>
  25 + );
  26 +}
... ...
src/pages/performance/KpiGroupSetting/components/DraftFilter.tsx 0 → 100755
  1 +import React, { useCallback } from "react";
  2 +import { Row, Select, Radio } from "antd";
  3 +import _ from "lodash";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { systemListApi } from "@/pages/admin/Privilege/api";
  6 +import { getAllPostListApi } from "@/common/api";
  7 +import { StatusDraftData } from "@/pages/performance/entity";
  8 +
  9 +const { Option } = Select;
  10 +interface Props {
  11 + setParams: any;
  12 + innerParams: any;
  13 +}
  14 +const RadioButton = Radio.Button;
  15 +const RadioGroup = Radio.Group;
  16 +
  17 +export default function Filter({ setParams, innerParams }: Props) {
  18 + const { list } = usePagination(getAllPostListApi, [], {});
  19 + console.log("innerParams", innerParams);
  20 +
  21 + const seachOnchange = useCallback(
  22 + _.debounce((param) => {
  23 + setParams({ ...param }, true);
  24 + }, 800),
  25 + [setParams]
  26 + );
  27 +
  28 + return (
  29 + <Row justify="start" style={{ marginBottom: 20 }}>
  30 + <Select
  31 + allowClear
  32 + placeholder="请选择岗位"
  33 + style={{ width: 250, marginRight: 10, marginBottom: 10 }}
  34 + onChange={(value) => {
  35 + setParams({ postId: value }, true);
  36 + }}
  37 + showSearch
  38 + optionFilterProp="children"
  39 + >
  40 + {list.map((item) => (
  41 + <Option value={item.id} key={item.id}>
  42 + {item.postName}
  43 + </Option>
  44 + ))}
  45 + </Select>
  46 + <RadioGroup
  47 + defaultValue={2}
  48 + buttonStyle="solid"
  49 + size="middle"
  50 + onChange={(e) => {
  51 + console.log("选中状态", e);
  52 + setParams({ status: e.target.value }, true);
  53 + }}
  54 + >
  55 + {StatusDraftData.map((item) => (
  56 + <RadioButton value={item.value}>
  57 + {item.label}
  58 + </RadioButton>
  59 + ))}
  60 + </RadioGroup>
  61 + </Row>
  62 + );
  63 +}
... ...
src/pages/performance/KpiGroupSetting/components/DraftList.tsx 0 → 100755
  1 +import React, { useState } from "react";
  2 +import { PageHeaderWrapper } from "@ant-design/pro-layout";
  3 +import { Button, Card, Table, Row, Space, Typography, Divider, Popconfirm, message } from "antd";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { history } from "umi";
  6 +import { kpiGroupDraftApi, deleteKpiGroup, quashKpiGroup } from "../api";
  7 +import DraftFilter from "./DraftFilter";
  8 +import DetailModal from "./DetailModal";
  9 +import { DraftStatusEnum } from "../entity";
  10 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
  11 +import EmployeesModal from "./EmployeesModal";
  12 +import ShopModal from "./ShopModal";
  13 +import moment from "moment";
  14 +
  15 +const Column = Table.Column;
  16 +interface Props {
  17 + type: number;
  18 +}
  19 +
  20 +export default ({ type }: Props) => {
  21 + const { loading, list, paginationConfig, setParams, innerParams } = usePagination(kpiGroupDraftApi, {
  22 + status: 2,
  23 + type: 2,
  24 + });
  25 + const [visibleDetail, setVisibleDetail] = useState(false);
  26 + const [item, setItem] = useState<any>({});
  27 + // 查看适用员工
  28 + const [employeeModal, setEmployeeModal] = useState<{
  29 + visible: boolean;
  30 + record?: KpiGroupSetteing.KpiGroupListItems;
  31 + }>({
  32 + visible: false,
  33 + record: {},
  34 + });
  35 + const [shopModal, setShopModal] = useState<{
  36 + visible: boolean;
  37 + record?: KpiGroupSetteing.KpiGroupListItems;
  38 + }>({
  39 + visible: false,
  40 + record: {},
  41 + });
  42 +
  43 + const _onCancel = () => {
  44 + setEmployeeModal({ visible: false });
  45 + };
  46 + const shopOnCancel = () => {
  47 + setShopModal({ visible: false });
  48 + };
  49 + //删除
  50 + const onDelet = async (id: number) => {
  51 + const pa = { id };
  52 + try {
  53 + const { success } = await deleteKpiGroup(pa);
  54 + if (success) {
  55 + message.success("删除成功", 5);
  56 + // 重新刷新列表
  57 + setParams({ ...innerParams }, true);
  58 + }
  59 + } catch (error: any) {
  60 + message.error(error.message);
  61 + }
  62 + };
  63 +
  64 + //撤销审批
  65 + const onQuash = async (id: number) => {
  66 + const pa = { id };
  67 + try {
  68 + const { success } = await quashKpiGroup(pa);
  69 + if (success) {
  70 + message.success("撤销审批成功", 5);
  71 + // 重新刷新列表
  72 + setParams({ ...innerParams }, true);
  73 + }
  74 + } catch (error: any) {
  75 + message.error(error.message);
  76 + }
  77 + };
  78 +
  79 + return (
  80 + <>
  81 + <Row justify="space-between" style={{ marginBottom: 10 }}>
  82 + <DraftFilter setParams={setParams} innerParams={innerParams} />
  83 +
  84 + <Button
  85 + type="primary"
  86 + onClick={() => {
  87 + history.push(`/morax/kpiGroupSetting/edit`);
  88 + }}
  89 + >
  90 + 新增
  91 + </Button>
  92 + </Row>
  93 + <Table
  94 + loading={loading}
  95 + rowKey={(row) => `id${row.id}`}
  96 + dataSource={list}
  97 + pagination={paginationConfig}
  98 + scroll={{ x: 500 }}
  99 + >
  100 + <Column width={150} title="绩效组名称" dataIndex="name" align="center" render={(name) => name || "--"} />
  101 + <Column title="岗位" dataIndex="postName" align="center" width={100} />
  102 + <Column
  103 + width={150}
  104 + title="绩效指标(项)"
  105 + dataIndex="indicatorNum"
  106 + align="center"
  107 + render={(name) => <span>{name || "--"}</span>}
  108 + />
  109 + <Column
  110 + title="适用门店"
  111 + width={120}
  112 + dataIndex="shopNames"
  113 + align="center"
  114 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
  115 + <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
  116 + 查看
  117 + </Button>
  118 + )}
  119 + />
  120 + <Column
  121 + title="适用员工"
  122 + width={120}
  123 + align="center"
  124 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
  125 + <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
  126 + 查看
  127 + </Button>
  128 + )}
  129 + />
  130 + <Column
  131 + title="状态"
  132 + width={100}
  133 + align="center"
  134 + dataIndex="status"
  135 + render={(text: number) => (text ? DraftStatusEnum[text] : "--")}
  136 + />
  137 + <Column
  138 + title="生效时间"
  139 + width={120}
  140 + align="center"
  141 + dataIndex="beginTime"
  142 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  143 + />
  144 + <Column
  145 + title="失效时间"
  146 + width={120}
  147 + align="center"
  148 + dataIndex="overTime"
  149 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  150 + />
  151 + <Column
  152 + title="操作"
  153 + width={180}
  154 + align="center"
  155 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => {
  156 + console.log(record);
  157 + return (
  158 + <Space split={<Divider type="vertical" />}>
  159 + {record.draftStatus == 2 || record.draftStatus == 3 ? (
  160 + <Typography.Link
  161 + onClick={() => {
  162 + setVisibleDetail(true);
  163 + setItem(record);
  164 + }}
  165 + >
  166 + 流程进度
  167 + </Typography.Link>
  168 + ) : null}
  169 + {record.draftStatus == 2 ? (
  170 + <Typography.Link
  171 + onClick={() => {
  172 + history.push(`/morax/kpiGroupSetting/edit/${record.draftId}/true/${type}`);
  173 + }}
  174 + >
  175 + 查看
  176 + </Typography.Link>
  177 + ) : null}
  178 + {record.draftStatus == 3 || record.draftStatus == 1 || record.draftStatus == 5 ? (
  179 + <Typography.Link
  180 + onClick={() => {
  181 + history.push(`/morax/kpiGroupSetting/edit/${record.draftId}/false/${type}`);
  182 + }}
  183 + >
  184 + {`${record.draftStatus == 3 ? "重新" : ""}编辑`}
  185 + </Typography.Link>
  186 + ) : null}
  187 +
  188 + {record.draftStatus == 3 || record.draftStatus == 1 || record.draftStatus == 5 ? (
  189 + <Popconfirm
  190 + title="确定删除,提交后不可更改?"
  191 + onConfirm={() => onDelet(record.draftId)}
  192 + okText="确定"
  193 + cancelText="取消"
  194 + >
  195 + <Typography.Link>删除</Typography.Link>
  196 + </Popconfirm>
  197 + ) : null}
  198 + {record.draftStatus == 2 ? (
  199 + <Popconfirm
  200 + title="确定撤销审批,提交后不可更改?"
  201 + onConfirm={() => onQuash(record.draftId)}
  202 + okText="确定"
  203 + cancelText="取消"
  204 + >
  205 + <Typography.Link>撤销审批</Typography.Link>
  206 + </Popconfirm>
  207 + ) : null}
  208 + </Space>
  209 + );
  210 + }}
  211 + />
  212 + </Table>
  213 + <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
  214 + <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  215 + <DetailModal visible={visibleDetail} item={item} onCancel={() => setVisibleDetail(false)} />
  216 + </>
  217 + );
  218 +};
... ...
src/pages/performance/KpiGroupSetting/components/EditModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/components/EditTagList.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/components/EmployeesModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/components/Filter.tsx 100644 → 100755
1 1 import React, { useCallback } from "react";
2   -import { Row, Select } from "antd";
  2 +import { Row, Select, Radio } from "antd";
3 3 import _ from "lodash";
4 4 import usePagination from "@/hooks/usePagination";
5 5 import { systemListApi } from "@/pages/admin/Privilege/api";
... ... @@ -11,6 +11,8 @@ interface Props {
11 11 setParams: any;
12 12 innerParams: any;
13 13 }
  14 +const RadioButton = Radio.Button;
  15 +const RadioGroup = Radio.Group;
14 16  
15 17 export default function Filter({ setParams, innerParams }: Props) {
16 18 const { list } = usePagination(getAllPostListApi, [], {});
... ... @@ -41,22 +43,21 @@ export default function Filter({ setParams, innerParams }: Props) {
41 43 </Option>
42 44 ))}
43 45 </Select>
44   - <Select
45   - allowClear
46   - placeholder="请选择状态"
47   - style={{ width: 250, marginRight: 10, marginBottom: 10 }}
48   - value={innerParams.status}
49   - onChange={(value) => {
50   - console.log("选中状态", value);
51   - setParams({ status: value }, true);
  46 + <RadioGroup
  47 + defaultValue={3}
  48 + buttonStyle="solid"
  49 + size="middle"
  50 + onChange={(e) => {
  51 + console.log("选中状态", e);
  52 + setParams({ status: e.target.value }, true);
52 53 }}
53 54 >
54 55 {StatusData.map((item) => (
55   - <Option value={item.value} key={item.value}>
  56 + <RadioButton value={item.value}>
56 57 {item.label}
57   - </Option>
  58 + </RadioButton>
58 59 ))}
59   - </Select>
  60 + </RadioGroup>
60 61 </Row>
61 62 );
62 63 }
... ...
src/pages/performance/KpiGroupSetting/components/NormalList.tsx 0 → 100755
  1 +import React, { useState } from "react";
  2 +import { PageHeaderWrapper } from "@ant-design/pro-layout";
  3 +import { Button, Card, Table, Row, Space, Typography, Divider, Popconfirm, message } from "antd";
  4 +import usePagination from "@/hooks/usePagination";
  5 +import { history } from "umi";
  6 +import { kpiGroupApi, kpiGroupEnable } from "../api";
  7 +import Filter from "./Filter";
  8 +import DetailModal from "./DetailModal";
  9 +import { StatusEnum } from "../entity";
  10 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
  11 +import EmployeesModal from "./EmployeesModal";
  12 +import ShopModal from "./ShopModal";
  13 +import moment from "moment";
  14 +
  15 +const Column = Table.Column;
  16 +interface Props {
  17 + type: number;
  18 +}
  19 +export default ({ type }: Props) => {
  20 + const { loading, list, paginationConfig, setParams, innerParams } = usePagination(kpiGroupApi, { status: 3 });
  21 + const [visibleDetail, setVisibleDetail] = useState(false);
  22 + const [item, setItem] = useState<any>({});
  23 + // 查看适用员工
  24 + const [employeeModal, setEmployeeModal] = useState<{
  25 + visible: boolean;
  26 + record?: KpiGroupSetteing.KpiGroupListItems;
  27 + }>({
  28 + visible: false,
  29 + record: {},
  30 + });
  31 + const [shopModal, setShopModal] = useState<{
  32 + visible: boolean;
  33 + record?: KpiGroupSetteing.KpiGroupListItems;
  34 + }>({
  35 + visible: false,
  36 + record: {},
  37 + });
  38 +
  39 + const _onCancel = () => {
  40 + setEmployeeModal({ visible: false });
  41 + };
  42 + const shopOnCancel = () => {
  43 + setShopModal({ visible: false });
  44 + };
  45 +
  46 + // 禁用
  47 + const indicatorEnable = async (id: number) => {
  48 + const pa ={id};
  49 + try {
  50 + const { success } = await kpiGroupEnable(pa);
  51 + if (success) {
  52 + message.success('禁用成功', 5);
  53 + // 重新刷新列表
  54 + setParams({ ...innerParams }, true);
  55 + }
  56 + } catch (error: any) {
  57 + message.error(error.message);
  58 + }
  59 + };
  60 + return (
  61 + <>
  62 + <Row justify="space-between" style={{ marginBottom: 10 }}>
  63 + <Filter setParams={setParams} innerParams={innerParams} />
  64 +
  65 + <Button
  66 + type="primary"
  67 + onClick={() => {
  68 + history.push(`/morax/kpiGroupSetting/edit`);
  69 + }}
  70 + >
  71 + 新增
  72 + </Button>
  73 + </Row>
  74 + <Table
  75 + loading={loading}
  76 + rowKey={(row) => `id${row.id}`}
  77 + dataSource={list}
  78 + pagination={paginationConfig}
  79 + scroll={{ x: 500 }}
  80 + >
  81 + <Column width={150} title="绩效组名称" dataIndex="name" align="center" render={(name) => name || "--"} />
  82 + <Column title="岗位" dataIndex="postName" align="center" width={100} />
  83 + <Column
  84 + width={150}
  85 + title="绩效指标(项)"
  86 + dataIndex="indicatorNum"
  87 + align="center"
  88 + render={(name) => <span>{name || "--"}</span>}
  89 + />
  90 + <Column
  91 + title="适用门店"
  92 + width={120}
  93 + dataIndex="shopNames"
  94 + align="center"
  95 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
  96 + <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
  97 + 查看
  98 + </Button>
  99 + )}
  100 + />
  101 + <Column
  102 + title="适用员工"
  103 + width={120}
  104 + align="center"
  105 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
  106 + <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
  107 + 查看
  108 + </Button>
  109 + )}
  110 + />
  111 + <Column
  112 + title="状态"
  113 + width={100}
  114 + align="center"
  115 + dataIndex="status"
  116 + render={(text: number) => (text ? StatusEnum[text] : "--")}
  117 + />
  118 + <Column
  119 + title="生效时间"
  120 + width={120}
  121 + align="center"
  122 + dataIndex="beginTime"
  123 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  124 + />
  125 + <Column
  126 + title="失效时间"
  127 + width={120}
  128 + align="center"
  129 + dataIndex="overTime"
  130 + render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
  131 + />
  132 + <Column
  133 + title="操作"
  134 + width={180}
  135 + align="center"
  136 + render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => {
  137 + return (
  138 + <Space split={<Divider type="vertical" />}>
  139 + {/* {record.status === 3 ? null : (
  140 + <Typography.Link
  141 + onClick={() => {
  142 + setVisibleDetail(true);
  143 + setItem(record);
  144 + }}
  145 + >
  146 + 流程进度
  147 + </Typography.Link>
  148 + )} */}
  149 + {record.status === 4 ? (
  150 + <Typography.Link
  151 + onClick={() => {
  152 + history.push(`/morax/kpiGroupSetting/edit/${record.id}/true/${type}`); // 通过传过来的type以斜杠形式放在url中,再来判断调用哪的详情
  153 + }}
  154 + >
  155 + 查看
  156 + </Typography.Link>
  157 + ) : null}
  158 + {record.status === 2 || record.status === 3 ? (
  159 + <Typography.Link
  160 + onClick={() => {
  161 + history.push(`/morax/kpiGroupSetting/edit/${record.id}/false/${type}`);
  162 + }}
  163 + >
  164 + 编辑
  165 + </Typography.Link>
  166 + ): null}
  167 + {record.status == 2 || record.status == 3 ? (
  168 + <Popconfirm
  169 + title="确定禁用,提交后不可更改?"
  170 + onConfirm={() => indicatorEnable(record.id)}
  171 + okText="确定"
  172 + cancelText="取消"
  173 + >
  174 + <Typography.Link>禁用</Typography.Link>
  175 + </Popconfirm>
  176 + ): null}
  177 + {/* {record.status !== 1 ? null : (
  178 + <Typography.Link
  179 + onClick={() => {
  180 + console.log("撤销审批");
  181 + }}
  182 + >
  183 + 撤销审批
  184 + </Typography.Link>
  185 + )} */}
  186 + </Space>
  187 + );
  188 + }}
  189 + />
  190 + </Table>
  191 + <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
  192 + <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  193 + <DetailModal visible={visibleDetail} item={item} onCancel={() => setVisibleDetail(false)} />
  194 + </>
  195 + );
  196 +};
... ...
src/pages/performance/KpiGroupSetting/components/PersonModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/components/ShopModal.tsx 100644 → 100755
src/pages/performance/KpiGroupSetting/components/detailModal.less 0 → 100755
  1 +.container {
  2 + flex: 1;
  3 +}
  4 +.itemContainer {
  5 + display: flex;
  6 + flex-direction: row;
  7 + padding: 10px;
  8 +}
  9 +.line {
  10 + height: 100%;
  11 + background-color: #2150D1;
  12 + width: 1.5px;
  13 + margin-left: 2px;
  14 +}
  15 +.leftView {
  16 + justify-content: center;
  17 +}
  18 +.textView {
  19 + margin-left: 10px;
  20 + margin-top: 7px;
  21 +}
  22 +.title {
  23 + font-size: 14px;
  24 + color: #262626;
  25 +}
  26 +.text {
  27 + font-size: 12px;
  28 + color: #666666;
  29 + margin-top: 6px;
  30 +}
... ...
src/pages/performance/KpiGroupSetting/entity.ts 100644 → 100755
1   -import { KpiGroupSetteing } from '@/pages/performance/KpiGroupSetting/interface';
  1 +import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
2 2 import _ from "lodash";
3 3  
4 4 // roleType 适用角色类型; 1: 全部角色 2:全部管理角色 3: 自定义(See: 适用角色类型枚举)
5 5 export const RoleType = [
6 6 {
7   - label: "全部角色", value: 1
  7 + label: "全部角色",
  8 + value: 1,
8 9 },
9 10 {
10   - label: "全部管理角色", value: 2
  11 + label: "全部管理角色",
  12 + value: 2,
11 13 },
12 14 {
13   - label: "自定义", value: 3
  15 + label: "自定义",
  16 + value: 3,
14 17 },
15 18 ];
16 19  
... ... @@ -25,17 +28,29 @@ export enum Role_Type_Enum {
25 28 */
26 29  
27 30 export enum StatusEnum {
28   - "审批中" = 1,
29   - "待生效",
30   - "生效中",
31   - "已失效",
  31 + "待审批" = 1,
  32 + "待生效" = 2,
  33 + "生效中" = 3,
  34 + "已失效" = 4,
  35 +}
  36 +export enum DraftStatusEnum {
  37 + "未发布" = 1,
  38 + "审批中" = 2,
  39 + "审批不通过" = 3,
  40 + "审批同意" = 4,
  41 + "撤销审批" = 5,
32 42 }
33 43  
34   -export const Approval_Status = [{
35   - label: "启用", value: 1
36   -}, {
37   - label: "禁用", value: 2
38   -}];
  44 +export const Approval_Status = [
  45 + {
  46 + label: "启用",
  47 + value: 1,
  48 + },
  49 + {
  50 + label: "禁用",
  51 + value: 2,
  52 + },
  53 +];
39 54  
40 55 export interface RoleList {
41 56 children: string;
... ... @@ -44,11 +59,11 @@ export interface RoleList {
44 59 value: string;
45 60 }
46 61 interface formData {
47   - post?: { value: number, label: string };
  62 + post?: { value: number; label: string };
48 63 shop?: { value: number }[];
49 64 indicators?: any[];
50   - starLadders?: any[]
51   - [key: string]: any
  65 + starLadders?: any[];
  66 + [key: string]: any;
52 67 }
53 68 /**
54 69 * 将form表单数据转换成接口需要的数据
... ... @@ -131,38 +146,38 @@ const salaryMaxValue = (_starLadders: any[], type: number) =&gt; {
131 146  
132 147 /**
133 148 * 将接口数据转换成表单数据
134   - * @param detail
135   - * @returns
  149 + * @param detail
  150 + * @returns
136 151 */
137 152 export function transformFormData(detail: KpiGroupSetteing.KpiGroupDetail): formData {
138 153 let formData: formData = {};
139 154 _.each(detail, (value: any, key: string) => {
140 155 switch (key) {
141   - case 'postId':
  156 + case "postId":
142 157 formData.post = { value, label: detail.postName };
143 158 break;
144   - case 'shopIds':
  159 + case "shopIds":
145 160 const _shopIdsOptions: number[] = value || [];
146 161 if (_shopIdsOptions.length) {
147 162 const _ShopIds = _shopIdsOptions.map((item, index) => ({ value: item, label: detail.shopNames[index] }));
148 163 formData.shop = _ShopIds;
149 164 }
150 165 break;
151   - case 'indicators':
  166 + case "indicators":
152 167 const res = maxValueTransform(value);
153 168 formData.indicators = res;
154 169 break;
155   - case 'starLadders':
  170 + case "starLadders":
156 171 formData.starLadders = value;
157 172 break;
158   - case 'attachment':
  173 + case "attachment":
159 174 const _res = value.map((item: string, index: number) => ({
160 175 uid: `${index}`,
161 176 name: "",
162   - status: 'done',
163   - url: '/api/file/show?fid=' + item,
  177 + status: "done",
  178 + url: "/api/file/show?fid=" + item,
164 179 thumbUrl: `/api/file/show?fid=${item}`,
165   - response: { data: item, status: 'success', fid: `${item}` }
  180 + response: { data: item, status: "success", fid: `${item}` },
166 181 }));
167 182 formData.kpiAttachList = _res;
168 183 break;
... ...
src/pages/performance/KpiGroupSetting/index.css 100644 → 100755
src/pages/performance/KpiGroupSetting/index.tsx 100644 → 100755
1 1 import React, { useState } from "react";
2 2 import { PageHeaderWrapper } from "@ant-design/pro-layout";
3   -import { Button, Card, Table, Row, Space, Typography, Divider } from "antd";
4   -import usePagination from "@/hooks/usePagination";
5   -import { history } from "umi";
6   -import { kpiGroupApi } from "./api";
7   -import Filter from "./components/Filter";
8   -import { StatusEnum } from "./entity";
9   -import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface";
10   -import EmployeesModal from "./components/EmployeesModal";
11   -import ShopModal from "./components/ShopModal";
12   -import moment from "moment";
13   -
14   -const Column = Table.Column;
  3 +import { Card, Radio, Divider } from "antd";
  4 +import NormalList from './components/NormalList';
  5 +import DraftList from "./components/DraftList";
15 6  
16 7 export default () => {
17   - const { loading, list, paginationConfig, setParams, innerParams } = usePagination(kpiGroupApi, { status: 3 });
18   - // 查看适用员工
19   - const [employeeModal, setEmployeeModal] = useState<{
20   - visible: boolean;
21   - record?: KpiGroupSetteing.KpiGroupListItems;
22   - }>({
23   - visible: false,
24   - record: {},
25   - });
26   - const [shopModal, setShopModal] = useState<{
27   - visible: boolean;
28   - record?: KpiGroupSetteing.KpiGroupListItems;
29   - }>({
30   - visible: false,
31   - record: {},
32   - });
33   -
34   - const _onCancel = () => {
35   - setEmployeeModal({ visible: false });
36   - };
37   - const shopOnCancel = () => {
38   - setShopModal({ visible: false });
39   - };
40   -
  8 + const [type, setType] = useState<number>(1);
41 9 return (
42 10 <PageHeaderWrapper title="绩效组配置">
43 11 <Card>
44   - <Row justify="space-between" style={{ marginBottom: 10 }}>
45   - <Filter setParams={setParams} innerParams={innerParams} />
46   -
47   - <Button
48   - type="primary"
49   - onClick={() => {
50   - history.push(`/morax/kpiGroupSetting/edit`);
51   - }}
52   - >
53   - 新增
54   - </Button>
55   - </Row>
56   - <Table
57   - loading={loading}
58   - rowKey={(row) => `id${row.id}`}
59   - dataSource={list}
60   - pagination={paginationConfig}
61   - scroll={{ x: 500 }}
62   - >
63   - <Column width={150} title="绩效组名称" dataIndex="name" align="center" render={(name) => name || "--"} />
64   - <Column title="岗位" dataIndex="postName" align="center" width={100} />
65   - <Column
66   - width={150}
67   - title="绩效指标(项)"
68   - dataIndex="indicatorNum"
69   - align="center"
70   - render={(name) => <span>{name || "--"}</span>}
71   - />
72   - <Column
73   - title="适用门店"
74   - width={120}
75   - dataIndex="shopNames"
76   - align="center"
77   - // render={(shops: string[]) => (shops.length > 0 ? shops.join(",") : "--")}
78   - render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
79   - <Button type="link" onClick={() => setShopModal({ visible: true, record })}>
80   - 查看
81   - </Button>
82   - )}
83   - />
84   - <Column
85   - title="适用员工"
86   - width={120}
87   - align="center"
88   - render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
89   - <Button type="link" onClick={() => setEmployeeModal({ visible: true, record })}>
90   - 查看
91   - </Button>
92   - )}
93   - />
94   - <Column
95   - title="状态"
96   - width={100}
97   - align="center"
98   - dataIndex="status"
99   - render={(text: number) => (text ? StatusEnum[text] : "--")}
100   - />
101   - <Column
102   - title="生效时间"
103   - width={120}
104   - align="center"
105   - dataIndex="beginTime"
106   - render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
107   - />
108   - <Column
109   - title="失效时间"
110   - width={120}
111   - align="center"
112   - dataIndex="overTime"
113   - render={(time: number) => (time ? moment(time).format("YYYY-MM-DD") : "--")}
114   - />
115   - <Column
116   - title="操作"
117   - width={180}
118   - align="center"
119   - render={(_: any, record: KpiGroupSetteing.KpiGroupListItems) => (
120   - <Space split={<Divider type="vertical" />}>
121   - <Typography.Link
122   - onClick={() => {
123   - history.push(`/morax/kpiGroupSetting/edit/${record.id}/true`);
124   - }}
125   - >
126   - 查看
127   - </Typography.Link>
128   - {record.status === 1 ? null : (
129   - <Typography.Link
130   - onClick={() => {
131   - history.push(`/morax/kpiGroupSetting/edit/${record.id}/false`);
132   - }}
133   - >
134   - 编辑
135   - </Typography.Link>
136   - )}
137   - </Space>
138   - )}
139   - />
140   - </Table>
141   - <EmployeesModal employeeModal={employeeModal} onCancel={_onCancel} />
142   - <ShopModal shopModal={shopModal} onCancel={shopOnCancel} />
  12 + <Radio.Group defaultValue={type} buttonStyle="solid" size="large" onChange={(e) => setType(e.target.value)}>
  13 + <Radio.Button value={1}>绩效组</Radio.Button>
  14 + <Radio.Button value={2}>草稿</Radio.Button>
  15 + </Radio.Group>
  16 + <Divider />
  17 + {type == 1 ? <NormalList type={type} /> : <DraftList type={type} />}
143 18 </Card>
144 19 </PageHeaderWrapper>
145 20 );
... ...