#include "staff_chewei_manage_widget.h"
StaffCheWeiManageWidget::StaffCheWeiManageWidget()
{
b_btn_4=new QPushButton;
b_btn_5=new QPushButton;
b_btn_6=new QPushButton;
b_layout_2=new QHBoxLayout;
label_1=new QLabel;
label_2=new QLabel;
label_1->setText("车位管理");
label_2->setText("车位租售");
b_btn_1->setText("添加");
b_btn_2->setText("修改");
b_btn_3->setText("查询");
b_btn_4->setText("删除");
b_btn_5->setText("出租");
b_btn_6->setText("出售");
//为关联信号和槽做准备
scwaw=new StaffCheWeiAddWidget;
scwew=new StaffCheWeiEditWidget;
scwdw=new StaffCheWeiDetailWidget;
scwsw=new StaffCheWeiSearchWidget;
bscwhw_1=new BaseStaffCheWeiHandleWidget;
bscwhw_2=new BaseStaffCheWeiHandleWidget;
b_layout->addWidget(label_1,2);
b_layout->addWidget(b_btn_1,3);
b_layout->addWidget(b_btn_2,3);
b_layout->addWidget(b_btn_3,3);
b_layout->addWidget(b_btn_4,3);
b_layout_2->addWidget(label_2,1);
b_layout_2->addWidget(b_btn_5,3);
b_layout_2->addWidget(b_btn_6,3);
layout->addLayout(b_layout_2);
//为关联信号和槽做准备
connect(b_btn_1,QPushButton::clicked,this,add);
connect(b_btn_2,QPushButton::clicked,this,edit);
connect(b_btn_3,QPushButton::clicked,this,search);
connect(b_btn_4,QPushButton::clicked,this,del);
connect(b_btn_5,QPushButton::clicked,this,chuzu);
connect(b_btn_6,QPushButton::clicked,this,chushou);
connect(scwaw,&StaffCheWeiAddWidget::newCheWei,this,refreshData);
connect(scwew,&StaffCheWeiEditWidget::editCheWei,this,refreshData);
connect(scwsw,&StaffCheWeiSearchWidget::entered,this,receiveKey);
this->init();
}
void StaffCheWeiManageWidget::receiveKey(const QString &key){
scwsw->hide();
scwsw->clear();
bool flag=scwdw->loadData(key);
if(!flag){
QMessageBox::information(this,tr("错误"),tr("加载失败!"),QMessageBox::Ok);
return;
}
scwdw->setWindowTitle("详情");
scwdw->setWindowModality(Qt::ApplicationModal);
scwdw->show();
}
void StaffCheWeiManageWidget::init(){
QString queryStr=QString("select pp_num"
", case account_num"
" when '0' then '空'"
" else account_num"
" end as account_num"
" ,case c_status"
" when 0 then '待租/售'"
" when 1 then '已租'"
" when 2 then '已售'"
" end as c_status"
" ,case c_type"
" when 1 then '小型车位'"
" when 2 then '中型车位'"
" when 3 then '大型车位'"
" end as c_type"
" ,case c_chongdian"
" when 0 then '无'"
" when 1 then '有'"
" end as c_chongdian"
" ,c_price_1"
" ,c_price_2"
" from chewei"
" where c_del=0");
this->load(queryStr);
q_model->setHeaderData(0, Qt::Orientation::Horizontal, "车位号");
q_model->setHeaderData(1, Qt::Orientation::Horizontal, "业主账号");
q_model->setHeaderData(2, Qt::Orientation::Horizontal, "租售状态");
q_model->setHeaderData(3, Qt::Orientation::Horizontal, "车位类型");
q_model->setHeaderData(4, Qt::Orientation::Horizontal, "充电桩状态");
q_model->setHeaderData(5, Qt::Orientation::Horizontal, "出租价格(元)");
q_model->setHeaderData(6, Qt::Orientation::Horizontal, "出售价格(元)");
}
void StaffCheWeiManageWidget::refreshData(){
this->init();
}
void StaffCheWeiManageWidget::add(){
scwaw->setWindowTitle("添加");
scwaw->setWindowModality(Qt::ApplicationModal);
scwaw->show();
}
void StaffCheWeiManageWidget::edit(){
QString key;
setMajorKey(key);
if(!scwew->isFree(key)){
QMessageBox::information(this,tr("提示"),tr("已租售车位不可修改!"),QMessageBox::Ok);
return ;
}
scwew->loadData(key);
scwew->setWindowTitle("修改");
scwew->setWindowModality(Qt::ApplicationModal);
scwew->show();
}
void StaffCheWeiManageWidget::search(){
scwsw->setWindowTitle("查询");
scwsw->setWindowModality(Qt::ApplicationModal);
scwsw->show();
}
void StaffCheWeiManageWidget::del(){
QString key;
setMajorKey(key);
QSqlQuery query;
QString str=QString("select c_status from chewei"
" where pp_num=%1").arg(key.toInt());
bool flag=query.exec(str);
if(!flag){
QMessageBox::information(this,tr("错误"),tr("加载失败!"),QMessageBox::Ok);
return ;
}
query.next();
if(query.value(0).toInt()!=0){
QMessageBox::information(this,tr("提示"),tr("已租售车位不可删除!"),QMessageBox::Ok);
return ;
}
QMessageBox::StandardButton reply;
reply = QMessageBox::warning(this, "警告", "确定删除?", QMessageBox::Yes | QMessageBox::No);
if(reply == QMessageBox::No){
return ;
}
QString str_2=QString("update chewei set c_del=1 where pp_num=%1").arg(key);
query.exec(str_2);
this->refreshData();
}
void StaffCheWeiManageWidget::handle(BaseStaffCheWeiHandleWidget &bscwhw,int type){
QString key;
QString info=type==1?"出租":"出售";
setMajorKey(key);
if(key==""){
QMessageBox::information(this,tr("提示"),tr("请选择车位!"),QMessageBox::Ok);
return ;
}
if(bscwhw.getStatus(key)==1){
QMessageBox::information(this,tr("提示"),tr("此车位为已租状态!"),QMessageBox::Ok);
return ;
}
else if(bscwhw.getStatus(key)==2){
QMessageBox::information(this,tr("提示"),tr("此车位为已售状态!"),QMessageBox::Ok);
return ;
}
if(!bscwhw.isApplied(key,type)){
QMessageBox::information(this,tr("提示"),tr("暂无业主申请租赁此车位!"),QMessageBox::Ok);
return ;
}
else{
if(bscwhw.handle(key,type)){
QMessageBox::information(this,tr("提示"),info+"成功!",QMessageBox::Ok);
this->refreshData();
}
else{
QMessageBox::information(this,tr("提示"),info+"失败!",QMessageBox::Ok);
}
}
}
void StaffCheWeiManageWidget::chuzu(){
handle(*bscwhw_1,1);
}
void StaffCheWeiManageWidget::chushou(){
handle(*bscwhw_2,2);
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!! 本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!! 本资源中的源码都是经过本地编译过可运行的,下载后按照文档配置好环境就可以运行。资源项目的难度比较适中,内容都是经过助教老师审定过的,应该能够满足学习、使用需求,如果有需要的话可以放心下载使用。有任何问题也可以随时私信博主,博主会第一时间给您解答!!!
资源推荐
资源详情
资源评论
收起资源包目录
C语言程序大作业:Qt实现的一个关于小区的数据管理系统.zip (83个子文件)
content
staff_yezhu_edit_widget.cpp 2KB
base_detail_widget.cpp 188B
staff_chewei_search_widget.cpp 265B
staff_chewei_detail_widget.h 723B
staff_feiyong_search_widget.h 698B
manager_renyuan_edit_widget.h 666B
staff_chewei_edit_widget.h 866B
owner_chewei_manage_widget.h 688B
staff_yezhu_manage_widget.h 735B
manager_renyuan_manage_widget.h 741B
owner_guzhang_add_widget.h 690B
staff_chewei_add_widget.h 971B
base_handle_widget.cpp 532B
manager_renyuan_detail_widget.h 551B
staff_feiyong_manage_widget.h 698B
staff_guzhang_edit_widget.h 790B
staff_yezhu_manage_widget.cpp 3KB
staff_chewei_manage_widget.cpp 7KB
staff_guzhang_edit_widget.cpp 3KB
staff_chewei_manage_widget.h 1KB
base_search_widget.cpp 938B
logindialog.ui 3KB
login_dialog.h 649B
staff_form.h 1KB
manager_renyuan_manage_widget.cpp 3KB
login_dialog.cpp 3KB
sqlmanager.h 339B
owner_guzhang_manage_widget.cpp 3KB
smart-community.pro.user 23KB
staff_chewei_edit_widget.cpp 4KB
owner_feiyong_add_widget.h 846B
owner_feiyong_add_widget.cpp 3KB
owner_feiyong_search_widget.h 698B
manager_renyuan_edit_widget.cpp 2KB
owner_guzhang_manage_widget.h 690B
owner_feiyong_search_widget.cpp 1KB
staff_chuqin_detail.h 517B
base_staff_chewei_handle_widget.h 604B
staff_yezhu_add_widget.h 678B
staff_chuqin_detail.cpp 1KB
owner_form.cpp 2KB
staff_chewei_search_widget.h 287B
base_manage_widget.h 708B
owner_feiyong_manage_widget.cpp 2KB
main.cpp 427B
staff_yezhu_detail_widget.cpp 1KB
staff_feiyong_add_widget.cpp 4KB
staff_yezhu_add_widget.cpp 3KB
owner_feiyong_manage_widget.h 698B
smart-community.pro 4KB
owner_guzhang_pingjia_widget.cpp 1KB
manager_renyuan_add_widget.cpp 3KB
staff_guzhang_manage_widget.h 547B
owner_guzhang_add_widget.cpp 2KB
owner_guzhang_pingjia_widget.h 740B
manager_form.cpp 2KB
base_manage_widget.cpp 1KB
staff_chewei_add_widget.cpp 5KB
staff_yezhu_detail_widget.h 501B
staff_feiyong_manage_widget.cpp 2KB
staff_kaoqin_manage_widget.cpp 3KB
manager_renyuan_detail_widget.cpp 2KB
.gitignore 449B
staff_form.cpp 2KB
manager_chuqin_manage_widget.h 324B
manager_kaoqin_manage_widget.h 499B
staff_yezhu_edit_widget.h 656B
manager_form.h 851B
owner_chewei_manage_widget.cpp 4KB
staff_chewei_detail_widget.cpp 3KB
sqlmanager.cpp 585B
staff_feiyong_add_widget.h 846B
manager_chuqin_manage_widget.cpp 664B
staff_feiyong_search_widget.cpp 1KB
base_detail_widget.h 393B
owner_form.h 832B
base_handle_widget.h 539B
base_search_widget.h 624B
base_staff_chewei_handle_widget.cpp 2KB
manager_kaoqin_manage_widget.cpp 3KB
manager_renyuan_add_widget.h 606B
staff_kaoqin_manage_widget.h 773B
staff_guzhang_manage_widget.cpp 2KB
共 83 条
- 1
资源评论
白话机器学习
- 粉丝: 8931
- 资源: 7681
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功