function jseOA_EditInputOrModifyControl() {
}
var selIndex = null; /*定义选中的一行的下标*/
var _source = null;
var url = location.search;
window.onload = function() {
    try {
        if (App.query("sqlType") == "access") {
            document.getElementById("LiDataSource").style.display = "none";
        }
        jseOA_EditInputOrModifyControl.setControlValue();
        var inputJs = document.createElement("script");
        var _head = document.getElementsByTagName("head");
        var sheet = App.query("sheetList");
        if (sheet != undefined) {
            document.getElementById("txtIdentity").disabled = false;
            document.getElementById("spParam").style.display = "none";
            document.getElementById("selPara").style.display = "none";
            document.getElementById("changeField").style.display = "";
            jseOA_EditInputOrModifyControl.selGetField(); /*参数：sheetList，tableName表名，showText标题，type*/

            document.getElementById('changeField').onclick = function() {

                var txtField = document.getElementById("txtIdentity");
                var selField = document.getElementById("selField");
                if (txtField.style.display == "none") {
                    txtField.style.display = "";
                    selField.style.display = "none";
                } else {
                    selField.style.display = "";
                    txtField.style.display = "none";
                }
            }
        }
        if (App.query("type") == "AddControl") {
            inputJs.src = "eOA_EditInputControl.js";
            inputJs.type = "text/javascript";
            _head[0].appendChild(inputJs);
            jseOA_EditInputOrModifyControl.showControlModule('1');
            var _title = document.getElementById('txtTitle');
            if (App.query("showText") != undefined) {
                _title.value = App.query("showText");
            }
            _title = null;
        } else if (App.query("type") == "EditControl") {
            inputJs.src = "eOA_EditModifyControl.js";
            inputJs.type = "text/javascript";
            _head[0].appendChild(inputJs);
            var insertSource =  eval(unescape(App.query("insertSource")));
            if (insertSource != null) {
                _source = $.parseJSON(unescape(insertSource.dataSource));
            } else {
                _source = $.parseJSON(ShowWindow.opener.document(App.query("formIdx")).getElementById("divQueryMode").queryData);
            }
            if (_source.type == "yyyy" || _source.type == "MM" || _source.type == "dd" || _source.type == "yyyy-MM" || _source.type == "MM-dd" || _source.type == "dd hh:mm:ss" || _source.type == "hh:mm:ss" || _source.type == "hh:mm" || _source.type == "hh" || _source.type == "mm") {
                _source.format = "dateTime";
            }
            jseOA_EditInputOrModifyControl.setContorlForEdit();
            CreateTree();
            //            var isEndTime = document.getElementById("isEndTime");
            //            jseOA_EditInputOrModifyControl.showPara(isEndTime);

        }
        document.getElementById('btnSetData').onclick = function() {
            var getForm = ShowWindow.getFormIdx();
            ShowWindow.OpenItemForm('Application/CMB/DataBase/DataSourceManage/html/frmDataBaseList.htm?getIndexForm=' + getForm, "选择数据源", 625, 503, 1);
            CollectGarbage();
        }
    } catch (e) {
        alert("Error for onload:" + e.message);
    }
}

