- 更新 ApprovalList 和 AuditList 组件的 ToolBar 类型定义 - 移除 DealerWarehousePicker 组件中的注释代码 - 优化 Step1Form 组件中的订单项类型定义和字段引用 - 调整多个组件中按钮尺寸属性的字符串格式 - 重构 ExpenseCostCard 组件支持费用类型和费用记录的混合展示 - 更新 ExpenseCostCreate 组件的费用类型预填充逻辑 - 优化 ExpenseCostList 组件的费用列表渲染方式 - 重命名 Step1Form 组件中的 shipOrderVO 相关变量为 orderShipVO - 更新 DeliveryFormSection 组件中的数据转换函数名称 - 调整多个组件中按钮的尺寸配置 - 更新 OrderList 组件的 ToolBar 类型定义 - 升级应用版本号并完善订单发货单常量配置 - 修正工作台中发货单菜单项的标识符 - 移除审批页面中未使用的 Text 组件和驳回理由展示
175 lines
5.0 KiB
TypeScript
175 lines
5.0 KiB
TypeScript
import {
|
|
ActionType,
|
|
DealerPicker,
|
|
Icon,
|
|
OrderItem,
|
|
PageList,
|
|
SupplierPicker,
|
|
ToolBar,
|
|
} from "@/components";
|
|
import React, { useRef, useState } from "react";
|
|
import { business } from "@/services";
|
|
import { View } from "@tarojs/components";
|
|
import { buildUrl } from "@/utils";
|
|
import Taro from "@tarojs/taro";
|
|
import { purchase } from "@/constant";
|
|
|
|
interface IOrderListProps {
|
|
params: BusinessAPI.OrderPageQry;
|
|
create?: boolean;
|
|
toolbar?: ToolBar<BusinessAPI.OrderVO>;
|
|
actionRef?: React.MutableRefObject<ActionType | undefined>;
|
|
}
|
|
|
|
export default function OrderList(props: IOrderListProps) {
|
|
const {
|
|
params: bizParams,
|
|
create = false,
|
|
toolbar: defaultToolbar,
|
|
actionRef: externalActionRef,
|
|
} = props;
|
|
|
|
const { type = "PRODUCTION_PURCHASE" } = bizParams;
|
|
|
|
const internalActionRef = useRef<ActionType>();
|
|
const actionRef = externalActionRef || internalActionRef;
|
|
const [dealerVO, setDealerVO] = useState<BusinessAPI.DealerVO>();
|
|
const [supplierVO, setSupplierVO] = useState<BusinessAPI.SupplierVO>();
|
|
const toolbar: ToolBar<BusinessAPI.OrderVO> = {
|
|
...defaultToolbar,
|
|
search: {
|
|
activeKey: "plate",
|
|
defaultActiveKey: "plate",
|
|
items: [
|
|
{
|
|
key: "plate",
|
|
name: "车牌号",
|
|
placeholder: "请输入车牌号",
|
|
},
|
|
],
|
|
},
|
|
render: () => (
|
|
<View className={"item-start flex flex-row gap-2.5"}>
|
|
<View>
|
|
<DealerPicker
|
|
onFinish={(dealerVO) => {
|
|
setDealerVO(dealerVO);
|
|
actionRef.current?.reload();
|
|
}}
|
|
trigger={
|
|
<View
|
|
className={`border-primary flex h-6 items-center rounded-md border-2 px-2.5`}
|
|
>
|
|
<View className={"text-primary text-xs"}>
|
|
{dealerVO?.shortName || "经销商"}
|
|
</View>
|
|
{dealerVO?.shortName ? (
|
|
<Icon
|
|
name={"circle-xmark"}
|
|
size={16}
|
|
onClick={(event) => {
|
|
setDealerVO(undefined);
|
|
actionRef.current?.reload();
|
|
event.stopPropagation();
|
|
}}
|
|
/>
|
|
) : (
|
|
<Icon name={"chevron-down"} size={16} />
|
|
)}
|
|
</View>
|
|
}
|
|
/>
|
|
</View>
|
|
<View>
|
|
<SupplierPicker
|
|
type={type === "PRODUCTION_PURCHASE" ? "FARMER" : "STALL"}
|
|
onFinish={(supplierVO) => {
|
|
setSupplierVO(supplierVO);
|
|
actionRef.current?.reload();
|
|
}}
|
|
trigger={
|
|
<View
|
|
className={`border-primary flex h-6 items-center rounded-md border-2 px-2.5`}
|
|
>
|
|
<View className={"text-primary text-xs"}>
|
|
{supplierVO?.name ||
|
|
(type === "PRODUCTION_PURCHASE" ? "瓜农" : "档口")}
|
|
</View>
|
|
{supplierVO?.name ? (
|
|
<Icon
|
|
name={"circle-xmark"}
|
|
size={16}
|
|
onClick={(event) => {
|
|
setSupplierVO(undefined);
|
|
actionRef.current?.reload();
|
|
event.stopPropagation();
|
|
}}
|
|
/>
|
|
) : (
|
|
<Icon name={"chevron-down"} size={16} />
|
|
)}
|
|
</View>
|
|
}
|
|
/>
|
|
</View>
|
|
</View>
|
|
),
|
|
actions: [
|
|
create && (
|
|
<View className={"flex flex-row gap-2 p-3"} key={"create"}>
|
|
<View className={"flex-1"}>
|
|
<View
|
|
className="bg-primary flex w-full flex-col items-center justify-center space-y-2 rounded-xl py-2.5 text-white"
|
|
onClick={() => {
|
|
Taro.navigateTo({
|
|
url: buildUrl(purchase.path[type].create),
|
|
});
|
|
}}
|
|
>
|
|
<View className="text-base font-bold">新建采购单</View>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
),
|
|
],
|
|
};
|
|
|
|
return (
|
|
<PageList<BusinessAPI.OrderVO, BusinessAPI.OrderPageQry>
|
|
rowId={"orderId"}
|
|
itemHeight={182}
|
|
type={"infinite"}
|
|
actionRef={actionRef}
|
|
render={(orderVO: BusinessAPI.OrderVO, index) => {
|
|
return (
|
|
<View className={"mb-2.5"} key={index}>
|
|
<OrderItem orderVO={orderVO} actionRef={actionRef} />
|
|
</View>
|
|
);
|
|
}}
|
|
toolbar={toolbar}
|
|
request={async (params) => {
|
|
const {
|
|
data: { data, success, notEmpty },
|
|
} = await business.order.pageOrder({
|
|
orderPageQry: {
|
|
...params,
|
|
...bizParams,
|
|
dealerId: dealerVO?.dealerId,
|
|
supplierId: supplierVO?.supplierId,
|
|
},
|
|
});
|
|
|
|
return {
|
|
data,
|
|
success,
|
|
hasMore: notEmpty,
|
|
};
|
|
}}
|
|
pagination={{
|
|
pageSize: 10,
|
|
}}
|
|
/>
|
|
);
|
|
}
|