翻页选中

master
mhsnet 2 months ago
parent 9d520a9d14
commit d2d13cd468

@ -51,7 +51,7 @@
</el-col>
<el-col :span="24">
<el-table
ref="multipleTable"
ref="sltTable"
:data="dbList"
tooltip-effect="dark"
style="width: 100%"
@ -129,11 +129,29 @@ export default {
}
};
},
created() {},
methods: {
init() {
init(rowO) {
this.initParams(rowO);
this.getList();
this.visible = true;
},
initParams(rowO) {
if (!Array.isArray(rowO)) {
rowO = [];
}
let _nowRows = rowO.map(o1 => {
let _row = {
pieceId: o1.materialId,
pieceName: o1.materialName
};
return _row;
});
this.sltdRows = _nowRows;
this.pageCurrent = 1;
this.queryParams.pieceId = "";
this.queryParams.pieceName = "";
},
getList() {
this.listLoading = true;
let _query = {
@ -156,13 +174,54 @@ export default {
method: "post",
data: _query
}).then(res => {
var _list = res.data.list;
let _list = res.data.list;
this.dbList = _list;
this.pageTotal = res.data.pagination.total;
let _sltdRows = this.sltdRows
setTimeout(() => {
this.fnSltdDo(_sltdRows);
}, 500);
});
},
fnSltdDo(sltdRowsN) {
this.sltdRows = sltdRowsN.map(o1 => {
let _item = this.dbList.find(o2 => {
return o1.pieceId == o2.pieceId;
});
if (_item) {
return _item;
} else {
return o1;
}
});
this.$nextTick(() => {
let _dbListId = this.dbList.map(o1 => {
return o1.pieceId;
});
let _sltdRows = this.sltdRows.filter(o1 => {
if (_dbListId.includes(o1.pieceId)) {
return true;
} else {
return false;
}
});
_sltdRows.forEach(row => {
this.$refs.sltTable.toggleRowSelection(row);
});
});
},
fnSltChg(sltdRowsNow) {
this.sltdRows = sltdRowsNow;
let _dbListId = this.dbList.map(o1 => {
return o1.pieceId;
});
let _sltdRows = this.sltdRows.filter(o1 => {
if (_dbListId.includes(o1.pieceId)) {
return false;
} else {
return true;
}
});
this.sltdRows = [...sltdRowsNow, ..._sltdRows];
},
fnPageSizeChg(pageSizeNow) {
this.pageSize = pageSizeNow;
@ -185,7 +244,7 @@ export default {
this.visible = false;
},
fnOk() {
this.$emit('cbSltdChg', this.sltdRows)
this.$emit("cbSltdChg", this.sltdRows);
this.fnCancel();
}
}

@ -287,7 +287,7 @@ export default {
methods: {
fnMaterialListDialog() {
this.$nextTick(() => {
this.$refs.materialListDialog.init();
this.$refs.materialListDialog.init(this.dataForm.data);
});
},
fnSltdMaterialChg(nowRows) {

Loading…
Cancel
Save