|
|
|
|
@ -1,93 +1,141 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div style="margin: 12px;color:#999">
|
|
|
|
|
设置说明:此功能为各个预约渠道设置默认数量百分比,用于为“预约计划”按比例自动分配数量,此次设置各个渠道的数值总数应为100,如果不想给某个渠道分配可设置为0
|
|
|
|
|
设置说明:
|
|
|
|
|
<div>1:预约渠道设置默认数量百分比,用于为“预约计划”按比例自动分配数量,此次设置各个渠道的数值总数应为100,如果不想给某个渠道分配可设置为0 </div>
|
|
|
|
|
<div>
|
|
|
|
|
2:渠道合并,合并后的号源池可共用
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="display: flex" v-loading="loading">
|
|
|
|
|
|
|
|
|
|
<div style="width: 400px;margin-right: 40px">
|
|
|
|
|
|
|
|
|
|
<el-form :model="ratioInfo" label-width="auto" style="max-width: 600px">
|
|
|
|
|
<el-form-item v-for="(item,index) in ratioInfo" :key="index" :label="item.name">
|
|
|
|
|
|
|
|
|
|
<div style="width: 750px;margin-right: 40px">
|
|
|
|
|
|
|
|
|
|
<el-form :model="ratioInfo" label-width="auto" style="max-width: 600px">
|
|
|
|
|
<el-form-item v-for="(item,index) in ratioInfo" :key="index" :label="item.name">
|
|
|
|
|
<div style="display: flex;">
|
|
|
|
|
<el-input size="large" type="number" min="0" max="100" v-model="ratioInfo[index].ratio"
|
|
|
|
|
style="margin-left: 10px;width: 250px;" />
|
|
|
|
|
<div style="margin-left: 10px;">%</div>
|
|
|
|
|
<el-input size="large" type="number" min="0" max="100" v-model="ratioInfo[index].ratio"
|
|
|
|
|
style="margin-left: 10px;width: 250px;" />
|
|
|
|
|
<div style="margin-left: 10px; margin-right: 40px;">%</div>
|
|
|
|
|
<div style="width: 100px;color: #75b96c;">号源池合并</div>
|
|
|
|
|
<el-select size="large" v-model="ratioInfo[index].link" multiple placeholder="未合并"
|
|
|
|
|
style="width: 240px" @remove-tag="(value) => LinkRemove(index, value)"
|
|
|
|
|
@change="LinkChange(index,ratioInfo[index].link)">
|
|
|
|
|
<el-option v-for="(item2,index2) in filteredOptions(item)" :key="index2"
|
|
|
|
|
:label="item2.name" :value="item2.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="display: flex;justify-content: center; align-items: center;">
|
|
|
|
|
<el-button type="primary" @click="Save" style="height: 70px;width: 100px">
|
|
|
|
|
确定
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="display: flex;justify-content: center; align-items: center;">
|
|
|
|
|
<el-button type="primary" @click="Save" style="height: 70px;width: 100px">
|
|
|
|
|
确定
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
onMounted
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import {
|
|
|
|
|
GetAppointmentRatio,SaveAppointmentRatio
|
|
|
|
|
} from '@/api/api.js'
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
let ratioInfo = ref([])
|
|
|
|
|
let loading = ref(false)
|
|
|
|
|
//获取当前科室各个渠道可预约百分比
|
|
|
|
|
const GetRatio = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetAppointmentRatio({}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
ratioInfo.value=res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
import {
|
|
|
|
|
ref,
|
|
|
|
|
onMounted
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import {
|
|
|
|
|
GetAppointmentRatio,
|
|
|
|
|
SaveAppointmentRatio
|
|
|
|
|
} from '@/api/api.js'
|
|
|
|
|
import {
|
|
|
|
|
ElMessage
|
|
|
|
|
} from 'element-plus'
|
|
|
|
|
let ratioInfo = ref([])
|
|
|
|
|
let loading = ref(false)
|
|
|
|
|
//获取当前科室各个渠道可预约百分比
|
|
|
|
|
const GetRatio = () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetAppointmentRatio({}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
ratioInfo.value = res.data
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//保存
|
|
|
|
|
const Save=()=>{
|
|
|
|
|
let status=false
|
|
|
|
|
let zong=0
|
|
|
|
|
ratioInfo.value.forEach((v,i)=>{
|
|
|
|
|
if(v.ratio>=0 && v.ratio<=100){
|
|
|
|
|
zong=zong+Number(v.ratio)
|
|
|
|
|
}else{
|
|
|
|
|
ElMessage.error("第"+(i+1)+"个渠道数据不正确")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if( zong ==100){
|
|
|
|
|
status=true
|
|
|
|
|
}else{
|
|
|
|
|
status=false
|
|
|
|
|
ElMessage.error("各渠道总和应为100,当前为"+zong)
|
|
|
|
|
}
|
|
|
|
|
if(!status) return false
|
|
|
|
|
loading.value = true
|
|
|
|
|
SaveAppointmentRatio({ratioInfo:ratioInfo.value}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: '保存成功',
|
|
|
|
|
type: 'success',
|
|
|
|
|
})
|
|
|
|
|
GetRatio()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
GetRatio()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//保存
|
|
|
|
|
const Save = () => {
|
|
|
|
|
|
|
|
|
|
let status = false
|
|
|
|
|
let zong = 0
|
|
|
|
|
ratioInfo.value.forEach((v, i) => {
|
|
|
|
|
if (v.ratio >= 0 && v.ratio <= 100) {
|
|
|
|
|
zong = zong + Number(v.ratio)
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error("第" + (i + 1) + "个渠道数据不正确")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (zong == 100) {
|
|
|
|
|
status = true
|
|
|
|
|
} else {
|
|
|
|
|
status = false
|
|
|
|
|
ElMessage.error("各渠道总和应为100,当前为" + zong)
|
|
|
|
|
}
|
|
|
|
|
if (!status) return false
|
|
|
|
|
loading.value = true
|
|
|
|
|
SaveAppointmentRatio({
|
|
|
|
|
ratioInfo: ratioInfo.value
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: '保存成功',
|
|
|
|
|
type: 'success',
|
|
|
|
|
})
|
|
|
|
|
GetRatio()
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 定义过滤逻辑
|
|
|
|
|
const filteredOptions = (item) => {
|
|
|
|
|
return ratioInfo.value.filter(option => option.id !== item.id);
|
|
|
|
|
};
|
|
|
|
|
const LinkChange = (index, newLinks) => {
|
|
|
|
|
const currentId = ratioInfo.value[index].id;
|
|
|
|
|
|
|
|
|
|
ratioInfo.value.forEach((item) => {
|
|
|
|
|
if (item.id === currentId) return; // 跳过当前项
|
|
|
|
|
|
|
|
|
|
const shouldInclude = newLinks.includes(item.id);
|
|
|
|
|
const hasCurrentId = item.link.includes(currentId);
|
|
|
|
|
|
|
|
|
|
if (shouldInclude && !hasCurrentId) {
|
|
|
|
|
item.link.push(currentId);
|
|
|
|
|
} else if (!shouldInclude && hasCurrentId) {
|
|
|
|
|
item.link = item.link.filter(id => id !== currentId);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const LinkRemove = (currentIndex, removedValue) => {
|
|
|
|
|
const currentId = ratioInfo.value[currentIndex].id;
|
|
|
|
|
const removedItem = ratioInfo.value.find(item => item.id === removedValue);
|
|
|
|
|
if (removedItem) {
|
|
|
|
|
removedItem.link = removedItem.link.filter(id => id !== currentId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
GetRatio()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
<style >
|
|
|
|
|
.el-select__tags .el-tag--info{
|
|
|
|
|
background-color: #b3e19d;
|
|
|
|
|
color:#68825b;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|