Przeglądaj źródła

1、修改dk-number-input

zhoux 2 lat temu
rodzic
commit
1674d0fac0

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

@@ -12,6 +12,8 @@ module.exports = {
   comMenuService: {
     // 前缀
     prefix: 'mdm-server/mst/comMenu/',
+    // 保存常用功能
+    save:'save'
   },
 
   routeUrl: {

+ 0 - 4
components/dkbase/dk-number-input/dk-number-input.js

@@ -192,9 +192,7 @@ Component({
     * @date : 2022/6/30 16:16
     */
     bindFocus(e){
-
       if(isNaN(this.data.inputValue)){
-        console.log('ttt',this.data.inputValue,isNaN(this.data.inputValue));
         this.setData({
           inputValue:0
         })
@@ -206,7 +204,6 @@ Component({
     * @date : 2022/6/30 16:16
     */
     bindInput(e) {
-      console.log('ddd1',e,this.data.inputValue);
       let flag = true;
       let values = e.detail.split('.')
       // 如果输入的是小数点,那么需要判断是否已经有小数点
@@ -328,7 +325,6 @@ Component({
       //添加判断条件,当用户输入空数据问题会出现NaN  于继渤2022/06/30 
       if (inputValue != undefined && inputValue && inputValue != 0) {
         // 判断是否有千分位
-        console.log('ttt',this.data.formatThousandth);
         if (this.data.formatThousandth) {
           displayValue = common.toThousandCents(inputValue);
         }

+ 1 - 1
components/dkbase/dk-number-input/dk-number-input.wxml

@@ -13,7 +13,7 @@
   </view> -->
   <!--文本框-->
   <view wx:else style="padding-top: 2rpx; padding-bottom: 2rpx;">
-    <van-field label-class="input-title-class" style="--color--:{{titleColor}};--fontSize--:{{fontSize + 'px'}};--width--:{{titleWidth}};--fontWeight--:{{titleFontWeight}}" value="{{inputValue?inputValue:undefined}}" input-align="left" label="{{titleValue}}" placeholder="{{placeholder}}" autosize auto-focus clearable border="{{ false }}" input-class="dk-cell-value-class" type="number" bind:focus="bindFocus" bind:change="bindInput" bind:blur="bindBlur">
+    <van-field label-class="input-title-class" style="--color--:{{titleColor}};--fontSize--:{{fontSize + 'px'}};--width--:{{titleWidth}};--fontWeight--:{{titleFontWeight}}" value="{{inputValue?inputValue:undefined}}" input-align="left" label="{{titleValue}}" placeholder="{{placeholder}}" autosize auto-focus clearable border="{{ false }}" input-class="dk-cell-value-class" type="text" inputMode="decimal" bind:focus="bindFocus" bind:change="bindInput" bind:blur="bindBlur">
     </van-field>
   </view>
 </view>

+ 38 - 8
pages/index/index.js

@@ -481,15 +481,45 @@ Page({
   */
   toEdit() {
     let editFlag = this.data.editFlag
-    editFlag = !editFlag;
-    let showMore = this.data.showMore
-    if (editFlag) {
-      showMore = true;
+    // 变为编辑模式
+    if(!editFlag){
+      editFlag = !editFlag;
+      let showMore = this.data.showMore
+      if (editFlag) {
+        showMore = true;
+      }
+      this.setData({
+        showMore: showMore,
+        editFlag: editFlag
+      })
+    }else{
+      // 保存常用功能
+      this.saveComMenu();
     }
-    this.setData({
-      showMore: showMore,
-      editFlag: editFlag
+  },
+  /**
+  * @desc : 保存常用功能
+  * @author : 周兴
+  * @date : 2024/3/29
+  */
+  saveComMenu(){
+    let comMenuList = this.data.comMenuList || []
+    comMenuList.forEach((it,index)=>{
+      it.staffId =  app.globalData.user.staffId,
+      it.appCode = Constants.APP_CODE,
+      it.displayNo = index
     })
+
+    let service = app.globalData['comMenuService']
+    api.request(service.prefix + service.save, 'POST', comMenuList).then(res => {
+      if (res.data.code == Constants.SUCESS_CODE) {
+        wx.showToast({
+          title: "保存成功",
+          image: '/static/image/success.png',
+          duration: 1000
+        })
+      }
+    });
   },
   /**
   * @desc : 查询常用应用
@@ -736,7 +766,7 @@ Page({
     let comMenuList = this.data.comMenuList
     let comMenuListForCheck = this.data.comMenuListForCheck
     comMenuList = comMenuList.filter(it=>it.menuUuid != item.menuUuid)
-    comMenuListForCheck.filter(it=>it != item.menuUuid)
+    comMenuListForCheck = comMenuListForCheck.filter(it=>it != item.menuUuid)
     this.setData({
       comMenuList:comMenuList,
       comMenuListForCheck:comMenuListForCheck

+ 3 - 2
pages/index/index.wxml

@@ -63,8 +63,9 @@
       <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;flex-wrap: wrap;padding: 43rpx 0;align-items: center;">
+        <view class="app-item "  
+        style="width:25%;text-align: center;" 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  }}">