|
@@ -7,6 +7,7 @@ import { test } from 'node:test'
|
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
|
|
|
|
|
|
import { usePointLocateStore } from '../src/modules/cockpit/stores/pointLocateStore.js'
|
|
import { usePointLocateStore } from '../src/modules/cockpit/stores/pointLocateStore.js'
|
|
|
|
|
+import { useDetailStore } from '../src/modules/cockpit/stores/detailStore.js'
|
|
|
import { workOrderRows } from '../src/modules/cockpit/domain/equipmentDetailView.js'
|
|
import { workOrderRows } from '../src/modules/cockpit/domain/equipmentDetailView.js'
|
|
|
import { planModeLayers } from '../src/modules/cockpit/domain/modeLayerPlan.js'
|
|
import { planModeLayers } from '../src/modules/cockpit/domain/modeLayerPlan.js'
|
|
|
|
|
|
|
@@ -25,6 +26,7 @@ const point = {
|
|
|
code: 'MP-131',
|
|
code: 'MP-131',
|
|
|
name: '测试点位',
|
|
name: '测试点位',
|
|
|
status: 'ALARM',
|
|
status: 'ALARM',
|
|
|
|
|
+ industry: 'DRAINAGE',
|
|
|
deviceCodes: ['DEV-131'],
|
|
deviceCodes: ['DEV-131'],
|
|
|
longitude: device.longitude,
|
|
longitude: device.longitude,
|
|
|
latitude: device.latitude,
|
|
latitude: device.latitude,
|
|
@@ -55,6 +57,8 @@ test('关联设备定位:越过宿主点位飞到设备自身坐标,再进
|
|
|
kind: 'monitoring-device',
|
|
kind: 'monitoring-device',
|
|
|
code: 'DEV-131',
|
|
code: 'DEV-131',
|
|
|
name: '测试设备',
|
|
name: '测试设备',
|
|
|
|
|
+ typeName: '环境监测终端(污水)',
|
|
|
|
|
+ industry: 'DRAINAGE',
|
|
|
status: 'NORMAL',
|
|
status: 'NORMAL',
|
|
|
longitude: device.longitude,
|
|
longitude: device.longitude,
|
|
|
latitude: device.latitude,
|
|
latitude: device.latitude,
|
|
@@ -75,9 +79,43 @@ test('关联设备定位:越过宿主点位飞到设备自身坐标,再进
|
|
|
assert.equal(calls.selectDevice[0].code, 'DEV-131')
|
|
assert.equal(calls.selectDevice[0].code, 'DEV-131')
|
|
|
assert.equal(calls.selectDevice[0].options.locateTarget.code, 'MP-131')
|
|
assert.equal(calls.selectDevice[0].options.locateTarget.code, 'MP-131')
|
|
|
assert.equal(calls.selectDevice[0].options.locateTarget.deviceCode, 'DEV-131')
|
|
assert.equal(calls.selectDevice[0].options.locateTarget.deviceCode, 'DEV-131')
|
|
|
|
|
+ assert.equal(calls.selectDevice[0].options.locateTarget.device.industry, 'DRAINAGE')
|
|
|
assert.deepEqual(calls.selectDevice[0].options.locateTarget.device, deviceTarget)
|
|
assert.deepEqual(calls.selectDevice[0].options.locateTarget.device, deviceTarget)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+test('关联设备卡没有 industry 时继承点位,类型徽标不空', async () => {
|
|
|
|
|
+ setActivePinia(createPinia())
|
|
|
|
|
+ const detail = useDetailStore()
|
|
|
|
|
+ detail.setSection('pointDetail', {
|
|
|
|
|
+ state: 'success',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ code: 'MP-131',
|
|
|
|
|
+ devices: [{
|
|
|
|
|
+ code: 'DEV-131',
|
|
|
|
|
+ name: '测试设备',
|
|
|
|
|
+ typeName: '环境监测终端(污水)',
|
|
|
|
|
+ status: 'NORMAL',
|
|
|
|
|
+ longitude: device.longitude,
|
|
|
|
|
+ latitude: device.latitude,
|
|
|
|
|
+ coordinate,
|
|
|
|
|
+ }],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ const locator = usePointLocateStore()
|
|
|
|
|
+ let flown = null
|
|
|
|
|
+ const result = await locator.locateTarget({ kind: 'map-object', code: 'DEV-131' }, {
|
|
|
|
|
+ objects: [point],
|
|
|
|
|
+ mapReady: true,
|
|
|
|
|
+ openPoint: async () => {},
|
|
|
|
|
+ flyPoint: async (object) => { flown = object; return true },
|
|
|
|
|
+ selectDevice: async () => {},
|
|
|
|
|
+ })
|
|
|
|
|
+ assert.equal(result.result, 'ok')
|
|
|
|
|
+ assert.equal(flown.code, 'DEV-131')
|
|
|
|
|
+ assert.equal(flown.industry, 'DRAINAGE', '设备卡无 industry 时必须继承点位行业')
|
|
|
|
|
+ assert.equal(flown.typeName, '环境监测终端(污水)')
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
test('事件回联:走完整视角飞行 + 高亮,不再只换中心', async () => {
|
|
test('事件回联:走完整视角飞行 + 高亮,不再只换中心', async () => {
|
|
|
setActivePinia(createPinia())
|
|
setActivePinia(createPinia())
|
|
|
const locator = usePointLocateStore()
|
|
const locator = usePointLocateStore()
|