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

修改排班

上级 25646a28
......@@ -19,6 +19,10 @@
"tinypng": "pica-cli-service tinypng"
},
"dependencies": {
"@fullcalendar/daygrid": "^5.10.0",
"@fullcalendar/interaction": "^5.10.0",
"@fullcalendar/timegrid": "^5.10.0",
"@fullcalendar/vue": "^5.10.0",
"axios": "^0.19.2",
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
......
......@@ -12,29 +12,43 @@ export const childLabelList = async (data) => {
method: 'get',
});
};
export const workQuery = async(data) => {
export const workQuery = async (data) => {
return request({
url: '/diagnose/doctor/work/workQuery',
data: data,
method: 'post',
url: '/diagnose/doctor/work/workQuery',
data: data,
method: 'post',
});
};
export const switchOpen = async(data) => {
export const switchOpen = async (data) => {
return request({
url: '/diagnose/doctor/work/switchOpen',
data: data,
method: 'post',
url: '/diagnose/doctor/work/switchOpen',
data: data,
method: 'post',
});
};
export const workInStep = async() => {
export const workInStep = async () => {
return request({
url: '/diagnose/doctor/work/inStep',
method: 'post',
url: '/diagnose/doctor/work/inStep',
method: 'post',
});
};
export const getLevel = async() => {
export const getLevel = async () => {
return request({
url: '/diagnose/doctor/work/getLevel',
method: 'post',
url: '/diagnose/doctor/work/getLevel',
method: 'post',
});
};
\ No newline at end of file
};
export const dutyRosterQuery = async (data) => {
return request({
url: '/diagnose/doctor/work/dutyRosterQuery',
data: data,
method: 'post',
});
};
export const saveDutyRoster = async (data) => {
return request({
url: '/diagnose/doctor/work/saveDutyRoster',
data: data,
method: 'post',
});
};
......@@ -14,6 +14,29 @@
background: #fff;
border-radius: 6px;
}
.ag-left-change {
// position: relative;
// border:1px solid #ccc;
// height:40px;
// width:100%;
// display:flex;
// z-index:1;
div {
width: 130px;
height: 40px;
border: 1px solid #ccc;
}
.ag-left1 {
position: absolute;
right: 140px;
top: 20px;
}
.ag-left2 {
position: absolute;
right: 20px;
top: 20px;
}
}
.agment-left-con {
margin-top: 70px;
background: #f0f2f5;
......@@ -104,10 +127,14 @@
background: #fff;
color: #02120f;
border-color: #d9d9d9;
border-radius: 8px;
padding: 1.3px 5px;
border-radius: 20px;
padding: 6px 16px;
}
/deep/.fc-myCustomButton-button {
padding: 6px 24px;
}
/deep/.fc-button-primary:hover {
background: #fff;
color: #02120f;
border: 1px solid #0d9078;
}
......@@ -11,21 +11,31 @@
<div class="agment-box">
<FullCalendar :options="calendarOptions" />
</div>
<div class="ag-left-change">
<div
v-if="week == 2"
class="ag-left1"
/>
<div
v-if="week == 3"
class="ag-left2"
/>
</div>
<div class="agment-box-left">
<div class="agment-left-con">
<div class="agment-head">
<div class="agment-head-name">
纵横
{{ this.schedulingTypeValue.doctorName }}
</div>
<div class="agment-head-phone">
1897653426
{{ this.schedulingTypeValue.mobilePhone }}
</div>
</div>
<div class="agment-hospital">
上海瑞金医院
{{ this.schedulingTypeValue.hospital }}
</div>
<div class="agment-hospital agment-hospital-ks">
普外科
{{ this.schedulingTypeValue.departmentName }}
</div>
</div>
<div style="margin-top: 24px">
......@@ -33,26 +43,14 @@
选择匹配优先级
</p>
<div class="agment-head-priority">
<!-- <el-button type="primary" plain style="color:#FFF;background:#0D9078">1</el-button>
<el-button type="primary" plain style="color:#FFF;background:#0D9078">2</el-button>
<el-button type="primary" plain style="color:#FFF;background:#0D9078">3</el-button>
<el-button type="primary" plain style="color:#FFF;background:#0D9078">4</el-button>
<el-button type="primary" plain style="color:#FFF;background:#0D9078">5</el-button> -->
<p class="item active">
1
</p>
<p class="item">
2
</p>
<p class="item">
3
</p>
<p class="item">
4
</p>
<p class="item">
5
<p
v-for="(item, index) in createList"
:key="index"
class="item"
:class="{ active: index == currentIndex }"
@click="handlePriority(index)"
>
{{ item.value }}
</p>
</div>
</div>
......@@ -68,6 +66,7 @@
type="primary"
round
style="width: 110px"
@click="saveDoctoreScheduling"
>
保存
</el-button>
......@@ -77,10 +76,12 @@
</template>
<script>
// import '@fullcalendar/core/vdom'
// import moment from 'moment';
import FullCalendar from '@fullcalendar/vue';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import { dutyRosterQuery, saveDutyRoster } from '@/api/serviceSchedule';
export default {
name: 'Index',
components: {
......@@ -95,13 +96,20 @@
},
schedulingType: {
type: String,
default: '',
default: '', // 1 新增 2 编辑 3 查看
},
createList: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
listDate: [],
nextBtn: 0,
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 2,
calendarOptions: {
// 引入的插件,比如fullcalendar/daygrid,fullcalendar/timegrid引入后才可显示月,周,日
plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
......@@ -120,49 +128,17 @@
datesSet: this.handleDatesSet,
// unselect:this.unSelectInfo,
events: [
{
title: '黄娇变电站3020开关综合检修',
start: '2021-10-18 09:30:00',
end: '2021-10-18 12:30:00',
color: '#FFEDE9',
editable: false,
}, // 可以拖动但不能缩放,但在周、日视图中是可以进行缩放的
// {
// title : '黄娇变电站3020开关综合检修',
// start : '2021-10-19 00:30',
// end : '2021-10-19 04:30',
// color:'#5580EE',
// editable: true
// }, //可以拖动、缩放
// {
// title : '准备公司资料',
// start : '2021-10-21 04:00',
// end : '2021-10-21 07:00',
// color: '#EDB378',
// editable: true,
// // overlap: true,
// // display: 'background',
// },
// {
// title : '准备公司资料',
// start: '2021-10-23 04:00',
// end: '2021-10-23 05:00',
// overlap: false,
// // display: 'background',
// color: '#797979'
// }
// 背景色 (添加相同时间的背景色时颜色会重叠) 一点要初始化日期时间 initialDate: '2020-07-10',
// title: '黄娇变电站3020开关综合检修',
// start: '2021-10-18 09:30:00',
// end: '2021-10-18 12:30:00',
// color: '#FFEDE9',
// editable: false,
// }, // 可以拖动但不能缩放,但在周、日视图中是可以进行缩放的
],
header: {
center: 'month,agendaFourDay', // buttons for switching between views
},
views: {
agendaFourDay: {
type: 'agenda',
duration: { days: 4 },
buttonText: '4 day',
},
},
firstDay: new Date().getDay(), // 设置一周中显示的第一天是哪天,周日是0,周一是1,类推
locale: 'zh-cn', // 切换语言,当前为中文
eventColor: '#fff', // 全部日历日程背景色3BB2E3
......@@ -197,10 +173,9 @@
expandRows: true,
slotMinWidth: 50,
slotDuration: '00:30:00',
slotMinTime: '09:30',
slotMaxTime: '19:30',
slotMinTime: '09:00',
slotMaxTime: '21:00',
slotLabelInterval: '',
dateClick: this.dateClick,
scrollTime: false,
slotLabelFormat: {
hour: 'numeric',
......@@ -223,7 +198,8 @@
};
},
mounted() {
// this.handleEventClick();
console.log(123, this.schedulingType, this.schedulingTypeValue);
this.init();
},
methods: {
/**
......@@ -234,13 +210,60 @@
* jsEvent是个javascript事件
* view是当前视图对象。
*/
handleDatesSet(dataInfo) {
console.log(dataInfo);
init() {
if (this.schedulingType == 1 || this.schedulingType == 2) {
this.handleInitSearch();
} else {
console.log('查看');
}
},
handleInitSearch() {
const objParms = {};
objParms.doctorId = this.schedulingTypeValue.doctorId;
objParms.week = this.week;
objParms.workId = this.schedulingTypeValue.id;
this.currentIndex = this.schedulingTypeValue.level - 1;
dutyRosterQuery(objParms).then((res) => {
if (res.code == '000000') {
this.handleInitData(res.data);
} else {
this.$toast(res.message);
}
});
},
prevCustom(mouseEvent, htmlElement) {
alert(1234);
console.log(mouseEvent, htmlElement, 'mouseEvent, htmlElement');
// this.defaultDate=;
handleInitData(data) {
const newDate = [].concat(data.acceptList, data.noAcceptList);
// const keyAll = ['end', 'endStr', 'id', 'start', 'startStr'];
newDate.forEach((item) => {
const dataObj = {};
const id = (this.calendarOptions.events.length + 1) * 10;
dataObj['week'] = this.week;
dataObj['id'] = id;
dataObj['end'] = item.endTime;
dataObj['start'] = item.startTime;
dataObj['type'] = item.type;
this.calendarOptions.events.push(dataObj);
});
console.log(this.calendarOptions.events, 'wokkkwok');
},
handleDatesSet(dataInfo) {
const currentTime = new Date().getTime();
const getTime = new Date(dataInfo.startStr).getTime();
const cz = currentTime - getTime;
const oneHour = 1 * 60 * 60 * 1000 * 24;
const timeDifference = (cz / oneHour) | 0;
if (timeDifference > 0) {
// 过去
this.week = 2;
} else if (timeDifference < 0) {
// 未来
this.week = 3;
this.handleInitSearch();
} else {
// 现在
this.week = 1;
}
// this.handleInitSearch();
},
eventResize(event) {
const index = this.getIdDeleteData(event.event.id);
......@@ -258,20 +281,20 @@
return this.calendarOptions.events.splice(index, 1);
// alert("你要取消日期吗");
},
unSelectInfo(info) {
console.log(info, '0000');
console.log(99);
},
selectInfo(info) {
const id = (this.calendarOptions.events.length + 1) * 10;
info.id = id;
const keyAll = ['end', 'endStr', 'id', 'start', 'startStr'];
const keyAll = ['end', 'endStr', 'id', 'start', 'startStr', 'week'];
const dataObj = {};
keyAll.forEach((item) => {
dataObj[item] = info[item];
if (item == 'week') {
dataObj[item] = this.week;
} else {
dataObj[item] = info[item];
}
});
console.log(dataObj, 'dataObjdkdkdkdk');
this.calendarOptions.events.push(dataObj);
console.log(this.calendarOptions.events, '10000');
},
selectAllow(info) {
const currentDate = new Date();
......@@ -289,9 +312,9 @@
// 对于排班交叉部分处理
const infoStart = new Date(info.start).getTime();
const infoEnd = new Date(info.end).getTime();
let indexObj = false;
const data = this.calendarOptions.events;
const newDate = [];
let indexObj = false;
data.forEach((item) => {
const d = new Date(item.end).getTime();
const s = new Date(item.start).getTime();
......@@ -305,11 +328,61 @@
newDate.push(item);
}
});
console.log(indexObj);
this.calendarOptions.events = newDate;
console.log(this.calendarOptions.events.length, 'len', indexObj);
},
dateClick(info) {
console.log(info, 'info');
handlePriority(index) {
this.currentIndex = index;
},
saveDoctoreScheduling() {
const objParms = {};
objParms.week = this.week;
objParms.workId = this.schedulingTypeValue.id;
objParms.level = this.currentIndex + 1;
objParms.list = [];
const data = this.calendarOptions.events;
data.forEach((item) => {
if (item.week == this.week) {
const obj = {};
// const timeFormat = 'YYYY-MM-DD HH:mm:ss';
// const endStr = moment(item.endStr).format(timeFormat);
// const startStr = moment(item.StartStr).format(timeFormat);
obj.startTime = this.dateFormat('YYYY-mm-dd HH:MM', item.start);
obj.endTime = this.dateFormat('YYYY-mm-dd HH:MM', item.end);
objParms.list.push(obj);
}
});
saveDutyRoster(objParms).then((res) => {
if (res.code === '000000') {
// this.$toast(res.message);
} else {
this.$toast(res.message);
}
console.log(res, '保存结果');
});
},
dateFormat(fmt, date) {
console.log(date, 'datedate');
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(), // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
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;
},
},
};
......
......@@ -147,6 +147,7 @@
<div class="serviceSchedule-container">
<div class="serviceSchedule-containerInfo">
<NewScheduling
:create-list="newCreateList"
:scheduling-type-value="schedulingTypeValue"
:scheduling-type="schedulingType"
/>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册