test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
Showing only changes of commit 2a2ef5ab5c - Show all commits

View File

@ -8,7 +8,13 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<h1>Recent 24 hours</h1> <h1>Recent 24 hours</h1>
<p>{{ list }}</p> <p>{{ jsondemo }}</p>
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emit-fun="handleEmitFun"></base-table>
</div> </div>
</template> </template>
@ -19,7 +25,99 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
list: [], queryParams: {
pageNo: 1,
pageSize: 10,
},
jsondemo: '',
list: [
{
inspectionContent: '检测内容1',
'2023-03-18T00:00:00-产线1': '产线1-asdf',
'2023-03-18T01:00:00-产线2': '产线2-kldf',
'2023-03-18T02:00:00-产线1': '产线1-vasdkj',
},
],
tableProps: [
{
prop: 'inspectionContent',
label: '检测内容',
align: 'center',
},
//
// mock
{
prop: '2023-03-18T00:00:00',
label: '2023-03-18T00:00:00',
align: 'center',
children: [
{
prop: '2023-03-18T00:00:00-产线1',
label: '产线1',
align: 'center',
},
{
prop: '2023-03-18T00:00:00-产线2',
label: '产线2',
align: 'center',
},
{
prop: '2023-03-18T00:00:00-产线3',
label: '产线3',
align: 'center',
},
{
prop: '2023-03-18T00:00:00-产线4',
label: '产线4',
align: 'center',
},
{
prop: '2023-03-18T00:00:00-产线5',
label: '产线5',
align: 'center',
},
],
},
{
prop: '2023-03-18T01:00:00',
label: '2023-03-18T01:00:00',
align: 'center',
children: [
{
prop: '2023-03-18T01:00:00-产线1',
label: '产线1',
align: 'center',
},
{
prop: '2023-03-18T01:00:00-产线2',
label: '产线2',
align: 'center',
},
{
prop: '2023-03-18T01:00:00-产线3',
label: '产线3',
align: 'center',
},
],
},
{
prop: '2023-03-18T02:00:00',
label: '2023-03-18T02:00:00',
align: 'center',
children: [
{
prop: '2023-03-18T02:00:00-产线1',
label: '产线1',
align: 'center',
},
{
prop: '2023-03-18T02:00:00-产线2',
label: '产线2',
align: 'center',
},
],
},
],
}; };
}, },
computed: {}, computed: {},
@ -33,7 +131,33 @@ export default {
method: 'get', method: 'get',
}); });
console.log(response); console.log(response);
this.list = JSON.stringify(response, null, 2); this.jsondemo = JSON.stringify(response, null, 2);
},
filterNameData(nameData) {
const ndSet = new Set();
nameData.forEach((nd) => {
ndSet.add(nd.name);
});
return Array.from(ndSet.values())
.sort()
.map((name) => ({
prop: name,
label: name,
}));
},
filterData(data) {
return data.map((item) => {
const { data: innerData } = item;
const keyValuePairs = {};
innerData.map((d) => {
keyValuePairs[d.dynamicName] = d.dynamicValue;
});
return {
inspectionContent: item.inspectionContent,
...keyValuePairs,
sumInput: item.sumInput,
};
});
}, },
}, },
}; };