feat: [商品管理] 優化商品匯入邏輯,支援 13 碼條碼自動生成、Upsert 更新機制與 Excel 說明工作表
This commit is contained in:
@@ -62,8 +62,11 @@ export default function ProductForm({
|
||||
};
|
||||
|
||||
const generateRandomBarcode = () => {
|
||||
const randomDigits = Math.floor(Math.random() * 9000000000) + 1000000000;
|
||||
setData("barcode", randomDigits.toString());
|
||||
let result = "";
|
||||
for (let i = 0; i < 13; i++) {
|
||||
result += Math.floor(Math.random() * 10).toString();
|
||||
}
|
||||
setData("barcode", result);
|
||||
};
|
||||
|
||||
const generateRandomCode = () => {
|
||||
@@ -150,7 +153,7 @@ export default function ProductForm({
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="barcode">
|
||||
條碼編號 <span className="text-red-500">*</span>
|
||||
條碼編號 <span className="text-gray-400 font-normal">(選填,未填將自動生成)</span>
|
||||
</Label>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
|
||||
Reference in New Issue
Block a user