Commit 24e9a501 authored by 左玲玲's avatar 左玲玲 😬

租赁合同,租赁台账的跳转,费用分析

parent 39a4ab8a
......@@ -98,11 +98,11 @@ export const layout = ({ initialState, setInitialState }) => {
},
links: isDev
? [
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
<LinkOutlined />
<span>OpenAPI 文档</span>
</Link>,
]
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
<LinkOutlined />
<span>OpenAPI 文档</span>
</Link>,
]
: [],
//接口获取菜单数据
menu: {
......@@ -112,8 +112,8 @@ export const layout = ({ initialState, setInitialState }) => {
},
request: (params, defaultMenuData) => {
let lastArr = initialState?.newMenu?.userHavePermList
? JSON.parse(JSON.stringify(initialState?.newMenu?.userHavePermList))
: [],
? JSON.parse(JSON.stringify(initialState?.newMenu?.userHavePermList))
: [],
newArr = [
{
path: '/welcome',
......
......@@ -16,19 +16,8 @@ export default (props) => {
childposition = childposition ?? 'left';
const actionbtn = {
add: <PremButton {...props?.addconfig}>{props?.addconfig?.name || '新增'}</PremButton>,
export: (
<PremButton
{...props?.exportconfig}
btn={{
...props.exportconfig,
icon: <ExportOutlined />,
}}
>
导出
</PremButton>
),
export: <PremButton {...props?.exportconfig}>{props?.exportconfig?.name || '导出'}</PremButton>,
};
//右上角 pageextra 类型 1.reactDom 2.string 以逗号隔开 为none时不显示
const renderextra = () => {
if (props.pageextra && !isString(props.pageextra)) {
......
......@@ -58,8 +58,8 @@ const Mtable = (props) => {
const request = async (params, sort, filter) => {
if (!path) return;
let newparams = {
...params,
...extraparams, //父组件传参
...params,
pageIndex: params.current,
pageSize: params.pageSize || pageSize,
};
......@@ -368,6 +368,7 @@ const Mtable = (props) => {
{...datas}
size={size}
onSubmit={(params) => {
console.log(params);
let newparams = {},
curkey = Object.keys(params)[Object.keys(params).length - 1],
curval = Object.values(params)[Object.keys(params).length - 1];
......
......@@ -56,7 +56,7 @@ const Tags = ({ tagList, closeTag, closeAllTag, closeOtherTag, refreshTag, home
key={item.path}
className={item.active ? `${styles.item} ${styles.active}` : styles.item}
onClick={() => history.push({ pathname: item.path, query: item.query })}
onContextMenu={(e) => openContextMenu(e, item)}
onContextMenu={(e) => openContextMenu(e, { ...item, currentIndex: i })}
>
<span>{item.title}</span>
{i !== 0 && (
......@@ -85,7 +85,7 @@ const Tags = ({ tagList, closeTag, closeAllTag, closeOtherTag, refreshTag, home
>
刷新
</li>
{currentTag.path != home && (
{currentTag.path != home && currentTag.currentIndex != 0 && (
<li
onClick={() => {
setMenuVisible(false);
......
......@@ -3,7 +3,7 @@ import { Tooltip, Tabs } from 'antd';
import Filedetail from "@/components/Filedetail";
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
import { history } from '@umijs/max';
import { useNavigate } from '@umijs/max';
const fields = [
{
title: '合同单号',
......@@ -180,8 +180,10 @@ const fields = [
return <Filedetail files={row?.['refundFileList']} />
}
},
],
columns = [
];
const Details = ({ drawer }) => {
const navigator = useNavigate();
const columns = [
{
title: '设备编号',
dataIndex: 'equipmentNo',
......@@ -198,13 +200,12 @@ const fields = [
<a
className="table-cell"
onClick={() => {
history.push({
path: '/lease/costanalysis',
query: {
navigator('/lease/costanalysis', {
state: {
pageStatus: row.pageStatus,
extraparams: {
contractId: row.contractId,
equipmentId: row.id
equipmentId: row.equipmentId
}
}
})
......@@ -265,7 +266,6 @@ const fields = [
hideInSearch: true
},
];
const Details = ({ drawer }) => {
const items = useMemo(() => {
return [
{
......
......@@ -3,7 +3,6 @@ import { Tooltip, Tabs } from 'antd';
import Filedetail from "@/components/Filedetail";
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
import { history } from '@umijs/max';
const columns = [
{
title: '设备编号',
......@@ -52,8 +51,14 @@ const columns = [
{
title: '采集状态',
dataIndex: 'collectStatusName',
key: 'collectStatusName',
hideInSearch: true
key: 'collectStatus',
valueType: 'select',
options: [
{ label: '工作', value: 1 },
{ label: '待机', value: 2 },
{ label: '关机', value: 3 },
{ label: '报警', value: 4 }
]
},
];
const Devices = ({ drawer }) => {
......
import { Tooltip, Image } from 'antd';
import Filedetail from "@/components/Filedetail";
function getcolumns(setdrawer, drawer) {
function getcolumns(setdrawer, valtype, itemId) {
let common = [
{
title: '合同单号',
......@@ -175,7 +175,7 @@ function getcolumns(setdrawer, drawer) {
},
options: {
path: '/lease/umLeaseLedger/queryLedgerSelectbox',
params: drawer?.val == 'add' ? {} : { contractId: drawer?.item?.id },
params: valtype == 'add' ? {} : { contractId: itemId },
},
},
{
......@@ -302,7 +302,7 @@ function getcolumns(setdrawer, drawer) {
hideInSearch: true,
hideInTable: true,
valueType: 'select',
options: { path: '/lease/umContract/querySelect', params: {} },
options: { path: '/lease/umContract/querySelect', params: { id: valtype == 'edit' ? itemId : '' } },
},
{
title: '合同负责人',
......@@ -325,7 +325,7 @@ function getcolumns(setdrawer, drawer) {
},
colProps: { span: 24 },
render: (_, row) => {
return <Filedetail files={drawer?.val == 'only' ? row?.['contractFileList'] : (row?.['contractFileList']?.[0] ? [row?.['contractFileList']?.[0]] : [])} />
return <Filedetail files={valtype == 'only' ? row?.['contractFileList'] : (row?.['contractFileList']?.[0] ? [row?.['contractFileList']?.[0]] : [])} />
}
}
];
......
......@@ -6,7 +6,7 @@
*/
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import { useState, useMemo, useRef, useEffect } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import FormTable from "@/components/AutoTable/mtable";
......@@ -19,6 +19,7 @@ import Detail from '@/components/RepaireDetail/Detail';
import dayjs from 'dayjs';
import Details from "./Details";
import Devices from "./Devices";
import { useLocation } from '@umijs/max';
const formCommonColumns = [
{
title: '是否可操作',
......@@ -92,14 +93,17 @@ const formCommonColumns = [
}
];
function Contract(props) {
const { state } = useLocation();
let actionRef = useRef(),
formRef = useRef();
formRef = useRef(),
tableRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
}),
[activeTabKey, setactiveTabKey] = useState('1'),
[amount, camount] = useState(0),
[intelligenceList, cil] = useState([]);
[intelligenceList, cil] = useState([]),
[flag, cflag] = useState(false);
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
......@@ -452,11 +456,13 @@ function Contract(props) {
btn={{
size: 'small',
onClick: async () => {
let res = await doFetch({ url: '/lease/umContractEquipment/queryBeforeEndOrHandle', params: { contractId: row.id } });
let res = await doFetch({ url: '/lease/umContractEquipment/queryBeforeEndOrHandle', params: { contractId: row.id } }),
res2 = await doFetch({ url: '/lease/umContract/queryBeforeHandle', params: { id: row.id } });
setdrawer((s) => ({
...s,
open: true,
item: { ...row, deviceList: res?.data?.dataList ?? [] },
item: { ...row, deviceList: res?.data?.dataList ?? [], refund: res2?.data?.data?.value },
val: 'handle',
title: '处理',
fields: [
......@@ -498,10 +504,22 @@ function Contract(props) {
</PremButton>
]
}
useEffect(() => {
if (state) {
cflag(false)
if (state.isFinish == 1) {
setactiveTabKey('1')
} else {
setactiveTabKey('2')
}
setTimeout(() => {
tableRef?.current?.setFieldsValue({ 'contractNo': state.contractNo });
}, 500)
}
}, [state])
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer, drawer).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath = getcolumns(setdrawer, drawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
let defcolumn = getcolumns(setdrawer, drawer?.val, drawer?.item?.id).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath = getcolumns(setdrawer, drawer?.val, drawer?.item?.id).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
if (activeTabKey == 1) {
return defcolumn.concat({
title: '操作',
......@@ -512,7 +530,7 @@ function Contract(props) {
} else {
return defcolumn;
}
}, [activeTabKey, drawer]);
}, [activeTabKey, drawer?.val, drawer?.item?.id]);
const pathconfig = useMemo(() => {
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
......@@ -593,7 +611,10 @@ function Contract(props) {
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
cflag(true);
}}
formRef={tableRef}
extraparams={state?.contractNo && !flag ? { 'contractNo': state?.contractNo } : {}}
/>
<DrawerPro
{...drawer}
......
......@@ -6,6 +6,11 @@ import { Tooltip } from "antd";
import Filedetail from "@/components/Filedetail";
import { doFetch, exportFetch } from '@/utils/doFetch';
import { message } from "antd";
const statusColor = {
1: '#00bce4',
2: '#7ac143',
3: '#6a737b'
}
const commona = [
{
title: '当期金额',
......@@ -29,7 +34,10 @@ const commona = [
title: '状态',
dataIndex: 'statusName',
key: 'statusName',
search: false
search: false,
render: (_, row) => {
return <span style={{ color: statusColor[row.status] }}>{row.statusName}</span>
}
}
],
commonb = [
......@@ -114,10 +122,10 @@ const commona = [
},
{
title: '相关文件',
dataIndex: 'reduceFileFileList',
key: 'reduceFileFileList',
dataIndex: 'reduceFileList',
key: 'reduceFileList',
render: (_, row) => {
return <Filedetail files={row?.['reduceFileFileList']} />
return <Filedetail files={row?.['reduceFileList']} />
}
},
{
......
......@@ -90,6 +90,12 @@ function getcolumns(setdrawer, activeKey) {
key: 'collectionPrice',
hideInSearch: true
},
{
title: '租金减免金额',
dataIndex: 'reducePrice',
key: 'reducePrice',
hideInSearch: true
},
{
title: '逾期次数',
dataIndex: 'overdueNum',
......
......@@ -3,18 +3,21 @@ import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { doFetch, exportFetch } from '@/utils/doFetch';
import { useRequest } from "ahooks";
import { Divider, Tabs, ProDescriptions, message } from "antd";
import dayjs from 'dayjs';
import Leaseterminformation from "./Leaseterminformation";
import { useLocation } from '@umijs/max';
const Costanalysis = () => {
const { pathname, state } = useLocation();
let actionRef = useRef(), formRef = useRef(), boxRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
}),
[extraparams, setextraparams] = useState({}),
[activeKey, catk] = useState('item-1');
[activeKey, catk] = useState('item-1'),
[searchParams, csearch] = useState({});
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
......@@ -28,6 +31,7 @@ const Costanalysis = () => {
},
});
const columns = useMemo(() => {
csearch({});
let defcolumn = getcolumns(setdrawer, activeKey)?.filter(it => it.key == activeKey)?.[0]?.columns ?? [];
return defcolumn.concat({
title: '操作',
......@@ -70,6 +74,7 @@ const Costanalysis = () => {
fieldProps: {
disabled: true
},
valueType: 'digit',
colProps: { span: 8 },
},
{
......@@ -105,8 +110,42 @@ const Costanalysis = () => {
key='reduction'
btn={{
size: 'small',
onClick: async () => {
onClick: () => {
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 }
}
]
}));
},
}}
>
......@@ -117,7 +156,29 @@ const Costanalysis = () => {
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: '此项为必填项' }] }
}
]
}));
}
},
}}
>
......@@ -125,6 +186,12 @@ const Costanalysis = () => {
</PremButton>
]
};
useEffect(() => {
if (state) {
catk(state.pageStatus == 1 ? 'item-1' : 'item-2');
setextraparams(state.extraparams);
}
}, [state])
return <div ref={boxRef}>
<AutoTable
......@@ -138,9 +205,24 @@ const Costanalysis = () => {
extraparams={extraparams}
onTabChange={(key) => {
catk(key);
setextraparams({})
}}
activeTabKey={activeKey}
tabList={getcolumns()}
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 } });
}
}
}}
/>
......@@ -156,6 +238,19 @@ const Costanalysis = () => {
open: false,
}));
}}
onValuesChange={(changedValues, allValues) => {
}}
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>
......
......@@ -2,7 +2,9 @@ import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
import { Tooltip } from "antd";
import { useNavigate, history } from '@umijs/max';
const Leaseresume = ({ setdrawer, drawer }) => {
const navigator = useNavigate();
const columns = [
{
title: '客户名称',
......@@ -31,7 +33,12 @@ const Leaseresume = ({ setdrawer, drawer }) => {
<a
className="table-cell"
onClick={() => {
navigator('/lease/contract', {
state: {
isFinish: row.isFinish,
contractNo: row.businessNo
}
})
}}
>
{row.businessNo}
......
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