cy
2022-06-23 b83c40548208609d0d6826be13d742c28a784806
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>修改</title>
 
[#include "/business/pages/include/static.html" /]
<style type="text/css">
    html{_overflow-y:scroll}
</style>
 <script type="text/javascript">
    var templateId = '${templateId}';
    var sjbh = '${infofather.categoryid}';
    $(document).ready(function() {
    $.formValidator.initConfig({formID:"myform",onError:function(msg){alert(msg)},onSuccess:function(){
        document.getElementById("myform").target = window.top.openDialog("1","操作",
                         {},
                         {"width":40,"height":40,"noclose":true},[{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                         return true;
    }});
    
//     $("input[name=template_weight]").change(function() {
//        var value = $(this).val();
//        if($.util.isNumber(value)){
//         if(!/(^[0-9]{1,3}$)|(^[0-9]{1,2}[\.]{1}[0-9]{1,2}$)/.test(value)){
//             popupTips("权重为小于等于100且小数不能超过两位的正数");
//             if(value<0){
//                 $(this).val(0);
//             }else{
//                  value = Math.round(value);
//                   $(this).val(value);
//             }
//         }else{
//             if(value>100){
//                 popupTips("权重为小于等于100且小数不能超过两位的正数");
//                 $(this).val(100);
//             }
//         }
//        }else{
//            popupTips("权重为小于等于100且小数不能超过两位的正数");
//           $(this).val(0);
//        }
    
//     });
    $("input[name=ordernum]").change(function() {
       var value = $(this).val();
       if($.util.isNumber(value)){
          value = Math.round(value);
          $(this).val(value);
       }else{
          $(this).val(0);
       }
    
    });
    
    $("input[name=check]").click(function() {
       var qxindex = $(this).attr("id").substr(5);
       var id = $("#id"+qxindex).val();
       if(!$(this).attr("checked")){
          $("#zh"+qxindex).val("");
          $("#delid"+qxindex).val(id);
       }else{
          $("#delid"+qxindex).val("");
          $("#zh"+qxindex).val($("#item_name"+qxindex).val()+"-"+$("#template_weight"+qxindex).val()+"-"+$("#ordernum"+qxindex).val()+"-"+$("#item_note"+qxindex).val());
       }
       });
});
function onDialogBtnClick(btnID, dialogID, config){
  if(btnID == "btnSure"){
  var e=true;
  $("input[name=template_weight]").each(function() {
       var value = $(this).val();
       if(value!=""){
           if($.util.isNumber(value)){
        if(!/(^[0-9]{1,3}$)|(^[0-9]{1,2}[\.]{1}[0-9]{1,2}$)/.test(value)){
            e=false;
        }else{
            if(value>100){
                e=false;
            }
        }
       }else{
          e=false;
       }
       }
    
    });
  if(!e) {
         popupTips("权重为小于等于100且小数不能超过两位的正数");
         return;
     }
  
  
  $("input[name=check]").parent().parent().css("background-color","");
  var a= false;
  var b = false;
  var c = false;
  var d = false;
  var quanz = 0;
    var $items = $("input:checked");
     $items.each(function() {
     var index = $(this).attr("id").substr(5,1);
         if($.util.isEmpty($.util.trim($("#item_name"+index).val()))||$.util.isEmpty($("#template_weight"+index).val())
           ||$.util.isEmpty($.util.trim($("#ordernum"+index).val()))) {
             b = true;
             $(this).parent().parent().css("background-color","#ccc");
             return;
         }
         var str=$("#item_name"+index).val();
         $("#item_name"+index).val(str.replace('-',""))
         if(!$.util.isNumber($.util.trim($("#ordernum"+index).val()))||!$.util.isNumber($("#template_weight"+index).val())){
              a = true;
             $(this).parent().parent().css("background-color","#ccc");
             return;
         }
         if($.util.trim($("#ordernum"+index).val()) ==0 ){
              c = true;
             $(this).parent().parent().css("background-color","#ccc");
             return;
         }
         if($.util.trim($("#item_name"+index).val()).length > 32){
             d = true;
             $(this).parent().parent().css("background-color","#ccc");
             return;
         }
         var zhvalues = $("#item_name"+index).val() + "-" + $("#template_weight"+index).val() + "-" + $("#ordernum"+index).val() + "-" +$("#item_note"+index).val(); 
         $("#zh"+index).val(zhvalues);
         var squan = parseFloat($("#template_weight"+index).val());
         quanz = parseFloat(quanz) + parseFloat(squan) ;
     });
       if(b) {
         popupTips("有未填写的指标项内容");
         return;
     }
     if(c) {
         popupTips("顺序号应为正数字");
         return;
     }
     if(d) {
         popupTips("名称超出最大限度");
         return;
     }
      if(a) {
         popupTips("指标项权重和顺序号应为整数");
         return;
     }else{
        if(quanz != 100){
           popupTips("指标项权重应为整数,权重之和不等于100");
            return;
        }
     }
     
     
    $("#myform").submit();
   }
}
    </script>
  </head>
  <body>
   <div class="pad_10" style="margin-top: 10px;">
<div class="col-tab">
<div id="div_setting_1" class="contentList pad_10" >
  <form method="post" action="" id="myform" name="myform" >
  <input type="hidden" name="cateId" value="${infofather.categoryid}" />
  <input type="hidden" name="categoryid" id="categoryid" value="${infofather.categoryid}" />
  <input type="hidden" name="item_level" id="item_level" value="${infofather.item_level}" />
  <table align="center"   width="98%" class="edit_layout">
  [#if items?? && items?size > 0]
  [#list items as item]
    <tr>
          <th style="text-align:center;width:6%;"><input type="checkbox" class="input-text" name="check" checked id="check${item_index+1}" />
           <input  type="hidden" class="input-text" name="id" id="id${item_index+1}" value="${item.ID}"/>
           <input  type="hidden" class="input-text" name="delid" id="delid${item_index+1}" value=""/>
          <input  type="hidden" class="input-text" name="zh" value="${item.ITEM_NAME}-${item.TEMPLATE_WEIGHT}-${item.ORDERNUM}-${item.ITEM_NOTE}" id="zh${item_index+1}" />
          </th>
          <th>名称:</th>
          <td><input style="width:100px;" type="text" class="general" value="${item.ITEM_NAME}" name="item_name"  id="item_name${item_index+1}" />
          </td>
           <th>权重:</th>
          <td><input style="width:50px;" type="text" class="general" value="${item.TEMPLATE_WEIGHT}" name="template_weight" id="template_weight${item_index+1}" />
          </td>
           <th align="center" width="10%">顺序号:</th>
          <td><input style="width:50px;" type="text" class="general" value="${item.ORDERNUM}" name="ordernum" id="ordernum${item_index+1}"/>
          </td>
           <th>说明:</th>
          <td><input style="width:300px;" type="text" class="general" value="${item.ITEM_NOTE}" name="item_note" id="item_note${item_index+1}"/>
          </td>
    </tr>
    [/#list]
    [/#if]
    [#if kongList?? && kongList?size > 0]
    [#list kongList as kong]
    <tr>
          <th style="text-align:center;"><input  type="checkbox" class="input-text" name="check" id="check${kong}" />
          <input  type="hidden" class="input-text" name="zh" id="zh${kong}" />
          <input  type="hidden" class="input-text" name="id" id="id${kong}" />
          </th>
           <th>名称:</th>
          <td><input style="width:100px;" type="text" class="general" name="item_name" id="item_name${kong}" />
          </td>
           <th>权重:</th>
          <td><input style="width:50px;" type="text" class="general"  name="template_weight" id="template_weight${kong}" />
          </td>
           <th >顺序号:</th>
          <td><input style="width:50px;" type="text" class="general"  name="ordernum" id="ordernum${kong}" />
          </td>
           <th>说明:</th>
          <td><input style="width:300px;" type="text" class="general"  name="item_note" id="item_note${kong}"/>
          </td>
    </tr>
    [/#list]
    [/#if]
    
  </table>
  </form>
    </div>
</div>
</div>
  </body>
</html>