Browse Source

修改数据中心

yanjie 4 years ago
parent
commit
ddc6aade75

+ 2 - 2
mini/pages/create-order-inner/index.wxml

xqd xqd
@@ -12,7 +12,7 @@
         <view class="sg-label">项目名称</view>
         <input value="{{project ? project.name : ''}}" class="sg-input" disabled="true"></input>
       </view>
-      <view class="sg-form-item sg-pad sg-top-border">
+      <!-- <view class="sg-form-item sg-pad sg-top-border">
         <view class="sg-label">需求工点</view>
         <picker bindchange="onChange" value="{{pointIndex}}" range="{{work_points}}" range-key="name"
           data-name="pointIndex" class="sg-input" disabled="{{!canEdit}}">
@@ -20,7 +20,7 @@
             {{pointIndex >= 0 ? work_points[pointIndex].name : '选择所需的工点'}}
           </view>
         </picker>
-      </view>
+      </view> -->
       <view class="sg-form-item sg-pad sg-top-border">
         <view class="sg-label">调用设备</view>
         <input value="{{devices.length}}" class="sg-input" disabled="true"></input>

+ 11 - 11
mini/pages/create-order/index.wxml

xqd xqd xqd xqd xqd xqd
@@ -36,7 +36,7 @@
     </view>
   </view>
   <van-calendar show="{{ showDate }}" bind:close="switchShowDate" bind:confirm="confirmDate" data-show="{{false}}"
-    type="range" class="sg-calendar" default-date="{{default_dates}}" allow-same-day="{{true}}"/>
+    type="range" class="sg-calendar" default-date="{{default_dates}}" allow-same-day="{{true}}" color="#5992fd"/>
   <view class="sg-device-box" wx:if="{{tabIndex == 1}}">
     <view class="sg-device-list sg-top-border">
       <block wx:if="{{devices.length <= 0}}">
@@ -101,7 +101,7 @@
   <van-dialog show="{{ showAdd }}" use-slot title="{{dialog_type == 'create' ? '添加设备' : '修改设备'}}" show-cancel-button
     bind:confirm="addDevice" bind:cancel="closeshow"  z-index="1" data-show="{{false}}" confirm-button-color="#5693FC">
     <view class="sg-add-device-box sg-pad sg-font-small">
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">设备类型</view>
         <picker bindchange="onChange" value="{{typeIndex}}" range="{{device_types}}" range-key="name"
           data-name="typeIndex" class="sg-input">
@@ -110,7 +110,7 @@
           </view>
         </picker>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center" >
         <view class="sg-label">设备名称</view>
         <block wx:if="{{customName}}">
           <input value="{{customNameVal}}" class="sg-input" bindinput="onChange" data-name="customNameVal"
@@ -124,11 +124,11 @@
             </view>
           </picker>
         </block>
-        <view class="">
+        <view class="" style="width:132rpx">
           <van-checkbox value="{{ customName }}" bind:change="onChange" data-name="customName">自填</van-checkbox>
         </view>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">规格型号</view>
         <block wx:if="{{customSpec}}">
           <input value="{{customSpecVal}}" class="sg-input" bindinput="onChange" data-name="customSpecVal"
@@ -142,11 +142,11 @@
             </view>
           </picker>
         </block>
-        <view class="">
+        <view class="" style="width:132rpx">
           <van-checkbox value="{{ customSpec }}" bind:change="onChange" data-name="customSpec">自填</van-checkbox>
         </view>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">租赁方式</view>
         <block wx:if="{{customRent}}">
           <input value="{{customRentVal}}" class="sg-input" bindinput="onChange" data-name="customRentVal"
@@ -160,21 +160,21 @@
             </view>
           </picker>
         </block>
-        <view class="">
+        <view class="" style="width:132rpx">
           <van-checkbox value="{{ customRent }}" bind:change="onChange" data-name="customRent">自填</van-checkbox>
         </view>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">租赁时间</view>
         <input value="{{ start_date ? start_date + '至' + end_date : '' }}" placeholder="请选择租赁时间" class="sg-input"
           disabled="true" bindtap="switchShowDate" data-show="{{true}}"></input>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">租赁计数</view>
         <input value="{{device_quantity}}" class="sg-input" bindinput="onChange" data-name="device_quantity"
           placeholder="请输入租赁计数" type="number"></input>
       </view>
