获取焦点
This commit is contained in:
@@ -90,6 +90,9 @@ const calcUnitRefPrice = (total: number, spec: string): number => {
|
||||
const calcLevelAmount = (amount: number, percent: number): number =>
|
||||
Math.trunc(amount * (100 + percent)) / 100;
|
||||
|
||||
/** 输入框聚焦时全选已有内容,方便直接键入覆盖(Input / InputNumber / TextArea 通用) */
|
||||
const selectAllOnFocus = (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => e.target.select();
|
||||
|
||||
/**
|
||||
* 采购单管理(C1 在门店订单页合并生成 / C2-C3 导出 / C4 明细矩阵修改)
|
||||
* 采购单无独立明细表,明细直接溯源门店订货明细:商品行 × 门店列
|
||||
@@ -560,6 +563,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
prefix="¥"
|
||||
className="w-full"
|
||||
defaultValue={Number(row.cost_price)}
|
||||
onFocus={selectAllOnFocus}
|
||||
onPressEnter={(e) => void handleInlineSave(row, dataIndex, (e.target as HTMLInputElement).value)}
|
||||
onBlur={(e) => void handleInlineSave(row, dataIndex, e.target.value)}
|
||||
/>
|
||||
@@ -573,6 +577,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
style={{ textAlign: 'center' }}
|
||||
defaultValue={row[dataIndex]}
|
||||
maxLength={dataIndex === 'unit' ? 20 : 100}
|
||||
onFocus={selectAllOnFocus}
|
||||
onPressEnter={(e) => void handleInlineSave(row, dataIndex, (e.target as HTMLInputElement).value)}
|
||||
onBlur={(e) => void handleInlineSave(row, dataIndex, e.target.value)}
|
||||
/>
|
||||
@@ -770,6 +775,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
precision={0}
|
||||
className="w-full"
|
||||
defaultValue={quantity}
|
||||
onFocus={selectAllOnFocus}
|
||||
onPressEnter={(e) => void handleStoreCellSave(row, store.id, (e.target as HTMLInputElement).value)}
|
||||
onBlur={(e) => void handleStoreCellSave(row, store.id, e.target.value)}
|
||||
/>
|
||||
@@ -1092,23 +1098,32 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
{
|
||||
title: '实际成本',
|
||||
dataIndex: 'actual_amount',
|
||||
hideInTable: true,
|
||||
hideInSearch: true,
|
||||
valueType: "digit",
|
||||
fieldProps: {
|
||||
min: 0,
|
||||
precision: 3,
|
||||
placeholder: "请输入单价"
|
||||
placeholder: "请输入单价",
|
||||
onFocus: selectAllOnFocus,
|
||||
},
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '账单总金额',
|
||||
dataIndex: 'bill_total_amount',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
align: 'center',
|
||||
render: (_, record) =>
|
||||
Number(record.actual_amount) > 0 ? (
|
||||
<Text strong>¥{record.actual_amount}</Text>
|
||||
record.bill_total_amount != null ? (
|
||||
<Text strong type="danger">¥{Number(record.bill_total_amount).toFixed(2)}</Text>
|
||||
) : (
|
||||
<Text type="secondary">未录入</Text>
|
||||
<Text type="secondary">未生成账单</Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '应付商品金额',
|
||||
title: '商品金额',
|
||||
dataIndex: 'bill_product_amount',
|
||||
hideInForm: true,
|
||||
hideInSearch: true,
|
||||
@@ -1132,7 +1147,10 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
dataIndex: 'remark',
|
||||
valueType: "textarea",
|
||||
hideInTable: true,
|
||||
hideInSearch: true
|
||||
hideInSearch: true,
|
||||
fieldProps: {
|
||||
onFocus: selectAllOnFocus,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '总重量',
|
||||
@@ -1528,6 +1546,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
precision={2}
|
||||
disabled={billed}
|
||||
placeholder="配送费"
|
||||
onFocus={selectAllOnFocus}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
@@ -1540,6 +1559,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
precision={0}
|
||||
disabled={billed}
|
||||
placeholder="正压负回"
|
||||
onFocus={selectAllOnFocus}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
@@ -1552,6 +1572,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
precision={0}
|
||||
disabled={billed}
|
||||
placeholder="正压负回"
|
||||
onFocus={selectAllOnFocus}
|
||||
/>
|
||||
</Form.Item>
|
||||
<div className="w-50 shrink-0 px-1! flex justify-center">
|
||||
@@ -1571,6 +1592,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
prefix={'¥'}
|
||||
disabled={billed}
|
||||
placeholder="可正负,计入总额"
|
||||
onFocus={selectAllOnFocus}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Space.Compact>
|
||||
@@ -1584,6 +1606,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
maxLength={255}
|
||||
disabled={billed}
|
||||
placeholder="备注(可选)"
|
||||
onFocus={selectAllOnFocus}
|
||||
/>
|
||||
</Form.Item>
|
||||
<div className="w-28 shrink-0 text-center">
|
||||
@@ -1641,10 +1664,10 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
name="quantity"
|
||||
rules={[{ required: true, message: '请输入采购数量' }]}
|
||||
>
|
||||
<InputNumber className="w-full" min={1} precision={0} placeholder="请输入采购数量(包数)" />
|
||||
<InputNumber className="w-full" min={1} precision={0} placeholder="请输入采购数量(包数)" onFocus={selectAllOnFocus} />
|
||||
</Form.Item>
|
||||
<Form.Item label="称重(斤,可选)" name="weight">
|
||||
<InputNumber className="w-full" min={0} precision={3} placeholder="请输入称重" />
|
||||
<InputNumber className="w-full" min={0} precision={3} placeholder="请输入称重" onFocus={selectAllOnFocus} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
@@ -1668,17 +1691,17 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
name="price"
|
||||
rules={[{ required: true, message: '请输入单价' }]}
|
||||
>
|
||||
<InputNumber className="w-full" min={0} precision={2} placeholder="请输入单价" />
|
||||
<InputNumber className="w-full" min={0} precision={2} placeholder="请输入单价" onFocus={selectAllOnFocus} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="采购数量"
|
||||
name="quantity"
|
||||
rules={[{ required: true, message: '请输入采购数量' }]}
|
||||
>
|
||||
<InputNumber className="w-full" min={0} precision={0} placeholder="请输入采购数量" />
|
||||
<InputNumber className="w-full" min={0} precision={0} placeholder="请输入采购数量" onFocus={selectAllOnFocus} />
|
||||
</Form.Item>
|
||||
<Form.Item label="称重(斤)" name="weight" rules={[{ required: true, message: '请输入称重' }]}>
|
||||
<InputNumber className="w-full" min={0} precision={3} placeholder="请输入称重" />
|
||||
<InputNumber className="w-full" min={0} precision={3} placeholder="请输入称重" onFocus={selectAllOnFocus} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user