Browse Source

备份初始医院数据,修改调诊交互

pull/15/head
zq 4 weeks ago
parent
commit
b02e2bce2a
  1. 141
      src/views/HosInformation.vue

141
src/views/HosInformation.vue

@ -425,7 +425,7 @@
</div> </div>
</el-tooltip> </el-tooltip>
<div v-else class="calendar-date"> <div v-else class="calendar-date" @click="handleDateClick(data.day, $event, date, data)">
<div class="date-header"> <div class="date-header">
<div class="flex gap12"> <div class="flex gap12">
<span class="date-text">{{ getDayNumber(data.day) }}</span> <span class="date-text">{{ getDayNumber(data.day) }}</span>
@ -623,11 +623,12 @@
<span class="" style="width: 50px;margin-right: 24px;">上午班</span> <span class="" style="width: 50px;margin-right: 24px;">上午班</span>
<div class="select-container"> <div class="select-container">
<div class="selected-hospitals-display" @click="toggleAfternoonDropdown('morn')"> <div class="selected-hospitals-display" @click="toggleAfternoonDropdown('morn')">
{{ getAfternoonSelectedNames('morningSelectedHospitals') }} <!-- {{ getAfternoonSelectedNames('morningSelectedHospitals') }} -->
{{ morningSelectedNames }}
<i :class="['el-icon-arrow-down', { 'is-reverse': isMornDropdownOpen }]"></i> <i :class="['el-icon-arrow-down', { 'is-reverse': isMornDropdownOpen }]"></i>
</div> </div>
<el-select placeholder="请选择" ref="afternoonSelect" class="hidden-select" @visible-change="handleMornVisibleChange"> <el-select placeholder="休息" ref="afternoonSelect" v-model="morningSelectedHospitals" class="hidden-select" @visible-change="handleMornVisibleChange">
<el-option v-for="item in hosList" :key="item.hid" :label="item.name" disabled <el-option v-for="item in hosList" :key="item.hid" :label="item.name" disabled :value="item.hid"
> >
<div class="flex-between option-content"> <div class="flex-between option-content">
<span style="color:#333">{{ item.name }}</span> <span style="color:#333">{{ item.name }}</span>
@ -637,7 +638,6 @@
:checked="item.morning_plan == '1' ? true : false"></el-checkbox> :checked="item.morning_plan == '1' ? true : false"></el-checkbox>
</div> </div>
</div> </div>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -647,11 +647,12 @@
<span style="width: 50px;margin-right: 24px;">下午班</span> <span style="width: 50px;margin-right: 24px;">下午班</span>
<div class="select-container"> <div class="select-container">
<div class="selected-hospitals-display" @click="toggleAfternoonDropdown('after')"> <div class="selected-hospitals-display" @click="toggleAfternoonDropdown('after')">
{{ getAfternoonSelectedNames('afternoonSelectedHospitals') }} <!-- {{ getAfternoonSelectedNames('afternoonSelectedHospitals') }} -->
{{ afternoonSelectedNames }}
<i :class="['el-icon-arrow-down', { 'is-reverse': isAfternoonDropdownOpen }]"></i> <i :class="['el-icon-arrow-down', { 'is-reverse': isAfternoonDropdownOpen }]"></i>
</div> </div>
<el-select placeholder="请选择" ref="afternoonSelect" class="hidden-select" @visible-change="handleAfternoonVisibleChange"> <el-select placeholder="休息" ref="afternoonSelect" v-model="afternoonSelectedHospitals" class="hidden-select" @visible-change="handleAfternoonVisibleChange">
<el-option v-for="item in hosList" :key="item.hid" :label="item.name" disabled <el-option v-for="item in hosList" :key="item.hid" :label="item.name" disabled :value="item.hid"
> >
<div class="flex-between option-content"> <div class="flex-between option-content">
<span style="color:#333">{{ item.name }}</span> <span style="color:#333">{{ item.name }}</span>
@ -949,6 +950,7 @@ export default {
singleHosTitle: '出诊日历',// singleHosTitle: '出诊日历',//
temp_plans: null,// temp_plans: null,//
hosList: [],// hosList: [],//
hosListCopy:[],//
currentDay: new Date(), currentDay: new Date(),
calendarList1: [], calendarList1: [],
calendarList: {}, // calendarList: {}, //
@ -983,6 +985,7 @@ export default {
// afternoonSelectedHospitals: [], // ID // afternoonSelectedHospitals: [], // ID
isAfternoonDropdownOpen: false, isAfternoonDropdownOpen: false,
isMornDropdownOpen: false, isMornDropdownOpen: false,
} }
}, },
created() { created() {
@ -1029,9 +1032,10 @@ export default {
computed: { computed: {
// //
// 使
hospitalColorMap() { hospitalColorMap() {
const colorMap = {}; const colorMap = {};
this.hosList.forEach((hospital, index) => { this.hosListCopy.forEach((hospital, index) => {
colorMap[hospital.hid] = this.colorPalette[index % this.colorPalette.length]; colorMap[hospital.hid] = this.colorPalette[index % this.colorPalette.length];
}); });
return colorMap; return colorMap;
@ -1071,6 +1075,12 @@ export default {
}); });
return configs; return configs;
}, },
morningSelectedNames() {
return this.getSelectedNames(this.morningSelectedHospitals);
},
afternoonSelectedNames() {
return this.getSelectedNames(this.afternoonSelectedHospitals);
},
selectedCount() { selectedCount() {
return this.selectedRows.length; return this.selectedRows.length;
@ -1078,6 +1088,19 @@ export default {
...mapState(['hosMenuData']) // VuexshowSidebar ...mapState(['hosMenuData']) // VuexshowSidebar
}, },
methods: { methods: {
getSelectedNames(selectedList) {
console.log(selectedList,'getSelectedNames----selectedList====');
if (selectedList.length === 0) {
return '不出诊';
}
const selectedNames = selectedList.map(hid => {
const hospital = this.hosList.find(item => item.hid === hid);
return hospital ? hospital.name : '';
}).filter(name => name);
console.log(selectedNames,'getSelectedNames--selectedNames');
return selectedNames.join('、') || '休息';
},
toggleAfternoonDropdown() { toggleAfternoonDropdown() {
console.log('----09999',this.afternoonSelectedHospitals); console.log('----09999',this.afternoonSelectedHospitals);
if (this.isAfternoonDropdownOpen) { if (this.isAfternoonDropdownOpen) {
@ -1096,12 +1119,24 @@ export default {
this.isAfternoonDropdownOpen = false; this.isAfternoonDropdownOpen = false;
}, },
getAfternoonSelectedNames(list) { getMorningSelectedNames() {
if (this[list].length === 0) { if (this.morningSelectedHospitals.length === 0) {
return '请选择'; return '不出诊';
}
const selectedNames = this.morningSelectedHospitals.map(hid => {
const hospital = this.hosList.find(item => item.hid === hid);
return hospital ? hospital.name : '';
}).filter(name => name);
return selectedNames.join('、') || '休息';
},
getAfternoonSelectedNames() {
if (this.afternoonSelectedHospitals.length === 0) {
return '不出诊';
} }
const selectedNames = this[list].map(hid => { const selectedNames = this.afternoonSelectedHospitals.map(hid => {
const hospital = this.hosList.find(item => item.hid === hid); const hospital = this.hosList.find(item => item.hid === hid);
return hospital ? hospital.name : ''; return hospital ? hospital.name : '';
}).filter(name => name); }).filter(name => name);
@ -1155,7 +1190,6 @@ export default {
}, },
// //
selectMorningHospital(hospitalId,workHos) { selectMorningHospital(hospitalId,workHos) {
console.log(workHos,hospitalId,'workHos00000');
if (!this.is_allow_coincide && this[workHos].length >= 1) { if (!this.is_allow_coincide && this[workHos].length >= 1) {
// //
@ -1163,6 +1197,8 @@ export default {
} else { } else {
// //
if (!this[workHos].includes(hospitalId)) { if (!this[workHos].includes(hospitalId)) {
console.log(workHos,this[workHos],'workHos00000');
this[workHos].push(hospitalId); this[workHos].push(hospitalId);
} }
} }
@ -1178,51 +1214,69 @@ export default {
// //
handleDateClick(dateString, event) { handleDateClick(dateString, event) {
event.stopPropagation(); event.stopPropagation();
// //
if (!this.hasScheduleData(dateString)) { const clickedDate = new Date(dateString);
console.log('该日期无排班数据'); const today = new Date();
today.setHours(0, 0, 0, 0); //
if (clickedDate < today) {
this.$Message.warning('无法调整过去的日期');
return; return;
} }
// //
// if (!this.hasScheduleData(dateString)) {
// console.log('');
// return;
// }
// //
const date1 = new Date(dateString); const date1 = new Date(dateString);
const day = date1.getDay() const day = date1.getDay()
const dayText = day == 0 ? '周日' : this.weekPlan[day] const dayText = day == 0 ? '周日' : this.weekPlan[day]
this.currentEditingDate = this.formatMonth(dateString, true) + ` ${dayText}` this.currentEditingDate = this.formatMonth(dateString, true) + ` ${dayText}`
this.isShowDialogDate = this.hasTempAdjustments(dateString) this.isShowDialogDate = this.hasTempAdjustments(dateString)
console.log('点击日期:000', this.isShowDialogDate, '999998888888', date1, this.currentEditingDate, dayText, dateString); // console.log(':000', this.isShowDialogDate, '999998888888', date1, this.currentEditingDate, dayText, dateString);
if (this.isShowDialogDate) { if (this.isShowDialogDate) {
this.singleHosTitle = dayText + '出诊规则' this.singleHosTitle = dayText + '出诊规则'
} }
// //
const schedule = this.getDateSchedule(dateString); // const schedule = this.getDateSchedule(dateString);
if (!schedule) return; // if (!schedule) return;
// //
const hospitals = this.getHospitalsByDate(dateString); const hospitals = this.getHospitalsByDate(dateString);
// console.log(this.hosListCopy,this.hosList,'=====');
// //
this.hosList = this.hosList.map(item => { this.hosList = this.hosListCopy.map(item => {
let hospitalInfo = { let hospitalInfo = {
hid: item.hid, hid: item.hid,
name: item.h_depart_name, name: item.h_depart_name,
workTime: '已取消', workTime: '休息',
originalPlan: '0', originalPlan: '0',
currentPlan: '0', currentPlan: '0',
isCancelled: false // isCancelled: false //
}; };
hospitals.forEach(hospital => { if(hospitals.length > 0){
if (hospital.hid === item.hid) { hospitals.forEach(hospital => {
hospitalInfo = { ...hospital } if (hospital.hid === item.hid) {
if (hospital.currentPlan == '1') { hospitalInfo = { ...hospital }
hospitalInfo.morning_plan = '1' if (hospital.currentPlan == '1') {
} else if (hospital.currentPlan == '2') { hospitalInfo.morning_plan = '1'
hospitalInfo.afternoon_plan = '1' hospitalInfo.afternoon_plan = '0'
} else if (hospital.currentPlan == '3') { } else if (hospital.currentPlan == '2') {
hospitalInfo.morning_plan = '1' hospitalInfo.afternoon_plan = '1'
hospitalInfo.afternoon_plan = '1' hospitalInfo.morning_plan = '0'
} else if (hospital.currentPlan == '3') {
hospitalInfo.morning_plan = '1'
hospitalInfo.afternoon_plan = '1'
}else{
hospitalInfo.morning_plan = '0'
hospitalInfo.afternoon_plan = '0'
}
} }
} })
}) }
console.log(hospitalInfo, ' ...hospitalInfo'); // console.log(hospitalInfo, ' ...hospitalInfo');
return { return {
morning_plan: '0', morning_plan: '0',
afternoon_plan: '0', afternoon_plan: '0',
@ -1230,7 +1284,7 @@ export default {
...hospitalInfo, ...hospitalInfo,
} }
}) })
console.log(hospitals, this.hosList, 'hospitals==='); // console.log(hospitals, this.hosList, 'hospitals===');
// //
if (this.hosList.length === 1) { if (this.hosList.length === 1) {
@ -1245,6 +1299,7 @@ export default {
}, },
// //
initSelectedHospitals(hospitals) { initSelectedHospitals(hospitals) {
this.morningSelectedHospitals = []; this.morningSelectedHospitals = [];
this.afternoonSelectedHospitals = []; this.afternoonSelectedHospitals = [];
@ -1259,10 +1314,8 @@ export default {
this.afternoonSelectedHospitals.push(hid); this.afternoonSelectedHospitals.push(hid);
} }
}); });
console.log(hospitals,this.morningSelectedHospitals, this.afternoonSelectedHospitals, 'initSelectedHospitals-初始化的喧哗走ing');
this.moreHosVisiable = true; this.moreHosVisiable = true;
// this.morningText = this.morningSelectedHospitals.join(', ')
// this.afterText = this.afternoonSelectedHospitals.join(', ')
console.log(this.morningSelectedHospitals, this.afternoonSelectedHospitals, '初始化的喧哗走ing');
}, },
// //
@ -1318,6 +1371,8 @@ export default {
if (response.code === 0) { if (response.code === 0) {
this.$message.success('临时调整保存成功'); this.$message.success('临时调整保存成功');
this.afternoonSelectedHospitals = [];
this.morningSelectedHospitals = [];
// //
this.getDoctorHosPreview(); this.getDoctorHosPreview();
} else { } else {
@ -1864,6 +1919,8 @@ export default {
h_depart_name: list[item].h_depart_name h_depart_name: list[item].h_depart_name
} }
}); });
//
this.hosListCopy = JSON.parse(JSON.stringify(this.hosList))
// //
// this.rawScheduleData = list; // this.rawScheduleData = list;
@ -1940,11 +1997,11 @@ export default {
const dateStr = daySchedule._dateStr; const dateStr = daySchedule._dateStr;
const originalPlan = this.getOriginalPlan(dateStr, hospitalId); const originalPlan = this.getOriginalPlan(dateStr, hospitalId);
console.log(` - addHospitalToSchedule: 医院=${hospitalId}, 当前计划=${shiftType}, 原计划=${originalPlan}`); // console.log(` - addHospitalToSchedule: =${hospitalId}, =${shiftType}, =${originalPlan}`);
// //
if (shiftType === "0" && originalPlan !== "0") { if (shiftType === "0" && originalPlan !== "0") {
console.log(` - 检测到临时取消: 医院=${hospitalId}, 原班次=${originalPlan}`); // console.log(` - : =${hospitalId}, =${originalPlan}`);
if (!daySchedule[originalPlan]) { if (!daySchedule[originalPlan]) {
daySchedule[originalPlan] = []; daySchedule[originalPlan] = [];
@ -2156,6 +2213,8 @@ export default {
// //
moreTempCancel() { moreTempCancel() {
this.moreHosVisiable = false; this.moreHosVisiable = false;
this.afternoonSelectedHospitals = [];
this.morningSelectedHospitals = [];
}, },
isCurrentMonth(date) { isCurrentMonth(date) {
const current = new Date(); const current = new Date();

Loading…
Cancel
Save