瀏覽代碼

修改eacharts

宇宙无敌M1处理器的MacBook Pro 4 年之前
父節點
當前提交
7e9f1e6976

+ 2 - 1
mini/app.json

xqd
@@ -30,7 +30,8 @@
     "pages/create-project/index",
     "pages/login/index",
     "pages/logs/logs",
-    "pages/about/agreement"
+    "pages/about/agreement",
+    "pages/detailInfo/detailinfo"
   ],
   "tabBar": {
     "custom": true,

+ 19 - 6
mini/pages/data-center/index.js

xqd xqd xqd xqd xqd
@@ -17,7 +17,7 @@ function initChart(canvas, width, height, dpr) {
   canvas.setChart(chart);
 
   option = {
-    // color: ["#5992fd"],
+    color: ["#5992fd"],
     legend: {
       data: []
     },
@@ -308,8 +308,8 @@ Page({
           type: type,
           data: data.data
         }],
-        width:"100%",
-        xAxis:{},
+        width: "100%",
+        xAxis: {},
         yAxis: {},
         tooltip: {},
         grid: {},
@@ -328,7 +328,7 @@ Page({
           type: type,
           data: data.data
         }],
-        xAxis:{},
+        xAxis: {},
         yAxis: {},
         tooltip: {},
       }
@@ -403,6 +403,15 @@ Page({
         grid: {
           left: '15%'
         },
+      },
+      option.title = {
+        text: data.info.flat().join('-'),
+        left: 'center',
+        bottom: 10,
+        textStyle: {
+          fontSize: 14,
+          color: "#5992fd"
+        },
       }
     } else {
       option.xAxis.show = true
@@ -468,10 +477,14 @@ Page({
   navigate: function (e) {
     var url = e.currentTarget.dataset.url
     wx.navigateTo({
-      url: url,
+      url: url + '?status=2',
+    })
+  },
+  detailInfo: function () {
+    wx.navigateTo({
+      url: '../detailInfo/detailinfo',
     })
   },
-
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 1 - 1
mini/pages/data-center/index.wxml

xqd
@@ -74,7 +74,7 @@
       </view>
       <view class="sg-chart">
         <block wx:if="{{chartIndex == 4}}">
-          <detail-table data="{{detail_data}}"></detail-table>
+          <detail-table bindtap="detailInfo" data="{{detail_data}}"></detail-table>
         </block>
         <block wx:else>
           <ec-canvas id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>

+ 33 - 21
mini/pages/data/index.js

xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -7,6 +7,7 @@ import * as echarts from '../../ec-canvas/echarts';
 
 let chart = null;
 let option = {}
+
 function initChart(canvas, width, height, dpr) {
   chart = echarts.init(canvas, null, {
     width: width,
@@ -30,17 +31,15 @@ function initChart(canvas, width, height, dpr) {
       type: 'value',
       show: false,
     },
-    dataZoom: [
-      { //Y轴固定,让内容滚动
-        type: 'slider',
-        show: true,
-        yAxisIndex: [0],
-        start: 1,
-        end: 50,//设置X轴刻度之间的间隔(根据数据量来调整)
-        filterMode:'none',
-        zoomLock: true,
-      },
-    ],
+    dataZoom: [{ //Y轴固定,让内容滚动
+      type: 'slider',
+      show: true,
+      yAxisIndex: [0],
+      start: 1,
+      end: 50, //设置X轴刻度之间的间隔(根据数据量来调整)
+      filterMode: 'none',
+      zoomLock: true,
+    }, ],
     series: [{
       data: [],
       type: 'bar',
@@ -52,8 +51,8 @@ function initChart(canvas, width, height, dpr) {
     }],
     tooltip: {
       trigger: 'axis',
-      axisPointer: {            // 坐标轴指示器,坐标轴触发有效
-        type: 'cross',       // 默认为直线,可选为:'line' | 'shadow' | 'cross'
+      axisPointer: { // 坐标轴指示器,坐标轴触发有效
+        type: 'cross', // 默认为直线,可选为:'line' | 'shadow' | 'cross'
         axis: "y",
       },
       showContent: false
@@ -74,10 +73,18 @@ Page({
     projects: [],
     project_id: '',
     project_ids: [],
-    sort_types: [
-      { text: '筛选类型', value: '' },
-      { text: '按年筛选', value: 'year' },
-      { text: '按月筛选', value: 'month' }
+    sort_types: [{
+        text: '筛选类型',
+        value: ''
+      },
+      {
+        text: '按年筛选',
+        value: 'year'
+      },
+      {
+        text: '按月筛选',
+        value: 'month'
+      }
     ],
     sort_type: '',
     project_names: '',
@@ -134,7 +141,9 @@ Page({
    */
   onLoad: function (options) {
     app.resetDataFilter()
-    api.getByName(this, 'projects/getAll', 'projects', { type: 'drop_menu' });
+    api.getByName(this, 'projects/getAll', 'projects', {
+      type: 'drop_menu'
+    });
   },
 
   // startX(e) {
@@ -165,7 +174,9 @@ Page({
     var chartIndex = this.data.chartIndex
     chartIndex = type == '+' ? (chartIndex + 1) : (chartIndex - 1)
     if (chartIndex < 0 || chartIndex > 2) return false;
-    this.setData({ chartIndex })
+    this.setData({
+      chartIndex
+    })
     this.getChartData()
   },
   popclose: function () {
@@ -302,7 +313,6 @@ Page({
         type: 'value',
         show: false
       }]
-
       option.legend = {
         data: data.legends,
         bottom: 40
@@ -364,6 +374,8 @@ Page({
         bottom: 40
       }
       var title = '设备最大单价费用排行'
+      title = (data.info.length != 0 ? data.info[0] + '-' + data.info[1] + '-' + data.info[2] + '-' + data.info[3] : '') + '\n' + '\n' + title
+      console.log(data)
       option.title = {
         text: title,
         left: 'center',
@@ -456,7 +468,7 @@ Page({
   navigate: function (e) {
     var url = e.currentTarget.dataset.url
     wx.navigateTo({
-      url: url,
+      url: url + '?status=1',
     })
   },
 

+ 66 - 0
mini/pages/detailInfo/detailinfo.js

xqd
@@ -0,0 +1,66 @@
+// pages/detailInfo/detailinfo.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
mini/pages/detailInfo/detailinfo.json

xqd
@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
mini/pages/detailInfo/detailinfo.wxml

xqd
@@ -0,0 +1,2 @@
+<!--pages/detailInfo/detailinfo.wxml-->
+<text>pages/detailInfo/detailinfo.wxml</text>

+ 1 - 0
mini/pages/detailInfo/detailinfo.wxss

xqd
@@ -0,0 +1 @@
+/* pages/detailInfo/detailinfo.wxss */

+ 11 - 4
mini/pages/filter-data/index.js

xqd xqd xqd xqd
@@ -9,6 +9,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    status: '',
     active: 0,
     devices: [],
     device_ids: [''],
@@ -24,7 +25,9 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    this.setData({
+      status: options.status
+    })
   },
 
   onChange: function (e) {
@@ -134,8 +137,10 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-    var data = wx.getStorageSync('sg-data-filters')
-    this.setData(data)
+    if (this.data.status != 1) {
+      var data = wx.getStorageSync('sg-data-filters')
+      this.setData(data)
+    }
     api.getByName(this, 'devices/get', 'devices', {
       type: 'drop_menu'
     });
@@ -156,7 +161,9 @@ Page({
    * 生命周期函数--监听页面隐藏
    */
   onHide: function () {
-    this.saveFilter()
+    if (this.data.status != 1) {
+      this.saveFilter()
+    }
   },
 
   saveFilter() {

+ 3 - 3
mini/pages/filter-data/index.wxml

xqd xqd xqd
@@ -22,7 +22,7 @@
                 data-index="{{index}}" ></van-button>
             </view>
           </view>
-          <view class="sg-margin-tb">
+          <view class="sg-margin-tb" wx:if="{{status!=1}}">
             <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_ids">新增
             </van-button>
           </view>
@@ -42,7 +42,7 @@
                 data-index="{{index}}" disabled="{{index == 0}}"></van-button>
             </view>
           </view>
-          <view class="sg-margin-tb">
+          <view class="sg-margin-tb" wx:if="{{status!=1}}">
             <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_name_ids"
               disabled="{{ device_ids.length > 1||device_ids[0]=='' }}">新增</van-button>
           </view>
@@ -62,7 +62,7 @@
                 data-index="{{index}}" disabled="{{index == 0}}"></van-button>
             </view>
           </view>
-          <view class="sg-margin-tb">
+          <view class="sg-margin-tb" wx:if="{{status!=1}}">
             <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="spec_ids"
               disabled="{{ device_name_ids.length > 1 || device_ids.length > 1 ||device_ids[0]==''||device_name_ids[0]==''}}">新增</van-button>
           </view>