This commit is contained in:
bb_pan 2025-12-17 16:50:40 +08:00
parent 5678a739ed
commit 8c89dc558a
4 changed files with 97 additions and 38 deletions

View File

@ -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)

View File

@ -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('<27> 收到响应:', res.config.url, '状态码:', data?.code, '数据:', data)
// console.log('<27> 收到响应:', res.config.url, '状态码:', data?.code, '数据:', data)
if (data.code == '200') {
return data

View File

@ -548,20 +548,19 @@ onUnmounted(() => {
<!-- <div class="home-logo"></div>-->
<div class="home-search" ref="homeSearchRef">
<input
:placeholder="searchTypeName === '装备' ? '搜索装备关键词' : '搜索工具关键词'"
placeholder="搜索关键词"
type="text"
v-model.trim="keywordIptValue"
@keydown.enter="searchKeywordBtn"
ref="inputRef"
@focus="placeholderText = ''"
@blur="
placeholderText =
searchTypeName === '装备' ? '搜索装备关键词' : '搜索工具关键词'
placeholderText = '搜索关键词'
"
@input="changeInputValue"
/>
<button class="search-btn" @click="searchKeywordBtn">搜索</button>
<div
<!-- <div
class="left-check-box"
@click="
() => {
@ -571,7 +570,7 @@ onUnmounted(() => {
>
{{ searchTypeName }}
<el-icon style="margin-left: 5px"><ArrowDownBold /></el-icon>
</div>
</div> -->
<div class="check-container" v-if="searchCheckVisible">
<div
@ -974,7 +973,7 @@ onUnmounted(() => {
line-height: 54px;
color: #333;
text-shadow: 0 0 0 #333;
padding-left: 110px;
padding-left: 20px;
box-sizing: border-box;
}

View File

@ -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()
}