|
@@ -0,0 +1,230 @@
|
|
|
+<template >
|
|
|
+ <div class="scheduling-table-body">
|
|
|
+ <div class="weeb-body" v-for="(its, inx) in timeObjArr" :key="inx">
|
|
|
+ <template v-for="(item, index) in its">
|
|
|
+ <div
|
|
|
+ class="task"
|
|
|
+ :class="resultTime(keyValues(inx), item) ? 'disabled' : ''"
|
|
|
+ v-if="intersectionDay(keyValues(inx), item, inx)"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ <div class="task-content">
|
|
|
+ <div class="task-content-title">{{ item.routeName }}</div>
|
|
|
+ <div class="task-content-time">{{ item.times }}</div>
|
|
|
+ <div class="task-set" v-if="matchingTime(keyValues(inx), item).isActive">
|
|
|
+ <span @click="resultTime(keyValues(inx), item) ? null : addItem(keyValues(inx), item)">
|
|
|
+ {{ matchingTime(keyValues(inx), item).partolName }}</span
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="task-set" v-else-if="!resultTime(keyValues(inx), item)">
|
|
|
+ <span @click="addItem(keyValues(inx), item)">设置</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ timeObj: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ monday: '',
|
|
|
+ tuesday: '',
|
|
|
+ wednesday: '',
|
|
|
+ thursday: '',
|
|
|
+ friday: '',
|
|
|
+ saturday: '',
|
|
|
+ sunday: ''
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ timeObjArr: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [[], [], [], [], [], [], []];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ calendarData: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
+ findUser: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ addItem(itemTime, item) {
|
|
|
+ new Promise((resolve) => {
|
|
|
+ this.$store.dispatch('addPopup', {
|
|
|
+ url: '/patrolManagement/popups/weekEditAdd.vue',
|
|
|
+ width: '450px',
|
|
|
+ height: '300px',
|
|
|
+ props: {
|
|
|
+ callback: resolve,
|
|
|
+ findUser: this.findUser,
|
|
|
+ dateDe: itemTime,
|
|
|
+ item: item
|
|
|
+ },
|
|
|
+ title: '排班'
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ this.$emit('getList', {
|
|
|
+ startTime: `${this.timeObj.monday} 00:00:00`,
|
|
|
+ endTime: `${this.timeObj.sunday} 23:59:59`
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //对比 现在时间 选择的时间至灰处理
|
|
|
+ resultTime(tis, item) {
|
|
|
+ let thisTime = this.$moment().format('YYYY-MM-DD') + ' 00:00:00';
|
|
|
+ let itemTime = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ return this.$moment(thisTime).valueOf() > this.$moment(itemTime).valueOf();
|
|
|
+ },
|
|
|
+ intersectionDay(tis, item, index) {
|
|
|
+ let startDate = this.$moment(item.startDate).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ let endDate = this.$moment(item.endDate).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ let thisDate = this.$moment(tis + ' 00:00:00').format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ let vra = item.periodValue.split(',').sort();
|
|
|
+ //每周几
|
|
|
+ if (item.periodType == 1) {
|
|
|
+ return (
|
|
|
+ this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
|
|
|
+ this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
|
|
|
+ vra.includes(vra[index])
|
|
|
+ );
|
|
|
+ //每隔几天
|
|
|
+ } else if (item.periodType == 2) {
|
|
|
+ let oneDay = 86400000;
|
|
|
+ // 第一天重合
|
|
|
+ if (this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf() == 0 || item.periodValue == 0) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return (
|
|
|
+ this.$moment(startDate).valueOf() <= this.$moment(thisDate).valueOf() &&
|
|
|
+ this.$moment(thisDate).valueOf() <= this.$moment(endDate).valueOf() &&
|
|
|
+ ((this.$moment(thisDate).valueOf() - this.$moment(startDate).valueOf()) / oneDay) %
|
|
|
+ (Number(item.periodValue) + 1) ==
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 对比已设置内容
|
|
|
+ matchingTime(tis, item) {
|
|
|
+ let objs = {
|
|
|
+ isActive: false
|
|
|
+ };
|
|
|
+ this.calendarData.map((items) => {
|
|
|
+ if (tis == items.partrolDate) {
|
|
|
+ items.rosterUserDtos.map((isv) => {
|
|
|
+ if (isv.id == item.id && isv.partrolTime == item.times) {
|
|
|
+ objs.isActive = true;
|
|
|
+ Object.assign(objs, isv);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return objs;
|
|
|
+ },
|
|
|
+ keyValues(index) {
|
|
|
+ if (index == 0) {
|
|
|
+ return this.timeObj.monday;
|
|
|
+ } else if (index == 1) {
|
|
|
+ return this.timeObj.tuesday;
|
|
|
+ } else if (index == 2) {
|
|
|
+ return this.timeObj.wednesday;
|
|
|
+ } else if (index == 3) {
|
|
|
+ return this.timeObj.thursday;
|
|
|
+ } else if (index == 4) {
|
|
|
+ return this.timeObj.friday;
|
|
|
+ } else if (index == 5) {
|
|
|
+ return this.timeObj.saturday;
|
|
|
+ } else if (index == 6) {
|
|
|
+ return this.timeObj.sunday;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.scheduling-table {
|
|
|
+ text-align: center;
|
|
|
+ height: calc(100% - 100px);
|
|
|
+ width: 100%;
|
|
|
+ padding: 20px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 4px;
|
|
|
+ &-body {
|
|
|
+ height: calc(100% - 45px);
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 2fr 2fr 2fr 2fr 2fr 2fr 2fr;
|
|
|
+ .weeb-body {
|
|
|
+ overflow-y: auto;
|
|
|
+ overflow-x: hidden;
|
|
|
+ &::-webkit-scrollbar {
|
|
|
+ z-index: 11;
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ &::-webkit-scrollbar-track,
|
|
|
+ &::-webkit-scrollbar-corner {
|
|
|
+ background: transparent;
|
|
|
+ }
|
|
|
+ &::-webkit-scrollbar-thumb {
|
|
|
+ border-radius: 5px;
|
|
|
+ display: none;
|
|
|
+ background: rgba(250, 250, 250, 0.09);
|
|
|
+ }
|
|
|
+ &::-webkit-scrollbar-track-piece {
|
|
|
+ background: transparent;
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .task {
|
|
|
+ height: 20%;
|
|
|
+ min-height: 120px;
|
|
|
+ border: 1px solid #e0e1e3;
|
|
|
+ color: #424656;
|
|
|
+ border-top: none;
|
|
|
+
|
|
|
+ &-content {
|
|
|
+ &-title {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 600;
|
|
|
+ padding-top: 20px;
|
|
|
+ }
|
|
|
+ &-time {
|
|
|
+ font-size: 16px;
|
|
|
+ line-height: 35px;
|
|
|
+ }
|
|
|
+ .task-set {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #0eaeff;
|
|
|
+ span {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &.disabled {
|
|
|
+ opacity: 0.5;
|
|
|
+ .task-set {
|
|
|
+ color: #424656;
|
|
|
+ span {
|
|
|
+ cursor: inherit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &:first-of-type {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|