Commit c6920454ee664461c8a93dada63629c6fd7f5a0d

Authored by xp.Huang
2 parents 21d2c7f1 822bee42

Merge branch 'ft-dev' into 'main'

feat:新增设备配置设为默认配置,新增表格两个字段,type和default,fix:修改设备配置第三步页面调整

See merge request huang/yun-teng-iot-front!149
@@ -11,7 +11,8 @@ VITE_PUBLIC_PATH = / @@ -11,7 +11,8 @@ VITE_PUBLIC_PATH = /
11 # VITE_PROXY = [["/api","http://192.168.10.108:8080/api"]] 11 # VITE_PROXY = [["/api","http://192.168.10.108:8080/api"]]
12 12
13 # 线上 13 # 线上
14 -VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] 14 +# VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
  15 +VITE_PROXY = [["/api","http://47.99.141.212:8080/api"]]
15 16
16 # 实时数据的ws地址 17 # 实时数据的ws地址
17 VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= 18 VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token=
@@ -16,6 +16,7 @@ enum EDeviceConfigApi { @@ -16,6 +16,7 @@ enum EDeviceConfigApi {
16 ALARM_CONTACT_GET_PAGE = '/alarmContact', 16 ALARM_CONTACT_GET_PAGE = '/alarmContact',
17 DEVICE_CONFIG_EXPORT = '/deviceProfile/export', 17 DEVICE_CONFIG_EXPORT = '/deviceProfile/export',
18 DEVICE_CONFIG_IMPORT = '/deviceProfile/import', 18 DEVICE_CONFIG_IMPORT = '/deviceProfile/import',
  19 + SET_DEVICE_ISDEFAULT = '/deviceProfile',
19 } 20 }
20 21
21 /** 22 /**
@@ -97,3 +98,19 @@ export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => { @@ -97,3 +98,19 @@ export const deviceConfigImport = (params: IDeviceConfigAddOrEditModel) => {
97 params, 98 params,
98 }); 99 });
99 }; 100 };
  101 +
  102 +/**
  103 + *
  104 + * 设置该设备配置为默认
  105 + */
  106 +export const setDeviceProfileIsDefaultApi = (id: string, v, params?: {}) => {
  107 + return defHttp.post(
  108 + {
  109 + url: EDeviceConfigApi.SET_DEVICE_ISDEFAULT + '/' + id + '/' + v,
  110 + params,
  111 + },
  112 + {
  113 + joinPrefix: false,
  114 + }
  115 + );
  116 +};
@@ -46,20 +46,6 @@ export async function deleteTenantProfileApi(ids: string) { @@ -46,20 +46,6 @@ export async function deleteTenantProfileApi(ids: string) {
46 ); 46 );
47 } 47 }
48 48
49 -// export async function deleteTenantProfileApi(ids: string[]) {  
50 -// await defHttp.delete(  
51 -// {  
52 -// url: Api.deleteTenantProfile,  
53 -// data: {  
54 -// ids: ids,  
55 -// },  
56 -// },  
57 -// {  
58 -// joinPrefix: false,  
59 -// }  
60 -// );  
61 -// }  
62 -  
63 export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { 49 export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => {
64 return defHttp.get({ 50 return defHttp.get({
65 url: Api.getTenantProfile, 51 url: Api.getTenantProfile,
@@ -18,17 +18,20 @@ @@ -18,17 +18,20 @@
18 </a-steps> 18 </a-steps>
19 </div> 19 </div>
20 <div class="mt-5"> 20 <div class="mt-5">
  21 + <!-- 设备配置 -->
21 <div v-show="current === 0"> 22 <div v-show="current === 0">
22 <DeviceProfileStep1 ref="DeviceProfileStep1Ref" @next="handleStepNext1" 23 <DeviceProfileStep1 ref="DeviceProfileStep1Ref" @next="handleStepNext1"
23 /></div> 24 /></div>
24 - 25 + <!-- 设备配置 -->
  26 + <!-- 传输配置 -->
25 <div v-show="current === 1"> 27 <div v-show="current === 1">
26 <DeviceProfileStep2 28 <DeviceProfileStep2
27 ref="DeviceProfileStep2Ref" 29 ref="DeviceProfileStep2Ref"
28 @prev="handleStepPrev" 30 @prev="handleStepPrev"
29 @next="handleStep2Next" 31 @next="handleStep2Next"
30 /></div> 32 /></div>
31 - 33 + <!-- 传输配置 -->
  34 + <!-- 告警配置 -->
32 <div v-show="current === 2"> 35 <div v-show="current === 2">
33 <DeviceProfileStep3 36 <DeviceProfileStep3
34 ref="DeviceProfileStep3Ref" 37 ref="DeviceProfileStep3Ref"
@@ -39,9 +42,12 @@ @@ -39,9 +42,12 @@
39 :isAddOrEdit="isStatus" 42 :isAddOrEdit="isStatus"
40 :isShowAddRule="isShowRule" 43 :isShowAddRule="isShowRule"
41 /></div> 44 /></div>
  45 + <!-- 告警配置 -->
  46 + <!-- 告警通知 -->
42 <div v-show="current === 3"> 47 <div v-show="current === 3">
43 <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" /> 48 <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" />
44 </div> 49 </div>
  50 + <!-- 告警通知 -->
45 </div> 51 </div>
46 </BasicModal> 52 </BasicModal>
47 </div> 53 </div>
@@ -113,7 +119,6 @@ @@ -113,7 +119,6 @@
113 const isShowOkBtnFalse = ref(true); 119 const isShowOkBtnFalse = ref(true);
114 const isShowRule = ref(true); 120 const isShowRule = ref(true);
115 const isEditAndChange = ref(true); 121 const isEditAndChange = ref(true);
116 -  
117 const getTitle = computed(() => 122 const getTitle = computed(() =>
118 isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情' 123 isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情'
119 ); 124 );
@@ -127,18 +132,19 @@ @@ -127,18 +132,19 @@
127 current.value = 0; 132 current.value = 0;
128 isStatus.value = !data.isUpdate; 133 isStatus.value = !data.isUpdate;
129 //清空第一步数据 134 //清空第一步数据
130 - proxy.$refs.DeviceProfileStep1Ref.resetIconFunc();  
131 - proxy.$refs.DeviceProfileStep1Ref.customResetStepOneFunc();  
132 - proxy.$refs.DeviceProfileStep3Ref.clearAllRegisterFormFunc(); 135 + proxy.$refs.DeviceProfileStep1Ref?.resetIconFunc();
  136 + proxy.$refs.DeviceProfileStep1Ref?.customResetStepOneFunc();
  137 + proxy.$refs.DeviceProfileStep3Ref?.clearProfileDataFunc1();
  138 + proxy.$refs.DeviceProfileStep3Ref?.deleteClearCondition();
133 //报警详细信息 139 //报警详细信息
134 - proxy.$refs.DeviceProfileStep3Ref.setRegisterFormChangeDetailFunc({ 140 + proxy.$refs.DeviceProfileStep3Ref?.setRegisterFormChangeDetailFunc({
135 isEditStatus: false, 141 isEditStatus: false,
136 stepThreeData: {}, 142 stepThreeData: {},
137 }); 143 });
138 } else if (isUpdate.value == 2) { 144 } else if (isUpdate.value == 2) {
139 isGetStepThreeData.profileData.alarms.length = 0; 145 isGetStepThreeData.profileData.alarms.length = 0;
140 try { 146 try {
141 - proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); 147 + proxy.$refs.DeviceProfileStep3Ref?.clearEditAllRegisterFormFunc();
142 } catch (e) { 148 } catch (e) {
143 return e; 149 return e;
144 } 150 }
@@ -161,7 +167,6 @@ @@ -161,7 +167,6 @@
161 }); 167 });
162 proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); 168 proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc();
163 proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); 169 proxy.$refs.DeviceProfileStep3Ref.addAlarmRule();
164 - // emit('success');  
165 } else if (isUpdate.value == 3) { 170 } else if (isUpdate.value == 3) {
166 postEditId.value = data.record.id; 171 postEditId.value = data.record.id;
167 getBackendData = await deviceConfigGetDetail(postEditId.value); 172 getBackendData = await deviceConfigGetDetail(postEditId.value);
@@ -182,36 +187,32 @@ @@ -182,36 +187,32 @@
182 }); 187 });
183 proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); 188 proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc();
184 proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); 189 proxy.$refs.DeviceProfileStep3Ref.addAlarmRule();
185 - // emit('success');  
186 } 190 }
187 }); 191 });
188 function handleStepPrev() { 192 function handleStepPrev() {
189 current.value--; 193 current.value--;
190 } 194 }
  195 + //第一步
