def EditPositionhrForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_positionhr_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #招聘岗位添加 layout = QFormLayout() self.part_id = QComboBox() my_business = business() (status,content) = my_business.get_dict() if status: for (key,item) in content['part'].items(): self.part_id.addItem(item,QVariant(key)) index = self.part_id.findData(QVariant(my_info['part_id'])) self.part_id.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>部门:"), self.part_id) self.name = QLineEdit() self.name.setText(my_info['name']) layout.addRow(QLabel(u"<font color='red'>*</font>岗位:"),self.name) self.description = QTextEdit() self.description.setText(my_info['description']) layout.addRow(QLabel(u"<font color='red'>*</font>要求:"), self.description) self.formGroupBox.setLayout(layout)
def EditAdminForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_admin_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #用户添加 layout = QFormLayout() self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.user_name = QLineEdit() self.user_name.setText(my_info['admin_name']) layout.addRow(QLabel(u"<font color='red'>*</font>用户帐号:"), self.user_name) self.passwd = QLineEdit() self.passwd.setEchoMode(QLineEdit.Password) layout.addRow(QLabel(u"<font color='red'>*</font>密码:"), self.passwd) self.re_passwd = QLineEdit() self.re_passwd.setEchoMode(QLineEdit.Password) layout.addRow(QLabel(u"<font color='red'>*</font>确认密码:"), self.re_passwd) self.name = QLineEdit() self.name.setText(my_info['name']) layout.addRow(QLabel(u"<font color='red'>*</font>姓名:"), self.name) self.status = QComboBox() self.status.addItem(u'正常',QVariant(0)) self.status.addItem(u'禁用',QVariant(-1)) index = self.status.findData(QVariant(my_info['status'])) self.status.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>状态:"), self.status) self.part = QComboBox() #查询部门 my_business = business() (status,result) = my_business.get_dict() if result.has_key('part'): for (key,item) in result['part'].items(): self.part.addItem(item,QVariant(key)) index = self.part.findData(QVariant(my_info['part'])) self.part.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>部门:"), self.part) self.role = QComboBox() if result.has_key('role'): for (key,item) in result['role'].items(): self.role.addItem(item,QVariant(key)) index = self.role.findData(QVariant(my_info['role'])) self.role.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>角色:"), self.role) self.formGroupBox.setLayout(layout)
def EditBugForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_bug_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #bug添加 layout = QFormLayout() self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.level = QComboBox() self.level.addItem(u'超高',QVariant(1)) ''' if 1 == my_info['level']: self.level.setCurrentIndex(1) ''' self.level.addItem(u'高',QVariant(2)) self.level.addItem(u'一般',QVariant(3)) index = self.level.findData(QVariant(my_info['level'])) self.level.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>优先级:"), self.level) self.status = QComboBox() self.status.addItem(u'待解救',QVariant(1)) self.status.addItem(u'已解救',QVariant(2)) self.status.addItem(u'已关闭',QVariant(3)) index = self.level.findData(QVariant(my_info['status'])) self.status.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>状态:"), self.status) self.project_id = QComboBox() (status,my_dict) = my_business.get_dict() self.project_id.addItem(u'请选择项目',QVariant(0)) self.my_dict = my_dict if my_dict.has_key('project'): for (key,value) in my_dict['project'].items(): self.project_id.addItem(value,QVariant(key)) index = self.project_id.findData(QVariant(my_info['project_id'])) self.project_id.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>所属项目:"), self.project_id) self.connect(self.project_id, SIGNAL('activated(int)'), self.onActivatedModule) self.project_mod_id = QComboBox() layout.addRow(QLabel(u"<font color='red'>*</font>所属模块:"), self.project_mod_id) self.get_member = QComboBox() layout.addRow(QLabel(u"<font color='red'>*</font>受理人:"), self.get_member) self.onActivatedModule(my_info['project_id']) index = self.project_mod_id.findData(QVariant(my_info['project_mod_id'])) self.project_mod_id.setCurrentIndex(index) index = self.get_member.findData(QVariant(my_info['get_member'])) self.get_member.setCurrentIndex(index) self.title = QTextEdit() self.title.setPlainText(my_info['title']) layout.addRow(QLabel(u"<font color='red'>*</font>问题描述:"), self.title) self.description = WebViewEx(self,my_info['description']) layout.addRow(QLabel(u"操作过程:"), self.description) self.formGroupBox.setLayout(layout) self.formGroupBox.resize(600,700) self.resize(600, 700)
def SaveAdmin(self): data={'number':0,'admin_name':'','passwd':'','re_passwd':'','name':'','status':0,'part':0,'role':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['admin_name'] = urllib.quote(str(self.user_name.text())) data['passwd'] = urllib.quote(str(self.passwd.text())) data['re_passwd'] = urllib.quote(str(self.re_passwd.text())) data['name'] = urllib.quote(str(self.name.text())) data['status'] = 0 data['part'] = 1 data['role'] = 2 #data['position'] = 1 if data['passwd'] != data['re_passwd']: content = u'两次密码不一致' Add.message = content Add.status = False self.parent.set_message(u'警告',content) return False data.pop('re_passwd') (status,content) = my_business.add_admin(data) print 'content:%s'%content if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def SavePositionhr(self): data={'part_id':0,'name':'','description':'','create':0} where = {'id':0} my_business = business() #组装数据 data['part_id'] = 2 data['description'] = urllib.quote(str(self.description.toPlainText())) data['name'] = urllib.quote(str(self.name.text())) data['create'] = get_cur_admin_id() where['id'] = self.id (status,content) = my_business.update_positionhr(data,where) print 'content:%s'%content if status: Edit.message = content Edit.status = True self.parent.set_message(u'提示',content) self.accept() return True else: Edit.message = content Edit.status = False self.parent.set_message(u'错误',content)
def SavePart(self): data={'number':'','name':'','create':0} where={'id':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['name'] = urllib.quote(str(self.name.text())) data['create'] = get_cur_admin_id() where['id'] = self.id (status,content) = my_business.update_part(data,where) print 'content:%s'%content if status: Edit.message = content Edit.status = True self.parent.set_message(u'提示',content) self.accept() return True else: Edit.message = content Edit.status = False self.parent.set_message(u'错误',content) pass
def AddResumeForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #简历添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.candidates = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>应聘人:"), self.candidates) self.telephone = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>联系方式:"), self.telephone) self.position_id = QComboBox() (status,content) = my_business.get_dict() if status: if content.has_key('positionhr'): for (key,value) in content['positionhr'].items(): self.position_id.addItems([value]) layout.addRow(QLabel(u"<font color='red'>*</font>应聘岗位:"), self.position_id) self.part_id = QComboBox() if status: for (key,value) in content['part'].items(): self.part_id.addItems([value]) layout.addRow(QLabel(u"<font color='red'>*</font>应聘部门:"), self.part_id) self.accessories = FileUpload() layout.addRow(QLabel(u"<font color='red'>*</font>简历附件:"), self.accessories) self.remark = QTextEdit() layout.addRow(QLabel(u"备注:"), self.remark) self.formGroupBox.setLayout(layout)
def EditRoleForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_role_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #角色添加 layout = QFormLayout() self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.name = QLineEdit() self.name.setText(my_info['name']) layout.addRow(QLabel(u"<font color='red'>*</font>角色名称:"), self.name) #查询资源 (status,content) = my_business.get_resource() source_name_list = {} if status: rows = int(content['record_count']) for i in range(0,rows-1): key = content['list'][i]['source_name'] id = content['list'][i]['id'] source_name_list[key] = id check_data = [] tmp_list = my_info['resource'].split(',') for item in tmp_list: check_data.append(int(str(item))) self.resource = MulCheckedBox(self,source_name_list,check_data) layout.addRow(QLabel(u"<font color='red'>*</font>权限:"), self.resource) self.formGroupBox.setLayout(layout)
def SaveProejct(self): data={'number':'','name':'','description':'','create':0} mem_data={'project_id':0,'admin_id':[]} mod_data={'project_id':0,'name':[]} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['name'] = urllib.quote(str(self.name.text())) data['description'] = urllib.quote(str(self.description.toPlainText())) data['create'] = get_cur_admin_id() #项目成员 mem_data['admin_id'] = self.project_mem.text() #项目模块 tmp_mod_data_name_list = self.project_mod.text() mod_data_name_list = [] for item in tmp_mod_data_name_list: mod_data_name_list.append(urllib.quote(item)) mod_data['name'] = mod_data_name_list (status,content) = my_business.add_proejct(data,mem_data,mod_data) if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def SaveBug(self): data={'number':'','title':'','level':0,'status':0,'project_id':0,'project_mod_id':0, 'get_member':0,'description':'','put_member':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['title'] = urllib.quote(str(self.title)) data['level'] = urllib.quote(str(self.level.itemData(self.level.currentIndex()).toPyObject())) data['status'] = urllib.quote(str(self.status.itemData(self.status.currentIndex()).toPyObject())) data['project_id'] = urllib.quote(str(self.project_id.itemData(self.project_id.currentIndex()).toPyObject())) data['project_mod_id'] = urllib.quote(str(self.project_mod_id.itemData(self.project_mod_id.currentIndex()).toPyObject())) data['get_member'] = urllib.quote(str(self.get_member.itemData(self.get_member.currentIndex()).toPyObject())) time.sleep(3) data['description'] = base64.b64encode(self.description.text()) data['put_member'] = get_cur_admin_id() (status,content) = my_business.add_bug(data) if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def AddPartForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #部门添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>部门名称:"), self.name) self.formGroupBox.setLayout(layout)
def SaveAdmin(self): data={'number':0,'admin_name':'','passwd':'','re_passwd':'','name':'','status':0,'part':0,'role':0} where={'id':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['admin_name'] = urllib.quote(str(self.user_name.text())) data['passwd'] = urllib.quote(str(self.passwd.text())) data['re_passwd'] = urllib.quote(str(self.re_passwd.text())) data['name'] = urllib.quote(str(self.name.text())) data['status'] = 0 data['part'] = 1 data['role'] = 2 #data['position'] = 1 where['id'] = self.id if '' != data['passwd']: if data['passwd'] != data['re_passwd']: content = u'两次密码不一致' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) return False #修改密码 tmp_data = {'admin_name':'','passwd':''} tmp_data['admin_name'] = data['admin_name'] tmp_data['passwd'] = data['passwd'] (tmp_status,tmp_content) = my_business.update_admin_passwd(tmp_data) if not tmp_status: Edit.message = tmp_content Edit.status = False self.parent.set_message(u'警告',tmp_content) return False data.pop('passwd') else: data.pop('passwd') data.pop('re_passwd') (status,content) = my_business.update_admin(data,where) if status: Edit.message = content Edit.status = True self.parent.set_message(u'提示',content) self.accept() return True else: Edit.message = content Edit.status = False self.parent.set_message(u'错误',content)
def AddProjectForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #项目添加 layout = QFormLayout() layout.addRow(QLabel(u"<font color='red'>*</font>项目名称:"), QLineEdit()) self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), QLabel(number)) layout.addRow(QLabel(u"项目描述:"), QTextEdit()) layout.addRow(QLabel(u"成员:"), TableComButton()) layout.addRow(QLabel(u"模块:"), TableTextButton()) self.formGroupBox.setLayout(layout)
def AddAdminForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #用户添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.user_name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>用户帐号:"), self.user_name) self.passwd = QLineEdit() self.passwd.setEchoMode(QLineEdit.Password) layout.addRow(QLabel(u"<font color='red'>*</font>密码:"), self.passwd) self.re_passwd = QLineEdit() self.re_passwd.setEchoMode(QLineEdit.Password) layout.addRow(QLabel(u"<font color='red'>*</font>确认密码:"), self.re_passwd) self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>姓名:"), self.name) self.status = QComboBox() self.status.addItems([u'正常']) self.status.addItems([u'禁用']) layout.addRow(QLabel(u"<font color='red'>*</font>状态:"), self.status) self.part = QComboBox() #查询部门 my_business = business() (status,result) = my_business.get_dict() if result.has_key('part'): for (key,item) in result['part'].items(): self.part.addItems([item]) layout.addRow(QLabel(u"<font color='red'>*</font>部门:"), self.part) self.role = QComboBox() if result.has_key('role'): for (key,item) in result['role'].items(): self.role.addItems([item]) layout.addRow(QLabel(u"<font color='red'>*</font>角色:"), self.role) self.formGroupBox.setLayout(layout)
def EditProjectForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_project_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #项目添加 layout = QFormLayout() self.name = QLineEdit() self.name.setText(my_info['name']) layout.addRow(QLabel(u"<font color='red'>*</font>项目名称:"), self.name) self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.description = QTextEdit() self.description.setText(my_info['description']) layout.addRow(QLabel(u"项目描述:"), self.description) data ={} (status,content) = my_business.get_dict() if status: if content.has_key('admin'): for (key,value) in content['admin'].items(): tmp_value = str(value) data[tmp_value] = int(str(key)) display_data = [] (status,content1) = my_business.get_project_mem_by_project_id(self.id) if status: for item in content1: if content.has_key('admin'): display_data.append(content['admin'][unicode(item)]) self.project_mem = TableComButton(self,data,display_data) layout.addRow(QLabel(u"<font color='red'>*</font>成员:"), self.project_mem) data = [] (status,content) = my_business.get_project_mod_by_project_id(self.id) if status: for item in content: data.append(item) self.project_mod = TableTextButton(self,data) layout.addRow(QLabel(u"<font color='red'>*</font>模块:"), self.project_mod) self.formGroupBox.setLayout(layout)
def EditPartForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_part_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #部门添加 layout = QFormLayout() self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.name = QLineEdit() self.name.setText(my_info['name']) layout.addRow(QLabel(u"<font color='red'>*</font>部门名称:"), self.name) self.formGroupBox.setLayout(layout)
def AddPositionhrForm(self): layout = QFormLayout() #招聘岗位添加 layout = QFormLayout() self.part_id = QComboBox() my_business = business() (status,content) = my_business.get_dict() if status: for (key,item) in content['part'].items(): self.part_id.addItems([item]) layout.addRow(QLabel(u"<font color='red'>*</font>部门:"), self.part_id) self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>岗位:"),self.name) self.description = QTextEdit() layout.addRow(QLabel(u"<font color='red'>*</font>要求:"), self.description) self.formGroupBox.setLayout(layout)
def AddRoleForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #角色添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>角色名称:"), self.name) #查询资源 (status,content) = my_business.get_resource_name() source_name_list = [] if status: source_name_list = content self.resource = MulCheckedBox(self,source_name_list) layout.addRow(QLabel(u"<font color='red'>*</font>权限:"), self.resource) self.formGroupBox.setLayout(layout)
def EditResumeForm(self): layout = QFormLayout() my_business = business() (status,my_info) = my_business.get_resume_one_by_id(self.id) if not status: content = u'查询错误' Edit.message = content Edit.status = False self.parent.set_message(u'警告',content) self.close() #简历添加 layout = QFormLayout() self.number = QLabel(my_info['number']) layout.addRow(QLabel(u" 编号:"), self.number) self.candidates = QLineEdit() self.candidates.setText(my_info['candidates']) layout.addRow(QLabel(u"<font color='red'>*</font>应聘人:"), self.candidates) self.telephone = QLineEdit() self.telephone.setText(my_info['telephone']) layout.addRow(QLabel(u"<font color='red'>*</font>联系方式:"), self.telephone) self.position_id = QComboBox() (status,content) = my_business.get_dict() if status: if content.has_key('positionhr'): for (key,value) in content['positionhr'].items(): self.position_id.addItem(value,QVariant(key)) index = self.position_id.findData(QVariant(my_info['position_id'])) self.position_id.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>应聘岗位:"), self.position_id) self.part_id = QComboBox() if status: for (key,value) in content['part'].items(): self.part_id.addItem(value,QVariant(key)) index = self.part_id.findData(QVariant(my_info['part_id'])) self.part_id.setCurrentIndex(index) layout.addRow(QLabel(u"<font color='red'>*</font>应聘部门:"), self.part_id) self.accessories = FileUpload(self,my_info['accessories_url']) layout.addRow(QLabel(u"<font color='red'>*</font>简历附件:"), self.accessories) self.remark = QTextEdit() self.remark.setText(my_info['remartk']) layout.addRow(QLabel(u"备注:"), self.remark) self.formGroupBox.setLayout(layout)
def SaveRole(self): data={'number':'','name':'','resource':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['name'] = urllib.quote(str(self.name.text())) data['resource'] = urllib.quote(str(self.resource.text())) (status,content) = my_business.add_role(data) print 'content:%s'%content if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def SaveResume(self): data={'number':'','candidates':'','telephone':'','position_id':0,'part_id':0,'accessories':0,'remartk':'','create':0} where = {'id':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['candidates'] = urllib.quote(str(self.candidates.text())) data['telephone'] = urllib.quote(str(self.telephone.text())) data['position_id'] = 1 data['part_id'] = 1 #附件 if self.accessories.filename != "": (status,content) = my_business.file_upload(str(self.accessories.filename)) if status: data['accessories'] = int(content['content']['id']) else: Edit.message = content Edit.status = False self.parent.set_message(u'错误',content) return False else: data.pop('accessories') data['remartk'] = urllib.quote(str(self.remark.toPlainText())) data['create'] = get_cur_admin_id() where['id'] = self.id (status,content) = my_business.update_resume(data,where) print 'content:%s'%content if status: Edit.message = content Edit.status = True self.parent.set_message(u'提示',content) self.accept() return True else: Edit.message = content Edit.status = False self.parent.set_message(u'错误',content)
def SavePart(self): data={'number':'','name':'','create':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['name'] = urllib.quote(str(self.name.text())) data['create'] = get_cur_admin_id() (status,content) = my_business.add_part(data) print 'content:%s'%content if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) return True else: Add.message = content Add.status = False self.parent.set_message(u'错误',content) pass
def SavePositionhr(self): data={'part_id':0,'name':'','description':'','create':0} my_business = business() #组装数据 data['part_id'] = 2 data['description'] = urllib.quote(str(self.description.toPlainText())) data['name'] = urllib.quote(str(self.name.text())) data['create'] = get_cur_admin_id() (status,content) = my_business.add_positionhr(data) print 'content:%s'%content if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def onActivatedModule(self, cuindex): #print 'cuindex:%d'%cuindex project_id = cuindex if 0 >= project_id: return #查询项目下面的模块 my_business = business() (status,content) = my_business.get_project_mod_by_project_id(project_id) self.project_mod_id.clear() self.project_mod_id.addItem(u'请选择项目模块',QVariant(0)) if status: for (key,item) in content.items(): self.project_mod_id.addItem(unicode(key),QVariant(item)) #成员 (status,content) = my_business.get_project_mem_by_project_id(project_id) self.get_member.clear() self.get_member.addItem(u'请选择受理人',QVariant(0)) if status: for item in content: self.get_member.addItem(unicode(self.my_dict['admin'][str(item)]),QVariant(item))
def AddBugForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #bug添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.level = QComboBox() self.level.addItem(u'超高',QVariant(1)) self.level.addItem(u'高',QVariant(2)) self.level.addItem(u'一般',QVariant(3)) layout.addRow(QLabel(u"<font color='red'>*</font>优先级:"), self.level) self.status = QComboBox() self.status.addItem(u'待解救',QVariant(1)) self.status.addItem(u'已解救',QVariant(2)) self.status.addItem(u'已关闭',QVariant(3)) layout.addRow(QLabel(u"<font color='red'>*</font>状态:"), self.status) self.project_id = QComboBox() (status,my_dict) = my_business.get_dict() self.project_id.addItem(u'请选择项目',QVariant(0)) self.my_dict = my_dict if my_dict.has_key('project'): for (key,value) in my_dict['project'].items(): self.project_id.addItem(value,QVariant(key)) layout.addRow(QLabel(u"<font color='red'>*</font>所属项目:"), self.project_id) self.connect(self.project_id, SIGNAL('activated(int)'), self.onActivatedModule) self.project_mod_id = QComboBox() self.project_mod_id.addItem(u'请选择项目模块',QVariant(0)) layout.addRow(QLabel(u"<font color='red'>*</font>所属模块:"), self.project_mod_id) self.get_member = QComboBox() self.get_member.addItem(u'请选择受理人',QVariant(0)) layout.addRow(QLabel(u"<font color='red'>*</font>受理人:"), self.get_member) self.title = QTextEdit() layout.addRow(QLabel(u"<font color='red'>*</font>问题描述:"), self.title) self.description = WebViewEx() layout.addRow(QLabel(u"操作过程:"), self.description) self.formGroupBox.setLayout(layout) self.formGroupBox.resize(600,700) self.resize(600, 700)
def AddRoleForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #角色添加 layout = QFormLayout() self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>角色名称:"), self.name) #查询资源 (status,content) = my_business.get_resource() source_name_list = {} if status: rows = int(content['record_count']) for i in range(0,rows-1): key = content['list'][i]['source_name'] id = content['list'][i]['id'] source_name_list[key] = id self.resource = MulCheckedBox(self,source_name_list) layout.addRow(QLabel(u"<font color='red'>*</font>权限:"), self.resource) self.formGroupBox.setLayout(layout)
def AddProjectForm(self): layout = QFormLayout() my_business = business() number = my_business.get_number(Add.module_index) #项目添加 layout = QFormLayout() self.name = QLineEdit() layout.addRow(QLabel(u"<font color='red'>*</font>项目名称:"), self.name) self.number = QLabel(number) layout.addRow(QLabel(u" 编号:"), self.number) self.description = QTextEdit() layout.addRow(QLabel(u"项目描述:"), self.description) data ={} (status,content) = my_business.get_dict() if status: for (key,value) in content['admin'].items(): tmp_value = str(value) data[tmp_value] = int(str(key)) self.project_mem = TableComButton(self,data) layout.addRow(QLabel(u"成员:"), self.project_mem) self.project_mod = TableTextButton() layout.addRow(QLabel(u"模块:"), self.project_mod) self.formGroupBox.setLayout(layout)
def SaveResume(self): data={'number':'','candidates':'','telephone':'','position_id':0,'part_id':0, 'accessories':0,'remartk':'','create':0} my_business = business() #组装数据 data['number'] = urllib.quote(str(self.number.text())) data['candidates'] = urllib.quote(str(self.candidates.text())) data['telephone'] = urllib.quote(str(self.telephone.text())) data['position_id'] = 1 data['part_id'] = 1 data['accessories'] = 0 #附件 (status,content) = my_business.file_upload(str(self.accessories.filename)) if status: data['accessories'] = int(content['content']['id']) else: Add.message = content Add.status = False self.parent.set_message(u'错误',content) return False data['remartk'] = urllib.quote(str(self.remark.toPlainText())) data['create'] = get_cur_admin_id() (status,content) = my_business.add_resume(data) print 'content:%s'%content if status: Add.message = content Add.status = True self.parent.set_message(u'提示',content) self.accept() else: Add.message = content Add.status = False self.parent.set_message(u'错误',content)
def my_login(self): import sys #登录逻辑处理模块 user_name = self.t_name.text() passwd = self.t_password.text() self.user_name = user_name self.passwd = passwd my_business = business() (message,status,admin_id,role_id,part_id) = my_business.login(self.user_name, self.passwd) if status: #发送成功消息 self.parent.set_message(u'提示',message) self.parent.set_tray(1) #查询我的bug (status,is_success,message) = my_business.get_my_bug(admin_id) #500,,参数错误 | 200,0,严重错误 | 200,1,一般错误 | 200,-1,没有错误 | 其他查询失败 if 500 == status:#500,,参数错误 pass elif 200 == status and 0 == is_success:#200,0,严重错误 pass elif 200 == status and 1 == is_success:#200,1,一般错误 pass elif 200 == status and -1 == is_success:#200,-1,没有错误 pass else: pass #查询权限 (status,content) = my_business.get_right(int(role_id)) if status: #写权限 right = content['resource'] my_Connector = Db_Connector(os.getcwd()+'/config.ini') my_Connector.set_value_right(right) #写权限及其组权限 team = {1:'项目管理',2:'系统管理',3:'简历管理'} where = {'id':['in',str(content['resource'])]} right_label = [] team_label = [] team_label_str = [] (status,content) = my_business.get_resource_where(where) if status: rows = int(content['record_count']) if 0<rows: for row in range(0,rows): if content['list'][row]['name'] not in right_label: right_label.append(content['list'][row]['name']) if content['list'][row]['team_name'] not in team_label: team_label.append(int(content['list'][row]['team_name'])) #写right_label权限 my_Connector.set_value_right_label(','.join(right_label)) #写组 if 0<len(team_label): for item in team_label: team_label_str.append(str(team[item])) my_Connector.set_value_right_team(','.join(team_label_str)) self.accept() else: self.parent.set_message(u'错误',content) return else: #发送错误消息 self.parent.set_message(u'错误',message) return
self.btnDel.setEnabled(True) self.btnAdd.setEnabled(True) pass def text(self): re_data = [] for key in self.display_data: re_data.append(self.data[key]) return re_data def test(self): print self.text() pass if __name__ == '__main__': app = QtGui.QApplication([]) data = {} my_business = business() (status,content) = my_business.get_dict() if status: for (key,value) in content['admin'].items(): tmp_value = str(value) data[tmp_value] = int(str(key)) print data window = TableComButton(None,data) window.show() sys.exit(app.exec_())