test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
2 changed files with 109 additions and 63 deletions
Showing only changes of commit 76100ad07d - Show all commits

View File

@ -16,10 +16,18 @@
<base-table
:key="1 + '__basetable'"
:table-props="table1.tableProps"
:page="1"
:limit="999"
:page="table1.pageNo"
:limit="table1.pageSize"
:table-data="table1.data"
@emitFun="(val) => handleEmitFun(table1, val)"></base-table>
<pagination
v-show="table1.total > 0"
:total="table1.total"
:page.sync="table1.pageNo"
:limit.sync="table1.pageSize"
:page-size="table1.pageSize"
:page-sizes="[1, 3, 5, 10, 20]"
@pagination="(val) => getListFor(table1, val)" />
<base-table
:key="2 + '__basetable'"
:table-props="table2.tableProps"
@ -86,6 +94,72 @@
</template>
<script>
import LocalDataManager from './utils/local-data-manager';
const fakeTable1Data = [
{
time: 1111111111111111,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 22222222222222,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 33333333333333,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 44444444444444,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5555555555555,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6666666666666666666,
},
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
];
const table1LDM = new LocalDataManager(fakeTable1Data, 1, 3);
export default {
name: 'EquipmentFullParams',
components: {},
@ -182,67 +256,10 @@ export default {
label: '布尔4',
},
],
data: [
{
time: 1111111111111111,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 22222222222222,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 33333333333333,
bol1: 4,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 44444444444444,
val2: 5,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5555555555555,
bol2: 6,
},
{
time: 1,
plcCode: 2,
val1: 3,
bol1: 4,
val2: 5,
bol2: 6666666666666666666,
},
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
{ time: 1, plcCode: 2, val1: 3, bol1: 4, val2: 5, bol2: 6 },
],
data: table1LDM.dataList,
pageNo: table1LDM.pageNo,
pageSize: table1LDM.pageSize,
total: table1LDM.total,
},
table2: {
tableProps: [

View File

@ -0,0 +1,29 @@
export default class LocalDataManager {
constructor(dataList, pageNo, pageSize) {
this._dataListStore = dataList;
this._pageNo = pageNo;
this._pageSize = pageSize;
}
setPageNo(pageNo) {
this._pageNo = pageNo;
}
setPageSize(pageSize) {
this._pageSize = pageSize;
}
get dataList() {
return this._dataListStore.slice((this._pageNo - 1) * this._pageSize, this._pageNo * this._pageSize);
}
get total() {
return this._dataListStore.length;
}
deleteData(id) {
const idx = this._dataListStore.findIndex(item => item.id == id);
this._dataListStore.splice(idx, 1);
// send http request
}
}