|
|
@ -305,9 +305,9 @@ |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row :gutter="12"> |
|
|
<el-row :gutter="12"> |
|
|
<el-col :span="6"><el-form-item label="SKU"><el-input v-model="addForm.sku" disabled /></el-form-item></el-col> |
|
|
<el-col :span="6"><el-form-item label="SKU"><el-input v-model="addForm.sku" disabled /></el-form-item></el-col> |
|
|
<el-col :span="6"><el-form-item label="Unit Price"><el-input v-model="addForm.price" type="number" /></el-form-item></el-col> |
|
|
|
|
|
<el-col :span="6"><el-form-item label="PO Qty"><el-input v-model="addForm.qty" type="number" /></el-form-item></el-col> |
|
|
|
|
|
<el-col :span="6"><el-form-item label="PO Value"><el-input v-model="addForm.value" /></el-form-item></el-col> |
|
|
|
|
|
|
|
|
<el-col :span="6"><el-form-item label="Unit Price" required><el-input v-model="addForm.price" type="number" @input="recalcAddFormValue" /></el-form-item></el-col> |
|
|
|
|
|
<el-col :span="6"><el-form-item label="PO Qty" required><el-input v-model="addForm.qty" type="number" @input="recalcAddFormValue" /></el-form-item></el-col> |
|
|
|
|
|
<el-col :span="6"><el-form-item label="PO Value"><el-input v-model="addForm.value" disabled /></el-form-item></el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row :gutter="12"> |
|
|
<el-row :gutter="12"> |
|
|
<el-col :span="6"><el-form-item label="A-Qty"><el-input v-model="addForm.shipQty" /></el-form-item></el-col> |
|
|
<el-col :span="6"><el-form-item label="A-Qty"><el-input v-model="addForm.shipQty" /></el-form-item></el-col> |
|
|
@ -754,7 +754,7 @@ export default { |
|
|
fixed: '', |
|
|
fixed: '', |
|
|
columnWidth: 80, |
|
|
columnWidth: 80, |
|
|
showOverflowTooltip: true, |
|
|
showOverflowTooltip: true, |
|
|
editAble: false, |
|
|
|
|
|
|
|
|
editAble: true, |
|
|
editType: 'num', |
|
|
editType: 'num', |
|
|
selectOptionsKey: '', |
|
|
selectOptionsKey: '', |
|
|
selectOptions: null |
|
|
selectOptions: null |
|
|
@ -777,8 +777,8 @@ export default { |
|
|
fixed: '', |
|
|
fixed: '', |
|
|
columnWidth: 90, |
|
|
columnWidth: 90, |
|
|
showOverflowTooltip: true, |
|
|
showOverflowTooltip: true, |
|
|
editAble: true, |
|
|
|
|
|
editType: 'text', |
|
|
|
|
|
|
|
|
editAble: false, |
|
|
|
|
|
editType: 'num', |
|
|
selectOptionsKey: '', |
|
|
selectOptionsKey: '', |
|
|
selectOptions: null |
|
|
selectOptions: null |
|
|
}, |
|
|
}, |
|
|
@ -1586,9 +1586,41 @@ export default { |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
}, |
|
|
}, |
|
|
onCellChange (row) { |
|
|
onCellChange (row) { |
|
|
|
|
|
if (row.price !== undefined || row.qty !== undefined) { |
|
|
|
|
|
this.$set(row, 'value', this.calcPoValue(row.price, row.qty)) |
|
|
|
|
|
} |
|
|
this.$set(row, 'changeFlag', 1) |
|
|
this.$set(row, 'changeFlag', 1) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
calcPoValue (price, qty) { |
|
|
|
|
|
if (price === '' || price == null || qty === '' || qty == null) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
const p = Number(price) |
|
|
|
|
|
const q = Number(qty) |
|
|
|
|
|
if (isNaN(p) || isNaN(q)) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
const total = p * q |
|
|
|
|
|
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(4))) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
recalcAddFormValue () { |
|
|
|
|
|
this.addForm.value = this.calcPoValue(this.addForm.price, this.addForm.qty) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
validatePriceAndQty (price, qty, label) { |
|
|
|
|
|
if (price === '' || price == null) { |
|
|
|
|
|
this.$message.warning((label ? label + ':' : '') + '请填写 Unit Price') |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if (qty === '' || qty == null) { |
|
|
|
|
|
this.$message.warning((label ? label + ':' : '') + '请填写 PO Qty') |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
handleSupplierChange(row, supplierNo) { |
|
|
handleSupplierChange(row, supplierNo) { |
|
|
console.log('供应商变更:', supplierNo, '行ID:', row.id) |
|
|
console.log('供应商变更:', supplierNo, '行ID:', row.id) |
|
|
|
|
|
|
|
|
@ -1744,6 +1776,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 保存订单信息 |
|
|
// 保存订单信息 |
|
|
buildBatchUpdateRow (row) { |
|
|
buildBatchUpdateRow (row) { |
|
|
|
|
|
const value = this.calcPoValue(row.price, row.qty) |
|
|
return { |
|
|
return { |
|
|
orderNo: row.orderNo, |
|
|
orderNo: row.orderNo, |
|
|
site: row.site, |
|
|
site: row.site, |
|
|
@ -1761,9 +1794,9 @@ export default { |
|
|
confirmed: row.confirmed, |
|
|
confirmed: row.confirmed, |
|
|
partNo: row.partNo, |
|
|
partNo: row.partNo, |
|
|
status: row.status, |
|
|
status: row.status, |
|
|
qty: row.qty, |
|
|
|
|
|
price: row.price, |
|
|
|
|
|
value: row.value, |
|
|
|
|
|
|
|
|
qty: row.qty === '' ? null : Number(row.qty), |
|
|
|
|
|
price: row.price === '' ? null : Number(row.price), |
|
|
|
|
|
value: value === '' ? null : Number(value), |
|
|
shipQty: row.shipQty, |
|
|
shipQty: row.shipQty, |
|
|
sumPrice: row.sumPrice, |
|
|
sumPrice: row.sumPrice, |
|
|
wantReceiveDate: row.wantReceiveDate, |
|
|
wantReceiveDate: row.wantReceiveDate, |
|
|
@ -1784,6 +1817,13 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
batchUpdatePoOrder(changed) { |
|
|
batchUpdatePoOrder(changed) { |
|
|
|
|
|
for (const row of changed) { |
|
|
|
|
|
const label = row.orderNo ? `订单 ${row.orderNo}` : '订单' |
|
|
|
|
|
if (!this.validatePriceAndQty(row.price, row.qty, label)) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.$set(row, 'value', this.calcPoValue(row.price, row.qty)) |
|
|
|
|
|
} |
|
|
const updateData = changed.map(row => this.buildBatchUpdateRow(row)) |
|
|
const updateData = changed.map(row => this.buildBatchUpdateRow(row)) |
|
|
|
|
|
|
|
|
// 调用批量修改接口 |
|
|
// 调用批量修改接口 |
|
|
@ -2057,12 +2097,18 @@ export default { |
|
|
this.$message.warning('请填写 PO No、Vendor Name、Item') |
|
|
this.$message.warning('请填写 PO No、Vendor Name、Item') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (!this.validatePriceAndQty(this.addForm.price, this.addForm.qty)) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.recalcAddFormValue() |
|
|
this.addFormSaving = true |
|
|
this.addFormSaving = true |
|
|
|
|
|
const calculatedValue = this.calcPoValue(this.addForm.price, this.addForm.qty) |
|
|
const payload = { |
|
|
const payload = { |
|
|
...this.addForm, |
|
|
...this.addForm, |
|
|
site: this.$store.state.user.site, |
|
|
site: this.$store.state.user.site, |
|
|
price: this.addForm.price === '' ? null : Number(this.addForm.price), |
|
|
|
|
|
qty: this.addForm.qty === '' ? null : Number(this.addForm.qty), |
|
|
|
|
|
|
|
|
price: Number(this.addForm.price), |
|
|
|
|
|
qty: Number(this.addForm.qty), |
|
|
|
|
|
value: calculatedValue === '' ? null : Number(calculatedValue), |
|
|
shipQty: this.addForm.shipQty === '' ? null : Number(this.addForm.shipQty), |
|
|
shipQty: this.addForm.shipQty === '' ? null : Number(this.addForm.shipQty), |
|
|
sumPrice: this.addForm.sumPrice === '' ? null : Number(this.addForm.sumPrice) |
|
|
sumPrice: this.addForm.sumPrice === '' ? null : Number(this.addForm.sumPrice) |
|
|
} |
|
|
} |
|
|
|