mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
ebb6add646
commit
f93292239b
26
public/components/admin/adminIndex/adminIndex.html
Normal file
26
public/components/admin/adminIndex/adminIndex.html
Normal file
@ -0,0 +1,26 @@
|
||||
<div>
|
||||
<div class="vc-index-nav">
|
||||
<span><i class="fa fa-home margin-right-sm"></i>首页</span><span
|
||||
class="margin-left-sm margin-right-sm">/</span><span>平台数据</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-2 margin-bottom" v-for="(item,index) in adminIndexInfo.datas" :key="index">
|
||||
<div class="white-bg text-center padding-top-sm" style="height:140px;border: 1px solid #e0e5eb;">
|
||||
<div style="font-size: 38px;font-weight: 600;" :style="{'color':item.color}">{{item.value}}</div>
|
||||
<div class="margin-top-lg" style="font-size: 20px;font-weight: 100;">{{item.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ">
|
||||
<div class="col-lg-6 ">
|
||||
<div id="communityFeeCharts" style="height:400px;width: 100%;" class="bg-white padding">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div id="communityRepairCharts" style="height:400px;width: 100%;" class="bg-white padding">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
190
public/components/admin/adminIndex/adminIndex.js
Normal file
190
public/components/admin/adminIndex/adminIndex.js
Normal file
@ -0,0 +1,190 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
vc.extends({
|
||||
data: {
|
||||
adminIndexInfo: {
|
||||
hostCount: 0,
|
||||
datas: [],
|
||||
action: '',
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('adminIndex', 'initData', function (_param) {
|
||||
$that._loadViewAdminData();
|
||||
$that._loadCommunityFee();
|
||||
$that._loadCommunityRepair();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
||||
_loadViewAdminData: function () {
|
||||
//获取主机访问token
|
||||
let param = {
|
||||
params: {
|
||||
platform: 'admin'
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/admin.queryAdminCount',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code != 0) {
|
||||
console.log(_json);
|
||||
return;
|
||||
}
|
||||
for (let _index = 0; _index < _json.data.length; _index++) {
|
||||
if (_index % 4 == 0) {
|
||||
_json.data[_index].color = "#1acda1";
|
||||
}
|
||||
if (_index % 4 == 1) {
|
||||
_json.data[_index].color = "#ffae11";
|
||||
}
|
||||
if (_index % 4 == 2) {
|
||||
_json.data[_index].color = "#ff7911";
|
||||
}
|
||||
if (_index % 4 == 3) {
|
||||
_json.data[_index].color = "#3a68f2";
|
||||
}
|
||||
}
|
||||
$that.adminIndexInfo.datas = _json.data;
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_loadCommunityFee: function () {
|
||||
//获取主机访问token
|
||||
let param = {
|
||||
params: {
|
||||
platform: 'admin'
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/admin.queryCommunityFee',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code != 0) {
|
||||
console.log(_json);
|
||||
return;
|
||||
}
|
||||
|
||||
$that._initAdminIndexCommunityFeeCharts(_json.data);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_initAdminIndexCommunityFeeCharts: function (_data) {
|
||||
let dom = document.getElementById('communityFeeCharts');
|
||||
let _source = [
|
||||
['product', '缴费数', '缴费金额'],
|
||||
];
|
||||
|
||||
_data.forEach(item => {
|
||||
_source.push([
|
||||
item.communityName,
|
||||
item.count,
|
||||
item.receivedAmount
|
||||
])
|
||||
});
|
||||
|
||||
let myChart = echarts.init(dom);
|
||||
let option = null;
|
||||
option = {
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
title: {
|
||||
show: "true",
|
||||
text: '小区缴费统计'
|
||||
},
|
||||
color: ['#FFDAB9', '#66CDAA'],
|
||||
dataset: {
|
||||
source: _source
|
||||
},
|
||||
xAxis: { type: 'category' },
|
||||
yAxis: {},
|
||||
series: [
|
||||
{ type: 'bar' },
|
||||
{ type: 'bar' }
|
||||
]
|
||||
};
|
||||
|
||||
if (option && typeof option === "object") {
|
||||
myChart.setOption(option, true);
|
||||
}
|
||||
|
||||
},
|
||||
_loadCommunityRepair: function () {
|
||||
//获取主机访问token
|
||||
let param = {
|
||||
params: {
|
||||
platform: 'admin'
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/admin.queryCommunityRepair',
|
||||
param,
|
||||
function (json, res) {
|
||||
let _json = JSON.parse(json);
|
||||
if (_json.code != 0) {
|
||||
console.log(_json);
|
||||
return;
|
||||
}
|
||||
|
||||
$that._initAdminIndexCommunityRepairCharts(_json.data);
|
||||
},
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_initAdminIndexCommunityRepairCharts: function (_data) {
|
||||
let dom = document.getElementById('communityRepairCharts');
|
||||
let _source = [
|
||||
['product', '报修单数'],
|
||||
];
|
||||
|
||||
_data.forEach(item => {
|
||||
_source.push([
|
||||
item.communityName,
|
||||
item.count
|
||||
])
|
||||
});
|
||||
|
||||
let myChart = echarts.init(dom);
|
||||
let option = null;
|
||||
option = {
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
title: {
|
||||
show: "true",
|
||||
text: '小区缴费统计'
|
||||
},
|
||||
color: ['#FFDAB9', '#66CDAA'],
|
||||
dataset: {
|
||||
source: _source
|
||||
},
|
||||
xAxis: { type: 'category' },
|
||||
yAxis: {},
|
||||
series: [
|
||||
{ type: 'bar' },
|
||||
{ type: 'bar' }
|
||||
]
|
||||
};
|
||||
|
||||
if (option && typeof option === "object") {
|
||||
myChart.setOption(option, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
@ -11,9 +11,12 @@
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
$that._loadPropertyIndexAssets();
|
||||
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('indexCommunityView','initData',function(){
|
||||
$that._loadPropertyIndexAssets();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
_loadPropertyIndexAssets: function () {
|
||||
|
||||
@ -9,9 +9,13 @@
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
$that._loadPropertyIndexNotices();
|
||||
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on('indexNotice','initData',function(){
|
||||
$that._loadPropertyIndexNotices();
|
||||
})
|
||||
},
|
||||
_initEvent: function() {},
|
||||
methods: {
|
||||
_loadPropertyIndexNotices: function() {
|
||||
let param = {
|
||||
|
||||
@ -9,9 +9,13 @@
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
$that._loadIndexOwnerRegisterData();
|
||||
},
|
||||
_initEvent: function() {},
|
||||
_initEvent: function() {
|
||||
vc.on('indexOwnerRoom','initData',function(){
|
||||
$that._loadIndexOwnerRegisterData();
|
||||
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
_loadIndexOwnerRegisterData: function() {
|
||||
let param = {
|
||||
|
||||
@ -13,10 +13,14 @@
|
||||
},
|
||||
_initMethod: function() {
|
||||
|
||||
$that._loadIndexComplaintData();
|
||||
$that._loadIndexRepairData();
|
||||
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on('indexRepairComplaint','initData',function(){
|
||||
$that._loadIndexComplaintData();
|
||||
$that._loadIndexRepairData();
|
||||
})
|
||||
},
|
||||
_initEvent: function() {},
|
||||
methods: {
|
||||
_loadIndexRepairData: function() {
|
||||
let param = {
|
||||
|
||||
@ -1,21 +1,29 @@
|
||||
<div class="vc-index">
|
||||
<div class="vc-index-nav">
|
||||
<span><i class="fa fa-home margin-right-sm"></i>首页</span><span class="margin-left-sm margin-right-sm">/</span><span>控制台</span>
|
||||
</div>
|
||||
<div class="vc-index-1 flex justify-start">
|
||||
<div class="index-1-left">
|
||||
<vc:create path="property/indexCommunity"></vc:create>
|
||||
|
||||
<div v-if="propertyIndexInfo.storeTypeCd == '800900000003'">
|
||||
<div class="vc-index-nav">
|
||||
<span><i class="fa fa-home margin-right-sm"></i>首页</span><span
|
||||
class="margin-left-sm margin-right-sm">/</span><span>控制台</span>
|
||||
</div>
|
||||
<div class="index-1-right">
|
||||
<vc:create path="property/indexNotice"></vc:create>
|
||||
<div class="vc-index-1 flex justify-start">
|
||||
<div class="index-1-left">
|
||||
<vc:create path="property/indexCommunity"></vc:create>
|
||||
</div>
|
||||
<div class="index-1-right">
|
||||
<vc:create path="property/indexNotice"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vc-index-1 flex justify-start">
|
||||
<div class="index-1-left">
|
||||
<vc:create path="property/indexRepairComplaint"></vc:create>
|
||||
</div>
|
||||
<div class="index-1-right">
|
||||
<vc:create path="property/indexOwnerRoom"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vc-index-1 flex justify-start">
|
||||
<div class="index-1-left">
|
||||
<vc:create path="property/indexRepairComplaint"></vc:create>
|
||||
</div>
|
||||
<div class="index-1-right">
|
||||
<vc:create path="property/indexOwnerRoom"></vc:create>
|
||||
</div>
|
||||
|
||||
<div v-if="propertyIndexInfo.storeTypeCd == '800900000001'">
|
||||
<vc:create path="admin/adminIndex"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,159 +1,35 @@
|
||||
(function(vc) {
|
||||
vc.extends({
|
||||
data: {
|
||||
indexContextInfo: {
|
||||
ownerCount: '0',
|
||||
noEnterRoomCount: '0',
|
||||
roomCount: '0',
|
||||
freeRoomCount: '0',
|
||||
parkingSpaceCount: '0',
|
||||
freeParkingSpaceCount: '0',
|
||||
shopCount: '0',
|
||||
freeShopCount: '0'
|
||||
propertyIndexInfo: {
|
||||
storeTypeCd: '',
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
vc.component._queryIndexContextData();
|
||||
setTimeout(function(){
|
||||
$that._computeStoreTypeCd();
|
||||
|
||||
},1000)
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on("indexContext", "_queryIndexContextData", function(_param) {
|
||||
vc.component._queryIndexContextData();
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
_queryIndexContextData: function() {
|
||||
if (vc.getCurrentCommunity() == null || vc.getCurrentCommunity() == undefined) {
|
||||
return;
|
||||
_computeStoreTypeCd:function(){
|
||||
let _getUserInfo = vc.getData('/nav/getUserInfo')
|
||||
if(_getUserInfo){
|
||||
$that.propertyIndexInfo.storeTypeCd = _getUserInfo.storeTypeCd
|
||||
}
|
||||
var param = {
|
||||
params: {
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
}
|
||||
//发送get请求
|
||||
vc.http.apiGet('/index.queryIndexStatistic',
|
||||
param,
|
||||
function(json, res) {
|
||||
var indexData = JSON.parse(json);
|
||||
vc.copyObject(indexData, vc.component.indexContextInfo);
|
||||
let _dom = document.getElementById('ownerCount');
|
||||
if (!_dom) { return; }
|
||||
$that._initCharts2(indexData.ownerCount - indexData.noEnterRoomCount, indexData.noEnterRoomCount, _dom, vc.i18n('业主信息', 'indexContext'), vc.i18n('已入住', 'indexContext'), vc.i18n('未入住', 'indexContext'));
|
||||
_dom = document.getElementById('roomCount');
|
||||
$that._initCharts2(indexData.roomCount - indexData.freeRoomCount, indexData.freeRoomCount, _dom, vc.i18n('房屋信息', 'indexContext'), vc.i18n('已入住', 'indexContext'), vc.i18n('空闲', 'indexContext'));
|
||||
_dom = document.getElementById('parkingSpaceCount');
|
||||
$that._initEcharts(indexData.parkingSpaceCount - indexData.freeParkingSpaceCount, indexData.freeParkingSpaceCount, _dom, vc.i18n('车位信息', 'indexContext'), vc.i18n('已使用', 'indexContext'), vc.i18n('空闲', 'indexContext'));
|
||||
_dom = document.getElementById('shopCount');
|
||||
$that._initCharts2(indexData.shopCount - indexData.freeShopCount, indexData.freeShopCount, _dom, vc.i18n('商铺信息', 'indexContext'), vc.i18n('已出售', 'indexContext'), vc.i18n('空闲', 'indexContext'));
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_initEcharts: function(userCount, freeCount, dom, _title, _userCountName, _freeCountName) {
|
||||
//let dom = document.getElementById("box2");
|
||||
let myChart = echarts.init(dom);
|
||||
let option = null;
|
||||
option = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
||||
},
|
||||
color: ['#66CDAA', '#FFDAB9'],
|
||||
series: [{
|
||||
name: _title,
|
||||
type: 'pie',
|
||||
radius: ['60%', '75%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
fontSize: '20',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
show: true
|
||||
},
|
||||
data: [
|
||||
{ value: userCount, name: _userCountName },
|
||||
{ value: freeCount, name: _freeCountName }
|
||||
],
|
||||
}]
|
||||
};
|
||||
if (option && typeof option === "object") {
|
||||
myChart.setOption(option, true);
|
||||
|
||||
if($that.propertyIndexInfo.storeTypeCd == '800900000003'){
|
||||
vc.emit('indexCommunityView','initData',{});
|
||||
vc.emit('indexNotice','initData',{});
|
||||
vc.emit('indexRepairComplaint','initData',{});
|
||||
vc.emit('indexOwnerRoom','initData',{});
|
||||
}
|
||||
},
|
||||
_initCharts2: function(userCount, freeCount, dom, _title, _userCountName, _freeCountName) {
|
||||
//var dom = document.getElementById("box1");
|
||||
let myChart = echarts.init(dom);
|
||||
let option = null;
|
||||
option = {
|
||||
textStyle: { //图例文字的样式
|
||||
fontSize: 12
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
color: ['#66CDAA', '#FFDAB9'],
|
||||
series: [{
|
||||
name: _title,
|
||||
type: 'pie',
|
||||
radius: '75%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
{ value: userCount, name: _userCountName },
|
||||
{ value: freeCount, name: _freeCountName }
|
||||
],
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
if (option && typeof option === "object") {
|
||||
myChart.setOption(option, true);
|
||||
}
|
||||
},
|
||||
_initCharts3: function(userCount, freeCount, dom, _title, _userCountName, _freeCountName) {
|
||||
//var dom = document.getElementById("box1");
|
||||
let myChart = echarts.init(dom);
|
||||
let option = null;
|
||||
option = {
|
||||
title: {
|
||||
text: '',
|
||||
subtext: '',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
color: ['#66CDAA', '#FFDAB9'],
|
||||
series: [{
|
||||
name: _title,
|
||||
type: 'pie',
|
||||
radius: ['20%', '75%'],
|
||||
center: ['50%', '50%'],
|
||||
roseType: 'area',
|
||||
data: [
|
||||
{ value: userCount, name: _userCountName },
|
||||
{ value: freeCount, name: _freeCountName }
|
||||
]
|
||||
}]
|
||||
};
|
||||
if (option && typeof option === "object") {
|
||||
myChart.setOption(option, true);
|
||||
|
||||
if($that.propertyIndexInfo.storeTypeCd == '800900000001'){
|
||||
vc.emit('adminIndex', 'initData',{})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user