Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss_wx_app

wangyingjie 2 лет назад
Родитель
Сommit
c8e4c979bb

+ 21 - 0
api/pages/mst/comMenu.js

@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright(c) 2024 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:
+ *		2.功能描述:常用功能查询方法
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		周兴		    2024-3-28     1.00		       	新建
+ *******************************************************************************/
+module.exports = {
+
+  comMenuService: {
+    // 前缀
+    prefix: 'mdm-server/mst/comMenu/',
+  },
+
+  routeUrl: {
+    comMenu: {
+    }
+  }
+};

+ 2 - 1
app.js

@@ -62,10 +62,11 @@ const inboundReturn = require('./api/pages/ivt/inboundReturn.js');
 const cusReceiptPayment = require('./api/pages/mac/cusReceiptPayment.js');
 const menuFrequency = require('./api/pages/mst/menuFrequency.js');
 const userMenuFrequency = require('./api/pages/mst/userMenuFrequency.js');
+const comMenu = require('./api/pages/mst/comMenu.js');
 
 // api服务路由文件
 var apiList = [common, oauth,setting, company, wechatPay,user, staff, staffRight, staffPurview, settingValue, customer, role, roleFun, org, roleSensitive, goodsBrand, goodsCategory, goodsSeries, unit, supplier, warehouse, saleChannel, goodsSku, basicData,customerMst,purchase,account,
-  receiptPayment,inbound,inboundOther,inboundProcessing,inboundPurchaseReturn,outbound,outboundOther,outboundProcessing,outboundSaleReturn,inventory,moneyAccount,intoReturn,intoReturnItem,cusFollow,order,transfer,income,saleOutBound,inboundReturn,cusReceiptPayment,menuFrequency,userMenuFrequency]
+  receiptPayment,inbound,inboundOther,inboundProcessing,inboundPurchaseReturn,outbound,outboundOther,outboundProcessing,outboundSaleReturn,inventory,moneyAccount,intoReturn,intoReturnItem,cusFollow,order,transfer,income,saleOutBound,inboundReturn,cusReceiptPayment,menuFrequency,userMenuFrequency,comMenu]
 
 const util = require('./utils/util.js')
 const baseMethod = require('./api/pages/baseMethod.js')

+ 52 - 47
components/dkbase/dk-form-bill/dk-form-bill.js

