dever %!s(int64=2) %!d(string=hai) anos
pai
achega
bf1804737e
Modificáronse 1 ficheiros con 53 adicións e 48 borrados
  1. 53 48
      assets/lib/manage/main.js

+ 53 - 48
assets/lib/manage/main.js

@@ -1094,11 +1094,21 @@ function loading(e, data, type)
 					}
 				}
 			} else {
+				var a = data.col;
 				if (pid) {
-					data.col = pid + '_i_' + data.col;
+					var b = $('#update_'+ (pid + '_i_' + a));
+					if (b.length) {
+						var ue = b;
+					} else {
+						var ue = $('#update_'+a);
+					}
+				} else {
+					var ue = $('#update_'+a);
+				}
+				data[a] = ue.val();
+				if (!data[a]) {
+					data[a] = ue.attr('v');
 				}
-				var ue = $('#update_'+data.col);
-				data[data.col] = ue.val();
 			}
 		}
 
@@ -2489,6 +2499,9 @@ function fastEdit(e, url, title, col, index, type)
 			if (html.indexOf('left: 740px') != -1) {
 				html = html.replace('left: 740px', 'left:583px;')
 			}
+			if (!$(t).find('.fa-save').length) {
+				func = false;
+			}
 		} else {
 			html = t;
 			func = false;
@@ -3596,51 +3609,43 @@ function init_xm(xm_id, xm_radio, xm_tips, xm_url, xm_data, xm_value, xm_on)
 	                }
 	            }
 	        }
-	        $.ajax({
-	            type: "get",
-	            url: xm_url,
-	            data: data,
-	            success : function success(response) {
-	                if (typeof response == "string") {
-	                    response = JSON.parse(response);
-	                }
-	                if (response.status == 2) {
-	                	cb([]);
-	                	return;
-	                }
-	                if (response.page && response.page.total) {
-	                	cb(response.data.list, response.page.total)
-	                } else {
-	                	cb(response.data.list)
-	                }
-	                if (response.data.table) {
-	                	xm.update({
-	                		content: response.data.table,
-	                	});
-	                	layui.table.init(xm_table, response.data.table_config).on('row('+xm_table+')', function(obj) {
-							var values = xm.getValue();
-							var item = obj.data;
-							var has = values.find(function(i){
-								return i.value === item.value
-							});
-							var send = {};
-							send.arr = [ item ];
-							if (has) {
-								xm.delete(send.arr);
-							} else if (xm_radio) {
-								xm.setValue(send.arr);
-								xm.closed();
-							} else {
-								xm.append(send.arr);
-							}
-							
-							xm_on && xm_on(send)
-						})
-	                }
-	            },
-	            error : function error(err) {
-	                cb([]);
-	            }
+	        $.getJSON(xm_url, data, function(response) {
+	        	if (typeof response == "string") {
+                    response = JSON.parse(response);
+                }
+                if (response.status == 2) {
+                	cb([]);
+                	return;
+                }
+                if (response.page && response.page.total) {
+                	cb(response.data.list, response.page.total)
+                } else {
+                	cb(response.data.list)
+                }
+                if (response.data.table) {
+                	xm.update({
+                		content: response.data.table,
+                	});
+                	layui.table.init(xm_table, response.data.table_config).on('row('+xm_table+')', function(obj) {
+						var values = xm.getValue();
+						var item = obj.data;
+						var has = values.find(function(i){
+							return i.value === item.value
+						});
+						var send = {};
+						send.arr = [ item ];
+						if (has) {
+							xm.delete(send.arr);
+						} else if (xm_radio) {
+							xm.setValue(send.arr);
+							xm.closed();
+						} else {
+							xm.append(send.arr);
+						}
+						
+						xm_on && xm_on(send)
+					})
+                }
 	        });
 	    },
 	});