main
岩仔88 1 week ago
parent 9672a12ae9
commit ff7c1eb579

@ -195,9 +195,18 @@ class PlanModelController extends Controller
$userInfo = DB::table('users')->where(['id' => $userid])->first(); $userInfo = DB::table('users')->where(['id' => $userid])->first();
if (!isset($userInfo->department_id)) return \Yz::echoError1('该用户未绑定科室'); if (!isset($userInfo->department_id)) return \Yz::echoError1('该用户未绑定科室');
$department_id = $userInfo->department_id; $department_id = $userInfo->department_id;
$type=isset($planInfo['type']) ?$planInfo['type']:0;
$resourceInfo=DB::table('s_department_resources')->where(['id' => $planInfo['resources_id']])->first();
if($resourceInfo->time_mode==1 and $type==0){
return \Yz::echoError1('请选择时令');
}
if($resourceInfo->time_mode==0 and $type != 0){
return \Yz::echoError1('时令配置异常,请刷新页面重试');
}
DB::beginTransaction(); DB::beginTransaction();
$data = [ $data = [
'type'=>$type,
'department_id' => $department_id, 'department_id' => $department_id,
'weekname' => '', 'weekname' => '',
'resources_id' => $planInfo['resources_id'], 'resources_id' => $planInfo['resources_id'],
@ -213,6 +222,7 @@ class PlanModelController extends Controller
'date_type' => $date_type, 'date_type' => $date_type,
]; ];
$param=[ $param=[
'type'=>$type,
'department_id' => $department_id, 'department_id' => $department_id,
'resources_id' => $planInfo['resources_id'], 'resources_id' => $planInfo['resources_id'],
'is_del' => 0, 'is_del' => 0,

@ -48,6 +48,7 @@ class DepartmentResourceService
$list=$list->select(['a.*','s_department.department_name'])->skip(($page-1)*$pageSize) $list=$list->select(['a.*','s_department.department_name'])->skip(($page-1)*$pageSize)
->take($pageSize)->get() ; ->take($pageSize)->get() ;
foreach ($list as $k=>$v){ foreach ($list as $k=>$v){
$list[$k]->time_range=json_decode($v->time_range,true);
$list[$k]->devicesInfo=DB::table('s_department_resources_device') $list[$k]->devicesInfo=DB::table('s_department_resources_device')
->join('s_devices', 's_department_resources_device.device_id', '=', 's_devices.id') ->join('s_devices', 's_department_resources_device.device_id', '=', 's_devices.id')
->select('s_devices.*') ->select('s_devices.*')

@ -17,6 +17,47 @@
<el-switch v-model="ResourcesInfo.department_resources_status" active-text="" inactive-text="" <el-switch v-model="ResourcesInfo.department_resources_status" active-text="" inactive-text=""
:active-value="1" :inactive-value="0" /> :active-value="1" :inactive-value="0" />
</el-form-item> </el-form-item>
<el-form-item label="时令:">
<div>
<el-switch v-model="ResourcesInfo.time_mode" size="large" active-text="" inactive-text="" :active-value="1" :inactive-value="0" @change="timeModeChange"/>
</div>
<div v-if="ResourcesInfo.time_mode==1" style="margin-top: 16px;">
<!-- 显示夏令时和冬令时的配置 -->
<div v-for="season in timeRangeList" :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> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -33,7 +74,7 @@
<script setup> <script setup>
import { import {
ref, ref,
onMounted,watch onMounted
} from 'vue' } from 'vue'
import { import {
GetEnableDepartmentList, GetEnableDepartmentList,
@ -42,6 +83,7 @@
import { import {
ElMessage ElMessage
} from 'element-plus' } from 'element-plus'
import { Delete } from '@element-plus/icons-vue'
let loading=ref(false); let loading=ref(false);
let dialogVisible=ref(true); let dialogVisible=ref(true);
let ResourcesInfo=ref({ let ResourcesInfo=ref({
@ -49,8 +91,74 @@
department_id:null, department_id:null,
department_resources_name:'', department_resources_name:'',
department_resources_status:1, department_resources_status:1,
department_resources_addr:'' department_resources_addr:'',
time_mode: 0, // 0 1
time_range: [] //
}) })
//
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) => {
// timeRangeList
if (e == 1 && timeRangeList.value.length === 0) {
// timeRangeList
timeRangeList.value = [
{
type: 'summer',
type_name: '夏季排班',
periods: [['', '']]
},
{
type: 'winter',
type_name: '冬季排班',
periods: [['', '']]
}
]
}
}
// defineProps: // defineProps:
const props = defineProps({ const props = defineProps({
departmentId: { departmentId: {
@ -80,6 +188,14 @@
ElMessage.error("请填写完整内容") ElMessage.error("请填写完整内容")
return false; return false;
} }
//
ResourcesInfo.value.time_range = timeRangeList.value.map(season => ({
type: season.type,
type_name: season.type_name,
periods: convertPeriodsToObjects(season.periods)
}))
loading.value = true loading.value = true
SaveDepartmentResource({info:ResourcesInfo.value}).then(res => { SaveDepartmentResource({info:ResourcesInfo.value}).then(res => {
loading.value = false loading.value = false
@ -105,7 +221,6 @@
return str !== null && str !== ''; return str !== null && str !== '';
} }
onMounted(() => { onMounted(() => {
console.log(props.departmentId); console.log(props.departmentId);
console.log(props.resourceInfo); console.log(props.resourceInfo);
let r_departmentId=props.departmentId let r_departmentId=props.departmentId
@ -117,6 +232,17 @@
ResourcesInfo.value.department_resources_name=props.resourceInfo.department_resources_name ResourcesInfo.value.department_resources_name=props.resourceInfo.department_resources_name
ResourcesInfo.value.department_resources_addr=props.resourceInfo.department_resources_addr ResourcesInfo.value.department_resources_addr=props.resourceInfo.department_resources_addr
ResourcesInfo.value.department_resources_status=props.resourceInfo.department_resources_status ResourcesInfo.value.department_resources_status=props.resourceInfo.department_resources_status
//
ResourcesInfo.value.time_mode = props.resourceInfo.time_mode || 0
// time_mode time_range
if (props.resourceInfo.time_range && props.resourceInfo.time_range.length > 0) {
timeRangeList.value = props.resourceInfo.time_range.map(season => ({
type: season.type,
type_name: season.type_name,
periods: convertPeriodsToArrays(season.periods)
}))
}
} }
ResourcesInfo.value.department_id=r_departmentId ResourcesInfo.value.department_id=r_departmentId

@ -243,51 +243,15 @@
:label="item.department_resources_name" :value="item.id" /> :label="item.department_resources_name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="PlanInfo.resources_id" label="时令:"> <el-form-item label="时令:" v-if="selectedResourceTimeMode === 1 && searchInfo.date_type === 1">
<div> <el-radio-group v-model="PlanInfo.type">
<el-switch v-model="PlanInfo.timeMode" size="large" active-text="" inactive-text="" :active-value="1" :inactive-value="0" @change="timeModeChange"/> <el-radio :label="1">
<span style="color: #E6A23C;">夏令时</span>
<el-radio-group v-if="PlanInfo.timeMode==1" v-model="PlanInfo.type" style="margin-left: 20px;"> </el-radio>
<el-radio-button label="1">夏令时</el-radio-button> <el-radio :label="2">
<el-radio-button style="margin-left: -10px;" label="2">冬令时</el-radio-button> <span style="color: #409EFF;">冬令时</span>
</el-radio>
</el-radio-group> </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>
<el-form-item label="服务组:" v-if="devicesList.length>0"> <el-form-item label="服务组:" v-if="devicesList.length>0">
<div v-if="devicesList.length>1" style="width: 100%;font-size: 12px;color: #999;"> <div v-if="devicesList.length>1" style="width: 100%;font-size: 12px;color: #999;">
@ -368,7 +332,7 @@
ElMessage, ElMessage,
ElMessageBox ElMessageBox
} from 'element-plus' } from 'element-plus'
import { Delete } from '@element-plus/icons-vue'
let CountType = ref("1"); // let CountType = ref("1"); //
let loading = ref(false) let loading = ref(false)
let currentPage = ref(1) // 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 dateRange = ref([]) //
let CreatePlanDialogVisible = ref(false) let CreatePlanDialogVisible = ref(false)
@ -673,7 +563,7 @@
const DataDefault = () => { const DataDefault = () => {
return { return {
id: 0, id: 0,
type: 1, // 1 2 type: 0, //0 1 2
xingqi: [], xingqi: [],
max_total: 0, max_total: 0,
qudao_total: [], qudao_total: [],
@ -683,34 +573,20 @@
end_reservation_time: '', end_reservation_time: '',
time_unit: 0, // time_unit: 0, //
resources_id: null, resources_id: null,
timeMode: 0,
devices: [], devices: [],
patientType: [], patientType: [],
status: 1, status: 1
timeRanges: [] //
} }
} }
let PlanInfo = ref(DataDefault()) let PlanInfo = ref(DataDefault())
let selectedResourceTimeMode = ref(0) // 0-1-
const Add = (row = null) => { const Add = (row = null) => {
devicesList.value = [] devicesList.value = []
CheckedAll.value = false CheckedAll.value = false
dialogVisible.value = true dialogVisible.value = true
PlanInfo.value = DataDefault() PlanInfo.value = DataDefault()
selectedResourceTimeMode.value = 0 //
//
timeRangeList.value = [
{
type: 'summer',
type_name: '夏季排班',
periods: [['', '']]
},
{
type: 'winter',
type_name: '冬季排班',
periods: [['', '']]
}
]
GetRatio() GetRatio()
GetEnableTimePeriod() GetEnableTimePeriod()
@ -755,17 +631,6 @@
return false 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( ElMessageBox.confirm(
'确定保存吗?', '确定保存吗?',
'提示', { '提示', {
@ -776,6 +641,7 @@
) )
.then(() => { .then(() => {
loading.value = true loading.value = true
PlanModelSave({ PlanModelSave({
date_type: searchInfo.value.date_type, date_type: searchInfo.value.date_type,
planInfo: PlanInfo.value planInfo: PlanInfo.value
@ -964,30 +830,9 @@
PlanInfo.value.max_total = res.data.qudao_total[0].max_total PlanInfo.value.max_total = res.data.qudao_total[0].max_total
PlanInfo.value.xingqi = [res.data.weekname] PlanInfo.value.xingqi = [res.data.weekname]
PlanInfo.value.devices = res.data.devices PlanInfo.value.devices = res.data.devices
//
// const selectedResource = enableResourceList.value.find(r => r.id === PlanInfo.value.resources_id);
if (res.data.timeRanges && res.data.timeRanges.length > 0) { selectedResourceTimeMode.value = selectedResource ? (selectedResource.time_mode || 0) : 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
}
}
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
@ -1023,6 +868,11 @@
let devicesList = ref([]) let devicesList = ref([])
const resourceChange = () => { const resourceChange = () => {
PlanInfo.value.devices = []; 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 loading.value = true
ResourceGetBindDeviceList({ ResourceGetBindDeviceList({
resource_id: PlanInfo.value.resources_id resource_id: PlanInfo.value.resources_id
@ -1030,20 +880,6 @@
loading.value = false loading.value = false
if (res.status) { if (res.status) {
devicesList.value = res.data 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 { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }

@ -36,6 +36,23 @@
<el-tag v-if="scope.row.department_resources_status==1" class="ml-2" type="success"></el-tag> <el-tag v-if="scope.row.department_resources_status==1" class="ml-2" type="success"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="time_mode" label="时令" width="280">
<template #default="scope">
<div style="display: flex; align-items: center;">
<el-tag v-if="scope.row.time_mode==0" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.time_mode==1" class="ml-2" type="warning"></el-tag>
<div v-if="scope.row.time_mode==1 && scope.row.time_range" style="font-size: 12px; margin-left: 8px;">
<div v-for="season in scope.row.time_range" :key="season.type" style="margin-bottom: 2px;">
<span style="color: #E6A23C;" v-if="season.type === 'summer'"></span>
<span style="color: #409EFF;" v-else></span>
<span v-for="(period, index) in season.periods" :key="index">
{{ period.start }}~{{ period.end }}<span v-if="index < season.periods.length - 1"></span>
</span>
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="" label="关联服务组" width="150"> <el-table-column prop="" label="关联服务组" width="150">
<template #default="scope"> <template #default="scope">
<div style="text-align: center;" > <div style="text-align: center;" >

Loading…
Cancel
Save