留样检验,跨年月份计算错误修复

master
FCD 1 week ago
parent b13138fad0
commit bac08f72eb

@ -164,8 +164,7 @@ import {
getManagerList,
getQcWaitCheckSampleTaskList,
getWorkshopList,
submitCheckSampleTaskZl0030,
updateQcCheckSampleTask
submitCheckSampleTaskZl0030
} from './model';
import moment from 'moment';
import PageHead from '@/components/lanju/page-head/index.vue';
@ -312,8 +311,17 @@ export default class SampleCheck extends BasePage {
//
timeDifference(time: any) {
//
const sampleTime = new Date(moment(time).format('YYYY-MM-DD')).getMonth();
return new Date().getMonth() - sampleTime;
const targetDate = moment(time).toDate(); // Date
// 2.
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth();
const targetYear = targetDate.getFullYear();
const targetMonth = targetDate.getMonth();
// 3.
return (currentYear - targetYear) * 12 + (currentMonth - targetMonth);
}
//

Loading…
Cancel
Save