Commit 062f1a79939c05333e81b94ed401612e583e6f37

Authored by ww
1 parent e3623ff6

fix: DEFECT-919 device detail click product jump gateway device

@@ -8,6 +8,8 @@ import moment from 'moment'; @@ -8,6 +8,8 @@ import moment from 'moment';
8 import { h } from 'vue'; 8 import { h } from 'vue';
9 import { Button } from 'ant-design-vue'; 9 import { Button } from 'ant-design-vue';
10 import { TypeEnum } from './data'; 10 import { TypeEnum } from './data';
  11 +import { PageEnum } from '/@/enums/pageEnum';
  12 +import { useGo } from '/@/hooks/web/usePage';
11 13
12 // 设备详情的描述 14 // 设备详情的描述
13 export const descSchema = (emit: EmitType): DescItem[] => { 15 export const descSchema = (emit: EmitType): DescItem[] => {
@@ -27,11 +29,15 @@ export const descSchema = (emit: EmitType): DescItem[] => { @@ -27,11 +29,15 @@ export const descSchema = (emit: EmitType): DescItem[] => {
27 { 29 {
28 field: 'deviceProfile.name', 30 field: 'deviceProfile.name',
29 label: '产品', 31 label: '产品',
30 - render(val, data) {  
31 - if (TypeEnum.SENSOR !== data.deviceType) return val; 32 + render(val) {
  33 + const go = useGo();
32 return h( 34 return h(
33 Button, 35 Button,
34 - { type: 'link', style: { padding: 0 }, onClick: () => emit('open-gateway-device', data) }, 36 + {
  37 + type: 'link',
  38 + style: { padding: 0 },
  39 + onClick: () => go(PageEnum.DEVICE_PROFILE + '?name=' + String(val)),
  40 + },
35 { default: () => val } 41 { default: () => val }
36 ); 42 );
37 }, 43 },
@@ -40,6 +46,14 @@ export const descSchema = (emit: EmitType): DescItem[] => { @@ -40,6 +46,14 @@ export const descSchema = (emit: EmitType): DescItem[] => {
40 field: 'gatewayName', 46 field: 'gatewayName',
41 label: '所属网关', 47 label: '所属网关',
42 show: (data) => !!data.gatewayName, 48 show: (data) => !!data.gatewayName,
  49 + render(val, data) {
  50 + if (TypeEnum.SENSOR !== data.deviceType) return val;
  51 + return h(
  52 + Button,
  53 + { type: 'link', style: { padding: 0 }, onClick: () => emit('open-gateway-device', data) },
  54 + { default: () => val }
  55 + );
  56 + },
43 }, 57 },
44 { 58 {
45 field: 'deviceType', 59 field: 'deviceType',