于继渤 2 лет назад
Родитель
Сommit
e4ee6de528

+ 16 - 1
components/dkbase/dk-popup/dk-popup.js

@@ -210,8 +210,23 @@ Component({
                 }
               },
               success: function (res) {
+                let data = {}
+                let item = e.currentTarget.dataset.item
+                if(item  && item.idKey){
+                  data['id'] = item[item.idKey]
+                }
+                if(item  && item.formMode){
+                  data['formMode'] = item.formMode
+                }
+                if(item  && item.formType){
+                  data['formType'] = item.button.formType
+                }
+                if(that.data.form){
+                  data['item'] = that.data.form
+                }
+                console.log('打开下拉',)
                 // 通过eventChannel向被打开页面传送数据
-                res.eventChannel.emit('params', { data: 'test' })
+                res.eventChannel.emit('params', data)
               }
             })
           }

+ 1 - 2
components/dkbase/dk-tree-form-more/dk-tree-form-more.js

@@ -155,8 +155,7 @@ Component({
     clickName(e) {
       const { idKey } = this.data;
       const { nameKey } = this.data;
-
-      this.triggerEvent('clickName', { id: e.currentTarget.dataset.item[idKey], name: e.currentTarget.dataset.item[nameKey] });
+      this.triggerEvent('clickName', { id: e.currentTarget.dataset.item[idKey], name: e.currentTarget.dataset.item[nameKey] ,item:e.currentTarget.dataset.item});
 
     },
     //点击控件里的控件 回调

+ 3 - 2
components/dkbase/dk-tree-form-more/dk-tree-form-more.wxml

@@ -44,8 +44,9 @@
 
           <view style="flex:1;">
             <view class="tree_right" wx:if="{{item[itemListKey]}}" data-id="{{item[idKey]}}" data-open="{{item.open}}" bindtap="onchange">
-              <van-icon wx:if="{{!item.open }}" color="#bdb7b7" name="arrow" />
-              <van-icon wx:else name="arrow-down" color="#bdb7b7" />
+              <van-button type="default" size="mini">  <van-icon wx:if="{{!item.open }}" color="#bdb7b7" name="arrow" />
+              <van-icon wx:else name="arrow-down" color="#bdb7b7" /></van-button>
+            
             </view>
           </view>
         </view>

+ 28 - 1
package-base-select/pages/select-product-attribute-suppliers/select-product-attribute-suppliers.js

@@ -55,9 +55,34 @@ Page({
     } else {
       params.flgValid = false
     }
+
+
+
+
     return params
   },
   /**
+   * @desc :   处理接口返回数据
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
+  handleSearchData(tableData) {
+    //显示已选
+    if (this.data.item && this.data.item.supplierIds) {
+      let supplierIds = this.data.item.supplierIds.split(",")
+      for (var i = 0; i < tableData.length; i++) {
+        // 检查当前对象的 id 是否包含在数组 A 中
+        if (supplierIds.includes(tableData[i].supId)) {
+          // 如果匹配,则修改该对象
+          tableData[i].checked = true
+        }
+      }
+      this.setData({
+        tableData:tableData
+      })
+    }
+  },
+  /**
    * @desc : 查询
    * @date : 2024/2/1 15:49
    * @author : 于继渤
@@ -121,6 +146,8 @@ Page({
    */
   onLoad(options) {
   },
-
+  onShow(){
+    this.searchData()
+  }
 
 })

+ 1 - 1
package-base-select/pages/select-product-attribute-suppliers/select-product-attribute-suppliers.wxml

@@ -31,7 +31,7 @@
     </view>
   </view>
 </view>
-<van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
+<!-- <van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider> -->
 <view style="height: 135rpx;"></view>
 
 <!-- 新建按钮 -->

+ 1 - 1
package-base-select/pages/select-sensitive-data/select-sensitive-data.wxml

@@ -3,7 +3,7 @@
 <loading wx:if="{{loading}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
