|
|
@@ -82,8 +82,8 @@ export default {
|
|
|
name: [
|
|
|
{ required: true, message: "不能为空", trigger: "blur" },
|
|
|
{
|
|
|
- pattern: /^\w+$/,
|
|
|
- message: "只能输入字母,下划线,数字",
|
|
|
+ pattern: /^(?![0-9]+$)(?![a-zA-Z]$)[A-Za-z_][A-Za-z_0-9]{0,}$/,
|
|
|
+ message: "只能输入字母,下划线或数字,数字不能在首位",
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
@@ -111,11 +111,11 @@ export default {
|
|
|
: "";
|
|
|
if (this.ruleForm.type === "int") {
|
|
|
if (Number(value) > 8) this.ruleForm.length = 8;
|
|
|
- if(Number(value) <= 0) this.ruleForm.length = 1;
|
|
|
+ if (Number(value) <= 0) this.ruleForm.length = 0;
|
|
|
}
|
|
|
if (this.ruleForm.type === "varchar") {
|
|
|
if (Number(value) > 512) this.ruleForm.length = 512;
|
|
|
- if(Number(value) <= 0) this.ruleForm.length = 1;
|
|
|
+ if (Number(value) <= 0) this.ruleForm.length = 0;
|
|
|
}
|
|
|
},
|
|
|
// 点击取消
|
|
|
@@ -124,6 +124,11 @@ export default {
|
|
|
this.$emit("update:dialogVisible", false);
|
|
|
},
|
|
|
async btnOk() {
|
|
|
+ if (
|
|
|
+ Number(this.ruleForm.length) <= 0 &&
|
|
|
+ this.ruleForm.type !== "datetime"
|
|
|
+ )
|
|
|
+ return this.$message.warning("字段长度不能为0");
|
|
|
try {
|
|
|
await this.$refs.ruleForm.validate();
|
|
|
let obj = { ...this.ruleForm, length: Number(this.ruleForm.length) };
|