可以报销了
parent
e711d03dd6
commit
c81d5e9020
|
@ -25,6 +25,7 @@ export type Department = {
|
|||
departmentName: string;
|
||||
}
|
||||
export type TableListItem = {
|
||||
key:number;
|
||||
id: number;
|
||||
beginDate: number;
|
||||
duration: number;
|
||||
|
@ -43,6 +44,7 @@ export type TableListItem = {
|
|||
let fakeData: TableListItem[] = [];
|
||||
for (let i = 0; i < 94; i++) {
|
||||
fakeData.push({
|
||||
key:i,
|
||||
id: i + 1,
|
||||
beginDate: Date.UTC(2022, i % 11 + 1, i % 28 + 1),
|
||||
endDate: Date.UTC(2022, i % 11 + 1, i % 28 + 1) + 1000 * 60 * 60 * 24 * i + 1,
|
||||
|
@ -72,7 +74,7 @@ class Subpage extends React.Component<any, any> {
|
|||
tableAction = React.createRef<ActionType>();
|
||||
departments = new Map<number, string>()
|
||||
|
||||
constructor(props: {}) {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
searchWord: "",
|
||||
|
@ -206,6 +208,7 @@ class Subpage extends React.Component<any, any> {
|
|||
let result: TableListItem[] = []
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
result.push({
|
||||
key:i,
|
||||
id: value[i].reimbursementId,
|
||||
beginDate: Date.parse(value[i].reimbursementDepartureInvoice.invoiceDate),
|
||||
endDate: Date.parse(value[i].reimbursementDepartureInvoice.invoiceDate) + value[i].reimbursementTripDuration * 24 * 60 * 60 * 1000,
|
||||
|
@ -375,7 +378,7 @@ class Subpage extends React.Component<any, any> {
|
|||
function MyReimbursement() {
|
||||
return (
|
||||
<>
|
||||
<Subpage/>
|
||||
<Subpage key={12}/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import {
|
|||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Modal, notification,
|
||||
Row
|
||||
Modal, notification, Popover,
|
||||
Row, Select, Tag
|
||||
} from "antd";
|
||||
import {FormInstance} from "antd/es/form";
|
||||
import {Invoice} from "../../../models/Reimbursement";
|
||||
|
@ -21,7 +21,7 @@ import {FieldData} from "rc-field-form/lib/interface";
|
|||
import {invoiceTypeNameMap} from "../../../models/Invoice";
|
||||
import SingleInvoiceSelector from "./component/SingleInvoiceSelector";
|
||||
import MultiInvoiceSelector from "./component/MultiInvoiceSelector";
|
||||
import {StatisticCard} from "@ant-design/pro-components";
|
||||
import {ActionType, StatisticCard} from "@ant-design/pro-components";
|
||||
|
||||
const {Operation} = StatisticCard;
|
||||
|
||||
|
@ -37,11 +37,14 @@ const openNotification = (hint: string) => {
|
|||
|
||||
class ReimbursementCreate extends React.Component<any, any> {
|
||||
formRef = React.createRef<FormInstance>();
|
||||
actionRef = React.createRef<ActionType>();
|
||||
invoiceSelector1 = React.createRef<SingleInvoiceSelector>();
|
||||
invoiceSelector2 = React.createRef<SingleInvoiceSelector>();
|
||||
invoiceSelector3 = React.createRef<MultiInvoiceSelector>();
|
||||
departments: { departmentId: number, departmentName: string }[] = [];
|
||||
|
||||
place: { placeName: string, subsidyPerDay: number }[] = []
|
||||
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
let managingDepartment = store.getState().staff.managingDepartment
|
||||
|
@ -66,8 +69,12 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
icon: <UserOutlined/>,
|
||||
})
|
||||
})
|
||||
axiosInstance.get("common/place").then((res) => {
|
||||
this.place = res.data
|
||||
this.formRef.current?.setFieldsValue({departureName: "", destinationName: ""})
|
||||
this.formRef.current?.resetFields(["departureName", "destinationName"])
|
||||
})
|
||||
store.subscribe(this.handleStoreChange);
|
||||
console.log(store.getState().staff.staffDepartments)
|
||||
this.state = {
|
||||
loading: false,
|
||||
open: this.props.open,
|
||||
|
@ -90,7 +97,7 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
}
|
||||
|
||||
handleStoreChange = () => {
|
||||
this.departments=[]
|
||||
this.departments = []
|
||||
let managingDepartment = store.getState().staff.managingDepartment
|
||||
if (managingDepartment !== null && managingDepartment !== undefined) {
|
||||
this.departments.push({
|
||||
|
@ -215,7 +222,19 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
}
|
||||
return res
|
||||
}
|
||||
|
||||
calculateAddition = () => {
|
||||
if(store.getState().staff.staffBase===this.formRef.current?.getFieldValue("destinationName"))
|
||||
return {value:0,hint:"出差地点与基地相同,无补贴"}
|
||||
let addition = 0
|
||||
this.place.map((item)=>{
|
||||
if(addition===this.formRef.current?.getFieldValue("destinationName"))
|
||||
addition=item.subsidyPerDay
|
||||
})
|
||||
let days=0
|
||||
if(this.state.duration!==undefined)
|
||||
days=this.state.duration
|
||||
return {value:addition*days,hint:"每日补贴"+addition+"元,共"+days+"天"}
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<Modal
|
||||
|
@ -240,20 +259,40 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
duration: 0
|
||||
}}>
|
||||
|
||||
<Row gutter={18}>
|
||||
<Row gutter={18} key={1}>
|
||||
<Col span={12}>
|
||||
<Form.Item label="出发地" name="departureName" rules={[{required: true}]}>
|
||||
<Input/>
|
||||
<Select
|
||||
showSearch
|
||||
placeholder="请选择出发地"
|
||||
optionFilterProp="children"
|
||||
filterOption={(input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
options={this.place.map((item) => {
|
||||
return {label: item.placeName, value: item.placeName}
|
||||
})}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item label="目的地" name="destinationName" rules={[{required: true}]}>
|
||||
<Input/>
|
||||
<Select
|
||||
showSearch
|
||||
placeholder="请选择目的地"
|
||||
optionFilterProp="children"
|
||||
filterOption={(input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
options={this.place.map((item) => {
|
||||
return {label: item.placeName, value: item.placeName}
|
||||
})}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row gutter={18}>
|
||||
<Row gutter={18} key={2}>
|
||||
<Col span={12}>
|
||||
<Form.Item help="" label="出发票据" name="departureInvoice" rules={[{required: true}]}>
|
||||
<SingleInvoiceSelector pickerOpen={false} after={0}
|
||||
|
@ -274,7 +313,7 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row gutter={18}>
|
||||
<Row gutter={18} key={3}>
|
||||
<Col span={12}>
|
||||
<Form.Item label="出差时长" name={"duration"} rules={[{required: true}]}>
|
||||
<InputNumber addonAfter={"天"} min={0} max={1000} disabled={this.state.back}
|
||||
|
@ -294,10 +333,19 @@ class ReimbursementCreate extends React.Component<any, any> {
|
|||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{fontSize: 15, marginBottom: 5}} key={4}>
|
||||
补贴金额:
|
||||
<Popover content={this.calculateAddition().hint} title="出差补贴" trigger="hover">
|
||||
<Tag color={store.getState().staff.staffBase===this.formRef.current?.getFieldValue("destinationName")?
|
||||
"red":"green"}>
|
||||
{this.calculateAddition().value}元
|
||||
</Tag>
|
||||
</Popover>
|
||||
</Row>
|
||||
<Form.Item label="附加票据" name="otherInvoices" rules={[{required: false}]}>
|
||||
<MultiInvoiceSelector pickerOpen={false}
|
||||
//after={0}
|
||||
after={this.state.departureInvoice !== null && this.state.departureInvoice !== undefined ? Number(Date.parse(this.state.departureInvoice.invoiceDate)) : 0}
|
||||
//after={0}
|
||||
after={this.state.departureInvoice !== null && this.state.departureInvoice !== undefined ? Number(Date.parse(this.state.departureInvoice.invoiceDate)) : 0}
|
||||
before={0} occupiedInvoices={this.getOccupiedInvoices(3)}
|
||||
pickerTitle={"附加票据"} ref={this.invoiceSelector3}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue