Ver código fonte

范围权限

姜永辉 2 anos atrás
pai
commit
af0935b673

+ 1 - 1
api/pages/mac/receiptPayment.js

@@ -10,7 +10,7 @@
 module.exports = {
 	receiptPaymentService: {
 		// 前缀
-		prefix: 'mdm-server/mac/recPay/',
+		prefix: 'mdm-server/mac/receipt/',
 		insertReceivableReceipt: 'insert_receivable_receipt',
 		insertPayableReceipt: 'insert_payable_receipt',
 		insertReceipt: 'insert_receipt',

+ 112 - 39
package-base-select/pages/select-staff-purview/select-staff-purview.js

@@ -2,6 +2,8 @@ const Constants = require('@/utils/Constants.js');
 const util = require('@/utils/util.js')
 const mixins = require('@/mixins/index.js')
 const api = require('@/utils/api.js');
+
+const app = getApp()
 Page({
   mixins: [mixins],
   /**
@@ -9,32 +11,21 @@ Page({
    */
   data: {
     routeObjName: 'staffPurview',
+    commonService: app.globalData['commonService'],
     tableData: [],
     allchecked: false,
+    flgNolimit: false,
     sideKey: 0,
+    purviewType: Constants.purviewType.org
   },
   /**
-    * @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
-          })
-        }
-      })
-    }
+  * @desc : 无限制
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+  onChange(e) {
     this.setData({
-      tableData: tableData
+      flgNolimit: !this.data.flgNolimit
     })
   },
 
@@ -64,9 +55,9 @@ Page({
     })
     let staffPurviewList = []
     let staffPurviewO = {
-      purviewCode: 'PU10000001',
+      purviewCode: this.data.purviewType,
       staffId: this.data.item.staffId,
-      flgNolimit: false,
+      flgNolimit: this.data.flgNolimit,
       dataIds: dataIds
     }
     staffPurviewList.push(staffPurviewO)
@@ -88,14 +79,50 @@ Page({
    * @author : 姜永辉
    */
   handleSearchData(tableData) {
-    let allchecked = true
-    tableData.forEach(it => {
-      it.menuName = it.orgName
-    })
-    this.setData({
-      tableData: util.convertToChildren(tableData),
-      allchecked,
-    })
+    console.log(tableData,"tableData");
+    if (this.data.typeList == null) {
+      tableData.forEach(it => {
+        it.menuName = it.orgName
+      })
+      this.setData({
+        tableData: util.convertToChildren(tableData),
+        flgNolimit: (tableData != null && tableData.length > 0) ? tableData[0].flgNolimit : false
+      })
+      return
+    }
+    let item = this.data.typeList[this.data.sideKey];
+    // 渠道
+    if (item.code == Constants.purviewType.channel) {
+      tableData.forEach(it => {
+        it.menuName = it.channelName
+      })
+      this.setData({
+        tableData: tableData,
+        flgNolimit: (tableData != null && tableData.length > 0) ? tableData[0].flgNolimit : false
+      })
+    }
+    // 制单员
+    else if (item.code == Constants.purviewType.make) {
+      tableData.forEach(it => {
+        it.menuName = it.staffName
+      })
+      console.log(tableData[0],tableData != null && tableData.length > 0,"制单员");
+      this.setData({
+        tableData: tableData,
+        flgNolimit: (tableData != null && tableData.length > 0) ? tableData[0].flgNolimit : false
+      })
+
+    } else {
+      tableData.forEach(it => {
+        it.menuName = it.orgName
+      })
+      this.setData({
+        tableData: util.convertToChildren(tableData),
+        flgNolimit: (tableData != null && tableData.length > 0) ? tableData[0].flgNolimit : false
+      })
+    }
+
+
   },
 
   /**
@@ -110,14 +137,31 @@ Page({
   },
 
   /**
+   * @desc : 切换左侧bar
+   * @date : 2024/2/1 15:49
+   * @author : 姜永辉
+   */
+  changeSidebar(e) {
+    this.setData({
+      sideKey: e.detail
+    })
+    let item = this.data.typeList[this.data.sideKey];
+    this.setData({
+      purviewType: item.code
+    })
+    // 默认查询
+    this.searchData();
+  },
+
+  /**
    * @desc : 设置额外参数
    * @date : 2024/2/1 15:49
    * @author : 姜永辉
    */
   setSearchParams(params) {
-    params.staffId = this.data.item.staffId
-    params.cpId = this.data.item.cpId
-    return params
+    let p = params || {}
+    p.staffId = this.data.item.staffId
+    return p
   },
   /**
    * @desc : 获取数据
@@ -125,7 +169,36 @@ Page({
    * @author : 姜永辉
    */
   getData(params) {
-    return this.excute(this.data.service, this.data.service.getStaffPurview, params)
+    if (this.data.typeList == null) {
+      params.purviewCode = this.data.purviewType
+      params.orgName = params.searchText
+      // 业务部门
+      return this.excute(this.data.service, this.data.service.getStaffPurview, params)
+    }
+
+    let item = this.data.typeList[this.data.sideKey]; 
+    
+    // 渠道
+    if (item.code == Constants.purviewType.channel) {
+      params.dataSourceCode = 'saleChannelPurviewType'
+      params.purviewCode = item.code
+      params.channelName = params.searchText
+      return this.excute(this.data.commonService, this.data.commonService.getInitData,params)
+    }
+    // 制单员
+    else if (item.code == Constants.purviewType.make) {
+      params.dataSourceCode = 'staffPurviewType'
+      params.purviewCode = item.code
+      params.staffName = params.searchText
+      return this.excute(this.data.commonService, this.data.commonService.getInitData,params)
+    } else {
+      params.purviewCode = this.data.purviewType
+      params.orgName = params.searchText
+      // 业务部门
+      return this.excute(this.data.service, this.data.service.getStaffPurview, params)
+    }
+
+
   },
   /**
     * @desc : 点击功能权限的返回值
@@ -144,7 +217,7 @@ Page({
    * @author : 姜永辉
    */
   loadInit() {
-    this.getPurviewType()
+    this.getInitData('purviewType')
   },
 
   /**
@@ -163,15 +236,15 @@ Page({
   },
 
   /**
-    * @desc : 加载范围权限类型
+    * @desc : 加载范围权限类型 渠道
     * @date : 2022/5/15 16:49
     * @author : 姜永辉
     */
-  getPurviewType() {
+  getInitData(dataSourceCode) {
     let param = {
-      dataSourceCode: 'purviewType',
+      dataSourceCode: dataSourceCode,
     }
-    api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param)
+    api.request(Constants.BASIC_WX_COMMON_API + 'get_wx_init_data', 'POST', param)
       .then(res => {
         if (res.data.code === Constants.SUCESS_CODE) {
           let list = res.data.data

+ 12 - 6
package-base-select/pages/select-staff-purview/select-staff-purview.wxml

@@ -3,7 +3,7 @@
 <loading wx:if="{{loading}}"></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
-  <dk-dropdown-menu model:searchForm="{{searchForm}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['roleFunName'])}}">
+  <dk-dropdown-menu model:value="{{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;">
@@ -21,23 +21,29 @@
 
 
 <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>
+      <view style="margin-left:28rpx ;margin-top:25rpx ;">
+        <van-cell title="不限制">
+          <van-switch size="18px" checked="{{ flgNolimit}}" bind:change="onChange" active-color="#1B365D" />
+        </van-cell>
+      </view>
+
+      <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;">
+  <view style="height:calc({{windowHeight+'px'}} - 360rpx );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 style="height: 130rpx;"></view>
 
 <!--  保存 -->
 <view class="bottom-class">

+ 29 - 0
package-base-select/pages/select-staff-purview/select-staff-purview.wxss

@@ -19,6 +19,35 @@
 	z-index: 2;
 	display: flex;
   }
+
+  
+.nomal-label,
+.nomal-label>view {
+  color: #95A8CB !important;
+  font-size: 14px;
+}
+
+/**普通label*/
+.nomal-label .van-field__label {
+  color: #95A8CB !important;
+  font-size: 14px !important;
+}
+
+/**普通label*/
+.nomal-label {
+  color: #95A8CB !important;
+  font-size: 14px !important;
+}
+
+
+  
+/**cell值颜色**/
+.dk-cell-value-class {
+	text-align: left !important;
+	font-size: 13px !important;
+	color: #1B365D !important;
+	font-weight: normal;
+  }
   
   /**底部保存按钮的样式*/
   .save-button-class{

+ 0 - 2
package-basic-data/pages/staff/staff.js

@@ -47,8 +47,6 @@ Page({
       { name: 'staffPurview', title: mixins.$t('purviewPermissions') },
       { name: 'leaveOffice', title: mixins.$t('leaveOffice') },
     ],
-
-
     // 主键Id
     primaryKey: 'staffId',
     // 路由

+ 93 - 85
utils/Constants.js

@@ -12,6 +12,8 @@ module.exports = {
   APP_CODE: 'CP-WXP',
   //页面加载数据API
   BASIC_COMMON_API: "mdm-server/mst/common/",
+  //页面加载数据API
+  BASIC_WX_COMMON_API: "mdm-server/wxapi/basic/common/",
   //供应商停用api
   BASIC_SUPLIER_API: "mdm-server/mst/supplier/",
   // 系统用户接口
@@ -85,6 +87,12 @@ module.exports = {
     inventorySku: 'inventorySku', //sku库存
   },
 
+  purviewType: {
+    org: 'PU10000001',
+    channel: 'PU10000002',
+    make: 'PU10000003',
+  },
+
   // 表单类型
   gradeCode: {
     // 标准版
@@ -110,38 +118,38 @@ module.exports = {
     // 其他
     other: 'other',
     //详情编辑
-    detailEdit:'detailEdit'
+    detailEdit: 'detailEdit'
   },
 
   // 查询条件日期数据源
   searchDateSource: [{
-      text: '本日',
-      value: 1
-    },
-    {
-      text: '本周',
-      value: 2
-    },
-    {
-      text: '本月',
-      value: 3
-    },
-    {
-      text: '本年',
-      value: 4
-    },
-    {
-      text: '近7天',
-      value: 6
-    },
-    {
-      text: '近30天',
-      value: 5
-    },
-    {
-      text: '自定义',
-      value: -2
-    },
+    text: '本日',
+    value: 1
+  },
+  {
+    text: '本周',
+    value: 2
+  },
+  {
+    text: '本月',
+    value: 3
+  },
+  {
+    text: '本年',
+    value: 4
+  },
+  {
+    text: '近7天',
+    value: 6
+  },
+  {
+    text: '近30天',
+    value: 5
+  },
+  {
+    text: '自定义',
+    value: -2
+  },
   ],
 
   // 收付款类型
@@ -182,29 +190,29 @@ module.exports = {
 
   // 出库进度
   outStatusList: [{
-      name: '未出库',
-      code: '出库状态-未出',
-      id: 0,
-      infotype: 'default'
-    },
-    {
-      name: '出库中',
-      code: '出库状态-部分',
-      id: 1,
-      infotype: 'default'
-    },
-    {
-      name: '已出库',
-      code: '出库状态-完成',
-      id: 2,
-      infotype: 'default'
-    },
-    {
-      name: '有退货',
-      code: '出库状态-退货',
-      id: 3,
-      infotype: 'default'
-    }
+    name: '未出库',
+    code: '出库状态-未出',
+    id: 0,
+    infotype: 'default'
+  },
+  {
+    name: '出库中',
+    code: '出库状态-部分',
+    id: 1,
+    infotype: 'default'
+  },
+  {
+    name: '已出库',
+    code: '出库状态-完成',
+    id: 2,
+    infotype: 'default'
+  },
+  {
+    name: '有退货',
+    code: '出库状态-退货',
+    id: 3,
+    infotype: 'default'
+  }
   ],
 
   // 对象类型
@@ -265,7 +273,7 @@ module.exports = {
    * @author : 王英杰
    * @date   : 2024/3/9 16:17
    */
-  checkStaus:{
+  checkStaus: {
     STAGING: '盘点状态-暂存',
     COMPLETE: '盘点状态-完成'
   },
@@ -283,27 +291,27 @@ module.exports = {
    * @author : 周兴
    * @date   : 2024/3/27 10:07
    */
-  tables:{
+  tables: {
     // 销售订单
-    order:'t_psi_order',
+    order: 't_psi_order',
     // 采购订单
-    purchase:'t_psi_purchase',
+    purchase: 't_psi_purchase',
     // 出库单
-    outbound:'t_psi_outbound',
+    outbound: 't_psi_outbound',
     // 入库单
-    inbound:'t_psi_inbound',
+    inbound: 't_psi_inbound',
     // 库存盘点
-    check:'t_psi_check',
+    check: 't_psi_check',
     // 库存调整
-    transfer:'t_psi_transfer',
+    transfer: 't_psi_transfer',
     // 资金转账
-    macTransfer:'t_mac_transfer',
+    macTransfer: 't_mac_transfer',
     // 收付款单
-    recPay:'t_mac_rec_pay',
+    recPay: 't_mac_rec_pay',
     // 其他收入单
-    income:'t_mac_income',
+    income: 't_mac_income',
     // 其他支出单
-    outlay:'t_mac_outlay',
+    outlay: 't_mac_outlay',
   },
 
   /**
@@ -311,11 +319,11 @@ module.exports = {
    * @author : 周兴
    * @date   : 2024/4/1 10:18
    */
-  settingCode:{
+  settingCode: {
     // 自动办理标识
-    IVT001:'IVT_001',
+    IVT001: 'IVT_001',
     // 允许负库存
-    IVT002:'IVT_002',
+    IVT002: 'IVT_002',
   },
 
   /**
@@ -325,7 +333,7 @@ module.exports = {
    */
   uploadFileConfig: {
     maxSize: 10485760,//图片大小的最大值 10MB 10240kb 10485760字节
-    maxSizeMB :'10MB',
+    maxSizeMB: '10MB',
     acceptPicType: 'image/png,image/jpeg,image/jpg',// 接受上传的图片类型
     acceptVideoType: 'video/mp4,video/avi,video/mov',// 接受上传的视频类型
     acceptExcel: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel ',
@@ -360,26 +368,26 @@ module.exports = {
 
   // 收款进度
   receiveStatusList: [{
-      name: '未收款',
-      code: '收款状态-未收',
-      id: 0,
-      infotype: 'default'
-    },
-    {
-      name: '部分收款',
-      code: '收款状态-部分',
-      id: 1,
-      infotype: 'default'
-    },
-    {
-      name: '收款完成',
-      code: '收款状态-完成',
-      id: 2,
-      infotype: 'default'
-    }
+    name: '未收款',
+    code: '收款状态-未收',
+    id: 0,
+    infotype: 'default'
+  },
+  {
+    name: '部分收款',
+    code: '收款状态-部分',
+    id: 1,
+    infotype: 'default'
+  },
+  {
+    name: '收款完成',
+    code: '收款状态-完成',
+    id: 2,
+    infotype: 'default'
+  }
   ],
   //菜单编码  客户退款
-  CUSTOMER_EFUND_FUNCTIONCODE:'2260c936-c469-404c-85ed-aa5046fc8684',
+  CUSTOMER_EFUND_FUNCTIONCODE: '2260c936-c469-404c-85ed-aa5046fc8684',
 
   //销售订单相关API
   SALE_ORDER_API: "order-server/wxapi/sale/order/",