车辆管理界面搭建
This commit is contained in:
164
src/views/system/cars/addCars.vue
Normal file
164
src/views/system/cars/addCars.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="AddBuildingBox">
|
||||
<PageHeader :title="userid ? '编辑房屋租赁' : '添加房屋租赁'"></PageHeader>
|
||||
<div class="AddBuildingBody">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="left" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车牌号" prop="houseId">
|
||||
<el-input v-model.trim="form.rentalName" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车辆品牌" prop="rentalName">
|
||||
<el-input v-model.trim="form.rentalName" placeholder="请输入住户姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车辆型号" prop="remark">
|
||||
<el-input v-model.trim="form.supInfo" placeholder="请输入补充房屋信息" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"></el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="车声颜色" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="车辆照片" prop="email"> </el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="持有人">
|
||||
<!-- 公共组件 持有人 -->
|
||||
<Holder :isedit="userid === null" @change="handleChange"></Holder>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="email">
|
||||
<el-input type="textarea" :rows="5" v-model.trim="form.email" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="cancelForm">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
houseId: null,
|
||||
rentalName: '', // 租户姓名
|
||||
rent: null, // 租金
|
||||
houseFace: '', // 房屋朝向
|
||||
rentalType: 0, // 整租合租
|
||||
phone: null, //手机号
|
||||
houseArea: null, // 房屋面积
|
||||
floorNo: null, //楼层号
|
||||
inTime: '', //入住时间
|
||||
facilities: '', //房屋设施
|
||||
houseImageUrl: '', //房屋图片
|
||||
supInfo: '', //补充租房信息
|
||||
vx: '', //微信
|
||||
houseUse: 0, //房屋用途
|
||||
rentalStatus: 0, //租赁状态
|
||||
email: '' //邮箱
|
||||
});
|
||||
const rules = ref({
|
||||
houseId: [{ required: true, message: '请选择房屋', trigger: 'blur' }],
|
||||
rentalName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
||||
});
|
||||
const userid = ref(null);
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
}
|
||||
});
|
||||
};
|
||||
// 推出
|
||||
const cancelForm = () => {
|
||||
router.push({
|
||||
path: '/house/parkingList'
|
||||
});
|
||||
};
|
||||
|
||||
// 选择住户
|
||||
function handleChange(pop) {
|
||||
console.log(pop);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.AddBuildingBox {
|
||||
padding: 15px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.AddBuildingBody {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: white;
|
||||
padding: 15px;
|
||||
.title {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding-left: 20px;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
color: rgba(16, 16, 16, 1);
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.formBody {
|
||||
width: 1050px;
|
||||
margin: 0 auto;
|
||||
&:deep(.el-form-item__content, .el-select, .el-input) {
|
||||
width: 350px !important;
|
||||
margin-right: 10px;
|
||||
.el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.el-form-item {
|
||||
margin-bottom: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.el-button {
|
||||
width: 80px;
|
||||
height: 35px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
277
src/views/system/cars/index.vue
Normal file
277
src/views/system/cars/index.vue
Normal file
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<Pageheader title="添加房屋租赁"></Pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="持有人" prop="residentId">
|
||||
<el-input v-model="queryParams.residentId" placeholder="请输入持有人id(住户表id)" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车牌号" prop="carNum">
|
||||
<el-input v-model="queryParams.carNum" placeholder="请输入车牌号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['car:car:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['car:car:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['car:car:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="carList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="车牌号" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="车辆品牌" align="center" prop="areaId" />
|
||||
<el-table-column label="车辆型号" align="center" prop="parkingId" />
|
||||
<el-table-column label="车身颜色" align="center" prop="residentId" />
|
||||
<el-table-column label="持有人" align="center" prop="carNum" />
|
||||
<el-table-column label="备注" align="center" prop="carBrand" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['car:car:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['car:car:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<!-- 添加或修改车辆管理对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="carFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="区域id" prop="areaId">
|
||||
<el-input v-model="form.areaId" placeholder="请输入区域id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车位id" prop="parkingId">
|
||||
<el-input v-model="form.parkingId" placeholder="请输入车位id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="持有人id(住户表id)" prop="residentId">
|
||||
<el-input v-model="form.residentId" placeholder="请输入持有人id(住户表id)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车牌号" prop="carNum">
|
||||
<el-input v-model="form.carNum" placeholder="请输入车牌号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车辆品牌" prop="carBrand">
|
||||
<el-input v-model="form.carBrand" placeholder="请输入车辆品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车辆型号" prop="carModel">
|
||||
<el-input v-model="form.carModel" placeholder="请输入车辆型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车身颜色" prop="carColor">
|
||||
<el-input v-model="form.carColor" placeholder="请输入车身颜色" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="车辆图片url" prop="carImageUrl">
|
||||
<el-input v-model="form.carImageUrl" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建者" prop="createBy">
|
||||
<el-input v-model="form.createBy" placeholder="请输入创建者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker clearable v-model="form.createTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="修改者" prop="updateBy">
|
||||
<el-input v-model="form.updateBy" placeholder="请输入修改者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="修改时间" prop="updateTime">
|
||||
<el-date-picker clearable v-model="form.updateTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择修改时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Car" lang="ts">
|
||||
import Pageheader from '@/components/Pageheader/index.vue';
|
||||
import { listCar, getCar, delCar, addCar, updateCar } from '@/api/system/cars/index';
|
||||
import { CarVO, CarQuery, CarForm } from '@/api/system/cars/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const carList = ref<CarVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const carFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: CarForm = {
|
||||
id: undefined,
|
||||
areaId: undefined,
|
||||
parkingId: undefined,
|
||||
residentId: undefined,
|
||||
carNum: undefined,
|
||||
carBrand: undefined,
|
||||
carModel: undefined,
|
||||
carColor: undefined,
|
||||
remark: undefined,
|
||||
carImageUrl: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
const data = reactive<PageData<CarForm, CarQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
areaId: undefined,
|
||||
parkingId: undefined,
|
||||
residentId: undefined,
|
||||
carNum: undefined,
|
||||
carBrand: undefined,
|
||||
carModel: undefined,
|
||||
carColor: undefined,
|
||||
carImageUrl: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '车辆管理表id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询车辆管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listCar(queryParams.value);
|
||||
carList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
carFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: CarVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/carArea/addCars'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: CarVO) => {
|
||||
router.push({
|
||||
path: '/carArea/addCars',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
carFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateCar(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addCar(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: CarVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除车辆管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delCar(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'car/car/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`car_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user