yanjie vor 4 Jahren
Ursprung
Commit
c18696551b

+ 1 - 0
mini/components/out-order-item/index.js

xqd
@@ -11,6 +11,7 @@ Component({
       this.setData({
         user_id: wx.getStorageSync('sg-userinfo').id
       })
+      console.log(this.properties.role)
     },
     detached: function () {
       // 在组件实例被从页面节点树移除时执行

+ 46 - 25
mini/pages/add-inner-device/index.js

xqd xqd xqd xqd
@@ -2,6 +2,7 @@
 import http from '../../utils/http'
 import util from '../../utils/util'
 import api from '../../utils/api'
+import { baseUrl } from '../../utils/env'
 
 Page({
 
@@ -30,13 +31,23 @@ Page({
    */
   onLoad: function (options) {
     var that = this
-    api.getByName(this, 'devices/getThreeLevel', 'device_types', {
-      type: 'drop_menu'
-    }, function () {
-      that.updateNameSpec()
-    });
+    // api.getByName(this, 'devices/getThreeLevel', 'device_types', {
+    //   type: 'drop_menu'
+    // }, function () {
+    //   that.updateNameSpec()
+    // });
     // api.getByName(this, 'inner-devices/get', 'names', {type: 'drop_menu'});
     // api.getByName(this, 'specs/get', 'specs', {type: 'drop_menu'});
+    http({
+      url: "inner-devices/getDeviceName",
+      success: (res) => {
+        if (res.code == 0) {
+          this.setData({
+            names: res.data
+          })
+        }
+      }
+    })
     this.getList()
   },
 
@@ -118,27 +129,37 @@ Page({
   },
 
   onChange: function (e) {
-    var name = e.currentTarget.dataset.name
     this.setData({
-      [name]: e.detail
+      spec: e.detail,
+      list: [],
+      page: 1,
+      touchBottom: false
+    })
+    // if (['type', 'name'].indexOf(name) != -1) {
+    //   if (name == 'type') {
+    //     this.setData({
+    //       name: '',
+    //       spec: ''
+    //     })
+    //   }
+    //   if (name == 'name') {
+    //     this.setData({
+    //       spec: ''
+    //     })
+    //   }
+    //   this.updateNameSpec()
+    // }
+    this.search()
+  },
+  onsearch(e){
+    this.setData({
+      number: e.detail,
+      list: [],
+      page: 1,
+      touchBottom: false
     })
-    if (['type', 'name'].indexOf(name) != -1) {
-      if (name == 'type') {
-        this.setData({
-          name: '',
-          spec: ''
-        })
-      }
-      if (name == 'name') {
-        this.setData({
-          spec: ''
-        })
-      }
-      this.updateNameSpec()
-    }
     this.search()
   },
-
   resetList: function () {
     this.setData({
       list: [],
@@ -158,9 +179,9 @@ Page({
       url: 'inner-devices/search',
       data: {
         number: this.data.number,
-        device_id: this.data.type,
-        device_name_id: this.data.name,
-        spec_id: this.data.spec,
+        // device_id: this.data.type,
+        // device_name_id: this.data.name,
+        device_name_id: this.data.spec,
         page: this.data.page,
         status: 'free'
       },

+ 9 - 12
mini/pages/add-inner-device/index.wxml

xqd
@@ -1,18 +1,15 @@
 <!--pages/add-inner-device/index.wxml-->
 <view class="sg-container">
   <view class="sg-search-box sg-fix-top">
-    <van-dropdown-menu>
-      <van-dropdown-item value="{{ type }}" options="{{ device_types }}" bind:change="onChange" bind:change="onChange"
-        data-name="type" />
-      <van-dropdown-item value="{{ name }}" options="{{ names }}" bind:change="onChange" bind:change="onChange"
-        data-name="name" />
-      <van-dropdown-item value="{{ spec }}" options="{{ specs }}" bind:change="onChange" bind:change="onChange"
-        data-name="spec" />
-    </van-dropdown-menu>
-    <van-search value="{{ number }}" placeholder="请输入固定资产编号模糊查询" bind:change="onChange" data-name="number"
-      left-icon="false" bind:search="search" use-right-icon-slot>
-      <van-icon name="search" bind:tap="search" slot="right-icon"></van-icon>
-    </van-search>
+    <view class="sg-search-box sg-flex sg-align-center">
+      <van-dropdown-menu active-color="#5992fd">
+        <van-dropdown-item value="{{ name }}" options="{{ names }}" bind:change="onChange"/>
+      </van-dropdown-menu>
+      <van-search value="{{ number }}" placeholder="请输入规格型号模糊查询" class="sg-flex-grow" bind:change="onsearch" data-name="number"
+        left-icon="false" bind:search="search" use-right-icon-slot>
+        <van-icon name="search" bind:tap="search" class="sg-index-color sg-icon"  slot="right-icon"></van-icon>
+      </van-search>
+    </view>
   </view>
   <view class="sg-list sg-pad">
     <inner-device-card wx:for="{{list}}" wx:key="index" index="{{index}}" item="{{item}}" showChecked="{{true}}"

+ 2 - 1
mini/pages/add-inner-device/index.wxss

xqd xqd
@@ -1,6 +1,6 @@
 /* pages/add-inner-device/index.wxss */
 .sg-list {
-  margin-top: 220rpx;
+  margin-top: 100rpx;
 }
 .sg-left-item {
   width: 50%;
@@ -10,6 +10,7 @@
 }
 .sg-search-box {
   z-index: 100;
+  background: #fff;
 }
 .sg-submit-box.sg-fix-bottom {
   z-index: 1;

+ 5 - 5
mini/pages/create-order-inner/index.js

xqd xqd
@@ -243,10 +243,10 @@ Page({
     var type = e.currentTarget.dataset.type
     var is_draft = type == 'draft' ? 1 : 2
     var submit_type = this.data.type
-    if (this.data.pointIndex < 0) {
-      util.error('需求工点必填');
-      return false;
-    }
+    // if (this.data.pointIndex < 0) {
+    //   util.error('需求工点必填');
+    //   return false;
+    // }
     if (this.data.devices.length <= 0) {
       util.error('请选择调用设备');
       return false;
@@ -272,7 +272,7 @@ Page({
       data: {
         id: this.data.order_id,
         project_id: this.data.id,
-        work_point_id: work_point.id,
+        // work_point_id: work_point.id,
         remark: this.data.remark,
         devices: this.data.devices,
         is_draft: is_draft,