Browse Source

2024-05-22 节假日设置的bug修复;工作日历的bug修复

master_hella_20240701
zhousq 6 months ago
parent
commit
fec9ff3a25
  1. 20
      src/views/mes/holiday/holiday.data.ts
  2. 48
      src/views/mes/workcalendar/index.vue

20
src/views/mes/holiday/holiday.data.ts

@ -1,8 +1,17 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
// 表单校验
export const HolidayRules = reactive({
holidayName: [
{ required: true, message: '请输入节日名称', trigger: 'blur' }
],
holidayType: [
{ required: true, message: '请输入节日类型', trigger: 'blur' }
],
holidayDate: [
{ required: true, message: '请输入节日日期', trigger: 'blur' }
],
})
export const Holiday = useCrudSchemas(reactive<CrudSchema[]>([
@ -10,7 +19,9 @@ export const Holiday = useCrudSchemas(reactive<CrudSchema[]>([
label: '主键',
field: 'id',
sort: 'custom',
isForm: false,
isSearch: false,
isTable:false,
isForm:false
},
@ -56,13 +67,13 @@ export const Holiday = useCrudSchemas(reactive<CrudSchema[]>([
label: '节日日期',
field: 'holidayDate',
sort: 'custom',
formatter: dateFormatter,
formatter: dateFormatter2,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD 00:00:00',
}
},
form: {
@ -72,6 +83,7 @@ export const Holiday = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x'
}
},
},
{
label: '状态',

48
src/views/mes/workcalendar/index.vue

@ -59,7 +59,7 @@
</el-aside>
<el-main>
<div class="calender-class">
<el-calendar ref="calendarMain">
<el-calendar ref="calendarMain" :key="calendarCount">
<template #header="{ date }">
<span>排班日历</span>
<span>{{ date }}</span>
@ -151,7 +151,7 @@
<el-drawer :title="batchTitle" v-model="batchAddDrawer" size="40%">
<div class="demo-drawer_content">
<el-form v-model="batchAddForm">
<el-form-item label="排班日期:" label-width="120px">
<el-form-item label="排班日期:" >
<el-date-picker
v-model="batchAddForm.batchDate"
value-format="YYYY-MM-DD"
@ -162,7 +162,7 @@
>
</el-date-picker>
</el-form-item>
<el-form-item label="规则类型:" label-width="120px">
<el-form-item label="规则类型:" >
<!-- <el-button type="primary" @click="addDomain" link> <Icon icon="ep:plus" /> </el-button> -->
<el-radio-group v-model="ruleType" @change="handleRuleType">
<el-radio label="一班倒">一班倒</el-radio>
@ -170,7 +170,7 @@
<el-radio label="三班倒">三班倒</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排除非法定休息日:" label-width="120px">
<el-form-item label="排除非法定休息日:">
<el-switch v-model="batchAddForm.excludeRestDay" />
</el-form-item>
@ -329,7 +329,7 @@ interface Team {
name: string
class: string
}
const calendarCount=ref(0)
const currentRow = ref() //
const handleTableCurrentChange = (val: Team) => {
currentRow.value = val
@ -414,6 +414,12 @@ watch(
}
}
)
// watch(
// () => viewDate.value,
// (newVal) => {
// console.log('🚀 ~ file: workcalendar:420 ~ watch ~ viewDate:', newVal)
// }
// )
onMounted(
async function () {
let res=await workCalendarApi.getHolidays(dayjs(currentDate.value).year())
@ -573,9 +579,15 @@ const addWork = () => {
saveList.push(info)
})
//console.log('🚀 ~ file: App.vue:571 ~ addWork ~ saveList:', saveList)
savePlan(saveList)
getViewData(currentRow.value.code, hanleDay.value.day, hanleDay.value.day)
savePlan(saveList,currentRow.value.code, hanleDay.value.day.slice(0, 8) + '01', dayjs(hanleDay.value.day).endOf('month').format('YYYY-MM-DD'))
//nextTick(() => {
//getViewData(currentRow.value.code, hanleDay.value.day.slice(0, 8) + '01', dayjs(hanleDay.value.day).endOf('month').format('YYYY-MM-DD'))
///})
//getViewData(currentRow.value.code, hanleDay.value.day, hanleDay.value.day)
//console.log('🚀 ~ file: App.vue:571 ~ addWork ~ saveList:', dayjs(hanleDay.value.day).endOf('month').format('YYYY-MM-DD'))
drawer.value = false
}
@ -650,8 +662,8 @@ const batchAddWork = () => {
}
})
savePlan(saveList)
getViewData(currentRow.value.code, dateList[0], dateList[1])
savePlan(saveList,currentRow.value.code, dateList[0], dateList[1])
//getViewData(currentRow.value.code, dateList[0], dateList[1])
batchAddDrawer.value = false
batchAddForm.value = {
batchDate: [],
@ -665,8 +677,11 @@ const handleAddClose = () => {
drawer.value = false
}
const savePlan = async (workList) => {
const savePlan = async (workList, code,startTime,endTime) => {
await workCalendarApi.createBatch(workList)
nextTick(() => {
getViewData( code,startTime,endTime)
})
//await workCalendarApi.createObj(workList);
}
const getViewData = async (teamCode: any, startDate: any, endDate: any) => {
@ -676,8 +691,12 @@ const getViewData = async (teamCode: any, startDate: any, endDate: any) => {
endTime: endDate
}
let res = await workCalendarApi.getWorkPlan(params)
//onsole.log('🚀 ~ file: App.vue:689 ~ getViewData ~ getViewData:',res)
viewDate.value = res
calendarCount.value++
// })
//if(res)
viewDate.value = res
//workInfoList.value =viewDate.value
//console.log('🚀 ~ file: App.vue:672 ~ getViewData ~ getViewData:', viewDate.value)
}
@ -726,7 +745,7 @@ const getTeamList = async () => {
//
const handleDelete=(row:any)=>{
message.delConfirm('确认要删除['+row.name+']班组当月排班数据吗?', 'Warning').then(() => {
message.delConfirm('确认要删除['+row.name+']班组当月排班数据吗?', '警告').then(() => {
//console.log('🚀 ~ file: App.vue:720 ~ handleDelete ~ :', dayjs(currentDate.value).endOf('month').format('YYYY-MM-DD'))
deleteWorkPlan(row.code,currentDate.value.slice(0, 8) + '01', dayjs(currentDate.value).endOf('month').format('YYYY-MM-DD'))
@ -742,10 +761,11 @@ const deleteWorkPlan=async (code:any,startTime:any,endTime:any)=>{
startTime:startTime,
endTime: endTime
}
console.log('🚀 ~ file: App.vue:720 ~ deleteWorkPlan ~ :', data)
//console.log('🚀 ~ file: App.vue:720 ~ deleteWorkPlan ~ :', data)
workCalendarApi.deleteWorkPlan(data)
getViewData(code, startTime,endTime)
}
</script>
<style>

Loading…
Cancel
Save