Commit 64b2bbca authored by Marcus's avatar Marcus

入仓表格表单验证

parent a6abfda1
......@@ -49,13 +49,13 @@
<el-button style="float: right;margin-left: 15px" size="mini" type="primary" icon="el-icon-minus" circle @click="handleDelete"></el-button>
<el-button style="float: right" size="mini" type="primary" icon="el-icon-plus" circle @click="handleAdd()"></el-button>
</div>
<el-form ref="tableForm" :model="form" :rules="tableFormRules" size="mini">
<el-form ref="tableForm" :model="tableData" :rules="tableFormRules" size="mini">
<el-table
:data="tableData"
style="width: 100%">
<el-table-column label="箱数" width="150px">
<template v-slot="{r,c,$index}">
<el-form-item prop="cartonsNum">
<el-form-item :rules="tableFormRules.cartonsNum" :prop="$index + '.cartonsNum'">
<span v-if="tableData[$index].id">
{{ tableData[$index].cartonsNum }}
{{ getDictDataLabel(DICT_TYPE.ECW_PACKAGE_TYPE, tableData[$index].unit) }}
......@@ -76,7 +76,7 @@
</el-table-column>
<el-table-column label="长(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="long">
<el-form-item :rules="tableFormRules.boxGauge1" :prop="$index + '.boxGauge1'">
<span v-if="tableData[$index].id">{{ tableData[$index].boxGauge ? tableData[$index].boxGauge.split('*')[0] : '' }}</span>
<el-input v-else v-model.number="tableData[$index].boxGauge1" placeholder="" @blur="handleVolume($index)"></el-input>
</el-form-item>
......@@ -84,7 +84,7 @@
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="width">
<el-form-item :rules="tableFormRules.boxGauge2" :prop="$index + '.boxGauge2'">
<span v-if="tableData[$index].id">{{ tableData[$index].boxGauge ? tableData[$index].boxGauge.split('*')[1] : '' }}</span>
<el-input v-else v-model.number="tableData[$index].boxGauge2" placeholder="" @blur="handleVolume($index)"></el-input>
</el-form-item>
......@@ -92,7 +92,7 @@
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="height">
<el-form-item :rules="tableFormRules.boxGauge3" :prop="$index + '.boxGauge3'">
<span v-if="tableData[$index].id">{{ tableData[$index].boxGauge ? tableData[$index].boxGauge.split('*')[2] : '' }}</span>
<el-input v-else v-model.number="tableData[$index].boxGauge3" placeholder="" @blur="handleVolume($index)"></el-input>
</el-form-item>
......@@ -100,7 +100,7 @@
</el-table-column>
<el-table-column label="体积(m³)">
<template v-slot="{r,c,$index}">
<el-form-item prop="volume">
<el-form-item :rules="tableFormRules.volume" :prop="$index + '.volume'">
<span v-if="tableData[$index].id">{{ tableData[$index].volume }}</span>
<el-input v-else v-model.number="tableData[$index].volume" placeholder=""></el-input>
</el-form-item>
......@@ -108,7 +108,7 @@
</el-table-column>
<el-table-column label="重量(Kg)">
<template v-slot="{r,c,$index}">
<el-form-item prop="weight">
<el-form-item :rules="tableFormRules.weight" :prop="$index + '.weight'">
<span v-if="tableData[$index].id">{{ tableData[$index].weight }}</span>
<el-input v-else v-model.number="tableData[$index].weight" placeholder=""></el-input>
</el-form-item>
......@@ -116,7 +116,7 @@
</el-table-column>
<el-table-column label="数量" width="130px">
<template v-slot="{r,c,$index}">
<el-form-item prop="quantityAll">
<el-form-item :rules="tableFormRules.quantityAll" :prop="$index + '.quantityAll'">
<span v-if="tableData[$index].id">{{ tableData[$index].quantityAll }}</span>
<el-input v-else v-model.number="tableData[$index].quantityAll" placeholder="">
<template slot="append"></template>
......@@ -180,13 +180,13 @@
<el-button style="float: right;margin-left: 15px" size="mini" type="primary" icon="el-icon-minus" circle @click="handleDelete(1)"></el-button>
<el-button style="float: right" size="mini" type="primary" icon="el-icon-plus" circle @click="handleAdd(1)"></el-button>
</div>
<el-form ref="tableForm1" :model="form" :rules="tableFormRules" size="mini">
<el-form ref="tableForm1" :model="tableData1" :rules="tableFormRules" size="mini">
<el-table
:data="tableData1"
style="width: 100%">
<el-table-column label="箱数" width="150px">
<template v-slot="{r,c,$index}">
<el-form-item prop="cartonsNum">
<el-form-item :rules="tableFormRules.cartonsNum" :prop="$index + '.cartonsNum'">
<span v-if="tableData1[$index].id">
{{ tableData1[$index].cartonsNum }}
{{ getDictDataLabel(DICT_TYPE.ECW_PACKAGE_TYPE, tableData1[$index].unit) }}
......@@ -207,7 +207,7 @@
</el-table-column>
<el-table-column label="长(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="long">
<el-form-item :rules="tableFormRules.boxGauge1" :prop="$index + '.boxGauge1'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].boxGauge ? tableData1[$index].boxGauge.split('*')[0] : '' }}</span>
<el-input v-else v-model.number="tableData1[$index].boxGauge1" placeholder="" @blur="handleVolume($index, 1)"></el-input>
</el-form-item>
......@@ -215,7 +215,7 @@
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="width">
<el-form-item :rules="tableFormRules.boxGauge2" :prop="$index + '.boxGauge2'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].boxGauge ? tableData1[$index].boxGauge.split('*')[1] : '' }}</span>
<el-input v-else v-model.number="tableData1[$index].boxGauge2" placeholder="" @blur="handleVolume($index, 1)"></el-input>
</el-form-item>
......@@ -223,7 +223,7 @@
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{r,c,$index}">
<el-form-item prop="height">
<el-form-item :rules="tableFormRules.boxGauge3" :prop="$index + '.boxGauge3'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].boxGauge ? tableData1[$index].boxGauge.split('*')[2] : '' }}</span>
<el-input v-else v-model.number="tableData1[$index].boxGauge3" placeholder="" @blur="handleVolume($index, 1)"></el-input>
</el-form-item>
......@@ -231,7 +231,7 @@
</el-table-column>
<el-table-column label="体积(m³)">
<template v-slot="{r,c,$index}">
<el-form-item prop="volume">
<el-form-item :rules="tableFormRules.volume" :prop="$index + '.volume'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].volume }}</span>
<el-input v-else v-model.number="tableData1[$index].volume" placeholder=""></el-input>
</el-form-item>
......@@ -239,7 +239,7 @@
</el-table-column>
<el-table-column label="重量(Kg)">
<template v-slot="{r,c,$index}">
<el-form-item prop="weight">
<el-form-item :rules="tableFormRules.weight" :prop="$index + '.weight'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].weight }}</span>
<el-input v-else v-model.number="tableData1[$index].weight" placeholder=""></el-input>
</el-form-item>
......@@ -247,7 +247,7 @@
</el-table-column>
<el-table-column label="数量" width="130px">
<template v-slot="{r,c,$index}">
<el-form-item prop="quantityAll">
<el-form-item :rules="tableFormRules.quantityAll" :prop="$index + '.quantityAll'">
<span v-if="tableData1[$index].id">{{ tableData1[$index].quantityAll }}</span>
<el-input v-else v-model.number="tableData1[$index].quantityAll" placeholder="">
<template slot="append"></template>
......@@ -378,9 +378,9 @@ export default {
},
tableFormRules: {
cartonsNum: [{required: true, message: "箱数不能为空", trigger: "blur"}],
long: [{required: true, message: "货物长不能为空", trigger: "blur"}],
width: [{required: true, message: "货物宽不能为空", trigger: "blur"}],
height: [{required: true, message: "货物高不能为空", trigger: "blur"}],
boxGauge1: [{required: true, message: "货物长不能为空", trigger: "blur"}],
boxGauge2: [{required: true, message: "货物宽不能为空", trigger: "blur"}],
boxGauge3: [{required: true, message: "货物高不能为空", trigger: "blur"}],
volume: [{required: true, message: "体积不能为空", trigger: "blur"}],
weight: [{required: true, message: "重量不能为空", trigger: "blur"}],
quantityAll: [{required: true, message: "数量不能为空", trigger: "blur"}]
......
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