diff --git a/config/routers/performance.ts b/config/routers/performance.ts index 46e0d6a..588dd9f 100755 --- a/config/routers/performance.ts +++ b/config/routers/performance.ts @@ -91,7 +91,7 @@ export default [ }, /** 考评数据导入==> 查看数据清单 */ { - path: "/morax/evaDataImport/edit/:id?", + path: "/morax/evaDataImport/edit/:id?/:num?", component: "./performance/EvaDataImport/EditComfirm/index", }, diff --git a/src/pages/performance/EvaDataImport/EditComfirm/index.tsx b/src/pages/performance/EvaDataImport/EditComfirm/index.tsx index d10e46e..da5ffc8 100644 --- a/src/pages/performance/EvaDataImport/EditComfirm/index.tsx +++ b/src/pages/performance/EvaDataImport/EditComfirm/index.tsx @@ -25,7 +25,7 @@ function Index(props: Props) { const [delay, setDelay] = useState(true); const [newData, setNewData] = useState([]); const { match } = props; - const { id } = match.params; + const { id, num } = match.params; useEffect(() => { setId(id); }, [id]); @@ -35,6 +35,7 @@ function Index(props: Props) { setDelay(false); } }, [configId]); + console.log('num', num); const { data, errMsg, setParams, loading } = useInitail(evaDataDetailApi, {}, {}, delay); console.log(isArray(data)); useEffect(() => { @@ -46,7 +47,7 @@ function Index(props: Props) { return ( - `id${id}`} dataSource={newData}> +
`id${id}`} dataSource={newData} pagination={{ total: num }}> {name || "--"}} /> {name || "--"}} /> (record.errorType ?
未导入
:
已导入
)} + render={(_: any, record: any) => + record.errorType ?
未导入
:
已导入
+ } /> { return request.get(`${MORAX_HOST}/erp/eval-indicator/indicators`, {}); } + +/** + * 保存上传人员数据 + * http://testgate.feewee.cn/morax/erp/eval-indicator/save-import + */ +export function saveEvaImportData(params: { key: string }) { + return request.get(`${MORAX_HOST}/erp/eval-indicator/save-import`, { params }); +} diff --git a/src/pages/performance/EvaDataImport/components/FileDatailsModal.tsx b/src/pages/performance/EvaDataImport/components/FileDatailsModal.tsx index 5a04982..c87ce68 100644 --- a/src/pages/performance/EvaDataImport/components/FileDatailsModal.tsx +++ b/src/pages/performance/EvaDataImport/components/FileDatailsModal.tsx @@ -19,6 +19,7 @@ import { TargetType, TargetTypeEnum } from "@/pages/performance/entity"; import { render } from "react-dom"; import moment from "moment"; import { ReasonsEnum } from "../entity"; +import { saveEvaImportData } from "../api"; import { history } from "umi"; import st from "./style.less"; @@ -28,28 +29,40 @@ interface Props { visible: boolean; fileData: any; tarOnCancel: Function; + setParams: Function; + innerParams: any; } -const columns = [ - { - title: "目标名称", - dataIndex: "indicatorName", - key: "indicatorName", - }, - - { - title: "目标值", - dataIndex: "targetValue", - key: "targetValue", - render: (value: Number, record: any) => { - return record.targetType === 2 ? `${value}%` : record.targetType === 3 ? `${value}元` : `${value}台`; - }, - }, -]; -const TargetModal = ({ visible, fileData, tarOnCancel }: Props) => { +const TargetModal = ({ visible, fileData, tarOnCancel, setParams, innerParams }: Props) => { + const [loading, setLoading] = useState(false); + const onOk = async (key: string) => { + const pa = { key }; + setLoading(true); + try { + const { success } = await saveEvaImportData(pa); + if (success) { + setLoading(false); + message.success(`数据上传成功`, 5); + // 重新刷新列表 + setParams({ ...innerParams }, true); + tarOnCancel && tarOnCancel(); + } + } catch (error: any) { + setLoading(false); + message.error(error.message); + } + }; return ( <> - tarOnCancel()} maskClosable={false} width={1500}> -
+ tarOnCancel()} + maskClosable={false} + width={1500} + onOk={() => onOk(fileData.key)} + confirmLoading={loading} + > +
{name || "--"}} /> {name || "--"}} /> { align="center" render={(name) => {name || "--"}} /> - { : "--"} )} - /> + /> */} { render={(_: any, record: any) => (record.errorType ? ReasonsEnum[record.errorType] : "--")} />
+
+ 成功条数: {fileData.successNum} 条 +
+
+ 失败条数: {fileData.errorNum} 条 +
); diff --git a/src/pages/performance/EvaDataImport/index.tsx b/src/pages/performance/EvaDataImport/index.tsx index 5be19a4..ea81af6 100644 --- a/src/pages/performance/EvaDataImport/index.tsx +++ b/src/pages/performance/EvaDataImport/index.tsx @@ -20,7 +20,7 @@ export default () => { const [visible, setVisible] = useState(false); const uploadPerson: UploadProps = { name: "file", - action: "/api/morax/erp/eval-indicator/staff-indicator", + action: "/api/morax/erp/eval-indicator/analysis-staff", maxCount: 1, showUploadList: false, onChange(info) { @@ -28,10 +28,8 @@ export default () => { console.log(info.file, info.fileList); } if (info.file.status === "done") { - message.success(`${info.file.name} 上传成功`); - setParams({ ...innerParams }, true); - // setFileData(info.file.response.data); - // setVisible(true); + setFileData(info.file.response.data); + setVisible(true); } else if (info.file.status === "error") { message.error(`${info.file.name} 上传失败`); } @@ -39,7 +37,7 @@ export default () => { }; const uploadShop: UploadProps = { name: "file", - action: "/api/morax/erp/eval-indicator/shop-indicator", + action: "/api/morax/erp/eval-indicator/analysis-shop", maxCount: 1, showUploadList: false, onChange(info) { @@ -47,8 +45,8 @@ export default () => { console.log(info.file, info.fileList); } if (info.file.status === "done") { - message.success(`${info.file.name} 上传成功`); - setParams({ ...innerParams }, true); + setFileData(info.file.response.data); + setVisible(true); } else if (info.file.status === "error") { message.error(`${info.file.name} 上传失败`); } @@ -91,7 +89,7 @@ export default () => { `id${row.indicatorCode}`} + rowKey={(row) => `id${row.id}`} dataSource={list} pagination={paginationConfig} > @@ -136,11 +134,11 @@ export default () => { align="center" dataIndex="enable" width={150} - render={(text: boolean, record: KpiSetteing.KpiListItems) => ( + render={(text: boolean, record: any) => ( }> { - history.push(`/morax/evaDataImport/edit/${record.id}`); + history.push(`/morax/evaDataImport/edit/${record.id}/${record.num}`); }} > 查看 @@ -149,7 +147,13 @@ export default () => { )} />
- {/* setVisible(false)} fileData={fileData} /> */} + setVisible(false)} + fileData={fileData} + setParams={setParams} + innerParams={innerParams} + />
); diff --git a/src/pages/performance/EvaGroupSetting/EditComfirm/components/AddEvaGroupModal.tsx b/src/pages/performance/EvaGroupSetting/EditComfirm/components/AddEvaGroupModal.tsx index c3a2ea3..59d52d9 100644 --- a/src/pages/performance/EvaGroupSetting/EditComfirm/components/AddEvaGroupModal.tsx +++ b/src/pages/performance/EvaGroupSetting/EditComfirm/components/AddEvaGroupModal.tsx @@ -76,10 +76,10 @@ export default function AddIndicatorsModal(props: Props) { // 查询门店 useEffect(() => { - if (evaItem.postId) { - getDealerList(evaItem.postId); + if (evaItem.post) { + getDealerList(evaItem.post.value); } - }, [evaItem.postId]); + }, [evaItem]); console.log("shopList", shopList); // 查询管理角色 @@ -256,11 +256,28 @@ export default function AddIndicatorsModal(props: Props) { } - - + prevValues.rewards !== currentValues.rewards}> + {({ getFieldValue }) => { + const rewards = getFieldValue("rewards"); + return ( + 0) }]}> + + + ); + }} - - + prevValues.indicators !== currentValues.indicators} + > + {({ getFieldValue }) => { + const indicators = getFieldValue("indicators"); + return ( + 0) }]}> + + + ); + }} diff --git a/src/pages/performance/EvaGroupSetting/EditComfirm/components/RankModal.tsx b/src/pages/performance/EvaGroupSetting/EditComfirm/components/RankModal.tsx index abb52b7..d2bb3f1 100755 --- a/src/pages/performance/EvaGroupSetting/EditComfirm/components/RankModal.tsx +++ b/src/pages/performance/EvaGroupSetting/EditComfirm/components/RankModal.tsx @@ -60,8 +60,13 @@ const TotalAmount = ({ if (dataIndex == "upper" && isPercent == 2) { precision = 2; } - const inputNode = - inputType === "number" ? : ; + let max = 0; + if ((dataIndex == "upper" || dataIndex == "lower") && isPercent == 2) { + max = 100; + } else { + max = 999999999999; + } + const inputNode = inputType === "number" ? : ; return ( diff --git a/src/pages/performance/EvaSetting/components/EditModal.tsx b/src/pages/performance/EvaSetting/components/EditModal.tsx index 544c7b6..c1646e5 100644 --- a/src/pages/performance/EvaSetting/components/EditModal.tsx +++ b/src/pages/performance/EvaSetting/components/EditModal.tsx @@ -98,7 +98,7 @@ export default function EditModal({ onClose, setItem, item, roleList }: Props) { ))} - + {/* - + */} {/* 使用角色 */} - + */}