提交 c85576b3 编写于 作者: W wwx691809

Threshold input is less than 0, setting succeeded

上级 8e0cfd60
...@@ -135,6 +135,7 @@ ...@@ -135,6 +135,7 @@
"lessThan": "小于", "lessThan": "小于",
"applyAllSelectTag": "应用到当前所选标签", "applyAllSelectTag": "应用到当前所选标签",
"placeHolderNumber": "请输入数值", "placeHolderNumber": "请输入数值",
"noSpace":"请勿输入空格",
"sameCompare": "不能有相同的比较运算符", "sameCompare": "不能有相同的比较运算符",
"unreasonable": "逻辑不合理", "unreasonable": "逻辑不合理",
"info": "提示", "info": "提示",
......
...@@ -493,6 +493,7 @@ export default { ...@@ -493,6 +493,7 @@ export default {
zoomData: [null, null], zoomData: [null, null],
zoomDataTimer: null, zoomDataTimer: null,
charObj: null, charObj: null,
invalidData: false,
}); });
propsList.push({ propsList.push({
...@@ -633,6 +634,7 @@ export default { ...@@ -633,6 +634,7 @@ export default {
if (hasInvalidData) { if (hasInvalidData) {
this.$set(sampleObject, 'invalidData', true); this.$set(sampleObject, 'invalidData', true);
} }
sampleObject.charData.charOption = this.formateCharOption( sampleObject.charData.charOption = this.formateCharOption(
sampleIndex, sampleIndex,
); );
...@@ -738,44 +740,52 @@ export default { ...@@ -738,44 +740,52 @@ export default {
let pieceStr = ''; let pieceStr = '';
if (tempStorgeArr.length === 1) { if (tempStorgeArr.length === 1) {
if (tempStorgeArr[0].gt && tempStorgeArr[0].lt) { if (!isNaN(tempStorgeArr[0].gt) && !isNaN(tempStorgeArr[0].lt)) {
pieceStr = `(${tempStorgeArr[0].gt},${tempStorgeArr[0].lt})`; pieceStr = `(${tempStorgeArr[0].gt},${tempStorgeArr[0].lt})`;
} } else if (
!isNaN(tempStorgeArr[0].gt) &&
if (tempStorgeArr[0].gt && !tempStorgeArr[0].lt) { isNaN(tempStorgeArr[0].lt)
) {
pieceStr = `(${tempStorgeArr[0].gt},Infinity)`; pieceStr = `(${tempStorgeArr[0].gt},Infinity)`;
} } else if (
if (tempStorgeArr[0].lt && !tempStorgeArr[0].gt) { !isNaN(tempStorgeArr[0].lt) &&
isNaN(tempStorgeArr[0].gt)
) {
pieceStr = `(-Infinity,${tempStorgeArr[0].lt})`; pieceStr = `(-Infinity,${tempStorgeArr[0].lt})`;
} }
} }
if (tempStorgeArr.length === 2) { if (tempStorgeArr.length === 2) {
if (tempStorgeArr[0].lt && tempStorgeArr[1].gt) { if (!isNaN(tempStorgeArr[0].lt) && !isNaN(tempStorgeArr[1].gt)) {
pieceStr = `(-Infinity,${tempStorgeArr[0].lt}),(${tempStorgeArr[1].gt},Infinity)`; pieceStr = `(-Infinity,${tempStorgeArr[0].lt}),(${tempStorgeArr[1].gt},Infinity)`;
} } else if (!isNaN(tempStorgeArr[0].gt) && !isNaN(tempStorgeArr[1].lt)) {
if (tempStorgeArr[0].gt && tempStorgeArr[1].lt) {
pieceStr = `(-Infinity,${tempStorgeArr[1].lt}),(${tempStorgeArr[0].gt},Infinity)`; pieceStr = `(-Infinity,${tempStorgeArr[1].lt}),(${tempStorgeArr[0].gt},Infinity)`;
} }
} }
sampleObject.pieceStr = pieceStr; sampleObject.pieceStr = pieceStr;
if ( if (tempStorgeArr.length === 1) {
(tempStorgeArr[0].lt && !tempStorgeArr[0].gt) || let itemValue;
(!tempStorgeArr[0].lt && tempStorgeArr[0].gt) if (tempStorgeArr[0]['lt'] || tempStorgeArr[0]['lt'] === 0) {
) { itemValue = tempStorgeArr[0]['lt'];
const itemValue = tempStorgeArr[0]['lt'] || tempStorgeArr[0]['gt']; } else {
itemValue = tempStorgeArr[0]['gt'];
}
tempStorgeArr.push({ tempStorgeArr.push({
value: tempStorgeArr[0]['lt'] ? itemValue + 1 : itemValue - 1, value:
tempStorgeArr[0]['lt'] || tempStorgeArr[0]['lt'] === 0
? itemValue + 1
: itemValue - 1,
}); });
} }
tempStorgeArr.forEach((item) => { tempStorgeArr.forEach((item) => {
if (item.lt) { if (item.lt || item.lt === 0) {
const markLineDataItem = {}; const markLineDataItem = {};
markLineDataItem.yAxis = item.lt; markLineDataItem.yAxis = item.lt;
markLineData.push(markLineDataItem); markLineData.push(markLineDataItem);
} }
if (item.gt) { if (item.gt || item.gt === 0) {
const markLineDataItem = {}; const markLineDataItem = {};
markLineDataItem.yAxis = item.gt; markLineDataItem.yAxis = item.gt;
markLineData.push(markLineDataItem); markLineData.push(markLineDataItem);
...@@ -1849,6 +1859,9 @@ export default { ...@@ -1849,6 +1859,9 @@ export default {
if (!valueFirst) { if (!valueFirst) {
this.thresholdErrorMsg = this.$t('scalar.placeHolderThreshold'); this.thresholdErrorMsg = this.$t('scalar.placeHolderThreshold');
isValidate = false; isValidate = false;
} else if (valueFirst.indexOf(' ') > -1) {
this.thresholdErrorMsg = this.$t('scalar.noSpace');
isValidate = false;
} else if (isNaN(valueFirst)) { } else if (isNaN(valueFirst)) {
this.thresholdErrorMsg = this.$t('scalar.placeHolderNumber'); this.thresholdErrorMsg = this.$t('scalar.placeHolderNumber');
isValidate = false; isValidate = false;
...@@ -1860,6 +1873,9 @@ export default { ...@@ -1860,6 +1873,9 @@ export default {
} else if (!valueFirst || !valueSec) { } else if (!valueFirst || !valueSec) {
this.thresholdErrorMsg = this.$t('scalar.placeHolderThreshold'); this.thresholdErrorMsg = this.$t('scalar.placeHolderThreshold');
isValidate = false; isValidate = false;
} else if (valueFirst.indexOf(' ') > -1 || valueSec.indexOf(' ') > -1) {
this.thresholdErrorMsg = this.$t('scalar.noSpace');
isValidate = false;
} else if (valueFirst === valueSec) { } else if (valueFirst === valueSec) {
this.thresholdErrorMsg = this.$t('scalar.unreasonable'); this.thresholdErrorMsg = this.$t('scalar.unreasonable');
isValidate = false; isValidate = false;
...@@ -1908,6 +1924,7 @@ export default { ...@@ -1908,6 +1924,7 @@ export default {
thresholdCommit() { thresholdCommit() {
const isValidate = this.thresholdValidate(); const isValidate = this.thresholdValidate();
if (isValidate) { if (isValidate) {
const chartPieces = []; const chartPieces = [];
if (this.thresholdValue[0].value && this.thresholdValue[1].value) { if (this.thresholdValue[0].value && this.thresholdValue[1].value) {
...@@ -1963,87 +1980,85 @@ export default { ...@@ -1963,87 +1980,85 @@ export default {
} }
}); });
if (this.thresholdSwitch) { let pieceStr = '';
this.originDataArr.forEach((sampleObject) => { if (chartPieces.length === 1) {
if (this.multiSelectedTagNames[sampleObject.tagName]) { if (!isNaN(chartPieces[0].gt) && !isNaN(chartPieces[0].lt)) {
if (!this.thresholdLocal) { pieceStr = `(${chartPieces[0].gt},${chartPieces[0].lt})`;
this.thresholdLocal = {}; } else if (
this.thresholdLocal[this.decodeTrainingJobId] = {}; !isNaN(chartPieces[0].gt) &&
this.thresholdLocal[this.decodeTrainingJobId][ isNaN(chartPieces[0].lt)
sampleObject.tagName ) {
] = chartPieces; pieceStr = `(${chartPieces[0].gt},Infinity)`;
} else { } else if (
if (!this.thresholdLocal[this.decodeTrainingJobId]) { !isNaN(chartPieces[0].lt) &&
this.thresholdLocal[this.decodeTrainingJobId] = {}; isNaN(chartPieces[0].gt)
this.thresholdLocal[this.decodeTrainingJobId][ ) {
sampleObject.tagName pieceStr = `(-Infinity,${chartPieces[0].lt})`;
] = chartPieces; }
} else { }
this.thresholdLocal[this.decodeTrainingJobId][ if (chartPieces.length === 2) {
sampleObject.tagName if (!isNaN(chartPieces[0].lt) && !isNaN(chartPieces[1].gt)) {
] = chartPieces; pieceStr = `(-Infinity,${chartPieces[0].lt}),(${chartPieces[1].gt},Infinity)`;
} } else if (!isNaN(chartPieces[0].gt) && !isNaN(chartPieces[1].lt)) {
} pieceStr = `(-Infinity,${chartPieces[1].lt}),(${chartPieces[0].gt},Infinity)`;
localStorage.setItem( }
'thresholdCache', }
JSON.stringify(this.thresholdLocal),
);
let pieceStr = ''; if (!this.thresholdLocal) {
if (chartPieces.length === 1) { this.thresholdLocal = {};
if (chartPieces[0].gt && chartPieces[0].lt) { }
pieceStr = `(${chartPieces[0].gt},${chartPieces[0].lt})`; if (!this.thresholdLocal[this.decodeTrainingJobId]) {
} else if (chartPieces[0].gt && !chartPieces[0].lt) { this.thresholdLocal[this.decodeTrainingJobId] = {};
pieceStr = `(${chartPieces[0].gt},Infinity)`; }
} else if (chartPieces[0].lt && !chartPieces[0].gt) {
pieceStr = `(-Infinity,${chartPieces[0].lt})`;
}
}
if (chartPieces.length === 2) {
if (chartPieces[0].lt && chartPieces[1].gt) {
pieceStr = `(-Infinity,${chartPieces[0].lt}),(${chartPieces[1].gt},Infinity)`;
} else if (chartPieces[0].gt && chartPieces[1].lt) {
pieceStr = `(-Infinity,${chartPieces[1].lt}),(${chartPieces[0].gt},Infinity)`;
}
}
sampleObject.pieceStr = pieceStr; const markLineData = [];
const tempCharOption = sampleObject.charData.charOption; chartPieces.forEach((item) => {
if (item.lt || item.lt === 0) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.lt;
markLineData.push(markLineDataItem);
}
if (item.gt || item.gt === 0) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.gt;
markLineData.push(markLineDataItem);
}
});
const chartPiecesTemp = JSON.parse(JSON.stringify(chartPieces)); const chartPiecesTemp = JSON.parse(JSON.stringify(chartPieces));
if (chartPiecesTemp.length === 1) { if (chartPiecesTemp.length === 1) {
const itemValue = chartPieces[0]['lt'] || chartPieces[0]['gt']; let itemValue;
chartPiecesTemp.push({ if (chartPiecesTemp[0]['lt'] || chartPiecesTemp[0]['lt'] === 0) {
value: chartPieces[0]['lt'] ? itemValue + 1 : itemValue - 1, itemValue = chartPiecesTemp[0]['lt'];
}); } else {
} itemValue = chartPiecesTemp[0]['gt'];
}
chartPiecesTemp.push({
value:
chartPiecesTemp[0]['lt'] || chartPiecesTemp[0]['lt'] === 0
? itemValue + 1
: itemValue - 1,
});
}
chartPiecesTemp.forEach((item) => { chartPiecesTemp.forEach((item) => {
item.color = this.thresholdColor; item.color = this.thresholdColor;
}); });
tempCharOption.visualMap.pieces = chartPiecesTemp;
if (this.thresholdSwitch) {
this.originDataArr.forEach((sampleObject) => {
if (this.multiSelectedTagNames[sampleObject.tagName]) {
this.thresholdLocal[this.decodeTrainingJobId][
sampleObject.tagName
] = chartPieces;
sampleObject.pieceStr = pieceStr;
const tempCharOption = sampleObject.charData.charOption;
tempCharOption.visualMap.pieces = chartPiecesTemp;
tempCharOption.visualMap.outOfRange = { tempCharOption.visualMap.outOfRange = {
color: sampleObject.colors, color: sampleObject.colors,
}; };
const markLineData = [];
chartPieces.forEach((item) => {
if (item.lt) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.lt;
markLineData.push(markLineDataItem);
}
if (item.gt) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.gt;
markLineData.push(markLineDataItem);
}
});
tempCharOption.series[0].lineStyle.color = null; tempCharOption.series[0].lineStyle.color = null;
tempCharOption.series[0].markLine = { tempCharOption.series[0].markLine = {
silent: true, silent: true,
...@@ -2052,91 +2067,29 @@ export default { ...@@ -2052,91 +2067,29 @@ export default {
sampleObject.charObj.setOption(tempCharOption, true); sampleObject.charObj.setOption(tempCharOption, true);
} }
}); });
this.thresholdDialogVisible = false;
} else { } else {
if (!this.thresholdLocal) { this.thresholdLocal[this.decodeTrainingJobId][
this.thresholdLocal = {}; this.currentTagName
this.thresholdLocal[this.decodeTrainingJobId] = {}; ] = chartPieces;
this.thresholdLocal[this.decodeTrainingJobId][ this.currentSample.pieceStr = pieceStr;
this.currentTagName
] = chartPieces;
} else {
if (!this.thresholdLocal[this.decodeTrainingJobId]) {
this.thresholdLocal[this.decodeTrainingJobId] = {};
this.thresholdLocal[this.decodeTrainingJobId][
this.currentTagName
] = chartPieces;
} else {
this.thresholdLocal[this.decodeTrainingJobId][
this.currentTagName
] = chartPieces;
}
}
localStorage.setItem(
'thresholdCache',
JSON.stringify(this.thresholdLocal),
);
let pieceStr = '';
if (chartPieces.length === 1) {
if (chartPieces[0].gt && chartPieces[0].lt) {
pieceStr = `(${chartPieces[0].gt},${chartPieces[0].lt})`;
} else if (chartPieces[0].gt && !chartPieces[0].lt) {
pieceStr = `(${chartPieces[0].gt},Infinity)`;
} else if (chartPieces[0].lt && !chartPieces[0].gt) {
pieceStr = `(-Infinity,${chartPieces[0].lt})`;
}
}
if (chartPieces.length === 2) {
if (chartPieces[0].lt && chartPieces[1].gt) {
pieceStr = `(-Infinity,${chartPieces[0].lt}),(${chartPieces[1].gt},Infinity)`;
} else if (chartPieces[0].gt && chartPieces[1].lt) {
pieceStr = `(-Infinity,${chartPieces[1].lt}),(${chartPieces[0].gt},Infinity)`;
}
}
this.originDataArr.forEach((sampleItem) => {
if (sampleItem.tagName === this.currentTagName) {
sampleItem.pieceStr = pieceStr;
}
});
const tempCharOption = this.currentSample.charData.charOption; const tempCharOption = this.currentSample.charData.charOption;
if (chartPieces.length === 1) { tempCharOption.visualMap.pieces = chartPiecesTemp;
const itemValue = chartPieces[0]['lt'] || chartPieces[0]['gt'];
chartPieces.push({
value: chartPieces[0]['lt'] ? itemValue + 1 : itemValue - 1,
});
}
chartPieces.forEach((item) => {
item.color = this.thresholdColor;
});
tempCharOption.visualMap.pieces = chartPieces;
tempCharOption.visualMap.outOfRange = { tempCharOption.visualMap.outOfRange = {
color: this.currentSample.colors, color: this.currentSample.colors,
}; };
const markLineData = [];
chartPieces.forEach((item) => {
if (item.lt) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.lt;
markLineData.push(markLineDataItem);
}
if (item.gt) {
const markLineDataItem = {};
markLineDataItem.yAxis = item.gt;
markLineData.push(markLineDataItem);
}
});
tempCharOption.series[0].lineStyle.color = null; tempCharOption.series[0].lineStyle.color = null;
tempCharOption.series[0].markLine = { tempCharOption.series[0].markLine = {
silent: true, silent: true,
data: markLineData, data: markLineData,
}; };
this.currentSample.charObj.setOption(tempCharOption, true); this.currentSample.charObj.setOption(tempCharOption, true);
this.thresholdDialogVisible = false;
} }
localStorage.setItem(
'thresholdCache',
JSON.stringify(this.thresholdLocal),
);
this.thresholdDialogVisible = false;
} }
}, },
...@@ -2186,15 +2139,15 @@ export default { ...@@ -2186,15 +2139,15 @@ export default {
font-weight: bold; font-weight: bold;
} }
.w261 {
width: 261px;
}
.w60 { .w60 {
width: 60px; width: 60px;
margin-left: 20px; margin-left: 20px;
} }
.w261 {
width: 261px;
}
.smallSelect { .smallSelect {
width: 80px; width: 80px;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册