Commit 9277d329753036253a09d0800ea6acd7ba691013

Authored by fengtao
1 parent 9386a4a1

fix:回退场景联动代码--修改属性选择问题

@@ -56,16 +56,6 @@ export const screenLinkPageAddApi = (params: ScreenAddModel, isUpdate: boolean) @@ -56,16 +56,6 @@ export const screenLinkPageAddApi = (params: ScreenAddModel, isUpdate: boolean)
56 }; 56 };
57 57
58 /** 58 /**
59 - * 获取主设备列表(exclude子设备)  
60 - * @param params organizationId  
61 - */  
62 -export const byOganizationIdGetMasterDevice = (params) => {  
63 - return defHttp.get({  
64 - url: ScreenManagerApi.MASTER_GET_DEVICE + '/' + params,  
65 - });  
66 -};  
67 -  
68 -/**  
69 * 删除场景联动 59 * 删除场景联动
70 * @param params pageSize page name 60 * @param params pageSize page name
71 */ 61 */
@@ -107,6 +97,7 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => { @@ -107,6 +97,7 @@ export const getOrganizationAlarmConfig = (params: { organizationId }) => {
107 }); 97 });
108 }; 98 };
109 99
  100 +//TODO-fengtao
110 /** 101 /**
111 * 获取设备属性列表 102 * 获取设备属性列表
112 */ 103 */
@@ -116,3 +107,14 @@ export const getAttribute = (orgId, deviceIds) => { @@ -116,3 +107,14 @@ export const getAttribute = (orgId, deviceIds) => {
116 url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText, 107 url: ScreenManagerApi.GET_ATTRBUTELIST + '/' + orgId + joinText,
117 }); 108 });
118 }; 109 };
  110 +
  111 +/**
  112 + * 获取主设备列表(exclude子设备)---执行动作
  113 + * @param params organizationId
  114 + */
  115 +export const byOganizationIdGetMasterDevice = (params) => {
  116 + return defHttp.get({
  117 + url: ScreenManagerApi.MASTER_GET_DEVICE + '/' + params,
  118 + });
  119 +};
  120 +//TODO-fengtao
@@ -99,7 +99,6 @@ @@ -99,7 +99,6 @@
99 screenLinkPageByDeptIdGetDevice, 99 screenLinkPageByDeptIdGetDevice,
100 getOrganizationAlarmConfig, 100 getOrganizationAlarmConfig,
101 byOganizationIdGetMasterDevice, 101 byOganizationIdGetMasterDevice,
102 - getAttribute,  
103 } from '/@/api/ruleengine/ruleengineApi'; 102 } from '/@/api/ruleengine/ruleengineApi';
104 import TriggerOrCondition from './cpns/Trigger-Condition.vue'; 103 import TriggerOrCondition from './cpns/Trigger-Condition.vue';
105 import Action from './cpns/Action.vue'; 104 import Action from './cpns/Action.vue';
@@ -107,8 +106,8 @@ @@ -107,8 +106,8 @@
107 import { formatToDateTime } from '/@/utils/dateUtil'; 106 import { formatToDateTime } from '/@/utils/dateUtil';
108 107
109 const emit = defineEmits(['register', 'success']); 108 const emit = defineEmits(['register', 'success']);
110 -  
111 const provideOrgid = ref(''); 109 const provideOrgid = ref('');
  110 +
112 const { createMessage } = useMessage(); 111 const { createMessage } = useMessage();
113 const triggerData = ref([]); 112 const triggerData = ref([]);
114 const conditionData = ref([]); 113 const conditionData = ref([]);
@@ -125,8 +124,6 @@ @@ -125,8 +124,6 @@
125 let getConditionFormValue = ref([]); 124 let getConditionFormValue = ref([]);
126 let getActionFormValue = ref([]); 125 let getActionFormValue = ref([]);
127 const editEntryIdData = ref([]); 126 const editEntryIdData = ref([]);
128 - const editEntryIdExcludeDoActionData = ref([]);  
129 - let editAttrIdData = [];  
130 const editAlarmConfigData = ref([]); 127 const editAlarmConfigData = ref([]);
131 const isUpdate = ref(false); 128 const isUpdate = ref(false);
132 const id = ref(undefined); 129 const id = ref(undefined);
@@ -158,31 +155,24 @@ @@ -158,31 +155,24 @@
158 await setFieldsValue(data.record); 155 await setFieldsValue(data.record);
159 id.value = recordId; 156 id.value = recordId;
160 tenantId.value = recordTenantId; 157 tenantId.value = recordTenantId;
  158 + //TODO-fengtao-把组织id传给子组件
