|
@@ -1,48 +1,14 @@
|
|
|
<template>
|
|
|
<div class="system-dic-container">
|
|
|
- <el-card shadow="hover">
|
|
|
+ <div>
|
|
|
<div class="system-user-search mb15">
|
|
|
<el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="68px">
|
|
|
- <el-form-item label="所属组织" prop="organizationId">
|
|
|
- <el-tree-select
|
|
|
- v-model="tableData.param.organizationId"
|
|
|
- :data="orgList"
|
|
|
- :props="{
|
|
|
- label: 'name',
|
|
|
- children: 'children'
|
|
|
- }"
|
|
|
- placeholder="请选择"
|
|
|
- node-key="id"
|
|
|
- :clearable="true"
|
|
|
- check-strictly
|
|
|
- style="width: 100%;"
|
|
|
- :render-after-expand="true"
|
|
|
- size="default"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="小区名称" prop="plotId">
|
|
|
- <el-select v-model="tableData.param.plotId" @change="onPlotChange" placeholder="选择小区名称" filterable clearable size="default">
|
|
|
- <el-option
|
|
|
- v-for="item in plotList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="楼宇名称" prop="floorId">
|
|
|
- <el-select v-model="tableData.param.floorId" placeholder="选择楼宇名称" filterable clearable size="default">
|
|
|
- <el-option
|
|
|
- v-for="item in floorList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="单元名称" prop="name">
|
|
|
<el-input v-model="tableData.param.name" placeholder="请输入单元名称" clearable size="default" style="width: 240px" @keyup.enter="queryList" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="单元号" prop="number">
|
|
|
+ <el-input v-model="tableData.param.number" placeholder="请输入单元号" clearable size="default" style="width: 240px" @keyup.enter="queryList" />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button size="default" type="primary" class="ml10" @click="queryList">
|
|
|
<el-icon>
|
|
@@ -62,19 +28,13 @@
|
|
|
</el-icon>
|
|
|
新增
|
|
|
</el-button>
|
|
|
- <!-- <el-button size="default" type="danger" class="ml10" @click="onRowDel(null)">
|
|
|
- <el-icon>
|
|
|
- <ele-Delete />
|
|
|
- </el-icon>
|
|
|
- 删除
|
|
|
- </el-button> -->
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<el-table :data="tableData.data" v-loading="tableData.loading" style="width: 100%" >
|
|
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
|
<el-table-column label="ID" align="center" prop="id" width="60" />
|
|
|
- <el-table-column label="组织名称" prop="organizationInfo.name" min-width="100" />
|
|
|
+ <el-table-column label="区域名称" prop="organizationInfo.name" min-width="100" />
|
|
|
<el-table-column label="小区名称" prop="plotInfo.name" min-width="100" />
|
|
|
<el-table-column label="楼宇名称" prop="floorInfo.name" min-width="100" />
|
|
|
<el-table-column label="楼号" prop="floorInfo.number" min-width="100" />
|
|
@@ -95,14 +55,14 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<pagination v-show="tableData.total>0" :total="tableData.total" v-model:page="tableData.param.pageNum" v-model:limit="tableData.param.pageSize" @pagination="queryList" />
|
|
|
- </el-card>
|
|
|
+ </div>
|
|
|
<EditDic ref="editDicRef" @queryList="queryList" />
|
|
|
<Detail ref="detailRef" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue';
|
|
|
+import { toRefs, reactive, onMounted, ref, defineComponent, watch } from 'vue';
|
|
|
import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
|
|
|
import EditDic from './component/edit.vue';
|
|
|
import Detail from './component/detail.vue';
|
|
@@ -112,7 +72,18 @@ import systemApi from '/@/api/system';
|
|
|
export default defineComponent({
|
|
|
name: 'loop',
|
|
|
components: { EditDic,Detail },
|
|
|
- setup() {
|
|
|
+ props: {
|
|
|
+ organizationId: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ plotId: {
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ floorId: {
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setup(prop) {
|
|
|
const addDicRef = ref();
|
|
|
const editDicRef = ref();
|
|
|
const detailRef=ref();
|
|
@@ -127,43 +98,13 @@ export default defineComponent({
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
name: '',
|
|
|
- plotId: '',
|
|
|
- floorId: '',
|
|
|
+ number: '',
|
|
|
organizationId: '',
|
|
|
+ floorId: '',
|
|
|
status: -1
|
|
|
},
|
|
|
},
|
|
|
});
|
|
|
- // 组织
|
|
|
- const orgList = ref([])
|
|
|
- // 小区
|
|
|
- const plotList = ref([])
|
|
|
- // 楼宇
|
|
|
- const floorList = ref([])
|
|
|
- // 初始化表格数据
|
|
|
- const initTableData = () => {
|
|
|
- queryList();
|
|
|
- };
|
|
|
- // 获取组织
|
|
|
- const getOrgList = () => {
|
|
|
- systemApi.org.getList({ name: '', status: -1 }).then((res: any) => {
|
|
|
- orgList.value = res;
|
|
|
- });
|
|
|
- }
|
|
|
- // 获取区域
|
|
|
- const getPlotList = () => {
|
|
|
- api.regionalManage.allList({})
|
|
|
- .then((res: any) => {
|
|
|
- plotList.value = res.Info || []
|
|
|
- })
|
|
|
- }
|
|
|
- // 获取楼宇
|
|
|
- const getFloorList = () => {
|
|
|
- api.floor.allList({ plotId: state.tableData.param.plotId })
|
|
|
- .then((res: any) => {
|
|
|
- floorList.value = res.Info || []
|
|
|
- })
|
|
|
- }
|
|
|
const queryList = () => {
|
|
|
state.tableData.loading = true
|
|
|
api.unit.getList(state.tableData.param).then((res: any) => {
|
|
@@ -173,22 +114,25 @@ export default defineComponent({
|
|
|
state.tableData.loading = false
|
|
|
});
|
|
|
};
|
|
|
- const onPlotChange = () => {
|
|
|
- floorList.value = []
|
|
|
- state.tableData.param.floorId = ''
|
|
|
- if (state.tableData.param.plotId) {
|
|
|
- getFloorList()
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ watch(() => prop.floorId, () => {
|
|
|
+ state.tableData.param.organizationId = prop.organizationId
|
|
|
+ state.tableData.param.floorId = prop.floorId
|
|
|
+ queryList()
|
|
|
+ }, {
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ })
|
|
|
+
|
|
|
//查看详情
|
|
|
const onOpenDetail=(row: any)=>{
|
|
|
detailRef.value.openDialog(row);
|
|
|
}
|
|
|
// 打开新增修改弹窗
|
|
|
const onOpenDialog = (row: any) => {
|
|
|
- editDicRef.value.orgList = orgList.value
|
|
|
- editDicRef.value.plotList = plotList.value
|
|
|
- editDicRef.value.openDialog(row);
|
|
|
+ // editDicRef.value.orgList = orgList.value
|
|
|
+ // editDicRef.value.plotList = plotList.value
|
|
|
+ editDicRef.value.openDialog(row, { organizationId: prop.organizationId, floorId: prop.floorId });
|
|
|
};
|
|
|
|
|
|
// 状态修改
|
|
@@ -226,11 +170,9 @@ export default defineComponent({
|
|
|
.catch(() => {});
|
|
|
};
|
|
|
// 页面加载时
|
|
|
- onMounted(() => {
|
|
|
- initTableData();
|
|
|
- getOrgList();
|
|
|
- getPlotList()
|
|
|
- });
|
|
|
+ // onMounted(() => {
|
|
|
+ // queryList();
|
|
|
+ // });
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return;
|
|
@@ -248,10 +190,6 @@ export default defineComponent({
|
|
|
onRowDel,
|
|
|
queryList,
|
|
|
resetQuery,
|
|
|
- orgList,
|
|
|
- plotList,
|
|
|
- floorList,
|
|
|
- onPlotChange,
|
|
|
handleStatusChange,
|
|
|
...toRefs(state),
|
|
|
};
|