|
@@ -24,6 +24,33 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+ <template #detailsOne>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-table :data="summaryList" show-summary :summary-method="getSummaries">
|
|
|
+ <el-table-column type="index" width="60" align="center" />
|
|
|
+ <!-- <el-table-column label="是否扫码" width="80">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div>
|
|
|
+ <span style="padding: 4px" :class="[row.isScan == 1 ? 'active' : 'disActive']">
|
|
|
+ {{
|
|
|
+ proxy.dictValueLabel(row.isScan, scanData)
|
|
|
+ }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column prop="productCode" label="产品编码" width="140" />
|
|
|
+ <el-table-column prop="productName" label="产品名称" min-width="160" />
|
|
|
+ <el-table-column prop="productSpec" label="规格型号" width="120" />
|
|
|
+ <el-table-column prop="productUnit" label="单位" width="80" :formatter="
|
|
|
+ (row) => dictValueLabel(row.productUnit, productUnit)
|
|
|
+ " />
|
|
|
+ <el-table-column label="入库数量" width="110" prop="quantity">
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template #details>
|
|
|
<div style="width: 100%">
|
|
|
<el-button type="primary" @click="clickAdd()">添加明细</el-button>
|
|
@@ -51,7 +78,7 @@
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
|
|
|
<el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="1"
|
|
|
- :disabled="row.isScan =='1'" onmousewheel="return false;" />
|
|
|
+ :disabled="row.isScan =='1'" onmousewheel="return false;" @change="()=>getSummaryList()" />
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -269,6 +296,11 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "slot",
|
|
|
+ slotName: "detailsOne",
|
|
|
+ label: "汇总明细",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
slotName: "details",
|
|
|
label: "入库明细",
|
|
|
},
|
|
@@ -287,7 +319,9 @@ const rules = ref({
|
|
|
{ required: true, message: "请输入入库人", trigger: "blur" },
|
|
|
],
|
|
|
});
|
|
|
+const summaryList = ref([]);
|
|
|
const openModal = () => {
|
|
|
+ summaryList.value = [];
|
|
|
formData.data = {
|
|
|
type: "1",
|
|
|
list: [],
|
|
@@ -304,6 +338,19 @@ const clickAdd = () => {
|
|
|
ElMessage("请先选择仓库");
|
|
|
}
|
|
|
};
|
|
|
+const getSummaryList = () => {
|
|
|
+ let obj = {};
|
|
|
+ for (let i = 0; i < formData.data.list.length; i++) {
|
|
|
+ const iele = formData.data.list[i];
|
|
|
+ if (obj[iele.productId]) {
|
|
|
+ obj[iele.productId].quantity =
|
|
|
+ Number(obj[iele.productId].quantity) + Number(iele.quantity);
|
|
|
+ } else {
|
|
|
+ obj[iele.productId] = { ...iele };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ summaryList.value = Object.values(obj);
|
|
|
+};
|
|
|
const pushGoods = (goods) => {
|
|
|
if (goods && goods.id) {
|
|
|
// formData.data.list = formData.data.list.concat(
|
|
@@ -327,9 +374,10 @@ const pushGoods = (goods) => {
|
|
|
productName: goods.name,
|
|
|
productSpec: goods.spec,
|
|
|
productUnit: goods.unit,
|
|
|
- quantity: undefined,
|
|
|
+ quantity: null,
|
|
|
purchaseDetailId: "",
|
|
|
});
|
|
|
+ getSummaryList();
|
|
|
ElMessage({
|
|
|
message: "添加成功!",
|
|
|
type: "success",
|
|
@@ -360,6 +408,7 @@ const submitForm = () => {
|
|
|
};
|
|
|
const handleDelete = (index) => {
|
|
|
formData.data.list.splice(index, 1);
|
|
|
+ getSummaryList();
|
|
|
};
|
|
|
const acquireSelectList = () => {
|
|
|
let data = [];
|
|
@@ -447,6 +496,7 @@ const handleScanValueChange = (val) => {
|
|
|
quantity: 1,
|
|
|
purchaseDetailId: "",
|
|
|
});
|
|
|
+ getSummaryList();
|
|
|
},
|
|
|
(err) => {}
|
|
|
);
|
|
@@ -464,6 +514,7 @@ const handleScanValueChange = (val) => {
|
|
|
quantity: 1,
|
|
|
purchaseDetailId: val,
|
|
|
});
|
|
|
+ getSummaryList();
|
|
|
},
|
|
|
(err) => {}
|
|
|
);
|