后台增加号源列表功能、改bug
parent
2ede0329ba
commit
226964a3fc
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\Admin\YeWu;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class PlanListController extends Controller
|
||||||
|
{
|
||||||
|
public function GetList()
|
||||||
|
{
|
||||||
|
$searchInfo = request('searchInfo');
|
||||||
|
$today=date('Y-m-d');
|
||||||
|
if(empty($searchInfo['dateRange']) or count($searchInfo['dateRange'])<>2){
|
||||||
|
$searchInfo['dateRange']=[$today,$today];
|
||||||
|
}
|
||||||
|
$list=DB::select("select date,
|
||||||
|
SUM(CASE WHEN type = 0 THEN 1 ELSE 0 END) as type_0_count,
|
||||||
|
SUM(CASE WHEN type =1 THEN 1 ELSE 0 END) as type_1_count,
|
||||||
|
SUM(CASE WHEN status=2 THEN 1 ELSE 0 END) as type_used_count
|
||||||
|
from plans where date >=? and date<=? and is_del=0 GROUP BY date",$searchInfo['dateRange']);
|
||||||
|
return \Yz::Return(true,"查询完成",['list'=>$list,'dateRange'=>$searchInfo['dateRange'],'count'=>0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="head">
|
||||||
|
<div class="head">
|
||||||
|
<el-row>
|
||||||
|
<el-form-item>
|
||||||
|
<el-date-picker v-model="searchInfo.dateRange" type="daterange" value-format="YYYY-MM-DD"
|
||||||
|
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<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="date" label="日期" />
|
||||||
|
<el-table-column prop="type_0_count" label="预留" />
|
||||||
|
<el-table-column prop="" label="已用/可用总数">
|
||||||
|
<template #default="scope">
|
||||||
|
{{scope.row.type_used_count}}/{{scope.row.type_1_count}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="" label="号源总数">
|
||||||
|
<template #default="scope">
|
||||||
|
{{Number(scope.row.type_0_count)+Number(scope.row.type_1_count)}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="" label="操作" width="220">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" @click="toDetail(scope.row.date)" size="small">明细</el-button>
|
||||||
|
|
||||||
|
<!-- <el-button type="success" @click="CreatPlanClick(scope.row)" size="small">重新生成</el-button> -->
|
||||||
|
<el-button type="danger" @click="Del(scope.row.date)" 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> -->
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
ElMessage,
|
||||||
|
ElMessageBox
|
||||||
|
} from 'element-plus'
|
||||||
|
import {
|
||||||
|
|
||||||
|
PlanListGetList,
|
||||||
|
|
||||||
|
PlanDel,
|
||||||
|
PlanCreate,
|
||||||
|
|
||||||
|
} from '@/api/api.js'
|
||||||
|
let loading = ref(false)
|
||||||
|
let searchInfo = ref({
|
||||||
|
dateRange: []
|
||||||
|
})
|
||||||
|
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
|
||||||
|
PlanListGetList({
|
||||||
|
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
|
||||||
|
searchInfo.value.dateRange = res.data.dateRange
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let Info = ref({});
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
if (v.type == 1) {
|
||||||
|
timeList.value[i].class = "timelist_button_selected"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let selectedDate = ref([]);
|
||||||
|
const Del = (date = null) => {
|
||||||
|
if (date !== null) {
|
||||||
|
selectedDate.value = [date]
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确定删除吗?已经占用的号源不会被删除',
|
||||||
|
'提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true
|
||||||
|
PlanDel({
|
||||||
|
dates: selectedDate.value
|
||||||
|
}).then(res => {
|
||||||
|
loading.value = false
|
||||||
|
if (res.status) {
|
||||||
|
GetList()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let CPlan = ref({});
|
||||||
|
let ChongFuList = ref([]);
|
||||||
|
const CreatPlanClick = (row) => {
|
||||||
|
CPlan.value.name = row.name
|
||||||
|
CPlan.value.model_id = row.id
|
||||||
|
}
|
||||||
|
|
||||||
|
const toDetail=(date)=>{
|
||||||
|
window.location.href = "./#/planMngr/plan?date="+date
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
GetList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.timelist_k {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue