|
|
|
|
@ -243,51 +243,15 @@
|
|
|
|
|
:label="item.department_resources_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="PlanInfo.resources_id" label="时令:">
|
|
|
|
|
<div>
|
|
|
|
|
<el-switch v-model="PlanInfo.timeMode" size="large" active-text="开启" inactive-text="关闭" :active-value="1" :inactive-value="0" @change="timeModeChange"/>
|
|
|
|
|
|
|
|
|
|
<el-radio-group v-if="PlanInfo.timeMode==1" v-model="PlanInfo.type" style="margin-left: 20px;">
|
|
|
|
|
<el-radio-button label="1">夏令时</el-radio-button>
|
|
|
|
|
<el-radio-button style="margin-left: -10px;" label="2">冬令时</el-radio-button>
|
|
|
|
|
<el-form-item label="时令:" v-if="selectedResourceTimeMode === 1 && searchInfo.date_type === 1">
|
|
|
|
|
<el-radio-group v-model="PlanInfo.type">
|
|
|
|
|
<el-radio :label="1">
|
|
|
|
|
<span style="color: #E6A23C;">夏令时</span>
|
|
|
|
|
</el-radio>
|
|
|
|
|
<el-radio :label="2">
|
|
|
|
|
<span style="color: #409EFF;">冬令时</span>
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-if="PlanInfo.timeMode==1" style="margin-top: 16px;">
|
|
|
|
|
<!-- 根据选择的类型显示对应的时令配置 -->
|
|
|
|
|
<div v-for="(season, seasonIndex) in timeRangeList.filter(s => (PlanInfo.type == 1 && s.type == 'summer') || (PlanInfo.type == 2 && s.type == 'winter'))" :key="season.type" style="margin-bottom: 16px;">
|
|
|
|
|
<div style="font-weight: bold; margin-bottom: 8px;">{{ season.type_name }}</div>
|
|
|
|
|
<div v-for="(period, periodIndex) in season.periods" :key="periodIndex" style="display: flex; align-items: center; margin-bottom: 8px;">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="season.periods[periodIndex]"
|
|
|
|
|
type="daterange"
|
|
|
|
|
format="MM-DD"
|
|
|
|
|
value-format="MM-DD"
|
|
|
|
|
range-separator="至"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
style="width: 400px;"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
type="danger"
|
|
|
|
|
:icon="Delete"
|
|
|
|
|
@click="deleteRange(season.type, periodIndex)"
|
|
|
|
|
:disabled="season.periods.length <= 1"
|
|
|
|
|
size="small"
|
|
|
|
|
plain
|
|
|
|
|
circle
|
|
|
|
|
style="margin-left: 8px;"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<el-button type="primary" @click="addRange(season.type)" size="small">
|
|
|
|
|
新增{{ season.type_name }}周期
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin-left: 18px;color: #ff8b7c;">
|
|
|
|
|
注意:调整时令,会影响该资源下全部模板
|
|
|
|
|
</div>
|
|
|
|
|
</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;">
|
|
|
|
|
@ -368,7 +332,7 @@
|
|
|
|
|
ElMessage,
|
|
|
|
|
ElMessageBox
|
|
|
|
|
} from 'element-plus'
|
|
|
|
|
import { Delete } from '@element-plus/icons-vue'
|
|
|
|
|
|
|
|
|
|
let CountType = ref("1"); //渠道数量设置方式
|
|
|
|
|
let loading = ref(false)
|
|
|
|
|
let currentPage = ref(1) //当前页码
|
|
|
|
|
@ -390,80 +354,6 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const timeRangeList = ref([
|
|
|
|
|
{
|
|
|
|
|
type: 'summer',
|
|
|
|
|
type_name: '夏季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'winter',
|
|
|
|
|
type_name: '冬季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 新增一组时间范围
|
|
|
|
|
const addRange = (seasonType) => {
|
|
|
|
|
const season = timeRangeList.value.find(s => s.type === seasonType)
|
|
|
|
|
if (season) {
|
|
|
|
|
season.periods.push(['', ''])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除指定组
|
|
|
|
|
const deleteRange = (seasonType, periodIndex) => {
|
|
|
|
|
const season = timeRangeList.value.find(s => s.type === seasonType)
|
|
|
|
|
if (season && season.periods.length > 1) {
|
|
|
|
|
season.periods.splice(periodIndex, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 将数组格式转换为对象格式(用于保存)
|
|
|
|
|
const convertPeriodsToObjects = (periods) => {
|
|
|
|
|
return periods.map(period => ({
|
|
|
|
|
start: period[0],
|
|
|
|
|
end: period[1]
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 将对象格式转换为数组格式(用于显示)
|
|
|
|
|
const convertPeriodsToArrays = (periods) => {
|
|
|
|
|
return periods.map(period => [period.start, period.end])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const timeModeChange = (e) => {
|
|
|
|
|
if (e == 0) {
|
|
|
|
|
// 关闭时令:重置为默认结构
|
|
|
|
|
timeRangeList.value = [
|
|
|
|
|
{
|
|
|
|
|
type: 'summer',
|
|
|
|
|
type_name: '夏季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'winter',
|
|
|
|
|
type_name: '冬季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
if (e == 1) {
|
|
|
|
|
// 开启时令:从资源配置加载已有的时令数据
|
|
|
|
|
if (PlanInfo.value.resources_id) {
|
|
|
|
|
const resource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id)
|
|
|
|
|
if (resource && resource.time_range) {
|
|
|
|
|
// 转换对象格式为数组格式
|
|
|
|
|
timeRangeList.value = resource.time_range.map(season => ({
|
|
|
|
|
type: season.type,
|
|
|
|
|
type_name: season.type_name,
|
|
|
|
|
periods: convertPeriodsToArrays(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let dateRange = ref([]) //生成计划明细时,选择的日期范围
|
|
|
|
|
let CreatePlanDialogVisible = ref(false)
|
|
|
|
|
@ -673,7 +563,7 @@
|
|
|
|
|
const DataDefault = () => {
|
|
|
|
|
return {
|
|
|
|
|
id: 0,
|
|
|
|
|
type: 1, // 1夏令时 2冬令时
|
|
|
|
|
type: 0, //0默认未开启夏时令 1夏令时 2冬令时
|
|
|
|
|
xingqi: [],
|
|
|
|
|
max_total: 0,
|
|
|
|
|
qudao_total: [],
|
|
|
|
|
@ -683,34 +573,20 @@
|
|
|
|
|
end_reservation_time: '',
|
|
|
|
|
time_unit: 0, //可用时长
|
|
|
|
|
resources_id: null,
|
|
|
|
|
timeMode: 0,
|
|
|
|
|
devices: [],
|
|
|
|
|
patientType: [],
|
|
|
|
|
status: 1,
|
|
|
|
|
timeRanges: [] // 时令数据(保存时用)
|
|
|
|
|
status: 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let PlanInfo = ref(DataDefault())
|
|
|
|
|
let selectedResourceTimeMode = ref(0) // 选中的资源时令模式:0-未开启时令,1-开启时令
|
|
|
|
|
|
|
|
|
|
const Add = (row = null) => {
|
|
|
|
|
devicesList.value = []
|
|
|
|
|
CheckedAll.value = false
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
PlanInfo.value = DataDefault()
|
|
|
|
|
|
|
|
|
|
// 重置时令数据
|
|
|
|
|
timeRangeList.value = [
|
|
|
|
|
{
|
|
|
|
|
type: 'summer',
|
|
|
|
|
type_name: '夏季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'winter',
|
|
|
|
|
type_name: '冬季排班',
|
|
|
|
|
periods: [['', '']]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
selectedResourceTimeMode.value = 0 // 重置时令模式
|
|
|
|
|
|
|
|
|
|
GetRatio()
|
|
|
|
|
GetEnableTimePeriod()
|
|
|
|
|
@ -755,17 +631,6 @@
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果开启了时令,将时令数据转换为对象格式并添加到 PlanInfo
|
|
|
|
|
if (PlanInfo.value.timeMode === 1) {
|
|
|
|
|
PlanInfo.value.timeRanges = timeRangeList.value.map(season => ({
|
|
|
|
|
type: season.type,
|
|
|
|
|
type_name: season.type_name,
|
|
|
|
|
periods: convertPeriodsToObjects(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
} else {
|
|
|
|
|
PlanInfo.value.timeRanges = []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
|
'确定保存吗?',
|
|
|
|
|
'提示', {
|
|
|
|
|
@ -776,6 +641,7 @@
|
|
|
|
|
)
|
|
|
|
|
.then(() => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
|
|
|
|
PlanModelSave({
|
|
|
|
|
date_type: searchInfo.value.date_type,
|
|
|
|
|
planInfo: PlanInfo.value
|
|
|
|
|
@ -964,30 +830,9 @@
|
|
|
|
|
PlanInfo.value.max_total = res.data.qudao_total[0].max_total
|
|
|
|
|
PlanInfo.value.xingqi = [res.data.weekname]
|
|
|
|
|
PlanInfo.value.devices = res.data.devices
|
|
|
|
|
|
|
|
|
|
// 加载时令数据
|
|
|
|
|
if (res.data.timeRanges && res.data.timeRanges.length > 0) {
|
|
|
|
|
// 转换对象格式为数组格式
|
|
|
|
|
timeRangeList.value = res.data.timeRanges.map(season => ({
|
|
|
|
|
type: season.type,
|
|
|
|
|
type_name: season.type_name,
|
|
|
|
|
periods: convertPeriodsToArrays(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
PlanInfo.value.timeMode = 1
|
|
|
|
|
} else {
|
|
|
|
|
// 从资源配置加载时令数据
|
|
|
|
|
const resource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id)
|
|
|
|
|
if (resource && resource.time_mode === 1 && resource.time_range) {
|
|
|
|
|
PlanInfo.value.timeMode = 1
|
|
|
|
|
timeRangeList.value = resource.time_range.map(season => ({
|
|
|
|
|
type: season.type,
|
|
|
|
|
type_name: season.type_name,
|
|
|
|
|
periods: convertPeriodsToArrays(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
} else {
|
|
|
|
|
PlanInfo.value.timeMode = 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 更新选中资源的时令模式
|
|
|
|
|
const selectedResource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id);
|
|
|
|
|
selectedResourceTimeMode.value = selectedResource ? (selectedResource.time_mode || 0) : 0;
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
@ -1023,6 +868,11 @@
|
|
|
|
|
let devicesList = ref([])
|
|
|
|
|
const resourceChange = () => {
|
|
|
|
|
PlanInfo.value.devices = [];
|
|
|
|
|
// 更新选中资源的时令模式
|
|
|
|
|
const selectedResource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id);
|
|
|
|
|
selectedResourceTimeMode.value = selectedResource ? (selectedResource.time_mode || 0) : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
ResourceGetBindDeviceList({
|
|
|
|
|
resource_id: PlanInfo.value.resources_id
|
|
|
|
|
@ -1030,20 +880,6 @@
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
devicesList.value = res.data
|
|
|
|
|
|
|
|
|
|
// 根据资源的 time_mode 设置时令开关状态
|
|
|
|
|
const resource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id)
|
|
|
|
|
if (resource) {
|
|
|
|
|
PlanInfo.value.timeMode = resource.time_mode
|
|
|
|
|
// 如果开启了时令,加载时令数据
|
|
|
|
|
if (resource.time_mode === 1 && resource.time_range) {
|
|
|
|
|
timeRangeList.value = resource.time_range.map(season => ({
|
|
|
|
|
type: season.type,
|
|
|
|
|
type_name: season.type_name,
|
|
|
|
|
periods: convertPeriodsToArrays(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|