姜永辉 2 лет назад
Родитель
Сommit
0ffac9c014

+ 3 - 8
api/pages/mst/staff.js

@@ -20,14 +20,9 @@ module.exports = {
              add: {key: 'add', url: './add/add'},
           // 功能权限
           staffRight: { key: 'staffRight', url: '/package-base-select/pages/select-staff-right/select-staff-right', image: '/static/img/customerFollow.png', valid: true },
-          // 跟进任务
-          followTask: { key: 'followTask', url: '/package3/pages/follow-up-tasks/follow-up-tasks', image: '/static/img/followTask.png' },
-          // 销售订单
-          order: { key: 'order', url: '/package-sales/pages/order-billing/order-billing', image: '/static/img/order.png', valid: true },
-          // 客户收款
-          collection: { key: 'collection', url: '/package4/pages/order-billing/customer-collection/add/add', image: '/static/img/receive.png' },
-          // 客户合并
-          merge: { key: 'merge', url: '/package4/pages/order-billing/customer-collection/add/add', image: '/static/img/customerFollow.png' },
+          // 范围权限
+          staffPurview: { key: 'staffPurview', url: '/package-base-select/pages/select-staff-purview/select-staff-purview', image: '/static/img/customerFollow.png' },
+          
         }
     }
 };

+ 214 - 62
package-base-select/pages/select-staff-purview/select-staff-purview.js

@@ -1,66 +1,218 @@
-// package-base-select/pages/select-staff-purview/select-staff-purview.js
+const Constants = require('@/utils/Constants.js');
+const util = require('@/utils/util.js')
+const mixins = require('@/mixins/index.js')
+const api = require('@/utils/api.js');
 Page({
+  mixins: [mixins],
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    routeObjName: 'staffPurview',
+    tableData: [],
+    allchecked: false,
+    sideKey: 0,
+  },
+  /**
+    * @desc : 切換是否全部
+    * @date : 2024/2/1 15:49
+    * @author : 姜永辉
+    */
+  onChangeSwitch(e) {
+    this.setData({
+      allchecked: e.detail
+    })
+    let tableData = this.data.tableData
+    if (tableData && tableData.length > 0) {
+      tableData.forEach(res => {
+        res.checked = e.detail
+        if (res.subMenus && res.subMenus.length > 0) {
+          res.subMenus.forEach(it => {
+            it.checked = e.detail
+          })
+        }
+      })
+    }
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
+    this.setData({
+      tableData: tableData
+    })
+  },
+
+  /**
+  * @desc : 保存的參數設置
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+  setParams(params) {
+    // 修改之后的 值
+    params = Object.assign({}, params, this.data.initData);
+    params.roleIds = (params.roleIds && params.roleIds.length > 0) ? params.roleIds.join(',') : undefined
+    let tableData = this.data.tableData
+    console.log("tableData", tableData);
+    let dataIds = []
+    //格式化数据
+    let tableDataTemp = []
+    tableData.forEach(res => {
+      if (res.checked) {
+        dataIds.push(res.id)
+      }
+      if (res.subMenus && res.subMenus.length > 0) {
+        res.subMenus.forEach(it => {
+          if (it.checked) {
+            dataIds.push(it.id)
+          }
+        })
+      }
+    })
+    let staffPurviewList = []
+    let staffPurviewO = {
+      purviewCode: 'PU10000001',
+      staffId: this.data.initData.staffId,
+      flgNolimit: false,
+      dataIds: dataIds.join(',')
+    }
+    params.staffPurviewList = staffPurviewList.push(staffPurviewO)
+    return params
+  },
+
+  /**
+ * @desc : 校验-需要额外校验就在此函数写
+ * @date : 2024/2/1 15:49
+ * @author : 姜永辉
+ */
+  validData() {
+    let params = this.data.formData
+    // 修改之后的 值
+    console.log('validData', params)
+    return true;
+  },
+
+  /**
+  * @desc : 保存数据服务
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+  saveData(params) {
+    console.log("saveData", params);
+    return this.excute(this.data.service, this.data.service.saveStaffPurview, params)
+  },
+
+  /**
+   * @desc : 处理接口返回数据
+   * @date : 2024/2/1 15:49
+   * @author : 姜永辉
+   */
+  handleData(tableData) {
+    console.log("handleData", tableData);
+    let allchecked = true
+    tableData.forEach(it => {
+      if (!it.checked) {
+        allchecked = false
+        return
+      }
+    })
+    this.setData({
+      tableData: util.convertToChildren(tableData),
+      allchecked,
+    })
+  },
+
+  /**
+   * @desc : 设置额外参数
+   * @date : 2024/2/1 15:49
+   * @author : 姜永辉
+   */
+  setSearchParams(params) {
+    params.staffId = this.data.initData.staffId
+    params.cpId = this.data.initData.cpId
+    return params
+  },
+  /**
+   * @desc : 获取数据
+   * @date : 2024/2/1 15:49
+   * @author : 姜永辉
+   */
+  getData(params) {
+    return this.excute(this.data.service, this.data.service.getStaffPurview, params)
+  },
+  /**
+    * @desc : 点击功能权限的返回值
+    * @date : 2024/2/1 15:49
+    * @author : 姜永辉
+    */
+  obtainList(e) {
+    console.log("obtainList", e);
+    this.setData({
+      tableData: e.detail.list
+    })
+  },
+
+  /**
+   * @desc : 加载数据
+   * @date : 2024/2/1 15:49
+   * @author : 姜永辉
+   */
+  loadInit() {
+    this.getPurviewType()
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    let _this = this;
+    wx.getSystemInfo({
+      success: function (res) {
+        _this.setData({
+          windowHeight: res.windowHeight,
+          windowWidth: res.windowWidth
+        })
+      }
+    })
+    //接收父页面传递的参数
+    let that = this
+    const eventChannel = this.getOpenerEventChannel()
+    eventChannel.on('data', function (data) {
+      that.setData({
+        initData: data
+      })
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+  /**
+    * @desc : 加载范围权限类型
+    * @date : 2022/5/15 16:49
+    * @author : 姜永辉
+    */
+  getPurviewType() {
+    let param = {
+      dataSourceCode: 'purviewType',
     }
+    api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param)
+      .then(res => {
+        if (res.data.code === Constants.SUCESS_CODE) {
+          console.log(res);
+          let list = res.data.data
+          let typeList = this.data.typeList || []
+          list.forEach(item2 => {
+            let item = {
+              id: item2.id,
+              code: item2.code,
+              name: item2.name,
+            }
+            typeList.push(item)
+          })
+          this.setData({
+            typeList: typeList
+          })
+        }
+      })
+  },
 })

+ 2 - 1
package-base-select/pages/select-staff-purview/select-staff-purview.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+    "usingComponents": {},
+    "navigationBarTitleText": "范围权限"
 }