jseOA_EditInputOrModifyControl.selGetField = function() {
    var sqlTxt = "";
    var obj = null;
    var selField = document.getElementById("selField");
    if (App.query("sqlType") != "access") {
        sqlTxt = "eOA_CMB_GetTableStruct " + App.query("tableName");
        obj = DBReader.selectSql(sqlTxt);
        if (DBReader.DObjectIsNull(obj) == false) {
            var rowCount = parseInt(obj.RecordCount);
            if (typeof (rowCount) == "number" && rowCount > 0) {
                obj.MoveFirst();
                var i = rowCount - 1;
                for (i; i >= 0; i--) {
                    var newItem = new Option(obj.Fields("Column_name").Value, obj.Fields("Column_name").Value);
                    selField.options.add(newItem);
                    newItem = null;
                    obj.MoveNext();
                }
                i = null;
            }
            rowCount = null;
        }
    } else {
        var tableName = App.query("tableName");
        if (tableName.indexOf("|") != -1) {
            var tableArray = tableName.split("|");
            sqlTxt = "select " + tableArray[1] + " from " + tableArray[0];
            try {
                obj = DBReader.selectSqlForJson(sqlTxt);
                obj = $.parseJSON("{" + obj + "}");
                if (obj.table != undefined) {
                    var _table = obj.table;
                    var rowCount = _table.length;
                    if (rowCount > 0) {
                        var i = rowCount - 1;
                        for (var i = 0; i < rowCount; i++) {
                            var newItem = new Option(_table[i][tableArray[1]], _table[i][tableArray[1]]);
                            selField.options.add(newItem);
                            newItem = null;
                        }
                    }
                    rowCount = null;
                }
                tableArray = null;
                _table = null;
            } catch (e) {
                alert(e.message);
            }
        } else {
            sqlTxt = "select * from " + App.query("tableName") + " where 1=2";
            try {
                obj = DBReader.selectSqlForJson(sqlTxt);
                obj = $.parseJSON("{" + obj + "}");
                if (obj.col != undefined) {
                    var col = obj.col;
                    var rowCount = col.length;
                    if (rowCount > 0) {
                        var i = rowCount - 1;
                        for (var i = 0; i < rowCount; i++) {
                            var newItem = new Option(col[i].FieldName, col[i].FieldName);
                            selField.options.add(newItem);
                            newItem = null;
                        }
                    }
                    rowCount = null;
                }
            } catch (e) {
                alert(e.message);
            }
        }
    }
    sqlTxt = null;
    DBReader.Dispose(obj);
    CollectGarbage();
}

jseOA_EditInputOrModifyControl.setContorlForEdit = function() {
    var type = _source.type;
    var format = _source.format;
    var selFormat = document.getElementById('selFormat');
    var selPara = document.getElementById("selPara");
    var dataText = document.getElementById("dataText");
    var dataType = _source.dataType;
    if (format == "text") {
        selFormat.value = "1";
    } else if (format == "dateTime") {
        selFormat.value = "2";
    } else if (format == "decimal") {
        selFormat.value = "3";
    } else if (format == "telphone") {
        selFormat.value = "4";
    } else if (format == "web") {
        selFormat.value = "5";
    }
    changeFormat(selFormat.value);
    if (dataType == "process") {
        var _sql = document.getElementById('txtSql');
        _sql.value = unescape(_source.process);
        document.getElementById('txtBindingName').value = _source.selSource[0].name;
        document.getElementById('txtBindingValue').value = _source.selSource[0].value;
    }
    dataText.value = type;
    selPara.value = _source.parameter;
    selFormat = null;
    dataText = null;
    type = null;
    format = null;
    selPara = null;
    CollectGarbage();
}
/*绑定参数选择下拉控件*/
jseOA_EditInputOrModifyControl.setControlValue = function() {
    var selPara = document.getElementById("selPara");
    var selPara2 = document.getElementById("selPara2");
    var dataViewID = App.query("currentDataViewID");
    //    var sqlText = "exec eOA_Sys_Select 'eOA_cmbDataSource','Name,SQLContent,SqlType,ProcessName,ProcessParam','AND ID=" + dataViewID + "'";
    var sqlText = "exec eOA_Sys_Select 'eOA_cmbDataSoureParameter','Parameter,IsQuery','AND DataSourceID=" + dataViewID + "'";
    var str = "";
    try {
        var obj = DBReader.selectSql(sqlText);
        if (obj != null && obj != undefined) {
            var rowCount = parseInt(obj.RecordCount);
            if (typeof (obj) == "object" && rowCount > 0) {
                obj.MoveFirst();
                for (var i = 0; i < rowCount; i++) {
                    if (obj.Fields('IsQuery').Value == 1) {
                        var newItem = new Option(obj.Fields('Parameter').Value, obj.Fields('Parameter').Value);
                        var newItem2 = new Option(obj.Fields('Parameter').Value, obj.Fields('Parameter').Value);
                        selPara.options.add(newItem);
                        selPara2.options.add(newItem2);
                        newItem = null;
                        newItem2 = null;
                    }
                    obj.MoveNext();
                }
                CollectGarbage();
            }
        }
    } catch (e) {
        alert("ERROR for setControlValue:" + e.message);
    }
    DBReader.Dispose(obj);
    var txtIdentity = document.getElementById("txtIdentity");
    if (App.query("fieldName") != undefined) {
        txtIdentity.value = App.query("fieldName");
    }
    txtIdentity = null;
    CollectGarbage();
}

/*确定*/
jseOA_EditInputOrModifyControl.saveContorl = function() {
    var isSave = false;
    var _format = document.getElementById("selFormat").value;
    if (_format != "0") {
        var url = location.search;
        var sheet = App.query("sheetList");
        var _identity = document.getElementById('txtIdentity').value;
        if (sheet != undefined) {
            var txtField = document.getElementById("txtIdentity");
            var selField = document.getElementById("selField");
            if (txtField.style.display == "none") {
                _identity = selField.value;
            } else {
                _identity = txtField.value;
            }
        }
        var _type = "";
        switch (_format) {
            case "1": { _format = "text"; _type = document.getElementById('dataText').value; } break;
            case "2": { _format = "dateTime"; _type = document.getElementById('dataTime').value; } break;
            case "3": { _format = "decimal"; _type = document.getElementById('dataNumeric').value; } break;
            case "4": { _format = "telphone"; _type = "telphone"; } break;
            case "5": { _format = "web"; _type = "web"; } break;
        }
        if (_type != null && _type != undefined) { isSave = true; }
        if (isSave) {
            var _title = document.getElementById('txtTitle').value;
            var _selPara = document.getElementById('selPara').value;
            var _selParaEnd = document.getElementById('selPara2').value;
            if (_selPara == "") {
                _selPara = "@" + _identity;
            }
            if (_selParaEnd == "") {
                _selPara = "@" + _identity + "End";
            }
            if (_type == "text" || _type == "textarea") {
                var str = '{"type":"' + _type + '","title":"' + _title + '","parameter":"' + _selPara + '","identity":"' + _identity + '","format":"' + _format + '","dataType":"sql"';
                switch (_type) {
                    case "text":

                        str += ',"content":"' + escape("<input  type='text'  Field='" + _identity + "' format='varchar(50)' class='ipt' />") + '"';
                        break;

                    case "textarea":
                        str += ',"content":"' + escape("<textarea  type='textarea' cols='50' rows='5' Field='" + _identity + "' style='width:90%;height:100px;' format='varchar(500)' class='multxt'></textarea>") + '"';
                        break;
                }
                str += "}";
                if (App.query("action") == undefined) {
                    ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')");
                } else {
                    ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace('@str', escape(str)));
                }
                ShowWindow.close();
            } else if (_type == "select" || _type == "radio" || _type == "checkbox") {
                var sel = document.getElementById("treeSel");
                jseOA_EditInputOrModifyControl.getSelect(sel);
                var controlName = "";
                if (App.query("controlName") != undefined) {
                    controlName = _type + App.query("controlName");
                }
                var str = '{"type":"' + _type + '","title":"' + _title + '","parameter":"' + _selPara + '","identity":"' + _identity + '","format":"' + _format + '","selSource":[';
                var controlSource = "";
                if ($("#rdoModule").attr("checked")) {
                    var ilength = sel.options.length;
                    if (ilength > 0) {
                        for (var i = 0; i < ilength; i++) {
                            if (i == 0 && _type == "select") {
                                controlSource = "<select type='select' Field='" + _identity + "' format='varchar(50)' dataType='sql'   SelValueMode='Text' >";
                            }
                            if (_type == "radio" || _type == "checkbox") {
                                controlSource += "<input name='" + controlName + "' Field='" + _identity + "' format='varchar(50)' type='" + _type + "'  value='" + sel[i].value + "'  dataType='sql' SelValueMode='Text'";
                                if (i == 0) {
                                    controlSource += "checked ='checked'";
                                }
                                controlSource += "/><span>" + sel[i].text + "</span>"
                            } else if (_type == "select") {
                                controlSource += "<option value='" + sel[i].value + "'>" + sel[i].text + "</option>";
                            }
                            str += '{"name":"' + sel[i].text + '","value":"' + sel[i].value + '"},';
                        }
                        str = str.substring(0, str.length - 1) + ']';
                    } else {
                        str += ']';
                    }
                    if ((ilength - 1) > 0 && _type == "select") {
                        controlSource += "</select>";
                    }
                    str += ',"content":"' + escape(controlSource) + '","dataType":"sql"}';
                    if (App.query("action") == undefined) {
                        ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')");
                    } else {
                        ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace('@str', escape(str)));
                    }
                    ShowWindow.close();
                    sel = null;
                    controlSource = null;
                    ilength = null;
                    i = null;
                } else {
                    try {
                        var _sql = document.getElementById('txtSql');
                        var sqlTxt = escape(_sql.value);
                        var txtName = $.trim(document.getElementById('txtBindingName').value);
                        var txtValue = $.trim(document.getElementById('txtBindingValue').value);

                        str += '{"name":"' + txtName + '","value":"' + txtValue + '"}],"dataType":"process","process":"' + sqlTxt + '"}';
                        if (App.query("action") == undefined) {
                            ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')");
                        } else {
                            ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace('@str', escape(str)));
                        }
                        txtName = null;
                        txtValue = null;
                        _sql = null;
                        sqlTxt = null;
                        ShowWindow.close();
                    } catch (e) {
                        alert("Error for getSource(DataSource):" + e.message);
                    }
                }
                str = null;
            } else if (_type == "yyyy-MM-dd" || _type == "yyyy" || _type == "MM" || _type == "dd" || _type == "yyyy-MM-dd hh:mm:ss" || _type == "yyyy-MM" || _type == "MM-dd" || _type == "dd hh:mm:ss" || _type == "hh:mm:ss" || _type == "hh:mm" || _type == "hh" || _type == "mm" || _type == "integer" || _type == "decimal") {
                if (!(_type == "yyyy-MM-dd" || _type == "integer" || _type == "decimal" || _type == "yyyy-MM-dd hh:mm:ss")) {
                    _format = "text";
                }
                var str = '{"type":"' + _type + '","title":"' + _title + '","parameter":"' + _selPara + '","identity":"' + _identity + '","format":"' + _format + '"';
                var isEndTime = document.getElementById("isEndTime");
                var isSecond = (_type == "yyyy-MM-dd" ? "" : "dateFmt:'yyyy-MM-dd HH:mm:ss',");
                var today = new Date();
                var controlSource = "";
                if (isEndTime.checked) {
                    //                    if (_selParaEnd == _selPara) {
                    //                        alert("操作错误，参数不能与结束时间参数相同！");
                    //                        return;
                    //                    } else {
                    controlSource = "<table Field='" + _identity + "' format='datetime'id='dateTb" + today.getTime() + "' class='tbTime'><tr><td><input type='text' id='date" + today.getTime() + "' Field='" + _identity + "' class='Wdate' maxlength='30' onclick=\"WdatePicker({" + isSecond + " maxDate:'#F{$dp.$D(\\\'date" + (parseInt(today.getTime()) + 1) + "\\\')}'});\"/></tr></td><tr><td><input type='text' id='date" + (parseInt(today.getTime()) + 1) + "' Field='" + _identity + "' class='Wdate' maxlength='30' onclick=\"WdatePicker({" + isSecond + "minDate:'#F{$dp.$D(\\\'date" + today.getTime() + "\\\')}'});\"/></tr></td></table>";
                    str += ',"isEndTime":true,"parameterEnd":"' + _selParaEnd + '"';
                    //                    }
                } else {
                    str += ',"isEndTime":false';
                    controlSource = "<input type='text' class='Wdate' Field='" + _identity + "' format='datetime' maxlength='30' onclick= \"WdatePicker({" + isSecond + "maxDate:'2099-10-01'})\"/>";
                }
                if (_type == "yyyy") {
                    controlSource = "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1900; i < 2099; i++) {
                        controlSource += "<option value=" + i + ">" + i + "</option>";
                    }
                    controlSource += '</select>';
                } else if (_type == "MM") {
                    controlSource = "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 13; i++) {
                        controlSource += "<option value=" + i + ">" + i + "</option>";
                    }
                    controlSource += '</select>';
                }
                else if (_type == "yyyy-MM") {
                    controlSource = "<div Field='" + _identity + "' datetype='" + _type + "'  format='datetime'><select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1900; i < 2099; i++) {
                        controlSource += "<option value=" + i + ">" + i + "</option>";
                    }
                    controlSource += '</select> - ';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 13; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select></div>';
                }
                else if (_type == "MM-dd") {
                    controlSource = "<div Field='" + _identity + "' datetype='" + _type + "'   format='datetime'><select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 13; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> - ';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 32; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select></div>';
                }
                else if (_type == "dd hh:mm:ss") {
                    controlSource = "<div Field='" + _identity + "' datetype='" + _type + "'   format='datetime'><select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 32; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select>  ';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 24; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> :';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> :';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select></div>';
                }
                else if (_type == "hh:mm:ss") {
                    controlSource = "<div Field='" + _identity + "' datetype='" + _type + "'   format='datetime'><select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 24; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> :';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> :';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select></div>';
                }
                else if (_type == "hh:mm") {
                    controlSource = "<div Field='" + _identity + "' datetype='" + _type + "'   format='datetime'><select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 24; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select> :';
                    controlSource += "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select></div>';
                }
                else if (_type == "hh") {
                    controlSource = "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 24; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                }
                else if (_type == "mm") {
                    controlSource = "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 0; i < 60; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                }
                else if (_type == "dd") {
                    controlSource = "<select Field='" + _identity + "'>";
                    controlSource += "<option value=''> </option>";
                    for (var i = 1; i < 32; i++) {
                        var date = i < 10 ? "0" + i : i;
                        controlSource += "<option value=" + date + ">" + date + "</option>";
                    }
                    controlSource += '</select>';
                }
                else if (_type == "integer") {
                    controlSource = "<input type='text' Field='" + _identity + "' format='integer' class='ipt' onblur='jsCommonLogic.dataValidate(3,this); ' />";
                }
                else if (_type == "decimal") {
                    controlSource = "<input type='text' Field='" + _identity + "' format='decimal' class='ipt' onblur='jsCommonLogic.dataValidate(5,this); ' />";
                }
                str += ',"content":"' + escape(controlSource) + '"}';
                isEndTime = null;
                if (App.query("action") == undefined) {
                    ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')"); //
                } else {
                    ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace("@str", escape(str)));
                }
                ShowWindow.close();
            } else if (_type == "telphone") {
            var str = '{"type":"' + _type + '","title":"' + _title + '","parameter":"' + _selPara + '","identity":"' + _identity + '","format":"' + _format + '","dataType":"sql","content":"' + escape("<input contorlType='phone' type='text'   Field='" + _identity + "' format='integer' class='ipt' onblur='jsCommonLogic.dataValidate(1,this); '/>&nbsp;<img alt='拨打' style='cursor:pointer' src='images/Tel.Gif' imgType='telphone' width='15px' height='15px' title='拨打电话' imageSrc='images/Tel.Gif'/>") + '"}';
                if (App.query("action") == undefined) {
                    ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')");
                } else {
                    ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace('@str', escape(str)));
                }
                ShowWindow.close();
            } else if (_type == "web") {
            var str = '{"type":"' + _type + '","title":"' + _title + '","parameter":"' + _selPara + '","identity":"' + _identity + '","format":"' + _format + '","dataType":"sql","content":"' + escape("<input contorlType='phone' type='text'   Field='" + _identity + "' format='integer' class='ipt' />&nbsp;<img alt='网址' style='cursor:pointer' src='images/htm.bmp' imgType='web'  width='15px' height='15px' title='打开网站' imageSrc='images/htm.bmp'/>") + '"}';
                if (App.query("action") == undefined) {
                    ShowWindow.opener.execScript(App.query("formIdx"), "getSource('" + str + "')");
                } else {
                    ShowWindow.opener.execScript(App.query("formIdx"), App.query("action").replace('@str', escape(str)));
                }
                ShowWindow.close();
            } else {
                alert("此格式未开放请重新选择！");
                //                ShowWindow.close();
            }
            render = null;
            eventName = null;
        } else {
            alert("请正确选择控件！");
        }
    } else {
        alert("请选择格式！");
    }
    isSave = null;
    CollectGarbage();
}

jseOA_EditInputOrModifyControl.showEditTime = function(obj) {
    document.getElementById("SpanEndTime").style.display = "none";
    document.getElementById("isEndTime").style.display = "none";
    document.getElementById("timePara").style.display = "none";
    if (obj.value == "yyyy-MM-dd" || obj.value == "yyyy-MM-dd hh:mm:ss") {
        document.getElementById("SpanEndTime").style.display = "";
        document.getElementById("isEndTime").style.display = "";
        if (document.getElementById("isEndTime").checked) {
            document.getElementById("timePara").style.display = "none";
        }
    }
}

//jseOA_EditInputOrModifyControl.showPara = function(obj) {
//    if (obj.checked) {
//        document.getElementById("timePara").style.display = "none";
//    } else {
//        document.getElementById("timePara").style.display = "none";
//    }
//}

/*增加*/
jseOA_EditInputOrModifyControl.addSelect = function() {
    var sel = document.getElementById("treeSel");
    var name = document.getElementById('txtName');
    var _value = document.getElementById('txtValue');
    var editBtn = document.getElementById("btnEdit");
    if ($.trim(_value.value) == "") {
        _value.value = name.value;
    }
    var newItem = new Option(name.value, _value.value);
    sel.options.add(newItem);
    name.value = "";
    _value.value = "";
    //    } else {
    //        alert("增加失败！请输入值！");
    //    }
    var i = sel.options.length - 1;
    for (i; i >= 0; i--) {
        sel[i].selected = false;
    }
    editBtn.disabled = "disabled";
    editBtn = null;
    selIndex = null;
    sel = null;
    newItem = null;
    name = null;
    _value = null;
    CollectGarbage();
}

