From ceda98aa00b882683efbcd0c113f2627b22871ea Mon Sep 17 00:00:00 2001 From: bb_pan Date: Thu, 27 Feb 2025 15:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=93=E5=8C=BA=E4=B8=8E?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/components/Navmenu/index.vue | 72 +- src/http/api/equip.ts | 5 + src/http/index.ts | 17 +- src/router/index.ts | 10 + src/views/equip/zoneEquipment.vue | 921 +++++++++++++++++++++++ src/views/user/goodsManagement/index.vue | 60 ++ src/views/user/index.vue | 5 +- 8 files changed, 1070 insertions(+), 21 deletions(-) create mode 100644 src/views/equip/zoneEquipment.vue diff --git a/components.d.ts b/components.d.ts index 06def7a..761092b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -41,6 +41,7 @@ declare module 'vue' { ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] ElProgress: typeof import('element-plus/es')['ElProgress'] + ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] diff --git a/src/components/Navmenu/index.vue b/src/components/Navmenu/index.vue index b50f63b..ef07e50 100644 --- a/src/components/Navmenu/index.vue +++ b/src/components/Navmenu/index.vue @@ -13,41 +13,77 @@ const route = useRoute() // { name: '通知公告', routerName: 'enterpriseZone' }, // // { name: '综合查询', routerName: 'enterpriseZone' }, // ] - -const isType: any = localStorage.getItem('rolesType') -const navMenuList = computed(() => { - // return store.leaseAndLesseeList - if (isType == 1) - return [ +const isType: any = ref(null) +// console.log('🚀 ~ onCreated ~ isType.value:', isType.value, localStorage.getItem('rolesType')) +onMounted(() => { + isType.value = localStorage.getItem('rolesType') + // console.log('🚀 ~ onMounted ~ isType.value:', isType.value) +}) +const navMenuList = ref([]) +watch(isType, (newValue) => { + if (newValue == 1) { + navMenuList.value = [ { name: '首页', routerName: 'home' }, { name: '装备共享大厅', routerName: 'equipList' }, { name: '租赁需求大厅', routerName: 'parity' }, - // { name: '装备管理', routerName: 'goodsManagement' }, - // { name: '订单管理', routerName: 'orderManagementCz' }, - // { name: '接单管理', routerName: 'accept-orders' }, + // { name: '专区设备', routerName: 'zoneEquipment' }, { name: '公告', routerName: 'enterpriseZone' }, - // { name: '数据大屏', routerName: 'big-screen' }, ] - if (isType == 2) - return [ + } else if (newValue == 2) { + navMenuList.value = [ { name: '首页', routerName: 'home' }, { name: '装备共享大厅', routerName: 'equipList' }, { name: '租赁需求大厅', routerName: 'parity' }, + // { name: '专区设备', routerName: 'zoneEquipment' }, { name: '订单管理', routerName: 'orderManagement' }, { name: '需求管理', routerName: 'sourcingNeed' }, { name: '通知公告', routerName: 'enterpriseZone' }, - // { name: '数据大屏', routerName: 'big-screen' }, ] - - if (isType == 3) - return [ + } else if (newValue == 3) { + navMenuList.value = [ { name: '首页', routerName: 'home' }, { name: '装备共享大厅', routerName: 'equipList' }, + // { name: '专区设备', routerName: 'zoneEquipment' }, { name: '租赁需求大厅', routerName: 'parity' }, { name: '通知公告', routerName: 'enterpriseZone' }, - // { name: '数据大屏', routerName: 'big-screen' }, ] -}) + } else { + navMenuList.value = [] + } +}, { immediate: true }) +// const navMenuList = computed(() => { +// // return store.leaseAndLesseeList +// if (isType == 1) +// return [ +// { name: '首页', routerName: 'home' }, +// { name: '装备共享大厅', routerName: 'equipList' }, +// { name: '租赁需求大厅', routerName: 'parity' }, +// // { name: '装备管理', routerName: 'goodsManagement' }, +// // { name: '订单管理', routerName: 'orderManagementCz' }, +// // { name: '接单管理', routerName: 'accept-orders' }, +// { name: '公告', routerName: 'enterpriseZone' }, +// // { name: '数据大屏', routerName: 'big-screen' }, +// ] +// if (isType == 2) +// return [ +// { name: '首页', routerName: 'home' }, +// { name: '装备共享大厅', routerName: 'equipList' }, +// { name: '租赁需求大厅', routerName: 'parity' }, +// { name: '订单管理', routerName: 'orderManagement' }, +// { name: '需求管理', routerName: 'sourcingNeed' }, +// { name: '通知公告', routerName: 'enterpriseZone' }, +// // { name: '数据大屏', routerName: 'big-screen' }, +// ] + +// if (isType == 3) +// return [ +// { name: '首页', routerName: 'home' }, +// { name: '装备共享大厅', routerName: 'equipList' }, +// { name: '租赁需求大厅', routerName: 'parity' }, +// { name: '通知公告', routerName: 'enterpriseZone' }, +// // { name: '数据大屏', routerName: 'big-screen' }, +// ] +// }) const navMenuClick = (name: any) => { const includeList = [ diff --git a/src/http/api/equip.ts b/src/http/api/equip.ts index eb9744c..5df6193 100644 --- a/src/http/api/equip.ts +++ b/src/http/api/equip.ts @@ -9,6 +9,11 @@ export const getTypeListApi = (data: any = {}) => { export const getDeviceListApi = (data: any) => { return post('/material-mall/dev/list', data) } + +// 获取专区装备列表 +export const getZoneListApi = (data: any) => { + return post('/material-mall/dev/zone_list', data) +} export const getCompanyCountApi = (data: any) => { return post('/material-mall/dev/getCompanyCount', data) } diff --git a/src/http/index.ts b/src/http/index.ts index c8e6be4..30ad1e7 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -3,7 +3,7 @@ import axios from 'axios' import NProgress from 'nprogress' // import { mainStore } from 'store/main' -import { ElMessage } from 'element-plus' +import { ElLoading, ElMessage } from 'element-plus' import { saveAs } from 'file-saver' import router from '@/router' import { tansParams } from '@/utils/bonus' @@ -56,6 +56,19 @@ service.interceptors.request.use( return error }, ) +const openLoading = () => { + return new Promise((resolve) => { + const loading = ElLoading.service({ + lock: true, + text: 'Loading...', + background: 'rgba(0, 0, 0, 0.7)', + }) + setTimeout(() => { + loading.close() + resolve() + }, 2000) + }) +} // 响应拦截 service.interceptors.response.use( (res) => { @@ -73,6 +86,7 @@ service.interceptors.response.use( ElMessage.error('请重新登录') // 清除token localStorage.removeItem('tokenNew') + openLoading() // 根据环境变量 VITE_API_URL 判断是否是本地开发环境 if (import.meta.env.VITE_API_URL == '/proxyApi') { router.push('/login') @@ -86,6 +100,7 @@ service.interceptors.response.use( } else if (data.code == '401') { ElMessage.error('请重新登录') localStorage.removeItem('tokenNew') + openLoading() if (import.meta.env.VITE_API_URL == '/proxyApi') { router.push('/login') } else { diff --git a/src/router/index.ts b/src/router/index.ts index 1535d70..1f27f76 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -103,6 +103,16 @@ const routes: Array = [ activeName: 'equipList', } }, + // 专区设备 + { + path: '/zoneEquipment', + name: 'zoneEquipment', + component: () => import('views/equip/zoneEquipment.vue'), + meta: { + title: '装备共享大厅', + activeName: 'zoneEquipment', + } + }, //装备详情 { path: '/equipDetail', diff --git a/src/views/equip/zoneEquipment.vue b/src/views/equip/zoneEquipment.vue new file mode 100644 index 0000000..e519b98 --- /dev/null +++ b/src/views/equip/zoneEquipment.vue @@ -0,0 +1,921 @@ + + + diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue index 58c94f4..c8fba05 100644 --- a/src/views/user/goodsManagement/index.vue +++ b/src/views/user/goodsManagement/index.vue @@ -258,6 +258,8 @@ const getDetailData = async (row: any) => { devInfoProperties, tableList, maintenanceAlarmDay, + isZone, + zoneId, } = res Object.assign(addAndEditForm, { @@ -282,6 +284,8 @@ const getDetailData = async (row: any) => { devInfoProperties, tableList, maintenanceAlarmDay, + isZone, + zoneId, }) if (settleinTitle.value == '装备编辑') { @@ -640,6 +644,30 @@ const equipRules = ref({ // // // { required: true, message: '整机重量不能为空', trigger: 'blur' }, // ], + // isZone: [ + // { + // required: true, + // message: '请选择是否在租', + // trigger: 'change', + // }, + // ], + // zoneId: [ + // { + // required: true, + // validator: (rule: any, value: any, callback: any) => { + // if (addAndEditForm.isZone) { + // if (value == '') { + // callback(new Error('请选择关联公司')) + // } else { + // callback() + // } + // } else { + // callback() + // } + // }, + // trigger: 'change', + // }, + // ], }) const getProertyNameRules = (item: any) => { @@ -1110,6 +1138,8 @@ const addAndEditForm = reactive({ examinationPdfs: [], devInfoProperties: [], tableList: [], + isZone: true, // 是否上架专区 + zoneId: '', // 专区id }) // const addAndEditFormTemp = reactive() const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload' @@ -1985,6 +2015,30 @@ const changeNextDate = (row: any) => { + +
{ style="width: 100%" placeholder="请输入唯一标识符" maxlength="20" + :disabled="disabledForm" > @@ -2256,6 +2311,7 @@ const changeNextDate = (row: any) => { controls-position="right" style="width: 100%" placeholder="请输入检修人" + :disabled="disabledForm" > @@ -2273,6 +2329,7 @@ const changeNextDate = (row: any) => { placeholder="请选择" @change="changeDate(row, $index)" style="width: 100%" + :disabled="disabledForm" > @@ -2291,6 +2348,7 @@ const changeNextDate = (row: any) => { placeholder="请选择" style="width: 100%" @change="changeNextDate(row)" + :disabled="disabledForm" > @@ -2309,6 +2367,7 @@ const changeNextDate = (row: any) => { :limit="5" :on-success="(file: any) => handleSuccess(file, row, 2)" accept=".jpg,.png,.pdf, .doc, .docx" + :disabled="!isAdd" > 上传 @@ -2329,6 +2388,7 @@ const changeNextDate = (row: any) => { :limit="5" :on-success="(file: any) => handleSuccess(file, row, 1)" accept=".jpg,.png,.pdf, .doc, .docx" + :disabled="!isAdd" > 上传 diff --git a/src/views/user/index.vue b/src/views/user/index.vue index 141d0c5..3187ef1 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -8,10 +8,11 @@ const store: any = useStore() const router = useRouter() const route = useRoute() const isAdmin = ref(JSON.parse(localStorage.getItem('main')).userInfo.admin) -console.log('🚀 ~ isAdmin:', isAdmin) +// 临时管理员权限 +// const isAdmin = ref(JSON.parse(localStorage.getItem('main')).userInfo.userName == 'yuecuishan_4261') +console.log('🚀 ~ isAdmin:', isAdmin.value) import imgSrc from '@/assets/img/logo.png' -import { el } from 'element-plus/es/locale' const handleSelect = (name: any, path: any) => { console.log('🚀 ~ handleSelect ~ name:', name)