|
@@ -194,6 +194,8 @@ void MatterElementConfigWidget::initConfigItems()
|
|
|
d.name = sub.name;
|
|
|
d.leftValues = QVector<double>(m_domainLevel + 1, 0);
|
|
|
d.rightValues = QVector<double>(m_domainLevel + 1, 0);
|
|
|
+ d.leftCloses = QVector<bool>(m_domainLevel + 1, false);
|
|
|
+ d.rightCloses = QVector<bool>(m_domainLevel + 1, false);
|
|
|
children.append(d);
|
|
|
}
|
|
|
MEConfigItem i;
|
|
@@ -217,9 +219,11 @@ void MatterElementConfigWidget::initConfigItems()
|
|
|
gii.gradeIndexName = configItem.childs.at(c).name;
|
|
|
gii.gradeParentName = configItem.parentName;
|
|
|
gii.gradeLevel = domain + 1;
|
|
|
- gii.gradeIndexValue = QString("(%1, %2)")
|
|
|
+ gii.gradeIndexValue = QString("%1%2, %3%4")
|
|
|
+ .arg(configItem.childs.at(c).leftCloses.at(domain) ? "[" : "(")
|
|
|
.arg(configItem.childs.at(c).leftValues.at(domain))
|
|
|
- .arg(configItem.childs.at(c).rightValues.at(domain));
|
|
|
+ .arg(configItem.childs.at(c).rightValues.at(domain))
|
|
|
+ .arg(configItem.childs.at(c).rightCloses.at(domain) ? "]" : ")");
|
|
|
if (!GradeIndexInfoService().AddGradeIndexInfo(gii)) {
|
|
|
QMessageBox::warning(this, "警告", "数据库访问失败");
|
|
|
}
|
|
@@ -235,11 +239,13 @@ void MatterElementConfigWidget::initConfigItems()
|
|
|
// 默认指标名具有唯一性
|
|
|
if (gindex->gradeIndexName == configItem.childs[c].name
|
|
|
&& gindex->gradeLevel == domain + 1) {
|
|
|
- QStringList list = gindex->gradeIndexValue.mid(1, gindex->gradeIndexValue.size() - 2)
|
|
|
- .replace(" ", "")
|
|
|
- .split(",");
|
|
|
+ QString indexValue = gindex->gradeIndexValue.trimmed();
|
|
|
+ QStringList list = indexValue.mid(1, indexValue.size() - 2).replace(" ", "").split(",");
|
|
|
+
|
|
|
configItem.childs[c].leftValues[domain] = list.at(0).toDouble();
|
|
|
configItem.childs[c].rightValues[domain] = list.at(1).toDouble();
|
|
|
+ configItem.childs[c].leftCloses[domain] = indexValue[0] == "[";
|
|
|
+ configItem.childs[c].rightCloses[domain] = indexValue.right(1) == "]";
|
|
|
found = true;
|
|
|
}
|
|
|
}
|
|
@@ -252,9 +258,12 @@ void MatterElementConfigWidget::initConfigItems()
|
|
|
gii.gradeIndexName = configItem.childs[c].name;
|
|
|
gii.gradeParentName = configItem.parentName;
|
|
|
gii.gradeLevel = domain + 1;
|
|
|
- gii.gradeIndexValue = QString("(%1, %2)")
|
|
|
- .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
- .arg(configItem.childs[c].rightValues.at(domain));
|
|
|
+ gii.gradeIndexValue =
|
|
|
+ QString("%1%2, %3%4")
|
|
|
+ .arg(configItem.childs.at(c).leftCloses.at(domain) ? "[" : "(")
|
|
|
+ .arg(configItem.childs.at(c).leftValues.at(domain))
|
|
|
+ .arg(configItem.childs.at(c).rightValues.at(domain))
|
|
|
+ .arg(configItem.childs.at(c).rightCloses.at(domain) ? "]" : ")");
|
|
|
if (!GradeIndexInfoService().AddGradeIndexInfo(gii)) {
|
|
|
QMessageBox::warning(this, "警告", "数据库访问失败");
|
|
|
}
|
|
@@ -347,9 +356,11 @@ void MatterElementConfigWidget::initDomainTable()
|
|
|
s->setTextAlignment(Qt::AlignCenter);
|
|
|
|
|
|
if (r < m_domainLevel) {
|
|
|
- s->setText(QString("(%1, %2)")
|
|
|
+ s->setText(QString("%1%2, %3%4")
|
|
|
+ .arg(m_allConfigItems[pindex].childs[k].leftCloses[r] ? "[" : "(")
|
|
|
.arg(m_allConfigItems[pindex].childs[k].leftValues[r])
|
|
|
- .arg(m_allConfigItems[pindex].childs[k].rightValues[r]));
|
|
|
+ .arg(m_allConfigItems[pindex].childs[k].rightValues[r])
|
|
|
+ .arg(m_allConfigItems[pindex].childs[k].rightCloses[r] ? "]" : ")"));
|
|
|
tModel->setItem(k, r * 4 + 3, s);
|
|
|
}
|
|
|
}
|
|
@@ -494,10 +505,12 @@ void MatterElementConfigWidget::onSaveBtnClick()
|
|
|
int indexNumber = m_allConfigItems.at(pindex).childs.size();
|
|
|
for (int r = 0; r < m_domainLevel + 1; ++r) {
|
|
|
for (int k = 0; k < indexNumber; ++k) {
|
|
|
- QString txt = tModel->item(k, r * 4 + 3)->text().trimmed();
|
|
|
- QStringList list = txt.mid(1, txt.size() - 2).replace(" ", "").split(",");
|
|
|
+ QString itemTxt = tModel->item(k, r * 4 + 3)->text();
|
|
|
+ QStringList list = itemTxt.mid(1, itemTxt.size() - 2).replace(" ", "").split(",");
|
|
|
m_allConfigItems[pindex].childs[k].leftValues[r] = list.at(0).toDouble();
|
|
|
m_allConfigItems[pindex].childs[k].rightValues[r] = list.at(1).toDouble();
|
|
|
+ m_allConfigItems[pindex].childs[k].leftCloses[r] = itemTxt[0] == "[";
|
|
|
+ m_allConfigItems[pindex].childs[k].rightCloses[r] = itemTxt.right(1) == "]";
|
|
|
qDebug() << r << k << list;
|
|
|
}
|
|
|
}
|
|
@@ -517,9 +530,12 @@ void MatterElementConfigWidget::onSaveBtnClick()
|
|
|
gii.gradeIndexName = configItem.childs[c].name;
|
|
|
gii.gradeParentName = configItem.parentName;
|
|
|
gii.gradeLevel = domain + 1;
|
|
|
- gii.gradeIndexValue = QString("(%1, %2)")
|
|
|
+ gii.gradeIndexValue = QString("%1%2, %3%4")
|
|
|
+ .arg(configItem.childs[c].leftCloses.at(domain) ? "[" : "(")
|
|
|
.arg(configItem.childs[c].leftValues.at(domain))
|
|
|
- .arg(configItem.childs[c].rightValues.at(domain));
|
|
|
+ .arg(configItem.childs[c].rightValues.at(domain))
|
|
|
+ .arg(configItem.childs[c].rightCloses.at(domain) ? "]" : ")");
|
|
|
+
|
|
|
if (!GradeIndexInfoService().AddGradeIndexInfo(gii)) {
|
|
|
QMessageBox::warning(this, "警告", "数据库访问失败");
|
|
|
}
|
|
@@ -530,17 +546,19 @@ void MatterElementConfigWidget::onSaveBtnClick()
|
|
|
for (const auto &configItem : m_allConfigItems) {
|
|
|
for (int c = 0; c < configItem.childs.size(); c++) {
|
|
|
bool found = false;
|
|
|
+
|
|
|
for (auto &gindex : gradeIndexInfoList) {
|
|
|
for (int domain = 0; domain < m_domainLevel + 1; ++domain) {
|
|
|
if ((gindex->gradeIndexName == configItem.childs[c].name)
|
|
|
&& (gindex->gradeLevel == domain + 1)) {
|
|
|
- if (gindex->gradeIndexValue
|
|
|
- != QString("(%1, %2)")
|
|
|
- .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
- .arg(configItem.childs[c].rightValues.at(domain))) {
|
|
|
- gindex->gradeIndexValue = QString("(%1, %2)")
|
|
|
- .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
- .arg(configItem.childs[c].rightValues.at(domain));
|
|
|
+ QString indexValue =
|
|
|
+ QString("%1%2, %3%4")
|
|
|
+ .arg(configItem.childs[c].leftCloses.at(domain) ? "[" : "(")
|
|
|
+ .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
+ .arg(configItem.childs[c].rightValues.at(domain))
|
|
|
+ .arg(configItem.childs[c].rightCloses.at(domain) ? "]" : ")");
|
|
|
+ if (gindex->gradeIndexValue != indexValue) {
|
|
|
+ gindex->gradeIndexValue = indexValue;
|
|
|
if (!GradeIndexInfoService().UpdateGradeIndexInfo(*gindex)) {
|
|
|
QMessageBox::warning(this, "警告", "数据库访问失败");
|
|
|
}
|
|
@@ -551,14 +569,17 @@ void MatterElementConfigWidget::onSaveBtnClick()
|
|
|
}
|
|
|
if (!found) {
|
|
|
for (int domain = 0; domain < m_domainLevel + 1; ++domain) {
|
|
|
+ QString indexValue = QString("%1%2, %3%4")
|
|
|
+ .arg(configItem.childs[c].leftCloses.at(domain) ? "[" : "(")
|
|
|
+ .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
+ .arg(configItem.childs[c].rightValues.at(domain))
|
|
|
+ .arg(configItem.childs[c].rightCloses.at(domain) ? "]" : ")");
|
|
|
GradeIndexInfo gii;
|
|
|
gii.projectId = projectId;
|
|
|
gii.gradeIndexName = configItem.childs[c].name;
|
|
|
gii.gradeParentName = configItem.parentName;
|
|
|
gii.gradeLevel = c + 1;
|
|
|
- gii.gradeIndexValue = QString("(%1, %2)")
|
|
|
- .arg(configItem.childs[c].leftValues.at(domain))
|
|
|
- .arg(configItem.childs[c].rightValues.at(domain));
|
|
|
+ gii.gradeIndexValue = indexValue;
|
|
|
if (!GradeIndexInfoService().AddGradeIndexInfo(gii)) {
|
|
|
QMessageBox::warning(this, "警告", "数据库访问失败");
|
|
|
}
|