Commit b61196f1 authored by Marcus's avatar Marcus

入仓表单验证补充

parent d2c421ac
......@@ -7,54 +7,56 @@
>
<el-tabs v-model="activeName" type="card" @tab-click="handleTabs">
<el-tab-pane :label="edit ? '货物修改' : '货物入仓'" name="first">
<el-descriptions border :column="2">
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 中文品名</template>
{{ warehousing.prodTitleZh }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 英文品名</template>
{{ warehousing.prodTitleEn }}
</el-descriptions-item>
<el-descriptions-item label="品牌">
<template slot="label"><span style="color: red">*</span> 品牌</template>
<span v-if="false">{{ form.brand ? brand : '无' }}</span>
<el-select
v-else v-model="form.brand"
placeholder="可修改"
filterable
@change="handleBrandChange"
allow-create>
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.titleZh"
:value="item.id">
</el-option>
</el-select>
</el-descriptions-item>
<el-descriptions-item label="是否备案">
<template slot="label"><span style="color: red">*</span> 是否备案</template>
{{ isBeian }}
</el-descriptions-item>
<el-descriptions-item label="收费模式">
<template slot="label"><span style="color: red">*</span> 收费模式</template>
{{ feeType }}
</el-descriptions-item>
<el-descriptions-item label="填单参数">
箱数:
<el-input size="mini" v-if="edit" v-model="warehousing.num" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.num }}</span><br>
体积:
<el-input size="mini" v-if="edit" v-model="warehousing.volume" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.volume }}</span><br>
重量:
<el-input size="mini" v-if="edit" v-model="warehousing.weight" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.weight }}</span>Kg
</el-descriptions-item>
</el-descriptions>
<el-form ref="form" :model="form" label-width="80px" style="margin-top: 20px">
<el-form-item label="材质">
<el-form ref="form" :model="form" :rules="formRules" label-width="80px">
<el-descriptions border :column="2">
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 中文品名</template>
{{ warehousing.prodTitleZh }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 英文品名</template>
{{ warehousing.prodTitleEn }}
</el-descriptions-item>
<el-descriptions-item label="品牌">
<template slot="label"><span style="color: red">*</span> 品牌</template>
<span v-if="false">{{ form.brand ? brand : '无' }}</span>
<el-form-item required label="" prop="brand" label-width="0">
<el-select
v-model="form1.brand"
placeholder="可修改"
filterable
@change="handleBrandChange"
clearable>
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.titleZh"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="是否备案">
<template slot="label"><span style="color: red">*</span> 是否备案</template>
{{ isBeian }}
</el-descriptions-item>
<el-descriptions-item label="收费模式">
<template slot="label"><span style="color: red">*</span> 收费模式</template>
{{ feeType }}
</el-descriptions-item>
<el-descriptions-item label="填单参数">
箱数:
<el-input size="mini" v-if="edit" v-model="warehousing.num" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.num }}</span><br>
体积:
<el-input size="mini" v-if="edit" v-model="warehousing.volume" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.volume }}</span><br>
重量:
<el-input size="mini" v-if="edit" v-model="warehousing.weight" style="display: inline-block;width: 100px"></el-input>
<span v-else>{{ warehousing.weight }}</span>Kg
</el-descriptions-item>
</el-descriptions>
<el-form-item label="材质" style="margin-top: 20px">
<dict-selector :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.material"></dict-selector>
</el-form-item>
<el-form-item label="入仓时间" v-if="!edit">
......@@ -173,43 +175,49 @@
</el-tab-pane>
<el-tab-pane label="添加新品名" name="second" v-if="!edit">
<el-descriptions border :column="2">
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 中文品名</template>
<product-selector v-model="form1.prodId" @change="onProductChange"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 英文品名</template>
<product-selector lang="En" v-model="form1.prodId" @change="onProductChange"/>
</el-descriptions-item>
<el-descriptions-item label="品牌">
<template slot="label"><span style="color: red">*</span> 品牌</template>
<el-select
v-model="form1.brand"
placeholder="可修改"
filterable
@change="handleBrandChange"
allow-create>
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.titleZh"
:value="item.id">
</el-option>
</el-select>
</el-descriptions-item>
<el-descriptions-item label="是否备案">
<template slot="label"><span style="color: red">*</span> 是否备案</template>
{{ isBeian1 }}
</el-descriptions-item>
<el-descriptions-item label="收费模式">
<template slot="label"><span style="color: red">*</span> 收费模式</template>
{{ feeType1 }}
</el-descriptions-item>
<el-descriptions-item label="填单参数">非填单货物</el-descriptions-item>
</el-descriptions>
<el-form ref="form" :model="form" label-width="80px" style="margin-top: 20px">
<el-form-item label="材质">
<el-form ref="form1" :model="form1" :rules="formRules" label-width="80px">
<el-descriptions border :column="2">
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 中文品名</template>
<el-form-item required label="" prop="prodId" label-width="0">
<product-selector v-model="form1.prodId" @change="onProductChange"/>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"><span style="color: red">*</span> 英文品名</template>
<el-form-item required label="" prop="prodId" label-width="0">
<product-selector lang="En" v-model="form1.prodId" @change="onProductChange"/>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="品牌">
<template slot="label"><span style="color: red">*</span> 品牌</template>
<el-form-item required label="" prop="brand" label-width="0">
<el-select
v-model="form1.brand"
placeholder="可修改"
filterable
@change="handleBrandChange"
clearable>
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.titleZh"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="是否备案">
<template slot="label"><span style="color: red">*</span> 是否备案</template>
{{ isBeian1 }}
</el-descriptions-item>
<el-descriptions-item label="收费模式">
<template slot="label"><span style="color: red">*</span> 收费模式</template>
{{ feeType1 }}
</el-descriptions-item>
<el-descriptions-item label="填单参数">非填单货物</el-descriptions-item>
</el-descriptions>
<el-form-item label="材质" style="margin-top: 20px">
<dict-selector :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form1.material"></dict-selector>
</el-form-item>
<el-form-item label="入仓时间">
......@@ -358,7 +366,6 @@ import {DICT_TYPE, getDictDataLabel} from "@/utils/dict"
import { orderWarehouseIn, orderWarehouseInUpdateApply } from '@/api/ecw/order'
import { getFeeTypeByOrderProduct, getProductBrankPage } from '@/api/ecw/productBrank'
import WorkFlow from "@/components/WorkFlow"
import elSelect from '@/components/render/slots/el-select'
import ProductSelector from "@/components/ProductSelector"
export default {
......@@ -420,6 +427,10 @@ export default {
getDictDataLabel,
opened: false,
brandList: [],
formRules: {
prodId: [{required: true, message: this.$t("请选择品名"), trigger: "change"}],
brand: [{required: true, message: this.$t("请选择品牌"), trigger: "change"}],
},
form: {
"brand": "",
// "brandType": 0,
......@@ -430,7 +441,7 @@ export default {
// "orderNo": "",
"orderWarehouseInItemDoList": [],
"prodAttrIds": "",
"prodId": 0,
"prodId": '',
// "prodTitleEn": "",
// "prodTitleZh": "",
// "prodType": 0,
......@@ -457,7 +468,7 @@ export default {
"orderNo": "",
"orderWarehouseInItemDoList": [],
"prodAttrIds": "",
"prodId": 0,
"prodId": '',
"prodTitleEn": "",
"prodTitleZh": "",
"prodType": 0,
......@@ -487,7 +498,7 @@ export default {
opened(val) {
if (val) {
this.form.material = this.warehousing.material
this.form.brand = this.warehousing.brand.toString()
this.form.brand = this.warehousing.brand?.toString() || ''
this.handleBrandChange(this.form.brand)
} else {
this.$emit('update:visible', false)
......@@ -527,7 +538,7 @@ export default {
handleVolume(index, val){
const {boxGauge1, boxGauge2, boxGauge3} = (val === 1 ? this.tableData1 : this.tableData)[index]
if (boxGauge1 && boxGauge2 && boxGauge3) {
(val === 1 ? this.tableData1 : this.tableData)[index].volume = ((boxGauge1 * boxGauge2 * boxGauge3) / 1000000).toFixed(2)
(val === 1 ? this.tableData1 : this.tableData)[index].volume = ((boxGauge1 * boxGauge2 * boxGauge3) / 1000000)?.toFixed(2) || ''
} else {
(val === 1 ? this.tableData1 : this.tableData)[index].volume = 0
}
......@@ -544,82 +555,87 @@ export default {
]
if (this.activeName !== "first"){
// 添加非填单货物
this.$refs['tableForm1'].validate(valid => {
if (!valid) {
return
}
return orderWarehouseIn({
...this.form1,
brandType: this.form1.brand ? 1 : 0,
orderId: this.warehousing.orderId,
orderItemId: undefined,
orderNo: this.warehousing.orderNo,
orderWarehouseInItemDoList: this.form1.orderWarehouseInItemDoList.map(e => {
return {
...e,
boxGauge: e.boxGauge1 + '*' + e.boxGauge2 + '*' + e.boxGauge3
}
})
}).then(r => {
if (r.data) {
this.$message.success('新增入仓成功')
this.handleClose()
} else {
this.$message.success('新增入仓失败')
this.$refs['form1'].validate(valid => {
this.$refs['tableForm1'].validate(valid1 => {
if (!valid || !valid1) {
return
}
})
})
} else {
this.$refs['tableForm'].validate(valid => {
if (!valid) {
return
}
if (this.edit) {
// 入仓修改
return orderWarehouseInUpdateApply({
...this.form,
brandType: this.form.brand ? 1 : 0,
return orderWarehouseIn({
...this.form1,
brandType: this.form1.brand ? 1 : 0,
orderId: this.warehousing.orderId,
orderItemId: this.warehousing.orderItemId,
orderItemId: undefined,
orderNo: this.warehousing.orderNo,
num: this.warehousing.num,
volume: this.warehousing.volume.toFixed(2),
weight: this.warehousing.weight.toFixed(2),
prodId: this.warehousing.prodId,
"orderWarehouseInUpdateItemDoList": this.tableData.map(e => {
orderWarehouseInItemDoList: this.form1.orderWarehouseInItemDoList.map(e => {
return {
...e,
boxGauge: e.boxGauge1 + '*' + e.boxGauge2 + '*' + e.boxGauge3
}
}),
copyUserId: this.selectedUsers
}).then(r => {
if (r.data) {
this.$message.success('入仓修改发起成功')
this.handleClose()
} else {
this.$message.success('入仓修改发起失败')
}
})
} else {
// 首次入仓
return orderWarehouseIn({
...this.form,
brandType: (this.form.brand && this.form.brand !== '0') ? 1 : 0,
orderId: this.warehousing.orderId,
orderItemId: this.warehousing.orderItemId,
orderNo: this.warehousing.orderNo,
orderWarehouseInItemDoList
})
}).then(r => {
if (r.data) {
this.$message.success('入仓成功')
this.$message.success('新增入仓成功')
this.handleClose()
} else {
this.$message.success('入仓失败')
this.$message.success('新增入仓失败')
}
})
}
})
})
} else {
this.$refs['form'].validate(valid => {
this.$refs['tableForm'].validate(valid1 => {
if (!valid || !valid1) {
return
}
if (this.edit) {
// 入仓修改
return orderWarehouseInUpdateApply({
...this.form,
brandType: this.form.brand ? 1 : 0,
orderId: this.warehousing.orderId,
orderItemId: this.warehousing.orderItemId,
orderNo: this.warehousing.orderNo,
num: this.warehousing.num,
volume: this.warehousing.volume?.toFixed(2) || '',
weight: this.warehousing.weight?.toFixed(2) || '',
prodId: this.warehousing.prodId,
"orderWarehouseInUpdateItemDoList": this.tableData.map(e => {
return {
...e,
boxGauge: e.boxGauge1 + '*' + e.boxGauge2 + '*' + e.boxGauge3
}
}),
copyUserId: this.selectedUsers
}).then(r => {
if (r.data) {
this.$message.success('入仓修改发起成功')
this.handleClose()
} else {
this.$message.success('入仓修改发起失败')
}
})
} else {
// 首次入仓
return orderWarehouseIn({
...this.form,
brandType: (this.form.brand && this.form.brand !== '0') ? 1 : 0,
orderId: this.warehousing.orderId,
orderItemId: this.warehousing.orderItemId,
orderNo: this.warehousing.orderNo,
orderWarehouseInItemDoList
}).then(r => {
if (r.data) {
this.$message.success('入仓成功')
this.handleClose()
} else {
this.$message.success('入仓失败')
}
})
}
})
})
}
},
handleClose() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment