cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>自定义组添加</title>
[#include "/business/pages/include/static.html" /]
 
<script type="text/javascript">
  $(document).ready(function() {
        $.formValidator.initConfig({formID:"myform",onError:function(msg){popupTips(msg)},onSuccess:function(){
            document.getElementById("myform").target = window.top.openDialog("0","操作",
                         {},
                         {"width":40,"height":40,"noclose":true},
                         [{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                         
                         
                         return true;
        }});
        
        $("#name").formValidator({empty: false,onFocus: "分组名称不能为空"}).inputValidator({min: 1,onError: "分组名称不能为空"});
        $("#userid").formValidator({empty: false,onFocus: "主要负责人不能为空"}).inputValidator({min: 1,onError: "主要负责人不能为空"});
            
    });
    
    
  </script>
</head>
 
<body class="personnel_allocation_body">
<form id="myform" action="" method="post">
<input type="hidden" name="customer_id" value='${RequestParameters.customer_id}'>
<table class="edit_layout">
<tr id="groupname"><th><label>分组名称:</label></th><td><input  type="text" name="name" id="name" value="${group.GROUP_NAME}" class="general"/></td></tr>
</table>
<table class="pab_con">
[#if users?? && users?size > 0]
   [#list users as role]
    <tr><th style="width:15%;">${role.name}</th><td>
        [#if role.dataList?? && role.dataList?size > 0]
           [#list role.dataList as user]
           <div class="pabitem"><input class="pos" type="checkbox" name="users" value="${role.id}_${user.ID}" [#if user.check == 1]checked[/#if]/><span>${user.ZSXM}</span></div>
           [/#list]
        [/#if]
    </td></tr>
   [/#list]
[/#if]
</table>
<table class="edit_layout">
    
     <tr>
         <th ><label>主负责人:</label></th>
         <td >
         <input class="general maintitle" type="text" id="main" name="main" style="width:170px;" [#if main.username??]value="${main.username}"[#else]value="从人员中选择主要负责人" [/#if]readonly/>
         <input  type="hidden" id="userid" name="userid" style="width:170px;" value="${main.userid}" />
         
         <div id="useridTip" style="display:inline-block;"></div>
         </td>
     </tr>
     <tr>
     <th ><label>人员:</label></th>
     <td>
     <div class="user" >
         [#if groupuser?? && groupuser?size > 0]
          [#list groupuser as user]
          <p style="float:left;margin-left:20px;margin-top:8px;"><input type="radio" class="ropos" name="mainuser" id="${user.userid}" value="${user.userid}" [#if user.IS_MASTER == 1]checked[/#if] /><span class="${user.userid}">${user.username}</span></p>
         [/#list]
        [/#if]
     </div>
     </td>
     </tr>
    </table>
    </form>
</body>
<script type="text/javascript">
$(function() {
    
    $('input.pos').live('click', function() {
         if($(this).is(":checked")){
           var id = $(this).val();
           var text = $(this).next("span").text();
           var selectid = $("#"+id).val();
           if($.util.isEmpty(selectid)){
                var html = "";
                html+='<p style="float:left;margin-left:20px;margin-top:8px;"><input type="radio" class="ropos" name="mainuser" id= "'+ id +'" value="'+ id +'"/><span class="'+ id +'">'+ text +'</span></p>  ';
                $(".user").append(html);
                var $user = $(":radio.ropos");
                if($user.length == 1){
                   $user.attr("checked",true);
                   $('#main').val($user.next("span").text());
                   $('#userid').val($user.val());
                 }
            }else{
               $(this).attr("checked",false);
               popupTips("此人已经选择");
            
            }
            
         }else{
            var checkid = $(this).val();
            var $temp = $('span.'+checkid).parent();
            var userId = $('#userid').val();
            if(!$.util.isEmpty(userId) && userId == checkid) {
                $('#userid').val("");
                $('#main').val("");
            }
            
            $temp.remove();
         }
            
            
    });
    $('input.ropos').live('click', function() {
               var id = $(this).val();
               var text = $(this).next("span").text();
               $('#main').val(text);
               $('#userid').val(id);
        });
    
    
})
    function radioAddClick() {
        $('input.ropos').live('click', function() {
               var id = $(this).val();
               var text = $(this).next("span").text();
               $('#main').val(text);
               $('#userid').val(id);
        });
    }
function onDialogBtnClick(btnID, dialogID, config){
    if(btnID == "btnSure"){
        var length = $(":checkbox:checked").length;
        if(length == 0) {
            popupTips("请选择人员");
        } else {
              $("#myform").submit();
        }
    }
}
</script>
</html>