zs 3 年之前
父節點
當前提交
1626053cb0

+ 10 - 5
pages/indepot/detail.js

@@ -1,5 +1,6 @@
 // pages/login/login.js
 import WxValidate from '../../utils/wxValidate';
+const { stock_type } = require('../../utils/dict');
 const app = getApp()
 Page({
 
@@ -24,10 +25,7 @@ Page({
         img_url: [],
         typeList: [],
         stock_type: '',
-        stock_typeList: [
-            { value: '1', label: '固定资产' },
-            { value: '2', label: '商品' },
-        ]
+        stock_typeList: stock_type
     },
     initValidate() {
         const rules = { register_name: { required: true, }, register_phone: { required: true, }, register_date: { required: true, }, reason: { required: true, } }
@@ -107,7 +105,14 @@ Page({
     },
     // 提交保存
     onSubmit: function (e) {
-        console.log(e.detail.value);
+        const params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+          const error = this.WxValidate.errorList[0];
+          wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+          return false
+        } else {
+          console.log(params);
+        }
     },
     /**
      * 生命周期函数--监听页面加载

+ 1 - 0
pages/indepot/detail.less

@@ -57,6 +57,7 @@
             .order_2 {
                 float: left;
                 width: 100%;
+                margin-top: 1%;
                 .list {
                     margin: 0 0 8px 0;
                     background-color: #f9f9f9;

+ 1 - 0
pages/indepot/detail.wxss

@@ -50,6 +50,7 @@
 .main .one .order .order_2 {
   float: left;
   width: 100%;
+  margin-top: 1%;
 }
 .main .one .order .order_2 .list {
   margin: 0 0 8px 0;

+ 1 - 1
pages/indepot/index.less

@@ -106,7 +106,7 @@
 
         .order_2 {
             float: left;
-            width: 99%;
+            width: 95%;
             padding: 0 5px;
             margin: 5px 0 0 0;
 

+ 1 - 1
pages/indepot/index.wxss

@@ -88,7 +88,7 @@
 }
 .dialog .order .order_2 {
   float: left;
-  width: 99%;
+  width: 95%;
   padding: 0 5px;
   margin: 5px 0 0 0;
 }

+ 8 - 1
pages/outdepot/detail.js

@@ -71,7 +71,14 @@ Page({
   },
   // 提交保存
   onSubmit: function (e) {
-    console.log(e.detail.value);
+    const params = e.detail.value;
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0];
+      wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+      return false
+    } else {
+      console.log(params);
+    }
   },
   /**
    * 生命周期函数--监听页面加载

+ 180 - 147
pages/outdepot/detail.less

@@ -1,167 +1,200 @@
 .main {
-    position: relative;
-    width: 100%;
+  position: relative;
+  width: 100%;
+
+  .one {
+    float: left;
+    width: 95%;
+    padding: 10px;
 
-    .one {
-        float: left;
-        width: 95%;
-        padding: 10px;
-        .content {
-            float: left;
-            width: 100%;
-            padding: 10px 0;
-            box-shadow: 0 0 5px #000000;
-            margin: 0 0 10px 0;
-            border-radius: 5px;
-            .left {
-                float: left;
-                margin: 0 10px;
-              }
-              .left .icon {
-                color: #000000;
-              }
-              .right input {
-                color: #000000;
-              }
-          }
-          .save {
-            float: left;
-            width: 100%;
-            text-align: center;
-          }
-          .save button {
-            margin: 10px;
-          }
-          .order {
-            float: left;
-            width: 95%;
-            padding: 10px;
-            box-shadow: 0 0 5px #000000;
-            margin: 0 0 10px 0;
-            border-radius: 5px;
-            .order_1 {
-                float: left;
-                width: 100%;
-                text-align: center;
-              }
-              .order_1 button {
-                margin: 0 5px;
-              }
-              .order_2 {
-                float: left;
-                width: 100%;
-                .list {
-                    margin: 0 0 8px 0;
-                    background-color: #f9f9f9;
-                    border-radius: 5px;
-                    padding: 8px 0;
-                    .name {
-                        font-size: 16px;
-                        margin: 0 0 5px 0;
-                        padding: 0 10px;
-                      }
-                      .other {
-                        .otherInfo {
-                            margin: 0 0 5px 0;
-                            font-size: 14px;
-                            color: #666666;
-                            padding: 0 10px;
-                          }
-                          .otherInfo text {
-                            color: #000000;
-                          }
-                      }
-                  }
-              }
-              
-          }
-    }
-}
-.dialog {
-    min-height: 30px;
-    max-height: 320px;
-    overflow-y: auto;
-    padding: 0 8px;
-  }
-  .dialog_1 {
     .content {
+      float: left;
+      width: 100%;
+      padding: 10px 0;
+      box-shadow: 0 0 5px #000000;
+      margin: 0 0 10px 0;
+      border-radius: 5px;
+
+      .left {
         float: left;
-        width: 100%;
-        padding: 8px 0;
-        border-radius: 6px;
-        margin: 0 0 5px 0;
-        background-color: #f1f1f1;
-        .left {
-            float: left;
-            margin: 0 10px;
-          }
-          .left text {
-            font-size: 14px;
-            color: #666666;
-          }
-          .right input {
-            font-size: 12px;
-          }
-          
+        margin: 0 10px;
       }
-      .save {
+
+      .left .icon {
+        color: #000000;
+      }
+
+      .right input {
+        color: #000000;
+      }
+    }
+
+    .save {
+      float: left;
+      width: 100%;
+      text-align: center;
+    }
+
+    .save button {
+      margin: 10px;
+    }
+
+    .order {
+      float: left;
+      width: 95%;
+      padding: 10px;
+      box-shadow: 0 0 5px #000000;
+      margin: 0 0 10px 0;
+      border-radius: 5px;
+
+      .order_1 {
         float: left;
         width: 100%;
         text-align: center;
       }
-      .save button {
-        margin: 10px;
+
+      .order_1 button {
+        margin: 0 5px;
       }
-      .search_1 {
+
+      .order_2 {
         float: left;
-        width: 95%;
-        padding: 0 8px;
-        height: 40px;
-        overflow: hidden;
-        border-bottom: 1px dashed #000000;
+        width: 100%;
+
+        .list {
+          margin: 0 0 8px 0;
+          background-color: #f9f9f9;
+          border-radius: 5px;
+          padding: 8px 0;
+
+          .name {
+            font-size: 16px;
+            margin: 0 0 5px 0;
+            padding: 0 10px;
+          }
+
+          .other {
+            .otherInfo {
+              margin: 0 0 5px 0;
+              font-size: 14px;
+              color: #666666;
+              padding: 0 10px;
+            }
+
+            .otherInfo text {
+              color: #000000;
+            }
+          }
+        }
       }
-      .search_1 input {
-        float: left;
-        width: 80%;
-        padding: 2px 5px;
-        margin: 5px 0;
-        border-radius: 5px;
-        border: 1px solid #cccccc;
-        background-color: #ffffff;
+
     }
+  }
+}
 
-    .search_1 text {
-        float: left;
-        width: 13%;
-        margin-top: 2.3%;
-        padding-left: 8px;
-        font-size: 17px;
+.dialog {
+  min-height: 30px;
+  max-height: 320px;
+  overflow-y: auto;
+  padding: 0 8px;
+}
+
+.dialog_1 {
+  .content {
+    float: left;
+    width: 100%;
+    padding: 8px 0;
+    border-radius: 6px;
+    margin: 0 0 5px 0;
+    background-color: #f1f1f1;
+
+    .left {
+      float: left;
+      margin: 0 10px;
+    }
+
+    .left text {
+      font-size: 14px;
+      color: #666666;
     }
-      .search_2 {
+
+    .right input {
+      font-size: 12px;
+    }
+
+  }
+
+  .save {
+    float: left;
+    width: 100%;
+    text-align: center;
+  }
+
+  .save button {
+    margin: 10px;
+  }
+
+  .search_1 {
+    float: left;
+    width: 95%;
+    padding: 0 8px;
+    height: 40px;
+    overflow: hidden;
+    border-bottom: 1px dashed #000000;
+  }
+
+  .search_1 input {
+    float: left;
+    width: 80%;
+    padding: 2px 5px;
+    margin: 5px 0;
+    border-radius: 5px;
+    border: 1px solid #cccccc;
+    background-color: #ffffff;
+  }
+
+  .search_1 text {
+    float: left;
+    width: 13%;
+    margin-top: 2.3%;
+    padding-left: 8px;
+    font-size: 17px;
+  }
+
+  .search_2 {
+    float: left;
+    width: 100%;
+    margin: 0 0 8px 0;
+
+    .search_2list {
+      float: left;
+      width: 100%;
+      margin: 8px 0 0 0;
+      border-radius: 6px;
+      box-shadow: 0 0 5px #cccccc;
+
+      .name {
         float: left;
-        width: 100%;
-        margin: 0 0 8px 0;
-        .search_2list {
-            margin: 8px 0 0 0;
-            border-radius: 6px;
-            box-shadow: 0 0 5px #cccccc;
-            .name {
-                padding: 0 5px;
-              }
-              .name text {
-                width: 67%;
-                float: left;
-                padding: 9px 0;
-                font-size: 14px;
-              }
-              .name button {
-                margin: 5px 0 0 10px;
-              }
-              
+        width: 98%;
+        padding: 0 5px;
       }
+
+      .name text {
+        width: 67%;
+        float: left;
+        padding: 9px 0;
+        font-size: 14px;
+      }
+
+      .name button {
+        margin: 5px 0 0 10px;
+      }
+
+    }
   }
 }
+
 .van-dialog__header {
-    padding-top: 0 !important;
-    padding: 10px 0 !important;
-  }
+  padding-top: 0 !important;
+  padding: 10px 0 !important;
+}

+ 4 - 0
pages/outdepot/detail.wxss

@@ -136,11 +136,15 @@
   margin: 0 0 8px 0;
 }
 .dialog_1 .search_2 .search_2list {
+  float: left;
+  width: 100%;
   margin: 8px 0 0 0;
   border-radius: 6px;
   box-shadow: 0 0 5px #cccccc;
 }
 .dialog_1 .search_2 .search_2list .name {
+  float: left;
+  width: 98%;
   padding: 0 5px;
 }
 .dialog_1 .search_2 .search_2list .name text {

+ 18 - 18
pages/stock/detail.js

@@ -1,5 +1,6 @@
 // pages/login/login.js
 import WxValidate from '../../utils/wxValidate'
+const { stock_type } = require('../../utils/dict');
 const app = getApp()
 Page({
 
@@ -11,25 +12,13 @@ Page({
         // 主体高度
         infoHeight: '',
         // 类型
-        typeList: [
-            { id: '0', name: '其他' },
-            { id: '1', name: '办公生活用品' },
-            { id: '2', name: '办公机械' },
-            { id: '3', name: '金融用品' },
-            { id: '4', name: '纸制品' },
-            { id: '5', name: '书写工具' },
-            { id: '6', name: '桌面办公文具' },
-        ],
-        info: { id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' },
+        typeList: [],
         form: {},
         stock_type: '',
         // 图片
         img_url: [],
         // 商品类型
-        stock_typeList: [
-            { value: '1', label: '固定资产' },
-            { value: '2', label: '商品' },
-        ]
+        stock_typeList: stock_type
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })
@@ -72,20 +61,31 @@ Page({
     },
     // 提交保存
     onSubmit: function (e) {
-        console.log(e.detail.value);
+        const params = e.detail.value;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            console.log(params);
+        }
     },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        if (options.id) {
-            this.setData({ 'form': this.data.info })
-        }
+        // 查询其他数据
+        this.searchOther()
         //验证规则函数
         this.initValidate()
         // 计算高度
         this.searchHeight()
     },
+    // 查询其他信息
+    searchOther: function () {
+        //查询类型
+        console.log('查询类型');
+    },
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;

+ 1 - 4
pages/stock/index.js

@@ -17,10 +17,7 @@ Page({
         // 详细信息
         info: { id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' },
         // 类型
-        typeList: [
-            { value: '1', label: '固定资产' },
-            { value: '2', label: '商品' },
-        ]
+        typeList: []
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })

+ 8 - 5
pages/type/detail.js

@@ -11,7 +11,6 @@ Page({
     // 主体高度
     infoHeight: '',
     // 详细信息
-    info: { id: '1234567', code: '8', name: '其他' },
     form: {},
   },
   initValidate() {
@@ -29,15 +28,19 @@ Page({
   },
   // 提交保存
   onSubmit: function (e) {
-    console.log(e.detail.value);
+    const params = e.detail.value;
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0];
+      wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+      return false
+    } else {
+      console.log(params);
+    }
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    if (options.id) {
-      this.setData({ 'form': this.data.info })
-    }
     //验证规则函数
     this.initValidate();
     // 计算高度

+ 10 - 12
pages/user/detail.js

@@ -1,5 +1,6 @@
 // pages/login/login.js
 import WxValidate from '../../utils/wxValidate'
+const { type } = require('../../utils/dict');
 const app = getApp()
 Page({
 
@@ -13,14 +14,7 @@ Page({
     info: { id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '0', type_name: '超级管理员' },
     form: {},
     // 用户类别
-    typeList: [
-      { value: '0', label: '超级管理员' },
-      { value: '1', label: '科室人员' },
-      { value: '2', label: '办公室人员' },
-      { value: '3', label: '采购部门' },
-      { value: '4', label: '入库管理部门' },
-      { value: '5', label: '财务部门' },
-      { value: '6', label: '供货单位' },]
+    typeList: type
   },
   initValidate() {
     const rules = { type_name: { required: true, }, name: { required: true, }, phone: { required: true, tel: true }, email: { required: true, }, address: { required: true, }, dept: { required: true, }, zw: { required: true, }, company: { required: true, } }
@@ -44,15 +38,19 @@ Page({
   },
   // 提交修改
   onSubmit: function (e) {
-    console.log(e.detail.value)
+    const params = e.detail.value;
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0];
+      wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+      return false
+    } else {
+      console.log(params);
+    }
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    if (options.id) {
-      this.setData({ 'form': this.data.info })
-    }
     //验证规则函数
     this.initValidate();
     // 计算高度

+ 18 - 2
pages/user/index.js

@@ -35,12 +35,28 @@ Page({
   },
   // 密码重置
   toReset: function (e) {
-    wx.showToast({ title: `密码重置`, icon: 'error', duration: 1000 })
+    wx.showModal({
+      content: '您确定密码重置吗?',
+      title: '密码重置',
+      success: (res) => {
+        if (res.confirm) {
+          wx.showToast({ title: `密码重置成功`, icon: 'success', duration: 2000 })
+        }
+      },
+    })
   },
 
   // 刪除信息
   toDel: function (e) {
-    wx.showToast({ title: `刪除信息`, icon: 'error', duration: 1000 })
+    wx.showModal({
+      content: '您确定刪除信息吗?',
+      title: '刪除信息',
+      success: (res) => {
+        if (res.confirm) {
+          wx.showToast({ title: `刪除信息成功`, icon: 'success', duration: 2000 })
+        }
+      },
+    })
   },
   /**
    * 生命周期函数--监听页面加载

+ 23 - 19
pages/user/index.less

@@ -50,7 +50,7 @@
             }
 
             .btn button {
-                margin: 0 5px;
+                margin: 2px 5px;
             }
         }
     }
@@ -62,30 +62,34 @@
     overflow-y: auto;
     padding: 0 8px;
 
-    .content {
-        float: left;
-        width: 100%;
-        padding: 8px 0;
-        border-radius: 6px;
-        margin: 0 0 5px 0;
-        background-color: #f1f1f1;
-
-        .left {
+    .dialog_1 {
+        .content {
             float: left;
-            margin: 0 10px;
-        }
+            width: 100%;
+            padding: 8px 0;
+            border-radius: 6px;
+            margin: 0 0 5px 0;
+            background-color: #f1f1f1;
 
-        .left text {
-            font-size: 14px;
-            color: #666666;
-        }
+            .left {
+                float: left;
+                margin: 0 10px;
+            }
+
+            .left text {
+                font-size: 14px;
+                color: #666666;
+            }
 
-        .right input {
-            font-size: 12px;
+            .right input {
+                font-size: 12px;
+            }
         }
     }
+
 }
+
 .van-dialog__header {
     padding-top: 0 !important;
     padding: 10px 0 !important;
-  }
+}

+ 33 - 31
pages/user/index.wxml

@@ -23,37 +23,39 @@
 </mobile-main>
 <van-dialog use-slot title="{{dialog.title}}" show="{{ dialog.show }}" confirmButtonText="返回">
     <view class="dialog">
-        <view class="content">
-            <view class="left"><text>姓名:</text></view>
-            <view class="right"><input name="name" value="{{info.name}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>电话:</text></view>
-            <view class="right"><input name="phone" value="{{info.phone}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>电子邮箱:</text></view>
-            <view class="right"><input name="email" value="{{info.email}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>联系地址:</text></view>
-            <view class="right"><input name="address" value="{{info.address}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>部门:</text></view>
-            <view class="right"><input name="dept" value="{{info.dept}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>职务:</text></view>
-            <view class="right"><input name="zw" value="{{info.zw}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>工作单位:</text></view>
-            <view class="right"><input name="company" value="{{info.company}}" disabled></input></view>
-        </view>
-        <view class="content">
-            <view class="left"><text>用户类型:</text></view>
-            <view class="right"><input name="type" value="{{info.type}}" disabled></input></view>
+        <view wx:if="{{dialog.type=='1'}}" class="dialog_1">
+            <view class="content">
+                <view class="left"><text>姓名:</text></view>
+                <view class="right"><input name="name" value="{{info.name}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>电话:</text></view>
+                <view class="right"><input name="phone" value="{{info.phone}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>电子邮箱:</text></view>
+                <view class="right"><input name="email" value="{{info.email}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>联系地址:</text></view>
+                <view class="right"><input name="address" value="{{info.address}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>部门:</text></view>
+                <view class="right"><input name="dept" value="{{info.dept}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>职务:</text></view>
+                <view class="right"><input name="zw" value="{{info.zw}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>工作单位:</text></view>
+                <view class="right"><input name="company" value="{{info.company}}" disabled></input></view>
+            </view>
+            <view class="content">
+                <view class="left"><text>用户类型:</text></view>
+                <view class="right"><input name="type" value="{{info.type}}" disabled></input></view>
+            </view>
         </view>
     </view>
 </van-dialog>

+ 5 - 5
pages/user/index.wxss

@@ -42,7 +42,7 @@
   text-align: center;
 }
 .main .two .list .btn button {
-  margin: 0 5px;
+  margin: 2px 5px;
 }
 .dialog {
   min-height: 30px;
@@ -50,7 +50,7 @@
   overflow-y: auto;
   padding: 0 8px;
 }
-.dialog .content {
+.dialog .dialog_1 .content {
   float: left;
   width: 100%;
   padding: 8px 0;
@@ -58,15 +58,15 @@
   margin: 0 0 5px 0;
   background-color: #f1f1f1;
 }
-.dialog .content .left {
+.dialog .dialog_1 .content .left {
   float: left;
   margin: 0 10px;
 }
-.dialog .content .left text {
+.dialog .dialog_1 .content .left text {
   font-size: 14px;
   color: #666666;
 }
-.dialog .content .right input {
+.dialog .dialog_1 .content .right input {
   font-size: 12px;
 }
 .van-dialog__header {