mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +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'})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="org" :title="item?.trainOrgName">{{item?.trainOrgName||'-'}}</div>
|
||||
<div class="text org" :title="item?.summaryTotal">{{item?.summaryTotal?item?.summaryTotal+'元':'-'}}</div>
|
||||
<div class="text org" :title="Number(item?.summaryTotal).toFixed(2)">{{item?.summaryTotal?Number(item?.summaryTotal).toFixed(2)+'元':'-'}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,7 +46,7 @@
|
||||
<a-table
|
||||
ref="drawerContent"
|
||||
:columns="columns"
|
||||
:data-source="expenseList"
|
||||
:data-source="searchTrue?timesList:expenseList"
|
||||
:pagination="false"
|
||||
:scroll="{ x: 'max-content',y:expenseList.length? pageHeight : null }"
|
||||
:loading="loadingData"
|
||||
@@ -141,6 +141,12 @@ const handleConfirm = () => {
|
||||
// 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('暂无可提交的数据')
|
||||
}
|
||||
@@ -171,6 +177,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 +189,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 +209,6 @@ watch(()=>props.visible,(val)=>{
|
||||
}).catch(()=>{
|
||||
message.error('获取数据失败,请重新尝试')
|
||||
loadingData.value = false
|
||||
forData.value = []
|
||||
expenseList.value = []
|
||||
})
|
||||
}else{
|
||||
nameUserNo.value = null
|
||||
@@ -222,7 +229,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)
|
||||
@@ -250,26 +258,44 @@ const searchData = (val) => {
|
||||
searchTrue.value = val
|
||||
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'})
|
||||
}
|
||||
@@ -446,9 +472,16 @@ 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: () => {
|
||||
@@ -471,6 +504,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;
|
||||
}
|
||||
</script>
|
||||
@@ -686,11 +728,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{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<a-drawer class="largeDrawerInside" :visible="visible" placement="right" :closable="false" :maskClosable="false"
|
||||
width="60%" :title="false">
|
||||
width="60%" :title="false">
|
||||
<div v-if="mask" style="width:100%;height:100%;background:rgba(0, 0, 0, 0.45);position: fixed;
|
||||
z-index: 999;"></div>
|
||||
<div class="appedit">
|
||||
<div class="header" style="margin-top: -24px;">
|
||||
<div class="headerTitle">汇总讲师费</div>
|
||||
@@ -457,6 +459,7 @@ export default {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const state = reactive({
|
||||
mask: false,
|
||||
orgList: [],
|
||||
params: {
|
||||
pageNo: 1,
|
||||
@@ -517,6 +520,7 @@ export default {
|
||||
})
|
||||
const getTableList = () => {
|
||||
state.loading = true
|
||||
state.mask = true
|
||||
queryExpnseByBillId({
|
||||
billId: props.id,
|
||||
pageNo: state.params.pageNo,
|
||||
@@ -528,6 +532,11 @@ export default {
|
||||
state.dataList = res.data.data.records
|
||||
state.params.total = Number(res.data.data.total);
|
||||
state.loading = false
|
||||
state.mask = false
|
||||
}).catch(err=>{
|
||||
state.loading = false
|
||||
state.mask = false
|
||||
message.error(err.data?.msg)
|
||||
})
|
||||
}
|
||||
const dateChange = (e) => {
|
||||
@@ -576,6 +585,7 @@ export default {
|
||||
state.formData = res.data.data
|
||||
})
|
||||
search();
|
||||
emits.emit('successParams',true)
|
||||
}).catch(err=>{
|
||||
message.destroy()
|
||||
message.error(err.data.msg)
|
||||
@@ -779,6 +789,11 @@ export default {
|
||||
closeDrawer();
|
||||
}
|
||||
}).catch(err=>{
|
||||
if(err.message=='timeout of 15000ms exceeded'){
|
||||
message.destroy()
|
||||
message.error('请求超时,请重试')
|
||||
return
|
||||
}
|
||||
message.destroy()
|
||||
message.error(err.data.msg)
|
||||
})
|
||||
@@ -837,9 +852,10 @@ export default {
|
||||
}).then(res=>{
|
||||
message.success('移除成功')
|
||||
search()
|
||||
emits.emit('successParams',true)
|
||||
state.formData.summaryTotal = (Number(state.formData.summaryTotal) - Number(record.expense)).toFixed(2)
|
||||
}).catch(err=>{
|
||||
message.error(err.msg)
|
||||
message.error(err.data?.msg)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1179,7 +1179,7 @@ getAllLevelList().then((res) => {
|
||||
}
|
||||
//一键确认讲师费
|
||||
const handleTeacher =()=>{
|
||||
// state.visibleConfirm = true
|
||||
state.visibleConfirm = true
|
||||
}
|
||||
async function validateField(name) {
|
||||
return new Promise((resolve) => {
|
||||
|
||||
Reference in New Issue
Block a user