refector: 去除getuserrange方法

This commit is contained in:
caoqianming 2023-04-12 08:44:29 +08:00
parent 9737ffa89b
commit e2bb6ac06f
8 changed files with 6 additions and 168 deletions

View File

@ -169,7 +169,6 @@
uni.setStorageSync('mySecret', JSON.stringify(mySecret))
}).catch(e => {})
// #endif
that.getUserRange();
})
},
ranStr(e) {
@ -190,60 +189,6 @@
codeChange(text) {
this.codeTips = text;
},
getUserRange() {
let that = this;
that.$u.api.deptList({
page: 0,
type__in: 'rparty,dept',
query: '{id, name, parent, type}'
}).then(res => {
let list1 = res;
let list2 = [];
let reqList = [];
list1.forEach(function(item) {
reqList.push(that.$u.api.userList({
page: 0,
belong_dept: item.id,
is_active: true,
query: '{id, name, belong_dept}'
}))
})
Promise.all(reqList).then(res => {
for (let i = 0; i < res.length; i++) {
list1[i].children = res[i]
}
list1.forEach(item => {
if (item.type == 'dept') {
list2.push({
...item
})
}
})
that.$u.vuex('vuex_userRange', that.parseData(list1))
that.$u.vuex('vuex_userRange2', that.parseData(list2))
})
})
},
parseData(data) {
// * parent
const obj = {};
data.forEach((item) => {
obj[item.id] = item;
});
const parentList = [];
data.forEach((item) => {
const parent = obj[item.parent];
if (parent) {
// *
parent.children = parent.children || [];
parent.children.unshift(item);
} else {
parentList.push(item);
}
});
return parentList;
},
//
getCode(e) {
// debugger;

View File

@ -84,25 +84,8 @@
},
onShow() {
// this.getUserRange();
},
methods: {
//
getUserRange() {
let that = this;
this.$u.api.vmVisitor({
page: 0
}).then(res => {
that.userRange = [];
res.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.userRange.push(obj)
})
})
},
select(row) {},
goBack() {
uni.navigateBack({

View File

@ -34,10 +34,6 @@
<text type="text" >{{worker_name}}</text>
<uni-icons style="position: absolute; right: 0;" type="arrowright" color="#999999"/>
</view>
<!-- <ba-tree-picker ref="workerPicker" :multiple='false' @select-change="selectChange" title="选择作业人员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{worker_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showPicker" type="arrowright" color="#999999"/> -->
</view>
</view>
@ -390,21 +386,15 @@
}
.dialogCont {
/* width: 80vw;
width: 90vw;
position: absolute;
top: 50%;
margin: auto;
background-color: #ffffff;
left: 10vw;
left: 5vw;
transform: translateY(-50%);
padding: 20rpx;
border-radius: 20rpx; */
width: 100vw;
position: absolute;
top: 61px;
height: 100vh;
padding: 30rpx;
background-color: #ffffff;
border-radius: 20rpx;
}
.dialogTitle {

View File

@ -248,7 +248,6 @@
this.getOplcates();
this.getdept();
this.getRange();
// this.getUserRange();
this.getHeader();
},
methods: {
@ -397,25 +396,6 @@
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;

View File

@ -240,7 +240,6 @@
this.getOplcates();
this.getdept();
this.getRange();
// this.getUserRange();
this.getHeader();
},
methods: {
@ -390,25 +389,6 @@
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;

View File

@ -243,7 +243,6 @@
this.getOplcates();
this.getdept();
this.getRange();
// this.getUserRange();
this.getHeader();
},
methods: {
@ -392,25 +391,6 @@
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;

View File

@ -350,7 +350,6 @@
this.getOplcates();
this.getdept();
this.getRange();
// this.getUserRange();
this.getHeader();
},
methods: {
@ -502,25 +501,6 @@
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;

View File

@ -172,7 +172,7 @@
},
onShow() {
this.getHeader();
this.getUserRange();
this.getVisitorRange();
},
methods: {
getHeader() {
@ -190,7 +190,7 @@
this.formData.test_report = data.path;
},
//
getUserRange() {
getVisitorRange() {
let that = this;
that.$u.api.vmVisitor({
page: 0