Commit 79d6f580 authored by wuhao's avatar wuhao 🎯

asder

parent 6bf879ab
/*
* @Author: wuhao930406 1148547900@qq.com
* @Date: 2023-09-19 08:36:54
* @LastEditors: wuhao930406 1148547900@qq.com
* @LastEditTime: 2023-09-19 08:54:01
* @FilePath: /ems3.3/config/config.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
// https://umijs.org/config/ // https://umijs.org/config/
import { defineConfig } from '@umijs/max'; import { defineConfig } from '@umijs/max';
import { join } from 'path'; import { join } from 'path';
...@@ -42,7 +52,7 @@ export default defineConfig({ ...@@ -42,7 +52,7 @@ export default defineConfig({
publicPath: process.env.NODE_ENV === 'production' ? './' : '/', publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
initialState: {}, initialState: {},
model: {}, model: {},
// keepalive: keepalive, keepalive: keepalive,
layout: { layout: {
// https://umijs.org/zh-CN/plugins/plugin-layout // https://umijs.org/zh-CN/plugins/plugin-layout
locale: false, locale: false,
......
/*
* @Author: wuhao930406 1148547900@qq.com
* @Date: 2023-09-19 08:36:54
* @LastEditors: wuhao930406 1148547900@qq.com
* @LastEditTime: 2023-09-19 08:41:04
* @FilePath: /ems3.3/config/proxy.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
/** /**
* 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
* ------------------------------- * -------------------------------
...@@ -13,7 +23,7 @@ export default { ...@@ -13,7 +23,7 @@ export default {
dev: { dev: {
[defaultSetting.proxypath]: { [defaultSetting.proxypath]: {
// 要代理的地址 // 要代理的地址
target: 'http://192.168.40.110:8000', //jf哥 target: 'http://192.168.40.111:8000', //jf哥
// target: 'http://192.168.40.248:8080', //jf哥 // target: 'http://192.168.40.248:8080', //jf哥
// target: 'http://192.168.40.64:28000', //gc哥 // target: 'http://192.168.40.64:28000', //gc哥
// target: 'http://192.168.40.203:8000', //dj哥 // target: 'http://192.168.40.203:8000', //dj哥
......
...@@ -54,7 +54,7 @@ const TagView = ({ children, home }) => { ...@@ -54,7 +54,7 @@ const TagView = ({ children, home }) => {
}; };
// 监听路由改变 // 监听路由改变
const handleOnChange = (routeContext) => { const handleOnChange = async (routeContext) => {
const { currentMenu } = routeContext; const { currentMenu } = routeContext;
// console.log(tagList); // console.log(tagList);
// tags初始化 // tags初始化
...@@ -64,7 +64,7 @@ const TagView = ({ children, home }) => { ...@@ -64,7 +64,7 @@ const TagView = ({ children, home }) => {
// 判断是否已打开过该页面 // 判断是否已打开过该页面
let hasOpen = false; let hasOpen = false;
if (currentMenu.path) { if (currentMenu.path) {
const tagsCopy = tagList.map((item) => { let tagsCopy = tagList.map((item) => {
if (currentMenu?.path === item.path) { if (currentMenu?.path === item.path) {
//console.log(item); //console.log(item);
hasOpen = true; hasOpen = true;
...@@ -87,6 +87,8 @@ const TagView = ({ children, home }) => { ...@@ -87,6 +87,8 @@ const TagView = ({ children, home }) => {
refresh: 0, refresh: 0,
active: true, active: true,
}); });
await setrefresh(false);
setrefresh(true);
} }
return setTagList(tagsCopy); return setTagList(tagsCopy);
...@@ -162,7 +164,7 @@ const TagView = ({ children, home }) => { ...@@ -162,7 +164,7 @@ const TagView = ({ children, home }) => {
</div> </div>
<div className={styles.child}> <div className={styles.child}>
<div className={styles.contianbox}> <div className={styles.contianbox}>
<div style={{ width: "100%", height: "100%" }}> {refresh && children}</div> <div style={{ width: '100%', height: '100%' }}> {refresh && children}</div>
</div> </div>
</div> </div>
</> </>
......
...@@ -4,260 +4,304 @@ import AutoTable from '@/components/AutoTable'; ...@@ -4,260 +4,304 @@ import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch, exportFetch } from '@/utils/doFetch'; import { doFetch, exportFetch } from '@/utils/doFetch';
import { useRequest } from "ahooks"; import { useRequest } from 'ahooks';
import { Divider, Tabs, ProDescriptions, message } from "antd"; import { Divider, Tabs, ProDescriptions, message } from 'antd';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import Leaseterminformation from "./Leaseterminformation"; import Leaseterminformation from './Leaseterminformation';
import { useLocation } from '@umijs/max'; import { useLocation } from '@umijs/max';
const Costanalysis = () => { const Costanalysis = () => {
const { pathname, state } = useLocation(); const { pathname, state } = useLocation();
let actionRef = useRef(), formRef = useRef(), boxRef = useRef(); let actionRef = useRef(),
const [drawer, setdrawer] = useState({ formRef = useRef(),
open: false, boxRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
}), }),
[extraparams, setextraparams] = useState({}), [extraparams, setextraparams] = useState({}),
[activeKey, catk] = useState(''), [activeKey, catk] = useState(''),
[searchParams, csearch] = useState({}); [searchParams, csearch] = useState({});
const { run, loading, runAsync } = useRequest(doFetch, { const { run, loading, runAsync } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, params) => { onSuccess: (res, params) => {
if (res?.code == "0000") { if (res?.code == '0000') {
actionRef?.current?.reload(); actionRef?.current?.reload();
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: false, open: false,
})); }));
} }
}, },
});
const columns = useMemo(() => {
csearch({});
let defcolumn =
getcolumns(setdrawer, activeKey)?.filter((it) => it.key == activeKey)?.[0]?.columns ?? [];
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: activeKey == 'item-1' ? 260 : 100,
render: (text, row, _, action) => rightExtra(text, row, _, action),
}); });
const columns = useMemo(() => { }, [activeKey]);
csearch({}); const tabList = useMemo(() => {
let defcolumn = getcolumns(setdrawer, activeKey)?.filter(it => it.key == activeKey)?.[0]?.columns ?? []; return getcolumns();
return defcolumn.concat({ }, [activeKey]);
title: '操作', const rightExtra = (text, row, _, action) => {
valueType: 'option', return [
width: activeKey == 'item-1' ? 260 : 100, activeKey == 'item-1' && (
render: (text, row, _, action) => rightExtra(text, row, _, action), <PremButton
}); key="confirm"
}, [activeKey]); btn={{
const tabList = useMemo(() => { size: 'small',
return getcolumns(); onClick: async () => {
}, [activeKey]); let res = await doFetch({
const rightExtra = (text, row, _, action) => { url: '/lease/umContractEquipment/queryBeforeCollection',
return [ params: { id: row.id },
activeKey == 'item-1' && <PremButton });
key='confirm' if (res?.data?.data?.waitNum == 0) {
btn={{ message.warning('该设备需回款的租期已全部回款,无需再次回款!');
size: 'small', } else {
onClick: async () => { setdrawer((s) => ({
let res = await doFetch({ url: '/lease/umContractEquipment/queryBeforeCollection', params: { id: row.id } }); ...s,
if (res?.data?.data?.waitNum == 0) { open: true,
message.warning('该设备需回款的租期已全部回款,无需再次回款!') item: {
} else { ...row,
setdrawer((s) => ({ waitNum: res?.data?.data?.waitNum,
...s, isColl: res?.data?.data?.isColl,
open: true, },
item: { ...row, waitNum: res?.data?.data?.waitNum, isColl: res?.data?.data?.isColl }, val: 'confirm',
val: 'confirm', title: '回款确认',
title: '回款确认', fields: [
fields: [ {
{ title: '本期是否回款',
title: '本期是否回款', dataIndex: 'isColl',
dataIndex: 'isColl', key: 'isColl',
key: 'isColl', fieldProps: {
fieldProps: { disabled: true,
disabled: true },
}, colProps: { span: 8 },
colProps: { span: 8 },
},
{
title: '剩余回款期数',
dataIndex: 'waitNum',
key: 'waitNum',
fieldProps: {
disabled: true
},
valueType: 'digit',
colProps: { span: 8 },
},
{
title: '本次回款期数',
dataIndex: 'collNum',
key: 'collNum',
valueType: 'digit',
colProps: { span: 8 },
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }
},
{
title: '回款形式',
dataIndex: 'collType',
key: 'collType',
valueType: 'select',
options: [
{ label: '现金', value: 1 },
{ label: '银行承兑', value: 2 },
],
colProps: { span: 8 },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
]
}));
}
}, },
}} {
> title: '剩余回款期数',
回款确认 dataIndex: 'waitNum',
</PremButton>, key: 'waitNum',
activeKey == 'item-1' && <PremButton fieldProps: {
key='reduction' disabled: true,
btn={{ },
size: 'small', valueType: 'digit',
onClick: () => { colProps: { span: 8 },
setdrawer((s) => ({
...s,
open: true,
item: { ...row, reducePrice: null },
val: 'reduction',
title: '租金减免',
fields: [
{
title: '当前减免金额(元)',
dataIndex: 'reducePrice',
key: 'reducePrice',
valueType: 'digit',
colProps: { span: 8 },
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }
},
{
title: '减免情况说明',
dataIndex: 'reduceRemark',
key: 'reduceRemark',
valueType: 'textarea',
colProps: { span: 24 },
},
{
title: '附件上传',
dataIndex: 'reduceFileList',
key: 'reduceFileList',
valueType: 'uploadBtn',
fieldProps: {
limit: 1,
},
colProps: { span: 24 }
}
]
}));
}, },
}} {
> title: '本次回款期数',
租金减免 dataIndex: 'collNum',
</PremButton>, key: 'collNum',
<PremButton valueType: 'digit',
key='invoicing' colProps: { span: 8 },
btn={{ precision: 0,
size: 'small', formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
onClick: async () => {
let res = await doFetch({ url: '/lease/umContractEquipment/queryBeforeInvoicing', params: { id: row.id } });
if (res?.data?.data?.openNum == 0) {
message.warning('该设备已无需要开票的租期,无需开票记录!')
} else {
setdrawer((s) => ({
...s,
open: true,
item: { ...row, openNum: null },
val: 'invoicing',
title: '开票记录',
fields: [
{
title: '开票期数',
dataIndex: 'openNum',
key: 'openNum',
valueType: 'digit',
colProps: { span: 8 },
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }
}
]
}));
}
}, },
}} {
> title: '回款形式',
开票记录 dataIndex: 'collType',
</PremButton> key: 'collType',
] valueType: 'select',
}; options: [
useEffect(() => { { label: '现金', value: 1 },
if (state) { { label: '银行承兑', value: 2 },
catk(state.pageStatus == 1 ? 'item-1' : 'item-2'); ],
setextraparams(state.extraparams); colProps: { span: 8 },
} else { formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
catk('item-1'); },
} ],
}, [state]); }));
return <div ref={boxRef}> }
<AutoTable },
pagetitle={<h3 className="page-title">费用分析</h3>} }}
columns={columns} >
extraparams={extraparams} 回款确认
path={activeKey == 'item-1' ? '/lease/umContractEquipment/queryNoAnalysis' : '/lease/umContractEquipment/queryYesAnalysis'} </PremButton>
actionRef={actionRef} ),
resizeable={false} activeKey == 'item-1' && (
bordered={false} <PremButton
x={2500} key="reduction"
onTabChange={(key) => { btn={{
catk(key); size: 'small',
setextraparams({}); onClick: () => {
}} setdrawer((s) => ({
activeTabKey={activeKey} ...s,
tabList={tabList} open: true,
pageextra={'export'} item: { ...row, reducePrice: null },
formRef={formRef} val: 'reduction',
dataSourceFieldsChange={(vals) => { title: '租金减免',
csearch(vals) fields: [
}} {
exportconfig={{ title: '当前减免金额(元)',
btn: { dataIndex: 'reducePrice',
type: 'primary', key: 'reducePrice',
onClick: async () => { valueType: 'digit',
message.warning('导出中,请稍后'); colProps: { span: 8 },
await exportFetch({ url: activeKey == 'item-1' ? '/lease/umContractEquipment/exportExcelNoAnalysis' : '/lease/umContractEquipment/exportExcelYesAnalysis', params: { ...extraparams, ...searchParams } }); precision: 0,
} formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
} },
}} {
/> title: '减免情况说明',
dataIndex: 'reduceRemark',
key: 'reduceRemark',
valueType: 'textarea',
colProps: { span: 24 },
},
{
title: '附件上传',
dataIndex: 'reduceFileList',
key: 'reduceFileList',
valueType: 'uploadBtn',
fieldProps: {
limit: 1,
},
colProps: { span: 24 },
},
],
}));
},
}}
>
租金减免
</PremButton>
),
<PremButton
key="invoicing"
btn={{
size: 'small',
onClick: async () => {
let res = await doFetch({
url: '/lease/umContractEquipment/queryBeforeInvoicing',
params: { id: row.id },
});
if (res?.data?.data?.openNum == 0) {
message.warning('该设备已无需要开票的租期,无需开票记录!');
} else {
setdrawer((s) => ({
...s,
open: true,
item: { ...row, openNum: null },
val: 'invoicing',
title: '开票记录',
fields: [
{
title: '开票期数',
dataIndex: 'openNum',
key: 'openNum',
valueType: 'digit',
colProps: { span: 8 },
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
}));
}
},
}}
>
开票记录
</PremButton>,
];
};
useEffect(() => {
if (state) {
catk(state.pageStatus == 1 ? 'item-1' : 'item-2');
setextraparams(state.extraparams);
} else {
catk('item-1');
}
}, [state]);
console.log('====================================');
console.log(extraparams);
console.log('====================================');
<DrawerPro return (
{...drawer} <div ref={boxRef}>
fields={drawer.fields} <AutoTable
params={{ id: drawer?.item?.id }} pagetitle={<h3 className="page-title">费用分析</h3>}
defaultFormValue={drawer?.item ?? {}} columns={columns}
placement="right" extraparams={extraparams}
onClose={() => { path={
setdrawer((s) => ({ activeKey == 'item-1'
...s, ? '/lease/umContractEquipment/queryNoAnalysis'
open: false, : '/lease/umContractEquipment/queryYesAnalysis'
})); }
}} actionRef={actionRef}
onValuesChange={(changedValues, allValues) => { resizeable={false}
bordered={false}
x={2500}
onTabChange={(key) => {
catk(key);
setextraparams({});
}}
activeTabKey={activeKey}
tabList={tabList}
pageextra={'export'}
formRef={formRef}
dataSourceFieldsChange={(vals) => {
csearch(vals);
}}
exportconfig={{
btn: {
type: 'primary',
onClick: async () => {
message.warning('导出中,请稍后');
await exportFetch({
url:
activeKey == 'item-1'
? '/lease/umContractEquipment/exportExcelNoAnalysis'
: '/lease/umContractEquipment/exportExcelYesAnalysis',
params: { ...extraparams, ...searchParams },
});
},
},
}}
/>
}} <DrawerPro
onFinish={async (vals) => { {...drawer}
let newVals = JSON.parse(JSON.stringify(vals)); fields={drawer.fields}
if (drawer?.val == 'confirm') { params={{ id: drawer?.item?.id }}
await runAsync({ url: '/lease/umContractEquipment/collection', params: { collNum: newVals.collNum, collType: newVals.collType, id: drawer?.item?.id } }); defaultFormValue={drawer?.item ?? {}}
} else if (drawer?.val == 'reduction') { placement="right"
await runAsync({ url: '/lease/umContractEquipment/exemption', params: { ...newVals, id: drawer?.item?.id } }); onClose={() => {
} else if (drawer?.val == 'invoicing') { setdrawer((s) => ({
await runAsync({ url: '/lease/umContractEquipment/invoicing', params: { ...newVals, id: drawer?.item?.id } }); ...s,
} open: false,
}} }));
> }}
<Leaseterminformation drawer={drawer} boxRef={boxRef} /> onValuesChange={(changedValues, allValues) => {}}
</DrawerPro> onFinish={async (vals) => {
let newVals = JSON.parse(JSON.stringify(vals));
if (drawer?.val == 'confirm') {
await runAsync({
url: '/lease/umContractEquipment/collection',
params: {
collNum: newVals.collNum,
collType: newVals.collType,
id: drawer?.item?.id,
},
});
} else if (drawer?.val == 'reduction') {
await runAsync({
url: '/lease/umContractEquipment/exemption',
params: { ...newVals, id: drawer?.item?.id },
});
} else if (drawer?.val == 'invoicing') {
await runAsync({
url: '/lease/umContractEquipment/invoicing',
params: { ...newVals, id: drawer?.item?.id },
});
}
}}
>
<Leaseterminformation drawer={drawer} boxRef={boxRef} />
</DrawerPro>
</div> </div>
} );
export default Costanalysis; };
\ No newline at end of file export default Costanalysis;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment