From 5f1c156f0548b3551c5e85c906ce168ab574a38b Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Wed, 1 May 2024 18:49:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9D=83=E9=99=90=E6=94=B9=E6=88=90?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 7 +++++-- src/main.ts | 4 ++-- src/pages/deviceReport/index.vue | 10 +++++----- src/pages/index.vue | 6 +----- src/pages/overhaulOrder/detail.vue | 4 ++-- src/pages/overhaulOrder/index.vue | 3 +-- src/pages/repairOrder/detail.vue | 13 ++++++------- src/pages/repairOrder/index.vue | 3 +-- src/pages/sparePartsApplication/detail.vue | 5 ++--- src/pages/sparePartsApplication/index.vue | 5 ++--- src/pages/sparePartsApplicationApprove/index.vue | 5 ++--- src/pages/spotCheckOrder/detail.vue | 3 +-- src/pages/spotCheckOrder/index.vue | 3 +-- src/pages/upkeepOrder/detail.vue | 7 +++---- src/plugins/auth.js | 12 ++++++------ src/store/modules/countStore.ts | 4 ++++ 16 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/App.vue b/src/App.vue index a482a03..1c345d7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,6 +5,7 @@ onHide } from '@dcloudio/uni-app' import { + ref, getCurrentInstance } from 'vue' import { @@ -15,7 +16,6 @@ import { storeToRefs } from 'pinia' import { useCountStore } from '@/store' - // 获取自定义的store const store = useCountStore() onLaunch(async () => { @@ -91,7 +91,10 @@ // #endif if (getAccessToken()) { await store.GetPermissionInfo().then(res => { - }).catch(() => { }) + uni.setStorageSync('permissionInfo',res.permissions) + uni.setStorageSync('roles',res.roles) + }).catch(() => { + }) await store.GetInfo().then(res => { }).catch(() => { }) } diff --git a/src/main.ts b/src/main.ts index c24d283..22b7f31 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import App from './App.vue' import tab from './plugins/tab' import modal from './plugins/modal' import time from './plugins/time' -// import auth from './plugins/auth' +import auth from './plugins/auth' // 权限 import { setupAuth } from '@/directives' @@ -34,7 +34,7 @@ export function createApp() { app.config.globalProperties.$modal = modal // 时间对象 app.config.globalProperties.$time = time - // app.config.globalProperties.$auth = auth + app.config.globalProperties.$auth = auth diff --git a/src/pages/deviceReport/index.vue b/src/pages/deviceReport/index.vue index 9173e5a..e10f5e8 100644 --- a/src/pages/deviceReport/index.vue +++ b/src/pages/deviceReport/index.vue @@ -4,7 +4,7 @@ @@ -44,9 +44,9 @@ 撤销 @@ -72,7 +72,7 @@ getCurrentInstance } from 'vue' import * as reportApi from "@/api/report.js" - import auth from '@/plugins/auth' + import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() diff --git a/src/pages/index.vue b/src/pages/index.vue index e36c992..6cd4863 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -97,9 +97,9 @@ import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js" const { proxy } = getCurrentInstance() + console.log(proxy.$plugins) // 获取自定义的store const store = useCountStore() - console.log(99,store) const bgOpacity = ref(0) @@ -144,7 +144,6 @@ async function sparePartsApplicationApprovePage(){ await sparePartsApplicationApproveApi.sparePartsApplicationApprovePage(params.value).then((res) => { number1.value = res.data.total - console.log(res.data.total) }).catch(() => { proxy.$modal.closeLoading() }) @@ -162,7 +161,6 @@ await proxy.$onLaunched; if (getAccessToken()) { meaus.value = store.meaus - console.log(meaus.value) let isHave = meaus.value.find (item=>item.path == 'parePartsManagement') let isHaveIndex = meaus.value.findIndex (item=>item.path == 'parePartsManagement') if(isHave&&isHave.children){ @@ -174,8 +172,6 @@ }) await sparePartsApplicationApprovePage() await sparePartsApplicationApprovePage1() - console.log(isShowItemApprove1.value) - console.log(isShowItemApprove2.value) // 如果只有一级审核 、待审核数量等于一级审核数量 if(isShowItemApprove1.value && !isShowItemApprove2.value){ number.value =number1.value diff --git a/src/pages/overhaulOrder/detail.vue b/src/pages/overhaulOrder/detail.vue index f7f9dee..5f863ca 100644 --- a/src/pages/overhaulOrder/detail.vue +++ b/src/pages/overhaulOrder/detail.vue @@ -131,10 +131,10 @@ - 完成 - + 验证完结 diff --git a/src/pages/overhaulOrder/index.vue b/src/pages/overhaulOrder/index.vue index 0a69431..72aaa21 100644 --- a/src/pages/overhaulOrder/index.vue +++ b/src/pages/overhaulOrder/index.vue @@ -5,7 +5,7 @@ title="检修工单"> @@ -71,7 +71,6 @@ } from 'vue' import * as overhaulOrderApi from "@/api/overhaulOrder.js" import { useCountStore } from '@/store' - import auth from '@/plugins/auth' const store = useCountStore() const isEngineer = ref(false) if(store.roles.some(item=>item.indexOf('Engineer')>-1)){//如果角色是工程师带添加 普通维修工不能添加 diff --git a/src/pages/repairOrder/detail.vue b/src/pages/repairOrder/detail.vue index 7a4545e..2dafd7e 100644 --- a/src/pages/repairOrder/detail.vue +++ b/src/pages/repairOrder/detail.vue @@ -9,7 +9,7 @@ v-if="data.status == 'PECEIVED' && (!serviceList || serviceList && serviceList.length == 0)">转办 --> + v-if="data.status == 'PECEIVED'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:turnToAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:turnToAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:turnToAPP')))"> 转办 @@ -207,23 +207,23 @@ + v-if="data.status == 'PENDING'&&((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickAPP')))"> 接单 修改工单 + :disabled='loading1' v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:updateAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:updateAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:updateAPP'))">修改工单 完成 + v-if="(type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickFinishAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickFinishAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickFinishAPP'))">完成 + v-if="((data.status == 'COMPLETED' && !data.requestNumber) || (data.status == 'APPLYPASS')) && ((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickVerifyAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickVerifyAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickVerifyAPP')))"> 验证 + v-if="(data.status == 'COMPLETED' && data.requestNumber && data.applyer == store.id)&& ((type=='DEVICE'&&$auth.hasPermi('eam:device-maintenance-job-main:orderClickConfirmAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-maintenance-job-main:orderClickConfirmAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-maintenance-job-main:orderClickConfirmAPP')))"> 维修确认 @@ -287,7 +287,6 @@ import * as dictApi from "@/api/dict.js" import * as repairOrderApi from "@/api/repairOrder.js" import { useCountStore } from '@/store' - import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() // 获取自定义的store diff --git a/src/pages/repairOrder/index.vue b/src/pages/repairOrder/index.vue index cb4dd2e..b160017 100644 --- a/src/pages/repairOrder/index.vue +++ b/src/pages/repairOrder/index.vue @@ -4,7 +4,7 @@ @@ -71,7 +71,6 @@ } from 'vue' import * as repairOrderApi from "@/api/repairOrder.js" import { useCountStore } from '@/store' - import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() // 获取自定义的store diff --git a/src/pages/sparePartsApplication/detail.vue b/src/pages/sparePartsApplication/detail.vue index 96fcf2b..513a3bd 100644 --- a/src/pages/sparePartsApplication/detail.vue +++ b/src/pages/sparePartsApplication/detail.vue @@ -38,8 +38,8 @@ - - + + @@ -56,7 +56,6 @@ ref, getCurrentInstance } from 'vue' - import auth from '@/plugins/auth' import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js" import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js" const { proxy } = getCurrentInstance() diff --git a/src/pages/sparePartsApplication/index.vue b/src/pages/sparePartsApplication/index.vue index 8c0738e..1a03734 100644 --- a/src/pages/sparePartsApplication/index.vue +++ b/src/pages/sparePartsApplication/index.vue @@ -4,7 +4,7 @@ @@ -41,7 +41,7 @@ 撤回 + v-if="item.status==0&&$auth.hasPermi('eam:item-apply-request-main:cancelAPP')" @click="cancle(item)">撤回 @@ -62,7 +62,6 @@ getCurrentInstance } from 'vue' import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js" - import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() const params = ref({ pageNo: 1, diff --git a/src/pages/sparePartsApplicationApprove/index.vue b/src/pages/sparePartsApplicationApprove/index.vue index cd4d4cb..a98d16a 100644 --- a/src/pages/sparePartsApplicationApprove/index.vue +++ b/src/pages/sparePartsApplicationApprove/index.vue @@ -38,9 +38,9 @@ 驳回 + v-if="item.status==0&&((from==2&&$auth.hasPermi('eam:item-apply-request-main:role0APP'))||(from==3&&$auth.hasPermi('eam:item-apply-request-main:role1APP')))" @click="reject(item)">驳回 通过 + v-if="item.status==0&&((from==2&&$auth.hasPermi('eam:item-apply-request-main:role0APP'))||(from==3&&$auth.hasPermi('eam:item-apply-request-main:role1APP')))" @click="agree(item)">通过 @@ -60,7 +60,6 @@ ref, getCurrentInstance } from 'vue' - import auth from '@/plugins/auth' import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js" const { proxy } = getCurrentInstance() const params = ref({ diff --git a/src/pages/spotCheckOrder/detail.vue b/src/pages/spotCheckOrder/detail.vue index 9a26b66..9ee814a 100644 --- a/src/pages/spotCheckOrder/detail.vue +++ b/src/pages/spotCheckOrder/detail.vue @@ -95,7 +95,7 @@ + v-if="data.status == 'COMPLETED'&& ((type=='DEVICE'&&$auth.hasPermi('eam:device-spot-inspection-record-main:orderClickVerifyAPP'))||(type=='MOLD'&&$auth.hasPermi('eam:mold-spot-inspection-record-main:orderClickVerifyAPP'))||(type=='TECH'&&$auth.hasPermi('eam:tech-spot-inspection-record-main:orderClickVerifyAPP')))"> 验证 @@ -133,7 +133,6 @@ import * as repairOrderApi from "@/api/repairOrder.js" import { useCountStore } from '@/store' import * as spotCheckOrderApi from "@/api/spotCheckOrder.js" - import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() // 获取自定义的store diff --git a/src/pages/spotCheckOrder/index.vue b/src/pages/spotCheckOrder/index.vue index 186274a..7060915 100644 --- a/src/pages/spotCheckOrder/index.vue +++ b/src/pages/spotCheckOrder/index.vue @@ -4,7 +4,7 @@ @@ -70,7 +70,6 @@ getCurrentInstance, nextTick } from 'vue' - import auth from '@/plugins/auth' import * as spotCheckOrderApi from "@/api/spotCheckOrder.js" import { useCountStore } from '@/store' diff --git a/src/pages/upkeepOrder/detail.vue b/src/pages/upkeepOrder/detail.vue index 745b266..c76c75e 100644 --- a/src/pages/upkeepOrder/detail.vue +++ b/src/pages/upkeepOrder/detail.vue @@ -142,13 +142,13 @@ 接单 完成 验证 @@ -179,7 +179,6 @@ } from 'vue' import * as moldApi from "@/api/mold.js" import * as upkeepOrderApi from "@/api/upkeepOrder.js" - import auth from '@/plugins/auth' const { proxy } = getCurrentInstance() const list = ref([{ name: '设备信息' diff --git a/src/plugins/auth.js b/src/plugins/auth.js index fb5665d..dbf7b05 100644 --- a/src/plugins/auth.js +++ b/src/plugins/auth.js @@ -1,12 +1,12 @@ // import store from '@/store' -import { - useCountStore -} from '@/store' -const store = useCountStore() +// import { +// useCountStore +// } from '@/store' +// const store = useCountStore() function authPermission(permission) { const all_permission = "*:*:*" - const permissions = store && store.permissions + const permissions = uni.getStorageSync('permissionInfo') if (permission && permission.length > 0) { return permissions.some(v => { return all_permission === v || v === permission @@ -18,7 +18,7 @@ function authPermission(permission) { function authRole(role) { const super_admin = "admin" - const roles = store && store.roles + const roles = uni.getStorageSync('roles') if (role && role.length > 0) { return roles.some(v => { return super_admin === v || v === role diff --git a/src/store/modules/countStore.ts b/src/store/modules/countStore.ts index c77fc99..39f48e8 100644 --- a/src/store/modules/countStore.ts +++ b/src/store/modules/countStore.ts @@ -61,6 +61,8 @@ const useStore = defineStore('storeId', { this.roles = res.roles this.role = res.roles.filter(item => item == 'all_approve' || item == 'normal_approve')[0] this.permissions = res.permissions + uni.setStorageSync('permissionInfo',res.permissions) + uni.setStorageSync('roles',res.roles) let menus = [] res.menus.forEach(item => { if (item.path == '/APP') { @@ -114,6 +116,8 @@ const useStore = defineStore('storeId', { this.post = '' this.dept = '' removeToken() + uni.removeStorageSync('permissionInfo') + uni.removeStorageSync('roles') resolve(res) }).catch(error => { reject(error)