diff --git a/config/router.ts b/config/router.ts index 48def77..aa2cd23 100644 --- a/config/router.ts +++ b/config/router.ts @@ -78,6 +78,11 @@ export default [ name: '不动产管理', component: "@/pages/realEstate/index", }, + { + path: '/ComplaintApproval/index', + name: '投诉审批', + component: "@/pages/ComplaintApproval/index", + }, ] diff --git a/src/components/leftSelectTree/leftSelectTree.tsx b/src/components/leftSelectTree/leftSelectTree.tsx index c789f5b..d5b2023 100644 --- a/src/components/leftSelectTree/leftSelectTree.tsx +++ b/src/components/leftSelectTree/leftSelectTree.tsx @@ -42,16 +42,13 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, UserIdEncrypted: addressParams.UserIdEncrypted } const userInfo = await handleGetPassportInfoById(req) - console.log('userInfouserInfouserInfo', userInfo); let data: any = [] if (userInfo?.UserPattern === 2000) { data = await getMerchantShopTree({ BusinessManId: userInfo?.BusinessManID, ShowShop: false }); } else { - data = await getServerpartTree(userInfo?.ProvinceCode, userInfo?.CityAuthority, true, true, true, false, 1000) + data = await getServerpartTree(userInfo?.ProvinceCode, userInfo?.CityAuthority, true, true, true, false, '1000,4000') } - console.log('datatree', data); - // 判断是否有多个片区的权限 if (data && data.length > 1) { @@ -81,10 +78,8 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, if (noWj) { list = handleFilterList(list, 89) } - console.log('list2', list); if (handleGetLeftTreeData) { let newData: any = await handleGetLeftTreeData() - console.log('newData', newData); setTreeView(newData) } else { setTreeView(list) @@ -150,7 +145,6 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, res.push(item) } }) - console.log('res', res); return res } diff --git a/src/components/leftSelectTree/service.ts b/src/components/leftSelectTree/service.ts index 8401fce..8a79d67 100644 --- a/src/components/leftSelectTree/service.ts +++ b/src/components/leftSelectTree/service.ts @@ -1,7 +1,7 @@ import request from "@/utils/requestOld" export async function getServerpartTree(ProvinceCode?: number | string, ServerpartCodes?: string, - ShowWholePower?: boolean, ShowSPRegion?: boolean, ShowRoyalty?: boolean | false, ShowCompactCount?: boolean | false, StatisticsType?: number): Promise { + ShowWholePower?: boolean, ShowSPRegion?: boolean, ShowRoyalty?: boolean | false, ShowCompactCount?: boolean | false, StatisticsType?: any): Promise { // ShowRoyalty 无论传入什么都是false const data = await request(`/BaseInfo/GetServerpartTree? ProvinceCode=${ProvinceCode || ''}&ServerpartCodes=${ServerpartCodes || ''}& diff --git a/src/models/user.ts b/src/models/user.ts index 8e01725..e009729 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -305,6 +305,12 @@ const UserModel: UserModelType = { name: '不动产管理', component: "@/pages/realEstate/index", }, + { + path: '/ComplaintApproval/index', + redirect: '', + name: '投诉审批', + component: "@/pages/ComplaintApproval/index", + }, ] } @@ -388,6 +394,7 @@ const UserModel: UserModelType = { "/RentCalculation/index", "/rentComparison/index", "/realEstate/index", + "/ComplaintApproval/index", // '/examine/index', // '/examine/modal', // '/examine/question', diff --git a/src/pages/ComplaintApproval/index.tsx b/src/pages/ComplaintApproval/index.tsx new file mode 100644 index 0000000..f6e6b9f --- /dev/null +++ b/src/pages/ComplaintApproval/index.tsx @@ -0,0 +1,193 @@ +import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree" +import { ActionType, ProForm, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton, ProTable } from "@ant-design/pro-components" +import { Button, Col, FormInstance, Modal, Popconfirm, Row } from "antd" +import moment from "moment" +import { useRef, useState } from "react" + +// 投诉审批页面 +const ComplaintApproval = () => { + const actionRef = useRef(); + const formRef = useRef(); + const modalFormRef = useRef(); + const transferFormRef = useRef(); + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + const [collapsible, setCollapsible] = useState(false) + // 点击的行数据 + const [currentRow, setCurrentRow] = useState() + // 显示悬浮框 + const [showDetail, setShowDetail] = useState(false) + // 悬浮框点击确认的加载效果 + const [confirmLoading, setConfirmLoading] = useState(false) + // 转办的悬浮框 + const [transferModal, setTransferModal] = useState(false) + // 转办悬浮框的loading效果 + const [transferLoading, setTransferLoading] = useState(false) + + // 列表配置 + const columns: any = [ + + ] + + return
+ + +
+ { + + }} + + toolbar={{ + actions: [ + + ] + }} + /> +
+ + + {/* 投诉的悬浮框 Modal */} + { + setCurrentRow(undefined) + setShowDetail(false) + }} + confirmLoading={confirmLoading} + footer={
+
+ +
+
+ + + + + + + + + +
+
} + > + { + }} + > + + + + + + + + + {/* 安全员核实反馈内容 */} + + + + + + + + + + + +
+ + {/* 转办的悬浮框 */} + { + setTransferModal(false) + }} + onOk={() => { + //因为如果是转办成功 那么肯定是两个悬浮框都关闭 且 表格重新刷新的 + // 当前悬浮框的关闭内容 + setTransferModal(false) + // 投诉悬浮框关闭的内容 + setCurrentRow(undefined) + setShowDetail(false) + // 表格数据更新 + actionRef.current?.reload() + }} + confirmLoading={transferLoading} + > + + + + + + + + + + + +
+} + + +export default ComplaintApproval \ No newline at end of file diff --git a/src/pages/DigitalElectronics/index.tsx b/src/pages/DigitalElectronics/index.tsx index 6806c61..442b8ec 100644 --- a/src/pages/DigitalElectronics/index.tsx +++ b/src/pages/DigitalElectronics/index.tsx @@ -9,6 +9,7 @@ import moment from "moment"; import { encryptAES } from "@/utils/handleAes"; import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components"; import InvoiceDetial from "../redReversal/components/InvoiceDetial"; +import { handleGetREALESTATEList } from "../realEstate/service"; interface ConnectState { user: { @@ -522,12 +523,12 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { // 同步旧票子 变为 红冲申请中 await handleSynchroBILL(2, { ...record, - billDetail: billDetail + DetailList: billDetail }) // 针对这个红冲 开一张新票子 编码为新的红冲编码 状态为9000 开票中 且票据类型变为 3000 红票 BILL_TYPE await handleUpdateOldBill({ ...record, - billDetail: billDetail, + DetailList: billDetail, BILL_TYPE: 3000, BILL_STATE: 9000, BILL_NO: `HC-${record?.BILL_NO}`, @@ -549,13 +550,11 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { const handleInvoice = async (record: Datum) => { try { message.loading({ content: '正在发起开票...', key: 'invoice' }); - // 检查是否有access_token if (!accessToken) { message.error({ content: '缺少访问令牌,请先刷新页面重新获取', key: 'invoice' }); return; } - // 拿个票据明细 const billDetail = await handleGetBILLDETAILList({ SearchParameter: { @@ -565,9 +564,12 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { PageSize: 999999, SortStr: "BILLDETAIL_ID" }) - let billDetailReq: any = [] + // 可能存在的不动产数据 + let estateLeaseItems: any = [] if (billDetail && billDetail.length > 0) { + // 从当前商品的详情里面取出 用的到的 不动产id + let REALESTATE_IDList: Number[] = [] billDetail.forEach((item: any) => { billDetailReq.push({ amount: item.INVOICE_AMOUNT, // 明细金额 @@ -579,12 +581,61 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { revenueCode: item.TABLE_NAME,// 税收分类编码 taxRate: (item.DUTY_PARAGRAPH / 100).toFixed(2),// 税率 units: item.ITEM_UNIT,// 计量单位 - specification: item.ITEM_RULE// 规格 - + specification: item.ITEM_RULE,// 规格 + REALESTATE_ID: item.REALESTATE_ID,// 不动产id + BILLDETAIL_DESC: item.BILLDETAIL_DESC // 备注 }) + REALESTATE_IDList.push(Number(item.REALESTATE_ID)) }) + + console.log('dhaskdhaslhdasl', billDetail); + // REALESTATE_ID 是,隔开的不动产id 这里去查询 记录 有多少条 + const req: any = { + searchParameter: { + SERVERPART_IDS: record?.SERVERPART_ID || "", + REALESTATE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + let newReq: any = { + name: "", + value: encryptAES(JSON.stringify(req)) + } + const data: any = await handleGetREALESTATEList(newReq) + console.log('dhaskdhaslhdasl', data); + // 这个服务区的全部不动产的数据 都在data里面 + if (data && data.length > 0) { + let unitObj: any = { + 1: "平方千米", + 2: "平方米", + 3: "公顷", + 4: "亩", + 5: "h㎡", + 6: "k㎡", + 7: "㎡" + } + data.forEach((item: any) => { + if (REALESTATE_IDList.indexOf(item.REALESTATE_ID) !== -1) { + estateLeaseItems.push({ + provinceAdress: item.PROVINCE_NAME, // 省份 + cityAdreess: item.CITY_NAME,// 城市 + detailAddress: item.REALESTATE_ADDRESS,// 不动产详细地址 + crossCitySign: item.CROSS_CITYSIGN,// 跨地(市)标志 + areaunit: item.AREA_UNIT ? unitObj[item.AREA_UNIT] : "",//面积单位 + startLeaseDate: item.START_LEASEDATE, // 租赁开始日期 + endLeaseDate: item.END_LEASEDATE,//租赁结束日期 + estateId: item.ESTATE_IDENTITY,//房屋产权证书/不动产权证号 + specialIndustryNumber: item.SPECIALINDUSTRY_NUMBER,//不动产基础资料编码 + carBrandNo: item.CARBRAND_NO,// 车牌号 + }) + } + }) + } } + + let obj: any = { billNo: record?.BILL_NO, // 单据编号 billDate: moment(record?.BILL_DATE).format('YYYY-MM-DD'), // 单据日期 @@ -625,13 +676,20 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { // originalIssueTime: record?.originalIssueTime, // blueInvoiceType: record?.blueInvoiceType, // blueinvoiceCode: record?.blueinvoiceCode, - billDetail: billDetailReq + billDetail: billDetailReq, + estateLeaseItems: estateLeaseItems, + specialType: estateLeaseItems && estateLeaseItems.length > 0 ? 'E06' : '00' } + console.log('objobj', obj); + console.log('billDetailbillDetailbillDetail', billDetail); + console.log('estateLeaseItemsestateLeaseItemsestateLeaseItems', estateLeaseItems); // 构造原始数据 const originalData = [obj]; // 将record作为data数组的一项 // 将data字段进行base64加密 const dataString = JSON.stringify(originalData); + console.log('dataStringdataStringdataString', dataString); + const encryptedData = btoa(unescape(encodeURIComponent(dataString))); // base64编码,支持中文 // 构造开票请求数据 const invoiceData = { @@ -656,11 +714,14 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { if (response && response.success) { let res: any = JSON.parse(decodeURIComponent(escape(atob(response.data)))); - + console.log('resresresresres', res); message.success({ content: `单据 ${record.BILL_NO} 开票申请已提交成功`, key: 'invoice' }); actionRef.current?.reload() // 他们的调用成功了 再调用我们自己的 同步票据信息表 的接口 - handleSynchroBILL(1, record) + handleSynchroBILL(1, { + ...record, + DetailList: billDetail + }) } else { @@ -901,28 +962,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { const handleSynchroBILL = async (type: number, obj: any) => { // type 1 开票的同步状态 即 9000 2 开票的红冲状态 即 9990 // 发票明细列表 - let detailList: any = [] - if (obj?.billDetail && obj?.billDetail.length > 0) { - obj?.billDetail.forEach((item: any) => { - detailList.push({ - ITEM_NAME: item.goodsName,// 款项名称 - ITEM_RULE: item.specification,// 规格型号 - ITEM_UNIT: item.units,// 计量单位 - INVOICE_COUNT: item.quantity,// 开票数量 - INVOICE_PRICE: item.price,// 开票单价 - INVOICE_AMOUNT: item.amount,// 开票金额 - DUTY_PARAGRAPH: item.taxRate,// 开票税率 - INVOICE_TAX: item.taxAmount,// 开票税额 - INVOICE_DISCOUNT: item.discountAmount,// 折扣金额 - INVOICE_DISCOUNTTAX: "",// 折扣税额 - ITEM_ACTAMOUNT: "",// 款项价税合计 - ITEM_DEDUCTIONAMOUNT: "",// 扣除额 - ITEM_ID: "",// 关联数据表内码(多个) - TABLE_NAME: "",// 数据表名称 - OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),// 操作时间 - }) - }) - } let req: any = { ...obj, BILL_TYPE: obj.BILL_TYPE || "", // 票据类型(1000:增值税专用发票;2000:普通发票) , @@ -1116,7 +1155,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { - + ) diff --git a/src/pages/authority.ts b/src/pages/authority.ts index 5acffb7..971a513 100644 --- a/src/pages/authority.ts +++ b/src/pages/authority.ts @@ -14,6 +14,7 @@ const authority: PageAuthority = { '/RentCalculation/index': ['/RentCalculation/index'], '/rentComparison/index': ['/rentComparison/index'], '/realEstate/index': ['/realEstate/index'], + '/ComplaintApproval/index': ['/ComplaintApproval/index'], }; diff --git a/src/pages/realEstate/index.tsx b/src/pages/realEstate/index.tsx index 6ded3e2..223cce4 100644 --- a/src/pages/realEstate/index.tsx +++ b/src/pages/realEstate/index.tsx @@ -88,7 +88,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { width: 150, align: 'center', render: (_, record) => { - return record?.ESTATE_IDENTITY ? isComponent ? record?.ESTATE_IDENTITY : { + return record?.ESTATE_IDENTITY ? { setCurrentRow(record) setShowDetail(true) }}> @@ -104,7 +104,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { width: 150, align: 'center', render: (_, record) => { - return record?.SPECIALINDUSTRY_NUMBER ? isComponent ? record?.ESTATE_IDENTITY : { + return record?.SPECIALINDUSTRY_NUMBER ? { setCurrentRow(record) setShowDetail(true) }}> @@ -161,7 +161,17 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { hideInSearch: true, ellipsis: true, width: 120, - align: 'center' + align: 'center', + valueType: "select", + valueEnum: { + 1: "平方千米", + 2: "平方米", + 3: "公顷", + 4: "亩", + 5: "h㎡", + 6: "k㎡", + 7: "㎡" + } }, { title: "租赁期限", @@ -294,6 +304,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { headerTitle={'不动产列表'} search={isComponent ? false : { span: 6, }} request={async (params) => { + if (!selectedId && !isComponent) { return [] } @@ -325,7 +336,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { return { data: [], success: true } }} rowSelection={isComponent ? { - type: 'checkbox', + type: 'radio', defaultSelectedRowKeys: selectRealEstateId || [], onChange: (_, row) => { console.log('__', _); @@ -335,7 +346,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { } } : false} toolbar={{ - actions: [ + actions: isComponent ? [] : [ @@ -356,24 +367,25 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { }} confirmLoading={confirmLoading} footer={ - { - setConfirmLoading(true) - await handleDeleteOrUpdate(currentRow?.REALESTATE_ID) - }} - handleCancel={() => { - setCurrentRow(undefined) - setShowDetail(false) - }} - handleOK={() => { - modalFormRef.current?.validateFields().then(async (res) => { + isComponent ? false : + { setConfirmLoading(true) - await handleAddOrUpdate(res) - }) - }} - /> + await handleDeleteOrUpdate(currentRow?.REALESTATE_ID) + }} + handleCancel={() => { + setCurrentRow(undefined) + setShowDetail(false) + }} + handleOK={() => { + modalFormRef.current?.validateFields().then(async (res) => { + setConfirmLoading(true) + await handleAddOrUpdate(res) + }) + }} + /> } > @@ -454,12 +467,14 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { required: true, message: '请选择服务区!' }]} + readonly={isComponent} /> @@ -467,6 +482,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { label={'租赁日期'} name={"LEASEDATE"} style={{ width: '100%' }} + rules={[{ required: true, message: '请选择租赁日期!' }]} + readonly={isComponent} /> @@ -474,12 +491,16 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { @@ -490,12 +511,15 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { { label: "是", value: 1 }, { label: "否", value: 0 }, ]} + readonly={isComponent} /> @@ -511,6 +535,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { { label: "k㎡", value: 6 }, { label: "㎡", value: 7 } ]} + rules={[{ required: true, message: '请选择面积单位!' }]} + readonly={isComponent} /> @@ -527,6 +553,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { }, }), ]} + readonly={isComponent} /> @@ -543,6 +570,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { }, }), ]} + readonly={isComponent} /> diff --git a/src/pages/redReversal/components/InvoiceDetial.tsx b/src/pages/redReversal/components/InvoiceDetial.tsx index 36bdfea..34a30e8 100644 --- a/src/pages/redReversal/components/InvoiceDetial.tsx +++ b/src/pages/redReversal/components/InvoiceDetial.tsx @@ -22,10 +22,11 @@ interface ParamsType { setShowDetail: (v: boolean) => void; parentRow: any; setParentRow: (v: any) => void; + parentTableRef?: any; // 父表格实例 } -const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: ParamsType) => { +const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, parentTableRef }: ParamsType) => { const realEstateRef = useRef(); const formRef = useRef>(); const detailActionRef = useRef(); @@ -60,6 +61,10 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P const [selectRealEstateId, setSelectRealEstateId] = useState(); // 选择不动产的loading const [realEstateLoading, setRealEstateLoading] = useState(false); + // 当前发票明细 点击的行的信息 + const [currentRow, setCurrentRow] = useState(); + // 解析不动产的枚举 + const [realEstateEnum, setRealEstateEnum] = useState(); const detailColumns: any = [ @@ -68,19 +73,19 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P dataIndex: "index", valueType: "index", align: 'center', - width: 80 + width: 70 }, { title:
款项名称
, align: 'left', - width: 250, + width: 230, dataIndex: "ITEM_NAME", ellipsis: true }, { title:
税务代码
, align: 'left', - width: 200, + width: 180, dataIndex: "TABLE_NAME", ellipsis: true, render: (_, record) => { @@ -96,11 +101,10 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P }} /> : record.TABLE_NAME } }, - { title:
税率
, align: 'center', - width: 120, + width: 80, dataIndex: "DUTY_PARAGRAPH", render: (_, record) => { return isEdit ? @@ -125,7 +129,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P { title:
商品条码
, align: 'left', - width: 150, + width: 120, dataIndex: "ITEM_ID", ellipsis: true }, @@ -133,13 +137,15 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P title:
规格型号
, align: 'center', width: 120, - dataIndex: "ITEM_RULE" + dataIndex: "ITEM_RULE", + ellipsis: true }, { title:
计量单位
, align: 'center', width: 100, - dataIndex: "ITEM_UNIT" + dataIndex: "ITEM_UNIT", + ellipsis: true }, { title:
数量
, @@ -175,6 +181,26 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P width: 120, dataIndex: "INVOICE_DISCOUNT" }, + { + title: "不动产", + dataIndex: "option", + width: 120, + align: 'center', + render: (_: any, record: any) => { + return record?.REALESTATE_ID ? +
{ + setCurrentRow(record) + setSelectRealEstateId([Number(record?.REALESTATE_ID)]) + setSelectRealEstateModal(true) + }}> + {realEstateEnum && realEstateEnum[record?.REALESTATE_ID] ? realEstateEnum[record?.REALESTATE_ID] : record?.REALESTATE_ID} + : + < Button type={'primary'} onClick={async () => { + setCurrentRow(record) + setSelectRealEstateModal(true) + }}> 选择不动产 + } + } // { // title:
操作时间
, // align: 'center', @@ -311,7 +337,17 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P hideInSearch: true, ellipsis: true, width: 120, - align: 'center' + align: 'center', + valueType: "select", + valueEnum: { + 1: "平方千米", + 2: "平方米", + 3: "公顷", + 4: "亩", + 5: "h㎡", + 6: "k㎡", + 7: "㎡" + } }, { title: "租赁期限", @@ -350,10 +386,34 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P const handleGetSelectRealEstate = (data: any) => { setRealEstateData(data) } + // 获取到这个服务区的全部 不动产信息 并给枚举的解析赋值 + const handleGetThisServerpartRealEstateData = async () => { + const req: any = { + searchParameter: { + SERVERPART_IDS: parentRow?.SERVERPART_ID || "", + REALESTATE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + let newReq: any = { + name: "", + value: encryptAES(JSON.stringify(req)) + } + const data: any = await handleGetREALESTATEList(newReq) + console.log('datadatadata', data); + let obj: any = {} + if (data && data.length > 0) { + data.forEach((item: any) => { + obj[item.REALESTATE_ID] = item.ESTATE_IDENTITY + }) + } + setRealEstateEnum(obj) + } return ( { @@ -484,6 +544,9 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P scroll={{ x: "100%", y: '500px' }} pagination={false} request={async () => { + // 调用一次 获取这个服务区里面的全部 不动产信息 + handleGetThisServerpartRealEstateData() + // 拿到发票明细 const billDetail = await handleGetBILLDETAILList({ SearchParameter: { BILL_ID: parentRow?.BILL_ID @@ -494,13 +557,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P }) if (billDetail && billDetail.length > 0) { - let idList: any = billDetail[0].REALESTATE_ID ? billDetail[0].REALESTATE_ID.split(',') : "" - console.log('idListidListidList', idList); - if (idList && idList.length > 0) { - detailActionRef.current?.reload() - setSelectRealEstateId(idList) - } - setTableEditData(billDetail) setReqDetailList(billDetail) return { data: billDetail, success: true } @@ -553,7 +609,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P {/* 不动产信息 */} -
+ {/*
不动产信息 @@ -612,7 +668,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P }} />
-
+ */} {/* 审批意见 */}
@@ -668,21 +724,34 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P setSelectRealEstateModal(false) }} confirmLoading={realEstateLoading} + onOk={async () => { + // 已经开票申请了的 就不能改变不动产数据了 + if (parentRow?.BILL_STATE > 2000) { + setCurrentRow(undefined) + setSelectRealEstateModal(false) + setRealEstateLoading(false) + return + } + let data = realEstateRef?.current?.selectRowDetail console.log('32131', data); // 开始保存内容 handleGetSelectRealEstate(data) + console.log('tableEditDatatableEditDatatableEditData', tableEditData); + console.log('currentRow', currentRow); if (tableEditData && tableEditData.length > 0) { setRealEstateLoading(true) let list: any = JSON.parse(JSON.stringify(tableEditData)) let idList: any = [] if (data && data.length > 0) { - idList = data.map((item: any) => item.REALESTATE_ID) + idList = data.map((item: any) => Number(item.REALESTATE_ID)) } list.forEach((item: any) => { - item.REALESTATE_ID = idList ? idList.toString() : "" + if (item.REALESTATE_ID === currentRow?.REALESTATE_ID) { + item.REALESTATE_ID = idList && idList.length > 0 ? Number(idList.toString()) : "" + } }) setSelectRealEstateId(idList) let newreqResult: any = { @@ -693,11 +762,14 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P if (res.Result_Code === 100) { message.success('同步成功!') detailActionRef.current?.reload() + setCurrentRow(undefined) + if (parentTableRef) { + parentTableRef.current?.reload() + } } else { message.error(data.Result_Desc) } } - setSelectRealEstateModal(false) setRealEstateLoading(false) }} diff --git a/src/pages/redReversal/index.tsx b/src/pages/redReversal/index.tsx index 6d48e21..d38670a 100644 --- a/src/pages/redReversal/index.tsx +++ b/src/pages/redReversal/index.tsx @@ -9,6 +9,7 @@ import moment from "moment"; import { encryptAES } from "@/utils/handleAes"; import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components"; import InvoiceDetial from "./components/InvoiceDetial"; +import { handleGetREALESTATEList } from "../realEstate/service"; interface ConnectState { user: { @@ -76,6 +77,22 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { }); const columns: any = [ + { + title: "查询内容", + dataIndex: "searchText", + hideInTable: true, + fieldProps: { + placeholder: "请输入经办人/单据号", + } + }, + { + title: "含税开票金额", + dataIndex: "INVOICE_TAXAMOUNT", + hideInTable: true, + fieldProps: { + placeholder: "请输入含税开票金额", + } + }, { title: '服务区名称', dataIndex: 'SERVERPART_NAME', @@ -243,7 +260,8 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => {
- : record?.BILL_TYPE === 2000 && record?.BILL_STATE >= 9200 && record?.BILL_STATE !== 9999 ? + : record?.BILL_STATE >= 9200 && record?.BILL_STATE !== 9999 ? + // record?.BILL_TYPE === 2000 &&
= (props) => { const cleanString = (str: string) => { return str.replace(/[\s]/g, ''); } - // 红冲发票 + // 红冲发票(开票红冲 普票专票都可以使用) const handleRedGoBill = async (record?: any) => { // 这个方法 比较复杂 我做一下注释 // 先拿到表单数据 里面有 红冲类型和 红冲原因 @@ -472,6 +490,9 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { SortStr: "BILLDETAIL_ID" }) + console.log('billDetailbillDetail', billDetail); + + // 调用金票云那里的列表接口 // 构造查询数据 const queryData = { @@ -512,7 +533,13 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { } let billDetailReq: any = [] + // 给自己接口的 + let DetailList: any = [] + // 可能存在的不动产数据 + let estateLeaseItems: any = [] if (billDetail && billDetail.length > 0) { + // 从当前商品的详情里面取出 用的到的 不动产id + let REALESTATE_IDList: Number[] = [] billDetail.forEach((item: any) => { billDetailReq.push({ amount: -item.INVOICE_AMOUNT, // 明细金额 @@ -524,11 +551,68 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { revenueCode: item.TABLE_NAME,// 税收分类编码 taxRate: (item.DUTY_PARAGRAPH / 100).toFixed(2),// 税率 units: item.ITEM_UNIT,// 计量单位 - + specification: item.ITEM_RULE,// 规格 + REALESTATE_ID: item.REALESTATE_ID,// 不动产id + BILLDETAIL_DESC: item.BILLDETAIL_DESC // 备注 }) + + DetailList.push({ + ...item, + INVOICE_AMOUNT: -item.INVOICE_AMOUNT, + INVOICE_COUNT: -item.INVOICE_COUNT, + INVOICE_TAX: -item.INVOICE_TAX + }) + + REALESTATE_IDList.push(Number(item.REALESTATE_ID)) }) + console.log('dhaskdhaslhdasl', billDetail); + // REALESTATE_ID 是,隔开的不动产id 这里去查询 记录 有多少条 + const req: any = { + searchParameter: { + SERVERPART_IDS: record?.SERVERPART_ID || "", + REALESTATE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + let newReq: any = { + name: "", + value: encryptAES(JSON.stringify(req)) + } + const data: any = await handleGetREALESTATEList(newReq) + console.log('dhaskdhaslhdasl', data); + // 这个服务区的全部不动产的数据 都在data里面 + if (data && data.length > 0) { + let unitObj: any = { + 1: "平方千米", + 2: "平方米", + 3: "公顷", + 4: "亩", + 5: "h㎡", + 6: "k㎡", + 7: "㎡" + } + data.forEach((item: any) => { + if (REALESTATE_IDList.indexOf(item.REALESTATE_ID) !== -1) { + estateLeaseItems.push({ + provinceAdress: item.PROVINCE_NAME, // 省份 + cityAdreess: item.CITY_NAME,// 城市 + detailAddress: item.REALESTATE_ADDRESS,// 不动产详细地址 + crossCitySign: item.CROSS_CITYSIGN,// 跨地(市)标志 + areaunit: item.AREA_UNIT ? unitObj[item.AREA_UNIT] : "",//面积单位 + startLeaseDate: item.START_LEASEDATE, // 租赁开始日期 + endLeaseDate: item.END_LEASEDATE,//租赁结束日期 + estateId: item.ESTATE_IDENTITY,//房屋产权证书/不动产权证号 + specialIndustryNumber: item.SPECIALINDUSTRY_NUMBER,//不动产基础资料编码 + carBrandNo: item.CARBRAND_NO,// 车牌号 + }) + } + }) + } } + + let newDesc: string = '' let addStr: string = `被红冲蓝字数电发票号码:${record?.blueinvoiceNo || ""}\t\t红字发票信息确认单编号:${record?.BILL_NO ? `HC-${record?.BILL_NO}` : ""};\n` @@ -574,10 +658,13 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { blueinvoiceCode: "", billDetail: billDetailReq, remark: `被红冲蓝字数电发票号码:${record?.SERIAL_NO}\t\t红字发票信息确认单编号:${record?.BILL_NO ? `HC-${record?.BILL_NO}` : ""};\n` + record?.BILL_DESC, + estateLeaseItems: estateLeaseItems, + specialType: estateLeaseItems && estateLeaseItems.length > 0 ? 'E06' : '00' } + console.log('objobj', obj); // 构造原始数据 - const originalData = [obj]; // 将record作为data数组的一项 + const originalData = [obj]; // 将record作为data数组的一项 // 将data字段进行base64加密 const dataString = JSON.stringify(originalData); const encryptedData = btoa(unescape(encodeURIComponent(dataString))); // base64编码,支持中文 @@ -619,15 +706,26 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { billDetail: billDetail }) // 针对这个红冲 开一张新票子 编码为新的红冲编码 状态为9000 开票中 且票据类型变为 3000 红票 BILL_TYPE + // 因为 DetailList 里面要把id去掉 所以要处理一下 + let newDetailList: any = [] + if (DetailList && DetailList.length > 0) { + DetailList.forEach((item: any) => { + newDetailList.push({ + ...item, + BILLDETAIL_ID: null, + BILL_ID: null, + }) + }) + } await handleUpdateOldBill({ ...record, - billDetail: billDetail, + DetailList: newDetailList, BILL_TYPE: 3000, BILL_STATE: 9000, BILL_NO: `HC-${record?.BILL_NO}`, BILL_DATE: moment().format('YYYY-MM-DD'), BILL_DESC: formData?.redReasonSelect ? redReasonObj[formData?.redReasonSelect] : "", - BILL_ID: "", + BILL_ID: null, BILL_TAXAMOUNT: -record?.BILL_TAXAMOUNT, BILL_AMOUNT: -record?.BILL_AMOUNT, INVOICE_TAXAMOUNT: -record?.INVOICE_TAXAMOUNT, @@ -897,28 +995,6 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { const handleSynchroBILL = async (type: number, obj: any) => { // type 1 开票的同步状态 即 9000 2 开票的红冲状态 即 9990 // 发票明细列表 - let detailList: any = [] - if (obj?.billDetail && obj?.billDetail.length > 0) { - obj?.billDetail.forEach((item: any) => { - detailList.push({ - ITEM_NAME: item.goodsName,// 款项名称 - ITEM_RULE: item.specification,// 规格型号 - ITEM_UNIT: item.units,// 计量单位 - INVOICE_COUNT: item.quantity,// 开票数量 - INVOICE_PRICE: item.price,// 开票单价 - INVOICE_AMOUNT: item.amount,// 开票金额 - DUTY_PARAGRAPH: item.taxRate,// 开票税率 - INVOICE_TAX: item.taxAmount,// 开票税额 - INVOICE_DISCOUNT: item.discountAmount,// 折扣金额 - INVOICE_DISCOUNTTAX: "",// 折扣税额 - ITEM_ACTAMOUNT: "",// 款项价税合计 - ITEM_DEDUCTIONAMOUNT: "",// 扣除额 - ITEM_ID: "",// 关联数据表内码(多个) - TABLE_NAME: "",// 数据表名称 - OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'),// 操作时间 - }) - }) - } let req: any = { ...obj, BILL_TYPE: obj.BILL_TYPE || "", // 票据类型(1000:增值税专用发票;2000:普通发票) , @@ -953,6 +1029,7 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { BILL_STATE: type === 1 ? 9000 : type === 2 ? '9990' : '',// 票据状态 DetailList: obj?.DetailList,// 发票明细列表 } + console.log('reqreq', req); const data = await handleSynchroBILLInterface(req) } // 获取当前用户信息 @@ -992,6 +1069,8 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { ...record, } const data = await handleSynchroBILLInterface(req) + // 新的也要同步 红冲发起申请的流程记录 + await handleSynchroAPPLYAPPROVEFun(3, data.Result_Data) } useEffect(async () => { @@ -1015,8 +1094,7 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { }} scroll={{ x: "100%", y: '400px' }} headerTitle={可红冲列表} - // search={{ span: 6, labelWidth: 100 }} - search={false} + search={{ span: 6, labelWidth: 100 }} request={async (params: any, sorter: any) => { const search = window.location.search; const addressParams = Object.fromEntries(new URLSearchParams(search).entries()); @@ -1028,18 +1106,22 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { return value ? `${n} ${value.replace('end', '')}` : '' }) - // 获取票据信息表列表 const req: any = { SearchParameter: { - BILL_TYPES: "2000",// 现在只支持普票红冲 所以找普票 且状态为 普票的已开票即可 + BILL_TYPES: "1000,2000",// 看普票 和 专票 SERVERPART_IDS: userInfo?.ServerpartIds, - BILL_STATES: "9200" + BILL_STATES: "9200", + INVOICE_TAXAMOUNT: params?.INVOICE_TAXAMOUNT || "" // BILL_TYPES: "1000,2000" }, PageIndex: 1, PageSize: 999999, sortstr: sortstr.length ? sortstr.toString() : "BILL_ID desc", + keyWord: { + Key: "BILL_PERSON,BILL_NO", + Value: params?.searchText || "" + } } const data = await handleGetBILLList(req) @@ -1082,7 +1164,7 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { // 获取票据信息表列表 const req: any = { SearchParameter: { - BILL_TYPES: "3000",// 现在只支持普票红冲 所以找普票 且状态为 普票的已开票即可 + BILL_TYPES: "3000",// 只看红票 SERVERPART_IDS: userInfo?.ServerpartIds, BILL_STATES: "9000" // BILL_TYPES: "1000,2000" @@ -1102,6 +1184,11 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { value: columnsStateBottomMap, onChange: setColumnsStateBottomMap, }} + toolbar={{ + actions: [ + + ] + }} /> {/* 用来输入红冲原因的 */} @@ -1128,6 +1215,14 @@ const RedReversal: React.FC<{ currentUser: any }> = (props) => { onFinish={() => { setConfirmLoading(true) handleRedGoBill(currentRow) + // if (currentRow?.BILL_TYPE === 2000) { + // // 普票的情况下 + // handleRedGoBill(currentRow) + // } else { + // // 专票红冲 + // handleRedGoBill(currentRow) + // // handleSpecialBillRed(currentRow) + // } }} >