From 8c89dc558a6d1c740f642cc7fb1f3cf7bcc0387a Mon Sep 17 00:00:00 2001 From: bb_pan Date: Wed, 17 Dec 2025 16:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/api/equip.ts | 5 ++ src/http/index.ts | 8 +-- src/layout/header.vue | 11 ++-- src/views/equip/list.vue | 111 +++++++++++++++++++++++++++++---------- 4 files changed, 97 insertions(+), 38 deletions(-) diff --git a/src/http/api/equip.ts b/src/http/api/equip.ts index 81291f4..f3646db 100644 --- a/src/http/api/equip.ts +++ b/src/http/api/equip.ts @@ -5,6 +5,11 @@ export const getTypeListApi = (data: any = {}) => { return get(`/material-mall/maType/getTypeList`, data) } +// 工具分类 +export const getToolTypeListApi = (data = {}) => { + return get('/material-mall/maType/getToolTypeList', data) +} + // 获取装备列表 export const getDeviceListApi = (data: any) => { return post('/material-mall/dev/list', data) diff --git a/src/http/index.ts b/src/http/index.ts index 64c43f1..d2b8320 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -30,9 +30,9 @@ service.interceptors.request.use( const token = localStorage.getItem('tokenNew') if (token) { config.headers['Authorization'] = token - console.log('🔑 请求携带Authorization:', token.substring(0, 50) + '...') + // console.log('🔑 请求携带Authorization:', token.substring(0, 50) + '...') } else { - console.warn('⚠️ localStorage中没有找到tokenNew') + // console.warn('⚠️ localStorage中没有找到tokenNew') } // 入参是否加密 @@ -58,7 +58,7 @@ service.interceptors.request.use( } } - console.log('📤 发送请求:', config.method?.toUpperCase(), config.url) + // console.log('📤 发送请求:', config.method?.toUpperCase(), config.url) return config }, (error) => { @@ -89,7 +89,7 @@ service.interceptors.response.use( } else { data = res.data } - console.log('� 收到响应:', res.config.url, '状态码:', data?.code, '数据:', data) + // console.log('� 收到响应:', res.config.url, '状态码:', data?.code, '数据:', data) if (data.code == '200') { return data diff --git a/src/layout/header.vue b/src/layout/header.vue index 6aa9097..41a42f5 100644 --- a/src/layout/header.vue +++ b/src/layout/header.vue @@ -548,20 +548,19 @@ onUnmounted(() => { -->
{ line-height: 54px; color: #333; text-shadow: 0 0 0 #333; - padding-left: 110px; + padding-left: 20px; box-sizing: border-box; } diff --git a/src/views/equip/list.vue b/src/views/equip/list.vue index c419ae2..92613d2 100644 --- a/src/views/equip/list.vue +++ b/src/views/equip/list.vue @@ -149,6 +149,7 @@ import { apiGetAddressList, apiGetEquipTypeList, getTypeListApi, + getToolTypeListApi, getDeviceListApi, getCompanyCountApi, } from 'http/api/equip' @@ -270,6 +271,18 @@ const screenChooseList: any = reactive([ }, ], }, + { + type: 'toolClass', + name: '工具分类:', + isShow: true, + list: [ + { + name: '全部', + value: '', + isChecked: true, + }, + ], + }, { type: 'companyId', name: '所属公司', @@ -297,7 +310,7 @@ const screenTags = computed(() => { screenChooseList.forEach((e: any) => { e.list.forEach((j: any) => { if (j.isChecked && j.name !== '全部') { - console.log(j, '******') + // console.log(j, '******') selectTagList.push(j) } }) @@ -344,11 +357,16 @@ const getTypeListData = async () => { if (route.query.level > 1) { params.id = route.query.typeId } - const res = await getTypeListApi() + const res: any = await getTypeListApi() const typeList = res.data.map((e: any) => { return { ...e, name: e.typeName, value: e.typeId, isChecked: false, index: 1 } }) screenChooseList[1].list.push(...typeList) + const res2: any = await getToolTypeListApi() + const toolList = res2.data.map((e: any) => { + return { ...e, name: e.typeName, value: e.typeId, isChecked: false, index: 2 } + }) + screenChooseList[3].list.push(...toolList) } // 获取下级分类 const lowerClassData = async () => { @@ -403,6 +421,8 @@ const getDeviceListData = async (params: any = null, keyWord: any = null) => { dayLeasePriceMin: '', dayLeasePriceMax: '', typeId: '', + maType: '', + toolType: '', level: '', maStatus: 2, dayLeasePriceOrderBy: @@ -417,16 +437,35 @@ const getDeviceListData = async (params: any = null, keyWord: any = null) => { searchParams.ageMax = j.value[1] } if (index === 1 && j.isChecked) { + searchParams.maType = j.typeId searchParams.typeId = j.value searchParams.level = j.level } + if (index === 1) { + const allUnchecked = screenChooseList[1].list.every((e: any) => !e.isChecked) + if (allUnchecked) { + searchParams.maType = -1 + } + } + if (index === 3) { + const allUnchecked = screenChooseList[3].list.every((e: any) => !e.isChecked) + if (allUnchecked) { + searchParams.toolType = -1 + } + } if (index === 2 && j.isChecked && currentIndex !== null && j.value != '') { searchParams.typeId = j.value searchParams.level = j.level } - if (index === 3 && j.isChecked && j.value.length > 0) { - searchParams.dayLeasePriceMin = j.value[0] - searchParams.dayLeasePriceMax = j.value[1] + if (index === 3 && j.isChecked) { + // searchParams.dayLeasePriceMin = j.value[0] + // searchParams.dayLeasePriceMax = j.value[1] + searchParams.toolType = j.typeId + searchParams.typeId = j.value + searchParams.level = j.level + } + if (index === 3 && !j.isChecked) { + // searchParams.toolType = -1 } if (index === 4 && j.isChecked) { searchParams.companyId = j.value @@ -493,6 +532,9 @@ const handleClose = (tag: any) => { if (tag.index != 5) { screenChooseList[tag.index].list[0].isChecked = true } + if (tag.index + 1 == 3) { + screenChooseList[3].list[0].isChecked = true + } if (tag.isAdd) { startPrice.value = 0 @@ -518,37 +560,50 @@ const changeOption = (val: any) => { //选中后添加到 大类中的select字段 const selectScreen = async (type: any, item: any, index: number) => { screenChooseList[index].list.forEach((e: any) => { - e.isChecked = false + if (e === item) { + // 当前点击项:取反 + e.isChecked = !e.isChecked + } else { + // 其他项:强制 false + e.isChecked = false + } }) - if (index == 1) { - screenChooseList[2].list = screenChooseList[2].list.slice(0, 1) + // screenChooseList[index].list.forEach((e: any) => { + // e.isChecked = false + // }) - const params = { - typeId: '', - level: '', - } - if (item.value) { - params.typeId = item.typeId - params.level = item.level - } else { - params.typeId = route.query.typeId - params.level = route.query.level - } - const res = await getTypeListApi(params) + // if (index == 1) { + // screenChooseList[2].list = screenChooseList[2].list.slice(0, 1) - const typeList_2 = res.data - .filter((e: any) => e.level == route.query.level * 1 + 1) - .map((j: any) => { - return { ...j, name: j.typeName, value: j.typeId, isChecked: false, index: 1 } - }) - screenChooseList[2].list.push(...typeList_2) - } + // const params: any = { + // typeId: '', + // level: '', + // } + // if (item.value) { + // params.typeId = item.typeId + // params.level = item.level + // } else { + // params.typeId = route.query.typeId + // params.level = route.query.level + // } + // const res = await getTypeListApi(params) + + // const typeList_2 = res.data + // .filter((e: any) => e.level == route.query.level * 1 + 1) + // .map((j: any) => { + // return { ...j, name: j.typeName, value: j.typeId, isChecked: false, index: 1 } + // }) + // screenChooseList[2].list.push(...typeList_2) + // } if (index == 2) { currentIndex = route.query.level * 1 + 1 } - item.isChecked = !item.isChecked + console.log('🚀 ~ selectScreen ~ item.isChecked:--前', item.isChecked) + + // item.isChecked = !item.isChecked + console.log('🚀 ~ selectScreen ~ item.isChecked:', item.isChecked) getDeviceListData() }