Ver Fonte

Merge branch '部门人员筛选' into 4.22更新

# Conflicts:
#	packageA/salesHourglass/index.js
#	packageA/salesHourglass/index.wxml
xiaohaizhao há 2 anos atrás
pai
commit
ed595bf548

+ 1 - 0
app.json

@@ -190,6 +190,7 @@
         "Yl_Detail": "/components/Yl_Detail/index",
         "Yl_nav": "/components/Yl_nav/index",
         "Yl_filtrate": "/components/Yl_filtrate/index",
+        "organization": "/components/organization/index",
         "Yl_Filtrate1": "/components/Yl_Filtrate1/index",
         "Yl_ListBox": "/components/Yl_ListBox/index",
         "My_card": "/components/My_card/index",

+ 6 - 0
components/Yl_Filtrate1/index.js

@@ -1,3 +1,5 @@
+const _Http = getApp().globalData.http;
+
 import {
     getHeight
 } from "../../utils/getHeight";
@@ -5,6 +7,9 @@ import {
     formatTime
 } from "../../utils/getTime"
 Component({
+    options: {
+        multipleSlots: true
+    },
     properties: {
         list: {
             type: {
@@ -178,6 +183,7 @@ Component({
                 obj.periodstart = this.data.periodstart;
                 obj.periodend = this.data.periodend;
             };
+            obj.name = name;
             this.triggerEvent("handle", obj);
             this.onClose();
         },

+ 1 - 4
components/Yl_Filtrate1/index.wxml

@@ -1,8 +1,7 @@
 <van-popup show="{{ show }}" position="right" custom-style="width: 660rpx; height:100vh;" z-index="{{zIndex}}" bind:close="onClose">
     <view class="head" />
     <Yl_ListBox height="{{listHeight}}" pullDown='{{false}}'>
-
-
+        <slot name='head' />
         <block wx:for="{{list}}" wx:key="label">
             <MultilevelClass id="MultilevelClass" item='{{item}}' wx:if="{{item.type=='multilevelClass'}}" />
             <view wx:elif="{{item.list.length}}" class="groud">
@@ -17,8 +16,6 @@
                 </view>
             </view>
         </block>
-
-
         <view wx:if="{{dateRange}}" class="groud">
             <view class="label">
                 {{dateRangeName}}

+ 141 - 0
components/organization/index.js

@@ -0,0 +1,141 @@
+const _Http = getApp().globalData.http;
+Component({
+    properties: {
+        isdep: {
+            type: Boolean,
+            value: true
+        },
+        isusers: {
+            type: Boolean,
+            value: true
+        },
+        defaultMy: {
+            type: Boolean,
+            value: true
+        },
+        exclution: {
+            type: Boolean,
+            value: true
+        },
+        dimissionF: {
+            type: Boolean
+        }
+    },
+    data: {
+        takeEffect: "", //生效筛选项
+        result: {},
+        isleave: 0,
+        tabs: [{
+            value: 0,
+            name: "全部"
+        }, {
+            value: 1,
+            name: "在职"
+        }, {
+            value: 2,
+            name: "离职"
+        }],
+        searchValue: ""
+    },
+    methods: {
+        searchChange({
+            detail
+        }) {
+            if (detail.length == 0) return this.searchClear()
+            let list = JSON.parse(JSON.stringify(this.data.users.copyList));
+            this.setData({
+                'users.list': list.filter(v => v.name.includes(detail) || v.accountno.includes(detail))
+            })
+        },
+        searchClear() {
+            this.setData({
+                'users.list': JSON.parse(JSON.stringify(this.data.users.copyList))
+            })
+        },
+        changLeave(e) {
+            this.setData({
+                isleave: e.currentTarget.dataset.value,
+                'result.isleave': e.currentTarget.dataset.value
+            })
+        },
+        initDepAndUser() {
+            this.setData({
+                result: {},
+                takeEffect: ""
+            })
+            return new Promise((resolve) => {
+                _Http.basic({
+                    "id": 20230620102004,
+                    "content": {}
+                }).then(res => {
+                    console.log("获取部门", res)
+                    if (this.data.isdep) this.setData({
+                        depGroud: [{
+                            label: "部门",
+                            list: res.data.dep,
+                            active: ""
+                        }]
+                    })
+                    if (this.data.isusers) {
+                        let active = ''
+                        if (this.data.defaultMy) {
+                            let user = res.data.hr.find(v => v.userid == wx.getStorageSync('userMsg').userid)
+                            if (user) {
+                                active = user.userid;
+                                resolve(user)
+                                this.setData({
+                                    takeEffect: "user",
+                                    result: user
+                                })
+                            }
+                        }
+                        this.setData({
+                            users: {
+                                label: "人员",
+                                list: res.data.hr,
+                                copyList: res.data.hr,
+                                active
+                            }
+                        })
+                    }
+                    resolve({})
+                })
+            })
+        },
+        selectDep(e) {
+            const {
+                item,
+                index
+            } = e.currentTarget.dataset;
+            let depGroud = this.data.depGroud.slice(0, index + 1);
+            depGroud[index].active = item.departmentid;
+            if (item.subdep.length) {
+                item.subdep.unshift(JSON.parse(JSON.stringify(item)))
+                item.subdep[0].depname = '全部';
+                item.subdep[0].subdep = [];
+                depGroud.push({
+                    label: item.depname + '下级部门',
+                    list: item.subdep,
+                    active: item.departmentid
+                })
+            }
+            item.name = item.depname
+            item.isleave = this.data.isleave;
+            this.setData({
+                depGroud,
+                takeEffect: "dep",
+                result: item
+            })
+        },
+        selectUser(e) {
+            const {
+                item
+            } = e.currentTarget.dataset;
+            this.setData({
+                'users.active': item.userid,
+                takeEffect: "user",
+                result: item
+            })
+        },
+    }
+})

+ 4 - 0
components/organization/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 147 - 0
components/organization/index.scss

@@ -0,0 +1,147 @@
+.groud {
+    width: 100%;
+    padding: 30rpx;
+    border-bottom: 1px solid #DDDDDD;
+    overflow: hidden;
+
+    .title {
+        display: flex;
+        justify-content: space-between;
+        box-sizing: border-box;
+
+        .label {
+            height: 40rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #333333;
+        }
+
+        .tabs-box {
+            display: flex;
+            align-items: center;
+            height: 50rpx;
+            background: #F5F5F5;
+            border-radius: 30rpx;
+            padding: 4rpx;
+            background-color: #F5F5F5;
+            box-sizing: content-box;
+            margin-right: 50rpx;
+
+            .item {
+                font-size: 24rpx;
+                font-family: PingFang SC-Regular, PingFang SC;
+                color: #FFFFFF;
+                height: 42rpx;
+                line-height: 42rpx;
+                padding: 0 16rpx;
+                background-color: #F5F5F5;
+                color: #999999;
+                border-radius: 26rpx;
+                box-sizing: border-box;
+            }
+
+            .active {
+                background-color: #3874F6;
+                color: #FFFFFF;
+                transition: color 0.3s;
+            }
+        }
+    }
+
+
+
+
+    .content {
+        display: flex;
+        flex-wrap: wrap;
+        width: 100%;
+
+        .but {
+            min-width: 188rpx;
+            height: 72rpx;
+            background: #F5F5F5;
+            border-radius: 8rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #333333;
+            margin-right: 20rpx;
+            margin-top: 20rpx;
+            padding: 0 20rpx;
+            box-sizing: border-box;
+        }
+
+        .active {
+            border: 1px solid #3874F6;
+            color: #3874F6;
+            font-weight: bold;
+            background-color: #F5F5F5;
+        }
+    }
+
+
+    .time {
+        .partition {
+            margin-right: 20rpx;
+            display: flex;
+            align-items: center;
+        }
+
+        .tbox {
+            width: 220rpx;
+            height: 72rpx;
+            text-align: center;
+            line-height: 72rpx;
+            background: #F5F5F5;
+            border-radius: 8rpx;
+            font-size: 28rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #333333;
+            box-sizing: border-box;
+            margin-right: 20rpx;
+            margin-top: 20rpx;
+        }
+    }
+}
+
+.exclution {
+    opacity: .7;
+
+    .content {
+        .active {
+            border: 0px solid #3874F6;
+            color: #333333;
+            font-weight: bold;
+            background-color: #F5F5F5;
+        }
+    }
+
+}
+
+.footer {
+    display: flex;
+    justify-content: space-around;
+    width: 100%;
+    box-sizing: border-box;
+    padding: 10rpx;
+    box-shadow: rgba(0, 0, 0, 0.1) 0px -2px 8rpx;
+
+    .v-but {
+        width: 190rpx;
+        height: 90rpx;
+        background: #FFFFFF;
+        border-radius: 8rpx;
+        border: 1px solid #CCCCCC;
+        font-size: 28rpx;
+        font-family: PingFang SC-Regular, PingFang SC;
+        color: #666666;
+    }
+
+    .confirm {
+        border: none;
+        background: #3874F6;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #FFFFFF;
+    }
+}

+ 31 - 0
components/organization/index.wxml

@@ -0,0 +1,31 @@
+<!-- 部门筛选 -->
+<view wx:if="{{isdep}}" class="groud {{exclution && takeEffect !='dep' ? 'exclution' : '' }}" wx:for="{{depGroud}}" wx:key="label">
+    <view class="title">
+        <view class="label">
+            {{item.label}}
+        </view>
+        <view class="tabs-box" wx:if="{{dimissionF && index==0}}">
+            <view class="item {{isleave == item.value?'active':''}}" wx:for="{{tabs}}" wx:key="{{item.value}}" data-value="{{item.value}}" bind:tap="changLeave">{{item.name}}</view>
+        </view>
+    </view>
+    <view class="content">
+        <van-button custom-class='but {{data.departmentid == item.active?" active":""}}' wx:for="{{item.list}}" wx:for-item="data" wx:for-index="i" wx:key="i" data-item="{{data}}" data-index="{{index}}" data-i="{{i}}" bindtap="selectDep">{{data.depname}}</van-button>
+    </view>
+</view>
+<!-- 人员筛选 -->
+<view wx:if="{{isusers}}" class="groud {{exclution && takeEffect != 'user'? 'exclution' : ''}}" wx:key="label">
+    <view class="title" style="align-items: center;">
+        <view class="label">
+            {{users.label}}
+        </view>
+        <view class="tabs-box" style="margin-right: 20rpx;">
+            <van-search value="{{ searchValue }}" shape='round' bind:change='searchChange' bind:clear='searchClear' placeholder="搜索姓名/账号" />
+        </view>
+    </view>
+    <view class="content">
+        <van-button custom-class='but {{item.userid == users.active?" active":""}}' wx:for="{{users.list}}" wx:key="userid" data-item="{{item}}" bindtap="selectUser">{{item.name}} {{item.accountno}}</van-button>
+    </view>
+</view>
+
+
+<wxs src='../../utils/wxmlQueryPer.wxs' module="per" />

+ 38 - 61
packageA/achievement/index.js

@@ -29,58 +29,13 @@ Page({
       }
     ],
     filtratelist: [],
-    showFiltrate: false
+    showFiltrate: false,
+    active: {
+      name: wx.getStorageSync('userMsg').name,
+      userid: wx.getStorageSync('userMsg').userid,
+    }
   },
   onLoad(options) {
-    _Http.basic({
-      "id": 20230620102004,
-      "content": {}
-    }).then(res => {
-      console.log("获取下级部门和下级人员", res)
-      if (res.msg != '成功') return wx.showToast({
-        title: res.data,
-        icon: "none"
-      })
-      let data = {
-        label: "查询范围",
-        index: 0,
-        showName: "name", //显示字段
-        valueKey: "active", //返回Key
-        value: "id", //选中值
-        list: res.data.hr.map(v => {
-          v.id = v.userid;
-          // v.key = v.name + v.userid;
-          v.type = '人员'
-          delete(v.rowindex)
-          delete(v.userid)
-          return v
-        })
-      };
-      const mflat = (v, prefix) => {
-        v.subdep.forEach(s => mflat(s, v.depname));
-        v.name = v.depname; //prefix ? prefix + '/' + v.depname : v.depname
-        v.type = '部门';
-        v.id = v.departmentid;
-        // v.key = v.name + v.id;
-        delete(v.depname)
-        delete(v.departmentid)
-        delete(v.parentid)
-        delete(v.rowindex)
-        delete(v.subdep)
-        data.list.unshift(v)
-      };
-      res.data.dep.forEach(v => mflat(v))
-      data.list.map((v, i) => {
-        v.index = i;
-        if (v.type == '人员' && v.id == wx.getStorageSync('userMsg').userid) data.index = i;
-        return v
-      })
-      this.setData({
-        "filtratelist[0]": data,
-        active: data.list[data.index]
-      });
-      this.refreshModel();
-    });
     this.refreshData();
   },
   openFiltrate() {
@@ -88,17 +43,26 @@ Page({
       showFiltrate: true
     })
   },
-  handleFilter(e) {
-    let {
-      active
-    } = e.detail;
-    this.setData({
-      active
-    });
-    this.refreshData(active.type == '人员' ? 0 : 1, active.id);
-    this.refreshModel();
+  handleFilter({
+    detail
+  }) {
+    if (detail.name == 'reset') {
+      this.selectComponent("#organization").initDepAndUser().then(active => {
+        this.setData({
+          active
+        })
+        this.refreshData();
+        this.refreshModel();
+      });
+    } else {
+      this.setData({
+        active: this.selectComponent("#organization").data.result
+      })
+      this.refreshData();
+      this.refreshModel();
+    }
   },
-  refreshData(type = 0, dataid = wx.getStorageSync('userMsg').userid) {
+  refreshData() {
     const conversion = (n) => {
       const integer = (n + '').split(".")[0] + '',
         length = integer.length,
@@ -131,13 +95,20 @@ Page({
       return obj
     };
     const getData = (dataType) => {
+      let active = this.data.active;
+      let type = active.userid ? 0 : 1,
+        dataid = type == 0 ? active.userid : active.departmentid,
+        where = {
+          isleave: active.isleave || 0
+        };
       return _Http.basic({
         "id": 20230616131404,
         "content": {
           nocache: true,
           dataType, // 1 作业数据 2 销售数据 3业绩数据
           type,
-          dataid
+          dataid,
+          where
         }
       }).then(res => {
         let data = {};
@@ -303,5 +274,11 @@ Page({
   },
   onReady() {
     this.selectComponent("#ListBox").setHeight(".head", this);
+    this.selectComponent("#organization").initDepAndUser().then(active => {
+      this.setData({
+        active
+      })
+      this.refreshModel();
+    });
   }
 })

+ 5 - 2
packageA/achievement/index.wxml

@@ -1,7 +1,7 @@
 <van-dropdown-menu active-color="#3874F6">
   <van-dropdown-item value="{{ dropdownItem }}" options="{{ dropdown }}" bindchange='dropdownItemChange' />
   <view class="filtrate" url="#" bindtap="openFiltrate">
-    <text style="margin-right: 6rpx;">{{active.name}}-{{active.type}}</text>
+    <text style="margin-right: 6rpx;">{{active.name}}</text>
     <van-icon name="arrow-down" />
   </view>
 </van-dropdown-menu>
@@ -168,4 +168,7 @@
 <view hidden="{{dropdownItem!=4}}">
   <bills id='model4' />
 </view>
-<Yl_Filtrate1 show='{{showFiltrate}}' isReset='{{false}}' list="{{filtratelist}}" bindhandle="handleFilter" />
+
+<Yl_Filtrate1 show='{{showFiltrate}}' isReset="{{false}}" list="{{filtratelist}}" bindhandle="handleFilter">
+  <organization slot='head' dimissionF id='organization' />
+</Yl_Filtrate1>

+ 28 - 66
packageA/finishforecast/detail.js

@@ -31,52 +31,9 @@ Page({
         this.setData({
             sa_salesforecastbillid: options.id
         })
-        if (options.admin == 'true') {
-            this.setData({
-                admin: true
-            })
-            _Http.basic({
-                "id": 20230620102004,
-                "content": {
-                    unLeave: 1
-                }
-            }).then(res => {
-                console.log("获取下级部门和下级人员", res)
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
-                    icon: "none"
-                })
-                let data = {
-                    label: "查询范围",
-                    showName: "name", //显示字段
-                    valueKey: "active", //返回Key
-                    value: "id", //选中值
-                    list: res.data.hr.map(v => {
-                        v.id = v.userid;
-                        v.type = '人员'
-                        delete(v.rowindex)
-                        delete(v.userid)
-                        return v
-                    })
-                };
-                const mflat = (v, prefix) => {
-                    v.subdep.forEach(s => mflat(s, v.depname));
-                    v.name = v.depname;
-                    v.type = '部门';
-                    v.id = v.departmentid;
-                    delete(v.depname)
-                    delete(v.departmentid)
-                    delete(v.parentid)
-                    delete(v.rowindex)
-                    delete(v.subdep)
-                    data.list.unshift(v)
-                };
-                res.data.dep.forEach(v => mflat(v))
-                this.setData({
-                    "filtratelist[0]": data
-                });
-            });
-        }
+        if (options.admin == 'true') this.setData({
+            admin: true
+        })
         let tabsList = [{
             label: "项目产品清单",
             icon: "icon-tabchanpin",
@@ -125,13 +82,12 @@ Page({
         this.setData({
             isonlydep: detail
         });
-        if (detail) {
-            this.setData({
-                active: null,
-                "content.type": 1,
-                "content.dataid": 0,
-            });
-        };
+        if (detail) this.setData({
+            active: null,
+            "content.type": 1,
+            "content.dataid": 0,
+        });
+        this.selectComponent("#organization").initDepAndUser();
         this.getRests();
     },
     /* 切换 */
@@ -145,24 +101,30 @@ Page({
             showFiltrate: true
         })
     },
-    handleFilter(e) {
-        let {
-            active
-        } = e.detail;
-        try {
-            if (active.type) this.setData({
-                active,
-                'content.type': active.type == '人员' ? 0 : 1,
-                'content.dataid': active.id || 0,
-                isonlydep: false
-            });
-        } catch (error) {
+
+    onReady() {
+        if (this.data.admin) this.selectComponent("#organization").initDepAndUser();
+    },
+    handleFilter({
+        detail
+    }) {
+        if (detail.name == 'reset') {
+            this.selectComponent("#organization").initDepAndUser()
             this.setData({
                 active: null,
-                'content.type': 1,
                 'content.dataid': 0,
+                'content.type': 1,
                 isonlydep: false
             })
+        } else {
+            let active = this.selectComponent("#organization").data.result;
+            let type = active.userid ? 0 : 1,
+                dataid = type == 0 ? active.userid : active.departmentid
+            this.setData({
+                active,
+                'content.dataid': dataid,
+                'content.type': type
+            })
         }
         this.getRests();
     },

+ 4 - 2
packageA/finishforecast/detail.wxml

@@ -38,11 +38,13 @@
         </view>
         <navigator url="#" class="filtrate" url="#" bindtap="openFiltrate">
             <text wx:if="{{!active}}">查看范围</text>
-            <text wx:else>{{active.name}}-{{active.type}}</text>
+            <text wx:else>{{active.name}}</text>
             <van-icon style="margin-left: 6rpx;" name="arrow-down" />
         </navigator>
     </view>
     <view style="height: 20rpx;" />
     <List list='{{rests.data}}' />
 </view>
-<Yl_Filtrate1 show='{{showFiltrate}}' list="{{filtratelist}}" bindhandle="handleFilter" />
+<Yl_Filtrate1 show='{{showFiltrate}}' list="{{[]}}" bindhandle="handleFilter">
+    <organization slot='head' defaultMy='{{false}}' id='organization' />
+</Yl_Filtrate1>

+ 27 - 67
packageA/invoiceforecast/detail.js

@@ -24,53 +24,9 @@ Page({
         this.setData({
             sa_salesforecastbillid: options.id
         })
-        if (options.admin == 'true') {
-            this.setData({
-                admin: true
-            })
-            _Http.basic({
-                "id": 20230620102004,
-                "content": {
-                    unLeave: 1
-                }
-            }).then(res => {
-                console.log("获取下级部门和下级人员", res)
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
-                    icon: "none"
-                })
-                let data = {
-                    label: "查询范围",
-                    showName: "name", //显示字段
-                    valueKey: "active", //返回Key
-                    value: "id", //选中值
-                    list: res.data.hr.map(v => {
-                        v.id = v.userid;
-                        v.type = '人员'
-                        delete(v.rowindex)
-                        delete(v.userid)
-                        return v
-                    })
-                };
-                const mflat = (v, prefix) => {
-                    v.subdep.forEach(s => mflat(s, v.depname));
-                    v.name = v.depname;
-                    v.type = '部门';
-                    v.id = v.departmentid;
-                    delete(v.depname)
-                    delete(v.departmentid)
-                    delete(v.parentid)
-                    delete(v.rowindex)
-                    delete(v.subdep)
-                    data.list.unshift(v)
-                };
-                res.data.dep.forEach(v => mflat(v))
-                this.setData({
-                    "filtratelist[0]": data
-                });
-            });
-        }
-
+        if (options.admin == 'true') this.setData({
+            admin: true
+        })
         let tabsList = [{
             label: "订单",
             icon: "icon-E-dingdan",
@@ -126,13 +82,12 @@ Page({
         this.setData({
             isonlydep: detail
         });
-        if (detail) {
-            this.setData({
-                active: null,
-                "content.type": 1,
-                "content.dataid": 0,
-            });
-        };
+        if (detail) this.setData({
+            active: null,
+            "content.type": 1,
+            "content.dataid": 0,
+        });
+        this.selectComponent("#organization").initDepAndUser();
         this.getRests();
     },
     /* 切换 */
@@ -146,24 +101,29 @@ Page({
             showFiltrate: true
         })
     },
-    handleFilter(e) {
-        let {
-            active
-        } = e.detail;
-        try {
-            if (active.type) this.setData({
-                active,
-                'content.type': active.type == '人员' ? 0 : 1,
-                'content.dataid': active.id || 0,
-                isonlydep: false
-            });
-        } catch (error) {
+    onReady() {
+        if (this.data.admin) this.selectComponent("#organization").initDepAndUser();
+    },
+    handleFilter({
+        detail
+    }) {
+        if (detail.name == 'reset') {
+            this.selectComponent("#organization").initDepAndUser()
             this.setData({
                 active: null,
-                'content.type': 1,
                 'content.dataid': 0,
+                'content.type': 1,
                 isonlydep: false
             })
+        } else {
+            let active = this.selectComponent("#organization").data.result;
+            let type = active.userid ? 0 : 1,
+                dataid = type == 0 ? active.userid : active.departmentid
+            this.setData({
+                active,
+                'content.dataid': dataid,
+                'content.type': type
+            })
         }
         this.getRests();
     },

+ 4 - 2
packageA/invoiceforecast/detail.wxml

@@ -39,7 +39,7 @@
         </view>
         <navigator url="#" class="filtrate" url="#" bindtap="openFiltrate">
             <text wx:if="{{!active}}">查看范围</text>
-            <text wx:else>{{active.name}}-{{active.type}}</text>
+            <text wx:else>{{active.name}}</text>
             <van-icon style="margin-left: 6rpx;" name="arrow-down" />
         </navigator>
     </view>
@@ -56,4 +56,6 @@
     <view style="height: 20rpx;" />
     <List list='{{rests.data}}' />
 </view>
-<Yl_Filtrate1 show='{{showFiltrate}}' list="{{filtratelist}}" bindhandle="handleFilter" />
+<Yl_Filtrate1 show='{{showFiltrate}}' list="{{[]}}" bindhandle="handleFilter">
+    <organization slot='head' defaultMy='{{false}}' id='organization' />
+</Yl_Filtrate1>

+ 24 - 81
packageA/salesHourglass/index.js

@@ -52,10 +52,11 @@ Page({
             where: {
                 begdate: "",
                 enddate: "",
-                tradefield: ""
+                tradefield: "",
+                isleave: 0
             }
         },
-        filtratelist: [null, {
+        filtratelist: [{
             label: "时间筛选",
             showName: "name", //显示字段
             valueKey: "dateType", //返回Key
@@ -85,56 +86,6 @@ Page({
         }]
     },
     onLoad(options) {
-        _Http.basic({
-            "id": 20230620102004,
-            "content": {}
-        }).then(res => {
-            console.log("获取下级部门和下级人员", res)
-            if (res.msg != '成功') return wx.showToast({
-                title: res.data,
-                icon: "none"
-            })
-            let data = {
-                label: "查询范围",
-                showName: "name", //显示字段
-                valueKey: "active", //返回Key
-                value: "id", //选中值
-                list: res.data.hr.map(v => {
-                    v.id = v.userid;
-                    v.type = '人员'
-                    delete(v.rowindex)
-                    delete(v.userid)
-                    return v
-                })
-            };
-            const mflat = (v, prefix) => {
-                v.subdep.forEach(s => mflat(s, v.depname));
-                v.name = v.depname;
-                v.type = '部门';
-                v.id = v.departmentid;
-                delete(v.depname)
-                delete(v.departmentid)
-                delete(v.parentid)
-                delete(v.rowindex)
-                delete(v.subdep)
-                data.list.unshift(v)
-            };
-            res.data.dep.forEach(v => mflat(v))
-
-            data.list.map((v, i) => {
-                v.index = i;
-                if (v.type == '人员' && v.id == wx.getStorageSync('userMsg').userid) {
-                    data.index = i
-                    data.default = i
-                };
-                return v
-            })
-
-            this.setData({
-                "filtratelist[0]": data
-            });
-        });
-
         _Http.basic({
             "id": 20221223141802,
             "content": {
@@ -165,45 +116,37 @@ Page({
     },
     onReady() {
         this.setChartData();
-        this.selectComponent("#Yl_Filtrate1").queryMonths(12)
+        this.selectComponent("#organization").initDepAndUser();
     },
     openFiltrate() {
         this.setData({
             showFiltrate: true
         })
     },
-    interrupt({
+    handleFilter({
         detail
     }) {
         console.log(detail)
-        if (detail.data.label == "时间筛选") this.selectComponent("#Yl_Filtrate1").queryMonths(detail.item.queryMonths)
-
-    },
-    handleFilter(e) {
-        console.log(e)
-        let {
-            active,
-            dateType,
-            enddate,
-            startdate,
-            tradefield
-        } = e.detail;
-        if (active && active != 'id') {
-            this.data.content.type = active.type == '人员' ? 0 : 1;
-            this.data.content.dataid = active.id || 0;
-        } else {
-            this.data.content.type = 0;
-            this.data.content.dataid = 0;
-        }
-        if (startdate && enddate) {
-            this.data.content.dateType = 0;
-            this.data.content.where.begdate = startdate;
-            this.data.content.where.enddate = enddate;
+        if (detail.name == 'reset') {
+            this.selectComponent("#organization").initDepAndUser()
+            this.setData({
+                'content.dataid': 0,
+                'content.type': 0,
+                'content.where.isleave': 0,
+                'content.where.tradefield': "",
+            })
         } else {
-            this.data.content.dateType = dateType && dateType != 'id' ? dateType : 0
+            let active = this.selectComponent("#organization").data.result;
+            let type = active.userid ? 0 : 1,
+                dataid = type == 0 ? active.userid : active.departmentid
+            this.setData({
+                'content.dataid': dataid,
+                'content.type': type,
+                'content.where.tradefield': detail.tradefield,
+                'content.where.isleave': active.isleave || 0,
+            })
         }
-
-        this.data.content.tradefield = tradefield
+        this.data.content.dateType = detail.dateType && detail.dateType != 'id' ? detail.dateType : 0;
         this.setChartData();
     },
     setChartData() {
@@ -246,5 +189,5 @@ Page({
         return createElement(Chart, {
             data: this.data.statistics
         });
-    },
+    }
 })

+ 3 - 1
packageA/salesHourglass/index.wxml

@@ -41,4 +41,6 @@
     </view>
 </view>
 <My_empty wx:if="{{!statistics.length}}" />
-<Yl_Filtrate1 id='Yl_Filtrate1' show='{{showFiltrate}}' dateRange='{{true}}' dateRangeName='创建日期' list="{{filtratelist}}" bindhandle="handleFilter" bindinterrupt='interrupt' />
+<Yl_Filtrate1 show='{{showFiltrate}}' dateRange='{{false}}' list="{{filtratelist}}" bindhandle="handleFilter">
+    <organization slot='head' defaultMy='{{false}}' dimissionF id='organization' />
+</Yl_Filtrate1>

+ 14 - 0
project.private.config.json

@@ -8,6 +8,20 @@
     "condition": {
         "miniprogram": {
             "list": [
+                {
+                    "name": "出货管理",
+                    "pathName": "packageA/invoiceforecast/detail",
+                    "query": "id=16308&admin=true",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "销售漏斗",
+                    "pathName": "packageA/salesHourglass/index",
+                    "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
                 {
                     "name": "任务",
                     "pathName": "packageA/work/index",