UserInfo.tui 10.1 KB
Newer Older
‘oliver.hui’'s avatar
‘oliver.hui’ committed
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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
[
    {
        name : 'tablewidgt',
        type : 'TabWidget',
        property : {},
        pack : {stretch:1},

        child : [
            {
                name : 'userinfo_page',
                type : 'ScrollArea',
                property : { widgetResizable:true, frameShape: 'QFrame::NoFrame'},
                pack : {label:self.ttr("User Information")},
                child : {
                    name : 'formlayout',
                    type : 'FormLayout',
                    property : {labelAlignment:'Qt::AlignRight',margin : 20,verticalSpacing : 10,horizontalSpacing :20},
                    pack : {},
                    child : [
                        {
                            name : 'id',
                            type : 'LineEdit',
                            title : self.ttr('ID'),
                            property : {enabled:false},
                            pack : {label: self.ttr('ID')},
                        },
                        {
                            name : 'name',
                            type : 'LineEdit',
                            title : self.ttr('Login Name'),
                            property : {},
                            pack : {label: self.ttr('Login Name')},
                            validate: function(obj,val,title,moment,self){
                                if (val.trim() == ''){
                                        return [title + self.ttr(" can not be null!"),'Error'];
                                }
                                else if (! val.match(new RegExp('^[a-z0-9_]+$'))){
                                        return [title + self.ttr(" can only contain [a-z0-9]!"),'Error'];
                                }

                                return;
                            },
                        },
                        {
                            name : 'fullname',
                            type : 'LineEdit',
                            title : self.ttr('Full Name'),
                            property : {},
                            pack : {label: self.ttr('Full Name')},
                        },
                        {
                            name : 'cardid',
                            type : 'LineEdit',
                            title : self.ttr('Card ID'),
                            property : {},
                            pack : {label: self.ttr('Card ID')},
							validate: function(obj,val,title,moment,self){								
								if (val.match(new RegExp('[a-zA-Z0-9]+$')) || val == ''){
									return ;
								}
								else{
									
									return [title+self.ttr(" illegal input!!"),'ERROR'];
								}							
							},
                        },
                        {
                            name : 'staffid',
                            type : 'LineEdit',
                            title : self.ttr('Staff ID'),
                            property : {},
                            pack : {label: self.ttr('Staff ID')},
							
                        },
                        {
                            name : 'mail',
                            type : 'LineEdit',
                            title : self.ttr('Mail'),
                            property : {},
                            validate: function(obj,val,title,moment){
                                if (val != ''){
                                    //var myregex = new RegExp('^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$');
                                     var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
									if (!filter.test(val)){
                                        return [self.ttr("invalid mail format;"),'ERROR']
                                    }
                                }
                            },
                            pack : {label: self.ttr('Mail')},
                        },
                        {
                            name : 'work_phone',
                            type : 'LineEdit',
                            title : self.ttr('Work Phone'),
                            property : {},
                            pack : {label: self.ttr('Work Phone')},							
                        },
                        {
                            name : 'cell_phone',
                            type : 'LineEdit',
                            title : self.ttr('Cell Phone'),
                            property : {},
                            pack : {label: self.ttr('Cell Phone')},
							validate: function(obj,val,title,moment,self){								
								if (val.match(new RegExp('[0-9]+$')) || val == ''){
									return ;
								}
								else{
   									 return [title+self.ttr("illegal input!"),'ERROR'];
								}							
							},
                        },
                        {
                            name : 'password',
                            type : 'LineEdit',
                            title : self.ttr('Password'),
                            property : {echoMode:'QLineEdit::Password'},
                            pack : {label: self.ttr('Password')},
                        },
                        {
                           name : 'department',
                           type : 'ComboBox',
                           title : self.ttr('Department'),
                           property :
                           {
                               itemList : TOPENM.enumList("Sys_Department").toComboList()
                           },
                           pack :
                           {
                               label : self.ttr('Department')
                           },
                       },

                        {
                            name : 'status',
                            type : 'ComboBox',
                            title : self.ttr('Status'),
                            property : {
                                itemList: TOPENM.enumList("Sys_UserStatus").toComboList()
                            },
                            pack : {label: self.ttr('Status')},
                            validate: function(obj,val,title,moment,self){
                                if (val.trim() == ''){
                                        return [title + self.ttr(" can not be null!"),'Error'];
                                }
                            }
                        },
                        {
                            name : 'product_category',
                            type : 'MultiComboBox',
                            title : self.ttr('Category'),
                            property : {
                                nameFormat: "|A|B|",
                                itemList: TOPENM.enumList("Sys_ProductCategory").toComboList()
                            },
                            pack : {label: self.ttr('Category')},
                            validate: '',
                            state: function(obj,self){
                                    if ((self.config("productCategory") != "") &&  (self.config("productCategory") != undefined) && (self.config("productCategory").length == 1))
                                    {
                                            return "Hide";
                                    }
                                    else
                                    {
                                            return "Show";
                                    }
                            },
                        },
                        {
                            name : 'tag',
                            type : 'LineEdit',
                            title : self.ttr('Tag'),
                            property : { },
                            pack : {label: self.ttr('Tag')},
                        },
                        {
                            name : 'remark',
                            type : 'PlainTextEdit',
                            title : self.ttr('Remark'),
                            property : { verticalScrollBarPolicy:'Qt::ScrollBarAlwaysOff'},
                            pack : {label: self.ttr('Remark')},

                        },

                    ]
            }
		    },
		    {
			   name : 'ROLE_PAGE',
			   type : 'VBoxLayout',
               property : {spacing:0, margin:0},
               pack : {label:self.ttr("Role")},
			   child : [
					{
						name : 'role_toolbar',
						type : 'ToolBar',
                        property : {toolButtonStyle:'Qt::ToolButtonTextBesideIcon'},
						pack : {},
						child : [
							{   name : 'act_add_role',
								type: 'Action' ,
                                property : {text:self.ttr('Add Role'),icon:'add_list',shortcut:'',tooltip:''},
                                callback : function(obj,checked,self) {
                                    self.showAddRoleDialog();
                                },
							},
							{   name : 'act_remove_role',
								type: 'Action' ,
                                property : {text:self.ttr('Remove Role'),icon:'remove_list',shortcut:'',tooltip:''},
                                callback : function(obj,checked,self) {
                                    if (TMessageBox.msgbox(self,self.ttr("Are you sure to delete selected roles?"),
                                                      '', 'Question',self.ttr("Question"),["Yes","No"]) == 'Yes')
                                    {
                                         this.getObject('ROLE_LIST').removeSelectedRows();
                                    }

                                },
							},
						]
				
					},
					{
						name : 'ROLE_LIST',
						type : 'TableView',
						property : {},
						pack : {},
						initCallback : function(obj){
							obj.setHeaderItem(
								[
									{ name : 'id', displayRole : '$id'},
                                    { name : 'name', display:self.ttr('Role Name'),displayRole:'$name',resizeMode:'Interactive'},
                                    { name : 'remark', display:self.ttr('Remark'),displayRole:'$remark',resizeMode:'Stretch'},
								]
							);
                            obj.setDataKeyList(["id","name","remark"]);
						},
					}
			   ]
			}
        ]
    },

]