/*删除*/
jseOA_EditInputOrModifyControl.delSelect = function() {
    //            var isRemove = window.confirm("确定删除吗？");
    //            if (isRemove) {
    var sel = document.getElementById("treeSel");
    var ilength = sel.options.length;
    var i = ilength - 1;
    var name = document.getElementById('txtName');
    var _value = document.getElementById('txtValue');
    name.value = "";
    _value.value = "";
    name = null;
    _value = null;
    for (i; i >= 0; i--) {
        if (sel[i].selected == true) {
            sel[i] = null;
        }
    }
    sel = null;
    ilength = null;
    i = null;
    selIndex = null;
    //            }
    isRemove = null;
    CollectGarbage();
}

/*修改按钮*/
jseOA_EditInputOrModifyControl.editSelect = function() {
    var obj = document.getElementById("treeSel");
    var name = document.getElementById('txtName');
    var _value = document.getElementById('txtValue');
    var editBtn = document.getElementById("btnEdit");
    if (selIndex != null) {
        selIndex = parseInt(selIndex);
        if (obj[selIndex] != null) {
            obj[selIndex].text = name.value;
            obj[selIndex].value = _value.value;
        }

        editBtn.disabled = "disabled";
        name.value = "";
        _value.value = "";
        selIndex = null;
    }
    name = null;
    _value = null;
    obj = null;
    editBtn = null;
    CollectGarbage();
}

