|
@@ -43,8 +43,9 @@
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="外协商名称" prop="supplierName">
|
|
|
- <el-input v-if="editStatus && form.isSubmit == 0 && hasReturnReceiptDetailFlag"
|
|
|
- v-model="form.supplierName" readonly placeholder="请输入外协商名称">
|
|
|
+ <el-input v-if="
|
|
|
+ editStatus && form.isSubmit == 0 && hasReturnReceiptDetailFlag
|
|
|
+ " v-model="form.supplierName" readonly placeholder="请输入外协商名称">
|
|
|
<template #append>
|
|
|
<el-button icon="Search" @click="handleShowDialogSuppliers" />
|
|
|
</template>
|
|
@@ -70,28 +71,33 @@
|
|
|
<el-form-item label="送货方式" prop="deliveryMethod">
|
|
|
<el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.deliveryMethod" placeholder="请选择"
|
|
|
@change="handleChangeDeliveryMethod">
|
|
|
- <el-option v-for=" dict in deliveryMethod " :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <el-option v-for="dict in deliveryMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
|
- <span v-else>{{ selectText(form.deliveryMethod, deliveryMethod) }}</span>
|
|
|
+ <span v-else>{{
|
|
|
+ selectText(form.deliveryMethod, deliveryMethod)
|
|
|
+ }}</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="带箱方式" prop="packagingMethod">
|
|
|
<el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.packagingMethod"
|
|
|
placeholder="请选择" @change="handleChangePackagingMethod">
|
|
|
- <el-option v-for=" dict in packagingMethod " :key="dict.value" :label="dict.label"
|
|
|
- :value="dict.value" />
|
|
|
+ <el-option v-for="dict in packagingMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
|
- <span v-else>{{ selectText(form.packagingMethod, packagingMethod) }}</span>
|
|
|
+ <span v-else>{{
|
|
|
+ selectText(form.packagingMethod, packagingMethod)
|
|
|
+ }}</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="结算方式" prop="settlementType">
|
|
|
<el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.settlementType"
|
|
|
placeholder="请选择">
|
|
|
- <el-option v-for=" dict in settlementType " :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <el-option v-for="dict in settlementType" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
|
- <span v-else>{{ selectText(form.settlementType, settlementType) }}</span>
|
|
|
+ <span v-else>{{
|
|
|
+ selectText(form.settlementType, settlementType)
|
|
|
+ }}</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
@@ -139,7 +145,11 @@
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" icon="Refresh" v-if="editStatus"
|
|
|
@click="handleChoiceFurnaceNoInfo(scope.row)">
|
|
|
- {{ scope.row.furnaceNoInfo != null ? scope.row.furnaceNoInfo.furnaceNumber : '选择炉号' }}
|
|
|
+ {{
|
|
|
+ scope.row.furnaceNoInfo != null
|
|
|
+ ? scope.row.furnaceNoInfo.furnaceNumber
|
|
|
+ : "选择炉号"
|
|
|
+ }}
|
|
|
</el-button>
|
|
|
<span v-else>{{ scope.row.furnaceNoInfo.furnaceNumber }}</span>
|
|
|
</template>
|
|
@@ -200,13 +210,13 @@ import {
|
|
|
printOutsource,
|
|
|
submitDetails,
|
|
|
submitDetailsOnFirst,
|
|
|
- getLotByProductionPlanSub
|
|
|
+ getLotByProductionPlanSub,
|
|
|
} from "@/api/business/outsourcedOrder";
|
|
|
import DialogFurnaceNoInfo from "./DialogFurnaceNoInfo";
|
|
|
import dialogSuppliers from "./DialogSuppliers";
|
|
|
import dialogProducts from "./DialogProducts";
|
|
|
import dialogProcesses from "./DialogProcesses";
|
|
|
-import dialogOutsourcedRecords from "./DialogOutsourcedRecords"
|
|
|
+import dialogOutsourcedRecords from "./DialogOutsourcedRecords";
|
|
|
// import FormDetailsRecycling from "./detailsRecyclingForm";
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
/** 父组件传参 */
|
|
@@ -244,10 +254,10 @@ const loadingCarrier = ref(false);
|
|
|
const carriers = ref([]);
|
|
|
const webHost = import.meta.env.VITE_APP_BASE_API;
|
|
|
const form = ref({});
|
|
|
-const selections = ref([])
|
|
|
+const selections = ref([]);
|
|
|
// const formatDetails = ref([])
|
|
|
const currentDetail = ref({});
|
|
|
-const dialogFurnaceNoInfoRef = ref(null)
|
|
|
+const dialogFurnaceNoInfoRef = ref(null);
|
|
|
const rules = {
|
|
|
supplierName: [
|
|
|
{ required: true, message: "外协商名称不能为空", trigger: "change" },
|
|
@@ -268,18 +278,18 @@ function handlePrint() {
|
|
|
/** 打开抽屉 */
|
|
|
function open(row) {
|
|
|
reset();
|
|
|
- totalCarriersNum.value = 0
|
|
|
+ totalCarriersNum.value = 0;
|
|
|
visible.value = true;
|
|
|
if (row) {
|
|
|
editStatus.value = true;
|
|
|
- hasReturnReceiptDetailFlag.value = true
|
|
|
- console.log(row)
|
|
|
- detailInfo.value = row
|
|
|
+ hasReturnReceiptDetailFlag.value = true;
|
|
|
+ console.log(row);
|
|
|
+ detailInfo.value = row;
|
|
|
form.value.id = row.id;
|
|
|
getForm();
|
|
|
} else {
|
|
|
editStatus.value = true;
|
|
|
- hasReturnReceiptDetailFlag.value = true
|
|
|
+ hasReturnReceiptDetailFlag.value = true;
|
|
|
}
|
|
|
}
|
|
|
/** 查询表单信息 */
|
|
@@ -289,56 +299,86 @@ function getForm() {
|
|
|
form.value = response.data;
|
|
|
//如果发出单明细里收回单,主表除了备注之外不能编辑
|
|
|
form.value.details.forEach((item) => {
|
|
|
- item.hasReturnReceiptDetailFlag = true
|
|
|
- if (item.returnReceiptDetailList && item.returnReceiptDetailList.length > 0) {
|
|
|
- hasReturnReceiptDetailFlag.value = false
|
|
|
+ item.hasReturnReceiptDetailFlag = true;
|
|
|
+ if (
|
|
|
+ item.returnReceiptDetailList &&
|
|
|
+ item.returnReceiptDetailList.length > 0
|
|
|
+ ) {
|
|
|
+ hasReturnReceiptDetailFlag.value = false;
|
|
|
}
|
|
|
- if (item.returnReceiptDetailList && item.returnReceiptDetailList.length > 0 && item.returnReceiptDetailList[0].status == 1) {
|
|
|
- item.hasReturnReceiptDetailFlag = false
|
|
|
+ if (
|
|
|
+ item.returnReceiptDetailList &&
|
|
|
+ item.returnReceiptDetailList.length > 0 &&
|
|
|
+ item.returnReceiptDetailList[0].status == 1
|
|
|
+ ) {
|
|
|
+ item.hasReturnReceiptDetailFlag = false;
|
|
|
}
|
|
|
});
|
|
|
form.value.details.forEach((item) => {
|
|
|
item.editStatus = false;
|
|
|
- totalCarriersNum.value += item.newCarrierCount == null ? 0 : item.newCarrierCount;
|
|
|
+ totalCarriersNum.value +=
|
|
|
+ item.newCarrierCount == null ? 0 : item.newCarrierCount;
|
|
|
});
|
|
|
|
|
|
editStatus.value = form.value.isSubmit == 1;
|
|
|
if (!detailInfo.value.flag) {
|
|
|
- editStatus.value = false
|
|
|
- console.log(editStatus.value)
|
|
|
+ editStatus.value = false;
|
|
|
+ console.log(editStatus.value);
|
|
|
}
|
|
|
- console.log(hasReturnReceiptDetailFlag.value)
|
|
|
+ console.log(hasReturnReceiptDetailFlag.value);
|
|
|
loading.value = false;
|
|
|
});
|
|
|
}
|
|
|
//改变带箱方式
|
|
|
function handleChangePackagingMethod() {
|
|
|
- totalCarriersNum.value = 0
|
|
|
+ totalCarriersNum.value = 0;
|
|
|
if (!editStatus) {
|
|
|
if (form.value.packagingMethod == 1 && form.value.details.length > 0) {
|
|
|
- form.value.details.forEach(item => { item.newCarriers = []; item.carrierIds = []; item.carriers = carriers.value })
|
|
|
- } if (form.value.packagingMethod == 0 && form.value.details.length > 0) {
|
|
|
- form.value.details.forEach(item => {
|
|
|
+ form.value.details.forEach((item) => {
|
|
|
+ item.newCarriers = [];
|
|
|
+ item.carrierIds = [];
|
|
|
+ item.carriers = carriers.value;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (form.value.packagingMethod == 0 && form.value.details.length > 0) {
|
|
|
+ form.value.details.forEach((item) => {
|
|
|
item.carriers = carriers.value;
|
|
|
item.newCarriers = [];
|
|
|
item.carrierIds = [];
|
|
|
- item.newCarriers.push(...item.originalCarrierList.map(v => ({ id: v.carrierId, code: v.carrierCode })));
|
|
|
- item.carriers.push(...item.originalCarrierList.map((v) => ({ value: v.carrierId, label: v.carrierCode })));
|
|
|
- item.carrierIds = item.originalCarrierList.map(info => { return info.carrierId })
|
|
|
- })
|
|
|
+ item.newCarriers.push(
|
|
|
+ ...item.originalCarrierList.map((v) => ({
|
|
|
+ id: v.carrierId,
|
|
|
+ code: v.carrierCode,
|
|
|
+ }))
|
|
|
+ );
|
|
|
+ item.carriers.push(
|
|
|
+ ...item.originalCarrierList.map((v) => ({
|
|
|
+ value: v.carrierId,
|
|
|
+ label: v.carrierCode,
|
|
|
+ }))
|
|
|
+ );
|
|
|
+ item.carrierIds = item.originalCarrierList.map((info) => {
|
|
|
+ return info.carrierId;
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
} else {
|
|
|
- form.value.details.forEach(item => {
|
|
|
- console.log(item.editStatus)
|
|
|
+ form.value.details.forEach((item) => {
|
|
|
+ console.log(item.editStatus);
|
|
|
if (item.editStatus) {
|
|
|
- item.newCarriers = []; item.carrierIds = []; item.carriers = carriers.value
|
|
|
+ item.newCarriers = [];
|
|
|
+ item.carrierIds = [];
|
|
|
+ item.carriers = carriers.value;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
- console.log(form.value.details)
|
|
|
+ console.log(form.value.details);
|
|
|
for (let i = 0; i < form.value.details.length; i++) {
|
|
|
- console.log(form.value.details)
|
|
|
- totalCarriersNum.value += form.value.details[i].newCarrierCount == null ? 0 : form.value.details[i].newCarrierCount
|
|
|
+ console.log(form.value.details);
|
|
|
+ totalCarriersNum.value +=
|
|
|
+ form.value.details[i].newCarrierCount == null
|
|
|
+ ? 0
|
|
|
+ : form.value.details[i].newCarrierCount;
|
|
|
}
|
|
|
}
|
|
|
//改变送货方式
|
|
@@ -348,7 +388,6 @@ function handleChangeDeliveryMethod() {
|
|
|
} else {
|
|
|
form.value.freightAmount = 0.0;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
//打开历史记录弹窗
|
|
|
function handleViewRecords() {
|
|
@@ -368,14 +407,17 @@ function cancel() {
|
|
|
}
|
|
|
|
|
|
const handleDelete = (index) => {
|
|
|
- totalCarriersNum.value -= (form.value.details[index].carrierNum == null ? 0 : form.value.details[index].carrierNum);
|
|
|
+ totalCarriersNum.value -=
|
|
|
+ form.value.details[index].carrierNum == null
|
|
|
+ ? 0
|
|
|
+ : form.value.details[index].carrierNum;
|
|
|
if (form.value.deliveryMethod == 1) {
|
|
|
form.value.freightAmount = form.value.freightPrice * totalCarriersNum.value;
|
|
|
} else {
|
|
|
form.value.freightAmount = 0.0;
|
|
|
}
|
|
|
- form.value.details.splice(index, 1)
|
|
|
- handleCarrierNumChange()
|
|
|
+ form.value.details.splice(index, 1);
|
|
|
+ handleCarrierNumChange();
|
|
|
};
|
|
|
|
|
|
/** 表单重置 */
|
|
@@ -395,7 +437,7 @@ function reset() {
|
|
|
remark: null,
|
|
|
details: [],
|
|
|
isSubmit: 0,
|
|
|
- isFirstProcess: 1
|
|
|
+ isFirstProcess: 1,
|
|
|
};
|
|
|
proxy.resetForm("formRef");
|
|
|
}
|
|
@@ -499,17 +541,19 @@ function handleSubmit() {
|
|
|
}
|
|
|
}
|
|
|
// 判断是否有批次没有炉号
|
|
|
- const unfurnace = form.value.details.find(v => v.furnaceNoInfo == null)
|
|
|
+ const unfurnace = form.value.details.find(
|
|
|
+ (v) => v.furnaceNoInfo == null
|
|
|
+ );
|
|
|
if (unfurnace != null) {
|
|
|
- proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号")
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号");
|
|
|
+ return;
|
|
|
}
|
|
|
if (totalCarriersNum.value == null || totalCarriersNum.value == 0) {
|
|
|
- proxy.$modal.msgError("请输入箱数")
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请输入箱数");
|
|
|
+ return;
|
|
|
}
|
|
|
if (valid) {
|
|
|
- console.log(form.value)
|
|
|
+ console.log(form.value);
|
|
|
submitDetailsOnFirst(form.value).then((response) => {
|
|
|
proxy.$modal.msgSuccess("提交成功");
|
|
|
visible.value = false;
|
|
@@ -517,7 +561,7 @@ function handleSubmit() {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- })
|
|
|
+ });
|
|
|
} else {
|
|
|
if (!form.value.details || form.value.details.length == 0) {
|
|
|
proxy.$modal.msgError("请添加产品明细");
|
|
@@ -532,17 +576,17 @@ function handleSubmit() {
|
|
|
}
|
|
|
}
|
|
|
// 判断是否有批次没有炉号
|
|
|
- const unfurnace = form.value.details.find(v => v.furnaceNoInfo == null)
|
|
|
+ const unfurnace = form.value.details.find((v) => v.furnaceNoInfo == null);
|
|
|
if (unfurnace != null) {
|
|
|
- proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号")
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号");
|
|
|
+ return;
|
|
|
}
|
|
|
if (totalCarriersNum.value == null || totalCarriersNum.value == 0) {
|
|
|
- proxy.$modal.msgError("请输入箱数")
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请输入箱数");
|
|
|
+ return;
|
|
|
}
|
|
|
if (valid) {
|
|
|
- console.log(form.value)
|
|
|
+ console.log(form.value);
|
|
|
submitDetailsOnFirst(form.value).then((response) => {
|
|
|
proxy.$modal.msgSuccess("提交成功");
|
|
|
visible.value = false;
|
|
@@ -564,7 +608,8 @@ const handleSingleSelectedSupplier = (data) => {
|
|
|
form.value.supplierId = data.id;
|
|
|
form.value.lossLimit = data.lossLimit;
|
|
|
form.value.supplierName = data.name;
|
|
|
- form.value.supplierCode = data.code
|
|
|
+ // form.value.supplierCode = data.code
|
|
|
+ form.value.supplierCode = data.mnemonicCode;
|
|
|
form.value.deliveryMethod = data.deliveryMethod;
|
|
|
form.value.freightPrice = data.freightPrice;
|
|
|
form.value.settlementType = data.settlementType;
|
|
@@ -594,15 +639,20 @@ const handleMultipleSelectedProducts = (selection) => {
|
|
|
planDetails: selection,
|
|
|
supplierId: form.value.supplierId,
|
|
|
supplierName: form.value.supplierName,
|
|
|
- masterId: form.value.id
|
|
|
- }
|
|
|
- getLotByProductionPlanSub(requestData).then(res => {
|
|
|
+ masterId: form.value.id,
|
|
|
+ };
|
|
|
+ getLotByProductionPlanSub(requestData).then((res) => {
|
|
|
// console.log(res)
|
|
|
if (res.code === 200) {
|
|
|
- form.value.details.push(...res.data.filter(e => form.value.details.findIndex(t => t.lotId === e.lotId) < 0).map(e => ({ ...e, hasReturnReceiptDetailFlag: true })))
|
|
|
+ form.value.details.push(
|
|
|
+ ...res.data
|
|
|
+ .filter(
|
|
|
+ (e) => form.value.details.findIndex((t) => t.lotId === e.lotId) < 0
|
|
|
+ )
|
|
|
+ .map((e) => ({ ...e, hasReturnReceiptDetailFlag: true }))
|
|
|
+ );
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/***************************** 外协工序对话框相关 *****************************/
|
|
@@ -614,18 +664,25 @@ const handleShowDialogProcesses = (row) => {
|
|
|
|
|
|
// 工序选择带回
|
|
|
const handleMultipleSelectedProcesses = (selection) => {
|
|
|
- const oldProcesses = currentDetail.value.processes == null ? [] : [...currentDetail.value.processes]
|
|
|
+ const oldProcesses =
|
|
|
+ currentDetail.value.processes == null
|
|
|
+ ? []
|
|
|
+ : [...currentDetail.value.processes];
|
|
|
if (
|
|
|
currentDetail.value.returnReceiptDetailList &&
|
|
|
currentDetail.value.returnReceiptDetailList.length > 0 &&
|
|
|
- selection.findIndex(e => !oldProcesses.some(v => v.technologicalProcessDetailId == e.id)) >= 0
|
|
|
+ selection.findIndex(
|
|
|
+ (e) => !oldProcesses.some((v) => v.technologicalProcessDetailId == e.id)
|
|
|
+ ) >= 0
|
|
|
) {
|
|
|
- proxy.$modal.msgError('已收回批次不能添加新工序')
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("已收回批次不能添加新工序");
|
|
|
+ return;
|
|
|
}
|
|
|
- currentDetail.value.processes = []
|
|
|
+ currentDetail.value.processes = [];
|
|
|
console.log(selection);
|
|
|
- const processNames = selection.sort((a, b) => a.processStepNumber - b.processStepNumber).map((item) => item.processAlias);
|
|
|
+ const processNames = selection
|
|
|
+ .sort((a, b) => a.processStepNumber - b.processStepNumber)
|
|
|
+ .map((item) => item.processAlias);
|
|
|
// 使用join方法将数组转换为以逗号分隔的字符串
|
|
|
let commaSeparatedString = processNames.join(",");
|
|
|
currentDetail.value.processes = [];
|
|
@@ -643,41 +700,44 @@ const handleMultipleSelectedProcesses = (selection) => {
|
|
|
};
|
|
|
|
|
|
function handleSelectionChange(selection) {
|
|
|
- selections.value = selection
|
|
|
+ selections.value = selection;
|
|
|
}
|
|
|
|
|
|
// 选择炉号
|
|
|
const handleChoiceFurnaceNoInfo = (row) => {
|
|
|
// 判断选择的产品是不是同一个
|
|
|
const changeFurnaceNoInfo = row ? [row] : selections.value;
|
|
|
- let checkSame = true
|
|
|
- changeFurnaceNoInfo.forEach(l => {
|
|
|
- checkSame = checkSame && l.productId == changeFurnaceNoInfo[0].productId
|
|
|
- })
|
|
|
- console.log(checkSame)
|
|
|
+ let checkSame = true;
|
|
|
+ changeFurnaceNoInfo.forEach((l) => {
|
|
|
+ checkSame = checkSame && l.productId == changeFurnaceNoInfo[0].productId;
|
|
|
+ });
|
|
|
+ console.log(checkSame);
|
|
|
if (!checkSame) {
|
|
|
- proxy.$modal.msgError('请选择相同计划单批量选择炉号')
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请选择相同计划单批量选择炉号");
|
|
|
+ return;
|
|
|
}
|
|
|
if (changeFurnaceNoInfo.length === 0) {
|
|
|
- proxy.$modal.msgError('请选择需要变更炉号的计划单')
|
|
|
- return
|
|
|
+ proxy.$modal.msgError("请选择需要变更炉号的计划单");
|
|
|
+ return;
|
|
|
}
|
|
|
- dialogFurnaceNoInfoRef.value.open({ details: changeFurnaceNoInfo, queryParams: { ...changeFurnaceNoInfo[0] } })
|
|
|
-}
|
|
|
+ dialogFurnaceNoInfoRef.value.open({
|
|
|
+ details: changeFurnaceNoInfo,
|
|
|
+ queryParams: { ...changeFurnaceNoInfo[0] },
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
const handleSingleSelectFurnaceNoInfo = (details, info) => {
|
|
|
- details.forEach(l => {
|
|
|
- l.furnaceNoInfo = info
|
|
|
- })
|
|
|
-}
|
|
|
+ details.forEach((l) => {
|
|
|
+ l.furnaceNoInfo = info;
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
function handleCarrierNumChange() {
|
|
|
- let sumNum = 0
|
|
|
- form.value.details.forEach(v => {
|
|
|
- sumNum += (v.newCarrierCount == null ? 0 : v.newCarrierCount)
|
|
|
- })
|
|
|
- totalCarriersNum.value = sumNum
|
|
|
+ let sumNum = 0;
|
|
|
+ form.value.details.forEach((v) => {
|
|
|
+ sumNum += v.newCarrierCount == null ? 0 : v.newCarrierCount;
|
|
|
+ });
|
|
|
+ totalCarriersNum.value = sumNum;
|
|
|
}
|
|
|
|
|
|
/** 暴露给父组件的方法 */
|