Commit 6861fe92ae76e6eaed41ec5f511697d05017a58b
Merge remote-tracking branch 'origin/master' into bug_fix
Showing
22 changed files
with
1257 additions
and
50 deletions
config/routers/contract.ts
... | ... | @@ -59,4 +59,12 @@ export default [ |
59 | 59 | path: "/contract/kt/itemamount/config", //事项款设置 |
60 | 60 | component: "./contract/ItemAmountSetting", |
61 | 61 | }, |
62 | + { | |
63 | + path: "/contract/kt/authorization/setting", //合同授权 | |
64 | + component: "./contract/AuthorizationSetting", | |
65 | + }, | |
66 | + { | |
67 | + path: "/contract/kt/expressChargingStandard/setting", //快递收费标准 | |
68 | + component: "./contract/ExpressChargingStandardSetting", | |
69 | + }, | |
62 | 70 | ]; | ... | ... |
config/routers/performance.ts
src/pages/contract/AuthorizationSetting/api.ts
0 → 100644
1 | +import { http } from "@/typing/http"; | |
2 | +import request from "@/utils/request"; | |
3 | +import qs from 'qs'; | |
4 | +import { CONTRACT_HOST, HOST } from "@/utils/host"; | |
5 | +import { Any } from "currency.js"; | |
6 | + | |
7 | +type PrResArr<T> = http.PromiseResp<T[]>; | |
8 | + | |
9 | +export interface Item { | |
10 | + id?:number, //授权ID | |
11 | + typeName?:string, //合同类型名称 | |
12 | + createTime?:number, //创建时间 | |
13 | + updateTime?:number, //更新时间 | |
14 | + enabled?:boolean, //是否启用 | |
15 | + roles?:Roles[],//授权角色 | |
16 | +} | |
17 | +export interface Roles { | |
18 | + roleCode?:string, //角色编码 | |
19 | + roleName?:string, //角色名称 | |
20 | +} | |
21 | +export interface TypesItem { | |
22 | + id?: number; // id | |
23 | + name?: string; | |
24 | + fixedAmount?: boolean; | |
25 | + contractableTradeCompCategories?: number[]; | |
26 | + feeType?: string; | |
27 | + feeTypeValue?: string; | |
28 | + bizType?: string; | |
29 | + bizTypeValue?: number; | |
30 | + subjectType?: string; | |
31 | + subjectTypeValue?: string; | |
32 | + servicePlaceTypes?: number[]; | |
33 | +} | |
34 | + | |
35 | +export interface PageParams { | |
36 | + current?: number; | |
37 | + pageSize?: number; | |
38 | + contractTypeName?:string //合同类型名称 | |
39 | +} | |
40 | +export interface SaveParams { | |
41 | + contractAuthId?: number; | |
42 | + typeId: number;//合同类型id | |
43 | + typeName:string //合同类型名称 | |
44 | + roles?:Roles[],//授权角色 | |
45 | +} | |
46 | +interface DelParams { | |
47 | + contractAuthId?: number; //合同授权id | |
48 | +} | |
49 | + | |
50 | +export interface DisableParams { | |
51 | + contractAuthId?: number;//合同授权id | |
52 | + enabled?: boolean;//是否启用 | |
53 | +} | |
54 | + | |
55 | +/** | |
56 | + * 查询所有角色列表 | |
57 | + */ | |
58 | +export function getAllRoleCodeApi(params: CommonApi.RoleParams): PrResArr<CommonApi.RoleCodeVO> { | |
59 | + return request.get(`${HOST}/role/listAll`, { params }); | |
60 | +} | |
61 | +/** | |
62 | + * 查询合同类型列表 | |
63 | + */ | |
64 | +export function getContractTypes(params: PageParams): http.PromisePageResp<TypesItem> { | |
65 | + return request.get(`${CONTRACT_HOST}/erp/contract/type/page`, { params }); | |
66 | +} | |
67 | + | |
68 | +/** | |
69 | + * 分页查询合同授权 | |
70 | + */ | |
71 | +export function getContractAuthPage(params?: PageParams): http.PromisePageResp<Item> { | |
72 | + return request.get(`${CONTRACT_HOST}/erp/contractAuth/page`, {params}); | |
73 | +} | |
74 | + | |
75 | +/** | |
76 | + * 新增合同授权/编辑合同授权 | |
77 | + */ | |
78 | +export function addContractAuth(params?: SaveParams): http.PromisePageResp<Any> { | |
79 | + return request.post(`${CONTRACT_HOST}/erp/contractAuth/save`, {...params}); | |
80 | +} | |
81 | + | |
82 | +/** | |
83 | + * 删除合同授权 | |
84 | + */ | |
85 | + export function delContractAuth(params?: DelParams): http.PromisePageResp<Any> { | |
86 | + return request.post(`${CONTRACT_HOST}/erp/contractAuth/delete`, {...params}); | |
87 | +} | |
88 | + | |
89 | +/** | |
90 | + * 启用或禁用 | |
91 | + */ | |
92 | + export function disableContractAuth(params?: DisableParams): http.PromisePageResp<Any> { | |
93 | + return request.post(`${CONTRACT_HOST}/erp/contractAuth/enableOrDisable`, {...params}); | |
94 | +} | |
0 | 95 | \ No newline at end of file | ... | ... |
src/pages/contract/AuthorizationSetting/components/AddModel/index.tsx
0 → 100644
1 | +import React, { useCallback, useEffect, useState } from "react"; | |
2 | +import { Modal, Skeleton, Select, Form, message } from "antd"; | |
3 | +import * as API from '../../api'; | |
4 | + | |
5 | +interface Props{ | |
6 | + visible:boolean; | |
7 | + row?:API.Item; | |
8 | + contractTypesList:any[], | |
9 | + roleList:any[], | |
10 | + onRefresh: () => void; | |
11 | + onCancel?: () => void; | |
12 | +} | |
13 | + | |
14 | +function AddModel({visible, row, contractTypesList, roleList, onCancel, onRefresh}:Props) { | |
15 | + const [form] = Form.useForm(); | |
16 | + const [loading, setLoading] = useState<boolean>(false); | |
17 | + const {id, roles, typeName } = row || {}; | |
18 | + useEffect(() => { | |
19 | + if (id) { | |
20 | + form.setFieldsValue({ | |
21 | + contractType: contractTypesList.filter((item:API.TypesItem) => item.name === typeName).map((i:any) => ({label: i.name, value: i.id}))[0], | |
22 | + roleCode: roles?.length && roles.map((i:any) => ({label: i.roleName, value: i.roleCode})), | |
23 | + }); | |
24 | + } | |
25 | + }, [row]); | |
26 | + | |
27 | + /** | |
28 | + * @description: 表单提交 | |
29 | + * @param {any} feildValue | |
30 | + * @return {*} | |
31 | + */ | |
32 | + const handleSave = (feildValue: any) => { | |
33 | + setLoading(true); | |
34 | + const { roleCode, contractType } = feildValue; | |
35 | + const _roleCode = roleCode.length && roleCode.map((item:any) => ({roleCode: item.value, roleName: item.label })); | |
36 | + const params = {roles: _roleCode, typeId: contractType.value, typeName: contractType.label }; | |
37 | + API.addContractAuth({ ...params, contractAuthId: id }) | |
38 | + .then(res => { | |
39 | + message.success("操作成功"); | |
40 | + _onCancel(); | |
41 | + setLoading(false); | |
42 | + onRefresh(); | |
43 | + }) | |
44 | + .catch(err => { | |
45 | + message.error(err?.message); | |
46 | + setLoading(false); | |
47 | + }); | |
48 | + }; | |
49 | + /** | |
50 | + * @description: 关闭弹框 | |
51 | + * @param {*} | |
52 | + * @return {*} | |
53 | + */ | |
54 | + const _onCancel = () => { | |
55 | + onCancel && onCancel(); | |
56 | + form.resetFields(); | |
57 | + }; | |
58 | + | |
59 | + return ( | |
60 | + <Modal | |
61 | + title={`${id ? '编辑':'新增'}合同授权`} | |
62 | + visible={visible} | |
63 | + confirmLoading={loading} | |
64 | + onCancel={_onCancel} | |
65 | + onOk={form.submit} | |
66 | + cancelButtonProps={{ hidden: true }} | |
67 | + width="50%" | |
68 | + bodyStyle={{minHeight: 300}} | |
69 | + > | |
70 | + <Skeleton | |
71 | + loading={false} | |
72 | + > | |
73 | + <Form form={form} onFinish={handleSave} wrapperCol={{ span: 18 }} labelCol={{ span: 4 }}> | |
74 | + <Form.Item | |
75 | + label="合同类型" | |
76 | + name="contractType" | |
77 | + rules={[{ required: true, message: '请选择合同类型' }]} | |
78 | + > | |
79 | + <Select | |
80 | + placeholder="请选择合同类型" | |
81 | + showSearch | |
82 | + allowClear | |
83 | + optionFilterProp="children" | |
84 | + labelInValue | |
85 | + onSelect={(it:any) => { | |
86 | + const item = contractTypesList.filter((i:any) => it.value === i.id); | |
87 | + }} | |
88 | + filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | |
89 | + > | |
90 | + { | |
91 | + contractTypesList && contractTypesList.map((item:any) => ( | |
92 | + <Select.Option value={item.id} key={item.id}> | |
93 | + {item.name} | |
94 | + </Select.Option> | |
95 | + )) | |
96 | + } | |
97 | + </Select> | |
98 | + </Form.Item> | |
99 | + <Form.Item | |
100 | + label="授权角色" | |
101 | + name="roleCode" | |
102 | + rules={[{ required: true, message: '请选择授权角色' }]} | |
103 | + > | |
104 | + <Select | |
105 | + placeholder="请选择授权角色(支持多选)" | |
106 | + mode="multiple" | |
107 | + showSearch | |
108 | + allowClear | |
109 | + showArrow | |
110 | + optionFilterProp="children" | |
111 | + labelInValue | |
112 | + onSelect={(it:any) => { | |
113 | + const item = roleList.filter((i:any) => it.value === i.roleCode); | |
114 | + }} | |
115 | + filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | |
116 | + > | |
117 | + { | |
118 | + roleList && roleList.map((item:any) => ( | |
119 | + <Select.Option value={item.roleCode} key={item.id}> | |
120 | + {item.roleName} | |
121 | + </Select.Option> | |
122 | + )) | |
123 | + } | |
124 | + </Select> | |
125 | + </Form.Item> | |
126 | + </Form> | |
127 | + </Skeleton> | |
128 | + </Modal> | |
129 | + ); | |
130 | +} | |
131 | + | |
132 | +export default AddModel; | |
0 | 133 | \ No newline at end of file | ... | ... |
src/pages/contract/AuthorizationSetting/components/Filter/index.tsx
0 → 100644
1 | +import React, { useCallback, useState } from "react"; | |
2 | +import { Row, Col, Select } from "antd"; | |
3 | +import * as common from "@/typing/common"; | |
4 | +import _ from "lodash"; | |
5 | +import * as API from '../../api'; | |
6 | + | |
7 | +interface Props{ | |
8 | + contractTypesList?:any[], | |
9 | + setParams:any, | |
10 | + innerParams?:any, | |
11 | +} | |
12 | + | |
13 | +function Filter({ contractTypesList, innerParams, setParams }:Props) { | |
14 | + const onChange = _.debounce((contractTypeName: string) => { | |
15 | + setParams({...innerParams, contractTypeName}, true); | |
16 | + }, 350); | |
17 | + return ( | |
18 | + <Row | |
19 | + style={{ display: 'flex', flex: 1 }} | |
20 | + > | |
21 | + <Col span={12}> | |
22 | + <Select | |
23 | + placeholder="请选择合同类型" | |
24 | + showSearch | |
25 | + optionFilterProp="children" | |
26 | + allowClear | |
27 | + style={{ width: 200 }} | |
28 | + onChange={(contractTypeName) => onChange(contractTypeName)} | |
29 | + > | |
30 | + { | |
31 | + contractTypesList && contractTypesList.map((item:any) => ( | |
32 | + <Select.Option value={item.name} key={item.id}> | |
33 | + {item.name} | |
34 | + </Select.Option> | |
35 | + )) | |
36 | + } | |
37 | + </Select> | |
38 | + </Col> | |
39 | + </Row> | |
40 | + ); | |
41 | +} | |
42 | + | |
43 | +export default Filter; | |
0 | 44 | \ No newline at end of file | ... | ... |
src/pages/contract/AuthorizationSetting/components/RolesModel/index.tsx
0 → 100644
1 | +import React, { useCallback, useEffect, useState } from "react"; | |
2 | +import { Modal, Form, message, Table } from "antd"; | |
3 | +import * as API from '../../api'; | |
4 | + | |
5 | +interface Props{ | |
6 | + visible:boolean; | |
7 | + roles?:API.Roles[]; | |
8 | + onRefresh: () => void; | |
9 | + onCancel?: () => void; | |
10 | +} | |
11 | +const { Column } = Table; | |
12 | + | |
13 | +function RolesModel({visible, roles, onRefresh, onCancel}:Props) { | |
14 | + return ( | |
15 | + <Modal | |
16 | + title="授权角色" | |
17 | + visible={visible} | |
18 | + onCancel={onCancel} | |
19 | + > | |
20 | + <Table | |
21 | + dataSource={roles} | |
22 | + rowKey={(item: API.Roles) => `${item.roleCode}`} | |
23 | + | |
24 | + > | |
25 | + <Column title="角色名称" width={200} dataIndex="roleName" render={(t) => t || "-"} /> | |
26 | + <Column title="角色编码" width={200} dataIndex="roleCode" render={(t) => t || "-"} /> | |
27 | + </Table> | |
28 | + </Modal> | |
29 | + ); | |
30 | +} | |
31 | + | |
32 | +export default RolesModel; | |
0 | 33 | \ No newline at end of file | ... | ... |
src/pages/contract/AuthorizationSetting/index.tsx
0 → 100644
1 | +import React, { useCallback, useState } from "react"; | |
2 | +import { Button, Card, ConfigProvider, Divider, Input, message, Popconfirm, Select, Table } from "antd"; | |
3 | +import { PageHeaderWrapper } from "@ant-design/pro-layout"; | |
4 | +import zhCN from "antd/lib/locale-provider/zh_CN"; | |
5 | +import usePagination from "@/hooks/usePagination"; | |
6 | +import useInitial from "@/hooks/useInitail"; | |
7 | +import { PlusOutlined } from "@ant-design/icons"; | |
8 | +import AddModel from './components/AddModel'; | |
9 | +import RolesModel from './components/RolesModel'; | |
10 | +import Filter from './components/Filter'; | |
11 | +import * as API from './api'; | |
12 | +import _ from "lodash"; | |
13 | +import moment from 'moment'; | |
14 | +import st from "./style.less"; | |
15 | + | |
16 | +const { Column } = Table; | |
17 | +function AuthorizationSetting() { | |
18 | + const [visible, setVisible] = useState<boolean>(false); | |
19 | + const [searchValue, setSearchValue] = useState<API.Item>({}); | |
20 | + const [rolesVisible, setRolesVisible] = useState<boolean>(false); | |
21 | + const [row, setRow] = useState<API.Item>(); | |
22 | + const [roles, setRoles] = useState<API.Roles[]>(); | |
23 | + const {data: roleList} = useInitial<CommonApi.RoleCodeVO[], any>(API.getAllRoleCodeApi, [], {}); | |
24 | + const { | |
25 | + list: authList, | |
26 | + paginationConfig, | |
27 | + loading, | |
28 | + innerParams, | |
29 | + setParams, | |
30 | + } = usePagination<API.Item>(API.getContractAuthPage, {current: 1, pageSize: 10}); | |
31 | + const { | |
32 | + list: contractTypesList, | |
33 | + } = usePagination<API.TypesItem>(API.getContractTypes, {current: 1, pageSize: 999}); | |
34 | + /** | |
35 | + * @description: 删除 | |
36 | + * @param {*} | |
37 | + * @return {*} | |
38 | + * | |
39 | + */ | |
40 | + const _delete = (row:API.Item) => { | |
41 | + const {id} =row; | |
42 | + API.delContractAuth({contractAuthId: id}) | |
43 | + .then((res) => { | |
44 | + message.success("操作成功"); | |
45 | + setParams({ ...innerParams }, true); | |
46 | + }) | |
47 | + .catch((e) => { | |
48 | + message.error(e.message); | |
49 | + }); | |
50 | + }; | |
51 | + | |
52 | + /** | |
53 | + * @description: 编辑 | |
54 | + * @param {API} row | |
55 | + * @return {*} | |
56 | + */ | |
57 | + const edit = async (row:API.Item) => { | |
58 | + await setRow(row); | |
59 | + setVisible(true); | |
60 | + }; | |
61 | + | |
62 | + /** | |
63 | + * @description: 禁用启用 | |
64 | + * @param {API} row | |
65 | + * @return {*} | |
66 | + */ | |
67 | + const handleDisable = (row:API.Item) => { | |
68 | + const { id, enabled } = row; | |
69 | + API.disableContractAuth({contractAuthId: id, enabled: !enabled}) | |
70 | + .then((res) => { | |
71 | + message.success("操作成功"); | |
72 | + setParams({ ...innerParams }, true); | |
73 | + }) | |
74 | + .catch((err) => { | |
75 | + message.error(err.message); | |
76 | + }); | |
77 | + }; | |
78 | + | |
79 | + const showRoles = async (row:API.Item) => { | |
80 | + const {roles} = row; | |
81 | + try { | |
82 | + await setRoles(roles); | |
83 | + } finally { | |
84 | + setRolesVisible(true); | |
85 | + } | |
86 | + }; | |
87 | + | |
88 | + return ( | |
89 | + <PageHeaderWrapper title="合同授权"> | |
90 | + <ConfigProvider locale={zhCN}> | |
91 | + <Card className={st.page}> | |
92 | + <div className={st.header}> | |
93 | + <Filter | |
94 | + contractTypesList={contractTypesList} | |
95 | + setParams={setParams} | |
96 | + innerParams={innerParams} | |
97 | + /> | |
98 | + <Button | |
99 | + type="primary" | |
100 | + icon={<PlusOutlined />} | |
101 | + onClick={() => { | |
102 | + setVisible(true); | |
103 | + }} | |
104 | + > | |
105 | + 新增 | |
106 | + </Button> | |
107 | + </div> | |
108 | + <Table | |
109 | + size="middle" | |
110 | + loading={loading} | |
111 | + dataSource={authList} | |
112 | + pagination={{ ...paginationConfig }} | |
113 | + scroll={{ y: 800 }} | |
114 | + rowKey={(item: API.Item) => `${item.id}`} | |
115 | + onChange={(_pagination) => setParams({ ..._pagination }, true)} | |
116 | + > | |
117 | + <Column title="合同类型" width={200} dataIndex="typeName" render={(t) => t || "-"} /> | |
118 | + <Column | |
119 | + title="授权角色" | |
120 | + width={200} | |
121 | + dataIndex="id" | |
122 | + render={(text, row:API.Item) => ( | |
123 | + <Button | |
124 | + type="link" | |
125 | + onClick={() => showRoles(row)} | |
126 | + > | |
127 | + 查看 | |
128 | + </Button> | |
129 | + )} | |
130 | + /> | |
131 | + <Column title="状态" width={200} dataIndex="enabled" render={(t) => (t?'启用':'禁用')} /> | |
132 | + {/* <Column title="创建时间" width={200} dataIndex="createTime" render={(t) => (t ? moment(t).format('YYYY-MM-DD HH:mm') : "-")} /> | |
133 | + <Column title="更新时间" width={200} dataIndex="updateTime" render={(t) => (t ? moment(t).format('YYYY-MM-DD HH:mm') : "-")} /> */} | |
134 | + <Column | |
135 | + title="操作" | |
136 | + width={100} | |
137 | + dataIndex="unit" | |
138 | + render={(text, row:API.Item) => ( | |
139 | + <span> | |
140 | + <Popconfirm title={`是否${row.enabled ? "禁用?":"启用?"}`} onConfirm={() => handleDisable(row)} okText="确定" cancelText="取消"> | |
141 | + <a | |
142 | + onClick={(e) => { | |
143 | + e.preventDefault(); | |
144 | + }} | |
145 | + style={{ color: "#FAAD14" }} | |
146 | + > | |
147 | + {`${row.enabled ? '禁用' :'启用'}`} | |
148 | + </a> | |
149 | + </Popconfirm> | |
150 | + <Divider type="vertical" /> | |
151 | + <Popconfirm title="是否编辑?" onConfirm={() => edit(row)} okText="确定" cancelText="取消"> | |
152 | + <a | |
153 | + onClick={(e) => { | |
154 | + e.preventDefault(); | |
155 | + }} | |
156 | + style={{ color: "#FAAD14" }} | |
157 | + > | |
158 | + 编辑 | |
159 | + </a> | |
160 | + </Popconfirm> | |
161 | + <Divider type="vertical" /> | |
162 | + <Popconfirm title="是否删除?" onConfirm={() => _delete(row)} okText="确定" cancelText="取消"> | |
163 | + <a | |
164 | + onClick={(e) => { | |
165 | + e.preventDefault(); | |
166 | + }} | |
167 | + style={{ color: "red" }} | |
168 | + > | |
169 | + 删除 | |
170 | + </a> | |
171 | + </Popconfirm> | |
172 | + </span> | |
173 | + | |
174 | + )} | |
175 | + /> | |
176 | + </Table> | |
177 | + <AddModel | |
178 | + visible={visible} | |
179 | + contractTypesList={contractTypesList} | |
180 | + roleList={roleList} | |
181 | + row={row} | |
182 | + onCancel={() => { | |
183 | + setVisible(false); | |
184 | + setRow(undefined); | |
185 | + }} | |
186 | + onRefresh={() => setParams({ ...innerParams }, true)} | |
187 | + /> | |
188 | + <RolesModel | |
189 | + visible={rolesVisible} | |
190 | + roles={roles} | |
191 | + onCancel={() => { | |
192 | + setRolesVisible(false); | |
193 | + setRoles(undefined); | |
194 | + }} | |
195 | + onRefresh={() => setParams({ ...innerParams }, true)} | |
196 | + /> | |
197 | + </Card> | |
198 | + </ConfigProvider> | |
199 | + </PageHeaderWrapper> | |
200 | + ); | |
201 | +} | |
202 | +export default AuthorizationSetting; | ... | ... |
src/pages/contract/AuthorizationSetting/style.css
0 → 100644
1 | +.page { | |
2 | + position: relative; | |
3 | +} | |
4 | +.page .header { | |
5 | + margin-bottom: 10px; | |
6 | + height: 32px; | |
7 | + display: flex; | |
8 | + flex-direction: row; | |
9 | + justify-content: space-between; | |
10 | +} | |
11 | +.page .header .add { | |
12 | + position: absolute; | |
13 | + right: 28px; | |
14 | + top: 24px; | |
15 | + z-index: 10; | |
16 | +} | |
17 | +.table :global .ant-table table { | |
18 | + width: 100%; | |
19 | + border-collapse: collapse; | |
20 | + text-align: center; | |
21 | + border-radius: 4px 4px 0 0; | |
22 | +} | |
23 | +.table :global .ant-table-thead > tr > th, | |
24 | +.table :global .ant-table-tbody > tr > td { | |
25 | + padding: 16px 16px; | |
26 | + word-break: break-word; | |
27 | + text-align: center; | |
28 | + -ms-word-break: break-all; | |
29 | +} | |
30 | +.table .cover { | |
31 | + align-items: center; | |
32 | + height: 68px; | |
33 | +} | |
34 | +.table .cover img { | |
35 | + border-radius: 4%; | |
36 | + height: 100%; | |
37 | + width: auto; | |
38 | + min-width: 100px; | |
39 | + max-width: 100px; | |
40 | +} | ... | ... |
src/pages/contract/AuthorizationSetting/style.less
0 → 100644
1 | +//@import '~antd/lib/style/themes/default.less'; | |
2 | + | |
3 | +.page { | |
4 | + position: relative; | |
5 | + | |
6 | + .header { | |
7 | + margin-bottom: 10px; | |
8 | + height: 32px; | |
9 | + display: flex; | |
10 | + flex-direction: row; | |
11 | + justify-content: space-between; | |
12 | + .add { | |
13 | + position: absolute; | |
14 | + right: 28px; | |
15 | + top: 24px; | |
16 | + z-index: 10; | |
17 | + } | |
18 | + } | |
19 | + | |
20 | + } | |
21 | + .table { | |
22 | + :global { | |
23 | + .ant-table table { | |
24 | + width: 100%; | |
25 | + border-collapse: collapse; | |
26 | + text-align: center; | |
27 | + border-radius: 4px 4px 0 0; | |
28 | + } | |
29 | + .ant-table-thead > tr > th, .ant-table-tbody > tr > td { | |
30 | + padding: 16px 16px; | |
31 | + word-break: break-word; | |
32 | + text-align: center; | |
33 | + -ms-word-break: break-all; | |
34 | + } | |
35 | + } | |
36 | + .cover { | |
37 | + align-items: center; | |
38 | + height: 68px; | |
39 | + img { | |
40 | + border-radius: 4%; | |
41 | + height: 100%; | |
42 | + width: auto; | |
43 | + min-width: 100px; | |
44 | + max-width: 100px; | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + | |
0 | 49 | \ No newline at end of file | ... | ... |
src/pages/contract/ExpressChargingStandardSetting/api.ts
0 → 100644
1 | +import { http } from "@/typing/http"; | |
2 | +import request from "@/utils/request"; | |
3 | +import qs from 'qs'; | |
4 | +import { CONTRACT_HOST, HOST, FINANCE2_HOST } from "@/utils/host"; | |
5 | +import { Any } from "currency.js"; | |
6 | + | |
7 | +type PrResArr<T> = http.PromiseResp<T[]>; | |
8 | + | |
9 | +export interface PageParams { | |
10 | + current?: number; | |
11 | + pageSize?: number; | |
12 | + tradeCompId?:number; //合同类型名称 | |
13 | + sendAreaNo?:string; //寄件地区编号 | |
14 | + arriveAreaNo?:string; //到达地区编号 | |
15 | +} | |
16 | + | |
17 | +export interface SaveParams { | |
18 | + expressChargeStandardId?:number; //id,提供该参数将执行编辑操作 | |
19 | + tradeCompId:number; //往来单位id | |
20 | + tradeCompName:string; //往来单位名称 | |
21 | + sendAreaNo:string; //寄件地区编号 | |
22 | + sendAreaName:string; //寄件地区名称 | |
23 | + firstWeight:number; //首重 | |
24 | + continuedWeight:number; //续重 | |
25 | + arriveAreas:ArriveAreas[]; //到达地区 | |
26 | +} | |
27 | + | |
28 | +export interface DelParams { | |
29 | + expressChargeStandardId:number; //快递收费标准id | |
30 | +} | |
31 | + | |
32 | +export interface ArriveAreas { | |
33 | + arriveAreaNo:string; //到达地区编号 | |
34 | + arriveAreaName:string; //到达地区名称 | |
35 | +} | |
36 | + | |
37 | +export interface Item { | |
38 | + id?:number; | |
39 | + tradeCompName?:string; //往来单位名称 | |
40 | + tradeCompShortName?:string; //往来单位简称 | |
41 | + sendAreaName?:string; //寄件地区名称 | |
42 | + arriveAreaName?:string; //到达地区名称 | |
43 | + firstWeight?:number; //首重 | |
44 | + continuedWeight?:number; //续重 | |
45 | +} | |
46 | + | |
47 | +/** | |
48 | + * 分页查询快递收费标准 | |
49 | + */ | |
50 | + export function getStandardPage(params?: PageParams): http.PromisePageResp<Item> { | |
51 | + return request.get(`${CONTRACT_HOST}/erp/express/charge/standard/page`, { params }); | |
52 | +} | |
53 | + | |
54 | +/** | |
55 | + * 新增/编辑快递收费标准 | |
56 | + */ | |
57 | + export function addStandardSave(params: SaveParams): http.PromiseResp<any> { | |
58 | + return request.post(`${CONTRACT_HOST}/erp/express/charge/standard/save`, { ...params }); | |
59 | +} | |
60 | + | |
61 | +/** | |
62 | + * 删除快递收费标准 | |
63 | + */ | |
64 | + export function delStandard(params: DelParams): http.PromiseResp<void> { | |
65 | + return request.post(`${CONTRACT_HOST}/erp/express/charge/standard/delete`, { ...params }); | |
66 | +} | |
67 | + | |
68 | +/**获取往来单位列表*/ | |
69 | +export function fetchComps(params?: any): http.PromiseResp<BearCostSetting.Comp[]> { | |
70 | + return request.get(`${FINANCE2_HOST}/common/trade/company/list`, {params }); | |
71 | +} | |
72 | + | |
73 | +/** | |
74 | + * 城市列表 | |
75 | + */ | |
76 | + export function getCityLsit(): http.PromiseResp<any> { | |
77 | + const params = { pbh: 0 }; | |
78 | + return request.get(`/oop/select/region`, { params }); | |
79 | +} | |
0 | 80 | \ No newline at end of file | ... | ... |
src/pages/contract/ExpressChargingStandardSetting/components/AddModel/index.tsx
0 → 100644
1 | +import React, { useCallback, useEffect, useState } from "react"; | |
2 | +import { Modal, Skeleton, Select, Form, message, InputNumber } from "antd"; | |
3 | +import * as API from '../../api'; | |
4 | +import _ from "lodash"; | |
5 | + | |
6 | +interface Props { | |
7 | + visible:boolean; | |
8 | + row?:API.Item; | |
9 | + compList:any[]; | |
10 | + cityList:any[]; | |
11 | + onCancel:()=>void; | |
12 | + onRefresh:() => void; | |
13 | + | |
14 | +} | |
15 | + | |
16 | +function AddModel({visible, row, compList, cityList, onCancel, onRefresh}:Props) { | |
17 | + const [form] = Form.useForm(); | |
18 | + const [loading, setLoading] = useState<boolean>(false); | |
19 | + const { id } = row || {}; | |
20 | + useEffect(() => { | |
21 | + if (id) { | |
22 | + const { tradeCompName, sendAreaName, firstWeight, continuedWeight, arriveAreaName } = row || {}; | |
23 | + form.setFieldsValue({ | |
24 | + tradeComp: compList.filter(it => tradeCompName === it.name).map(item => ({value: item.id, label: item.name}))[0], | |
25 | + sendArea: cityList.filter(it => sendAreaName === it.fullName).map(item => ({value: item.bh, label: item.fullName}))[0], | |
26 | + firstWeight, | |
27 | + continuedWeight, | |
28 | + arriveAreas: cityList.filter(it => arriveAreaName === it.fullName).map(item => ({value: item.bh, label: item.fullName}))[0] | |
29 | + | |
30 | + }); | |
31 | + } | |
32 | + }, [row]); | |
33 | + | |
34 | + /** | |
35 | + * @description: 确定 | |
36 | + * @param {*} | |
37 | + * @return {*} | |
38 | + */ | |
39 | + const handleSave = (feildValue:any) => { | |
40 | + setLoading(true); | |
41 | + const {tradeComp, sendArea, arriveAreas, firstWeight, continuedWeight} = feildValue; | |
42 | + const _arriveAreas = id ? [{ ...arriveAreas }].map(item => ({arriveAreaNo: item.value, arriveAreaName: item.label})) | |
43 | + : arriveAreas.length && arriveAreas.map((item:any) => ({arriveAreaNo: item.value, arriveAreaName: item.label})); | |
44 | + | |
45 | + const params = { | |
46 | + expressChargeStandardId: id, | |
47 | + tradeCompId: tradeComp.value, | |
48 | + tradeCompName: tradeComp.label, | |
49 | + tradeCompShortName: compList && compList.filter(item => item.id == tradeComp.value)[0].shortName, | |
50 | + sendAreaNo: sendArea.value, | |
51 | + sendAreaName: sendArea.label, | |
52 | + firstWeight, | |
53 | + continuedWeight, | |
54 | + arriveAreas: _arriveAreas | |
55 | + }; | |
56 | + API.addStandardSave({ ...params }) | |
57 | + .then(res => { | |
58 | + message.success("操作成功"); | |
59 | + _onCancel(); | |
60 | + setLoading(false); | |
61 | + onRefresh(); | |
62 | + }).catch(err => { | |
63 | + message.error(err?.message); | |
64 | + setLoading(false); | |
65 | + }); | |
66 | + }; | |
67 | + /** | |
68 | + * @description: 关闭弹框 | |
69 | + * @param {*} | |
70 | + * @return {*} | |
71 | + */ | |
72 | + const _onCancel = () => { | |
73 | + onCancel && onCancel(); | |
74 | + form.resetFields(); | |
75 | + }; | |
76 | + | |
77 | + return ( | |
78 | + <Modal | |
79 | + title={`${id ? '编辑':'新增'}快递收费标准`} | |
80 | + visible={visible} | |
81 | + confirmLoading={loading} | |
82 | + onCancel={_onCancel} | |
83 | + onOk={form.submit} | |
84 | + cancelButtonProps={{ hidden: true }} | |
85 | + width="50%" | |
86 | + bodyStyle={{minHeight: 300}} | |
87 | + > | |
88 | + <Skeleton loading={false}> | |
89 | + <Form form={form} onFinish={handleSave} wrapperCol={{ span: 18 }} labelCol={{ span: 4 }}> | |
90 | + <Form.Item | |
91 | + label="快递公司" | |
92 | + name="tradeComp" | |
93 | + rules={[{required: true, message: '请选择快递公司'}]} | |
94 | + > | |
95 | + <Select | |
96 | + placeholder="请选择快递公司" | |
97 | + showSearch | |
98 | + allowClear | |
99 | + optionFilterProp="children" | |
100 | + labelInValue | |
101 | + onSelect={(it:any) => { | |
102 | + const item = compList.filter((i:any) => it.value === i.id); | |
103 | + }} | |
104 | + filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | |
105 | + > | |
106 | + { | |
107 | + compList.map(item => ( | |
108 | + <Select.Option value={item.id} key={item.id}> | |
109 | + {item.name} | |
110 | + </Select.Option> | |
111 | + )) | |
112 | + } | |
113 | + </Select> | |
114 | + </Form.Item> | |
115 | + <Form.Item | |
116 | + label="寄件地区" | |
117 | + name="sendArea" | |
118 | + rules={[{required: true, message: '请选择寄件地区'}]} | |
119 | + > | |
120 | + <Select | |
121 | + placeholder="请选择寄件地区" | |
122 | + showSearch | |
123 | + allowClear | |
124 | + optionFilterProp="children" | |
125 | + labelInValue | |
126 | + onSelect={(it:any) => { | |
127 | + const item = cityList.filter((i:any) => it.value === i.id); | |
128 | + }} | |
129 | + filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | |
130 | + > | |
131 | + { | |
132 | + cityList.map(item => ( | |
133 | + <Select.Option value={item.bh} key={item.bh}> | |
134 | + {item.fullName} | |
135 | + </Select.Option> | |
136 | + )) | |
137 | + } | |
138 | + </Select> | |
139 | + </Form.Item> | |
140 | + <Form.Item | |
141 | + label="到达地区" | |
142 | + name="arriveAreas" | |
143 | + rules={[{required: true, message: '请选择到达地区'}]} | |
144 | + > | |
145 | + <Select | |
146 | + placeholder={`请选择到达地区${id ? '' : '(支持多选)'}`} | |
147 | + mode={id ? undefined : 'multiple'} | |
148 | + showSearch | |
149 | + allowClear | |
150 | + showArrow | |
151 | + optionFilterProp="children" | |
152 | + labelInValue | |
153 | + onSelect={(it:any) => { | |
154 | + const item = cityList.filter((i:any) => it.value === i.id); | |
155 | + }} | |
156 | + filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | |
157 | + > | |
158 | + { | |
159 | + cityList.map(item => ( | |
160 | + <Select.Option value={item.bh} key={item.bh}> | |
161 | + {item.fullName} | |
162 | + </Select.Option> | |
163 | + )) | |
164 | + } | |
165 | + </Select> | |
166 | + </Form.Item> | |
167 | + <Form.Item | |
168 | + label="首重" | |
169 | + name="firstWeight" | |
170 | + rules={[{required: true, message: '请填写首重'}]} | |
171 | + > | |
172 | + <InputNumber placeholder="请填写" addonAfter="元" max={100000000} min={0} precision={2} /> | |
173 | + </Form.Item> | |
174 | + <Form.Item | |
175 | + label="续重" | |
176 | + name="continuedWeight" | |
177 | + rules={[{required: true, message: '请填写续重'}]} | |
178 | + > | |
179 | + <InputNumber placeholder="请填写" addonAfter="元/kg" max={100000000} min={0} precision={2} /> | |
180 | + </Form.Item> | |
181 | + </Form> | |
182 | + </Skeleton> | |
183 | + </Modal> | |
184 | + ); | |
185 | +} | |
186 | + | |
187 | +export default AddModel; | |
0 | 188 | \ No newline at end of file | ... | ... |
src/pages/contract/ExpressChargingStandardSetting/components/Filter/index.tsx
0 → 100644
1 | +import React, { useCallback, useState } from "react"; | |
2 | +import { Row, Col, Select } from "antd"; | |
3 | +import _ from "lodash"; | |
4 | + | |
5 | +interface Props { | |
6 | + setParams:any; | |
7 | + innerParams:any; | |
8 | + cityList:any[]; | |
9 | + compList:BearCostSetting.Comp[]; | |
10 | +} | |
11 | + | |
12 | +interface SearchData { | |
13 | + tradeCompId?:number;//往来单位id | |
14 | + sendAreaNo?:string;//寄件地区编号 | |
15 | + arriveAreaNo?:string;//到达地区编号 | |
16 | +} | |
17 | + | |
18 | +function Filter({ compList, cityList, setParams, innerParams }:Props) { | |
19 | + const [searchData, setSearchData] = useState<SearchData>({}); | |
20 | + return ( | |
21 | + <Row style={{flex: 1}}> | |
22 | + <Col span={8} style={{marginRight: 10}}> | |
23 | + <Select | |
24 | + placeholder="请选择快递公司" | |
25 | + showSearch | |
26 | + optionFilterProp="children" | |
27 | + allowClear | |
28 | + style={{ minWidth: 260, maxWidth: 280 }} | |
29 | + onChange={(tradeCompId) => { | |
30 | + setSearchData({...searchData, tradeCompId}); | |
31 | + setParams({...innerParams, ...searchData, tradeCompId}, true); | |
32 | + }} | |
33 | + > | |
34 | + { | |
35 | + compList.map(item => ( | |
36 | + <Select.Option value={item.id} key={item.id}> | |
37 | + {item.name} | |
38 | + </Select.Option> | |
39 | + )) | |
40 | + } | |
41 | + </Select> | |
42 | + </Col> | |
43 | + <Col span={6} style={{marginRight: 10}}> | |
44 | + <Select | |
45 | + placeholder="请选择寄件地区" | |
46 | + showSearch | |
47 | + optionFilterProp="children" | |
48 | + allowClear | |
49 | + style={{ width: 200 }} | |
50 | + onChange={(sendAreaNo) => { | |
51 | + setSearchData({...searchData, sendAreaNo}); | |
52 | + setParams({...innerParams, ...searchData, sendAreaNo}, true); | |
53 | + }} | |
54 | + > | |
55 | + { | |
56 | + cityList.map(item => ( | |
57 | + <Select.Option value={item.bh} key={item.bh}> | |
58 | + {item.fullName} | |
59 | + </Select.Option> | |
60 | + )) | |
61 | + } | |
62 | + </Select> | |
63 | + </Col> | |
64 | + <Col span={6} style={{marginRight: 10}}> | |
65 | + <Select | |
66 | + placeholder="请选择到达地区" | |
67 | + showSearch | |
68 | + optionFilterProp="children" | |
69 | + allowClear | |
70 | + style={{ width: 200 }} | |
71 | + onChange={(arriveAreaNo) => { | |
72 | + setSearchData({...searchData, arriveAreaNo}); | |
73 | + setParams({...innerParams, ...searchData, arriveAreaNo}, true); | |
74 | + }} | |
75 | + > | |
76 | + { | |
77 | + cityList.map(item => ( | |
78 | + <Select.Option value={item.bh} key={item.bh}> | |
79 | + {item.fullName} | |
80 | + </Select.Option> | |
81 | + )) | |
82 | + } | |
83 | + </Select> | |
84 | + </Col> | |
85 | + </Row> | |
86 | + ); | |
87 | +} | |
88 | + | |
89 | +export default Filter; | |
0 | 90 | \ No newline at end of file | ... | ... |
src/pages/contract/ExpressChargingStandardSetting/index.tsx
0 → 100644
1 | +import React, { useState } from "react"; | |
2 | +import { Button, Card, ConfigProvider, Divider, message, Popconfirm, Table } from "antd"; | |
3 | +import { PageHeaderWrapper } from "@ant-design/pro-layout"; | |
4 | +import zhCN from "antd/lib/locale-provider/zh_CN"; | |
5 | +import usePagination from "@/hooks/usePagination"; | |
6 | +import useInitial from "@/hooks/useInitail"; | |
7 | +import { PlusOutlined } from "@ant-design/icons"; | |
8 | +import AddModel from './components/AddModel'; | |
9 | +import Filter from './components/Filter'; | |
10 | +import * as API from './api'; | |
11 | +import _ from "lodash"; | |
12 | +import st from "./style.less"; | |
13 | + | |
14 | +interface Props { | |
15 | +} | |
16 | + | |
17 | +const { Column } = Table; | |
18 | + | |
19 | +function expressChargingStandard(props:Props) { | |
20 | + const [visible, setVisible] = useState<boolean>(false); | |
21 | + const { | |
22 | + list: standardList, | |
23 | + loading, | |
24 | + paginationConfig, | |
25 | + innerParams, | |
26 | + setParams, | |
27 | + setLoading | |
28 | + } = usePagination<API.Item>(API.getStandardPage, {current: 1, pageSize: 10}); | |
29 | + const { data: cityList, loading: cityLoading } = useInitial(API.getCityLsit, [], {}); | |
30 | + const { data: compList, loading: compLoading } = useInitial(API.fetchComps, [], {types: '88'}); | |
31 | + const [row, setRow] = useState<API.Item>(); | |
32 | + /** | |
33 | + * @description: 编辑 | |
34 | + * @param {*} _ | |
35 | + * @return {*} | |
36 | + */ | |
37 | + const edit = _.debounce(async (row:API.Item) => { | |
38 | + await setRow({...row}); | |
39 | + setVisible(true); | |
40 | + }, 800); | |
41 | + | |
42 | + /** | |
43 | + * @description: 删除 | |
44 | + * @param {*} _ | |
45 | + * @return {*} | |
46 | + */ | |
47 | + const _delete = _.debounce((row:API.Item) => { | |
48 | + const {id} = row; | |
49 | + if (!id) return; | |
50 | + setLoading(true); | |
51 | + API.delStandard({expressChargeStandardId: id}) | |
52 | + .then(res => { | |
53 | + message.success("操作成功"); | |
54 | + setParams({...innerParams}, true); | |
55 | + setLoading(false); | |
56 | + }).catch(err => { | |
57 | + message.error(err?.message); | |
58 | + setLoading(false); | |
59 | + }); | |
60 | + }, 800); | |
61 | + | |
62 | + return ( | |
63 | + <PageHeaderWrapper | |
64 | + loading={cityLoading || compLoading} | |
65 | + title="快递收费标准配置" | |
66 | + > | |
67 | + <ConfigProvider locale={zhCN}> | |
68 | + <Card className={st.page}> | |
69 | + <div className={st.header}> | |
70 | + <Filter | |
71 | + cityList={cityList || []} | |
72 | + compList={compList || []} | |
73 | + setParams={setParams} | |
74 | + innerParams={innerParams} | |
75 | + /> | |
76 | + <Button | |
77 | + type="primary" | |
78 | + icon={<PlusOutlined />} | |
79 | + onClick={() => { | |
80 | + setVisible(true); | |
81 | + }} | |
82 | + > | |
83 | + 新增 | |
84 | + </Button> | |
85 | + </div> | |
86 | + <Table | |
87 | + size="middle" | |
88 | + loading={loading} | |
89 | + dataSource={standardList} | |
90 | + pagination={{ ...paginationConfig }} | |
91 | + scroll={{ y: 800 }} | |
92 | + rowKey={(item: API.Item) => `${item.id}`} | |
93 | + onChange={(_pagination) => setParams({ ..._pagination }, true)} | |
94 | + > | |
95 | + <Column title="快递公司" width={200} dataIndex="tradeCompName" render={(t:any) => t || "-"} /> | |
96 | + <Column title="寄件地区" width={200} dataIndex="sendAreaName" render={(t:any) => t || '-'} /> | |
97 | + <Column title="到达地区" width={200} dataIndex="arriveAreaName" render={(t:any) => t || '-'} /> | |
98 | + <Column title="首重(元)" width={200} dataIndex="firstWeight" render={(t:any) => t || '-'} /> | |
99 | + <Column title="续重(元/kg)" width={200} dataIndex="continuedWeight" render={(t:any) => t || '-'} /> | |
100 | + <Column | |
101 | + title="操作" | |
102 | + width={100} | |
103 | + dataIndex="unit" | |
104 | + render={(text, row:API.Item) => ( | |
105 | + <span> | |
106 | + <Popconfirm title="是否编辑?" onConfirm={() => edit(row)} okText="确定" cancelText="取消"> | |
107 | + <a | |
108 | + onClick={(e) => { | |
109 | + e.preventDefault(); | |
110 | + }} | |
111 | + style={{ color: "#FAAD14" }} | |
112 | + > | |
113 | + 编辑 | |
114 | + </a> | |
115 | + </Popconfirm> | |
116 | + <Divider type="vertical" /> | |
117 | + <Popconfirm title="是否删除?" onConfirm={() => _delete(row)} okText="确定" cancelText="取消"> | |
118 | + <a | |
119 | + onClick={(e) => { | |
120 | + e.preventDefault(); | |
121 | + }} | |
122 | + style={{ color: "red" }} | |
123 | + > | |
124 | + 删除 | |
125 | + </a> | |
126 | + </Popconfirm> | |
127 | + </span> | |
128 | + | |
129 | + )} | |
130 | + /> | |
131 | + </Table> | |
132 | + <AddModel | |
133 | + visible={visible} | |
134 | + row={row} | |
135 | + compList={compList || []} | |
136 | + cityList={cityList || []} | |
137 | + onCancel={() => { | |
138 | + setVisible(false); | |
139 | + setRow(undefined); | |
140 | + }} | |
141 | + onRefresh={() => setParams({ ...innerParams }, true)} | |
142 | + /> | |
143 | + </Card> | |
144 | + </ConfigProvider> | |
145 | + </PageHeaderWrapper> | |
146 | + ); | |
147 | +} | |
148 | + | |
149 | +export default expressChargingStandard; | |
0 | 150 | \ No newline at end of file | ... | ... |
src/pages/contract/ExpressChargingStandardSetting/style.less
0 → 100644
1 | +//@import '~antd/lib/style/themes/default.less'; | |
2 | + | |
3 | +.page { | |
4 | + position: relative; | |
5 | + | |
6 | + .header { | |
7 | + margin-bottom: 10px; | |
8 | + height: 32px; | |
9 | + display: flex; | |
10 | + flex-direction: row; | |
11 | + justify-content: space-between; | |
12 | + .add { | |
13 | + position: absolute; | |
14 | + right: 28px; | |
15 | + top: 24px; | |
16 | + z-index: 10; | |
17 | + } | |
18 | + } | |
19 | + | |
20 | + } | |
21 | + .table { | |
22 | + :global { | |
23 | + .ant-table table { | |
24 | + width: 100%; | |
25 | + border-collapse: collapse; | |
26 | + text-align: center; | |
27 | + border-radius: 4px 4px 0 0; | |
28 | + } | |
29 | + .ant-table-thead > tr > th, .ant-table-tbody > tr > td { | |
30 | + padding: 16px 16px; | |
31 | + word-break: break-word; | |
32 | + text-align: center; | |
33 | + -ms-word-break: break-all; | |
34 | + } | |
35 | + } | |
36 | + .cover { | |
37 | + align-items: center; | |
38 | + height: 68px; | |
39 | + img { | |
40 | + border-radius: 4%; | |
41 | + height: 100%; | |
42 | + width: auto; | |
43 | + min-width: 100px; | |
44 | + max-width: 100px; | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + | |
0 | 49 | \ No newline at end of file | ... | ... |
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<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 "@/pages/performance/entity"; |
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) => { |
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) => { |
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) => { |
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 () => { |
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 () => { |
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 () => { |
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 () => { |
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 () => { |
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 () => { |
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 () => { |
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 }} | ... | ... |