コード例 #1
0
 def insert_log(self):
     # 提交按钮
     if self.tableWidget.rowCount() > 0:
         sql_temporary = "SELECT * FROM temporary WHERE 姓名 = %s"
         data = LinkMySQL().select_sql(sql_temporary, self.name)
         sql_log = "INSERT INTO log(temprary_id,姓名,部门,岗位,时间,工作分类,事项内容,工时,性质,重要等级,状态," \
                   "工作配合,问题和困难) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
         LinkMySQL().commit_sql(sql_log, data, False)
         delete_sql = "DELETE FROM temporary WHERE 姓名 = %s"
         LinkMySQL().commit_sql(delete_sql, self.name)
         self.update_table()
コード例 #2
0
 def insert_temporary(self):
     # 保存按钮
     ls = self.get_list()
     sql = "INSERT INTO temporary(姓名,部门,岗位,时间,工作分类,事项内容,工时,性质,重要等级,状态,工作配合,问题和困难) " \
           "VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
     LinkMySQL().commit_sql(sql, ls)
     self.update_table()  # 更新表数据
コード例 #3
0
 def update_tamporary(self):
     # 修改按钮
     if len(self.id) > 0:
         sql = "UPDATE temporary SET 姓名=%s,部门=%s,岗位=%s,时间=%s,工作分类=%s,事项内容=%s," \
               "工时=%s,性质=%s,重要等级=%s,状态=%s,工作配合=%s,问题和困难=%s WHERE temprary_id = %s"
         ls = self.get_list()
         ls.append(self.id)
         LinkMySQL().commit_sql(sql, ls)
         self.update_table()  # 更新表数据
コード例 #4
0
 def update_table(self):
     # 更新数据,并显示在table
     sql = "SELECT 时间, 工作分类, 事项内容,工时,性质,重要等级,状态," \
           "工作配合,问题和困难, temprary_id FROM temporary WHERE 姓名 = %s"
     data = LinkMySQL().select_sql(sql, self.name)
     self.tableWidget.setRowCount(len(data))
     for c, lindata in enumerate(data):
         for r, value in enumerate(lindata):
             it = QTableWidgetItem(str(value))
             self.tableWidget.setItem(c, r, it)
コード例 #5
0
 def set_list(self, sort):
     # 点击左侧,右侧显示数据
     self.sort = sort
     sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = %s ORDER BY 排序"
     ls = []
     ls.append(self.name)
     ls.append(sort)
     data = LinkMySQL().select_sql(sql_parameter, ls)
     self.listWidget.clear()  # 清空右侧的List
     self.listWidget.addItems([x[0] for x in data])  # 重新给右侧的List添加数据
コード例 #6
0
def show_joblog(ls):
    """
    验证用户信息
    :param ls: 获取用户的密码和姓名
    :return:
    """
    users = LinkMySQL().select_user(ls[0])
    if len(users) == 0 or ls[1] != users[0][3]:
        landing.show_error()
    else:
        landing.hide()
        joblog.get_users(users[0])
        joblog.show()
コード例 #7
0
 def ok(self):
     # 先删除
     sql = "DELETE FROM parameter WHERE 姓名=%s and 大类=%s"
     ls = []
     ls.append(self.name)
     ls.append(self.sort)
     LinkMySQL().commit_sql(sql, ls)
     # 后新增
     ls = []
     tup = []
     for r in range(self.listWidget.count()):
         tup.append(self.name)
         tup.append(self.sort)
         tup.append(self.listWidget.item(r).text())
         tup.append(r)
         tup = tuple(tup)
         ls.append(tup)
         tup = []
     sql = "INSERT INTO parameter values (%s,%s,%s,%s)"
     LinkMySQL().commit_sql(sql, ls, num=False)
     QMessageBox.information(self,
                             "温馨提示",
                             "修改成功",
                             QMessageBox.Yes)
コード例 #8
0
    def get_users(self, user):
        # 设置参数
        self.user = user
        self.name = user[0]
        self.lineEdit.setText(user[0])
        self.lineEdit_2.setText(user[1])
        self.lineEdit_3.setText(user[2])
        self.update_table()  # 更新表数据
        # 工作分类
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '工作分类' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox.addItem(value[0])

        # 工时
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '工时' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox_2.addItem(value[0])

        # 性质
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '性质' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox_3.addItem(value[0])

        # 重要程度
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '重要程度' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox_4.addItem(value[0])

        # 状态
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '状态' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox_5.addItem(value[0])

        # 工作配合
        sql_parameter = "SELECT 小类 FROM parameter WHERE 姓名 = %s AND 大类 = '工作配合' ORDER BY 排序"
        data = LinkMySQL().select_sql(sql_parameter, self.name)
        for value in data:
            self.comboBox_6.addItem(value[0])
コード例 #9
0
 def delete_tamporary(self):
     # 删除按钮
     if len(self.id) > 0:
         sql = "DELETE FROM temporary WHERE temprary_id = %s"
         LinkMySQL().commit_sql(sql, self.id)
         self.update_table()  # 更新表数据