|
|
@@ -1,10 +1,10 @@
|
|
|
<!--
|
|
|
* @Author: liuzhenlin 461480418@qq.ocm
|
|
|
* @Date: 2023-01-12 11:57:48
|
|
|
- * @LastEditors: wanglj
|
|
|
- * @LastEditTime: 2023-02-20 10:05:52
|
|
|
+ * @LastEditors: liuzhenlin
|
|
|
+ * @LastEditTime: 2023-02-23 18:05:16
|
|
|
* @Description: file content
|
|
|
- * @FilePath: \frontend_mobile\pages\home\index.vue
|
|
|
+ * @FilePath: \oms\pages\home\index.vue
|
|
|
-->
|
|
|
<template>
|
|
|
<view class="home">
|
|
|
@@ -24,26 +24,28 @@
|
|
|
<view class="main">
|
|
|
<view class="msg-box">
|
|
|
<view class="tab-date-wrap">
|
|
|
- <text class="tab-date-item" @click="tabDate = 'week'" :class="{ dateActive: tabDate == 'week' }">本周</text>
|
|
|
- <text class="tab-date-item" @click="tabDate = 'month'" :class="{ dateActive: tabDate == 'month' }">本月</text>
|
|
|
+ <text class="tab-date-item" @click="getReport('week')" :class="{ dateActive: tabDate == 'week' }">本周</text>
|
|
|
+ <text class="tab-date-item" @click="getReport('month')" :class="{ dateActive: tabDate == 'month' }">
|
|
|
+ 本月
|
|
|
+ </text>
|
|
|
</view>
|
|
|
<view class="date-msg">
|
|
|
<u-row justify="space-between">
|
|
|
<u-col span="4">
|
|
|
<view class="center flex-column">
|
|
|
- <view class="num">12</view>
|
|
|
+ <view class="num">{{ newCustomer }}</view>
|
|
|
<view class="txt">新增客户</view>
|
|
|
</view>
|
|
|
</u-col>
|
|
|
<u-col span="4">
|
|
|
<view class="center flex-column">
|
|
|
- <view class="num">19</view>
|
|
|
+ <view class="num">{{ newBusiness }}</view>
|
|
|
<view class="txt">新增项目</view>
|
|
|
</view>
|
|
|
</u-col>
|
|
|
<u-col span="4">
|
|
|
<view class="center flex-column">
|
|
|
- <view class="num">12</view>
|
|
|
+ <view class="num">{{ newTask }}</view>
|
|
|
<view class="txt">督办事项</view>
|
|
|
</view>
|
|
|
</u-col>
|
|
|
@@ -101,7 +103,7 @@
|
|
|
</u-row>
|
|
|
<u-row justify="space-between" gutter="14">
|
|
|
<u-col span="6">
|
|
|
- <view class="menu-item flex_l flex-colunm">
|
|
|
+ <view class="menu-item flex_l flex-colunm" @click="handleHomeLink()">
|
|
|
<view class="menu-img-box">
|
|
|
<image class="menu-img" src="../../static/images/menu4.png" mode="scaleToFill" />
|
|
|
</view>
|
|
|
@@ -112,7 +114,7 @@
|
|
|
</view>
|
|
|
</u-col>
|
|
|
<u-col span="6">
|
|
|
- <view class="menu-item flex_l flex-colunm">
|
|
|
+ <view class="menu-item flex_l flex-colunm" @click="handleHomeLink()">
|
|
|
<view class="menu-img-box">
|
|
|
<image class="menu-img" src="../../static/images/menu6.png" mode="scaleToFill" />
|
|
|
</view>
|
|
|
@@ -127,7 +129,7 @@
|
|
|
<view class="echarts-container">
|
|
|
<h4>个人报表</h4>
|
|
|
<view class="echarts" v-for="item in echarts" :key="item.id">
|
|
|
- <h4>{{item.report_name}}</h4>
|
|
|
+ <h4>{{ item.report_name }}</h4>
|
|
|
<view class="chart">
|
|
|
<l-echart :ref="item.id + ''" @finished="init(item.id)"></l-echart>
|
|
|
</view>
|
|
|
@@ -181,16 +183,15 @@
|
|
|
</view>
|
|
|
</view> -->
|
|
|
</view>
|
|
|
- <view class="check" @click="toCheckIn">
|
|
|
- 卡
|
|
|
- </view>
|
|
|
+ <view class="check" @click="toCheckIn">卡</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import indexApi from '@/api/system/index.js'
|
|
|
+ import homeApi from '@/api/home'
|
|
|
import to from 'await-to-js'
|
|
|
- import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
|
|
|
+ import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue'
|
|
|
import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
|
|
|
export default {
|
|
|
name: 'omsIndex',
|
|
|
@@ -199,26 +200,30 @@
|
|
|
height: '',
|
|
|
paddingTop: '',
|
|
|
tabDate: 'week',
|
|
|
- rankList: [{
|
|
|
- name: '邱国辉',
|
|
|
- money: '100000',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '邱国辉',
|
|
|
- money: '100000000',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '邱国辉',
|
|
|
- money: '100000000',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '邱国辉',
|
|
|
- money: '100000000',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '邱国辉',
|
|
|
- money: '100000000',
|
|
|
- },
|
|
|
+ newCustomer: 0,
|
|
|
+ newBusiness: 0,
|
|
|
+ newTask: 0,
|
|
|
+ rankList: [
|
|
|
+ // {
|
|
|
+ // name: '邱国辉',
|
|
|
+ // money: '100000',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '邱国辉',
|
|
|
+ // money: '100000000',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '邱国辉',
|
|
|
+ // money: '100000000',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '邱国辉',
|
|
|
+ // money: '100000000',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '邱国辉',
|
|
|
+ // money: '100000000',
|
|
|
+ // },
|
|
|
],
|
|
|
echarts: [],
|
|
|
}
|
|
|
@@ -231,53 +236,83 @@
|
|
|
mounted() {
|
|
|
this.getEcharts()
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ this.getReport('week')
|
|
|
+ },
|
|
|
components: {
|
|
|
- LEchart
|
|
|
+ LEchart,
|
|
|
},
|
|
|
methods: {
|
|
|
+ async getReport(type) {
|
|
|
+ this.tabDate = type
|
|
|
+ let params = { viewInterval: this.tabDate }
|
|
|
+ const [err, res] = await to(homeApi.getReportData(params))
|
|
|
+ if (err) return
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.newCustomer = res.data.newCustomer
|
|
|
+ this.newBusiness = res.data.newBusiness
|
|
|
+ this.newTask = res.data.newTask
|
|
|
+ }
|
|
|
+ },
|
|
|
handleHomeLink(url) {
|
|
|
+ if (!url) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '功能开发中~',
|
|
|
+ icon: 'none',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
//保留当前页面,跳转到应用内的某个页面
|
|
|
url,
|
|
|
})
|
|
|
},
|
|
|
async getEcharts() {
|
|
|
- const [err, res] = await to(indexApi.getHomeReport({
|
|
|
- module_code: 'HomePage'
|
|
|
- }))
|
|
|
+ const [err, res] = await to(
|
|
|
+ indexApi.getHomeReport({
|
|
|
+ module_code: 'HomePage',
|
|
|
+ })
|
|
|
+ )
|
|
|
if (err) return
|
|
|
const obj = JSON.parse(res.data.configInfo)
|
|
|
this.echarts = obj.data_report_config || []
|
|
|
},
|
|
|
async init(id) {
|
|
|
console.log(id, 'id')
|
|
|
- const [err, res] = await to(indexApi.getHomeDataReportData({
|
|
|
- id
|
|
|
- }))
|
|
|
+ const [err, res] = await to(
|
|
|
+ indexApi.getHomeDataReportData({
|
|
|
+ id,
|
|
|
+ })
|
|
|
+ )
|
|
|
if (err) return
|
|
|
const option = {
|
|
|
grid: {
|
|
|
bottom: 10,
|
|
|
top: 20,
|
|
|
right: 10,
|
|
|
- containLabel: true
|
|
|
+ containLabel: true,
|
|
|
},
|
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
|
},
|
|
|
- xAxis: [{
|
|
|
- type: 'category',
|
|
|
- data: res.data.data.xData,
|
|
|
- axisTick: {
|
|
|
- alignWithLabel: true,
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: 'category',
|
|
|
+ data: res.data.data.xData,
|
|
|
+ axisTick: {
|
|
|
+ alignWithLabel: true,
|
|
|
+ },
|
|
|
},
|
|
|
- }, ],
|
|
|
- yAxis: [{
|
|
|
- type: 'value',
|
|
|
- name: '(元)',
|
|
|
- nameLocation: 'start'
|
|
|
- }, ],
|
|
|
- series: [{
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '(元)',
|
|
|
+ nameLocation: 'start',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
name: '销售指标',
|
|
|
type: 'bar',
|
|
|
data: res.data.data.yDataTarget,
|
|
|
@@ -289,16 +324,16 @@
|
|
|
},
|
|
|
],
|
|
|
}
|
|
|
- this.$refs[id][0].init(echarts, chart => {
|
|
|
- chart.setOption(option);
|
|
|
- });
|
|
|
+ this.$refs[id][0].init(echarts, (chart) => {
|
|
|
+ chart.setOption(option)
|
|
|
+ })
|
|
|
},
|
|
|
toCheckIn() {
|
|
|
uni.navigateTo({
|
|
|
//保留当前页面,跳转到应用内的某个页面
|
|
|
url: '/pages/home/checkIn',
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
@@ -392,8 +427,6 @@
|
|
|
border-radius: 31rpx 31rpx 31rpx 31rpx;
|
|
|
margin: 0 auto;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
.tab-date-wrap {
|
|
|
padding: 8rpx 0 24rpx 38rpx;
|
|
|
|
|
|
@@ -549,15 +582,13 @@
|
|
|
box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
|
|
|
border-radius: 31rpx 31rpx 31rpx 31rpx;
|
|
|
|
|
|
- +.echarts {
|
|
|
+ + .echarts {
|
|
|
margin-top: 32rpx;
|
|
|
}
|
|
|
|
|
|
.chart {
|
|
|
height: 400rpx;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|