Replace let with const where variable is never reassigned in Vue files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 09:38:40 +08:00
parent 64372c7043
commit 1d0d938193
21 changed files with 176 additions and 191 deletions

View File

@@ -349,12 +349,12 @@ export default {
* @param {object} data new watch's value 監聽到後端傳來的報告 data
*/
setConformanceTempReportData(data){
let total = getNumberLabel(Object.values(data.counts).reduce((acc, val) => acc + val, 0));
let sum = data.counts.conforming + data.counts.not_conforming;
let rate = ((data.counts.conforming / sum) * 100).toFixed(1);
let isNullTime = value => value === null ? null : getNumberLabel((value / 86400).toFixed(1));
let isNullCase = value => value === null ? null : getNumberLabel(value.toFixed(1));
let setLoopData = value => value.map(item => {
const total = getNumberLabel(Object.values(data.counts).reduce((acc, val) => acc + val, 0));
const sum = data.counts.conforming + data.counts.not_conforming;
const rate = ((data.counts.conforming / sum) * 100).toFixed(1);
const isNullTime = value => value === null ? null : getNumberLabel((value / 86400).toFixed(1));
const isNullCase = value => value === null ? null : getNumberLabel(value.toFixed(1));
const setLoopData = value => value.map(item => {
return {
no: item.no,
label: item.description,
@@ -363,7 +363,7 @@ export default {
ratio: this.getPercentLabel(item.count / data.counts.conforming),
}
});
let setIssueData = value => value.map(item => {
const setIssueData = value => value.map(item => {
return {
no: item.no,
label: item.description,
@@ -372,10 +372,10 @@ export default {
ratio: this.getPercentLabel(item.count / data.counts.not_conforming),
}
});
let isNullLoops = value => value === null ? null : setLoopData(value);
let isNullIsssue = value => value === null ? null : setIssueData(value);
const isNullLoops = value => value === null ? null : setLoopData(value);
const isNullIsssue = value => value === null ? null : setIssueData(value);
let result = {
const result = {
total: `Total ${total}`,
counts: {
conforming: getNumberLabel(data.counts.conforming),
@@ -627,14 +627,14 @@ export default {
* @param {number} yMin Time Trend yMin
*/
setTimeChartData(data, xMax, xMin, yMax, yMin) {
let max = yMax * 1.1;
let xVal = timeRange(xMin, xMax, 100);
let yVal = yTimeRange(data, 100, yMin, yMax);
const max = yMax * 1.1;
const xVal = timeRange(xMin, xMax, 100);
const yVal = yTimeRange(data, 100, yMin, yMax);
xVal.map((x, index) => ({ x, y: yVal[index] }));
let formattedXVal = xVal.map(value => formatTime(value));
formattedXVal = formatMaxTwo(formattedXVal);
let selectTimeMinIndex = getXIndex(xVal, this.selectDurationTime.min);
let selectTimeMaxIndex = getXIndex(xVal, this.selectDurationTime.max);
const selectTimeMinIndex = getXIndex(xVal, this.selectDurationTime.min);
const selectTimeMaxIndex = getXIndex(xVal, this.selectDurationTime.max);
const start = selectTimeMinIndex;
const end = selectTimeMaxIndex;
const inside = (ctx, value) => ctx.p0DataIndex >= start && ctx.p1DataIndex <= end ? value : undefined;

View File

@@ -121,7 +121,7 @@ export default {
},
},
created() {
let newlist = JSON.parse(JSON.stringify(this.listSeq));
const newlist = JSON.parse(JSON.stringify(this.listSeq));
this.listSequence = this.isSubmit ? newlist : [];
this.$emitter.on('reset', (data) => {
this.listSequence = [];

View File

@@ -82,7 +82,7 @@ export default {
},
computed: {
selectCfmSeqSE: function() {
let data = [];
const data = [];
if(this.selectCfmSeqStart) data.push(this.selectCfmSeqStart);
if(this.selectCfmSeqEnd) data.push(this.selectCfmSeqEnd);
data.sort((a, b) => {
@@ -92,7 +92,7 @@ export default {
return data;
},
selectCfmPtEteSE: function() {
let data = [];
const data = [];
if(this.selectCfmPtEteSEStart) data.push(this.selectCfmPtEteSEStart);
if(this.selectCfmPtEteSEEnd) data.push(this.selectCfmPtEteSEEnd);
data.sort((a, b) => {
@@ -102,7 +102,7 @@ export default {
return data;
},
selectCfmPtPSE: function() {
let data = [];
const data = [];
if(this.selectCfmPtPSEStart) data.push(this.selectCfmPtPSEStart);
if(this.selectCfmPtPSEEnd) data.push(this.selectCfmPtPSEEnd);
data.sort((a, b) => {
@@ -112,7 +112,7 @@ export default {
return data;
},
selectCfmWtEteSE: function() {
let data = [];
const data = [];
if(this.selectCfmWtEteSEStart) data.push(this.selectCfmWtEteSEStart);
if(this.selectCfmWtEteSEEnd) data.push(this.selectCfmWtEteSEEnd);
data.sort((a, b) => {
@@ -122,7 +122,7 @@ export default {
return data;
},
selectCfmWtPSE: function() {
let data = [];
const data = [];
if(this.selectCfmWtPSEStart) data.push(this.selectCfmWtPSEStart);
if(this.selectCfmWtPSEEnd) data.push(this.selectCfmWtPSEEnd);
data.sort((a, b) => {
@@ -132,7 +132,7 @@ export default {
return data;
},
selectCfmCtEteSE: function() {
let data = [];
const data = [];
if(this.selectCfmCtEteSEStart) data.push(this.selectCfmCtEteSEStart);
if(this.selectCfmCtEteSEEnd) data.push(this.selectCfmCtEteSEEnd);
data.sort((a, b) => {
@@ -182,7 +182,7 @@ export default {
this.containstTasksData = data;
});
this.$emitter.on('actRadioData', (newData) => {
let data = JSON.parse(JSON.stringify(newData)); // 深拷貝原始 cases 的內容
const data = JSON.parse(JSON.stringify(newData)); // 深拷貝原始 cases 的內容
const categoryMapping = {
'cfmSeqStart': ['Start', 'selectCfmSeqStart', 'selectCfmSeqEnd'],

View File

@@ -93,7 +93,7 @@ export default {
return this.traceList.length;
},
traceList: function() {
let sum = this.listTraces.map(trace => trace.count).reduce((acc, cur) => acc + cur, 0);
const sum = this.listTraces.map(trace => trace.count).reduce((acc, cur) => acc + cur, 0);
return this.listTraces.map(trace => {
return {
@@ -148,7 +148,7 @@ export default {
this.showTraceId = newValue;
},
showTraceId: function(newValue, oldValue) {
let isScrollTop = document.querySelector('.infiniteTable');
const isScrollTop = document.querySelector('.infiniteTable');
if(isScrollTop && typeof isScrollTop.scrollTop !== 'undefined') if(newValue !== oldValue) isScrollTop.scrollTop = 0;
},
firstCases: function(newValue, oldValue){
@@ -240,7 +240,7 @@ export default {
*/
createCy(){
this.$nextTick(() => {
let graphId = this.$refs.cfmTrace;
const graphId = this.$refs.cfmTrace;
this.setNodesData();
this.setEdgesData();