Browse Source

领用,领用审核。备件维修,我的,权限判断

master
zhang_li 9 months ago
parent
commit
fc4ab23b4b
  1. 8
      api/location.js
  2. 2
      api/repairOrder.js
  3. 24
      api/sparePartsApplicationApprove.js
  4. 8
      api/sparePartsServiceWorkOrderList.js
  5. 21
      pages.json
  6. 8
      pages/deviceReport/myDeviceReport.vue
  7. 163
      pages/index.vue
  8. 12
      pages/login.vue
  9. 21
      pages/mine/index.vue
  10. 8
      pages/repairOrder/detail.vue
  11. 4
      pages/repairOrder/index.vue
  12. 2
      pages/repairOrder/myOrder.vue
  13. 98
      pages/sparePartsApplication/detail.vue
  14. 187
      pages/sparePartsApplication/mySparePartsApplication.vue
  15. 192
      pages/sparePartsApplicationApprove/index.vue
  16. 56
      pages/sparePartsServiceWorkOrderList/addForm.vue
  17. 169
      pages/sparePartsServiceWorkOrderList/mySparePartsService.vue
  18. 240
      store/modules/user.js
  19. 3
      utils/constant.js
  20. 2
      utils/storage.js

8
api/location.js

@ -0,0 +1,8 @@
import request from '@/utils/request'
// 获取库位
export function getLocation(number) {
return request({
url: '/eam/location/scanCodeByNumber?number='+number,
'method': 'GET',
})
}

2
api/repairOrder.js