-  <dk-dropdown-menu model:searchForm="{{searchForm}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['sensitiveName'])}}">
+  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['sensitiveName'])}}">
   </dk-dropdown-menu>
   <view style="display: flex;background-color: white;padding:18rpx;padding-right: 40rpx;padding-left:40rpx;">
     <view style="width: 60%;display: flex;">

+ 1 - 1
package-basic-data/pages/basic-data/basic-data.wxml

@@ -1,5 +1,5 @@
 <wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
-<loading wx:if="{{loading}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<loading wx:if="{{loading}}"></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
   <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['dataName','dataCode','remarks'])}}">

+ 21 - 4
package-basic-data/pages/product-attribute/product-attribute.js

@@ -23,11 +23,19 @@ Page({
     unitService: app.globalData['unitService'],
     // 路由
     routeObjName: 'product-attribute',
+    // 查询条件
+    searchContent: [{
+      code: 'flgValid', title: mixins.$t('allValidInvalid'), searchType: Constants.searchType.switch,
+
+      list: [
+        { code: 1, title: mixins.$t('valid'), value: true },
+        { code: 2, title: mixins.$t('invalid'), value: false }]
+    }],
     // 列表区(内容)商品品牌
     contentList: [
       { name: 'brandCode', title: mixins.$t('brandCode') },
       { name: 'brandName', title: mixins.$t('brandName') },
-      { name: 'supplierName', title: mixins.$t('supplier') }
+      { name: 'supplierNames', title: mixins.$t('supplier') }
     ],
     sidebarList: [
       { id: 0, name: mixins.$t('goodsBrand') },
@@ -40,7 +48,7 @@ Page({
       [
         { code: 'brandCode', type: 'str', title: mixins.$t('brandCode'), required: false, readonly: true, },
         { code: 'brandName', type: 'str', title: mixins.$t('brandName'), required: true },
-        { code: 'supplierIds', name: 'supplierNames', title: 'supplier', type: 'choose', required: true, dropType: 'supplier', required: true, },
+        { code: 'supplierIds',formMode: 'index', idKey: 'roleId', chooseType:true, name: 'supplierNames', title: 'supplier', type: 'choose', required: true, dropType: 'supplier', required: true, },
         { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false }
       ],
     sideKey: 0,
@@ -187,7 +195,9 @@ Page({
       dataItem: JSON.stringify(item)
     })
   },
-
+  toClickName(e){
+    console.log(e)
+  },
   /**
    * @desc : 新建
    * @author : 于继渤
@@ -226,6 +236,12 @@ Page({
    * @date : 2024/1/23 9:16
    */
   setSearchParams(params) {
+    //有效标识
+    if (params.flgValidList && params.flgValidList.indexOf("true") != -1 && params.flgValidList.indexOf("false") == -1) {
+      params.flgValid = true
+    } else if (params.flgValidList && params.flgValidList.indexOf("true") == -1 && params.flgValidList.indexOf("false") != -1) {
+      params.flgValid = false
+    }
     if (this.data.formDataName == mixins.$t('goodsCategory')) {
       params.pageSize = 100000
       params.currentPage = 1
@@ -264,7 +280,8 @@ Page({
         [
           { code: 'brandCode', type: 'str', title: mixins.$t('brandCode'), required: false, readonly: true, },
           { code: 'brandName', type: 'str', title: mixins.$t('brandName'), required: true },
-          { code: 'supplierIds', name: 'supplierNames', title: 'supplier', type: 'choose', required: true, dropType: 'supplier', required: true, urlKey: 'selectProductAttributeSuppliers', },
+          { code: 'supplierIds', name: 'supplierNames', title: 'supplier', type: 'choose', required: true, dropType: 'supplier', required: true, urlKey: 'selectProductAttributeSuppliers', code: 'supplierIds',formMode: 'index', idKey: 'roleId', },
+      
           { code: 'remarks', type: 'str', title: mixins.$t('remarks'), required: false }
         ]
       routeObjNameGoTo = 'goodsBrand'

+ 10 - 12
package-basic-data/pages/product-attribute/product-attribute.wxml

@@ -1,22 +1,20 @@
+<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
 <!-- 顶部信息 -->
 <van-sticky scroll-top="0">
-  <van-search model:value="{{ searchText }}" bind:change="onSearchText" bind:search="doSearch" placeholder="输入要素名称/备注"> </van-search>
-  <van-dropdown-menu active-color="#1B365D">
-
-    <van-dropdown-item id="status" title="{{statusItem.text }}">
-      <dk-dropdown-switch dataList="{{statusList}}" bind:commit='dropdownSwitchCommit'></dk-dropdown-switch>
-    </van-dropdown-item>
-  </van-dropdown-menu>
-
+  <!-- 查询条件 -->
+  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['dataName','dataCode'])}}">
+  </dk-dropdown-menu>
 </van-sticky>
-<loading wx:if="{{loading}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<loading wx:if="{{loading}}" ></loading>
 <view style="display: flex;">
   <!-- 左侧菜单列表 -->
-  <van-sidebar activeKey="{{sideKey}}" bindchange="changeSidebar" custom-class="left-class">
-    <view style="height:calc({{windowHeight+'px'}} - {{'220rpx'}});overflow: scroll;">
+  <van-sidebar activeKey="{{sideKey}}" bindchange="changeSidebar" custom-class="left-class" >
+    <view style="height:calc({{windowHeight+'px'}} - {{'220rpx'}});overflow: scroll;background-color:#ECF2FF">
       <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="{{sidebarList}}" />
     </view>
+  
   </van-sidebar>
+
   <!-- 内容列表 -->
   <view style="margin-left: 140rpx;width: 100%;">
 
@@ -24,7 +22,7 @@
     <dk-list wx:if="{{formDataName == $t['goodsBrand']}}" list="{{tableData}}" titleImageFlag="{{false}}" swipeDisabled="{{false}}" bind:swipe="deactivateEnable" statusFlag="{{false}}" flgPoint="{{false}}" switchFlag="{{true}}" title="goodsBrand" content="{{contentList}}" collectName="" contentObj="{{contentObj}}" bind:toDetail="toDetail" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
     
     <!-- 商品种类 -->
-    <dk-tree-form-more wx:if="{{formDataName == $t['goodsCategory']}}" treeList="{{tableData}}" idKey="catId" flgValidKey="flgValid" nameKey="catName" parentIdKey="parentId" itemListKey="children" id="treeSelect" bind:onclick="treeClick"  bind:onSwipe="onSwipeBind"   ></dk-tree-form-more>
+    <dk-tree-form-more wx:if="{{formDataName == $t['goodsCategory']}}" treeList="{{tableData}}" idKey="catId" flgValidKey="flgValid" nameKey="catName" parentIdKey="parentId" itemListKey="children" id="treeSelect" bind:onclick="treeClick" bind:clickName="toClickName" bind:onSwipe="onSwipeBind"   ></dk-tree-form-more>
 
     <!-- 商品系列 -->
     <dk-list wx:if="{{formDataName ==  $t['goodsSeries']}}" list="{{tableData}}" titleImageFlag="{{false}}" swipeDisabled="{{false}}" bind:swipe="deactivateEnable" statusFlag="{{false}}" flgPoint="{{false}}" switchFlag="{{true}}" title="seriesName" bind:toDetail="toDetail" bind:open="open"></dk-list>

+ 3 - 1
package-basic-data/pages/product-attribute/product-attribute.wxss

@@ -47,7 +47,9 @@ page{
   border-bottom-left-radius: 0;
   border-bottom-right-radius: 30rpx; */
 }
-
+.van-sideba{
+  background: #fff !important;
+}
 /**左侧字体样式*/
 .van-sidebar-item__text{
   width: 70rpx !important;

+ 9 - 1
package-basic-data/pages/role/add/add.js

@@ -62,7 +62,15 @@ Page({
     this.setData({
       formData: null
     })
-
+    var pages = getCurrentPages();
+    var prevPage = pages[pages.length - 2]; //上一个页面
+    prevPage.setData({
+      refreshDataFlag:true
+    })
+    
+    wx.navigateBack({
+      delta: 1
+    })
   },
 
 

+ 10 - 48
package-basic-data/pages/role/role.js

@@ -21,53 +21,6 @@ Page({
     tableData: [],
   },
 
-  // /**
-  //    * @desc :   表单选择跳转事件
-  //    * @date : 2024/2/1 15:49
-  //    * @author : 于继渤
-  //    */
-  // openObjPop(e) {
-  //   let that = this
-  //   let key = e.currentTarget.dataset.key
-  //   wx.navigateTo({
-  //     url: key,
-  //     events: {
-  //       // 回调后
-  //       bindData: function (data) {
-  //         let formData = JSON.parse(that.data.formData)
-  //         if (data.showFlag == 'selectFunctionalPermissions') {
-  //           formData.roleFunList = data.list
-  //           that.setData({
-  //             selectFunctionalPermissionsFlag: data.list.length > 0,
-  //             formData: JSON.stringify(formData)
-  //           })
-  //         } else if (data.showFlag == 'selectSensitiveData') {
-  //           formData.roleSensitiveList = data.list
-  //           that.setData({
-  //             selectSensitiveDataFlag: data.list.length > 0,
-  //             formData: JSON.stringify(formData)
-  //           })
-  //         }
-
-  //       }
-  //     },
-  //     success: function (res) {
-  //       // 通过eventChannel向被打开页面传送数据
-  //       let formData = JSON.parse(that.data.formData)
-  //       if (that.data.formMode == Constants.formMode.edit) {
-  //         console.log(that.data.id)
-  //         formData['roleId'] = that.data.id
-  //       }
-  //       let data = {
-  //         formData: JSON.stringify(formData),
-  //         id: that.data.id
-  //       }
-  //       res.eventChannel.emit('editParams', { data: data })
-  //     }
-  //   })
-  // },
-
-
   /**
     * @desc :   启用停用
     * @date : 2024/2/1 15:49
@@ -124,7 +77,9 @@ Page({
     wx.navigateTo({
       url: this.data.route.add.url,
       events: function (e) {
+        console.log('回调后,在这里给页面赋值')
         // 回调后,在这里给页面赋值
+     
       },
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
@@ -146,6 +101,9 @@ Page({
       tableData: tableData
     })
   },
+  setSearchParams(params){
+    return params
+  },
   /**
    * @desc :   加载数据源
    * @date : 2024/2/1 15:49
@@ -179,6 +137,10 @@ Page({
   onLoad(options) {
 
   },
-
+  onShow(){
+    if(this.data.refreshDataFlag){
+      this.searchData()
+    }
+  }
 
 })

+ 4 - 6
package-basic-data/pages/role/role.wxml

@@ -1,18 +1,16 @@
 <!-- 前台导入wxmlUtil.wxs -->
 <wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
-<loading wx:if="{{loading}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<loading wx:if="{{loading}}" ></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
-  <dk-dropdown-menu model:searchForm="{{searchForm}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['roleName'])}}">
+  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['roleName','roleCode'])}}">
   </dk-dropdown-menu>
 </van-sticky>
-<!-- 暂无数据 -->
-<van-empty wx:if="{{tableData.length<=0}}" description="{{$t['nodata']}}" />
+
 <!-- 列表区 -->
 <!-- 系统预制不可停用 TODO -->
-<dk-list swipeDisabled="{{false}}"  bind:swipe="deactivateEnable" list="{{tableData}}" titleCorner="" title="roleName" status="displayStatus" content="{{contentList}}" collectCol="sumAccount" collectName="" contentObj="{{contentObj}}" contentCol="" footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" bind:toStatus="toStatus" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
 
-<!-- <van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}</van-divider> -->
+<dk-list list="{{tableData}}" title="roleName" status="displayStatus" content="{{contentList}}"  swipeDisabled="{{false}}"  bind:swipe="deactivateEnable" bind:toDetail="toDetail" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
 
 <view style="height: 200rpx;"></view>