diff --git a/src/components/project/BatchLecturer.vue b/src/components/project/BatchLecturer.vue
index 4d43d048..07e73f16 100644
--- a/src/components/project/BatchLecturer.vue
+++ b/src/components/project/BatchLecturer.vue
@@ -22,9 +22,9 @@
搜索
重置
@@ -34,9 +34,9 @@
@@ -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(() => {
@@ -87,6 +96,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 +106,6 @@ watch(()=>props.visible,(val)=>{
loading.value = false
}).catch(err=>{
loading.value = false
- tableData.value = []
message.error(err.data.msg)
})
}else{
@@ -110,39 +119,70 @@ 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
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
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)
+ );
+ 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
});
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'})
}
+ }, 500);
}
const loading = ref(false)
const selectedRowKeys = ref([])
@@ -155,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 32824583..1231e3c4 100644
--- a/src/components/project/ConfirmLecturer.vue
+++ b/src/components/project/ConfirmLecturer.vue
@@ -25,7 +25,7 @@
{{item?.trainOrgName||'-'}}
-
{{item?.summaryTotal?item?.summaryTotal+'元':'-'}}
+
{{item?.summaryTotal?Number(item?.summaryTotal).toFixed(2)+'元':'-'}}
@@ -34,9 +34,9 @@