161 provideOrgid.value = organizationId; 159 provideOrgid.value = organizationId;
  160 + //TODO-fengtao获取当前执行动作下的设备(master那个接口)
  161 + getMasterDeviceList.value = await byOganizationIdGetMasterDevice(organizationId);
  162 + //TODO-fengtao
162 // 获取当前组织下的设备列表 163 // 获取当前组织下的设备列表
163 - const options = await byOganizationIdGetMasterDevice(organizationId);  
164 - const optionsExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId }); 164 + const options = await screenLinkPageByDeptIdGetDevice({
  165 + organizationId,
  166 + });
165 // 获取当前组织下的告警配置 167 // 获取当前组织下的告警配置
166 const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); 168 const alarmConfig = await getOrganizationAlarmConfig({ organizationId });
167 - // 获取当前组织下的属性列表  
168 - const attrList = await getAttribute(  
169 - organizationId,  
170 - triggers.map((m) => m.entityId).join(',')  
171 - );  
172 - watchAttrList.value = await getAttribute(organizationId, null);  
173 169
174 // 生成回显时对应得组件数量 170 // 生成回显时对应得组件数量
175 triggerData.value = [...new Array(triggers.length).keys()]; 171 triggerData.value = [...new Array(triggers.length).keys()];
176 conditionData.value = [...new Array(doConditions.length).keys()]; 172 conditionData.value = [...new Array(doConditions.length).keys()];
177 actionData.value = [...new Array(doActions.length).keys()]; 173 actionData.value = [...new Array(doActions.length).keys()];
178 // 回显设备列表 174 // 回显设备列表
179 - editEntryIdData.value = options.map((item) => {  
180 - return {  
181 - value: item.id,  
182 - label: item.name,  
183 - };  
184 - });  
185 - editEntryIdExcludeDoActionData.value = optionsExcludeDoAction.items.map((item) => { 175 + editEntryIdData.value = options.items.map((item) => {
186 return { 176 return {
187 value: item.tbDeviceId, 177 value: item.tbDeviceId,
188 label: item.name, 178 label: item.name,
@@ -195,17 +185,11 @@ @@ -195,17 +185,11 @@
195 }; 185 };
196 }); 186 });
197 deviceList.value = editEntryIdData.value; 187 deviceList.value = editEntryIdData.value;
198 - deviceExcludeDoAction.value = editEntryIdExcludeDoActionData.value;  
199 -  
200 - //回显属性列表  
201 - editAttrIdData = attrList;  
202 nextTick(() => { 188 nextTick(() => {
203 - setEditFields(skipUnwrap.triggerItemRefs, editEntryIdExcludeDoActionData);  
204 - setEditFields(skipUnwrap.conditionItemRefs, editEntryIdExcludeDoActionData); 189 + setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData);
  190 + setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData);
205 setEditFields(skipUnwrap.actionItemRefs, editEntryIdData); 191 setEditFields(skipUnwrap.actionItemRefs, editEntryIdData);
206 setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); 192 setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData);
207 - setEditAttr(skipUnwrap.triggerItemRefs, editAttrIdData);  
208 - setEditAttr(skipUnwrap.conditionItemRefs, editAttrIdData);  
209 }); 193 });
210 194
211 const map = { 195 const map = {
@@ -216,6 +200,7 @@ @@ -216,6 +200,7 @@
216 // 回显触发器数据---此处是个闭包! 200 // 回显触发器数据---此处是个闭包!
217 triggers.forEach((trigger, index) => { 201 triggers.forEach((trigger, index) => {
218 nextTick(async () => { 202 nextTick(async () => {
  203 + const selectDeviceId = ref('');
219 // 回显启用规则 204 // 回显启用规则
220 unref(skipUnwrap.triggerItemRefs)[index].currentIndex = 205 unref(skipUnwrap.triggerItemRefs)[index].currentIndex =
221 map[trigger.triggerCondition.schedule.type]; 206 map[trigger.triggerCondition.schedule.type];
@@ -223,15 +208,12 @@ @@ -223,15 +208,12 @@
223 unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true; 208 unref(skipUnwrap.triggerItemRefs)[index].isUpdate = true;
224 unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData = 209 unref(skipUnwrap.triggerItemRefs)[index].alarmScheduleRef.scheduleData =
225 trigger.triggerCondition.schedule; 210 trigger.triggerCondition.schedule;
226 - const getAttrKeyOption = trigger?.triggerCondition?.condition?.condition?.map(  
227 - (m) => m.key.key  
228 - );  
229 unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({ 211 unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({
230 triggered: trigger?.triggerCondition?.condition?.spec?.type, 212 triggered: trigger?.triggerCondition?.condition?.spec?.type,
231 device: trigger?.entityType, 213 device: trigger?.entityType,
232 triggerType: trigger?.triggerType, 214 triggerType: trigger?.triggerType,
233 type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type, 215 type1: trigger?.triggerCondition?.condition?.condition[0]?.key?.type,
234 - type2: getAttrKeyOption, 216 + type2: trigger?.triggerCondition?.condition?.condition[0]?.key?.key,
235 operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType, 217 operationType: trigger?.triggerCondition?.condition?.condition[0]?.valueType,
236 detail: trigger?.triggerCondition?.alarmDetails, 218 detail: trigger?.triggerCondition?.alarmDetails,
237 entityId: trigger?.entityId, 219 entityId: trigger?.entityId,
@@ -239,6 +221,15 @@ @@ -239,6 +221,15 @@
239 time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue, 221 time: trigger?.triggerCondition?.condition?.spec?.predicate?.defaultValue,
240 timeUnit: trigger?.triggerCondition?.condition?.spec?.unit, 222 timeUnit: trigger?.triggerCondition?.condition?.spec?.unit,
241 }); 223 });
  224 + if (trigger.entityId != undefined) {
  225 + selectDeviceId.value = trigger?.entityId;
  226 + }
  227 + //fengtao-把设备id回传给子组件
  228 + unref(skipUnwrap.triggerItemRefs)[index].updateFieldAttributeFunc(
  229 + selectDeviceId.value,
  230 + provideOrgid.value
  231 + );
  232 + //fengtao
242 // 设置值operationType 233 // 设置值operationType
243 unref(skipUnwrap.triggerItemRefs)[index].operationType = 234 unref(skipUnwrap.triggerItemRefs)[index].operationType =
244 trigger.triggerCondition?.condition.condition[0].valueType; 235 trigger.triggerCondition?.condition.condition[0].valueType;
@@ -298,15 +289,12 @@ @@ -298,15 +289,12 @@
298 unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true; 289 unref(skipUnwrap.conditionItemRefs)[index].isUpdate = true;
299 unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData = 290 unref(skipUnwrap.conditionItemRefs)[index].alarmScheduleRef.scheduleData =
300 condition.triggerCondition.schedule; 291 condition.triggerCondition.schedule;
301 - const getAttrKeyOption = condition?.triggerCondition?.condition?.condition?.map(  
302 - (m) => m.key.key  
303 - );  
304 unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({ 292 unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({
305 triggered: condition?.triggerCondition?.condition?.spec?.type, 293 triggered: condition?.triggerCondition?.condition?.spec?.type,
306 device: condition?.entityType, 294 device: condition?.entityType,
307 triggerType: condition?.triggerType, 295 triggerType: condition?.triggerType,
308 type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type, 296 type1: condition?.triggerCondition?.condition?.condition[0]?.key?.type,
309 - type2: getAttrKeyOption, 297 + type2: condition?.triggerCondition?.condition?.condition[0]?.key?.key,
310 operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType, 298 operationType: condition?.triggerCondition?.condition?.condition[0]?.valueType,
311 detail: condition?.triggerCondition?.alarmDetails, 299 detail: condition?.triggerCondition?.alarmDetails,
312 entityId: condition?.entityId, 300 entityId: condition?.entityId,
@@ -493,11 +481,9 @@ @@ -493,11 +481,9 @@
493 // 设置设备的options 481 // 设置设备的options
494 const setEditFields = (linkAge, deviceList) => { 482 const setEditFields = (linkAge, deviceList) => {
495 unref(linkAge).map((item) => { 483 unref(linkAge).map((item) => {
496 - if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') {  
497 - item.updateExcludeActionFieldDeviceId(deviceList);  
498 - } else {  
499 - item.updateFieldDeviceId(deviceList);  
500 - } 484 + //TODO-fengtao
  485 + item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList);
  486 + //TODO-fengtao
501 }); 487 });
502 }; 488 };
503 // 设置告警配置options 489 // 设置告警配置options
@@ -506,29 +492,21 @@ @@ -506,29 +492,21 @@
506 item.updateEditFieldAlarmConfig(alarmConfigList); 492 item.updateEditFieldAlarmConfig(alarmConfigList);
507 }); 493 });
508 }; 494 };
509 - //设置设备属性的options  
510 - const setEditAttr = (linkAge, attrList) => {  
511 - unref(linkAge).map((item) => {  
512 - item.updateFieldAttr(attrList);  
513 - });  
514 - };  
515 -  
516 // 监听组织变化更新设备列表 495 // 监听组织变化更新设备列表
517 const deviceList = ref([]); 496 const deviceList = ref([]);
  497 + const getMasterDeviceList = ref([]);
  498 + const orgId = ref('');
518 const alarmConfigList = ref([]); 499 const alarmConfigList = ref([]);
519 - const watchAttrList = ref([]);  
520 - const deviceExcludeDoAction = ref([]);  
521 watch(organizationId, async (newValue: string) => { 500 watch(organizationId, async (newValue: string) => {
522 if (!newValue) return; 501 if (!newValue) return;
523 - provideOrgid.value = newValue;  
524 - const items = await byOganizationIdGetMasterDevice(newValue);  
525 - const itemExcludeDoAction = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue });  
526 - deviceExcludeDoAction.value = itemExcludeDoAction.items.map((item) => ({  
527 - label: item.name,  
528 - value: item.tbDeviceId,  
529 - }));  
530 - deviceList.value = items.map((item) => ({ label: item.name, value: item.id }));  
531 - watchAttrList.value = await getAttribute(newValue, null); 502 + const { items } = await screenLinkPageByDeptIdGetDevice({ organizationId: newValue });
  503 + //TODO fengtao
  504 + getMasterDeviceList.value = await byOganizationIdGetMasterDevice(newValue);
  505 + //TODO fengtao
  506 + deviceList.value = items.map((item) => ({ label: item.name, value: item.tbDeviceId }));
  507 + //TODO fengtao
  508 + orgId.value = newValue;
  509 + //TODO fengtao
532 setFields(skipUnwrap.triggerItemRefs, true); 510 setFields(skipUnwrap.triggerItemRefs, true);
533 setFields(skipUnwrap.conditionItemRefs, true); 511 setFields(skipUnwrap.conditionItemRefs, true);
534 setFields(skipUnwrap.actionItemRefs, true); 512 setFields(skipUnwrap.actionItemRefs, true);
@@ -541,12 +519,9 @@ @@ -541,12 +519,9 @@
541 function setFields(linkAge, isOrganizationChange = false) { 519 function setFields(linkAge, isOrganizationChange = false) {
542 unref(linkAge).map((item) => { 520 unref(linkAge).map((item) => {
543 isOrganizationChange && item.resetFieldsValueFunc(); 521 isOrganizationChange && item.resetFieldsValueFunc();
544 - if (item.isTriggerAndConditionFlag == 'isTriggerAndConditionFlag') {  
545 - item.updateExcludeActionFieldDeviceId(deviceExcludeDoAction);  
546 - item.updateFieldAttr(watchAttrList);  
547 - } else {  
548 - item.updateFieldDeviceId(deviceList);  
549 - } 522 + //TODO fengtao
  523 + item.updateFieldDeviceId(deviceList, orgId, isUpdate, getMasterDeviceList);
  524 + //TODO fengtao
550 }); 525 });
551 } 526 }
552 function setAlarmConfig(linkAge, isOrganizationChange = false) { 527 function setAlarmConfig(linkAge, isOrganizationChange = false) {
@@ -609,7 +584,20 @@ @@ -609,7 +584,20 @@
609 id: unref(id), 584 id: unref(id),
610 tenantId: unref(tenantId), 585 tenantId: unref(tenantId),
611 }; 586 };
612 - 587 + //TODO fengtao---修改之前如果是新增,如果条件筛选页面打开,但没填值,还是可以新增成功
  588 + const typeBoolean = postAddOrEditData?.triggers?.some((f) => {
  589 + let type = false;
  590 + f?.triggerCondition?.condition?.condition?.some((s) => {
  591 + if (s?.predicate?.value?.defaultValue == undefined) {
  592 + type = true;
  593 + } else {
  594 + type = false;
  595 + }
  596 + });
  597 + return type;
  598 + });
  599 + if (typeBoolean) return createMessage.error('请填写条件筛选');
  600 + //TODO fengtao
613 await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); 601 await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate));
614 createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); 602 createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`);
615 closeDrawer(); 603 closeDrawer();
@@ -659,8 +647,14 @@ @@ -659,8 +647,14 @@
659 </script> 647 </script>
660 648
661 <style lang="less" scoped> 649 <style lang="less" scoped>
662 - ///统一下拉选择框宽度,否则超出默认宽度会造成页面样式错乱  
663 - :deep(.ant-select-selector) {  
664 - max-width: 14.2rem; 650 + //TODO-fengtao
  651 + ///移除选择框默认样式(24px)否则超出默认宽度会造成页面样式错乱
  652 + ::v-deep(.ant-select-selector) {
  653 + padding-right: 0px !important;
  654 + }
  655 +
  656 + ::v-deep(.ant-select-selection-overflow) {
  657 + max-width: 10vw !important;
665 } 658 }
  659 + //TODO-fengtao
666 </style> 660 </style>
@@ -257,7 +257,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -257,7 +257,7 @@ export const trigger_condition_schema: FormSchema[] = [
257 { 257 {
258 field: 'type2', 258 field: 'type2',
259 label: '', 259 label: '',
260 - component: 'Select', 260 + component: 'AutoComplete',
261 componentProps: { 261 componentProps: {
262 placeholder: '请选择属性', 262 placeholder: '请选择属性',
263 }, 263 },
@@ -98,42 +98,96 @@ @@ -98,42 +98,96 @@
98 ); 98 );
99 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; 99 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData };
100 }; 100 };
101 - const updateExcludeActionFieldDeviceId = (deviceList: any[]) => { 101 +
  102 + //TODO-fengtao
  103 + const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => {
  104 + //用于编辑回显
  105 + if (isUpdate.value != 3 && isUpdate.value) {
  106 + updateSchema({
  107 + field: 'entityId',
  108 + componentProps: {
  109 + options: deviceList,
  110 + },
  111 + });
  112 + }
  113 + //新增、编辑都会触发onChang事件
102 updateSchema({ 114 updateSchema({
103 - field: 'entityId', 115 + field: 'device',
104 componentProps: { 116 componentProps: {
105 - options: deviceList,  
106 - onChange(e) { 117 + options: [
  118 + { label: '全部', value: 'ALL' },
  119 + { label: '部分', value: 'PART' },
  120 + ],
  121 + async onChange(e) {
  122 + setFieldsValue({ type2: '' });
  123 + //部分切换-清空或者重置为初始值
  124 + updateSchema({
  125 + field: 'type2',
  126 + componentProps: {
  127 + options: [],
  128 + },
  129 + });
107 if (e) { 130 if (e) {
108 - updateFieldAttributeFunc(e); 131 + //fengtao
  132 + if (e == 'ALL') {
  133 + const data = await getAttribute(props.provideOrgid || orgId.value, null);
  134 + //fengtao
  135 + const options = data.map((m) => {
  136 + return {
  137 + label: m,
  138 + value: m,
  139 + };
  140 + });
  141 + updateSchema({
  142 + field: 'type2',
  143 + componentProps: {
  144 + placeholder: '请选择属性',
  145 + options,
  146 + },
  147 + });
  148 + } else {
  149 + const getT = getFieldsValue();
  150 + const entityId = getT.entityId;
  151 + if (entityId !== undefined && entityId.length > 0) {
  152 + updateFieldAttributeFunc(entityId, orgId.value);
  153 + }
  154 + updateSchema({
  155 + field: 'entityId',
  156 + componentProps: {
  157 + options: deviceList,
  158 + onChange(e) {
  159 + if (e) {
  160 + //fengtao
  161 + updateFieldAttributeFunc(e, orgId.value);
  162 + //fengtao
  163 + }
  164 + },
  165 + },
  166 + });
  167 + }
  168 + //fengtao
109 } 169 }
110 }, 170 },
111 }, 171 },
112 }); 172 });
113 }; 173 };
114 - const updateFieldAttr = (attrList: any[]) => {  
115 - const attrMapList = attrList.value?.map((m) => {  
116 - return {  
117 - label: m,  
118 - value: m,  
119 - };  
120 - });  
121 - updateSchema({  
122 - field: 'type2',  
123 - componentProps: {  
124 - placeholder: '请选择属性',  
125 - options: attrMapList,  
126 - },  
127 - });  
128 - }; 174 + //TODO-fengtao
129 const resetFieldsValueFunc = () => resetFields(); 175 const resetFieldsValueFunc = () => resetFields();
130 // 回显数据函数 176 // 回显数据函数
131 const setFieldsFormValueFun = (fieldsValue) => { 177 const setFieldsFormValueFun = (fieldsValue) => {
132 setFieldsValue(fieldsValue); 178 setFieldsValue(fieldsValue);
133 }; 179 };
134 - const updateFieldAttributeFunc = async (e) => {  
135 - const joinDeviceIds = e.join(',');  
136 - const data = await getAttribute(props.provideOrgid, joinDeviceIds); 180 + //TODO-fengtao
  181 + const updateFieldAttributeFunc = async (deviceId, orgId) => {
  182 + //TODO-fengtao
  183 + let data;
  184 + if (deviceId !== undefined && deviceId.length > 0) {
  185 + const joinDeviceIds = deviceId.join(',');
  186 + data = await getAttribute(orgId || props.provideOrgid, joinDeviceIds);
  187 + } else {
  188 + data = await getAttribute(orgId || props.provideOrgid, null);
  189 + }
  190 + //TODO-fengtao
137 const options = data.map((m) => { 191 const options = data.map((m) => {
138 return { 192 return {
139 label: m, 193 label: m,
@@ -144,11 +198,11 @@ @@ -144,11 +198,11 @@
144 field: 'type2', 198 field: 'type2',
145 componentProps: { 199 componentProps: {
146 placeholder: '请选择属性', 200 placeholder: '请选择属性',
147 - options, 201 + options: options,
148 }, 202 },
149 }); 203 });
150 }; 204 };
151 - 205 + //TODO-fengtao
152 const handleDelete = (params: { index: number; title: string }) => { 206 const handleDelete = (params: { index: number; title: string }) => {
153 emit('delete', params); 207 emit('delete', params);
154 }; 208 };
@@ -195,12 +249,9 @@ @@ -195,12 +249,9 @@
195 currentIndex.value = index; 249 currentIndex.value = index;
196 }; 250 };
197 const scheduleData = ref(null); 251 const scheduleData = ref(null);
198 - const isTriggerAndConditionFlag = 'isTriggerAndConditionFlag';  
199 defineExpose({ 252 defineExpose({
200 - isTriggerAndConditionFlag,  
201 getFieldsValueFunc, 253 getFieldsValueFunc,
202 - updateExcludeActionFieldDeviceId,  
203 - updateFieldAttr, 254 + updateFieldDeviceId,
204 resetFieldsValueFunc, 255 resetFieldsValueFunc,
205 setFieldsFormValueFun, 256 setFieldsFormValueFun,
206 childGetFieldsValue, 257 childGetFieldsValue,
@@ -212,9 +263,17 @@ @@ -212,9 +263,17 @@
212 scheduleData, 263 scheduleData,
213 isUpdate, 264 isUpdate,
214 alarmScheduleRef, 265 alarmScheduleRef,
  266 + updateFieldAttributeFunc,
215 }); 267 });
216 </script> 268 </script>
217 269
  270 +<style lang="less" scoped>
  271 + ///移除选择框默认样式(24px)否则超出默认宽度会造成页面样式错乱
  272 + ::v-deep(.ant-select-selector) {
  273 + padding-right: 0px !important;
  274 + }
  275 +</style>
  276 +
218 <style> 277 <style>
219 .active { 278 .active {
220 color: #377dff; 279 color: #377dff;
@@ -140,14 +140,25 @@ @@ -140,14 +140,25 @@
140 setFieldsValue(fieldsValue); 140 setFieldsValue(fieldsValue);
141 }; 141 };
142 const resetFieldsValueFunc = () => resetFields(); 142 const resetFieldsValueFunc = () => resetFields();
143 - const updateFieldDeviceId = (deviceList) => { 143 +
  144 + //TODO-fengtao
  145 + const updateFieldDeviceId = (deviceList, e, i, masterList) => {
  146 + console.log(deviceList, e, i);
  147 + console.log(masterList.value);
  148 + const options = masterList.value.map((m) => {
  149 + return {
  150 + value: m.id,
  151 + label: m.name,
  152 + };
  153 + });
144 updateSchema({ 154 updateSchema({
145 field: 'deviceId', 155 field: 'deviceId',
146 componentProps: { 156 componentProps: {
147 - options: deviceList, 157 + options,
148 }, 158 },
149 }); 159 });
150 }; 160 };
  161 + //TODO-fengtao
151 const updateEditFieldAlarmConfig = (alarmConfigList) => { 162 const updateEditFieldAlarmConfig = (alarmConfigList) => {
152 updateSchema({ 163 updateSchema({
153 field: 'alarm_config', 164 field: 'alarm_config',