網(wǎng)站首頁 編程語言 正文
目錄
效果圖
?步驟:
1. 看elementui?官網(wǎng)上的案例,用到的方法是自帶的 toggleRowSelection
?2.?思路?
原委
? ? ? ?選中主表中的一條數(shù)據(jù);判斷與子表中的數(shù)據(jù)是否關(guān)聯(lián)(如果子表的關(guān)聯(lián)ID==主表的ID,則子表的這條數(shù)據(jù)顯示被勾選)。
效果圖
?步驟:
1. 看elementui?官網(wǎng)上的案例,用到的方法是自帶的 toggleRowSelection
?2.?思路?
? ? 判斷 選中的這條數(shù)據(jù)的ID與彈窗里面的數(shù)據(jù)進行匹配,建一個臨時數(shù)組,如果匹配成功,放入臨時數(shù)組中,然后使用官網(wǎng)給的方法。
代碼:
//1. 獲取主表選中的數(shù)據(jù)
roleID =1
//彈窗
//2. 調(diào)接口獲取子表格數(shù)據(jù)
that.$API.GetDepartmentUser(param).then((res) => {
let tempTabledata = JSON.parse(res.data.data);
that.$refs.cummonTable.SettableData(tempTabledata);
this.getselectData(tempTabledata); // lu 然后掉方法,這個方法就是給子表關(guān)聯(lián)ID與主表的ID一樣的顯示被勾選
});
/**
* 3. 獲取==角色ID的數(shù)據(jù),頁面展示被勾選
*/
getselectData(data) {
let tempselectData = []; //臨時數(shù)組
data.map((item) => {
// 遍歷 子表數(shù)據(jù)data中RoleID(關(guān)聯(lián)ID)== roleID(主表ID),放入新數(shù)據(jù)
if (item.RoleID == this.RoleID) {
tempselectData.push(item);
}
});
console.log(tempselectData, "遍歷之后的數(shù)據(jù)");
let rows = tempselectData;
//下面這個就是elementui 提供的方法
if (rows) {
rows.forEach((row) => {
if (this.dialogVisible) {
this.$nextTick(() => {
this.$refs.cummonTable.$refs.table.toggleRowSelection(row, true); //true 說明顯示被勾選
});
}
});
} else {
}
},
原文鏈接:https://blog.csdn.net/CMDN123456/article/details/131512407
- 上一篇:沒有了
- 下一篇:沒有了
相關(guān)推薦
- 2022-06-27 服務(wù)器端如何開啟GZIP壓縮功能(Apache、IIS、Nginx)_Linux
- 2023-07-27 修改el-button 的樣式
- 2022-04-27 Python中的元組(Tuple)操作實例詳解_python
- 2022-12-06 C++類成員函數(shù)后面加const問題_C 語言
- 2024-04-02 docker開機自啟設(shè)置
- 2022-04-15 Go?interface{}?轉(zhuǎn)切片類型的實現(xiàn)方法_Golang
- 2022-10-16 Qt實現(xiàn)串口助手_C 語言
- 2022-03-31 Linux中Go環(huán)境配置和GoModule常用操作_Golang
- 欄目分類
-
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支