Commit 477fbb7b0275f314bf6ec6f74c5326aa3fcbf532

Authored by fengistao
1 parent 288e6508

feat:设备配置传输类型新增默认类型

@@ -149,6 +149,7 @@ @@ -149,6 +149,7 @@
149 function handleStep2Next(v) { 149 function handleStep2Next(v) {
150 current.value++; 150 current.value++;
151 getStepTwoData.value = v; 151 getStepTwoData.value = v;
  152 + proxy.$refs.DeviceProfileStep3Ref.addAlarmRule();
152 } 153 }
153 function handleStep3Next(v) { 154 function handleStep3Next(v) {
154 current.value++; 155 current.value++;
1 <template> 1 <template>
2 <div class="step3"> 2 <div class="step3">
3 <template v-for="(item, index) in profileData" :key="item.id"> 3 <template v-for="(item, index) in profileData" :key="item.id">
4 - <CollapseContainer class="border mb-1"> 4 + <CollapseContainer class="border mb-1" :canExpan="false">
5 <template #action> 5 <template #action>
6 <div @click="deleteAlarmRule(index)" class="cursor-pointer"> 6 <div @click="deleteAlarmRule(index)" class="cursor-pointer">
7 <DeleteOutlined style="font-size: 20px" class="mr-2" /> 7 <DeleteOutlined style="font-size: 20px" class="mr-2" />
8 </div> 8 </div>
9 </template> 9 </template>
10 - <div style="margin-left: -30px"> <BasicForm @register="registerForm" /></div> 10 + <div class="alert-type" style="margin-left: -30px; margin-top: -10px">
  11 + <BasicForm @register="registerForm"
  12 + /></div>
11 <CollapseContainer style="margin-top: -20px"> 13 <CollapseContainer style="margin-top: -20px">
12 <template #action> </template> 14 <template #action> </template>
13 <div style="margin-left: 10px"> 15 <div style="margin-left: 10px">
@@ -22,52 +24,63 @@ @@ -22,52 +24,63 @@
22 <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> 24 <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id">
23 <div class="aic mb-1" style="border: 1px solid #bfbfbf"> 25 <div class="aic mb-1" style="border: 1px solid #bfbfbf">
24 <div class="w-3/4"> 26 <div class="w-3/4">
25 - <div style="margin-left: -30px"  
26 - ><BasicForm @register="registerFormCreateAlarm"  
27 - /></div>  
28 - <div style="margin-left: 5px">  
29 - <p style="color: #f5594e" class="mt-4 ml-4"  
30 - >请添加报警规则条件  
31 - <PlusOutlined 27 + <div style="margin-left: -30px; margin-top: 20px"
  28 + ><BasicForm @register="registerFormCreateAlarm" />
  29 + </div>
  30 + <div style="margin-left: 5px; position: relative">
  31 + <div style="color: #f5594e" class="mt-4 ml-4"
  32 + >报警规则条件:
  33 + <Button size="small" type="primary" @click="handleOpenAlaramRuleConditions"
  34 + >添加</Button
  35 + >
  36 + <p>{{ ruleTemplateData }}</p>
  37 + <!-- <PlusOutlined
32 @click="handleOpenAlaramRuleConditions" 38 @click="handleOpenAlaramRuleConditions"
33 class="cursor-pointer ml-4" 39 class="cursor-pointer ml-4"
34 style="font-size: 20px" 40 style="font-size: 20px"
35 - />{{ ruleTemplateData }}  
36 - </p>  
37 - <p style="white-space: wrap" class="mt-4 ml-4"  
38 - >启用规则:始终启用  
39 - <EditOutlined 41 + />{{ ruleTemplateData }} -->
  42 + </div>
  43 + <div style="white-space: wrap" class="mt-4 ml-4"
  44 + >启用规则:
  45 + <Button size="small" type="primary" @click="handleOpenEnableRule">添加</Button>
  46 + <p>{{ enableTemplateData }}</p>
  47 + <!-- <EditOutlined
40 @click="handleOpenEnableRule" 48 @click="handleOpenEnableRule"
41 class="cursor-pointer ml-4" 49 class="cursor-pointer ml-4"
42 style="font-size: 20px" 50 style="font-size: 20px"
43 - />{{ enableTemplateData }}  
44 - </p>  
45 - <p class="mt-4 ml-4"  
46 - >详情模板:<EditOutlined 51 + /> -->
  52 + <div class="mt-4 ml-4" style="margin-left: 0px"
  53 + >详情模板:
  54 + <Button size="small" type="primary" @click="handleOpenDetailTemplate"
  55 + >添加</Button
  56 + >
  57 + <p>{{ detailTemplateData }}</p>
  58 + <!-- <EditOutlined
47 @click="handleOpenDetailTemplate" 59 @click="handleOpenDetailTemplate"
48 class="cursor-pointer ml-4" 60 class="cursor-pointer ml-4"
49 style="font-size: 20px" 61 style="font-size: 20px"
50 - />{{ detailTemplateData }}  
51 - </p>  
52 - <div style="margin-left: 16px">  
53 - <BasicForm @register="dashboardForm" /> 62 + /> -->
  63 + </div>
  64 + <div style="margin-left: 0px">
  65 + <BasicForm @register="dashboardForm" />
  66 + </div>
54 </div> 67 </div>
55 </div> 68 </div>
56 - </div>  
57 - <div class="w-1/4 flex justify-center">  
58 - <img  
59 - style="cursor: pointer"  
60 - @click="deleteCondition(index, createIndex)"  
61 - alt="移除"  
62 - src="../../../../assets/images/close.png"  
63 - />  
64 - <!-- <Tooltip title="移除"> 69 + <div class="remove-type" style="position: absolute; top: -10px; right: 10px">
  70 + <img
  71 + style="cursor: pointer"
  72 + @click="deleteCondition(index, createIndex)"
  73 + alt="移除"
  74 + src="../../../../assets/images/close.png"
  75 + />
  76 + <!-- <Tooltip title="移除">
65 <MinusCircleOutlined 77 <MinusCircleOutlined
66 style="font-size: 25px; color: #305680" 78 style="font-size: 25px; color: #305680"
67 class="cursor-pointer" 79 class="cursor-pointer"
68 @click="deleteCondition(index, createIndex)" 80 @click="deleteCondition(index, createIndex)"
69 /> 81 />
70 </Tooltip> --> 82 </Tooltip> -->
  83 + </div>
71 </div> 84 </div>
72 </div> 85 </div>
73 </template> 86 </template>
@@ -80,48 +93,61 @@ @@ -80,48 +93,61 @@
80 <div class="aic mb-1" style="border: 1px solid #bfbfbf"> 93 <div class="aic mb-1" style="border: 1px solid #bfbfbf">
81 <div class="w-3/4"> 94 <div class="w-3/4">
82 <div style="margin-left: 5px"> 95 <div style="margin-left: 5px">
83 - <p style="color: #f5594e" class="mt-4 ml-4"  
84 - >请添加报警规则条件  
85 - <PlusOutlined 96 + <div style="color: #f5594e" class="mt-4 ml-4"
  97 + >报警规则条件:
  98 + <Button size="small" type="primary" @click="handleOpenClearAlaramRuleConditions"
  99 + >添加</Button
  100 + >
  101 + <p>{{ ruleClearTemplateData }}</p>
  102 + <!-- <PlusOutlined
86 @click="handleOpenClearAlaramRuleConditions" 103 @click="handleOpenClearAlaramRuleConditions"
87 class="cursor-pointer ml-4" 104 class="cursor-pointer ml-4"
88 style="font-size: 20px" 105 style="font-size: 20px"
89 - />{{ ruleClearTemplateData }}</p  
90 - >  
91 - <p class="mt-4 ml-4"  
92 - >启用规则:始终启用  
93 - <EditOutlined 106 + /> -->
  107 + </div>
  108 + <div style="white-space: wrap" class="mt-4 ml-4"
  109 + >启用规则:
  110 + <Button size="small" type="primary" @click="handleOpenClearEnableRule"
  111 + >添加</Button
  112 + >
  113 + <p>{{ enableClearTemplateData }}</p>
  114 + <!-- <EditOutlined
94 @click="handleOpenClearEnableRule" 115 @click="handleOpenClearEnableRule"
95 class="cursor-pointer ml-4" 116 class="cursor-pointer ml-4"
96 style="font-size: 20px" 117 style="font-size: 20px"
97 - />{{ enableClearTemplateData }}</p  
98 - >  
99 - <p class="mt-4 ml-4"  
100 - >详情模板:<EditOutlined 118 + /> -->
  119 + <div class="mt-4 ml-4" style="margin-left: 0px"
  120 + >详情模板:
  121 + <Button size="small" type="primary" @click="handleOpenClearDetailTemplate"
  122 + >添加</Button
  123 + >
  124 + <p>{{ detailClearTemplateData }}</p>
  125 + <!-- <EditOutlined
101 @click="handleOpenClearDetailTemplate" 126 @click="handleOpenClearDetailTemplate"
102 class="cursor-pointer ml-4" 127 class="cursor-pointer ml-4"
103 style="font-size: 20px" 128 style="font-size: 20px"
104 - />{{ detailClearTemplateData }}</p  
105 - >  
106 - <div style="margin-left: 16px">  
107 - <BasicForm @register="dashboardForm" /> 129 + /> -->
  130 + </div>
  131 + <div style="margin-left: 0px">
  132 + <BasicForm @register="dashboardForm" />
  133 + </div>
108 </div> 134 </div>
109 </div> 135 </div>
110 - </div>  
111 - <div class="w-1/4 flex justify-center">  
112 - <img  
113 - style="cursor: pointer"  
114 - @click="deleteClearCondition(index, createIndex)"  
115 - alt="移除"  
116 - src="../../../../assets/images/close.png"  
117 - />  
118 - <!-- <Tooltip title="移除"> 136 + <div class="w-1/4 flex justify-center">
  137 + <img
  138 + style="cursor: pointer"
  139 + @click="deleteClearCondition(index, createIndex)"
  140 + alt="移除"
  141 + src="../../../../assets/images/close.png"
  142 + />
  143 + <!-- <Tooltip title="移除">
119 <MinusCircleOutlined 144 <MinusCircleOutlined
120 style="font-size: 25px; color: #305680" 145 style="font-size: 25px; color: #305680"
121 class="cursor-pointer" 146 class="cursor-pointer"
122 @click="deleteClearCondition(index, createIndex)" 147 @click="deleteClearCondition(index, createIndex)"
123 /> 148 />
124 </Tooltip> --> 149 </Tooltip> -->
  150 + </div>
125 </div> 151 </div>
126 </div> 152 </div>
127 </template> 153 </template>
@@ -204,6 +230,7 @@ @@ -204,6 +230,7 @@
204 import DetailTemplate from './cpns/detailtemplate/index.vue'; 230 import DetailTemplate from './cpns/detailtemplate/index.vue';
205 import EnableRule from './cpns/enablerule/index.vue'; 231 import EnableRule from './cpns/enablerule/index.vue';
206 import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; 232 import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue';
  233 + import { Button } from '/@/components/Button';
207 234
208 export default defineComponent({ 235 export default defineComponent({
209 components: { 236 components: {
@@ -219,6 +246,7 @@ @@ -219,6 +246,7 @@
219 DetailTemplate, 246 DetailTemplate,
220 EnableRule, 247 EnableRule,
221 AlarmRuleConditions, 248 AlarmRuleConditions,
  249 + Button,
222 }, 250 },
223 emits: ['prev', 'next'], 251 emits: ['prev', 'next'],
224 setup(_, { emit }) { 252 setup(_, { emit }) {
@@ -231,6 +259,7 @@ @@ -231,6 +259,7 @@
231 const alarmss: any = ref([]); 259 const alarmss: any = ref([]);
232 const emptyObj: any = ref({}); 260 const emptyObj: any = ref({});
233 const detailObj: any = ref({}); 261 const detailObj: any = ref({});
  262 + const detailClearObj: any = ref({});
234 const ruleObj: any = ref({}); 263 const ruleObj: any = ref({});
235 const ruleLastObj: any = ref({}); 264 const ruleLastObj: any = ref({});
236 const enableObj: any = ref({}); 265 const enableObj: any = ref({});
@@ -246,32 +275,32 @@ @@ -246,32 +275,32 @@
246 const detailClearTemplateData: any = ref(null); 275 const detailClearTemplateData: any = ref(null);
247 //告警列表 276 //告警列表
248 let profileData = ref<alarmListItem[]>([ 277 let profileData = ref<alarmListItem[]>([
249 - {  
250 - configuration: {},  
251 - transportConfiguration: {},  
252 - provisionConfiguration: {  
253 - provisionDeviceSecret: '',  
254 - },  
255 - alarms: [  
256 - {  
257 - id: Date.now() + Math.random(),  
258 - alarmType: '',  
259 - createRules: {},  
260 - clearRule: {},  
261 - propagate: true,  
262 - propagateRelationTypes: [''],  
263 - },  
264 - ],  
265 - clearAlarms: [  
266 - {  
267 - id: Date.now() + Math.random(),  
268 - alarmType: '',  
269 - clearRules: {},  
270 - propagate: true,  
271 - propagateRelationTypes: [''],  
272 - },  
273 - ],  
274 - }, 278 + // {
  279 + // configuration: {},
  280 + // transportConfiguration: {},
  281 + // provisionConfiguration: {
  282 + // provisionDeviceSecret: '',
  283 + // },
  284 + // alarms: [
  285 + // {
  286 + // id: Date.now() + Math.random(),
  287 + // alarmType: '',
  288 + // createRules: {},
  289 + // clearRule: {},
  290 + // propagate: true,
  291 + // propagateRelationTypes: [''],
  292 + // },
  293 + // ],
  294 + // clearAlarms: [
  295 + // {
  296 + // id: Date.now() + Math.random(),
  297 + // alarmType: '',
  298 + // clearRules: {},
  299 + // propagate: true,
  300 + // propagateRelationTypes: [''],
  301 + // },
  302 + // ],
  303 + // },
275 ]); 304 ]);
276 const log = (e) => { 305 const log = (e) => {
277 console.log(e); 306 console.log(e);
@@ -286,6 +315,7 @@ @@ -286,6 +315,7 @@
286 }; 315 };
287 316
288 const addAlarmRule = () => { 317 const addAlarmRule = () => {
  318 + console.log(typeof unref(profileData));
289 unref(profileData).push({ 319 unref(profileData).push({
290 configuration: {}, 320 configuration: {},
291 transportConfiguration: {}, 321 transportConfiguration: {},
@@ -542,7 +572,7 @@ @@ -542,7 +572,7 @@
542 //清除条件 572 //清除条件
543 //详情模板 573 //详情模板
544 const getAllClearFieldsFunc = (v) => { 574 const getAllClearFieldsFunc = (v) => {
545 - detailObj.value = v; 575 + detailClearObj.value = v;
546 detailClearTemplateData.value = ` 576 detailClearTemplateData.value = `
547 报警详细信息:${v.alarmDetails} 577 报警详细信息:${v.alarmDetails}
548 `; 578 `;
@@ -669,7 +699,7 @@ @@ -669,7 +699,7 @@
669 const getClearSchedule = { 699 const getClearSchedule = {
670 schedule: scheduleClearValue, 700 schedule: scheduleClearValue,
671 }; 701 };
672 - const getClearAdditionalProp = Object.assign({}, detailObj.value, getClearSchedule); 702 + const getClearAdditionalProp = Object.assign({}, detailClearObj.value, getClearSchedule);
673 const scheduleValue = { 703 const scheduleValue = {
674 type: enableObj.value.schedule, 704 type: enableObj.value.schedule,
675 daysOfWeek: enableObj.value.daysOfWeek, 705 daysOfWeek: enableObj.value.daysOfWeek,
@@ -847,4 +877,7 @@ @@ -847,4 +877,7 @@
847 :deep(.vben-collapse-container__header) { 877 :deep(.vben-collapse-container__header) {
848 border: none; 878 border: none;
849 } 879 }
  880 + :deep(.anticon svg) {
  881 + display: none !important;
  882 + }
850 </style> 883 </style>
@@ -73,9 +73,10 @@ export const step2Schemas: FormSchema[] = [ @@ -73,9 +73,10 @@ export const step2Schemas: FormSchema[] = [
73 field: 'transportType', 73 field: 'transportType',
74 component: 'Select', 74 component: 'Select',
75 label: '传输方式', 75 label: '传输方式',
76 - defaultValue: 'CoAP', 76 + defaultValue: 'DEFAULT',
77 componentProps: { 77 componentProps: {
78 options: [ 78 options: [
  79 + { label: 'DEFAULT', value: 'DEFAULT' },
79 { label: 'MQTT', value: 'MQTT' }, 80 { label: 'MQTT', value: 'MQTT' },
80 { label: 'TCP', value: 'TCP' }, 81 { label: 'TCP', value: 'TCP' },
81 { label: 'CoAP', value: 'CoAP' }, 82 { label: 'CoAP', value: 'CoAP' },