Commit df25d19792cc7a93a49747bf6ed8dea7c31ec338

Authored by xp.Huang
2 parents da0c6dda 280eb9f0

Merge branch 'fix/data-board-share' into 'main_dev'

fix: 修复命令下发等接口未携带分享token

See merge request yunteng/thingskit-front!1228
@@ -44,6 +44,7 @@ export const getDeviceActiveTime = (entityId: string) => { @@ -44,6 +44,7 @@ export const getDeviceActiveTime = (entityId: string) => {
44 }, 44 },
45 { 45 {
46 joinPrefix: false, 46 joinPrefix: false,
  47 + withShareToken: true,
47 } 48 }
48 ); 49 );
49 }; 50 };
@@ -14,6 +14,7 @@ import { PaginationResult } from '/#/axios'; @@ -14,6 +14,7 @@ import { PaginationResult } from '/#/axios';
14 import { AlarmLogItem } from './model/deviceConfigModel'; 14 import { AlarmLogItem } from './model/deviceConfigModel';
15 import { omit } from 'lodash-es'; 15 import { omit } from 'lodash-es';
16 import { CommandDeliveryWayEnum } from '/@/enums/deviceEnum'; 16 import { CommandDeliveryWayEnum } from '/@/enums/deviceEnum';
  17 +import { isShareMode } from '/@/views/sys/share/hook';
17 enum DeviceManagerApi { 18 enum DeviceManagerApi {
18 /** 19 /**
19 * 设备URL 20 * 设备URL
@@ -137,9 +138,12 @@ export const createOrEditDevice = (data) => { @@ -137,9 +138,12 @@ export const createOrEditDevice = (data) => {
137 138
138 // 查询设备详情 139 // 查询设备详情
139 export const getDeviceDetail = (id: string) => { 140 export const getDeviceDetail = (id: string) => {
140 - return defHttp.get<DeviceRecord>({  
141 - url: DeviceManagerApi.DEVICE_URL + `/${id}`,  
142 - }); 141 + return defHttp.get<DeviceRecord>(
  142 + {
  143 + url: `${DeviceManagerApi.DEVICE_URL}${isShareMode() ? '/public' : ''}/${id}`,
  144 + },
  145 + { withShareToken: true }
  146 + );
143 }; 147 };
144 148
145 // 查询设备详情中的告警 149 // 查询设备详情中的告警
@@ -290,6 +294,7 @@ export const commandIssuanceApi = ( @@ -290,6 +294,7 @@ export const commandIssuanceApi = (
290 }, 294 },
291 { 295 {
292 joinPrefix: false, 296 joinPrefix: false,
  297 + withShareToken: true,
293 } 298 }
294 ); 299 );
295 }; 300 };
@@ -74,10 +74,13 @@ export const cancelTask = ( @@ -74,10 +74,13 @@ export const cancelTask = (
74 * @returns {string} 74 * @returns {string}
75 */ 75 */
76 export const genModbusCommand = (data: GenModbusCommandType) => { 76 export const genModbusCommand = (data: GenModbusCommandType) => {
77 - return defHttp.post<string>({  
78 - url: Api.GEN_MODBUS_COMMAND,  
79 - data,  
80 - }); 77 + return defHttp.post<string>(
  78 + {
  79 + url: Api.GEN_MODBUS_COMMAND,
  80 + data,
  81 + },
  82 + { withShareToken: true }
  83 + );
81 }; 84 };
82 85
83 export const immediateExecute = (data: ImmediateExecuteTaskType) => { 86 export const immediateExecute = (data: ImmediateExecuteTaskType) => {