diff --git a/src/components/project/BatchLecturer.vue b/src/components/project/BatchLecturer.vue index 5c4d0702..07e73f16 100644 --- a/src/components/project/BatchLecturer.vue +++ b/src/components/project/BatchLecturer.vue @@ -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 @@ > @@ -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)=>{ diff --git a/src/components/project/ConfirmLecturer.vue b/src/components/project/ConfirmLecturer.vue index 9ff51122..1231e3c4 100644 --- a/src/components/project/ConfirmLecturer.vue +++ b/src/components/project/ConfirmLecturer.vue @@ -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;