<script>
|
export default {
|
data() {
|
return {};
|
},
|
methods: {
|
// 级联改变数据
|
onChange(ref, val, field, formData) {
|
// debugger;
|
// 记录ID和Name
|
if (field.options.prop === "provinceName") {
|
// 设置表单数据
|
const item = ref.getOption(val);
|
// 改变市级下拉框
|
this.loadChildrenNode(item.value, 614, field.options.prop);
|
} else if (field.options.prop === "cityName") {
|
// 设置表单数据
|
const item = ref.getOption(val);
|
// 改变区级下拉框
|
this.loadChildrenNode(item.value, 615, field.options.prop);
|
} else if (field.options.prop === "expressCorpType") {
|
// 根据快递类别改变快递名称
|
const expressCorpType = this.editor.formData.expressCorpType;
|
const url = "/api/basicInfo/base/expressCorp/getList";
|
const params = {
|
openNodeApi: true,
|
expressCorpType: expressCorpType
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
var data = [];
|
this.editor.setDropdownData(568, data);
|
this.editor.changeValue("expressCorp_Id", null);
|
this.editor.changeValue("expressCorpName", null);
|
if (res.result) {
|
res.data.forEach(item => {
|
const newItem = {
|
value: item.expressCorp_Id,
|
label: item.expressCorpName,
|
expressCorp_Id: item.expressCorp_Id,
|
expressCorpName: item.expressCorpName
|
};
|
data.push(newItem);
|
});
|
this.editor.setDropdownData(568, data);
|
} else {
|
this.editor.setDropdownData(568, data);
|
}
|
});
|
} else if (field.options.prop === "clientShortName") {
|
// 隐藏下拉框
|
ref.doClose();
|
// 选择客户名称之后加载客户信息
|
const clientShortName = this.editor.formData["clientShortName"];
|
const url = "/api/basicInfo/base/client/getList";
|
const params = {
|
name: clientShortName
|
};
|
const _ref = this.dataList;
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// debugger;
|
var arr = JSON.parse(res.data[0].expandFields);
|
if (arr) {
|
this.editor.changeValue("linecode", arr.linecode);
|
this.editor.changeValue("lineName", arr.lineName);
|
}
|
this.editor.changeValue("mobile", res.data[0].mobile);
|
this.editor.changeValue("tel", res.data[0].tel);
|
this.editor.changeValue("shippingName", res.data[0].shippingName);
|
this.editor.changeValue("shippingAddress", res.data[0].shippingAddress);
|
this.editor.changeValue("province_Id", res.data[0].province_Id);
|
this.editor.changeValue("provinceName", res.data[0].provinceName);
|
this.editor.changeValue("city_Id", res.data[0].city_Id);
|
this.editor.changeValue("cityName", res.data[0].cityName);
|
this.editor.changeValue("region_Id", res.data[0].region_Id);
|
this.editor.changeValue("regionName", res.data[0].regionName);
|
this.editor.changeValue("telephone", res.data[0].tel);
|
this.editor.changeValue("countryName", res.data[0].countryName);
|
this.editor.changeValue("client_Id", res.data[0].client_Id);
|
this.editor.changeValue("clientCode", res.data[0].clientCode);
|
} else {
|
this.editor.changeValue("tel", null);
|
this.editor.changeValue("linecode", null);
|
this.editor.changeValue("lineName", null);
|
this.editor.changeValue("mobile", null);
|
this.editor.changeValue("shippingName", null);
|
this.editor.changeValue("shippingAddress", null);
|
this.editor.changeValue("linecode", null);
|
this.editor.changeValue("province_Id", null);
|
this.editor.changeValue("provinceName", null);
|
this.editor.changeValue("city_Id", null);
|
this.editor.changeValue("cityName", null);
|
this.editor.changeValue("region_Id", null);
|
this.editor.changeValue("regionName", null);
|
this.editor.changeValue("telephone", null);
|
this.editor.changeValue("countryName", null);
|
this.editor.changeValue("client_Id", null);
|
this.editor.changeValue("clientCode", null);
|
}
|
};
|
this.common.ajax(url, params, callback, _ref);
|
}
|
},
|
// 根据省ID获得市
|
loadChildrenNode(id, dropdown_Id, prop) {
|
var editorRef = this.editor;
|
var where = { parentId: id };
|
var url = "/api/common/loadTreeNode";
|
var params = {
|
openNodeApi: true,
|
folder: "basicInfo/base",
|
dbServer: "Sys",
|
tableName: "Base_City",
|
tableView: "Base_City",
|
keyName: "city_Id",
|
nodeName: "cityName",
|
fixHasChild: false,
|
isBreakWay: false,
|
displayBreakWay: false,
|
parentName: "parentId",
|
orderBy: "orderNo desc, city_Id",
|
where: where,
|
extendColumns: ""
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
if (res.result) {
|
var data = res.data.map(item => {
|
if (prop === "provinceName") {
|
const newItem = {
|
city_Id: item.value,
|
cityName: item.label,
|
value: item.value,
|
label: item.label
|
};
|
return newItem;
|
} else if (prop === "cityName") {
|
this.$set(this.form);
|
const newItem = {
|
region_Id: item.value,
|
regionName: item.label,
|
value: item.value,
|
label: item.label
|
};
|
return newItem;
|
}
|
});
|
editorRef.setDropdownData(dropdown_Id, data);
|
} else {
|
this.$message.error(res.msg);
|
}
|
},
|
true
|
);
|
},
|
// 新建后事件
|
onAddLoadAfter(formData) {
|
// 清空下拉框数据
|
this.editor.setDropdownData(614, []);
|
this.editor.setDropdownData(615, []);
|
this.editor.setDropdownData(553, []);
|
if (formData.orderType === "手动出库") {
|
const email = this.editor.formData["email"];
|
var productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.readonly = true;
|
email;
|
// productCodeField = this.editorOptions.fields[2].columns[1].fields[0]; //销售订单号
|
// productCodeField.options.readonly = true;
|
if (email === "发料到销售订单231") {
|
this.masterData.baseCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField.options.disabled = false;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "发料到成本中心201") {
|
this.masterData.storeCurrencyCode = null;
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "发料到生产订单261") {
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "暂存区发料到生产订单261") {
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "311立库到平库") {
|
this.masterData.storeCurrencyCode = null;
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.baseCurrencyCode = null;
|
this.masterData.tag = "G021";
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.disabled = false;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.readonly = true;
|
productCodeField.options.disabled = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
}
|
}
|
|
this.onEditLoadAfter(formData);
|
},
|
// 数据加载后
|
onEditLoadAfter(formData) {
|
// var saleOrderList = this.editor.formData["Sale_OrderList"].rows;
|
const saleOrderList = this.editor.formData["Sale_OrderList"].rows.filter(item => {
|
return item.trackingNumber;
|
});
|
setTimeout(() => {
|
saleOrderList.forEach(item => {
|
this.editor.$refs["detail-table-Sale_OrderList"][0].toggleRowSelection(item, true);
|
});
|
}, 1000);
|
// this.editor.detailFields[0].options.detailSelections = saleOrderList;
|
|
this.formData = formData;
|
var statusID = formData.statusID;
|
var sortingStatus = formData.sortingStatus;
|
this.btnReadOnly.detailAddPosition = true;
|
|
if (statusID === 16) {
|
// 终止
|
this.btnReadOnly.open = false; // 可编辑
|
this.btnReadOnly.stop = true; // 不可编辑
|
this.btnReadOnly.sorting = true; // 不可编辑
|
this.btnReadOnly.confirm = true; // 不可编辑
|
this.btnReadOnly.detailAddPosition = true;
|
this.editorOptions.config.disabled = true; // 整个对话框不可编辑
|
} else if (statusID === 23) {
|
// 临时修改
|
this.btnReadOnly.confirm = true;
|
this.btnReadOnly.sorting = false;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = true;
|
this.editorOptions.config.disabled = false;
|
} else if (statusID === 2 || statusID === 25) {
|
// 审核成功,25改变物流
|
this.btnReadOnly.confirm = true;
|
this.btnReadOnly.sorting = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = true;
|
this.editorOptions.config.disabled = true;
|
} else if (statusID === 3 || statusID === 4 || statusID === 5 || statusID === 7 || statusID === 8) {
|
// 库房作业,审核失败,已打印
|
this.btnReadOnly.confirm = true;
|
this.btnReadOnly.sorting = true;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = true;
|
this.editorOptions.config.disabled = true;
|
} else if (statusID === 2 && sortingStatus === 2) {
|
// 审核成功,已分配
|
|
this.btnReadOnly.confirm = true;
|
this.btnReadOnly.sorting = true;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = true;
|
this.editorOptions.config.disabled = true;
|
} else if (statusID === 1 || statusID === 21) {
|
// 新建,下载失败
|
this.btnReadOnly.confirm = false;
|
this.btnReadOnly.sorting = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = false;
|
this.editorOptions.config.disabled = false;
|
} else {
|
this.btnReadOnly.confirm = true;
|
this.btnReadOnly.sorting = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.detailAddPosition = true;
|
// this.$set(this.btnReadOnly, "lackAnalysis", false);
|
this.editorOptions.config.disabled = true;
|
}
|
if (sortingStatus === 5) {
|
// 部分分拣
|
this.btnReadOnly.sorting = false;
|
}
|
if (statusID !== 1) {
|
// 加载省
|
this.loadChildrenNode(formData.province_Id, 614, "provinceName");
|
// 加载市
|
this.loadChildrenNode(formData.city_Id, 615, "cityName");
|
}
|
const email = this.editor.formData["email"];
|
var productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.readonly = true;
|
email;
|
// productCodeField = this.editorOptions.fields[2].columns[1].fields[0]; //销售订单号
|
// productCodeField.options.readonly = true;
|
// 不同的移动类型 禁用不同的文本框
|
if (email === "发料到销售订单231") {
|
this.masterData.baseCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "发料到成本中心201") {
|
this.masterData.storeCurrencyCode = null;
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "发料到生产订单261") {
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "暂存区发料到生产订单261") {
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.giftMessage = null;
|
this.masterData.tag = null;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = false;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = false;
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.disabled = true;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.disabled = true;
|
} else if (email === "311立库到平库") {
|
this.masterData.storeCurrencyCode = null;
|
this.masterData.orderCurrencyCode = null;
|
this.masterData.baseCurrencyCode = null;
|
this.masterData.tag = "G021";
|
productCodeField = this.editorOptions.fields[3].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.disabled = false;
|
// productCodeField.options.required = true;
|
productCodeField = this.editorOptions.fields[3].columns[0].fields[0];
|
// productCodeField.options.required = true;
|
productCodeField.options.readonly = true;
|
productCodeField.options.disabled = false;
|
productCodeField = this.editorOptions.fields[2].columns[0].fields[0];
|
productCodeField.options.required = false;
|
productCodeField.options.readonly = true;
|
productCodeField = this.editorOptions.fields[2].columns[1].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
productCodeField = this.editorOptions.fields[2].columns[2].fields[0];
|
productCodeField.options.readonly = true;
|
productCodeField.options.required = false;
|
}
|
|
this.btnReadOnly.lackAnalysis = false;
|
},
|
// 关闭窗口前钩子函数, return true关闭窗口
|
beforeClose() {
|
const detailList = this.editor.formData["Sale_OrderList"].rows.filter(item => {
|
return !item.orderList_Id;
|
});
|
if (this.editor.formData.statusText === "待审核" && detailList.length) {
|
this.$confirm("数据未保存,是否关闭?", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.editor.config.visible = false;
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
this.editor.config.visible = true;
|
});
|
} else {
|
this.editor.config.visible = false;
|
}
|
},
|
// 明细字段改变
|
onDetailChange(ref, val, row, field) {
|
// debugger;
|
let grandTotal = 0; // 销售金额
|
let discountAmount = 0; // 优惠金额
|
let totalQuantityOrder = 0; // 合计数量
|
let totalvolume = 0; // 合计体积
|
let subTotal = 0; // 折后金额
|
let weight = 0; // 物品重量
|
var totalWeight = 0.0;
|
// var formData = this.editor.formData;
|
var detailRows = this.detailRows;
|
// var arr = JSON.parse(item.expandFields);]
|
// debugger;
|
this.detailRows.forEach(row => {
|
totalvolume += row.volume || 0;
|
});
|
|
detailRows.forEach(item => {
|
grandTotal += Math.Round((item.quantityOrder || 0) * (item.salePrice || 0), 4);
|
discountAmount += item.discountAmount || 0;
|
totalQuantityOrder += item.quantityOrder || 0;
|
// debugger;
|
// totalvolume += volume;
|
|
item.rowTotal = Math.Round((item.quantityOrder || 0) * (item.salePrice || 0), 2);
|
item.salePriceDiscount = Math.Round((item.salePrice || 0) * (item.discountRate || 0), 2);
|
item.subTotal = Math.Round((item.quantityOrder || 0) * (item.salePriceDiscount || 0) - (item.discountAmount || 0), 2);
|
// subTotal += (item.quantityOrder || 0) * (item.salePriceDiscount || 0);
|
subTotal += item.subTotal;
|
item.rowWeight = Math.Round((item.quantityOrder || 0) * (item.weight || 0), 2);
|
item.ratePrice = Math.Round((item.salePrice || 0) * (1 - (item.rate || 0)), 2);
|
item.rateMoney = Math.Round((item.rowTotal || 0) * (1 - (item.rate || 0)), 2);
|
item.salesvolume = Math.Round((item.quantityOrder || 0) * (item.salePrice || 0), 2);
|
item.purchaseamount = Math.Round((item.quantityOrder || 0) * (item.purchasePrice || 0), 2);
|
// this.$set(item, "totalWeight", item.rowWeight);
|
weight += (item.quantityOrder || 0) * (item.weight || 0);
|
// if (item.quantityOrder !== null || item.weight !== null) {
|
// if (field && field.prop !== "totalWeight") {
|
// item.totalWeight = Math.Round((item.quantityOrder || 0) * (item.weight || 0), 2);
|
// }
|
// }
|
// if (field.prop === "totalWeight") {
|
// item.weight = (item.totalWeight || 0) / (item.quantityOrder || 0);
|
// }
|
if (field) {
|
if (field.prop === "quantityOrder" || field.prop === "weight") {
|
// 小计毛重 = 预出库数量 * 单位重量
|
item.totalWeight = (item.quantityOrder || 0) * (item.weight || 0);
|
} else if (field && field.prop === "totalWeight") {
|
// 单位重量:weight= 小计毛重:totalWeight/ 预出库数量:quantityOrder
|
if (item.quantityOrder) {
|
item.weight = (item.totalWeight || 0) / (item.quantityOrder || 0);
|
} else {
|
item.weight = 0;
|
}
|
}
|
}
|
totalWeight += item.totalWeight || 0;
|
if (field) {
|
if (field.prop === "paiQty") {
|
item.paiQty = Math.ceil(item.paiQty);
|
} else {
|
item.paiQty = item.unitConvert ? Math.ceil(item.quantityOrder / item.unitConvert) : 0;
|
}
|
}
|
// 大单位数量= 预出库数量*大单位换算关系
|
if (!item.quantityOrder || !item.unitConvert) {
|
item.bigUnitnumber = 0;
|
} else {
|
item.bigUnitnumber = Math.Round(item.quantityOrder / item.unitConvert, 4);
|
}
|
if (!item.quantityOrder || !item.unitConvert) {
|
item.bigUnitRounding = 0;
|
} else {
|
item.bigUnitRounding = Math.ceil(item.quantityOrder / item.unitConvert, 4);
|
}
|
});
|
this.editor.changeValue("grandTotal", Math.Round(grandTotal, 4));
|
this.editor.changeValue("totalQuantityOrder", totalQuantityOrder);
|
this.editor.changeValue("totalvolume", totalvolume);
|
|
this.editor.changeValue("subTotal", Math.Round(subTotal, 2));
|
this.editor.changeValue("weight", Math.Round(weight, 2));
|
this.editor.changeValue("discountAmount", Math.Round(discountAmount, 2));
|
this.editor.changeValue("totalWeight", Math.Round(totalWeight, 2));
|
|
// 已支付、未支付
|
const totalPaid = this.masterData.totalPaid || 0;
|
const unpaid = subTotal - totalPaid;
|
this.editor.changeValue("totalPaid", Math.Round(totalPaid, 2));
|
this.editor.changeValue("unpaid", Math.Round(unpaid, 2));
|
},
|
// 保存前事件
|
onSaveBefore(formData) {
|
this.onDetailChange();
|
let hasQty = true; // 预出库数量
|
const containerNos = []; // 集装箱号
|
var detailRows = formData["Sale_OrderList"].rows;
|
// if (detailRows.length <= 0) {
|
// this.$message({
|
// message: "请填写订单明细数据!",
|
// type: "warning"
|
// });
|
// return false;
|
// } //
|
// this.masterData.client_Id = this.masterData.outNumber;
|
detailRows.forEach(item => {
|
if (item.quantityOrder <= 0 || !item.quantityOrder) {
|
hasQty = false;
|
}
|
if (item.containerNo) {
|
if (!containerNos.find(row => row.containerNo === item.containerNo)) {
|
containerNos.push(item.containerNo);
|
}
|
}
|
});
|
// if (!hasQty) {
|
// this.$message({
|
// message: "明细列表的预出库数量必须大于0!",
|
// type: "warning"
|
// });
|
// return false;
|
// }
|
const outNumber = this.editor.formData["outNumber"];
|
const client_Id = this.masterData.client_Id;
|
const materialCount = this.editor.formData["materialCount"];
|
if (outNumber < 0) {
|
this.$message({
|
message: "出库套数不可小于0!",
|
type: "warning"
|
});
|
return false;
|
}
|
|
if (outNumber > materialCount - client_Id) {
|
this.$message({
|
message: "出库套数不可超过可出库套数!",
|
type: "warning"
|
});
|
return false;
|
}
|
const containerNo = Array.from(new Set(containerNos)).join(",");
|
this.editor.changeValue("containerNo", containerNo);
|
},
|
// 出库单批量前事件
|
beforeImportSubmit() {
|
if (!this.form.storage_Id) {
|
this.$message.error("请选择仓库!");
|
return false;
|
}
|
if (!this.form.consignor_Id) {
|
this.$message.error("请选择货主!");
|
return false;
|
}
|
const storageInfo = this.storageNames.find(item => item.storage_Id === this.form.storage_Id);
|
const consignorInfo = this.consignorNames.find(item => item.consignor_Id === this.form.consignor_Id);
|
|
// 自定义参数
|
this.orderImportConfig.params = {
|
storage_Id: this.form.storage_Id,
|
storageName: storageInfo.storageName,
|
consignor_Id: this.form.consignor_Id,
|
consignorName: consignorInfo.consignorName
|
};
|
},
|
// 表格下拉框字段改变事件
|
onRowChange(ref, val, field) {
|
// 货主和仓库改变
|
if (["consignorName", "storageName"].indexOf(field.options.prop) >= 0) {
|
window.setTimeout(() => {
|
this.getDefaultItems();
|
}, 200);
|
}
|
// 根据货主获得门店名称
|
if (["consignorName"].indexOf(field.options.prop) >= 0) {
|
window.setTimeout(() => {
|
this.getShortName();
|
}, 200);
|
}
|
},
|
// 获取一次性收费项默认值
|
getDefaultItems() {
|
const formData = this.editor.formData;
|
if (formData.feeItem_Ids && this.editorOptions.config.action !== "add") return; // 已经有值了不在设置默认值
|
|
const url = "/api/finance/baseOneCharge/getDefaultItems";
|
const params = {
|
associatedTasks: "出库单",
|
consignor_Id: formData.consignor_Id,
|
storage_Id: formData.storage_Id
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.$set(formData, "feeItem_Ids", res.data);
|
}
|
});
|
},
|
// 获取客户名称
|
getShortName() {
|
const formData = this.editor.formData;
|
const url = "/api/outbound/order/getShortName";
|
const params = {
|
consignorCode: formData.consignorCode
|
};
|
|
// this.common.ajax(url, params, res => {
|
// this.common.showMsg(res);
|
// if (res.result) {
|
// debugger;
|
// // 关闭弹出框
|
// this.isFeeTtemPopup = false;
|
// this.editor.reload();
|
// }
|
// });
|
|
var callback = res => {
|
if (res.result) {
|
var data = [];
|
// this.editor.setDropdownData(553, data);
|
// this.editor.changeValue("clientShortName", null);
|
// this.editor.changeValue("client_Id", null);
|
// this.editor.changeValue("clientCode", null);
|
if (res.result) {
|
res.data.forEach(item => {
|
const newItem = {
|
value: item.clientShortName,
|
label: item.clientShortName,
|
clientShortName: item.clientShortName,
|
client_Id: item.client_Id,
|
clientCode: item.clientCode
|
};
|
data.push(newItem);
|
});
|
this.editor.setDropdownData(553, data);
|
}
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
}
|
}
|
};
|
</script>
|