update
This commit is contained in:
parent
85b417e367
commit
1e71004070
@ -1,12 +1,13 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form";
|
||||
import { Col, Drawer, FormInstance, Row, Table, Typography, Space, Button, Empty, Divider, Input, message } from "antd";
|
||||
import { Col, Drawer, FormInstance, Row, Table, Typography, Space, Button, Empty, Divider, Input, message, Select } from "antd";
|
||||
import { connect } from "umi";
|
||||
import { ActionType, ProTable } from "@ant-design/pro-components";
|
||||
import { handleGetAPPLYAPPROVEList, handleGetBILLDETAILList, handleSynchroBILLDETAILList } from "@/pages/DigitalElectronics/service";
|
||||
import moment from "moment";
|
||||
import { encryptAES } from "@/utils/handleAes";
|
||||
import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun";
|
||||
import { getFieldEnum } from "@/pages/serverpartAssets/service";
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@ -46,8 +47,17 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
const [isEdit, setIsEdit] = useState(false);
|
||||
// 表格数据
|
||||
const [tableEditData, setTableEditData] = useState<any>();
|
||||
// 税率枚举列表
|
||||
const [taxRateList, setTaxRateList] = useState<any>();
|
||||
|
||||
const detailColumns: any = [
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "index",
|
||||
valueType: "index",
|
||||
align: 'center',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>款项名称</div>,
|
||||
align: 'left',
|
||||
@ -63,7 +73,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return isEdit ? <Input defaultValue={record.TABLE_NAME} onBlur={(e: any) => {
|
||||
console.log('eee', e);
|
||||
let value: string = e.target.value || ""
|
||||
let tableData: any = JSON.parse(JSON.stringify(tableEditData))
|
||||
tableData.forEach((item: any) => {
|
||||
@ -75,6 +84,32 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
}} /> : record.TABLE_NAME
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>税率</div>,
|
||||
align: 'center',
|
||||
width: 120,
|
||||
dataIndex: "DUTY_PARAGRAPH",
|
||||
render: (_, record) => {
|
||||
return isEdit ?
|
||||
<Select
|
||||
style={{ width: '100%' }}
|
||||
defaultValue={record?.DUTY_PARAGRAPH ? record?.DUTY_PARAGRAPH.toString() : ""}
|
||||
options={taxRateList}
|
||||
onChange={(e: any) => {
|
||||
let value: string = e || ""
|
||||
let tableData: any = JSON.parse(JSON.stringify(tableEditData))
|
||||
tableData.forEach((item: any) => {
|
||||
if (item.BILLDETAIL_ID === record.BILLDETAIL_ID) {
|
||||
item.DUTY_PARAGRAPH = value
|
||||
}
|
||||
})
|
||||
setTableEditData(tableData)
|
||||
}}
|
||||
/> :
|
||||
record?.DUTY_PARAGRAPH ? `${record?.DUTY_PARAGRAPH}%` : ""
|
||||
}
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>商品条码</div>,
|
||||
align: 'left',
|
||||
@ -115,15 +150,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
valueType: 'digit',
|
||||
dataIndex: "INVOICE_AMOUNT"
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>税率</div>,
|
||||
align: 'center',
|
||||
width: 120,
|
||||
dataIndex: "DUTY_PARAGRAPH",
|
||||
render: (_, record) => {
|
||||
return record?.DUTY_PARAGRAPH ? `${record?.DUTY_PARAGRAPH}%` : ""
|
||||
}
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>税额</div>,
|
||||
align: 'right',
|
||||
@ -199,12 +225,13 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
const handleSaveTaxCode = async () => {
|
||||
// 当前的表格数据
|
||||
console.log('tableEditDatatableEditDatatableEditData', tableEditData);
|
||||
|
||||
let newreqResult: any = {
|
||||
name: "",
|
||||
value: encryptAES(JSON.stringify({ list: tableEditData }))
|
||||
}
|
||||
setSaveLoading(true)
|
||||
console.log('newreqResultnewreqResult', newreqResult);
|
||||
|
||||
const data = await handleSynchroBILLDETAILList(newreqResult)
|
||||
setSaveLoading(false)
|
||||
if (data.Result_Code === 100) {
|
||||
@ -344,7 +371,8 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
search={false}
|
||||
columns={detailColumns}
|
||||
bordered
|
||||
scroll={{ x: "100%" }}
|
||||
scroll={{ x: "100%", y: '500px' }}
|
||||
pagination={false}
|
||||
request={async () => {
|
||||
console.log('parentRowparentRowparentRow', parentRow);
|
||||
const billDetail = await handleGetBILLDETAILList({
|
||||
@ -383,7 +411,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
</> :
|
||||
<Button type="primary" onClick={() => {
|
||||
setIsEdit(true)
|
||||
}}>编辑税务代码</Button>
|
||||
}}>编辑表格</Button>
|
||||
}
|
||||
|
||||
</>,
|
||||
@ -417,6 +445,9 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
|
||||
bordered
|
||||
request={async () => {
|
||||
console.log('parentRowparentRowparentRow', parentRow);
|
||||
// 拿个税率的枚举
|
||||
const taxRateLabel: any = await getFieldEnum({ FieldExplainField: 'DUTY_PARAGRAPH', notformate: true })
|
||||
setTaxRateList(taxRateLabel)
|
||||
|
||||
const req: any = {
|
||||
SearchParameter: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user