添加航班管理 #6

Merged
root merged 1 commits from sjy into master 2024-10-29 16:57:27 +08:00
15 changed files with 1280 additions and 91 deletions

9
ludu-admin-vue.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -12,6 +12,15 @@ export interface WhiteVO {
dept: string // 部门 dept: string // 部门
memo: string // 备注 memo: string // 备注
source: string // 来源 source: string // 来源
name: string //
carType: string
areaId: number
areaStart: string
areaEnd: string
address: string
phone: string
plateColor: string
} }
// 白名单管理 API // 白名单管理 API

View File

@ -0,0 +1,47 @@
import request from '@/config/axios'
// 航班 VO
export interface FlightVO {
id: number // id
flightName: string // 航班名称
}
// 航班 API
export const FlightApi = {
//查询航班下拉框数据
getFlightName: async () =>{
return await request.get({ url : `/ticket/flight/flightNameOption`})
},
// 查询航班分页
getFlightPage: async (params: any) => {
return await request.get({ url: `/ticket/flight/page`, params })
},
// 查询航班详情
getFlight: async (id: number) => {
return await request.get({ url: `/ticket/flight/get?id=` + id })
},
// 新增航班
createFlight: async (data: FlightVO) => {
return await request.post({ url: `/ticket/flight/create`, data })
},
// 修改航班
updateFlight: async (data: FlightVO) => {
return await request.put({ url: `/ticket/flight/update`, data })
},
// 删除航班
deleteFlight: async (id: number) => {
return await request.delete({ url: `/ticket/flight/delete?id=` + id })
},
// 导出航班 Excel
exportFlight: async (params) => {
return await request.download({ url: `/ticket/flight/export-excel`, params })
},
}

View File

@ -0,0 +1,47 @@
import request from '@/config/axios'
// 航线 VO
export interface ShipRouteVO {
id: number // id
flightId: number // 航班
routeName: string // 航线名称
}
// 航线 API
export const ShipRouteApi = {
//查询航班下拉框数据
getRouteName: async () =>{
return await request.get({ url : `/ticket/ship-route/routeNameOption`})
},
// 查询航线分页
getShipRoutePage: async (params: any) => {
return await request.get({ url: `/ticket/ship-route/page`, params })
},
// 查询航线详情
getShipRoute: async (id: number) => {
return await request.get({ url: `/ticket/ship-route/get?id=` + id })
},
// 新增航线
createShipRoute: async (data: ShipRouteVO) => {
return await request.post({ url: `/ticket/ship-route/create`, data })
},
// 修改航线
updateShipRoute: async (data: ShipRouteVO) => {
return await request.put({ url: `/ticket/ship-route/update`, data })
},
// 删除航线
deleteShipRoute: async (id: number) => {
return await request.delete({ url: `/ticket/ship-route/delete?id=` + id })
},
// 导出航线 Excel
exportShipRoute: async (params) => {
return await request.download({ url: `/ticket/ship-route/export-excel`, params })
},
}

View File

@ -0,0 +1,43 @@
import request from '@/config/axios'
// 今日航班 VO
export interface TodayFlightVO {
id: number // id
shipRouteId: number // 航线
classes: string // 班次
flightDate: string // 当日日期
startTime: string // 开始时间
}
// 今日航班 API
export const TodayFlightApi = {
// 查询今日航班分页
getTodayFlightPage: async (params: any) => {
return await request.get({ url: `/ticket/today-flight/page`, params })
},
// 查询今日航班详情
getTodayFlight: async (id: number) => {
return await request.get({ url: `/ticket/today-flight/get?id=` + id })
},
// 新增今日航班
createTodayFlight: async (data: TodayFlightVO) => {
return await request.post({ url: `/ticket/today-flight/create`, data })
},
// 修改今日航班
updateTodayFlight: async (data: TodayFlightVO) => {
return await request.put({ url: `/ticket/today-flight/update`, data })
},
// 删除今日航班
deleteTodayFlight: async (id: number) => {
return await request.delete({ url: `/ticket/today-flight/delete?id=` + id })
},
// 导出今日航班 Excel
exportTodayFlight: async (params) => {
return await request.download({ url: `/ticket/today-flight/export-excel`, params })
},
}

