import { ActionType, CopyText, DealerPicker, Icon, PageList, PurchaseOrderRejectApprove, State, SupplierPicker, ToolBar, } from "@/components"; import React, { useRef, useState } from "react"; import { business } from "@/services"; import { Label, Text, View } from "@tarojs/components"; import { buildUrl } from "@/utils"; import { Button } from "@nutui/nutui-react-taro"; import dayjs from "dayjs"; import purchaseOrder from "@/constant/purchaseOrder"; import Taro from "@tarojs/taro"; interface IPurchaseOrderAuditListProps { params: BusinessAPI.PurchaseOrderPageQry; toolbar?: ToolBar; actionRef?: React.MutableRefObject; } export default function PurchaseOrderAuditList( props: IPurchaseOrderAuditListProps, ) { const { params: bizParams, toolbar: defaultToolbar, actionRef: externalActionRef, } = props; const internalActionRef = useRef(); const actionRef = externalActionRef || internalActionRef; const [dealerVO, setDealerVO] = useState(); const [supplierVO, setSupplierVO] = useState(); const toolbar: ToolBar = { ...defaultToolbar, search: { activeKey: "plate", defaultActiveKey: "plate", items: [ { key: "plate", name: "车牌号", placeholder: "请输入车牌号", }, ], }, render: () => ( { setDealerVO(dealerVO); actionRef.current?.reload(); }} trigger={ {dealerVO?.shortName || "经销商"} {dealerVO?.shortName ? ( { setDealerVO(undefined); actionRef.current?.reload(); event.stopPropagation(); }} /> ) : ( )} } /> { setSupplierVO(supplierVO); actionRef.current?.reload(); }} trigger={ {supplierVO?.name || "瓜农"} {supplierVO?.name ? ( { setSupplierVO(undefined); actionRef.current?.reload(); event.stopPropagation(); }} /> ) : ( )} } /> ), }; return ( rowId={"purchaseOrderId"} itemHeight={182} toolbar={toolbar} type={"infinite"} actionRef={actionRef} render={(purchaseOrderVO: BusinessAPI.PurchaseOrderVO, index) => { return ( {/* 复制 */} {purchaseOrderVO.orderVehicle?.dealerName}{" "} {purchaseOrderVO.orderVehicle?.vehicleNo ? "第" + purchaseOrderVO.orderVehicle?.vehicleNo + "车" : "暂未生成车次"} {purchaseOrderVO.orderVehicle?.origin} {" 至 "} {purchaseOrderVO.orderVehicle?.destination} {purchaseOrderVO.orderSn} {purchaseOrderVO.createdByName} {dayjs(purchaseOrderVO.createdAt).format("MM-DD HH:mm")} {purchaseOrderVO.state === "WAITING_AUDIT" && purchaseOrderVO.auditState === "PENDING_QUOTE_APPROVAL" && ( { actionRef.current?.reload(); }} /> )} ); }} request={async (params) => { const { data: { data, success, notEmpty }, } = await business.purchaseOrder.pagePurchaseOrder({ purchaseOrderPageQry: { ...params, ...bizParams, }, }); return { data, success, hasMore: notEmpty, }; }} pagination={{ pageSize: 10, }} /> ); }