userCheck
This commit is contained in:
parent
38a03bcdf8
commit
b1eaf35a69
|
|
@ -359,6 +359,7 @@
|
|||
},
|
||||
|
||||
formSubmit(e) {
|
||||
// debugger;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
|
|
@ -368,7 +369,8 @@
|
|||
that.$u.api.login(obj).then(res => {
|
||||
uni.hideLoading();
|
||||
that.$u.vuex('vuex_token', res.access)
|
||||
that.$u.vuex('vuex_refresh', res.refresh)
|
||||
that.$u.vuex('vuex_refresh', res.refresh);
|
||||
that.getUserRange();
|
||||
that.$u.api.getUserInfo().then(user => {
|
||||
if(user.avatar){
|
||||
user.avatar = this.vuex_host + user.avatar
|
||||
|
|
@ -421,16 +423,77 @@
|
|||
})
|
||||
}).catch(e=>{})
|
||||
// #endif
|
||||
/* let secret = that.ranStr(12)
|
||||
let mySecret = {'username': obj.username, 'secret': secret}
|
||||
that.$u.api.bindSecret({secret: secret}).then(res=>{
|
||||
uni.setStorageSync('mySecret', JSON.stringify(mySecret))
|
||||
}).catch(e=>{}) */
|
||||
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
},
|
||||
getUserRange(){
|
||||
let that = this;
|
||||
that.$u.api.deptList({page: 0,type__in:'rparty,dept'}).then(res => {
|
||||
let arr = [];
|
||||
let obj = {};
|
||||
res.forEach(item=>{
|
||||
obj = {...item};
|
||||
obj.children = [];
|
||||
arr.push(obj)
|
||||
})
|
||||
let userRange0 = that.resetData(arr);
|
||||
let useArr = userRange0[0].children;
|
||||
|
||||
for (let i=0;i<useArr.length;i++){
|
||||
if(useArr[i].children.length>0){
|
||||
let childrenArr = useArr[i].children;
|
||||
for(let j = 0;j<childrenArr.length;j++){
|
||||
if(childrenArr[j].children){
|
||||
that.$u.api.userList({page: 0,belong_dept:childrenArr[j].id}).then(res1 => {
|
||||
res1.forEach(item1=>{
|
||||
useArr[i].children[j].children.push(item1);
|
||||
that.$u.vuex('vuex_userRange', useArr)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
that.$u.api.userList({page: 0,belong_dept:useArr[i].id}).then(res0 => {
|
||||
res0.forEach(item0=>{
|
||||
useArr[i].children.push(item0);
|
||||
that.$u.vuex('vuex_userRange', useArr)
|
||||
})
|
||||
})
|
||||
}
|
||||
setTimeout(function(){
|
||||
// debugger;
|
||||
console.log(useArr);
|
||||
that.$u.vuex('vuex_userRange', useArr)
|
||||
},3000)
|
||||
})
|
||||
},
|
||||
resetData(params) {
|
||||
let posts = [];
|
||||
params.forEach((item) => {
|
||||
let obj = new Object();
|
||||
obj = {
|
||||
...item
|
||||
};
|
||||
obj.value = item.id;
|
||||
obj.text = item.name;
|
||||
obj.parentId = item.parent;
|
||||
posts.push(obj);
|
||||
});
|
||||
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
|
||||
let arr = [];
|
||||
for (let item of posts) {
|
||||
if (item.parentId == null) {
|
||||
arr.push(item);
|
||||
continue;
|
||||
}
|
||||
let parent = obj[item.parentId];
|
||||
parent.children = parent.children ? parent.children : [];
|
||||
parent.children.push(item);
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
formSubmit2(e) {
|
||||
var that = this;
|
||||
const obj = e.target.value;
|
||||
|
|
@ -438,8 +501,7 @@
|
|||
that.$u.api.codeLogin(obj).then(res => {
|
||||
that.$u.vuex('vuex_token', res.access)
|
||||
that.$u.vuex('vuex_refresh', res.refresh)
|
||||
// let data = {openid: uni.getStorageSync('wxmp_openid')}
|
||||
// that.$u.api.bindmp(data).then(res=>{})
|
||||
that.getUserRange();
|
||||
that.$u.api.getUserInfo().then(res => {
|
||||
if(res.avatar){
|
||||
res.avatar = this.vuex_host + res.avatar
|
||||
|
|
@ -466,7 +528,7 @@
|
|||
},
|
||||
// 获取验证码
|
||||
getCode() {
|
||||
debugger;
|
||||
// debugger;
|
||||
console.log(this.phoneNumber)
|
||||
if (this.phoneNumber !== '') {
|
||||
if (this.$refs.uCode.canGetCode){
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
<view class="form-content ">
|
||||
<view class="form-item border-bottom">
|
||||
<view class="form-left">
|
||||
<!-- <text class="star">*</text> -->
|
||||
<text class="form-left-text">具体地点</text>
|
||||
</view>
|
||||
<view class="form-right">
|
||||
|
|
@ -97,7 +96,7 @@
|
|||
</view>
|
||||
<view class="form-right" style="position: relative;">
|
||||
<ba-tree-picker ref="dcoordinator_Picker" :multiple='false' @select-change="select_coordinator_Change" title="选择部门协调员"
|
||||
:localdata="userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
|
||||
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
|
||||
<text type="text">{{dcoordinator_name}}</text>
|
||||
<uni-icons style="position: absolute; right: 0;" @click="showDcoordinatorPicker" type="arrowright" color="#999999"/>
|
||||
</view>
|
||||
|
|
@ -183,8 +182,6 @@
|
|||
},
|
||||
onShow() {
|
||||
this.getdept();
|
||||
this.getRange();
|
||||
this.getUserRange();
|
||||
this.range = [];
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -248,7 +245,7 @@
|
|||
},
|
||||
//获取工作operation
|
||||
getOperation() {
|
||||
debugger;
|
||||
// debugger;
|
||||
let that = this;
|
||||
that.$u.api.operationItem(that.operationId).then((res) => {
|
||||
that.formData.id = res.id; //
|
||||
|
|
@ -267,6 +264,9 @@
|
|||
that.formData.vchannel = res.vchannels[0]
|
||||
}
|
||||
that.operationName = res.name; //作业
|
||||
that.dept_ter_name = res.dept_ter_.name; //属地部门
|
||||
that.dept_bus_name = res.dept_bus_.name; //业务部门
|
||||
that.dcoordinator_name = res.coordinator_name; //部门协调员
|
||||
that.datetimerange = [res.start_time, res.end_time]
|
||||
});
|
||||
},
|
||||
|
|
@ -310,48 +310,7 @@
|
|||
that.depRange = resetData(res);
|
||||
})
|
||||
},
|
||||
//获取作业区域
|
||||
getRange() {
|
||||
this.$u.api.areaLists({page: 0}).then(res => {
|
||||
let range = [];
|
||||
let obj = {};
|
||||
res.forEach(item => {
|
||||
obj = {value: null,text: ''};
|
||||
obj.value = item.id;
|
||||
obj.text = item.name;
|
||||
range.push(obj);
|
||||
})
|
||||
this.range = range
|
||||
})
|
||||
},
|
||||
//获取用户
|
||||
getUserRange() {
|
||||
let that = this;
|
||||
/* that.$u.api.deptList({page: 0}).then(res => {
|
||||
that.userRange = resetData(res)[0].children;
|
||||
let depts = that.userRange;
|
||||
for (let i=0;i<depts.length;i++){
|
||||
// depts[i].children = [{id:0,name:'name'}]
|
||||
that.$u.api.userList({page: 0,belong_dept:depts[i].id}).then(res => {
|
||||
depts[i].children = res;
|
||||
that.userRange = depts;
|
||||
})
|
||||
}
|
||||
that.userRange = depts;
|
||||
}) */
|
||||
that.$u.api.deptList({page: 0}).then(res => {
|
||||
that.userRange = resetData(res);
|
||||
let userRange = that.userRange[0];
|
||||
let depts = userRange.children;
|
||||
for (let i=0;i<depts.length;i++){
|
||||
that.$u.api.userList({page: 0,belong_dept:depts[i].id}).then(res => {
|
||||
depts[i].children = res;
|
||||
})
|
||||
}
|
||||
that.userRange.children = depts;
|
||||
that.userRange = depts;
|
||||
})
|
||||
},
|
||||
|
||||
/* 参数验证 */
|
||||
paramsCheck() {
|
||||
if (!nonNullCheck(this.formData.name)) {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,6 @@
|
|||
style="position: absolute;top:0;left:0;bottom:0;right:0;height: 290rpx;background-image: url(../../static/workSpace/bgimg.png);background-position: center bottom;background-size: 100%;">
|
||||
</view>
|
||||
<view class="top-title" style="display: flex;">
|
||||
<!-- <block v-for="(item,index) in routerList" :key="index">
|
||||
<view class="title-item" @click="goInto(index)">
|
||||
<view class="title-icon">
|
||||
<image :src="require('@/static/workSpace/'+item.icon+'')" mode="widthFix"></image>
|
||||
</view>
|
||||
<text class="title-text">{{item.name}}</text>
|
||||
</view>
|
||||
</block> -->
|
||||
<view class="title-item" @click="goInto(0)" v-if="limitedOperation">
|
||||
<view class="title-icon">
|
||||
<image :src="require('@/static/workSpace/specialmatter.png')" mode="widthFix"></image>
|
||||
|
|
@ -115,7 +107,7 @@
|
|||
},
|
||||
onShow() {
|
||||
// debugger;
|
||||
// console.log(this.vuex_perm)
|
||||
console.log(this.vuex_userRange)
|
||||
this.limitedRpj = this.vuex_perm.includes('rpj.create')>-1||this.vuex_perm.includes('superuser')>-1;
|
||||
this.limitedOperation = this.vuex_perm.includes('operation.create')>-1||this.vuex_perm.includes('superuser')>-1;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ try{
|
|||
}
|
||||
|
||||
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
||||
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_appid','vuex_perm','vuex_employee'];
|
||||
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_appid','vuex_perm','vuex_employee','vuex_userRange'];
|
||||
|
||||
// 保存变量到本地存储中
|
||||
const saveLifeData = function(key, value){
|
||||
|
|
@ -34,6 +34,7 @@ const store = new Vuex.Store({
|
|||
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
|
||||
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
|
||||
vuex_perm: lifeData.vuex_perm ? lifeData.vuex_perm : [],
|
||||
vuex_userRange: lifeData.vuex_userRange ? lifeData.vuex_userRange : [],
|
||||
vuex_appid: 'wxf7d6140f507466be',
|
||||
vuex_login: 'http://qyjy.ctc-zc.com/h5/',
|
||||
vuex_version: '1.00.08',
|
||||
|
|
|
|||
Loading…
Reference in New Issue