Commit d82a05ba7ef071e4f21ace8f08f2a398bc15376f
Merge remote-tracking branch 'origin/master' into todo_f
Showing
29 changed files
with
1117 additions
and
295 deletions
config/routers/crm_new.ts
... | ... | @@ -77,4 +77,8 @@ export default [ |
77 | 77 | path: '/crm/threePartyPlatformClue', // 三方平台线索配置 |
78 | 78 | component: './crm_new/ThreePartyPlatformClue', |
79 | 79 | }, |
80 | + { | |
81 | + path: '/crm/closeClue', // 暂停区域线索站岗分配 | |
82 | + component: './crm_new/Settings/subpages/CloseClue', | |
83 | + }, | |
80 | 84 | ]; |
81 | 85 | \ No newline at end of file | ... | ... |
config/routers/finance.ts
... | ... | @@ -24,6 +24,10 @@ export default [ |
24 | 24 | component: "finance/CompanyRelationAuth", |
25 | 25 | }, |
26 | 26 | { |
27 | + path: "/finance2/companyRelationAuth/create", //往来单位关系设置==》新增 | |
28 | + component: "finance/CompanyRelationCreate", | |
29 | + }, | |
30 | + { | |
27 | 31 | path: "/finance2/specialAccountSetting/deductAccount", //划扣专用账户 |
28 | 32 | component: "./finance/SpecialAccount/DeductAccount", |
29 | 33 | }, | ... | ... |
src/pages/admin/Role/components/RoleFilter.tsx
... | ... | @@ -24,7 +24,14 @@ export default function RoleFilter() { |
24 | 24 | <RadioButton value={0}>禁用</RadioButton> |
25 | 25 | {/* <RadioButton value={-1}>已删除</RadioButton> */} |
26 | 26 | </RadioGroup> |
27 | - <Select allowClear placeholder="请选择系统" style={{ width: 200, marginRight: 10, marginBottom: 10 }} onChange={sysId => setParams({ ...innerParams, sysId, current: 1 }, true)}> | |
27 | + <Select | |
28 | + allowClear | |
29 | + showSearch | |
30 | + optionFilterProp="children" | |
31 | + placeholder="请选择系统" | |
32 | + style={{ width: 200, marginRight: 10, marginBottom: 10 }} | |
33 | + onChange={sysId => setParams({ ...innerParams, sysId, current: 1 }, true)} | |
34 | + > | |
28 | 35 | {(systems || []).map((i: Privilege.SystemListVO) => (<Option value={i.id || 0} key={i.id}>{i.sysName || '--'}</Option>))} |
29 | 36 | </Select> |
30 | 37 | <Search | ... | ... |
src/pages/admin/Role/components/RoleList.tsx
... | ... | @@ -37,8 +37,7 @@ export default function RoleList() { |
37 | 37 | message.success(record.status ? "禁用成功" : "启用成功") |
38 | 38 | const tempList = list.map((item: any) => { |
39 | 39 | if (item.id === record.id) { |
40 | - item.status = record.status === 0 ? 1 : 0 | |
41 | - return item; | |
40 | + return { ...item, status: record.status === 0 ? 1 : 0 }; | |
42 | 41 | } |
43 | 42 | return item; |
44 | 43 | }); | ... | ... |
src/pages/admin/RoleManagementGroup/components/Modal.tsx
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * @Author: wangqiang@feewee.cn |
3 | 3 | * @Date: 2022-06-29 10:44:56 |
4 | 4 | * @LastEditors: wangqiang@feewee.cn |
5 | - * @LastEditTime: 2022-07-01 16:13:26 | |
5 | + * @LastEditTime: 2022-11-30 14:34:02 | |
6 | 6 | */ |
7 | 7 | import { |
8 | 8 | Button, |
... | ... | @@ -139,12 +139,7 @@ export default function RoleManagementGrooupModal() { |
139 | 139 | /> |
140 | 140 | </Form.Item> |
141 | 141 | <Divider orientation="left">管理组</Divider> |
142 | - <Form.List | |
143 | - name="roleList" | |
144 | - rules={[ | |
145 | - { validator: groupValidator }, | |
146 | - ]} | |
147 | - > | |
142 | + <Form.List name="roleList" rules={[{ validator: groupValidator }]}> | |
148 | 143 | {(fields, { add, remove }, { errors }) => ( |
149 | 144 | <> |
150 | 145 | {fields.map((field, index) => { |
... | ... | @@ -152,11 +147,17 @@ export default function RoleManagementGrooupModal() { |
152 | 147 | <Form.Item |
153 | 148 | {...field} |
154 | 149 | style={{ flex: 1 }} |
155 | - label={`${number2text(index + 1)}级管理组`} | |
150 | + label={ | |
151 | + index > 0 ? `${number2text(index)}级管理` : "基础角色组" | |
152 | + } | |
156 | 153 | rules={[ |
157 | 154 | { |
158 | 155 | required: true, |
159 | - message: `请选择${number2text(index + 1)}级管理组`, | |
156 | + message: `请选择${ | |
157 | + index > 0 | |
158 | + ? `${number2text(index)}级管理` | |
159 | + : "基础角色组" | |
160 | + }`, | |
160 | 161 | }, |
161 | 162 | ]} |
162 | 163 | > |
... | ... | @@ -221,7 +222,9 @@ function SelectRoleGroup({ |
221 | 222 | optionFilterProp="label" |
222 | 223 | mode={index === 0 ? "multiple" : undefined} |
223 | 224 | style={{ flex: 1 }} |
224 | - placeholder={`请选择${number2text(index + 1)}级管理组`} | |
225 | + placeholder={`请选择${ | |
226 | + index > 0 ? `${number2text(index)}级管理` : "基础角色组" | |
227 | + }`} | |
225 | 228 | onBlur={() => { |
226 | 229 | formatRoleList(form.getFieldValue("roleList") || []); |
227 | 230 | }} | ... | ... |
src/pages/contract/BearCostSetting/components/BearModal/index.tsx
... | ... | @@ -35,7 +35,7 @@ const BearModal = ({visible, onCancel, item = {} as BearCostSetting.Item}:Props) |
35 | 35 | rowKey={(item) => `${item.id}`} |
36 | 36 | > |
37 | 37 | <Column title="门店/往来单位名称" dataIndex="name" render={(t) => t || "-"} /> |
38 | - <Column title="分摊比例" dataIndex="shareRate" render={(t) => (t && `${t*100}%`) || "-"} /> | |
38 | + <Column title="分摊比例" dataIndex="shareRate" render={(t) => (t && `${(t*100).toFixed(2)}%`) || "-"} /> | |
39 | 39 | |
40 | 40 | </Table> |
41 | 41 | </Skeleton> | ... | ... |
src/pages/crm_new/Settings/index.tsx
... | ... | @@ -111,6 +111,9 @@ export default function Settings() { |
111 | 111 | |
112 | 112 | {/* 龚昆修改整合:集客跟进,潜客跟进到一个新的页面 */} |
113 | 113 | <div style={{ width: '100%', height: 40 }} /> |
114 | + <List.Item actions={[<a onClick={() => history.push('/crm/closeClue')}>查看</a>]}> | |
115 | + <List.Item.Meta title="暂停区域线索站岗分配资格设置" /> | |
116 | + </List.Item> | |
114 | 117 | <List.Item actions={[<a onClick={() => history.push('/crm/followUpSettings')}>查看</a>]}> |
115 | 118 | <List.Item.Meta title="跟进设置" /> |
116 | 119 | </List.Item> | ... | ... |
src/pages/crm_new/Settings/subpages/CloseClue/api.ts
0 → 100644
1 | +import request from '@/utils/request'; | |
2 | +import { CRM_HOST } from '@/utils/host'; | |
3 | + | |
4 | +export interface Result { | |
5 | + onlineSaleShopAssignClue?: boolean // 网销门店是否参与区域站岗线索分配 | |
6 | + exclusiveClueConvertRate?: number // 专属线索转化率(示例:90.50%) | |
7 | + stageMinAssignCount?: number // 下阶段每日最低分配线索数量 | |
8 | + dailyMinAssignCount?: number // 每日最低分配线索数量 从20个线索起,当天区域站岗分配线索跟进数每增加10个,低于“判断标准”,暂停当天资格 | |
9 | + increaseCount?: number // 每增加多少个当天区域站岗分配线索跟进数每增加10个,低于“判断标准”,暂停当天资格; | |
10 | +} | |
11 | +/** 查询停止区域线索分配资格设置 */ | |
12 | +export function getInfoApi() { | |
13 | + return request.get<Result>(`${CRM_HOST}/erp/config/find/stop/area/clue/assign/setting`); | |
14 | +} | |
15 | + | |
16 | +/** 新增/修改停止区域线索分配资格设置 */ | |
17 | +export function saveInfoApi(params: Result) { | |
18 | + return request.post(`${CRM_HOST}/erp/config/edit/stop/area/clue/assign/setting`, params); | |
19 | +} | |
0 | 20 | \ No newline at end of file | ... | ... |
src/pages/crm_new/Settings/subpages/CloseClue/index.tsx
0 → 100644
1 | +import React, { useEffect, useState } from 'react'; | |
2 | +import { Button, Card, ConfigProvider, Form, InputNumber, message, Row, Switch, Space } from 'antd'; | |
3 | +import zhCN from 'antd/lib/locale-provider/zh_CN'; | |
4 | +import { PageHeaderWrapper } from '@ant-design/pro-layout'; | |
5 | +import { getInfoApi, saveInfoApi, Result } from './api'; | |
6 | +import './style.less'; | |
7 | +import { history } from 'umi'; | |
8 | +import { debounce } from 'lodash'; | |
9 | + | |
10 | +export default function CollectionFollowSetting() { | |
11 | + const [edit, setEdit] = useState(false); | |
12 | + const [loading, setLoading] = useState<boolean>(true); | |
13 | + const [confirmLoading, setConfirmLoading]= useState<boolean>(false); | |
14 | + const [form] = Form.useForm(); | |
15 | + const [stageMinAssignCount, setStageMinAssignCount] = useState<number>(0); | |
16 | + const [dailyMinAssignCount, setDailyMinAssignCount] = useState<number>(0); | |
17 | + const [increaseCount, setIncreaseCount] = useState<number>(0); | |
18 | + const [checked, setChecked] = useState<boolean>(false); | |
19 | + | |
20 | + useEffect(() => { | |
21 | + getInfo(); | |
22 | + }, []); | |
23 | + | |
24 | + const getInfo = () => { | |
25 | + getInfoApi().then(res => { | |
26 | + if (res.data) { | |
27 | + form.setFieldsValue({...res.data}); | |
28 | + setDailyMinAssignCount(res.data?.dailyMinAssignCount || 0); | |
29 | + setStageMinAssignCount(res.data?.stageMinAssignCount || 0); | |
30 | + setIncreaseCount(res.data?.increaseCount || 0); | |
31 | + setChecked(res.data.onlineSaleShopAssignClue || false); | |
32 | + } | |
33 | + setLoading(false); | |
34 | + }).catch(error => { | |
35 | + message.error(error.message); | |
36 | + setLoading(false); | |
37 | + }); | |
38 | + }; | |
39 | + | |
40 | + const onCancle = () => { | |
41 | + getInfo(); | |
42 | + setEdit(false); | |
43 | + }; | |
44 | + | |
45 | + const onOk = async () => { | |
46 | + const params: any = await form.validateFields(); | |
47 | + const _params: Result = { | |
48 | + exclusiveClueConvertRate: params.exclusiveClueConvertRate, | |
49 | + stageMinAssignCount, | |
50 | + dailyMinAssignCount, | |
51 | + increaseCount, | |
52 | + onlineSaleShopAssignClue: checked, | |
53 | + }; | |
54 | + setConfirmLoading(true); | |
55 | + saveInfoApi(_params).then(res => { | |
56 | + message.success(res.result); | |
57 | + setEdit(false); | |
58 | + setConfirmLoading(false); | |
59 | + history.goBack(); | |
60 | + }).catch(error => { | |
61 | + message.error(error.message); | |
62 | + setConfirmLoading(false); | |
63 | + }); | |
64 | + }; | |
65 | + | |
66 | + return ( | |
67 | + <PageHeaderWrapper title="暂停区域线索站岗分配资格"> | |
68 | + <ConfigProvider locale={zhCN}> | |
69 | + <Card style={{paddingLeft: "60px", justifyContent: 'center'}} bordered={false} loading={loading}> | |
70 | + {/* <Spin> */} | |
71 | + <Form | |
72 | + labelCol={{ span: 2 }} | |
73 | + wrapperCol={{ span: 18 }} | |
74 | + form={form} | |
75 | + > | |
76 | + <Form.Item labelCol={{offset: 0}} label="区域站岗分配线索转化率标准" name="exclusiveClueConvertRate" labelAlign="right" rules={[{ required: true, message: '请输入' }]}> | |
77 | + <InputNumber | |
78 | + style={{width: '100%'}} | |
79 | + controls={false} | |
80 | + min={0} | |
81 | + max={100} | |
82 | + formatter={value => `${value}%`} | |
83 | + precision={2} | |
84 | + disabled={!edit} | |
85 | + parser={value => value?.replace('%', '')} | |
86 | + /> | |
87 | + </Form.Item> | |
88 | + | |
89 | + <Form.Item labelCol={{offset: 2}} label=" " name="stageMinAssignCount" colon={false} labelAlign="right"> | |
90 | + <span>{`(1)每阶段滚动判定,低于"区域站岗分配线索转化率标准",下一阶段线索每日仅分配`}</span> | |
91 | + <InputNumber | |
92 | + controls={false} | |
93 | + min={0} | |
94 | + disabled={!edit} | |
95 | + value={stageMinAssignCount} | |
96 | + onChange={(e) => setStageMinAssignCount(e || 0)} | |
97 | + formatter={value => `${value}个`} | |
98 | + precision={0} | |
99 | + parser={value => value?.replace('个', '')} | |
100 | + /> | |
101 | + <br /> | |
102 | + <span style={{color: "#F4333C"}}>(最低要求);阶段:1~10号;11~20号;21~月末</span> | |
103 | + </Form.Item> | |
104 | + | |
105 | + <Form.Item labelCol={{offset: 2}} className="feewee-settings-form-closeClue" label=" " colon={false}> | |
106 | + <Form.Item colon={false} name="dailyMinAssignCount"> | |
107 | + <span>(2)从</span> | |
108 | + <InputNumber | |
109 | + controls={false} | |
110 | + value={dailyMinAssignCount} | |
111 | + onChange={(e) => setDailyMinAssignCount(e || 0)} | |
112 | + min={0} | |
113 | + disabled={!edit} | |
114 | + formatter={value => `${value}个`} | |
115 | + precision={0} | |
116 | + parser={value => value?.replace('个', '')} | |
117 | + /> | |
118 | + <span>线索起,当天区域站岗分配线索跟进数每增加</span> | |
119 | + </Form.Item> | |
120 | + <Form.Item colon={false} name="increaseCount"> | |
121 | + <InputNumber | |
122 | + controls={false} | |
123 | + min={0} | |
124 | + value={increaseCount} | |
125 | + onChange={(e) => setIncreaseCount(e || 0)} | |
126 | + formatter={value => `${value}个`} | |
127 | + precision={0} | |
128 | + disabled={!edit} | |
129 | + parser={value => value?.replace('个', '')} | |
130 | + /> | |
131 | + <span>,低于{`"区域站岗分配线索转化率标准"`},暂停当天资格;</span> | |
132 | + </Form.Item> | |
133 | + </Form.Item> | |
134 | + <Form.Item labelCol={{offset: 0}} label="网销门店是否参与区域线索站岗分配" name="onlineSaleShopAssignClue" labelAlign="right"> | |
135 | + <Switch | |
136 | + disabled={!edit} | |
137 | + checked={checked} | |
138 | + checkedChildren="是" | |
139 | + unCheckedChildren="否" | |
140 | + size="default" | |
141 | + onChange={(e) => setChecked(e)} | |
142 | + /> | |
143 | + </Form.Item> | |
144 | + | |
145 | + </Form> | |
146 | + <Row justify="space-around" align="middle"> | |
147 | + <Space> | |
148 | + { | |
149 | + !edit ? <Button disabled={confirmLoading} type="default" onClick={() => setEdit(true)}>编辑</Button> : <Button disabled={confirmLoading} type="default" onClick={onCancle}>取消</Button> | |
150 | + } | |
151 | + <Button disabled={confirmLoading} loading={confirmLoading} type="primary" onClick={debounce(onOk, 380)}>确认</Button> | |
152 | + <Button disabled={confirmLoading} type="link" onClick={() => { history.goBack(); }}>返回上一级</Button> | |
153 | + </Space> | |
154 | + </Row> | |
155 | + {/* </Spin> */} | |
156 | + </Card> | |
157 | + </ConfigProvider> | |
158 | + </PageHeaderWrapper> | |
159 | + ); | |
160 | +} | |
0 | 161 | \ No newline at end of file | ... | ... |
src/pages/crm_new/Settings/subpages/CloseClue/style.less
0 → 100644
src/pages/finance/CompanyRelationAuth/api.ts
... | ... | @@ -19,6 +19,10 @@ export interface CompanyRelationListVO { |
19 | 19 | compShortName?: string; //简称 |
20 | 20 | compType?: number[]; //类型 |
21 | 21 | compTypeName?: number; //类型 |
22 | + beforeReimburse?: boolean; //是否报销前提供发票 | |
23 | + billAmountRatio?: number; //发票要求金额比例(已扩大100倍,前端直接拼接百分号展示) | |
24 | + settleMethodNames?: string; // 支持结算方式 | |
25 | + accountCheckPeriod?: number; //对账周期,每月多少号 | |
22 | 26 | } |
23 | 27 | |
24 | 28 | /** | ... | ... |
src/pages/finance/CompanyRelationAuth/components/Filter.tsx
... | ... | @@ -3,7 +3,8 @@ import { Button, Col, Popconfirm, Row, Select, Input, message } from "antd"; |
3 | 3 | import { useStore } from "../index"; |
4 | 4 | import { CompanyCategoryTypeEnum } from "@/pages/finance/entitys"; |
5 | 5 | import { debounce } from "lodash"; |
6 | -import { deleteCompanyRelationApi } from '@/pages/finance/CompanyRelationAuth/api'; | |
6 | +import { deleteCompanyRelationApi } from "@/pages/finance/CompanyRelationAuth/api"; | |
7 | +import { history } from "umi"; | |
7 | 8 | |
8 | 9 | const Search = Input.Search; |
9 | 10 | const { Option } = Select; |
... | ... | @@ -50,8 +51,9 @@ export default function Filter() { |
50 | 51 | setDisabled(false); |
51 | 52 | } |
52 | 53 | |
54 | + // 新增 | |
53 | 55 | function onAdd() { |
54 | - setVisible(true); | |
56 | + history.push({ pathname: "/finance2/companyRelationAuth/create", state: companyParams }); | |
55 | 57 | } |
56 | 58 | /** |
57 | 59 | * @param compId |
... | ... | @@ -59,7 +61,7 @@ export default function Filter() { |
59 | 61 | async function onDelete() { |
60 | 62 | const compIdList = selectedRelation.map((item) => item.compId); |
61 | 63 | try { |
62 | - const pa = { ...companyParams, compIdList}; | |
64 | + const pa = { ...companyParams, compIdList }; | |
63 | 65 | setSubmitLoading(true); |
64 | 66 | const { success, result } = await deleteCompanyRelationApi(pa); |
65 | 67 | setSubmitLoading(false); |
... | ... | @@ -140,25 +142,15 @@ export default function Filter() { |
140 | 142 | </Col> |
141 | 143 | </Row> |
142 | 144 | <div style={{ display: "flex", flexDirection: "row-reverse" }}> |
143 | - {/* <Button hidden={disabled} type="primary" onClick={onAdd}> */} | |
144 | 145 | <Button type="primary" onClick={onAdd}> |
145 | 146 | 新增 |
146 | 147 | </Button> |
147 | 148 | |
148 | 149 | <Popconfirm title="确定删除?" onConfirm={onDelete}> |
149 | - <Button style={{marginRight:10}} hidden={!selectedRelation.length} danger loading={submitLoading}> | |
150 | + <Button style={{ marginRight: 10 }} hidden={!selectedRelation.length} danger loading={submitLoading}> | |
150 | 151 | 删除 |
151 | 152 | </Button> |
152 | 153 | </Popconfirm> |
153 | - {/* <Button hidden={disabled} type="link" onClick={onSubmit}> | |
154 | - 保存 | |
155 | - </Button> | |
156 | - <Popconfirm title="确定取消?取消将重置数据" onConfirm={onCancel}> | |
157 | - <Button hidden={disabled} danger type="text"> | |
158 | - 取消 | |
159 | - </Button> | |
160 | - </Popconfirm> | |
161 | - */} | |
162 | 154 | </div> |
163 | 155 | </div> |
164 | 156 | ); | ... | ... |
src/pages/finance/CompanyRelationAuth/index.tsx
... | ... | @@ -3,7 +3,6 @@ import { Card, Table } from "antd"; |
3 | 3 | import { PageHeaderWrapper } from "@ant-design/pro-layout"; |
4 | 4 | import { createStore } from "@/hooks/moz"; |
5 | 5 | import store from "./useStore"; |
6 | -import SelectModal from "./components/SelectModal"; | |
7 | 6 | import Filter from "./components/Filter"; |
8 | 7 | import { CompanyRelationListVO } from "@/pages/finance/CompanyRelationAuth/api"; |
9 | 8 | |
... | ... | @@ -15,7 +14,6 @@ function CompanyRelationAuth() { |
15 | 14 | const { |
16 | 15 | selected, |
17 | 16 | loading, |
18 | - | |
19 | 17 | setSelectedRelation, |
20 | 18 | } = useStore(); |
21 | 19 | |
... | ... | @@ -25,10 +23,10 @@ function CompanyRelationAuth() { |
25 | 23 | setSelectedRelation([...selectedRows]); |
26 | 24 | }, |
27 | 25 | getCheckboxProps: (record: CompanyRelationListVO) => ({ |
28 | - // disabled: record.name === "Disabled User", // Column configuration not to be checked | |
29 | 26 | name: String(record.compId), |
30 | 27 | }), |
31 | 28 | }; |
29 | + | |
32 | 30 | return ( |
33 | 31 | <PageHeaderWrapper title="往来单位关系设置"> |
34 | 32 | <Card> |
... | ... | @@ -46,20 +44,12 @@ function CompanyRelationAuth() { |
46 | 44 | <Column title="单位名称" dataIndex="compName" /> |
47 | 45 | <Column title="简称" dataIndex="compShortName" /> |
48 | 46 | <Column title="类型" dataIndex="compTypeName" /> |
49 | - {/* <Column | |
50 | - title="操作" | |
51 | - dataIndex="compId" | |
52 | - render={(key) => ( | |
53 | - <Popconfirm title="是否删除" onConfirm={() => onDelete(key)} okText="确定" cancelText="取消"> | |
54 | - <Button type="link" danger loading={submitLoading}> | |
55 | - 删除 | |
56 | - </Button> | |
57 | - </Popconfirm> | |
58 | - )} | |
59 | - /> */} | |
47 | + <Column title="发票要求" dataIndex="beforeReimburse" render={(before) => `支付${before ? "前" : "后"}`} /> | |
48 | + <Column title="发票金额要求比例" dataIndex="billAmountRatio" render={(ratio) => `${ratio}%`} /> | |
49 | + <Column title="支持结算方式" dataIndex="settleMethodNames" render={(way) => way || "--"} /> | |
50 | + <Column title="对账周期" dataIndex="accountCheckPeriod" render={(date) => (date ? `${date}日` : "--")} /> | |
60 | 51 | </Table> |
61 | 52 | </Card> |
62 | - <SelectModal /> | |
63 | 53 | </PageHeaderWrapper> |
64 | 54 | ); |
65 | 55 | } | ... | ... |
src/pages/finance/CompanyRelationCreate/api.ts
0 → 100644
1 | +import { http } from "@/typing/http"; | |
2 | +import request from "@/utils/request"; | |
3 | +import { FINANCE2_HOST } from "@/utils/host"; | |
4 | + | |
5 | +type PrRes<T> = http.PromiseResp<T>; | |
6 | + | |
7 | +export interface CompanyRelationParams { | |
8 | + dealerId: number; | |
9 | + compCategory: number; | |
10 | + keywords?: string; | |
11 | + current?: number; | |
12 | + pageSize?: number; | |
13 | + companyType?: number; | |
14 | +} | |
15 | + | |
16 | +export interface CompanyRelationListVO { | |
17 | + compId?: number; | |
18 | + compName?: string; | |
19 | + compShortName?: string; //简称 | |
20 | + compType?: number[]; //类型 | |
21 | + compTypeName?: number; //类型 | |
22 | + beforeReimburse?: boolean; //是否报销前提供发票 | |
23 | + billAmountRatio?: number; //发票要求金额比例(已扩大100倍,前端直接拼接百分号展示) | |
24 | + settleMethodNames?: string; // 支持结算方式 | |
25 | + accountCheckPeriod?: number; //对账周期,每月多少号 | |
26 | +} | |
27 | + | |
28 | +/** | |
29 | + * 查询往来单位关系列表 | |
30 | + */ | |
31 | +export function getCompanyByDealerApi(params: CompanyRelationParams): PrRes<CompanyRelationListVO[]> { | |
32 | + return request.get(`${FINANCE2_HOST}/trade/company/relation/list`, { params }); | |
33 | +} | |
34 | + | |
35 | +interface SaveParams { | |
36 | + compIdList: number[]; //单位id集合 | |
37 | + dealerId: number; //商家id,必填 | |
38 | + compCategory: number; //单位类别,必填 | |
39 | +} | |
40 | + | |
41 | +/** | |
42 | + * 新增往来单位关系 | |
43 | + */ | |
44 | +export function saveCompanyRelationApi(params: SaveParams): PrRes<void> { | |
45 | + return request.post(`${FINANCE2_HOST}/trade/company/relation/save`, params); | |
46 | +} | |
47 | + | |
48 | +/** | |
49 | +* 删除往来单位关系 | |
50 | + /trade/company/relation/delete | |
51 | + */ | |
52 | +export function deleteCompanyRelationApi(params: SaveParams): PrRes<void> { | |
53 | + return request.post(`${FINANCE2_HOST}/trade/company/relation/delete`, params); | |
54 | +} | ... | ... |
src/pages/finance/CompanyRelationCreate/components/EditTagList.tsx
0 → 100644
1 | +import * as React from "react"; | |
2 | +import { Tag, Input, Tooltip } from "antd"; | |
3 | +import { PlusOutlined } from "@ant-design/icons"; | |
4 | +import { isArray } from "lodash"; | |
5 | +// import "./EditTagList.less"; | |
6 | + | |
7 | +interface Props { | |
8 | + value?: string[]; | |
9 | + onChange?: (value: string[]) => any; | |
10 | +} | |
11 | + | |
12 | +const colorArr = ["magenta", "geekblue", "cyan", "orange", "green", "lime", "gold", "volcano", "purple", "red"]; | |
13 | + | |
14 | +export default ({ value = [], onChange }: Props) => { | |
15 | + function handleClose(tag: string) { | |
16 | + const tags = value.filter((item) => item !== tag); | |
17 | + onChange && onChange(tags); | |
18 | + } | |
19 | + return ( | |
20 | + <> | |
21 | + <div style={{ borderStyle: "solid", borderColor: "#eee", padding: 5, borderWidth: 1 }}> | |
22 | + {isArray(value) && | |
23 | + value.map((tag, index) => { | |
24 | + const isLongTag = tag.length > 20; | |
25 | + const tagElem = ( | |
26 | + <Tag | |
27 | + className="edit-tag" | |
28 | + key={tag} | |
29 | + closable={value.length > 1} | |
30 | + color={colorArr[index % 10]} | |
31 | + onClose={() => handleClose(tag)} | |
32 | + > | |
33 | + <span>{isLongTag ? `${tag.slice(0, 20)}...` : tag}</span> | |
34 | + </Tag> | |
35 | + ); | |
36 | + return isLongTag ? ( | |
37 | + <Tooltip title={tag} key={tag}> | |
38 | + {tagElem} | |
39 | + </Tooltip> | |
40 | + ) : ( | |
41 | + tagElem | |
42 | + ); | |
43 | + })} | |
44 | + </div> | |
45 | + </> | |
46 | + ); | |
47 | +}; | ... | ... |
src/pages/finance/CompanyRelationCreate/components/Filter.tsx
0 → 100644
1 | +import React from "react"; | |
2 | +import { Button, Col, Popconfirm, Row, Select, Input, message } from "antd"; | |
3 | +import { useStore } from "../index"; | |
4 | +import { CompanyCategoryTypeEnum } from "@/pages/finance/entitys"; | |
5 | +import { debounce } from "lodash"; | |
6 | +import { deleteCompanyRelationApi } from '@/pages/finance/CompanyRelationAuth/api'; | |
7 | +import { history } from 'umi'; | |
8 | + | |
9 | +const Search = Input.Search; | |
10 | +const { Option } = Select; | |
11 | + | |
12 | +export default function Filter() { | |
13 | + const { | |
14 | + setVisible, | |
15 | + dealerList, | |
16 | + setCompanyParams, | |
17 | + dealerLoading, | |
18 | + disabled, | |
19 | + setDisabled, | |
20 | + setSelected, | |
21 | + companyList, | |
22 | + comBussinessList, | |
23 | + selectedRelation, | |
24 | + submitLoading, | |
25 | + setSubmitLoading, | |
26 | + companyParams, | |
27 | + setLoading, | |
28 | + } = useStore(); | |
29 | + const searchDealer = (dealerId: number) => { | |
30 | + setCompanyParams({ ...companyParams, dealerId }, true); | |
31 | + }; | |
32 | + | |
33 | + function searchType(compCategory: number) { | |
34 | + setCompanyParams({ ...companyParams, compCategory }, true); | |
35 | + } | |
36 | + | |
37 | + function searchCompanyType(companyType: number) { | |
38 | + setCompanyParams({ ...companyParams, companyType }, true); | |
39 | + } | |
40 | + | |
41 | + const fetchListByName = debounce((value) => { | |
42 | + setCompanyParams({ ...companyParams, keywords: value }, true); | |
43 | + }, 500); | |
44 | + | |
45 | + function onCancel() { | |
46 | + setDisabled(true); | |
47 | + setSelected([...companyList]); | |
48 | + } | |
49 | + | |
50 | + function onEdit() { | |
51 | + setDisabled(false); | |
52 | + } | |
53 | + | |
54 | + // 新增 | |
55 | + function onAdd() { | |
56 | + history.push("/finance2/companyRelationAuth/create"); | |
57 | + } | |
58 | + /** | |
59 | + * @param compId | |
60 | + */ | |
61 | + async function onDelete() { | |
62 | + const compIdList = selectedRelation.map((item) => item.compId); | |
63 | + try { | |
64 | + const pa = { ...companyParams, compIdList}; | |
65 | + setSubmitLoading(true); | |
66 | + const { success, result } = await deleteCompanyRelationApi(pa); | |
67 | + setSubmitLoading(false); | |
68 | + | |
69 | + if (!success) { | |
70 | + return message.error(result); | |
71 | + } else { | |
72 | + message.success(result); | |
73 | + setLoading(true); | |
74 | + } | |
75 | + } catch (e) { | |
76 | + setSubmitLoading(false); | |
77 | + message.error(e.message); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + return ( | |
82 | + <div | |
83 | + style={{ | |
84 | + display: "flex", | |
85 | + flexDirection: "row", | |
86 | + justifyContent: "space-between", | |
87 | + alignItems: "center", | |
88 | + marginBottom: 20, | |
89 | + }} | |
90 | + > | |
91 | + <Row style={{ display: "flex", flex: 1 }}> | |
92 | + <Col span={9}> | |
93 | + <Select | |
94 | + placeholder="请选择商家" | |
95 | + showSearch | |
96 | + loading={dealerLoading} | |
97 | + disabled={!disabled} | |
98 | + optionFilterProp="children" | |
99 | + onChange={searchDealer} | |
100 | + value={companyParams.dealerId} | |
101 | + style={{ width: "80%" }} | |
102 | + > | |
103 | + {dealerList.map((dealer) => ( | |
104 | + <Option value={dealer.id} key={dealer.id}> | |
105 | + {dealer.name} | |
106 | + </Option> | |
107 | + ))} | |
108 | + </Select> | |
109 | + </Col> | |
110 | + <Col span={5}> | |
111 | + <Search | |
112 | + allowClear | |
113 | + disabled={!disabled} | |
114 | + placeholder="搜索单位名称" | |
115 | + onChange={(e) => fetchListByName(e.target.value || undefined)} | |
116 | + style={{ width: 200 }} | |
117 | + /> | |
118 | + </Col> | |
119 | + <Col span={3}> | |
120 | + <Select | |
121 | + placeholder="搜索单位类别" | |
122 | + disabled={!disabled} | |
123 | + onChange={searchType} | |
124 | + value={companyParams.compCategory} | |
125 | + style={{ width: 100 }} | |
126 | + > | |
127 | + {[1, 2].map((i) => ( | |
128 | + <Option value={i} key={i}> | |
129 | + {CompanyCategoryTypeEnum[i]} | |
130 | + </Option> | |
131 | + ))} | |
132 | + </Select> | |
133 | + </Col> | |
134 | + <Col> | |
135 | + <Select placeholder="搜索类型" disabled={!disabled} onChange={searchCompanyType} style={{ width: 150 }}> | |
136 | + {comBussinessList.map((item) => ( | |
137 | + <Option key={item.id} value={item.id}> | |
138 | + {item.name} | |
139 | + </Option> | |
140 | + ))} | |
141 | + </Select> | |
142 | + </Col> | |
143 | + </Row> | |
144 | + <div style={{ display: "flex", flexDirection: "row-reverse" }}> | |
145 | + <Button type="primary" onClick={onAdd}> | |
146 | + 新增 | |
147 | + </Button> | |
148 | + | |
149 | + <Popconfirm title="确定删除?" onConfirm={onDelete}> | |
150 | + <Button style={{marginRight:10}} hidden={!selectedRelation.length} danger loading={submitLoading}> | |
151 | + 删除 | |
152 | + </Button> | |
153 | + </Popconfirm> | |
154 | + </div> | |
155 | + </div> | |
156 | + ); | |
157 | +} | ... | ... |
src/pages/finance/CompanyRelationCreate/components/RelationshipSettings.tsx
0 → 100644
1 | +import React, { useState, useEffect, memo } from "react"; | |
2 | +import { Select, message, Form, Divider, Button, InputNumber } from "antd"; | |
3 | +import { useStore } from "../index"; | |
4 | +import { saveCompanyRelationApi } from "@/pages/finance/CompanyRelationAuth/api"; | |
5 | +import EditTagList from "./EditTagList"; | |
6 | +import { invoiceRequirements, payWay, RequirementsTypeEnum } from "@/pages/finance/CompanyRelationCreate/entity"; | |
7 | + | |
8 | +const { Option } = Select; | |
9 | + | |
10 | +interface Props { | |
11 | + onPrevious?: () => void; | |
12 | +} | |
13 | + | |
14 | +function SelectModal({ onPrevious }: Props) { | |
15 | + const [form] = Form.useForm(); | |
16 | + const { | |
17 | + // visible, | |
18 | + // selected, | |
19 | + // setVisible, | |
20 | + companyParams, | |
21 | + // comBussinessList, | |
22 | + // comBussinessLoading, | |
23 | + setDisabled, | |
24 | + selectData, | |
25 | + setSelectData, | |
26 | + } = useStore(); | |
27 | + const [submitLoading, setSubmitLoading] = useState(false); | |
28 | + | |
29 | + useEffect(() => { | |
30 | + const formDate = transFormData(selectData); | |
31 | + form.setFieldsValue({ ...formDate }); | |
32 | + }, [selectData]); | |
33 | + | |
34 | + function transFormData(originData: TradeCompany.ComList[]) { | |
35 | + let res = {}; | |
36 | + const comp = originData.map((it) => it.compName); | |
37 | + res.comp = comp; | |
38 | + return res; | |
39 | + } | |
40 | + | |
41 | + function onCancel() { | |
42 | + setSelectData([]); | |
43 | + history.back(); | |
44 | + } | |
45 | + | |
46 | + // 保存 | |
47 | + function _onOk(formData: any) { | |
48 | + const pa = transformDTO(formData); | |
49 | + setSubmitLoading(true); | |
50 | + saveCompanyRelationApi(pa) | |
51 | + .then((res) => { | |
52 | + message.success("保存成功"); | |
53 | + setSubmitLoading(false); | |
54 | + setDisabled(true); | |
55 | + onCancel(); | |
56 | + }) | |
57 | + .catch((e) => { | |
58 | + setSubmitLoading(false); | |
59 | + message.error(e.message); | |
60 | + }); | |
61 | + } | |
62 | + | |
63 | + function transformDTO(formData: any) { | |
64 | + const { beforeReimburse, comp = [] } = formData; | |
65 | + const compList = selectData.filter((item) => comp.find((y) => y === item.compName)); | |
66 | + const relationCompanyList = compList.map((item) => ({ | |
67 | + ...formData, | |
68 | + comp: undefined, | |
69 | + compId: item.id, | |
70 | + beforeReimburse: beforeReimburse === RequirementsTypeEnum["支付前"], | |
71 | + })); | |
72 | + const pa = { | |
73 | + ...companyParams, | |
74 | + relationCompanyList, | |
75 | + }; | |
76 | + return pa; | |
77 | + } | |
78 | + | |
79 | + return ( | |
80 | + <> | |
81 | + <Form | |
82 | + form={form} | |
83 | + labelCol={{ | |
84 | + xs: { span: 24 }, | |
85 | + sm: { span: 8 }, | |
86 | + md: { span: 6 }, | |
87 | + }} | |
88 | + wrapperCol={{ | |
89 | + xs: { span: 24 }, | |
90 | + sm: { span: 10 }, | |
91 | + md: { span: 15 }, | |
92 | + }} | |
93 | + onFinish={_onOk} | |
94 | + > | |
95 | + <Form.Item label="往来单位" name="comp"> | |
96 | + <EditTagList /> | |
97 | + </Form.Item> | |
98 | + <Form.Item label="发票要求" name="beforeReimburse" rules={[{ required: true, message: "请选择发票要求" }]}> | |
99 | + <Select placeholder="请选择发票要求"> | |
100 | + {invoiceRequirements.map((item) => ( | |
101 | + <Option key={item.value} value={item.value}> | |
102 | + {item.label} | |
103 | + </Option> | |
104 | + ))} | |
105 | + </Select> | |
106 | + </Form.Item> | |
107 | + <Form.Item | |
108 | + label="发票金额要求比例" | |
109 | + name="billAmountRatio" | |
110 | + rules={[ | |
111 | + { required: true, message: "请输入发票金额要求比例" }, | |
112 | + { pattern: /^(100)$|^((\d|[1-9]\d)(\.\d{1,2})?)$/, message: "请输入0-100之间的数字(保留两位小数)" }, | |
113 | + ]} | |
114 | + > | |
115 | + <InputNumber | |
116 | + min={0} | |
117 | + max={100} | |
118 | + style={{ width: "100%" }} | |
119 | + formatter={(value) => `${value}%`} | |
120 | + parser={(value) => value!.replace("%", "")} | |
121 | + /> | |
122 | + </Form.Item> | |
123 | + <Form.Item label="支持结算方式" name="settleMethods" rules={[{ required: true, message: "请选择结算方式" }]}> | |
124 | + <Select placeholder="请选择结算方式" mode="multiple"> | |
125 | + {payWay.map((item) => ( | |
126 | + <Option key={item.value} value={item.value}> | |
127 | + {item.label} | |
128 | + </Option> | |
129 | + ))} | |
130 | + </Select> | |
131 | + </Form.Item> | |
132 | + <Form.Item label="对账周期" name="accountCheckPeriod" rules={[{ required: true, message: "请输入对账周期" }]}> | |
133 | + <InputNumber | |
134 | + addonBefore="每月" | |
135 | + placeholder="请输入" | |
136 | + min={1} | |
137 | + precision={0} | |
138 | + max={31} | |
139 | + addonAfter="日" | |
140 | + style={{ width: "100%" }} | |
141 | + /> | |
142 | + </Form.Item> | |
143 | + </Form> | |
144 | + <div style={{ width: "100%", textAlign: "center", marginTop: 30 }}> | |
145 | + <Button type="primary" style={{ marginBottom: 10 }} onClick={() => history.back()}> | |
146 | + 返回列表 | |
147 | + </Button> | |
148 | + <Divider type="vertical" /> | |
149 | + <Button | |
150 | + type="primary" | |
151 | + style={{ marginBottom: 10 }} | |
152 | + onClick={() => { | |
153 | + const comp = form.getFieldValue("comp"); | |
154 | + const _selectData = selectData.filter((item) => comp.find((it) => it === item.compName)); | |
155 | + | |
156 | + setSelectData(_selectData); | |
157 | + onPrevious && onPrevious(); | |
158 | + }} | |
159 | + > | |
160 | + 返回上一步 | |
161 | + </Button> | |
162 | + <Divider type="vertical" /> | |
163 | + <Button type="primary" style={{ marginBottom: 10 }} onClick={() => form.submit()} loading={submitLoading}> | |
164 | + 保存 | |
165 | + </Button> | |
166 | + </div> | |
167 | + </> | |
168 | + ); | |
169 | +} | |
170 | + | |
171 | +export default memo(SelectModal); | ... | ... |
src/pages/finance/CompanyRelationAuth/components/SelectModal.tsx renamed to src/pages/finance/CompanyRelationCreate/components/SelectCorrespondenceUnits.tsx
1 | 1 | import React, { useState, useEffect, memo } from "react"; |
2 | -import { Modal, Table, Select, Input, message, Spin } from "antd"; | |
2 | +import { Modal, Table, Select, Input, message, Spin, Button, Divider } from "antd"; | |
3 | 3 | import Column from "antd/lib/table/Column"; |
4 | 4 | import { RecordStateEnum } from "@/pages/finance/entitys"; |
5 | 5 | import usePagination from "@/hooks/usePagination"; |
6 | 6 | import { getCompAccountApi } from "@/pages/finance/TradeCompany/api"; |
7 | 7 | import { useStore } from "../index"; |
8 | 8 | import { debounce } from "lodash"; |
9 | -import { saveCompanyRelationApi } from '@/pages/finance/CompanyRelationAuth/api'; | |
10 | 9 | |
11 | -function SelectModal() { | |
10 | +interface Props { | |
11 | + onNext?: () => void; | |
12 | +} | |
13 | + | |
14 | +function SelectModal({ onNext }: Props) { | |
12 | 15 | const { |
13 | 16 | visible, |
14 | 17 | selected, |
... | ... | @@ -17,155 +20,126 @@ function SelectModal() { |
17 | 20 | comBussinessList, |
18 | 21 | comBussinessLoading, |
19 | 22 | setDisabled, |
20 | - setLoading, | |
23 | + selectData, | |
24 | + setSelectData, | |
21 | 25 | } = useStore(); |
22 | - const [submitLoading, setSubmitLoading] = useState(false); | |
23 | 26 | |
24 | 27 | const [delay, setDelay] = useState<boolean>(true); |
25 | - const [selectData, setSelectData] = useState<TradeCompany.ComList[]>([]); | |
28 | + | |
26 | 29 | const { |
27 | 30 | list: compList, |
28 | 31 | loading, |
29 | 32 | paginationConfig, |
30 | 33 | setParams, |
31 | 34 | innerParams, |
32 | - } = usePagination<TradeCompany.ComList>(getCompAccountApi, { recordState: RecordStateEnum["已备案"] }, { delay }); | |
33 | - | |
34 | - const fetchListByName = debounce((value) => { | |
35 | - setParams({ ...innerParams, keywords: value }, true); | |
36 | - }, 500); | |
37 | - | |
38 | - function searchType(compTypes: number) { | |
39 | - setParams({ compTypes }, true); | |
40 | - } | |
35 | + } = usePagination<TradeCompany.ComList>( | |
36 | + getCompAccountApi, | |
37 | + { | |
38 | + compCategory: companyParams.compCategory, | |
39 | + excludeDealerId: companyParams.dealerId, | |
40 | + recordState: RecordStateEnum["已备案"], | |
41 | + }, | |
42 | + { delay } | |
43 | + ); | |
41 | 44 | |
42 | 45 | useEffect(() => { |
43 | - if (visible) { | |
46 | + if (companyParams.dealerId !== -1) { | |
44 | 47 | setDelay(false); |
45 | 48 | setParams({ compCategory: companyParams.compCategory, excludeDealerId: companyParams.dealerId }, true); |
46 | - // setSelectData(selected.map((row) => ({ id: row.compId, compName: row.compName }))); | |
47 | 49 | } |
48 | - }, [visible, companyParams, selected]); | |
49 | - | |
50 | - function handSave() { | |
51 | - console.log("已选:", selectData); | |
50 | + }, [companyParams]); | |
52 | 51 | |
53 | - const res = onSubmit(selectData); | |
54 | - console.log("res", res); | |
55 | - | |
56 | - if (res) { | |
57 | - onCancel(); | |
58 | - } | |
59 | - | |
60 | - // setSelected( | |
61 | - // selectData.map((item) => ({ | |
62 | - // compId: item.id, | |
63 | - // compName: item.compName, | |
64 | - // compShortName: item.compShortName, | |
65 | - // compType: item.compType, | |
66 | - // })) | |
67 | - // ); | |
68 | - } | |
52 | + const fetchListByName = debounce((value) => { | |
53 | + setParams({ ...innerParams, keywords: value }, true); | |
54 | + }, 500); | |
69 | 55 | |
70 | - function onSubmit(selectedData: any[]) { | |
71 | - if (!selectedData.length) { | |
72 | - return message.info("请先选择往来单位"); | |
73 | - } | |
74 | - setSubmitLoading(true); | |
75 | - saveCompanyRelationApi({ | |
76 | - dealerId: companyParams.dealerId, | |
77 | - compCategory: companyParams.compCategory, | |
78 | - compIdList: selectedData.map((item) => item.id!), | |
79 | - }) | |
80 | - .then((res) => { | |
81 | - message.success("保存成功"); | |
82 | - setLoading(true); | |
83 | - setSubmitLoading(false); | |
84 | - setDisabled(true); | |
85 | - onCancel(); | |
86 | - }) | |
87 | - .catch((e) => { | |
88 | - setSubmitLoading(false); | |
89 | - message.error(e.message); | |
90 | - }); | |
91 | - } | |
92 | - function onCancel() { | |
93 | - setVisible(false); | |
94 | - setSelectData([]); | |
56 | + function searchType(compTypes: number) { | |
57 | + setParams({ compTypes }, true); | |
95 | 58 | } |
96 | 59 | |
97 | 60 | return ( |
98 | - <Modal | |
99 | - width={700} | |
100 | - visible={visible} | |
101 | - title="选择往来单位" | |
102 | - onCancel={onCancel} | |
103 | - onOk={handSave} | |
104 | - bodyStyle={{ maxHeight: 600, overflowY: "auto" }} | |
105 | - > | |
106 | - <Spin tip="保存中" spinning={submitLoading}> | |
107 | - <div style={{ display: "flex", flexDirection: "row", marginBottom: 20 }}> | |
108 | - <Input.Search | |
109 | - allowClear | |
110 | - placeholder="搜索单位名称/社会信用代码" | |
111 | - onChange={(e) => fetchListByName(e.target.value || undefined)} | |
112 | - style={{ width: 250, marginRight: 10 }} | |
113 | - /> | |
114 | - <Select | |
115 | - placeholder="搜索业务类型" | |
116 | - showSearch | |
117 | - allowClear | |
118 | - optionFilterProp="children" | |
119 | - loading={comBussinessLoading} | |
120 | - onChange={searchType} | |
121 | - style={{ width: 200 }} | |
122 | - > | |
123 | - {comBussinessList.map((item) => ( | |
124 | - <Select.Option key={item.id} value={item.id}> | |
125 | - {item.name} | |
126 | - </Select.Option> | |
127 | - ))} | |
128 | - </Select> | |
129 | - </div> | |
130 | - | |
131 | - <Table | |
132 | - loading={loading} | |
133 | - dataSource={compList} | |
134 | - pagination={{ ...paginationConfig, showSizeChanger: false }} | |
135 | - rowKey="id" | |
136 | - rowSelection={{ | |
137 | - type: "checkbox", | |
138 | - selectedRowKeys: selectData.map((row) => row.id as number), | |
139 | - onSelect: (row: any, _selected: boolean) => { | |
140 | - const index = selectData.findIndex((_row) => _row.id == row.id); | |
141 | - if (_selected) { | |
142 | - selectData.unshift(row); | |
143 | - } else if (index > -1) { | |
144 | - selectData.splice(index, 1); | |
145 | - } | |
146 | - setSelectData([...selectData]); | |
147 | - }, | |
148 | - onSelectAll: (selected, selectedRows, changeRows) => { | |
149 | - const changedKeys = changeRows.map((row) => row.id); | |
150 | - let newData = []; | |
151 | - // 全选 | |
152 | - if (selected) { | |
153 | - // 过滤掉已选的 | |
154 | - newData = selectData.concat(changeRows.filter((row) => !selectData.some((item) => item == row.id))); | |
155 | - } else { | |
156 | - // 全不选 - 去掉已选的 | |
157 | - newData = selectData.filter((row) => !changedKeys.find((y) => y === row.id)); | |
158 | - } | |
159 | - setSelectData(newData); | |
160 | - }, | |
161 | - }} | |
61 | + <> | |
62 | + <div style={{ display: "flex", flexDirection: "row", marginBottom: 20 }}> | |
63 | + <Input.Search | |
64 | + allowClear | |
65 | + placeholder="搜索单位名称/社会信用代码" | |
66 | + onChange={(e) => fetchListByName(e.target.value || undefined)} | |
67 | + style={{ width: 250, marginRight: 10 }} | |
68 | + /> | |
69 | + <Select | |
70 | + placeholder="搜索业务类型" | |
71 | + showSearch | |
72 | + allowClear | |
73 | + optionFilterProp="children" | |
74 | + loading={comBussinessLoading} | |
75 | + onChange={searchType} | |
76 | + style={{ width: 200 }} | |
162 | 77 | > |
163 | - <Column title="账户名称" dataIndex="compName" /> | |
164 | - <Column title="业务类型" dataIndex="compTypeName" /> | |
165 | - <Column title="社会信用代码" dataIndex="creditCode" width="15%" /> | |
166 | - </Table> | |
167 | - </Spin> | |
168 | - </Modal> | |
78 | + {comBussinessList.map((item) => ( | |
79 | + <Select.Option key={item.id} value={item.id}> | |
80 | + {item.name} | |
81 | + </Select.Option> | |
82 | + ))} | |
83 | + </Select> | |
84 | + </div> | |
85 | + | |
86 | + <Table | |
87 | + loading={loading} | |
88 | + dataSource={compList} | |
89 | + pagination={{ ...paginationConfig, showSizeChanger: false }} | |
90 | + rowKey="id" | |
91 | + rowSelection={{ | |
92 | + type: "checkbox", | |
93 | + selectedRowKeys: selectData.map((row) => row.id as number), | |
94 | + onSelect: (row: any, _selected: boolean) => { | |
95 | + const index = selectData.findIndex((_row) => _row.id == row.id); | |
96 | + if (_selected) { | |
97 | + selectData.unshift(row); | |
98 | + } else if (index > -1) { | |
99 | + selectData.splice(index, 1); | |
100 | + } | |
101 | + setSelectData([...selectData]); | |
102 | + }, | |
103 | + onSelectAll: (selected, selectedRows, changeRows) => { | |
104 | + const changedKeys = changeRows.map((row) => row.id); | |
105 | + let newData = []; | |
106 | + // 全选 | |
107 | + if (selected) { | |
108 | + // 过滤掉已选的 | |
109 | + newData = selectData.concat(changeRows.filter((row) => !selectData.some((item) => item == row.id))); | |
110 | + } else { | |
111 | + // 全不选 - 去掉已选的 | |
112 | + newData = selectData.filter((row) => !changedKeys.find((y) => y === row.id)); | |
113 | + } | |
114 | + setSelectData(newData); | |
115 | + }, | |
116 | + }} | |
117 | + > | |
118 | + <Column title="账户名称" dataIndex="compName" /> | |
119 | + <Column title="业务类型" dataIndex="compTypeName" /> | |
120 | + <Column title="社会信用代码" dataIndex="creditCode" width="15%" /> | |
121 | + </Table> | |
122 | + <div style={{ width: "100%", textAlign: "center", marginTop: 30 }}> | |
123 | + <Button type="primary" style={{ marginBottom: 10 }} onClick={() => history.back()}> | |
124 | + 返回列表 | |
125 | + </Button> | |
126 | + | |
127 | + {!!selectData.length && ( | |
128 | + <> | |
129 | + <Divider type="vertical" /> | |
130 | + <Button | |
131 | + type="primary" | |
132 | + style={{ marginBottom: 10 }} | |
133 | + onClick={() => { | |
134 | + onNext && onNext(); | |
135 | + }} | |
136 | + > | |
137 | + 下一步 | |
138 | + </Button> | |
139 | + </> | |
140 | + )} | |
141 | + </div> | |
142 | + </> | |
169 | 143 | ); |
170 | 144 | } |
171 | 145 | ... | ... |
src/pages/finance/CompanyRelationCreate/entity.ts
0 → 100644
1 | +// 发票要求 1:支付前 2:支付后 | |
2 | +export const invoiceRequirements = [ | |
3 | + { | |
4 | + label: "支付前", | |
5 | + value: 1, | |
6 | + }, | |
7 | + { | |
8 | + label: "支付后", | |
9 | + value: 2, | |
10 | + }, | |
11 | +]; | |
12 | + | |
13 | +export enum RequirementsTypeEnum { | |
14 | + "支付前" = 1, | |
15 | + "支付后", | |
16 | +} | |
17 | + | |
18 | +// 往来单位支付方式 | |
19 | +export const payWay = [ | |
20 | + { label: "即时支付", value: 1 }, | |
21 | + { label: "周期支付", value: 2 }, | |
22 | + { label: "员工垫付", value: 3 }, | |
23 | +]; | |
24 | + | |
25 | + export enum PayWayEnum { | |
26 | + "即时支付" = 1, | |
27 | + "周期支付", | |
28 | + "员工垫付", | |
29 | + } | ... | ... |
src/pages/finance/CompanyRelationCreate/index.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { Card, Steps, Table, Tabs } from "antd"; | |
3 | +import { PageHeaderWrapper } from "@ant-design/pro-layout"; | |
4 | +import { createStore } from "@/hooks/moz"; | |
5 | +import store from "./useStore"; | |
6 | +import SelectCorrespondenceUnits from "./components/SelectCorrespondenceUnits"; | |
7 | +import RelationshipSettings from "./components/RelationshipSettings"; | |
8 | +import { CompanyRelationListVO } from "@/pages/finance/CompanyRelationAuth/api"; | |
9 | + | |
10 | +const { Column } = Table; | |
11 | +const { TabPane } = Tabs; | |
12 | + | |
13 | +export const { Provider, useStore } = createStore(store); | |
14 | + | |
15 | +function CompanyRelationCreate(props) { | |
16 | + const pathParams = props.location.state || {}; | |
17 | + const { Step } = Steps; | |
18 | + const [current, setCurrent] = useState<number>(0); | |
19 | + const { | |
20 | + selected, | |
21 | + // loading, | |
22 | + selectedRelation, | |
23 | + setSelectedRelation, | |
24 | + submitLoading, | |
25 | + setSubmitLoading, | |
26 | + // setLoading, | |
27 | + companyParams, | |
28 | + setCompanyParams, | |
29 | + } = useStore(); | |
30 | + | |
31 | + useEffect(() => { | |
32 | + setCompanyParams({ ...pathParams }); | |
33 | + }, []); | |
34 | + | |
35 | + const rowSelection = { | |
36 | + onChange: (selectedRowKeys: React.Key[], selectedRows: CompanyRelationListVO[]) => { | |
37 | + setSelectedRelation([...selectedRows]); | |
38 | + }, | |
39 | + getCheckboxProps: (record: CompanyRelationListVO) => ({ | |
40 | + name: String(record.compId), | |
41 | + }), | |
42 | + }; | |
43 | + | |
44 | + return ( | |
45 | + <PageHeaderWrapper title="往来单位关系设置"> | |
46 | + <Card> | |
47 | + <Steps type="navigation" current={current} className="site-navigation-steps"> | |
48 | + <Step title="选择往来单位" /> | |
49 | + <Step title="关系设置" /> | |
50 | + </Steps> | |
51 | + <Tabs | |
52 | + style={{ marginTop: 40 }} | |
53 | + activeKey={String(current)} | |
54 | + tabBarStyle={{ display: "hidden" }} | |
55 | + renderTabBar={() => <div />} | |
56 | + > | |
57 | + <TabPane key="0"> | |
58 | + <SelectCorrespondenceUnits onNext={() => setCurrent(current + 1)} /> | |
59 | + </TabPane> | |
60 | + <TabPane key="1"> | |
61 | + <RelationshipSettings onPrevious={() => setCurrent(0)} /> | |
62 | + </TabPane> | |
63 | + </Tabs> | |
64 | + </Card> | |
65 | + </PageHeaderWrapper> | |
66 | + ); | |
67 | +} | |
68 | + | |
69 | +export default (props) => ( | |
70 | + <Provider> | |
71 | + <CompanyRelationCreate {...props} /> | |
72 | + </Provider> | |
73 | +); | ... | ... |
src/pages/finance/CompanyRelationCreate/useStore.ts
0 → 100644
1 | +import { useState} from "react"; | |
2 | +import useInitial from "@/hooks/useInitail"; | |
3 | +import { CompanyRelationListVO } from "./api"; | |
4 | +import { getCompanyBusinessTypesApi } from "@/pages/finance/TradeCompany/api"; | |
5 | + | |
6 | +export default function useStore() { | |
7 | + const [disabled, setDisabled] = useState<boolean>(true); | |
8 | + const [visible, setVisible] = useState(false); | |
9 | + const [submitLoading, setSubmitLoading] = useState(false); | |
10 | + const [selectData, setSelectData] = useState<TradeCompany.ComList[]>([]); | |
11 | + // 存储已选关系,用于批量删除 | |
12 | + const [selectedRelation, setSelectedRelation] = useState<CompanyRelationListVO[]>([]); | |
13 | + // 存储新增时选择条件 | |
14 | + const [companyParams, setCompanyParams] = useState({ dealerId: -1 }); | |
15 | + | |
16 | + // 往来单位业务类型列表 | |
17 | + const { data: comBussinessList, loading: comBussinessLoading } = useInitial(getCompanyBusinessTypesApi, [], null); | |
18 | + | |
19 | + const [selected, setSelected] = useState<CompanyRelationListVO[]>([]); | |
20 | + | |
21 | + return { | |
22 | + selectData, | |
23 | + setSelectData, | |
24 | + visible, | |
25 | + setVisible, | |
26 | + | |
27 | + disabled, | |
28 | + setDisabled, | |
29 | + selected, | |
30 | + setSelected, | |
31 | + submitLoading, | |
32 | + setSubmitLoading, | |
33 | + comBussinessList, | |
34 | + comBussinessLoading, | |
35 | + selectedRelation, | |
36 | + setSelectedRelation, | |
37 | + companyParams, | |
38 | + setCompanyParams, | |
39 | + }; | |
40 | +} | ... | ... |
src/pages/finance/SpecialAccount/FinancingCompany/components/CreateModal.tsx
... | ... | @@ -14,7 +14,6 @@ export default function CreateModal() { |
14 | 14 | const [form] = Form.useForm(); |
15 | 15 | |
16 | 16 | const [saveLoading, setSaveLoading] = useState<boolean>(false); |
17 | - console.log("current", current); | |
18 | 17 | useEffect(() => { |
19 | 18 | if (visible) { |
20 | 19 | form.setFieldsValue({ |
... | ... | @@ -77,8 +76,6 @@ export default function CreateModal() { |
77 | 76 | } |
78 | 77 | |
79 | 78 | function submit(fieldValue: any) { |
80 | - // console.log("表单参数:", fieldValue); | |
81 | - // return; | |
82 | 79 | const param = { |
83 | 80 | dealerId, |
84 | 81 | ...fieldValue, |
... | ... | @@ -100,13 +97,11 @@ export default function CreateModal() { |
100 | 97 | loan: !!fieldValue.loan, |
101 | 98 | }; |
102 | 99 | setSaveLoading(true); |
103 | - | |
104 | 100 | savePlatformMobile(param) |
105 | 101 | .then((res) => { |
106 | 102 | message.success("保存成功"); |
107 | 103 | setVisible(false); |
108 | 104 | setLoading(true); |
109 | - // setSaveLoading(false); | |
110 | 105 | }) |
111 | 106 | .catch((err) => { |
112 | 107 | message.error(err.message); |
... | ... | @@ -199,7 +194,6 @@ export default function CreateModal() { |
199 | 194 | ))} |
200 | 195 | </Select> |
201 | 196 | </FormItem> |
202 | - | |
203 | 197 | <FormItem name="account" label="一般账户" rules={[{ required: true, message: "请选择一般账户" }]}> |
204 | 198 | <Select labelInValue placeholder="请选择一般账户"> |
205 | 199 | {accountList.map((item) => ( |
... | ... | @@ -275,6 +269,18 @@ export default function CreateModal() { |
275 | 269 | formatter={(value) => `${value} %`} |
276 | 270 | /> |
277 | 271 | </FormItem> |
272 | + {/* 清票划扣账户类型:1 一般户;2 保证金户;3 一般户,保证金户(See: 清票划扣账户类型) */} | |
273 | + <FormItem | |
274 | + name="deductAccountType" | |
275 | + label="清票划扣账户" | |
276 | + rules={[{ required: true, message: "请选择清票划扣账户" }]} | |
277 | + > | |
278 | + <Radio.Group> | |
279 | + <Radio value={1}>一般户</Radio> | |
280 | + <Radio value={2}>保证金户</Radio> | |
281 | + <Radio value={3}>一般户,保证金户</Radio> | |
282 | + </Radio.Group> | |
283 | + </FormItem> | |
278 | 284 | <FormItem name="billLimitDates" label="票据期限" rules={[{ required: true, message: "请输入票据期限" }]}> |
279 | 285 | <InputNumber style={{ width: "100%" }} placeholder="请输入票据期限" formatter={(value) => `${value} 个月`} /> |
280 | 286 | </FormItem> |
... | ... | @@ -285,14 +291,12 @@ export default function CreateModal() { |
285 | 291 | > |
286 | 292 | <InputNumber style={{ width: "100%" }} placeholder="请输入提前天数" formatter={(value) => `${value} 天`} /> |
287 | 293 | </FormItem> |
288 | - | |
289 | 294 | <FormItem name="toLoan" label="是否支持票转贷" rules={[{ required: true, message: "请选择是否支持票转贷" }]}> |
290 | 295 | <Radio.Group> |
291 | 296 | <Radio value={1}>是</Radio> |
292 | 297 | <Radio value={0}>否</Radio> |
293 | 298 | </Radio.Group> |
294 | 299 | </FormItem> |
295 | - | |
296 | 300 | <FormItem noStyle shouldUpdate={(prevValues, currentValues) => prevValues.toLoan != currentValues.toLoan}> |
297 | 301 | {({ getFieldValue }): any => { |
298 | 302 | const category = getFieldValue("toLoan"); |
... | ... | @@ -353,7 +357,6 @@ export default function CreateModal() { |
353 | 357 | ) : null; |
354 | 358 | }} |
355 | 359 | </FormItem> |
356 | - | |
357 | 360 | <FormItem name="loan" label="是否支持贷款启票" rules={[{ required: true, message: "请选择是否支持贷款启票" }]}> |
358 | 361 | <Radio.Group> |
359 | 362 | <Radio value={1}>是</Radio> | ... | ... |
src/pages/finance/TradeCompany/components/AdressSelect.tsx
0 → 100644
1 | +import React, { useEffect, useState } from "react"; | |
2 | +import { Modal, Form, Select, Input, Radio } from "antd"; | |
3 | +import PositionSelector from "@/components/PositionSelector"; | |
4 | +import ShopSelect from "@/components/ShopSelect"; | |
5 | +import * as API from "@/common/api"; | |
6 | +import useInitial from "@/hooks/useInitail"; | |
7 | +import { FormInstance } from "antd/es/form/Form"; | |
8 | + | |
9 | +const FormItem = Form.Item; | |
10 | + | |
11 | +interface Props { | |
12 | + | |
13 | + form: FormInstance; | |
14 | +} | |
15 | + | |
16 | +function AdressSelect(props: Props) { | |
17 | + const {form } = props; | |
18 | + const [hiddern, setHidden] = useState(true); //控制地图选择 | |
19 | + const [own, setOwn] = useState(1); //配置控制 | |
20 | + | |
21 | + const _onChange = (e: any) => { | |
22 | + form.setFieldsValue({ | |
23 | + addrslng: undefined, | |
24 | + addrslat: undefined, | |
25 | + }); | |
26 | + if (e.target.value === 1) { | |
27 | + setHidden(true); | |
28 | + setOwn(e.target.value); | |
29 | + } else { | |
30 | + setHidden(false); | |
31 | + setOwn(e.target.value); | |
32 | + } | |
33 | + }; | |
34 | + | |
35 | + const onAd = (e: any) => { | |
36 | + form.setFieldsValue({ | |
37 | + addrslng: e.point.lng, | |
38 | + addrslat: e.point.lat, | |
39 | + }); | |
40 | + }; | |
41 | + | |
42 | + return ( | |
43 | + <> | |
44 | + <FormItem label="地理位置" rules={[{ required: true, message: "请配置地址" }]}> | |
45 | + <Radio.Group onChange={(e: any) => _onChange(e)} value={own}> | |
46 | + <Radio value={1}>地图配置</Radio> | |
47 | + <Radio value={2}>自定义配置</Radio> | |
48 | + </Radio.Group> | |
49 | + </FormItem> | |
50 | + {hiddern && ( | |
51 | + <FormItem name="location" label="地址" rules={[{ required: true, message: "必填" }]}> | |
52 | + <PositionSelector style={{ width: "100%" }} onChange={(e: any) => onAd(e)} /> | |
53 | + </FormItem> | |
54 | + )} | |
55 | + <div | |
56 | + style={{ | |
57 | + display: "flex", | |
58 | + justifyContent: "space-between", | |
59 | + width: "80%", | |
60 | + marginLeft: "15%", | |
61 | + }} | |
62 | + > | |
63 | + <FormItem name="longitude" label="经度" style={{ width: "45%" }} rules={[{ required: true, message: "必填" }]}> | |
64 | + <Input style={{ width: "100%" }} disabled={own === 1} /> | |
65 | + </FormItem> | |
66 | + <FormItem name="latitude" label="纬度" style={{ width: "45%" }} rules={[{ required: true, message: "必填" }]}> | |
67 | + <Input style={{ width: "100%" }} disabled={own === 1} /> | |
68 | + </FormItem> | |
69 | + </div> | |
70 | + </> | |
71 | + ); | |
72 | +} | |
73 | + | |
74 | +export default AdressSelect; | ... | ... |
src/pages/finance/TradeCompany/components/CreateModal.tsx
... | ... | @@ -6,6 +6,7 @@ import PositionSelector from "@/components/PositionSelector"; |
6 | 6 | import Contact from "./ContactsInput"; |
7 | 7 | import Account from "./AccountsInput"; |
8 | 8 | import { createCompanyApi, updateCompanyApi, getDetailComAccountApi } from "../api"; |
9 | +import AdressSelect from "@/pages/finance/TradeCompany/components/AdressSelect"; | |
9 | 10 | |
10 | 11 | const FormItem = Form.Item; |
11 | 12 | const { Option } = Select; |
... | ... | @@ -31,6 +32,7 @@ export default function CreateModal() { |
31 | 32 | item = data; |
32 | 33 | } |
33 | 34 | form.setFieldsValue({ |
35 | + ...item, | |
34 | 36 | compName: item.compName, |
35 | 37 | compShortName: item.compShortName, |
36 | 38 | subjectType: item.subjectType, |
... | ... | @@ -41,7 +43,9 @@ export default function CreateModal() { |
41 | 43 | brandId: item.brandId, |
42 | 44 | location: item.compAddress |
43 | 45 | ? { |
44 | - address: "", | |
46 | + // address: "", | |
47 | + //@ts-ignored; | |
48 | + address: item.lonLatAddress||"", | |
45 | 49 | point: { |
46 | 50 | lng: item.longitude, |
47 | 51 | lat: item.latitude, |
... | ... | @@ -61,8 +65,9 @@ export default function CreateModal() { |
61 | 65 | const param = { |
62 | 66 | id: current.id, |
63 | 67 | ...item, |
64 | - longitude: (item.location?.point || {}).lng, | |
65 | - latitude: (item.location?.point || {}).lat, | |
68 | + longitude: Number(item.longitude), | |
69 | + latitude: Number(item.latitude), | |
70 | + lonLatAddress: item.location? item.location.address : "", | |
66 | 71 | }; |
67 | 72 | setSavelLoading(true); |
68 | 73 | const saveApi = current.id ? updateCompanyApi : createCompanyApi; |
... | ... | @@ -104,7 +109,7 @@ export default function CreateModal() { |
104 | 109 | }} |
105 | 110 | width="60%" |
106 | 111 | > |
107 | - <Form form={form} onFinish={submit} labelCol={{ span: 6 }} wrapperCol={{ span: 15 }}> | |
112 | + <Form form={form} onFinish={submit} labelCol={{ span: 4 }} wrapperCol={{ span: 18 }}> | |
108 | 113 | <FormItem name="compName" label="往来单位名称" rules={[{ required: true, message: "请填入往来单位名称" }]}> |
109 | 114 | <Input placeholder="请填入往来单位名称" maxLength={64} /> |
110 | 115 | </FormItem> |
... | ... | @@ -151,16 +156,16 @@ export default function CreateModal() { |
151 | 156 | const _compType = getFieldValue("compType"); |
152 | 157 | return _compType?.includes(CompanyBusinessTypeEnum["新车采购(主机厂)"]) || |
153 | 158 | _compType?.includes(CompanyBusinessTypeEnum["配件采购"]) ? ( |
154 | - <FormItem name="brandId" label="品牌" rules={[{ required: true, message: "请选择品牌" }]}> | |
155 | - <Select placeholder="请选择品牌" showSearch optionFilterProp="children"> | |
156 | - {brandList?.map((item) => ( | |
157 | - <Option key={item.id} value={item.id}> | |
158 | - {item.name} | |
159 | - </Option> | |
160 | - ))} | |
161 | - </Select> | |
162 | - </FormItem> | |
163 | - ) : null; | |
159 | + <FormItem name="brandId" label="品牌" rules={[{ required: true, message: "请选择品牌" }]}> | |
160 | + <Select placeholder="请选择品牌" showSearch optionFilterProp="children"> | |
161 | + {brandList?.map((item) => ( | |
162 | + <Option key={item.id} value={item.id}> | |
163 | + {item.name} | |
164 | + </Option> | |
165 | + ))} | |
166 | + </Select> | |
167 | + </FormItem> | |
168 | + ) : null; | |
164 | 169 | }} |
165 | 170 | </FormItem> |
166 | 171 | <FormItem |
... | ... | @@ -173,13 +178,14 @@ export default function CreateModal() { |
173 | 178 | <FormItem name="compAddress" label="通信地址" rules={[{ required: true, message: "请输入地址" }]}> |
174 | 179 | <Input placeholder="请输入通信地址" /> |
175 | 180 | </FormItem> |
176 | - <FormItem name="location" label="地理位置"> | |
177 | - <PositionSelector style={{ width: "100%" }} /> | |
178 | - </FormItem> | |
181 | + {/* <FormItem name="location" label="地理位置" rules={[{ required: true, message: "请配置地址" }]}> */} | |
182 | + {/* <PositionSelector style={{ width: "100%" }} /> */} | |
183 | + <AdressSelect form={form} /> | |
184 | + {/* </FormItem> */} | |
179 | 185 | <FormItem name="contacts" label="联系方式" rules={[{ required: true }]}> |
180 | 186 | <Contact /> |
181 | 187 | </FormItem> |
182 | - <FormItem name="accounts" label="账户信息" rules={[{ required: true }]}> | |
188 | + <FormItem name="accounts" label="账户信息" c rules={[{ required: true }]}> | |
183 | 189 | <Account /> |
184 | 190 | </FormItem> |
185 | 191 | </Form> | ... | ... |
src/pages/notice/PublicRelease/store.ts
1 | 1 | /* |
2 | 2 | * @Date: 2021-08-10 10:05:18 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2022-11-02 16:18:14 | |
4 | + * @LastEditTime: 2022-12-09 14:21:58 | |
5 | 5 | */ |
6 | 6 | |
7 | 7 | import useInitial from "@/hooks/useInitail"; |
... | ... | @@ -9,40 +9,6 @@ import usePagination from "@/hooks/usePagination"; |
9 | 9 | import { useMemo, useState } from "react"; |
10 | 10 | import * as api from "./api"; |
11 | 11 | |
12 | -export default function useStore() { | |
13 | - const [listType, setListType] = useState<"列表" | "草稿">("列表"); | |
14 | - const listPagination = usePagination(api.getPublicListApi); | |
15 | - const draftPagination = usePagination(api.getDraftListApi); | |
16 | - const { data: TypeList } = useInitial(api.getFileTypeListApi, [], null); | |
17 | - const { data: Way } = useInitial(api.getPublicWayListApi, [], null); | |
18 | - const [visible, setVisible] = useState(false); | |
19 | - const [current, setCurrent] = useState<PublicNotice.ListVO>(); | |
20 | - const [isView, setIsView] = useState(false); // 是否查看 | |
21 | - const [isChangeDetail, setIsChangeDetial] = useState(false); // 是否查看变更记录 | |
22 | - const [fileChangeId, setFileChangeId] = useState<number>(); // 变更记录ID,用于查询变更记录详情使用 | |
23 | - const [rangeDetailVisible, setRangeDetailVisible] = useState(false); // 是否打开执行范围详情 | |
24 | - const [isChange, setIsChange] = useState(false); // 是否变更执行文件 | |
25 | - const [approvalProgressModalInfo, setApprovalProgressModalInfo] = | |
26 | - useState<PublicNotice.ApprovalProgressModalInfo>({ visible: false }); | |
27 | - const [fidModal, setFidModal] = useState<{ | |
28 | - visible: boolean; | |
29 | - title?: string; | |
30 | - fidList?: string[]; | |
31 | - }>({ visible: false }); | |
32 | - | |
33 | - const [fileProgressModal, setFileProgressModal] = useState<{ | |
34 | - visible: boolean; | |
35 | - id?: number; // 执行文件ID | |
36 | - title?: string; // 执行文件名 | |
37 | - loading?: boolean; | |
38 | - data?: CommonProgress.Item[]; | |
39 | - }>({ visible: false }); | |
40 | - | |
41 | - const pagination = useMemo( | |
42 | - () => (listType === "列表" ? listPagination : draftPagination), | |
43 | - [listType, listPagination, draftPagination] | |
44 | - ); | |
45 | - | |
46 | 12 | enum RangeType { |
47 | 13 | "全集团" = 1, |
48 | 14 | "部分人员", |
... | ... | @@ -114,6 +80,40 @@ export default function useStore() { |
114 | 80 | "#F4333C", |
115 | 81 | } |
116 | 82 | |
83 | +export default function useStore() { | |
84 | + const [listType, setListType] = useState<"列表" | "草稿">("列表"); | |
85 | + const listPagination = usePagination(api.getPublicListApi, { fileStatus: FileStatus.执行中 }); | |
86 | + const draftPagination = usePagination(api.getDraftListApi); | |
87 | + const { data: TypeList } = useInitial(api.getFileTypeListApi, [], null); | |
88 | + const { data: Way } = useInitial(api.getPublicWayListApi, [], null); | |
89 | + const [visible, setVisible] = useState(false); | |
90 | + const [current, setCurrent] = useState<PublicNotice.ListVO>(); | |
91 | + const [isView, setIsView] = useState(false); // 是否查看 | |
92 | + const [isChangeDetail, setIsChangeDetial] = useState(false); // 是否查看变更记录 | |
93 | + const [fileChangeId, setFileChangeId] = useState<number>(); // 变更记录ID,用于查询变更记录详情使用 | |
94 | + const [rangeDetailVisible, setRangeDetailVisible] = useState(false); // 是否打开执行范围详情 | |
95 | + const [isChange, setIsChange] = useState(false); // 是否变更执行文件 | |
96 | + const [approvalProgressModalInfo, setApprovalProgressModalInfo] = | |
97 | + useState<PublicNotice.ApprovalProgressModalInfo>({ visible: false }); | |
98 | + const [fidModal, setFidModal] = useState<{ | |
99 | + visible: boolean; | |
100 | + title?: string; | |
101 | + fidList?: string[]; | |
102 | + }>({ visible: false }); | |
103 | + | |
104 | + const [fileProgressModal, setFileProgressModal] = useState<{ | |
105 | + visible: boolean; | |
106 | + id?: number; // 执行文件ID | |
107 | + title?: string; // 执行文件名 | |
108 | + loading?: boolean; | |
109 | + data?: CommonProgress.Item[]; | |
110 | + }>({ visible: false }); | |
111 | + | |
112 | + const pagination = useMemo( | |
113 | + () => (listType === "列表" ? listPagination : draftPagination), | |
114 | + [listType, listPagination, draftPagination] | |
115 | + ); | |
116 | + | |
117 | 117 | const gotoDraftList = (item: PublicNotice.ListVO) => { |
118 | 118 | draftPagination.setParams({ fileId: item.id, fileName: item.title }); |
119 | 119 | setTimeout(() => { | ... | ... |
src/pages/pms/partPlan/MinRatioPlan/components/StepBnt.tsx
... | ... | @@ -8,7 +8,7 @@ interface Props { |
8 | 8 | } |
9 | 9 | export default function Index({length}: Props) { |
10 | 10 | const { bntLoading, getStep2, current, setCurrent, getSummary, submit, summarySupplier, brandId, parts } = useStore(); |
11 | - const flag = _.flattenDeep(summarySupplier.map(it => it.parts || [])).length == parts.length; | |
11 | + // const flag = _.flattenDeep(summarySupplier.map(it => it.parts || [])).length == parts.length; | |
12 | 12 | const next = _.throttle(() => { |
13 | 13 | if (current == 1) { |
14 | 14 | getStep2(); |
... | ... | @@ -40,7 +40,7 @@ export default function Index({length}: Props) { |
40 | 40 | {current == length && ( |
41 | 41 | <Button |
42 | 42 | type="primary" |
43 | - disabled={!brandId || summarySupplier.length == 0 || !flag} | |
43 | + disabled={!brandId || summarySupplier.length == 0 } | |
44 | 44 | loading={bntLoading} |
45 | 45 | onClick={onSubmit} |
46 | 46 | > | ... | ... |
src/pages/pms/storage/partShop/components/UploadExcel.tsx
... | ... | @@ -2,18 +2,27 @@ import React, { useState } from 'react'; |
2 | 2 | import { InboxOutlined } from '@ant-design/icons'; |
3 | 3 | import { Button, Modal, Upload, message, Switch } from 'antd'; |
4 | 4 | import { useStore } from "@/pages/pms/storage/partShop"; |
5 | +import {importStockFix, shopImport} from './api'; | |
6 | +import _ from 'lodash'; | |
7 | +import type { UploadFile, UploadProps } from 'antd/es/upload/interface'; | |
5 | 8 | |
6 | 9 | interface Props{ |
7 | 10 | stock?:boolean |
8 | 11 | } |
12 | +const apiObj: {[key: number]: any} = { | |
13 | + 1: importStockFix, | |
14 | + 2: shopImport | |
15 | +}; | |
9 | 16 | const Dragger = Upload.Dragger; |
10 | 17 | export default function UploadExcel(props: Props) { |
11 | 18 | const { importVisible, setImportVisible, override, setOverride } = useStore(); |
12 | - const [fileList, setFileList] = useState<any[]>([]); | |
19 | + const [fileList, setFileList] = useState<UploadFile[]>([]); | |
13 | 20 | const [uploadResult, setUploadResult] = useState<any>(); |
21 | + const [confirmLoading, setConfirmLoading] = useState(false); | |
14 | 22 | const {stock} = props; |
15 | 23 | |
16 | 24 | function beforeUpload(file: any) { |
25 | + setFileList([...fileList, file]); | |
17 | 26 | if (override == null) { |
18 | 27 | message.error('请选择是否覆盖数据'); |
19 | 28 | return false; |
... | ... | @@ -23,37 +32,36 @@ export default function UploadExcel(props: Props) { |
23 | 32 | message.error('文件不能超过20MB!'); |
24 | 33 | return false; |
25 | 34 | } |
26 | - return isLt2M; | |
35 | + return false; | |
27 | 36 | } |
28 | 37 | |
29 | - function handleChange(info: any) { | |
30 | - const { file: { status, response }, fileList } = info; | |
31 | - if (status !== 'uploading' && response) { | |
32 | - const { success, result, data } = response; | |
33 | - if (status === 'done' && success) { | |
34 | - message.success(`${info.file.name} 上传成功`); | |
35 | - // 调用上传接口 | |
36 | - setUploadResult(data); | |
37 | - } else if (response && !success) { | |
38 | - message.error(`${info.file.name} 上传失败: ${result}`); | |
39 | - } | |
40 | - } | |
41 | - setFileList(fileList.splice(-1)); | |
42 | - } | |
43 | - function handleChangeStock(info: any) { | |
44 | - const { file: { status, response }, fileList } = info; | |
45 | - if (status !== 'uploading' && response) { | |
46 | - const { success, result, data } = response; | |
47 | - if (status === 'done' && success) { | |
48 | - message.success(`${info.file.name} 上传成功`); | |
49 | - // 调用上传接口 | |
50 | - setUploadResult(data); | |
51 | - } else if (response && !success) { | |
52 | - message.error(`${info.file.name} 上传失败: ${result}`); | |
53 | - } | |
38 | + function submit() { | |
39 | + if (override == null) { | |
40 | + message.error('请选择是否覆盖数据'); | |
41 | + return; | |
54 | 42 | } |
55 | - setFileList(fileList.splice(-1)); | |
43 | + setConfirmLoading(true); | |
44 | + const type = stock ? 1 : 2; | |
45 | + apiObj[type]({file: fileList[0], override}).then((res) => { | |
46 | + setConfirmLoading(false); | |
47 | + setUploadResult(res.data) | |
48 | + message.success('导入成功'); | |
49 | + }).catch((e: any) => { | |
50 | + setConfirmLoading(false); | |
51 |