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

View File

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

View File

@ -231,6 +231,12 @@
console.log('123'); console.log('123');
}, 10000); }, 10000);
}, },
beforeDestroy() {
if (this.timerId) {
clearInterval(this.timerId)
this.timerId = null
}
},
onHide() { onHide() {
this.destroyTimer(); this.destroyTimer();
}, },
@ -321,6 +327,21 @@
arrcopy.push(driverPosition) arrcopy.push(driverPosition)
} }
this.marker = arrcopy; 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") // console.log(this.marker, "marker")
}) })
}, },

View File

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

View File

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

View File

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

View File

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

View File

@ -83,12 +83,21 @@
</view> </view>
</view> </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="xinput">
<view class="text1"> <text class="hong1">*</text> 车辆类型</view> <view class="text1"> <text class="hong1">*</text> 车辆类型</view>
<view class="xz"> <view class="xz">
<view :class="{'xlan':carzhi == index}" class="kuang" v-for="(item,index) in car" :key="index" <view :class="{'xlan':carzhi == index}" class="kuang" v-for="(item,index) in car" :key="index"
@click="getzhi(index,item.dictValue)"> @click="getzhi(index,item.value)">
<view class="">{{item.dictLabel}}</view> <view class="">{{item.label}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -96,8 +105,8 @@
<view class="text1"> <text class="hong1">*</text> 收费类型</view> <view class="text1"> <text class="hong1">*</text> 收费类型</view>
<view class="xz"> <view class="xz">
<view :class="{'xlan':maneizhi == index}" class="kuang" v-for="(item,index) in manei" :key="index" <view :class="{'xlan':maneizhi == index}" class="kuang" v-for="(item,index) in manei" :key="index"
@click="getzhi2(index,item.dictValue)"> @click="getzhi2(index,item.value)">
<view class="">{{item.dictLabel}}</view> <view class="">{{item.label}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -133,7 +142,9 @@
<view class=""> <view class="">
<u-picker :show="shows" :columns="columns" @confirm="confirmm" @cancel="cancelm" keyName="dictValue"></u-picker> <u-picker :show="shows" :columns="columns" @confirm="confirmm" @cancel="cancelm" keyName="dictValue"></u-picker>
</view> </view>
<view class="">
<u-picker :show="roadVisible" :columns="roadOptions" @confirm="roadConfirm" @cancel="roadCancel" keyName="dictValue"></u-picker>
</view>
<tabBar msg="1"></tabBar> <tabBar msg="1"></tabBar>
</view> </view>
</template> </template>
@ -144,6 +155,7 @@
import request from '../../utils/request' import request from '../../utils/request'
import config from '@/config' import config from '@/config'
import upload from '@/utils/upload.js' import upload from '@/utils/upload.js'
import {hasRole} from "@/utils/auth";
export default { export default {
data() { data() {
return { return {
@ -151,13 +163,10 @@
value1: Number(new Date()), value1: Number(new Date()),
rescueLongitude: '', rescueLongitude: '',
rescueLatitude: '', rescueLatitude: '',
rescueLongitude: '',
rescueLatitude: '',
connectionName: '', connectionName: '',
connectionPhone: '', connectionPhone: '',
rescuePosition: '', rescuePosition: '',
rescueDetail: '', rescueDetail: '',
rescueSceneImage: '',
rescueType: '', rescueType: '',
baseUrl: this.$baseUrl, baseUrl: this.$baseUrl,
carType: 1, carType: 1,
@ -201,13 +210,15 @@
city1: '', city1: '',
area1: '', area1: '',
four1: '', four1: '',
role: '',
shows: false, shows: false,
kcname: '', kcname: '',
columns: [ columns: [
], ],
title: '救援' title: '救援',
roadOptions: [],
seletedRoad: [],
roadVisible: false
} }
}, },
onLoad(option) { onLoad(option) {
@ -233,9 +244,8 @@
} }
this.newtwo() this.newtwo()
this.isAppointment = option.isAppointment this.isAppointment = option.isAppointment
this.role = uni.getStorageSync('role')
if (this.role[0] == 'jjdd') { if (hasRole('jjdd')) {
this.kcdd() this.kcdd()
} }
}, },
@ -245,50 +255,44 @@
}, },
methods: { methods: {
newtwo() { 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({ // request({
// url: '/system/dict/data/type/fee_type', // url: '/system/dict-data/page?pageNo=1&pageSize=100&dictType=fee_type',
// method: 'get', // method: 'get'
// }).then(res => {
// }).then((res) => { // console.log('res: ', res);
// this.manei = res.data // if (res.data && res.data.list && res.data.list.length > 0) {
// console.log(res); // this.manei = res.data.list.map(m => {
// return {
// dictValue: m.value,
// dictLabel: m.label
// }
// })
// }
// }) // })
request({ 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' method: 'get'
}).then(res => { }).then(res => {
console.log('res: ', res); this.roadOptions = res.data
if (res.data && res.data.list && res.data.list.length > 0) { console.log(res);
this.car = res.data.list.map(m => {
return {
dictValue: m.value,
dictLabel: m.label
}
})
}
}) })
// request({
// url: '/system/dict/data/type/rescue_car_type',
// method: 'get',
// }).then((res) => {
// this.car = res.data
// console.log(res);
// })
}, },
kcdd() { kcdd() {
request({ request({
@ -308,6 +312,13 @@
cancelm() { cancelm() {
this.shows = false this.shows = false
}, },
roadConfirm(e) {
console.log('e: ',e);
this.roadVisible = false
},
roadCancel() {
this.roadVisible = false
},
confirms(e) { confirms(e) {
console.log(e); console.log(e);
@ -330,11 +341,8 @@
postadd() { postadd() {
this.rescueSceneImage = this.imageList.join(",") this.rescueSceneImage = this.imageList.join(",")
if (typeof this.rescueTime === "number") { if (typeof this.rescueTime === "number") {
console.log("是数字类型");
} else { } else {
this.rescueTime = '' this.rescueTime = ''
console.log("不是数字类型");
} }
if (this.isAppointment == 'undefined') { if (this.isAppointment == 'undefined') {
this.isAppointment = 0 this.isAppointment = 0
@ -342,27 +350,40 @@
if (this.rescueLongitude == "" || this.rescueLatitude == "") { if (this.rescueLongitude == "" || this.rescueLatitude == "") {
uni.showToast({ uni.showToast({
title: '起点位置不能为空', title: '起点位置不能为空',
icon: 'error' icon: 'none'
}) })
return return
} }
// if (this.connectionName == "") { if (this.connectionName == "") {
// uni.showToast({ uni.showToast({
// title: '', title: '联系人不能为空',
// icon: 'error' icon: 'none'
// }) })
return
// return }
// } if (this.connectionPhone == "") {
// if (this.connectionPhone == "") { uni.showToast({
// uni.showToast({ title: '手机号不能为空',
// title: '', icon: 'none'
// icon: 'error' })
// }) return
// 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 = { let data = {
rescueLongitude: this.rescueLongitude, rescueLongitude: this.rescueLongitude,
@ -374,6 +395,7 @@
rescuePosition: this.rescuePosition, rescuePosition: this.rescuePosition,
destinationInfo: this.destinationInfo, destinationInfo: this.destinationInfo,
licenseNum: this.licenseNum, licenseNum: this.licenseNum,
roadIds: this.seletedRoad,
isAppointment: this.isAppointment, isAppointment: this.isAppointment,
rescueTime: this.rescueTime, rescueTime: this.rescueTime,
rescueDetail: this.rescueDetail, rescueDetail: this.rescueDetail,
@ -549,6 +571,19 @@
this.feeType = id this.feeType = id
this.maneizhi = index 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>
<view class="box"> <view class="box">
<template v-for="(item, index) in busiTypeList"> <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> <image class="xz-box-icon" :src="item.icon" mode="aspectFit"></image>
<view class="box-wenzi">{{item.label}}</view> <view class="box-wenzi">{{item.label}}</view>
<view class="checkedFlag"> <view class="checkedFlag">
@ -17,29 +17,7 @@
<uni-icons class="checkedFlagIcon" type="checkmarkempty" size="22" color="#fff"></uni-icons> <uni-icons class="checkedFlagIcon" type="checkmarkempty" size="22" color="#fff"></uni-icons>
</view> </view>
</template> </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>
<!-- <view class="anniu" @click="goindex()">
<view class="">立即进入</view>
</view> -->
<view class="submitBtn" @click="hanleOkBusiType">下一步</view> <view class="submitBtn" @click="hanleOkBusiType">下一步</view>
</view> </view>
<tabBar msg="1"></tabBar> <tabBar msg="1"></tabBar>
@ -50,6 +28,7 @@
import request from '../../utils/request'; import request from '../../utils/request';
import tabBar from '../../components/tabBar/tabBar.vue' import tabBar from '../../components/tabBar/tabBar.vue'
import VNavigationBarVue from '../../components/VNavigationBar.vue'; import VNavigationBarVue from '../../components/VNavigationBar.vue';
import {hasRole} from "@/utils/auth";
export default { export default {
data() { data() {
@ -57,7 +36,6 @@
sx1: true, sx1: true,
sx2: false, sx2: false,
isAppointment: '', isAppointment: '',
role: '',
busiType: '', busiType: '',
busiTypeList: [{ busiTypeList: [{
label: '拖车', label: '拖车',
@ -88,9 +66,9 @@
}, },
onLoad(option) { onLoad(option) {
this.isAppointment = option.isAppointment this.isAppointment = option.isAppointment
this.role = uni.getStorageSync('role')
}, },
methods: { methods: {
hasRole,
getback() { getback() {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,

View File

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

View File

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

View File

@ -18,3 +18,14 @@ export function setTenantId(TenantId) {
export function getTenantId(){ export function getTenantId(){
return uni.getStorageSync(TenantIdKey) 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
}