停车场-白名单配置

This commit is contained in:
XinWei 2024-07-30 14:55:30 +08:00
parent d1a26b469b
commit a44ef732d4
3 changed files with 611 additions and 0 deletions

View File

@ -0,0 +1,56 @@
import request from '@/config/axios'
// 白名单配置 VO
export interface WhitelistDeliveryVO {
id: number // id
parkNumber: string // 场库编号
size: number // 白名单数量
plate: string // 车牌号
chargeType: string // 收费类型
name: string // 车主姓名
certificate: string // 身份证信息
address: string // 车主联系地址
phone: string // 车主联系电话
plateColor: string // 车牌颜色
start: string // 生效日期
end: string // 失效日期
dept: string // 部门
carType: string // 车辆类型
memo: string // 备注
areaId: number // 区域Id
areaStart: string // 生效日期
areaEnd: string // 失效日期
}
// 白名单配置 API
export const WhitelistDeliveryApi = {
// 查询白名单配置分页
getWhitelistDeliveryPage: async (params: any) => {
return await request.get({ url: `/parking/whitelist-delivery/page`, params })
},
// 查询白名单配置详情
getWhitelistDelivery: async (id: number) => {
return await request.get({ url: `/parking/whitelist-delivery/get?id=` + id })
},
// 新增白名单配置
createWhitelistDelivery: async (data: WhitelistDeliveryVO) => {
return await request.post({ url: `/parking/whitelist-delivery/create`, data })
},
// 修改白名单配置
updateWhitelistDelivery: async (data: WhitelistDeliveryVO) => {
return await request.put({ url: `/parking/whitelist-delivery/update`, data })
},
// 删除白名单配置
deleteWhitelistDelivery: async (id: number) => {
return await request.delete({ url: `/parking/whitelist-delivery/delete?id=` + id })
},
// 导出白名单配置 Excel
exportWhitelistDelivery: async (params) => {
return await request.download({ url: `/parking/whitelist-delivery/export-excel`, params })
},
}

View File