-      <view class="sg-form-item sg-pad-tb sg-top-border">
+      <view class="sg-form-item sg-pad-tb sg-top-border sg-align-center">
         <view class="sg-label">租赁单价</view>
         <input value="{{device_price}}" class="sg-input" bindinput="onChange" data-name="device_price"
           placeholder="请输入设备单价" type="digit"></input>

+ 1 - 0
mini/pages/create-order/index.wxss

xqd
@@ -31,6 +31,7 @@
   text-align: right;
 }
 .sg-order-box {
+  margin-top: 88rpx;
   background: white;
 }
 .sg-submit-box {

+ 20 - 10
mini/pages/data/index.js

xqd xqd xqd xqd xqd xqd
@@ -28,8 +28,19 @@ function initChart(canvas, width, height, dpr) {
     },
     yAxis: {
       type: 'value',
-      show: false
+      show: false,
     },
+    dataZoom: [
+      { //Y轴固定,让内容滚动
+        type: 'slider',
+        show: true,
+        yAxisIndex: [0],
+        start: 1,
+        end: 50,//设置X轴刻度之间的间隔(根据数据量来调整)
+        filterMode:'none',
+        zoomLock: true,
+      },
+    ],
     series: [{
       data: [],
       type: 'bar',
@@ -46,9 +57,8 @@ function initChart(canvas, width, height, dpr) {
         axis: "y",
       },
       showContent: false
-    }
+    },
   };
-
   chart.setOption(option);
   return chart;
 }
