|
@@ -150,7 +150,12 @@ $(function () {
|
|
|
|
|
|
// 保存套装
|
|
|
$(document).on('click','#suit_exit_value', function() {
|
|
|
- let suit_name = $("#suit_name").val();
|
|
|
+ let suit_name = $("#suit_name").val().trim();
|
|
|
+ if(suit_name==""){
|
|
|
+ alert("套装名称不可以为空!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
let url=http+"cku_suit/add";
|
|
|
let data_string = JSON.stringify({token:token,name:suit_name});
|
|
|
$.ajax({
|
|
@@ -277,7 +282,7 @@ $(function () {
|
|
|
// console.log(id);
|
|
|
// console.log(num_name);
|
|
|
let url=http+"sku_condition/update";
|
|
|
- let data_string = JSON.stringify({token:token,numName:num_name[0],name:num_name[1],id:id});
|
|
|
+ let data_string = JSON.stringify({token:token,numName:num_name[0].trim(),name:num_name[1].trim(),id:id});
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: "post",
|
|
@@ -305,12 +310,10 @@ $(function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
// 添加一行的条件
|
|
|
$(document).on('click','.add_role_div', function() {
|
|
|
// 添加一行条件并显示到页面
|
|
@@ -329,7 +332,7 @@ $(function () {
|
|
|
// 保存添加的规则和条件
|
|
|
$(document).on('click','#role_add_value', function() {
|
|
|
// console.log(suit_rid);
|
|
|
- let role_edit_name = $("#role_edit_name").val();
|
|
|
+ let role_edit_name = $("#role_edit_name").val().trim();
|
|
|
let condition_number=[];
|
|
|
let condition_that=[];
|
|
|
let condition_id=[];
|
|
@@ -358,11 +361,11 @@ $(function () {
|
|
|
// console.log(data);
|
|
|
rule_id = data.res[0].id;
|
|
|
for(let i=0;i<add_i;i++){
|
|
|
- let number = $("#condition_number_"+i).val();
|
|
|
+ let number = $("#condition_number_"+i).val().trim();
|
|
|
if(number!="" && number!=undefined){
|
|
|
condition_number.push([number]);
|
|
|
}
|
|
|
- let that = $("#condition_that_"+i).val();
|
|
|
+ let that = $("#condition_that_"+i).val().trim();
|
|
|
if(that!="" && that!=undefined){
|
|
|
condition_that.push([that]);
|
|
|
}
|
|
@@ -385,7 +388,6 @@ $(function () {
|
|
|
},
|
|
|
error:function (XMLHttpRequest) {
|
|
|
console.log("失败!");
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -407,7 +409,11 @@ $(function () {
|
|
|
if(j==9){
|
|
|
suit_html=suit_html+ '<div class="rule_ rule_hr"></div>';
|
|
|
try{
|
|
|
- suit_html=suit_html+ '<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input" rid="'+condition_id[j]+'" value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
|
|
|
+ if(condition_number[j]!=undefined){
|
|
|
+ suit_html=suit_html+ '<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input" rid="'+condition_id[j]+'" value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
|
|
|
+ }else{
|
|
|
+ suit_html=suit_html+ '<div class="rule_ rule_hr"></div>';
|
|
|
+ }
|
|
|
}catch(e){
|
|
|
//TODO handle the exception
|
|
|
suit_html=suit_html+ '<div class="rule_ rule_hr"></div>';
|
|
@@ -516,8 +522,7 @@ $(function () {
|
|
|
//回到首页
|
|
|
window.location.href = "login.html";
|
|
|
});
|
|
|
+
|
|
|
+// var dele = http+'cku_suit/delete?token='+$.cookie('sku_access_token')+'&id=';
|
|
|
+// console.log(dele);
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|