|
|
|
|
@ -137,8 +137,13 @@
|
|
|
|
|
: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>
|
|
|
|
|
@ -151,7 +156,7 @@
|
|
|
|
|
<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="primary">{{item.date +' '+item.time}}</el-tag>
|
|
|
|
|
<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>
|
|
|
|
|
@ -373,6 +378,7 @@
|
|
|
|
|
CreatPlanDialogVisible.value = true
|
|
|
|
|
CPlan.value.name=row.name
|
|
|
|
|
CPlan.value.model_id=row.id
|
|
|
|
|
success_daterange.value=[];
|
|
|
|
|
}
|
|
|
|
|
const CPanCheckAll=()=>{//生成计划时全选星期
|
|
|
|
|
if(CPlan.value.checkedAll){
|
|
|
|
|
@ -381,18 +387,37 @@
|
|
|
|
|
CPlan.value.week=[]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const CreatePlans=()=>{
|
|
|
|
|
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
|
|
|
|
|
PlanCreate({
|
|
|
|
|
CPlan: CPlan.value
|
|
|
|
|
let r_status=false;
|
|
|
|
|
await PlanCreate({
|
|
|
|
|
CPlan: CPlan.value,
|
|
|
|
|
dateRange:range
|
|
|
|
|
}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.status) {
|
|
|
|
|
CreatPlanDialogVisible.value = false
|
|
|
|
|
// CreatPlanDialogVisible.value = false
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: "成功创建"+res.data.success_count+"条计划",
|
|
|
|
|
type: 'success',
|
|
|
|
|
})
|
|
|
|
|
r_status=true;
|
|
|
|
|
} else {
|
|
|
|
|
if(res.msg=='号源重复'){
|
|
|
|
|
CreatTiShiDialogVisible.value=true
|
|
|
|
|
@ -401,6 +426,7 @@
|
|
|
|
|
ElMessage.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return r_status;
|
|
|
|
|
}
|
|
|
|
|
const SetPlanType=(item)=>{
|
|
|
|
|
timeList.value.forEach((v,i)=>{
|
|
|
|
|
@ -413,6 +439,33 @@
|
|
|
|
|
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>
|
|
|
|
|
|