Explorar el Código

修改测试bug

zhangshuangnan %!s(int64=8) %!d(string=hace) años
padre
commit
7a54b80aef
Se han modificado 1 ficheros con 131 adiciones y 127 borrados
  1. 131 127
      CallCenterWeb.UI/TelCall/js/transferTimeSetting.js

+ 131 - 127
CallCenterWeb.UI/TelCall/js/transferTimeSetting.js

@@ -1,128 +1,132 @@
1 1
 var token = $.cookie("token");
2
-			$(document).ready(function(){
3
-				  $.ajax({
4
-			    		type:"get",
5
-			    		url:huayi.config.callcenter_url + 'UserAccount/GetCallForwarding',
6
-			    		async:true,
7
-			    		dataType:'json',
8
-			    		data:{
9
-			    		        token: token,	
10
-			    		},
11
-			    		success:function(res){
12
-			    			if(res.state.toLowerCase()=='success'){
13
-			    				$('.tables').html('');
14
-			    				$(res.data).each(function(i,n){
15
-			    					$('<tr>'+
16
-										'<th><a href="javaScript:;" class="removes" onclick="del(this)"><i class="fa fa-remove"></i></a>时间段'+ parseInt(i+1) +':</th>'+
17
-										'<td>'+
18
-											'<div class="timeBox">'+
19
-												'<i class="fa fa-clock-o tub"></i>'+
20
-												'<input type="text" class="test-item" id="usestrTime2" value="'+ n.starttime+'" />'+
21
-											'</div> &nbsp;'+
22
-											'<span>至</span> &nbsp;'+
23
-											'<div class="timeBox">'+
24
-												'<i class="fa fa-clock-o tub"></i>'+
25
-											    '<input type="text" class="test-item" id="usestrTime22" value="'+ n.endtime +'" name="starttime1" />'+
26
-											'</div>'+
27
-										'</td>'+
28
-									'</tr>').appendTo('.tables');
29
-			    				})
30
-			    				layerdate()
31
-			    			}
32
-			    		}
33
-			    	});
34
-			    //时间赋值 layerdate
35
-			   function layerdate(){
36
-			   		lay('.test-item').each(function(){
37
-									    laydate.render({
38
-									      elem: this
39
-									      ,trigger: 'click'
40
-									      ,type: 'time'
41
-									     });
42
-									  });
43
-			   }
44
-		    	$('#addto').click(function(){
45
-		    		var trs=$('.tables tr').length,lths=parseInt(trs+1);
46
-		    		console.log(trs);
47
-		    		for(var i=trs;i<lths;i++){
48
-		    			$('<tr>'+
49
-							'<th><a href="javaScript:;" class="removes" onclick="del(this)"><i class="fa fa-remove"></i></a>时间段'+ parseInt(i+1) +':</th>'+
50
-							'<td>'+
51
-								'<div class="timeBox">'+
52
-									'<i class="fa fa-clock-o tub"></i>'+
53
-									'<input type="text" class="test-item" id="usestrTime2" />'+
54
-								'</div> &nbsp;'+
55
-								'<span>至</span> &nbsp;'+
56
-								'<div class="timeBox">'+
57
-									'<i class="fa fa-clock-o tub"></i>'+
58
-								    '<input type="text" class="test-item" id="usestrTime22"  />'+
59
-								'</div>'+
60
-							'</td>'+
61
-						'</tr>').appendTo('.tables');
62
-		    		}
63
-		    		layerdate()
64
-		    	})
65
-				$('#del').click(function(){
66
-				 	$('.removes').show();
67
-				 })
68
-			
69
-				 $('#save').click(function(){
70
-				 	save()
71
-				 })
72
-				 
73
-				
74
-				  
75
-			})
76
-				 //删除
77
-				 function del(a){
78
-				 	$(a).parent().parent('tr').remove();
79
-				 	save();
80
-				 }
81
-				 //拼字符串
82
-				 function str(){
83
-				 	var arr='';
84
-				 	$('.tables tr').each(function(i,n){
85
-				 		var htmlStr='';
86
-//				 		console.log($(n).find('input'))
87
-				 		$($(n).find('input')).each(function(k,m){
88
-				 			if(m.value==''){
89
-				 				m.value=""
90
-				 			}
91
-				 			if(htmlStr){
92
-				 				htmlStr +=','
93
-				 				htmlStr +=m.value;
94
-				 			}else{
95
-				 				htmlStr +=m.value;
96
-				 			}
97
-				 		})
98
-						if(arr){
99
-								arr +='|'
100
-				 				arr +=htmlStr;
101
-						}else{
102
-							arr +=htmlStr;
103
-						}
104
-				 	})
105
-				    return arr
106
-				 }
107
-		
108
-				//保存提交
109
-				 function save(){
110
-				 	  $.ajax({
111
-			    		type:"get",
112
-			    		url:huayi.config.callcenter_url +'UserAccount/EditCallForwarding',
113
-			    		async:true,
114
-			    		dataType:'json',
115
-			    		data:{
116
-			    		        token: token,
117
-			    		        timestr:str()
118
-			    		},
119
-			    		success:function(res){
120
-			    			if(res.state.toLowerCase()=='success'){
121
-			    			  layer.msg(res.message)
122
-			    			}
123
-			    			
124
-			    		}
125
-			    	})
126
-				 }
127
-				 
128
-		
2
+	oneLoad()
3
+	function oneLoad(){
4
+		$.ajax({
5
+			type: "get",
6
+			url: huayi.config.callcenter_url + 'UserAccount/GetCallForwarding',
7
+			async: true,
8
+			dataType: 'json',
9
+			data: {
10
+				token: token,
11
+			},
12
+			success: function(res) {
13
+				if(res.state.toLowerCase() == 'success') {
14
+					$('.tables').html('');
15
+					$(res.data).each(function(i, n) {
16
+						$('<tr>' +
17
+							'<th><a href="javaScript:;" class="removes" onclick="del(this)"><i class="fa fa-remove"></i></a>时间段' + parseInt(i + 1) + ':</th>' +
18
+							'<td>' +
19
+							'<div class="timeBox">' +
20
+							'<i class="fa fa-clock-o tub"></i>' +
21
+							'<input type="text" class="test-item" id="usestrTime2" value="' + n.starttime + '" />' +
22
+							'</div> &nbsp;' +
23
+							'<span>至</span> &nbsp;' +
24
+							'<div class="timeBox">' +
25
+							'<i class="fa fa-clock-o tub"></i>' +
26
+							'<input type="text" class="test-item" id="usestrTime22" value="' + n.endtime + '" name="starttime1" />' +
27
+							'</div>' +
28
+							'</td>' +
29
+							'</tr>').appendTo('.tables');
30
+					})
31
+					layerdate()
32
+				}
33
+			}
34
+		});
35
+	}
36
+	
37
+	//时间赋值 layerdate
38
+	function layerdate() {
39
+		lay('.test-item').each(function() {
40
+			laydate.render({
41
+				elem: this,
42
+				trigger: 'click',
43
+				type: 'time'
44
+			});
45
+		});
46
+	}
47
+	$('#addto').click(function() {
48
+		var trs = $('.tables tr').length,
49
+			lths = parseInt(trs + 1);
50
+		console.log(trs);
51
+		for(var i = trs; i < lths; i++) {
52
+			$('<tr>' +
53
+				'<th><a href="javaScript:;" class="removes" onclick="del(this)"><i class="fa fa-remove"></i></a>时间段' + parseInt(i + 1) + ':</th>' +
54
+				'<td>' +
55
+				'<div class="timeBox">' +
56
+				'<i class="fa fa-clock-o tub"></i>' +
57
+				'<input type="text" class="test-item" id="usestrTime2" />' +
58
+				'</div> &nbsp;' +
59
+				'<span>至</span> &nbsp;' +
60
+				'<div class="timeBox">' +
61
+				'<i class="fa fa-clock-o tub"></i>' +
62
+				'<input type="text" class="test-item" id="usestrTime22"  />' +
63
+				'</div>' +
64
+				'</td>' +
65
+				'</tr>').appendTo('.tables');
66
+		}
67
+		layerdate()
68
+		$('.removes').hide();
69
+	})
70
+	$('#del').click(function() {
71
+		$('.removes').show();
72
+	})
73
+
74
+	$('#save').click(function() {
75
+		save()
76
+	})
77
+
78
+
79
+//删除
80
+function del(a) {
81
+	$(a).parent().parent('tr').remove();
82
+	save();
83
+	oneLoad();
84
+}
85
+//拼字符串
86
+function str() {
87
+	var arr = '';
88
+	$('.tables tr').each(function(i, n) {
89
+		var htmlStr = '';
90
+		//				 		console.log($(n).find('input'))
91
+		$($(n).find('input')).each(function(k, m) {
92
+			if(m.value == '') {
93
+				m.value = ""
94
+			}
95
+			if(htmlStr) {
96
+				htmlStr += ','
97
+				htmlStr += m.value;
98
+			} else {
99
+				htmlStr += m.value;
100
+			}
101
+		})
102
+		if(arr) {
103
+			arr += '|'
104
+			arr += htmlStr;
105
+		} else {
106
+			arr += htmlStr;
107
+		}
108
+	})
109
+	return arr
110
+}
111
+
112
+//保存提交
113
+function save() {
114
+	$.ajax({
115
+		type: "get",
116
+		url: huayi.config.callcenter_url + 'UserAccount/EditCallForwarding',
117
+		async: true,
118
+		dataType: 'json',
119
+		data: {
120
+			token: token,
121
+			timestr: str()
122
+		},
123
+		success: function(res) {
124
+			if(res.state.toLowerCase() == 'success') {
125
+				layer.msg("操作成功!")
126
+				$('.removes').hide();
127
+				oneLoad();
128
+			}
129
+
130
+		}
131
+	})
132
+}