mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-20 00:06:47 +08:00
讲师管理bug
This commit is contained in:
@@ -131,15 +131,18 @@ import * as lecturerApi from "@/api/Lecturer.js";
|
||||
lecturerApi.getUnSelectOrg(props.isParent).then(res=>{
|
||||
if(res.data.code == 200){
|
||||
notLists.value = res.data.data
|
||||
notLists.value = notLists.value.filter(item=>{
|
||||
return !treeAddData.value.some(item2=>item2.orgId == item.orgId)
|
||||
})
|
||||
}
|
||||
if(treeData.value.length){
|
||||
treeData.value.map(item=>{
|
||||
item.name = item.name?.split('(')[0]
|
||||
notLists.value.some(i=>{
|
||||
if(i.orgId == item.id){
|
||||
if(i.orgId == item.id ){
|
||||
item.disabled = true
|
||||
item.name = item.name + '(' + i.affiliationName + ')'
|
||||
// return true
|
||||
return true
|
||||
}
|
||||
})
|
||||
return item
|
||||
|
||||
@@ -27,29 +27,29 @@
|
||||
<div class="org" :title="item?.trainOrgName">{{item?.trainOrgName||'-'}}</div>
|
||||
<div class="text org" :title="Number(item?.summaryTotal).toFixed(2)">{{item?.summaryTotal?Number(item?.summaryTotal).toFixed(2)+'元':'-'}}</div>
|
||||
</div>
|
||||
<div class="icon" :class="activeList.includes(item.trainOrgId)?'active':'not'" @click.stop="setList(item)"></div>
|
||||
<div class="icon" :class="activeList.includes(index)?'active':'not'" @click.stop="setList(index)"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="top">
|
||||
<div class="item">
|
||||
<a-input @pressEnter="searchData(true)" style="border-radius: 8px;width:240px;height: 40px;" v-model:value="nameUserNo" placeholder="请输入工号/讲师名称进行搜索" allowClear />
|
||||
<a-input @pressEnter="searchData(true,indexList)" style="border-radius: 8px;width:240px;height: 40px;" v-model:value="searchConditions[indexList].nameUserNo" placeholder="请输入工号/讲师名称进行搜索" allowClear />
|
||||
</div>
|
||||
<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" />
|
||||
<a-range-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD" style="border-radius: 8px;width:360px;height: 40px;" v-model:value="searchConditions[indexList].dateValue" />
|
||||
</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>
|
||||
<a-button type="primary" @click="searchData(true,indexList)" style="margin-right:20px;border-radius:8px;width: 100px;height: 40px;">搜索</a-button>
|
||||
<a-button type="primary" @click="resetData(indexList,true)" style="border-radius:8px;width: 100px;height: 40px;">重置</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table">
|
||||
<a-table
|
||||
ref="drawerContent"
|
||||
:columns="columns"
|
||||
:data-source="searchTrue?timesList:expenseList"
|
||||
:data-source="searchTrue?timesList[indexList]:expenseList[indexList]"
|
||||
:pagination="false"
|
||||
:scroll="{ x: 'max-content',y:expenseList.length? pageHeight : null }"
|
||||
:scroll="{ x: 'max-content',y:expenseList[indexList]?.length? pageHeight : null }"
|
||||
:loading="loadingData"
|
||||
:custom-row="customRow"
|
||||
>
|
||||
@@ -135,24 +135,13 @@ const close = () => {
|
||||
modalVisible.value = false;
|
||||
}
|
||||
const handleConfirm = () => {
|
||||
// if(numTime.value >= 10){
|
||||
// message.error('提交审批次数已达上限')
|
||||
// return
|
||||
// }
|
||||
// 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)
|
||||
const idList = []
|
||||
activeList.value?.map(item=>{
|
||||
idList.push(...timesList.value[item])
|
||||
})
|
||||
const ids = idList?.map(item=>item.id)
|
||||
api.teacherExpenseConfirm({ids:ids?.join(',')}).then(res=>{
|
||||
console.log(res,'resssss')
|
||||
api.submitApproval({ids:res.data?.data?.join(',')}).then(res=>{
|
||||
@@ -184,13 +173,13 @@ const expenseList = ref([])
|
||||
const searchList = ref([])
|
||||
const timesList = ref([])
|
||||
const clickItem = (item,i) => {
|
||||
expenseList.value = item.expenseList
|
||||
indexList.value = i
|
||||
resetData()
|
||||
resetData(i,false)
|
||||
}
|
||||
const pageHeight = computed(() => {
|
||||
return window.innerHeight - 450
|
||||
});
|
||||
const searchConditions = ref([{ nameUserNo: '', dateValue: [] }])
|
||||
watch(()=>props.visible,(val)=>{
|
||||
if(val){
|
||||
loadingData.value = true
|
||||
@@ -207,17 +196,21 @@ watch(()=>props.visible,(val)=>{
|
||||
).then(res=>{
|
||||
if(res.data.code === 200){
|
||||
forData.value = res.data.data
|
||||
expenseList.value = res.data.data[indexList.value]?.expenseList || []
|
||||
forData.value.forEach((item,i) => {
|
||||
searchConditions.value.push({ nameUserNo: '', dateValue: [] });
|
||||
expenseList.value.push(forData.value[i]?.expenseList || [])
|
||||
timesList.value.push(forData.value[i]?.expenseList || [])
|
||||
});
|
||||
}
|
||||
loadingData.value = false
|
||||
resetData()
|
||||
}).catch(()=>{
|
||||
resetData(indexList.value,true)
|
||||
}).catch((err)=>{
|
||||
message.error('获取数据失败,请重新尝试')
|
||||
loadingData.value = false
|
||||
})
|
||||
}else{
|
||||
nameUserNo.value = null
|
||||
dateValue.value = null
|
||||
searchConditions.value = [{ nameUserNo: '', dateValue: [] }]
|
||||
timesList.value = []
|
||||
indexList.value = 0
|
||||
activeList.value = []
|
||||
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:0,behavior: 'smooth'})
|
||||
@@ -235,11 +228,10 @@ const removeId = (e,i) =>{
|
||||
})
|
||||
})
|
||||
if(searchTrue.value){
|
||||
// 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)
|
||||
timesList.value[indexList.value] = timesList.value[indexList.value].filter(item=>item.id !== e.id)
|
||||
expenseList.value[indexList.value] = expenseList.value[indexList.value].filter(item=>item.id !== e.id)
|
||||
}else{
|
||||
expenseList.value = expenseList.value.filter(item=>item.id !== e.id)
|
||||
expenseList.value[indexList.value] = expenseList.value[indexList.value].filter(item=>item.id !== e.id)
|
||||
}
|
||||
forData.value[indexList.value].summaryTotal = (forData.value[indexList.value]?.summaryTotal - e.expense).toFixed(2)
|
||||
if(!forData.value[indexList.value].expenseList.length){
|
||||
@@ -249,8 +241,6 @@ const removeId = (e,i) =>{
|
||||
}
|
||||
})
|
||||
}
|
||||
const nameUserNo = ref(null)
|
||||
const dateValue = ref(null)
|
||||
const searchTrue = ref(false)
|
||||
const drawerContent = ref(null)
|
||||
const customRow = (record) => {
|
||||
@@ -261,7 +251,7 @@ const customRow = (record) => {
|
||||
};
|
||||
};
|
||||
let timeout = null
|
||||
const searchData = (val) => {
|
||||
const searchData = (val,index) => {
|
||||
searchTrue.value = val
|
||||
loadingData.value = true
|
||||
if (timeout) {
|
||||
@@ -269,43 +259,32 @@ const searchData = (val) => {
|
||||
}
|
||||
timeout = setTimeout(() => {
|
||||
loadingData.value = false;
|
||||
if(!nameUserNo.value&&!dateValue.value){
|
||||
const { nameUserNo, dateValue } = searchConditions.value[index];
|
||||
if(!nameUserNo&&!dateValue.length){
|
||||
searchList.value = [];
|
||||
timesList.value = expenseList.value
|
||||
forData.value[indexList.value].summaryTotal = expenseList.value.reduce((sum, item) => sum + (Number(item.expense) || 0), 0);
|
||||
timesList.value[indexList.value] = expenseList.value[indexList.value]
|
||||
forData.value[indexList.value].summaryTotal = expenseList.value[indexList.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 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 timesLists = expenseList.value[indexList.value].filter(item => {
|
||||
const teachingDateTimestamp = new Date(item.teachingDate).getTime();
|
||||
if(dateValue.value==null){
|
||||
return expenseList.value
|
||||
if(dateValue==null||!dateValue.length){
|
||||
return expenseList.value[indexList.value]
|
||||
}
|
||||
const startDateTimestamp = new Date(dateValue.value[0]).getTime();
|
||||
const endDateTimestamp = new Date(dateValue.value[1]).getTime();
|
||||
const startDateTimestamp = new Date(dateValue[0]).getTime();
|
||||
const endDateTimestamp = new Date(dateValue[1]).getTime();
|
||||
const isDateInRange = teachingDateTimestamp >= startDateTimestamp && teachingDateTimestamp <= endDateTimestamp;
|
||||
return isDateInRange;
|
||||
});
|
||||
const filteredList = timesLists.filter(item => {
|
||||
const isNameMatch = (item.name + item.userNo).includes(nameUserNo.value);
|
||||
if(!nameUserNo){
|
||||
return
|
||||
}
|
||||
const isNameMatch = (item.name + item.userNo).includes(nameUserNo);
|
||||
return isNameMatch
|
||||
});
|
||||
searchList.value = filteredList;
|
||||
timesList.value = timesLists
|
||||
timesList.value[indexList.value] = timesLists
|
||||
forData.value[indexList.value].summaryTotal = timesLists.reduce((sum, item) => sum + (Number(item.expense) || 0), 0);
|
||||
let scrollHeight = null
|
||||
filteredList.length && (scrollHeight = timesLists.findIndex(item => item.id === filteredList[0].id))
|
||||
@@ -314,10 +293,9 @@ const searchData = (val) => {
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
const resetData = () => {
|
||||
nameUserNo.value = null
|
||||
dateValue.value = null
|
||||
searchData(false)
|
||||
const resetData = (index,val) => {
|
||||
val && (searchConditions.value[index] = { nameUserNo: '', dateValue: [] });
|
||||
searchData(true,index);
|
||||
}
|
||||
const emit = defineEmits(['update:visible'])
|
||||
const columns = [
|
||||
@@ -341,6 +319,7 @@ const columns = [
|
||||
key: 'courseName',
|
||||
align: 'left',
|
||||
width:160,
|
||||
ellipsis:true,
|
||||
customCell :() => {return {style: {maxWidth: '200px',overflow: 'hidden',whiteSpace: 'nowrap',textOverflow:'ellipsis',cursor:'pointer'}}},
|
||||
},
|
||||
{
|
||||
@@ -486,24 +465,19 @@ const columns = [
|
||||
const closeDrawer = () => emit("update:visible", false);
|
||||
const activeList = ref([])
|
||||
const setList = (item) => {
|
||||
const index = activeList.value.findIndex(listItem => listItem === item.trainOrgId);
|
||||
const index = activeList.value.findIndex(listItem => listItem === item);
|
||||
if (index > -1) {
|
||||
activeList.value.splice(index, 1);
|
||||
} else {
|
||||
activeList.value.push(item.trainOrgId);
|
||||
activeList.value.push(item);
|
||||
}
|
||||
}
|
||||
const qureyDrawer = () => {
|
||||
const filterList = forData.value.filter(item=>{
|
||||
return activeList.value.includes(item.trainOrgId)
|
||||
const idList = []
|
||||
activeList.value?.map(item=>{
|
||||
idList.push(...timesList.value[item])
|
||||
})
|
||||
const ids = filterList?.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)
|
||||
// }
|
||||
const ids = idList?.map(item=>item.id)
|
||||
if(!ids.length){
|
||||
return message.error('暂无可提交的数据')
|
||||
}
|
||||
@@ -528,23 +502,15 @@ const qureyDrawer = () => {
|
||||
})
|
||||
}
|
||||
const config = () => {
|
||||
const filterList = forData.value.filter(item=>{
|
||||
return activeList.value.includes(item.trainOrgId)
|
||||
const idList = []
|
||||
activeList.value?.map(item=>{
|
||||
idList.push(...timesList.value[item])
|
||||
})
|
||||
const ids = filterList?.flatMap(item => item.expenseList?.map(item => item.id));
|
||||
const ids = idList?.map(item=>item.id)
|
||||
if(!ids.length){
|
||||
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>
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</a-drawer>
|
||||
<AddOrgContent :Addtitle="'选择组织'" :isParent="formParam.isParent" v-model:showContent="showContent" :AddContentLists="formParam.affiliationOrgLists" v-model:AddContentList="formParam.affiliationOrgList"/>
|
||||
<AddOrgContent :Addtitle="'选择组织'" :isParent="formParam.isParent" v-model:showContent="showContent" :AddContentLists="formParam.affiliationOrgLists" v-model:AddContentList="formParam.affiliationOrgList" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="jsx">
|
||||
@@ -354,7 +354,7 @@ export default{
|
||||
code: null,
|
||||
isContains: '0',
|
||||
affiliationOrgList: [],
|
||||
affiliationOrgLists: [],
|
||||
affiliationOrgLists:[],
|
||||
locking: 1,
|
||||
},
|
||||
})
|
||||
@@ -768,6 +768,7 @@ const getTableDate = (obj) => {
|
||||
code: null,
|
||||
isContains: '0',
|
||||
affiliationOrgList: [],
|
||||
affiliationOrgLists:[],
|
||||
locking: 1,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user