xn-date.html
5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en" >
<meta charset="UTF-8">
<title></title>
<link href="../spm_modules/bootstrap-css/1.0.0/bootstrap.css" rel="stylesheet">
<link href="../demo/base.less" rel="stylesheet">
<link href="../demo/nav.less" rel="stylesheet">
<!--<link href="../spm_modules/xn-icon-common/1.0.0/iconfont.min.css" rel="stylesheet">-->
<link href="http://xn-static.oss-cn-hangzhou.aliyuncs.com/font/xn-icon-common/2.0.11/iconfont.min.css" rel="stylesheet">
<script type="text/javascript" src="../spm_modules/jquery/1.7.2/jquery.js"></script>
<script type="text/javascript" src="../spm_modules/angular/1.3.9/angular.js"></script>
<script type="text/javascript" src="../spm_modules/angular-ui/1.0.0/bootstraptpls.js"></script>
<script type="text/javascript" src="../spm_modules/xn-directive-common/2.1.6/directive/commons.js"></script>
<script type="text/javascript" src="../spm_modules/xn-service-common/1.0.7/service/commons.js"></script>
<script type="text/javascript" src="../spm_modules/xn-directive-form/1.0.5/directive/forms.js"></script>
<style>
.error{
border: 1px solid red;
}
.xn-openData{
position: relative;
}
.btn-Data{
position: absolute;
z-index: 1;
right: 0;
top: 0;
bottom: 0;
width: 30px;
border-radius: 4px;
display:inline-flex;
justify-items: center;
align-items: center;
cursor: pointer;
text-align: center;
padding-left:6px;
}
</style>
</head>
<body ng-controller="MyController">
<a href="index.html">返回</a>
<div class="clearfix"></div>
<div style="width: 800px;margin: auto">
<form class="form-horizontal xn-form" role="form" xn-form-validate novalidate="" name="validateForm">
<input type="text" class="form-control" ng-model="vm.startTime" name="qq">
<div class="col-sm-3 ">
<div class="xn-openData">
<input type="text" class="form-control" id="inpuStartTime" placeholder="开始时间"
ng-model="vm.startTime" is-open="startTime" today-disabled="true"
datepicker-popup="yyyy-MM-dd" max-date="maxDate" ng-blur="doTime($event)"
datepicker-options="dateOptions" name="textStartTime"
close-text="关闭" clear-text="清除" current-text="今天" >
<span class="btn-Data" ng-click="startData($event)"> <i class="icon icon-calendar"></i></span>
</div>
</div>
<div class="col-sm-3 ">
<div class="xn-openData ">
<input type="text" class="form-control" id="inpuEndTime" placeholder="结束时间"
ng-model="vm.endTime" is-open="endTime" today-disabled="true"
datepicker-popup="yyyy-MM-dd" name="textEndTime" mix-date="minDate" datepicker-options="dateOptions"
current-text="今天" close-text="关闭" clear-text="清除" date-disabled="disabled(date, mode)">
<span class="btn-Data" ng-click="endDate($event)"><i class="icon icon-calendar"></i></span>
</div>
</div>
<input type="button" class="btn btn-default" value="提交" xn-form-submit="doSave()">
<input type="button" class="btn btn-default" value="提交" ng-click="doSave()">
</form>
</div>
<div class="clearfix"></div>
<h3>使用说明</h3>
<script type="text/javascript">
angular.module("myApp", ["ui.bootstrap","xn.directive.common","xn.service.common","xn.service.interceptor","xn.directive.form"])
.config(["xnValidatorProvider", function (xnValidatorProvider) {
// 全局配置
xnValidatorProvider.config({
blurTrig: false,
showError: false,
removeError: false
});
xnValidatorProvider.setRules({
textStartTime: {
required: "单号不能为空!"
},
textEndTime: {
required: "员工不能为空!"
},
});
}])
.controller("MyController", ["$scope", function($scope) {
$scope.vm={};
$scope.doTime=function ($event) {
console.log($event.target.value="")
console.log($scope.vm.startTime)
console.log($scope.vm.endTime)
}
//弹出式日历触发函数
$scope.startData = function ($event) {
if ($scope.vm.endTime !== null) {
$scope.maxDate = $scope.vm.endTime;
}
$event.preventDefault();
$event.stopPropagation();
$scope.startTime = true;
};
$scope.endDate = function ($event) {
if ($scope.vm.startTime !== null) {
$scope.minDate = $scope.vm.startTime;
}
$event.preventDefault();
$event.stopPropagation();
$scope.endTime = true;
};
$scope.doSave=function () {
console.log($scope.vm.startTime)
console.log($scope.vm.endTime)
}
}]);
</script>
</body>
</html>