归档
This commit is contained in:
@@ -63,12 +63,12 @@
|
||||
</el-popover>
|
||||
</span>
|
||||
</div>
|
||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>
|
||||
<el-select v-model="currentHarmNum">
|
||||
<el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="checkList.length" label='测试项'>
|
||||
<!-- <el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>-->
|
||||
<!-- <el-select v-model="currentHarmNum">-->
|
||||
<!-- <el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 230px;" v-if="checkList.length" label='测试项'>
|
||||
<el-select v-model="currentCheckItem">
|
||||
<el-option v-for="item in checkList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
@@ -131,9 +131,9 @@ const formContent = reactive<CheckData.DataCheck>({
|
||||
chnNum: '',
|
||||
})
|
||||
// 当前选中的谐波次数
|
||||
const currentHarmNum = ref<string>("-1")
|
||||
// const currentHarmNum = ref<string>("-1")
|
||||
// 谐波次数列表
|
||||
const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||
// const harmNumList = reactive<{ value: string, label: string }[]>([])
|
||||
// 当前选中的检测项
|
||||
const currentCheckItem = ref<string>("")
|
||||
// 检测项列表
|
||||
@@ -166,7 +166,8 @@ let resTableData: { resultData: Map<string, any>, rawData: Map<string, any> } =
|
||||
const checkResultData = reactive<CheckData.CheckResult[]>([])
|
||||
|
||||
const popoverWidth: ComputedRef<string> = computed(() => {
|
||||
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
|
||||
// return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (harmNumList.length || checkList.length ? 160 : 0)}px`
|
||||
return `${940 - (currentScriptTypeName.value.length + 7) * 14 - (checkList.length ? 220 : 0)}px`
|
||||
})
|
||||
|
||||
// 原始数据表格数据
|
||||
@@ -216,30 +217,31 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
|
||||
activeTab.value = 'resultTab'
|
||||
})
|
||||
|
||||
watch(currentHarmNum, (newVal, oldVal) => {
|
||||
// console.log("谐波次数", newVal);
|
||||
if (newVal !== '-1') {
|
||||
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
|
||||
setCheckResultData(resCheckResult)
|
||||
// watch(currentHarmNum, (newVal, oldVal) => {
|
||||
// console.log("谐波次数", newVal);
|
||||
// if (newVal !== '-1') {
|
||||
// let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal.toString())
|
||||
// setCheckResultData(resCheckResult)
|
||||
//
|
||||
// let tempRawData = resTableData.rawData.get(newVal.toString())
|
||||
// if (tempRawData) {
|
||||
// setRawData(tempRawData)
|
||||
// } else {
|
||||
// setRawData([])
|
||||
// }
|
||||
// }
|
||||
// activeTab.value = 'resultTab'
|
||||
// })
|
||||
|
||||
let tempRawData = resTableData.rawData.get(newVal.toString())
|
||||
if (tempRawData) {
|
||||
setRawData(tempRawData)
|
||||
} else {
|
||||
setRawData([])
|
||||
}
|
||||
}
|
||||
activeTab.value = 'resultTab'
|
||||
})
|
||||
|
||||
watch(currentCheckItem, (newVal, oldVal) => {
|
||||
// console.log("当前检测项", newVal);
|
||||
if (newVal) {
|
||||
let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间'
|
||||
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(key)
|
||||
// let key = newVal.toString() === 'Voltage' ? '电压幅值' : '持续时间'
|
||||
let resCheckResult: CheckData.ResCheckResult = resTableData.resultData.get(newVal)
|
||||
setCheckResultData(resCheckResult)
|
||||
|
||||
let tempRawData = resTableData.rawData.get(key)
|
||||
let tempRawData = resTableData.rawData.get(newVal)
|
||||
if (tempRawData) {
|
||||
setRawData(tempRawData)
|
||||
} else {
|
||||
@@ -313,42 +315,59 @@ const updateTableData = async () => {
|
||||
if (keys1.length === 1) {
|
||||
resCheckResult = resTableData.resultData.get(keys1[0])
|
||||
resRawData = resTableData.rawData.get(keys2[0])
|
||||
Object.assign(harmNumList, [])
|
||||
currentHarmNum.value = '-1'
|
||||
|
||||
// Object.assign(harmNumList, [])
|
||||
// currentHarmNum.value = '-1'
|
||||
|
||||
resRawData = (resRawData == null || resRawData == undefined ? [] : resRawData)
|
||||
resCheckResult = (resCheckResult == null || resCheckResult == undefined ? {} : resCheckResult)
|
||||
setCheckResultData(resCheckResult)
|
||||
setRawData(resRawData)
|
||||
} else if (resTableData.resultData.get('电压幅值') || resTableData.resultData.get('持续时间')) {
|
||||
} else
|
||||
// if (resTableData.resultData.get('电压幅值') || resTableData.resultData.get('持续时间')) {
|
||||
// let tempCheckList = []
|
||||
// if (resTableData.resultData.get('电压幅值')) {
|
||||
// tempCheckList.push({value: 'Voltage', label: '电压幅值'})
|
||||
// //resCheckResult = resTableData.resultData.get('电压幅值')
|
||||
// }
|
||||
// if (resTableData.resultData.get('持续时间')) {
|
||||
// tempCheckList.push({value: 'Duration', label: '持续时间'})
|
||||
// //resCheckResult = resTableData.resultData.get('持续时间')
|
||||
// }
|
||||
//
|
||||
// Object.assign(checkList, tempCheckList)
|
||||
// currentCheckItem.value = checkList[0].value
|
||||
//
|
||||
// Object.assign(harmNumList, [])
|
||||
// currentHarmNum.value = '-1'
|
||||
//
|
||||
// //setCheckResultData(resCheckResult)
|
||||
// } else
|
||||
if (keys1.length != 0) {
|
||||
// let tempHarmNumList: { value: string, label: string }[] = []
|
||||
// for (let [key, value] of resTableData.resultData) {
|
||||
// tempHarmNumList.push({
|
||||
// value: key,
|
||||
// label: value.isData === 1 ? key : value.isData === 4 ? `${formatHarmNum(key)}(/)` : `${formatHarmNum(key)}(不符合)`
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// Object.assign(harmNumList, tempHarmNumList)
|
||||
// currentHarmNum.value = harmNumList.length > 0 ? harmNumList[0].value : '-1'
|
||||
|
||||
let tempCheckList = []
|
||||
if (resTableData.resultData.get('电压幅值')) {
|
||||
tempCheckList.push({value: 'Voltage', label: '电压幅值'})
|
||||
//resCheckResult = resTableData.resultData.get('电压幅值')
|
||||
}
|
||||
if (resTableData.resultData.get('持续时间')) {
|
||||
tempCheckList.push({value: 'Duration', label: '持续时间'})
|
||||
//resCheckResult = resTableData.resultData.get('持续时间')
|
||||
}
|
||||
|
||||
Object.assign(checkList, tempCheckList)
|
||||
currentCheckItem.value = checkList[0].value
|
||||
|
||||
Object.assign(harmNumList, [])
|
||||
currentHarmNum.value = '-1'
|
||||
|
||||
//setCheckResultData(resCheckResult)
|
||||
} else if (keys1.length != 0) {
|
||||
let tempHarmNumList: { value: string, label: string }[] = []
|
||||
for (let [key, value] of resTableData.resultData) {
|
||||
tempHarmNumList.push({
|
||||
let hum=formatHarmNum(key)
|
||||
tempCheckList.push({
|
||||
value: key,
|
||||
label: value.isData === 1 ? key : value.isData === 4 ? `${formatHarmNum(key)}(/)` : `${formatHarmNum(key)}(不符合)`
|
||||
label: value.isData === 1 ? hum : value.isData === 4 ? `${hum}(/)` : `${hum}(不符合)`
|
||||
})
|
||||
}
|
||||
|
||||
Object.assign(harmNumList, tempHarmNumList)
|
||||
currentHarmNum.value = harmNumList.length > 0 ? harmNumList[0].value : '-1'
|
||||
// debugger
|
||||
Object.assign(checkList, tempCheckList)
|
||||
|
||||
currentCheckItem.value = checkList[0].value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,8 +418,8 @@ const close = () => {
|
||||
chnNum: '',
|
||||
})
|
||||
treeDataAll.length = 0
|
||||
harmNumList.length = 0
|
||||
currentHarmNum.value = '-1'
|
||||
// harmNumList.length = 0
|
||||
// currentHarmNum.value = '-1'
|
||||
currentCheckItem.value = ''
|
||||
checkResultData.length = 0
|
||||
rawTableData.length = 0
|
||||
@@ -458,29 +477,52 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
|
||||
}
|
||||
|
||||
const formatHarmNum = (num: string) => {
|
||||
// debugger
|
||||
if (num.includes('.5')) {
|
||||
return num
|
||||
} else {
|
||||
return num.replace('.0', '')
|
||||
num = num.replace('.0', '')
|
||||
return num
|
||||
}
|
||||
}
|
||||
|
||||
const setRawData = (data: CheckData.RawDataItem[]) => {
|
||||
// console.log("原始数据", data)
|
||||
data.forEach((item: CheckData.RawDataItem) => {
|
||||
item.dataA = item.dataA == null || item.dataA == undefined ? '/' : Number(item.dataA).toFixed(fixed).replace(/-/g, "")
|
||||
item.dataB = item.dataB == null || item.dataB == undefined ? '/' : Number(item.dataB).toFixed(fixed).replace(/-/g, "")
|
||||
item.dataC = item.dataC == null || item.dataC == undefined ? '/' : Number(item.dataC).toFixed(fixed).replace(/-/g, "")
|
||||
item.dataT = item.dataT == null || item.dataT == undefined ? '/' : Number(item.dataT).toFixed(fixed).replace(/-/g, "")
|
||||
item.dataA = stringToFixed(item.dataA)
|
||||
item.dataB = stringToFixed(item.dataB)
|
||||
item.dataC = stringToFixed(item.dataC)
|
||||
item.dataT = stringToFixed(item.dataT)
|
||||
})
|
||||
Object.assign(rawTableData, data)
|
||||
console.log("原始数据", rawTableData)
|
||||
}
|
||||
|
||||
const numberToFixed = (num: number): string => {
|
||||
if (num == null || num == undefined) {
|
||||
return '/'
|
||||
} else {
|
||||
return num.toFixed(fixed).replace(/-/g, "")
|
||||
let result = num.toFixed(fixed)
|
||||
if (result === "-0.0000") {
|
||||
return result.replace(/-/g, "")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
const stringToFixed = (str: string): string => {
|
||||
if (str == null || str == undefined) {
|
||||
return '/'
|
||||
} else {
|
||||
let num = Number(str)
|
||||
if (isNaN(num)) {
|
||||
return '/'
|
||||
}else{
|
||||
let result = num.toFixed(fixed)
|
||||
if (result === "-0.0000") {
|
||||
return result.replace(/-/g, "")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user