@@ -112,7 +112,7 @@ Component({
     quantityMin: { //步进器 最小值
       type: String,
     },
-    quantityMax:{
+    quantityMax: {
       type: String
     },
     showPopFlag: { //弹窗标识  true 不弹窗
@@ -153,46 +153,51 @@ Component({
     delValidFlag: {
       type: Boolean,
     },
-      // 对象取值列
-      objCol: {
-        type: String
-      },
-      // 对象列名
-      objLabel: {
-        type: String
-      },
-      // 对象类型(客户customer;供应商supplier)
-      objType: {
-        type: String
-      },
-      // 对象标题
-      objTitle: {
-        type: String,
-        value: 'cusName'
-      },
-      // 对象副标题
-      objSubTitle: {
-        type: String,
-        value: 'cusPhone'
-      },
-      // 金额标题
-      amountTitle: {
-        type: String,
-        value: '应收金额'
-      },
-      // 金额列
-      amountCol: {
-        type: String,
-        value: 'receivableResidue'
-      },
-      // 对象Id列
-      objIdCol: {
-        type: String,
-        value: 'cusId'
-      },
-      chooseText:{
-        type: String,
-      },
+    // 对象取值列
+    objCol: {
+      type: String
+    },
+    // 对象列名
+    objLabel: {
+      type: String
+    },
+    // 对象类型(客户customer;供应商supplier)
+    objType: {
+      type: String
+    },
+    // 对象标题
+    objTitle: {
+      type: String,
+      value: 'cusName'
+    },
+    // 对象副标题
+    objSubTitle: {
+      type: String,
+      value: 'cusPhone'
+    },
+    // 金额标题
+    amountTitle: {
+      type: String,
+      value: '应收金额'
+    },
+    // 金额列
+    amountCol: {
+      type: String,
+      value: 'receivableResidue'
+    },
+    // 对象Id列
+    objIdCol: {
+      type: String,
+      value: 'cusId'
+    },
+    chooseText: {
+      type: String,
+    },
+    // 用于联动控制选商品按钮
+    chooseVisible:{
+      type:Boolean,
+      value:true
+    },
     // 结果集
     value: {
       type: String,
@@ -229,7 +234,7 @@ Component({
     itemName: 'goodsList',
     deleteName: 'deleteList',
     selectGoodsUrl: null,
-    chooseVisible: true,  // 用于联动控制选商品按钮
+    // chooseVisible: true,  // 用于联动控制选商品按钮
     maxSize: Constants.uploadFileConfig.maxSize,
     // popContent:
     //   [{ code: 'quantity', type: 'step', title: '数量', required: true }, { code: 'pricePromotion', type: 'number', title: '销售价格', required: true }, { code: 'warehouseId', name: 'warehouseName', type: 'drop', required: true, dropType: 'warehouse' , required: true}, { code: 'color', type: 'str', title: '批次号' , required: true}, { code: 'giftFlag', type: 'checkbox', title: '赠品标识' }],
@@ -1060,20 +1065,20 @@ Component({
       let deleteFlag = true;
       let item = e.currentTarget.dataset.item
       // 判断删除前是否需要判断
-      if(this.data.delValidFlag){
+      if (this.data.delValidFlag) {
         // 行不允许删除
-        if(item.deleteFlag == false){
+        if (item.deleteFlag == false) {
           deleteFlag = false;
         }
       }
       // 不允许删除给出提示信息
-      if(!deleteFlag){
+      if (!deleteFlag) {
         wx.showToast({
-          title: item.message?item.message:'不满足删除条件',
+          title: item.message ? item.message : '不满足删除条件',
           image: '/static/image/warning.png',
           duration: 2000
         })
-      }else{
+      } else {
         const { instance } = e.detail;
         let index = e.currentTarget.dataset.index
         // 删除明细

+ 122 - 7
pages/index/index.js

@@ -19,6 +19,10 @@ Page({
    * 页面的初始数据
    */
   data: {
+    showMore: false,
+    editFlag: false, // 编辑模式
+    comMenuList: [], // 常用功能
+    comMenuListForCheck:[] ,// 常用功能(简单数组)用于判断
     allCondition: '',//搜索菜单
     noticeShowFlag: true,// 是否显示通知的
     loadingShow: false,
@@ -341,8 +345,8 @@ Page({
         ImageUri: '/static/img/collection.png',
         PFunctionCode: '05',
         FunctionCode: '0509'
-      }, 
-      { 
+      },
+      {
         FunctionName: '资金账户',
         FormName: '/package-accounts-manage/pages/fund-account/fund-account',
         ImageUri: '/static/img/collection.png',
@@ -459,7 +463,56 @@ Page({
 
     ],
   },
-
+  /**
+   * @desc   : 展开收缩
+   * @author : 周兴
+   * @date   : 2024/1/26 11:46
+   */
+  expand() {
+    let showMore = this.data.showMore;
+    this.setData({
+      showMore: !showMore
+    })
+  },
+  /**
+  * @desc : 进入编辑模式
+  * @author : 周兴
+  * @date : 2024/3/29
+  */
+  toEdit() {
+    let editFlag = this.data.editFlag
+    editFlag = !editFlag;
+    let showMore = this.data.showMore
+    if (editFlag) {
+      showMore = true;
+    }
+    this.setData({
+      showMore: showMore,
+      editFlag: editFlag
+    })
+  },
+  /**
+  * @desc : 查询常用应用
+  * @author : 周兴
+  * @date : 2024/3/29
+  */
+  getComMenu() {
+    let params = {
+      staffId: app.globalData.user.staffId,
+      appCode: Constants.APP_CODE,
+    }
+    let service = app.globalData['comMenuService']
+    api.request(service.prefix + service.selectByCond, 'POST', params).then(res => {
+      if (res.data.code == Constants.SUCESS_CODE) {
+        let comMenuList = res.data.data
+        let comMenuListForCheck = comMenuList.map(it=>it.menuUuid)
+        this.setData({
+          comMenuList: comMenuList,
+          comMenuListForCheck:comMenuListForCheck
+        })
+      }
+    });
+  },
   /**
  * 过滤菜单
  */
@@ -636,11 +689,25 @@ Page({
    */
   onLoad: function (options) {
     // 调用权限时候放开
-    this.filterFunction()
+    this.filterFunction();
+    // 查询常用功能
+    this.getComMenu();
   },
 
   /* 点击icon事件 */
   toApp(e) {
+    // 编辑模式不跳页
+    if (this.data.editFlag) {
+      let comFlag = e.currentTarget.dataset.com
+      // 删除常用功能
+      if(comFlag){
+        this.delCom(e.currentTarget.dataset.item);
+      }else{
+        // 增加到常用功能
+        this.addToCom(e.currentTarget.dataset.item);
+      }
+      return;
+    }
     let url = e.currentTarget.dataset.url
     let code = e.currentTarget.dataset.code
     if (!url) {
@@ -655,12 +722,60 @@ Page({
     // 调转页面
     wx.navigateTo({
       url: url,
-      success: function(res) {
-        res.eventChannel.emit('params', { formMode:'index',functionCode:e.currentTarget.dataset.code })
+      success: function (res) {
+        res.eventChannel.emit('params', { formMode: 'index', menuUuid: code })
       }
     })
   },
-
+  /**
+   * @desc : 删除常用应用
+   * @author : 周兴
+   * @date : 2024/3/29 9:16
+   */
+  delCom(item){
+    let comMenuList = this.data.comMenuList
+    let comMenuListForCheck = this.data.comMenuListForCheck
+    comMenuList = comMenuList.filter(it=>it.menuUuid != item.menuUuid)
+    comMenuListForCheck.filter(it=>it != item.menuUuid)
+    this.setData({
+      comMenuList:comMenuList,
+      comMenuListForCheck:comMenuListForCheck
+    })
+  },
+  /**
+   * @desc : 添加到常用应用中
+   * @author : 周兴
+   * @date : 2024/3/29 9:16
+   */
+  addToCom(item) {
+    let comMenuList = this.data.comMenuList
+    let comMenuListForCheck = this.data.comMenuListForCheck
+    let it = {}
+    it.menuUuid = item.FunctionCode
+    it.objectPath = item.FormName
+    let imageUri = item.ImageUri + ''
+    it.objectIcon = imageUri ? (imageUri.substring(imageUri.lastIndexOf('/') + 1)) : ''
+    it.menuName = item.FunctionName
+
+    console.log('er', it, comMenuList);
+    let filters = comMenuList.filter(t => t.menuUuid == it.menuUuid);
+    if (!filters || filters.length == 0) {
+      if (comMenuList && comMenuList.length >= 9) {
+        wx.showToast({
+          title: '常用应用不超过9个',
+          image: '/static/image/warning.png',
+          duration: 1000
+        })
+        return
+      }
+      comMenuList.push(it);
+      comMenuListForCheck.push(it.menuUuid)
+    }
+    this.setData({
+      comMenuList: comMenuList,
+      comMenuListForCheck:comMenuListForCheck
+    })
+  },
 
   /**
      * 页面相关事件处理函数--监听用户下拉动作

+ 1 - 1
pages/index/index.json

@@ -1,6 +1,6 @@
 {
   "usingComponents": {},
-  "navigationBarTitleText":"应用",
+  "navigationBarTitleText":"应用中心",
   "enablePullDownRefresh": true,
   "backgroundColor": "#F8F9FD"
 }

+ 87 - 44
pages/index/index.wxml

@@ -1,58 +1,101 @@
 <wxs module="m1">
-	var hasAuth = function (array, auth) {
-		return array.indexOf(auth) !== -1;
-	}
-	module.exports.hasAuth = hasAuth;
+  var hasAuth = function (array, auth) {
+    return array.indexOf(auth) !== -1;
+  }
+  module.exports.hasAuth = hasAuth;
 
-	var defineIndexOf = function (str, val) {
-		if (str != null) {
-			return str.indexOf(val);
-		}
-	}
-	module.exports.defineIndexOf = defineIndexOf;
+  var defineIndexOf = function (str, val) {
+    if (str != null) {
+      return str.indexOf(val);
+    }
+  }
+  module.exports.defineIndexOf = defineIndexOf;
 
-	var getInfoNum = function (array, infos, val) {
-		var num;
-		if (array.indexOf(val) >= 0) {
-			for (var i = 0; i < infos.length; i++) { if (infos[i].code === val) { num = infos[i].num; break; } }
-		} return num
-	}
-	module.exports.getInfoNum = getInfoNum; 
+  var getInfoNum = function (array, infos, val) {
+    var num;
+    if (array.indexOf(val) >= 0) {
+      for (var i = 0; i < infos.length; i++) { if (infos[i].code === val) { num = infos[i].num; break; } }
+    } return num
+  }
+  module.exports.getInfoNum = getInfoNum; 
 </wxs>
-
+<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
 <!-- loading -->
 <van-notify id="van-notify" />
 <loading wx:if="{{loadingShow}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
 <!--选择功能分区-->
 <van-sticky scroll-top="0">
-	<view class="menu-box">
-		<view style="width:32%;background:white;">
-			<van-dropdown-menu>
-				<van-dropdown-item id="functionItem" title-class="title-class" title="{{ functionItem.text }}">
-					<dk-dropdown-switch dataList="{{functionRegion}}" bind:commit='dropdowncommit'></dk-dropdown-switch>
-				</van-dropdown-item>
-			</van-dropdown-menu>
-		</view>
-		<view style="width:69%;background:white;display:flex; align-items: center;">
-			<van-search field-class="field-class" custom-class="custom-class" model:value="{{ allCondition }}" bind:change="filterFunction" use-action-slot input-align="center" placeholder="搜索菜单" />
-		</view>
-	</view>
-
+  <view class="menu-box">
+    <view style="width:32%;background:white;">
+      <van-dropdown-menu>
+        <van-dropdown-item id="functionItem" title-class="title-class" title="{{ functionItem.text }}">
+          <dk-dropdown-switch dataList="{{functionRegion}}" bind:commit='dropdowncommit'></dk-dropdown-switch>
+        </van-dropdown-item>
+      </van-dropdown-menu>
+    </view>
+    <view style="width:69%;background:white;display:flex; align-items: center;">
+      <van-search field-class="field-class" custom-class="custom-class" model:value="{{ allCondition }}" bind:change="filterFunction" use-action-slot input-align="center" placeholder="搜索菜单" />
+    </view>
+  </view>
 </van-sticky>
 
+<!-- 常用应用 -->
+<view wx:if="{{bingFlag == 0 }}">
+  <view class="panel-class">
+    <view class="app-name" style="display: flex;justify-content: space-between;line-height: 30rpx;">
+      <view style="display: flex;width: 100%;">
+        <view>常用应用 </view>
+        <!--图标-->
+        <view style="display: flex;width: 75%;" bindtap='expand'>
+          <view wx:if="{{!showMore}}" style="display: flex;margin-left: 10rpx;">
+            <view style="margin-left: 2rpx;" wx:for="{{comMenuList}}" wx:for-item="item" data-code="{{item.menuUuid}}" data-url="{{item.objectPath}}" wx:key="i">
+              <image src="{{item.objectIcon?('/static/img/' + item.objectIcon):''}}" style="height: 30rpx;width:30rpx;"></image>
+            </view>
+          </view>
+          <view wx:if="{{showMore}}" class="expand-class">
+            <van-icon size="12px" name="arrow-up" />
+          </view>
+          <view wx:else class="expand-class">
+            <van-icon size="12px" name="arrow-down" />
+          </view>
+        </view>
+      </view>
+      <dk-tag type="primary" padding="0 20rpx" height="40rpx" color="#1E90FF" textColor="#FFFFFF" radius="5rpx" roundFlag="{{true}}" value="{{editFlag?'保存':'编辑'}}" catchtap="toEdit"></dk-tag>
+    </view>
+    <view wx:if="{{showMore}}" style="background: #fff;border-radius: 15rpx;">
+      <view style="display: flex;flex-wrap: wrap;padding: 43rpx 0;align-items: center;">
+        <view class="app-item" style="width:25%;text-align: center;" icon-class="index-grid-item-icon-class" text-class="index-grid-item-text-class" content-class="index-grid-item-class" wx:for="{{comMenuList}}" wx:for-item="item" data-item="{{item}}" data-code="{{item.menuUuid}}" data-url="{{item.objectPath}}" data-com="{{true}}" bindtap="toApp" wx:key="i">
+          <view style="display: flex;justify-content: center;">
+            <image src="{{item.objectIcon?('/static/img/' + item.objectIcon):''}}" style="height: 80rpx;width:80rpx;margin-bottom: 11rpx;"></image>
+            <view style="margin-left: -6rpx; margin-top: -20rpx" wx:if="{{editFlag  }}">
+              <van-icon size="15px" name="clear" color="#D3D3D3" />
+            </view>
+          </view>
+          <view class="index-grid-item-text-class">{{item.menuName}}</view>
+        </view>
+      </view>
+    </view>
+  </view>
+</view>
+
 <!-- 应用集合 -->
 <view wx:if="{{bingFlag == 0 }}">
-	<view class="panel-class" wx:for="{{regions}}" data-item="{{item}}" wx:key="index" title="{{item.FunctionName}}" wx:if="{{m1.hasAuth(functionRegions,item.FunctionName)}}">
-		<view class="app-name">{{item.FunctionName}}
-			<image wx:if="{{item.FunctionName == '资金管理' || item.FunctionName == '经营分析'}}" src="/static/img/diamond.png" class="icon-title_diamond" />
-		</view>
-		<view style="background: #fff;border-radius: 15rpx;">
-			<view style="display: flex;flex-wrap: wrap;padding: 43rpx 0;align-items: center;">
-				<view class="app-item" style="width:25%;text-align: center;" icon-class="index-grid-item-icon-class" text-class="index-grid-item-text-class" content-class="index-grid-item-class" wx:for="{{functionItems}}" wx:for-item="item2" data-code="{{item2.FunctionCode}}" wx:if="{{item.FunctionCodeOrder==item2.PFunctionCode}}" data-url="{{item2.FormName}}" bindtap="toApp" wx:key="i" info="{{m1.getInfoNum(infocodes,infos,item2.FunctionCode)}}">
-					<image src="{{item2.ImageUri}}" style="height: 80rpx;width:80rpx;margin-bottom: 11rpx;"></image>
-					<view class="index-grid-item-text-class">{{item2.FunctionName}}</view>
-				</view>
-			</view>
-		</view>
-	</view>
+  <view class="panel-class" wx:for="{{regions}}" data-item="{{item}}" wx:key="index" title="{{item.FunctionName}}" wx:if="{{m1.hasAuth(functionRegions,item.FunctionName)}}">
+    <view class="app-name">{{item.FunctionName}}
+      <image wx:if="{{item.FunctionName == '资金管理' || item.FunctionName == '经营分析'}}" src="/static/img/diamond.png" class="icon-title_diamond" />
+    </view>
+    <view style="background: #fff;border-radius: 15rpx;">
+      <view style="display: flex;flex-wrap: wrap;padding: 43rpx 0;align-items: center;">
+        <view class="app-item" style="width:25%;text-align: center;" icon-class="index-grid-item-icon-class" text-class="index-grid-item-text-class" content-class="index-grid-item-class" wx:for="{{functionItems}}" wx:for-item="item2" data-code="{{item2.FunctionCode}}" wx:if="{{item.FunctionCodeOrder==item2.PFunctionCode}}" data-url="{{item2.FormName}}" data-item="{{item2}}" bindtap="toApp" wx:key="i" info="{{m1.getInfoNum(infocodes,infos,item2.FunctionCode)}}">
+          <view style="display: flex;justify-content: center;">
+            <image src="{{item2.ImageUri}}" style="height: 80rpx;width:80rpx;margin-bottom: 11rpx;"></image>
+            <view style="margin-left: -6rpx; margin-top: -20rpx" wx:if="{{editFlag && !m1.hasAuth(comMenuListForCheck,item2.FunctionCode) }}">
+              <van-icon size="15px" name="add" color="#1E90FF" />
+            </view>
+          </view>
+          <view class="index-grid-item-text-class" style="margin-left: -28rpx;">{{item2.FunctionName}}</view>
+        </view>
+      </view>
+    </view>
+  </view>
 </view>

+ 8 - 1
pages/index/index.wxss

@@ -17,7 +17,9 @@ page {
   display: flex;
 }
 
-
+.expand-class{
+  margin-left: 10rpx;
+}
 
 .panel-class {
   margin-top: 44rpx;
@@ -104,6 +106,11 @@ page {
   margin-bottom: 21rpx;
 }
 
+/* .app-item{
+  display: flex;
+  justify-content: center;
+} */
+
 .app-item:nth-child(n+5) {
   margin-top: 50rpx;
 }