Browse Source

添加表单校验

test
caoyizhong 2 years ago
parent
commit
9b530bec2a
  1. 2
      src/option/basicdata/basicStorageServices.js
  2. 67
      src/views/basicdata/brand/basicBrand.vue
  3. 101
      src/views/basicdata/brand/basicShop.vue
  4. 10
      src/views/basicdata/brand/basicStorageServices.vue
  5. 61
      src/views/basicdata/brand/basicStoreContact.vue
  6. 100
      src/views/basicdata/brand/basicZonePrice.vue
  7. 108
      src/views/basicdata/brand/basicdataFreight.vue
  8. 28
      src/views/basicdata/brand/basicdataSupportValue.vue

2
src/option/basicdata/basicStorageServices.js

@ -89,7 +89,7 @@ export default {
hide: true,
},
{
label: "门店ID",
label: "门店名称",
prop: "shopId",
search: true,
},

67
src/views/basicdata/brand/basicBrand.vue

@ -116,7 +116,7 @@
width="50%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<el-form :disabled="view" ref="form" :model="form" label-width="80px" :rules="rules">
<!-- 表单字段 -->
<el-form-item label="品牌名称" prop="brandName">
<el-input v-model="form.brandName" placeholder="请输入品牌名称"/>
@ -152,7 +152,7 @@
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -250,6 +250,21 @@ export default {
dialogImageUrl : '',
dialogVisible: false,
disabled: false,
rules: {
brandName: [
{ required: true, message: '请输入品牌名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
brandCode: [
{ required: true, message: '请输入品牌编号', trigger: 'change' }
],
brandIcon : [
{ required: true, message: '请上传图标', trigger: 'blur' }
],
acceptanceTime: [
{ required: true, message: '请选择承接时间', trigger: 'blur' }
],
},
}
},
mounted () {
@ -323,27 +338,33 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
console.log("提交的数据!!",this.form);
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
handleSubmit (from) {
this.$refs[from].validate((valid) => {
if (valid) {
if (!this.form.id) {
console.log("提交的数据!!",this.form);
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}
})
},
handleAdd () {
this.title = '新增'

101
src/views/basicdata/brand/basicShop.vue

@ -128,7 +128,7 @@
width="35%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<el-form :disabled="view" ref="form" :model="form" label-width="80px" :rules = 'rules'>
<!-- 表单字段 -->
<el-form-item label="客户名称" prop="clientId">
<!-- <el-input v-model="form.clientId" placeholder="请选择客户"/>-->
@ -214,7 +214,7 @@
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')" > </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -313,6 +313,36 @@ export default {
data: [],
optioner:[],
optionser:[],
rules: {
clientId: [
{ required: true, message: '请选择客户', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
storeCode: [
{ required: true, message: '输入门店编码', trigger: 'change' }
],
storeName : [
{ required: true, message: '请输入门店名称', trigger: 'blur' }
],
linkman: [
{ required: true, message: '请输入门店联系人', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入联系电话', trigger: 'change' }
],
bladeRegionProvinceId: [
{ required: true, message: '请选择地址', trigger: 'blur' }
],
detailedAddress: [
{ required: true, message: '请填写详细地址', trigger: 'blur' }
],
checkInTime: [
{ type: 'date', required: true, message: '请选择开始时间', trigger: 'change' }
],
postSetTime: [
{ type: 'date', required: true, message: '请选择结束时间', trigger: 'change' }
]
},
}
},
@ -371,37 +401,44 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
console.log("from>>>",this.form);
this.form.bladeRegionCityId = this.form.bladeRegionProvinceId[1];
this.form.bladeRegionAreaId = this.form.bladeRegionProvinceId[2];
this.form.bladeRegionProvinceId = this.form.bladeRegionProvinceId[0];
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
this.form.bladeRegionCityId = this.form.bladeRegionProvinceId[1];
this.form.bladeRegionAreaId = this.form.bladeRegionProvinceId[2];
this.form.bladeRegionProvinceId = this.form.bladeRegionProvinceId[0];
if(JSON.stringify(this.form.clientId).length < 10){
this.form.clientId = null;
handleSubmit (from) {
this.$refs[from].validate((valid) => {
if (valid) {
if (!this.form.id) {
console.log("from>>>",this.form);
this.form.bladeRegionCityId = this.form.bladeRegionProvinceId[1];
this.form.bladeRegionAreaId = this.form.bladeRegionProvinceId[2];
this.form.bladeRegionProvinceId = this.form.bladeRegionProvinceId[0];
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
this.form.bladeRegionCityId = this.form.bladeRegionProvinceId[1];
this.form.bladeRegionAreaId = this.form.bladeRegionProvinceId[2];
this.form.bladeRegionProvinceId = this.form.bladeRegionProvinceId[0];
if(JSON.stringify(this.form.clientId).length < 10){
this.form.clientId = null;
}
console.log("this.form.clientId",this.form.clientId,JSON.stringify(this.form.clientId).length);
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}
console.log("this.form.clientId",this.form.clientId,JSON.stringify(this.form.clientId).length);
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
})
},
handleAdd () {
this.title = '新增'

10
src/views/basicdata/brand/basicStorageServices.vue

@ -4,8 +4,8 @@
<el-row :hidden="!search" style="padding:6px 18px">
<!-- 查询模块 -->
<el-form :inline="true" :model="query">
<el-form-item label="门店ID:">
<el-input v-model="query.shopId" placeholder="请输入门店ID"></el-input>
<el-form-item label="门店名称:">
<el-input v-model="query.shopId" placeholder="请输入门店名称"></el-input>
</el-form-item>
<el-form-item label="发货单位:">
<el-input v-model="query.forwardingUnit" placeholder="请输入发货单位"></el-input>
@ -44,7 +44,7 @@
:border="option.border">
<el-table-column type="selection" v-if="option.selection" width="55" align="center"></el-table-column>
<el-table-column type="expand" v-if="option.expand" align="center"></el-table-column>
<el-table-column v-if="option.index" label="#" type="index" width="50" align="center">
<el-table-column v-if="option.index" label="序号" type="index" width="80" align="center">
</el-table-column>
<template v-for="(item,index) in option.column">
<!-- table字段 -->
@ -88,8 +88,8 @@
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<!-- 表单字段 -->
<el-form-item label="门店ID" prop="shopId">
<el-input v-model="form.shopId" placeholder="请输入门店ID"/>
<el-form-item label="门店名称" prop="shopId">
<el-input v-model="form.shopId" placeholder="请选择门店"/>
</el-form-item>
<el-form-item label="发货单位" prop="forwardingUnit">
<el-input v-model="form.forwardingUnit" placeholder="请输入发货单位"/>

61
src/views/basicdata/brand/basicStoreContact.vue

@ -86,7 +86,7 @@
width="50%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<el-form :disabled="view" ref="form" :model="form" label-width="80px" :rules="rules">
<!-- 表单字段 -->
<!-- <el-form-item label="门店ID" prop="shopId">-->
<!-- <el-input v-model="form.shopId" placeholder="请输入门店ID"/>-->
@ -101,7 +101,7 @@
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -150,6 +150,15 @@ export default {
option: option,
//
data: [],
rules: {
linkman: [
{ required: true, message: '请输入联系人', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入电话', trigger: 'change' }
],
},
}
},
mounted () {
@ -190,27 +199,33 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
this.form.shopId = this.mainId; //ID
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
handleSubmit (from) {
this.$refs[from].validate((valid) => {
if (valid) {
if (!this.form.id) {
this.form.shopId = this.mainId; //ID
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}
})
},
handleAdd () {
this.title = '新增'

100
src/views/basicdata/brand/basicZonePrice.vue

@ -112,7 +112,7 @@
width="35%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="120px">
<el-form :disabled="view" ref="form" :model="form" label-width="120px" :rules="rules">
<!-- 表单字段 -->
<el-form-item label="地址" prop="province">
<!-- <el-input v-model="form.province" placeholder="请输入省"/>-->
@ -165,7 +165,7 @@
<el-form-item label="费用" prop="cost">
<el-input v-model="form.cost" placeholder="请输入费用"/>
</el-form-item>
<el-form-item label="仓储时间端状态" prop="warehousingTimeStatus">
<el-form-item label="仓储时间端" prop="warehousingTimeStatus">
<!-- <el-input v-model="form.warehousingTimeStatus" placeholder="请输入仓储时间端状态;1 0-30天 2 0-60天 3 60天以上"/>-->
<el-select v-model="form.warehousingTimeStatus" class="m-2" placeholder="请输入仓储时间端状态" >
<el-option
@ -211,7 +211,7 @@
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -264,6 +264,30 @@ export default {
optioner:[],
optionsr:[],
optionser:[],
rules: {
province: [
{ required: true, message: '请选择地址', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
brand: [
{ required: true, message: '请选择品牌', trigger: 'change' }
],
freightMark : [
{ required: true, message: '请选择费用类型', trigger: 'blur' }
],
cost: [
{ required: true, message: '请输入费用', trigger: 'blur' }
],
warehousingTimeStatus: [
{ required: true, message: '请选择时间段', trigger: 'change' }
],
warehousingTimeCharge: [
{ required: true, message: '请选择时间段费用', trigger: 'blur' }
],
goalGranary: [
{ required: true, message: '请选择末端仓', trigger: 'blur' }
],
},
}
},
created() {
@ -342,42 +366,46 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
this.form.city = this.form.province[1];
this.form.district = this.form.province[2];
this.form.province = this.form.province[0];
console.log("提交的数据》》》",this.form);
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
handleSubmit (from) {
this.$refs[from].validate((valid) => {
if (valid) {
if (!this.form.id) {
this.form.city = this.form.province[1];
this.form.district = this.form.province[2];
this.form.province = this.form.province[0];
console.log("提交的数据》》》",this.form);
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
this.form.city = this.form.province[1];
this.form.district = this.form.province[2];
this.form.province = this.form.province[0];
if(JSON.stringify(this.form.goalGranary).length < 15){
this.form.goalGranary = null;
}
if(JSON.stringify(this.form.brand).length < 15){
this.form.brand = null;
} else {
this.form.city = this.form.province[1];
this.form.district = this.form.province[2];
this.form.province = this.form.province[0];
if(JSON.stringify(this.form.goalGranary).length < 15){
this.form.goalGranary = null;
}
if(JSON.stringify(this.form.brand).length < 15){
this.form.brand = null;
}
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
})
},
handleAdd () {
this.title = '新增'

108
src/views/basicdata/brand/basicdataFreight.vue

@ -216,6 +216,11 @@
value: "dictKey"
},
search: true,
rules: [{
required: true,
message: '请选择计算方式',
trigger: 'blur'
}]
},
{
label: "物品名称",
@ -223,6 +228,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写物品名称',
trigger: 'blur'
}]
},
{
label: "门店品牌",
@ -262,12 +272,22 @@
}
},
rules: [{
required: true,
message: '请选择门店品牌',
trigger: 'blur'
}]
},
{
label: "运费",
prop: "freight",
type: "input",
rules: [{
required: true,
message: '请填写运费',
trigger: 'blur'
}]
},
{
label: "送货费用",
@ -275,6 +295,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写送货运费',
trigger: 'blur'
}]
},
{
label: "提货费用",
@ -282,6 +307,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写提货费用',
trigger: 'blur'
}]
},
{
label: "仓库管理费用",
@ -289,6 +319,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写管理费用',
trigger: 'blur'
}]
},
{
label: "仓储费用",
@ -296,6 +331,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写仓储费用',
trigger: 'blur'
}]
},
{
label: "装卸费用",
@ -303,6 +343,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写装卸费用',
trigger: 'blur'
}]
},
{
label: "其他费用",
@ -324,7 +369,12 @@
props: {
label: 'name',
value: 'id',
}
},
rules: [{
required: true,
message: '请选择末端仓',
trigger: 'blur'
}]
},
{
label: "发货单位",
@ -333,6 +383,11 @@
width:"150px",
span:12,
search: true,
rules: [{
required: true,
message: '请填写发货单位',
trigger: 'blur'
}]
},
{
label: "门店",
@ -360,6 +415,11 @@
value: "dictKey"
},
search: true,
rules: [{
required: true,
message: '请选择服务类型',
trigger: 'blur'
}]
},
{
label: "结算方", //;1 2
@ -371,6 +431,11 @@
value: "dictKey"
},
search: true,
rules: [{
required: true,
message: '请选择结算方',
trigger: 'blur'
}]
},
{
label: "一级品类",
@ -378,6 +443,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写一级品类',
trigger: 'blur'
}]
},
{
label: "一口价",
@ -385,6 +455,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写一口价',
trigger: 'blur'
}]
},
{
label: "干线费用",
@ -392,6 +467,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写干线费用',
trigger: 'blur'
}]
},
{
label: "生效时间",
@ -400,17 +480,27 @@
width:"150px",
span:12,
format:'YYYY-MM-DD HH:mm:ss',
valueFormat:'YYYY-MM-DD HH:mm:ss'
valueFormat:'YYYY-MM-DD HH:mm:ss',
rules: [{
required: true,
message: '请填写生效时间',
trigger: 'blur'
}]
},
{
label: "截至时间",
label: "截时间",
prop: "expirationTime",
type: "datetime",
width:"150px",
span:12,
format:'YYYY-MM-DD HH:mm:ss',
valueFormat:'YYYY-MM-DD HH:mm:ss'
valueFormat:'YYYY-MM-DD HH:mm:ss',
rules: [{
required: true,
message: '请填写截止时间',
trigger: 'blur'
}]
},
// {
@ -436,6 +526,11 @@
value: "dictKey"
},
search: true,
rules: [{
required: true,
message: '请选择时间段',
trigger: 'blur'
}]
},
{
label: "时间段费用",
@ -443,6 +538,11 @@
type: "input",
width:"150px",
span:12,
rules: [{
required: true,
message: '请填写时间段费用',
trigger: 'blur'
}]
},
]
},

28
src/views/basicdata/brand/basicdataSupportValue.vue

@ -153,23 +153,51 @@
prop: "userName",
type: "input",
search: true,
rules: [
{
required: true,
message: '请输入收货用户名称',
trigger: 'blur'
}
]
},
{
label: "保费率",
prop: "premiumRate",
type: "input",
rules: [
{
required: true,
message: '请输入保费率',
trigger: 'blur'
}
]
},
{
label: "收货用户地址",
prop: "userAdderss",
type: "input",
search: true,
rules: [
{
required: true,
message: '请输入收货用户地址',
trigger: 'blur'
}
]
},
{
label: "收货用户电话",
prop: "userPhone",
type: "input",
search: true,
rules: [
{
required: true,
message: '请输入收货用户电话',
trigger: 'blur'
}
]
},
{
label: "预留1",

Loading…
Cancel
Save