|
@@ -86,9 +86,12 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="合同明细" prop="contractProductData">
|
|
|
- <el-table :data="contractProductData" @select="handleSelectProduct">
|
|
|
+ <el-table
|
|
|
+ :data="formData.data.contractProductData"
|
|
|
+ @select="handleSelectProduct"
|
|
|
+ >
|
|
|
<el-table-column type="selection" label="" width="50" />
|
|
|
- <el-table-column prop="code" label="合同编码" />
|
|
|
+ <el-table-column prop="contractCode" label="合同编码" />
|
|
|
<el-table-column prop="productName" label="产品名称" />
|
|
|
<el-table-column prop="cpQuantity" label="合同数量" />
|
|
|
<el-table-column prop="waitQuantity" label="待装箱数量" />
|
|
@@ -96,7 +99,6 @@
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
:prop="'contractProductData.' + $index + '.quantity'"
|
|
|
- :rules="rules.quantity"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
@@ -118,30 +120,47 @@
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="装箱明细">
|
|
|
- <div class="box">
|
|
|
+ <el-form-item label="装箱明细" prop="packDetailList">
|
|
|
+ <div
|
|
|
+ class="box"
|
|
|
+ v-for="(item, index) in formData.data.packDetailList"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
<div ref="">箱规</div>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="5">
|
|
|
- <el-form-item label="箱数" prop="supplyId">
|
|
|
+ <el-form-item
|
|
|
+ label="箱数"
|
|
|
+ :prop="'packDetailList.' + index + '.packQuantity'"
|
|
|
+ :rules="rules.packQuantity"
|
|
|
+ >
|
|
|
<el-input
|
|
|
- v-model="formData.data.a"
|
|
|
+ v-model="item.packQuantity"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="5">
|
|
|
- <el-form-item label="净重(kg)" prop="supplyId">
|
|
|
+ <el-form-item
|
|
|
+ label="净重(kg)"
|
|
|
+ :prop="'packDetailList.' + index + '.netWeight'"
|
|
|
+ :rules="rules.netWeight"
|
|
|
+ >
|
|
|
<el-input
|
|
|
- v-model="formData.data.a"
|
|
|
+ v-model="item.netWeight"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+
|
|
|
<el-col :span="5">
|
|
|
- <el-form-item label="毛重(kg)" prop="supplyId">
|
|
|
+ <el-form-item
|
|
|
+ label="毛重(kg)"
|
|
|
+ :prop="'packDetailList.' + index + '.roughWeight'"
|
|
|
+ :rules="rules.roughWeight"
|
|
|
+ >
|
|
|
<el-input
|
|
|
- v-model="formData.data.a"
|
|
|
+ v-model="item.roughWeight"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -151,24 +170,42 @@
|
|
|
<el-form-item label="尺寸(cm³)" required>
|
|
|
<el-col :span="1"></el-col>
|
|
|
<el-col :span="7">
|
|
|
- <el-input
|
|
|
- v-model="formData.data.a"
|
|
|
- placeholder="长"
|
|
|
- ></el-input>
|
|
|
+ <el-form-item
|
|
|
+ label=""
|
|
|
+ :prop="'packDetailList.' + index + '.boxLong'"
|
|
|
+ :rules="rules.boxLong"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="item.boxLong"
|
|
|
+ placeholder="长"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1" style="text-align: center"> * </el-col>
|
|
|
<el-col :span="7">
|
|
|
- <el-input
|
|
|
- v-model="formData.data.a"
|
|
|
- placeholder="宽"
|
|
|
- ></el-input>
|
|
|
+ <el-form-item
|
|
|
+ label=""
|
|
|
+ :prop="'packDetailList.' + index + '.boxWide'"
|
|
|
+ :rules="rules.boxWide"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="item.boxWide"
|
|
|
+ placeholder="宽"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1" style="text-align: center"> * </el-col>
|
|
|
<el-col :span="7">
|
|
|
- <el-input
|
|
|
- v-model="formData.data.a"
|
|
|
- placeholder="高"
|
|
|
- ></el-input>
|
|
|
+ <el-form-item
|
|
|
+ label=""
|
|
|
+ :prop="'packDetailList.' + index + '.boxHigh'"
|
|
|
+ :rules="rules.boxHigh"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="item.boxHigh"
|
|
|
+ placeholder="高"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
</el-row>
|
|
@@ -177,46 +214,74 @@
|
|
|
<div class="line"></div>
|
|
|
<el-form-item label="关联合同产品">
|
|
|
<div class="flex-box">
|
|
|
- <div class="item">
|
|
|
- <div>合同编码:PO-2301-001</div>
|
|
|
- <div>产品名称:PO-2301-001</div>
|
|
|
- <div>每箱数量:PO-2301-001</div>
|
|
|
+ <div
|
|
|
+ class="item"
|
|
|
+ v-for="(product, j) in item.packDetailProductList"
|
|
|
+ :key="j"
|
|
|
+ >
|
|
|
+ <div>合同编码:{{ product.code }}</div>
|
|
|
+ <div>产品名称:{{ product.name }}</div>
|
|
|
+ <div>每箱数量:{{ product.quantity }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <div class="bottom-arrow" v-show="fade">
|
|
|
+ <div
|
|
|
+ class="bottom-arrow"
|
|
|
+ v-show="!item.isShow"
|
|
|
+ @click="item.isShow = !item.isShow"
|
|
|
+ >
|
|
|
<span style="margin-right: 5px"> 自定义装箱明细</span>
|
|
|
<el-icon><ArrowDownBold /></el-icon>
|
|
|
</div>
|
|
|
- <div class="bottom-arrow" v-show="true">
|
|
|
+ <div
|
|
|
+ class="bottom-arrow"
|
|
|
+ v-show="item.isShow"
|
|
|
+ @click="item.isShow = !item.isShow"
|
|
|
+ >
|
|
|
<span style="margin-right: 5px"> 收起</span>
|
|
|
<el-icon><ArrowUpBold /></el-icon>
|
|
|
</div>
|
|
|
- <el-form-item prop="自定义装箱">
|
|
|
- <el-button type="primary" style="margin-bottom: 10px">
|
|
|
+ <el-form-item prop="packDetailGoodsList" v-show="item.isShow">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ style="margin-bottom: 10px"
|
|
|
+ @click="handleCustomPush(index)"
|
|
|
+ >
|
|
|
添加行
|
|
|
</el-button>
|
|
|
- <el-table :data="formData.data.purchaseDetailList">
|
|
|
- <el-table-column prop="count" label="货物描述">
|
|
|
+ <el-table :data="item.packDetailGoodsList">
|
|
|
+ <el-table-column label="货物描述">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'purchaseDetailList.' + $index + '.count'"
|
|
|
- :rules="rules.count"
|
|
|
+ :prop="[
|
|
|
+ 'packDetailList',
|
|
|
+ index,
|
|
|
+ 'packDetailGoodsList',
|
|
|
+ $index,
|
|
|
+ 'remark',
|
|
|
+ ]"
|
|
|
+ :rules="rules.remark"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
- <el-input v-model="row.count" placeholder="请输入" />
|
|
|
+ <el-input v-model="row.remark" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="count" label="单位" width="150">
|
|
|
+ <el-table-column label="单位" width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'purchaseDetailList.' + $index + '.count'"
|
|
|
- :rules="rules.count"
|
|
|
+ :prop="[
|
|
|
+ 'packDetailList',
|
|
|
+ index,
|
|
|
+ 'packDetailGoodsList',
|
|
|
+ $index,
|
|
|
+ 'unit',
|
|
|
+ ]"
|
|
|
+ :rules="rules.unit"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- v-model="row.count"
|
|
|
+ v-model="row.unit"
|
|
|
:precision="4"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
@@ -224,15 +289,21 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="count" label="数量" width="150">
|
|
|
+ <el-table-column label="数量" width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'purchaseDetailList.' + $index + '.count'"
|
|
|
- :rules="rules.count"
|
|
|
+ :prop="[
|
|
|
+ 'packDetailList',
|
|
|
+ index,
|
|
|
+ 'packDetailGoodsList',
|
|
|
+ $index,
|
|
|
+ 'quantity',
|
|
|
+ ]"
|
|
|
+ :rules="rules.quantityOne"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- v-model="row.count"
|
|
|
+ v-model="row.quantity"
|
|
|
:precision="4"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
@@ -242,7 +313,10 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="zip" label="操作" width="100">
|
|
|
<template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleRemove($index)"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ @click="handleCustomRemove(index, $index)"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
@@ -256,7 +330,7 @@
|
|
|
<el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- @click="submitForm('byform')"
|
|
|
+ @click="submitForm()"
|
|
|
size="large"
|
|
|
:loading="submitLoading"
|
|
|
>
|
|
@@ -294,7 +368,16 @@ let dialogVisible = ref(false);
|
|
|
let modalType = ref("add");
|
|
|
let fileList = ref([]);
|
|
|
let rules = ref({
|
|
|
+ packQuantity: [{ required: true, message: "请输入箱数", trigger: "blur" }],
|
|
|
+ netWeight: [{ required: true, message: "请输入净重", trigger: "blur" }],
|
|
|
+ roughWeight: [{ required: true, message: "请输入毛重", trigger: "blur" }],
|
|
|
+ boxLong: [{ required: true, message: "请输入长", trigger: "blur" }],
|
|
|
+ boxWide: [{ required: true, message: "请输入宽", trigger: "blur" }],
|
|
|
+ boxHigh: [{ required: true, message: "请输入高", trigger: "blur" }],
|
|
|
quantity: [{ required: true, message: "请输入装箱数量", trigger: "blur" }],
|
|
|
+ quantityOne: [{ required: true, message: "请输入数量", trigger: "blur" }],
|
|
|
+ unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
|
|
|
+ remark: [{ required: true, message: "请输入货物描述", trigger: "blur" }],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const selectConfig = reactive([
|
|
@@ -448,7 +531,7 @@ const config = computed(() => {
|
|
|
},
|
|
|
];
|
|
|
});
|
|
|
-
|
|
|
+const formDom = ref(null);
|
|
|
let formData = reactive({
|
|
|
data: {},
|
|
|
});
|
|
@@ -472,31 +555,37 @@ const getList = async (req) => {
|
|
|
};
|
|
|
|
|
|
const openModal = () => {
|
|
|
- formData.data = {};
|
|
|
+ formData.data = {
|
|
|
+ packDetailList: [],
|
|
|
+ };
|
|
|
dialogVisible.value = true;
|
|
|
- handleChangeCustomer("");
|
|
|
+ // handleChangeCustomer("");
|
|
|
};
|
|
|
|
|
|
const submitForm = () => {
|
|
|
- byform.value.handleSubmit((valid) => {
|
|
|
- formData.data.fileList = fileList.value;
|
|
|
- submitLoading.value = true;
|
|
|
- proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
|
|
|
- (res) => {
|
|
|
- ElMessage({
|
|
|
- message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- fileList.value = [];
|
|
|
- dialogVisible.value = false;
|
|
|
- submitLoading.value = false;
|
|
|
- getList();
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log(err, "aswwwww");
|
|
|
- submitLoading.value = false;
|
|
|
- }
|
|
|
- );
|
|
|
+ console.log(formData.data, "qwdads");
|
|
|
+
|
|
|
+ formDom.value.validate((vaild) => {
|
|
|
+ if (vaild) {
|
|
|
+ console.log(formData.data, "qwdads");
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ fileList.value = [];
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err, "aswwwww");
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -510,12 +599,26 @@ const handleSelectProduct = (data) => {
|
|
|
};
|
|
|
const handleClickPacking = () => {
|
|
|
if (selectProductData.value.length > 0) {
|
|
|
- const packDetailProductList = selectProductData.value.map((x) => ({
|
|
|
- contractId: "",
|
|
|
- contractProductId: "",
|
|
|
- quantity: "",
|
|
|
+ const list = selectProductData.value;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ if (!e.quantity) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "请输入装箱数量",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const packDetailProductList = list.map((x) => ({
|
|
|
+ contractId: x.id,
|
|
|
+ contractProductId: x.contractProductId,
|
|
|
+ quantity: x.quantity,
|
|
|
+ productId: x.contractProductId,
|
|
|
+ productName: "",
|
|
|
+ productModel: "",
|
|
|
+ remark: "",
|
|
|
}));
|
|
|
- this.formData.packDetailList.push({
|
|
|
+ formData.data.packDetailList.push({
|
|
|
customerId: "",
|
|
|
contractIds: "",
|
|
|
packQuantity: "",
|
|
@@ -527,8 +630,10 @@ const handleClickPacking = () => {
|
|
|
bomVolume: "",
|
|
|
remark: "",
|
|
|
packDetailGoodsList: [],
|
|
|
- packDetailProductList: [],
|
|
|
+ packDetailProductList: packDetailProductList,
|
|
|
+ isShow: false,
|
|
|
});
|
|
|
+ console.log(formData.data.packDetailList, "qsda");
|
|
|
} else {
|
|
|
return ElMessage({
|
|
|
message: "请选择产品 !",
|
|
@@ -536,6 +641,18 @@ const handleClickPacking = () => {
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+const handleCustomPush = (index) => {
|
|
|
+ formData.data.packDetailList[index].packDetailGoodsList.push({
|
|
|
+ unit: "",
|
|
|
+ quantity: "",
|
|
|
+ remark: "",
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleCustomRemove = (index, sonIndex) => {
|
|
|
+ formData.data.packDetailList[index].packDetailGoodsList.splice(sonIndex, 1);
|
|
|
+};
|
|
|
const customerList = ref([]);
|
|
|
const getSelectData = () => {
|
|
|
proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
@@ -557,14 +674,13 @@ const handleChangeCustomer = (val) => {
|
|
|
formData.data.contractIds = "";
|
|
|
});
|
|
|
};
|
|
|
-const contractProductData = ref([]);
|
|
|
const handleChangeContract = (val) => {
|
|
|
proxy
|
|
|
.get(
|
|
|
- `/contract/getNoPackContractProductById?customerId=${formData.data.customerId}&contractId=${val}`
|
|
|
+ `/contractProduct/getNoPackContractProductById?customerId=${formData.data.customerId}&contractIds=${val}`
|
|
|
)
|
|
|
.then((res) => {
|
|
|
- contractProductData.value = res.data.map((x) => ({
|
|
|
+ formData.data.contractProductData = res.data.map((x) => ({
|
|
|
...x,
|
|
|
waitQuantity: Number(x.cpQuantity) - Number(x.sumPackQuantity),
|
|
|
}));
|
|
@@ -591,6 +707,7 @@ getList();
|
|
|
padding: 15px;
|
|
|
background: #fde6c8;
|
|
|
border: 1px solid #7fb5e3;
|
|
|
+ margin-bottom: 10px;
|
|
|
.flex-box {
|
|
|
width: 100%;
|
|
|
display: flex;
|