def _submit(self): name = self.staff_name.text() sex = self.gender.text() id_card_no = self.id_card_no.text() submit_staff_info(name, sex, id_card_no, self.staff_id) QMessageBox.information(self.submit, "提示", "提交成功") self.close() set_table_content(self.staff_table, get_all_staff(), self.table_title)
def _delete_staff(self): staff_id = get_table_current_index_info(self.staff_table, 0) if staff_id: reply = QtWidgets.QMessageBox.question(self.delete_staff, 'Message', "是否删除此员工?", QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) if reply == QtWidgets.QMessageBox.Yes: delete_staff_by_id(staff_id) set_table_content(self.staff_table, get_all_staff(), self.table_title) else: QtWidgets.QMessageBox.information(self.delete_staff, "提示", "请选择员工")
def worker(self, keyword, get_data): try: if self.request.method == 'POST': if keyword == "code": code = get_data.get("code", "").strip() root = 'config.ini' basicMsg = configparser.ConfigParser() basicMsg.read(root) localCode = basicMsg.get("msg", "code") if code != "" and localCode == code: # 请求获取门店信息 data = store_pc_info.get_store_detail() if not self.connect or not data: store = config.get_local_store_info() data = { 'data': { "pcId": store.id(), "pcPhone": store.phone(), "pcAddress": store.address(), "pcSign": store.name(), }, 'code': 200 } if data.get('code') == 200: result = data.get("data") else: raise ApiException(ErrorCode.CodeError) else: raise ApiException(ErrorCode.CodeError) return set_return_dicts(result) elif keyword == "ip": return set_return_dicts(True) else: raise ApiException(ErrorCode.ErrorRequest) elif self.request.method == "GET": if keyword == "list": worker = user_handler.get_all_staff() worker_list = list() for data in worker: worker_list.append({ "workerId": data[0], "workerName": data[1] }) return set_return_dicts(worker_list) else: raise ApiException(ErrorCode.ErrorRequest) except ApiException as e: return set_return_dicts(forWorker=e.error_result['forWorker'], code=e.error_result['errorCode'], forUser=e.error_result['forUser'])
def __init__(self): super(Staff, self).__init__() self.setupUi(self) self.setWindowTitle('门店人员管理') self.staff_table.horizontalHeader().setDefaultAlignment(Qt.AlignCenter) self.table_title = ("ID", '姓名', '性别', '身份证号码', '创建时间') self._init_signal_and_slot() set_table_content(self.staff_table, get_all_staff(), self.table_title)