|
|
@@ -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();
|
|
|
+ });
|
|
|
}
|
|
|
})
|