代码优化

This commit is contained in:
BianLzhaoMin 2024-12-03 16:00:10 +08:00
parent a47974425a
commit 98a864868c
9 changed files with 109 additions and 32 deletions

4
components.d.ts vendored
View File

@ -24,7 +24,6 @@ declare module 'vue' {
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
@ -32,7 +31,6 @@ declare module 'vue' {
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElProgress: typeof import('element-plus/es')['ElProgress']
@ -40,8 +38,6 @@ declare module 'vue' {
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -3,6 +3,7 @@ import $bus from '@/utils/bus'
import { mainStore } from 'store/main'
import { useStore } from 'store/user'
import { ElMessage, ElMessageBox } from 'element-plus'
import headerLogo from 'assets/img/zulinlogo.png'
const store: any = mainStore()
const userStore = useStore()
userStore.editMenuList(1)
@ -121,6 +122,18 @@ const onCarts = () => {
name: 'cart',
})
}
const isMyInfoPage = () => {
if (
route.path.indexOf('cart') !== -1 ||
route.path.indexOf('demand-details') !== -1 ||
route.path.indexOf('order-confirm') !== -1
) {
return true
} else {
return false
}
}
</script>
<template>
@ -128,6 +141,21 @@ const onCarts = () => {
<div class="header-container">
<div class="header-user-info">
<div class="header-box wapper">
<!-- <img
v-if="isMyInfoPage()"
:src="headerLogo"
style="height: 35px; cursor: pointer"
alt=""
/> -->
<el-image
style="width: 190px; cursor: pointer; margin-right: 50%"
v-if="isMyInfoPage()"
:src="headerLogo"
fit="contain"
@click="$router.push('/home')"
/>
<div class="header-item" v-if="isShowLogout">
<!-- <img src="../assets/img/home/star.png" alt="" /> -->
<a class="user-name">{{ store.userInfo.nickName }}</a>

View File

@ -105,7 +105,7 @@ const routes: Array<RouteRecordRaw> = [
name: 'equipDetail',
component: () => import('views/equip/detail.vue'),
meta: {
title: '',
title: '装备详情',
keepAlive: false,
AuthFlag: false,
}

View File

@ -1,8 +1,8 @@
<template>
<Header />
<div class="container">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ name: 'parity' }">租赁需求大厅</el-breadcrumb-item>
<el-breadcrumb separator="/" class="primary-lease">
<el-breadcrumb-item :to="{ path: backPath }">{{ backName }}</el-breadcrumb-item>
<el-breadcrumb-item>需求详情</el-breadcrumb-item>
</el-breadcrumb>
@ -89,6 +89,7 @@
"
@click="onAcceptOrders"
:disabled="userId == leaseDetails.publishUser"
v-if="leaseDetails.leaseStatus !== 1"
>
立即接单
</el-button>
@ -108,6 +109,8 @@ import { getLeaseInfoByIdApi, setAcceptByIdApi } from 'http/api/home/index'
import moment from 'moment'
import { useRoute, useRouter } from 'vue-router'
import { mainStore } from 'store/main'
const backPath = ref<any>('')
const backName = ref<any>('')
const leaseDetails = reactive<any>({})
const route = useRoute()
@ -159,6 +162,28 @@ const equipBaseInfoList = reactive([
},
])
if (router.options.history.state.back) {
backPath.value = router.options.history.state.back
const previousRoute: any = []
router.options.routes.forEach((route: any) => {
if (route.path === router.options.history.state.back) {
previousRoute.push(route)
} else {
if (route.children && route.children.length > 0) {
route.children.forEach((r: any) => {
if (r.path === router.options.history.state.back) {
previousRoute.push(r)
}
})
}
}
})
if (previousRoute.length > 0) {
backName.value = previousRoute[0].meta.title
}
}
//
const getLeaseInfoByIdData = async () => {
const res: any = await getLeaseInfoByIdApi({ id: route.query.id })

View File

@ -1,7 +1,7 @@
<template>
<Header />
<div class="container">
<el-breadcrumb separator="/">
<el-breadcrumb separator="/" class="primary-lease">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>提交订单</el-breadcrumb-item>
</el-breadcrumb>

View File

@ -100,7 +100,16 @@
}"
>
<el-table-column align="center" label="序号" type="index" width="80" />
<el-table-column align="center" prop="leaseCode" label="需求编号" />
<el-table-column align="center" label="需求编号">
<template #default="{ row }">
<a
style="cursor: pointer; color: #00a288; text-decoration: underline"
@click="router.push({ name: 'demand-details', query: { id: row.id } })"
>
{{ row.leaseCode }}
</a>
</template>
</el-table-column>
<el-table-column align="center" prop="leaseName" label="需求名称" />
<el-table-column align="center" prop="areaName" label="项目所在地" />
<el-table-column align="center" prop="publishUser" label="发布人" />
@ -381,6 +390,7 @@ import { getCompanyListApi, getGoodsClassListApi, getAreaApi } from 'http/api/ho
import { getAcceptOrdersListApi } from 'http/api/sourcing/index'
import { InfoFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload'
const addOrEditDialogVisible = ref(false)
const companyOptions = ref<any>([])
@ -396,10 +406,7 @@ const areaList = ref<any>([])
const releaseTime = ref([])
const dialogTitle = ref('新增')
const fileListTemp = ref<any>([])
const props2 = {
multiple: true,
checkStrictly: true,
}
const router = useRouter()
const searchParams = reactive({
leaseName: '',

View File

@ -475,28 +475,30 @@ const submitBtn = () => {
insurancePdf: insurancePdf.value, //
examinationPdf: examinationPdf.value, //
}
if(equipmentDeploymentParams.value.maId&&equipmentDeploymentParams.value.maId!=""){
if (
equipmentDeploymentParams.value.maId &&
equipmentDeploymentParams.value.maId != ''
) {
const res: any = await equipmentEditApi(param)
if (res.code === 200) {
ElMessage({
type: 'success',
message: '保存成功',
})
dialogFormVisibleSettlein.value = false
dialogFormVisibleSettlein.value = false
getList()
}
}else{
} else {
const res: any = await equipmentAddApi(param)
if (res.code === 200) {
ElMessage({
type: 'success',
message: '保存成功',
})
dialogFormVisibleSettlein.value = false
dialogFormVisibleSettlein.value = false
getList()
}
}
}
})
}
@ -817,7 +819,16 @@ const handleRemove = (list: any, index: Number) => {
:header-cell-style="{ background: '#00a288', color: '#fff' }"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
<el-table-column
type="selection"
width="55"
align="center"
:selectable="
(row:any) => {
return row.maStatus != 0
}
"
/>
<el-table-column label="序号" align="center" width="80" type="index"></el-table-column>
<el-table-column align="center" prop="deviceName" label="装备名称" />
<el-table-column align="center" prop="code" label="装备编号" />
@ -831,7 +842,7 @@ const handleRemove = (list: any, index: Number) => {
</el-table-column>
<el-table-column align="center" prop="typeName" label="装备型号" />
<el-table-column align="center" label="装备状态" width="80px">
<el-table-column align="center" label="装备状态">
<template #default="{ row }">
<el-tag v-if="row.maStatus == 0" size="small" type="info">草稿状态</el-tag>
<el-tag v-if="row.maStatus == 1" size="small" type="warning">下架</el-tag>

View File

@ -1,5 +1,4 @@
<template>
<!-- 寻源需求 -->
<el-form
:inline="true"
size="default"
@ -101,12 +100,23 @@
}"
>
<el-table-column align="center" label="序号" type="index" width="80" />
<el-table-column align="center" prop="leaseCode" label="需求编号" />
<el-table-column align="center" label="需求编号">
<template #default="{ row }">
<a
style="cursor: pointer; color: #00a288; text-decoration: underline"
@click="router.push({ name: 'demand-details', query: { id: row.id } })"
>
{{ row.leaseCode }}
</a>
</template>
</el-table-column>
<el-table-column align="center" prop="leaseName" label="需求名称" />
<el-table-column align="center" prop="operateAddress" label="需求所在地" />
<el-table-column align="center" prop="publishUser" label="发布人" />
<el-table-column align="center" prop="endTime" label="需求截止日期" />
<el-table-column align="center" prop="endTime" label="需求截止日期" width="120" />
<el-table-column align="center" prop="startTime" label="发布时间" />
<el-table-column align="center" prop="orderUser" label="接单人" />
<el-table-column align="center" prop="" label="接单人联系方式" width="140" />
<el-table-column align="center" prop="leaseStatusName" label="需求状态" />
<el-table-column align="center" label="操作" :width="220">
<template #default="{ row }">
@ -124,8 +134,8 @@
size="small"
class="primary-lease"
type="primary"
v-if="row.leaseStatus === 2"
@click="onRepublish(row.id, true)"
v-if="row.leaseStatus === 2 || row.leaseStatus === 0"
@click="onRepublish(row.id, true, row.leaseStatus)"
>
编辑
</el-button>
@ -400,7 +410,9 @@
>
保存
</el-button>
<el-button class="primary-lease" @click="onSubmit(true)"> 提交 </el-button>
<el-button class="primary-lease" type="primary" @click="onSubmit(true)">
提交
</el-button>
</div>
</template>
</el-dialog>
@ -419,6 +431,7 @@ import {
} from 'http/api/sourcing/index'
import { InfoFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload'
const addOrEditDialogVisible = ref(false)
const companyOptions = ref<any>([])
@ -434,10 +447,7 @@ const areaList = ref<any>([])
const releaseTime = ref([])
const dialogTitle = ref('新增')
const fileListTemp = ref<any>([])
const props2 = {
multiple: true,
checkStrictly: true,
}
const router = useRouter()
const searchParams = reactive({
leaseName: '',
@ -560,10 +570,11 @@ const onDelete = async (id: any) => {
}
}
//
const onRepublish = async (id: any, type: any) => {
const onRepublish = async (id: any, type: any, leaseStatus: any) => {
dialogTitle.value = '编辑'
isRepublish.value = false
isSave.value = type
if (leaseStatus === 0) isSave.value = false
const res: any = await getLeaseDetailsByIdApi({ id })
const {
leaseName,
@ -610,7 +621,6 @@ const onSubmit = (type: boolean) => {
addOrEditForm.value.isSubmit = type
addOrEditForm.value.typeId =
addOrEditForm.value.typeIds[addOrEditForm.value.typeIds.length - 1]
addOrEditForm.value.fileInfoList.push(...fileListTemp.value)
const SUBMIT_API = isRepublish.value ? addLeaseInfoApi : editLeaseInfoApi
const res: any = await SUBMIT_API(addOrEditForm.value)