物联设备增加过滤条件

main
liutao 10 hours ago
parent 0736edf8af
commit 741b4d7dc1

@ -2,6 +2,7 @@ import request from '@/config/axios'
export interface DeviceOperationOverviewParams {
ids?: string
deviceType?: number
startTime?: string
endTime?: string
timelinePageNo?: number

@ -21,6 +21,7 @@ export interface DeviceOperationRecordVO {
export interface DeviceOperationRecordPageParams {
pageNo: number
pageSize: number
deviceType?: number
deviceCode?: string
deviceName?: string
startTime?: string

@ -73,7 +73,12 @@ export const OrganizationApi = {
return await request.download({ url: `/mes/organization/export-excel`, params })
},
deviceParameterAnalysis: async (params: { keyword?: string, showDevices?: number, filterNoDeviceLine?: number }) => {
deviceParameterAnalysis: async (params: {
keyword?: string
deviceType?: number
showDevices?: number
filterNoDeviceLine?: number
}) => {
return await request.get({ url: `/mes/device-line/deviceParameterAnalysis`, params })
}
}

@ -44,6 +44,16 @@
<el-option v-for="item in modelList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="formData.deviceType" placeholder="请选择设备类型">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.IOT_DEVICE_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="t('EquipmentManagement.EquipmentLedger.images')" prop="images">
<UploadImg style="height: 100px" v-model="formData.images" />
</el-form-item>
@ -102,10 +112,9 @@
</Dialog>
</template>
<script setup lang="ts">
import { getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import { getStrDictOptions,getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import { DeviceApi, DeviceVO } from '@/api/iot/device'
import {DeviceModelApi, DeviceModelVO} from "@/api/iot/devicemodel";
/** 物联设备 表单 */
defineOptions({ name: 'DeviceForm' })
@ -193,12 +202,13 @@ const submitForm = async () => {
//
formLoading.value = true
try {
const { id, deviceCode, deviceName, deviceModelId, sampleCycle, remark, isEnable, topic,images } = formData.value as any
const { id, deviceCode, deviceName,deviceType, deviceModelId, sampleCycle, remark, isEnable, topic,images } = formData.value as any
if (formType.value === 'create') {
const data: Partial<DeviceVO> = {
deviceCode,
deviceName,
deviceType,
deviceModelId,
sampleCycle,
remark,
@ -208,11 +218,11 @@ const submitForm = async () => {
await DeviceApi.createDevice(data as DeviceVO)
message.success(t('common.createSuccess'))
} else if (formType.value === 'update') {
const data: any = { id, deviceCode, deviceName, deviceModelId, sampleCycle, isEnable,images}
const data: any = { id, deviceCode, deviceName,deviceType, deviceModelId, sampleCycle, isEnable,images}
await DeviceApi.updateDevice(data)
message.success(t('common.updateSuccess'))
} else {
const data: any = { id, deviceCode, deviceName, deviceModelId, isEnable, topic,images}
const data: any = { id, deviceCode, deviceName,deviceType, deviceModelId, isEnable, topic,images}
await DeviceApi.updateDevice(data)
message.success(t('common.updateSuccess'))
}

@ -147,6 +147,7 @@ import {QuestionFilled} from "@element-plus/icons-vue";
defineOptions({ name: 'IotRunReport' })
const { t } = useI18n()
const IOT_DEVICE_TYPE = 2
const loading = ref(false)
const list = ref<DeviceOperationRecordVO[]>([])
@ -188,6 +189,7 @@ const buildQueryParams = (): DeviceOperationRecordPageParams => {
return {
pageNo: queryParams.pageNo,
pageSize: queryParams.pageSize,
deviceType: IOT_DEVICE_TYPE,
deviceCode: queryParams.deviceCode,
deviceName: queryParams.deviceName,
startTime,

@ -314,6 +314,7 @@ const currentDeviceIds = computed(() =>
)
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
const IOT_DEVICE_TYPE = 2
const normalizeDateTime = (value: string, fallback: string) => {
const parsed = dayjs(value)
@ -348,6 +349,7 @@ const buildOverviewRequestParams = () => {
const [startTime, endTime] = syncSafeTimeRange()
return {
ids: currentDeviceIds.value.join(','),
deviceType: IOT_DEVICE_TYPE,
startTime,
endTime,
timelinePageNo: pageNo.value,
@ -416,6 +418,7 @@ const getDeviceLedgerOptions = async (groupId?: string) => {
const getFilterOptions = async () => {
const deviceLineTree = await OrganizationApi.deviceParameterAnalysis({
keyword: undefined,
deviceType: IOT_DEVICE_TYPE,
showDevices: 1,
filterNoDeviceLine: 1
})

Loading…
Cancel
Save