+ 46 - 2
package-base-select/pages/select-staff-purview/select-staff-purview.wxml

@@ -1,2 +1,46 @@
-<!--package-base-select/pages/select-staff-purview/select-staff-purview.wxml-->
-<text>package-base-select/pages/select-staff-purview/select-staff-purview.wxml</text>
+<!-- 前台导入wxmlUtil.wxs -->
+<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
+<loading wx:if="{{loading}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<van-sticky scroll-top="0">
+  <!-- 查询条件 -->
+  <dk-dropdown-menu model:searchForm="{{searchForm}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['roleFunName'])}}">
+  </dk-dropdown-menu>
+  <view style="display: flex;background-color: white;padding:18rpx;padding-right: 40rpx;padding-left:40rpx;">
+    <view style="width: 60%;display: flex;">
+      <view style="width: 18%;">
+        <van-image width="40rpx" height="40rpx" src="{{'/static/img/roles.png'}}" />
+      </view>
+      <view class="font" style="width: 82%;">{{initData.orgName}}</view>
+    </view>
+    <view style="width: 50%;text-align: right;">
+      {{initData.staffName}}
+    </view>
+  </view>
+
+</van-sticky>
+
+
+<view class="main-good-class" style="height:{{windowHeight+'px'}}">
+  <scroll-view scroll-y='{{true}}' bindscrolltolower='scrollToLower' lower-threshold='100' class="goods-class" style="height:calc({{windowHeight+'px'}} - 295rpx);overflow: scroll;">
+    <van-cell-group style="display: flex;justify-content: flex-end;width: calc({{windowWidth+'px'}} - 40rpx);" custom-class="width-70">
+      <dk-collapse-item list="{{tableData}}" bind:obtainList="obtainList"></dk-collapse-item>
+    </van-cell-group>
+  </scroll-view>
+
+</view>
+
+<van-sidebar activeKey="{{sideKey}}" bindchange="changeSidebar" custom-class="left-class">
+  <view style="height:calc({{windowHeight+'px'}} - 370rpx );overflow: scroll;">
+    <van-sidebar-item wx:key="index" custom-class="{{sideKey - 1 == index? 'sidebar-item-before': (sideKey + 1 == index?'sidebar-item-next':'sidebar-item')}}" title="{{item.name}}" data-id="{{item.id}}" wx:for="{{typeList}}" />
+  </view>
+</van-sidebar>
+
+
+<!-- 
+<dk-save-bottom flagTypeName="select-functional-permissions" bottomClass="{{true}}" bind:submit="toClose" bind:allClean="toAdd" /> -->
+
+<!--  保存 -->
+<view class="bottom-class">
+  <van-button custom-class="save-button-class" disabled="{{loading}}" loading="{{loading}}" bind:click="save" type="default">保存
+  </van-button>
+</view>

+ 106 - 1
package-base-select/pages/select-staff-purview/select-staff-purview.wxss

