feat(sis): 电梯信息关联楼层
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -61,9 +61,9 @@ export function floorRemove(id: ID | IDS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据单元ID查询楼层
|
* 根据楼层ID查询楼层
|
||||||
* @param id id
|
* @param id id
|
||||||
*/
|
*/
|
||||||
export function queryByUnitId(id: ID | IDS) {
|
export function queryByBuildingId(id: ID | IDS) {
|
||||||
return requestClient.get<FloorVO[]>(`/property/floor/queryByUnitId/${id}`);
|
return requestClient.get<FloorVO[]>(`/property/floor/queryByBuildingId/${id}`);
|
||||||
}
|
}
|
||||||
|
@@ -107,6 +107,11 @@ export interface ElevatorInfoVO {
|
|||||||
deviceIp: string,
|
deviceIp: string,
|
||||||
deviceId: number,
|
deviceId: number,
|
||||||
}[]
|
}[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建筑ID
|
||||||
|
*/
|
||||||
|
buildingId?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ElevatorInfoForm extends BaseEntity {
|
export interface ElevatorInfoForm extends BaseEntity {
|
||||||
@@ -206,10 +211,9 @@ export interface ElevatorInfoForm extends BaseEntity {
|
|||||||
controlPwd?: string
|
controlPwd?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单元ID
|
* 建筑ID
|
||||||
*/
|
*/
|
||||||
unitId?: number
|
buildingId?: number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ElevatorInfoQuery extends PageQuery {
|
export interface ElevatorInfoQuery extends PageQuery {
|
||||||
|
@@ -105,7 +105,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'TreeSelect',
|
component: 'TreeSelect',
|
||||||
fieldName: 'unitId',
|
fieldName: 'buildingId',
|
||||||
defaultValue: undefined,
|
defaultValue: undefined,
|
||||||
label: '社区建筑',
|
label: '社区建筑',
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref, reactive } from 'vue'
|
||||||
|
import { Tabs, TabPane, Form, FormItem, Space, Input } from 'ant-design-vue'
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui'
|
import { useVbenModal } from '@vben/common-ui'
|
||||||
import { $t } from '@vben/locales'
|
import { $t } from '@vben/locales'
|
||||||
@@ -15,9 +16,11 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
|||||||
|
|
||||||
import { modalSchema } from './data'
|
import { modalSchema } from './data'
|
||||||
import { communityTree } from '#/api/property/community'
|
import { communityTree } from '#/api/property/community'
|
||||||
|
import { queryByBuildingId } from '#/api/property/floor'
|
||||||
import type { DeviceManageForm, DeviceManageQuery } from '#/api/sis/deviceManage/model'
|
import type { DeviceManageForm, DeviceManageQuery } from '#/api/sis/deviceManage/model'
|
||||||
import { deviceManageList } from '#/api/sis/deviceManage'
|
import { deviceManageList } from '#/api/sis/deviceManage'
|
||||||
|
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>()
|
const emit = defineEmits<{ reload: [] }>()
|
||||||
|
|
||||||
const isUpdate = ref(false)
|
const isUpdate = ref(false)
|
||||||
@@ -69,18 +72,26 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
if (isUpdate.value && id) {
|
if (isUpdate.value && id) {
|
||||||
const record = await elevatorInfoInfo(id)
|
const record = await elevatorInfoInfo(id)
|
||||||
record.elevatorControlDeviceId = {
|
|
||||||
value: record.elevatorControlDeviceId.deviceId,
|
if (record.elevatorControlDeviceId) {
|
||||||
deviceIp: record.elevatorControlDeviceId.deviceIp,
|
record.elevatorControlDeviceId = {
|
||||||
deviceId: record.elevatorControlDeviceId.deviceId,
|
value: record.elevatorControlDeviceId.deviceId,
|
||||||
|
deviceIp: record.elevatorControlDeviceId.deviceIp,
|
||||||
|
deviceId: record.elevatorControlDeviceId.deviceId,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
record.remoteCallElevatorDeviceId = record.remoteCallElevatorDeviceId.map(item => ({
|
if (record.remoteCallElevatorDeviceId) {
|
||||||
value: item.deviceId,
|
record.remoteCallElevatorDeviceId = record.remoteCallElevatorDeviceId.map(item => {
|
||||||
deviceIp: item.deviceIp,
|
return {
|
||||||
deviceId: item.deviceId,
|
value: item.deviceId,
|
||||||
}));
|
deviceIp: item.deviceIp,
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await handleGetFloor(record.buildingId)
|
||||||
await formApi.setValues(record)
|
await formApi.setValues(record)
|
||||||
}
|
}
|
||||||
await markInitialized()
|
await markInitialized()
|
||||||
@@ -98,7 +109,16 @@ async function handleConfirm() {
|
|||||||
}
|
}
|
||||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
const data = cloneDeep(await formApi.getValues())
|
const data = cloneDeep(await formApi.getValues())
|
||||||
console.log(data)
|
// 通道信息
|
||||||
|
const filteredChannels = dynamicValidateForm.floor
|
||||||
|
.filter(item => !(item.out.length === 0 && item.in.length === 0))
|
||||||
|
.map(item => ({
|
||||||
|
floorId: item.id,
|
||||||
|
inChannel: item.in,
|
||||||
|
outChannel: item.out
|
||||||
|
}))
|
||||||
|
|
||||||
|
data.channels = filteredChannels
|
||||||
await (isUpdate.value ? elevatorInfoUpdate(data) : elevatorInfoAdd(data))
|
await (isUpdate.value ? elevatorInfoUpdate(data) : elevatorInfoAdd(data))
|
||||||
resetInitialized()
|
resetInitialized()
|
||||||
emit('reload')
|
emit('reload')
|
||||||
@@ -183,6 +203,9 @@ async function setupCommunitySelect() {
|
|||||||
value: 'code',
|
value: 'code',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
},
|
},
|
||||||
|
onChange: async (value: any) => {
|
||||||
|
await handleGetFloor(value)
|
||||||
|
},
|
||||||
getPopupContainer,
|
getPopupContainer,
|
||||||
placeholder: '请选择建筑',
|
placeholder: '请选择建筑',
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
@@ -194,11 +217,41 @@ async function setupCommunitySelect() {
|
|||||||
// 选中后显示在输入框的值
|
// 选中后显示在输入框的值
|
||||||
treeNodeLabelProp: 'fullName',
|
treeNodeLabelProp: 'fullName',
|
||||||
}),
|
}),
|
||||||
fieldName: 'unitId',
|
fieldName: 'buildingId',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface floor {
|
||||||
|
out: string
|
||||||
|
in: string
|
||||||
|
num: string | number
|
||||||
|
id: string | number
|
||||||
|
}
|
||||||
|
const floorList = ref<floor[]>([])
|
||||||
|
const dynamicValidateForm = reactive<{ floor: floor[] }>({
|
||||||
|
floor: [],
|
||||||
|
})
|
||||||
|
async function handleGetFloor(unitId: string | number) {
|
||||||
|
try {
|
||||||
|
const res = await queryByBuildingId(unitId)
|
||||||
|
floorList.value = []
|
||||||
|
res.forEach((item) => {
|
||||||
|
floorList.value.push({
|
||||||
|
out: '',
|
||||||
|
in: '',
|
||||||
|
num: item.floorNumber,
|
||||||
|
id: item.id,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
dynamicValidateForm.floor = floorList.value
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取楼层列表失败:', error)
|
||||||
|
floorList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function handleClosed() {
|
async function handleClosed() {
|
||||||
await formApi.resetForm()
|
await formApi.resetForm()
|
||||||
resetInitialized()
|
resetInitialized()
|
||||||
@@ -207,6 +260,23 @@ async function handleClosed() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicModal :title="title">
|
<BasicModal :title="title">
|
||||||
<BasicForm />
|
<Tabs style="height: 600px !important">
|
||||||
|
<TabPane key="1" tab="基本信息">
|
||||||
|
<BasicForm />
|
||||||
|
</TabPane>
|
||||||
|
<TabPane key="2" tab="楼层信息">
|
||||||
|
<Form :model="dynamicValidateForm" layout="inline">
|
||||||
|
<Space v-for="(floor, index) in dynamicValidateForm.floor" :key="floor.id"
|
||||||
|
style="display: flex; margin-bottom: 8px" align="baseline">
|
||||||
|
<FormItem :label="'楼层' + (floor.num)" :name="['floor', index, 'out']">
|
||||||
|
<Input v-model:value="floor.out" placeholder="外部按键通道" />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem :name="['floor', index, 'in']">
|
||||||
|
<Input v-model:value="floor.in" placeholder="内部按键通道" />
|
||||||
|
</FormItem>
|
||||||
|
</Space>
|
||||||
|
</Form>
|
||||||
|
</TabPane>
|
||||||
|
</Tabs>
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
Reference in New Issue
Block a user