修复汇总库配置时取消再添加,上次编辑的信息未清空

This commit is contained in:
chenlw 2017-01-09 11:26:47 +08:00
parent 6107e8d36e
commit 511e1302de
2 changed files with 37 additions and 11 deletions

View File

@ -29,17 +29,17 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">名称</label> <label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control " type="text" ng-model="tableForm.name" name="orcName" ng-minlength="2" ng-maxlength="20" required="required"/> <input class="system-info-danger-input form-control " type="text" ng-model="tableForm.name" name="orcName" ng-minlength="2" ng-maxlength="20" required="required" ng-focus="tableForm.name=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcName.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcName.$invalid && submitted">
<span role="alert" ng-show="validForm.orcName.$error.required">名称不能为空</span> <span role="alert" ng-show="validForm.orcName.$error.required">名称不能为空</span>
<span role="alert" ng-show="!validForm.orcName.$error.required && validForm.orcName.$invalid">请输入输入2-20个字符的数据名称</span> <span role="alert" ng-show="!validForm.orcName.$error.required && validForm.orcName.$invalid">请输入2-20个字符的数据名称</span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">IP</label> <label class="col-sm-2 control-label">IP</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.ip" name="orcIP" ng-pattern="/((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.ip" name="orcIP" ng-pattern="/((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))/" required="required" ng-focus="tableForm.ip=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcIP.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcIP.$invalid && submitted">
<span role="alert" ng-show="validForm.orcIP.$error.required">IP不能为空</span> <span role="alert" ng-show="validForm.orcIP.$error.required">IP不能为空</span>
<span role="alert" ng-show="validForm.orcIP.$error.pattern">请输入正确的IP地址</span> <span role="alert" ng-show="validForm.orcIP.$error.pattern">请输入正确的IP地址</span>
@ -49,7 +49,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">端口号</label> <label class="col-sm-2 control-label">端口号</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.port" name="orcPort" ng-pattern="/^([1-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.port" name="orcPort" ng-pattern="/^([1-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/" required="required" ng-focus="tableForm.port=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcPort.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcPort.$invalid && submitted">
<span role="alert" ng-show="validForm.orcPort.$error.required">端口号不能为空</span> <span role="alert" ng-show="validForm.orcPort.$error.required">端口号不能为空</span>
<span role="alert" ng-show="validForm.orcPort.$error.pattern">端口号必须为1~65535的数字</span> <span role="alert" ng-show="validForm.orcPort.$error.pattern">端口号必须为1~65535的数字</span>
@ -59,7 +59,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">用戶名</label> <label class="col-sm-2 control-label">用戶名</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.user" name="orcUser" ng-pattern="/^\w{2,15}$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.user" name="orcUser" ng-pattern="/^\w{2,15}$/" required="required" ng-focus="tableForm.user=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcUser.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcUser.$invalid && submitted">
<span role="alert" ng-show="validForm.orcUser.$error.required">用户名不能为空</span> <span role="alert" ng-show="validForm.orcUser.$error.required">用户名不能为空</span>
<span role="alert" ng-show="validForm.orcUser.$error.pattern">用户名必须为2-15个字母、数字或下划线</span> <span role="alert" ng-show="validForm.orcUser.$error.pattern">用户名必须为2-15个字母、数字或下划线</span>
@ -69,7 +69,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">密码</label> <label class="col-sm-2 control-label">密码</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.password" name="orcPassword" ng-pattern="/^\w{2,15}$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.password" name="orcPassword" ng-pattern="/^\w{2,15}$/" required="required" ng-focus="tableForm.password=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcPassword.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcPassword.$invalid && submitted">
<span role="alert" ng-show="validForm.orcPassword.$error.required">密码不能为空</span> <span role="alert" ng-show="validForm.orcPassword.$error.required">密码不能为空</span>
<span role="alert" ng-show="validForm.orcPassword.$error.pattern">密码必须为2-15个字母、数字或下划线</span> <span role="alert" ng-show="validForm.orcPassword.$error.pattern">密码必须为2-15个字母、数字或下划线</span>
@ -79,7 +79,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">服务名</label> <label class="col-sm-2 control-label">服务名</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.databaseName" name="orcService" ng-pattern="/^[a-zA-Z]{1,10}$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.databaseName" name="orcService" ng-pattern="/^[a-zA-Z]{1,10}$/" required="required" ng-focus="tableForm.databaseName=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcService.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcService.$invalid && submitted">
<span role="alert" ng-show="validForm.orcService.$error.required">服务名不能为空</span> <span role="alert" ng-show="validForm.orcService.$error.required">服务名不能为空</span>
<span role="alert" ng-show="validForm.orcService.$error.pattern">服务名必须为1-10个字母</span> <span role="alert" ng-show="validForm.orcService.$error.pattern">服务名必须为1-10个字母</span>
@ -89,7 +89,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">表空间名</label> <label class="col-sm-2 control-label">表空间名</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.tableName" name="orcTable" ng-pattern="/^\w{1,15}$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.tableName" name="orcTable" ng-pattern="/^\w{1,15}$/" required="required" ng-focus="tableForm.tableName=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcTable.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcTable.$invalid && submitted">
<span role="alert" ng-show="validForm.orcTable.$error.required">表空间名不能为空</span> <span role="alert" ng-show="validForm.orcTable.$error.required">表空间名不能为空</span>
<span role="alert" ng-show="validForm.orcTable.$error.pattern">表空间名必须为1-15个字母、数字或下划线</span> <span role="alert" ng-show="validForm.orcTable.$error.pattern">表空间名必须为1-15个字母、数字或下划线</span>
@ -99,7 +99,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">表后缀名</label> <label class="col-sm-2 control-label">表后缀名</label>
<div class="col-sm-10 sj_form_input"> <div class="col-sm-10 sj_form_input">
<input class="system-info-danger-input form-control" type="text" ng-model="tableForm.suffix" name="orcSuffix" ng-pattern="/^\w{1,10}$/" required="required"/> <input class="system-info-danger-input form-control" type="text" ng-model="tableForm.suffix" name="orcSuffix" ng-pattern="/^\w{1,10}$/" required="required" ng-focus="tableForm.suffix=''"/>
<div class="system-info-danger-red-char form-error" ng-show="validForm.orcSuffix.$invalid && submitted"> <div class="system-info-danger-red-char form-error" ng-show="validForm.orcSuffix.$invalid && submitted">
<span role="alert" ng-show="validForm.orcSuffix.$error.required">表后缀名不能为空</span> <span role="alert" ng-show="validForm.orcSuffix.$error.required">表后缀名不能为空</span>
<span role="alert" ng-show="validForm.orcSuffix.$error.pattern">表后缀名必须为1-10个字母、数字或下划线</span> <span role="alert" ng-show="validForm.orcSuffix.$error.pattern">表后缀名必须为1-10个字母、数字或下划线</span>

