Jelajahi Sumber

组件混入修改

于继渤 2 tahun lalu
induk
melakukan
e5b7a23725

+ 13 - 5
components/dkbase/dk-collapse-item/dk-collapse-item.js

@@ -54,7 +54,9 @@ Component({
       let list =_that.data.list
       let list =_that.data.list
       list[index].checked = !list[index].checked
       list[index].checked = !list[index].checked
       if (list[index].children && list[index].children.length > 0) {
       if (list[index].children && list[index].children.length > 0) {
-        console.log('list[index].children',list[index].children)
+        if(list[index].checked){
+          list[index].childrenChecked = false
+        }
         list[index].children.forEach(res => {
         list[index].children.forEach(res => {
           res.checked = list[index].checked
           res.checked = list[index].checked
         })
         })
@@ -68,17 +70,23 @@ Component({
     },
     },
     //todo
     //todo
     onCheckedItem_(e) {
     onCheckedItem_(e) {
-      console.log(e)
       let index = e.currentTarget.dataset.index
       let index = e.currentTarget.dataset.index
       let index_ = e.currentTarget.dataset.index_
       let index_ = e.currentTarget.dataset.index_
       let list = this.data.list
       let list = this.data.list
       list[index].children[index_].checked = !list[index].children[index_].checked
       list[index].children[index_].checked = !list[index].children[index_].checked
-      if(list[index].children.filter(res=>{
-        res.checked
-      }).length ==  list[index].children.length){
+      let  checkedList = []
+      list[index].children.forEach(it=>{
+        if(it.checked){
+          checkedList.push(it)
+        }
+      })
+      if(checkedList.length ==  list[index].children.length){
         list[index].checked = true
         list[index].checked = true
+        list[index].childrenChecked = false
       }else{
       }else{
         list[index].checked = false
         list[index].checked = false
+        //控制父级选中图标
+        list[index].childrenChecked = checkedList.length  == 0  ? false : true  
       }
       }
       this.setData({
       this.setData({
         list: list
         list: list

+ 4 - 1
components/dkbase/dk-collapse-item/dk-collapse-item.wxml

@@ -5,7 +5,10 @@
         <view slot="title">
         <view slot="title">
           <view style="display: flex;">
           <view style="display: flex;">
             <view style="width: 15%;" catch:tap="onCheckedItem" data-index="{{index}}">
             <view style="width: 15%;" catch:tap="onCheckedItem" data-index="{{index}}">
-              <van-checkbox checked-color="#95A8CB" value="{{ item.checked }}" shape="square" >
+              <van-checkbox wx:if="{{item.childrenChecked}}"  use-icon-slot checked-color="#95A8CB" value="{{ item.checked }}" shape="square" >
+                <image  slot="icon" src="/static/img/checkbox.png" style="width: 40rpx;height: 40rpx;" />
+              </van-checkbox>
+              <van-checkbox wx:else  checked-color="#95A8CB" value="{{ item.checked }}" shape="square" >
               </van-checkbox>
               </van-checkbox>
             </view>
             </view>
             <view style="width: 85%;">
             <view style="width: 85%;">

+ 2 - 0
components/dkbase/dk-form/dk-form.js

@@ -145,9 +145,11 @@ Component({
                 }
                 }
               },
               },
               success: function (res) {
               success: function (res) {
+                console.log('item',that.data.form)
                 // 通过eventChannel向被打开页面传送数据
                 // 通过eventChannel向被打开页面传送数据
                 that.data.form.formMode = item.item.formMode
                 that.data.form.formMode = item.item.formMode
                 that.data.form.id = that.data.form[item.item.idKey]
                 that.data.form.id = that.data.form[item.item.idKey]
+                that.data.form.chooseType =  item.item.chooseType
                 res.eventChannel.emit('params', that.data.form )
                 res.eventChannel.emit('params', that.data.form )
               }
               }
             })
             })

+ 3 - 3
components/dkbase/dk-save-bottom/dk-save-bottom.wxml

@@ -1092,12 +1092,12 @@
   <!-- 基础资料 -->
   <!-- 基础资料 -->
   <view wx:if="{{flagTypeName ==='basic-data'}}" style="display: flex; padding:35rpx 34rpx 62rpx 34rpx;">
   <view wx:if="{{flagTypeName ==='basic-data'}}" style="display: flex; padding:35rpx 34rpx 62rpx 34rpx;">
 
 
-    <view style="width:48%">
+    <!-- <view style="width:48%">
       <van-button size="large" plain round color="#1B365D" custom-style="height:88rpx;" bind:click="submit" type="default">排序
       <van-button size="large" plain round color="#1B365D" custom-style="height:88rpx;" bind:click="submit" type="default">排序
       </van-button>
       </van-button>
     </view>
     </view>
-    <view style="width: 4%;"></view>
-    <view style="width:48%;">
+    <view style="width: 4%;"></view> -->
+    <view style="width:100%;">
       <van-button size="large" round color="#CAA977" custom-style="height:88rpx;" bind:click="allClean" type="default">新建
       <van-button size="large" round color="#CAA977" custom-style="height:88rpx;" bind:click="allClean" type="default">新建
       </van-button>
       </van-button>
     </view>
     </view>

+ 5 - 0
mixins/index.js

@@ -553,6 +553,11 @@ module.exports = {
             formType: data.formType
             formType: data.formType
           })
           })
         }
         }
