推送计划 - 选择和管理任务
<template>
<el-dialog v-model="Scheduledtasks" title="推送计划" width="95%" height="95%">
<div>
<div>
<el-button type="primary" @click="add = true">增加</el-button>
<el-button type="primary" @click="edit = true">修改</el-button>
<el-button type="primary" @click="deleteRows">删除</el-button>
</div>
<el-table
ref="multipleTableRef"
:data="PlantableData"
style="width: 100%"
@selection-change="PlanleSelectionChange"
>
<el-table-column type="selection" width="30" />
<el-table-column property="js" label="角色" show-overflow-tooltip />
<el-table-column label="时间">
<template #default="scope">{{ scope.row.sj }}</template>
</el-table-column>
<el-table-column property="rw" label="任务" />
<el-table-column property="zt" label="状态" />
</el-table>
</div>
</el-dialog>
</template>
<script>
export default {
data() {
return {
Scheduledtasks: false,
PlantableData: [], // 表格数据
selectedRows: [] // 选中的数据
};
},
created() {
this.selectedRows = JSON.parse(localStorage.getItem('selectedRows')) || [];
},
methods: {
PlanleSelectionChange(selection) {
this.selectedRows = selection;
localStorage.setItem('selectedRows', JSON.stringify(selection));
},
deleteRows() {
// 删除选中的数据
this.PlantableData = this.PlantableData.filter(
item => !this.selectedRows.includes(item)
);
// 清除选中状态
this.$refs.multipleTableRef.clearSelection();
// 更新本地存储中的选中数据
localStorage.setItem('selectedRows', JSON.stringify(this.selectedRows));
}
}
};
</script>
原文地址: https://www.cveoy.top/t/topic/pE5m 著作权归作者所有。请勿转载和采集!