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

Loading…
Cancel
Save