输入id即时提示该ID是否可用
<ui-col style="" class="text-right" sm="2" md="2" lg="2">
<label class="control-label animated"
uib-tooltip-html="'hello <b>world.</b>'" tooltip-popup-delay="" tooltip-popup-close-delay=""
tooltip-placement="top" tooltip-trigger="'mouseenter'" tooltip-enable="false"
tooltip-class="">事件id</label>
</ui-col>
<ui-col style="" class="text-right" sm="4" md="4" lg="4">
<input type="text" class="form-control " placeholder="" ng-readonly="showDetail" ng-required="true"
ng-model="param.bus.event_id" ng-change="checkUnique()">
<p class="text-left" ng-show="param.bus.event_id!=undefined" ng-bind="param.checkMsg"
ng-style="{'color':param.pass?'green':'red'}"></p>
<span>{{typeof(param.bus.event_id)}}</span>
</ui-col>
// 校验事件ID的唯一
$scope.checkUnique = function () {
// console.log(typeof ($scope.param.bus.event_id));
$http({
method: "GET",
url: MSBURL + "....",
params: {
event_id: $scope.param.bus.event_id
}
}).then(function (response) {
switch (response.data.code) {
case "1":
$scope.param.pass = true;
$scope.param.checkMsg = "当前事件id唯一,可使用"
// $scope.query();
break;
case "0":
$scope.param.pass = false;
$scope.param.checkMsg = "当前事件id已存在,请更换"
break;
}
});
}