|
@@ -13,7 +13,7 @@ Page({
|
|
|
"pageNumber": 1,
|
|
|
"pageSize": 40,
|
|
|
"type": "0", //1按部门 0按人员
|
|
|
- "dataid": "0", //部门人员id
|
|
|
+ "dataid": wx.getStorageSync('userMsg').userid, //部门人员id
|
|
|
"querytype": "1", //0按业务员 1按客户
|
|
|
"point": "全部", // 入账节点
|
|
|
"where": {
|
|
@@ -64,57 +64,7 @@ Page({
|
|
|
return prev.width ? prev.width + cur.width : prev + cur.width
|
|
|
})
|
|
|
})
|
|
|
- _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;
|
|
|
- this.data.content.dataid = v.id;
|
|
|
- };
|
|
|
- return v
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- "filtratelist[0]": data
|
|
|
- });
|
|
|
- this.getList()
|
|
|
- });
|
|
|
+ this.getList()
|
|
|
},
|
|
|
getList(init = false) {
|
|
|
if (init.detail != undefined) init = init.detail;
|
|
@@ -201,6 +151,7 @@ Page({
|
|
|
},
|
|
|
onReady() {
|
|
|
this.setListHeight()
|
|
|
+ this.selectComponent("#organization").initDepAndUser();
|
|
|
},
|
|
|
/* 设置页面高度 */
|
|
|
setListHeight() {
|
|
@@ -214,14 +165,23 @@ Page({
|
|
|
handleFilter({
|
|
|
detail
|
|
|
}) {
|
|
|
- if (typeof detail == 'object') {
|
|
|
- if (detail.active == 'id') return this.getList(true)
|
|
|
- this.data.content.type = detail.active.type == '人员' ? 0 : 1;
|
|
|
- this.data.content.dataid = detail.active.id;
|
|
|
+
|
|
|
+ if (detail.name == 'reset') {
|
|
|
+ this.selectComponent("#organization").initDepAndUser()
|
|
|
+ this.setData({
|
|
|
+ 'content.dataid': wx.getStorageSync('userMsg').userid,
|
|
|
+ 'content.type': 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
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
this.getList(true)
|
|
|
},
|
|
|
startSearch({
|