@@ -245,7 +255,7 @@ Page({
       var title = '设备租赁费用明细'
       var date = this.data.date
       date = date.length > 7 ? date.substr(0, 4) + '年' : ''
-      title = (data.project ? data.project.name + '-' : '-') + date + title
+      title = (data.project ? data.project.name + '\n' + '\n' : '-') + date + title
       option.title = {
         text: title,
         left: 'center',
@@ -276,13 +286,13 @@ Page({
         label: {
           show: true
         },
-        name: data.name,
+        // name: data.name,
         type: 'bar',
         data: values
       }]
       option.grid = {
         left: 20,
-        right: 20,
+        right: 35,
         bottom: 60,
         top: 0,
         containLabel: true
@@ -331,13 +341,13 @@ Page({
         label: {
           show: true
         },
-        name: '租赁费用',
+        // name: '租赁费用',
         type: 'bar',
         data: values
       }]
       option.grid = {
         left: 20,
-        right: 20,
+        right: 35,
         bottom: 60,
         top: 0,
         containLabel: true
@@ -384,13 +394,13 @@ Page({
         label: {
           show: true
         },
-        name: '租赁最大单价',
+        // name: '租赁最大单价',
         type: 'bar',
         data: values
       }]
       option.grid = {
         left: 20,
-        right: 20,
+        right: 35,
         bottom: 60,
         top: 0,
         containLabel: true

+ 29 - 9
mini/pages/data/index.wxml

xqd xqd xqd xqd
@@ -1,5 +1,5 @@
 <!--pages/data/index.wxml-->
-<view class="sg-container sg-index-bg">
+<view class=" sg-index-bg">
   <van-popup show="{{ projectShow }}" safe-area-inset-top position="top" custom-style="height: 20%;">
     <van-dropdown-menu active-color="#5992fd">
       <van-dropdown-item value="{{ project_id }}" options="{{ projects }}" bind:change="onChange"
@@ -9,11 +9,12 @@
     </van-dropdown-menu>
     <view class="sg-pad sg-flex sg-align-center sg-space-between">
       <view class="" style="width:300rpx">
-        <van-button size="normal" round  type="info" block bind:click="switchShow" data-show="{{false}}" data-name="projectShow">确定
+        <van-button size="normal" round type="info" block bind:click="switchShow" data-show="{{false}}"
+          data-name="projectShow">确定
         </van-button>
       </view>
-      <view class=""  style="width:300rpx">
-        <van-button size="normal" round  block bind:click="popclose" color="#737477">取消</van-button>
+      <view class="" style="width:300rpx">
+        <van-button size="normal" round block bind:click="popclose" color="#737477">取消</van-button>
       </view>
     </view>
   </van-popup>
@@ -44,7 +45,26 @@
     </view>
   </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 class="sg-flex sg-pad sg-align-center" style="justify-content: space-between;color: #5693FC;">
+      <view class="sg-flex sg-align-center">
+        <view hidden="{{chartIndex == 0}}" bindtap="changeChartIndex" data-type="-">
+          <van-icon name="arrow-left" class="sg-icon-lg sg-index-color" style="font-size:1.3rem" />
+        </view>
+        <view class="zlprice" style="margin-left:15rpx">
+          <view style="margin-right:15rpx" wx:if="{{chartIndex == 1}}">
+            租赁费用
+          </view>
+          <view style="margin-right:15rpx" wx:elif="{{chartIndex == 0}}">
+            租赁金额
+          </view>
+          <view style="margin-right:15rpx" wx:elif="{{chartIndex == 2}}">
+            租赁单价
+          </view>
+        </view>
+        <view hidden="{{chartIndex == 0}}" hidden="{{chartIndex == 2}}" bindtap="changeChartIndex" data-type="+">
+          <van-icon name="arrow" class="sg-icon-lg sg-index-color" style="font-size:1.3rem" />
+        </view>
+      </view>
       <view wx:if="{{projectinfoname!=''&&projectinfoprice!=''}}">
         <view>
           {{projectinfoname}}
@@ -80,13 +100,13 @@
       </view> -->
     </view>
     <view class="sg-chart sg-flex sg-align-center sg-space-between" hidden="{{projectShow}}">
-      <view hidden="{{chartIndex == 0}}" bindtap="changeChartIndex" data-type="-">
+      <!-- <view hidden="{{chartIndex == 0}}" bindtap="changeChartIndex" data-type="-">
         <van-icon name="arrow-left" class="sg-icon-lg sg-index-color" />
-      </view>
+      </view> -->
       <ec-canvas id="mychart-dom-bar" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>
-      <view hidden="{{chartIndex == 0}}" hidden="{{chartIndex == 2}}" bindtap="changeChartIndex" data-type="+">
+      <!-- <view hidden="{{chartIndex == 0}}" hidden="{{chartIndex == 2}}" bindtap="changeChartIndex" data-type="+">
         <van-icon name="arrow" class="sg-icon-lg sg-index-color" />
-      </view>
+      </view> -->
     </view>
   </view>
 </view>

+ 16 - 2
mini/pages/data/index.wxss

xqd
@@ -6,9 +6,23 @@
   border-radius: 16rpx;
   margin-top: 24rpx;
 }
-
+.zlprice{
+  display: flex;
+  align-items: center;
+  flex-direction: column;
+}
+.zlprice::after{
+  content: "";
+  display: inline-block;
+  width: 150rpx;
+  margin-top: 15rpx;
+  height: 10rpx;
+  border-radius: 16rpx;
+  background: #5992fd;
+  margin-right: 15rpx;
+}
 .sg-chart-box {
-  min-height: 90vh;
+  /* min-height: 90vh; */
   border-top-right-radius: 50rpx;
   border-top-left-radius: 50rpx;
   margin-top: 40rpx;

+ 19 - 7
mini/pages/device-inner/index.js

xqd xqd xqd xqd xqd xqd
@@ -19,14 +19,15 @@ Page({
     spec_id: '',
     list: [],
     number: '',
-    stat: null
+    stat: null,
+    device_status: ""
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+
   },
 
   getList: function () {
@@ -42,7 +43,8 @@ Page({
         device_name_id: data.device_name_id,
         spec_id: data.spec_id,
         page: data.page,
-        stat: true
+        stat: true,
+        status: this.data.device_status
       },
       success: function (res) {
         if (res.code == 0) {
@@ -63,13 +65,23 @@ Page({
     })
   },
 
-  onChange: function(e) {
+  onChange: function (e) {
     var name = e.currentTarget.dataset.name
     this.setData({
       [name]: e.detail
     })
   },
 
+  filterSelect: function (e) {
+    let name = e.currentTarget.dataset.status
+    this.setData({
+      device_status: name,
+      touchBottom: false,
+      list: [],
+      page: 1
+    })
+    this.getList()
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -77,7 +89,7 @@ Page({
 
   },
 
-  navigate: function(e) {
+  navigate: function (e) {
     // this.saveFilter()
     wx.navigateTo({
       url: e.currentTarget.dataset.url,
@@ -104,7 +116,7 @@ Page({
     this.search()
   },
 
-  search: function() {
+  search: function () {
     this.setData({
       touchBottom: false,
       list: [],
@@ -138,7 +150,7 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    if(!this.data.touchBottom) {
+    if (!this.data.touchBottom) {
       this.setData({
         page: this.data.page + 1
       })

+ 12 - 7
mini/pages/device-inner/index.wxml

xqd
@@ -1,21 +1,26 @@
 <!--pages/device-inner/index.wxml-->
 <view class="sg-container">
   <view class="sg-top sg-fix-top">
-    <van-search value="{{ number }}" placeholder="按设备固定资产编号模糊搜索" left-icon="none" use-action-slot use-right-icon-slot bind:change="onChange" data-name="number" bind:blur="search">
-      <van-icon name="search" slot="right-icon" class="sg-icon sg-bold" bindtap="search"/>
-      <van-icon name="filter-o" slot="action" class="sg-icon sg-index-color sg-bold" bindtap="navigate" data-url="/pages/filter/index"/>
+    <van-search value="{{ number }}" placeholder="按设备固定资产编号模糊搜索" left-icon="none" use-action-slot use-right-icon-slot
+      bind:change="onChange" data-name="number" bind:blur="search">
+      <van-icon name="search" slot="right-icon" class="sg-icon sg-bold" bindtap="search" />
+      <van-icon name="filter-o" slot="action" class="sg-icon sg-index-color sg-bold" bindtap="navigate"
+        data-url="/pages/filter/index" />
     </van-search>
     <view class="sg-stat-list sg-pad sg-white-bg sg-flex sg-align-center sg-space-around sg-font-xs sg-gray-color">
-      <view class="sg-item">
+      <view class="sg-item" bindtap="filterSelect" data-status=" ">
+        <text>全部:</text><text class="sg-bold" style="color:skyblue">{{stat ? stat.free+stat.using+stat.repair+stat.scrap : 0}}</text>
+      </view>
+      <view class="sg-item" bindtap="filterSelect" data-status="free">
         <text>闲置:</text><text class="sg-bold sg-green">{{stat ? stat.free : 0}}</text>
       </view>
-      <view class="sg-item">
+      <view class="sg-item" bindtap="filterSelect" data-status="using">
         <text>在用:</text><text class="sg-bold sg-red">{{stat ? stat.using : 0}}</text>
       </view>
-      <view class="sg-item">
+      <view class="sg-item" bindtap="filterSelect" data-status="repair">
         <text>维修:</text><text class="sg-bold sg-yellow">{{stat ? stat.repair : 0}}</text>
       </view>
-      <view class="sg-item">
+      <view class="sg-item" bindtap="filterSelect" data-status="scrap">
         <text>报废:</text><text class="sg-bold sg-black">{{stat ? stat.scrap : 0}}</text>
       </view>
     </view>

+ 6 - 2
mini/pages/repair/index.js

xqd xqd
@@ -118,10 +118,14 @@ Page({
   delete: function (e) {
     var parts = this.data.parts
     var index = e.currentTarget.dataset.index
+    this.setData({
+      money: (this.data.money - (parts[index].price - 0)).toFixed(2)
+    })
     parts.splice(index, 1)
     this.setData({
-      parts
+      parts,
     })
+
   },
 
   add: function () {
@@ -147,7 +151,7 @@ Page({
     this.setData({
       parts,
       showAdd: false,
-      money: this.data.money += (part.price - 0)
+      money:  this.data.money += (part.price - 0)
     })
   },
   cancel: function () {