参数校验相关提交
parent
c33d10734f
commit
2932c7f35d
|
@ -57,3 +57,24 @@ export const URL =
|
||||||
|
|
||||||
// 固话
|
// 固话
|
||||||
export const TEL = /0\d{2,3}-\d{7,8}/
|
export const TEL = /0\d{2,3}-\d{7,8}/
|
||||||
|
|
||||||
|
|
||||||
|
// 正整数
|
||||||
|
export const INTEGER = {
|
||||||
|
pattern: /^[0-9]\d*$/,
|
||||||
|
message:'请输入正整数'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const VARCHAR20 = {
|
||||||
|
pattern:/^.{3,20}$/,
|
||||||
|
message:'长度应该限制在3-20个字符'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const URL200 = {
|
||||||
|
pattern:/[a-zA-z]+\:\/\/[^\s]{1,190}/,
|
||||||
|
message:'请输入长度不超过200的URL地址'
|
||||||
|
}
|
||||||
|
export const REQUIRED = {
|
||||||
|
required: true,
|
||||||
|
message:'请填写参数'
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Form ref="searchForm" @keydown.enter.native="handleSearch" :model="searchForm" inline :label-width="70" class="search-form">
|
<Form ref="searchForm" @keydown.enter.native="handleSearch" :model="searchForm" inline :label-width="70"
|
||||||
|
class="search-form">
|
||||||
<Form-item label="品牌名称">
|
<Form-item label="品牌名称">
|
||||||
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px"/>
|
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px"/>
|
||||||
</Form-item>
|
</Form-item>
|
||||||
|
@ -12,7 +13,8 @@
|
||||||
</Row>
|
</Row>
|
||||||
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
|
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
|
||||||
<Row type="flex" justify="end" class="mt_10">
|
<Row type="flex" justify="end" class="mt_10">
|
||||||
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
|
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage"
|
||||||
|
@on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
|
||||||
show-total show-elevator show-sizer></Page>
|
show-total show-elevator show-sizer></Page>
|
||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -43,6 +45,8 @@ import {
|
||||||
} from "@/api/goods";
|
} from "@/api/goods";
|
||||||
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
|
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
|
||||||
|
|
||||||
|
import {regular} from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "brand",
|
name: "brand",
|
||||||
components: {
|
components: {
|
||||||
|
@ -68,7 +72,16 @@ export default {
|
||||||
deleteFlag: "",
|
deleteFlag: "",
|
||||||
},
|
},
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {},
|
formValidate: {
|
||||||
|
name: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR20
|
||||||
|
],
|
||||||
|
logo: [
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.URL200
|
||||||
|
],
|
||||||
|
},
|
||||||
submitLoading: false, // 添加或编辑提交状态
|
submitLoading: false, // 添加或编辑提交状态
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,9 +171,17 @@ export default {
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
formValidate: {
|
formValidate: {
|
||||||
commissionRate: [
|
commissionRate: [
|
||||||
{ required: true, message: "请填写佣金比例" },
|
regular.REQUIRED,
|
||||||
{ pattern: regular.Integer, message: "佣金比例不能为负" },
|
regular.INTEGER
|
||||||
],
|
],
|
||||||
|
name:[
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.VARCHAR20,
|
||||||
|
],
|
||||||
|
sortOrder:[
|
||||||
|
regular.REQUIRED,
|
||||||
|
regular.INTEGER
|
||||||
|
]
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue