This commit is contained in:
shijing 2022-10-26 08:37:49 +08:00
commit 4cf6e44ffa
17 changed files with 396 additions and 404 deletions

171
App.vue
View File

@ -4,6 +4,57 @@
globalData: {
appid: 'wxf7d6140f507466be'
},
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;
},
onLaunch() {
// #ifdef APP-PLUS
@ -68,11 +119,11 @@
}
});
// #endif
// #ifdef APP-PLUS
uni.getSystemInfo({
success(res) {
console.log(res)
that.$u.vuex('vuex_version', res.appVersion)
// #ifdef APP-PLUS
if (res.platform == 'android') {
that.$u.api.apkCheck().then(res1 => {
if (res.appVersion < res1.version) {
@ -95,127 +146,9 @@
}
})
}
}
})
// #endif
// #ifdef APP-PLUS
uni.showLoading({
title: '自动登录中...',
mask: true
})
uni.getStorage({
key: 'mySecret',
success: function(res) {
let secret = res.data
if (secret) {
uni.showToast({
title: JSON.parse(secret).username,
icon: "none"
})
that.$u.api.loginSecret(JSON.parse(secret)).then(res => {
that.$u.vuex('vuex_token', res.access)
that.$u.api.getUserInfo().then(res => {
if(res.avatar){
res.avatar = this.vuex_host + res.avatar
}
that.$u.vuex('vuex_user', res)
let perms = [];
for (let key in user.perms) {
perms.push(key);
}
console.log(perms);
that.$u.vuex('vuex_perm', perms)
//
})
uni.reLaunch({
url: '/pages/home/home_'
})
}).catch(e=>{
uni.reLaunch({
url: '/pages/login/login_'
})
})
}else{
uni.reLaunch({
url: '/pages/login/login_'
})
}
},
fail() {
uni.reLaunch({
url: '/pages/login/login_'
})
},
complete() {
uni.hideLoading()
}
});
//
uni.showToast({
title: qyjyClientId,
icon: "none"
})
/* that.$u.api.loginCOde(qyjyClientId).then(res => {
that.$u.api.getUserInfo().then(res => {
that.$u.vuex('vuex_user', res)
//
})
uni.reLaunch({
url: '/pages/home/home_'
})
}).catch(res=>{
uni.reLaunch({
url: '/pages/login/login_'
})
}) */
// #endif
uni.showLoading({
title: '自动登录中...',
mask: true
})
uni.getStorage({
key: 'mySecret',
success: function(res) {
let secret = res.data
if (secret) {
uni.showToast({
title: JSON.parse(secret).username,
icon: "none"
})
let a=JSON.parse(secret).username;
console.log(a)
that.$u.api.getUserInfo().then(res => {
that.$u.vuex('vuex_user', res)
let perms = [];
for (let key in user.perms) {
perms.push(key);
}
console.log(perms);
that.$u.vuex('vuex_perm', perms)
if(res.type==='employee'||res.type==='remployee'){
uni.reLaunch({
url: '/pages/home/home_'
})
}else{
uni.reLaunch({
url: '/pages/workSpace/workSpace'
})
}
//
})
}
},
complete() {
uni.hideLoading()
}
});
},
}
</script>

View File

@ -2,8 +2,8 @@
"name" : "曲阳金隅EHS",
"appid" : "__UNI__B00D419",
"description" : "曲阳金隅EHS",
"versionName" : "1.01.03",
"versionCode" : 10103,
"versionName" : "1.01.07",
"versionCode" : 10107,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -121,6 +121,6 @@
"mode" : "history",
"base" : "/h5/"
},
"title" : "共享平台"
"title" : "曲阳金隅EHS"
}
}

View File

@ -41,7 +41,7 @@
{
"path": "pages/home/home_",
"style": {
// "navigationBarTitleText": "曲阳金隅EHS主页",
"navigationBarTitleText": "曲阳金隅EHS主页",
"enablePullDownRefresh": false
}
},

View File