@ -17,7 +17,7 @@ export function repairOrderUpdate(data) {
data data
}) })
} }
// 报修列表 // 工单列表
export function repairOrderPage(params) { export function repairOrderPage(params) {
return request({ return request({
url: '/eam/device-maintenance-main/getAppPage', url: '/eam/device-maintenance-main/getAppPage',

24
api/sparePartsApplicationApprove.js

@ -0,0 +1,24 @@
import request from '@/utils/request'
// 备件领用审批列表
export function sparePartsApplicationApprovePage(params) {
return request({
url: '/eam/item-apply-main/getAppApprovePage',
'method': 'GET',
params
})
}
// 通过申请
export function sparePartsApplicationAgree(id) {
return request({
url: '/eam/item-apply-main/agree?id='+id,
'method': 'GET'
})
}
// 驳回申请
export function sparePartsApplicationReject(id) {
return request({
url: '/eam/item-apply-main/disAgree?id='+id,
'method': 'GET'
})
}

8
api/sparePartsServiceWorkOrderList.js

@ -8,3 +8,11 @@ export function sparePartsServiceWorkOrderListCreate(data) {
data data
}) })
} }
// 备件维修列表
export function sparePartsServiceWorkOrderListPage(params) {
return request({
url: '/eam/item-maintenance/getAppPage',
'method': 'GET',
params
})
}

21
pages.json

@ -189,6 +189,13 @@
"navigationBarBackgroundColor": "#409eff", "navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
},{
"path": "pages/sparePartsApplication/mySparePartsApplication",
"style": {
"navigationBarTitleText": "我的领用",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{ },{
"path": "pages/sparePartsServiceWorkOrderList/addForm", "path": "pages/sparePartsServiceWorkOrderList/addForm",
"style": { "style": {
@ -196,6 +203,20 @@
"navigationBarBackgroundColor": "#409eff", "navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
},{
"path": "pages/sparePartsServiceWorkOrderList/mySparePartsService",
"style": {
"navigationBarTitleText": "我的备件维修",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplicationApprove/index",
"style": {
"navigationBarTitleText": "领用申请审批",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
}], }],
"tabBar": { "tabBar": {
"color": "#8f9bb3", "color": "#8f9bb3",

8
pages/deviceReport/myDeviceReport.vue

@ -4,15 +4,13 @@
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' <u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="我的报修"> title="我的报修">
</u-navbar> </u-navbar>
<!-- <Search @search='search' @screen='screen'/> -->
<view class="list"> <view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item,index)"> <view class="item" v-for="(item,index) in list" :key="index">
<view class="title"> <view class="title">
<view class="title-txt"> <view class="title-txt">
{{item.describes}} {{item.describes}}
</view> </view>
<view class="time"> <view class="time">
<!-- 2023-12-12 08:00:00 -->
{{`${$time.formatDate(item.createTime)}`}} {{`${$time.formatDate(item.createTime)}`}}
</view> </view>
</view> </view>
@ -33,10 +31,10 @@
<u-tag :text="item.result" bg-color='rgba(255,255,255,0)' color='#2ba471' <u-tag :text="item.result" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="primary" shape='circle' /> border-color='#2ba471' type="primary" shape='circle' />
</view> </view>
<view class="button"> <!-- <view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" <u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button> v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view> </view> -->
</view> </view>
</view> </view>

163
pages/index.vue

@ -42,69 +42,81 @@
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class="title">设备维护</view> <view class="" v-if=" $store.state.user.classType == 'DEVICE' || $store.state.user.classType == 'TECH' || !$store.state.user.classType">
<u-row gutter="16" style="padding:0px 20rpx ;"> <view class="title">设备维护</view>
<u-col span="3"> <u-row gutter="16" style="padding:0px 20rpx ;">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=DEVICE')"> <u-col span="3">
<image src="../static/images/icon4.svg" mode=""></image> <view class="icon-item" @click="open('/pages/deviceReport/index?type=DEVICE')">
<view>设备报修</view> <image src="../static/images/icon4.svg" mode=""></image>
</view> <view>设备报修</view>
</u-col> </view>
<u-col span="3"> </u-col>
<view class="icon-item" @click="open('/pages/repairOrder/index?type=DEVICE')"> <u-col span="3">
<image src="../static/images/icon5.svg" mode=""></image> <view class="icon-item" @click="open('/pages/repairOrder/index?type=DEVICE')">
<view>维修工单</view> <image src="../static/images/icon5.svg" mode=""></image>
</view> <view>维修工单</view>
</u-col> </view>
<u-col span="3"> </u-col>
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=DEVICE')"> <u-col span="3">
<image src="../static/images/icon3.svg" mode=""></image> <view class="icon-item" @click="open('/pages/overhaulOrder/index?type=DEVICE')">
<view>检修工单</view> <image src="../static/images/icon3.svg" mode=""></image>
</view> <view>检修工单</view>
</u-col> </view>
<u-col span="3"> </u-col>
<view class="icon-item" @click="open('/pages/spotCheckOrder/addForm?type=DEVICE')"> <u-col span="3">
<image src="../static/images/icon2.svg" mode=""></image> <view class="icon-item" @click="open('/pages/spotCheckOrder/addForm?type=DEVICE')">
<view>点检工单</view> <image src="../static/images/icon2.svg" mode=""></image>
</view> <view>点检工单</view>
</u-col> </view>
<u-col span="3"> </u-col>
<view class="icon-item" @click="open('/pages/upkeepOrder/index?type=DEVICE')"> <u-col span="3">
<image src="../static/images/icon1.svg" mode=""></image> <view class="icon-item" @click="open('/pages/upkeepOrder/index?type=DEVICE')">
<view>保养工单</view> <image src="../static/images/icon1.svg" mode=""></image>
</view> <view>保养工单</view>
</u-col> </view>
</u-row> </u-col>
<view class="title">模具维护</view> </u-row>
</view>
<view class="" v-if="$store.state.user.classType == 'MOLD' ">
<view class="title">模具维护</view>
<u-row gutter="16">
<u-col span="3">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=MOLD')">
<image src="../static/images/icon4.svg" mode=""></image>
<view>设备报修</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/repairOrder/index?type=MOLD')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=MOLD')">
<image src="../static/images/icon2.svg" mode=""></image>
<view>检修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/maintenWorkOrderList/index')">
<image src="../static/images/icon1.svg" mode=""></image>
<view>保养工单</view>
</view>
</u-col>
</u-row>
</view>
<view class="title">备件管理</view>
<u-row gutter="16"> <u-row gutter="16">
<u-col span="3"> <u-col span="3" v-if=" $store.state.user.role == 'all_approve' || $store.state.user.role == 'normal_approve'">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=MOLD')"> <view class="icon-item" @click="open('/pages/sparePartsApplicationApprove/index')">
<image src="../static/images/icon4.svg" mode=""></image> <image src="../static/images/icon6.png" mode=""></image>
<view>设备报修</view> <view>领用申请审批</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/repairOrder/index?type=MOLD')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=MOLD')">
<image src="../static/images/icon2.svg" mode=""></image>
<view>检修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/maintenWorkOrderList/index')">
<image src="../static/images/icon1.svg" mode=""></image>
<view>保养工单</view>
</view> </view>
</u-col> </u-col>
</u-row> <u-col span="3" v-else>
<view class="title">备件管理</view>
<u-row gutter="16">
<u-col span="3">
<view class="icon-item" @click="open('/pages/sparePartsApplication/index')"> <view class="icon-item" @click="open('/pages/sparePartsApplication/index')">
<image src="../static/images/icon6.png" mode=""></image> <image src="../static/images/icon6.png" mode=""></image>
<view>领用申请</view> <view>领用申请</view>
@ -130,14 +142,16 @@
getCounts, getCounts,
getToDoCountsByUser getToDoCountsByUser
} from '@/api/index' } from '@/api/index'
import { getAccessToken } from '@/utils/auth' import {
getAccessToken
} from '@/utils/auth'
export default { export default {
data() { data() {
return { return {
bgOpacity: 0, bgOpacity: 0,
counts:'', counts: '',
counts1:'' counts1: '',
} }
}, },
@ -145,38 +159,23 @@
open(url) { open(url) {
this.$tab.navigateTo(url) this.$tab.navigateTo(url)
}, },
getInfo() {
getInfo().then(res => {
console.log((res))
uni.setStorageSync('user', res.data)
})
},
getPermissionInfo() {
this.$store.dispatch('GetPermissionInfo').then(res => {
})
},
getCounts() { getCounts() {
getCounts().then(res => { getCounts().then(res => {
console.log((res))
this.counts = res.data this.counts = res.data
}) })
}, },
getToDoCountsByUser() { getToDoCountsByUser() {
getToDoCountsByUser().then(res => { getToDoCountsByUser().then(res => {
console.log((res))
this.counts1 = res.data this.counts1 = res.data
}) })
}, },
}, },
onLoad: function() { onLoad: async function() {
if (getAccessToken()) { if (getAccessToken()) {
this.getInfo() this.getCounts()
this.getPermissionInfo() this.getToDoCountsByUser()
this.getCounts()
this.getToDoCountsByUser()
} }
console.log( this.$store.state)
}, },
onPageScroll(e) { onPageScroll(e) {
if (e.scrollTop > 0) { if (e.scrollTop > 0) {

12
pages/login.vue

@ -90,15 +90,19 @@
async pwdLogin(captchaParams) { async pwdLogin(captchaParams) {
this.$modal.loading("登录中,请耐心等待...") this.$modal.loading("登录中,请耐心等待...")
// //
this.$store.dispatch('Login', this.loginForm).then(() => { this.$store.dispatch('Login', this.loginForm).then(async () => {
this.$modal.closeLoading() this.$modal.closeLoading()
this.$tab.reLaunch('/pages/index') await this.loginSuccess()
// this.$tab.reLaunch('/pages/index')
}) })
}, },
// //
loginSuccess(result) { async loginSuccess(result) {
// //
this.$store.dispatch('GetInfo').then(res => { await this.$store.dispatch('GetPermissionInfo').then(res => {
// this.$tab.reLaunch('/pages/index')
})
await this.$store.dispatch('GetInfo').then(res => {
this.$tab.reLaunch('/pages/index') this.$tab.reLaunch('/pages/index')
}) })
} }

21
pages/mine/index.vue

@ -45,11 +45,15 @@
<image src="../../static/images/banner/icon4.png" mode="widthFix"></image> <image src="../../static/images/banner/icon4.png" mode="widthFix"></image>
<text class="text">巡检点检</text> <text class="text">巡检点检</text>
</view> </view>
<view class="action-item action-item1" @click="handleBuilding"> <view class="action-item action-item1" @click="handleSparePartsApplicationApprove" v-if=" $store.state.user.role == 'all_approve' || $store.state.user.role == 'normal_approve'">
<image src="../../static/images/banner/icon5.png" mode="widthFix"></image>
<text class="text">领用审批</text>
</view>
<view class="action-item action-item1" @click="handleSparePartsApplication" v-else>
<image src="../../static/images/banner/icon5.png" mode="widthFix"></image> <image src="../../static/images/banner/icon5.png" mode="widthFix"></image>
<text class="text">我的领用</text> <text class="text">我的领用</text>
</view> </view>
<view class="action-item action-item1" @click="handleBuilding"> <view class="action-item action-item1" @click="handleSparePartsService">
<image src="../../static/images/banner/icon6.png" mode="widthFix"></image> <image src="../../static/images/banner/icon6.png" mode="widthFix"></image>
<text class="text">备件维修</text> <text class="text">备件维修</text>
</view> </view>
@ -68,12 +72,12 @@
<view style="margin-left: 10rpx;">版本更新</view> <view style="margin-left: 10rpx;">版本更新</view>
</view> </view>
</view> --> </view> -->
<view class="list-cell list-cell-arrow" @click="handleAbout"> <!-- <view class="list-cell list-cell-arrow" @click="handleAbout">
<view class="menu-item-box"> <view class="menu-item-box">
<u-icon name="heart" color="#2979ff" size="32"></u-icon> <u-icon name="heart" color="#2979ff" size="32"></u-icon>
<view style="margin-left: 10rpx;">关于我们</view> <view style="margin-left: 10rpx;">关于我们</view>
</view> </view>
</view> </view> -->
</view> </view>
<view class="btn" @click="handleLogout" v-if="user">退出登录</view> <view class="btn" @click="handleLogout" v-if="user">退出登录</view>
@ -125,6 +129,15 @@
handleSpotCheckOrder() { handleSpotCheckOrder() {
this.$tab.navigateTo('/pages/spotCheckOrder/myOrder') this.$tab.navigateTo('/pages/spotCheckOrder/myOrder')
}, },
handleSparePartsApplication(){
this.$tab.navigateTo('/pages/sparePartsApplication/mySparePartsApplication?flag=1')
},
handleSparePartsApplicationApprove(){
this.$tab.navigateTo('/pages/sparePartsApplication/mySparePartsApplication?flag=2')
},
handleSparePartsService(){
this.$tab.navigateTo('/pages/sparePartsServiceWorkOrderList/mySparePartsService')
},
handleLogout() { handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => { this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {

8
pages/repairOrder/detail.vue

@ -112,7 +112,7 @@
</view> </view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> --> <!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view> </view>
<view class="add-btn" v-if="data.status == 'PENDING' || data.status == 'PECEIVED'" > <view class="add-btn" v-if="(data.status == 'PENDING' || data.status == 'PECEIVED')&& $store.state.user.post == 'worker'" >
<u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff" <u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加维修内容</u-button> size="36"></u-icon>添加维修内容</u-button>
</view> </view>
@ -121,11 +121,11 @@
</view> </view>
<view class="footer"> <view class="footer">
<view class="btns"> <view class="btns">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick(1)" :loading='loading' <u-button type="primary" v-if="data.status == 'PENDING'&& $store.state.user.post == 'worker'" @click="orderClick(1)" :loading='loading'
:disabled='loading'>接单</u-button> :disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClickSuccess()" :loading='loading' <u-button type="primary" v-if="data.status == 'PECEIVED'&& $store.state.user.post == 'worker'" @click="orderClickSuccess()" :loading='loading'
:disabled='loading'>完成</u-button> :disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'" @click="orderClick(3)" :loading='loading' <u-button type="primary" v-if="data.status == 'COMPLETED'&& $store.state.user.post == 'engineer'" @click="orderClick(3)" :loading='loading'
:disabled='loading'>验证完结</u-button> :disabled='loading'>验证完结</u-button>
</view> </view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> <view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>

4
pages/repairOrder/index.vue

@ -4,7 +4,7 @@
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' <u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="维修工单"> title="维修工单">
<template v-slot:right> <template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon> <u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm" v-if=" $store.state.user.post == 'worker'"></u-icon>
</template> </template>
</u-navbar> </u-navbar>
<!-- <Search @search='search' @screen='screen'/> --> <!-- <Search @search='search' @screen='screen'/> -->
@ -45,7 +45,7 @@
<view class="time" style="flex: 1;"> <view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}} {{`${$time.formatDate(item.createTime)}`}}
</view> </view>
<view class="status"> <view class="status" v-if=" $store.state.user.post == 'worker'">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button> <u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button>
</view> </view>

2
pages/repairOrder/myOrder.vue

@ -10,7 +10,7 @@
<!-- <Search @search='search' @screen='screen'/> --> <!-- <Search @search='search' @screen='screen'/> -->
<view class="list"> <view class="list">
<view class="item" v-for="(item,index) in list" :key="index" > <view class="item" v-for="(item,index) in list" :key="index" >
<view class="" @click="itemClick(item,index)"> <view class="">
<view class="title"> <view class="title">
<view class="title-txt"> <view class="title-txt">
{{item.describes}} {{item.describes}}

98
pages/sparePartsApplication/detail.vue

@ -36,19 +36,27 @@
</view> </view>
</view> </view>
</view> </view>
<view class="footer" v-if="!from">
<view class="btns">
<button class="reset" @click="reject">驳回</button>
<button class="sure" @click="agree" :loading='loading' :disabled='loading'>通过</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> <view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view> </view>
</template> </template>
<script> <script>
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js" import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
import * as moldApi from "@/api/mold.js" import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js"
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
export default { export default {
data() { data() {
return { return {
number: '', number: '',
data: '', data: '',
loading: false,
from:'',//
} }
}, },
methods: { methods: {
@ -56,10 +64,58 @@
sparePartsApplicationApi.sparePartsApplicationDetail(this.number).then((res)=>{ sparePartsApplicationApi.sparePartsApplicationDetail(this.number).then((res)=>{
this.data = res.data this.data = res.data
}) })
} },
//
agree() {
this.$modal.confirm('确定通过申请吗').then(() => {
this.$modal.loading('加载中')
this.loading = true
sparePartsApplicationApproveApi.sparePartsApplicationAgree(this.data.id).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('审核成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('审核失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reject(item) {
this.$modal.confirm('确定驳回申请吗?').then(() => {
this.$modal.loading('加载中')
this.loading = true
sparePartsApplicationApproveApi.sparePartsApplicationReject(item.id).then(async (res) => {
if (res.data) {
this.$modal.showToast('已驳回')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('审核失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
}, },
onLoad(option) { onLoad(option) {
if (option.type) this.type = option.type; if (option.type) this.type = option.type;
if (option.from) this.from = option.from;
if (option.number) { if (option.number) {
this.number = option.number this.number = option.number
} }
@ -207,4 +263,40 @@
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
</style> </style>

187
pages/sparePartsApplication/mySparePartsApplication.vue

@ -0,0 +1,187 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="dec" v-if="item.status!=0">
审批时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span>
</view>
<view class="dec" v-if="item.status!=0">
:<span>{{item.approveName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
flag:''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/sparePartsApplication/screen`)
},
addForm() {
this.$tab.navigateTo(`/pages/sparePartsApplication/addForm`)
},
openDetail(item){
this.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}&from=1`)
},
//
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await sparePartsApplicationApi.sparePartsApplicationPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item) {
this.$modal.confirm('确定撤回申请吗?').then(() => {
this.$modal.loading('加载中')
sparePartsApplicationApi.sparePartsApplicationCancle(item.id).then(async (res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
await this.getList()
this.$modal.showToast('撤回成功')
})
})
}
},
onLoad(option) {
if (option.flag) this.params.flag = option.flag;
if(this.params.flag == 2){
uni.setNavigationBarTitle({
title:'领用申请审批'
})
}
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

192
pages/sparePartsApplicationApprove/index.vue

@ -0,0 +1,192 @@
<template>
<!-- 备件领用申请审批 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="领用申请审批">
</u-navbar>
<!-- <Search @search='search' @screen='screen' /> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" size="mini" style="min-width: 120rpx;"
v-if="item.status==0" @click="reject(item)">驳回</u-button>
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;margin-left: 20rpx;"
v-if="item.status==0" @click="agree(item)">通过</u-button>
</view>
</view>
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/sparePartsApplication/screen`)
},
addForm() {
this.$tab.navigateTo(`/pages/sparePartsApplication/addForm`)
},
openDetail(item){
this.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}`)
},
//
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await sparePartsApplicationApproveApi.sparePartsApplicationApprovePage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
agree(item) {
this.$modal.confirm('确定通过申请吗?').then(() => {
this.$modal.loading('加载中')
sparePartsApplicationApproveApi.sparePartsApplicationAgree(item.id).then(async (res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
await this.getList()
this.$modal.showToast('审核成功')
})
})
},
//
reject(item) {
this.$modal.confirm('确定驳回申请吗?').then(() => {
this.$modal.loading('加载中')
sparePartsApplicationApproveApi.sparePartsApplicationReject(item.id).then(async (res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
await this.getList()
this.$modal.showToast('已驳回')
})
})
},
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

56
pages/sparePartsServiceWorkOrderList/addForm.vue

@ -13,7 +13,12 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> <u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="库位" prop="locationNumber" required v-if="isShow">
<u-input v-model="form.locationNumber" placeholder="请选择库位" @blur="blur"/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required> <u-form-item label="数量" prop="qty" required>
<u-input v-model="form.qty" type="number" placeholder="请输入数量" /> <u-input v-model="form.qty" type="number" placeholder="请输入数量" />
</u-form-item> </u-form-item>
@ -42,6 +47,7 @@
import * as sparePartsApi from "@/api/spareParts.js" import * as sparePartsApi from "@/api/spareParts.js"
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js" import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js"
import * as dictApi from "@/api/dict.js" import * as dictApi from "@/api/dict.js"
import * as locationApi from "@/api/location.js"
export default { export default {
@ -54,13 +60,16 @@
qty: '', qty: '',
result: 'YES', result: 'YES',
reasons: '', reasons: '',
locationNumber:'',
areaNumber:''
}, },
sparePartsList: [], sparePartsList: [],
singleColumnShow: false, singleColumnShow: false,
singleColumnDefaultValue: [], singleColumnDefaultValue: [],
singleColumnList: [], singleColumnList: [],
field: '', field: '',
result: [] result: [],
isShow:false
} }
}, },
methods: { methods: {
@ -71,6 +80,14 @@
this.$modal.showToast('请选择备件') this.$modal.showToast('请选择备件')
return; return;
} }
if (this.isInAccount == 'TRUE') {
this.$modal.showToast('该库位属于帐内库,请选择帐外库')
return;
}
if (this.itemNumber) {
this.$modal.showToast('该库位已绑定过备件')
return;
}
if (!this.form.qty) { if (!this.form.qty) {
this.$modal.showToast(`请输入数量`) this.$modal.showToast(`请输入数量`)
return; return;
@ -86,7 +103,8 @@
this.$modal.confirm('是否添加备件维修工单').then(() => { this.$modal.confirm('是否添加备件维修工单').then(() => {
this.$modal.loading('加载中') this.$modal.loading('加载中')
this.loading = true this.loading = true
sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListCreate(this.form).then((res) => { sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListCreate(this.form).then((
res) => {
this.$modal.closeLoading() this.$modal.closeLoading()
if (res.data) { if (res.data) {
this.$modal.showToast('添加成功') this.$modal.showToast('添加成功')
@ -137,12 +155,15 @@
}, },
// //
chooseSingleColumn(e) { chooseSingleColumn(e) {
console.log(this.field)
this.form[this.field] = e[0].value this.form[this.field] = e[0].value
if (this.field == 'deviceNumber') { if (this.field == 'itemNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value) this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName this.form.locationNumber = this.choosesingleColumnItem[0].locationNumber
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber this.form.areaNumber = this.choosesingleColumnItem[0].areaNumber
// this.form.deviceNumber = e[0].value if(!this.choosesingleColumnItem[0].locationNumber){
this.isShow = true
}
} }
this.singleColumnShow = false this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field]) this.$emit('singleColumn', this.field, this.form[this.field])
@ -158,6 +179,27 @@
this.sparePartsList = res.data this.sparePartsList = res.data
}) })
}, },
//
chickRightButton(field) {
uni.scanCode({
success: function(res) {
this.form.locationNumber = res.result
this.getLocation()
}
});
},
getLocation(){
locationApi.getLocation(this.form.locationNumber).then(res=>{
this.form.areaNumber = res.data.areaNumber;
this.isInAccount = res.data.isInAccount
this.itemNumber = res.data.itemNumber
})
},
blur() {
if (this.form.locationNumber) {
this.getLocation()
}
},
}, },
async onLoad(option) { async onLoad(option) {
if (option.type) this.type = option.type; if (option.type) this.type = option.type;

169
pages/sparePartsServiceWorkOrderList/mySparePartsService.vue

@ -0,0 +1,169 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="title">
<view class="title-txt">
{{item.itemName}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
<view>申请单号</view><view>{{item.number}}</view>
</view>
<view class="dec">
<view>备件单号</view><view>{{item.itemNumber}}</view>
</view>
<view class="dec">
<view>数量</view><view>{{item.qty}}</view>
</view>
<view class="dec">
<view>维修结果</view><view>{{item.result == 'YES'?'完成':'未完成'}}</view>
</view>
<view class="dec">
<view>维修原因</view><view>{{item.reasons}}</view>
</view>
<!-- <view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.status==0" @click="cancle(item)">撤回</u-button>
</view>
</view> -->
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
flag:1
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
},
onLoad(option) {
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
display: flex;
align-items: center;
view {
&:nth-child(1){
width: 160rpx;;
}
&:nth-child(2){
color: #999999;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

240
store/modules/user.js

@ -1,102 +1,162 @@
import config from '@/config' import config from '@/config'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant' import constant from '@/utils/constant'
import { login, logout, getInfo,getPermissionInfo } from '@/api/login' import {
import { setToken, removeToken } from '@/utils/auth' login,
logout,
getInfo,
getPermissionInfo
} from '@/api/login'
import {
setToken,
removeToken
} from '@/utils/auth'
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
const user = { const user = {
state: { state: {
id: 0, // 用户编号 id: 0, // 用户编号
name: storage.get(constant.name), name: storage.get(constant.name),
avatar: storage.get(constant.avatar), avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles), roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions) permissions: storage.get(constant.permissions),
}, role:storage.get(constant.role),
post:storage.get(constant.post),
// post:storage.get(constant.posts) && storage.get(constant.posts).filter(item => item.code == 'worker' || item.code ==
// 'engineer')[0].code,
classType:storage.get(constant.classType),
},
mutations: { mutations: {
SET_ID: (state, id) => { SET_ID: (state, id) => {
state.id = id state.id = id
}, },
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name
storage.set(constant.name, name) storage.set(constant.name, name)
}, },
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
storage.set(constant.avatar, avatar) storage.set(constant.avatar, avatar)
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
storage.set(constant.roles, roles) storage.set(constant.roles, roles)
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
storage.set(constant.permissions, permissions) storage.set(constant.permissions, permissions)
} },
}, SET_ROLE: (state, role) => {
state.role = role
storage.set(constant.role, role)
},
SET_CLASSTYPE: (state, classType) => {
state.classType = classType
storage.set(constant.classType, classType)
},
SET_POST: (state, post) => {
state.post = post
storage.set(constant.post, post)
}
},
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({
const username = userInfo.username.trim() commit
const password = userInfo.password }, userInfo) {
const captchaVerification = userInfo.captchaVerification const username = userInfo.username.trim()
const tenantName = userInfo.tenantName const password = userInfo.password
const rememberMe = userInfo.rememberMe const captchaVerification = userInfo.captchaVerification
const code = userInfo.code const tenantName = userInfo.tenantName
const uuid = userInfo.uuid const rememberMe = userInfo.rememberMe
return new Promise((resolve, reject) => { const code = userInfo.code
login(username, password, captchaVerification,tenantName,rememberMe,code,uuid).then(res => { const uuid = userInfo.uuid
res = res.data; return new Promise((resolve, reject) => {
// 设置 token login(username, password, captchaVerification, tenantName, rememberMe, code, uuid).then(
setToken(res) res => {
resolve() res = res.data;
}).catch(error => { // 设置 token
reject(error) setToken(res)
}) resolve()
}) }).catch(error => {
}, reject(error)
})
})
},
// 获取权限 // 获取权限
GetPermissionInfo({ commit, state }) { GetPermissionInfo({
return new Promise((resolve, reject) => { commit,
getPermissionInfo().then(res => { state
res = res.data; // 读取 data 数据 }) {
// const user = res.user return new Promise((resolve, reject) => {
const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require("@/static/images/profile.jpg") : user.avatar getPermissionInfo().then(res => {
const nickname = (user == null || user.nickname === "" || user.nickname == null) ? "" : user.nickname res = res.data; // 读取 data 数据
if (res.roles && res.roles.length > 0) { // const user = res.user
commit('SET_ROLES', res.roles) const avatar = (user == null || user.avatar === "" || user.avatar == null) ?
commit('SET_PERMISSIONS', res.permissions) require("@/static/images/profile.jpg") : user.avatar
} else { const nickname = (user == null || user.nickname === "" || user.nickname ==
commit('SET_ROLES', ['ROLE_DEFAULT']) null) ? "" : user.nickname
} if (res.roles && res.roles.length > 0) {
commit('SET_NAME', nickname) commit('SET_ROLES', res.roles)
commit('SET_AVATAR', avatar) commit('SET_ROLE', res.roles.filter(item => item == 'all_approve' || item == 'normal_approve')[0])
resolve(res) commit('SET_PERMISSIONS', res.permissions)
}).catch(error => { } else {
reject(error) commit('SET_ROLES', ['ROLE_DEFAULT'])
}) commit('SET_ROLE','')
}) }
}, commit('SET_NAME', nickname)
commit('SET_AVATAR', avatar)
// 退出系统 resolve(res)
LogOut({ commit, state }) { }).catch(error => {
return new Promise((resolve, reject) => { reject(error)
logout(state.token).then(() => { })
commit('SET_ROLES', []) })
commit('SET_PERMISSIONS', []) },
removeToken() // 获取权限
storage.clean() GetInfo({
resolve() commit,
}).catch(error => { state
reject(error) }) {
}) return new Promise((resolve, reject) => {
}) getInfo().then(res => {
} res = res.data; // 读取 data 数据
} commit('SET_CLASSTYPE', res.dept.classType)
if (res.posts && res.posts.length > 0) {
commit('SET_POST', res.posts.filter(item => item.code == 'worker' || item.code == 'engineer')[0].code)
} else {
commit('SET_POST','')
}
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统
LogOut({
commit,
state
}) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
commit('SET_POST', '')
commit('SET_CLASSTYPE', '')
commit('SET_ROLE', '')
removeToken()
storage.clean()
resolve()
}).catch(error => {
reject(error)
})
})
}
}
} }
export default user export default user

3
utils/constant.js

@ -3,6 +3,9 @@ const constant = {
name: 'vuex_name', name: 'vuex_name',
roles: 'vuex_roles', roles: 'vuex_roles',
permissions: 'vuex_permissions', permissions: 'vuex_permissions',
role: 'vuex_role',
classType: 'vuex_classType',
posts: 'vuex_posts',
} }
export default constant export default constant

2
utils/storage.js

@ -4,7 +4,7 @@ import constant from './constant'
let storageKey = 'storage_data' let storageKey = 'storage_data'
// 存储节点变量名 // 存储节点变量名
let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions,constant.user] let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.role, constant.classType,constant.posts]
// 存储的数据 // 存储的数据
let storageData = uni.getStorageSync(storageKey) || {} let storageData = uni.getStorageSync(storageKey) || {}

Loading…
Cancel
Save