|
|
|
|
@ -0,0 +1,835 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="head">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select :filterable="true" clearable v-model="searchInfo.department_id" placeholder="选择科室"
|
|
|
|
|
style="margin-left: 8px;width: 150px;">
|
|
|
|
|
<el-option v-for="(item,index) in EnableDepartmentList" :key="index"
|
|
|
|
|
:label="item.department_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select :filterable="true" clearable v-model="searchInfo.resources_id" placeholder="选择资源"
|
|
|
|
|
style="margin-left: 8px;width: 150px;">
|
|
|
|
|
<el-option v-for="(item,index) in enableResourceList" :key="index"
|
|
|
|
|
:label="item.department_resources_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select :filterable="true" clearable v-model="searchInfo.device_id" placeholder="选择服务组"
|
|
|
|
|
style="margin-left: 8px;width: 150px;">
|
|
|
|
|
<el-option v-for="(item,index) in EnableDeviceList" :key="index" :label="item.device_name"
|
|
|
|
|
:value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select :filterable="true" clearable v-model="searchInfo.xingqi" placeholder="星期"
|
|
|
|
|
style="margin-left: 8px;width: 150px;">
|
|
|
|
|
<el-option v-for="(item,index) in xingqi" :key="index" :label="item.label"
|
|
|
|
|
:value="item.label" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select :filterable="true" clearable v-model="searchInfo.status" placeholder="状态"
|
|
|
|
|
style="margin-left: 8px;width: 150px;">
|
|
|
|
|
<el-option label="正常" value="1" />
|
|
|
|
|
<el-option label="关闭" value="0" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-button @click="GetList()" style="margin-left: 10px;">搜索</el-button>
|
|
|
|
|
<el-button type="primary" @click="Add()" style="margin-left: 10px;">添加</el-button>
|
|
|
|
|
<el-button type="danger" @click="Del()" style="margin-left: 10px;">删除</el-button>
|
|
|
|
|
<el-button type="success" @click="CreatedPlanClick()" style="margin-left: 20px;">生成选中的计划</el-button>
|
|
|
|
|
</el-row>
|
|
|
|
|
</div>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-radio-group style="margin-bottom: 8px;" v-model="searchInfo.date_type"
|
|
|
|
|
@change="DateTypeChange()">
|
|
|
|
|
<el-radio-button :label="1">工作日</el-radio-button>
|
|
|
|
|
<el-radio-button :label="2">节假日</el-radio-button>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table :data="tableData" :span-method="arraySpanMethod" border style="width: 100%;" row-key="id"
|
|
|
|
|
v-loading="loading" @selection-change="handleSelectionChange">
|
|
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
|
|
<el-table-column prop="id" label="Id" width="70" />
|
|
|
|
|
<el-table-column prop="weekname" label="星期" width="80" v-if="searchInfo.date_type==1"/>
|
|
|
|
|
<el-table-column prop="resources_id" label="" v-if="false" />
|
|
|
|
|
<el-table-column prop="department_resources_name" label="资源" width="150" />
|
|
|
|
|
<el-table-column prop="" label="服务组" show-overflow-tooltip width="150">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<div class="type_count" v-if="scope.row.devices.length>0">
|
|
|
|
|
<div v-for="(item,index) in scope.row.devices" :key="index"
|
|
|
|
|
:class="(item.status==1 && item.is_del==0) ? '':'hongzi'">{{ item.device_name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="period_name" label="时段" width="100" />
|
|
|
|
|
<el-table-column prop="begin_time" label="开始时间" width="100" />
|
|
|
|
|
<el-table-column prop="end_time" label="结束时间" width="100" />
|
|
|
|
|
<el-table-column prop="" label="类型数量" show-overflow-tooltip>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<div class="type_count" v-if="scope.row.countsInfo.length>0">
|
|
|
|
|
<div style="font-weight: 700">最大数量:{{ scope.row.countsInfo[0].max_total }}</div>
|
|
|
|
|
<div v-for="(item,index) in scope.row.countsInfo" :key="index">{{ item.name }}:{{ item.count
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="end_reservation_time" label="预约截止时间" width="120" />
|
|
|
|
|
<!-- <el-table-column prop="time_unit" label="可用时长" width="80" /> -->
|
|
|
|
|
<el-table-column prop="roster_status" label="状态" width="80">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag v-if="scope.row.status === 1" class="ml-2" type="success">正常</el-tag>
|
|
|
|
|
<el-tag v-if="scope.row.status === 0" class="ml-2" type="danger">关闭</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column prop="" label="操作" width="80">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button type="primary" @click="Add(scope.row)" size="small" style="margin-left: 10px;">修改
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- <div class="page">
|
|
|
|
|
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
|
|
|
|
|
:page-sizes="[15, 50, 100, 200]" layout="total,sizes, prev, pager, next" :total="total"
|
|
|
|
|
@size-change="PageSizeChange" @current-change="PageCurrentChange" />
|
|
|
|
|
</div> -->
|
|
|
|
|
<el-dialog v-model="dialogVisible" :title="'时间段('+date_type_name+')'" width="45%">
|
|
|
|
|
<el-form ref="PlanInfoForm" :model="PlanInfo" label-width="100px" v-loading="loading"
|
|
|
|
|
style="padding-right: 40px;">
|
|
|
|
|
<el-form-item label="星期:" prop="xingqi" v-if="searchInfo.date_type==1">
|
|
|
|
|
<el-checkbox :disabled="PlanInfo.id==0?false:true" style="margin-right: 8px;" v-model="CheckedAll"
|
|
|
|
|
@change="CheckedAllFunc" label="全选"><span style="font-weight: 700;color: #409eff;">全选</span>
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
<el-checkbox-group v-model="PlanInfo.xingqi">
|
|
|
|
|
<el-checkbox :disabled="PlanInfo.id==0?false:true" v-for="(item, index) in xingqi" :key="index"
|
|
|
|
|
:label="item.label">{{ item.label }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="渠道名额:">
|
|
|
|
|
<div style="margin-right: 26px">
|
|
|
|
|
<div>
|
|
|
|
|
<el-radio-group v-model="CountType" @change="CountTypeChange">
|
|
|
|
|
<el-radio label="1">根据总量</el-radio>
|
|
|
|
|
<el-radio style="margin-left: -10px;" label="2">根据时长(分钟)</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</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="1" placeholder="0"
|
|
|
|
|
oninput="value=value.replace(/^0|[^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="1"
|
|
|
|
|
placeholder="0" oninput="value=value.replace(/^0|[^0-9]/g, '')" />
|
|
|
|
|
<div style="margin-left: 4px; color: #ccc;">{{item.ratio}}%</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="时间设置:">
|
|
|
|
|
<div>选择时段:
|
|
|
|
|
<el-select :filterable="true" clearable v-model="PlanInfo.period_id" @change="timePeriodChange"
|
|
|
|
|
placeholder="选择时段" style="width: 200px;margin-left: 8px;margin-bottom: 4px">
|
|
|
|
|
<el-option v-for="(item,index) in TimePeriodList" :key="index" :label="item.period_name"
|
|
|
|
|
:value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
<div style="display:flex;">
|
|
|
|
|
<div>
|
|
|
|
|
<div style="display:flex;">
|
|
|
|
|
<div style="width: 70px">开始时间:</div>
|
|
|
|
|
<div class="qudao_k_input">
|
|
|
|
|
<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="结束时间" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin-left: 8px">
|
|
|
|
|
<div style="display:flex;">
|
|
|
|
|
<div style="width: 90px">停止预约时间:</div>
|
|
|
|
|
<div class="qudao_k_input">
|
|
|
|
|
<el-input v-model="PlanInfo.end_reservation_time" placeholder="停止预约时间" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="display:flex;">
|
|
|
|
|
<div style="width: 90px">可用时间长度:</div>
|
|
|
|
|
<div class="qudao_k_input">
|
|
|
|
|
<el-input v-model="PlanInfo.time_unit" placeholder="可用时间长度" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="资源:">
|
|
|
|
|
<el-select :filterable="true" clearable v-model="PlanInfo.resources_id" @change="resourceChange"
|
|
|
|
|
placeholder="选择资源" style="width: 200px;margin-left: 8px;margin-bottom: 4px">
|
|
|
|
|
<el-option v-for="(item,index) in enableResourceList" :key="index"
|
|
|
|
|
:label="item.department_resources_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="服务组:" v-if="devicesList.length>0">
|
|
|
|
|
<div v-if="devicesList.length>1" style="width: 100%;font-size: 12px;color: #999;">
|
|
|
|
|
此诊室包含多台设备,如同时勾选多个,被勾选设备将共同占用分配的名额。如需为设备单独分配名额,请单独勾选(推荐)</div>
|
|
|
|
|
<el-checkbox-group v-model="PlanInfo.devices">
|
|
|
|
|
<el-checkbox v-for="(item,index) in devicesList" :key="index"
|
|
|
|
|
:label="item.id">{{ item.device_name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="病人类型:">
|
|
|
|
|
<el-checkbox-group v-model="PlanInfo.patientType">
|
|
|
|
|
<el-checkbox label="0">住院</el-checkbox>
|
|
|
|
|
<el-checkbox label="1">门诊</el-checkbox>
|
|
|
|
|
<el-checkbox label="2">急诊</el-checkbox>
|
|
|
|
|
<el-checkbox label="3">体检</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="状态:">
|
|
|
|
|
<el-switch v-model="PlanInfo.status" size="large" active-text="正常" inactive-text="关闭"
|
|
|
|
|
:active-value="1" :inactive-value="0" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="Save">
|
|
|
|
|
确定
|
|
|
|
|
</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<!-- 生成时选择时间段-->
|
|
|
|
|
<el-dialog v-model="CreatePlanDialogVisible" title="生成计划" width="50%">
|
|
|
|
|
<el-form label-width="100px" v-loading="loading" style="padding-right: 40px;">
|
|
|
|
|
<el-form-item label="选择时间范围:">
|
|
|
|
|
<el-date-picker v-model="dateRange" type="daterange" range-separator="To" start-placeholder="开始时间"
|
|
|
|
|
end-placeholder="结束时间" value-format="YYYY-MM-DD" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="节假日生成:">
|
|
|
|
|
<el-switch v-model="HolidayEnable" size="large" active-text="是" inactive-text="否"
|
|
|
|
|
:active-value="1" :inactive-value="0" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="CreatePlanDialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="CreatedPlanAction">
|
|
|
|
|
确定
|
|
|
|
|
</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
onMounted
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import {
|
|
|
|
|
PlanModelSave,
|
|
|
|
|
PlanModelGetList,
|
|
|
|
|
GetEnableDepartmentList,
|
|
|
|
|
GetAppointmentRatio,
|
|
|
|
|
TimePeriodGetEnableList,
|
|
|
|
|
TimePeriodGetDetail,
|
|
|
|
|
DepartmentResourceGetEnableList,
|
|
|
|
|
ResourceGetBindDeviceList,
|
|
|
|
|
GetPlanModelDetailInfo,
|
|
|
|
|
PlanModelDel,
|
|
|
|
|
GetEnableDeviceList,
|
|
|
|
|
CreatePlanList,
|
|
|
|
|
GetServiceDateTime
|
|
|
|
|
} from '@/api/api.js'
|
|
|
|
|
import {
|
|
|
|
|
ElMessage,
|
|
|
|
|
ElMessageBox
|
|
|
|
|
} from 'element-plus'
|
|
|
|
|
let CountType = ref("1"); //渠道数量设置方式
|
|
|
|
|
let loading = ref(false)
|
|
|
|
|
let tableData = ref([])
|
|
|
|
|
let currentPage = ref(1) //当前页码
|
|
|
|
|
let pageSize = ref(15) //每页数量
|
|
|
|
|
let total = 0 //总数量
|
|
|
|
|
const PageSizeChange = (e) => { // 修改每页数量
|
|
|
|
|
pageSize.value = e
|
|
|
|
|
GetList()
|
|
|
|
|
}
|
|
|
|
|
const PageCurrentChange = (e) => { //切换页码
|
|
|
|
|
currentPage.value = e
|
|
|
|
|
GetList()
|
|
|
|
|
}
|
|
|
|
|
let tableSelected = ref([])
|
|
|
|
|
const handleSelectionChange = (e) => {
|
|
|
|
|
tableSelected.value = e
|
|
|
|
|
}
|
|
|
|
|
let dateRange = ref([]) //生成计划明细时,选择的日期范围
|
|
|
|
|
let CreatePlanDialogVisible = ref(false)
|
|
|
|
|
const CreatedPlanClick = () => { //点击生成计划明细按钮
|
|
|
|
|
if (tableSelected.value.length === 0) {
|
|
|
|
|
ElMessage.error("请至少勾选1条记录")
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
CreatePlanDialogVisible.value = true;
|
|
|
|
|
}
|
|
|
|
|
const CreatedPlanAction = () => { //调用生成计划明细接口
|
|
|
|
|
if (dateRange.value.length === 0) {
|
|
|
|
|
ElMessage.error("请选择日期范围")
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
let ids = [];
|
|
|
|
|
tableSelected.value.forEach((v, i) => {
|
|
|
|
|
ids.push(v.id)
|
|
|
|
|
})
|
|
|
|
|
CreatePlanList({
|
|
|
|
|
dateRange: dateRange.value,
|
|
|
|
|
ids: ids,
|
|
|
|
|
HolidayEnable:HolidayEnable.value,
|
|
|
|
|
date_type:searchInfo.value.date_type
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (res.status) {
|
|
|
|
|
CreatePlanDialogVisible.value = false;
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: res.msg,
|
|
|
|
|
type: 'success',
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
ElMessageBox.alert(res.msg, '提示', {
|
|
|
|
|
// if you want to disable its autofocus
|
|
|
|
|
// autofocus: false,
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let searchInfo = ref({
|
|
|
|
|
department_id: null,
|
|
|
|
|
resources_id: null,
|
|
|
|
|
device_id: null,
|
|
|
|
|
xingqi: null,
|
|
|
|
|
status: null,
|
|
|
|
|
})
|
|
|
|
|
let HolidayEnable=ref(1)
|
|
|
|
|
let date_type_name =ref('工作日')
|
|
|
|
|
let dialogVisible = ref(false)
|
|
|
|
|
const GetList = () => {
|
|
|
|
|
PlanModelGetList({
|
|
|
|
|
page: currentPage.value,
|
|
|
|
|
pageSize: pageSize.value,
|
|
|
|
|
searchInfo: searchInfo.value
|
|
|
|
|
}).then(res => {
|
|
|
|
|
tableData.value = res.data.list
|
|
|
|
|
total = res.data.count
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let xingqi = ref([{
|
|
|
|
|
label: '星期一',
|
|
|
|
|
value: 1
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期二',
|
|
|
|
|
value: 2
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期三',
|
|
|
|
|
value: 3
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期四',
|
|
|
|
|
value: 4
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期五',
|
|
|
|
|
value: 5
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期六',
|
|
|
|
|
value: 6
|
|
|
|
|
}, {
|
|
|
|
|
label: '星期日',
|
|
|
|
|
value: 7
|
|
|
|
|
}])
|
|
|
|
|
let PlanInfoForm = ref(null)
|
|
|
|
|
const DataDefault = () => {
|
|
|
|
|
return {
|
|
|
|
|
id: 0,
|
|
|
|
|
xingqi: [],
|
|
|
|
|
max_total: 0,
|
|
|
|
|
qudao_total: [],
|
|
|
|
|
period_id: null,
|
|
|
|
|
begin_time: '',
|
|
|
|
|
end_time: '',
|
|
|
|
|
end_reservation_time: '',
|
|
|
|
|
time_unit: 0, //可用时长
|
|
|
|
|
resources_id: null,
|
|
|
|
|
devices: [],
|
|
|
|
|
patientType: [],
|
|
|
|
|
status: 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let PlanInfo = ref(DataDefault())
|
|
|
|
|
|
|
|
|
|
const Add = (row = null) => {
|
|
|
|
|
devicesList.value=[]
|
|
|
|
|
CheckedAll.value = false
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
PlanInfo.value = DataDefault()
|
|
|
|
|
|
|
|
|
|
GetRatio()
|
|
|
|
|
GetEnableTimePeriod()
|
|
|
|
|
getEnableResource()
|
|
|
|
|
if (row) {
|
|
|
|
|
PlanInfo.value.resources_id = row.resources_id
|
|
|
|
|
resourceChange()
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
console.log('编辑')
|
|
|
|
|
GetDetailInfo(row.id)
|
|
|
|
|
}, 500)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const DateTypeChange=()=>{
|
|
|
|
|
if(searchInfo.value.date_type==1) date_type_name.value='工作日'
|
|
|
|
|
if(searchInfo.value.date_type==2) date_type_name.value='节假日'
|
|
|
|
|
GetList()
|
|
|
|
|
}
|
|
|
|
|
const Save = () => {
|
|
|
|
|
// console.log(PlanInfo.value)
|
|
|
|
|
//判断各个渠道和是否等于总数
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
|
'确定保存吗?',
|
|
|
|
|
'提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.then(() => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
PlanModelSave({
|
|
|
|
|
date_type:searchInfo.value.date_type,
|
|
|
|
|
planInfo: PlanInfo.value
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
GetList()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const Del = () => {
|
|
|
|
|
if (tableSelected.value.length == 0) {
|
|
|
|
|
ElMessage.error("请至少勾选1条记录")
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
let ids = []
|
|
|
|
|
tableSelected.value.map((item) => {
|
|
|
|
|
ids.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
|
'确定删除吗?',
|
|
|
|
|
'提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
}
|
|
|
|
|
).then(() => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
PlanModelDel({
|
|
|
|
|
ids: ids
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: res.msg,
|
|
|
|
|
type: 'success',
|
|
|
|
|
})
|
|
|
|
|
GetList()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取可用服务组
|
|
|
|
|
let EnableDeviceList = ref([])
|
|
|
|
|
const GetEnableDeviceListFunc = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetEnableDeviceList().then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
EnableDeviceList.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let EnableDepartmentList = ref([])
|
|
|
|
|
const GetDepartmentEnableList = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetEnableDepartmentList({}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
EnableDepartmentList.value = res.data.list
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取当前科室各个渠道可预约百分比
|
|
|
|
|
const GetRatio = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetAppointmentRatio({}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
PlanInfo.value.qudao_total = res.data
|
|
|
|
|
PlanInfo.value.qudao_total.forEach((v, i) => {
|
|
|
|
|
PlanInfo.value.qudao_total[i].count = 0
|
|
|
|
|
})
|
|
|
|
|
// console.log(PlanInfo.value)
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//监听最大值输入
|
|
|
|
|
const MaxCountChange = (e) => {
|
|
|
|
|
if (e === '' || e == null || e === 0) {
|
|
|
|
|
PlanInfo.value.max_total = 0
|
|
|
|
|
}
|
|
|
|
|
let temp = 0
|
|
|
|
|
let qudao_count = PlanInfo.value.qudao_total.length
|
|
|
|
|
console.log(PlanInfo.value.qudao_total)
|
|
|
|
|
for (let i = 0; i < qudao_count; i++) {
|
|
|
|
|
if (PlanInfo.value.qudao_total[i].ratio === 0) continue;
|
|
|
|
|
PlanInfo.value.qudao_total[i].count = Math.round(PlanInfo.value.max_total * (PlanInfo.value.qudao_total[i]
|
|
|
|
|
.ratio / 100))
|
|
|
|
|
temp = temp + PlanInfo.value.qudao_total[i].count
|
|
|
|
|
//如果各个渠道的总和与设置的总数不一致,最后1项适当加减,平衡总数
|
|
|
|
|
if (i === qudao_count - 1 && temp !== PlanInfo.value.max_total) {
|
|
|
|
|
let bodongzhi = temp - PlanInfo.value.max_total;
|
|
|
|
|
// PlanInfo.value.qudao_total[i].count = PlanInfo.value.qudao_total[i].count - (temp - PlanInfo.value.max_total)
|
|
|
|
|
// if(PlanInfo.value.qudao_total[i].count<0) {
|
|
|
|
|
// PlanInfo.value.qudao_total[i].count=0
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
PlanInfo.value.qudao_total.sort((a, b) => a.ratio - b.ratio);
|
|
|
|
|
|
|
|
|
|
// 遍历排序后的数组,找到第一个非零项
|
|
|
|
|
let minRatioItem = null;
|
|
|
|
|
for (let ii = 0; ii < PlanInfo.value.qudao_total.length; ii++) {
|
|
|
|
|
if (PlanInfo.value.qudao_total[ii].count !== 0) {
|
|
|
|
|
minRatioItem = PlanInfo.value.qudao_total[ii];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取最小且非零项在原数组中的位置
|
|
|
|
|
let index = PlanInfo.value.qudao_total.indexOf(minRatioItem);
|
|
|
|
|
console.log("最小且非零项在原数组中的位置:", index);
|
|
|
|
|
console.log(bodongzhi);
|
|
|
|
|
if (bodongzhi > 0) {
|
|
|
|
|
PlanInfo.value.qudao_total[index].count = PlanInfo.value.qudao_total[index].count - bodongzhi
|
|
|
|
|
}
|
|
|
|
|
if (bodongzhi < 0 && index > 0) {
|
|
|
|
|
PlanInfo.value.qudao_total[index - 1].count = PlanInfo.value.qudao_total[index - 1].count -
|
|
|
|
|
bodongzhi
|
|
|
|
|
}
|
|
|
|
|
if (bodongzhi < 0 && index == 0) {
|
|
|
|
|
PlanInfo.value.qudao_total[index].count = PlanInfo.value.qudao_total[index].count - bodongzhi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlanInfo.value.qudao_total.sort((a, b) => b.ratio - a.ratio);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取可用的时间段
|
|
|
|
|
let TimePeriodList = ref([])
|
|
|
|
|
const GetEnableTimePeriod = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
TimePeriodGetEnableList({date_type:searchInfo.value.date_type}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
TimePeriodList.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//选择时间段
|
|
|
|
|
const timePeriodChange = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
TimePeriodGetDetail({
|
|
|
|
|
id: PlanInfo.value.period_id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
PlanInfo.value.begin_time = res.data.period_begin_time
|
|
|
|
|
PlanInfo.value.end_time = res.data.period_end_time
|
|
|
|
|
PlanInfo.value.end_reservation_time = res.data.period_deadline
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取计划详情
|
|
|
|
|
const GetDetailInfo = (id) => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetPlanModelDetailInfo({
|
|
|
|
|
id: id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
PlanInfo.value = res.data
|
|
|
|
|
PlanInfo.value.max_total = res.data.qudao_total[0].max_total
|
|
|
|
|
PlanInfo.value.xingqi = [res.data.weekname]
|
|
|
|
|
PlanInfo.value.devices = res.data.devices
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取可用资源列表
|
|
|
|
|
let enableResourceList = ref([])
|
|
|
|
|
const getEnableResource = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
DepartmentResourceGetEnableList().then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
enableResourceList.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//切换资源
|
|
|
|
|
let devicesList = ref([])
|
|
|
|
|
const resourceChange = () => {
|
|
|
|
|
PlanInfo.value.devices = [];
|
|
|
|
|
loading.value = true
|
|
|
|
|
ResourceGetBindDeviceList({
|
|
|
|
|
resource_id: PlanInfo.value.resources_id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
devicesList.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取当月日期范围
|
|
|
|
|
const setMonthRange = () => {
|
|
|
|
|
GetServiceDateTime().then(res => {
|
|
|
|
|
if (res.status) {
|
|
|
|
|
let currentdate = res.data.datetime.substring(0, 10)
|
|
|
|
|
var date = new Date(currentdate);
|
|
|
|
|
|
|
|
|
|
// 获取当前月份(注意:JavaScript中的月份是从0开始计数的)
|
|
|
|
|
var currentMonth = date.getMonth();
|
|
|
|
|
|
|
|
|
|
// 计算下个月的月份,考虑到12月后应跳转到次年1月
|
|
|
|
|
var nextMonthMonth = (currentMonth + 1) % 12;
|
|
|
|
|
var nextMonthYear = date.getFullYear() + ((currentMonth + 1) / 12 | 0); // 处理年份的进位
|
|
|
|
|
|
|
|
|
|
// 获取当前日期的日
|
|
|
|
|
var currentDay = date.getDate();
|
|
|
|
|
|
|
|
|
|
// 创建下个月的同一天日期对象,需检查下月是否有同日,若无则调整至下月最后一天
|
|
|
|
|
var nextMonthSameDay = new Date(nextMonthYear, nextMonthMonth, currentDay);
|
|
|
|
|
|
|
|
|
|
// 检查是否需要调整到下月的最后一天(例如,3月31日到4月没有31日)
|
|
|
|
|
if (nextMonthSameDay.getMonth() !== nextMonthMonth) {
|
|
|
|
|
// 如果构造的日期月份变了,说明原日超出下月范围,应调整为下月最后一天
|
|
|
|
|
nextMonthSameDay = new Date(nextMonthYear, nextMonthMonth, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 返回格式化的日期字符串,可根据需要调整格式
|
|
|
|
|
let nextMonth = nextMonthSameDay.toISOString().split('T')[0]; // 默认返回YYYY-MM-DD格式
|
|
|
|
|
dateRange.value = [currentdate, nextMonth];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let CheckedAll = ref(false);
|
|
|
|
|
//星期全选事件
|
|
|
|
|
const CheckedAllFunc = (e) => {
|
|
|
|
|
if (e) {
|
|
|
|
|
PlanInfo.value.xingqi = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'];
|
|
|
|
|
} else {
|
|
|
|
|
PlanInfo.value.xingqi = []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//合并显示
|
|
|
|
|
let bb_countRowspan = 1;
|
|
|
|
|
const arraySpanMethod = ({
|
|
|
|
|
row,
|
|
|
|
|
column,
|
|
|
|
|
rowIndex,
|
|
|
|
|
columnIndex,
|
|
|
|
|
}) => {
|
|
|
|
|
|
|
|
|
|
const fields = ['weekname']
|
|
|
|
|
const cellValue = row[column.property]
|
|
|
|
|
let countRowspan = 1
|
|
|
|
|
|
|
|
|
|
if (cellValue && fields.includes(column.property)) {
|
|
|
|
|
const prevRow = tableData.value[rowIndex - 1]
|
|
|
|
|
let nextRow = tableData.value[rowIndex + 1]
|
|
|
|
|
if (prevRow && prevRow[column.property] === cellValue && prevRow.declareRegion == row.declareRegion) {
|
|
|
|
|
bb_countRowspan = countRowspan
|
|
|
|
|
return {
|
|
|
|
|
rowspan: 0,
|
|
|
|
|
colspan: 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
while (nextRow && nextRow[column.property] === cellValue && nextRow.declareRegion == row
|
|
|
|
|
.declareRegion) {
|
|
|
|
|
nextRow = tableData.value[++countRowspan + rowIndex]
|
|
|
|
|
}
|
|
|
|
|
if (countRowspan > 1) {
|
|
|
|
|
bb_countRowspan = countRowspan
|
|
|
|
|
return {
|
|
|
|
|
rowspan: countRowspan,
|
|
|
|
|
colspan: 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// if (columnIndex === 3) {
|
|
|
|
|
// if (bb_countRowspan > 1) {
|
|
|
|
|
// return {
|
|
|
|
|
// rowspan: bb_countRowspan,
|
|
|
|
|
// colspan: 1
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// return {
|
|
|
|
|
// rowspan: 0,
|
|
|
|
|
// colspan: 0
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//总量设置方式切换
|
|
|
|
|
const CountTypeChange = (e) => {
|
|
|
|
|
CountType.value = e
|
|
|
|
|
MaxCountChange(0)
|
|
|
|
|
TimeLongChange(0)
|
|
|
|
|
if (e == 2) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//监听时长输入
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
searchInfo.value.date_type=1
|
|
|
|
|
GetList()
|
|
|
|
|
GetDepartmentEnableList()
|
|
|
|
|
getEnableResource()
|
|
|
|
|
GetEnableDeviceListFunc()
|
|
|
|
|
setMonthRange()
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.type_count {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.type_count div {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.qudao_k {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.qudao_k_input {
|
|
|
|
|
width: 150px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.hongzi {
|
|
|
|
|
color: #b25252;
|
|
|
|
|
}
|
|
|
|
|
</style>
|