191 function handleStepNext1(v, v1) { 196 function handleStepNext1(v, v1) {
192 current.value++; 197 current.value++;
193 getStepOneData.value = v; 198 getStepOneData.value = v;
194 getStepOneData.value.icon = v1; 199 getStepOneData.value.icon = v1;
195 if (isUpdate.value == 1) { 200 if (isUpdate.value == 1) {
196 } else if (isUpdate.value == 2) { 201 } else if (isUpdate.value == 2) {
197 - return proxy.$refs.DeviceProfileStep2Ref.setStepTwoFieldsValueFunc({ 202 + proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc({
198 transportType: editData.value?.profileData.transportConfiguration.type, 203 transportType: editData.value?.profileData.transportConfiguration.type,
199 }); 204 });
200 } else if (isUpdate.value == 3) { 205 } else if (isUpdate.value == 3) {
201 - return proxy.$refs.DeviceProfileStep2Ref.setStepTwoFieldsValueFunc({ 206 + proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc({
202 transportType: editData.value?.profileData.transportConfiguration.type, 207 transportType: editData.value?.profileData.transportConfiguration.type,
203 }); 208 });
204 } 209 }
205 } 210 }
  211 + //第二步
206 function handleStep2Next(v) { 212 function handleStep2Next(v) {
207 current.value++; 213 current.value++;
208 getStepTwoData.value = v; 214 getStepTwoData.value = v;
209 if (isUpdate.value == 1) { 215 if (isUpdate.value == 1) {
210 - try {  
211 - proxy.$refs.DeviceProfileStep3Ref.initAddAlarmRuleFunc();  
212 - proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc();  
213 - proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc();  
214 - } catch {}  
215 } else if (isUpdate.value == 2) { 216 } else if (isUpdate.value == 2) {
216 try { 217 try {
217 proxy.$refs.DeviceProfileStep3Ref.setAlaramTypeFormFunc({ 218 proxy.$refs.DeviceProfileStep3Ref.setAlaramTypeFormFunc({
@@ -265,6 +266,7 @@ @@ -265,6 +266,7 @@
265 } catch {} 266 } catch {}
266 } 267 }
267 } 268 }
  269 + //第三步
268 function handleStep3Next(v, v1) { 270 function handleStep3Next(v, v1) {
269 isEditAndChange.value = v1; 271 isEditAndChange.value = v1;
270 current.value++; 272 current.value++;
@@ -285,7 +287,6 @@ @@ -285,7 +287,6 @@
285 function handleRedo() { 287 function handleRedo() {
286 current.value = 0; 288 current.value = 0;
287 } 289 }
288 -  
289 const handleSubmit = async () => { 290 const handleSubmit = async () => {
290 if (isUpdate.value == 1) { 291 if (isUpdate.value == 1) {
291 isGetStepThreeData.profileData.alarms = getStepThreeData.value; 292 isGetStepThreeData.profileData.alarms = getStepThreeData.value;
@@ -333,18 +334,19 @@ @@ -333,18 +334,19 @@
333 emit('success'); 334 emit('success');
334 } 335 }
335 }; 336 };
336 -  
337 const handleCancel = () => { 337 const handleCancel = () => {
338 closeModal(); 338 closeModal();
339 try { 339 try {
340 - proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc();  
341 - proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc();  
342 - proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc();  
343 - proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc();  
344 - emit('success');  
345 - } catch (e) {  
346 - return e;  
347 - } 340 + proxy.$refs.DeviceProfileStep1Ref?.customResetStepOneFunc();
  341 + proxy.$refs.DeviceProfileStep2Ref?.customClearStepTwoValueFunc();
  342 + proxy.$refs.DeviceProfileStep3Ref?.resetAlarmSeverityRefFunc();
  343 + proxy.$refs.DeviceProfileStep3Ref?.resetRegisterFormCreateAlarmFunc();
  344 + proxy.$refs.DeviceProfileStep3Ref?.clearDetailTemplateFunc();
  345 + proxy.$refs.DeviceProfileStep3Ref?.clearEditAllRegisterFormFunc();
  346 + proxy.$refs.DeviceProfileStep3Ref?.clearAllRegisterFormFunc();
  347 + proxy.$refs.DeviceProfileStep4Ref?.clearAlaramContactAndNoticeMethodFunc();
  348 + proxy.$refs.DeviceProfileStep3Ref?.clearProfileDataFunc1();
  349 + } catch {}
348 }; 350 };
349 return { 351 return {
350 isShowRule, 352 isShowRule,
@@ -6,24 +6,29 @@ import { numberRule } from '/@/utils/rules'; @@ -6,24 +6,29 @@ import { numberRule } from '/@/utils/rules';
6 6
7 export const columns: BasicColumn[] = [ 7 export const columns: BasicColumn[] = [
8 { 8 {
9 - title: '配置名称', 9 + title: '创建时间',
  10 + dataIndex: 'createTime',
  11 + width: 150,
  12 + },
  13 + {
  14 + title: '名称',
10 dataIndex: 'name', 15 dataIndex: 'name',
11 - width: 200, 16 + width: 150,
12 }, 17 },
13 { 18 {
14 - title: '传输协议',  
15 - dataIndex: 'transportType',  
16 - width: 200, 19 + title: '配置类型',
  20 + dataIndex: 'type',
  21 + width: 100,
17 }, 22 },
18 { 23 {
19 - title: '创建时间',  
20 - dataIndex: 'createTime',  
21 - width: 180, 24 + title: '传输方式',
  25 + dataIndex: 'transportType',
  26 + width: 100,
22 }, 27 },
23 { 28 {
24 title: '描述', 29 title: '描述',
25 dataIndex: 'description', 30 dataIndex: 'description',
26 - width: 180, 31 + width: 150,
27 }, 32 },
28 ]; 33 ];
29 34
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <template #toolbar> 9 <template #toolbar>
10 <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> 10 <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button>
11 <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> 11 <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD">
12 - <a-button @click="handleImport"> 导入设备配置 </a-button> 12 + <a-button disabled @click="handleImport"> 导入设备配置 </a-button>
13 </ImpExcel> 13 </ImpExcel>
14 <a-button danger color="error" @click="handleTableDel" :disabled="disabled"> 14 <a-button danger color="error" @click="handleTableDel" :disabled="disabled">
15 批量删除 15 批量删除
@@ -19,6 +19,11 @@ @@ -19,6 +19,11 @@
19 <TableAction 19 <TableAction
20 :actions="[ 20 :actions="[
21 { 21 {
  22 + label: '设置为默认',
  23 + icon: 'ant-design:profile-outlined',
  24 + onClick: handleSetDefault.bind(null, record),
  25 + },
  26 + {
22 label: '详情', 27 label: '详情',
23 icon: 'ant-design:eye-outlined', 28 icon: 'ant-design:eye-outlined',
24 onClick: handleDetailView.bind(null, record), 29 onClick: handleDetailView.bind(null, record),
@@ -41,6 +46,9 @@ @@ -41,6 +46,9 @@
41 title: '是否确认删除', 46 title: '是否确认删除',
42 confirm: handleDelete.bind(null, record), 47 confirm: handleDelete.bind(null, record),
43 }, 48 },
  49 + ifShow: () => {
  50 + return record.default === false;
  51 + },
44 }, 52 },
45 ]" 53 ]"
46 /> 54 />
@@ -55,7 +63,11 @@ @@ -55,7 +63,11 @@
55 import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table'; 63 import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table';
56 import { columns, searchFormSchema } from './device.profile.data'; 64 import { columns, searchFormSchema } from './device.profile.data';
57 import { useMessage } from '/@/hooks/web/useMessage'; 65 import { useMessage } from '/@/hooks/web/useMessage';
58 - import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi'; 66 + import {
  67 + deviceConfigGetQuery,
  68 + deviceConfigDelete,
  69 + setDeviceProfileIsDefaultApi,
  70 + } from '/@/api/device/deviceConfigApi';
59 import { useModal } from '/@/components/Modal'; 71 import { useModal } from '/@/components/Modal';
60 import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue'; 72 import DeviceProfileModal from '/@/views/device/profiles/DeviceProfileModal.vue';
61 import { ImpExcel, ExcelData } from '/@/components/Excel'; 73 import { ImpExcel, ExcelData } from '/@/components/Excel';
@@ -220,7 +232,32 @@ @@ -220,7 +232,32 @@
220 function handleSuccess() { 232 function handleSuccess() {
221 reload(); 233 reload();
222 } 234 }
  235 + const handleSetDefault = async (record: Recordable) => {
  236 + let id = record.id;
  237 + const obj = {
  238 + headers: {
  239 + normalizedNames: {},
  240 + lazyUpdate: null,
  241 + },
  242 + params: {
  243 + updates: null,
  244 + cloneFrom: null,
  245 + encoder: {},
  246 + map: null,
  247 + interceptorConfig: {
  248 + ignoreLoading: false,
  249 + ignoreErrors: false,
  250 + resendRequest: false,
  251 + },
  252 + },
  253 + };
  254 + const data = await setDeviceProfileIsDefaultApi(id, 'default', obj);
  255 + if (!data) return createMessage.error('设置该设备配置为默认失败');
  256 + createMessage.success('设置该设备配置为默认成功');
  257 + reload();
  258 + };
223 return { 259 return {
  260 + handleSetDefault,
224 disabled, 261 disabled,
225 deviceDetailRef, 262 deviceDetailRef,
226 // setRowClassName, 263 // setRowClassName,
1 <template> 1 <template>
2 <div class="step2"> 2 <div class="step2">
3 - <BasicForm @register="register" /> 3 + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" />
  4 + <div
  5 + style="
  6 + display: flex;
  7 + width: 11vw;
  8 + height: 4vh;
  9 + flex-direction: row;
  10 + justify-content: space-between;
  11 + margin-left: 8vw;
  12 + margin-top: -4vh;
  13 + "
  14 + >
  15 + <div style="display: flex; width: 4vw; height: 4vh">
  16 + <Button type="default" style="border-radius: 2px" class="mt-5" @click="customResetFunc"
  17 + >上一步</Button
  18 + >
  19 + </div>
  20 + <div style="display: flex; width: 4vw; height: 4vh">
  21 + <Button type="default" class="mt-5" @click="customSubmitFunc"> 下一步</Button>
  22 + </div>
  23 + </div>
4 </div> 24 </div>
5 </template> 25 </template>
6 <script lang="ts"> 26 <script lang="ts">
@@ -8,6 +28,7 @@ @@ -8,6 +28,7 @@
8 import { BasicForm, useForm } from '/@/components/Form'; 28 import { BasicForm, useForm } from '/@/components/Form';
9 import { step2Schemas } from './data'; 29 import { step2Schemas } from './data';
10 import { Alert, Divider, Descriptions } from 'ant-design-vue'; 30 import { Alert, Divider, Descriptions } from 'ant-design-vue';
  31 + import { Button } from '/@/components/Button';
11 32
12 export default defineComponent({ 33 export default defineComponent({
13 components: { 34 components: {
@@ -16,6 +37,7 @@ @@ -16,6 +37,7 @@
16 [Divider.name]: Divider, 37 [Divider.name]: Divider,
17 [Descriptions.name]: Descriptions, 38 [Descriptions.name]: Descriptions,
18 [Descriptions.Item.name]: Descriptions.Item, 39 [Descriptions.Item.name]: Descriptions.Item,
  40 + Button,
19 }, 41 },
20 emits: ['next', 'prev', 'register'], 42 emits: ['next', 'prev', 'register'],
21 setup(_, { emit }) { 43 setup(_, { emit }) {
@@ -25,14 +47,6 @@ @@ -25,14 +47,6 @@
25 actionColOptions: { 47 actionColOptions: {
26 span: 14, 48 span: 14,
27 }, 49 },
28 - resetButtonOptions: {  
29 - text: '上一步',  
30 - },  
31 - submitButtonOptions: {  
32 - text: '下一步',  
33 - },  
34 - resetFunc: customResetFunc,  
35 - submitFunc: customSubmitFunc,  
36 }); 50 });
37 const setStepTwoFieldsValueFunc = (v) => { 51 const setStepTwoFieldsValueFunc = (v) => {
38 setFieldsValue(v); 52 setFieldsValue(v);
@@ -52,7 +66,13 @@ @@ -52,7 +66,13 @@
52 } finally { 66 } finally {
53 } 67 }
54 } 68 }
55 - return { register, setStepTwoFieldsValueFunc, customClearStepTwoValueFunc }; 69 + return {
  70 + customResetFunc,
  71 + customSubmitFunc,
  72 + register,
  73 + setStepTwoFieldsValueFunc,
  74 + customClearStepTwoValueFunc,
  75 + };
56 }, 76 },
57 }); 77 });
58 </script> 78 </script>
@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 v-if="isAddRuleStatus" 181 v-if="isAddRuleStatus"
182 style="border-radius: 10px" 182 style="border-radius: 10px"
183 class="mt-5" 183 class="mt-5"
184 - @click="addCreateRole(index)" 184 + @click="addCreateRule(index)"
185 ><PlusCircleOutlined />添加创建条件</a-button 185 ><PlusCircleOutlined />添加创建条件</a-button
186 > 186 >
187 </div> 187 </div>
@@ -189,8 +189,8 @@ @@ -189,8 +189,8 @@
189 <!-- 创建报警规则 --> 189 <!-- 创建报警规则 -->
190 <div style="height: 20px"></div> 190 <div style="height: 20px"></div>
191 <!-- 清除报警规则 --> 191 <!-- 清除报警规则 -->
192 - <div>  
193 - <p style="margin-left: 10px; font-size: medium">清除报警规则</p> 192 + <div v-if="clearRuleStatus || getStepThreeEditStatus">
  193 + <p style="margin-left: 10px; font-size: medium; position: relative">清除报警规则</p>
194 <template 194 <template
195 v-for="(childClearItem, clearIndexItem) in item.clearRule" 195 v-for="(childClearItem, clearIndexItem) in item.clearRule"
196 :key="childClearItem.id" 196 :key="childClearItem.id"
@@ -294,6 +294,29 @@ @@ -294,6 +294,29 @@
294 </div> 294 </div>
295 </div> 295 </div>
296 </template> 296 </template>
  297 + <!-- 移除按钮 -->
  298 + <div
  299 + class="remove-type"
  300 + style="display: inline-block; position: relative; top: -21.2vh; left: 41.4vw"
  301 + >
  302 + <img
  303 + v-if="isAddRuleStatus"
  304 + style="cursor: pointer"
  305 + @click="deleteClearCondition"
  306 + alt="移除"
  307 + src="../../../../assets/images/close.png"
  308 + />
  309 + </div>
  310 + <!-- 移除按钮 -->
  311 + </div>
  312 + <div>
  313 + <a-button
  314 + v-if="isAddRuleStatus"
  315 + style="border-radius: 10px; margin-top: -2vh"
  316 + class="mt-5"
  317 + @click="addClearRuleStatus"
  318 + ><PlusCircleOutlined />清除报警规则</a-button
  319 + >
297 </div> 320 </div>
298 <!-- 清除报警规则 --> 321 <!-- 清除报警规则 -->
299 </CollapseContainer> 322 </CollapseContainer>
@@ -470,8 +493,9 @@ @@ -470,8 +493,9 @@
470 const createAlarmArray = ref<[]>([]); 493 const createAlarmArray = ref<[]>([]);
471 const isLostFocuxStatus = ref(true); 494 const isLostFocuxStatus = ref(true);
472 const editIndex = ref(-1); 495 const editIndex = ref(-1);
473 - const allAlarmsData = ref<[]>([]);  
474 - let allAlarmsSingleObj = reactive({}); 496 + // const allAlarmsData = ref<[]>([]);
  497 + // let allAlarmsSingleObj = reactive({});
  498 + const clearRuleStatus = ref(false);
475 499
476 setTimeout(() => { 500 setTimeout(() => {
477 getIsShowAddRule = props.isShowAddRule; 501 getIsShowAddRule = props.isShowAddRule;
@@ -483,6 +507,9 @@ @@ -483,6 +507,9 @@
483 const clearProfileDataFunc = () => { 507 const clearProfileDataFunc = () => {
484 profileData.value.splice(0, 1); 508 profileData.value.splice(0, 1);
485 }; 509 };
  510 + const clearProfileDataFunc1 = () => {
  511 + profileData.value.length = 0;
  512 + };
486 //删除告警配置 513 //删除告警配置
487 const deleteAlarmRule = (index: number) => { 514 const deleteAlarmRule = (index: number) => {
488 profileData.value.splice(index, 1); 515 profileData.value.splice(index, 1);
@@ -552,33 +579,45 @@ @@ -552,33 +579,45 @@
552 const clearEditAllRegisterFormFunc = () => { 579 const clearEditAllRegisterFormFunc = () => {
553 getFilterStepThreeEditArr.value.length = 0; 580 getFilterStepThreeEditArr.value.length = 0;
554 getFilterStepThreeEditArr.value = []; 581 getFilterStepThreeEditArr.value = [];
555 - try {  
556 - proxy.$refs.alarmSeverityRef.resetFieldsFunc();  
557 - } catch {}  
558 }; 582 };
559 583
560 //重置表单数据 584 //重置表单数据
561 const clearAllRegisterFormFunc = () => { 585 const clearAllRegisterFormFunc = () => {
562 try { 586 try {
563 setTimeout(() => { 587 setTimeout(() => {
  588 + //报警类型
564 clearAlaramTypeValueFunc(); 589 clearAlaramTypeValueFunc();
  590 + //传递报警
565 clearTransmitAlarmFunc(); 591 clearTransmitAlarmFunc();
566 - resetRegisterFormClearChangeDetailFunc(); 592 + //报警严重程度
  593 + addChangeSeverity.value = {};
  594 + proxy.$refs.alarmSeverityRef?.resetFieldsFunc();
  595 + //报警详情模板
  596 + proxy.$refs.detailTemplateRef?.resetFieldsFunc();
  597 + //清除报警详情模板
  598 + resetRegisterFormClearChangeDetail();
  599 + //重置报警规则条件
  600 + fliterTempRuleConditionTempArr.value = [];
  601 + fliterTempRuleConditionTempArr.value.length = 0;
  602 + //重置报警启用规则
  603 + fliterTempOpenRuleTempArr.value = [];
  604 + fliterTempOpenRuleTempArr.value.length = 0;
  605 + //重置清除报警规则条件
  606 + fliterClearTempRuleConditionTempArr.value = [];
  607 + fliterClearTempRuleConditionTempArr.value.length = 0;
  608 + //重置清除报警启用规则
  609 + fliterClearTempOpenRuleTempArr.value = [];
  610 + fliterClearTempOpenRuleTempArr.value.length = 0;
567 resetAllTemplateFunc(); 611 resetAllTemplateFunc();
568 - }, 5000); 612 + }, 10);
569 } catch {} 613 } catch {}
570 }; 614 };
  615 +
571 //重置报警启用规则-报警规则条件 616 //重置报警启用规则-报警规则条件
572 const resetAllTemplateFunc = () => { 617 const resetAllTemplateFunc = () => {
573 - fliterTempOpenRuleTempArr.value = [];  
574 - fliterTempRuleConditionTempArr.value = [];  
575 - fliterClearTempRuleConditionTempArr.value = [];  
576 - fliterClearTempOpenRuleTempArr.value = [];  
577 allAlarms.value = []; 618 allAlarms.value = [];
578 tempDetailTempArr.value = []; 619 tempDetailTempArr.value = [];
579 addCreateRulesObj.createRules = {}; 620 addCreateRulesObj.createRules = {};
580 - profileData.value = [];  
581 - profileData.value.push(initProfileData);  
582 initClearCreateRuleFunc(); 621 initClearCreateRuleFunc();
583 getFilterStepThreeEditArr.value = []; 622 getFilterStepThreeEditArr.value = [];
584 getFilterStepThreeEditClearArr.value = []; 623 getFilterStepThreeEditClearArr.value = [];
@@ -595,11 +634,6 @@ @@ -595,11 +634,6 @@
595 }); 634 });
596 }; 635 };
597 636
598 - //清除修改详情模板  
599 - const resetRegisterFormClearChangeDetailFunc = () => {  
600 - resetRegisterFormClearChangeDetail();  
601 - };  
602 -  
603 //回显报警类型和传递报警数据 637 //回显报警类型和传递报警数据
604 const setAlaramTypeFormFunc = (v) => { 638 const setAlaramTypeFormFunc = (v) => {
605 setAlaramTypeValueFunc(v); 639 setAlaramTypeValueFunc(v);
@@ -735,13 +769,6 @@ @@ -735,13 +769,6 @@
735 return e; 769 return e;
736 } 770 }
737 }; 771 };
738 - const clearDetailTemplateFunc = () => {  
739 - try {  
740 - proxy.$refs.detailTemplateRef.resetFieldsFunc();  
741 - } catch (e) {  
742 - return e;  
743 - }  
744 - };  
745 const getRegisterClearFormChangeDetailFunc = () => { 772 const getRegisterClearFormChangeDetailFunc = () => {
746 changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); 773 changeGetClearDetailValue.value = getRegisterFormClearChangeDetail();
747 }; 774 };
@@ -768,10 +795,12 @@ @@ -768,10 +795,12 @@
768 //传递报警数据 795 //传递报警数据
769 const validateRegisterFormHighSettingFunc = () => { 796 const validateRegisterFormHighSettingFunc = () => {
770 const val = getTransmitAlarmFunc(); 797 const val = getTransmitAlarmFunc();
771 - propagateAndpropagateRelationTypes.propagate = val.propagate;  
772 - propagateAndpropagateRelationTypes.propagateRelationTypes.push(  
773 - val.propagateRelationTypes as never  
774 - ); 798 + try {
  799 + propagateAndpropagateRelationTypes.propagate = val.propagate;
  800 + propagateAndpropagateRelationTypes.propagateRelationTypes.push(
  801 + val.propagateRelationTypes as never
  802 + );
  803 + } catch {}
775 }; 804 };
776 //报警类型数据 805 //报警类型数据
777 const validateRegisterFormFunc = () => { 806 const validateRegisterFormFunc = () => {
@@ -782,33 +811,34 @@ @@ -782,33 +811,34 @@
782 const addAlarmRule = () => { 811 const addAlarmRule = () => {
783 profileData.value.push(initProfileData); 812 profileData.value.push(initProfileData);
784 addAlarmRuleFunc(); 813 addAlarmRuleFunc();
  814 + clearAllRegisterFormFunc();
785 }; 815 };
786 //添加报警规则方法 816 //添加报警规则方法
787 const addAlarmRuleFunc = () => { 817 const addAlarmRuleFunc = () => {
788 - validateRegisterFormFunc();  
789 - validateRegisterFormHighSettingFunc();  
790 - addCreateRuleFunc();  
791 - tempDetailTempArr.value.push(changeGetDetailValue.value as never);  
792 - tempDetailTempArr.value.forEach((f1) => {  
793 - kongDetail.value = f1;  
794 - });  
795 - addChangeSeverity.value = proxy.$refs.alarmSeverityRef.getFieldsValueFunc();  
796 - emptyCreateRoleFunc();  
797 - getOpenRuleAndRuleCondition();  
798 - tempOpenRuleTempArr.value.forEach((f2) => {  
799 - kongOpenRuleObj.schedule = f2;  
800 - });  
801 - tempRuleConditionTempArr.value.forEach((f3) => {  
802 - kongRuleConditionObj.condition = f3;  
803 - });  
804 - createRulesObj.value[addChangeSeverity.value?.default] = {  
805 - ...kongDetail.value,  
806 - ...addNewOpenRule,  
807 - ...addNewRuleTem,  
808 - ...kongOpenRuleObj,  
809 - ...kongRuleConditionObj,  
810 - };  
811 - console.log(createRulesObj); 818 + // validateRegisterFormFunc();
  819 + // validateRegisterFormHighSettingFunc();
  820 + // addCreateRuleFunc();
  821 + // tempDetailTempArr.value.push(changeGetDetailValue.value as never);
  822 + // tempDetailTempArr.value.forEach((f1) => {
  823 + // kongDetail.value = f1;
  824 + // });
  825 + // addChangeSeverity.value = proxy.$refs.alarmSeverityRef.getFieldsValueFunc();
  826 + // emptyCreateRoleFunc();
  827 + // getOpenRuleAndRuleCondition();
  828 + // tempOpenRuleTempArr.value.forEach((f2) => {
  829 + // kongOpenRuleObj.schedule = f2;
  830 + // });
  831 + // tempRuleConditionTempArr.value.forEach((f3) => {
  832 + // kongRuleConditionObj.condition = f3;
  833 + // });
  834 + // createRulesObj.value[addChangeSeverity.value?.default] = {
  835 + // ...kongDetail.value,
  836 + // ...addNewOpenRule,
  837 + // ...addNewRuleTem,
  838 + // ...kongOpenRuleObj,
  839 + // ...kongRuleConditionObj,
  840 + // };
  841 + // console.log(createRulesObj);
812 // const sigleAlarmTypeGetVal = []; 842 // const sigleAlarmTypeGetVal = [];
813 // let sigleAlarmTypeGetObj = {}; 843 // let sigleAlarmTypeGetObj = {};
814 // sigleAlarmTypeGetVal.push(alarmTypeGet.value as never); 844 // sigleAlarmTypeGetVal.push(alarmTypeGet.value as never);
@@ -823,11 +853,11 @@ @@ -823,11 +853,11 @@
823 }; 853 };
824 854
825 //初始化添加一个报警规则 855 //初始化添加一个报警规则
826 - const initAddAlarmRuleFunc = () => {  
827 - if (profileData.value.length === 0) {  
828 - profileData.value.push(initProfileData);  
829 - }  
830 - }; 856 + // const initAddAlarmRuleFunc = () => {
  857 + // if (profileData.value.length === 0) {
  858 + // profileData.value.push(initProfileData);
  859 + // }
  860 + // };
831 // 添加创建条件方法 861 // 添加创建条件方法
832 const addCreateRuleFunc = async () => { 862 const addCreateRuleFunc = async () => {
833 try { 863 try {
@@ -876,11 +906,12 @@ @@ -876,11 +906,12 @@
876 }; 906 };
877 907
878 // 添加创建条件 908 // 添加创建条件
879 - const addCreateRole = async (index: number) => { 909 + const addCreateRule = async (index: number) => {
880 profileData.value[index]?.alarms.push(initCreateRules); 910 profileData.value[index]?.alarms.push(initCreateRules);
881 addCreateRuleFunc(); 911 addCreateRuleFunc();
882 - proxy.$refs.alarmSeverityRef.updateSchemaSelectDisableFunc(); 912 + proxy.$refs.alarmSeverityRef?.updateSchemaSelectDisableFunc();
883 }; 913 };
  914 +
884 // 删除创建条件 915 // 删除创建条件
885 const deleteCondition = (index: number, createIndex: number) => { 916 const deleteCondition = (index: number, createIndex: number) => {
886 profileData.value[index].alarms.splice(createIndex, 1); 917 profileData.value[index].alarms.splice(createIndex, 1);
@@ -888,6 +919,13 @@ @@ -888,6 +919,13 @@
888 getFilterStepThreeEditArr.value.pop(); 919 getFilterStepThreeEditArr.value.pop();
889 } 920 }
890 }; 921 };
  922 +
  923 + const addClearRuleStatus = () => {
  924 + clearRuleStatus.value = true;
  925 + };
  926 + const deleteClearCondition = () => {
  927 + clearRuleStatus.value = false;
  928 + };
891 //报警规则 929 //报警规则
892 //启用规则 930 //启用规则
893 const getAllFieldsEnabFunc = (v) => { 931 const getAllFieldsEnabFunc = (v) => {
@@ -1018,13 +1056,11 @@ @@ -1018,13 +1056,11 @@
1018 getStepThreeEditStatus.value = false; 1056 getStepThreeEditStatus.value = false;
1019 setTimeout(() => { 1057 setTimeout(() => {
1020 openModal3(true); 1058 openModal3(true);
1021 - if (true) {  
1022 - try {  
1023 - setTimeout(() => {  
1024 - proxy.$refs.getChildData3.resetDataFunc();  
1025 - }, 100);  
1026 - } catch {}  
1027 - } 1059 + try {
  1060 + setTimeout(() => {
  1061 + proxy.$refs.getChildData3.resetDataFunc();
  1062 + }, 100);
  1063 + } catch {}
1028 }, 10); 1064 }, 10);
1029 }; 1065 };
1030 const handleOpenClearDetailTemplate = () => { 1066 const handleOpenClearDetailTemplate = () => {
@@ -1074,6 +1110,10 @@ @@ -1074,6 +1110,10 @@
1074 }; 1110 };
1075 1111
1076 return { 1112 return {
  1113 + deleteClearCondition,
  1114 + clearRuleStatus,
  1115 + addClearRuleStatus,
  1116 + clearProfileDataFunc1,
1077 clearEditAllRegisterFormFunc, 1117 clearEditAllRegisterFormFunc,
1078 returnChildItem, 1118 returnChildItem,
1079 editIndex, 1119 editIndex,
@@ -1100,7 +1140,7 @@ @@ -1100,7 +1140,7 @@
1100 tempOpenRuleTempArr, 1140 tempOpenRuleTempArr,
1101 kongOpenRuleObj, 1141 kongOpenRuleObj,
1102 allAlarms, 1142 allAlarms,
1103 - initAddAlarmRuleFunc, 1143 + // initAddAlarmRuleFunc,
1104 getChildData5, 1144 getChildData5,
1105 getChildData6, 1145 getChildData6,
1106 refAlarmDetailTemplate, 1146 refAlarmDetailTemplate,
@@ -1139,7 +1179,7 @@ @@ -1139,7 +1179,7 @@
1139 addAlarmRule, 1179 addAlarmRule,
1140 registerForm, 1180 registerForm,
1141 registerFormHighSetting, 1181 registerFormHighSetting,
1142 - addCreateRole, 1182 + addCreateRule,
1143 deleteCondition, 1183 deleteCondition,
1144 setCreateRegisterFormChangeDetailFunc, 1184 setCreateRegisterFormChangeDetailFunc,
1145 detailDetailModelArray, 1185 detailDetailModelArray,
@@ -1147,7 +1187,6 @@ @@ -1147,7 +1187,6 @@
1147 handleClickHidenEdit, 1187 handleClickHidenEdit,
1148 alarmSeverityRef, 1188 alarmSeverityRef,
1149 detailTemplateRef, 1189 detailTemplateRef,
1150 - clearDetailTemplateFunc,  
1151 }; 1190 };
1152 }, 1191 },
1153 }); 1192 });
@@ -101,6 +101,7 @@ export const formSchema: FormSchema[] = [ @@ -101,6 +101,7 @@ export const formSchema: FormSchema[] = [
101 label: '条件类型', 101 label: '条件类型',
102 colProps: { span: 13 }, 102 colProps: { span: 13 },
103 component: 'Select', 103 component: 'Select',
  104 + defaultValue: 'SIMPLE',
104 componentProps: { 105 componentProps: {
105 placeholder: '请选择报警日程表', 106 placeholder: '请选择报警日程表',
106 options: [ 107 options: [
@@ -175,7 +175,8 @@ export const formSchema: FormSchema[] = [ @@ -175,7 +175,8 @@ export const formSchema: FormSchema[] = [
175 field: 'value1', 175 field: 'value1',
176 label: '默认值', 176 label: '默认值',
177 colProps: { span: 13 }, 177 colProps: { span: 13 },
178 - component: 'Input', 178 + component: 'InputNumber',
  179 + defaultValue: 0,
179 componentProps: { 180 componentProps: {
180 maxLength: 16, 181 maxLength: 16,
181 placeholder: '请输入值(数字)', 182 placeholder: '请输入值(数字)',
@@ -266,7 +267,8 @@ export const formSchema: FormSchema[] = [ @@ -266,7 +267,8 @@ export const formSchema: FormSchema[] = [
266 field: 'value1', 267 field: 'value1',
267 label: '值', 268 label: '值',
268 colProps: { span: 13 }, 269 colProps: { span: 13 },
269 - component: 'Input', 270 + component: 'InputNumber',
  271 + defaultValue: 0,
270 componentProps: { 272 componentProps: {
271 placeholder: '请输入值(数字)', 273 placeholder: '请输入值(数字)',
272 }, 274 },
@@ -317,7 +319,7 @@ export const formSchema: FormSchema[] = [ @@ -317,7 +319,7 @@ export const formSchema: FormSchema[] = [
317 ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), 319 ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')),
318 }, 320 },
319 { 321 {
320 - field: '', 322 + field: 'no',
321 label: '默认值', 323 label: '默认值',
322 colProps: { span: 13 }, 324 colProps: { span: 13 },
323 component: 'Checkbox', 325 component: 'Checkbox',
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
  2 +import { ref } from 'vue';
  3 +
  4 +const isWhereType = ref('');
2 5
3 export const formSchema: FormSchema[] = [ 6 export const formSchema: FormSchema[] = [
4 { 7 {
5 field: 'default', 8 field: 'default',
  9 + component: 'Select',
6 label: '报警严重程度:', 10 label: '报警严重程度:',
  11 + defaultValue: 'CRITICAL',
7 colProps: { 12 colProps: {
8 span: 17, 13 span: 17,
9 }, 14 },
10 - component: 'Select',  
11 - componentProps: {  
12 - placeholder: '请选择报警严重程度',  
13 - options: [  
14 - {  
15 - value: 'CRITICAL',  
16 - label: '危险',  
17 - disabled: false,  
18 - },  
19 - {  
20 - value: 'MAJOR',  
21 - label: '重要',  
22 - disabled: false,  
23 - },  
24 - {  
25 - value: 'MINOR',  
26 - label: '次要',  
27 - disabled: false,  
28 - },  
29 - {  
30 - value: 'WARNING',  
31 - label: '警告',  
32 - disabled: false,  
33 - },  
34 - {  
35 - value: 'INDETERMINATE',  
36 - label: '不确定',  
37 - disabled: false, 15 + componentProps() {
  16 + return {
  17 + placeholder: '请选择严重程度',
  18 + options: [
  19 + {
  20 + value: 'CRITICAL',
  21 + label: '危险',
  22 + },
  23 + {
  24 + value: 'MAJOR',
  25 + label: '重要',
  26 + },
  27 + {
  28 + value: 'MINOR',
  29 + label: '次要',
  30 + },
  31 + {
  32 + value: 'WARNING',
  33 + label: '警告',
  34 + },
  35 + {
  36 + value: 'INDETERMINATE',
  37 + label: '不确定',
  38 + },
  39 + ],
  40 + onChange: (v) => {
  41 + isWhereType.value = v ? v : 'INDETERMINATE';
38 }, 42 },
39 - ], 43 + };
40 }, 44 },
41 }, 45 },
42 ]; 46 ];
@@ -31,38 +31,34 @@ @@ -31,38 +31,34 @@
31 fieldValue.value = getFieldsValue(); 31 fieldValue.value = getFieldsValue();
32 return fieldValue.value; 32 return fieldValue.value;
33 }; 33 };
  34 +
34 const item = [ 35 const item = [
35 { 36 {
36 value: 'CRITICAL', 37 value: 'CRITICAL',
37 label: '危险', 38 label: '危险',
38 - disabled: false,  
39 }, 39 },
40 { 40 {
41 value: 'MAJOR', 41 value: 'MAJOR',
42 label: '重要', 42 label: '重要',
43 - disabled: false,  
44 }, 43 },
45 { 44 {
46 value: 'MINOR', 45 value: 'MINOR',
47 label: '次要', 46 label: '次要',
48 - disabled: false,  
49 }, 47 },
50 { 48 {
51 value: 'WARNING', 49 value: 'WARNING',
52 label: '警告', 50 label: '警告',
53 - disabled: false,  
54 }, 51 },
55 { 52 {
56 value: 'INDETERMINATE', 53 value: 'INDETERMINATE',
57 label: '不确定', 54 label: '不确定',
58 - disabled: false,  
59 }, 55 },
60 ]; 56 ];
61 const updateSchemaSelectDisableFunc = () => { 57 const updateSchemaSelectDisableFunc = () => {
62 updateSchema({ 58 updateSchema({
63 field: 'default', 59 field: 'default',
64 componentProps: ({ formModel }) => { 60 componentProps: ({ formModel }) => {
65 - item.forEach((f) => { 61 + item.forEach((f: any) => {
66 if (f.value == formModel.default) { 62 if (f.value == formModel.default) {
67 f.disabled = true; 63 f.disabled = true;
68 } 64 }
@@ -74,14 +74,7 @@ export const step2Schemas: FormSchema[] = [ @@ -74,14 +74,7 @@ export const step2Schemas: FormSchema[] = [
74 label: '传输方式', 74 label: '传输方式',
75 defaultValue: 'DEFAULT', 75 defaultValue: 'DEFAULT',
76 componentProps: { 76 componentProps: {
77 - options: [  
78 - { label: 'DEFAULT', value: 'DEFAULT' },  
79 - { label: 'MQTT', value: 'MQTT' },  
80 - { label: 'TCP', value: 'TCP' },  
81 - { label: 'CoAP', value: 'CoAP' },  
82 - { label: 'LWM2M', value: 'LWM2M' },  
83 - { label: 'SNMP', value: 'SNMP' },  
84 - ], 77 + options: [{ label: '默认', value: 'DEFAULT' }],
85 }, 78 },
86 }, 79 },
87 ]; 80 ];
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 }; 38 };
39 const updateFieldDeviceId = (v) => { 39 const updateFieldDeviceId = (v) => {
40 const option = v; 40 const option = v;
  41 + console.log(option);
41 setTimeout(() => { 42 setTimeout(() => {
42 updateSchema({ 43 updateSchema({
43 field: 'entityId', 44 field: 'entityId',
@@ -98,6 +99,19 @@ @@ -98,6 +99,19 @@
98 }); 99 });
99 }, 10); 100 }, 10);
100 }; 101 };
  102 + const updateOperatorAndValue = () => {
  103 + updateSchema([
  104 + {
  105 + field: 'operation',
  106 + ifShow: false,
  107 + },
  108 + {
  109 + field: 'value',
  110 + ifShow: false,
  111 + },
  112 + ]);
  113 + };
  114 +
101 const resetFieldsValueFunc = () => { 115 const resetFieldsValueFunc = () => {
102 resetFields(); 116 resetFields();
103 }; 117 };
@@ -130,7 +144,7 @@ @@ -130,7 +144,7 @@
130 }, 144 },
131 ]); 145 ]);
132 } 146 }
133 - }, 10); 147 + }, 1);
134 } 148 }
135 }; 149 };
136 150
@@ -183,6 +197,7 @@ @@ -183,6 +197,7 @@
183 }); 197 });
184 }; 198 };
185 return { 199 return {
  200 + updateOperatorAndValue,
186 clearSelectAttribute, 201 clearSelectAttribute,
187 updateFieldType2Func, 202 updateFieldType2Func,
188 updateFieldDeviceId, 203 updateFieldDeviceId,
@@ -34,7 +34,12 @@ export enum AttrAndWenDuEnum { @@ -34,7 +34,12 @@ export enum AttrAndWenDuEnum {
34 IS_SHIDU = 'NUMERIC', 34 IS_SHIDU = 'NUMERIC',
35 IS_CONDITION_WENDU = 'NUMERIC2', 35 IS_CONDITION_WENDU = 'NUMERIC2',
36 IS_CONDITION_SHIDU = 'NUMERIC1', 36 IS_CONDITION_SHIDU = 'NUMERIC1',
  37 + IS_TYPE2 = 'type2',
37 } 38 }
  39 +export const isType2 = (type: string) => {
  40 + return type === AttrAndWenDuEnum.IS_TYPE2;
  41 +};
  42 +
38 export const isConditionShiDu = (type: string) => { 43 export const isConditionShiDu = (type: string) => {
39 return type === AttrAndWenDuEnum.IS_CONDITION_SHIDU; 44 return type === AttrAndWenDuEnum.IS_CONDITION_SHIDU;
40 }; 45 };
@@ -80,6 +85,11 @@ export const isHand = (type: string) => { @@ -80,6 +85,11 @@ export const isHand = (type: string) => {
80 85
81 export const columns: BasicColumn[] = [ 86 export const columns: BasicColumn[] = [
82 { 87 {
  88 + title: '创建时间',
  89 + dataIndex: 'createTime',
  90 + width: 180,
  91 + },
  92 + {
83 title: '场景联动名称', 93 title: '场景联动名称',
84 dataIndex: 'name', 94 dataIndex: 'name',
85 width: 200, 95 width: 200,
@@ -139,11 +149,6 @@ export const columns: BasicColumn[] = [ @@ -139,11 +149,6 @@ export const columns: BasicColumn[] = [
139 dataIndex: 'description', 149 dataIndex: 'description',
140 width: 200, 150 width: 200,
141 }, 151 },
142 - {  
143 - title: '创建时间',  
144 - dataIndex: 'createTime',  
145 - width: 180,  
146 - },  
147 ]; 152 ];
148 153
149 export const getData = ref(null); 154 export const getData = ref(null);
@@ -294,10 +299,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -294,10 +299,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
294 component: 'Select', 299 component: 'Select',
295 componentProps: { 300 componentProps: {
296 placeholder: '属性触发', 301 placeholder: '属性触发',
297 - options: [  
298 - { label: '属性触发', value: 'TIME_SERIES' },  
299 - // { label: '上下线触发', value: 'ATTRIBUTE' },  
300 - ], 302 + options: [{ label: '属性触发', value: 'TIME_SERIES' }],
301 }, 303 },
302 ifShow: ({ values }) => 304 ifShow: ({ values }) =>
303 !isTime(Reflect.get(values, 'triggerType')) && 305 !isTime(Reflect.get(values, 'triggerType')) &&
@@ -305,25 +307,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -305,25 +307,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [
305 !isHand(Reflect.get(values, 'triggerType')), 307 !isHand(Reflect.get(values, 'triggerType')),
306 colProps: { span: 12 }, 308 colProps: { span: 12 },
307 }, 309 },
308 - // {  
309 - // field: 'key1',  
310 - // label: '',  
311 - // component: 'Select',  
312 - // componentProps: {  
313 - // placeholder: '请选择上下线',  
314 - // options: [  
315 - // { label: '上下线', value: '1' },  
316 - // { label: '上线', value: '2' },  
317 - // { label: '下线', value: '3' },  
318 - // ],  
319 - // },  
320 - // colProps: { span: 12 },  
321 - // ifShow: ({ values }) =>  
322 - // isUpAndDown(Reflect.get(values, 'type1')) &&  
323 - // !isTime(Reflect.get(values, 'triggerType')) &&  
324 - // !isScene(Reflect.get(values, 'triggerType')) &&  
325 - // !isHand(Reflect.get(values, 'triggerType')),  
326 - // },  
327 { 310 {
328 field: 'type2', 311 field: 'type2',
329 label: '', 312 label: '',
@@ -340,7 +323,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -340,7 +323,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
340 !isTime(Reflect.get(values, 'triggerType')) && 323 !isTime(Reflect.get(values, 'triggerType')) &&
341 !isScene(Reflect.get(values, 'triggerType')) && 324 !isScene(Reflect.get(values, 'triggerType')) &&
342 !isHand(Reflect.get(values, 'triggerType')) && 325 !isHand(Reflect.get(values, 'triggerType')) &&
343 - !isUpAndDown(Reflect.get(values, 'type1')), 326 + isUpAndDown(Reflect.get(values, 'type1')),
344 colProps: { span: 12 }, 327 colProps: { span: 12 },
345 }, 328 },
346 { 329 {
@@ -357,23 +340,23 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -357,23 +340,23 @@ export const useTriggerDrawerSchema: FormSchema[] = [
357 { label: '>=', value: 'GREATER_OR_EQUAL' }, 340 { label: '>=', value: 'GREATER_OR_EQUAL' },
358 ], 341 ],
359 }, 342 },
360 - ifShow: false, 343 + ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')),
361 colProps: { span: 12 }, 344 colProps: { span: 12 },
362 }, 345 },
363 { 346 {
364 field: 'value', 347 field: 'value',
365 component: 'Input', 348 component: 'Input',
366 label: '', 349 label: '',
  350 + defaultValue: 0,
367 componentProps: { 351 componentProps: {
368 maxLength: 16, 352 maxLength: 16,
369 placeholder: '请输入比较值', 353 placeholder: '请输入比较值',
370 }, 354 },
371 - ifShow: false, 355 + ifShow: ({ values }) => isType2(Reflect.get(values, 'type2')),
372 colProps: { 356 colProps: {
373 span: 12, 357 span: 12,
374 }, 358 },
375 }, 359 },
376 -  
377 { 360 {
378 field: 'sceneLinkageId', 361 field: 'sceneLinkageId',
379 label: '', 362 label: '',
@@ -390,19 +373,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -390,19 +373,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [
390 }, 373 },
391 ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), 374 ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')),
392 }, 375 },
393 -  
394 - // {  
395 - // field: 'no3',  
396 - // label: '',  
397 - // component: 'ApiSelect',  
398 - // colProps: {  
399 - // span: 12,  
400 - // },  
401 - // componentProps: {  
402 - // placeholder: '暂不实现',  
403 - // },  
404 - // ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')),  
405 - // },  
406 ]; 376 ];
407 377
408 export const useConditionDrawerSchema: FormSchema[] = [ 378 export const useConditionDrawerSchema: FormSchema[] = [
@@ -536,12 +506,11 @@ export const useActionDrawerSchema: FormSchema[] = [ @@ -536,12 +506,11 @@ export const useActionDrawerSchema: FormSchema[] = [
536 { 506 {
537 field: 'doContext', 507 field: 'doContext',
538 component: 'InputTextArea', 508 component: 'InputTextArea',
539 - defaultValue:  
540 - '{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1,"DO2": 1,"DO3": 1,"DO4": 1}}}',  
541 label: '', 509 label: '',
542 componentProps: { 510 componentProps: {
543 maxLength: 255, 511 maxLength: 255,
544 - placeholder: '请输入下发指定', 512 + placeholder:
  513 + '请输入下发指定(JSON格式:{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1}})',
545 }, 514 },
546 ifShow: ({ values }) => 515 ifShow: ({ values }) =>
547 !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')), 516 !isScene(Reflect.get(values, 'outTarget')) && !isMsg(Reflect.get(values, 'outTarget')),
@@ -374,17 +374,15 @@ @@ -374,17 +374,15 @@
374 }); 374 });
375 }); 375 });
376 376
377 - options.items.forEach((v) => {  
378 - return (v.value = v.tbDeviceId), (v.label = v.name); 377 + optionsItemArray.value = options.items.map((v) => {
  378 + return {
  379 + value: v.tbDeviceId,
  380 + label: v.name,
  381 + };
379 }); 382 });
380 - optionsItemArray.value = options.items;  
381 - try {  
382 - proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value);  
383 - proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value);  
384 - proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value);  
385 - } catch (e) {  
386 - return e;  
387 - } 383 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);
  384 + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);
  385 + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value);
