瀏覽代碼

角色管理

zhaoxiaohai 3 年之前
父節點
當前提交
8fd7c93d06
共有 3 個文件被更改,包括 34 次插入27 次删除
  1. 30 24
      pages/teams/addRole.js
  2. 2 1
      pages/teams/addRole.json
  3. 2 2
      pages/teams/addRole.wxml

+ 30 - 24
pages/teams/addRole.js

@@ -1,4 +1,5 @@
 const _Http = getApp().globalData.http;
+const getHeight = require("../../utils/getRheRemainingHeight.js");
 
 Page({
 
@@ -6,6 +7,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        height: 0,
         roleid: -1, //角色id
         appList: [], //应用列表
         fromList: [{
@@ -46,6 +48,26 @@ Page({
         }
         this.query_appselect();
     },
+    /* 查询应用列表 */
+    query_appselect() {
+        _Http.basic({
+            "classname": "sale.role.role",
+            "method": "query_appselect",
+            "content": {
+                "roleid": this.data.roleid
+            }
+        }).then(res => {
+            console.log("应用列表", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
+            this.setData({
+                roleid: this.data.roleid == -1 ? 0 : this.data.roleid,
+                appList: res.data
+            })
+        })
+    },
     /* 提交数据 */
     submitRole() {
         if (this.data.disabled || this.data.loading) return;
@@ -74,9 +96,6 @@ Page({
             this.setData({
                 disabled: true
             })
-            wx.showToast({
-                title: '保存成功!',
-            })
             let pages = getCurrentPages(),
                 prevPage = pages[pages.length - 2];
             prevPage.getList(true);
@@ -84,34 +103,21 @@ Page({
                 wx.navigateBack({
                     delta: 0
                 })
+                wx.showToast({
+                    title: '保存成功!',
+                })
             }, 300)
         })
     },
-    /* 查询应用列表 */
-    query_appselect() {
-        _Http.basic({
-            "classname": "sale.role.role",
-            "method": "query_appselect",
-            "content": {
-                "roleid": this.data.roleid
-            }
-        }).then(res => {
-            console.log("应用列表", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            this.setData({
-                roleid: this.data.roleid == -1 ? 0 : this.data.roleid,
-                appList: res.data
-            })
-        })
-    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady() {
-
+        getHeight.getHeight('.module-navigation', this).then(res => {
+            this.setData({
+                height: res - 130
+            })
+        })
     },
 
     /* 表单是否完成 */

+ 2 - 1
pages/teams/addRole.json

@@ -1,6 +1,7 @@
 {
     "navigationBarTitleText": "新建角色",
     "usingComponents": {
-        "My_form": "/components/My_form/index"
+        "My_form": "/components/My_form/index",
+        "My_categoryListings": "/components/My_categoryListings/index"
     }
 }

+ 2 - 2
pages/teams/addRole.wxml

@@ -4,8 +4,8 @@
     <view>模块</view>
     <view>应用</view>
 </view>
-<My_empty wx:if="{{appList.length==0}}" />
-<view style="height: 130rpx;" />
+<My_categoryListings height='{{height}}' list='{{appList}}'></My_categoryListings>
+
 <view class="footer">
     <van-button disabled='{{disabled}}' loading='{{loading}}' bindtap="submitRole" loading-text="保存中..." custom-class='submit'>保存</van-button>
 </view>