Authored by qinchao

恶意ip页面bug

@@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
124 columns: [ 124 columns: [
125 { 125 {
126 title: "", 126 title: "",
127 - width:"20px", 127 + width:"10%",
128 field: "ip", 128 field: "ip",
129 formatter: function (value, rowData, rowIndex) { 129 formatter: function (value, rowData, rowIndex) {
130 var div = $("<div>"); 130 var div = $("<div>");
@@ -139,11 +139,11 @@ @@ -139,11 +139,11 @@
139 }, 139 },
140 { 140 {
141 title: "ip", 141 title: "ip",
142 - width: "80px", 142 + width: "20%",
143 field: "ip" 143 field: "ip"
144 }, { 144 }, {
145 title: "reason", 145 title: "reason",
146 - width: "120px", 146 + width: "60%",
147 field: "reasonDur", 147 field: "reasonDur",
148 styler : function(value, rowData, rowIndex){ 148 styler : function(value, rowData, rowIndex){
149 return { 149 return {
@@ -188,7 +188,7 @@ @@ -188,7 +188,7 @@
188 },*/ 188 },*/
189 { 189 {
190 title: "操作", 190 title: "操作",
191 - width: "50px", 191 + width: "10%",
192 field: "ip", 192 field: "ip",
193 formatter: function (value, rowData, rowIndex) { 193 formatter: function (value, rowData, rowIndex) {
194 var div = $("<div>"); 194 var div = $("<div>");
@@ -120,14 +120,35 @@ @@ -120,14 +120,35 @@
120 columns: [ 120 columns: [
121 { 121 {
122 title: "ip", 122 title: "ip",
123 - width: "100px", 123 + width: "20%",
124 field: "ip" 124 field: "ip"
125 }, 125 },
126 { 126 {
127 title: "reason", 127 title: "reason",
128 - width: "120px", 128 + width: "60%",
129 field: "reason", 129 field: "reason",
130 - // align: "left", 130 + align: "left",
  131 + formatter:function(value,rowData,rowIndex){
  132 + var allReasonDiv = "<div name='allReasonDiv' style='display:none'><a onclick='showResons(this)' style='color:#333;cursor:pointer' value='true' >";
  133 + allReasonDiv +=value;
  134 + allReasonDiv +="</a></div>";
  135 +
  136 + var simpleReasonDiv = "<div name='simpleReasonDiv'>";
  137 + if(value != null && value.length > 0){
  138 + simpleReasonDiv += "<a onclick='showResons(this)' style='color:#333;cursor:pointer' value='true' >";
  139 + var str_array=value.split("<br>");
  140 + for (var i = 0; i < str_array.length; i ++){
  141 + if(i <=2 ){
  142 + simpleReasonDiv = simpleReasonDiv + str_array[i] + ";&nbsp;&nbsp;&nbsp;";
  143 + }
  144 + }
  145 + simpleReasonDiv+="......</a>";
  146 + }
  147 + simpleReasonDiv += "</div>";
  148 +
  149 +
  150 + return simpleReasonDiv + allReasonDiv;
  151 + },
131 styler : function(value, rowData, rowIndex){ 152 styler : function(value, rowData, rowIndex){
132 return { 153 return {
133 "vertical-align" : "middle" 154 "vertical-align" : "middle"
@@ -137,7 +158,7 @@ @@ -137,7 +158,7 @@
137 { 158 {
138 title: "时间", 159 title: "时间",
139 field: "createTime", 160 field: "createTime",
140 - width: "80px", 161 + width: "20%",
141 formatter:function (value,rowData,rowIndex) { 162 formatter:function (value,rowData,rowIndex) {
142 if(value !=null && value!=""){ 163 if(value !=null && value!=""){
143 return format(value); 164 return format(value);
@@ -150,6 +171,31 @@ @@ -150,6 +171,31 @@
150 }); 171 });
151 } 172 }
152 173
  174 + function showResons(elememt){
  175 + var that = elememt;
  176 + var btnText = $(that).attr("value");
  177 + if("true" == btnText){
  178 + var ipsDiv = $(that).closest("tr").find("div[name='simpleReasonDiv']").each(function (index,el) {
  179 + $(this).hide();//隐藏当前显示的(仅两个ip)
  180 + });
  181 + var ipsDiv = $(that).closest("tr").find("div[name='allReasonDiv']").each(function (index,el) {
  182 + $(this).show();//显示所有的ips
  183 + });
  184 + $(that).attr("value","false");
  185 +// $(that).text("隐藏详情");
  186 +
  187 + }else{
  188 + var ipsDiv = $(that).closest("tr").find("div[name='simpleReasonDiv']").each(function (index,el) {
  189 + $(this).show();//隐藏当前显示的(仅两个ip)
  190 + });
  191 + var ipsDiv = $(that).closest("tr").find("div[name='allReasonDiv']").each(function (index,el) {
  192 + $(this).hide();//显示所有的ips
  193 + });
  194 + $(that).attr("value","true");
  195 +// $(that).text("显示详情");
  196 + }
  197 + }
  198 +
153 //timeValue---时间戳 199 //timeValue---时间戳
154 function format(timeValue){ 200 function format(timeValue){
155 var time = new Date(timeValue); 201 var time = new Date(timeValue);