lb #19

Merged
g7hoo merged 80 commits from lb into test 2023-09-11 15:05:16 +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 <base-table
:key="1 + '__basetable'" :key="1 + '__basetable'"
:table-props="table1.tableProps" :table-props="table1.tableProps"
:page="1" :page="table1.pageNo"
:limit="999" :limit="table1.pageSize"
:table-data="table1.data" :table-data="table1.data"
@emitFun="(val) => handleEmitFun(table1, val)"></base-table> @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 <base-table
:key="2 + '__basetable'" :key="2 + '__basetable'"
:table-props="table2.tableProps" :table-props="table2.tableProps"
@ -86,6 +94,72 @@
</template> </template>
<script> <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 { export default {
name: 'EquipmentFullParams', name: 'EquipmentFullParams',
components: {}, components: {},
@ -182,67 +256,10 @@ export default {
label: '布尔4', label: '布尔4',
}, },
], ],
data: [ data: table1LDM.dataList,
{ pageNo: table1LDM.pageNo,
time: 1111111111111111, pageSize: table1LDM.pageSize,
plcCode: 2, total: table1LDM.total,
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 },
],
}, },
table2: { table2: {
tableProps: [ 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
}
}