|
@@ -18,10 +18,15 @@
|
|
<!-- 根据批次循环行,不再根据班级: -->
|
|
<!-- 根据批次循环行,不再根据班级: -->
|
|
<tr v-for="(batch, bi) in getMonthBatch(month)" :key="`${month}-${batch}`">
|
|
<tr v-for="(batch, bi) in getMonthBatch(month)" :key="`${month}-${batch}`">
|
|
<template v-for="(item, ci) in makeCalendar(month)">
|
|
<template v-for="(item, ci) in makeCalendar(month)">
|
|
- <td v-if="cellDisplay(item, batch, month, bi)" :colspan="cellColSpan(item, batch, month, bi)"
|
|
|
|
- :rowspan="cellRowSpan(item, batch, month, bi)" @click="cellClick(item, batch, month, bi)"
|
|
|
|
- :key="`${month}-${ci}`" :style="setStyle(item, batch, month, bi)"
|
|
|
|
- :title="renderCell(item, batch, month, bi)">
|
|
|
|
|
|
+ <td
|
|
|
|
+ v-if="cellDisplay(item, batch, month, bi)"
|
|
|
|
+ :colspan="cellColSpan(item, batch, month, bi)"
|
|
|
|
+ :rowspan="cellRowSpan(item, batch, month, bi)"
|
|
|
|
+ @click="cellClick(item, batch, month, bi)"
|
|
|
|
+ :key="`${month}-${ci}`"
|
|
|
|
+ :style="setStyle(item, batch, month, bi)"
|
|
|
|
+ :title="renderCell(item, batch, month, bi)"
|
|
|
|
+ >
|
|
{{ renderCell(item, batch, month, bi) }}
|
|
{{ renderCell(item, batch, month, bi) }}
|
|
</td>
|
|
</td>
|
|
</template>
|
|
</template>
|
|
@@ -30,7 +35,6 @@
|
|
<td :rowspan="getRowNumber(month)">{{ getRemark(month, 'number') }}</td>
|
|
<td :rowspan="getRowNumber(month)">{{ getRemark(month, 'number') }}</td>
|
|
</template>
|
|
</template>
|
|
</tr>
|
|
</tr>
|
|
-
|
|
|
|
</template>
|
|
</template>
|
|
</table>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@@ -41,7 +45,7 @@
|
|
/**
|
|
/**
|
|
* 表格与渲染的处理思路:
|
|
* 表格与渲染的处理思路:
|
|
* 是不是跨月:
|
|
* 是不是跨月:
|
|
- * 不跨月:
|
|
|
|
|
|
+ * 不跨月:
|
|
* 再查看是不是第一天:
|
|
* 再查看是不是第一天:
|
|
* 是:显示内容,计算合并值: 合并值 = 结束时间 - 开始时间
|
|
* 是:显示内容,计算合并值: 合并值 = 结束时间 - 开始时间
|
|
* 不是:不显示,等着被合并
|
|
* 不是:不显示,等着被合并
|
|
@@ -56,7 +60,7 @@
|
|
* 不是:不显示,等着被合并
|
|
* 不是:不显示,等着被合并
|
|
*/
|
|
*/
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
-import { format, coreResult, getDays, getMonthLastDay, getMonthFirstDay, outPutCore, toRegularDate, inDateRange, checkIsSame } from './util'
|
|
|
|
|
|
+import { format, coreResult, getDays, getMonthLastDay, getMonthFirstDay, outPutCore, toRegularDate, inDateRange, checkIsSame } from './util';
|
|
const _ = require('lodash');
|
|
const _ = require('lodash');
|
|
const moment = require('moment');
|
|
const moment = require('moment');
|
|
export default {
|
|
export default {
|
|
@@ -65,28 +69,28 @@ export default {
|
|
year: { type: String },
|
|
year: { type: String },
|
|
events: { type: Array },
|
|
events: { type: Array },
|
|
vacation: { type: Array },
|
|
vacation: { type: Array },
|
|
- remark: { type: Array, default: () => { } },
|
|
|
|
|
|
+ remark: { type: Array, default: () => {} },
|
|
placeList: { type: Array },
|
|
placeList: { type: Array },
|
|
},
|
|
},
|
|
components: {},
|
|
components: {},
|
|
- data: function () {
|
|
|
|
|
|
+ data: function() {
|
|
return {
|
|
return {
|
|
/**
|
|
/**
|
|
* 用于渲染每个月的表格行数
|
|
* 用于渲染每个月的表格行数
|
|
* {月份: {}批次分组, 有多少批次: 该月表格的行数 }
|
|
* {月份: {}批次分组, 有多少批次: 该月表格的行数 }
|
|
* 开始时间,结束时间 其中一个和该月有交集的,就列入本月中
|
|
* 开始时间,结束时间 其中一个和该月有交集的,就列入本月中
|
|
- * { 1:
|
|
|
|
|
|
+ * { 1:
|
|
* {
|
|
* {
|
|
* 1: [
|
|
* 1: [
|
|
* {批次数据带期数}
|
|
* {批次数据带期数}
|
|
* ],
|
|
* ],
|
|
- * 2: [],
|
|
|
|
- *
|
|
|
|
|
|
+ * 2: [],
|
|
|
|
+ *
|
|
* }
|
|
* }
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
batchList: {},
|
|
batchList: {},
|
|
- viewKey: undefined
|
|
|
|
|
|
+ viewKey: undefined,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -103,7 +107,7 @@ export default {
|
|
// console.log(this.vacation)
|
|
// console.log(this.vacation)
|
|
// console.log('remark')
|
|
// console.log('remark')
|
|
// console.log(this.remark)
|
|
// console.log(this.remark)
|
|
- console.log(this.batchList)
|
|
|
|
|
|
+ console.log(this.batchList);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
rerender() {
|
|
rerender() {
|
|
@@ -111,22 +115,22 @@ export default {
|
|
},
|
|
},
|
|
// 单元格内容
|
|
// 单元格内容
|
|
renderCell(date, batch, month, lineIndex) {
|
|
renderCell(date, batch, month, lineIndex) {
|
|
- if (!date) return ''
|
|
|
|
- const rd = toRegularDate(this.year, date)
|
|
|
|
|
|
+ if (!date) return '';
|
|
|
|
+ const rd = toRegularDate(this.year, date);
|
|
let result = '';
|
|
let result = '';
|
|
// 1.需要查看是不是节日
|
|
// 1.需要查看是不是节日
|
|
if (lineIndex === 0) {
|
|
if (lineIndex === 0) {
|
|
- const r1 = this.checkVacation(rd)
|
|
|
|
|
|
+ const r1 = this.checkVacation(rd);
|
|
if (r1) {
|
|
if (r1) {
|
|
- const r = outPutCore(r1.start, r1.end, rd, month)
|
|
|
|
|
|
+ const r = outPutCore(r1.start, r1.end, rd, month);
|
|
if (r === coreResult.SMFD) {
|
|
if (r === coreResult.SMFD) {
|
|
- const isFirstDay = checkIsSame(r1.start, rd)
|
|
|
|
|
|
+ const isFirstDay = checkIsSame(r1.start, rd);
|
|
if (isFirstDay) result = _.get(r1, 'title');
|
|
if (isFirstDay) result = _.get(r1, 'title');
|
|
} else if (r === coreResult.STMFD) {
|
|
} else if (r === coreResult.STMFD) {
|
|
- const isFirstDay = checkIsSame(r1.start, rd)
|
|
|
|
|
|
+ const isFirstDay = checkIsSame(r1.start, rd);
|
|
if (isFirstDay) result = _.get(r1, 'title');
|
|
if (isFirstDay) result = _.get(r1, 'title');
|
|
} else if (r === coreResult.ENDMFD) {
|
|
} else if (r === coreResult.ENDMFD) {
|
|
- const firstDay = moment(`${moment(r1.end).year()}-${moment(r1.end).month() + 1}-01`).format(format)
|
|
|
|
|
|
+ const firstDay = moment(`${moment(r1.end).year()}-${moment(r1.end).month() + 1}-01`).format(format);
|
|
if (moment(rd).isSame(firstDay)) result = _.get(r1, 'title');
|
|
if (moment(rd).isSame(firstDay)) result = _.get(r1, 'title');
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
@@ -134,12 +138,12 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
// 2.查看有没有安排
|
|
// 2.查看有没有安排
|
|
- const v2s = _.get(this.batchList, `${month}.${batch}`)
|
|
|
|
|
|
+ const v2s = _.get(this.batchList, `${month}.${batch}`);
|
|
if (v2s) {
|
|
if (v2s) {
|
|
- const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd))
|
|
|
|
|
|
+ const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd));
|
|
if (v2) {
|
|
if (v2) {
|
|
const { term, batch, class: cla = [], startdate, enddate } = v2;
|
|
const { term, batch, class: cla = [], startdate, enddate } = v2;
|
|
- const r = outPutCore(startdate, enddate, rd, month)
|
|
|
|
|
|
+ const r = outPutCore(startdate, enddate, rd, month);
|
|
if (r === coreResult.SMFD) {
|
|
if (r === coreResult.SMFD) {
|
|
result = `第${term}期-第${batch}批-共${cla.length}班`;
|
|
result = `第${term}期-第${batch}批-共${cla.length}班`;
|
|
} else if (r === coreResult.STMFD) {
|
|
} else if (r === coreResult.STMFD) {
|
|
@@ -149,61 +153,62 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return result
|
|
|
|
|
|
+ return result;
|
|
},
|
|
},
|
|
// 单元格列合并
|
|
// 单元格列合并
|
|
cellColSpan(date, batch, month) {
|
|
cellColSpan(date, batch, month) {
|
|
// 没有日期的为站位格子
|
|
// 没有日期的为站位格子
|
|
- if (!date) return 1
|
|
|
|
- const rd = toRegularDate(this.year, date)
|
|
|
|
|
|
+ if (!date) return 1;
|
|
|
|
+ const rd = toRegularDate(this.year, date);
|
|
// 先判断是不是假期, 假期的第一个单元格是合并,其余的全是0
|
|
// 先判断是不是假期, 假期的第一个单元格是合并,其余的全是0
|
|
- const r1 = this.checkVacation(rd)
|
|
|
|
|
|
+ const r1 = this.checkVacation(rd);
|
|
if (r1) {
|
|
if (r1) {
|
|
- const r = outPutCore(r1.start, r1.end, rd, month)
|
|
|
|
|
|
+ const r = outPutCore(r1.start, r1.end, rd, month);
|
|
let colspan = 0;
|
|
let colspan = 0;
|
|
// 列合并,不是第一列不要管
|
|
// 列合并,不是第一列不要管
|
|
if (r === coreResult.SMFD) {
|
|
if (r === coreResult.SMFD) {
|
|
// 同月第一天,需要知道后面几天,然后合并
|
|
// 同月第一天,需要知道后面几天,然后合并
|
|
- const diff = getDays(r1.start, r1.end)
|
|
|
|
|
|
+ const diff = getDays(r1.start, r1.end);
|
|
if (diff <= 0) colspan = 1;
|
|
if (diff <= 0) colspan = 1;
|
|
colspan = diff + 1;
|
|
colspan = diff + 1;
|
|
} else if (r === coreResult.STMFD) {
|
|
} else if (r === coreResult.STMFD) {
|
|
// 开始时间同月第一天: 需要计算出开始时间到月末差几天
|
|
// 开始时间同月第一天: 需要计算出开始时间到月末差几天
|
|
- const lastDay = getMonthLastDay(r1.start)
|
|
|
|
- const diff = getDays(r1.start, lastDay)
|
|
|
|
|
|
+ const lastDay = getMonthLastDay(r1.start);
|
|
|
|
+ const diff = getDays(r1.start, lastDay);
|
|
if (diff <= 0) colspan = 1;
|
|
if (diff <= 0) colspan = 1;
|
|
colspan = diff + 1;
|
|
colspan = diff + 1;
|
|
} else if (r === coreResult.ENDMFD) {
|
|
} else if (r === coreResult.ENDMFD) {
|
|
- const firstDay = getMonthFirstDay(r1.end)
|
|
|
|
- const diff = getDays(firstDay, r1.end)
|
|
|
|
|
|
+ const firstDay = getMonthFirstDay(r1.end);
|
|
|
|
+ const diff = getDays(firstDay, r1.end);
|
|
if (diff <= 0) colspan = 1;
|
|
if (diff <= 0) colspan = 1;
|
|
colspan = diff + 1;
|
|
colspan = diff + 1;
|
|
}
|
|
}
|
|
|
|
+ console.log(r1, date, colspan);
|
|
return colspan;
|
|
return colspan;
|
|
}
|
|
}
|
|
// 查看安排
|
|
// 查看安排
|
|
- const v2s = _.get(this.batchList, `${month}.${batch}`)
|
|
|
|
|
|
+ const v2s = _.get(this.batchList, `${month}.${batch}`);
|
|
if (v2s) {
|
|
if (v2s) {
|
|
let colspan = 0;
|
|
let colspan = 0;
|
|
- const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd))
|
|
|
|
|
|
+ const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd));
|
|
if (v2) {
|
|
if (v2) {
|
|
const { startdate, enddate } = v2;
|
|
const { startdate, enddate } = v2;
|
|
- const r = outPutCore(startdate, enddate, rd, month)
|
|
|
|
|
|
+ const r = outPutCore(startdate, enddate, rd, month);
|
|
if (r === coreResult.SMFD) {
|
|
if (r === coreResult.SMFD) {
|
|
// 直接计算多少天作为合并列数
|
|
// 直接计算多少天作为合并列数
|
|
- const diff = getDays(startdate, enddate)
|
|
|
|
|
|
+ const diff = getDays(startdate, enddate);
|
|
if (diff > 0) colspan = diff + 1;
|
|
if (diff > 0) colspan = diff + 1;
|
|
- else if (diff === 0) colspan = 1
|
|
|
|
|
|
+ else if (diff === 0) colspan = 1;
|
|
} else if (r === coreResult.STMFD) {
|
|
} else if (r === coreResult.STMFD) {
|
|
- const lastDay = getMonthLastDay(startdate)
|
|
|
|
- const diff = getDays(startdate, lastDay)
|
|
|
|
|
|
+ const lastDay = getMonthLastDay(startdate);
|
|
|
|
+ const diff = getDays(startdate, lastDay);
|
|
if (diff > 0) colspan = diff + 1;
|
|
if (diff > 0) colspan = diff + 1;
|
|
- else if (diff === 0) colspan = 1
|
|
|
|
|
|
+ else if (diff === 0) colspan = 1;
|
|
} else if (r === coreResult.ENDMFD) {
|
|
} else if (r === coreResult.ENDMFD) {
|
|
- const firstDay = getMonthFirstDay(enddate)
|
|
|
|
- const diff = getDays(firstDay, enddate)
|
|
|
|
|
|
+ const firstDay = getMonthFirstDay(enddate);
|
|
|
|
+ const diff = getDays(firstDay, enddate);
|
|
if (diff > 0) colspan = diff + 1;
|
|
if (diff > 0) colspan = diff + 1;
|
|
- else if (diff === 0) colspan = 1
|
|
|
|
|
|
+ else if (diff === 0) colspan = 1;
|
|
}
|
|
}
|
|
return colspan;
|
|
return colspan;
|
|
}
|
|
}
|
|
@@ -213,21 +218,21 @@ export default {
|
|
// 单元格行合并
|
|
// 单元格行合并
|
|
cellRowSpan(date, batch, month, lineIndex) {
|
|
cellRowSpan(date, batch, month, lineIndex) {
|
|
// 没有日期的为站位格子
|
|
// 没有日期的为站位格子
|
|
- if (!date) return 1
|
|
|
|
- const rd = toRegularDate(this.year, date)
|
|
|
|
|
|
+ if (!date) return 1;
|
|
|
|
+ const rd = toRegularDate(this.year, date);
|
|
// 先判断是不是假期
|
|
// 先判断是不是假期
|
|
- const r1 = this.checkVacation(rd)
|
|
|
|
|
|
+ const r1 = this.checkVacation(rd);
|
|
if (r1) {
|
|
if (r1) {
|
|
let rowspan = 1;
|
|
let rowspan = 1;
|
|
// 行合并,不是第一行不要管
|
|
// 行合并,不是第一行不要管
|
|
if (lineIndex !== 0) rowspan = 0;
|
|
if (lineIndex !== 0) rowspan = 0;
|
|
else {
|
|
else {
|
|
// 同月第一天: 获取该月批次列表的长度+2即为总行数
|
|
// 同月第一天: 获取该月批次列表的长度+2即为总行数
|
|
- const v2s = _.get(this.batchList, `${month}`, {})
|
|
|
|
- const keys = Object.keys(v2s)
|
|
|
|
- rowspan = keys.length + 1
|
|
|
|
|
|
+ const v2s = _.get(this.batchList, `${month}`, {});
|
|
|
|
+ const keys = Object.keys(v2s);
|
|
|
|
+ rowspan = keys.length + 1;
|
|
}
|
|
}
|
|
- return rowspan
|
|
|
|
|
|
+ return rowspan;
|
|
}
|
|
}
|
|
// 一个批次一行,不需要处理安排的行
|
|
// 一个批次一行,不需要处理安排的行
|
|
|
|
|
|
@@ -235,28 +240,27 @@ export default {
|
|
},
|
|
},
|
|
// 单元格点击事件
|
|
// 单元格点击事件
|
|
cellClick(date, batch, month, lineIndex) {
|
|
cellClick(date, batch, month, lineIndex) {
|
|
- if (!date) return ''
|
|
|
|
- const rd = toRegularDate(this.year, date)
|
|
|
|
- const v2s = _.get(this.batchList, `${month}.${batch}`)
|
|
|
|
|
|
+ if (!date) return '';
|
|
|
|
+ const rd = toRegularDate(this.year, date);
|
|
|
|
+ const v2s = _.get(this.batchList, `${month}.${batch}`);
|
|
if (v2s) {
|
|
if (v2s) {
|
|
- const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd))
|
|
|
|
- if (v2) this.$emit('cellClick', v2)
|
|
|
|
- else this.$emit('cellClick', rd)
|
|
|
|
- } else this.$emit('cellClick', rd)
|
|
|
|
|
|
+ const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd));
|
|
|
|
+ if (v2) this.$emit('cellClick', v2);
|
|
|
|
+ else this.$emit('cellClick', rd);
|
|
|
|
+ } else this.$emit('cellClick', rd);
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 整理一维的批次列表,将term加进去并按月份整理成object
|
|
* 整理一维的批次列表,将term加进去并按月份整理成object
|
|
*/
|
|
*/
|
|
setBatchList() {
|
|
setBatchList() {
|
|
let batchList = this.events.map(i => {
|
|
let batchList = this.events.map(i => {
|
|
- const { term, batchnum } = i
|
|
|
|
|
|
+ const { term, batchnum } = i;
|
|
let bl = _.cloneDeep(batchnum);
|
|
let bl = _.cloneDeep(batchnum);
|
|
- bl = bl.map(i => ({ ...i, term }))
|
|
|
|
|
|
+ bl = bl.map(i => ({ ...i, term }));
|
|
return bl;
|
|
return bl;
|
|
- })
|
|
|
|
- batchList = _.flattenDeep(batchList)
|
|
|
|
|
|
+ });
|
|
|
|
+ batchList = _.flattenDeep(batchList);
|
|
/**
|
|
/**
|
|
* 1.月为key; value为在该月显示的安排
|
|
* 1.月为key; value为在该月显示的安排
|
|
* 2.value: 批次为key, v2为按月分完后,同一批次下的所有数据
|
|
* 2.value: 批次为key, v2为按月分完后,同一批次下的所有数据
|
|
@@ -264,30 +268,30 @@ export default {
|
|
const monthObject = {};
|
|
const monthObject = {};
|
|
// 为每个月都创建下
|
|
// 为每个月都创建下
|
|
for (let i = 1; i <= 12; i++) {
|
|
for (let i = 1; i <= 12; i++) {
|
|
- monthObject[i] = {}
|
|
|
|
|
|
+ monthObject[i] = {};
|
|
}
|
|
}
|
|
for (const i of batchList) {
|
|
for (const i of batchList) {
|
|
const { startdate, enddate, batch } = i;
|
|
const { startdate, enddate, batch } = i;
|
|
// 必须2个时间和批次名都要有
|
|
// 必须2个时间和批次名都要有
|
|
if (!startdate || !enddate || !batch) continue;
|
|
if (!startdate || !enddate || !batch) continue;
|
|
// 开始时间所在月份,和结束时间所在月份
|
|
// 开始时间所在月份,和结束时间所在月份
|
|
- const sm = moment(startdate).month() + 1
|
|
|
|
- const em = moment(enddate).month() + 1
|
|
|
|
|
|
+ const sm = moment(startdate).month() + 1;
|
|
|
|
+ const em = moment(enddate).month() + 1;
|
|
// 如果是同一个月那就放1个,如果不同月,就各方各的
|
|
// 如果是同一个月那就放1个,如果不同月,就各方各的
|
|
if (sm === em) {
|
|
if (sm === em) {
|
|
- const v2 = _.get(monthObject, `${sm}.${batch}`, [])
|
|
|
|
|
|
+ const v2 = _.get(monthObject, `${sm}.${batch}`, []);
|
|
v2.push(i);
|
|
v2.push(i);
|
|
monthObject[sm][batch] = v2;
|
|
monthObject[sm][batch] = v2;
|
|
} else {
|
|
} else {
|
|
- const sv2 = _.get(monthObject, `${sm}.${batch}`, [])
|
|
|
|
- sv2.push(i)
|
|
|
|
|
|
+ const sv2 = _.get(monthObject, `${sm}.${batch}`, []);
|
|
|
|
+ sv2.push(i);
|
|
monthObject[sm][batch] = sv2;
|
|
monthObject[sm][batch] = sv2;
|
|
- const ev2 = _.get(monthObject, `${em}.${batch}`, [])
|
|
|
|
- ev2.push(i)
|
|
|
|
|
|
+ const ev2 = _.get(monthObject, `${em}.${batch}`, []);
|
|
|
|
+ ev2.push(i);
|
|
monthObject[em][batch] = ev2;
|
|
monthObject[em][batch] = ev2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.$set(this, 'batchList', monthObject)
|
|
|
|
|
|
+ this.$set(this, 'batchList', monthObject);
|
|
},
|
|
},
|
|
|
|
|
|
// #region 时间处理函数
|
|
// #region 时间处理函数
|
|
@@ -316,23 +320,23 @@ export default {
|
|
// 单元格样式
|
|
// 单元格样式
|
|
setStyle(date, batch, month, bi) {
|
|
setStyle(date, batch, month, bi) {
|
|
let style = { cursor: 'pointer' };
|
|
let style = { cursor: 'pointer' };
|
|
- const rd = toRegularDate(this.year, date)
|
|
|
|
|
|
+ const rd = toRegularDate(this.year, date);
|
|
// 先判断是不是假期
|
|
// 先判断是不是假期
|
|
- const r1 = this.checkVacation(rd)
|
|
|
|
|
|
+ const r1 = this.checkVacation(rd);
|
|
if (r1) {
|
|
if (r1) {
|
|
style = { cursor: 'not-allowed' };
|
|
style = { cursor: 'not-allowed' };
|
|
style['pointer-events'] = 'none';
|
|
style['pointer-events'] = 'none';
|
|
if (date !== '') style['background'] = 'red';
|
|
if (date !== '') style['background'] = 'red';
|
|
}
|
|
}
|
|
|
|
|
|
- const v2s = _.get(this.batchList, `${month}.${batch}`)
|
|
|
|
|
|
+ const v2s = _.get(this.batchList, `${month}.${batch}`);
|
|
if (v2s) {
|
|
if (v2s) {
|
|
- const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd))
|
|
|
|
|
|
+ const v2 = v2s.find(f => inDateRange(f.startdate, f.enddate, rd));
|
|
if (v2) {
|
|
if (v2) {
|
|
- const place = _.get(v2, 'place')
|
|
|
|
|
|
+ const place = _.get(v2, 'place');
|
|
if (place) {
|
|
if (place) {
|
|
- const p = this.placeList.find(f => f._id === place)
|
|
|
|
- if (p) style.background = _.get(p, 'color', '#ffffff')
|
|
|
|
|
|
+ const p = this.placeList.find(f => f._id === place);
|
|
|
|
+ if (p) style.background = _.get(p, 'color', '#ffffff');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -341,18 +345,18 @@ export default {
|
|
},
|
|
},
|
|
// 单元格是否显示(需要被合并的不显示)
|
|
// 单元格是否显示(需要被合并的不显示)
|
|
cellDisplay(date, batch, month, bi) {
|
|
cellDisplay(date, batch, month, bi) {
|
|
- const colspan = this.cellColSpan(date, batch, month, bi)
|
|
|
|
- const rowspan = this.cellRowSpan(date, batch, month, bi)
|
|
|
|
|
|
+ const colspan = this.cellColSpan(date, batch, month, bi);
|
|
|
|
+ const rowspan = this.cellRowSpan(date, batch, month, bi);
|
|
if (colspan > 0 && rowspan > 0) return true;
|
|
if (colspan > 0 && rowspan > 0) return true;
|
|
},
|
|
},
|
|
|
|
|
|
// 获取本月批次列表
|
|
// 获取本月批次列表
|
|
getMonthBatch(month) {
|
|
getMonthBatch(month) {
|
|
const v1 = this.batchList[month];
|
|
const v1 = this.batchList[month];
|
|
- const keys = Object.keys(v1)
|
|
|
|
|
|
+ const keys = Object.keys(v1);
|
|
// 多留出一行
|
|
// 多留出一行
|
|
- keys.push({})
|
|
|
|
- return keys
|
|
|
|
|
|
+ keys.push({});
|
|
|
|
+ return keys;
|
|
},
|
|
},
|
|
// 获取一个月的天数列表
|
|
// 获取一个月的天数列表
|
|
getDayList(month, days) {
|
|
getDayList(month, days) {
|
|
@@ -368,8 +372,8 @@ export default {
|
|
},
|
|
},
|
|
// 获取该月有几行
|
|
// 获取该月有几行
|
|
getRowNumber(month) {
|
|
getRowNumber(month) {
|
|
- const v1 = this.batchList[month]
|
|
|
|
- const keys = Object.keys(v1)
|
|
|
|
|
|
+ const v1 = this.batchList[month];
|
|
|
|
+ const keys = Object.keys(v1);
|
|
// 因为多留出一行,所以+2,否则加1
|
|
// 因为多留出一行,所以+2,否则加1
|
|
return keys.length + 2;
|
|
return keys.length + 2;
|
|
},
|
|
},
|
|
@@ -402,8 +406,6 @@ export default {
|
|
return _.inRange(month, 1, 13);
|
|
return _.inRange(month, 1, 13);
|
|
},
|
|
},
|
|
// #endregion
|
|
// #endregion
|
|
-
|
|
|
|
-
|
|
|
|
},
|
|
},
|
|
filters: {
|
|
filters: {
|
|
getWord(month) {
|
|
getWord(month) {
|
|
@@ -417,8 +419,8 @@ export default {
|
|
deep: true,
|
|
deep: true,
|
|
handler(oval, nval) {
|
|
handler(oval, nval) {
|
|
this.setBatchList();
|
|
this.setBatchList();
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
metaInfo() {
|
|
metaInfo() {
|
|
return { title: this.$route.meta.title };
|
|
return { title: this.$route.meta.title };
|
|
@@ -438,12 +440,16 @@ tr {
|
|
}
|
|
}
|
|
|
|
|
|
table {
|
|
table {
|
|
|
|
+ width: 100%;
|
|
table-layout: fixed;
|
|
table-layout: fixed;
|
|
- zoom:0.8;
|
|
|
|
|
|
+ zoom: 0.8;
|
|
td {
|
|
td {
|
|
text-align: center;
|
|
text-align: center;
|
|
width: 30px;
|
|
width: 30px;
|
|
height: 10px;
|
|
height: 10px;
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ white-space: nowrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|