@@ -1 +1,106 @@
-/* package-base-select/pages/select-staff-purview/select-staff-purview.wxss */
+.font {
+	font-family: PingFang HK;
+	font-size: 30rpx;
+	font-weight: 400;
+	line-height: 40rpx;
+	letter-spacing: 0em;
+	text-align: left;
+  
+  }
+
+  /**底部的样式*/
+.bottom-class{
+	position: fixed;
+	bottom: 20rpx;
+	width: 100%;
+	align-items: center;
+	justify-content: center;
+	border-top: 2rpx solid #efefef;
+	z-index: 2;
+	display: flex;
+  }
+  
+  /**底部保存按钮的样式*/
+  .save-button-class{
+	width: 640rpx;
+	background: #1B365D !important;
+	border-radius: 15rpx !important;
+	color:#fff !important;
+	font-size: 16px !important;
+	font-weight: 500 !important;
+  }
+
+  
+.sidebar-item{
+	padding: 30rpx 25rpx 20rpx 35rpx !important;
+	font-size:13px !important;
+	background: #ECF2FF !important;
+	color: #95A8CB !important;
+  }
+  
+  .sidebar-item-before{
+	padding: 30rpx 25rpx 20rpx 35rpx !important;
+	font-size:13px !important;
+	background: #ECF2FF !important;
+	border-bottom-right-radius: 30rpx;
+	color: #95A8CB !important;
+  }
+  
+  .sidebar-item-next{
+	padding: 30rpx 25rpx 20rpx 35rpx !important;
+	font-size:13px !important;
+	background: #ECF2FF !important;
+	border-top-right-radius: 30rpx;
+	color: #95A8CB !important;
+  }
+  
+  .van-sidebar-item--selected{
+	position: relative;
+	background: #fff !important;
+	border-radius: 15rpx 30rpx 30rpx 15rpx !important;
+	border: 0 !important;
+	color: black  !important;
+	/* border-top-left-radius: 0;
+	border-top-right-radius: 30rpx;
+	border-bottom-left-radius: 0;
+	border-bottom-right-radius: 30rpx; */
+  }
+  
+  /**左侧字体样式*/
+  .van-sidebar-item__text{
+	width: 70rpx !important;
+  }
+  
+  .van-sidebar-item--selected::after{
+	content: '';
+	position: absolute;
+	left: 0;
+	height: 40rpx;
+	width: 6rpx;
+	background-color: #1B365D;
+	top: calc((100% - 40rpx)/2);
+  }
+
+  
+
+.left-class{
+	color:#0072ff;
+	position: fixed;
+	left:20rpx;
+	top: 210rpx;
+	width:130rpx !important;
+	
+  }
+  
+  .right-class{
+	color:#0072ff;
+	position: fixed;
+	top: 88rpx;
+	width:18% !important;
+  
+  }
+  .width-70{
+	width:80%;
+	/* float:right; */
+  }
+  

+ 20 - 15
package-basic-data/pages/staff/staff.js

@@ -17,13 +17,18 @@ Page({
    */
   data: {
     // 查询条件
-    searchContent: [], 
+    searchContent: [],
 
     // 列表区(内容)
-    contentList: [{ name: 'staffCode', title: '员工编码' }, { name: 'staffPhone', title: '员工电话' }, { name: 'orgName', title: '业务部门' }],
-  
+    contentList: [
+      { name: 'staffCode', title: '员工编码' },
+      { name: 'staffPhone', title: '员工电话' },
+      { name: 'orgName', title: '业务部门' }],
+
     // 弹出按钮
-    buttonList: [{ name: 'staffRight', title: '功能权限' },{ name: 'staffPurview', title: '功能权限' } ],
+    buttonList: [
+      { name: 'staffRight', title: '功能权限' },
+      { name: 'staffPurview', title: '范围权限' }],
 
     totallength: 0, //视图下方提醒数量
 
@@ -36,14 +41,14 @@ Page({
   * @author : 姜永辉
   */
   toDetail(e) {
-    let staffId = e.detail.item.staffId 
+    let staffId = e.detail.item.staffId
     wx.navigateTo({
       url: this.data.route.add.url,
-      events:  {
-         // 回调后,在这里给页面赋值
-         bandData:function(e){
-          console.log("toDetail",e); 
-        }        
+      events: {
+        // 回调后,在这里给页面赋值
+        bandData: function (e) {
+          console.log("toDetail", e);
+        }
       },
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
@@ -61,12 +66,12 @@ Page({
     let _this = this
     wx.navigateTo({
       url: this.data.route.add.url,
-      events :  {
+      events: {
         // 回调后,在这里给页面赋值
-        bandData:function(e){
-          console.log("toAdd",e);
+        bandData: function (e) {
+          console.log("toAdd", e);
           _this.getData()
-        }        
+        }
       },
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
@@ -79,7 +84,7 @@ Page({
    * @date : 2024/2/1 15:49
    * @author : 周兴
    */
-  openValidData(item, name) { 
+  openValidData(item, name) {
     return true;
   },