本日开发新增 楼栋摄像头绑定前后端代码、楼栋图片前后端代码、楼栋信息注册前后端代码。
This commit is contained in:
1 parent
dd70b2c88d
commit
a69ff6ca77
9 files changed
+1110
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingInfoVoList/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingInfoVoList',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/buildingInfoVoList/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingInfoVoList',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingInfoVoList',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingManage/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingManage',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/buildingManage/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingManage',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingManage',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function delChildObj(ids?: Object) {
|
||||
return request({
|
||||
url: '/admin/buildingManage/child',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/hrmsBuildingPhotoList/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/hrmsBuildingPhotoList',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/hrmsBuildingPhotoList/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/admin/hrmsBuildingPhotoList',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/hrmsBuildingPhotoList',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="关联building_manage表的id" prop="buildingId">
|
||||
<el-input v-model="form.buildingId" placeholder="请输入关联building_manage表的id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="房屋名称." prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入房屋名称."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="房屋序号." prop="homeSh">
|
||||
<el-input v-model="form.homeSh" placeholder="请输入房屋序号."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="房屋状态." prop="homeState">
|
||||
<el-input v-model="form.homeState" placeholder="请输入房屋状态."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="操作类型,0:新增,1:修改,2:删除,3:其他(无任何操作)." prop="operate">
|
||||
<el-input v-model="form.operate" placeholder="请输入操作类型,0:新增,1:修改,2:删除,3:其他(无任何操作)."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="是否允许删除,1是用户新增的,允许删除,2是自动新增的,不允许删除." prop="allowDelete">
|
||||
<el-input v-model="form.allowDelete" placeholder="请输入是否允许删除,1是用户新增的,允许删除,2是自动新增的,不允许删除."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼层." prop="noFloor">
|
||||
<el-input v-model="form.noFloor" placeholder="请输入楼层."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单元号." prop="houseUnit">
|
||||
<el-input v-model="form.houseUnit" placeholder="请输入单元号."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="该层第几户." prop="noHouseHold">
|
||||
<el-input v-model="form.noHouseHold" placeholder="请输入该层第几户."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="房屋名称." prop="houseCode">
|
||||
<el-input v-model="form.houseCode" placeholder="请输入房屋名称."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BuildingInfoVoListDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/buildingManage/buildingInfoVoList'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
buildingId: '',
|
||||
name: '',
|
||||
homeSh: '',
|
||||
homeState: '',
|
||||
operate: '',
|
||||
allowDelete: '',
|
||||
noFloor: '',
|
||||
houseUnit: '',
|
||||
noHouseHold: '',
|
||||
houseCode: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取buildingInfoVoList信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getbuildingInfoVoListData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getbuildingInfoVoListData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'admin_buildingInfoVoList_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'admin_buildingInfoVoList_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'admin_buildingInfoVoList_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="buildingId" label="关联building_manage表的id" show-overflow-tooltip/>
|
||||
<el-table-column prop="name" label="房屋名称." show-overflow-tooltip/>
|
||||
<el-table-column prop="homeSh" label="房屋序号." show-overflow-tooltip/>
|
||||
<el-table-column prop="homeState" label="房屋状态." show-overflow-tooltip/>
|
||||
<el-table-column prop="operate" label="操作类型,0:新增,1:修改,2:删除,3:其他(无任何操作)." show-overflow-tooltip/>
|
||||
<el-table-column prop="allowDelete" label="是否允许删除,1是用户新增的,允许删除,2是自动新增的,不允许删除." show-overflow-tooltip/>
|
||||
<el-table-column prop="noFloor" label="楼层." show-overflow-tooltip/>
|
||||
<el-table-column prop="houseUnit" label="单元号." show-overflow-tooltip/>
|
||||
<el-table-column prop="noHouseHold" label="该层第几户." show-overflow-tooltip/>
|
||||
<el-table-column prop="houseCode" label="房屋名称." show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'admin_buildingInfoVoList_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_buildingInfoVoList_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemBuildingInfoVoList">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/buildingManage/buildingInfoVoList";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/buildingInfoVoList/export', Object.assign(state.queryForm, { ids: selectObjs }), 'buildingInfoVoList.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<el-drawer :title="form.id ? (detail ? '详情' : '编辑') : '添加'" v-model="visible" size="50%">
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" :disabled="detail" v-loading="loading">
|
||||
<el-row :gutter="72">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="建筑物类型" prop="buildType">
|
||||
<el-input v-model="form.buildType" placeholder="1->楼房;2->平房;3->其他"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="房屋用途" prop="houseUseFor">
|
||||
<el-input v-model="form.houseUseFor" placeholder="1->自用;2->出租;3->转租;4->商铺;5-> 空置"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="批量添加" prop="isBatchAdd">
|
||||
<el-input v-model="form.isBatchAdd" placeholder="0->否;1->是"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋序号" prop="buildingNum">
|
||||
<el-input v-model="form.buildingNum" placeholder="请输入楼栋序号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋开始序号" prop="startNum">
|
||||
<el-input v-model="form.startNum" placeholder="请输入楼栋开始序号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋结束序号" prop="endNum">
|
||||
<el-input v-model="form.endNum" placeholder="请输入楼栋结束序号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="建筑地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入建筑地址"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单元数" prop="dwellingUnits">
|
||||
<el-input v-model="form.dwellingUnits" placeholder="请输入单元数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="地面层数" prop="groundFloor">
|
||||
<el-input v-model="form.groundFloor" placeholder="请输入地面层数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="每层户数" prop="houseSperFloor">
|
||||
<el-input v-model="form.houseSperFloor" placeholder="请输入每层户数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="地下层数" prop="undergroundLayers">
|
||||
<el-input v-model="form.undergroundLayers" placeholder="请输入地下层数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="经度" prop="mapX">
|
||||
<el-input v-model="form.mapX" placeholder="请输入经度"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="纬度" prop="mapY">
|
||||
<el-input v-model="form.mapY" placeholder="请输入纬度"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="所属小区ID" prop="blockId">
|
||||
<el-input v-model="form.blockId" placeholder="请输入所属小区ID"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="所属小区名称" prop="blockName">
|
||||
<el-input v-model="form.blockName" placeholder="请输入所属小区名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="建筑面积" prop="area">
|
||||
<el-input v-model="form.area" placeholder="请输入建筑面积/m²"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="地下是否入住" prop="isLiveUnderground">
|
||||
<el-input v-model="form.isLiveUnderground" placeholder="0->否;1->是"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="建筑年份" prop="buildDate">
|
||||
<el-input v-model="form.buildDate" placeholder="yyyy-MM"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入楼栋描述."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋负责人ID" prop="buildingPersonId">
|
||||
<el-input v-model="form.buildingPersonId" placeholder="请输入楼栋负责人ID."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="同步添加默认住户" prop="isAddPerson">
|
||||
<el-input v-model="form.isAddPerson" placeholder="0->否;1->是"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<sc-form-table
|
||||
v-model="form.buildingInfoVoListList"
|
||||
:addTemplate="childTemp"
|
||||
@delete="deleteChild"
|
||||
placeholder="暂无数据"
|
||||
>
|
||||
<el-table-column label="房屋名称" prop="name">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.name`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.name" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋序号" prop="homeSh">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.homeSh`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.homeSh" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋状态." prop="homeState">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.homeState`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.homeState" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作类型" prop="operate">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.operate`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.operate" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否允许删除" prop="allowDelete">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.allowDelete`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.allowDelete" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="楼层" prop="noFloor">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.noFloor`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.noFloor" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单元号" prop="houseUnit">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.houseUnit`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.houseUnit" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="该层第几户" prop="noHouseHold">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.noHouseHold`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.noHouseHold" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="房屋名称" prop="houseCode">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`buildingInfoVoListList.${$index}.houseCode`" :rules="[{ required: true, trigger: 'blur' }]">
|
||||
<el-input v-model="row.houseCode" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BuildingManageDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, delChildObj } from '/@/api/buildingManage/buildingManage'
|
||||
const scFormTable = defineAsyncComponent(() => import('/@/components/FormTable/index.vue'));
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
const detail = ref(false);
|
||||
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
buildType: '',
|
||||
houseUseFor: '',
|
||||
isBatchAdd: '',
|
||||
buildingNum: '',
|
||||
startNum: '',
|
||||
endNum: '',
|
||||
address: '',
|
||||
dwellingUnits: '',
|
||||
groundFloor: '',
|
||||
houseSperFloor: '',
|
||||
undergroundLayers: '',
|
||||
mapX: '',
|
||||
mapY: '',
|
||||
blockId: '',
|
||||
blockName: '',
|
||||
area: '',
|
||||
isLiveUnderground: '',
|
||||
buildDate: '',
|
||||
description: '',
|
||||
buildingPersonId: '',
|
||||
isAddPerson: '',
|
||||
buildingInfoVoListList:[],
|
||||
});
|
||||
|
||||
const childTemp = reactive({
|
||||
id: '',
|
||||
buildingId: '',
|
||||
name: '',
|
||||
homeSh: '',
|
||||
homeState: '',
|
||||
operate: '',
|
||||
allowDelete: '',
|
||||
noFloor: '',
|
||||
houseUnit: '',
|
||||
noHouseHold: '',
|
||||
houseCode: '',
|
||||
createBy: '',
|
||||
updateBy: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
delFlag: '',
|
||||
tenantId: '',
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string, isDetail: boolean) => {
|
||||
visible.value = true
|
||||
detail.value = isDetail
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
form.buildingInfoVoListList = [];
|
||||
});
|
||||
|
||||
// 获取buildingManage信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getBuildingManageData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
// 删除子表数据
|
||||
const deleteChild = async (obj: { id: string }) => {
|
||||
if (obj.id) {
|
||||
try {
|
||||
await delChildObj([obj.id]);
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getBuildingManageData = (id: string) => {
|
||||
// 获取数据
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'admin_buildingManage_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'admin_buildingManage_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'admin_buildingManage_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangeHandle" @sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="buildType" label="建筑物类型" show-overflow-tooltip/>
|
||||
<el-table-column prop="houseUseFor" label="房屋用途" show-overflow-tooltip/>
|
||||
<el-table-column prop="isBatchAdd" label="批量添加" show-overflow-tooltip/>
|
||||
<el-table-column prop="buildingNum" label="楼栋序号" show-overflow-tooltip/>
|
||||
<el-table-column prop="startNum" label="楼栋开始序号" show-overflow-tooltip/>
|
||||
<el-table-column prop="endNum" label="楼栋结束序号" show-overflow-tooltip/>
|
||||
<el-table-column prop="address" label="建筑地址" show-overflow-tooltip/>
|
||||
<el-table-column prop="dwellingUnits" label="单元数" show-overflow-tooltip/>
|
||||
<el-table-column prop="groundFloor" label="地面层数" show-overflow-tooltip/>
|
||||
<el-table-column prop="houseSperFloor" label="每层户数" show-overflow-tooltip/>
|
||||
<el-table-column prop="undergroundLayers" label="地下层数" show-overflow-tooltip/>
|
||||
<el-table-column prop="mapX" label="经度" show-overflow-tooltip/>
|
||||
<el-table-column prop="mapY" label="纬度" show-overflow-tooltip/>
|
||||
<el-table-column prop="blockId" label="所属小区ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="blockName" label="所属小区名称" show-overflow-tooltip/>
|
||||
<el-table-column prop="area" label="建筑面积/m²" show-overflow-tooltip/>
|
||||
<el-table-column prop="isLiveUnderground" label="地下是否入住" show-overflow-tooltip/>
|
||||
<el-table-column prop="buildDate" label="建筑年份" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" label="楼栋描述" show-overflow-tooltip/>
|
||||
<el-table-column prop="buildingPersonId" label="楼栋负责人ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="isAddPerson" label="同步添加默认住户" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button text type="primary" icon="view" v-auth="'sys_role_edit'" @click="formDialogRef.openDialog(scope.row.id, true)">
|
||||
详情
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'admin_buildingManage_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_buildingManage_del'" @click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemBuildingManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/buildingManage/buildingManage";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/buildingManage/export', Object.assign(state.queryForm, { ids: selectObjs }), 'buildingManage.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangeHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="关联building_manage表的id" prop="buildingId">
|
||||
<el-input v-model="form.buildingId" placeholder="请输入关联building_manage表的id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋照片相对路径,,完整地址参考OSS方式." prop="photoUrl">
|
||||
<el-input v-model="form.photoUrl" placeholder="请输入楼栋照片相对路径,,完整地址参考OSS方式."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="楼栋照片名称." prop="photoName">
|
||||
<el-input v-model="form.photoName" placeholder="请输入楼栋照片名称."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="照片类型【-1:全部,0:方位,1:外观,2:门牌】." prop="photoType">
|
||||
<el-input v-model="form.photoType" placeholder="请输入照片类型【-1:全部,0:方位,1:外观,2:门牌】."/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="是否是封面【0-否,1-是】。" prop="isCover">
|
||||
<el-input v-model="form.isCover" placeholder="请输入是否是封面【0-否,1-是】。"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="HrmsBuildingPhotoListDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/buildingManage/hrmsBuildingPhotoList'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
buildingId: '',
|
||||
photoUrl: '',
|
||||
photoName: '',
|
||||
photoType: '',
|
||||
isCover: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取hrmsBuildingPhotoList信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
gethrmsBuildingPhotoListData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const gethrmsBuildingPhotoListData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'admin_hrmsBuildingPhotoList_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'admin_hrmsBuildingPhotoList_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'admin_hrmsBuildingPhotoList_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="buildingId" label="关联building_manage表的id" show-overflow-tooltip/>
|
||||
<el-table-column prop="photoUrl" label="楼栋照片相对路径,,完整地址参考OSS方式." show-overflow-tooltip/>
|
||||
<el-table-column prop="photoName" label="楼栋照片名称." show-overflow-tooltip/>
|
||||
<el-table-column prop="photoType" label="照片类型【-1:全部,0:方位,1:外观,2:门牌】." show-overflow-tooltip/>
|
||||
<el-table-column prop="isCover" label="是否是封面【0-否,1-是】。" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'admin_hrmsBuildingPhotoList_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_hrmsBuildingPhotoList_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemHrmsBuildingPhotoList">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/buildingManage/hrmsBuildingPhotoList";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/admin/hrmsBuildingPhotoList/export', Object.assign(state.queryForm, { ids: selectObjs }), 'hrmsBuildingPhotoList.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in new issue
Block a user