号源合并调整

main
yanzai 8 months ago
parent 64a897e999
commit bf4f51a8aa

@ -295,6 +295,7 @@ class PlanModelController extends Controller
foreach ($ratio as $k => $v) {
if ($value->id == $v->appointment_type_id) {
$appointment_type[$key]->ratio = $v->ratio;
$appointment_type[$key]->link = json_decode($v->link,true);
}
}
}
@ -318,6 +319,7 @@ class PlanModelController extends Controller
'department_id' => $department_id,
'appointment_type_id' => $value['id'],
'ratio' => $value['ratio'],
'link'=>isset($value['link'])?json_encode($value['link'],JSON_UNESCAPED_UNICODE):null,
]);
}
if ($u) {

@ -1,18 +1,29 @@
<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">
<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>
<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>
@ -34,9 +45,12 @@ import {
onMounted
} from 'vue'
import {
GetAppointmentRatio,SaveAppointmentRatio
GetAppointmentRatio,
SaveAppointmentRatio
} from '@/api/api.js'
import { ElMessage } from 'element-plus'
import {
ElMessage
} from 'element-plus'
let ratioInfo = ref([])
let loading = ref(false)
//
@ -54,6 +68,7 @@ const GetRatio = () => {
}
//
const Save = () => {
let status = false
let zong = 0
ratioInfo.value.forEach((v, i) => {
@ -71,7 +86,9 @@ const Save=()=>{
}
if (!status) return false
loading.value = true
SaveAppointmentRatio({ratioInfo:ratioInfo.value}).then(res => {
SaveAppointmentRatio({
ratioInfo: ratioInfo.value
}).then(res => {
loading.value = false
if (res.status) {
ElMessage({
@ -84,10 +101,41 @@ const Save=()=>{
}
})
}
//
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>
Loading…
Cancel
Save