View File

@ -26,15 +26,15 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="操作员 Id" prop="operatorId"> <!-- <el-form-item label="操作员 Id" prop="operatorId">-->
<el-input <!-- <el-input-->
v-model="queryParams.operatorId" <!-- v-model="queryParams.operatorId"-->
placeholder="请输入操作员 Id" <!-- placeholder="请输入操作员 Id"-->
clearable <!-- clearable-->
@keyup.enter="handleQuery" <!-- @keyup.enter="handleQuery"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="操作员姓名" prop="operatorName"> <el-form-item label="操作员姓名" prop="operatorName">
<el-input <el-input
v-model="queryParams.operatorName" v-model="queryParams.operatorName"
@ -262,14 +262,14 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
plain <!-- plain-->
@click="openForm('create')" <!-- @click="openForm('create')"-->
v-hasPermi="['parking:appearance-record:create']" <!-- v-hasPermi="['parking:appearance-record:create']"-->
> <!-- >-->
<Icon icon="ep:plus" class="mr-5px" /> 新增 <!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
</el-button> <!-- </el-button>-->
<el-button <el-button
type="success" type="success"
plain plain
@ -324,14 +324,14 @@
/> />
<el-table-column label="操作" align="center" fixed="right" width="110"> <el-table-column label="操作" align="center" fixed="right" width="110">
<template #default="scope"> <template #default="scope">
<el-button <!-- <el-button-->
link <!-- link-->
type="primary" <!-- type="primary"-->
@click="openForm('update', scope.row.id)" <!-- @click="openForm('update', scope.row.id)"-->
v-hasPermi="['parking:appearance-record:update']" <!-- v-hasPermi="['parking:appearance-record:update']"-->
> <!-- >-->
编辑 <!-- 编辑-->
</el-button> <!-- </el-button>-->
<el-button <el-button
link link
type="danger" type="danger"

View File

@ -55,6 +55,10 @@ const formData = ref({
memo: undefined, memo: undefined,
}) })
const formRules = reactive({ const formRules = reactive({
parkNumber: [{ required: true, message: '场库编号不能为空', trigger: 'blur' }],
plate: [{ required: true, message: '车牌号不能为空', trigger: 'blur' }],
memo: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
source: [{ required: true, message: '来源不能为空', trigger: 'blur' }],
}) })
const formRef = ref() // Ref const formRef = ref() // Ref

View File

