diff --git a/src/views/projectAdmin/dataBoard/projectHuScreen/planProgress/centerTop.vue b/src/views/projectAdmin/dataBoard/projectHuScreen/planProgress/centerTop.vue index a6ef3884..bcf06905 100644 --- a/src/views/projectAdmin/dataBoard/projectHuScreen/planProgress/centerTop.vue +++ b/src/views/projectAdmin/dataBoard/projectHuScreen/planProgress/centerTop.vue @@ -1,6 +1,38 @@ @@ -14,10 +46,118 @@ export default { default: '' } }, + created() { + console.log(this.getDays('2022/09'), '到') + }, data() { - return {} + return { + dates: ['2020/04', '2020/05'] + } + }, + methods: { + getDays(date) { + const year = date.split('/')[0] + const month = +date.split('/')[1] + const large = [1, 3, 5, 7, 8, 10, 12] + const normal = [4, 6, 9, 11] + const small = [2] + let count = 0 + switch (true) { + case large.includes(month): + count = 31 + break + case normal.includes(month): + count = 30 + break + case small.includes(month): + count = year % 4 ? 28 : 29 + break + } + + return (() => { + const days = new Array(count) + .fill(0) + .map((item, index) => index + 1) + .filter(item => item % 2) + if (count === 28) { + days.push(28) + } else if (count === 30) { + days.push(30) + } + return days + })() + } } } - +