388 } catch (e) { 386 } catch (e) {
389 return e; 387 return e;
390 } 388 }
@@ -392,6 +390,7 @@ @@ -392,6 +390,7 @@
392 }); 390 });
393 const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); 391 const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动'));
394 const handleClose = () => { 392 const handleClose = () => {
  393 + editTriggerPushData.value.length = 0;
395 pushEditArray.value.length = 0; 394 pushEditArray.value.length = 0;
396 pushEditConditionArray.value.length = 0; 395 pushEditConditionArray.value.length = 0;
397 pushEditActionArray.value.length = 0; 396 pushEditActionArray.value.length = 0;
@@ -403,6 +402,13 @@ @@ -403,6 +402,13 @@
403 filterArrayTrigger.length = 0; 402 filterArrayTrigger.length = 0;
404 filterArrayCondition.value.length = 0; 403 filterArrayCondition.value.length = 0;
405 filterArrayAction.value.length = 0; 404 filterArrayAction.value.length = 0;
  405 + proxy.$refs.refTriggerChild?.resetFieldsValueFunc();
  406 + proxy.$refs.refTriggerChild?.clearSelectDevice();
  407 + proxy.$refs.refTriggerChild?.clearSelectAttribute();
  408 + proxy.$refs.refConditionChild?.resetFieldsValueFunc();
  409 + proxy.$refs.refConditionChild?.clearSelectDevice();
  410 + proxy.$refs.refActionChild?.resetFieldsValueFunc();
  411 + proxy.$refs.refActionChild?.clearSelectDevice();
406 }; 412 };
407 413
408 const clearAllArrayFunc = () => { 414 const clearAllArrayFunc = () => {
@@ -430,23 +436,24 @@ @@ -430,23 +436,24 @@
430 }; 436 };
431 watch(getData, async (newV: string) => { 437 watch(getData, async (newV: string) => {
432 const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); 438 const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV });
433 - options.items.forEach((v) => {  
434 - return (v.value = v.tbDeviceId), (v.label = v.name); 439 + optionsItemArray.value = options.items.map((v) => {
  440 + return {
  441 + value: v.tbDeviceId,
  442 + label: v.name,
  443 + };
435 }); 444 });
436 - optionsItemArray.value = options.items; 445 + // optionsItemArray.value = options.items;
437 updateDeviceIdFunc(optionsItemArray.value); 446 updateDeviceIdFunc(optionsItemArray.value);
438 - try {  
439 - proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value);  
440 - } catch (e) {  
441 - return e;  
442 - } 447 + proxy.$refs.refActionChild?.updateFieldDeviceId(optionsItemArray.value);
  448 + proxy.$refs.refConditionChild?.updateFieldDeviceId(optionsItemArray.value);
  449 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);
