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