代码优化

This commit is contained in:
BianLzhaoMin 2024-12-10 15:06:36 +08:00
parent 076644e4f6
commit 9bdae9d218
3 changed files with 188 additions and 30 deletions

4
env/.env.dev vendored
View File

@ -8,9 +8,9 @@ VITE_API_URL = '/proxyApi'
# VITE_proxyTarget = 'http://10.40.92.74:8080' #盛旭
# VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅
VITE_proxyTarget = 'http://192.168.2.127:28080' # 梁超
# VITE_proxyTarget = 'http://192.168.2.127:28080' # 梁超
# VITE_proxyTarget = 'http://36.33.26.201:17788/proxyApi' # 测试服务
# VITE_proxyTarget = 'http://192.168.0.244:28580' # 测试服务
VITE_proxyTarget = 'http://192.168.0.244:28580' # 测试服务
# VITE_proxyTarget = 'http://192.168.2.129:18080' # 马帅j
# VITE_proxyTarget = 'http://10.40.92.185:9206' # 赵福海 ( 设备类型)

View File

@ -9,9 +9,10 @@ import userClass from '../hooks/userClass'
const { getCompanyList } = userClass()
import imgSrc from '@/assets/img/logo.png'
const store: any = mainStore()
const searchTypeName = ref('装备')
const userStore = useStore()
const cart = cartStore()
const isType = localStorage.getItem('rolesType')
const isType: any = localStorage.getItem('rolesType')
userStore.editMenuList(1)
const route = useRoute()
const router = useRouter()
@ -21,6 +22,7 @@ rolesName.value = localStorage.getItem('rolesType')
const isAdmin = ref(false)
const roles = store.userInfo.roles
const activeLoginCompanyName = ref('')
const searchCheckVisible = ref(false)
if (roles?.length > 0) {
isAdmin.value = roles.some((e: any) => e.roleKey == 'admin')
}
@ -102,16 +104,39 @@ const searchKeywordBtn = () => {
store.addHistoryRecord(keywordIptValue.value)
if (route.path == '/equipList') {
$bus.emit('search', keywordIptValue.value)
if (searchTypeName.value === '装备') {
$bus.emit('search', keywordIptValue.value)
} else {
router.push({
name: 'parity',
query: { keyWord: keywordIptValue.value },
})
}
}
if (route.path == '/parity') {
if (searchTypeName.value === '需求') {
$bus.emit('search', keywordIptValue.value)
} else {
router.push({
name: 'equipList',
query: { keyWord: keywordIptValue.value },
})
}
$bus.emit('search', keywordIptValue.value)
}
if (route.path == '/home') {
router.push({
name: 'equipList',
query: { keyWord: keywordIptValue.value },
})
if (searchTypeName.value === '装备') {
router.push({
name: 'equipList',
query: { keyWord: keywordIptValue.value },
})
}
if (searchTypeName.value === '需求') {
router.push({
name: 'parity',
query: { keyWord: keywordIptValue.value },
})
}
}
}
@ -277,8 +302,76 @@ const onJumpUser = () => {
</div>
<!-- 中间logo 部分 -->
<div class="logo-ipt-container wapper">
<div class="home-logo">
<el-image
style="width: 70%; margin-left: 60px; cursor: pointer"
:src="imgSrc"
fit="cover"
@click="$router.push('/home')"
/>
</div>
<div class="home-search">
<input
:placeholder="searchTypeName === '装备' ? '搜索装备关键词' : '搜索需求关键词'"
type="text"
v-model.trim="keywordIptValue"
@keydown.enter="searchKeywordBtn"
ref="inputRef"
@focus="placeholderText = ''"
@blur="
placeholderText =
searchTypeName === '装备' ? '搜索装备关键词' : '搜索需求关键词'
"
/>
<button class="search-btn" @click="searchKeywordBtn">搜索</button>
<div
class="left-check-box"
@click="
() => {
searchCheckVisible = true
}
"
>
{{ searchTypeName }}
<el-icon style="margin-left: 5px"><ArrowDownBold /></el-icon>
</div>
<div class="check-container" v-if="searchCheckVisible">
<div
style="border-top-left-radius: 6px; border-top-right-radius: 6px"
@click="
() => {
searchTypeName = '装备'
searchCheckVisible = false
}
"
>
装备
</div>
<div
@click="
() => {
searchTypeName = '需求'
searchCheckVisible = false
}
"
style="border-bottom-left-radius: 6px; border-bottom-right-radius: 6px"
>
需求
</div>
</div>
</div>
<div class="cart-container">
<div class="cart-icon" @click="onCarts" v-if="isType == 2">
<el-badge :value="cartNum">
<svg class="icon" aria-hidden="true" style="width: 30px; height: 30px">
<use xlink:href="#icon-gouwuche2"></use>
</svg>
</el-badge>
<span style="margin-left: 15px"> 预约车 </span>
</div>
</div>
<!-- <img
src="@/assets/img/logo.png"
alt="首页"
@ -286,7 +379,7 @@ const onJumpUser = () => {
@click="$router.push('/home')"
/> -->
<el-image
<!-- <el-image
style="width: 190px; cursor: pointer; margin-left: 60px"
:src="imgSrc"
fit="cover"
@ -321,7 +414,7 @@ const onJumpUser = () => {
</svg>
</el-badge>
<span style="margin-left: 15px"> 预约车 </span>
</div>
</div> -->
</div>
</div>
</template>
@ -454,25 +547,85 @@ const onJumpUser = () => {
display: flex;
align-items: center;
background-color: #eeeff6;
padding: 30px 0 60px 0;
padding: 30px 0;
box-sizing: content-box;
img {
margin-left: 38px;
width: 160px;
height: 60px;
cursor: pointer;
// padding: 30px 0 60px 0;
.home-logo {
width: 246px;
height: 100%;
}
.home-search {
position: relative;
width: 800px;
margin-left: 20px;
.left-check-box {
position: absolute;
left: 0;
top: 0;
height: 53px;
width: 70px;
display: flex;
align-items: center;
justify-content: center;
border-right: 1px solid #3cb4a6;
font-size: 14px;
color: #11806f;
cursor: pointer;
}
.check-container {
position: absolute;
left: 0;
bottom: -100%;
width: 70px;
background-color: #fff;
border-radius: 6px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
z-index: 999;
transition: all 1s linear;
cursor: pointer;
div {
height: 25px;
font-size: 14px;
line-height: 25px;
text-align: center;
letter-spacing: 1px;
}
div:hover {
color: #fff;
background-color: #00a288;
}
}
}
.cart-container {
flex: 1;
}
// img {
// margin-left: 38px;
// width: 160px;
// height: 60px;
// cursor: pointer;
// }
input {
width: 700px;
height: 45px;
width: 100%;
height: 53px;
display: block;
border: 1px solid #3cb4a6;
border-radius: 45px;
margin-left: 70px;
line-height: 45px;
border-radius: 20px;
line-height: 53px;
color: #333;
text-shadow: 0 0 0 #333;
padding-left: 30px;
padding-left: 75px;
box-sizing: border-box;
}
input:focus {
@ -483,16 +636,20 @@ const onJumpUser = () => {
color: #949494;
}
.search-btn {
position: absolute;
top: 0;
right: 0;
width: 100px;
height: 39px;
transform: translate(-110px, 0);
border-radius: 39px;
height: 43px;
transform: translate(-10px, 5px);
border-radius: 43px;
background: linear-gradient(132deg, #22ab9b 0%, #0d7462 100%);
box-shadow: 0px 2px 4px 0px rgba(20, 175, 255, 0.5);
border: none;
color: #fff;
cursor: pointer;
font-size: 18px;
box-sizing: border-box;
}
.ipt-down {
@ -515,9 +672,10 @@ const onJumpUser = () => {
}
.cart-icon {
width: 10%;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
cursor: pointer;
span {

View File

@ -102,9 +102,9 @@
<el-table-column align="center" prop="deviceCode" label="装备编码" />
<el-table-column align="center" prop="deviceName" label="装备名称" />
<el-table-column align="center" prop="qcTime" label="最新质检日期" />
<el-table-column align="center" prop="nickName" label="上传人" width="120" />
<el-table-column align="center" prop="createBy" label="创建人" width="120" />
<el-table-column align="center" prop="createTime" label="上传时间" />
<el-table-column align="center" prop="updateTime" label="更新时间" />
<!-- <el-table-column align="center" prop="updateTime" label="更新时间" /> -->
<el-table-column align="center" label="操作" :width="220">
<template #default="{ row }">
<el-button
@ -355,7 +355,7 @@
<el-table-column align="center" prop="qcCode" label="维修保养编码" />
<el-table-column align="center" prop="qcName" label="维修保养名称" />
<el-table-column align="center" prop="qcTime" label="维修保养日期" />
<el-table-column align="center" prop="createBy" label="上传人" width="120" />
<el-table-column align="center" prop="nickName" label="上传人" width="120" />
<el-table-column align="center" prop="createTime" label="上传时间" />
<el-table-column align="center" label="附件">
<template #default="{ row }">