@ -24,7 +24,7 @@
<text class="form-left-text">工单状态</text>
</view>
<view class="form-right" style="color:blue">
<view>{{ticketDetail.state_.name}}</view>
<view v-if="ticketDetail.state">{{ticketDetail.state_.name}}</view>
</view>
</view>
</view>
@ -269,7 +269,8 @@
<text class="form-left-text">所属作业</text>
</view>
<view class="form-right">
<view v-if="oplDetail.operation_" style="color:blue" @click="goOp">{{oplDetail.operation_.name}}</view>
<view v-if="oplDetail.operation_" style="color:blue" @click="goOp">{{oplDetail.operation_.name}}
</view>
</view>
</view>
<view class="form-item border-bottom">
@ -356,13 +357,15 @@
<view class="btn" style="display: flex;justify-content: space-between;margin-top: 20rpx;">
<view class="left-content">
<button class="mini-btn" size="mini" type="primary" @click="addNode">加签</button>
<button class="mini-btn" size="mini" v-if="ticketDetail.state_&&ticketDetail.state_.enable_deliver"
type="primary" plain @click="deliverNode">转交
<button class="mini-btn" size="mini"
v-if="ticketDetail.state_&&ticketDetail.state_.enable_deliver" type="primary" plain
@click="deliverNode">转交
</button>
</view>
<view class="right-time">
<button v-for="item in operationBtn" :key="item.id" class="mini-btn" size="mini"
:type="item.attribute_type===2?'warn':'primary'" @click="operationSubmit(item.id)" style="margin-left:8upx">
:type="item.attribute_type===2?'warn':'primary'" @click="operationSubmit(item.id)"
style="margin-left:8upx">
{{item.name}}
</button>
</view>
@ -380,7 +383,7 @@
<uni-list-item v-for="item in tLog" :key="item.id">
<text slot="body">
<view>{{item.state_.name}}</view>
<view style="color:gray">
<view style="color:gray;font-size: 28rpx;">
<span v-if="item.participant">{{item.participant_.name}}-</span>
<span v-if="item.transition_attribute==1" style="color:green">同意-</span>
<span v-if="item.transition_attribute==2" style="color:red">拒绝-</span>
@ -699,7 +702,9 @@
this.$u.api.ticketHandle(this.ticketId, params).then(res => {
uni.hideLoading()
uni.navigateBack()
}).catch(e=>{uni.hideLoading()})
}).catch(e => {
uni.hideLoading()
})
},
goOp() {
uni.navigateTo({
@ -975,6 +980,7 @@
border-top-width: 0;
border-bottom-color: #EBEEF5;
}
.dialogWrap {
position: fixed;
width: 100vw;

View File

@ -127,7 +127,7 @@
onShow() {
// debugger;
// console.log(this.vuex_perm)
if(this.vuex_user.type==='visitor'){
if(this.vuex_user.type==='visitor'||this.vuex_user.type==='driver'){
this.limitedVisit = true;
}else{
let date = new Date();

View File

@ -119,8 +119,14 @@
}
},
onLoad() {
that = this;
onLoad(options) {
that = this
var autoLoading = options.autoLoading;
// #ifdef APP-PLUS
if(autoLoading != 'no'){
that.appLogin()
}
// #endif
},
methods: {
checkboxChange(e) {
@ -370,7 +376,6 @@
uni.hideLoading();
that.$u.vuex('vuex_token', res.access)
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
@ -385,7 +390,6 @@
}
console.log(perms);
that.$u.vuex('vuex_perm', perms)
})
that.$u.api.hrmUserInfo().then(res => {
that.$u.vuex('vuex_employee', res)
if (res.type === 'employee') {
@ -394,7 +398,8 @@
})
} else {
//
if(res.id_number==''||res.photo==''||res.id_number==null||res.photo==null){
if (res.id_number == '' || res.photo == '' || res.id_number == null || res
.photo == null) {
//
uni.reLaunch({
url: '/pages/my/myInfoChange'
@ -413,114 +418,79 @@
}
}
})
})
// #ifdef APP-PLUS
let secret = that.ranStr(12)
let mySecret = {'username': obj.username, 'secret': secret}
that.$u.api.bindSecret({secret: secret}).then(res=>{
let mySecret = {
'username': obj.username,
'secret': secret
}
that.$u.api.bindSecret({
secret: secret
}).then(res => {
uni.setStorageSync('mySecret', JSON.stringify(mySecret))
uni.reLaunch({
url: '/pages/home/home_'
})
// uni.reLaunch({
// url: '/pages/home/home_'
// })
}).catch(e => {})
// #endif
that.getUserRange();
}).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)
})
var useArr = that.resetData(arr);
for (let i=0;i<useArr.length;i++){
let requestList = []
requestList.push(that.$u.api.userList({page: 0,belong_dept:useArr[i].id}))
Promise.all(requestList).then(res=>{
res.forEach(item=>{
item.forEach(item0=>{
useArr[i].children.push(item0);
if(useArr[i].children.length>0){
let childrenArr = useArr[i].children;
for(let j = 0;j<childrenArr.length;j++){
let requestList2= []
if(childrenArr[j].children){
requestList2.push(that.$u.api.userList({page: 0,belong_dept:childrenArr[j].id}))
Promise.all(requestList2).then(res2=>{
res2.forEach(item=>{
item.forEach(item1=>{
useArr[i].children[j].children.push(item1);
})
})
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]
}
}
}
})
})
})
}
that.$u.vuex('vuex_userRange', useArr)
})
},
getUser1(id) {
that.$u.api.userList({page: 0,belong_dept:id}).then(res0 => {
res0.forEach(item0=>{
useArr[i].children.push(item0);
that.$u.vuex('vuex_userRange', useArr);
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)
})
})
}
}
}
})
})
},
resetData(params) {
let posts = [];
params.forEach((item) => {
let obj = new Object();
obj = {
list1.forEach(item => {
if (item.type == 'dept') {
list2.push({
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
})
}
})
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;
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
console.log(item)
if (item.parentId == null||item.parentId=="1561653664806998016") {
arr.push(item);
continue;
const parentList = [];
data.forEach((item) => {
const parent = obj[item.parent];
if (parent) {
// *
parent.children = parent.children || [];
parent.children.unshift(item);
} else {
let parent = obj[item.parentId];
if(obj[item.parentId]!==undefined){
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}else{}
parentList.push(item);
}
}
return arr;
});
return parentList;
},
formSubmit2(e) {
var that = this;
@ -539,8 +509,13 @@
})
// #ifdef APP-PLUS
let secret = that.ranStr(12)
let mySecret = {'username': obj.username, 'secret': secret}
that.$u.api.bindSecret({secret: secret}).then(res=>{
let mySecret = {
'username': obj.username,
'secret': secret
}
that.$u.api.bindSecret({
secret: secret
}).then(res => {
uni.setStorageSync('mySecret', JSON.stringify(mySecret))
}).catch(e => {})
// #endif
@ -548,8 +523,7 @@
uni.reLaunch({
url: '/pages/home/home_'
})
}).catch(e => {
})
}).catch(e => {})
},
codeChange(text) {
this.codeTips = text;
@ -589,6 +563,68 @@
that.agreement = true;
}
},
appLogin() {
var that = this;
// App
uni.showLoading({
title: '自动登录中...',
mask: true
})
uni.getStorage({
key: 'mySecret',
success: function(res) {
let secret = res.data
if (secret) {
that.$u.api.loginSecret(JSON.parse(secret)).then(res1 => {
that.$u.vuex('vuex_token', res1.access)
that.$u.api.getUserInfo().then(res2 => {
console.log(res2);
if (res2.avatar) {
res2.avatar = this.vuex_host + res2.avatar
}
that.$u.vuex('vuex_user', res2)
let perms = [];
for (let key in res2.perms) {
perms.push(key);
}
that.$u.vuex('vuex_perm', perms)
//
})
that.$u.api.hrmUserInfo().then(res3 => {
that.$u.vuex('vuex_employee', res3)
if (res3.type === 'employee') {
uni.reLaunch({
url: '/pages/home/home_'
})
} else {
//
if (res3.id_number == '' || res3.photo == '' || res3
.id_number == null || res3.photo == null) {
//
uni.reLaunch({
url: '/pages/my/myInfoChange'
})
} else {
//
if (res3.type === 'remployee') {
uni.reLaunch({
url: '/pages/home/home_'
})
} else {
uni.reLaunch({
url: '/pages/workSpace/workSpace'
})
}
}
}
})
that.getUserRange()
})
}
}
});
}
}
}
</script>
@ -833,22 +869,28 @@
padding-left: 12rpx;
padding-right: 12rpx;
}
.registerWrap {
display: flex;
margin-top: 40upx;
}
.visitorReg {
margin-right: 50upx;
}
.visitorReg,.driverRegWrap{
.visitorReg,
.driverRegWrap {
display: flex;
text-align: center;
flex-direction: column;
}
.visitorReg>image {
width: 90upx;
height: 90upx;
}
.driverReg {
width: 80upx;
height: 80upx;
@ -856,6 +898,7 @@
background: #0075ff;
margin-bottom: 8upx;
}
.driverReg>image {
width: 46upx;
height: 46upx;

View File

@ -107,19 +107,12 @@
if (!that.checkedParams(obj)) return;
that.$u.api.visitorRegister(obj).then(res => {
uni.hideLoading();
if(res.err_msg){
this.$u.toast(res.err_msg);
}else{
uni.reLaunch({
url: '/pages/login/login_'
})
}
}).catch(e => {
console.log(e)
uni.showToast({
title: e.err_msg,
icon: 'none'
title:"注册成功,请重新登录",
icon: "none"
})
uni.reLaunch({
url: '/pages/login/login_?autoLoading=no'
})
})

View File

@ -46,9 +46,15 @@
<text class="title-text">我的打卡记录</text>
<uni-icons size="13" color="#b9b9b9" class="right-icon" type="right"></uni-icons>
</view>
<view class="enter-item">
<image style="width: 34rpx;height: 30rpx;" class="left-icon" src="../../static/my/wodeziliao.png"
mode=""></image>
<text class="title-text">我的访客库</text>
<uni-icons size="13" color="#b9b9b9" class="right-icon" type="right"></uni-icons>
</view>
</view>
<view class="sign-out">
<button type="default" @click="signoutFn" class="sign-out-btn">退出</button>
<button type="default" @click="signoutFn" class="sign-out-btn">退出账号</button>
</view>
</view>
@ -175,7 +181,7 @@
// error
}
uni.reLaunch({
url:'/pages/login/login_'
url:'/pages/login/login_?autoLoading=no'
})
})
}