View File

@ -73,7 +73,15 @@ module Configs{
$scope.edit = false; $scope.edit = false;
$scope.tableForm = {}; $scope.tableForm = {};
$scope.tableForm["id"]=0; $scope.tableForm["id"]=0;
$scope.tableForm["type"]=0; $scope.tableForm["type"]=0;
$scope.tableForm["name"]='请输入2-20个字符的数据名称';
$scope.tableForm["ip"]='例如0.0.0.0';
$scope.tableForm["port"]='1~65535';
$scope.tableForm["user"]='2-15个字母、数字或下划线';
$scope.tableForm["password"]='2-15个字母、数字或下划线';
$scope.tableForm["databaseName"]='1-10个字母';
$scope.tableForm["tableName"]='1-15个字母、数字或下划线';
$scope.tableForm["suffix"]='1-10个字母、数字或下划线';
} }
$scope.cancel = () => { $scope.cancel = () => {
@ -83,7 +91,25 @@ module Configs{
$scope.submitted = false; $scope.submitted = false;
} }
$scope.onSubmit = (oracle) => { $scope.onSubmit = (oracle) => {
if($scope.tableForm["name"]=='请输入2-20个字符的数据名称')
$scope.tableForm["name"]='';
if($scope.tableForm["ip"]=='例如0.0.0.0')
$scope.tableForm["ip"]='';
if($scope.tableForm["port"]=='1~65535')
$scope.tableForm["port"]='';
if($scope.tableForm["user"]=='2-15个字母、数字或下划线')
$scope.tableForm["user"]='';
if($scope.tableForm["password"]=='2-15个字母、数字或下划线')
$scope.tableForm["password"]='';
if($scope.tableForm["databaseName"]=='1-10个字母')
$scope.tableForm["databaseName"]='';
if($scope.tableForm["tableName"]=='1-15个字母、数字或下划线')
$scope.tableForm["tableName"]='';
if($scope.tableForm["suffix"]=='1-10个字母、数字或下划线')
$scope.tableForm["suffix"]='';
if($scope.validForm.$valid && $scope.validForm.$dirty){ if($scope.validForm.$valid && $scope.validForm.$dirty){
$scope.edit = false; $scope.edit = false;
$scope.add = false; $scope.add = false;