mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-22 09:16:46 +08:00
讲师管理bug
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
<div class="item">
|
||||
<a-input @pressEnter="searchData(true)" style="border-radius: 8px;width:240px;height: 40px;" v-model:value="nameUserNo" placeholder="请输入工号/讲师名称进行搜索" allowClear />
|
||||
</div>
|
||||
<!-- <div class="item">
|
||||
<div class="item">
|
||||
<a-range-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD" style="border-radius: 8px;width:360px;height: 40px;" v-model:value="dateValue" />
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="item">
|
||||
<a-button type="primary" @click="searchData(true)" style="margin-right:20px;border-radius:8px;width: 100px;height: 40px;">搜索</a-button>
|
||||
<a-button type="primary" @click="resetData()" style="border-radius:8px;width: 100px;height: 40px;">重置</a-button>
|
||||
@@ -34,7 +34,7 @@
|
||||
<a-table
|
||||
ref="drawerContent"
|
||||
:columns="columns"
|
||||
:data-source="tableData"
|
||||
:data-source="searchTrue?timesList:tableData"
|
||||
:pagination="false"
|
||||
:scroll="{ x: 'max-content',y:tableData.length? pageHeight : null }"
|
||||
row-key="id"
|
||||
@@ -87,6 +87,7 @@ const pageHeight = computed(() => {
|
||||
watch(()=>props.visible,(val)=>{
|
||||
if(val){
|
||||
loading.value = true
|
||||
tableData.value = []
|
||||
api.getListByStatus().then(res=>{
|
||||
if(res.data.code == 200 ){
|
||||
tableData.value = res.data.data
|
||||
@@ -96,7 +97,6 @@ watch(()=>props.visible,(val)=>{
|
||||
loading.value = false
|
||||
}).catch(err=>{
|
||||
loading.value = false
|
||||
tableData.value = []
|
||||
message.error(err.data.msg)
|
||||
})
|
||||
}else{
|
||||
@@ -110,6 +110,7 @@ const nameUserNo = ref(null)
|
||||
const dateValue = ref(null)
|
||||
const searchTrue = ref(false)
|
||||
const searchList = ref([])
|
||||
const timesList = ref([])
|
||||
const resetData = () => {
|
||||
nameUserNo.value = null
|
||||
dateValue.value = null
|
||||
@@ -120,26 +121,45 @@ const searchData = (val) => {
|
||||
searchTrue.value = val
|
||||
if(!nameUserNo.value&&!dateValue.value){
|
||||
searchList.value = [];
|
||||
timesList.value = tableData.value
|
||||
return
|
||||
}
|
||||
//搜索 数组expenseList.value 参数名字或者工号:nameUserNo.value 日期:dateValue.value
|
||||
const filteredList = tableData.value.filter(item => {
|
||||
const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value);
|
||||
// const filteredList = tableData.value.filter(item => {
|
||||
// const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value);
|
||||
// const teachingDateTimestamp = new Date(item.teachingDate).getTime();
|
||||
// if(dateValue.value==null){
|
||||
// return isNameMatch
|
||||
// }
|
||||
// const startDateTimestamp = new Date(dateValue.value[0]).getTime();
|
||||
// const endDateTimestamp = new Date(dateValue.value[1]).getTime();
|
||||
// const isDateInRange = teachingDateTimestamp >= startDateTimestamp && teachingDateTimestamp <= endDateTimestamp;
|
||||
// if(nameUserNo.value&&startDateTimestamp&&endDateTimestamp){
|
||||
// return isNameMatch && isDateInRange;
|
||||
// }
|
||||
// return isNameMatch || isDateInRange;
|
||||
// });
|
||||
const timesLists = tableData.value.filter(item => {
|
||||
const teachingDateTimestamp = new Date(item.teachingDate).getTime();
|
||||
if(dateValue.value==null){
|
||||
return isNameMatch
|
||||
return tableData.value
|
||||
}
|
||||
const startDateTimestamp = new Date(dateValue.value[0]).getTime();
|
||||
const endDateTimestamp = new Date(dateValue.value[1]).getTime();
|
||||
const isDateInRange = teachingDateTimestamp >= startDateTimestamp && teachingDateTimestamp <= endDateTimestamp;
|
||||
if(nameUserNo.value&&startDateTimestamp&&endDateTimestamp){
|
||||
return isNameMatch && isDateInRange;
|
||||
}
|
||||
return isNameMatch || isDateInRange;
|
||||
return isDateInRange;
|
||||
});
|
||||
selectedRowKeys.value = selectedRowKeys.value.filter(id =>
|
||||
timesLists.some(item => item.id === id)
|
||||
);
|
||||
const filteredList = timesLists.filter(item => {
|
||||
const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value);
|
||||
return isNameMatch
|
||||
});
|
||||
searchList.value = filteredList;
|
||||
timesList.value = timesLists
|
||||
let scrollHeight = null
|
||||
filteredList.length && (scrollHeight = tableData.value.findIndex(item => item.id === filteredList[0].id))
|
||||
filteredList.length && (scrollHeight = timesLists.findIndex(item => item.id === filteredList[0].id))
|
||||
if(scrollHeight||scrollHeight==0){
|
||||
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:scrollHeight*55,behavior: 'smooth'})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user