443 }); 450 });
444 451
445 const updateDeviceIdFunc = (v) => { 452 const updateDeviceIdFunc = (v) => {
446 try { 453 try {
447 - proxy.$refs.refTriggerChild.updateFieldDeviceId(v);  
448 - proxy.$refs.refConditionChild.updateFieldDeviceId(v);  
449 - proxy.$refs.refActionChild.updateFieldDeviceId(v); 454 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(v);
  455 + proxy.$refs.refConditionChild?.updateFieldDeviceId(v);
  456 + proxy.$refs.refActionChild?.updateFieldDeviceId(v);
450 } catch (e) { 457 } catch (e) {
451 return e; 458 return e;
452 } 459 }
@@ -503,7 +510,7 @@ @@ -503,7 +510,7 @@
503 // type: m.type2 == null ? 'NUMERIC' : m.type2, 510 // type: m.type2 == null ? 'NUMERIC' : m.type2,
504 type: 'NUMERIC', 511 type: 'NUMERIC',
505 value: { 512 value: {
506 - defaultValue: Number(m.value) == null ? 0 : Number(m.value), 513 + defaultValue: Number(m.value),
507 }, 514 },
508 operation: m.operation == null ? 'EQUAL' : m.operation, 515 operation: m.operation == null ? 'EQUAL' : m.operation,
509 }, 516 },
@@ -654,7 +661,7 @@ @@ -654,7 +661,7 @@
654 // type: m.type2 == null ? 'NUMERIC' : m.type2, 661 // type: m.type2 == null ? 'NUMERIC' : m.type2,
655 type: 'NUMERIC', 662 type: 'NUMERIC',
656 value: { 663 value: {
657 - defaultValue: Number(m.value) == null ? 0 : Number(m.value), 664 + defaultValue: Number(m.value),
658 }, 665 },
659 operation: m.operation == null ? 'EQUAL' : m.operation, 666 operation: m.operation == null ? 'EQUAL' : m.operation,
660 }, 667 },
@@ -668,8 +675,8 @@ @@ -668,8 +675,8 @@
668 }); 675 });
669 try { 676 try {
670 setTimeout(() => { 677 setTimeout(() => {
671 - proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value);  
672 - }, 50); 678 + proxy.$refs.refTriggerChild?.updateFieldDeviceId(optionsItemArray.value);
  679 + }, 10);
673 } catch (e) { 680 } catch (e) {
674 return e; 681 return e;
675 } 682 }
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 let selectedRowKeys: Array<string> = []; 66 let selectedRowKeys: Array<string> = [];
67 const [registerDrawer, { openDrawer }] = useDrawer(); 67 const [registerDrawer, { openDrawer }] = useDrawer();
68 const { createMessage } = useMessage(); 68 const { createMessage } = useMessage();
69 - const [registerTable, { reload, getSelectRowKeys }] = useTable({ 69 + const [registerTable, { reload, getSelectRows }] = useTable({
70 title: '租户配置列表', 70 title: '租户配置列表',
71 clickToRowSelect: false, 71 clickToRowSelect: false,
72 api: getTableTenantProfileApi, 72 api: getTableTenantProfileApi,