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
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
<!doctype html>
<html class="no-js">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>增加/修改型号</title>
</head>
<body class="edit_txt_body">
[#include "/business/pages/include/static.html" /]
    <script type="text/javascript">
        //字段编码规则,字母数字下划线组成,且必须以字母开头
        regexEnum.COLUMN_CODE_REGEX="^[A-Za-z][A-Za-z_0-9]+$";
        $(document).ready(function () {
            $.formValidator.initConfig({formID:"myform",onError:function(msg){alert(msg)},onSuccess:function(){
                //验证最大值,最小值 或者 字符串格式
                var value = $("#datatype").val();
                if(value != 4 && value != 5 && value !=6 ){
                    var max = $.trim($("#maxvalues").val());
                    var min = $.trim($('#minvalues').val());
                    if(parseInt(min) >= parseInt(max)){
                        alert("最小值必须小于最大值");
                        return false;
                    }
                }
                [#if !info.ID??]
                if(!confirm("字段添加完成后,关键属性将不再允许修改,请谨慎操作!确定要进行吗?")) return false;
                [/#if]
 
                document.getElementById("myform").target = window.top.openDialog("1","操作",
                    {},
                    {"width":40,"height":40},[{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                return true;
            }});
           [#if info.ID??]
            var value = $("#datatype").val();
            if(value != 4 && value != 5 && value !=6 ){
                $('.validHtml').show();
            } else {
                $('.validHtml').hide();
            }
            if(value == 1 || value ==2 ){ $('.defaultHtml').show();} else { $('.defaultHtml').hide(); }
            if(value != 4 && value != 5 && value !=6){
                $("#minvalues").formValidator({empty:false,onShow:"不能为空",onFocus:"不能为空"})
                    .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                $("#maxvalues").formValidator({empty:false,onShow:"不能为空",onFocus:"不能为空"})
                    .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                if(value==1){
                    $("#default_val").formValidator({empty:true,onShow:"请输入正整数数字格式",onFocus:"请输入正整数数字格式"})
                        .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                }
            }else {
                $("#minvalues").unFormValidator(true);
                $("#maxvalues").unFormValidator(true);
                $("#default_val").unFormValidator(true);
            }
            document.getElementById("datatype").disabled = true;
            [/#if]
            $("#datatype").change(function(){
                //1:数字,5:多选
               var value = $(this).val();
                if(value != 4 && value != 5 && value !=6 ){ $('.validHtml').show();} else { $('.validHtml').hide(); }
                if(value == 1 || value ==2 ){ $('.defaultHtml').show();} else { $('.defaultHtml').hide(); }
                if(value != 4 && value != 5 && value !=6){
                    $("#minvalues").formValidator({empty:false,onShow:"不能为空",onFocus:"不能为空"})
                        .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                    $("#maxvalues").formValidator({empty:false,onShow:"不能为空",onFocus:"不能为空"})
                        .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                    if(value==1){
                    $("#default_val").formValidator({empty:true,onShow:"请输入正整数数字格式",onFocus:"请输入正整数数字格式"})
                        .regexValidator({regExp:"intege1", dataType:"enum", onError:"请输入正整数数字格式"});
                    }
                }else {
                    $("#minvalues").unFormValidator(true);
                    $("#maxvalues").unFormValidator(true);
                    $("#default_val").unFormValidator(true);
                }
            });
            $("#columnname").formValidator({empty:false,onShow:"字段名如:用户",onFocus:"字段名称不能为空!"})
            .inputValidator({min:1,max:20,onError:"字段名称长度为1-20个字符!"});
            [#if info.COLUMNCODE == ""]
            $("#columncode").formValidator({empty:false,onShow:"字母数字下划线组成,且必须以字母开头",onFocus:"字段编码不能为空,字母数字下划线组成,且必须以字母开头"})
                    .inputValidator({min:2,max:20,onError:"编码长度不能超过2-20个字符!"})
                    .regexValidator({regExp:"COLUMN_CODE_REGEX",dataType:"enum",onError:"编码格式不正确"})
            .ajaxValidator({
                dataType : "html",
                async : true,
                data:"id=${info.id}",
                url : "checkPropCode.html?groupId=${RequestParameters.groupId}",
                success : function(data){
                    if( data == 0 ) return true;
                    if( data == 1 ) return false;
                    return false;
                },
                buttons: $("#dosubmit"),
                error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据,可能服务器忙,请重试"+errorThrown);},
                onError : "该编码已存在,请更换",
                onWait : "正在对编码进行校验,请稍候..."
            });
            [#else]
            $("#columncode").formValidator({empty:false,onShow:"编码不允许修改!",onFocus:"编码不允许修改!"}).inputValidator({min:2,max:20,onCorrect:"123",onError:"分类编码不允许修改!"});
            [/#if]
            $("#inputtype").formValidator({empty:false,onShow:"请选择手工输入或列表选择",onFocus:"不能为空!"}).inputValidator({min:1,onError:"请选择手工输入或列表选择!"});
            $("#allownull").formValidator({empty:false,onShow:"请选择是或否",onFocus:"不能为空!"}).inputValidator({min:1,onError:"请选择是或否!"});
            /*$("#showinlist").formValidator({empty:false,onShow:"请选择是或否",onFocus:"不能为空!"}).inputValidator({min:1,onError:"请选择是或否!"});
            $("#allowquery").formValidator({empty:false,onShow:"请选择是或否",onFocus:"不能为空!"}).inputValidator({min:1,onError:"请选择是或否!"});*/
            [#if info.id??]
            $("#datatype").formValidator({empty:false,onShow:"不可修改",onFocus:"不可修改!"});
            [#else]
            $("#datatype").formValidator({empty:false,onShow:"请选择数据类型",onFocus:"数据类型不能为空,提交后不可修改!"}).inputValidator({min:1,onError:"请选择数据类型,提交后不可修改!"});
            [/#if]
            $("#serial").formValidator({empty:false,onShow:"请输入顺序号",onFocus:"请输入顺序号"}).inputValidator({min:1,max:5,onError:"顺序号必须为1到5位正整数数字"})
            .regexValidator({regExp:"intege1", dataType:"enum", onError:"顺序号必须为1到5位正整数数字"});
        });
    </script>
 
<div class="edit_txt">
    <form action="editCommonProp.html" method="post" id="myform" name="myform" >
        <input type="hidden" name="group_id" value="${RequestParameters.groupId}"/>
        <input type="hidden" name="id" value="${RequestParameters.id}"/>
        <table align="center" width="98%" class="edit_layout2">
            <tr>
                <th  align="right"><label class="required" >字段名称:</label></th>
                <td><input type="text" class="general" value="${info.columnname}" name="columnname" id="columnname"/>
                    <div id="columnnameTip" style="display:inline-block;"></div>
                </td>
             </tr>
            <tr>
                <th align="right"><label class="required" >字段编码:</label></th>
                <td><input [#if info.ID??] disabled="disabled" [/#if]type="text" value="${info.COLUMNCODE}" class="general" name="columncode"
                           id="columncode"/>
                     <div id="columncodeTip" style="display:inline-block;"></div>
                </td>
 
            </tr>
            <tr>
                <th align="right"><label class="required" >输入类型:</label></th>
                <td>
                    [@select id="inputtype" value=info.inputtype source=Constants.PROP_INPUTTYPE_MAP/]
                    <div id="inputtypeTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th align="right"><label class="required" >是否为空:</label></th>
                <td>
                    [@select id="allownull" value=info.allownull source=Constants.PROP_ALLOWNULL_MAP /]
                    <div id="allownullTip" style="display:inline-block;"></div>
                </td>
            </tr>
           <!-- <tr>
                <th align="right"><label class="required" >是否列表显示:</label></th>
                <td>
                    [@select id="showinlist" value=info.showinlist source=Constants.PROP_SHOWINLIST_MAP/]
                    <div id="showinlistTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th align="right"><label class="required" >是否查询条件:</label></th>
                <td>
                    [@select id="allowquery" value=info.allowquery source=Constants.PROP_ALLOWQUERY_MAP/]
                   <div id="allowqueryTip" style="display:inline-block;"></div>
                </td>
            </tr>-->
            <tr id="datatypeTr">
                <th align="right"><label class="required" >数据类型:</label></th>
                <td>
                    [@select id="datatype" value=info.datatype source=Constants.PROP_TYPE_MAP/]
                    <div id="datatypeTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th align="right"><label class="required" >顺序号:</label></th>
                <td ><input type="text" value="${info.serial}" class="general" name="serial"
                           id="serial"/>
                     <div id="serialTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr class="validHtml" style="display:none;">
                <th align="right"><label class="required" >最小值:</label></th>
                <td>
                    <input type="text" value="${info.minvalues}" class="general" name="minvalues" id="minvalues"></input>
                    <div id="minvaluesTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr class="validHtml" style="display:none;">
                <th align="right"><label class="required" >最大值:</label></th>
                <td><input type="text" value="${info.maxvalues}" class="general" name="maxvalues" id="maxvalues"></input>
                     <div id="maxvaluesTip" style="display:inline-block;"></div>
            </tr>
            <tr class="defaultHtml" style="display:none;">
                <th  align="right"><label>默认值:</label></th>
                <td><input type="text" class="general" value="${info.default_val}" name="default_val" id="default_val"/>
                    <div id="default_valTip" style="display:inline-block;"></div>
                </td>
             </tr>
            <tr>
                <th align="right"><label>输入时提醒:</label></th>
                <td ><input type="text" style="width:60%" class="general" value="${info.alert}" name="alert" id="alert"/>
                    <div id="alertTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th align="right"><label >备注:</label></th>
                <td ><textarea class="general" rows="3" cols="20" style="width: 80%" name="note"
                           id="note">${info.note}</textarea>
                </td>
            </tr>
        </table>
    </form>
</div>
 
<script type="text/javascript">
function onDialogBtnClick(btnID, dialogID, config){
    if(btnID == "btnSure"){
        $("#myform").submit();
    }
}
</script>
</body>
</html>