diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 90087fd23..bb6d22712 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -481,10 +481,10 @@ class StatementMangementController extends ThinkController } if ($accounts) { - foreach ($accounts as $index => $account) { - - if (checkAccount($user_types[$index],$account)==1) { + if (trim($account) == '') { + unset($accounts[$index]); + } else if (checkAccount($user_types[$index],$account)==1) { $data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]); } else { return $this->error('账号'.$account.'不存在,请重新输入'); diff --git a/Application/Admin/View/StatementMangement/rewardManageSave.html b/Application/Admin/View/StatementMangement/rewardManageSave.html index 37c30839b..467dad5ef 100644 --- a/Application/Admin/View/StatementMangement/rewardManageSave.html +++ b/Application/Admin/View/StatementMangement/rewardManageSave.html @@ -81,7 +81,7 @@ *类型: - @@ -91,7 +91,7 @@ *公司类型: - $type):?> @@ -102,7 +102,7 @@ *公司/部门: - @@ -117,7 +117,7 @@ *会长账号: - @@ -132,7 +132,7 @@ *结算方式: - $type):?> @@ -264,7 +264,7 @@
  • - @@ -276,7 +276,7 @@
  • - @@ -379,9 +379,7 @@ content: $('#pop-form'), zIndex: 1, end : function(){ - $('#item-form')[0].reset() // 重置数据 - $('#form-company-name').attr('readonly', false); - $('#form-promote-account-input').attr('readonly', false); + resetPopForm(); } }); } @@ -432,11 +430,50 @@ data['promote_account'] = $("#form-promote-account").val(); } + if (data['amount'] == '0') { + layer.msg('请填写金额'); + return false; + } + + if (data['company_id'] == '0' && data['company_name'] == '') { + layer.msg('请选择或者填写公司/部门'); + return false; + } + + if (data['promote_account'] == '') { + layer.msg('请选择或者填写会长账号'); + return false; + } + + var flag = false; + + // 判断相反的是否已经存在该公司节点 + $('.reward-data-info,.punish-data-info').each(function(){ + var node_info = $(this).find('.info').val(); + if (node_info) { + var otherData = JSON.parse(node_info); + // console.log(otherData) + // console.log((data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) ); + // console.log(data['company_type'] == otherData['company_type'] ); + // 判断对立面是否有相同的公司或者部门 + if ((data['company_type'] == otherData['company_type']) + && (data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) ) { + //console.log('已有相此公司的奖罚,请检查') + layer.closeAll(); + layer.msg('已有此公司的奖罚,请检查'); + flag = true; + } + } + }); + + if (flag) { + return false; + } + var type_dec = data['type'] == 1 ? 'reward' : 'punish'; // 找到空闲的节点,如果没有,则创建一行 var emptyNode = $('.table-body tr,.empty-'+type_dec+':first'); if (emptyNode.length == 0) { - console.log(emptyNode.length) var newNodeHtml = ` @@ -483,12 +520,23 @@ }); $(emptyNode).removeClass('empty-'+type_dec); countAmount(); - $('#item-form')[0].reset() - $('#form-company-name').attr('readonly', false); - $('#form-promote-account-input').attr('readonly', false); + resetPopForm(); layer.closeAll(); }); + function resetPopForm() + { + $('#item-form')[0].reset() // 重置数据 + $('.form-pop-select').select2(); + companyTypeChange(); + $('#form-company-name').attr('readonly', false); + $('#form-promote-account-input').attr('readonly', false); + var promoteData = ""; + $("#form-promote-account").empty(); + $('#form-promote-account').html(promoteData); + $("#form-promote-account").select2(); + } + // 全部总金额重算 function countAmount() {