cody 2 years ago
parent c3d33a0ba0
commit 88ca77b1ff

@ -66,7 +66,7 @@ class HomeController extends CommonController
// 各产品占比
$lies = [];
$product = Product::where('project_id', $project_id)->first();
if($product){
if ($product) {
$productItem = ProductItems::where('product_id', $product->id)->get();
$factor = FactorItems::where('factor_id', $product->statistic_factor_id)->get();
$order_total = OrderItems::whereIn('product_item_id', $productItem->pluck('id'))->sum('total');
@ -113,8 +113,15 @@ class HomeController extends CommonController
$roleId = Role::where('name', 'like', '%首页统计%')->where('guard_name', 'admin')->value('id');
$tongji = DB::table('model_has_roles')->where('role_id', $roleId)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
// 判断是否有大屏幕权限
$roleIdBydp = Role::where('name', 'like', '%大屏统计%')->where('guard_name', 'admin')->value('id');
$dp = DB::table('model_has_roles')->where('role_id', $roleIdBydp)
->where('model_type', 'App\Admin')->where('model_id', $userId)->count();
if (is_mobile() || empty($tongji)) {
return view($this->bladePath . ".mobile_home");
$jumpDp = 0;
if ($dp) $jumpDp = 1;
return view($this->bladePath . ".mobile_home", ['jump_dp' => $jumpDp]);
} else {
return view($this->bladePath . ".home", compact('project_id', 'projects', 'counts', 'lies', 'saleList', 'orderList'));
}

@ -11,46 +11,57 @@
padding-bottom: 62px;
overflow-y: scroll;
}
.footer {
background: #fff;
}
.toll-free-box i {
transform: none !important;
left: 1rem;
bottom: .4rem;
}
.static-container {
display: flex;
flex-wrap: wrap;
}
.static-container > .card1 {
margin-bottom: 20px;
}
.static-container > .card1 + .card1 {
margin-left: 20px;
}
.static-container > .card1:nth-child(1) {
flex-basis: 36%;
}
.static-container > .card1:nth-child(2) {
flex-basis: calc(64% - 20px);
}
.static-container > .card1:nth-child(3) {
flex-basis: 68%;
height: 300px;
margin-left: 0 !important;
}
.static-container > .card1:nth-child(3) .card1-title > div::before {
display: none;
}
.card1 {
background: #fff;
border-radius: 4px;
font-size: 14px;
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
overflow: hidden;
position: relative;
}
.card1::before {
content: "";
height: 28px;
@ -62,6 +73,7 @@
bottom: -14px;
right: 12px;
}
.card1::after {
content: "";
height: 42px;
@ -73,6 +85,7 @@
bottom: -4px;
right: -14px;
}
.card1-title {
display: flex;
justify-content: space-between;
@ -81,26 +94,30 @@
padding: 12px 14px;
line-height: 1;
}
.card1-title > div:nth-child(1) {
color: #333;
position: relative;
}
.card1-title > div:nth-child(1)::before {
content: '';
height: 14px;
width: 140px;
background: radial-gradient(12px 9px at 10px 40%,#7ed3b155 20%,#0000 70%) 0 0/12px 12px no-repeat,
radial-gradient(120px 9px at 10px 40%,#7ed3b155 20%,#0000 70%) 12px 0/130px 12px no-repeat;
background: radial-gradient(12px 9px at 10px 40%, #7ed3b155 20%, #0000 70%) 0 0/12px 12px no-repeat,
radial-gradient(120px 9px at 10px 40%, #7ed3b155 20%, #0000 70%) 12px 0/130px 12px no-repeat;
position: absolute;
bottom: -6px;
left: -6px;
}
.card1-title__arrow {
padding-right: 20px;
cursor: pointer;
position: relative;
}
.card1-title__arrow::before {
content: "\F142";
display: inline-block;
@ -114,25 +131,30 @@
bottom: 0;
right: 0;
}
.card1-body {
padding: 7px;
}
.card1-body .static1, .card1-body .static2{
.card1-body .static1, .card1-body .static2 {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-top: 20px;
}
.static1 .static1__item, .static2 .static2__item{
.static1 .static1__item, .static2 .static2__item {
margin: 14px;
padding-left: 20px;
font-size: 14px;
}
.static1 .static1__item .static1__item--label,.static2 .static2__item .static2__item--label {
.static1 .static1__item .static1__item--label, .static2 .static2__item .static2__item--label {
color: #666;
position: relative;
}
.static1 .static1__item .static1__item--label::before {
content: "";
width: 4px;
@ -145,9 +167,11 @@
left: -10px;
top: 0;
}
.static2 .static2__item--label {
padding-left: 4px;
}
.static2 .static2__item .static2__item--label::before {
content: "";
width: 8px;
@ -160,28 +184,35 @@
left: -10px;
top: 50%;
}
.static2 .static2__item:nth-child(2) .static2__item--label::before {
background: #548fee;
}
.static2 .static2__item:nth-child(3) .static2__item--label::before {
background: #78d3a9;
}
.static1 .static1__item .static1__item--value,.static2 .static2__item .static2__item--value {
.static1 .static1__item .static1__item--value, .static2 .static2__item .static2__item--value {
font-weight: 600;
color: #333;
line-height: 2;
font-size: 15px;
}
.static2 .static2__item .static2__item--value {
text-align: center;
}
.card1-body:has(#pie-chart) {
height: calc(100% - 39px);
}
#pie-chart {
height: 100%;
width: 100%;
}
#bar-chart {
height: 100%;
width: 100%;
@ -190,10 +221,12 @@
.type-switch {
display: flex;
}
.type-switch .type-switch__item {
padding: 0 20px;
position: relative;
}
.type-switch .type-switch__item > input {
opacity: 0;
position: absolute;
@ -202,10 +235,12 @@
right: 0;
bottom: 0;
}
.type-switch .type-switch__item:has(input:checked) .text {
color: #609ff9;
position: relative;
}
.type-switch .type-switch__item:has(input:checked) .text::after {
content: "";
width: 100%;
@ -215,9 +250,11 @@
left: 0;
bottom: -12px;
}
.hospital-select:focus {
outline: none;
}
.card1-body:has(#bar-chart) {
height: calc(100% - 39px);
}
@ -240,7 +277,8 @@
<select class="hospital-select" name="hospital-select">
@foreach($projects as $project)
<option value="{{$project->id}}" @if(request()->project_id === $project->id){{ "selected" }}@endif>{{$project->name}}</option>
<option
value="{{$project->id}}" @if(request()->project_id === $project->id){{ "selected" }}@endif>{{$project->name}}</option>
@endforeach
</select>
@ -249,7 +287,7 @@
<div class="card1-title">
<div>数据统计</div>
<div>
{{-- <span class="card1-title__arrow">更多</span>--}}
{{-- <span class="card1-title__arrow">更多</span>--}}
</div>
</div>
<div class="card1-body">
@ -304,7 +342,7 @@
<div class="card1-title">
<div>各产品占比</div>
<div>
{{-- <span class="card1-title__arrow">更多</span>--}}
{{-- <span class="card1-title__arrow">更多</span>--}}
</div>
</div>
<div class="card1-body">
@ -324,14 +362,14 @@
<div class="text">订单量</div>
</div>
</div>
{{-- <div class="date-select">--}}
{{-- <span>今日</span>--}}
{{-- <span>本周</span>--}}
{{-- <span>本月</span>--}}
{{-- <span>全年</span>--}}
{{-- <select name="date"></select>--}}
{{-- </div>--}}
{{-- <div class="date-select">--}}
{{-- <span>今日</span>--}}
{{-- <span>本周</span>--}}
{{-- <span>本月</span>--}}
{{-- <span>全年</span>--}}
{{-- <select name="date"></select>--}}
{{-- </div>--}}
</div>
<div class="card1-body">
<div id="bar-chart"></div>
@ -341,7 +379,7 @@
@endsection
<script>
function jump(url){
function jump(url) {
window.open(url)
}
@ -349,16 +387,21 @@
@push("footer")
<script src="/plugins/echarts/echarts.min.js"></script>
<script>
var jump_dp = '{{$jump_dp}}'
if (jump_dp == '1') {
window.open('/dashboard')
}
var lies = {!! json_encode($lies) !!};
var saleList = {!! json_encode($saleList) !!};
var orderList = {!! json_encode($orderList) !!};
console.log(lies,saleList,orderList)
function initPieChart () {
console.log(lies, saleList, orderList)
function initPieChart() {
var datas = lies.map(function (item) {
return [
{
name: item.name,
value: parseFloat(item.total??"0") * item.rate,
value: parseFloat(item.total ?? "0") * item.rate,
label: {
show: true,
position: 'center',
@ -370,7 +413,7 @@
},
{
name: '未完成',
value: parseFloat(item.total??"0") * (1 - item.rate),
value: parseFloat(item.total ?? "0") * (1 - item.rate),
itemStyle: {
color: "#f1f2f5"
}
@ -426,8 +469,10 @@
// 使用刚指定的配置项和数据显示图表。
pieChart.setOption(option);
}
var barChart
function initBarChart () {
function initBarChart() {
barChart = echarts.init(document.querySelector("#bar-chart"));
var option = {
title: {
@ -455,7 +500,8 @@
}
barChart.setOption(option)
}
function setBarChartOption (type) {
function setBarChartOption(type) {
var option
if (type == 1) {
option = {
@ -511,25 +557,28 @@
barChart.setOption(option)
}
}
function typeSwitchListener () {
function typeSwitchListener() {
$("[name=type-switch]").change(function () {
setBarChartOption($(this).val())
})
}
function hospitalSelectListner () {
function hospitalSelectListner() {
if (window.location.search) {
var project_id = window.location.search.split("=")
if (project_id[1]) {
$("[name=hospital-select] option[value="+project_id[1]+"]").prop("selected",true)
$("[name=hospital-select] option[value=" + project_id[1] + "]").prop("selected", true)
}
}
$("[name=hospital-select]").change(function () {
var url = window.location.origin + window.location.pathname;
url += ("?project_id=" + $(this).val());
window.open(url,'_self');
window.open(url, '_self');
})
}
(function () {
initPieChart()
initBarChart()

Loading…
Cancel
Save