改版号源模板,增加批量等功能

main
yanzai 1 month ago
parent 24d1f73cde
commit caaec2b931

@ -0,0 +1,546 @@
<template>
<div>
<div class="head">
<div class="head">
<el-row>
<el-form-item>
<el-input v-model="searchInfo.name" placeholder="请输入模板名称" style="margin-left: 10px;" />
</el-form-item>
<el-button type="primary" @click="GetList()" style="margin-left: 10px;">查询</el-button>
<el-button type="success" @click="Add()" style="margin-left: 10px;">添加</el-button>
</el-row>
</div>
</div>
<el-table :data="tableData" style="width: 100%;" row-key="id" v-loading="loading">
<el-table-column prop="id" label="Id" width="100" v-if="false" />
<el-table-column prop="name" label="名称" />
<!-- <el-table-column prop="plan_type_name" label="号源类型" /> -->
<el-table-column prop="" label="起止时间" width="140">
<template #default="scope">
{{scope.row.start_time}} - {{scope.row.end_time}}
</template>
</el-table-column>
<el-table-column prop="interval_time" label="时间间隔">
<template #default="scope">
{{scope.row.interval_time}}分钟
</template>
</el-table-column>
<el-table-column prop="count" label="号源总数" />
<el-table-column prop="count" label="预留号源数">
<template #default="scope">
{{scope.row.y_number.length}}
</template>
</el-table-column>
<el-table-column prop="" label="操作" width="220">
<template #default="scope">
<el-button type="primary" @click="Edit(scope.row)" size="small">修改</el-button>
<el-button type="danger" @click="Del(scope.row.id)" size="small">删除</el-button>
<el-button type="success" @click="CreatPlanClick(scope.row)" size="small">生成计划</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="号源模板设置" style="margin-top: 10px;">
<div class="chuansuokuang" v-loading="loading">
<el-form :model="Info" label-width="150" style="max-width: 600px">
<el-form-item label="医院">
<el-select :filterable="true" clearable v-model="Info.hospital_id" placeholder="选择医院">
<el-option label="海南现代妇女儿童医院"
:value="1" />
</el-select>
</el-form-item>
<el-form-item label="名称">
<el-input v-model="Info.name" />
</el-form-item>
<el-form-item label="起止时间">
<div style="display: flex;">
<el-time-picker v-model="Info.TimeRange" value-format='HH:mm:00' is-range
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
@change="TimeRangeChange()" />
</div>
</el-form-item>
<el-form-item label="时间间隔">
<el-input-number v-model="Info.interval_time" :min="1" :max="10000"
@input.native="handle($event)" />
</el-form-item>
<!-- <el-form-item label="号源类型">
<el-select :filterable="true" clearable v-model="Info.plan_type" placeholder="选择号源类型">
<el-option v-for="(item,index) in PlabTypeList" :key="index" :label="item.name"
:value="item.id" />
</el-select>
</el-form-item> -->
<el-form-item label="状态">
<el-switch v-model="Info.status" size="large" active-text="" inactive-text=""
:active-value="1" :inactive-value="0" />
</el-form-item>
</el-form>
<div class="plan_type_list">
<div v-for="(item,index) in PlabTypeList" :key="index" @click="SetPlanType(item)" class="plan_type" :style="'background-color:'+ item.color" >设为 {{item.name}}-<span class="TypeCount">{{item.count}}</span></div>
</div>
<div class="timelist_k" v-if="timeList">
<div v-for="(item,index) in timeList" :key="index" :class="['timelist_button', item.class]" :style="'background-color:'+ item.type_color"
@click="TimeClick(index)">{{item.time}}</div>
</div>
<div>未选中则为预留号源</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="Save()">
确定
</el-button>
<el-button type="warning" @click="Save2()">
另存
</el-button>
</span>
</template>
</el-dialog>
<el-dialog v-model="CreatPlanDialogVisible" title="生成号源">
<div class="chuansuokuang" v-loading="loading">
<el-form :model="CPlan" label-width="150" >
<el-form-item label="名称">
<span style="font-size: 14px;font-weight: 700;">{{CPlan.name}}</span>
</el-form-item>
<el-form-item label="起止时间">
<div style="display: flex;">
<el-date-picker
v-model="CPlan.dateRange"
type="daterange"
value-format="YYYY-MM-DD"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="星期">
<el-checkbox v-model="CPlan.checkedAll" @change="CPanCheckAll()"></el-checkbox>
<el-checkbox-group v-model="CPlan.week">
<el-checkbox label="1">星期一</el-checkbox>
<el-checkbox label="2">星期二</el-checkbox>
<el-checkbox label="3">星期三</el-checkbox>
<el-checkbox label="4">星期四</el-checkbox>
<el-checkbox label="5">星期五</el-checkbox>
<el-checkbox label="6">星期六</el-checkbox>
<el-checkbox label="7">星期日</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="工作日生成">
<el-switch v-model="CPlan.workday_create" size="large" active-text="" inactive-text=""
:active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="节假日生成">
<el-switch v-model="CPlan.holiday_create" size="large" active-text="" inactive-text=""
:active-value="1" :inactive-value="0" />
</el-form-item>
</el-form>
</div>
<div v-if="success_daterange.length>0">
<div>以下日期内的号源已成功生成</div>
<el-tag type="success" style="margin-left: 8px;margin-bottom: 8px;" v-for="(item,index) in success_daterange" :key="index">{{item[0]}}-{{item[1]}}</el-tag>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="CreatPlanDialogVisible = false">取消</el-button>
<el-button type="primary" @click="CreatePlans()">
确定
</el-button>
</span>
</template>
</el-dialog>
<el-dialog v-model="CreatTiShiDialogVisible" title="生成号源">
<div style="margin-bottom: 10px;">当前选择的时间段和现有如下计划时间段有重叠,请先删除</div>
<div style="display: flex; justify-content: space-between;flex-wrap: wrap;">
<el-tag style="margin: 4px;" size="large" v-for="(item,index) in ChongFuList" :key="index" type="">{{item.date +' '+item.time}}</el-tag>
</div>
<template #footer>
<span class="dialog-footer">
<!-- <el-button @click="CreatTiShiDialogVisible = false">取消</el-button> -->
<el-button type="primary" @click="CreatTiShiDialogVisible = false">
知道了
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import {
ref,
onMounted
} from 'vue';
import {
ElMessage,
ElMessageBox
} from 'element-plus'
import {
PlanTypeGetList,
PlanModelTimeList,
PlanModelSave,
PlanModelGetList,
PlanModelGetDetail,
PlanModelDel,
PlanCreate
} from '@/api/api.js'
let loading = ref(false)
let searchInfo = ref({})
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()
}
const GetList = () => {
loading.value = true
PlanModelGetList({
searchInfo: searchInfo.value,
page: currentPage.value,
pageSize: pageSize.value
}).then(res => {
loading.value = false
if (res.status) {
tableData.value = res.data.list
total = res.data.count
} else {
ElMessage.error(res.msg)
}
})
}
let Info = ref({});
let dialogVisible = ref(false);
const Add = async() => {
Info.value = {}
Info.value.id = 0
Info.value.hospital_id=1
Info.value.status = 1
Info.value.TimeRange = ['08:00:00', '12:00:00']
Info.value.interval_time = 5 //
dialogVisible.value = true
await GetPlanTypeList()
GetTimeList()
}
let PlabTypeList = ref([]); //
const GetPlanTypeList = async () => {
loading.value = true
try {
const res = await PlanTypeGetList({
searchInfo: {
status: 1
},
})
if (res.status) {
PlabTypeList.value = res.data.list.map(item => ({
...item,
count: 0
}));
} else {
ElMessage.error(res.msg)
}
} catch (error) {
ElMessage.error('请求失败')
} finally {
loading.value = false
}
}
const handle = (e) => {
Info.value.interval_time = e
setTimeout(() => {
GetTimeList()
}, 500)
}
//
const TimeRangeChange = () => {
GetTimeList()
}
//
let timeList = ref([])
const GetTimeList = (type = '') => {
timeList.value = []
loading.value = true
PlanModelTimeList({
TimeRange: Info.value.TimeRange,
interval_time: Info.value.interval_time
}).then(res => {
loading.value = false
if (res.status) {
let time_obj = {}
res.data.list.forEach((v, i) => {
if (type == 'detail') { // ,
if (Info.value.y_number.includes(i)) {
time_obj = {
time: v
}
} else {
time_obj = {
time: v,
class: "timelist_button_selected"
}
}
} else {
time_obj = {
time: v
}
}
timeList.value.push(time_obj)
})
console.log('---------',PlabTypeList.value)
} else {
ElMessage.error(res.msg)
}
})
}
//
const TimeClick = (index) => {
if (timeList.value[index].class == "timelist_button_selected") {
timeList.value[index].class = ""
timeList.value[index].type_color = null
timeList.value[index].plan_type_id = null
} else {
timeList.value[index].class = "timelist_button_selected"
}
}
//
const Save2=()=>{
Info.value.id=0
Save()
}
//
const Save = () => {
Info.value.y_number = [] //
timeList.value.forEach((v, i) => {
if (v.class != 'timelist_button_selected') {
Info.value.y_number.push(i)
}
})
Info.value.count = timeList.value.length
loading.value = true
PlanModelSave({
Info: Info.value,
Timelist:timeList.value
}).then(res => {
loading.value = false
if (res.status) {
dialogVisible.value = false
GetList()
} else {
ElMessage.error(res.msg)
}
})
}
const Edit = async(row) => {
dialogVisible.value = true
await GetPlanTypeList()
GetDetail(row.id)
}
const GetDetail = (id) => {
loading.value = true
PlanModelGetDetail({
id: id
}).then(res => {
loading.value = false
if (res.status) {
Info.value = res.data
//GetTimeList('detail')
timeList.value=Info.value.list
timeList.value.forEach((v,i)=>{
PlabTypeList.value.forEach((t_v,t_i)=>{
if(v.plan_type_id==t_v.id){
t_v.count++
}
})
if(v.type==1){
timeList.value[i].class = "timelist_button_selected"
}
})
} else {
ElMessage.error(res.msg)
}
})
}
const Del = (id) => {
loading.value = true
PlanModelDel({
id: id
}).then(res => {
loading.value = false
if (res.status) {
GetList()
} else {
ElMessage.error(res.msg)
}
})
}
let CPlan=ref({});
let CreatPlanDialogVisible = ref(false)
let CreatTiShiDialogVisible= ref(false)
let ChongFuList=ref([]);
const CreatPlanClick = (row) => {
CreatPlanDialogVisible.value = true
CPlan.value.name=row.name
CPlan.value.model_id=row.id
CPlan.value.workday_create=1
CPlan.value.holiday_create=1
success_daterange.value=[];
}
const CPanCheckAll=()=>{//
if(CPlan.value.checkedAll){
CPlan.value.week=['1','2','3','4','5','6','7']
}else{
CPlan.value.week=[]
}
}
let success_daterange=ref([]);
const CreatePlans= async ()=>{
if(loading.value===true) return
success_daterange.value=[];
let ranges=splitDateRange(CPlan.value.dateRange[0],CPlan.value.dateRange[1])
for (const range of ranges) {
let status= await CreatePlans_r(range)
if(status===true){
success_daterange.value.push(range)
}
if(status===false){
break;
}
}
}
const CreatePlans_r= async (range)=>{
loading.value = true
let r_status=false;
await PlanCreate({
CPlan: CPlan.value,
dateRange:range
}).then(res => {
loading.value = false
if (res.status) {
// CreatPlanDialogVisible.value = false
ElMessage({
message: "成功创建"+res.data.success_count+"条计划",
type: 'success',
})
r_status=true;
} else {
if(res.msg=='号源重复'){
CreatTiShiDialogVisible.value=true
ChongFuList.value=res.data.list
}
ElMessage.error(res.msg)
}
})
return r_status;
}
const SetPlanType=(item)=>{
timeList.value.forEach((v,i)=>{
if(v.class == "timelist_button_selected" && v.type_color==null){
timeList.value[i].type_color =item.color
timeList.value[i].plan_type_id =item.id
PlabTypeList.value.forEach((t_v,t_i)=>{
if(item.id==t_v.id){
t_v.count++
}
})
}
})
}
onMounted(() => {
GetList()
})
function splitDateRange(startDateStr, endDateStr) {
const result = [];
const startDate = new Date(startDateStr);
const endDate = new Date(endDateStr);
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
const year = currentDate.getFullYear();
const month = currentDate.getMonth();
const nextMonthDate = new Date(year, month + 1, 1);
const endOfCurrentMonth = new Date(nextMonthDate - 1);
//
const actualEndDate = (endOfCurrentMonth <= endDate)? endOfCurrentMonth : endDate;
const startStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(currentDate.getDate()).padStart(2, '0')}`;
const endStr = `${actualEndDate.getFullYear()}-${String(actualEndDate.getMonth() + 1).padStart(2, '0')}-${String(actualEndDate.getDate()).padStart(2, '0')}`;
result.push([startStr, endStr]);
currentDate = nextMonthDate;
}
return result;
}
</script>
<style scoped>
.timelist_k {
display: flex;
flex-wrap: wrap;
height: 500px;
overflow-y: scroll;
}
.timelist_button {
width: 150px;
border: 1px solid #e2e2e2;
margin-top: 8px;
margin-left: 8px;
text-align: center;
height: 28px;
line-height: 28px;
cursor: pointer;
background-color: #f4f4f4;
font-weight: 700;
border-radius: 4px;
}
.timelist_button:hover {
border: 2px solid #8fc2ff;
line-height: 26px;
color: #2b5885;
}
.timelist_button_selected {
background-color: #8fc2ff;
color: #fff
}
.plan_type_list{
display: flex;
color: #fff;
}
.plan_type{
padding: 4px 8px;
border-radius: 6px;
margin-left: 8px;
cursor: pointer;
}
.TypeCount{
font-size: 14px;
font-weight: 900;
}
</style>

@ -44,8 +44,8 @@
: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="号源模板设置" style="margin-top: 10px;">
<div class="chuansuokuang" v-loading="loading">
<el-dialog v-model="dialogVisible" title="号源模板设置" style="margin-top: 10px;width: 63%;">
<div class="mubankuang" v-loading="loading">
<el-form :model="Info" label-width="150" style="max-width: 600px">
<el-form-item label="医院">
<el-select :filterable="true" clearable v-model="Info.hospital_id" placeholder="选择医院">
@ -78,17 +78,45 @@
:active-value="1" :inactive-value="0" />
</el-form-item>
</el-form>
<div class="plan_type_list">
<div v-for="(item,index) in PlabTypeList" :key="index" @click="SetPlanType(item)" class="plan_type" :style="'background-color:'+ item.color" >设为 {{item.name}}-<span class="TypeCount">{{item.count}}</span></div>
</div>
<div class="timelist_k" v-if="timeList">
<div v-for="(item,index) in timeList" :key="index" :class="['timelist_button', item.class]" :style="'background-color:'+ item.type_color"
@click="TimeClick(index)">{{item.time}}</div>
<div style="border: 1px solid #ccc; padding: 8px;margin-top: -10px;border-radius: 8px;">
<div style="display: flex;align-items: center;margin-top: -10px;">
<div style="margin-right: 8px;font-size: 14px;font-weight: 700;">批量勾选</div>
<el-switch v-model="AutoSelectedStatus" size="large" active-text="" inactive-text=""
:active-value="1" :inactive-value="0" />
<div style="display: flex;margin-left: 50px;font-size: 16px;">
<div>总数:<span style="font-weight: 900;color: #00aeb7;">{{PlanCount}} </span></div>
<div style="margin-left: 8px;">已使用:<span style="font-weight: 900;color: #ff4040;">{{PlanUseCount}} </span></div>
<div style="margin-left: 8px;">未使用:<span style="font-weight: 900;color: #88675d;">{{PlanUnuseCount}} </span></div>
</div>
</div>
<div class="plan_type_list" v-if="AutoSelectedStatus===0">
<div v-for="(item,index) in PlabTypeList" :key="index" @click="SetPlanType(item)" class="plan_type" :style="'background-color:'+ item.color" >设为 {{item.name}}-<span class="TypeCount">{{item.count}}</span></div>
</div>
<div class="plan_type_list" v-else>
<div v-for="(item,index) in PlabTypeList" :key="index">
<el-popover
placement="top-start"
:width="250"
content="this is content, this is content, this is content">
<div >
<el-button @click="PiLiangOpenFunc(item)" style="width: 220px;background-color: #92eebd;" > <span style="font-weight: 900;color: #00aeb7;">{{item.name}}</span> 批量设置</el-button>
<el-button @click="ZhuanHuanOpenFunc(item)" style="width: 220px;margin-left: 0px; background-color:#eec788;margin-top: 4px;"><span style="font-weight: 900;color: #00aeb7;">{{item.name}}</span>号源转换为其他类型</el-button>
</div>
<template #reference>
<div class="plan_type2" :style="'background-color:'+ item.color" ><span style="font-weight: 900;color:#666">批量</span> {{item.name}}-<span class="TypeCount">{{item.count}}</span></div>
</template>
</el-popover>
</div>
</div>
<div class="timelist_k" v-if="timeList">
<div v-for="(item,index) in timeList" :key="index" :class="['timelist_button', item.class]" :style="'background-color:'+ item.type_color"
@click="TimeClick(index)">{{item.time}}</div>
</div>
<div>未选中则为预留号源</div>
</div>
<div>未选中则为预留号源</div>
</div>
<template #footer>
<span class="dialog-footer">
@ -172,6 +200,42 @@
</span>
</template>
</el-dialog>
<el-dialog v-model="PiLiangDialogVisible" >
<div style="margin-top: -30px;font-size: 16px;margin-bottom: 10px;font-weight: 700;"> <span style="color: #00aeb7;font-weight: 900;">{{SelectedPlanType.name}}</span> 批量选择号源</div>
<div style="margin-bottom: 10px;">
开始时间
<el-time-select
v-model="PiliangSelectedStartTime"
style="width: 240px"
:start="PiLiangTimeListStart"
:step="PiLiangStep"
:end="PiLiangTimeListEnd"
placeholder="Select time"
/>
</div>
<div style="margin-bottom: 10px;">
号源间隔<el-input-number v-model="PiLiangJianGe" :min="1" :max="10" />
</div>
<div style="margin-bottom: 10px;">
号源数量<el-input-number v-model="PiLiangNeedCount" :min="1" :max="10" /> 需要勾选几个
</div>
<template #footer>
<span class="dialog-footer">
<!-- <el-button @click="CreatTiShiDialogVisible = false">取消</el-button> -->
<el-button type="primary" @click="PiLiangSelectFunc()">
</el-button>
</span>
</template>
</el-dialog>
<el-dialog v-model="ZhuanHuanDialogVisible" style="width: 200px;" >
<div style="margin-top: -30px;font-size: 16px;margin-bottom: 10px;font-weight: 700;"><span style="color: #00aeb7;font-weight: 900;">{{SelectedPlanType.name}}</span>号源转为</div>
<div style="margin-bottom: 10px;" v-for="(item,index) in PlabTypeList" :key="index">
<div class="button2" :style="'background-color:'+ item.color" v-if="item.id != SelectedPlanType.id" @click="PiLiangZhuanFunc(item.id,item.color)">{{item.name}}</div>
</div>
<div class="button2" @click="PiLiangZhuanFunc(0,null)"></div>
</el-dialog>
</div>
</template>
@ -199,6 +263,18 @@
let currentPage = ref(1) //
let pageSize = ref(15) //
let total = 0 //
let AutoSelectedStatus=ref(0);//
let PiLiangDialogVisible=ref(false);
let ZhuanHuanDialogVisible=ref(false)
let PiLiangStep=ref('');
let PiLiangTimeListStart=ref('')
let PiLiangTimeListEnd=ref('')
let PiliangSelectedStartTime=ref('')//
let PiLiangJianGe=ref(0)//
let PiLiangNeedCount=ref(0)//
let PlanCount=ref(0)
let PlanUseCount=ref(0)
let PlanUnuseCount=ref(0)
const PageSizeChange = (e) => { //
pageSize.value = e
GetList()
@ -207,6 +283,11 @@
currentPage.value = e
GetList()
}
const SetPiLiangCanShu=(interval_time,start,end)=>{
PiLiangStep.value="00:"+interval_time
PiLiangTimeListStart.value=start
PiLiangTimeListEnd.value=end
}
const GetList = () => {
loading.value = true
PlanModelGetList({
@ -235,6 +316,7 @@
dialogVisible.value = true
await GetPlanTypeList()
GetTimeList()
}
let PlabTypeList = ref([]); //
const GetPlanTypeList = async () => {
@ -304,7 +386,11 @@
}
timeList.value.push(time_obj)
})
console.log('---------',PlabTypeList.value)
PlanCount.value=res.data.list.length
PlanUseCount.value=0;
PlanUnuseCount.value=0
SetPiLiangCanShu(Info.value.interval_time,Info.value.TimeRange[0],Info.value.TimeRange[1])
} else {
ElMessage.error(res.msg)
}
@ -312,6 +398,10 @@
}
//
const TimeClick = (index) => {
if(AutoSelectedStatus.value===1){//
ElMessage.error("请关闭 批量勾选")
return false
}
if (timeList.value[index].class == "timelist_button_selected") {
timeList.value[index].class = ""
timeList.value[index].type_color = null
@ -348,6 +438,7 @@
}
})
}
const Edit = async(row) => {
dialogVisible.value = true
await GetPlanTypeList()
@ -361,7 +452,11 @@
loading.value = false
if (res.status) {
Info.value = res.data
SetPiLiangCanShu(Info.value.interval_time,Info.value.start_time,Info.value.end_time)
//GetTimeList('detail')
PlanCount.value=Info.value.count
PlanUseCount.value=0
PlanUnuseCount.value=0
timeList.value=Info.value.list
timeList.value.forEach((v,i)=>{
PlabTypeList.value.forEach((t_v,t_i)=>{
@ -371,6 +466,9 @@
})
if(v.type==1){
timeList.value[i].class = "timelist_button_selected"
PlanUseCount.value++
}else{
PlanUnuseCount.value++
}
})
} else {
@ -451,7 +549,7 @@
})
return r_status;
}
const SetPlanType=(item)=>{
const SetPlanType=(item)=>{
timeList.value.forEach((v,i)=>{
if(v.class == "timelist_button_selected" && v.type_color==null){
timeList.value[i].type_color =item.color
@ -461,9 +559,96 @@
t_v.count++
}
})
PlanUseCount.value++
PlanUnuseCount.value--
}
})
}
let SelectedPlanType=ref(null)//
const PiLiangOpenFunc=(type)=>{
SelectedPlanType.value=type
PiLiangDialogVisible.value=true
}
const ZhuanHuanOpenFunc=(type)=>{
SelectedPlanType.value=type
ZhuanHuanDialogVisible.value=true
}
const PiLiangSelectFunc=()=>{
if(!!PiliangSelectedStartTime.value && !!PiLiangJianGe.value && !!PiLiangNeedCount.value){
let start_k=null
let j=0
let count=0
console.log('timeList.value:',timeList.value)
timeList.value.forEach((v,i)=>{
if(v.type_color==undefined) v.type_color=null
if(v.time==PiliangSelectedStartTime.value+':00' || v.time==PiliangSelectedStartTime.value){
start_k=i
}
if(start_k !==null){
if( (v.type_color==null && j==0) || v.plan_type_id===SelectedPlanType.value.id){ //
console.log(v.time)
if(count<PiLiangNeedCount.value){
timeList.value[i].class = "timelist_button_selected"
count++
}
}
j++
if(j%PiLiangJianGe.value===0){
j=0
}
}
})
if(count==PiLiangNeedCount.value){
SetPlanType(SelectedPlanType.value)
PiLiangDialogVisible.value=false
}else{
console.log('count:',count)
console.log('need:',PiLiangNeedCount.value)
timeList.value.forEach((v,i)=>{
if(v.class == "timelist_button_selected" && v.type_color==null){
timeList.value[i].class = ""
}
})
ElMessage.error("剩余号源数量不足,请调整参数")
}
}else{
ElMessage.error("请设置全部参数")
}
}
const PiLiangZhuanFunc=(id,color)=>{
timeList.value.forEach((v,i)=>{
if(v.plan_type_id==SelectedPlanType.value.id){
if(id>0){
timeList.value[i].class = "timelist_button_selected"
timeList.value[i].type_color =color
timeList.value[i].plan_type_id =id
}
if(id===0){
timeList.value[i].class = ""
timeList.value[i].type_color =null
timeList.value[i].plan_type_id =null
PlanUseCount.value--
PlanUnuseCount.value++
}
PlabTypeList.value.forEach((t_v,t_i)=>{//
if(id==t_v.id){
t_v.count++
}
if(SelectedPlanType.value.id==t_v.id){ //
t_v.count--
}
})
}
})
ZhuanHuanDialogVisible.value=false;
}
onMounted(() => {
GetList()
})
@ -528,6 +713,10 @@
background-color: #8fc2ff;
color: #fff
}
.mubankuang{
margin-top: -30px;
margin-bottom: -30px;
}
.plan_type_list{
display: flex;
color: #fff;
@ -538,9 +727,28 @@
margin-left: 8px;
cursor: pointer;
}
.plan_type2{
padding: 4px 8px;
border-radius: 6px;
margin-left: 8px;
cursor: pointer;
box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.5);
}
.TypeCount{
font-size: 14px;
font-weight: 900;
}
.button2{
border: 1px solid #ccc;
width: 160px;
text-align: center;
padding: 4px;
border-radius: 4px;
background-color: #f4f4f4;
cursor: pointer;
}
.el-form-item{
margin-bottom: 8px;
}
</style>
Loading…
Cancel
Save