解决合并冲突
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleSave">批量保存</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button type="primary" plain icon="Printer" @click="handlePrint"> 打印单据 </el-button>
|
||||
<el-form
|
||||
:model="receiptHeaderForm"
|
||||
ref="receiptHeaderRef"
|
||||
@@ -633,6 +634,8 @@ import { useRoute } from 'vue-router';
|
||||
import { ref, reactive, watch, onMounted, onUnmounted, toRefs, defineEmits, getCurrentInstance } from 'vue';
|
||||
import { useStore } from '@/store/store';
|
||||
import useTagsViewStore from '@/store/modules/tagsView';
|
||||
import templateJson from './components/template';
|
||||
import { hiprint } from 'vue-plugin-hiprint';
|
||||
import { debounce } from 'lodash-es';
|
||||
const tagsViewStore = useTagsViewStore();
|
||||
const store = useStore();
|
||||
@@ -1367,6 +1370,39 @@ function handleLocationClick(purposeLocationId, itemId, index, lotNumber) {
|
||||
});
|
||||
}
|
||||
|
||||
function handlePrint() {
|
||||
const result = [];
|
||||
// let supplierName = supplierListOptions.value.filter((item) => {
|
||||
// return item.value == receiptHeaderForm.supplierId;
|
||||
// })[0].label;
|
||||
// const totalAmount = form.purchaseinventoryList.reduce((accumulator, currentRow) => {
|
||||
// return accumulator + (Number(currentRow.totalPrice) || 0);
|
||||
// }, 0);
|
||||
form.purchaseinventoryList = form.purchaseinventoryList.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
price: Number(item.price).toFixed(2),
|
||||
profitAmount: Number(item.profitAmount).toFixed(2),
|
||||
reasonCode_dictText: profit_reason.value.filter((k) => k.value == item.reasonCode)[0]?.label,
|
||||
};
|
||||
});
|
||||
result.push({
|
||||
// supplierName: supplierName,
|
||||
purposeLocationName: form.purchaseinventoryList[0].purposeLocationName,
|
||||
name: userStore.name,
|
||||
totalAmount: totalAmount.value.toFixed(2),
|
||||
...receiptHeaderForm,
|
||||
purchaseinventoryList: form.purchaseinventoryList,
|
||||
});
|
||||
console.log(result, '345678987654');
|
||||
const printElements = templateJson;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
printer: 'EPSON LQ-80KFII',
|
||||
title: '打印标题',
|
||||
}); //开始打印
|
||||
}
|
||||
|
||||
// 单位处理
|
||||
function handleUnitCodeChange(row, index, value) {
|
||||
// 防止点击和已选一样的问题
|
||||
@@ -1677,8 +1713,8 @@ function getMaxCounts(row, index, counts) {
|
||||
}
|
||||
|
||||
function handleSave(row, index) {
|
||||
if (form.purchaseinventoryList.length === 0) {
|
||||
proxy.$message.success('保存成功!');
|
||||
if (form.purchaseinventoryList.length === 0) {
|
||||
proxy.$message.success('保存成功!');
|
||||
return;
|
||||
}
|
||||
rowList.value = [];
|
||||
@@ -2504,7 +2540,7 @@ function totalSourceQuantityChange(rowData, index, value) {
|
||||
// 计算盈亏金额
|
||||
if (rowData.price > 0) {
|
||||
form.purchaseinventoryList[index].lllstatus = true;
|
||||
const profitAmount =
|
||||
const profitAmount =
|
||||
// 修复:正确计算盈亏金额 - 实盘数量减去盘前库存整数部分
|
||||
rowData.price * (totalQuantityNum - parseFloat(zhengshu)) +
|
||||
(rowData.price / partPercent) * parseFloat(xiaoshuzhi);
|
||||
@@ -2529,7 +2565,7 @@ function totalSourceQuantityChange(rowData, index, value) {
|
||||
// 确保在所有情况下都正确计算盈亏金额
|
||||
if (rowData.price > 0 && !form.purchaseinventoryList[index].lllstatus) {
|
||||
// 处理字符串类型的itemQuantity
|
||||
const itemQuantityNum =
|
||||
const itemQuantityNum =
|
||||
typeof form.purchaseinventoryList[index].itemQuantity === 'string'
|
||||
? parseFloat(form.purchaseinventoryList[index].itemQuantity) || 0
|
||||
: form.purchaseinventoryList[index].itemQuantity || 0;
|
||||
|
||||
Reference in New Issue
Block a user