/*向上按钮*/
jseOA_EditInputOrModifyControl.selectGetUp = function(btnObj) {
    try {
        var obj = document.getElementById("treeSel");
        var btnDown = document.getElementById("btnDown");
        btnDown.disabled = false;
        var tempObj = { name: obj[selIndex].text, value: obj[selIndex].value };
        obj[selIndex].text = obj[selIndex - 1].text;
        obj[selIndex].value = obj[selIndex - 1].value;
        obj[selIndex - 1].text = tempObj.name;
        obj[selIndex - 1].value = tempObj.value;
        var i = obj.options.length - 1;
        for (i; i >= 0; i--) {
            obj[i].selected = false;
        }
        selIndex = selIndex - 1;
        obj[selIndex].selected = true;
        if (selIndex == 0) {
            btnObj.disabled = true;
        }
        btnObj = null;
        btnDown = null;
        obj = null;
        tempObj = null;
    } catch (e) {

    }
    CollectGarbage();
}

/*向下按钮*/
jseOA_EditInputOrModifyControl.SelectGetDown = function(btnObj) {
    try {
        var obj = document.getElementById("treeSel");
        var btnUp = document.getElementById("btnUp");
        btnUp.disabled = false;
        var tempObj = { name: obj[selIndex].text, value: obj[selIndex].value };
        obj[selIndex].text = obj[selIndex + 1].text;
        obj[selIndex].value = obj[selIndex + 1].value;
        obj[selIndex + 1].text = tempObj.name;
        obj[selIndex + 1].value = tempObj.value;
        var i = obj.options.length - 1;
        for (i; i >= 0; i--) {
            obj[i].selected = false;
        }
        selIndex = selIndex + 1;
        obj[selIndex].selected = true;
        if (selIndex == (obj.options.length - 1)) {
            btnObj.disabled = true;
        }
        btnObj = null;
        btnUp = null;
        obj = null;
        tempObj = null;
    } catch (e) {

    }
    CollectGarbage();
}