View File

@ -10,7 +10,7 @@
<view class="item item_bottom_border">
<view class="title">手机号</view>
<view class="content">
<input type="text" v-model="userInfo.phone" maxlength="20" placeholder="请输入" />
<input type="text" v-model="userInfo.phone" maxlength="20" placeholder="请输入" disabled/>
</view>
</view>
<view class="item item_bottom_border">
@ -112,12 +112,21 @@
if (!that.paramsCheck()) {
return;
} else {
this.$u.api.hrmUpdateInfo(this.userInfo).then(res=>{
debugger;
console.log(res)
uni.navigateTo({
url: '/pages/my/my'
uni.showLoading({
title: '保存中...',
mask: true
})
this.$u.api.hrmUpdateInfo(this.userInfo).then(res=>{
uni.hideLoading()
uni.showToast({
title: '保存成功',
icon: 'none'
})
uni.reLaunch({
url: '/pages/workSpace/workSpace'
})
}).catch(e=>{
uni.hideLoading()
})
}
},

View File

@ -249,7 +249,7 @@
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
// this.getUserRange();
this.getHeader();
},
methods: {

View File

@ -241,7 +241,7 @@
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
// this.getUserRange();
this.getHeader();
},
methods: {

View File

@ -244,7 +244,7 @@
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
// this.getUserRange();
this.getHeader();
},
methods: {

View File

@ -351,7 +351,7 @@
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
// this.getUserRange();
this.getHeader();
},
methods: {

View File

@ -63,7 +63,7 @@
</view>
<view class="form-right">
<ba-tree-picker ref="dcoordinator_Picker" :multiple='false' @select-change="select_coordinator_Change" title="选择接待人"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
:localdata="vuex_userRange2" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<view @click="showDcoordinatorPicker" style="position: relative;display: flex;">
<text type="text" >{{receptionist_name}}</text>
<uni-icons style="position: absolute; right: 0;" type="arrowright" color="#999999"/>
@ -122,7 +122,7 @@
return {
formData: {
name: '', //访
purpose: 50, //访
purpose: 10, //访
receptionist: '', //
visit_time: '', //访
leave_time: '', //

View File

@ -56,13 +56,13 @@
<view class="item item_bottom_border">
<view class="title">是否报备</view>
<view class="content">
<switch name="is_main" v-model="formData.is_reported" />
<u-switch v-model="formData.is_reported"></u-switch>
</view>
</view>
<view class="item item_bottom_border">
<view class="title">是否主访客</view>
<view class="content">
<switch name="is_main" v-model="formData.is_main" />
<u-switch v-model="formData.is_main"></u-switch>
</view>
</view>
<view class="item item_bottom_border" style="height: fit-content;">

View File

@ -107,8 +107,8 @@
},
onShow() {
// debugger;
console.log('vuex_userRange'+this.vuex_perm);
console.log(this.vuex_user);
console.log(this.vuex_perm);
this.limitedRpj = this.vuex_perm.includes('rpj.create')||this.vuex_perm.includes('superuser');
this.limitedOperation = this.vuex_perm.includes('operation.create')||this.vuex_perm.includes('superuser');
},

View File

@ -12,7 +12,7 @@ try{
}
// 需要永久存储且下次APP启动需要取出的在state中的变量名
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_appid','vuex_perm','vuex_employee','vuex_userRange'];
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_appid', 'vuex_perm', 'vuex_employee'];
// 保存变量到本地存储中
const saveLifeData = function(key, value){
@ -32,9 +32,11 @@ const store = new Vuex.Store({
// 如果上面从本地获取的lifeData对象下有对应的属性就赋值给state中对应的变量
// 加上vuex_前缀是防止变量名冲突也让人一目了然
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
vuex_employee: lifeData.vuex_employee ? lifeData.vuex_employee : {},
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_userRange: lifeData.vuex_userRange ? lifeData.vuex_userRange : {},
vuex_userRange2: lifeData.vuex_userRange2 ? lifeData.vuex_userRange2 : {},
vuex_appid: 'wxf7d6140f507466be',
vuex_login: 'http://qyjy.ctc-zc.com/h5/',
vuex_version: '1.00.08',