复制订单信息包含物品
This commit is contained in:
@@ -121,11 +121,9 @@ export default function WorkerOrdersPage() {
|
||||
}
|
||||
|
||||
function copyOrderInfo(order: WorkOrder) {
|
||||
const items = getMaterialDetailItems(order).filter((item) =>
|
||||
String(item.value || '').trim(),
|
||||
)
|
||||
const items = getCopyOrderInfoItems(order)
|
||||
if (items.length === 0) {
|
||||
message.warning('该订单暂无资料信息')
|
||||
message.warning('该订单暂无可复制信息')
|
||||
return
|
||||
}
|
||||
const text = items.map((item) => `${item.label}: ${item.value}`).join('\n')
|
||||
@@ -373,6 +371,7 @@ export default function WorkerOrdersPage() {
|
||||
const items = getMaterialDetailItems(row).filter((item) =>
|
||||
String(item.value || '').trim(),
|
||||
)
|
||||
const canCopyInfo = getCopyOrderInfoItems(row).length > 0
|
||||
const screenshots = getMaterialScreenshots(row)
|
||||
return (
|
||||
<div className="cell-stack">
|
||||
@@ -394,7 +393,7 @@ export default function WorkerOrdersPage() {
|
||||
<Button
|
||||
size="small"
|
||||
icon={<CopyOutlined />}
|
||||
disabled={items.length === 0}
|
||||
disabled={!canCopyInfo}
|
||||
onClick={() => copyOrderInfo(row)}
|
||||
>
|
||||
复制信息
|
||||
@@ -960,6 +959,18 @@ function getMaterialDetailItems(order: WorkOrder): DetailFieldItem[] {
|
||||
return items
|
||||
}
|
||||
|
||||
function getCopyOrderInfoItems(order: WorkOrder): Array<Pick<DetailFieldItem, 'label' | 'value'>> {
|
||||
const productName = String(order.productName || '').trim()
|
||||
const materialItems = getMaterialDetailItems(order).filter((item) =>
|
||||
String(item.value || '').trim(),
|
||||
)
|
||||
|
||||
return [
|
||||
...(productName ? [{ label: '物品', value: productName }] : []),
|
||||
...materialItems,
|
||||
]
|
||||
}
|
||||
|
||||
function renderDetailFieldValues(items: DetailFieldItem[], emptyText: string) {
|
||||
if (items.length === 0) {
|
||||
return <Typography.Text type="secondary">{emptyText}</Typography.Text>
|
||||
|
||||
Reference in New Issue
Block a user