@ -105,21 +105,31 @@
< el -icon v-if ="isSelected(item2.id)" color="#ffffff" > < Select / > < / e l - i c o n >
< / div >
< div class = "qudao_count_row" >
< div class = "qudao_title_zong" > < span > 总 < / span > { { item2 . countsInfo [ 0 ] . max _total } }
<!-- 模式A : 只有医生渠道有数量 -- >
< template v-if ="!hasOtherChannelCount(item2.countsInfo)" >
< div class = "qudao_count_row qudao_count_row_simple" >
< span class = "card_total" > 总 { { item2 . countsInfo [ 0 ] . max _total } } < / span >
< span v-if ="getTotalLocked(item2.countsInfo) > 0" class="card_locked" > 占 {{ getTotalLocked ( item2.countsInfo ) }} < / span >
< / div >
< div v-for ="(item3,index3) in item2.countsInfo" :key ="index3" >
< span > { { item3 . jiancheng } } < / span > < span > { { item3 . count } } < / span >
< / template >
<!-- 模式B : 多渠道有数量 -- >
< template v-else >
< div class = "qudao_count_row" >
< div class = "qudao_title_zong" > < span > 总 < / span > { { item2 . countsInfo [ 0 ] . max _total } }
< / div >
< div v-for ="(item3,index3) in item2.countsInfo" :key ="index3" >
< span > { { item3 . jiancheng } } < / span > < span > { { item3 . count } } < / span >
< / div >
< / div >
< / div >
< div v-if ="getTotalLocked(item2.countsInfo) > 0" class="locked_count_row" >
占 : { { getTotalLocked ( item2 . countsInfo ) } }
< / div >
< / template >
< div class = "patient_type_row" >
< div class = "tps" v-for ="(item3,index3) in item2.patient_type_label" >
{ { item3 } }
< / div >
< / div >
< div v-if ="getTotalLocked(item2.countsInfo) > 0" class="locked_count_row" >
占 : { { getTotalLocked ( item2 . countsInfo ) } }
< / div >
< / div >
< / td >
< / tr >
@ -187,32 +197,18 @@
< / e l - c h e c k b o x >
< / e l - c h e c k b o x - g r o u p >
< / e l - f o r m - i t e m >
< el -form -item label = " 渠道名额 : ">
< el -form -item label = " 号源数量 : ">
< div style = "margin-right: 26px" >
< div >
< el -radio -group v-model ="CountType" @change="CountTypeChange" >
< el -radio label = "1" > 根据总量 < / e l - r a d i o >
< el -radio style = "margin-left: -10px;" label = "2" > 根据时长 ( 分钟 ) < / e l - r a d i o >
< / e l - r a d i o - g r o u p >
< / div >
< div class = "qudao_k_input" >
< el -input v -if = " CountType = = 1 " style = "width: 220px;" @input ="MaxCountChange" type = "number"
v - model = "PlanInfo.max_total" : min = "0" placeholder = "0"
oninput = "value=value.replace(/[^0-9]/g, '')" / >
< el -input v -if = " CountType = = 2 " style = "width: 220px;" @input ="TimeLongChange" type = "number"
v - model = "PlanInfo.time_long" : min = "1" placeholder = "0"
oninput = "value=value.replace(/^0|[^0-9]/g, '')" / >
< / div >
< div style = "font-size: 12px;color: #999" > 设置渠道比例可自动分配 < / div >
< / div >
< div >
< div class = "qudao_k" v-for ="(item,index) in PlanInfo.qudao_total" :key ="index" >
< div style = "width: 50px" > { { item . name } } < / div >
< div class = "qudao_k_input" style = "display: flex;" >
< el -input type = "number" v -model = " PlanInfo.qudao_total [ index ] .count " :min ="0"
placeholder = "0" oninput = "value=value.replace(/[^0-9]/g, '')" / >
< div style = "margin-left: 4px; color: #ccc;" > { { item . ratio } } % < / div >
< / div >
< template v-for ="(item,index) in PlanInfo.qudao_total" :key ="index" >
< div class = "qudao_k" v-if ="visibleChannelIds.has(item.id || item.appointment_type_id)" >
< div v-if ="visibleChannelIds.size > 1" style="width: 60px" > {{ item.name }} < / div >
< div class = "qudao_k_input" style = "display: flex;" >
< el -input type = "number" v -model = " PlanInfo.qudao_total [ index ] .count " :min ="0"
placeholder = "0" oninput = "value=value.replace(/[^0-9]/g, '')" / >
< / div >
< / div >
< / template >
< / div >
< / div >
< / e l - f o r m - i t e m >
@ -228,13 +224,13 @@
< div style = "display:flex;" >
< div style = "width: 70px" > 开始时间 : < / div >
< div class = "qudao_k_input" >
< el -input v -model = " PlanInfo.begin_time " placeholder = "开始时间" disabled / >
< el -input v -model = " PlanInfo.begin_time " placeholder = "开始时间" / >
< / div >
< / div >
< div style = "display:flex;" >
< div style = "width: 70px" > 结束时间 : < / div >
< div class = "qudao_k_input" >
< el -input v -model = " PlanInfo.end_time " placeholder = "结束时间" disabled / >
< el -input v -model = " PlanInfo.end_time " placeholder = "结束时间" / >
< / div >
< / div >
< / div >
@ -242,13 +238,7 @@
< div style = "display:flex;" >
< div style = "width: 90px" > 停止预约时间 : < / div >
< div class = "qudao_k_input" >
< el -input v -model = " PlanInfo.end_reservation_time " placeholder = "停止预约时间" disabled / >
< / div >
< / div >
< div style = "display:flex;" >
< div style = "width: 90px" > 可用时间长度 : < / div >
< div class = "qudao_k_input" >
< el -input v -model = " PlanInfo.time_unit " placeholder = "可用时间长度" disabled / >
< el -input v -model = " PlanInfo.end_reservation_time " placeholder = "停止预约时间" / >
< / div >
< / div >
< / div >
@ -356,17 +346,16 @@
< el -form -item label = "星期:" >
{ { ZhanWeiInfo . weekname } }
< / e l - f o r m - i t e m >
< el -form -item label = " 渠道占位: ">
< el -form -item label = " 号源占位: ">
< div style = "display: flex; flex-direction: column; gap: 10px; width: 100%;" >
< template v-if ="ZhanWeiInfo.qudao_total && ZhanWeiInfo.qudao_total.length > 0" >
< template v-for ="(item,index) in ZhanWeiInfo.qudao_total" :key ="index" >
< div v -if = " item & & ! ( item.count = = = 0 ) "
< div v -if = " visibleZhanWeiChannelIds.has( item.appointment_type_id | | item.id ) "
style = "display: flex; align-items: center; gap: 10px;" >
< div style = "width: 80px;" > { { item . name } } < / div >
< div style = "flex: 1;" >
< el -input type = "number" v -model = " ZhanWeiInfo.qudao_total [ index ] .locked_count " placeholder = "占位数量" min = "0"
oninput = "value=value.replace(/[^0-9]/g,'')" / >
< / div >
< div v-if ="visibleZhanWeiChannelIds.size > 1" style="width: 80px;" > {{ item.name }} < / div >
< el -input type = "number" v -model = " ZhanWeiInfo.qudao_total [ index ] .locked_count " placeholder = "占位数量" min = "0"
style = "width: 220px;"
oninput = "value=value.replace(/[^0-9]/g,'')" / >
< div style = "color: #999; font-size: 12px;" >
可用 : { { item . count } }
< / div >
@ -394,22 +383,35 @@
< div >
< div style = "margin-bottom: 16px; color: #666;" > 已选 { { selectedPlanArr . length } } 条号源明细 < / div >
< el -form label -width = " 100px " >
< el -row :gutter ="10" style = "margin-bottom: 6px; font-weight: 600; color: #333; font-size: 13px;" >
< el -col :span ="6" > 渠道名称 < / e l - c o l >
< el -col :span ="8" > 数量 < / e l - c o l >
< / e l - r o w >
< el -row v-for ="(ch, ci) in batchChannels" :key="ci" :gutter="10" style="margin-bottom: 10px;" >
< el -col :span ="6" style = "line-height: 32px;" > { { ch . name } } < / e l - c o l >
< el -col :span ="8" >
< el -input v -model .number = " batchForm [ ci ] .count " placeholder = "数量" size = "default"
oninput = "value=value.replace(/[^0-9]/g,'')" / >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="10" style = "border-top: 1px solid #eee; padding-top: 10px;" >
< el -col :span ="6" style = "line-height: 32px; font-weight: 600;" > 合计 < / e l - c o l >
< el -col :span ="8" style = "line-height: 32px; font-weight: 600;" > 数量 : { { batchTotalCount } } < / e l - c o l >
< / e l - r o w >
< el -form -item label = "号源数量:" >
< div style = "display: flex; flex-direction: column; gap: 10px;" >
< template v-for ="(ch, ci) in batchChannels" :key ="ci" >
< div v-if ="visibleBatchChannelIds.has(ch.id || ch.appointment_type_id)" style="display: flex; align-items: center; gap: 8px; margin-bottom: 10px;" >
< span v-if ="visibleBatchChannelIds.size > 1" style="width: 60px; color: #666;" > {{ ch.name }} < / span >
< el -input v -model .number = " batchForm [ ci ] .count " placeholder = "数量" size = "default" style = "width: 220px;"
oninput = "value=value.replace(/[^0-9]/g,'')" / >
< / div >
< / template >
< / div >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< div v-if ="batchSameTimeSlot" style="margin-top: 16px; padding-top: 12px; border-top: 1px solid #eee;" >
< div style = "margin-bottom: 8px; font-weight: 600; color: #333; font-size: 13px;" > 时间段设置 < / div >
< div style = "display: flex; gap: 12px; flex-wrap: wrap;" >
< div style = "display: flex; align-items: center;" >
< div style = "width: 70px" > 开始时间 : < / div >
< el -input v -model = " batchTimeInfo.begin_time " placeholder = "开始时间" style = "width: 120px;" / >
< / div >
< div style = "display: flex; align-items: center;" >
< div style = "width: 70px" > 结束时间 : < / div >
< el -input v -model = " batchTimeInfo.end_time " placeholder = "结束时间" style = "width: 120px;" / >
< / div >
< div style = "display: flex; align-items: center;" >
< div style = "width: 90px" > 停止预约时间 : < / div >
< el -input v -model = " batchTimeInfo.end_reservation_time " placeholder = "停止预约时间" style = "width: 120px;" / >
< / div >
< / div >
< / div >
< div style = "margin-top: 16px; padding-top: 12px; border-top: 1px solid #eee;" >
< div style = "margin-bottom: 8px; font-weight: 600; color: #333; font-size: 13px;" > 病人类型 < / div >
< el -checkbox -group v-model ="batchPatientType" >
@ -430,28 +432,21 @@
< div >
< div style = "margin-bottom: 16px; color: #666;" > 已选 { { selectedPlanArr . length } } 条号源明细 < / div >
< el -form label -width = " 100px " >
< el -row :gutter ="10" style = "margin-bottom: 6px; font-weight: 600; color: #333; font-size: 13px;" >
< el -col :span ="6" > 渠道名称 < / e l - c o l >
< el -col :span ="8" > 占用数量 < / e l - c o l >
< el -col :span ="8" > 提示 < / e l - c o l >
< / e l - r o w >
< el -row v-for ="(ch, ci) in batchOccupyChannels" :key="ci" :gutter="10" style="margin-bottom: 10px;" >
< el -col :span ="6" style = "line-height: 32px;" > { { ch . name } } < / e l - c o l >
< el -col :span ="8" >
< el -input v -model .number = " batchOccupyForm [ ci ] .locked_count " placeholder = "占用数量" size = "default"
oninput = "value=value.replace(/[^0-9]/g,'')"
@ input = "onOccupyInput(ci, $event)" / >
< / e l - c o l >
< el -col :span ="8" style = "line-height: 32px; font-size: 12px; color: #999;" >
< template v-if ="batchOccupyLimits[ch.id]?.maxValue !== null" >
最大可占 : { { batchOccupyLimits [ ch . id ] . maxValue } }
< / template >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="10" style = "border-top: 1px solid #eee; padding-top: 10px;" >
< el -col :span ="6" style = "line-height: 32px; font-weight: 600;" > 合计 < / e l - c o l >
< el -col :span ="8" style = "line-height: 32px; font-weight: 600;" > 占用 : { { batchOccupyTotalLocked } } < / e l - c o l >
< / e l - r o w >
< el -form -item label = "号源占位:" >
< div style = "display: flex; flex-direction: column; gap: 10px;" >
< template v-for ="(ch, ci) in batchOccupyChannels" :key ="ci" >
< div v-if ="visibleBatchOccupyChannelIds.has(ch.id)" style="display: flex; align-items: center; gap: 8px; margin-bottom: 10px;" >
< span v-if ="visibleBatchOccupyChannelIds.size > 1" style="width: 60px; color: #666;" > {{ ch.name }} < / span >
< el -input v -model .number = " batchOccupyForm [ ci ] .locked_count " placeholder = "占用数量" size = "default" style = "width: 220px;"
oninput = "value=value.replace(/[^0-9]/g,'')"
@ input = "onOccupyInput(ci, $event)" / >
< span style = "color: #999; font-size: 12px;" >
最大可占 : { { batchOccupyLimits [ ch . id ] ? . maxValue } }
< / span >
< / div >
< / template >
< / div >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< / div >
< template # footer >
@ -494,7 +489,6 @@
ElMessageBox
} from 'element-plus'
let CountType = ref ( "1" ) ; / / 渠 道 数 量 设 置 方 式
let loading = ref ( false )
let currentPage = ref ( 1 ) / / 当 前 页 码
let pageSize = ref ( 15 ) / / 每 页 数 量
@ -666,10 +660,12 @@
let batchModifyRunning = ref ( false )
let batchChannels = ref ( [ ] )
let batchForm = ref ( [ ] )
let visibleBatchChannelIds = ref ( new Set ( ) )
let visibleZhanWeiChannelIds = ref ( new Set ( ) )
let visibleBatchOccupyChannelIds = ref ( new Set ( ) )
let batchSameTimeSlot = ref ( false )
let batchTimeInfo = ref ( { begin _time : '' , end _time : '' , end _reservation _time : '' } )
let batchPatientType = ref ( [ ] )
const batchTotalCount = computed ( ( ) => {
return batchForm . value . reduce ( ( s , item ) => s + ( Number ( item . count ) || 0 ) , 0 )
} )
/ / 批 量 占 用 状 态
let BatchOccupyDialogVisible = ref ( false )
let batchOccupyRunning = ref ( false )
@ -773,14 +769,16 @@
channelMap . set ( ci . appointment _type _id , {
name : ci . name ,
jiancheng : ci . jiancheng ,
counts : [ ]
counts : [ ] ,
locked _counts : [ ]
} )
}
channelMap . get ( ci . appointment _type _id ) . counts . push ( ci . count )
channelMap . get ( ci . appointment _type _id ) . locked _counts . push ( Number ( ci . locked _count ) || 0 )
} )
/ / 收 集 病 人 类 型
if ( cell . patient _type ) {
patientTypeSets . push ( new Set ( cell . patient _type ))
patientTypeSets . push ( new Set ( cell . patient _type .split ( ',' ) . filter ( v => v !== '' ) ))
}
}
}
@ -796,6 +794,19 @@
count : allSame ? info . counts [ 0 ] : ''
} )
}
/ / 渠 道 显 示 快 照 : i d = 1 或 c o u n t > 0 的 渠 道 显 示
visibleBatchChannelIds . value = new Set (
batchForm . value
. filter ( ( item , ci ) => {
const ch = batchChannels . value [ ci ]
const chId = ch . id || ch . appointment _type _id
return chId === 1 || Number ( item . count ) > 0 || channelMap . get ( chId ) ? . locked _counts ? . some ( v => v > 0 )
} )
. map ( ( item , ci ) => {
const ch = batchChannels . value [ ci ]
return ch . id || ch . appointment _type _id
} )
)
/ / 病 人 类 型 回 填 : 同 值 勾 选 , 异 值 留 空
if ( patientTypeSets . length > 0 ) {
const commonTypes = patientTypeSets . reduce ( ( acc , set ) => {
@ -811,6 +822,51 @@
}
batchModifyRunning . value = false
BatchModifyDialogVisible . value = true
/ / 判 断 选 中 项 是 否 同 一 时 间 段 ( 复 用 已 有 的 s e l e c t e d I d s )
const selectedCells = [ ]
planTableData . value . forEach ( row => {
for ( const key in row ) {
if ( key === 'time_range' ) continue
const cell = row [ key ]
if ( cell && cell . id && selectedIds . has ( cell . id ) ) {
selectedCells . push ( cell )
}
}
} )
if ( selectedCells . length > 0 ) {
const firstBegin = selectedCells [ 0 ] . begin _time
const firstEnd = selectedCells [ 0 ] . end _time
const allSameTime = selectedCells . every ( c => c . begin _time === firstBegin && c . end _time === firstEnd )
batchSameTimeSlot . value = allSameTime
if ( allSameTime ) {
/ / 截 止 时 间 取 出 现 频 次 最 多 的 值
const deadlineCount = { }
selectedCells . forEach ( c => {
const v = c . end _reservation _time
if ( v !== null && v !== undefined ) {
deadlineCount [ v ] = ( deadlineCount [ v ] || 0 ) + 1
}
} )
let bestDeadline = selectedCells [ 0 ] . end _reservation _time
let maxFreq = 0
for ( const [ v , freq ] of Object . entries ( deadlineCount ) ) {
if ( freq > maxFreq ) {
maxFreq = freq
bestDeadline = v
}
}
batchTimeInfo . value = {
begin _time : firstBegin ,
end _time : firstEnd ,
end _reservation _time : bestDeadline
}
} else {
batchTimeInfo . value = { begin _time : '' , end _time : '' , end _reservation _time : '' }
}
} else {
batchSameTimeSlot . value = false
batchTimeInfo . value = { begin _time : '' , end _time : '' , end _reservation _time : '' }
}
}
const execBatchModify = async ( ) => {
/ / 校 验
@ -820,20 +876,26 @@
return
}
}
const maxTotal = batch TotalCount. value
const maxTotal = batch Form. value . reduce ( ( s , item ) => s + ( Number ( item . count ) || 0 ) , 0 )
batchModifyRunning . value = true
const ids = [ ... selectedPlanArr . value ]
const coutsInfo = batchForm . value . map ( item => ( {
appointment _type _id : item . appointment _type _id ,
count : Number ( item . count ) || 0
} ) )
const batchParams = {
ids : ids ,
max _total : maxTotal ,
coutsInfo : coutsInfo ,
patientType : batchPatientType . value
}
if ( batchSameTimeSlot . value ) {
batchParams . begin _time = batchTimeInfo . value . begin _time
batchParams . end _time = batchTimeInfo . value . end _time
batchParams . end _reservation _time = batchTimeInfo . value . end _reservation _time
}
try {
const res = await PlanModelBatchChange ( {
ids : ids ,
max _total : maxTotal ,
coutsInfo : coutsInfo ,
patientType : batchPatientType . value
} )
const res = await PlanModelBatchChange ( batchParams )
batchModifyRunning . value = false
if ( res && res . status ) {
BatchModifyDialogVisible . value = false
@ -947,9 +1009,13 @@
row [ xingqi . label ] = {
countsInfo : matchingPlan . countsInfo ,
patient _type _label : matchingPlan . patient _type _label ,
patient _type : matchingPlan . patient _type ,
status : matchingPlan . status ,
id : matchingPlan . id ,
resources _id : matchingPlan . resources _id
resources _id : matchingPlan . resources _id ,
begin _time : matchingPlan . begin _time ,
end _time : matchingPlan . end _time ,
end _reservation _time : matchingPlan . end _reservation _time
} ;
} else {
@ -1008,7 +1074,6 @@
begin _time : '' ,
end _time : '' ,
end _reservation _time : '' ,
time _unit : 0 , / / 可 用 时 长
resources _id : null ,
devices : [ ] ,
patientType : [ ] ,
@ -1016,6 +1081,7 @@
}
}
let PlanInfo = ref ( DataDefault ( ) )
let visibleChannelIds = ref ( new Set ( ) )
let selectedResourceTimeMode = ref ( 0 ) / / 选 中 的 资 源 时 令 模 式 : 0 - 未 开 启 时 令 , 1 - 开 启 时 令
const Add = ( row = null ) => {
@ -1061,15 +1127,12 @@
GetList ( )
}
const Save = ( ) => {
/ / 判断 各 个 渠 道 和 是 否 等 于 总 数
/ / m a x _ t o t a l 自 动 等 于 各 渠 道 c o u n t 之 和
let tempCount = 0
PlanInfo . value . qudao _total . forEach ( ( item ) => {
tempCount = tempCount + Number ( item . count )
} )
if ( tempCount !== Number ( PlanInfo . value . max _total ) ) {
ElMessage . error ( '各个渠道数量之和与当日总量不符' )
return false
}
PlanInfo . value . max _total = tempCount
ElMessageBox . confirm (
'确定保存吗?' ,
@ -1159,10 +1222,12 @@
if ( ! channelMap . has ( ci . appointment _type _id ) ) {
channelMap . set ( ci . appointment _type _id , {
name : ci . name ,
counts : [ ]
counts : [ ] ,
locked _counts : [ ]
} )
}
channelMap . get ( ci . appointment _type _id ) . counts . push ( ci . count )
channelMap . get ( ci . appointment _type _id ) . locked _counts . push ( Number ( ci . locked _count ) || 0 )
} )
}
}
@ -1177,6 +1242,22 @@
}
batchOccupyLimits . value = limits
initBatchOccupyForm ( )
/ / 渠 道 显 示 快 照 : i d = 1 或 m a x V a l u e > 0 的 渠 道 显 示
visibleBatchOccupyChannelIds . value = new Set (
batchOccupyChannels . value
. filter ( ch => {
if ( ch . id === 1 ) return true
if ( batchOccupyLimits . value [ ch . id ] ? . maxValue > 0 ) return true
/ / 已 有 占 位 的 渠 道 也 显 示
const ci = batchOccupyChannels . value . findIndex ( c => c . id === ch . id )
if ( ci >= 0 ) {
const maxLocked = Math . max ( ... channelMap . get ( ch . id ) ? . locked _counts || [ 0 ] )
if ( maxLocked > 0 ) return true
}
return false
} )
. map ( ch => ch . id )
)
batchOccupyRunning . value = false
BatchOccupyDialogVisible . value = true
}
@ -1249,7 +1330,12 @@
PlanInfo . value . qudao _total . forEach ( ( v , i ) => {
PlanInfo . value . qudao _total [ i ] . count = 0
} )
/ / c o n s o l e . l o g ( P l a n I n f o . v a l u e )
/ / 新 增 模 式 : 只 有 医 生 渠 道 显 示
visibleChannelIds . value = new Set (
PlanInfo . value . qudao _total
. filter ( item => item . id === 1 || item . appointment _type _id === 1 )
. map ( item => item . id || item . appointment _type _id )
)
} else {
ElMessage . error ( res . msg )
}
@ -1354,6 +1440,12 @@
PlanInfo . value . max _total = res . data . qudao _total [ 0 ] . max _total
PlanInfo . value . xingqi = [ res . data . weekname ]
PlanInfo . value . devices = res . data . devices
/ / 编 辑 模 式 : i d = 1 或 c o u n t > 0 的 渠 道 显 示
visibleChannelIds . value = new Set (
PlanInfo . value . qudao _total
. filter ( item => item . id === 1 || item . appointment _type _id === 1 || Number ( item . count ) > 0 )
. map ( item => item . id || item . appointment _type _id )
)
/ / 更 新 选 中 资 源 的 时 令 模 式
const selectedResource = enableResourceList . value . find ( r => r . id === PlanInfo . value . resources _id ) ;
selectedResourceTimeMode . value = selectedResource ? ( selectedResource . time _mode || 0 ) : 0 ;
@ -1458,15 +1550,6 @@
}
}
/ / 总 量 设 置 方 式 切 换
const CountTypeChange = ( e ) => {
CountType . value = e
MaxCountChange ( 0 )
TimeLongChange ( 0 )
if ( e == 2 ) {
}
}
const handleSelectionChange = ( e ) => {
selectedPlanArr . value = [ ]
e . forEach ( ( v , i ) => {
@ -1476,42 +1559,6 @@
console . log ( selectedPlanArr . value )
}
/ / 监 听 时 长 输 入
const TimeLongChange = ( timelong ) => {
if ( CountType . value == 2 ) { / / 如 果 是 根 据 时 长 计 算 总 量
if ( PlanInfo . value . begin _time == '' || PlanInfo . value . end _time == '' ) {
ElMessage . error ( "请先设置时段" )
PlanInfo . value . max _total = 0
return false
}
ComPuteCountByTime ( timelong )
}
}
/ / 根 据 时 长 计 算 总 量
const ComPuteCountByTime = ( timelong ) => {
let count = calculateTimeSegments ( PlanInfo . value . begin _time , PlanInfo . value . end _time , timelong )
PlanInfo . value . max _total = count
MaxCountChange ( count )
}
/ / 根 据 时 间 段 和 跨 度 算 出 数 量
function calculateTimeSegments ( startTime , endTime , span ) {
/ / 将 时 间 字 符 串 转 换 为 分 钟 数
function timeToMinutes ( timeStr ) {
const [ hours , minutes ] = timeStr . split ( ':' ) . map ( Number ) ;
return hours * 60 + minutes ;
}
const startMinutes = timeToMinutes ( startTime ) ;
const endMinutes = timeToMinutes ( endTime ) ;
/ / 计 算 总 的 时 间 差 ( 以 分 钟 为 单 位 )
const totalMinutes = endMinutes - startMinutes ;
/ / 计 算 可 以 划 分 的 时 间 段 数 量
const segments = Math . floor ( totalMinutes / span ) ;
return segments ;
}
/ / 计 算 总 占 位 数 量
const getTotalLocked = ( countsInfo ) => {
if ( ! countsInfo || ! Array . isArray ( countsInfo ) ) return 0
@ -1519,6 +1566,11 @@
return total + ( Number ( item . locked _count ) || 0 )
} , 0 )
}
/ / 判 断 是 否 有 其 他 渠 道 ( 非 医 生 渠 道 ) 配 置 了 数 量
const hasOtherChannelCount = ( countsInfo ) => {
if ( ! countsInfo || ! Array . isArray ( countsInfo ) ) return false
return countsInfo . some ( ci => ci . appointment _type _id !== 1 && ( Number ( ci . count ) > 0 || Number ( ci . locked _count ) > 0 ) )
}
/ / 占 位 功 能 - 打 开 占 位 对 话 框
const OpenZhanWeiDialog = ( row ) => {
ZhanWeiDialogVisible . value = true
@ -1542,6 +1594,12 @@
item . locked _count = 0
}
} )
/ / 渠 道 显 示 快 照 : i d = 1 或 c o u n t > 0 的 渠 道 显 示
visibleZhanWeiChannelIds . value = new Set (
ZhanWeiInfo . value . qudao _total
. filter ( item => item . appointment _type _id === 1 || item . id === 1 || Number ( item . count ) > 0 || Number ( item . locked _count ) > 0 )
. map ( item => item . appointment _type _id || item . id )
)
}
} else {
ElMessage . error ( res . msg )
@ -1726,6 +1784,31 @@
margin - left : 6 px ;
}
. card _total {
display : inline - block ;
background : # 409 eff ;
color : # fff ;
font - size : 16 px ;
font - weight : 700 ;
padding : 2 px 10 px ;
border - radius : 4 px ;
}
. card _locked {
display : inline - block ;
background : # e6a23c ;
color : # fff ;
font - size : 16 px ;
font - weight : 700 ;
padding : 2 px 10 px ;
border - radius : 4 px ;
}
& . qudao _count _row _simple {
justify - content : center ;
gap : 12 px ;
}
. qudao _title _zong {
font - weight : 700 ;