当前位置: 首页 > 工具软件 > OperaMasks-UI > 使用案例 >

Operamasks-UI控件操作

彭坚壁
2023-12-01

编辑框:

1,初始化

 $('#txtIncidentDescription').omEditor({
                height: 60,
                uiColor: '#BCC5D2',
                enterMode: OMEDITOR.ENTER_BR,
                allowImageType: ['jpg', 'gif', 'png', 'bmp'],
                filebrowserImageUploadUrl: 'http://www.cnblogs.com/Handler/ReportInfoHandler.ashx?Method=UploadImage&type=Images',
                toolbar: [{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] }, { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', '-', 'RemoveFormat'] },
                { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'Image'] }, { name: 'document', items: ['Preview']}]
            });

 

2,获取编辑框的值

var discription = $('#txtIncidentDescription').omEditor('getData');

 

3,编辑框赋值

$('#editor1').omEditor("setData", data.rows[0].INFOCONTENT);

 

4,编辑框重置

 $("#txtInContent").val("");

 

日历框:

1,初始化

 $("#txtInInputTimeE").omCalendar({
                editable: false,
                dateFormat: 'yy-mm-dd'
            });

 

2,日历框获取值

var ininputtimeE = $("#txtInInputTimeE").val();

 

3,日历框赋值

$('#txtRecordTime').val(timetemp);

 

4,日历框重置

$("#txtRecordTime").omCalendar("value", "");

 

下拉框

1,初始化

 $("#txtRecordMan").omCombo({
                width: 218,
                editable: false,
                forceSelction: true,
                dataSource: 'http://www.cnblogs.com/Handler/EventLogHandler.ashx?Method=GetAllSystemUser',
                filterStrategy: 'anywhere'
            });

 

2,下拉框获取值

var title = $('#txtTitle').val();

 

3,下拉框赋值

  $('#txtRecordMan').omCombo('value',recordman);

 

4,下拉框重置

$("#txtIncidentTitle").omCombo("value", "");

 

按钮

1,初始化

 $('span#btnAdd').omButton({
                icons: { left: 'http://www.cnblogs.com/JScript/omui/images/add.png' },
                onClick: function () {
                    ShowWind();
                }
            });

 

Panel

1,初始化

 $("#search-panel").omPanel({
                title: "<span style='color:#15428B;font-weight: bold;'>查询条件</span>",
                collapsible: true
            });

 

GridView

1,初始化

 $('#gridDetail').omGrid({
                dataSource: 'http://www.cnblogs.com/Handler/EventLogHandler.ashx?Method=GetAllEventLog',
                height: 360,
                limit: 10,
                title: "查询结果",
                autoFit: true,
                colModel: [
                             { header: '记录时间', name: 'CREATETIME', align: 'center' },
                             { header: '记录描述', name: 'RECORD_DESCRIPTION', align: 'center', renderer: showdetail },
                             { header: '录入人员', name: 'USERNAME', align: 'center' },
                             { header: '单位', name: 'ORGAN_NAME', align: 'center' },
                           ]
            });

2,包含重置密码,删除功能

 $('#grid').omGrid({
                dataSource: 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=GetAllSysUser',
                height: 120,
                limit: 5,
                title: "查询结果",
                autoFit: true,
                colModel: [
                             { header: '用户名', name: 'USERNAME', align: 'center', renderer: showdetail },
                             { header: '单位', name: 'DEPT', align: 'center' },
                             { header: '是否锁定', name: 'ISLOCKED', align: 'center', renderer: function (colValue, rowData, rowIndex) {
                                 var data = $("#grid").omGrid("getData").rows[rowIndex];
                                 return '<input type="checkbox" οnclick="IsLock(\'' + data.USERCODE + '\')" />';
                             }
                             },
                             { header: '是否删除', name: 'ISDELETE', align: 'center', renderer: function (colValue, rowData, rowIndex) {
                                 var data = $("#grid").omGrid("getData").rows[rowIndex];
                                 return '<input type="checkbox" οnclick="IsDelete(\'' + data.USERCODE + '\')" />';
                             }
                             },
                             { header: '密码重置', name: 'USERPWD', align: 'center', renderer: function (colValue, rowData, rowIndex) {
                                 var data = $("#grid").omGrid("getData").rows[rowIndex];
                                 //                                 alert(data.USERPWD);
                                 //                                 alert(data.USERCODE);
                                 return '<button value="重置" onClick="ResetPwd(\'' + data.USERPWD + '\',\'' + data.USERCODE + '\')">密码重置</button>';
                             }
                             }

                           ],
                           onSuccess: function (data, testStatus, XMLHttpRequest, event) {
                    vCurrentRowCnt = (data.rows.length) * 27 + 92;
                    $("#grid").omGrid("resize", { height: vCurrentRowCnt });
                }
            });

 //重置密码
        function ResetPwd(spwd, scode) {
            $.omMessageBox.confirm({
                title: '确认重置密码',
                content: '你确定要重置该用户密码吗?',
                onClose: function (v) {
                    if (v) {
                        var params = "&supwd=" + encodeURI(spwd) +
                         "&sucode=" + encodeURI(scode);
                        $('#grid').omGrid("setData", 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=ResetPwd' + params);
                        $.omMessageBox.alert({
                            type: 'success',
                            title: '成功',
                            content: '该用户密码已重置!',
                            onClose: function (v) {
                            }
                        });
                    }
                }
            });
        }

        //        function IsLock(scode) {
        //            var params = "&sucode=" + encodeURI(scode);
        //            $('#grid').omGrid("setData", 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=IsLock' + params);
        //        }
        //锁住用户
        function IsLock(scode) {
            $.omMessageBox.confirm({
                title: '确认锁住用户',
                content: '你确定要锁住该用户吗?',
                onClose: function (v) {
                    if (v) {
                        var params = "&id=" + encodeURI(scode);
                        $('#grid').omGrid("setData", 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=IsLock' + params);
                        $.omMessageBox.alert({
                            type: 'success',
                            title: '成功',
                            content: '用户已锁住!',
                            onClose: function (v) {
                            }
                        });
                    }
                }
            });
        }


        //        function IsDelete(scode) {
        //            var params = "&sucode=" + encodeURI(scode);
        //            $('#grid').omGrid("setData", 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=IsDelete' + params);
        //        }

        // 删除用户
        function IsDelete(scode) {
            $.omMessageBox.confirm({
                title: '确认删除',
                content: '删除后不可恢复,你确定要删除吗?',
                onClose: function (v) {
                    if (v) {
                        var params = "&id=" + encodeURI(scode);
                        $('#grid').omGrid("setData", 'http://www.cnblogs.com/Handler/SysUserHandler.ashx?Method=IsDelete' + params);
                        $.omMessageBox.alert({
                            type: 'success',
                            title: '成功',
                            content: '删除成功!',
                            onClose: function (v) {
                            }
                        });
                    }
                }
            });
        }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/qinhj348770376/archive/2012/10/22/2733398.html

 类似资料: