xiaohaizhao преди 1 година
родител
ревизия
3e48d692f6

+ 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",

+ 2 - 3
components/organization/index.wxml

@@ -1,5 +1,5 @@
 <!-- 部门筛选 -->
-<view class="groud {{exclution && takeEffect !='dep' ? 'exclution' : '' }}" wx:for="{{depGroud}}" wx:key="label">
+<view wx:if="{{isdep}}" class="groud {{exclution && takeEffect !='dep' ? 'exclution' : '' }}" wx:for="{{depGroud}}" wx:key="label">
     <view class="title">
         <view class="label">
             {{item.label}}
@@ -13,8 +13,7 @@
     </view>
 </view>
 <!-- 人员筛选 -->
-<view class="groud {{exclution && takeEffect != 'user'? 'exclution' : ''}}" wx:key="label">
-
+<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}}

+ 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>

+ 26 - 62
packageA/salesHourglass/index.js

@@ -48,9 +48,12 @@ Page({
             nocache: true,
             dataid: 0,
             type: 0,
-            dateType: 0
+            dateType: 0,
+            "where": {
+                isleave: 0
+            },
         },
-        filtratelist: [null, {
+        filtratelist: [{
             label: "时间筛选",
             showName: "name", //显示字段
             valueKey: "dateType", //返回Key
@@ -74,77 +77,38 @@ 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
-            });
-        });
     },
     onReady() {
         this.setChartData();
+        this.selectComponent("#organization").initDepAndUser();
     },
     openFiltrate() {
         this.setData({
             showFiltrate: true
         })
     },
-    handleFilter(e) {
-        let {
-            active,
-            dateType
-        } = e.detail;
-        if (active && active != 'id') {
-            this.data.content.type = active.type == '人员' ? 0 : 1;
-            this.data.content.dataid = active.id || 0;
+    handleFilter({
+        detail
+    }) {
+        if (detail.name == 'reset') {
+            this.selectComponent("#organization").initDepAndUser()
+            this.setData({
+                'content.dataid': 0,
+                'content.type': 0,
+                'content.where.isleave': 0,
+            })
         } else {
-            this.data.content.type = 0;
-            this.data.content.dataid = 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.isleave': active.isleave || 0,
+            })
         }
-        this.data.content.dateType = dateType && dateType != 'id' ? dateType : 0
+        this.data.content.dateType = detail.dateType && detail.dateType != 'id' ? detail.dateType : 0;
         this.setChartData();
     },
     setChartData() {
@@ -187,5 +151,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 show='{{showFiltrate}}' dateRange='{{false}}' list="{{filtratelist}}" bindhandle="handleFilter" />
+<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

@@ -7,6 +7,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",