讲师管理bug

This commit is contained in:
zhangsir
2024-12-31 15:49:48 +08:00
parent 31e4608137
commit c0db544735
2 changed files with 33 additions and 4 deletions

View File

@@ -36,7 +36,7 @@
:columns="columns"
:data-source="searchTrue?timesList:tableData"
:pagination="false"
:scroll="{ x: 'max-content',y:tableData.length? pageHeight : null }"
:scroll="{ x: 'max-content',y:searchTrue?timesList.length?pageHeight : null:tableData.length?pageHeight : null, }"
row-key="id"
:loading="loading"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@@ -44,8 +44,8 @@
>
<template #action="{ record }">
<div class="action">
<div style="color: #1890ff;cursor: pointer;" class="btn" v-if="selectedRowKeys.includes(record.id)" @click="removeList(record)">取消选择</div>
<div style="color: #1890ff;cursor: pointer;" class="btn" v-else @click="addList(record)">选择</div>
<div style="color: #1890ff;cursor: pointer;" class="btn" v-if="selectedRowKeys.includes(record.id)" @click.stop="removeList(record)">取消选择</div>
<div style="color: #1890ff;cursor: pointer;" class="btn" v-else @click.stop="addList(record)">选择</div>
</div>
</template>
</a-table>
@@ -79,6 +79,15 @@ const customRow = (record) => {
style:{
backgroundColor: searchTrue.value && searchList.value.some(item => item.id === record.id) ? '#a6dff9' : '',
},
onClick() {
if(selectedRowKeys.value.some(item => item === record.id)){
selectedRowKeys.value = selectedRowKeys.value.filter(item => item !== record.id)
selectsData.value = selectsData.value.filter(item => item.id !== record.id)
}else{
selectedRowKeys.value.push(record.id)
selectsData.value.push(record)
}
}
};
};
const pageHeight = computed(() => {
@@ -116,9 +125,16 @@ const resetData = () => {
dateValue.value = null
searchData(false)
}
let timeout = null
const searchData = (val) => {
// drawerContent.value.scrollTo({top:200,behavior: 'smooth'})
searchTrue.value = val
loading.value = true
if(timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
loading.value = false
if(!nameUserNo.value&&!dateValue.value){
searchList.value = [];
timesList.value = tableData.value
@@ -152,6 +168,9 @@ const searchData = (val) => {
selectedRowKeys.value = selectedRowKeys.value.filter(id =>
timesLists.some(item => item.id === id)
);
selectsData.value = selectsData.value.filter(item =>
timesLists.some(item2 => item2.id === item.id)
);
const filteredList = timesLists.filter(item => {
const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value);
return isNameMatch
@@ -163,6 +182,7 @@ const searchData = (val) => {
if(scrollHeight||scrollHeight==0){
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:scrollHeight*55,behavior: 'smooth'})
}
}, 500);
}
const loading = ref(false)
const selectedRowKeys = ref([])
@@ -175,6 +195,7 @@ const emit = defineEmits(['selectedRowKeys','update:visible'])
const addList = (item) => {
selectedRowKeys.value.push(item.id)
selectsData.value.push(item)
console.log(selectedRowKeys.value)
}
const expense = ref(0)
watch(()=>selectsData.value.length,(val)=>{

View File

@@ -258,8 +258,15 @@ const customRow = (record) => {
}
};
};
let timeout = null
const searchData = (val) => {
searchTrue.value = val
loadingData.value = true
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
loadingData.value = false;
if(!nameUserNo.value&&!dateValue.value){
searchList.value = [];
timesList.value = expenseList.value
@@ -303,6 +310,7 @@ const searchData = (val) => {
if(scrollHeight||scrollHeight==0){
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:scrollHeight*55,behavior: 'smooth'})
}
}, 500);
}
const resetData = () => {
nameUserNo.value = null
@@ -711,7 +719,7 @@ const config = () => {
.right{
color: #646C9A;
.org{
max-width: 148px;
max-width: 136px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;