提交 95038102 编写于 作者: xiaoping.di's avatar xiaoping.di

排班数据修改

上级 f8a856cf
.agment-box { .schedul-box {
height: 100%; width: 100%;
background: #fff; height: auto;
overflow: hidden; position: relative;
padding: 20px;
border-radius: 6px;
flex: 3.8;
}
.setMaxNum {
display: flex; display: flex;
justify-content: space-around; justify-content: space-between;
} .agment-box {
.input-value { height: 100%;
width: 100px; background: #fff;
/deep/.el-input-number__decrease { overflow: hidden;
width: 20px; padding: 20px;
border-radius: 6px;
flex: 3.8;
} }
/deep/.el-input-number__increase { .setMaxNum {
width: 20px; display: flex;
justify-content: space-around;
} }
/deep/.el-input__inner { .input-value {
padding: 0; width: 100px;
/deep/.el-input-number__decrease {
width: 20px;
}
/deep/.el-input-number__increase {
width: 20px;
}
/deep/.el-input__inner {
padding: 0;
}
} }
} .list-item {
.list-item { width: 86px;
width: 86px; height: 25px;
height: 25px; background: #ffffff;
background: #ffffff; border-radius: 16px;
border-radius: 16px; border: 1px solid rgba(0, 0, 0, 0.15);
border: 1px solid rgba(0, 0, 0, 0.15); text-align: center;
text-align: center;
}
.list-item-noth {
width: 86px;
height: 25px;
background: red;
border-radius: 16px;
border: 1px solid rgba(0, 0, 0, 0.15);
text-align: center;
}
.w2 {
/deep/.fc-prev-button {
background: #f4f4f5;
cursor: not-allowed;
border: 1px solid #d9d9d9;
} }
} .list-item-noth {
.w3 { width: 86px;
/deep/.fc-next-button { height: 25px;
background: #f4f4f5; background: red;
border: 1px solid #d9d9d9; border-radius: 16px;
cursor: not-allowed; border: 1px solid rgba(0, 0, 0, 0.15);
text-align: center;
} }
} .w2 {
/deep/.fc-timegrid-event-harness { /deep/.fc-prev-button {
// position: absolute !important; background: #f4f4f5;
left: 0 !important; cursor: not-allowed;
} border: 1px solid #d9d9d9;
.agment-box-left {
flex: 1;
height: 100%;
margin-left: 12px;
background: #fff;
border-radius: 6px;
text-align: center;
display: flex;
justify-content: center;
}
.el-dialog-show {
.set-agment-maxNum {
.first-show-num {
text-align: center;
padding-bottom: 30px;
} }
.num-max { }
text-align: center; .w3 {
.hour-num-title { /deep/.fc-next-button {
font-size: 14px; background: #f4f4f5;
font-family: PingFangSC-Regular, PingFang SC; border: 1px solid #d9d9d9;
font-weight: 400; cursor: not-allowed;
color: #02120f; }
}
/deep/.fc-timegrid-event-harness {
// position: absolute !important;
left: 0 !important;
}
.agment-box-left {
flex: 1;
height: 100%;
margin-left: 12px;
background: #fff;
border-radius: 6px;
text-align: center;
display: flex;
justify-content: center;
}
.el-dialog-show {
.set-agment-maxNum {
.first-show-num {
text-align: center;
padding-bottom: 30px;
} }
.num-input-show { .num-max {
padding-top: 10px; text-align: center;
.el-input { .hour-num-title {
width: 50%; font-size: 14px;
/deep/.el-input__inner { font-family: PingFangSC-Regular, PingFang SC;
border-radius: 20px; font-weight: 400;
text-align: center; color: #02120f;
}
.num-input-show {
padding-top: 10px;
.el-input {
width: 50%;
/deep/.el-input__inner {
border-radius: 20px;
text-align: center;
}
} }
} }
} }
} }
} }
} .ag-left-change {
.ag-left-change { // position: relative;
// position: relative; // border:1px solid #ccc;
// border:1px solid #ccc; // height:40px;
// height:40px; // width:100%;
// width:100%; // display:flex;
// display:flex; // z-index:1;
// z-index:1; div {
div { width: 9%;
width: 9%; height: 55px;
height: 55px; }
} .ag-left1 {
.ag-left1 { position: absolute;
position: absolute; right: 12%;
right: 12%; top: 18px;
top: 18px; }
.ag-left2 {
position: absolute;
right: 1%;
top: 18px;
}
} }
.ag-left2 { .show-work-set {
position: absolute; margin-top: 100px;
right: 1%;
top: 18px;
} }
} .agment-left-con {
.show-work-set { padding: 15px;
margin-top: 100px; text-align: center;
} background: #f2f2f2;
.agment-left-con { border-radius: 12px;
padding: 15px;
text-align: center;
background: #f2f2f2;
border-radius: 12px;
}
.reset-doctor-schedu {
padding: 30px 15px 5px 15px;
text-align: center;
.copy-submit {
background: #fff;
border: 1px solid #9ed4ca;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
}
}
.copy-doctor-schedu {
padding: 5px;
margin: 0 auto;
text-align: center;
.copy-submit {
background: #fff;
border: 1px solid #9ed4ca;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
} }
} .reset-doctor-schedu {
.agment-left-copy { padding: 30px 15px 5px 15px;
padding: 5px; text-align: center;
margin: 0 auto; .copy-submit {
text-align: center; background: #fff;
.copy-reset-schedu { border: 1px solid #9ed4ca;
padding-top: 14px;
.copy-week-schedu {
font-size: 14px; font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #0d9078; color: #0d9078;
margin-right: 5px;
cursor: pointer;
} }
.copy-reaset-line { }
color: #d9d9d9; .copy-doctor-schedu {
} padding: 5px;
.reset-week-schedu { margin: 0 auto;
text-align: center;
.copy-submit {
background: #fff;
border: 1px solid #9ed4ca;
font-size: 14px; font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #0d9078; color: #0d9078;
margin-left: 5px;
cursor: pointer;
} }
} }
} .agment-left-copy {
.first-left-max { padding: 5px;
padding: 5px; margin: 0 auto;
margin: 0 auto;
text-align: center;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
cursor: pointer;
}
.agment-head {
border-radius: 5px;
text-align: center;
}
.agment-head-name {
font-size: 20px;
color: #02120f;
font-weight: 600;
padding: 3px;
}
.agment-head-phone {
font-size: 18px;
margin-left: 16px;
}
.agment-hospital {
color: #89888b;
font-size: 16px;
margin-top: 10px;
}
.agment-hospital-show {
margin-right: 10px;
}
.agment-hospital-ks {
margin-top: 8px;
}
.agment-head-title {
font-size: 14px;
color: #02120f;
margin-top: 19px;
}
.agment-head-none {
background: #fff;
pointer-events: none;
}
.new-max {
text-align: center;
margin-top: 20px;
}
.new-max-none {
text-align: center;
margin-top: 20px;
pointer-events: none;
}
.agment-head-priority {
padding-top: 20px;
display: flex;
justify-content: center;
align-items: center;
.item {
width: 42px;
height: 32px;
margin-right: 10px;
border: 1px solid #d9d9d9;
border-radius: 8px;
text-align: center; text-align: center;
line-height: 32px; .copy-reset-schedu {
padding-top: 14px;
.copy-week-schedu {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
margin-right: 5px;
cursor: pointer;
}
.copy-reaset-line {
color: #d9d9d9;
}
.reset-week-schedu {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
margin-left: 5px;
cursor: pointer;
}
}
}
.first-left-max {
padding: 5px;
margin: 0 auto;
text-align: center;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
cursor: pointer; cursor: pointer;
} }
.active { .agment-head {
color: #fff; border-radius: 5px;
text-align: center;
}
.agment-head-name {
font-size: 20px;
color: #02120f;
font-weight: 600;
padding: 3px;
}
.agment-head-phone {
font-size: 18px;
margin-left: 16px;
}
.agment-hospital {
color: #89888b;
font-size: 16px;
margin-top: 10px;
}
.agment-hospital-show {
margin-right: 10px;
}
.agment-hospital-ks {
margin-top: 8px;
}
.agment-head-title {
font-size: 14px;
color: #02120f;
margin-top: 19px;
}
.agment-head-none {
background: #fff;
pointer-events: none;
}
.new-max {
text-align: center;
margin-top: 20px;
}
.new-max-none {
text-align: center;
margin-top: 20px;
pointer-events: none;
}
.agment-head-priority {
padding-top: 20px;
display: flex;
justify-content: center;
align-items: center;
.item {
width: 42px;
height: 32px;
margin-right: 10px;
border: 1px solid #d9d9d9;
border-radius: 8px;
text-align: center;
line-height: 32px;
cursor: pointer;
}
.active {
color: #fff;
background: #0d9078;
border: none;
}
}
.agment-left-button {
margin-top: 34px;
display: flex;
justify-content: center;
}
.copy-submit {
background: #0d9078; background: #0d9078;
border: none; border: 1px solid #0d9078;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #ffffff;
}
.reset-submit {
background: #fff;
border: 1px solid #0d9078;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
}
/deep/.fc-timegrid-event {
border-radius: 1px !important;
}
/deep/thead .fc-scroller-harness {
background: #fcfbff;
}
/deep/.fc-col-header-cell-cushion {
color: #333;
height: 45px;
line-height: 45px;
}
/deep/.fc .fc-highlight {
background: transparent;
} }
}
.agment-left-button {
margin-top: 34px;
display: flex;
justify-content: center;
}
.copy-submit {
background: #0d9078;
border: 1px solid #0d9078;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #ffffff;
}
.reset-submit {
background: #fff;
border: 1px solid #0d9078;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #0d9078;
}
/deep/.fc-timegrid-event {
border-radius: 1px !important;
}
/deep/thead .fc-scroller-harness {
background: #fcfbff;
}
/deep/.fc-col-header-cell-cushion {
color: #333;
height: 45px;
line-height: 45px;
}
/deep/.fc .fc-highlight {
background: transparent;
}
/deep/.fc-header-toolbar {
position: absolute;
right: 0;
top: 15px;
padding: 20px;
width: 20%;
}
/deep/.fc-toolbar-title {
font-size: 6px;
}
/deep/.fc-toolbar-chunk {
display: flex;
}
/deep/.fc-button-primary {
background: #fff;
color: #02120f;
border-color: #d9d9d9;
border-radius: 20px;
padding: 6px 16px;
flex-shrink: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1300px) {
/deep/.fc-header-toolbar { /deep/.fc-header-toolbar {
right: 6%; position: absolute;
right: 0;
top: 15px;
padding: 20px;
width: 20%;
} }
.ag-left1 { /deep/.fc-toolbar-title {
width: 12% !important; font-size: 6px;
right: 18% !important;
// border: 1px solid red !important;
} }
.ag-left2 { /deep/.fc-toolbar-chunk {
width: 12% !important; display: flex;
right: 1% !important; }
/deep/.fc-button-primary {
background: #fff;
color: #02120f;
border-color: #d9d9d9;
border-radius: 20px;
padding: 6px 16px;
flex-shrink: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1300px) {
/deep/.fc-header-toolbar {
right: 6%;
}
.ag-left1 {
width: 12% !important;
right: 18% !important;
// border: 1px solid red !important;
}
.ag-left2 {
width: 12% !important;
right: 1% !important;
}
}
/deep/.fc-myCustomButton-button {
padding: 6px 24px;
}
/deep/.fc-button-primary:hover {
background: #fff;
color: #02120f;
border: 1px solid #0d9078;
}
/deep/.fc-event-time {
font-size: 14px;
color: #0d9078;
word-wrap: break-word;
white-space: normal;
}
/deep/.fc-col-header-cell-cushion {
background: #fff;
border: 1px solid #0d9078;
color: #0d9078;
border-radius: 20px;
height: 30px;
line-height: 25px;
font-size: 14px;
margin: 10px 0;
text-decoration: none;
}
/deep/a:hover {
text-decoration: none;
} }
}
/deep/.fc-myCustomButton-button {
padding: 6px 24px;
}
/deep/.fc-button-primary:hover {
background: #fff;
color: #02120f;
border: 1px solid #0d9078;
}
/deep/.fc-event-time {
font-size: 14px;
color: #0d9078;
word-wrap: break-word;
white-space: normal;
}
/deep/.fc-col-header-cell-cushion {
background: #fff;
border: 1px solid #0d9078;
color: #0d9078;
border-radius: 20px;
height: 30px;
line-height: 25px;
font-size: 14px;
margin: 10px 0;
text-decoration: none;
}
/deep/a:hover {
text-decoration: none;
} }
<template> <template>
<div <div
v-loading="loading" v-loading="loading"
style=" class="schedul-box"
width: 100%;
height: auto;
position: relative;
display: flex;
justifycontent: space-between;
"
> >
<div <div
ref="agment" ref="agment"
...@@ -158,7 +152,7 @@ ...@@ -158,7 +152,7 @@
getLevelAndDayCount, getLevelAndDayCount,
} from '@/api/serviceSchedule'; } from '@/api/serviceSchedule';
export default { export default {
name: 'Index', name: 'Scheduing',
components: { components: {
FullCalendar, FullCalendar,
}, },
...@@ -251,7 +245,7 @@ ...@@ -251,7 +245,7 @@
scrollerHeight: 0, scrollerHeight: 0,
loading: false, loading: false,
isDoIt: false, isDoIt: false,
getEveryDay: '', getStartWeek: '',
copyArr: [], copyArr: [],
centerDialogVisible: false, centerDialogVisible: false,
maxNumValue: '', maxNumValue: '',
...@@ -267,7 +261,6 @@ ...@@ -267,7 +261,6 @@
if (newV !== oldV) { if (newV !== oldV) {
this.handleInitSearch(); this.handleInitSearch();
this.saveDoctoreScheduling(2, oldV); this.saveDoctoreScheduling(2, oldV);
// this.getLevelAndDayCount(newV);
} }
}, },
}, },
...@@ -291,7 +284,6 @@ ...@@ -291,7 +284,6 @@
}, },
mounted() { mounted() {
this.scrollerHeight = this.$refs.agment.clientHeight + 'px'; this.scrollerHeight = this.$refs.agment.clientHeight + 'px';
// this.scrollerHeight = 400 + 'px';
this.init(); this.init();
}, },
methods: { methods: {
...@@ -304,6 +296,7 @@ ...@@ -304,6 +296,7 @@
* view是当前视图对象。 * view是当前视图对象。
*/ */
init() { init() {
// schedulingType 1,2 表示编辑新加,其他表示查看
if (this.schedulingType == 1 || this.schedulingType == 2) { if (this.schedulingType == 1 || this.schedulingType == 2) {
this.calendarOptions.editable = true; this.calendarOptions.editable = true;
} else { } else {
...@@ -335,17 +328,17 @@ ...@@ -335,17 +328,17 @@
selectDate = dayjs(selectDate).unix(); selectDate = dayjs(selectDate).unix();
const nowDate = dayjs(new Date()).unix(); const nowDate = dayjs(new Date()).unix();
let isAddAllDay = true; let isAddAllDay = true;
const data = this.calendarOptions.events; const haveSelectDate = this.calendarOptions.events;
const len = data.length; const len = haveSelectDate.length;
const cz = ((nowDate - selectDate) / 3600) | 0; const differenceTime = ((nowDate - selectDate) / 3600) | 0;
if (cz > 0 && cz >= 24) { if (differenceTime > 0 && differenceTime >= 24) {
return this.$message.info('你不能添加过去的时间的排班'); return this.$message.info('你不能添加过去的时间的排班');
} }
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
const itemDay = dayjs(data[i].start).day(); const itemDay = dayjs(haveSelectDate[i].start).day();
if (!data[i].constraint && day === itemDay) { if (!haveSelectDate[i].constraint && day === itemDay) {
data[i].allStatus && (isAddAllDay = false); haveSelectDate[i].allStatus && (isAddAllDay = false);
const index = this.getIdDeleteData(data[i].id); const index = this.getIdDeleteData(haveSelectDate[i].id);
this.isDoIt = true; this.isDoIt = true;
this.calendarOptions.events.splice(index, 1); this.calendarOptions.events.splice(index, 1);
i--; i--;
...@@ -353,48 +346,49 @@ ...@@ -353,48 +346,49 @@
} }
if (isAddAllDay) { if (isAddAllDay) {
// 添加日期 // 添加日期
const list = [ const selectAllDay = [
{ startTime: '09:00:00', endTime: '12:00:00' }, { startTime: '09:00:00', endTime: '12:00:00' },
{ startTime: '13:00:00', endTime: '17:00:00' }, { startTime: '13:00:00', endTime: '21:00:00' },
{ startTime: '18:00:00', endTime: '21:00:00' },
]; ];
list.forEach((item) => { selectAllDay.forEach((item) => {
const obj = {}; const allDayData = {};
obj.id = dayDate + (this.calendarOptions.events.length + 1) * 10; allDayData.id =
obj.week = this.week; dayDate + (this.calendarOptions.events.length + 1) * 10;
obj.end = dayFormat + ' ' + item.endTime; allDayData.week = this.week;
obj.start = dayFormat + ' ' + item.startTime; allDayData.end = dayFormat + ' ' + item.endTime;
obj.allStatus = true; allDayData.start = dayFormat + ' ' + item.startTime;
console.log(obj); allDayData.allStatus = true;
this.calendarOptions.events.push(obj); console.log(allDayData);
this.calendarOptions.events.push(allDayData);
}); });
} }
}, },
getCopyData(data) { getCopyData(lastWeekData) {
const copyList = []; const copyDate = [];
const addDay = 7; const addDay = 7;
data.noAcceptList.map((item) => { lastWeekData.noAcceptList.map((item) => {
const obj = {}; const nowWeekTime = {};
obj['startTime'] = dayjs(item.startTime) nowWeekTime['startTime'] = dayjs(item.startTime)
.add(addDay, 'day') .add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
obj['endTime'] = dayjs(item.endTime) nowWeekTime['endTime'] = dayjs(item.endTime)
.add(addDay, 'day') .add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
copyList.push(obj); copyDate.push(nowWeekTime);
}); });
this.calendarOptions.events = []; this.calendarOptions.events = [];
data.noAcceptList = copyList; lastWeekData.noAcceptList = copyDate;
this.isDoIt = true; this.isDoIt = true;
}, },
handleInitSearch(isReset, type) { handleInitSearch(isReset, isLoopLast) {
if (isReset && type != 1) { //
if (isReset && isLoopLast != 1) {
this.calendarOptions.events = this.calendarOptions.events.filter( this.calendarOptions.events = this.calendarOptions.events.filter(
(v) => v.week !== this.week (v) => v.week !== this.week
); );
} }
let copyWeek = ''; let copyWeek = '';
if (type == 1) { if (isLoopLast == 1) {
if (this.week == 1) { if (this.week == 1) {
copyWeek = 2; copyWeek = 2;
} else if (this.week == 3) { } else if (this.week == 3) {
...@@ -405,20 +399,20 @@ ...@@ -405,20 +399,20 @@
copyWeek = 4; copyWeek = 4;
} }
} }
const objParms = {}; const searchLastWeek = {};
objParms.doctorId = this.doctorId; searchLastWeek.doctorId = this.doctorId;
objParms.week = type == 1 ? copyWeek : this.week; searchLastWeek.week = isLoopLast == 1 ? copyWeek : this.week;
// type == 1 表示 copy // isLoopLast == 1 表示 copy
objParms.workId = this.id; searchLastWeek.workId = this.id;
dutyRosterQuery(objParms).then((res) => { dutyRosterQuery(searchLastWeek).then((res) => {
if (res.code == '000000') { if (res.code == '000000') {
console.log(res.data.noAcceptList, 'res.data.noAcceptList'); console.log(res.data.noAcceptList, 'res.data.noAcceptList');
if (type == 1 && !res.data.noAcceptList.length) { if (isLoopLast == 1 && !res.data.noAcceptList.length) {
return this.$toast('没有上周的排班信息可以用'); return this.$toast('没有上周的排班信息可以用');
} else { } else {
this.calendarOptions.events = []; this.calendarOptions.events = [];
} }
if (type == 1 && res.data.noAcceptList.length) { if (isLoopLast == 1 && res.data.noAcceptList.length) {
this.getCopyData(res.data); this.getCopyData(res.data);
} }
this.handleInitData(res.data); this.handleInitData(res.data);
...@@ -427,59 +421,52 @@ ...@@ -427,59 +421,52 @@
} }
}); });
}, },
handleInitData(data) { handleInitData(weekData) {
var newDate = null; var newDate = null;
if (this.schedulingType != 3) { if (this.schedulingType != 3) {
newDate = [].concat(data.noAcceptList); newDate = [].concat(weekData.noAcceptList);
} else { } else {
var acceptList = []; var acceptList = [];
data.acceptList.forEach((item) => { weekData.acceptList.forEach((item) => {
item.type = 88; item.type = 88;
acceptList.push(item); acceptList.push(item);
}); });
newDate = [].concat(acceptList, data.noAcceptList); newDate = [].concat(acceptList, weekData.noAcceptList);
} }
newDate.forEach((item) => { newDate.forEach((item) => {
const dataObj = {}; const selectDate = {};
const id = (this.calendarOptions.events.length + 1) * 10; const id = (this.calendarOptions.events.length + 1) * 10;
dataObj['week'] = this.week; selectDate['week'] = this.week;
dataObj['id'] = id; selectDate['id'] = id;
dataObj['end'] = item.endTime; selectDate['end'] = item.endTime;
dataObj['start'] = item.startTime; selectDate['start'] = item.startTime;
dataObj['type'] = item.type; selectDate['type'] = item.type;
if (item.type == 88) { if (item.type == 88) {
dataObj['color'] = '#FFEDE9'; selectDate['color'] = '#FFEDE9';
} }
this.calendarOptions.events.push(dataObj); this.calendarOptions.events.push(selectDate);
}); });
this.limmitDateFun(); this.limmitDateFun();
}, },
limmitDateFun() { limmitDateFun() {
const list = [];
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
const obj = {}; const limitTime = {};
const lastObj = {};
const day = dayjs(this.getEveryDay) const day = dayjs(this.getEveryDay)
.add(i, 'day') .add(i, 'day')
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
obj.start = dayjs(day).add(12, 'hour').format('YYYY-MM-DD HH:mm:ss'); limitTime.start = dayjs(day)
obj.end = dayjs(day).add(13, 'hour').format('YYYY-MM-DD HH:mm:ss'); .add(12, 'hour')
lastObj.start = dayjs(day) .format('YYYY-MM-DD HH:mm:ss');
.add(17, 'hour') limitTime.end = dayjs(day)
.add(13, 'hour')
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
lastObj.end = dayjs(day).add(18, 'hour').format('YYYY-MM-DD HH:mm:ss'); limitTime.constraint = 'businessHours';
obj.constraint = 'businessHours'; limitTime.color = '#ccc';
obj.color = '#ccc'; limitTime.display = 'background';
obj.display = 'background'; limitTime.editable = false;
obj.editable = false; this.calendarOptions.events.push(limitTime);
lastObj.constraint = 'businessHours';
lastObj.color = '#ccc';
lastObj.display = 'background';
lastObj.editable = false;
this.calendarOptions.events.push(obj);
this.calendarOptions.events.push(lastObj);
} }
console.log(list, 'obj', this.getEveryDay); console.log('obj', this.getEveryDay);
}, },
handleDatesSet(dataInfo) { handleDatesSet(dataInfo) {
this.getEveryDay = dayjs(dataInfo.start).format('YYYY-MM-DD HH:mm:ss'); this.getEveryDay = dayjs(dataInfo.start).format('YYYY-MM-DD HH:mm:ss');
...@@ -488,34 +475,34 @@ ...@@ -488,34 +475,34 @@
const cz = currentTime - getTime; // 每周周一时间戳 - 今天的时间 const cz = currentTime - getTime; // 每周周一时间戳 - 今天的时间
const oneHour = 1 * 60 * 60 * 1000 * 24; // 一天的时间戳 const oneHour = 1 * 60 * 60 * 1000 * 24; // 一天的时间戳
const timeDifference = (cz / oneHour) | 0; // 每周一时间距离今天时间数量 const timeDifference = (cz / oneHour) | 0; // 每周一时间距离今天时间数量
const headObj = this.calendarOptions.customButtons.myCustomButton; const weekHeadTitle = this.calendarOptions.customButtons.myCustomButton;
console.log(timeDifference, 'timeDifference', cz / oneHour); console.log(timeDifference, 'timeDifference', cz / oneHour);
// debugger; // debugger;
const czCorrert = cz / oneHour; const exactTime = cz / oneHour;
if (timeDifference == 0 && czCorrert > 0) { if (timeDifference == 0 && exactTime > 0) {
this.week = 1; this.week = 1;
headObj.text = '本周'; weekHeadTitle.text = '本周';
return; return;
} }
if (timeDifference > 0 && timeDifference <= 6) { if (timeDifference > 0 && timeDifference <= 6) {
// 过去 // 过去
this.week = 1; this.week = 1;
headObj.text = '本周'; weekHeadTitle.text = '本周';
} else if (timeDifference >= -6 && timeDifference <= 0) { } else if (timeDifference >= -6 && timeDifference <= 0) {
// 未来 // 未来
this.week = 3; this.week = 3;
headObj.text = '下周'; weekHeadTitle.text = '下周';
} else if (timeDifference >= -13 && timeDifference <= -7) { } else if (timeDifference >= -13 && timeDifference <= -7) {
// 未来 // 未来
this.week = 4; this.week = 4;
headObj.text = '第二周'; weekHeadTitle.text = '第二周';
} else if (timeDifference >= -20 && timeDifference <= -14) { } else if (timeDifference >= -20 && timeDifference <= -14) {
// 未来 // 未来
this.week = 5; this.week = 5;
headObj.text = '第三周'; weekHeadTitle.text = '第三周';
} else if (timeDifference >= 7) { } else if (timeDifference >= 7) {
// 现在 // 现在
headObj.text = '上周'; weekHeadTitle.text = '上周';
this.week = 2; this.week = 2;
} }
}, },
...@@ -538,21 +525,16 @@ ...@@ -538,21 +525,16 @@
if (!this.calendarOptions.selectable || event.event.constraint) { if (!this.calendarOptions.selectable || event.event.constraint) {
return; return;
} }
console.log(event, event, 'iiiieventeventevent');
this.$confirm('你要取消日期吗?', '提示', { this.$confirm('你要取消日期吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) }).then((_) => {
.then((_) => { console.log(_);
console.log(_); const index = this.getIdDeleteData(event.event.id);
const index = this.getIdDeleteData(event.event.id); this.isDoIt = true;
this.isDoIt = true; this.calendarOptions.events.splice(index, 1);
this.calendarOptions.events.splice(index, 1); });
})
.catch((_) => {
console.log(_);
});
}, },
eventDrop(event) { eventDrop(event) {
event.revert(); event.revert();
...@@ -592,22 +574,17 @@ ...@@ -592,22 +574,17 @@
const day = dayjs(info.start).date(); const day = dayjs(info.start).date();
const id = day + (this.calendarOptions.events.length + 1) * 10; const id = day + (this.calendarOptions.events.length + 1) * 10;
info.id = id; info.id = id;
const keyAll = ['end', 'endStr', 'id', 'start', 'startStr', 'week']; const keyAll = ['end', 'id', 'start', 'week'];
const dataObj = {}; const selectTime = {};
keyAll.forEach((item) => { keyAll.forEach((item) => {
if (item == 'week') { if (item == 'week') {
dataObj[item] = this.week; selectTime[item] = this.week;
} else { } else {
dataObj[item] = info[item]; selectTime[item] = info[item];
} }
}); });
console.log(dataObj, 'dataObjdataObj'); console.log(selectTime, 'dataObjdataObj');
this.calendarOptions.events.push(dataObj); this.calendarOptions.events.push(selectTime);
// this.calendarOptions.events.forEach(item=>{
// if(!item.constraint){
// console.log(item.id);
// }
// });
}, },
selectAllow(info) { selectAllow(info) {
this.isDoIt = true; this.isDoIt = true;
...@@ -615,10 +592,7 @@ ...@@ -615,10 +592,7 @@
const endDay = new Date(info.end).getDay(); const endDay = new Date(info.end).getDay();
const startHour = dayjs(info.start).hour(); const startHour = dayjs(info.start).hour();
console.log(dayjs(info.start).format('YYYY-MM-DD HH:mm:ss')); console.log(dayjs(info.start).format('YYYY-MM-DD HH:mm:ss'));
if (startDay != endDay) { if (startDay != endDay || startHour == 12) {
return false;
}
if (startHour == 12 || startHour == 17) {
return false; return false;
} }
const currentDate = new Date(); const currentDate = new Date();
...@@ -668,29 +642,26 @@ ...@@ -668,29 +642,26 @@
saveDoctoreScheduling(type, weekV = 0) { saveDoctoreScheduling(type, weekV = 0) {
if (this.isDoIt) { if (this.isDoIt) {
this.loading = true; this.loading = true;
const objParms = {}; const saveParms = {};
objParms.week = weekV ? weekV : this.week; saveParms.week = weekV ? weekV : this.week;
objParms.workId = this.schedulingTypeValue.id; saveParms.workId = this.schedulingTypeValue.id;
// objParms.list = [];
const lastData = []; const lastData = [];
const data = this.calendarOptions.events; const haveSelectDate = this.calendarOptions.events;
console.log('data=======', data); haveSelectDate.forEach((item) => {
data.forEach((item) => { if (item.week == (weekV ? weekV : this.week)) {
if (item.week == (weekV ? weekV : this.week) && !item.constraint) { const saveDate = {};
const obj = {}; saveDate.startTime = dayjs(item.start).format(
obj.startTime = this.dateFormat('YYYY-mm-dd HH:MM:SS', item.start); 'YYYY-MM-DD HH:mm:ss'
obj.endTime = this.dateFormat('YYYY-mm-dd HH:MM:SS', item.end); );
lastData.push(obj); saveDate.endTime = dayjs(item.end).format('YYYY-MM-DD HH:mm:ss');
lastData.push(saveDate);
} }
}); });
console.log('objParms=======', objParms); console.log('saveParms=======', saveParms);
objParms.list = lastData.filter((item) => { saveParms.list = lastData.filter((item) => {
return ( return item.startTime.split(' ')[1] !== '12:00:00';
item.startTime.split(' ')[1] !== '12:00:00' &&
item.startTime.split(' ')[1] !== '17:00:00'
);
}); });
saveDutyRoster(objParms).then((res) => { saveDutyRoster(saveParms).then((res) => {
if (res.code === '000000') { if (res.code === '000000') {
this.loading = false; this.loading = false;
if (type == 1) { if (type == 1) {
...@@ -707,29 +678,6 @@ ...@@ -707,29 +678,6 @@
}); });
} }
}, },
dateFormat(fmt, date2) {
const date = new Date(date2);
let ret;
const opt = {
'Y+': date.getFullYear().toString(), // 年
'm+': (date.getMonth() + 1).toString(), // 月
'd+': date.getDate().toString(), // 日
'H+': date.getHours().toString(), // 时
'M+': date.getMinutes().toString(), // 分
'S+': date.getSeconds().toString() || '00', // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (const k in opt) {
ret = new RegExp('(' + k + ')').exec(fmt);
if (ret) {
fmt = fmt.replace(
ret[1],
ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
);
}
}
return fmt;
},
}, },
}; };
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册