2025-05-16 19:20:46 +08:00
|
|
|
|
#include "baseInfoDlg.h"
|
2025-07-11 18:13:54 +08:00
|
|
|
|
#include "graphicsItem/electricBayItem.h"
|
|
|
|
|
|
#include "graphicsDataModel/fixedPortsModel.h"
|
2025-05-16 19:20:46 +08:00
|
|
|
|
#include "ui_baseInfoDlg.h"
|
2025-05-23 10:30:52 +08:00
|
|
|
|
#include "dataBase.h"
|
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
#include "baseProperty.h"
|
|
|
|
|
|
#include "basePropertyManager.h"
|
2025-10-17 18:14:44 +08:00
|
|
|
|
#include "itemPropertyDlg.h"
|
2025-05-23 10:30:52 +08:00
|
|
|
|
#include <QButtonGroup>
|
2025-05-16 19:20:46 +08:00
|
|
|
|
|
|
|
|
|
|
BaseInfoDlg::BaseInfoDlg(QWidget *parent)
|
|
|
|
|
|
: BaseContentDlg(parent)
|
|
|
|
|
|
, ui(new Ui::baseInfoDlg)
|
2025-10-17 18:14:44 +08:00
|
|
|
|
,_parentDlg(nullptr)
|
2025-05-16 19:20:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
2025-05-23 10:30:52 +08:00
|
|
|
|
_stateGroup = new QButtonGroup(this);
|
|
|
|
|
|
_stateGroup->addButton(ui->rb_inService,1);
|
|
|
|
|
|
_stateGroup->addButton(ui->rb_outService,0);
|
2025-07-18 18:26:13 +08:00
|
|
|
|
_stateGroup->setExclusive(true);
|
2025-10-17 18:14:44 +08:00
|
|
|
|
initial();
|
2025-05-16 19:20:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BaseInfoDlg::~BaseInfoDlg()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-17 18:14:44 +08:00
|
|
|
|
void BaseInfoDlg::initial()
|
|
|
|
|
|
{
|
|
|
|
|
|
connect(ui->btn_icon,&QPushButton::clicked,this,&BaseInfoDlg::onIconManagerClicked);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-16 19:20:46 +08:00
|
|
|
|
void BaseInfoDlg::createGroupView(groupStateInfo infos)
|
|
|
|
|
|
{
|
2025-05-23 10:30:52 +08:00
|
|
|
|
QList<gridInfo> lstGrid = DataBase::GetInstance()->getAllGrid();
|
|
|
|
|
|
QList<zoneInfo> lstZone = DataBase::GetInstance()->getAllZone();
|
|
|
|
|
|
QList<stationInfo> lstStation = DataBase::GetInstance()->getAllStation();
|
2025-05-16 19:20:46 +08:00
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
for(auto &info:lstGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->cb_grid->addItem(info.name,info.id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(auto &info:lstZone)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->cb_zone->addItem(info.name,info.id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(auto &info:lstStation)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->cb_station->addItem(info.name,info.id);
|
|
|
|
|
|
}
|
2025-05-16 19:20:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
QMap<QString,propertyStateInfo> BaseInfoDlg::getPropertyValue(BaseProperty* pPro)
|
2025-05-16 19:20:46 +08:00
|
|
|
|
{
|
|
|
|
|
|
QMap<QString,propertyStateInfo> map;
|
|
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
if(pPro)
|
|
|
|
|
|
{
|
|
|
|
|
|
pPro->setTag(ui->le_tag->text());
|
|
|
|
|
|
pPro->setPath(ui->le_nameSpace->text());
|
|
|
|
|
|
pPro->setName(ui->le_name->text());
|
|
|
|
|
|
pPro->setLabel(QJsonObject());
|
|
|
|
|
|
pPro->setDescription(ui->le_description->text());
|
|
|
|
|
|
pPro->setGrid(ui->cb_grid->currentText());
|
|
|
|
|
|
pPro->setZone(ui->cb_zone->currentText());
|
|
|
|
|
|
pPro->setStation(ui->cb_station->currentText());
|
2025-05-16 19:20:46 +08:00
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
QJsonObject connectBus;
|
|
|
|
|
|
connectBus["bay_name"] = ui->le_bayName->text();
|
|
|
|
|
|
connectBus["bay_offset_outer"] = ui->le_idx_1->text();
|
|
|
|
|
|
connectBus["bay_offset_inner"] = ui->le_idx_2->text();
|
|
|
|
|
|
connectBus["from_uuid"] = ui->le_from->text();
|
|
|
|
|
|
connectBus["to_uuid"] = ui->le_to->text();
|
|
|
|
|
|
pPro->setConnectedBus(connectBus);
|
|
|
|
|
|
pPro->setInService(_stateGroup->checkedId());
|
|
|
|
|
|
pPro->setState(ui->le_status->text().toInt());
|
2025-05-16 19:20:46 +08:00
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
emit BasePropertyManager::instance().dataChanged(pPro->uuid().toString());
|
|
|
|
|
|
}
|
2025-05-16 19:20:46 +08:00
|
|
|
|
return map;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
void BaseInfoDlg::setPropertyValue(QVariant var)
|
2025-05-16 19:20:46 +08:00
|
|
|
|
{
|
2025-05-23 10:30:52 +08:00
|
|
|
|
BaseProperty* pPro = static_cast<BaseProperty*>(var.value<void*>());
|
|
|
|
|
|
if(pPro)
|
2025-05-16 19:20:46 +08:00
|
|
|
|
{
|
2025-05-23 10:30:52 +08:00
|
|
|
|
ui->le_uuid->setText(pPro->uuid().toString());
|
|
|
|
|
|
ui->le_tag->setText(pPro->tag());
|
|
|
|
|
|
ui->le_nameSpace->setText(pPro->path());
|
|
|
|
|
|
ui->le_name->setText(pPro->name());
|
|
|
|
|
|
ui->le_label->setText(""); //label josn格式暂不解析
|
|
|
|
|
|
ui->le_description->setText(pPro->description());
|
|
|
|
|
|
ui->cb_grid->setCurrentText(pPro->grid());
|
|
|
|
|
|
ui->cb_zone->setCurrentText(pPro->zone());
|
|
|
|
|
|
ui->cb_station->setCurrentText(pPro->station());
|
|
|
|
|
|
|
|
|
|
|
|
ui->le_status->setText(QString::number(pPro->state())); //page status字段将移动到component
|
2025-05-16 19:20:46 +08:00
|
|
|
|
|
2025-05-23 10:30:52 +08:00
|
|
|
|
QJsonObject connectBus = pPro->connectedBus();
|
|
|
|
|
|
QString bay_name = connectBus["bay_name"].toString();
|
|
|
|
|
|
QString bay_offset_outer = connectBus["bay_offset_outer"].toString();
|
|
|
|
|
|
QString bay_offset_inner = connectBus["bay_offset_inner"].toString();
|
|
|
|
|
|
QString from_uuid = connectBus["from_uuid"].toString();
|
|
|
|
|
|
QString to_uuid = connectBus["to_uuid"].toString();
|
2025-07-11 18:13:54 +08:00
|
|
|
|
//ui->le_bayName->setText(bay_name);
|
2025-05-23 10:30:52 +08:00
|
|
|
|
ui->le_idx_1->setText(bay_offset_outer);
|
|
|
|
|
|
ui->le_idx_2->setText(bay_offset_inner);
|
2025-07-11 18:13:54 +08:00
|
|
|
|
//ui->le_from->setText(from_uuid);
|
|
|
|
|
|
//ui->le_to->setText(to_uuid);
|
2025-05-23 10:30:52 +08:00
|
|
|
|
if(pPro->inService() == 1)
|
|
|
|
|
|
ui->rb_inService->setChecked(true);
|
|
|
|
|
|
else
|
|
|
|
|
|
ui->rb_outService->setChecked(true);
|
2025-07-11 18:13:54 +08:00
|
|
|
|
|
|
|
|
|
|
//间隔处理
|
|
|
|
|
|
BayProperty* pBay = nullptr;
|
|
|
|
|
|
QMap<QUuid,ElectricBayItem*> mapBay = _curModelController->allBayItem();
|
|
|
|
|
|
for(auto& item:mapBay){
|
|
|
|
|
|
AbstractProperty* p = item->getProperty();
|
|
|
|
|
|
BayProperty* pBayPro = dynamic_cast<BayProperty*>(p);
|
|
|
|
|
|
if(pBayPro){
|
|
|
|
|
|
QList<QUuid> lstCompo = pBayPro->getLstComponent(); //获取间隔下的component,找到本component对应的间隔
|
|
|
|
|
|
for(auto& id:lstCompo){
|
|
|
|
|
|
if(id == pPro->uuid()){
|
|
|
|
|
|
pBay = pBayPro;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(pBay){
|
|
|
|
|
|
auto lstFrom = pBay->getLstFrom();
|
|
|
|
|
|
auto lstTo = pBay->getLstTo();
|
|
|
|
|
|
|
|
|
|
|
|
QStringList sLstFrom;
|
|
|
|
|
|
for(auto& fromId:lstFrom){
|
|
|
|
|
|
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(fromId);
|
|
|
|
|
|
if(pPro){
|
|
|
|
|
|
sLstFrom.append(pPro->tag());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QStringList sLstTo;
|
|
|
|
|
|
for(auto& toId:lstTo){
|
|
|
|
|
|
BaseProperty* pPro = BasePropertyManager::instance().findEntityData(toId);
|
|
|
|
|
|
if(pPro){
|
|
|
|
|
|
sLstTo.append(pPro->tag());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ui->le_bayName->setText(pBay->tag());
|
|
|
|
|
|
ui->le_from->setText(sLstFrom.join("、"));
|
|
|
|
|
|
ui->le_to->setText(sLstTo.join("、"));
|
|
|
|
|
|
}
|
2025-05-16 19:20:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-17 18:14:44 +08:00
|
|
|
|
|
|
|
|
|
|
void BaseInfoDlg::onIconManagerClicked()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(_parentDlg){
|
|
|
|
|
|
_parentDlg->getModelController()->showProjectIconSettingDlg(_parentDlg->getCurItem());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|