|
@@ -84,7 +84,7 @@
|
|
|
</template>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
- <el-dialog title="产品装箱" v-model="dtlModalType" width="80%" v-loading="loading" @close="dtlModalClose">
|
|
|
+ <el-dialog title="产品装箱" v-model="dtlModalType" width="80%" v-loading="loading">
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="8">
|
|
|
<div class="common-title">箱规</div>
|
|
@@ -169,9 +169,33 @@
|
|
|
<!-- 添加行 -->
|
|
|
<div class="add-box" style="margin-bottom: 20px;">
|
|
|
<el-button type="primary" @click="packDetailProductListPush(boxIndex)"> 添加行 </el-button>
|
|
|
- <el-button type="primary" @click="packDetailProductListPush(boxIndex)"> 自定义装箱 </el-button>
|
|
|
+ <el-button type="primary" @click="openCustom('2')" v-if='encasementType == "1"'> 自定义装箱 </el-button>
|
|
|
+ <el-button type="primary" @click="openCustom('1')" v-if='encasementType == "2"'> 标准装箱 </el-button>
|
|
|
</div>
|
|
|
- <el-table :data="boxFormData.packDetailProductList" @select="handleSelectProduct" @select-all="handleSelectProduct" ref="tableDom">
|
|
|
+ <el-table :data="boxFormData.packDetailGoodsList" ref="tableDom2" v-if='encasementType == "2"'>
|
|
|
+ <el-table-column prop="remark" label="货品描述" min-width="180">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item prop="remark" :inline-message="true">
|
|
|
+ <el-input v-model="boxFormData.packDetailGoodsList[$index].remark" onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="unit" label="单位" min-width="180">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item prop="unit" :inline-message="true">
|
|
|
+ <el-input v-model="boxFormData.packDetailGoodsList[$index].unit" onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="quantity" label="入箱数" min-width="180">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item prop="quantity" :inline-message="true">
|
|
|
+ <el-input-number v-model="boxFormData.packDetailGoodsList[$index].quantity" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-table v-else :data="boxFormData.packDetailProductList" @select="handleSelectProduct" @select-all="handleSelectProduct" ref="tableDom">
|
|
|
<el-table-column prop="productName" label="产品名称" min-width="180">
|
|
|
<template #default="{ row, $index }">
|
|
|
<!-- 选择产品 -->
|
|
@@ -190,10 +214,10 @@
|
|
|
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="productSpec" label="规格型号" min-width="140" />
|
|
|
- <el-table-column prop="cpQuantity" label="合同数量" width="140" />
|
|
|
- <el-table-column prop="waitQuantity" label="待装箱数量" width="140" />
|
|
|
- <el-table-column prop="quantity" label="装箱数量" width="160">
|
|
|
+ <el-table-column prop="productSpec" label="规格型号" min-width="100" />
|
|
|
+ <el-table-column prop="cpQuantity" label="合同数量" width="100" />
|
|
|
+ <el-table-column prop="waitQuantity" label="待装箱数量" width="100" />
|
|
|
+ <el-table-column prop="quantity" label="装箱数量" width="100">
|
|
|
<template #default="{ row, $index }">
|
|
|
|
|
|
<el-form-item prop="quantity" :inline-message="true">
|
|
@@ -201,6 +225,12 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <!-- 删除按钮 -->
|
|
|
+ <el-table-column prop="quantity" label="操作" width="100">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button type="danger" @click="boxFormData.packDetailProductList.splice($index,1)"> 删除 </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -235,151 +265,6 @@
|
|
|
<i class="iconfont icon-iconm_tianjia1" @click="openDtlModal"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-form-item label="合同明细" prop="contractProductData">
|
|
|
- <el-table :data="formData.data.contractProductData" @select="handleSelectProduct" @select-all="handleSelectProduct" ref="tableDom">
|
|
|
- <el-table-column type="selection" label="" width="50" />
|
|
|
- <el-table-column prop="contractCode" label="合同编码" width="160" />
|
|
|
- <el-table-column prop="productName" label="产品名称" min-width="180" />
|
|
|
- <el-table-column prop="productSpec" label="规格型号" min-width="140" />
|
|
|
- <el-table-column prop="cpQuantity" label="合同数量" width="140" />
|
|
|
- <el-table-column prop="waitQuantity" label="待装箱数量" width="140" />
|
|
|
- <el-table-column prop="quantity" label="装箱数量" width="160">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="'contractProductData.' + $index + '.quantity'" :inline-message="true">
|
|
|
- <el-input-number v-model="row.quantity" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-button type="primary" style="margin-top: 10px; width: 100%" @click="handleClickPacking"> 装箱 </el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="装箱明细" prop="packDetailList">
|
|
|
- <div class="box" v-for="(item, index) in formData.data.packDetailList" :key="index">
|
|
|
- <div ref="" style="position: relative">
|
|
|
- <span>箱规</span>
|
|
|
- <el-button type="primary" style="position: absolute; right: 0px; top: 0px" @click="clickDelete(index)" text>删除</el-button>
|
|
|
- </div>
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item label="箱数" :prop="'packDetailList.' + index + '.packQuantity'" :rules="rules.packQuantity">
|
|
|
- <el-input-number
|
|
|
- v-model="item.packQuantity"
|
|
|
- :precision="0"
|
|
|
- :controls="false"
|
|
|
- :min="1"
|
|
|
- placeholder="请输入"
|
|
|
- onmousewheel="return false;"
|
|
|
- @change="(val) => handleChangePackQuantity(val, index)" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item label="净重(kg)" :prop="'packDetailList.' + index + '.netWeight'" :rules="rules.netWeight">
|
|
|
- <el-input-number v-model="item.netWeight" :precision="2" :controls="false" :min="0" placeholder="请输入" onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col :span="5">
|
|
|
- <el-form-item label="毛重(kg)" :prop="'packDetailList.' + index + '.roughWeight'" :rules="rules.roughWeight">
|
|
|
- <el-input-number v-model="item.roughWeight" :precision="2" :controls="false" :min="0" placeholder="请输入" onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="9">
|
|
|
- <el-row>
|
|
|
- <el-form-item label="尺寸(cm³)" required>
|
|
|
- <el-col :span="1"></el-col>
|
|
|
- <el-col :span="7">
|
|
|
- <el-form-item label="" :prop="'packDetailList.' + index + '.boxLong'" :rules="rules.boxLong">
|
|
|
- <el-input-number
|
|
|
- v-model="item.boxLong"
|
|
|
- placeholder="长"
|
|
|
- :precision="2"
|
|
|
- :controls="false"
|
|
|
- :min="0"
|
|
|
- onmousewheel="return false;"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1" style="text-align: center"> * </el-col>
|
|
|
- <el-col :span="7">
|
|
|
- <el-form-item label="" :prop="'packDetailList.' + index + '.boxWide'" :rules="rules.boxWide">
|
|
|
- <el-input-number
|
|
|
- v-model="item.boxWide"
|
|
|
- placeholder="宽"
|
|
|
- :precision="2"
|
|
|
- :controls="false"
|
|
|
- :min="0"
|
|
|
- onmousewheel="return false;"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1" style="text-align: center"> * </el-col>
|
|
|
- <el-col :span="7">
|
|
|
- <el-form-item label="" :prop="'packDetailList.' + index + '.boxHigh'" :rules="rules.boxHigh">
|
|
|
- <el-input-number
|
|
|
- v-model="item.boxHigh"
|
|
|
- placeholder="高"
|
|
|
- :precision="2"
|
|
|
- :controls="false"
|
|
|
- :min="0"
|
|
|
- onmousewheel="return false;"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form-item>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <div class="line"></div>
|
|
|
- <el-form-item label="关联合同产品">
|
|
|
- <div class="flex-box">
|
|
|
- <div class="item" v-for="(product, j) in item.packDetailProductList" :key="j">
|
|
|
- <div>合同编码:{{ product.contractCode }}</div>
|
|
|
- <div>产品名称:{{ product.productName }}</div>
|
|
|
- <div>每箱数量:{{ product.quantity }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
- <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="item.isShow" @click="item.isShow = !item.isShow">
|
|
|
- <span style="margin-right: 5px"> 收起</span>
|
|
|
- <el-icon><ArrowUpBold /></el-icon>
|
|
|
- </div>
|
|
|
- <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="item.packDetailGoodsList">
|
|
|
- <el-table-column label="货物描述">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="['packDetailList', index, 'packDetailGoodsList', $index, 'remark']" :rules="rules.remark" :inline-message="true">
|
|
|
- <el-input v-model="row.remark" placeholder="请输入" />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="单位" width="150">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="['packDetailList', index, 'packDetailGoodsList', $index, 'unit']" :rules="rules.unit" :inline-message="true">
|
|
|
- <el-input v-model="row.unit" placeholder="请输入" />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="数量" width="150">
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item
|
|
|
- :prop="['packDetailList', index, 'packDetailGoodsList', $index, 'quantity']"
|
|
|
- :rules="rules.quantityOne"
|
|
|
- :inline-message="true">
|
|
|
- <el-input-number v-model="row.quantity" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="zip" label="操作" width="100">
|
|
|
- <template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleCustomRemove(index, $index)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<el-button @click="handleClose" size="large">取 消</el-button>
|
|
@@ -421,7 +306,17 @@ const sourceList = ref({
|
|
|
});
|
|
|
|
|
|
const openDtlUpdata = (index) => {
|
|
|
+ boxFormType = 'updata'
|
|
|
boxIndex.value = index;
|
|
|
+ boxFormData.value = {...formData.data.packDetailList[index]}
|
|
|
+ formData.data.contractProductData.forEach((item) => {
|
|
|
+ item.disabled = false
|
|
|
+ boxFormData.value.packDetailProductList.forEach((item1) => {
|
|
|
+ if(item.mathId == item1.mathId){
|
|
|
+ item.disabled = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
dtlModalType.value = true;
|
|
|
};
|
|
|
|
|
@@ -439,7 +334,36 @@ let boxFormData = ref({
|
|
|
id: Math.random().toString(36).substr(2),
|
|
|
});
|
|
|
|
|
|
+const openCustom = (type) => {
|
|
|
+ if(type == '2' && boxFormData.value.packDetailGoodsList.length == 0) {
|
|
|
+ for (let i = 0; i < boxFormData.value.packDetailProductList.length; i++) {
|
|
|
+ const item = boxFormData.value.packDetailProductList[i];
|
|
|
+ if (item.quantity == null) {
|
|
|
+ ElMessage.error("请填写装箱数量");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (item.productId == null) {
|
|
|
+ ElMessage.error("请填写选择产品");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boxFormData.value.packDetailGoodsList = boxFormData.value.packDetailProductList.map(item => {
|
|
|
+ return {
|
|
|
+ remark:item.productName,
|
|
|
+ unit:null,
|
|
|
+ quantity:item.quantity
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ encasementType.value = type
|
|
|
+}
|
|
|
+
|
|
|
const openDtlModal = () => {
|
|
|
+ console.log(formData.data.contractProductData)
|
|
|
+ if(!formData.data.contractProductData || formData.data.contractProductData.length == 0) {
|
|
|
+ ElMessage.error("请先选择合同");
|
|
|
+ return;
|
|
|
+ }
|
|
|
boxFormData.value = {
|
|
|
packQuantity: null,
|
|
|
netWeight: null,
|
|
@@ -453,33 +377,46 @@ const openDtlModal = () => {
|
|
|
//生成唯一id
|
|
|
id: Math.random().toString(36).substr(2),
|
|
|
};
|
|
|
- boxIndex.value = formData.data.packDetailList.length - 1;
|
|
|
+ boxFormType = 'add'
|
|
|
+ boxIndex.value = formData.data.packDetailList.length;
|
|
|
+ formData.data.contractProductData.forEach((item) => {
|
|
|
+ item.disabled = false
|
|
|
+ boxFormData.value.packDetailProductList.forEach((item1) => {
|
|
|
+ if(item.mathId == item1.mathId){
|
|
|
+ item.disabled = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
dtlModalType.value = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
-const dtlModalClose = () => {
|
|
|
- dtlModalType.value = false;
|
|
|
- //如果关闭删除本条数据
|
|
|
- formData.data.packDetailList.splice(boxIndex.value, 1);
|
|
|
- boxIndex.value = 0
|
|
|
- console.log(formData.data.packDetailList)
|
|
|
-};
|
|
|
|
|
|
const boxIndex = ref(0);
|
|
|
|
|
|
const packDetailProductListPush = (index) => {
|
|
|
- boxFormData.value.packDetailProductList.push({
|
|
|
- contractId: null,
|
|
|
- productName: null,
|
|
|
- contractProductId: null,
|
|
|
- quantity: null,
|
|
|
- productId: null,
|
|
|
- productModel: null,
|
|
|
- remark:null,
|
|
|
- });
|
|
|
+ if(encasementType.value == '1') {
|
|
|
+ boxFormData.value.packDetailGoodsList.push({
|
|
|
+ remark:null,
|
|
|
+ unit:null,
|
|
|
+ quantity:null,
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ boxFormData.value.packDetailProductList.push({
|
|
|
+ contractId: null,
|
|
|
+ productName: null,
|
|
|
+ contractProductId: null,
|
|
|
+ quantity: null,
|
|
|
+ productId: null,
|
|
|
+ productModel: null,
|
|
|
+ remark:null,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
+let boxFormType = 'add'
|
|
|
+
|
|
|
const submitBox = () => {
|
|
|
formDom.value.validate((vaild) => {
|
|
|
if (vaild) {
|
|
@@ -487,8 +424,9 @@ const submitBox = () => {
|
|
|
ElMessage.error("请添加产品");
|
|
|
return;
|
|
|
}
|
|
|
+ alert('通过')
|
|
|
for (let i = 0; i < boxFormData.value.packDetailProductList.length; i++) {
|
|
|
- const item = boxFormData.value.packDetailProductList[j];
|
|
|
+ const item = boxFormData.value.packDetailProductList[i];
|
|
|
if (item.quantity == null) {
|
|
|
ElMessage.error("请填写装箱数量");
|
|
|
return;
|
|
@@ -499,22 +437,16 @@ const submitBox = () => {
|
|
|
}
|
|
|
}
|
|
|
dtlModalType.value = false;
|
|
|
- formData.data.packDetailList[boxIndex.value] = {
|
|
|
- packQuantity: boxFormData.value.packQuantity,
|
|
|
- netWeight: boxFormData.value.netWeight,
|
|
|
- roughWeight: boxFormData.value.roughWeight,
|
|
|
- boxLong: boxFormData.value.boxLong,
|
|
|
- boxWide: boxFormData.value.boxWide,
|
|
|
- boxHigh: boxFormData.value.boxHigh,
|
|
|
- packDetailGoodsList: boxFormData.value.packDetailGoodsList,
|
|
|
- packDetailProductList: boxFormData.value.packDetailProductList,
|
|
|
- bomVolume: boxFormData.value.bomVolume,
|
|
|
- id: boxFormData.value.id,
|
|
|
- };
|
|
|
+ if(boxFormType == 'add') {
|
|
|
+ formData.data.packDetailList.push(
|
|
|
+ {...boxFormData.value}
|
|
|
+ )
|
|
|
+ console.log(formData.data.packDetailList)
|
|
|
+ } else {
|
|
|
+ formData.data.packDetailList[boxIndex.value] = {...boxFormData.value}
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- console.log(formData.data.packDetailList[boxIndex.value])
|
|
|
-
|
|
|
};
|
|
|
|
|
|
const dtlformData = reactive({
|
|
@@ -537,18 +469,21 @@ const dtlformData = reactive({
|
|
|
const selectProduct = (val,index) => {
|
|
|
let msg = {...formData.data.contractProductData.find((item) => item.mathId == val)}
|
|
|
//根据val 禁用相应的下拉数据
|
|
|
- console.log(msg,index)
|
|
|
+
|
|
|
boxFormData.value.packDetailProductList[index] = {
|
|
|
productId: msg.productId,
|
|
|
productName: msg.productName,
|
|
|
productSpec: msg.productSpec,
|
|
|
contractCode: msg.contractCode,
|
|
|
- contractProductId: msg.contractProductId,
|
|
|
+ contractProductId: msg.id,
|
|
|
cpQuantity: msg.cpQuantity,
|
|
|
waitQuantity: msg.waitQuantity,
|
|
|
quantity: null,
|
|
|
mathId: msg.mathId,
|
|
|
+ contractId: msg.contractId,
|
|
|
+ contractProductId: msg.id,
|
|
|
}
|
|
|
+ console.log(boxFormData.value.packDetailProductList)
|
|
|
formData.data.contractProductData.forEach((item) => {
|
|
|
item.disabled = false
|
|
|
boxFormData.value.packDetailProductList.forEach((item1) => {
|
|
@@ -793,6 +728,8 @@ const formConfig = reactive([
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
+const encasementType = ref('1')
|
|
|
+
|
|
|
const getList = async (req) => {
|
|
|
selectData.value = [];
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
@@ -870,12 +807,28 @@ const submitForm = () => {
|
|
|
}
|
|
|
submitLoading.value = true;
|
|
|
loadingOne.value = true;
|
|
|
+
|
|
|
+ formData.data.contractIds = formData.data.contractIds.join(",");
|
|
|
for (let i = 0; i < formData.data.packDetailList.length; i++) {
|
|
|
const e = formData.data.packDetailList[i];
|
|
|
e.bomVolume = (e.boxLong * e.boxWide * e.boxHigh) / 1000000;
|
|
|
+ e.contractIds = formData.data.contractIds;
|
|
|
+ e.customerId = formData.data.customerId;
|
|
|
}
|
|
|
- formData.data.contractIds = formData.data.contractIds.join(",");
|
|
|
- proxy.post("/pack/" + modalType.value, formData.data).then(
|
|
|
+ console.log(formData.data.packDetailList)
|
|
|
+ formData.data.packDetailList.map((x) => {
|
|
|
+ return{
|
|
|
+ ...x,
|
|
|
+ customerId:formData.data.customerId,
|
|
|
+ contractIds:formData.data.contractIds,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let reqData = {...formData.data}
|
|
|
+ //删除 reqData.packDetailList 里的id
|
|
|
+ reqData.packDetailList.forEach((item) => {
|
|
|
+ delete item.id
|
|
|
+ })
|
|
|
+ proxy.post("/pack/" + modalType.value, reqData).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: modalType.value == "add" ? "添加成功" : "编辑成功",
|