|
@@ -241,6 +241,9 @@
|
|
|
|
|
|
<!-- 新增物资和生成一车 -->
|
|
|
<div class="button-box">
|
|
|
+ <el-button type="primary" class="btn" @click="singleDistribute"
|
|
|
+ >单拼分配到每车</el-button
|
|
|
+ >
|
|
|
<el-button type="primary" class="btn" @click="createACar"
|
|
|
>添加到订单</el-button
|
|
|
>
|
|
@@ -1216,20 +1219,104 @@ export default {
|
|
|
//调用记录每一行的合并数的方法
|
|
|
this.getSpanArr(this.selectionList);
|
|
|
},
|
|
|
- //准备生成部分订单
|
|
|
- createACar() {
|
|
|
+ singleDistribute() {
|
|
|
+ let ml = this.materialList.length;
|
|
|
+ if (ml == 0) {
|
|
|
+ this.$message.warning("请至少填入一车物资");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let singleArr = this.materialList;
|
|
|
+ this.$confirm(
|
|
|
+ `以上${ml}车物资将分配到不同的${ml}车,确定继续分配?`,
|
|
|
+ "提醒",
|
|
|
+ {
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ center: true
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ this.creatArtSingle(singleArr);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async creatArtSingle(singleArr) {
|
|
|
let i = 0;
|
|
|
- this.materialList.forEach(e => {
|
|
|
- if (!/(^[1-9]\d*$)/.test(e.meterNumber) && e.meterNumber != null) {
|
|
|
- e.meterNumber = null;
|
|
|
+ singleArr.forEach(e => {
|
|
|
+ if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
|
|
|
+ e.orderPlanWeight = null;
|
|
|
i++;
|
|
|
}
|
|
|
});
|
|
|
if (i != 0) {
|
|
|
- i = 0;
|
|
|
- this.$message.error("米数请输入正整数");
|
|
|
+ this.$message.error("件数必填且请输入正整数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ singleArr.forEach(e => {
|
|
|
+ if (e.materialName.includes("定尺")) {
|
|
|
+ if (!e.meterNumber) {
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (i != 0) {
|
|
|
+ this.$message.error("定尺必须填写米数");
|
|
|
return;
|
|
|
}
|
|
|
+ if (
|
|
|
+ !this.saleOrderConsigneeTel &&
|
|
|
+ this.ignoreSaleOrderConsigneeTel == 0
|
|
|
+ ) {
|
|
|
+ this.$confirm(
|
|
|
+ "收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?",
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ this.ignoreSaleOrderConsigneeTel = 1;
|
|
|
+ this.addMaterialToSaleOrderSingle();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.info("已取消!");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.addMaterialToSaleOrderSingle();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addMaterialToSaleOrderSingle() {
|
|
|
+ this.materialList.forEach(e => {
|
|
|
+ var addmap = {
|
|
|
+ cxh: this.maxCxh,
|
|
|
+ materialName: e.materialName,
|
|
|
+ Specification: e.Specification,
|
|
|
+ materialCode: e.materialCode,
|
|
|
+ orderPlanWeight: e.orderPlanWeight,
|
|
|
+ meterNumber: e.meterNumber,
|
|
|
+ isPound: e.isPound,
|
|
|
+ saleShipperAddressId: this.saleShipperAddressId,
|
|
|
+ place: this.place1,
|
|
|
+ saleShipperAddressName: this.saleShipperAddressName,
|
|
|
+ saleDateOfReceipt: this.saleDateOfReceipt,
|
|
|
+ saleOrderConsigneeTel: this.saleOrderConsigneeTel,
|
|
|
+ truckRemark: this.truckRemark,
|
|
|
+ materialId: e.materialId,
|
|
|
+ haveMeter: e.haveMeter,
|
|
|
+ isDisable: e.isDisable
|
|
|
+ };
|
|
|
+ console.log(addmap);
|
|
|
+ this.selectionList.push(addmap);
|
|
|
+ //最大车序号加1
|
|
|
+ this.maxCxh += 1;
|
|
|
+ this.onblur();
|
|
|
+ });
|
|
|
+ this.materialList = [];
|
|
|
+ this.getSpanArr(this.selectionList);
|
|
|
+ },
|
|
|
+ //准备生成部分订单
|
|
|
+ createACar() {
|
|
|
+ let i = 0;
|
|
|
this.materialList.forEach(e => {
|
|
|
if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
|
|
|
e.orderPlanWeight = null;
|
|
@@ -1340,8 +1427,8 @@ export default {
|
|
|
haveMeter: e.haveMeter,
|
|
|
isDisable: e.isDisable
|
|
|
};
|
|
|
+ console.log(addmap);
|
|
|
this.selectionList.push(addmap);
|
|
|
- console.log(this.selectionList);
|
|
|
});
|
|
|
//清空materialList
|
|
|
this.materialList = [];
|
|
@@ -1636,17 +1723,6 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
let i = 0;
|
|
|
- this.selectionList.forEach(e => {
|
|
|
- if (!/(^[1-9]\d*$)/.test(e.meterNumber) && e.meterNumber != null) {
|
|
|
- e.meterNumber = null;
|
|
|
- i++;
|
|
|
- }
|
|
|
- });
|
|
|
- if (i != 0) {
|
|
|
- i = 0;
|
|
|
- this.$message.error("米数请输入正整数");
|
|
|
- return;
|
|
|
- }
|
|
|
this.selectionList.forEach(e => {
|
|
|
if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
|
|
|
e.orderPlanWeight = null;
|