| | |
| | | |
| | | const testObj = computed(() => { |
| | | if (testRecordList.value) { |
| | | let [type, record] = testRecordCode.value || []; |
| | | let [type, record, record2] = testRecordCode.value || []; |
| | | if (!type) return {}; |
| | | |
| | | let list = testRecordList.value.filter((v) => v.value == type)[0].children; |
| | | return list.filter((v) => record == v.value)[0]; |
| | | if (record2 !== undefined) { |
| | | return list |
| | | .filter((v) => record == v.value)[0].children |
| | | .filter((vv) => vv.value == record2)[0]; |
| | | } else { |
| | | return list.filter((v) => record == v.value)[0]; |
| | | } |
| | | } else { |
| | | return {}; |
| | | } |
| | |
| | | } |
| | | let label = type; |
| | | let value = v; |
| | | let children = arr.map((vv) => ({ |
| | | ...vv, |
| | | label: vv.testStarttime, |
| | | value: vv.testRecordCount, |
| | | })); |
| | | return { label, value, disabled: !arr.length, children }; |
| | | let children = []; |
| | | let count = arr.length; |
| | | if (devType.value == 1) { |
| | | children = arr.map((vv) => ({ |
| | | ...vv, |
| | | label: vv.testStarttime, |
| | | value: vv.testRecordCount, |
| | | })); |
| | | } else { |
| | | // 添加一级 区分是组1还是组2 |
| | | let _obj = {}; |
| | | for (let i = 0, len = arr.length; i < len; i++) { |
| | | let item = arr[i]; |
| | | let idx = item.battIdx; |
| | | _obj[idx] = _obj[idx] || []; |
| | | _obj[idx].push(item); |
| | | } |
| | | |
| | | Object.keys(_obj).forEach((vv) => { |
| | | let item = _obj[vv]; |
| | | let idx = `组${vv * 1 + 1}`; |
| | | let _count = item.length; |
| | | children.push({ |
| | | label: idx, |
| | | count: _count, |
| | | value: `group_${vv}`, |
| | | children: item.map((vvv) => ({ |
| | | ...vvv, |
| | | label: vvv.testStarttime, |
| | | value: vvv.testRecordCount, |
| | | })), |
| | | }); |
| | | }); |
| | | } |
| | | return { label, value, count, disabled: !arr.length, children }; |
| | | }); |
| | | } |
| | | testRecordList.value = _list; |
| | |
| | | } |
| | | |
| | | const canSlide = computed(() => !!testDatas.value.length); |
| | | |
| | | // const testInf = computed(() => { |
| | | // if (testDatas.value.length) { |
| | | // return testDatas.value[0]; |
| | | // } else { |
| | | // return {}; |
| | | // } |
| | | // }); |
| | | |
| | | function updateChart(data) { |
| | | let labels = [], |
| | |
| | | } |
| | | |
| | | function selectRecord() { |
| | | let res = testRecordCode.value[1]; |
| | | let res = testRecordCode.value[testRecordCode.value.length - 1]; |
| | | // console.log("res", res, "============="); |
| | | |
| | | getRecordInf(currentDevId.value, res) |
| | |
| | | $message.error("请选择要导出的测试记录"); |
| | | return false; |
| | | } |
| | | exportRecord(currentDevId.value, testRecordCode.value[1]) |
| | | exportRecord( |
| | | currentDevId.value, |
| | | testRecordCode.value[testRecordCode.value.length - 1] |
| | | ) |
| | | .then((res) => { |
| | | let { data, status, headers } = res; |
| | | const matchRes = /filename=(.*)/.exec(headers["content-disposition"]); |
| | |
| | | @change="selectRecord" |
| | | ><template #default="{ node, data }"> |
| | | <span>{{ data.label }}</span> |
| | | <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span> |
| | | <span v-if="!node.isLeaf"> ({{ data.count }}) </span> |
| | | </template></el-cascader |
| | | > |
| | | <div class="info-title"> |