@ -64,53 +64,53 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="访问事由" prop="visitReason"> <!-- <el-form-item label="访问事由" prop="visitReason">-->
<el-input <!-- <el-input-->
v-model="queryParams.visitReason" <!-- v-model="queryParams.visitReason"-->
placeholder="请输入访问事由" <!-- placeholder="请输入访问事由"-->
clearable <!-- clearable-->
@keyup.enter="handleQuery" <!-- @keyup.enter="handleQuery"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="放行类型" prop="openGateMode"> <!-- <el-form-item label="放行类型" prop="openGateMode">-->
<el-input <!-- <el-input-->
v-model="queryParams.openGateMode" <!-- v-model="queryParams.openGateMode"-->
placeholder="请输入放行类型" <!-- placeholder="请输入放行类型"-->
clearable <!-- clearable-->
@keyup.enter="handleQuery" <!-- @keyup.enter="handleQuery"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="匹配模式" prop="matchMode"> <!-- <el-form-item label="匹配模式" prop="matchMode">-->
<el-input <!-- <el-input-->
v-model="queryParams.matchMode" <!-- v-model="queryParams.matchMode"-->
placeholder="请输入匹配模式" <!-- placeholder="请输入匹配模式"-->
clearable <!-- clearable-->
@keyup.enter="handleQuery" <!-- @keyup.enter="handleQuery"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="是否开闸" prop="barriorOpen"> <!-- <el-form-item label="是否开闸" prop="barriorOpen">-->
<el-input <!-- <el-input-->
v-model="queryParams.barriorOpen" <!-- v-model="queryParams.barriorOpen"-->
placeholder="请输入是否开闸" <!-- placeholder="请输入是否开闸"-->
clearable <!-- clearable-->
@keyup.enter="handleQuery" <!-- @keyup.enter="handleQuery"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="开闸耗时" prop="costTime"> <!-- <el-form-item label="开闸耗时" prop="costTime">-->
<el-date-picker <!-- <el-date-picker-->
v-model="queryParams.costTime" <!-- v-model="queryParams.costTime"-->
value-format="YYYY-MM-DD HH:mm:ss" <!-- value-format="YYYY-MM-DD HH:mm:ss"-->
type="daterange" <!-- type="daterange"-->
start-placeholder="开始日期" <!-- start-placeholder="开始日期"-->
end-placeholder="结束日期" <!-- end-placeholder="结束日期"-->
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" <!-- :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"-->
class="!w-240px" <!-- class="!w-240px"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="创建时间" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
@ -125,14 +125,14 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
plain <!-- plain-->
@click="openForm('create')" <!-- @click="openForm('create')"-->
v-hasPermi="['parking:entry-record:create']" <!-- v-hasPermi="['parking:entry-record:create']"-->
> <!-- >-->
<Icon icon="ep:plus" class="mr-5px" /> 新增 <!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
</el-button> <!-- </el-button>-->
<el-button <el-button
type="success" type="success"
plain plain
@ -171,14 +171,14 @@
/> />
<el-table-column label="操作" align="center" fixed="right" width="110"> <el-table-column label="操作" align="center" fixed="right" width="110">
<template #default="scope"> <template #default="scope">
<el-button <!-- <el-button-->
link <!-- link-->
type="primary" <!-- type="primary"-->
@click="openForm('update', scope.row.id)" <!-- @click="openForm('update', scope.row.id)"-->
v-hasPermi="['parking:entry-record:update']" <!-- v-hasPermi="['parking:entry-record:update']"-->
> <!-- >-->
编辑 <!-- 编辑-->
</el-button> <!-- </el-button>-->
<el-button <el-button
link link
type="danger" type="danger"

View File

@ -147,6 +147,14 @@
<el-table-column label="部门" align="center" prop="dept" /> <el-table-column label="部门" align="center" prop="dept" />
<el-table-column label="备注" align="center" prop="memo" /> <el-table-column label="备注" align="center" prop="memo" />
<el-table-column label="来源" align="center" prop="source" /> <el-table-column label="来源" align="center" prop="source" />
<el-table-column label="车主姓名" align="center" prop="name" />
<el-table-column label="车子类型" align="center" prop="carType" />
<el-table-column label="地址id" align="center" prop="areaId" />
<el-table-column label="地址有效日期" align="center" prop="areaStart" />
<el-table-column label="地址失效日期" align="center" prop="areaEnd" />
<el-table-column label="地址" align="center" prop="address" />
<el-table-column label="手机号码" align="center" prop="phone" />
<el-table-column label="车牌颜色" align="center" prop="palteColor" />
<el-table-column <el-table-column
label="创建时间" label="创建时间"
align="center" align="center"

View File