+        if (data.chooseType) {
+          _this.setData({
+            chooseData: data
+          })
+        }
         console.log('t2', data);
         console.log('t2', data);
         // 加载后续数据
         // 加载后续数据
         _this.handleLoadData();
         _this.handleLoadData();

+ 29 - 4
package-base-select/pages/select-functional-permissions/select-functional-permissions.js

@@ -10,6 +10,7 @@ Page({
     routeObjName: 'roleFun',
     routeObjName: 'roleFun',
     tableData: [],
     tableData: [],
     formData: {},
     formData: {},
+    pageFlag:false
   },
   },
   /**
   /**
  * @desc :   全选事件
  * @desc :   全选事件
@@ -46,9 +47,25 @@ Page({
  * @author : 于继渤
  * @author : 于继渤
  */
  */
   handleSearchData(tableData) {
   handleSearchData(tableData) {
+    console.log('处理接口返回数据',tableData)
+    let temp = util.convertToChildren(tableData)
+    console.log('处理接口返回数据后',temp)
+    temp.forEach(res=>{
+      if(!res.checked && res.children && res.children.length > 0){
+        let childrenChecked = false
+        let trueList = res.children.filter(item=>{
+          return item.checked == true
+        } )
+        if(trueList.length  > 0){
+          childrenChecked = true
+        }
+        res.childrenChecked = childrenChecked
+      }
+    })
     this.setData({
     this.setData({
-      tableData: util.convertToChildren(tableData)
+      tableData: temp
     })
     })
+    
   },
   },
   /**
   /**
    * @desc : 设置查询参数
    * @desc : 设置查询参数
@@ -62,7 +79,15 @@ Page({
     if (this.data.item && this.data.item.roleId) {
     if (this.data.item && this.data.item.roleId) {
       params.roleId = this.data.item.roleId
       params.roleId = this.data.item.roleId
     }
     }
-    
+    let menuUuids = []  //没保存进数据库之前选择的数据需要回显
+    if(this.data.chooseData && this.data.chooseData.roleFunList && this.data.chooseData.roleFunList.length > 0){
+      this.data.chooseData.roleFunList.forEach(it=>{
+        if(it && it.menuUuid){
+          menuUuids.push(it.menuUuid)
+        }
+      })
+    }
+    params.menuUuids = menuUuids
     return params;
     return params;
   },
   },
   /**
   /**
@@ -71,7 +96,6 @@ Page({
  * @author : 于继渤
  * @author : 于继渤
  */
  */
   getData(params) {
   getData(params) {
-    console.log('getData',this.data.item)
     return this.excute(this.data.service, this.data.service.getRoleFun, params);
     return this.excute(this.data.service, this.data.service.getRoleFun, params);
   },
   },
   /**
   /**
@@ -97,6 +121,7 @@ Page({
       if (res.checked) {
       if (res.checked) {
         tableDataTemp.push({
         tableDataTemp.push({
           funUuid: res.funUuid,
           funUuid: res.funUuid,
+          menuUuid: res.menuUuid,
           appCode: res.appCode
           appCode: res.appCode
         })
         })
       }
       }
@@ -105,6 +130,7 @@ Page({
           if (it.checked) {
           if (it.checked) {
             tableDataTemp.push({
             tableDataTemp.push({
               funUuid: it.funUuid,
               funUuid: it.funUuid,
+              menuUuid: it.menuUuid,
               appCode: it.appCode
               appCode: it.appCode
             })
             })
           }
           }
@@ -145,7 +171,6 @@ Page({
     return this.excute(this.data.service, this.data.service.updateBatch, params);
     return this.excute(this.data.service, this.data.service.updateBatch, params);
   },
   },
 
 
-
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */

