Просмотр исходного кода

fix:增加首页周月数据、echarts.js更换为只有柱状图

liuzl 2 лет назад
Родитель
Сommit
f6b6758509

+ 16 - 0
api/home/index.js

@@ -0,0 +1,16 @@
+/*
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-29 09:43:06
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-01-29 09:43:36
+ * @Description: file content
+ * @FilePath: \crm\api\schedule\index.js
+ */
+import micro_request from '../../utils/micro_request'
+const basePath = process.uniEnv.VUE_APP_ParentPath
+export default {
+    // 首页周月数据
+    getReportData(query) {
+        return micro_request.postRequest(basePath, 'Home', 'GetWechatHomeNumReportData', query)
+    },
+}

+ 0 - 94
components/currency/index.vue

@@ -1,94 +0,0 @@
-<!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-10 16:18:28
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-17 17:44:24
- * @Description: file content
- * @FilePath: \订单全流程管理系统\src\components\currency\index.vue
--->
-<template>
-  <view>
-    <u-input
-      v-model="num"
-      @blur="inputMoney($event)"
-      @change="handleChange"
-      @focus="uninputMoney($event)"
-      @input="returnNum" />
-  </view>
-</template>
-
-<script>
-  export default {
-    name: 'AmountInput',
-    props: {
-      value: {
-        type: [String, Number],
-        default: '0',
-      },
-    },
-    data() {
-      return {
-        num: '',
-      }
-    },
-    watch: {
-      value() {
-        this.num = this.formatPrice(this.value)
-      },
-    },
-    mounted() {
-      this.num = this.formatPrice(this.value)
-    },
-    methods: {
-      returnNum() {
-        if (this.num) {
-          this.$emit('input', this.CurrencyFomatNumber(this.num))
-        }
-      },
-      handleChange(value) {
-        this.$nextTick(() => {
-          this.$emit('change', this.CurrencyFomatNumber(value))
-        })
-      },
-      // 失焦显示数字类型
-      inputMoney(value) {
-        let temp = Number(value) || null
-        this.num = this.formatPrice(temp)
-      },
-      // 获得焦点金额去掉格式
-      uninputMoney() {
-        this.num = this.CurrencyFomatNumber(this.num)
-      },
-      //去除千分位中的‘,’
-      CurrencyFomatNumber(num, n = 2) {
-        let number = num.replace('¥', '')
-        if (number != null && number != '' && number != undefined) {
-          number = number.replace(/,/g, '') //去除千分位的','
-          if (isNaN(number)) {
-            //判断是否是数字
-            number = '0'
-          } else {
-            number = Math.round(number * Math.pow(10, n)) / Math.pow(10, n) //n幂
-            number = number.toString()
-          }
-        } else {
-          number = '0'
-        }
-        //a.indexOf(x,y);返回x值在a字符串值中从y位置开始检索首次出现的位置
-        var numLength = number.indexOf('.')
-        //判断传递的值是整数增加小数点再补"0"
-        if (numLength < 0) {
-          numLength = number.length
-          number += '.'
-        }
-        //不足n位小数的,循环补"0"
-        while (number.length <= numLength + n) {
-          number += '0'
-        }
-        return parseFloat(number)
-      },
-    },
-  }
-</script>
-
-<style lang="scss" scoped></style>

+ 95 - 64
pages/home/index.vue

@@ -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;
           }
-
-
         }
       }
     }

+ 2 - 2
pages/login/index.vue

@@ -55,8 +55,8 @@
         height: '',
         paddingTop: '',
         loginForm: {
-          username: 'admin',
-          password: '123456',
+          username: '',
+          password: '',
         },
         rules: {
           username: {

+ 2 - 2
pages/message/index.vue

@@ -15,7 +15,7 @@
         </view>
       </view>
     </view>
-    <view class="main">
+    <!-- <view class="main">
       <u-row>
         <u-col span="12">
           <view class="menu-item">
@@ -101,7 +101,7 @@
           </view>
         </u-col>
       </u-row>
-    </view>
+    </view> -->
   </view>
 </template>
 <script>

+ 1 - 3
pages/project/create.vue

@@ -171,7 +171,6 @@
               suffixIconStyle="color:#CDCDCD"
               clearable
               customStyle="padding: 0 30rpx 0 12rpx"></u-input>
-            <!-- <amount-input v-model="addForm.nboBudget" placeholder="请输入金额" /> -->
           </u-form-item>
           <u-form-item prop="isBigVal" borderBottom customStyle="padding:40rpx 0 30rpx" @click="showLarge = true">
             <view class="form-label flex_l">
@@ -436,11 +435,10 @@
   import CustomerContact from 'components/CustomerContact'
   import SelectUser from 'components/SelectUser'
   import SelectDealer from 'components/SelectDealer'
-  import AmountInput from 'components/currency'
   import SelectProduct from 'components/SelectProduct'
   export default {
     name: 'omsIndex',
-    components: { SelectCustomer, CustomerContact, SelectUser, SelectDealer, AmountInput, SelectProduct },
+    components: { SelectCustomer, CustomerContact, SelectUser, SelectDealer, SelectProduct },
     data() {
       const validateDistributor = (rule, value, callback) => {
         if ('' === value && this.form.salesModel !== '10')

Разница между файлами не показана из-за своего большого размера
+ 0 - 34
uni_modules/lime-echart/static/echarts.min.js


Некоторые файлы не были показаны из-за большого количества измененных файлов