/*内容点击事件*/
jseOA_EditInputOrModifyControl.getSelect = function(obj) {
    var editBtn = document.getElementById("btnEdit");
    editBtn.disabled = "";
    var ilength = obj.options.length;
    var i = ilength - 1;
    var name = document.getElementById('txtName');
    var _value = document.getElementById('txtValue');
    var btnUp = document.getElementById("btnUp");
    var btnDown = document.getElementById("btnDown");
    btnUp.disabled = false;
    btnDown.disabled = false;
    for (i; i >= 0; i--) {
        if (obj[i].selected == true) {
            name.value = obj[i].text;
            _value.value = obj[i].value;
            selIndex = obj[i].index;
            if (i == 0) {
                btnUp.disabled = true;
            }
            else if (i == (ilength - 1)) {
                btnDown.disabled = true;
            }
            break;
        }
    }
    btnDown = null;
    btnUp = null;
    name = null;
    _value = null;
    ilength = null;
    i = null;
    obj = null;
    CollectGarbage();
}

/*手动与数据修改设换*/
jseOA_EditInputOrModifyControl.showControlModule = function(i) {
    var manual = document.getElementById('ulManual');
    var ulData = document.getElementById('ulData');
    var ulBinding = document.getElementById('ulBinding');
    var rdoData = document.getElementById('rdoData');
    var rdoModule = document.getElementById('rdoModule');
    if (i == "1") {
        manual.style.display = "block";
        ulData.style.display = "none";
        ulBinding.style.display = "none";
        rdoModule.checked = true;
    } else {
        manual.style.display = "none";
        ulData.style.display = "block";
        ulBinding.style.display = "block";
        rdoData.checked = true;
    }
    manual = null;
    ulData = null;
    CollectGarbage();
}