mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-20 08:16:46 +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=>{
|
lecturerApi.getUnSelectOrg(props.isParent).then(res=>{
|
||||||
if(res.data.code == 200){
|
if(res.data.code == 200){
|
||||||
notLists.value = res.data.data
|
notLists.value = res.data.data
|
||||||
|
notLists.value = notLists.value.filter(item=>{
|
||||||
|
return !treeAddData.value.some(item2=>item2.orgId == item.orgId)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if(treeData.value.length){
|
if(treeData.value.length){
|
||||||
treeData.value.map(item=>{
|
treeData.value.map(item=>{
|
||||||
item.name = item.name?.split('(')[0]
|
item.name = item.name?.split('(')[0]
|
||||||
notLists.value.some(i=>{
|
notLists.value.some(i=>{
|
||||||
if(i.orgId == item.id){
|
if(i.orgId == item.id ){
|
||||||
item.disabled = true
|
item.disabled = true
|
||||||
item.name = item.name + '(' + i.affiliationName + ')'
|
item.name = item.name + '(' + i.affiliationName + ')'
|
||||||
// return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return item
|
return item
|
||||||
|
|||||||
@@ -27,29 +27,29 @@
|
|||||||
<div class="org" :title="item?.trainOrgName">{{item?.trainOrgName||'-'}}</div>
|
<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 class="text org" :title="Number(item?.summaryTotal).toFixed(2)">{{item?.summaryTotal?Number(item?.summaryTotal).toFixed(2)+'元':'-'}}</div>
|
||||||
</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>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="item">
|
<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>
|
||||||
<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" />
|
<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>
|
||||||
<div class="item">
|
<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="searchData(true,indexList)" 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="resetData(indexList,true)" style="border-radius:8px;width: 100px;height: 40px;">重置</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<a-table
|
<a-table
|
||||||
ref="drawerContent"
|
ref="drawerContent"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data-source="searchTrue?timesList:expenseList"
|
:data-source="searchTrue?timesList[indexList]:expenseList[indexList]"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:scroll="{ x: 'max-content',y:expenseList.length? pageHeight : null }"
|
:scroll="{ x: 'max-content',y:expenseList[indexList]?.length? pageHeight : null }"
|
||||||
:loading="loadingData"
|
:loading="loadingData"
|
||||||
:custom-row="customRow"
|
:custom-row="customRow"
|
||||||
>
|
>
|
||||||
@@ -135,24 +135,13 @@ const close = () => {
|
|||||||
modalVisible.value = false;
|
modalVisible.value = false;
|
||||||
}
|
}
|
||||||
const handleConfirm = () => {
|
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;
|
modalVisible.value = false;
|
||||||
emit('example',true)
|
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=>{
|
api.teacherExpenseConfirm({ids:ids?.join(',')}).then(res=>{
|
||||||
console.log(res,'resssss')
|
console.log(res,'resssss')
|
||||||
api.submitApproval({ids:res.data?.data?.join(',')}).then(res=>{
|
api.submitApproval({ids:res.data?.data?.join(',')}).then(res=>{
|
||||||
@@ -184,13 +173,13 @@ const expenseList = ref([])
|
|||||||
const searchList = ref([])
|
const searchList = ref([])
|
||||||
const timesList = ref([])
|
const timesList = ref([])
|
||||||
const clickItem = (item,i) => {
|
const clickItem = (item,i) => {
|
||||||
expenseList.value = item.expenseList
|
|
||||||
indexList.value = i
|
indexList.value = i
|
||||||
resetData()
|
resetData(i,false)
|
||||||
}
|
}
|
||||||
const pageHeight = computed(() => {
|
const pageHeight = computed(() => {
|
||||||
return window.innerHeight - 450
|
return window.innerHeight - 450
|
||||||
});
|
});
|
||||||
|
const searchConditions = ref([{ nameUserNo: '', dateValue: [] }])
|
||||||
watch(()=>props.visible,(val)=>{
|
watch(()=>props.visible,(val)=>{
|
||||||
if(val){
|
if(val){
|
||||||
loadingData.value = true
|
loadingData.value = true
|
||||||
@@ -207,17 +196,21 @@ watch(()=>props.visible,(val)=>{
|
|||||||
).then(res=>{
|
).then(res=>{
|
||||||
if(res.data.code === 200){
|
if(res.data.code === 200){
|
||||||
forData.value = res.data.data
|
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
|
loadingData.value = false
|
||||||
resetData()
|
resetData(indexList.value,true)
|
||||||
}).catch(()=>{
|
}).catch((err)=>{
|
||||||
message.error('获取数据失败,请重新尝试')
|
message.error('获取数据失败,请重新尝试')
|
||||||
loadingData.value = false
|
loadingData.value = false
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
nameUserNo.value = null
|
searchConditions.value = [{ nameUserNo: '', dateValue: [] }]
|
||||||
dateValue.value = null
|
timesList.value = []
|
||||||
indexList.value = 0
|
indexList.value = 0
|
||||||
activeList.value = []
|
activeList.value = []
|
||||||
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:0,behavior: 'smooth'})
|
drawerContent.value?.$el.querySelector('.ant-table-body')?.scrollTo({top:0,behavior: 'smooth'})
|
||||||
@@ -235,11 +228,10 @@ const removeId = (e,i) =>{
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
if(searchTrue.value){
|
if(searchTrue.value){
|
||||||
// searchList.value = searchList.value.filter(item=>item.id !== e.id)
|
timesList.value[indexList.value] = timesList.value[indexList.value].filter(item=>item.id !== e.id)
|
||||||
timesList.value = timesList.value.filter(item=>item.id !== e.id)
|
expenseList.value[indexList.value] = expenseList.value[indexList.value].filter(item=>item.id !== e.id)
|
||||||
expenseList.value = expenseList.value.filter(item=>item.id !== e.id)
|
|
||||||
}else{
|
}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)
|
forData.value[indexList.value].summaryTotal = (forData.value[indexList.value]?.summaryTotal - e.expense).toFixed(2)
|
||||||
if(!forData.value[indexList.value].expenseList.length){
|
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 searchTrue = ref(false)
|
||||||
const drawerContent = ref(null)
|
const drawerContent = ref(null)
|
||||||
const customRow = (record) => {
|
const customRow = (record) => {
|
||||||
@@ -261,7 +251,7 @@ const customRow = (record) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
let timeout = null
|
let timeout = null
|
||||||
const searchData = (val) => {
|
const searchData = (val,index) => {
|
||||||
searchTrue.value = val
|
searchTrue.value = val
|
||||||
loadingData.value = true
|
loadingData.value = true
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
@@ -269,43 +259,32 @@ const searchData = (val) => {
|
|||||||
}
|
}
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
loadingData.value = false;
|
loadingData.value = false;
|
||||||
if(!nameUserNo.value&&!dateValue.value){
|
const { nameUserNo, dateValue } = searchConditions.value[index];
|
||||||
|
if(!nameUserNo&&!dateValue.length){
|
||||||
searchList.value = [];
|
searchList.value = [];
|
||||||
timesList.value = expenseList.value
|
timesList.value[indexList.value] = expenseList.value[indexList.value]
|
||||||
forData.value[indexList.value].summaryTotal = expenseList.value.reduce((sum, item) => sum + (Number(item.expense) || 0), 0);
|
forData.value[indexList.value].summaryTotal = expenseList.value[indexList.value].reduce((sum, item) => sum + (Number(item.expense) || 0), 0);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//搜索 数组expenseList.value 参数名字或者工号:nameUserNo.value 日期:dateValue.value
|
const timesLists = expenseList.value[indexList.value].filter(item => {
|
||||||
// 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();
|
const teachingDateTimestamp = new Date(item.teachingDate).getTime();
|
||||||
if(dateValue.value==null){
|
if(dateValue==null||!dateValue.length){
|
||||||
return expenseList.value
|
return expenseList.value[indexList.value]
|
||||||
}
|
}
|
||||||
const startDateTimestamp = new Date(dateValue.value[0]).getTime();
|
const startDateTimestamp = new Date(dateValue[0]).getTime();
|
||||||
const endDateTimestamp = new Date(dateValue.value[1]).getTime();
|
const endDateTimestamp = new Date(dateValue[1]).getTime();
|
||||||
const isDateInRange = teachingDateTimestamp >= startDateTimestamp && teachingDateTimestamp <= endDateTimestamp;
|
const isDateInRange = teachingDateTimestamp >= startDateTimestamp && teachingDateTimestamp <= endDateTimestamp;
|
||||||
return isDateInRange;
|
return isDateInRange;
|
||||||
});
|
});
|
||||||
const filteredList = timesLists.filter(item => {
|
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
|
return isNameMatch
|
||||||
});
|
});
|
||||||
searchList.value = filteredList;
|
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);
|
forData.value[indexList.value].summaryTotal = timesLists.reduce((sum, item) => sum + (Number(item.expense) || 0), 0);
|
||||||
let scrollHeight = null
|
let scrollHeight = null
|
||||||
filteredList.length && (scrollHeight = timesLists.findIndex(item => item.id === filteredList[0].id))
|
filteredList.length && (scrollHeight = timesLists.findIndex(item => item.id === filteredList[0].id))
|
||||||
@@ -314,10 +293,9 @@ const searchData = (val) => {
|
|||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
const resetData = () => {
|
const resetData = (index,val) => {
|
||||||
nameUserNo.value = null
|
val && (searchConditions.value[index] = { nameUserNo: '', dateValue: [] });
|
||||||
dateValue.value = null
|
searchData(true,index);
|
||||||
searchData(false)
|
|
||||||
}
|
}
|
||||||
const emit = defineEmits(['update:visible'])
|
const emit = defineEmits(['update:visible'])
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -341,6 +319,7 @@ const columns = [
|
|||||||
key: 'courseName',
|
key: 'courseName',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
width:160,
|
width:160,
|
||||||
|
ellipsis:true,
|
||||||
customCell :() => {return {style: {maxWidth: '200px',overflow: 'hidden',whiteSpace: 'nowrap',textOverflow:'ellipsis',cursor:'pointer'}}},
|
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 closeDrawer = () => emit("update:visible", false);
|
||||||
const activeList = ref([])
|
const activeList = ref([])
|
||||||
const setList = (item) => {
|
const setList = (item) => {
|
||||||
const index = activeList.value.findIndex(listItem => listItem === item.trainOrgId);
|
const index = activeList.value.findIndex(listItem => listItem === item);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
activeList.value.splice(index, 1);
|
activeList.value.splice(index, 1);
|
||||||
} else {
|
} else {
|
||||||
activeList.value.push(item.trainOrgId);
|
activeList.value.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const qureyDrawer = () => {
|
const qureyDrawer = () => {
|
||||||
const filterList = forData.value.filter(item=>{
|
const idList = []
|
||||||
return activeList.value.includes(item.trainOrgId)
|
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)
|
||||||
// let ids = []
|
|
||||||
// if(searchTrue.value){
|
|
||||||
// ids = timesList.value.map(item=>item.id)
|
|
||||||
// }else{
|
|
||||||
// ids = expenseList.value.map(item=>item.id)
|
|
||||||
// }
|
|
||||||
if(!ids.length){
|
if(!ids.length){
|
||||||
return message.error('暂无可提交的数据')
|
return message.error('暂无可提交的数据')
|
||||||
}
|
}
|
||||||
@@ -528,23 +502,15 @@ const qureyDrawer = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const config = () => {
|
const config = () => {
|
||||||
const filterList = forData.value.filter(item=>{
|
const idList = []
|
||||||
return activeList.value.includes(item.trainOrgId)
|
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){
|
if(!ids.length){
|
||||||
message.error('暂无可提交的数据')
|
message.error('暂无可提交的数据')
|
||||||
return
|
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;
|
modalVisible.value = true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -293,7 +293,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="jsx">
|
<script lang="jsx">
|
||||||
@@ -354,7 +354,7 @@ export default{
|
|||||||
code: null,
|
code: null,
|
||||||
isContains: '0',
|
isContains: '0',
|
||||||
affiliationOrgList: [],
|
affiliationOrgList: [],
|
||||||
affiliationOrgLists: [],
|
affiliationOrgLists:[],
|
||||||
locking: 1,
|
locking: 1,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -768,6 +768,7 @@ const getTableDate = (obj) => {
|
|||||||
code: null,
|
code: null,
|
||||||
isContains: '0',
|
isContains: '0',
|
||||||
affiliationOrgList: [],
|
affiliationOrgList: [],
|
||||||
|
affiliationOrgLists:[],
|
||||||
locking: 1,
|
locking: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user