task.js
6.77 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
var initApp = function () {
"use strict";
var ref = [
"xn.common",
"xn.directive.top",
"xn.service.interceptor",
"xn.task.filter",
"xn.task.service",
"xn.page",
"ui.bootstrap",
"xn.directive.form",
"xn.directive.attachment",
"xn.directive.select",
"xn.directive.calendar",
"xn.directive.card"
];
var app = angular.module("xn", ref);
//拦截器
app.config(["$httpProvider", function ($httpProvider) {
$httpProvider.interceptors.push("httpInterceptor");
}]);
// 全局配置 form提交验证
app.config(["xnValidatorProvider", function (xnValidatorProvider) {
// 全局配置
xnValidatorProvider.config({
blurTrig: false,
showError: false,
removeError: false
});
xnValidatorProvider.setRules({
name: {
required: "名称不能为空!"
},
room:{
required: "厅名称不能为空!"
},
unitPrice:{
required: "单价不能为空!",
pattern:"单价只能为数字"
},
ticketCategoryName: {
required: "门票类别名称不能为空!"
},
quantity:{
required: "数量不能为空!",
pattern:"数量只能为数字"
},
freeEntry:{
required: "免费进场人数不能为空!",
pattern:"人数只能为正整数"
},
maximumSeats:{
required: "可坐人数不能为空!",
pattern:"人数只能为正整数"
},
venueName:{
required: "场地名称不能为空!"
},
venueCode:{
required: "场地编码不能为空!"
},
location:{
required: "详细地址不能为空!",
maxlength:"详细地址不能超过200字"
},
shortName:{
required: "场地简称不能为空!"
},
contactName:{
required: "姓名不能为空!"
},
contactPhone:{
required: "电话不能为空!"
},
myLoc:{
required: "具体位置不能为空!"
},
zipcode:{
required: "邮编不能为空!"
},
contactMail:{
required: "邮箱不能为空!",
pattern:"邮箱格式不正确"
},
orderIndex:{
required: "排序索引不能为空!",
pattern:"排序索引只能为数字"
},
age:{
required: "年龄不能为空!",
pattern:"年龄请输入三位数以下的正整数"
},
djName: {
required: "DJ姓名不能为空!"
},
type: {
required: "币种不能为空!"
},
promoteCode: {
required: "促销码不能为空!"
},
taxRate: {
required: "税率不能为空!"
},
evenName: {
required: "活动主题不能为空!"
},
description:{
maxlength:"描述不能超过500字"
},
unionLevelName: {
required: "名称不能为空!"
},
unionLevelCode: {
required: "代码不能为空!"
},
adjustmentPoint: {
required: "调整积分不能为空!",
pattern:"调整积分只能输入整数!"
},
listPrice: {
required: "原价不能为空!",
pattern:"价格只能输入非负数(如果是小数只能保留两位小数)!"
},
salePrice: {
required: "优惠价不能为空!",
pattern:"价格只能输入非负数(如果是小数只能保留两位小数)!"
}
});
}]);
app.value("xnConfig",xnConfig);
app.controller("BodyController", ["$scope","$location","$filter","dialogService",
function ($scope,$location,$filter,dialogService) {
$scope.$on('navShow', function (e, newNavShow) {
$scope.navShow = newNavShow;
});
$scope.global = {loadingInit: false};
$scope.maxPageSize = 5;
//日期转换函数
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
};
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
};
//关闭错误
$scope.closeAlert = function (index, form) {
form.splice(index, 1);
};
$scope.upFileClick = function () {
var upImportFileId = document.getElementById("upImportFileId");
upImportFileId.onchange = function () {
var upImportFile;
var upImportFileList = upImportFileId.files;
var upImportFilename;
if (upImportFileList) {
upImportFile = upImportFileList[0];
upImportFilename = upImportFile.name;
} else {
upImportFilename = upImportFileId.value;
}
var str = upImportFilename.substr(upImportFilename.indexOf(".") + 1);
if (!(str == "xls" || str == "xlsx" || str == "et")) {
$("#upImportFile").val("");
dialogService.tip([{"message": "请上传Excel支持的文件(xls,xlsx,et等)!"}]);
} else {
$("#upImportFile").val(upImportFilename);
}
};
};
}]);
};