@ -0,0 +1,186 @@
<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="parkNumber">
<el-input v-model="formData.parkNumber" placeholder="请输入场库编号" />
</el-form-item>
<el-form-item label="白名单数量" prop="size">
<el-input v-model="formData.size" placeholder="请输入白名单数量" />
</el-form-item>
<el-form-item label="车牌号" prop="plate">
<el-input v-model="formData.plate" placeholder="请输入车牌号" />
</el-form-item>
<el-form-item label="收费类型" prop="chargeType">
<el-select v-model="formData.chargeType" placeholder="请选择收费类型">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="车主姓名" prop="name">
<el-input v-model="formData.name" placeholder="请输入车主姓名" />
</el-form-item>
<el-form-item label="身份证信息" prop="certificate">
<el-input v-model="formData.certificate" placeholder="请输入身份证信息" />
</el-form-item>
<el-form-item label="车主联系地址" prop="address">
<el-input v-model="formData.address" placeholder="请输入车主联系地址" />
</el-form-item>
<el-form-item label="车主联系电话" prop="phone">
<el-input v-model="formData.phone" placeholder="请输入车主联系电话" />
</el-form-item>
<el-form-item label="车牌颜色" prop="plateColor">
<el-input v-model="formData.plateColor" placeholder="请输入车牌颜色" />
</el-form-item>
<el-form-item label="生效日期" prop="start">
<el-input v-model="formData.start" placeholder="请输入生效日期" />
</el-form-item>
<el-form-item label="失效日期" prop="end">
<el-input v-model="formData.end" placeholder="请输入失效日期" />
</el-form-item>
<el-form-item label="部门" prop="dept">
<el-input v-model="formData.dept" placeholder="请输入部门" />
</el-form-item>
<el-form-item label="车辆类型" prop="carType">
<el-select v-model="formData.carType" placeholder="请选择车辆类型">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="memo">
<el-input v-model="formData.memo" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="区域Id" prop="areaId">
<el-input v-model="formData.areaId" placeholder="请输入区域Id" />
</el-form-item>
<el-form-item label="生效日期" prop="areaStart">
<el-date-picker
v-model="formData.areaStart"
type="date"
value-format="x"
placeholder="选择生效日期"
/>
</el-form-item>
<el-form-item label="失效日期" prop="areaEnd">
<el-date-picker
v-model="formData.areaEnd"
type="date"
value-format="x"
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 { WhitelistDeliveryApi, WhitelistDeliveryVO } from '@/api/parking/whitelistdelivery'
/** 白名单配置 表单 */
defineOptions({ name: 'WhitelistDeliveryForm' })
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,
parkNumber: undefined,
size: undefined,
plate: undefined,
chargeType: undefined,
name: undefined,
certificate: undefined,
address: undefined,
phone: undefined,
plateColor: undefined,
start: undefined,
end: undefined,
dept: undefined,
carType: undefined,
memo: undefined,
areaId: undefined,
areaStart: undefined,
areaEnd: undefined,
})
const formRules = reactive({
parkNumber: [{ 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 WhitelistDeliveryApi.getWhitelistDelivery(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 WhitelistDeliveryVO
if (formType.value === 'create') {
await WhitelistDeliveryApi.createWhitelistDelivery(data)
message.success(t('common.createSuccess'))
} else {
await WhitelistDeliveryApi.updateWhitelistDelivery(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
parkNumber: undefined,
size: undefined,
plate: undefined,
chargeType: undefined,
name: undefined,
certificate: undefined,
address: undefined,
phone: undefined,
plateColor: undefined,
start: undefined,
end: undefined,
dept: undefined,
carType: undefined,
memo: undefined,
areaId: undefined,
areaStart: undefined,
areaEnd: undefined,
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,369 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="场库编号" prop="parkNumber">
<el-input
v-model="queryParams.parkNumber"
placeholder="请输入场库编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="白名单数量" prop="size">
<el-input
v-model="queryParams.size"
placeholder="请输入白名单数量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="车牌号" prop="plate">
<el-input
v-model="queryParams.plate"
placeholder="请输入车牌号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="收费类型" prop="chargeType">
<el-select
v-model="queryParams.chargeType"
placeholder="请选择收费类型"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="车主姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入车主姓名"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="身份证信息" prop="certificate">
<el-input
v-model="queryParams.certificate"
placeholder="请输入身份证信息"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="车主联系地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入车主联系地址"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="车主联系电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入车主联系电话"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="车牌颜色" prop="plateColor">
<el-input
v-model="queryParams.plateColor"
placeholder="请输入车牌颜色"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="生效日期" prop="start">
<el-input
v-model="queryParams.start"
placeholder="请输入生效日期"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="失效日期" prop="end">
<el-input
v-model="queryParams.end"
placeholder="请输入失效日期"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="部门" prop="dept">
<el-input
v-model="queryParams.dept"
placeholder="请输入部门"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="车辆类型" prop="carType">
<el-select
v-model="queryParams.carType"
placeholder="请选择车辆类型"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="memo">
<el-input
v-model="queryParams.memo"
placeholder="请输入备注"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="区域Id" prop="areaId">
<el-input
v-model="queryParams.areaId"
placeholder="请输入区域Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="生效日期" prop="areaStart">
<el-date-picker
v-model="queryParams.areaStart"
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="areaEnd">
<el-date-picker
v-model="queryParams.areaEnd"
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="['parking:whitelist-delivery:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['parking:whitelist-delivery: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="parkNumber" />
<el-table-column label="白名单数量" align="center" prop="size" />
<el-table-column label="车牌号" align="center" prop="plate" />
<el-table-column label="收费类型" align="center" prop="chargeType" />
<el-table-column label="车主姓名" align="center" prop="name" />
<el-table-column label="身份证信息" align="center" prop="certificate" />
<el-table-column label="车主联系地址" align="center" prop="address" />
<el-table-column label="车主联系电话" align="center" prop="phone" />
<el-table-column label="车牌颜色" align="center" prop="plateColor" />
<el-table-column label="生效日期" align="center" prop="start" />
<el-table-column label="失效日期" align="center" prop="end" />
<el-table-column label="部门" align="center" prop="dept" />
<el-table-column label="车辆类型" align="center" prop="carType" />
<el-table-column label="备注" align="center" prop="memo" />
<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="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="['parking:whitelist-delivery:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['parking:whitelist-delivery: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>
<!-- 表单弹窗添加/修改 -->
<WhitelistDeliveryForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { WhitelistDeliveryApi, WhitelistDeliveryVO } from '@/api/parking/whitelistdelivery'
import WhitelistDeliveryForm from './WhitelistDeliveryForm.vue'
/** 白名单配置 列表 */
defineOptions({ name: 'WhitelistDelivery' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<WhitelistDeliveryVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
parkNumber: undefined,
size: undefined,
plate: undefined,
chargeType: undefined,
name: undefined,
certificate: undefined,
address: undefined,
phone: undefined,
plateColor: undefined,
start: [],
end: [],
dept: undefined,
carType: undefined,
memo: undefined,
areaId: undefined,
areaStart: [],
areaEnd: [],
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await WhitelistDeliveryApi.getWhitelistDeliveryPage(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 WhitelistDeliveryApi.deleteWhitelistDelivery(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await WhitelistDeliveryApi.exportWhitelistDelivery(queryParams)
download.excel(data, '白名单配置.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>