Commit cc798613a88f68a1f6e69cde894eba628017fad7

Authored by loveumiko
1 parent 3a85fa18

fix: 场景联动创建的时候添加参数isSceneLinkage

... ... @@ -5,10 +5,13 @@ import { isString } from '/@/utils/is';
5 5 import { OrderByEnum } from '/@/views/device/localtion/cpns/TimePeriodForm/config';
6 6
7 7 // 获取设备配置,很多地方使用,不能修改这里
8   -export const getDeviceProfile = (deviceType?: string) => {
  8 +export const getDeviceProfile = (deviceType?: string, isSceneLinkage?: Boolean) => {
9 9 return defHttp.get<DeviceProfileModel[]>({
10 10 url: '/device_profile/me/list',
11   - params: { deviceType: isString(deviceType) ? deviceType : undefined },
  11 + params: {
  12 + deviceType: isString(deviceType) ? deviceType : undefined,
  13 + isSceneLinkage: isSceneLinkage ? isSceneLinkage : undefined,
  14 + },
12 15 });
13 16 };
14 17
... ...
... ... @@ -125,11 +125,16 @@ export const getAttribute = (orgId) => {
125 125 export const byOrganizationIdGetMasterDevice = (params: {
126 126 organizationId: string;
127 127 deviceProfileId?: string;
  128 + isSceneLinkage?: Boolean;
128 129 }) => {
129   - const { organizationId, deviceProfileId } = params;
  130 + const { organizationId, deviceProfileId, isSceneLinkage } = params;
130 131 return defHttp.get<DeviceModel[]>({
131 132 url: `${ScreenManagerApi.MASTER_GET_DEVICE}`,
132   - params: { deviceProfileId, organizationId },
  133 + params: {
  134 + deviceProfileId,
  135 + organizationId,
  136 + isSceneLinkage: isSceneLinkage ? isSceneLinkage : undefined,
  137 + },
133 138 });
134 139 };
135 140 //TODO-fengtao
... ...
... ... @@ -217,7 +217,7 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => {
217 217 const { setFieldsValue } = formActionType;
218 218 return {
219 219 api: async () => {
220   - return await getDeviceProfile(deviceType);
  220 + return await getDeviceProfile(deviceType, true);
221 221 },
222 222 labelField: 'name',
223 223 valueField: 'id',
... ... @@ -283,7 +283,10 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => {
283 283 return {
284 284 api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => {
285 285 if (params.deviceProfileId && params.organizationId) {
286   - const result = await byOrganizationIdGetMasterDevice(params);
  286 + const result = await byOrganizationIdGetMasterDevice({
  287 + ...params,
  288 + isSceneLinkage: true,
  289 + });
287 290 if (result) {
288 291 return result.map((item) => ({
289 292 ...item,
... ...
... ... @@ -147,7 +147,7 @@ export const getFormSchemas = (
147 147 const { setFieldsValue } = formActionType;
148 148 return {
149 149 api: async () => {
150   - return await getDeviceProfile(deviceType);
  150 + return await getDeviceProfile(deviceType, true);
151 151 },
152 152 labelField: 'name',
153 153 valueField: 'id',
... ... @@ -251,7 +251,10 @@ export const getFormSchemas = (
251 251 return {
252 252 api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => {
253 253 if (params.deviceProfileId && params.organizationId) {
254   - const result = await byOrganizationIdGetMasterDevice(params);
  254 + const result = await byOrganizationIdGetMasterDevice({
  255 + ...params,
  256 + isSceneLinkage: true,
  257 + });
255 258 if (result) {
256 259 return result.map((item) => ({
257 260 ...item,
... ...
... ... @@ -17,4 +17,5 @@ export interface SceneLinkageDataType {
17 17 name: string;
18 18 description?: string;
19 19 organizationId: string;
  20 + isSceneLinkage?: Boolean;
20 21 }
... ...