Merge branch 'main' of http://192.168.0.56:3000/bonus/bonus-ui into safetywarning-ui

This commit is contained in:
jjLv 2024-11-15 11:52:23 +08:00
commit 50e32ae590
2 changed files with 72 additions and 11 deletions

View File

@ -101,7 +101,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange" :selectable="checkSelectable" :row-class-name="getRowClassName">
<el-table-column type="selection" min-width="55" align="center"/>
<el-table-column label="角色编号" prop="roleId" min-width="120" align="center"/>
<el-table-column label="角色名称" align="center" prop="roleName" :show-overflow-tooltip="true" min-width="150"/>
@ -476,10 +476,15 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roleId)
this.single = selection.length != 1
this.multiple = !selection.length
},
//
const validSelection = selection.filter(row => this.checkSelectable(row));
// roleId
this.ids = validSelection.map(item => item.roleId);
//
this.single = validSelection.length !== 1;
this.multiple = !validSelection.length;
},
//
handleCommand(command, row) {
switch (command) {
@ -626,7 +631,33 @@ export default {
this.download('system/role/export', {
...this.queryParams
}, `role_${new Date().getTime()}.xlsx`)
}
},
//
checkSelectable(row) {
return !(row.roleId === 1 || row.isBuiltIn === '0');
},
getRowClassName(row) {
return !this.checkSelectable(row) ? 'disabled-row' : '';
},
}
}
</script>
<style>
.disabled-row {
background-color: #f5f7fa !important;
color: #909399;
cursor: not-allowed;
}
.disabled-row .el-checkbox__input {
cursor: not-allowed !important;
}
.disabled-row:hover td {
background-color: #f5f7fa !important;
}
</style>

View File

@ -82,7 +82,7 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" :selectable="checkSelectable" :row-class-name="getRowClassName">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible"/>
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible"
@ -584,9 +584,14 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userId)
this.single = selection.length != 1
this.multiple = !selection.length
//
const validSelection = selection.filter(row => this.checkSelectable(row));
// roleId
this.ids = validSelection.map(item => item.userId);
//
this.single = validSelection.length !== 1;
this.multiple = !validSelection.length;
},
//
handleCommand(command, row) {
@ -782,7 +787,32 @@ export default {
//
submitFileForm() {
this.$refs.upload.submit()
}
},
//
checkSelectable(row) {
return !(row.userId === 1 || row.isBuiltIn === '0');
},
getRowClassName(row) {
return !this.checkSelectable(row) ? 'disabled-row' : '';
},
}
}
</script>
<style>
.disabled-row {
background-color: #f5f7fa !important;
color: #909399;
cursor: not-allowed;
}
.disabled-row .el-checkbox__input {
cursor: not-allowed !important;
}
.disabled-row:hover td {
background-color: #f5f7fa !important;
}
</style>