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
[#include "/component/DatePicker.html" /]
[#include "/component/newsel.html" /]
[#macro prop source=[] groupid=""]
[#assign col_index=0/]
[#assign col_span=1/]
[#list source as item]
    [#if col_index%4==0]
    <tr>
    [/#if]
        <th><label [#if item.ALLOWNULL==2] class="required"[/#if]>${item.COLUMNNAME}:</label></th>
        [#if item.DATATYPE==3||item.DATATYPE==6]
            [#assign col_index=col_index+4/]
            [#assign col_span=3/]
        [#elseif item_has_next]
            [#if source[item_index+1].DATATYPE==3||source[item_index+1].DATATYPE==6]
                [#assign col_index=col_index+(4-col_index%4)/]
                [#assign col_span=(3-col_index%4)/]
            [#else]
                [#assign col_index=col_index+2/]
                [#assign col_span=1/]
            [/#if]
        [#elseif !item_has_next]
            [#assign col_index=col_index+(4-col_index%4)/]
            [#if col_index%4==0]
                [#assign col_span=1/]
            [#else]
                [#assign col_span=(3-col_index%4)/]
            [/#if]
 
        [/#if]
        <td colspan="${col_span}">
            [#if item.datatype==1 || item.datatype==2]
            <input class="general" type="text" name="p_${item.ID}" id="p_${item.ID}" value="${item.default_val}"/>
            [#elseif item.datatype==4]
                [@datepicker id="p_"+item.ID name="p_"+item.ID class="general" value="${item.default_val}" /]
            [#elseif item.datatype==5]
                [@sel id="p_"+item.ID name="p_"+item.ID labelName="p_"+item.ID+"_text" source=item.items textField="ID" valueField="ITEMVALUE" value="${item.default_val}" /]
            [#elseif item.datatype==6]
                <input type="hidden" class="audit" value="${c.ID}" name="p_${item.ID}_text"  id="p_${item.ID}_text" />
                  [#list item.items as c]
                  [#assign def_val = item.default_val/]
                      <input type="checkbox" class="audit" value="${c.ID}" name="p_${item.ID}" onchange="changeCheckBox('p_${item.ID}')"
                      [#if def_val??&&def_val!="" ]
                      [#if def_val?index_of(c.ID)!=-1]
                          checked
                      [/#if]
                      [/#if]
            />
                      <span>${c.ITEMVALUE}</span>
                  [/#list]
              [#elseif item.datatype==3]
                  <textarea class="general" name="p_${item.ID}" id="p_${item.ID}">${item.default_val}</textarea>
            [/#if]
            <div id="p_${item.ID}Tip" style="display:inline-block;"></div>
        </td>
    [#if col_index%4==0]
    </tr>
    [/#if]
[/#list]
<script type="text/javascript">
$(document).ready(function() {
[#list source as d]
[#--if d.ALLOWNULL==2--]
    [#if d.DATATYPE==6]
        $(":checkbox[name='p_${d.ID}']").formValidator({tipID:"p_${d.ID}Tip",empty:${K_IfTrue(d.ALLOWNULL==1,'true','false')},onFocus:"${d.ALERT}",onShow:"${d.ALERT}"}).inputValidator({min:1,onError:"${d.COLUMNNAME}为空或不存在,请重新选择!"});
    [#elseif d.DATATYPE==5]
        $("#p_${d.ID}").formValidator({empty:${K_IfTrue(d.ALLOWNULL==1,'true','false')},onFocus:"${d.ALERT}",onShow:"${d.ALERT}"}).inputValidator({min:1,max:320,onError:"${d.COLUMNNAME}为空或不存在,请重新选择!"});
    [#else ]
        $("#p_${d.ID}").formValidator({empty:${K_IfTrue(d.ALLOWNULL==1,'true','false')},onFocus:"${d.ALERT}",onShow:"${d.ALERT}"}).inputValidator({${K_IfEmpty(d.MINVALUES,'','min:${d.MINVALUES},')}${K_IfEmpty(d.MAXVALUES,'','max:${d.MAXVALUES},')}${K_IfTrue(d.DATATYPE==1 ,'type:"value",','')}onError:"最小值为${d.MINVALUES},最大值为${d.MAXVALUES}"})[#if d.DATATYPE==1].regexValidator({regExp:"num", dataType:"enum", onError:"【${d.COLUMNNAME}】必须数字"});[#else];[/#if]
    [/#if]
[#--/#if--]
[/#list]
})
 
function changeCheckBox(checkbox_name){
    var checkbox_text = "";
    $(":checkbox:checked").each(function(i){
        checkbox_text += (checkbox_text?",":"") + $(this).next("span").text();
    })
    $("#"+checkbox_name + "_text").val(checkbox_text);
}
</script>
[/#macro]