Ver Fonte

修改调整

yanjie há 4 anos atrás
pai
commit
26e31885ea

+ 3 - 3
mini/app.js

xqd xqd
@@ -96,10 +96,10 @@ App({
       [name]: val
     })
   },
-  loginCallback: function(data) {
+  loginCallback: function (data) {
     this.updateUserInfo(data)
     var topRole = data.topRole
-    if(topRole && topRole.key == 'leader') {
+    if (topRole && topRole.key == 'leader') {
       wx.switchTab({
         url: '/pages/account/index',
       })
@@ -108,5 +108,5 @@ App({
         url: '/pages/index/index',
       })
     }
-  }
+  },
 })

+ 16 - 1
mini/pages/data-center/index.js

xqd xqd
@@ -17,6 +17,7 @@ function initChart(canvas, width, height, dpr) {
   canvas.setChart(chart);
 
   option = {
+    // color: ["#5992fd"],
     legend: {
       data: []
     },
@@ -125,16 +126,30 @@ Page({
     var project_ids = []
     var project_names = []
     var projects = this.data.projects
+    let charts = this.data.charts
     for (var i = 0; i < projects.length; ++i) {
       if (projects[i].checked) {
         project_ids.push(projects[i].id)
         project_names.push(projects[i].name)
       }
     }
+    if (project_ids.length > 1) {
+      charts = [{
+        name: '柱状图',
+        type: 'bar'
+      }, {
+        name: '折线图',
+        type: 'line'
+      }, {
+        name: '雷达图',
+        type: 'radar'
+      }]
+    }
     project_names = project_names.join(',')
     this.setData({
       project_ids,
-      project_names
+      project_names,
+      charts
     })
     this.switchShow(e)
     this.getData()

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

xqd xqd
@@ -51,7 +51,7 @@
   <view class="sg-white-bg sg-chart-box" wx:if="{{!projectShow && !dateShow}}">
     <block wx:if="{{project_names}}">
       <view class="sg-flex sg-pad sg-align-center sg-space-between">
-        <view>
+        <view style="color: #5693FC;">
           <picker bindchange="onChange" value="{{chartIndex}}" range="{{charts}}" range-key="name"
             data-name="chartIndex" class="sg-flex-grow">
             <view class="picker sg-flex sg-align-center">
@@ -60,7 +60,7 @@
             </view>
           </picker>
         </view>
-        <view class="sg-flex sg-align-center">
+        <view class="sg-flex sg-align-center" style="color: #5693FC;">
           <!-- <view class="sg-radio-group sg-flex sg-align-center sg-fon-small sg-margin-right sg-light-gray-bg">
             <view class="sg-radio {{index == dateIndex ? 'sg-shadow sg-selected sg-index-bg sg-white sg-bold' : ''}}"
               wx:for="{{dateTypes}}" wx:key="index" data-index="{{index}}" data-name="dateIndex" bindtap="radioChange">

+ 54 - 12
mini/pages/data/index.js

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -7,7 +7,6 @@ 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,
@@ -15,11 +14,11 @@ function initChart(canvas, width, height, dpr) {
     devicePixelRatio: dpr // new
   });
   canvas.setChart(chart);
-  chart.on('click',function(params){
+  chart.on('click', function (params) {
     console.log(params)
   })
   option = {
-    color:["#5992fd"],
+    color: ["#5992fd"],
     legend: {
       data: []
     },
@@ -33,8 +32,21 @@ function initChart(canvas, width, height, dpr) {
     },
     series: [{
       data: [],
-      type: 'bar'
-    }]
+      type: 'bar',
+      label: {
+        normal: {
+          show: true
+        }
+      },
+    }],
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {            // 坐标轴指示器,坐标轴触发有效
+        type: 'cross',       // 默认为直线,可选为:'line' | 'shadow' | 'cross'
+        axis: "y",
+      },
+      showContent: false
+    }
   };
 
   chart.setOption(option);
@@ -47,6 +59,8 @@ Page({
    * 页面的初始数据
    */
   data: {
+    projectinfoname: "",
+    projectinfoprice: "",
     projects: [],
     project_id: '',
     project_ids: [],
@@ -101,7 +115,8 @@ Page({
       onInit: initChart
     },
     detail_data: [],
-    orderBy: 'asc'
+    orderBy: 'asc',
+    recordX: 0
   },
 
   /**
@@ -112,6 +127,29 @@ Page({
     api.getByName(this, 'projects/getAll', 'projects', { type: 'drop_menu' });
   },
 
+  // startX(e) {
+  //   console.log(e)
+  //   this.setData({
+  //     recordX: e.touches[0].clientX
+  //   })
+  // },
+  // moveX(e) {
+  //   console.log(e)
+  //   let currentX = e.changedTouches[0].clientX
+  //   var chartIndex = this.data.chartIndex
+  //   if (currentX - this.data.recordX <= -60) {
+  //     chartIndex = (chartIndex + 1)
+  //     console.log(chartIndex)
+  //   }
+  //   if (currentX - this.data.recordX >= 60) {
+  //     chartIndex = (chartIndex - 1)
+  //     console.log(chartIndex)
+  //   }
+  //   if (chartIndex < 0 || chartIndex > 2) return false;
+  //   this.setData({ chartIndex })
+  //   this.getChartData()
+  // },
+
   changeChartIndex: function (e) {
     var type = e.currentTarget.dataset.type
     var chartIndex = this.data.chartIndex
@@ -120,7 +158,11 @@ Page({
     this.setData({ chartIndex })
     this.getChartData()
   },
-
+  popclose: function () {
+    this.setData({
+      projectShow: false
+    })
+  },
   updateValue: function (e) {
     var name = e.currentTarget.dataset.name
     var value = e.currentTarget.dataset.value
@@ -210,7 +252,7 @@ Page({
         bottom: 10,
         textStyle: {
           fontSize: 14,
-          color:"#5992fd"
+          color: "#5992fd"
         },
       }
       option.yAxis = [{
@@ -248,7 +290,7 @@ Page({
     } else if (chartIndex == 1) {
       option.xAxis = [{
         type: 'value',
-        show:false
+        show: false
       }]
 
       option.legend = {
@@ -265,7 +307,7 @@ Page({
         bottom: 10,
         textStyle: {
           fontSize: 14,
-          color:"#5992fd"
+          color: "#5992fd"
         },
       }
       option.yAxis = [{
@@ -304,7 +346,7 @@ Page({
     } else {
       option.xAxis = [{
         type: 'value',
-        show:false
+        show: false
       }]
 
       option.legend = {
@@ -318,7 +360,7 @@ Page({
         bottom: 10,
         textStyle: {
           fontSize: 14,
-          color:"#5992fd"
+          color: "#5992fd"
         },
       }
       option.yAxis = [{

+ 11 - 2
mini/pages/data/index.wxml

xqd xqd
@@ -1,7 +1,8 @@
 <!--pages/data/index.wxml-->
 <view class="sg-container sg-index-bg">
-  <van-popup show="{{ projectShow }}" position="bottom" custom-style="height: 100%;">
-    <van-dropdown-menu>
+  <van-popup show="{{ projectShow }}" closeable safe-area-inset-top position="top" bind:close="popclose"
+    custom-style="height: 20%;">
+    <van-dropdown-menu active-color="#5992fd">
       <van-dropdown-item value="{{ project_id }}" options="{{ projects }}" bind:change="onChange"
         data-name="project_id" />
       <van-dropdown-item value="{{ sort_type }}" options="{{ sort_types }}" bind:change="onChange"
@@ -40,6 +41,14 @@
   </view>
   <view class="sg-white-bg sg-chart-box">
     <view class="sg-flex sg-pad sg-align-center" style="justify-content: flex-end;color: #5693FC;">
+      <view wx:if="{{projectinfoname!=''&&projectinfoprice!=''}}">
+        <view>
+          {{projectinfoname}}
+        </view>
+        <view>
+          租赁总费用:¥{{projectinfoprice}}.00
+        </view>
+      </view>
       <view wx:if="{{chartIndex == 0}}">
         <van-icon name="setting-o" class="sg-icon-lg" bindtap="switchShow" data-name="projectShow"
           data-show="{{true}}" />

+ 1 - 1
mini/pages/feedback/index.wxml

xqd
@@ -9,7 +9,7 @@
     <view class="sg-pad-tb sg-bottom-border">
       <view class="sg-pad-tb-sm">相关截图(选填)({{files.length ? files.length : 0}}/4)</view>
       <view class="sg-pad-tb-sm">
-        <van-uploader file-list="{{ files }}" bind:after-read="afterRead" bind:delete="delete"/>
+        <van-uploader file-list="{{ files }}" max-count="4" bind:after-read="afterRead" bind:delete="delete"/>
       </view>
     </view>
     <view class="sg-pad-tb sg-flex sg-align-center sg-space-between">

+ 14 - 9
mini/pages/filter-data/index.wxml

xqd xqd xqd
@@ -23,7 +23,8 @@
             </view>
           </view>
           <view class="sg-margin-tb">
-            <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_ids">新增</van-button>
+            <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_ids">新增
+            </van-button>
           </view>
         </view>
       </van-tab>
@@ -34,14 +35,16 @@
             <view wx:for="{{device_name_ids}}" wx:key="index" class="sg-flex sg-align-center">
               <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                 <van-dropdown-item value="{{ item }}" options="{{ names }}" bind:change="onDropChange"
-                  data-name="device_name_ids" data-index="{{index}}"  disabled="{{ device_ids.length > 1 }}"/>
+                  data-name="device_name_ids" data-index="{{index}}"
+                  disabled="{{ device_ids.length > 1 ||device_ids[0]==''}}" />
               </van-dropdown-menu>
-              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete"
-                data-name="device_name_ids" data-index="{{index}}" disabled="{{index == 0}}"></van-button>
+              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete" data-name="device_name_ids"
+                data-index="{{index}}" disabled="{{index == 0}}"></van-button>
             </view>
           </view>
           <view class="sg-margin-tb">
-            <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_name_ids" disabled="{{ device_ids.length > 1 }}">新增</van-button>
+            <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>
         </view>
       </van-tab>
@@ -52,14 +55,16 @@
             <view wx:for="{{spec_ids}}" wx:key="index" class="sg-flex sg-align-center">
               <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                 <van-dropdown-item value="{{ item }}" options="{{ specs }}" bind:change="onDropChange"
-                  data-name="spec_ids" data-index="{{index}}"  disabled="{{ device_name_ids.length > 1 || device_ids.length > 1 }}"/>
+                  data-name="spec_ids" data-index="{{index}}"
+                  disabled="{{ device_name_ids.length > 1 || device_ids.length > 1 ||device_ids[0]==''||device_name_ids[0]==''}}" />
               </van-dropdown-menu>
-              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete"
-                data-name="spec_ids" data-index="{{index}}" disabled="{{index == 0}}"></van-button>
+              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete" data-name="spec_ids"
+                data-index="{{index}}" disabled="{{index == 0}}"></van-button>
             </view>
           </view>
           <view class="sg-margin-tb">
-            <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 }}">新增</van-button>
+            <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>
         </view>
       </van-tab>

+ 1 - 1
mini/pages/order-inner/index.js

xqd
@@ -57,7 +57,7 @@ Page({
       tabIndex
     })
     api.getProject(this)
-    api.getByName(this, 'work-points/get', 'work_points', {type: 'drop_menu'});
+    api.getByName(this, 'work-points/get', 'work_points', {type: 'drop_menu',project_id: id});
     api.getByName(this, 'orders/getRole', 'role', {id: id});
     this.getList();
   },

+ 1 - 0
mini/pages/project/index.js

xqd
@@ -124,6 +124,7 @@ Page({
   navigate: function(e) {
     var url = e.currentTarget.dataset.url
     var id = this.data.id
+    console.log(url)
     if(url == '/pages/device-inner/index?id=' + id) {
       app.resetFilter();
     }