Commit 913c42294d994df98d52ac2861270122c0bce8fd

Authored by 张志伟
2 parents 8b11baa5 c0188e80

Merge branch 'bug_fix' into 'master'

Bug fix



See merge request !190
config/routers/performance.ts
... ... @@ -91,7 +91,7 @@ export default [
91 91 },
92 92 /** 考评数据导入==> 查看数据清单 */
93 93 {
94   - path: "/morax/evaDataImport/edit/:id?",
  94 + path: "/morax/evaDataImport/edit/:id?/:num?",
95 95 component: "./performance/EvaDataImport/EditComfirm/index",
96 96 },
97 97  
... ...
src/pages/performance/EvaDataImport/EditComfirm/index.tsx
... ... @@ -25,7 +25,7 @@ function Index(props: Props) {
25 25 const [delay, setDelay] = useState(true);
26 26 const [newData, setNewData] = useState<any>([]);
27 27 const { match } = props;
28   - const { id } = match.params;
  28 + const { id, num } = match.params;
29 29 useEffect(() => {
30 30 setId(id);
31 31 }, [id]);
... ... @@ -35,6 +35,7 @@ function Index(props: Props) {
35 35 setDelay(false);
36 36 }
37 37 }, [configId]);
  38 + console.log('num', num);
38 39 const { data, errMsg, setParams, loading } = useInitail(evaDataDetailApi, {}, {}, delay);
39 40 console.log(isArray(data));
40 41 useEffect(() => {
... ... @@ -46,7 +47,7 @@ function Index(props: Props) {
46 47 return (
47 48 <PageHeaderWrapper title="考评数据导入">
48 49 <Card>
49   - <Table loading={loading} rowKey={(row) => `id${id}`} dataSource={newData}>
  50 + <Table loading={loading} rowKey={(row) => `id${id}`} dataSource={newData} pagination={{ total: num }}>
50 51 <Column title="归属人员" dataIndex="userName" align="center" render={(name) => <span>{name || "--"}</span>} />
51 52 <Column title="归属门店" dataIndex="shopName" align="center" render={(name) => <span>{name || "--"}</span>} />
52 53 <Column
... ... @@ -80,7 +81,9 @@ function Index(props: Props) {
80 81 title="是否导入"
81 82 dataIndex="errorType"
82 83 align="center"
83   - render={(_: any, record: any) => (record.errorType ? <div className={st.no}>未导入</div> : <div className={st.yes}>已导入</div>)}
  84 + render={(_: any, record: any) =>
  85 + record.errorType ? <div className={st.no}>未导入</div> : <div className={st.yes}>已导入</div>
  86 + }
84 87 />
85 88 <Column
86 89 title="未导入原因"
... ...
src/pages/performance/EvaDataImport/api.ts
... ... @@ -44,3 +44,11 @@ export function evaDataDetailApi(params: { id: number }): http.PromisePageResp&lt;a
44 44 export function evaDataIndApi(): http.PromiseResp<any> {
45 45 return request.get(`${MORAX_HOST}/erp/eval-indicator/indicators`, {});
46 46 }
  47 +
  48 +/**
  49 + * 保存上传人员数据
  50 + * http://testgate.feewee.cn/morax/erp/eval-indicator/save-import
  51 + */
  52 +export function saveEvaImportData(params: { key: string }) {
  53 + return request.get(`${MORAX_HOST}/erp/eval-indicator/save-import`, { params });
  54 +}
... ...
src/pages/performance/EvaDataImport/components/FileDatailsModal.tsx
... ... @@ -19,6 +19,7 @@ import { TargetType, TargetTypeEnum } from &quot;@/pages/performance/entity&quot;;
19 19 import { render } from "react-dom";
20 20 import moment from "moment";
21 21 import { ReasonsEnum } from "../entity";
  22 +import { saveEvaImportData } from "../api";
22 23 import { history } from "umi";
23 24 import st from "./style.less";
24 25  
... ... @@ -28,28 +29,40 @@ interface Props {
28 29 visible: boolean;
29 30 fileData: any;
30 31 tarOnCancel: Function;
  32 + setParams: Function;
  33 + innerParams: any;
31 34 }
32   -const columns = [
33   - {
34   - title: "目标名称",
35   - dataIndex: "indicatorName",
36   - key: "indicatorName",
37   - },
38   -
39   - {
40   - title: "目标值",
41   - dataIndex: "targetValue",
42   - key: "targetValue",
43   - render: (value: Number, record: any) => {
44   - return record.targetType === 2 ? `${value}%` : record.targetType === 3 ? `${value}元` : `${value}台`;
45   - },
46   - },
47   -];
48   -const TargetModal = ({ visible, fileData, tarOnCancel }: Props) => {
  35 +const TargetModal = ({ visible, fileData, tarOnCancel, setParams, innerParams }: Props) => {
  36 + const [loading, setLoading] = useState<boolean>(false);
  37 + const onOk = async (key: string) => {
  38 + const pa = { key };
  39 + setLoading(true);
  40 + try {
  41 + const { success } = await saveEvaImportData(pa);
  42 + if (success) {
  43 + setLoading(false);
  44 + message.success(`数据上传成功`, 5);
  45 + // 重新刷新列表
  46 + setParams({ ...innerParams }, true);
  47 + tarOnCancel && tarOnCancel();
  48 + }
  49 + } catch (error: any) {
  50 + setLoading(false);
  51 + message.error(error.message);
  52 + }
  53 + };
49 54 return (
50 55 <>
51   - <Modal title="导入数据详情" visible={visible} onCancel={() => tarOnCancel()} maskClosable={false} width={1500}>
52   - <Table bordered dataSource={fileData.details}>
  56 + <Modal
  57 + title="导入数据详情"
  58 + visible={visible}
  59 + onCancel={() => tarOnCancel()}
  60 + maskClosable={false}
  61 + width={1500}
  62 + onOk={() => onOk(fileData.key)}
  63 + confirmLoading={loading}
  64 + >
  65 + <Table bordered dataSource={fileData.details} pagination={{ total: fileData.num }}>
53 66 <Column title="归属人员" dataIndex="userName" align="center" render={(name) => <span>{name || "--"}</span>} />
54 67 <Column title="归属门店" dataIndex="shopName" align="center" render={(name) => <span>{name || "--"}</span>} />
55 68 <Column
... ... @@ -58,7 +71,7 @@ const TargetModal = ({ visible, fileData, tarOnCancel }: Props) =&gt; {
58 71 align="center"
59 72 render={(name) => <span>{name || "--"}</span>}
60 73 />
61   - <Column
  74 + {/* <Column
62 75 title="指标值"
63 76 dataIndex="indicatorValue"
64 77 align="center"
... ... @@ -71,7 +84,7 @@ const TargetModal = ({ visible, fileData, tarOnCancel }: Props) =&gt; {
71 84 : "--"}
72 85 </span>
73 86 )}
74   - />
  87 + /> */}
75 88 <Column
76 89 title="考核周期"
77 90 dataIndex="dataDate"
... ... @@ -93,6 +106,12 @@ const TargetModal = ({ visible, fileData, tarOnCancel }: Props) =&gt; {
93 106 render={(_: any, record: any) => (record.errorType ? ReasonsEnum[record.errorType] : "--")}
94 107 />
95 108 </Table>
  109 + <div>
  110 + 成功条数: <span style={{ color: "#20c688" }}>{fileData.successNum}</span> 条
  111 + </div>
  112 + <div>
  113 + 失败条数: <span style={{ color: "#f4333c" }}>{fileData.errorNum}</span> 条
  114 + </div>
96 115 </Modal>
97 116 </>
98 117 );
... ...
src/pages/performance/EvaDataImport/index.tsx
... ... @@ -20,7 +20,7 @@ export default () =&gt; {
20 20 const [visible, setVisible] = useState<boolean>(false);
21 21 const uploadPerson: UploadProps = {
22 22 name: "file",
23   - action: "/api/morax/erp/eval-indicator/staff-indicator",
  23 + action: "/api/morax/erp/eval-indicator/analysis-staff",
24 24 maxCount: 1,
25 25 showUploadList: false,
26 26 onChange(info) {
... ... @@ -28,10 +28,8 @@ export default () =&gt; {
28 28 console.log(info.file, info.fileList);
29 29 }
30 30 if (info.file.status === "done") {
31   - message.success(`${info.file.name} 上传成功`);
32   - setParams({ ...innerParams }, true);
33   - // setFileData(info.file.response.data);
34   - // setVisible(true);
  31 + setFileData(info.file.response.data);
  32 + setVisible(true);
35 33 } else if (info.file.status === "error") {
36 34 message.error(`${info.file.name} 上传失败`);
37 35 }
... ... @@ -39,7 +37,7 @@ export default () =&gt; {
39 37 };
40 38 const uploadShop: UploadProps = {
41 39 name: "file",
42   - action: "/api/morax/erp/eval-indicator/shop-indicator",
  40 + action: "/api/morax/erp/eval-indicator/analysis-shop",
43 41 maxCount: 1,
44 42 showUploadList: false,
45 43 onChange(info) {
... ... @@ -47,8 +45,8 @@ export default () =&gt; {
47 45 console.log(info.file, info.fileList);
48 46 }
49 47 if (info.file.status === "done") {
50   - message.success(`${info.file.name} 上传成功`);
51   - setParams({ ...innerParams }, true);
  48 + setFileData(info.file.response.data);
  49 + setVisible(true);
52 50 } else if (info.file.status === "error") {
53 51 message.error(`${info.file.name} 上传失败`);
54 52 }
... ... @@ -91,7 +89,7 @@ export default () =&gt; {
91 89 </Row>
92 90 <Table
93 91 loading={loading}
94   - rowKey={(row) => `id${row.indicatorCode}`}
  92 + rowKey={(row) => `id${row.id}`}
95 93 dataSource={list}
96 94 pagination={paginationConfig}
97 95 >
... ... @@ -136,11 +134,11 @@ export default () =&gt; {
136 134 align="center"
137 135 dataIndex="enable"
138 136 width={150}
139   - render={(text: boolean, record: KpiSetteing.KpiListItems) => (
  137 + render={(text: boolean, record: any) => (
140 138 <Space split={<Divider type="vertical" />}>
141 139 <Typography.Link
142 140 onClick={() => {
143   - history.push(`/morax/evaDataImport/edit/${record.id}`);
  141 + history.push(`/morax/evaDataImport/edit/${record.id}/${record.num}`);
144 142 }}
145 143 >
146 144 查看
... ... @@ -149,7 +147,13 @@ export default () =&gt; {
149 147 )}
150 148 />
151 149 </Table>
152   - {/* <FileDatailsModal visible={visible} tarOnCancel={() => setVisible(false)} fileData={fileData} /> */}
  150 + <FileDatailsModal
  151 + visible={visible}
  152 + tarOnCancel={() => setVisible(false)}
  153 + fileData={fileData}
  154 + setParams={setParams}
  155 + innerParams={innerParams}
  156 + />
153 157 </Card>
154 158 </PageHeaderWrapper>
155 159 );
... ...
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddEvaGroupModal.tsx
... ... @@ -76,10 +76,10 @@ export default function AddIndicatorsModal(props: Props) {
76 76  
77 77 // 查询门店
78 78 useEffect(() => {
79   - if (evaItem.postId) {
80   - getDealerList(evaItem.postId);
  79 + if (evaItem.post) {
  80 + getDealerList(evaItem.post.value);
81 81 }
82   - }, [evaItem.postId]);
  82 + }, [evaItem]);
83 83 console.log("shopList", shopList);
84 84  
85 85 // 查询管理角色
... ... @@ -256,11 +256,28 @@ export default function AddIndicatorsModal(props: Props) {
256 256 }
257 257 </Form.Item>
258 258  
259   - <Form.Item name="indicators" label="考评指标" rules={[{ required: true }]}>
260   - <IndivatorsTable postId={postId} personModal={personModal} scopeType={scopeType} />
  259 + <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.rewards !== currentValues.rewards}>
  260 + {({ getFieldValue }) => {
  261 + const rewards = getFieldValue("rewards");
  262 + return (
  263 + <Form.Item name="indicators" label="考评指标" rules={[{ required: !(rewards && rewards.length > 0) }]}>
  264 + <IndivatorsTable postId={postId} personModal={personModal} scopeType={scopeType} />
  265 + </Form.Item>
  266 + );
  267 + }}
261 268 </Form.Item>
262   - <Form.Item name="rewards" label="考评奖惩" rules={[{ required: true }]}>
263   - <RewardsTableSal postId={postId} personModal={personModal} scopeType={scopeType} />
  269 + <Form.Item
  270 + noStyle
  271 + shouldUpdate={(prevValues, currentValues) => prevValues.indicators !== currentValues.indicators}
  272 + >
  273 + {({ getFieldValue }) => {
  274 + const indicators = getFieldValue("indicators");
  275 + return (
  276 + <Form.Item name="rewards" label="考评奖惩" rules={[{ required: !(indicators && indicators.length > 0) }]}>
  277 + <RewardsTableSal postId={postId} personModal={personModal} scopeType={scopeType} />
  278 + </Form.Item>
  279 + );
  280 + }}
264 281 </Form.Item>
265 282 </Form>
266 283  
... ...
src/pages/performance/EvaGroupSetting/EditComfirm/components/RankModal.tsx
... ... @@ -60,8 +60,13 @@ const TotalAmount = ({
60 60 if (dataIndex == "upper" && isPercent == 2) {
61 61 precision = 2;
62 62 }
63   - const inputNode =
64   - inputType === "number" ? <InputNumber precision={precision} max={isPercent == 2 ? 100 : 100000} /> : <Input />;
  63 + let max = 0;
  64 + if ((dataIndex == "upper" || dataIndex == "lower") && isPercent == 2) {
  65 + max = 100;
  66 + } else {
  67 + max = 999999999999;
  68 + }
  69 + const inputNode = inputType === "number" ? <InputNumber precision={precision} max={max} /> : <Input />;
65 70  
66 71 return (
67 72 <td {...restProps}>
... ...
src/pages/performance/EvaSetting/components/EditModal.tsx
... ... @@ -98,7 +98,7 @@ export default function EditModal({ onClose, setItem, item, roleList }: Props) {
98 98 ))}
99 99 </Select>
100 100 </Form.Item>
101   - <Form.Item name="belongSystem" label="归属系统" rules={[{ required: true }]}>
  101 + {/* <Form.Item name="belongSystem" label="归属系统" rules={[{ required: true }]}>
102 102 <Select placeholder="请选择归属系统" showSearch allowClear labelInValue optionFilterProp="children">
103 103 {list.map((item) => (
104 104 <Option value={item.id} key={item.id}>
... ... @@ -106,7 +106,7 @@ export default function EditModal({ onClose, setItem, item, roleList }: Props) {
106 106 </Option>
107 107 ))}
108 108 </Select>
109   - </Form.Item>
  109 + </Form.Item> */}
110 110 {/* 使用角色 */}
111 111 <Form.Item name="role" label="导入操作人员" rules={[{ required: true }]}>
112 112 <Select placeholder="请选择导入操作角色类型" showSearch allowClear labelInValue optionFilterProp="children">
... ...
src/pages/performance/EvaSetting/components/Filter.tsx
... ... @@ -64,7 +64,7 @@ export default function Filter({ setParams, roleList }: Props) {
64 64 </Option>
65 65 ))}
66 66 </Select>
67   - <Select
  67 + {/* <Select
68 68 allowClear
69 69 placeholder="选择归属系统"
70 70 style={{ width: 260, marginRight: 5 }}
... ... @@ -77,7 +77,7 @@ export default function Filter({ setParams, roleList }: Props) {
77 77 {item.sysName}
78 78 </Select.Option>
79 79 ))}
80   - </Select>
  80 + </Select> */}
81 81 <Select
82 82 placeholder="筛选禁用与启用"
83 83 style={{ width: 250, marginRight: 10, marginBottom: 10 }}
... ...
src/pages/stock/VehicleAdditional/SelelctCarTreeAuth/index.tsx
... ... @@ -100,7 +100,7 @@ export default function index({ onChange, value, disabled, brandList = [] }: Pro
100 100 currentItem.children = _series;
101 101 }
102 102  
103   - const tempData = savaData.map((item: any) => (item.brandId === currentItem.brandId ? { ...currentItem, authType: 2 } : item));
  103 + const tempData = savaData.map((item: any) => (item.brandId === currentItem.brandId ? { ...currentItem, authType: series.length ? 2 : 1 } : { ...item, authType: 1 }));
104 104 setSavadata([...tempData]);
105 105 onChange && onChange(tempData);
106 106 setVisible(false);
... ... @@ -116,10 +116,10 @@ export default function index({ onChange, value, disabled, brandList = [] }: Pro
116 116 currentItem.authType = 2;
117 117 const tempData = savaData.map((item: any) => {
118 118 if (item.children) {
119   - const newChildren = item.children.map((i: any) => (i.seriesId === currentItem.seriesId ? { ...currentItem, authType: 2 } : i));
  119 + const newChildren = item.children.map((i: any) => (i.seriesId === currentItem.seriesId ? { ...currentItem, authType: spec.length ? 2 : 1 } : i));
120 120 item.children = newChildren;
121 121 }
122   - return item;
  122 + return { ...item, authType: 1 };
123 123 });
124 124 setSavadata([...tempData]);
125 125 onChange && onChange(tempData);
... ...