|
@@ -94,11 +94,9 @@ const jgzzhysProductValue = () => {
|
|
|
//考勤年月按钮 继续
|
|
//考勤年月按钮 继续
|
|
|
const kqny = ref('')
|
|
const kqny = ref('')
|
|
|
const jjgzzhysclick = async () => {
|
|
const jjgzzhysclick = async () => {
|
|
|
- // console.log(jjgzzhysformData.date)
|
|
|
|
|
- var date = jjgzzhysformData.date;
|
|
|
|
|
- var year = date.slice(0, 4);
|
|
|
|
|
- var month = date.slice(4);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var date = jjgzzhysformData.date;//202403
|
|
|
|
|
+ var year = date.slice(0, 4);//2024
|
|
|
|
|
+ var month = date.slice(4);//03
|
|
|
if (month < 1 || month > 12) {
|
|
if (month < 1 || month > 12) {
|
|
|
ElMessage({type: 'warning',message: '月份必须在1到12月之间'})
|
|
ElMessage({type: 'warning',message: '月份必须在1到12月之间'})
|
|
|
return false;
|
|
return false;
|
|
@@ -108,7 +106,6 @@ const jjgzzhysclick = async () => {
|
|
|
}
|
|
}
|
|
|
kqny.value = year+month;
|
|
kqny.value = year+month;
|
|
|
}
|
|
}
|
|
|
- // console.log(jjgzzhysformData.start_date)
|
|
|
|
|
function formatDate(dateString) {
|
|
function formatDate(dateString) {
|
|
|
if (dateString === null || dateString === '') {
|
|
if (dateString === null || dateString === '') {
|
|
|
return '';
|
|
return '';
|
|
@@ -119,24 +116,23 @@ const jjgzzhysclick = async () => {
|
|
|
const day = String(formattedDate.getDate()).padStart(2, '0');
|
|
const day = String(formattedDate.getDate()).padStart(2, '0');
|
|
|
return `${year}-${month}-${day}`;
|
|
return `${year}-${month}-${day}`;
|
|
|
}
|
|
}
|
|
|
- var dateMonth = kqny.value.slice(-2); //获取月份
|
|
|
|
|
|
|
+ var dateMonth = kqny.value.slice(-2);//获取date后两位月份
|
|
|
|
|
+ //开始日期结束日期
|
|
|
if (formatDate(jjgzzhysformData.start_date).slice(5, 7) !== dateMonth && formatDate(jjgzzhysformData.end_date).slice(5, 7) !== dateMonth) {
|
|
if (formatDate(jjgzzhysformData.start_date).slice(5, 7) !== dateMonth && formatDate(jjgzzhysformData.end_date).slice(5, 7) !== dateMonth) {
|
|
|
ElMessage({type: 'warning',message: '考勤月份和开始日期和结束日期的月份不一致'})
|
|
ElMessage({type: 'warning',message: '考勤月份和开始日期和结束日期的月份不一致'})
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+ //法定假日1开始日期结束日期
|
|
|
if (jjgzzhysformData.vacation_one_start && formatDate(jjgzzhysformData.vacation_one_start).slice(5, 7) !== dateMonth && jjgzzhysformData.vacation_one_end && formatDate(jjgzzhysformData.vacation_one_end).slice(5, 7) !== dateMonth) {
|
|
if (jjgzzhysformData.vacation_one_start && formatDate(jjgzzhysformData.vacation_one_start).slice(5, 7) !== dateMonth && jjgzzhysformData.vacation_one_end && formatDate(jjgzzhysformData.vacation_one_end).slice(5, 7) !== dateMonth) {
|
|
|
ElMessage({ type: 'warning', message: '考勤月份和法定假日1的月份不一致' });
|
|
ElMessage({ type: 'warning', message: '考勤月份和法定假日1的月份不一致' });
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ //法定假日2开始日期结束日期
|
|
|
if (jjgzzhysformData.vacation_two_start && formatDate(jjgzzhysformData.vacation_two_start).slice(5, 7) !== dateMonth && jjgzzhysformData.vacation_two_end && formatDate(jjgzzhysformData.vacation_two_end).slice(5, 7) !== dateMonth) {
|
|
if (jjgzzhysformData.vacation_two_start && formatDate(jjgzzhysformData.vacation_two_start).slice(5, 7) !== dateMonth && jjgzzhysformData.vacation_two_end && formatDate(jjgzzhysformData.vacation_two_end).slice(5, 7) !== dateMonth) {
|
|
|
ElMessage({ type: 'warning', message: '考勤月份和开法定假日2的月份不一致' });
|
|
ElMessage({ type: 'warning', message: '考勤月份和开法定假日2的月份不一致' });
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //返回接口数据
|
|
|
const formattedData = {
|
|
const formattedData = {
|
|
|
sys_id: _username.value,
|
|
sys_id: _username.value,
|
|
|
date: kqny.value,
|
|
date: kqny.value,
|
|
@@ -149,10 +145,10 @@ const jjgzzhysclick = async () => {
|
|
|
vacation_two_end: formatDate(jjgzzhysformData.vacation_two_end)
|
|
vacation_two_end: formatDate(jjgzzhysformData.vacation_two_end)
|
|
|
};
|
|
};
|
|
|
console.log(formattedData);
|
|
console.log(formattedData);
|
|
|
- const staffSalaryCount_add = await staffSalaryCount(formattedData);
|
|
|
|
|
|
|
+ const staffSalaryCount_add = await staffSalaryCount(formattedData);//调用接口
|
|
|
if (staffSalaryCount_add.code === 0) {
|
|
if (staffSalaryCount_add.code === 0) {
|
|
|
- ElMessage({type: 'success',message: '更新成功'})
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ ElMessage({type: 'success',message: msg})
|
|
|
|
|
+ }else{
|
|
|
ElMessage({type: 'error',message: '更新失败'})
|
|
ElMessage({type: 'error',message: '更新失败'})
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|