def retranslateUi(self, InStorageForm): _translate = QtCore.QCoreApplication.translate InStorageForm.setWindowTitle(_translate("InStorageForm", "入库管理")) self.label.setText(_translate("InStorageForm", "入库信息查询")) self.addInStorageButton.setText(_translate("InStorageForm", "新建入库信息")) self.selectInStorageInfo.setText(_translate("InStorageForm", "查看产品入库信息")) self.alterInStorageInfo.setText(_translate("InStorageForm", "修改入库信息")) self.deleteInStorageInfo.setText(_translate("InStorageForm", "删除入库信息")) self.searchButton.setText(_translate("InStorageForm", "查询")) self.comboBox.setItemText(0, _translate("InStorageForm", "按产品编号查询")) self.comboBox.setItemText(1, _translate("InStorageForm", "按入库编号查询")) self.label_2.setText(_translate("InStorageForm", "跳转至第")) self.jumpEdit.setText(_translate("InStorageForm", "1")) self.totalPageLabel.setText(_translate("InStorageForm", "/ " + str(self.queryModel.totalPage) + " 页")) self.jumpButton.setText(_translate("InStorageForm", "跳转")) self.previousButton.setText(_translate("InStorageForm", "上一页")) self.nextButton.setText(_translate("InStorageForm", "下一页")) # tableView数据设置 headerRow = ["入库编号", "产品编号", "入库库房", "入库日期", "入库数量", "登记人", "出库编号"] self.tableView.setModel(self.queryModel) self.queryModel = MySearchTableModel("T_In_Detail", headerRow) self.tableView.setModel(self.queryModel) self.header = CheckBoxHeader() self.tableView.setHorizontalHeader(self.header) self.header.clicked.connect(self.queryModel.headerClick) self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.tableView.setModel(self.queryModel) # 按钮绑定事件 # 增加 self.addInStorageButton.clicked.connect(lambda: self.addButtonEvent(AddInStorage())) # 查找 self.searchButton.clicked.connect(self.searchButtonEvent) # 查看 self.selectInStorageInfo.clicked.connect(lambda: self.selectButtonEvent(SelectINStorage())) # 修改 self.alterInStorageInfo.clicked.connect(lambda: self.updateButtonEvent(AlterInStorage())) # 下面是无需改动的按钮 # 删除按钮 self.deleteInStorageInfo.clicked.connect(self.deleteButtonEvent) # 上一页 self.previousButton.clicked.connect(self.preButtonEvent) # 下一页 self.nextButton.clicked.connect(self.nextButtonEvent) # 跳转按钮 self.jumpButton.clicked.connect(self.jumpButtonEvent) # 添加查询 self.searchButton.clicked.connect(self.searchButtonEvent)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(800, 1000) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(Form) font = QtGui.QFont() font.setPointSize(16) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") # 添加按钮 没必要 self.addButton = QtWidgets.QPushButton(Form) self.addButton.setObjectName("addFunctionButton") self.addButton.setDisabled(True) self.addButton.setHidden(True) self.horizontalLayout_5.addWidget(self.addButton) # 查询按钮,没必要 self.showInfo = QtWidgets.QPushButton(Form) self.showInfo.setObjectName("showInfo") self.showInfo.setHidden(False) self.showInfo.setDisabled(False) self.horizontalLayout_5.addWidget(self.showInfo) # 更新修改按钮 self.alterButton = QtWidgets.QPushButton(Form) self.alterButton.setObjectName("alterFunctionButton") self.alterButton.setDisabled(True) self.alterButton.setHidden(True) self.horizontalLayout_5.addWidget(self.alterButton) self.horizontalLayout_3.addLayout(self.horizontalLayout_5) # 删除按钮,没必要 self.deleteButton = QtWidgets.QPushButton(Form) self.deleteButton.setObjectName("deleteFunctionButton") self.deleteButton.setDisabled(True) self.deleteButton.setHidden(True) self.horizontalLayout_3.addWidget(self.deleteButton) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(7) self.horizontalLayout.setObjectName("horizontalLayout") # 查询框 self.searchEdit = QtWidgets.QLineEdit(Form) self.searchEdit.setMaximumSize(QtCore.QSize(500, 16777215)) self.searchEdit.setObjectName("searchEdit") self.horizontalLayout.addWidget(self.searchEdit) # 查询按钮 self.searchButton = QtWidgets.QPushButton(Form) self.searchButton.setObjectName("searchButton") self.horizontalLayout.addWidget(self.searchButton) self.comboBox = QtWidgets.QComboBox(Form) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") self.comboBox.addItem("") self.horizontalLayout.addWidget(self.comboBox) self.horizontalLayout_3.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout_3) # 待修改成需要展示的日志管理界面的表格 self.db = openDB() self.tableView = QTableView() headerRow = ["日志条ID", "用户ID", "登录时间", "是否处于登录状态"] self.queryModel = MySearchTableModel("Login_info", headerRow) self.header = CheckBoxHeader() self.tableView.setHorizontalHeader(self.header) self.header.clicked.connect(self.queryModel.headerClick) self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.tableView.setModel(self.queryModel) self.verticalLayout.addWidget(self.tableView) # self.tableView = QtWidgets.QTableView(Form) # self.tableView.setObjectName("tableView") # self.verticalLayout.addWidget(self.tableView) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_2 = QtWidgets.QLabel(Form) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) self.jumpEdit = QtWidgets.QLineEdit(Form) self.jumpEdit.setMaximumSize(QtCore.QSize(50, 50)) self.jumpEdit.setMaxLength(9999) self.jumpEdit.setAlignment(QtCore.Qt.AlignCenter) self.jumpEdit.setObjectName("jumpEdit") self.horizontalLayout_2.addWidget(self.jumpEdit) self.totalPageLabel = QtWidgets.QLabel(Form) self.totalPageLabel.setObjectName("totalPageLabel") self.horizontalLayout_2.addWidget(self.totalPageLabel) self.jumpButton = QtWidgets.QPushButton(Form) self.jumpButton.setObjectName("jumpButton") self.horizontalLayout_2.addWidget(self.jumpButton) self.previousButton = QtWidgets.QPushButton(Form) self.previousButton.setObjectName("previousButton") self.horizontalLayout_2.addWidget(self.previousButton) self.nextButton = QtWidgets.QPushButton(Form) self.nextButton.setObjectName("nextButton") self.horizontalLayout_2.addWidget(self.nextButton) self.horizontalLayout_4.addLayout(self.horizontalLayout_2) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.retranslateUi(Form) # 绑定按钮事件 self.bindButton() currentUserRightID = distinctUserRight() if currentUserRightID == 0: self.showInfo.setHidden(True) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1171, 813) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(Form) font = QtGui.QFont() font.setPointSize(16) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.addComponentButton = QtWidgets.QPushButton(Form) self.addComponentButton.setObjectName("addComponentButton") self.horizontalLayout_5.addWidget(self.addComponentButton) self.selectComponent = QtWidgets.QPushButton(Form) self.selectComponent.setObjectName("selectComponent") self.horizontalLayout_5.addWidget(self.selectComponent) self.selectSubComponent = QtWidgets.QPushButton(Form) self.selectSubComponent.setObjectName("selectSubComponent") self.horizontalLayout_5.addWidget(self.selectSubComponent) self.alterComponentButton = QtWidgets.QPushButton(Form) self.alterComponentButton.setObjectName("alterComponentButton") self.horizontalLayout_5.addWidget(self.alterComponentButton) self.horizontalLayout_3.addLayout(self.horizontalLayout_5) self.deleteComponentButton = QtWidgets.QPushButton(Form) self.deleteComponentButton.setObjectName("deleteComponentButton") self.horizontalLayout_3.addWidget(self.deleteComponentButton) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(7) self.horizontalLayout.setObjectName("horizontalLayout") self.searchEdit = QtWidgets.QLineEdit(Form) self.searchEdit.setMaximumSize(QtCore.QSize(500, 16777215)) self.searchEdit.setObjectName("searchEdit") self.horizontalLayout.addWidget(self.searchEdit) self.searchButton = QtWidgets.QPushButton(Form) self.searchButton.setObjectName("searchButton") self.horizontalLayout.addWidget(self.searchButton) self.comboBox = QtWidgets.QComboBox(Form) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") self.horizontalLayout.addWidget(self.comboBox) self.horizontalLayout_3.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout_3) # self.tableView = QtWidgets.QTableView(Form) # self.tableView.setObjectName("tableView") # self.verticalLayout.addWidget(self.tableView) # 中间手动代码部分 表格UI构建 self.db = openDB() self.tableView = QTableView() # hsj 自动义的tableModel headerRow = ["组件ID", "产品ID", "组件代号", "组件名称", "父节点ID", "组件类型", "组件数量"] self.queryModel = MySearchTableModel("T_ProductComponent_New", headerRow) self.tableView.setModel(self.queryModel) self.header = CheckBoxHeader() self.tableView.setHorizontalHeader(self.header) self.header.clicked.connect(self.queryModel.headerClick) self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.tableView.setModel(self.queryModel) self.verticalLayout.addWidget(self.tableView) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_2 = QtWidgets.QLabel(Form) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) self.jumpEdit = QtWidgets.QLineEdit(Form) self.jumpEdit.setMaximumSize(QtCore.QSize(50, 50)) self.jumpEdit.setMaxLength(9999) self.jumpEdit.setAlignment(QtCore.Qt.AlignCenter) self.jumpEdit.setObjectName("jumpEdit") self.horizontalLayout_2.addWidget(self.jumpEdit) self.totalPageLabel = QtWidgets.QLabel(Form) self.totalPageLabel.setObjectName("totalPageLabel") self.horizontalLayout_2.addWidget(self.totalPageLabel) self.jumpButton = QtWidgets.QPushButton(Form) self.jumpButton.setObjectName("jumpButton") self.horizontalLayout_2.addWidget(self.jumpButton) self.previousButton = QtWidgets.QPushButton(Form) self.previousButton.setObjectName("previousButton") self.horizontalLayout_2.addWidget(self.previousButton) self.nextButton = QtWidgets.QPushButton(Form) self.nextButton.setObjectName("nextButton") self.horizontalLayout_2.addWidget(self.nextButton) self.horizontalLayout_4.addLayout(self.horizontalLayout_2) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.retranslateUi(Form) self.bindButton() QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(777, 813) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(Form) font = QtGui.QFont() font.setPointSize(16) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.addMaintenanceWayButton = QtWidgets.QPushButton(Form) self.addMaintenanceWayButton.setObjectName("addMaintenanceWayButton") self.horizontalLayout_7.addWidget(self.addMaintenanceWayButton) self.selectMaintenanceWay = QtWidgets.QPushButton(Form) self.selectMaintenanceWay.setObjectName("selectMaintenanceWay") self.horizontalLayout_7.addWidget(self.selectMaintenanceWay) self.alterMaintenanceWayButton = QtWidgets.QPushButton(Form) self.alterMaintenanceWayButton.setObjectName("alterMaintenanceWayButton") self.horizontalLayout_7.addWidget(self.alterMaintenanceWayButton) self.horizontalLayout_6.addLayout(self.horizontalLayout_7) self.deleteMaintenanceWayButton = QtWidgets.QPushButton(Form) self.deleteMaintenanceWayButton.setObjectName("deleteMaintenanceWayButton") self.horizontalLayout_6.addWidget(self.deleteMaintenanceWayButton) self.printProductButton = QtWidgets.QPushButton(Form) self.printProductButton.setObjectName("printProductButton") self.horizontalLayout_6.addWidget(self.printProductButton) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setSpacing(7) self.horizontalLayout_8.setObjectName("horizontalLayout_8") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem) self.searchEdit = QtWidgets.QLineEdit(Form) self.searchEdit.setMaximumSize(QtCore.QSize(500, 16777215)) self.searchEdit.setObjectName("searchEdit") self.horizontalLayout_8.addWidget(self.searchEdit) self.searchButton = QtWidgets.QPushButton(Form) self.searchButton.setObjectName("searchButton") self.horizontalLayout_8.addWidget(self.searchButton) self.comboBox = QtWidgets.QComboBox(Form) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") self.horizontalLayout_8.addWidget(self.comboBox) self.horizontalLayout_6.addLayout(self.horizontalLayout_8) self.verticalLayout.addLayout(self.horizontalLayout_6) # # 中间手动代码部分 表格UI构建 self.db = openDB() self.tableView = QTableView() # hsj 自动义的tableModel # headerRow = ["维保方式", "产品编号","维保方式名称","初次维保时间", # "维保间隔时间(天)", "维保到期前多少天提醒(天)", "创建人员", # "创建时间", "修改人员", "修改时间", "备注","编号"] headerRow = ["维保方式编号", "维保方式名称","产品编号","产品名称","产品代号","维保间隔时间","维保到期提醒","最近维保时间"] self.queryModel = MySearchTableModel("MaintenanceWay", headerRow) # 这里有个setModel self.tableView.setModel(self.queryModel) self.header = CheckBoxHeader() self.tableView.setHorizontalHeader(self.header) self.header.clicked.connect(self.queryModel.headerClick) self.tableView.horizontalHeader().setStretchLastSection(True) self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # 这里也有setModel self.tableView.setModel(self.queryModel) self.verticalLayout.addWidget(self.tableView) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem1) self.horizontalLayout_10 = QtWidgets.QHBoxLayout() self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.label_3 = QtWidgets.QLabel(Form) self.label_3.setObjectName("label_3") self.horizontalLayout_10.addWidget(self.label_3) self.jumpEdit = QtWidgets.QLineEdit(Form) self.jumpEdit.setMaximumSize(QtCore.QSize(50, 50)) self.jumpEdit.setMaxLength(9999) self.jumpEdit.setAlignment(QtCore.Qt.AlignCenter) self.jumpEdit.setObjectName("jumpEdit") self.horizontalLayout_10.addWidget(self.jumpEdit) self.totalPageLabel = QtWidgets.QLabel(Form) self.totalPageLabel.setObjectName("totalPageLabel") self.horizontalLayout_10.addWidget(self.totalPageLabel) self.jumpButton = QtWidgets.QPushButton(Form) self.jumpButton.setObjectName("jumpButton") self.horizontalLayout_10.addWidget(self.jumpButton) self.previousButton = QtWidgets.QPushButton(Form) self.previousButton.setObjectName("previousButton") self.horizontalLayout_10.addWidget(self.previousButton) self.nextButton = QtWidgets.QPushButton(Form) self.nextButton.setObjectName("nextButton") self.horizontalLayout_10.addWidget(self.nextButton) self.horizontalLayout_9.addLayout(self.horizontalLayout_10) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem2) self.verticalLayout.addLayout(self.horizontalLayout_9) self.retranslateUi(Form) self.comboBox.setCurrentIndex(0) # 这里绑定按钮 self.bindButton() QtCore.QMetaObject.connectSlotsByName(Form)