|
@@ -192,13 +192,12 @@ export default {
|
|
|
],
|
|
|
rules: {
|
|
|
dataBaseName: {
|
|
|
- required: true,
|
|
|
- message: "请输入数据库名称",
|
|
|
+ validator: this.checkDataBaseName,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
+
|
|
|
tableName: {
|
|
|
- required: true,
|
|
|
- message: "请输入数据库名称",
|
|
|
+ validator: this.checkTableName,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
},
|
|
@@ -368,6 +367,29 @@ export default {
|
|
|
callback();
|
|
|
}
|
|
|
},
|
|
|
+ // 校验数据表名称
|
|
|
+ checkTableName(rule, value, callback) {
|
|
|
+ let msg = "";
|
|
|
+ if (!value.trim().length) {
|
|
|
+ msg = "请输入数据表名称";
|
|
|
+ this.$message.error(msg);
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else if (value[0] == "_") {
|
|
|
+ msg = "数据表名,请不要以下划线开头";
|
|
|
+ this.$message.error(msg);
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else if (!isNaN(value[0])) {
|
|
|
+ msg = "数据表名,请不要以数字开头";
|
|
|
+ this.$message.error(msg);
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else if (!this.isValidString(value)) {
|
|
|
+ msg = "数据表名,字段名应该只有下划线,数字和小写字母";
|
|
|
+ this.$message.error(msg);
|
|
|
+ callback(new Error(msg));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ },
|
|
|
//
|
|
|
|
|
|
// 处理非空校验问题
|