|
@@ -135,18 +135,19 @@ void DataTableWidget::setupModels()
|
|
|
|
|
|
hIndex += hHeaders.size();
|
|
|
|
|
|
- QList<SchemaEval *> schemeList;
|
|
|
+ m_schemeList.clear();
|
|
|
if (m_process.indexType == ProjectManager::EfficiencyIndex) {
|
|
|
- SchemeInfoService().QuerySchemeInfoByEngineerId(&schemeList, m_process.projectId, 1);
|
|
|
+ SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 1);
|
|
|
}
|
|
|
if (m_process.indexType == ProjectManager::OptimalIndex) {
|
|
|
- SchemeInfoService().QuerySchemeInfoByEngineerId(&schemeList, m_process.projectId, 0);
|
|
|
+ SchemeInfoService().QuerySchemeInfoByEngineerId(&m_schemeList, m_process.projectId, 0);
|
|
|
}
|
|
|
|
|
|
- if (schemeList.count() > 0) {
|
|
|
- for (SchemaEval *scheme : schemeList) {
|
|
|
+ if (m_schemeList.count() > 0) {
|
|
|
+ for (SchemaEval *scheme : m_schemeList) {
|
|
|
QStandardItem *item = new QStandardItem(scheme->name);
|
|
|
model->setHorizontalHeaderItem(++hIndex, item);
|
|
|
+ m_schemeStartIndex = hIndex;
|
|
|
for (QString indexValue : scheme->valueStr.split(";")) {
|
|
|
QStringList indexAndValue = indexValue.split(":");
|
|
|
if (indexAndValue.size() < 2) {
|
|
@@ -156,6 +157,7 @@ void DataTableWidget::setupModels()
|
|
|
QStandardItem *hHeader = model->verticalHeaderItem(l);
|
|
|
if (hHeader->text() == indexAndValue.first()) {
|
|
|
QStandardItem *item = new QStandardItem(indexAndValue.last());
|
|
|
+ item->setData(indexAndValue.last());
|
|
|
model->setItem(l, hIndex, item);
|
|
|
}
|
|
|
}
|
|
@@ -444,6 +446,7 @@ void DataTableWidget::setNodeMatrixData(QList<NodeMatrixInfo *> data, bool isExp
|
|
|
for (int c = 0; c < model->columnCount(); c++) {
|
|
|
QStandardItem *item = model->item(r, c);
|
|
|
if (item != nullptr) {
|
|
|
+ item->setData("");
|
|
|
item->setText("");
|
|
|
}
|
|
|
}
|
|
@@ -489,6 +492,7 @@ void DataTableWidget::setNodeMatrixData(QList<NodeMatrixInfo *> data, bool isExp
|
|
|
if (cHeader->text() == info->abscissa) {
|
|
|
QStandardItem *item = new QStandardItem();
|
|
|
item->setText(info->nodeValue);
|
|
|
+ item->setData(info->nodeValue);
|
|
|
model->setItem(0, c, item);
|
|
|
}
|
|
|
}
|
|
@@ -511,6 +515,7 @@ void DataTableWidget::setNodeMatrixData(QList<NodeMatrixInfo *> data, bool isExp
|
|
|
if (cHeader->text() == info->abscissa && rHeader->text() == info->ordinate) {
|
|
|
QStandardItem *item = new QStandardItem();
|
|
|
item->setText(info->nodeValue);
|
|
|
+ item->setData(info->nodeValue);
|
|
|
model->setItem(r, c, item);
|
|
|
}
|
|
|
}
|
|
@@ -602,35 +607,60 @@ void DataTableWidget::itemChanged(QStandardItem *item)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 只关心用户编辑实测数据
|
|
|
+ static bool useOldData = false;
|
|
|
+ if (useOldData) {
|
|
|
+ useOldData = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // ([0-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])
|
|
|
+ // (-?[1-9][0-9]+)|(-?[0-9])|(-?[1-9]\\d+\\.\\d+)|(-?[0-9]\\.\\d+)
|
|
|
+ QString Pattern("(\\d*\\.?\\d*)"); // 匹配非负数
|
|
|
+ QRegExp reg(Pattern);
|
|
|
+ if (!reg.exactMatch(item->text())) {
|
|
|
+ useOldData = true;
|
|
|
+ item->setText(item->data().toString());
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (item->data().toString() != item->text()) {
|
|
|
+ item->setData(item->text());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户编辑实测数据, 包括权重数据和能力重要度评估数据
|
|
|
bool weightData = m_process.type == SchemePlanManager::ImportWeightData
|
|
|
&& m_process.dSource == SchemePlanManager::FromMeasurement;
|
|
|
bool evalData = m_process.type == SchemePlanManager::ImportEvalData
|
|
|
&& m_process.dSource == SchemePlanManager::FromMeasurement
|
|
|
&& m_process.indexType == ProjectManager::TechIndex;
|
|
|
|
|
|
- if (!weightData && !evalData) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- QString indexName = ProjectManager::nameOfIndexType((ProjectManager::IndexType)m_process.indexType);
|
|
|
- NodeMatrixInfo info;
|
|
|
- info.nodeValue = item->text();
|
|
|
- info.engineerId = m_process.projectId;
|
|
|
- info.tableMsg = indexName;
|
|
|
- info.strUuid = m_uuidStr;
|
|
|
-
|
|
|
- QStandardItem *hHeader = item->model()->horizontalHeaderItem(item->column());
|
|
|
- info.abscissa = hHeader->text();
|
|
|
+ // 用户编辑方案数据, 包括方案优选评估数据和效能评估数据
|
|
|
+ bool schemeData = m_process.type == SchemePlanManager::ImportEvalData
|
|
|
+ && (m_process.indexType == ProjectManager::OptimalIndex
|
|
|
+ || m_process.indexType == ProjectManager::EfficiencyIndex);
|
|
|
+
|
|
|
+ if (weightData || evalData) {
|
|
|
+ QString indexName = ProjectManager::nameOfIndexType((ProjectManager::IndexType)m_process.indexType);
|
|
|
+ NodeMatrixInfo info;
|
|
|
+ info.nodeValue = item->text();
|
|
|
+ info.engineerId = m_process.projectId;
|
|
|
+ info.tableMsg = indexName;
|
|
|
+ info.strUuid = m_uuidStr;
|
|
|
+
|
|
|
+ QStandardItem *hHeader = item->model()->horizontalHeaderItem(item->column());
|
|
|
+ info.abscissa = hHeader->text();
|
|
|
+
|
|
|
+ if (evalData) {
|
|
|
+ QStandardItem *vHeader = item->model()->verticalHeaderItem(item->row());
|
|
|
+ info.ordinate = vHeader->text();
|
|
|
+ }
|
|
|
|
|
|
- if (evalData) {
|
|
|
- QStandardItem *vHeader = item->model()->verticalHeaderItem(item->row());
|
|
|
- info.ordinate = vHeader->text();
|
|
|
+ bool ret = NodeMatrixService().UpdateMeasureData(info);
|
|
|
+ if (ret) {
|
|
|
+ emit sigMeasureDataEdited(&info);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- bool ret = NodeMatrixService().UpdateMeasureData(info);
|
|
|
- qDebug() << __FUNCTION__ << __LINE__ << ret << endl;
|
|
|
- if (ret) {
|
|
|
- emit sigMeasureDataEdited(&info);
|
|
|
- }
|
|
|
+ if (schemeData) { }
|
|
|
}
|