role调整

This commit is contained in:
ChuShiZ 2024-08-27 21:45:25 +08:00
parent bfd4661135
commit d713c4fba2
12 changed files with 166 additions and 130 deletions

View File

@ -37,7 +37,7 @@
<view class="orderCardFooter">
<text class="orderCardDateTime">{{ orderData.rescueTime || "" }}</text>
<view class="orderCardBtnGroup">
<template v-if="role == 'ddzx' && orderData.rescueStatus <= 2">
<template v-if="hasRole('ddzx') && orderData.rescueStatus <= 2">
<view @click.stop="deleteId" class="orderCardBtnGroupItem" style="background-color: #fff;color: #317DFA">
删除订单</view>
<view @click.stop="getzhipai" class="orderCardBtnGroupItem">指派司机</view>
@ -56,6 +56,7 @@
<script>
import request from '../../utils/request';
import {hasRole} from "@/utils/auth";
export default {
props: {
orderData: {
@ -87,19 +88,16 @@
}
}
},
mounted() {
this.role = uni.getStorageSync('role')
},
data() {
return {
columns: [],
id: '',
show: false,
showDelete: false,
role: []
}
},
methods: {
hasRole,
getRescueTypeStr(){
if(this.orderData.rescueTypeStr){
return this.orderData.rescueTypeStr

View File

@ -1,13 +1,13 @@
<template>
<view class="bottoms">
<view class="box" :class="{active: aindex == 1}" @click="getgogo(1)" v-if="role == 'user' ">
<view class="box" :class="{active: aindex == 1}" @click="getgogo(1)" v-if="identity == 'user' ">
<view class="imgs">
<image mode="aspectFit" src="@/static/icons/tabbar/home.png" v-show="aindex != 1"></image>
<image mode="aspectFit" src="@/static/icons/tabbar/home-checked.png" v-show="aindex == 1"></image>
</view>
<view class="">首页</view>
</view>
<view class="box" :class="{active: aindex == 8}" @click="getgogo(8)" v-if="role == 'police' ">
<view class="box" :class="{active: aindex == 8}" @click="getgogo(8)" v-if="identity == 'police' ">
<view class="imgs">
<image mode="aspectFit" src="@/static/icons/tabbar/home.png" v-show="aindex != 8"></image>
<image mode="aspectFit" src="@/static/icons/tabbar/home-checked.png" v-show="aindex == 8"></image>
@ -60,7 +60,7 @@
msgSocket: this.$msgSocket,
aindex: 1,
msgNum: null,
role: 'user',
identity: 'user',
nowPageInterval: null,
arr: [{
text: '首页'
@ -93,7 +93,7 @@
// #ifdef APP || H5
console.log('tabbag', uni.getStorageSync('identity'));
this.role = uni.getStorageSync('identity');
this.identity = uni.getStorageSync('identity');
// #endif
if (!this.nowPageInterval) {
this.nowPageInterval = setInterval(() => {
@ -107,7 +107,7 @@
}, 2000);
this.aindex = this.msg
if (this.role == 'police' && this.msg == '1') {
if (this.identity == 'police' && this.msg == '1') {
this.aindex = '8'
}
this.getbottom()

View File

@ -231,6 +231,12 @@
console.log('123');
}, 10000);
},
beforeDestroy() {
if (this.timerId) {
clearInterval(this.timerId)
this.timerId = null
}
},
onHide() {
this.destroyTimer();
},
@ -321,6 +327,21 @@
arrcopy.push(driverPosition)
}
this.marker = arrcopy;
if (this.detailsinfo.detail && this.detailsinfo.detail.length > 0) {
function timestampToDateString(timestamp) {
const date = new Date(timestamp); // Date
const year = date.getFullYear(); //
const month = (date.getMonth() + 1).toString().padStart(2, '0'); //
const day = date.getDate().toString().padStart(2, '0'); //
const hours = date.getHours().toString().padStart(2, '0');
const mm = date.getMinutes().toString().padStart(2, '0');
const ss = date.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${mm}:${ss}`; //
}
this.detailsinfo.detail.forEach(item => {
item.createTime = timestampToDateString(item.createTime)
})
}
// console.log(this.marker, "marker")
})
},

View File

@ -318,7 +318,7 @@
userJson.userId = res.data.user.id
uni.setStorageSync('userInfo', res.data.user)
uni.setStorageSync('userId', res.data.user.id)
uni.setStorageSync('role', res.data.roles)
uni.setStorageSync('role', res.data.role)
this.goselect()
})
}
@ -330,8 +330,7 @@
let userJson = {}
userJson.userId = res.data.user.id
uni.setStorageSync('userInfo', res.data.user)
let roles = res.data.role.map(item=>{item.name})
uni.setStorageSync('role', roles)
uni.setStorageSync('role', res.data.role)
uni.setStorageSync('userId', res.data.user.id)
this.goselect()
})

View File

@ -34,7 +34,7 @@
</view>
<view class="ail">
<view class="back-car" v-if="role === 'user'">
<view class="back-car" v-if="identity === 'user'">
<image style="width: 45px;height: 35px" src="../../static/my/位图@2x.png" mode=""></image>
<view class="back-car-logo">
<image style="width: 90px;height: 22px" src="../../static/my/一键还车@2x.png" mode=""></image>
@ -43,7 +43,7 @@
<view class="back-button" @click="goHuanche">去还车</view>
</view>
<view class="bai-box" v-if="role === 'user'">
<view class="bai-box" v-if="identity === 'user'">
<view class="b-title">我的订单</view>
<image class="sanjiao" src="../../static/my/sanjiao.png"/>
<view class="sige">
@ -75,9 +75,9 @@
</view>
</view>
<view v-if="role !== 'user'" style="margin-top: 80px"> <!-- --> </view>
<view v-if="identity !== 'user'" style="margin-top: 80px"> <!-- --> </view>
<view class="dai-box">
<view class="vinput" @click="goAssess()" v-if="role === 'user'">
<view class="vinput" @click="goAssess()" v-if="identity === 'user'">
<view class="dix">
<view class="d-img">
<image src="../../static/my/编组 18@2x.png" mode=""></image>
@ -88,7 +88,7 @@
<uni-icons type="right" size="20" color="#000000"></uni-icons>
</view>
</view>
<view class="vinput" @click="gogogog()" v-if="role === 'user'">
<view class="vinput" @click="gogogog()" v-if="identity === 'user'">
<view class="dix">
<view class="d-img">
<image src="../../static/my/编组 19@2x.png" mode=""></image>
@ -110,7 +110,7 @@
<uni-icons type="right" size="20" color="#000000"></uni-icons>
</view>
</view>
<view class="vinput" @click="gosj()" v-if="role === 'user'">
<view class="vinput" @click="gosj()" v-if="identity === 'user'">
<view class="dix">
<view class="d-img">
<image src="../../static/my/编组 20@2x.png" mode=""></image>
@ -166,7 +166,7 @@
export default {
data() {
return {
role: 'user',
identity: 'user',
show: false,
title: '修改昵称',
indicatorDots: false,
@ -189,7 +189,7 @@
}
},
mounted() {
this.role = uni.getStorageSync('identity');
this.identity = uni.getStorageSync('identity');
},
onShow() {
console.log('what?', uni.getStorageSync('userInfo'));
@ -380,7 +380,7 @@
})
},
gocarlist() {
if(this.role === 'user'){
if(this.identity === 'user'){
uni.navigateTo({
url: '/pages/my/carlist'
})

View File

@ -42,7 +42,6 @@
sx1:true,
sx2:false,
isAppointment:'',
role:'',
}
},
components:{
@ -50,7 +49,6 @@
},
onLoad(option) {
this.isAppointment = option.isAppointment
this.role = uni.getStorageSync('role')
},
methods:{
getback(){

View File

@ -123,7 +123,6 @@
],
arrbox: [],
role: ''
}
},
components: {
@ -132,7 +131,6 @@
OrderCardVue
},
onLoad(option) {
this.role = uni.getStorageSync('role')
this.gindex = option.id
this.getlist()
},

View File

@ -83,12 +83,21 @@
</view>
</view>
</view>
<view class="xinput">
<view class="text1"> <text class="hong1">*</text> 路段选择</view>
<view class="xz" style="flex-wrap: wrap;row-gap: 20rpx">
<view :class="{'xlan': seletedRoad.includes(item.id)}" class="kuang" v-for="(item,index) in roadOptions" :key="index"
@click="chooseRoad(index,item.id)">
<view class="">{{item.label}}</view>
</view>
</view>
</view>
<view class="xinput">
<view class="text1"> <text class="hong1">*</text> 车辆类型</view>
<view class="xz">
<view :class="{'xlan':carzhi == index}" class="kuang" v-for="(item,index) in car" :key="index"
@click="getzhi(index,item.dictValue)">
<view class="">{{item.dictLabel}}</view>
@click="getzhi(index,item.value)">
<view class="">{{item.label}}</view>
</view>
</view>
</view>
@ -96,8 +105,8 @@
<view class="text1"> <text class="hong1">*</text> 收费类型</view>
<view class="xz">
<view :class="{'xlan':maneizhi == index}" class="kuang" v-for="(item,index) in manei" :key="index"
@click="getzhi2(index,item.dictValue)">
<view class="">{{item.dictLabel}}</view>
@click="getzhi2(index,item.value)">
<view class="">{{item.label}}</view>
</view>
</view>
</view>
@ -133,7 +142,9 @@
<view class="">
<u-picker :show="shows" :columns="columns" @confirm="confirmm" @cancel="cancelm" keyName="dictValue"></u-picker>
</view>
<view class="">
<u-picker :show="roadVisible" :columns="roadOptions" @confirm="roadConfirm" @cancel="roadCancel" keyName="dictValue"></u-picker>
</view>
<tabBar msg="1"></tabBar>
</view>
</template>
@ -144,6 +155,7 @@
import request from '../../utils/request'
import config from '@/config'
import upload from '@/utils/upload.js'
import {hasRole} from "@/utils/auth";
export default {
data() {
return {
@ -151,13 +163,10 @@
value1: Number(new Date()),
rescueLongitude: '',
rescueLatitude: '',
rescueLongitude: '',
rescueLatitude: '',
connectionName: '',
connectionPhone: '',
rescuePosition: '',
rescueDetail: '',
rescueSceneImage: '',
rescueType: '',
baseUrl: this.$baseUrl,
carType: 1,
@ -201,13 +210,15 @@
city1: '',
area1: '',
four1: '',
role: '',
shows: false,
kcname: '',
columns: [
],
title: '救援'
title: '救援',
roadOptions: [],
seletedRoad: [],
roadVisible: false
}
},
onLoad(option) {
@ -233,9 +244,8 @@
}
this.newtwo()
this.isAppointment = option.isAppointment
this.role = uni.getStorageSync('role')
if (this.role[0] == 'jjdd') {
if (hasRole('jjdd')) {
this.kcdd()
}
},
@ -245,50 +255,44 @@
},
methods: {
newtwo() {
request({
url: '/system/dict-data/page?pageNo=1&pageSize=100&dictType=fee_type',
method: 'get'
}).then(res => {
console.log('res: ', res);
if (res.data && res.data.list && res.data.list.length > 0) {
this.manei = res.data.list.map(m => {
return {
dictValue: m.value,
dictLabel: m.label
}
})
}
})
// request({
// url: '/system/dict/data/type/fee_type',
// method: 'get',
// }).then((res) => {
// this.manei = res.data
// console.log(res);
// url: '/system/dict-data/page?pageNo=1&pageSize=100&dictType=fee_type',
// method: 'get'
// }).then(res => {
// console.log('res: ', res);
// if (res.data && res.data.list && res.data.list.length > 0) {
// this.manei = res.data.list.map(m => {
// return {
// dictValue: m.value,
// dictLabel: m.label
// }
// })
// }
// })
request({
url: '/system/dict-data/page?pageNo=1&pageSize=100&dictType=rescue_car_type',
url: '/rescue/dict/data/type/fee_type',
method: 'get',
}).then((res) => {
this.manei = res.data
console.log(res);
})
request({
url: '/rescue/dict/data/type/rescue_car_type',
method: 'get',
}).then((res) => {
this.car = res.data
console.log(res);
})
request({
url: '/rescue/dict/data/type/kcRescueRoad-1',
method: 'get'
}).then(res => {
console.log('res: ', res);
if (res.data && res.data.list && res.data.list.length > 0) {
this.car = res.data.list.map(m => {
return {
dictValue: m.value,
dictLabel: m.label
}
})
}
this.roadOptions = res.data
console.log(res);
})
// request({
// url: '/system/dict/data/type/rescue_car_type',
// method: 'get',
// }).then((res) => {
// this.car = res.data
// console.log(res);
// })
},
kcdd() {
request({
@ -308,6 +312,13 @@
cancelm() {
this.shows = false
},
roadConfirm(e) {
console.log('e: ',e);
this.roadVisible = false
},
roadCancel() {
this.roadVisible = false
},
confirms(e) {
console.log(e);
@ -330,11 +341,8 @@
postadd() {
this.rescueSceneImage = this.imageList.join(",")
if (typeof this.rescueTime === "number") {
console.log("是数字类型");
} else {
this.rescueTime = ''
console.log("不是数字类型");
}
if (this.isAppointment == 'undefined') {
this.isAppointment = 0
@ -342,27 +350,40 @@
if (this.rescueLongitude == "" || this.rescueLatitude == "") {
uni.showToast({
title: '起点位置不能为空',
icon: 'error'
icon: 'none'
})
return
}
// if (this.connectionName == "") {
// uni.showToast({
// title: '',
// icon: 'error'
// })
// return
// }
// if (this.connectionPhone == "") {
// uni.showToast({
// title: '',
// icon: 'error'
// })
// return
// }
if (this.connectionName == "") {
uni.showToast({
title: '联系人不能为空',
icon: 'none'
})
return
}
if (this.connectionPhone == "") {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
})
return
}
if (!this.licenseNum) {
uni.showToast({
title: '车牌号不能为空',
icon: 'none'
})
return
}
if (this.seletedRoad.length === 0) {
uni.showToast({
title: '未选择路段',
icon: 'none'
})
return
}
console.log('this.seletedRoad: ',this.seletedRoad);
let data = {
rescueLongitude: this.rescueLongitude,
@ -374,6 +395,7 @@
rescuePosition: this.rescuePosition,
destinationInfo: this.destinationInfo,
licenseNum: this.licenseNum,
roadIds: this.seletedRoad,
isAppointment: this.isAppointment,
rescueTime: this.rescueTime,
rescueDetail: this.rescueDetail,
@ -549,6 +571,19 @@
this.feeType = id
this.maneizhi = index
},
/**
* 路段选择事件
* @param index
* @param id
*/
chooseRoad(index, id) {
if (this.seletedRoad.includes(id)) {
const findIndex = this.seletedRoad.indexOf(id)
this.seletedRoad.splice(findIndex, 1)
} else {
this.seletedRoad.push(id)
}
}
}

View File

@ -8,7 +8,7 @@
</view>
<view class="box">
<template v-for="(item, index) in busiTypeList">
<view v-if="index !== 4 || role[0] == 'jjdd'" :key="index" class="xz-box" :class="{ checked: busiType === index + 1 }" @click="getsx(index + 1)">
<view v-if="index !== 4 || hasRole('jjdd')" :key="index" class="xz-box" :class="{ checked: busiType === index + 1 }" @click="getsx(index + 1)">
<image class="xz-box-icon" :src="item.icon" mode="aspectFit"></image>
<view class="box-wenzi">{{item.label}}</view>
<view class="checkedFlag">
@ -17,29 +17,7 @@
<uni-icons class="checkedFlagIcon" type="checkmarkempty" size="22" color="#fff"></uni-icons>
</view>
</template>
<!-- <view class="xz-box" :class="{ checked: busiType === 1 }" id="y1" @click="getsx(1)">
<image class="xz-box-icon" src="@/static/icons/order/tuoche.png" mode="aspectFit"></image>
<view class="box-wenzi">拖车</view>
</view> -->
<!-- <view class="xz-box" :class="{ checked: busiType === 2 }" id="y2" @click="getsx(2)">
<image class="xz-box-icon" src="@/static/icons/order/songyou.png" mode="aspectFit"></image>
<view class="box-wenzi">送油</view>
</view>
<view class="xz-box" :class="{ checked: busiType === 3 }" id="y3" @click="getsx(3)">
<image class="xz-box-icon" src="@/static/icons/order/dadian.png" mode="aspectFit"></image>
<view class="box-wenzi">搭电</view>
</view>
<view class="xz-box" :class="{ checked: busiType === 4 }" id="y4" @click="getsx(4)">
<image class="xz-box-icon" src="@/static/icons/order/huantai.png" mode="aspectFit"></image>
<view class="box-wenzi">换胎</view>
</view>
<view class="xz-box" :class="{ checked: busiType === 5 }" v-if="role[0] == 'jjdd' " id="y5" @click="getsx(5)">
<view class="box-wenzi">扣车</view>
</view> -->
</view>
<!-- <view class="anniu" @click="goindex()">
<view class="">立即进入</view>
</view> -->
<view class="submitBtn" @click="hanleOkBusiType">下一步</view>
</view>
<tabBar msg="1"></tabBar>
@ -50,6 +28,7 @@
import request from '../../utils/request';
import tabBar from '../../components/tabBar/tabBar.vue'
import VNavigationBarVue from '../../components/VNavigationBar.vue';
import {hasRole} from "@/utils/auth";
export default {
data() {
@ -57,7 +36,6 @@
sx1: true,
sx2: false,
isAppointment: '',
role: '',
busiType: '',
busiTypeList: [{
label: '拖车',
@ -88,9 +66,9 @@
},
onLoad(option) {
this.isAppointment = option.isAppointment
this.role = uni.getStorageSync('role')
},
methods: {
hasRole,
getback() {
uni.navigateBack({
delta: 1,

View File

@ -105,7 +105,7 @@
<uni-icons class="checkedFlagIcon" type="checkmarkempty" size="22" color="#fff"></uni-icons>
</view>
</template>
<!-- <view class="xz-box" v-if="role[0] == 'jjdd' " id="y5" @click="getsx(5)">
<!-- <view class="xz-box" v-if="hasRole('jjdd')" id="y5" @click="getsx(5)">
<view class="box-wenzi">扣车</view>
</view> -->
</view>
@ -183,7 +183,7 @@
<view class="zhtai">
<view class="">{{item.rescueStatusStr}}</view>
</view>
<view class="dianhua" v-if="role == 'ddzx' && item.rescueStatus <= 2 ">
<view class="dianhua" v-if="hasRole('ddzx') && item.rescueStatus <= 2 ">
<view>
<view @click="getzhipai(item.id)" style="margin-bottom: 20px;" class="">指派司机</view>
<view class="dianhuad" @click="deleteId(item.id)" v-if="item.rescueStatusStr == '待救援' ">
@ -302,7 +302,6 @@
dzfNum: 0,
jyzNum: 0,
ywcNum: 0,
role: [],
currentTime: '',
cityName: '济南',
positionInfo: '泸州',
@ -344,7 +343,6 @@
}
},
onLoad() {
this.role = uni.getStorageSync('role')
this.$startMsgSocket(uni.getStorageSync('userId'))
this.register()
this.jyPushStart()

View File

@ -133,7 +133,7 @@
<view class="orderCardFooter">
<text class="orderCardDateTime">{{ item.rescueTime || "" }}</text>
<view class="orderCardBtnGroup">
<view v-if="role[0] == 'ddzx' && item.rescueStatus <= 2 " @click.stop="getzhipai(item.id)"
<view v-if="hasRole('ddzx') && item.rescueStatus <= 2 " @click.stop="getzhipai(item.id)"
class="orderCardBtnGroupItem">指派司机</view>
<view v-if="item.rescueStatus > 2" @click.stop="gettel(item.driverPhoneNum)"
class="orderCardBtnGroupItem">
@ -145,7 +145,7 @@
<view class="">{{item.rescueStatusStr}}</view>
</view>
<view class="dianhua" v-if="role[0] == 'ddzx' && item.rescueStatus <= 2 " @click="getzhipai(item.id)">
<view class="dianhua" v-if="hasRole('ddzx') && item.rescueStatus <= 2 " @click="getzhipai(item.id)">
<view class="">指派司机</view>
</view>
@ -161,7 +161,7 @@
</view>
</view>
<!-- 一键救援 -->
<!-- <view class="kou" v-if="role[0] == 'jjdd' " @click="getsx()">
<!-- <view class="kou" v-if="hasRole('jjdd')" @click="getsx()">
<image src="../../static/kou.png" mode=""></image>
</view> -->
<view style="width: 100%; height: 80px; "></view>
@ -179,6 +179,7 @@
import {
getWXStatusHeight
} from '@/utils/utils.js'
import {hasRole} from "@/utils/auth";
export default {
data() {
return {
@ -198,7 +199,6 @@
dzfNum: 0,
jyzNum: 0,
ywcNum: 0,
role: [],
currentTime: '',
cityName: '济南',
positionInfo: '泸州',
@ -221,7 +221,6 @@
}
},
onLoad() {
this.role = uni.getStorageSync('role')
// #ifdef MP
const {
barHeight,
@ -258,6 +257,7 @@
tabBar,
},
methods: {
hasRole,
gosg() {
uni.navigateTo({
url: '/pages/rescue/PoliceOder'

View File

@ -18,3 +18,14 @@ export function setTenantId(TenantId) {
export function getTenantId(){
return uni.getStorageSync(TenantIdKey)
}
export function hasRole(roleCode) {
const roleList = uni.getStorageSync('role')
if (roleList && roleList.length > 0) {
const roleInfo = roleList.find(f => f.code === roleCode)
if (roleInfo) {
return true
}
}
return false
}