diff --git a/package.json b/package.json index a321aa9..61baacc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "circular-json": "^0.5.9", "dayjs": "^1.11.6", "echarts": "^5.4.1", - "element-plus": "^2.7.6", + "element-plus": "^2.7.8", "file-saver": "^2.0.5", "hotkeys-js": "^3.10.0", "html2canvas": "^1.4.1", diff --git a/package.json b/package.json index a321aa9..61baacc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "circular-json": "^0.5.9", "dayjs": "^1.11.6", "echarts": "^5.4.1", - "element-plus": "^2.7.6", + "element-plus": "^2.7.8", "file-saver": "^2.0.5", "hotkeys-js": "^3.10.0", "html2canvas": "^1.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c39d5f8..2e6406c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,7 +39,7 @@ specifier: ^5.4.1 version: 5.4.1 element-plus: - specifier: ^2.7.6 + specifier: ^2.7.8 version: 2.7.8(vue@3.2.44) file-saver: specifier: ^2.0.5 diff --git a/package.json b/package.json index a321aa9..61baacc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "circular-json": "^0.5.9", "dayjs": "^1.11.6", "echarts": "^5.4.1", - "element-plus": "^2.7.6", + "element-plus": "^2.7.8", "file-saver": "^2.0.5", "hotkeys-js": "^3.10.0", "html2canvas": "^1.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c39d5f8..2e6406c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,7 +39,7 @@ specifier: ^5.4.1 version: 5.4.1 element-plus: - specifier: ^2.7.6 + specifier: ^2.7.8 version: 2.7.8(vue@3.2.44) file-saver: specifier: ^2.0.5 diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts index e1220f7..64d3b96 100644 --- a/src/api/home/device/device.ts +++ b/src/api/home/device/device.ts @@ -29,6 +29,24 @@ data, }) } + +// 新建点位 +export function addPosition(data: any) { + return request({ + url: '/system/busLedgerPipe/addPosition', + method: 'post', + data, + }) +} +// 点位列表 + +export function getPositionListPage(data: any) { + return request({ + url: `/system/busLedgerPipe/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} // 编辑设备 export function editDevice(data: any) { return request({ diff --git a/package.json b/package.json index a321aa9..61baacc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "circular-json": "^0.5.9", "dayjs": "^1.11.6", "echarts": "^5.4.1", - "element-plus": "^2.7.6", + "element-plus": "^2.7.8", "file-saver": "^2.0.5", "hotkeys-js": "^3.10.0", "html2canvas": "^1.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c39d5f8..2e6406c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,7 +39,7 @@ specifier: ^5.4.1 version: 5.4.1 element-plus: - specifier: ^2.7.6 + specifier: ^2.7.8 version: 2.7.8(vue@3.2.44) file-saver: specifier: ^2.0.5 diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts index e1220f7..64d3b96 100644 --- a/src/api/home/device/device.ts +++ b/src/api/home/device/device.ts @@ -29,6 +29,24 @@ data, }) } + +// 新建点位 +export function addPosition(data: any) { + return request({ + url: '/system/busLedgerPipe/addPosition', + method: 'post', + data, + }) +} +// 点位列表 + +export function getPositionListPage(data: any) { + return request({ + url: `/system/busLedgerPipe/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} // 编辑设备 export function editDevice(data: any) { return request({ diff --git a/src/views/home/device/device/components/addDialog.vue b/src/views/home/device/device/components/addDialog.vue index 4c9f349..c422262 100644 --- a/src/views/home/device/device/components/addDialog.vue +++ b/src/views/home/device/device/components/addDialog.vue @@ -16,7 +16,7 @@ import { addDevice, editDevice } from '@/api/home/device/device' const emits = defineEmits(['refresh']) const dataFormRef = ref() -const dialogFormVisible = ref(false) // 对话框是否显示 +const dialogFormVisible1 = ref(false) // 对话框是否显示 const dialogStatus = ref('') // 对话框类型:create,update const dataForm = ref({ productId: '', // 产品 @@ -32,6 +32,7 @@ deptName: '', lng: '', lat: '', + ledgerIds: [] as string[], }) // 表单 const textMap: { [key: string]: string } = { edit: '编辑', @@ -42,6 +43,8 @@ typeName: [{ required: true, message: '设备类型不能为空', trigger: ['blur', 'change'] }], devcode: [{ required: true, message: '设备编号不能为空', trigger: ['blur', 'change'] }], valid: [{ required: true, message: '在用情况不能为空', trigger: ['blur', 'change'] }], + leftLength: [{ required: true, message: '左侧指示带长度不能为空', trigger: ['blur', 'change'] }], + rightLength: [{ required: true, message: '右侧指示带长度不能为空', trigger: ['blur', 'change'] }], } // 前端校验规则 // 重置表单 @@ -60,13 +63,16 @@ deptName: '', lng: '', lat: '', + ledgerIds: [], } } - +// 是否燃气监测桩 +const isGaspile = ref(false) // 初始化对话框 const initDialog = (dialogStatusValue: string, row: any) => { + isGaspile.value = false dialogStatus.value = dialogStatusValue - dialogFormVisible.value = true + dialogFormVisible1.value = true if (dialogStatus.value === 'add') { // 如果是新增,清除验证 resetForm() dataFormRef.value?.resetFields() @@ -93,7 +99,7 @@ type: 'success', }) // 通知父组件刷新状态 - dialogFormVisible.value = false + dialogFormVisible1.value = false setTimeout(() => { emits('refresh') }) @@ -108,6 +114,19 @@ const updateData = () => { dataFormRef.value.validate((valid: any) => { if (valid) { + // const data = { + // "devcode": "121212", + // "deviceModel": "", + // "deviceName": "测试设备", + // "deviceType": 4, + // "installDate": "2024-08-19", + // "ledgerIds": [121212], + // "productId": 1468539134214225926, + // "rightLength": "", + // "secretKey": "", + // "tagNumber": "121212", + // "watchObject": "2" + // } editDevice(dataForm.value).then((response) => { if (response.code === 200) { ElMessage({ @@ -118,7 +137,7 @@ setTimeout(() => { emits('refresh') }) - dialogFormVisible.value = false + dialogFormVisible1.value = false } }).catch((_) => { // 异常情况,loading置为false }) @@ -136,7 +155,7 @@ } } const cancel = () => { - dialogFormVisible.value = false + dialogFormVisible1.value = false } const productList = ref([]) // 产品列表 const deviceTypeList = ref([]) // 设备类型列表 @@ -170,6 +189,12 @@ if (newVal) { dataForm.value.deviceType = productList.value.filter((item: any) => item.id === newVal)[0].deviceType dataForm.value.watchObject = deviceTypeList.value.filter((item: any) => item.id === dataForm.value.deviceType)[0].watchObject + + // 燃气监测桩 指示带长度字段为必填 + const deviceTypeName = deviceTypeList.value.filter((item: any) => item.id === dataForm.value.deviceType)[0].typeName + if (deviceTypeName === '燃气监测桩') { + isGaspile.value = true + } } }, { deep: true, @@ -195,13 +220,24 @@ } } // 确认安装位置 -const comfirmLocation = (data: any) => { +const comfirmLocation = (data: any, type: 'single' | 'multi') => { console.log(data, '确认安装位置') - dataForm.value.tagNumber = data.tagNumber - dataForm.value.position = data.position - dataForm.value.deptName = data.deptName - dataForm.value.lat = data.latGaode - dataForm.value.lng = data.lngGaode + if (type === 'single') { + dataForm.value.tagNumber = data.tagNumber + dataForm.value.position = data.position + dataForm.value.deptName = data.deptName + dataForm.value.lat = data.latGaode + dataForm.value.lng = data.lngGaode + dataForm.value.ledgerIds = [data.id] + } + else { + dataForm.value.tagNumber = data[0].tagNumber + dataForm.value.position = data[0].position + dataForm.value.deptName = data[0].deptName + dataForm.value.lat = data[0].latGaode + dataForm.value.lng = data[0].lngGaode + dataForm.value.ledgerIds = data.map((item: { id: string }) => item.id) + } } @@ -210,7 +246,7 @@ - + @@ -281,15 +317,39 @@ - + + + + + + + + + + + + + - + - + diff --git a/package.json b/package.json index a321aa9..61baacc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "circular-json": "^0.5.9", "dayjs": "^1.11.6", "echarts": "^5.4.1", - "element-plus": "^2.7.6", + "element-plus": "^2.7.8", "file-saver": "^2.0.5", "hotkeys-js": "^3.10.0", "html2canvas": "^1.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c39d5f8..2e6406c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,7 +39,7 @@ specifier: ^5.4.1 version: 5.4.1 element-plus: - specifier: ^2.7.6 + specifier: ^2.7.8 version: 2.7.8(vue@3.2.44) file-saver: specifier: ^2.0.5 diff --git a/src/api/home/device/device.ts b/src/api/home/device/device.ts index e1220f7..64d3b96 100644 --- a/src/api/home/device/device.ts +++ b/src/api/home/device/device.ts @@ -29,6 +29,24 @@ data, }) } + +// 新建点位 +export function addPosition(data: any) { + return request({ + url: '/system/busLedgerPipe/addPosition', + method: 'post', + data, + }) +} +// 点位列表 + +export function getPositionListPage(data: any) { + return request({ + url: `/system/busLedgerPipe/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} // 编辑设备 export function editDevice(data: any) { return request({ diff --git a/src/views/home/device/device/components/addDialog.vue b/src/views/home/device/device/components/addDialog.vue index 4c9f349..c422262 100644 --- a/src/views/home/device/device/components/addDialog.vue +++ b/src/views/home/device/device/components/addDialog.vue @@ -16,7 +16,7 @@ import { addDevice, editDevice } from '@/api/home/device/device' const emits = defineEmits(['refresh']) const dataFormRef = ref() -const dialogFormVisible = ref(false) // 对话框是否显示 +const dialogFormVisible1 = ref(false) // 对话框是否显示 const dialogStatus = ref('') // 对话框类型:create,update const dataForm = ref({ productId: '', // 产品 @@ -32,6 +32,7 @@ deptName: '', lng: '', lat: '', + ledgerIds: [] as string[], }) // 表单 const textMap: { [key: string]: string } = { edit: '编辑', @@ -42,6 +43,8 @@ typeName: [{ required: true, message: '设备类型不能为空', trigger: ['blur', 'change'] }], devcode: [{ required: true, message: '设备编号不能为空', trigger: ['blur', 'change'] }], valid: [{ required: true, message: '在用情况不能为空', trigger: ['blur', 'change'] }], + leftLength: [{ required: true, message: '左侧指示带长度不能为空', trigger: ['blur', 'change'] }], + rightLength: [{ required: true, message: '右侧指示带长度不能为空', trigger: ['blur', 'change'] }], } // 前端校验规则 // 重置表单 @@ -60,13 +63,16 @@ deptName: '', lng: '', lat: '', + ledgerIds: [], } } - +// 是否燃气监测桩 +const isGaspile = ref(false) // 初始化对话框 const initDialog = (dialogStatusValue: string, row: any) => { + isGaspile.value = false dialogStatus.value = dialogStatusValue - dialogFormVisible.value = true + dialogFormVisible1.value = true if (dialogStatus.value === 'add') { // 如果是新增,清除验证 resetForm() dataFormRef.value?.resetFields() @@ -93,7 +99,7 @@ type: 'success', }) // 通知父组件刷新状态 - dialogFormVisible.value = false + dialogFormVisible1.value = false setTimeout(() => { emits('refresh') }) @@ -108,6 +114,19 @@ const updateData = () => { dataFormRef.value.validate((valid: any) => { if (valid) { + // const data = { + // "devcode": "121212", + // "deviceModel": "", + // "deviceName": "测试设备", + // "deviceType": 4, + // "installDate": "2024-08-19", + // "ledgerIds": [121212], + // "productId": 1468539134214225926, + // "rightLength": "", + // "secretKey": "", + // "tagNumber": "121212", + // "watchObject": "2" + // } editDevice(dataForm.value).then((response) => { if (response.code === 200) { ElMessage({ @@ -118,7 +137,7 @@ setTimeout(() => { emits('refresh') }) - dialogFormVisible.value = false + dialogFormVisible1.value = false } }).catch((_) => { // 异常情况,loading置为false }) @@ -136,7 +155,7 @@ } } const cancel = () => { - dialogFormVisible.value = false + dialogFormVisible1.value = false } const productList = ref([]) // 产品列表 const deviceTypeList = ref([]) // 设备类型列表 @@ -170,6 +189,12 @@ if (newVal) { dataForm.value.deviceType = productList.value.filter((item: any) => item.id === newVal)[0].deviceType dataForm.value.watchObject = deviceTypeList.value.filter((item: any) => item.id === dataForm.value.deviceType)[0].watchObject + + // 燃气监测桩 指示带长度字段为必填 + const deviceTypeName = deviceTypeList.value.filter((item: any) => item.id === dataForm.value.deviceType)[0].typeName + if (deviceTypeName === '燃气监测桩') { + isGaspile.value = true + } } }, { deep: true, @@ -195,13 +220,24 @@ } } // 确认安装位置 -const comfirmLocation = (data: any) => { +const comfirmLocation = (data: any, type: 'single' | 'multi') => { console.log(data, '确认安装位置') - dataForm.value.tagNumber = data.tagNumber - dataForm.value.position = data.position - dataForm.value.deptName = data.deptName - dataForm.value.lat = data.latGaode - dataForm.value.lng = data.lngGaode + if (type === 'single') { + dataForm.value.tagNumber = data.tagNumber + dataForm.value.position = data.position + dataForm.value.deptName = data.deptName + dataForm.value.lat = data.latGaode + dataForm.value.lng = data.lngGaode + dataForm.value.ledgerIds = [data.id] + } + else { + dataForm.value.tagNumber = data[0].tagNumber + dataForm.value.position = data[0].position + dataForm.value.deptName = data[0].deptName + dataForm.value.lat = data[0].latGaode + dataForm.value.lng = data[0].lngGaode + dataForm.value.ledgerIds = data.map((item: { id: string }) => item.id) + } } @@ -210,7 +246,7 @@ - + @@ -281,15 +317,39 @@ - + + + + + + + + + + + + + - + - + diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 687266f..64294e1 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -76,7 +76,7 @@