<template>
|
<BaseCard>
|
<template #content>
|
<el-table
|
:data="tableData"
|
v-loading="loading"
|
table-layout="fixed"
|
:row-class-name="tableRowClassName"
|
:height="tableHeight"
|
border
|
>
|
<el-table-column prop="TIME" label="时间" />
|
<el-table-column
|
v-for="(item, index) in tableColumn"
|
:key="index"
|
:prop="item.name"
|
:label="item.label"
|
/>
|
</el-table>
|
<el-pagination
|
v-if="pagination"
|
ref="paginationRef"
|
class="el-pagination"
|
v-model:current-page="currentPage"
|
v-model:page-size="pageSize"
|
:page-sizes="[10, 20, 50, 100]"
|
:background="true"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
/>
|
</template>
|
|
<template #footer> </template>
|
</BaseCard>
|
</template>
|
|
<script>
|
import { FactorDatas } from '@/model/FactorDatas';
|
import { checkboxOptions } from '@/constant/checkbox-options';
|
import { TYPE0 } from '@/constant/device-type';
|
|
export default {
|
props: {
|
factorDatas: FactorDatas,
|
deviceType: {
|
type: String,
|
// type0: 车载或无人机; type1:无人船
|
default: TYPE0
|
}
|
},
|
data() {
|
return {
|
tableHeight: '500',
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
loading: false
|
};
|
},
|
computed: {
|
tableData() {
|
const list = [];
|
for (const key in this.factorDatas.factor) {
|
if (Object.hasOwnProperty.call(this.factorDatas.factor, key)) {
|
const f = this.factorDatas.factor[key];
|
f.datas.forEach((v, i) => {
|
if (list.length <= i) {
|
list.push({ [f.factorName]: v });
|
} else {
|
list[i][f.factorName] = v;
|
}
|
});
|
}
|
}
|
return list;
|
},
|
tableColumn() {
|
return checkboxOptions(this.deviceType);
|
}
|
}
|
};
|
</script>
|