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 @@
- +
搜索 重置 @@ -46,7 +46,7 @@ { // numTime.value+=1 // localStorage.setItem('numTime',numTime.value) const ids = forData.value.flatMap(item => item.expenseList.map(item => item.id)); + // let ids = [] + // if(searchTrue.value){ + // ids = timesList.value.map(item=>item.id) + // }else{ + // ids = expenseList.value.map(item=>item.id) + // } if(!ids.length){ return message.error('暂无可提交的数据') } + modalVisible.value = false; + emit('example',true) api.teacherExpenseConfirm({ids:ids?.join(',')}).then(res=>{ console.log(res,'resssss') api.submitApproval({ids:res.data?.data?.join(',')}).then(res=>{ @@ -152,12 +160,14 @@ const handleConfirm = () => { close() closeDrawer() emit('visibleFalse',false) + emit('example',false) }).catch(err=>{ message.destroy() message.error(err.data.msg) close() closeDrawer() emit('visibleFalse',false) + emit('example',false) }) }).catch(err=>{ message.destroy() @@ -171,6 +181,7 @@ const forData = ref() const indexList = ref(0) const expenseList = ref([]) const searchList = ref([]) +const timesList = ref([]) const clickItem = (item,i) => { expenseList.value = item.expenseList indexList.value = i @@ -182,6 +193,8 @@ const pageHeight = computed(() => { watch(()=>props.visible,(val)=>{ if(val){ loadingData.value = true + forData.value = [] + expenseList.value = [] // numTime.value = Number(localStorage.getItem('numTime')||0) api.getListByAffiliation( { @@ -200,8 +213,6 @@ watch(()=>props.visible,(val)=>{ }).catch(()=>{ message.error('获取数据失败,请重新尝试') loadingData.value = false - forData.value = [] - expenseList.value = [] }) }else{ nameUserNo.value = null @@ -222,7 +233,8 @@ const removeId = (e,i) =>{ }) }) if(searchTrue.value){ - searchList.value = searchList.value.filter(item=>item.id !== e.id) + // searchList.value = searchList.value.filter(item=>item.id !== e.id) + timesList.value = timesList.value.filter(item=>item.id !== e.id) expenseList.value = expenseList.value.filter(item=>item.id !== e.id) }else{ expenseList.value = expenseList.value.filter(item=>item.id !== e.id) @@ -246,33 +258,59 @@ 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 + forData.value[indexList.value].summaryTotal = expenseList.value.reduce((sum, item) => sum + (Number(item.expense) || 0), 0); return } //搜索 数组expenseList.value 参数名字或者工号:nameUserNo.value 日期:dateValue.value - const filteredList = expenseList.value.filter(item => { - const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value); + // const filteredList = expenseList.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 = expenseList.value.filter(item => { const teachingDateTimestamp = new Date(item.teachingDate).getTime(); if(dateValue.value==null){ - return isNameMatch + return expenseList.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; + }); + const filteredList = timesLists.filter(item => { + const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value); + return isNameMatch }); searchList.value = filteredList; + timesList.value = timesLists + forData.value[indexList.value].summaryTotal = timesLists.reduce((sum, item) => sum + (Number(item.expense) || 0), 0); let scrollHeight = null - filteredList.length && (scrollHeight = expenseList.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 resetData = () => { nameUserNo.value = null @@ -446,21 +484,31 @@ const columns = [ const closeDrawer = () => emit("update:visible", false); const qureyDrawer = () => { const ids = forData.value.flatMap(item => item.expenseList.map(item => item.id)); + // let ids = [] + // if(searchTrue.value){ + // ids = timesList.value.map(item=>item.id) + // }else{ + // ids = expenseList.value.map(item=>item.id) + // } if(!ids.length){ return message.error('暂无可提交的数据') } + console.log(ids,'idssssss') dialog({ content: '是否确认讲师费信息无误?提交后按“培训发生组织”汇总至审批中心,等待验证后“提交”进入审批流程。', ok: () => { + emit('example',true) api.teacherExpenseConfirm({ids:ids?.join(',')}).then(res=>{ console.log(res,'resssss') message.success('提交成功') closeDrawer() + emit('example',false) emit('visibleFalse',false) }).catch(err=>{ message.destroy() message.error(err.data.msg) closeDrawer() + emit('example',false) emit('visibleFalse',false) }) } @@ -471,6 +519,15 @@ const config = () => { message.error('暂无可提交的数据') return } + // let ids = [] + // if(searchTrue.value){ + // ids = timesList.value.map(item=>item.id) + // }else{ + // ids = expenseList.value.map(item=>item.id) + // } + // if(!ids.length){ + // return message.error('暂无可提交的数据') + // } modalVisible.value = true; } @@ -662,7 +719,7 @@ const config = () => { .right{ color: #646C9A; .org{ - max-width: 148px; + max-width: 136px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -686,11 +743,13 @@ const config = () => { padding-bottom: 80px; .top{ display: flex; + flex-wrap: wrap; align-items: center; - margin-bottom: 20px; + // margin-bottom: 20px; margin-top: 10px; .item{ margin-right: 20px; + margin-bottom: 20px; } } .table{ diff --git a/src/views/lecturer/ExternalLecturer.vue b/src/views/lecturer/ExternalLecturer.vue index d93ed152..ca3aec27 100644 --- a/src/views/lecturer/ExternalLecturer.vue +++ b/src/views/lecturer/ExternalLecturer.vue @@ -753,6 +753,7 @@ export default { getTeacherById({id:state.id}).then((res) => { console.log("外部讲师详情", res.data); state.formParam = res.data.data + state.formParam.defaultTeachingTime = state.formParam.defaultTeachingTime == null ? 0 : state.formParam.defaultTeachingTime state.formParam.description = state.formParam.description == null ? '


' : state.formParam.description state.formParam.photo = state.formParam.photo == null ? null : state.formParam.photo.includes('upload') ? res.data.data.photo : '/upload'+res.data.data.photo }) diff --git a/src/views/lecturer/ExternalTeaching.vue b/src/views/lecturer/ExternalTeaching.vue index 3566b0b6..d386db87 100644 --- a/src/views/lecturer/ExternalTeaching.vue +++ b/src/views/lecturer/ExternalTeaching.vue @@ -81,9 +81,9 @@
- +
@@ -1294,6 +1294,7 @@ export default { // objA.neworgName= objA.neworgName[objA.neworgName.length-1] // } state.formParam = res.data.data + state.formParam.defaultTeachingTime = state.formParam.defaultTeachingTime == null ? 0 : state.formParam.defaultTeachingTime state.formParam.description = state.formParam.description == null ? '


' : state.formParam.description state.formParam.workExperience = state.formParam.workExperience == null ? '


' : state.formParam.workExperience state.formParam.courses = state.formParam.courses == null ? '


' : state.formParam.courses diff --git a/src/views/lecturer/InsideTeaching.vue b/src/views/lecturer/InsideTeaching.vue index 4f5a37b5..25131fe3 100644 --- a/src/views/lecturer/InsideTeaching.vue +++ b/src/views/lecturer/InsideTeaching.vue @@ -94,13 +94,13 @@
- + - + 导出 @@ -291,7 +291,7 @@ /> 授课/课程日期 : - @@ -502,6 +502,8 @@ import { DownloadOutlined } from '@ant-design/icons-vue'; import dayjs from "dayjs"; +import locale from 'ant-design-vue/es/date-picker/locale/zh_CN'; +import 'dayjs/locale/zh-cn'; // import Editor from "@/components/project/Editor"; import ProjectManager from "@/components/project/ProjectManagerNew"; import { message } from "ant-design-vue"; @@ -1521,7 +1523,8 @@ export default { // searchTimeChange, cancelTeachingDialog, // editTimeChange, - scoreChange + scoreChange, + locale } }, }; diff --git a/src/views/lecturer/LecturerAPPEdit.vue b/src/views/lecturer/LecturerAPPEdit.vue index c2c720a6..a20c7cf3 100644 --- a/src/views/lecturer/LecturerAPPEdit.vue +++ b/src/views/lecturer/LecturerAPPEdit.vue @@ -1,6 +1,8 @@