feat(发货单): 添加批量新增发货单明细功能
- 新增批量新增发货单明细API接口 - 在发货单明细表格中添加批量新增按钮 - 改造CoilSelector组件支持多选功能 - 将表单中的输入框改为下拉选择框提升用户体验
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<coil-selector :use-trigger="true" multiple @confirm="handleBatchAdd"
|
||||
:filters="{ selectType: 'product', status: 0, excludeBound: true, orderBy: true }" :orderBy="true">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini">批量新增</el-button>
|
||||
</coil-selector>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
@@ -48,20 +54,30 @@
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-form-item label="发货钢卷" prop="coilId">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<coil-selector v-model="form.coilId" :use-trigger="true"
|
||||
:filters="{ selectType: 'product', status: 0, excludeBound: true, orderBy: true }"
|
||||
@select="handleSelect" :orderBy="true" />
|
||||
<coil-selector v-model="form.coilId" :use-trigger="true"
|
||||
:filters="{ selectType: 'product', status: 0, excludeBound: true, orderBy: true }" @select="handleSelect"
|
||||
:orderBy="true" />
|
||||
<el-checkbox v-model="autoFillForm" label="自动填写表单信息" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="品名" prop="productName">
|
||||
<el-input v-model="form.productName" placeholder="请输入品名" />
|
||||
<el-select v-model="form.productName" placeholder="请选择品名" style="width: 100%">
|
||||
<el-option v-for="item in dict.type.coil_itemname" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="切边" prop="edgeType">
|
||||
<el-input v-model="form.edgeType" placeholder="请输入切边" />
|
||||
<el-select v-model="form.edgeType" placeholder="请选择切边" style="width: 100%">
|
||||
<el-option label="净边料" value="净边料" />
|
||||
<el-option label="毛边料" value="毛边料" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="包装" prop="packaging">
|
||||
<el-input v-model="form.packaging" placeholder="请输入包装" />
|
||||
<el-select v-model="form.packaging" placeholder="请选择包装" style="width: 100%">
|
||||
<el-option label="裸包" value="裸包" />
|
||||
<el-option label="普包" value="普包" />
|
||||
<el-option label="简包" value="简包" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="结算方式" prop="settlementType">
|
||||
<el-input v-model="form.settlementType" placeholder="请输入结算方式" />
|
||||
@@ -100,7 +116,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDeliveryWaybillDetail, getDeliveryWaybillDetail, delDeliveryWaybillDetail, addDeliveryWaybillDetail, updateDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
||||
import { listDeliveryWaybillDetail, getDeliveryWaybillDetail, delDeliveryWaybillDetail, addDeliveryWaybillDetail, updateDeliveryWaybillDetail, batchAddDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
||||
import CoilSelector from "@/components/CoilSelector";
|
||||
|
||||
export default {
|
||||
@@ -115,6 +131,7 @@ export default {
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
dicts: ['coil_itemname'],
|
||||
components: {
|
||||
CoilSelector
|
||||
},
|
||||
@@ -122,7 +139,7 @@ export default {
|
||||
waybillId: {
|
||||
handler(newVal, oldVal) {
|
||||
// if (newVal) {
|
||||
this.getList();
|
||||
this.getList();
|
||||
// }
|
||||
},
|
||||
immediate: true
|
||||
@@ -293,6 +310,31 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
handleBatchAdd(rows) {
|
||||
console.log(rows);
|
||||
const payload = rows.map(coil => ({
|
||||
waybillId: this.waybillId,
|
||||
coilId: coil.coilId,
|
||||
productName: coil.itemName,
|
||||
edgeType: coil.trimmingRequirement,
|
||||
packaging: coil.packagingRequirement,
|
||||
rawMaterialFactory: coil.manufacturer,
|
||||
coilNo: coil.currentCoilNo,
|
||||
specification: coil.specification,
|
||||
material: coil.material,
|
||||
quantity: 1,
|
||||
weight: coil.netWeight,
|
||||
}))
|
||||
this.loading = true;
|
||||
this.buttonLoading = true;
|
||||
batchAddDeliveryWaybillDetail(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const detailIds = row.detailId || this.ids;
|
||||
|
||||
Reference in New Issue
Block a user