@ -0,0 +1,92 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="航班名称" prop="flightName">
<el-input v-model="formData.flightName" placeholder="请输入航班名称" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { FlightApi, FlightVO } from '@/api/ticket/flight'
/** 航班 表单 */
defineOptions({ name: 'FlightForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
flightName: undefined,
})
const formRules = reactive({
flightName: [{ required: true, message: '航班名称不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await FlightApi.getFlight(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as FlightVO
if (formType.value === 'create') {
await FlightApi.createFlight(data)
message.success(t('common.createSuccess'))
} else {
await FlightApi.updateFlight(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
flightName: undefined,
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,187 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="航班名称" prop="flightName">
<el-input
v-model="queryParams.flightName"
placeholder="请输入航班名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['ticket:flight:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['ticket:flight:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="航班名称" align="center" prop="flightName" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['ticket:flight:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['ticket:flight:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<FlightForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { FlightApi, FlightVO } from '@/api/ticket/flight'
import FlightForm from './FlightForm.vue'
/** 航班 列表 */
defineOptions({ name: 'Flight' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<FlightVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
flightName: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await FlightApi.getFlightPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await FlightApi.deleteFlight(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await FlightApi.exportFlight(queryParams)
download.excel(data, '航班.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

View File

@ -0,0 +1,123 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<!-- <el-form-item label="归属航班" prop="flightId">
<el-input v-model="formData.flightId" placeholder="请输入航班" />
</el-form-item> -->
<el-form-item label="所属航班" prop="flightId">
<el-select v-model="formData.flightId" placeholder="请选择所属航班" clearable class="!w-240px">
<el-option v-for="flightNameOptions in option" :key="flightNameOptions.id"
:label="flightNameOptions.flightName" :value="flightNameOptions.id" />
</el-select>
</el-form-item>
<el-form-item label="航线名称" prop="routeName">
<el-input v-model="formData.routeName" placeholder="请输入航线名称" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ShipRouteApi, ShipRouteVO } from '@/api/ticket/shiproute'
import { FlightApi, FlightVO } from '@/api/ticket/flight'
/** 航线 表单 */
defineOptions({ name: 'ShipRouteForm' })
const { t } = useI18n() //
const message = useMessage() //
const loading = ref(true) //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const option = ref<FlightVO[]>([]);
const formData = ref({
id: undefined,
flightId: undefined,
routeName: undefined,
})
const formRules = reactive({
flightId: [{ required: true, message: '归属航班不能为空', trigger: 'blur' }],
routeName: [{ required: true, message: '航线名称不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await ShipRouteApi.getShipRoute(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
//
const getFlightName = async () => {
loading.value = true
try {
option.value = await FlightApi.getFlightName()
} finally {
loading.value = false
}
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as ShipRouteVO
if (formType.value === 'create') {
await ShipRouteApi.createShipRoute(data)
message.success(t('common.createSuccess'))
} else {
await ShipRouteApi.updateShipRoute(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
flightId: undefined,
routeName: undefined,
}
formRef.value?.resetFields()
}
/** 初始化 **/
onMounted(() => {
getFlightName()
})
</script>

View File

@ -0,0 +1,230 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<!-- <el-form-item label="归属航班" prop="flightId">
<el-input
v-model="queryParams.flightId"
placeholder="请输入航班"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> -->
<el-form-item label="所属航班" prop="flightId">
<el-select
v-model="queryParams.flightId"
placeholder="请选择属于航班"
clearable
class="!w-200px"
>
<el-option
v-for="flightNameOptions in option"
:key="flightNameOptions.id"
:label="flightNameOptions.flightName"
:value="flightNameOptions.id"
/>
</el-select>
</el-form-item>
<el-form-item label="航线名称" prop="routeName">
<el-input
v-model="queryParams.routeName"
placeholder="请输入航线名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['ticket:ship-route:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['ticket:ship-route:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="所属航班" align="center" prop="flightName" />
<el-table-column label="航线名称" align="center" prop="routeName" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['ticket:ship-route:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['ticket:ship-route:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ShipRouteForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { ShipRouteApi, ShipRouteVO } from '@/api/ticket/shiproute'
import ShipRouteForm from './ShipRouteForm.vue'
import { FlightApi, FlightVO } from '@/api/ticket/flight'
/** 航线 列表 */
defineOptions({ name: 'ShipRoute' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<ShipRouteVO[]>([]) //
const total = ref(0) //
const option = ref<FlightVO[]>([]);
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
flightId: undefined,
routeName: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ShipRouteApi.getShipRoutePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
//
const getFlightName = async () => {
loading.value = true
try {
option.value = await FlightApi.getFlightName()
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ShipRouteApi.deleteShipRoute(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ShipRouteApi.exportShipRoute(queryParams)
download.excel(data, '航线.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
getFlightName()
})
</script>

View File

@ -0,0 +1,136 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="航线" prop="shipRouteId">
<el-select v-model="formData.shipRouteId" placeholder="请选择所属航线" clearable class="!w-240px">
<el-option v-for="shipRouteNameOptions in option" :key="shipRouteNameOptions.id"
:label="shipRouteNameOptions.routeName" :value="shipRouteNameOptions.id" />
</el-select>
</el-form-item>
<el-form-item label="班次" prop="classes">
<el-input v-model="formData.classes" placeholder="请输入班次" />
</el-form-item>
<el-form-item label="出发时间" prop="startTime">
<el-time-select
v-model="formData.startTime"
start="05:00"
step="00:05"
end="20:00"
placeholder="选择出发时间"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { TodayFlightApi, TodayFlightVO } from '@/api/ticket/todayflight'
import { ShipRouteApi, ShipRouteVO } from '@/api/ticket/shiproute'
/** 今日航班 表单 */
defineOptions({ name: 'TodayFlightForm' })
const { t } = useI18n() //
const message = useMessage() //
// const value = ref('');
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const loading = ref(true) //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const option = ref<ShipRouteVO[]>([]);
const formData = ref({
id: undefined,
shipRouteId: undefined,
classes: undefined,
// flightDate: undefined,
startTime: undefined,
})
const formRules = reactive({
shipRouteId: [{ required: true, message: '航线不能为空', trigger: 'blur' }],
classes: [{ required: true, message: '班次不能为空', trigger: 'blur' }],
// flightDate: [{ required: true, message: '', trigger: 'blur' }],
startTime: [{ required: true, message: '出发时间不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await TodayFlightApi.getTodayFlight(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as TodayFlightVO
if (formType.value === 'create') {
await TodayFlightApi.createTodayFlight(data)
message.success(t('common.createSuccess'))
} else {
await TodayFlightApi.updateTodayFlight(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
//线
const getRouteName = async () => {
loading.value = true
try {
option.value = await ShipRouteApi.getRouteName()
} finally {
loading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
shipRouteId: undefined,
classes: undefined,
// flightDate: undefined,
startTime: undefined,
}
formRef.value?.resetFields()
}
/** 初始化 **/
onMounted(() => {
getRouteName()
})
</script>

View File

@ -0,0 +1,254 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<!-- <el-form-item label="航线" prop="shipRouteId">
<el-input
v-model="queryParams.shipRouteId"
placeholder="请输入航线"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> -->
<el-form-item label="航线" prop="shipRouteId">
<el-select
v-model="queryParams.shipRouteId"
placeholder="请选择属于航线"
clearable
class="!w-200px"
>
<el-option
v-for="shipRouteNameOptions in option"
:key="shipRouteNameOptions.id"
:label="shipRouteNameOptions.routeName"
:value="shipRouteNameOptions.id"
/>
</el-select>
</el-form-item>
<el-form-item label="班次" prop="classes">
<el-input
v-model="queryParams.classes"
placeholder="请输入班次"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<!-- <el-form-item label="当日日期" prop="flightDate">
<el-date-picker
v-model="queryParams.flightDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item> -->
<el-form-item label="出发时间" prop="startTime">
<el-date-picker
v-model="queryParams.startTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['ticket:today-flight:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['ticket:today-flight:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="航线" align="center" prop="shipRouteName" />
<el-table-column label="班次" align="center" prop="classes" />
<el-table-column label="出发时间" align="center" prop="startTime" width="180px"/>
<!-- <el-table-column label="当日日期" align="center" prop="flightDate" /> -->
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['ticket:today-flight:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['ticket:today-flight:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<TodayFlightForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { TodayFlightApi, TodayFlightVO } from '@/api/ticket/todayflight'
import TodayFlightForm from './TodayFlightForm.vue'
import { ShipRouteApi, ShipRouteVO } from '@/api/ticket/shiproute'
/** 今日航班 列表 */
defineOptions({ name: 'TodayFlight' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<TodayFlightVO[]>([]) //
const total = ref(0) //
const option = ref<ShipRouteVO[]>([]);
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
shipRouteId: undefined,
classes: undefined,
flightDate: [],
startTime: [],
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await TodayFlightApi.getTodayFlightPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
//线
const getRouteName = async () => {
loading.value = true
try {
option.value = await ShipRouteApi.getRouteName()
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await TodayFlightApi.deleteTodayFlight(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await TodayFlightApi.exportTodayFlight(queryParams)
download.excel(data, '今日航班.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
getRouteName()
})
</script>