diff --git a/config/routers/contract.ts b/config/routers/contract.ts index 177d15e..bc9291d 100644 --- a/config/routers/contract.ts +++ b/config/routers/contract.ts @@ -59,4 +59,12 @@ export default [ path: "/contract/kt/itemamount/config", //事项款设置 component: "./contract/ItemAmountSetting", }, + { + path: "/contract/kt/authorization/setting", //合同授权 + component: "./contract/AuthorizationSetting", + }, + { + path: "/contract/kt/expressChargingStandard/setting", //快递收费标准 + component: "./contract/ExpressChargingStandardSetting", + }, ]; 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/contract/AuthorizationSetting/api.ts b/src/pages/contract/AuthorizationSetting/api.ts new file mode 100644 index 0000000..6c2d94f --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/api.ts @@ -0,0 +1,94 @@ +import { http } from "@/typing/http"; +import request from "@/utils/request"; +import qs from 'qs'; +import { CONTRACT_HOST, HOST } from "@/utils/host"; +import { Any } from "currency.js"; + +type PrResArr = http.PromiseResp; + +export interface Item { + id?:number, //授权ID + typeName?:string, //合同类型名称 + createTime?:number, //创建时间 + updateTime?:number, //更新时间 + enabled?:boolean, //是否启用 + roles?:Roles[],//授权角色 +} +export interface Roles { + roleCode?:string, //角色编码 + roleName?:string, //角色名称 +} +export interface TypesItem { + id?: number; // id + name?: string; + fixedAmount?: boolean; + contractableTradeCompCategories?: number[]; + feeType?: string; + feeTypeValue?: string; + bizType?: string; + bizTypeValue?: number; + subjectType?: string; + subjectTypeValue?: string; + servicePlaceTypes?: number[]; +} + +export interface PageParams { + current?: number; + pageSize?: number; + contractTypeName?:string //合同类型名称 +} +export interface SaveParams { + contractAuthId?: number; + typeId: number;//合同类型id + typeName:string //合同类型名称 + roles?:Roles[],//授权角色 +} +interface DelParams { + contractAuthId?: number; //合同授权id +} + +export interface DisableParams { + contractAuthId?: number;//合同授权id + enabled?: boolean;//是否启用 +} + +/** + * 查询所有角色列表 + */ +export function getAllRoleCodeApi(params: CommonApi.RoleParams): PrResArr { + return request.get(`${HOST}/role/listAll`, { params }); +} +/** + * 查询合同类型列表 + */ +export function getContractTypes(params: PageParams): http.PromisePageResp { + return request.get(`${CONTRACT_HOST}/erp/contract/type/page`, { params }); +} + +/** + * 分页查询合同授权 + */ +export function getContractAuthPage(params?: PageParams): http.PromisePageResp { + return request.get(`${CONTRACT_HOST}/erp/contractAuth/page`, {params}); +} + +/** + * 新增合同授权/编辑合同授权 + */ +export function addContractAuth(params?: SaveParams): http.PromisePageResp { + return request.post(`${CONTRACT_HOST}/erp/contractAuth/save`, {...params}); +} + +/** + * 删除合同授权 + */ + export function delContractAuth(params?: DelParams): http.PromisePageResp { + return request.post(`${CONTRACT_HOST}/erp/contractAuth/delete`, {...params}); +} + +/** + * 启用或禁用 + */ + export function disableContractAuth(params?: DisableParams): http.PromisePageResp { + return request.post(`${CONTRACT_HOST}/erp/contractAuth/enableOrDisable`, {...params}); +} \ No newline at end of file diff --git a/src/pages/contract/AuthorizationSetting/components/AddModel/index.tsx b/src/pages/contract/AuthorizationSetting/components/AddModel/index.tsx new file mode 100644 index 0000000..1a47a9f --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/components/AddModel/index.tsx @@ -0,0 +1,132 @@ +import React, { useCallback, useEffect, useState } from "react"; +import { Modal, Skeleton, Select, Form, message } from "antd"; +import * as API from '../../api'; + +interface Props{ + visible:boolean; + row?:API.Item; + contractTypesList:any[], + roleList:any[], + onRefresh: () => void; + onCancel?: () => void; +} + +function AddModel({visible, row, contractTypesList, roleList, onCancel, onRefresh}:Props) { + const [form] = Form.useForm(); + const [loading, setLoading] = useState(false); + const {id, roles, typeName } = row || {}; + useEffect(() => { + if (id) { + form.setFieldsValue({ + contractType: contractTypesList.filter((item:API.TypesItem) => item.name === typeName).map((i:any) => ({label: i.name, value: i.id}))[0], + roleCode: roles?.length && roles.map((i:any) => ({label: i.roleName, value: i.roleCode})), + }); + } + }, [row]); + + /** + * @description: 表单提交 + * @param {any} feildValue + * @return {*} + */ + const handleSave = (feildValue: any) => { + setLoading(true); + const { roleCode, contractType } = feildValue; + const _roleCode = roleCode.length && roleCode.map((item:any) => ({roleCode: item.value, roleName: item.label })); + const params = {roles: _roleCode, typeId: contractType.value, typeName: contractType.label }; + API.addContractAuth({ ...params, contractAuthId: id }) + .then(res => { + message.success("操作成功"); + _onCancel(); + setLoading(false); + onRefresh(); + }) + .catch(err => { + message.error(err?.message); + setLoading(false); + }); + }; + /** + * @description: 关闭弹框 + * @param {*} + * @return {*} + */ + const _onCancel = () => { + onCancel && onCancel(); + form.resetFields(); + }; + + return ( + + +
+ + + + + + +
+
+
+ ); +} + +export default AddModel; \ No newline at end of file diff --git a/src/pages/contract/AuthorizationSetting/components/Filter/index.tsx b/src/pages/contract/AuthorizationSetting/components/Filter/index.tsx new file mode 100644 index 0000000..65f444c --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/components/Filter/index.tsx @@ -0,0 +1,43 @@ +import React, { useCallback, useState } from "react"; +import { Row, Col, Select } from "antd"; +import * as common from "@/typing/common"; +import _ from "lodash"; +import * as API from '../../api'; + +interface Props{ + contractTypesList?:any[], + setParams:any, + innerParams?:any, +} + +function Filter({ contractTypesList, innerParams, setParams }:Props) { + const onChange = _.debounce((contractTypeName: string) => { + setParams({...innerParams, contractTypeName}, true); + }, 350); + return ( + + + + + + ); +} + +export default Filter; \ No newline at end of file diff --git a/src/pages/contract/AuthorizationSetting/components/RolesModel/index.tsx b/src/pages/contract/AuthorizationSetting/components/RolesModel/index.tsx new file mode 100644 index 0000000..ccb2012 --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/components/RolesModel/index.tsx @@ -0,0 +1,32 @@ +import React, { useCallback, useEffect, useState } from "react"; +import { Modal, Form, message, Table } from "antd"; +import * as API from '../../api'; + +interface Props{ + visible:boolean; + roles?:API.Roles[]; + onRefresh: () => void; + onCancel?: () => void; +} +const { Column } = Table; + +function RolesModel({visible, roles, onRefresh, onCancel}:Props) { + return ( + + `${item.roleCode}`} + + > + t || "-"} /> + t || "-"} /> +
+
+ ); +} + +export default RolesModel; \ No newline at end of file diff --git a/src/pages/contract/AuthorizationSetting/index.tsx b/src/pages/contract/AuthorizationSetting/index.tsx new file mode 100644 index 0000000..902ad2b --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/index.tsx @@ -0,0 +1,202 @@ +import React, { useCallback, useState } from "react"; +import { Button, Card, ConfigProvider, Divider, Input, message, Popconfirm, Select, Table } from "antd"; +import { PageHeaderWrapper } from "@ant-design/pro-layout"; +import zhCN from "antd/lib/locale-provider/zh_CN"; +import usePagination from "@/hooks/usePagination"; +import useInitial from "@/hooks/useInitail"; +import { PlusOutlined } from "@ant-design/icons"; +import AddModel from './components/AddModel'; +import RolesModel from './components/RolesModel'; +import Filter from './components/Filter'; +import * as API from './api'; +import _ from "lodash"; +import moment from 'moment'; +import st from "./style.less"; + +const { Column } = Table; +function AuthorizationSetting() { + const [visible, setVisible] = useState(false); + const [searchValue, setSearchValue] = useState({}); + const [rolesVisible, setRolesVisible] = useState(false); + const [row, setRow] = useState(); + const [roles, setRoles] = useState(); + const {data: roleList} = useInitial(API.getAllRoleCodeApi, [], {}); + const { + list: authList, + paginationConfig, + loading, + innerParams, + setParams, + } = usePagination(API.getContractAuthPage, {current: 1, pageSize: 10}); + const { + list: contractTypesList, + } = usePagination(API.getContractTypes, {current: 1, pageSize: 999}); + /** + * @description: 删除 + * @param {*} + * @return {*} + * + */ + const _delete = (row:API.Item) => { + const {id} =row; + API.delContractAuth({contractAuthId: id}) + .then((res) => { + message.success("操作成功"); + setParams({ ...innerParams }, true); + }) + .catch((e) => { + message.error(e.message); + }); + }; + + /** + * @description: 编辑 + * @param {API} row + * @return {*} + */ + const edit = async (row:API.Item) => { + await setRow(row); + setVisible(true); + }; + + /** + * @description: 禁用启用 + * @param {API} row + * @return {*} + */ + const handleDisable = (row:API.Item) => { + const { id, enabled } = row; + API.disableContractAuth({contractAuthId: id, enabled: !enabled}) + .then((res) => { + message.success("操作成功"); + setParams({ ...innerParams }, true); + }) + .catch((err) => { + message.error(err.message); + }); + }; + + const showRoles = async (row:API.Item) => { + const {roles} = row; + try { + await setRoles(roles); + } finally { + setRolesVisible(true); + } + }; + + return ( + + + +
+ + +
+ `${item.id}`} + onChange={(_pagination) => setParams({ ..._pagination }, true)} + > + t || "-"} /> + ( + + )} + /> + (t?'启用':'禁用')} /> + {/* (t ? moment(t).format('YYYY-MM-DD HH:mm') : "-")} /> + (t ? moment(t).format('YYYY-MM-DD HH:mm') : "-")} /> */} + ( + + handleDisable(row)} okText="确定" cancelText="取消"> + { + e.preventDefault(); + }} + style={{ color: "#FAAD14" }} + > + {`${row.enabled ? '禁用' :'启用'}`} + + + + edit(row)} okText="确定" cancelText="取消"> + { + e.preventDefault(); + }} + style={{ color: "#FAAD14" }} + > + 编辑 + + + + _delete(row)} okText="确定" cancelText="取消"> + { + e.preventDefault(); + }} + style={{ color: "red" }} + > + 删除 + + + + + )} + /> +
+ { + setVisible(false); + setRow(undefined); + }} + onRefresh={() => setParams({ ...innerParams }, true)} + /> + { + setRolesVisible(false); + setRoles(undefined); + }} + onRefresh={() => setParams({ ...innerParams }, true)} + /> +
+
+
+ ); +} +export default AuthorizationSetting; diff --git a/src/pages/contract/AuthorizationSetting/style.css b/src/pages/contract/AuthorizationSetting/style.css new file mode 100644 index 0000000..54cc5b3 --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/style.css @@ -0,0 +1,40 @@ +.page { + position: relative; +} +.page .header { + margin-bottom: 10px; + height: 32px; + display: flex; + flex-direction: row; + justify-content: space-between; +} +.page .header .add { + position: absolute; + right: 28px; + top: 24px; + z-index: 10; +} +.table :global .ant-table table { + width: 100%; + border-collapse: collapse; + text-align: center; + border-radius: 4px 4px 0 0; +} +.table :global .ant-table-thead > tr > th, +.table :global .ant-table-tbody > tr > td { + padding: 16px 16px; + word-break: break-word; + text-align: center; + -ms-word-break: break-all; +} +.table .cover { + align-items: center; + height: 68px; +} +.table .cover img { + border-radius: 4%; + height: 100%; + width: auto; + min-width: 100px; + max-width: 100px; +} diff --git a/src/pages/contract/AuthorizationSetting/style.less b/src/pages/contract/AuthorizationSetting/style.less new file mode 100644 index 0000000..e4df1e1 --- /dev/null +++ b/src/pages/contract/AuthorizationSetting/style.less @@ -0,0 +1,48 @@ +//@import '~antd/lib/style/themes/default.less'; + +.page { + position: relative; + + .header { + margin-bottom: 10px; + height: 32px; + display: flex; + flex-direction: row; + justify-content: space-between; + .add { + position: absolute; + right: 28px; + top: 24px; + z-index: 10; + } + } + + } + .table { + :global { + .ant-table table { + width: 100%; + border-collapse: collapse; + text-align: center; + border-radius: 4px 4px 0 0; + } + .ant-table-thead > tr > th, .ant-table-tbody > tr > td { + padding: 16px 16px; + word-break: break-word; + text-align: center; + -ms-word-break: break-all; + } + } + .cover { + align-items: center; + height: 68px; + img { + border-radius: 4%; + height: 100%; + width: auto; + min-width: 100px; + max-width: 100px; + } + } + } + \ No newline at end of file diff --git a/src/pages/contract/ExpressChargingStandardSetting/api.ts b/src/pages/contract/ExpressChargingStandardSetting/api.ts new file mode 100644 index 0000000..aafbba7 --- /dev/null +++ b/src/pages/contract/ExpressChargingStandardSetting/api.ts @@ -0,0 +1,79 @@ +import { http } from "@/typing/http"; +import request from "@/utils/request"; +import qs from 'qs'; +import { CONTRACT_HOST, HOST, FINANCE2_HOST } from "@/utils/host"; +import { Any } from "currency.js"; + +type PrResArr = http.PromiseResp; + +export interface PageParams { + current?: number; + pageSize?: number; + tradeCompId?:number; //合同类型名称 + sendAreaNo?:string; //寄件地区编号 + arriveAreaNo?:string; //到达地区编号 +} + +export interface SaveParams { + expressChargeStandardId?:number; //id,提供该参数将执行编辑操作 + tradeCompId:number; //往来单位id + tradeCompName:string; //往来单位名称 + sendAreaNo:string; //寄件地区编号 + sendAreaName:string; //寄件地区名称 + firstWeight:number; //首重 + continuedWeight:number; //续重 + arriveAreas:ArriveAreas[]; //到达地区 +} + +export interface DelParams { + expressChargeStandardId:number; //快递收费标准id +} + +export interface ArriveAreas { + arriveAreaNo:string; //到达地区编号 + arriveAreaName:string; //到达地区名称 +} + +export interface Item { + id?:number; + tradeCompName?:string; //往来单位名称 + tradeCompShortName?:string; //往来单位简称 + sendAreaName?:string; //寄件地区名称 + arriveAreaName?:string; //到达地区名称 + firstWeight?:number; //首重 + continuedWeight?:number; //续重 +} + +/** + * 分页查询快递收费标准 + */ + export function getStandardPage(params?: PageParams): http.PromisePageResp { + return request.get(`${CONTRACT_HOST}/erp/express/charge/standard/page`, { params }); +} + +/** + * 新增/编辑快递收费标准 + */ + export function addStandardSave(params: SaveParams): http.PromiseResp { + return request.post(`${CONTRACT_HOST}/erp/express/charge/standard/save`, { ...params }); +} + +/** + * 删除快递收费标准 + */ + export function delStandard(params: DelParams): http.PromiseResp { + return request.post(`${CONTRACT_HOST}/erp/express/charge/standard/delete`, { ...params }); +} + +/**获取往来单位列表*/ +export function fetchComps(params?: any): http.PromiseResp { + return request.get(`${FINANCE2_HOST}/common/trade/company/list`, {params }); +} + +/** + * 城市列表 + */ + export function getCityLsit(): http.PromiseResp { + const params = { pbh: 0 }; + return request.get(`/oop/select/region`, { params }); +} \ No newline at end of file diff --git a/src/pages/contract/ExpressChargingStandardSetting/components/AddModel/index.tsx b/src/pages/contract/ExpressChargingStandardSetting/components/AddModel/index.tsx new file mode 100644 index 0000000..bca7683 --- /dev/null +++ b/src/pages/contract/ExpressChargingStandardSetting/components/AddModel/index.tsx @@ -0,0 +1,187 @@ +import React, { useCallback, useEffect, useState } from "react"; +import { Modal, Skeleton, Select, Form, message, InputNumber } from "antd"; +import * as API from '../../api'; +import _ from "lodash"; + +interface Props { + visible:boolean; + row?:API.Item; + compList:any[]; + cityList:any[]; + onCancel:()=>void; + onRefresh:() => void; + +} + +function AddModel({visible, row, compList, cityList, onCancel, onRefresh}:Props) { + const [form] = Form.useForm(); + const [loading, setLoading] = useState(false); + const { id } = row || {}; + useEffect(() => { + if (id) { + const { tradeCompName, sendAreaName, firstWeight, continuedWeight, arriveAreaName } = row || {}; + form.setFieldsValue({ + tradeComp: compList.filter(it => tradeCompName === it.name).map(item => ({value: item.id, label: item.name}))[0], + sendArea: cityList.filter(it => sendAreaName === it.fullName).map(item => ({value: item.bh, label: item.fullName}))[0], + firstWeight, + continuedWeight, + arriveAreas: cityList.filter(it => arriveAreaName === it.fullName).map(item => ({value: item.bh, label: item.fullName}))[0] + + }); + } + }, [row]); + + /** + * @description: 确定 + * @param {*} + * @return {*} + */ + const handleSave = (feildValue:any) => { + setLoading(true); + const {tradeComp, sendArea, arriveAreas, firstWeight, continuedWeight} = feildValue; + const _arriveAreas = id ? [{ ...arriveAreas }].map(item => ({arriveAreaNo: item.value, arriveAreaName: item.label})) + : arriveAreas.length && arriveAreas.map((item:any) => ({arriveAreaNo: item.value, arriveAreaName: item.label})); + + const params = { + expressChargeStandardId: id, + tradeCompId: tradeComp.value, + tradeCompName: tradeComp.label, + tradeCompShortName: compList && compList.filter(item => item.id == tradeComp.value)[0].shortName, + sendAreaNo: sendArea.value, + sendAreaName: sendArea.label, + firstWeight, + continuedWeight, + arriveAreas: _arriveAreas + }; + API.addStandardSave({ ...params }) + .then(res => { + message.success("操作成功"); + _onCancel(); + setLoading(false); + onRefresh(); + }).catch(err => { + message.error(err?.message); + setLoading(false); + }); + }; + /** + * @description: 关闭弹框 + * @param {*} + * @return {*} + */ + const _onCancel = () => { + onCancel && onCancel(); + form.resetFields(); + }; + + return ( + + +
+ + + + + + + + + + + + + + + +
+
+
+ ); +} + +export default AddModel; \ No newline at end of file diff --git a/src/pages/contract/ExpressChargingStandardSetting/components/Filter/index.tsx b/src/pages/contract/ExpressChargingStandardSetting/components/Filter/index.tsx new file mode 100644 index 0000000..d5f3db6 --- /dev/null +++ b/src/pages/contract/ExpressChargingStandardSetting/components/Filter/index.tsx @@ -0,0 +1,89 @@ +import React, { useCallback, useState } from "react"; +import { Row, Col, Select } from "antd"; +import _ from "lodash"; + +interface Props { + setParams:any; + innerParams:any; + cityList:any[]; + compList:BearCostSetting.Comp[]; +} + +interface SearchData { + tradeCompId?:number;//往来单位id + sendAreaNo?:string;//寄件地区编号 + arriveAreaNo?:string;//到达地区编号 +} + +function Filter({ compList, cityList, setParams, innerParams }:Props) { + const [searchData, setSearchData] = useState({}); + return ( + + + + + + + + + + + + ); +} + +export default Filter; \ No newline at end of file diff --git a/src/pages/contract/ExpressChargingStandardSetting/index.tsx b/src/pages/contract/ExpressChargingStandardSetting/index.tsx new file mode 100644 index 0000000..1a08992 --- /dev/null +++ b/src/pages/contract/ExpressChargingStandardSetting/index.tsx @@ -0,0 +1,149 @@ +import React, { useState } from "react"; +import { Button, Card, ConfigProvider, Divider, message, Popconfirm, Table } from "antd"; +import { PageHeaderWrapper } from "@ant-design/pro-layout"; +import zhCN from "antd/lib/locale-provider/zh_CN"; +import usePagination from "@/hooks/usePagination"; +import useInitial from "@/hooks/useInitail"; +import { PlusOutlined } from "@ant-design/icons"; +import AddModel from './components/AddModel'; +import Filter from './components/Filter'; +import * as API from './api'; +import _ from "lodash"; +import st from "./style.less"; + +interface Props { +} + +const { Column } = Table; + +function expressChargingStandard(props:Props) { + const [visible, setVisible] = useState(false); + const { + list: standardList, + loading, + paginationConfig, + innerParams, + setParams, + setLoading + } = usePagination(API.getStandardPage, {current: 1, pageSize: 10}); + const { data: cityList, loading: cityLoading } = useInitial(API.getCityLsit, [], {}); + const { data: compList, loading: compLoading } = useInitial(API.fetchComps, [], {types: '88'}); + const [row, setRow] = useState(); + /** + * @description: 编辑 + * @param {*} _ + * @return {*} + */ + const edit = _.debounce(async (row:API.Item) => { + await setRow({...row}); + setVisible(true); + }, 800); + + /** + * @description: 删除 + * @param {*} _ + * @return {*} + */ + const _delete = _.debounce((row:API.Item) => { + const {id} = row; + if (!id) return; + setLoading(true); + API.delStandard({expressChargeStandardId: id}) + .then(res => { + message.success("操作成功"); + setParams({...innerParams}, true); + setLoading(false); + }).catch(err => { + message.error(err?.message); + setLoading(false); + }); + }, 800); + + return ( + + + +
+ + +
+ `${item.id}`} + onChange={(_pagination) => setParams({ ..._pagination }, true)} + > + t || "-"} /> + t || '-'} /> + t || '-'} /> + t || '-'} /> + t || '-'} /> + ( + + edit(row)} okText="确定" cancelText="取消"> + { + e.preventDefault(); + }} + style={{ color: "#FAAD14" }} + > + 编辑 + + + + _delete(row)} okText="确定" cancelText="取消"> + { + e.preventDefault(); + }} + style={{ color: "red" }} + > + 删除 + + + + + )} + /> +
+ { + setVisible(false); + setRow(undefined); + }} + onRefresh={() => setParams({ ...innerParams }, true)} + /> +
+
+
+ ); +} + +export default expressChargingStandard; \ No newline at end of file diff --git a/src/pages/contract/ExpressChargingStandardSetting/style.less b/src/pages/contract/ExpressChargingStandardSetting/style.less new file mode 100644 index 0000000..e4df1e1 --- /dev/null +++ b/src/pages/contract/ExpressChargingStandardSetting/style.less @@ -0,0 +1,48 @@ +//@import '~antd/lib/style/themes/default.less'; + +.page { + position: relative; + + .header { + margin-bottom: 10px; + height: 32px; + display: flex; + flex-direction: row; + justify-content: space-between; + .add { + position: absolute; + right: 28px; + top: 24px; + z-index: 10; + } + } + + } + .table { + :global { + .ant-table table { + width: 100%; + border-collapse: collapse; + text-align: center; + border-radius: 4px 4px 0 0; + } + .ant-table-thead > tr > th, .ant-table-tbody > tr > td { + padding: 16px 16px; + word-break: break-word; + text-align: center; + -ms-word-break: break-all; + } + } + .cover { + align-items: center; + height: 68px; + img { + border-radius: 4%; + height: 100%; + width: auto; + min-width: 100px; + max-width: 100px; + } + } + } + \ No newline at end of file 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) { ))} - + {/* - + */} {/* 使用角色 */} - + */}