+ 3 - 2
package-basic-data/pages/role/add/add.js

@@ -13,8 +13,8 @@ Page({
       main: [
       main: [
         { code: 'roleName', type: 'str', required: true, title: mixins.$t('roleName') },
         { code: 'roleName', type: 'str', required: true, title: mixins.$t('roleName') },
         { code: 'remarks', type: 'textarea', title: mixins.$t('remarks') },
         { code: 'remarks', type: 'textarea', title: mixins.$t('remarks') },
-        { formMode: 'index',code:'roleFunList', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectFunctionalPermissions', required: true, type: 'choose', title: mixins.$t('functionalPermissions') },
-        { formMode: 'index', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectSensitiveData', required: true, code:'roleSensitiveList', type: 'choose', title: mixins.$t('sensitiveData') }
+        { formMode: 'index',code:'roleFunList', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectFunctionalPermissions',chooseType:true, required: true, type: 'choose', title: mixins.$t('functionalPermissions') },
+        { formMode: 'index', idKey: 'roleId', chooseType:true,placeholder: mixins.$t('notSet'), urlKey: 'selectSensitiveData', required: true, code:'roleSensitiveList', type: 'choose', title: mixins.$t('sensitiveData') }
       ],
       ],
     },
     },
     // 路由
     // 路由
@@ -226,6 +226,7 @@ Page({
       contentObj.main = [
       contentObj.main = [
         { code: 'roleCode', type: 'str', required: false, readonly: true, title: mixins.$t('roleCode') },
         { code: 'roleCode', type: 'str', required: false, readonly: true, title: mixins.$t('roleCode') },
         { code: 'roleName', type: 'str', required: true, title: mixins.$t('roleName') },
         { code: 'roleName', type: 'str', required: true, title: mixins.$t('roleName') },
+        { code: 'remarks', type: 'textarea', title: mixins.$t('remarks') },
         { formMode: 'index',code:'roleFunList', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectFunctionalPermissions', required: true, type: 'choose', title: mixins.$t('functionalPermissions') },
         { formMode: 'index',code:'roleFunList', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectFunctionalPermissions', required: true, type: 'choose', title: mixins.$t('functionalPermissions') },
         { formMode: 'index', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectSensitiveData', required: true, code:'roleSensitiveList', type: 'choose', title: mixins.$t('sensitiveData') }
         { formMode: 'index', idKey: 'roleId', placeholder: mixins.$t('notSet'), urlKey: 'selectSensitiveData', required: true, code:'roleSensitiveList', type: 'choose', title: mixins.$t('sensitiveData') }
       ]
       ]

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

@@ -12,7 +12,7 @@
 <!-- 系统预制不可停用 TODO -->
 <!-- 系统预制不可停用 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>
 <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>
+<!-- <van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}</van-divider> -->
 
 
 <view style="height: 200rpx;"></view>
 <view style="height: 200rpx;"></view>
 
 

TEMPAT SAMPAH
static/img/checkbox.png