From b460f17012b5a89b27e29d383adeb3b21bf5b146 Mon Sep 17 00:00:00 2001 From: jiangwei Date: Fri, 17 Feb 2023 10:15:48 +0800 Subject: [PATCH] 货拉拉账户配置 --- src/pages/pms/transfer/HuolalaSetting/api.ts | 15 +++++++++++++-- src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx | 27 +++++++++++++++++++++++---- src/pages/pms/transfer/HuolalaSetting/index.tsx | 22 +++++++++++++--------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/pages/pms/transfer/HuolalaSetting/api.ts b/src/pages/pms/transfer/HuolalaSetting/api.ts index cb67373..65fd54a 100644 --- a/src/pages/pms/transfer/HuolalaSetting/api.ts +++ b/src/pages/pms/transfer/HuolalaSetting/api.ts @@ -93,13 +93,24 @@ export interface saveParams{ // @NotBlank(message = "发单账号不能为空") account?:string; } - +interface queryList { + current?:number + pageSize?:number + sysId?:number +} +// 查询财务账户信息列表 export function getList(params: Params):http.PromisePageResp { return request.get(`${PMS_HOST}/erp/finance/account/get/page`, {params}); } +// 新增/编辑API export function saveApi(params: saveParams) { return request.post(`${PMS_HOST}/erp/finance/account/exit`, {...params}); } -export function roleListApi(params: Role.queryList): http.PromisePageResp { +// 推待办角色列表 +export function roleListApi(params: queryList): http.PromisePageResp { return request.get(`${HOST}/role/list`, { params }); +} +// 删除API +export function deleteApi(params: {id: number}) { + return request.post(`${PMS_HOST}/erp/finance/account/delete`, {...params}); } \ No newline at end of file diff --git a/src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx b/src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx index 74fe977..af43eb3 100644 --- a/src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx +++ b/src/pages/pms/transfer/HuolalaSetting/components/AddModal.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import {Form, Button, InputNumber, Modal, message, Input } from 'antd'; import PmsSelect from '@/pages/pms/comonents/PmsSelect'; import { ListVO, saveApi, roleListApi } from '../api'; @@ -14,15 +14,30 @@ interface Props{ onCancel: Function, item?:ListVO } + export default function Index(props:Props) { const { list: suppliers } = usePagination(getPageListApi, { supplierType: 40, pageSize: 500 }); const { data: shops } = useInitail(getShopApi, [], {}); - const { list } = usePagination(roleListApi, [], {}); + const { list } = usePagination(roleListApi, { pageSize: 500, sysId: 229 }); const [loading, setLoading] = useState(false); - const { visible, onCancel, item } = props; const [form] = Form.useForm(); + useEffect(() => { + if (visible && item?.id) { + form.setFieldsValue({ + supplierId: item.supplierId, + shopId: item.shopId, + minAmount: item.minAmount, + roleCode: item.roleCode, + account: item.account + }); + } + if (!visible) { + form.resetFields(); + } + }, [visible]); + const onSave = () => { form.validateFields().then(files => { const params = { @@ -32,6 +47,7 @@ export default function Index(props:Props) { shopId: files.shopId, minAmount: files.minAmount, roleCode: files.roleCode, + roleName: list.find(i => i.roleCode == files.roleCode)?.roleName, account: files.account }; setLoading(true); @@ -80,7 +96,10 @@ export default function Index(props:Props) { - + ({value: item.roleCode, label: item.roleName}))} + /> diff --git a/src/pages/pms/transfer/HuolalaSetting/index.tsx b/src/pages/pms/transfer/HuolalaSetting/index.tsx index 05b0fde..f69ab9b 100644 --- a/src/pages/pms/transfer/HuolalaSetting/index.tsx +++ b/src/pages/pms/transfer/HuolalaSetting/index.tsx @@ -1,23 +1,23 @@ import React, { useState } from 'react'; -import { Card, Button, Table, Divider, Popconfirm } from 'antd'; +import { Card, Button, Table, Divider, Popconfirm, message } from 'antd'; import { PageHeaderWrapper } from '@ant-design/pro-layout'; import AddModal from './components/AddModal'; import ChargeModal from './components/ChargeModal'; -import {getList, ListVO} from './api'; +import {getList, ListVO, deleteApi} from './api'; import usePagination from '@/hooks/usePagination'; const Column = Table.Column; export default function Index() { - const {list, loading, paginationConfig} = usePagination(getList, [], {}); + const {list, loading, paginationConfig, setParams} = usePagination(getList, [], {}); const [current, setCurrent] = useState<{ visible: boolean, item: ListVO }>({visible: false, item: {}}); const [chargeInfo, setChargeInfo] = useState<{ visible: boolean, item: ListVO }>({visible: false, item: {}}); - + const data = [{id: 1, supplierName: "货拉拉", shopName: "不过承诺书可能单纯迪士尼才", amount: 3000, minAmount: 1500, roleName: "计划制定员", account: "15725173,16638183"}]; return ( setCurrent({visible: true, item: {}})}>新增} > - +
@@ -27,19 +27,23 @@ export default function Index() { ( - <> +
setChargeInfo({visible: true, item: r})}>预付款充值申请 setCurrent({visible: true, item: r})}>编辑 {}} + onConfirm={() => { + deleteApi({id: r.id}).then(res => { + message.success('操作成功'); + setParams({}, true); + }).catch(e => message.error(e.message)); + }} > 删除 - - +
)} />
-- libgit2 0.22.2