Commit c1be4cb4570d621bee9034f3da61941ff806d944

Authored by xp.Huang
2 parents 29444437 59fedf58

Merge branch 'ft-dev' into 'main'

feat:修改

See merge request huang/yun-teng-iot-front!55
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 step1Schemas, 75 step1Schemas,
76 step2Schemas, 76 step2Schemas,
77 step3Schemas, 77 step3Schemas,
78 - step3HighSetting, 78 + step3ViewHighSetting,
79 step3CreateAlarm, 79 step3CreateAlarm,
80 alertContactsSchemas, 80 alertContactsSchemas,
81 echoFormSchema, 81 echoFormSchema,
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 }, 113 },
114 }); 114 });
115 const [registerStep3HighSetting, { setFieldsValue: setRegisterStep3HighSetting }] = useForm({ 115 const [registerStep3HighSetting, { setFieldsValue: setRegisterStep3HighSetting }] = useForm({
116 - schemas: step3HighSetting, 116 + schemas: step3ViewHighSetting,
117 actionColOptions: { 117 actionColOptions: {
118 span: 24, 118 span: 24,
119 }, 119 },
@@ -189,43 +189,49 @@ @@ -189,43 +189,49 @@
189 break; 189 break;
190 case '2': 190 case '2':
191 setRegisterTrans({ 191 setRegisterTrans({
192 - transportType: descInfo.value.profileData.transportConfiguration.type, 192 + transportType: descInfo.value.profileData?.transportConfiguration.type,
193 }); 193 });
194 break; 194 break;
195 case '3': 195 case '3':
196 setRegisterStep3Schemas({ 196 setRegisterStep3Schemas({
197 - alarmType: descInfo.value.profileData.alarms[0].alarmType, 197 + alarmType: descInfo.value.profileData?.alarms[0].alarmType,
198 }); 198 });
199 setRegisterStep3HighSetting({ 199 setRegisterStep3HighSetting({
200 - propagate: descInfo.value.profileData.alarms[0].propagate,  
201 - propagateRelationTypes:  
202 - descInfo.value.profileData.alarms[0].propagateRelationTypes[0], 200 + propagate: descInfo.value.profileData?.alarms[0].propagate,
  201 + propagateRelationTypes: descInfo.value.profileData?.alarms[0].propagateRelationTypes,
203 }); 202 });
204 - const getKey = Object.keys(descInfo.value.profileData.alarms[0].createRules);  
205 - console.log(descInfo.value.profileData.alarms[0].createRules[getKey[0]]); 203 + const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules);
  204 + console.log(descInfo.value.profileData?.alarms[0].createRules[getKey[0]]);
206 // console.log(descInfo.value.profileData.alarms[0].createRules.MAJOR); 205 // console.log(descInfo.value.profileData.alarms[0].createRules.MAJOR);
207 // console.log(descInfo.value.profileData.alarms[0].createRules['MAJOR']); 206 // console.log(descInfo.value.profileData.alarms[0].createRules['MAJOR']);
208 setRegisterStep3CreateAlarm({ 207 setRegisterStep3CreateAlarm({
209 - MAJOR: descInfo.value.profileData.alarms[0].createRules[getKey[0]] + '', 208 + WARNING: descInfo.value.profileData?.alarms[0].createRules[getKey[0]],
210 }); 209 });
211 setRegisterStep3RuleAlarm({ 210 setRegisterStep3RuleAlarm({
212 - type: descInfo.value.profileData.alarms[0].createRules[getKey[0]].condition.condition  
213 - .key.type,  
214 - key: descInfo.value.profileData.alarms[0].createRules[getKey[0]].condition.condition  
215 - .key.key, 211 + type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition
  212 + .condition[0].key.type,
  213 + key: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition
  214 + .condition[0].key.key,
216 valueType: 215 valueType:
217 - descInfo.value.profileData.alarms[0].createRules[getKey[0]].condition.condition 216 + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0]
218 .valueType, 217 .valueType,
  218 + value:
  219 + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0]
  220 + .value,
  221 + predicate:
  222 + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0]
  223 + .predicate,
219 }); 224 });
220 setRegisterStep3Condition({ 225 setRegisterStep3Condition({
221 conditionType: 226 conditionType:
222 - descInfo.value.profileData.alarms[0].createRules[getKey[0]].condition.spec.type, 227 + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec.type,
223 }); 228 });
224 setRegisterStep3Enable({ 229 setRegisterStep3Enable({
225 - schedule: descInfo.value.profileData.alarms[0].createRules[getKey[0]].schedule, 230 + schedule: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule,
226 }); 231 });
227 setRegisterStep3TemplateDetail({ 232 setRegisterStep3TemplateDetail({
228 - alarmDetails: descInfo.value.profileData.alarms[0].createRules, 233 + alarmDetails:
  234 + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails,
229 }); 235 });
230 break; 236 break;
231 case '4': 237 case '4':
@@ -71,6 +71,7 @@ @@ -71,6 +71,7 @@
71 const [registerModalDetail, { openModal: openModalDetail }] = useModal(); 71 const [registerModalDetail, { openModal: openModalDetail }] = useModal();
72 const [registerTable, { reload, getSelectRowKeys }] = useTable({ 72 const [registerTable, { reload, getSelectRowKeys }] = useTable({
73 title: '设备配置列表', 73 title: '设备配置列表',
  74 + pagination: true,
74 clickToRowSelect: false, 75 clickToRowSelect: false,
75 api: deviceConfigGetQuery, 76 api: deviceConfigGetQuery,
76 columns, 77 columns,
  1 +{
  2 + "name": "sd1",
  3 + "defaultRuleChainId": "354c7210-5d97-11ec-8ac9-f38ed935ea2a",
  4 + "description": "sd1",
  5 + "transportType": "LWM2M",
  6 + "profileData": {
  7 + "alarms": [
  8 + {
  9 + "alarmType": "sd1",
  10 + "propagate": true,
  11 + "propagateRelationTypes": [
  12 + "sd1"
  13 + ],
  14 + "createRules": {
  15 + "MAJOR": {
  16 + "alarmDetails": "sd1dw",
  17 + "schedule": {
  18 + "type": "ANY_TIME"
  19 + },
  20 + "condition": {
  21 + "condition": [
  22 + {
  23 + "key": {
  24 + "type": "TIME_SERIES",
  25 + "key": "CO2"
  26 + },
  27 + "valueType": "STRING",
  28 + "predicate": {
  29 + "operation": "EQUAL",
  30 + "value": {
  31 + "defaultValue": 1
  32 + },
  33 + "type": "STRING"
  34 + }
  35 + }
  36 + ],
  37 + "spec": {
  38 + "type": "DURATION"
  39 + }
  40 + }
  41 + }
  42 + },
  43 + "clearRule": {
  44 + "alarmDetails": "sd1dw",
  45 + "schedule": {
  46 + "type": "ANY_TIME"
  47 + },
  48 + "condition": {
  49 + "condition": [
  50 + {
  51 + "key": {
  52 + "type": "TIME_SERIES",
  53 + "key": "temp"
  54 + },
  55 + "valueType": "STRING",
  56 + "predicate": {
  57 + "operation": "NOT_CONTAINS",
  58 + "value": {
  59 + "defaultValue": 99
  60 + },
  61 + "type": "STRING"
  62 + }
  63 + }
  64 + ],
  65 + "spec": {
  66 + "type": "DURATION"
  67 + }
  68 + }
  69 + }
  70 + }
  71 + ]
  72 + },
  73 + "alarmProfile": {
  74 + "alarmContactId": "a3004ddd-db8f-487c-aea0-4f6f3efc59a9",
  75 + "messageMode": "PHONE_MESSAGE"
  76 + }
  77 +}
  1 +{
  2 + "alarmProfile": {
  3 + "alarmContactId": "string",
  4 + "createTime": "2021-12-30T08:14:03.921Z",
  5 + "creator": "string",
  6 + "defaultConfig": "string",
  7 + "description": "string",
  8 + "deviceProfileId": "string",
  9 + "enabled": true,
  10 + "icon": "string",
  11 + "id": "string",
  12 + "messageMode": "string",
  13 + "name": "string",
  14 + "roleIds": [
  15 + "string"
  16 + ],
  17 + "tenantExpireTime": "2021-12-30T08:14:03.921Z",
  18 + "tenantId": "string",
  19 + "tenantStatus": "DISABLED",
  20 + "updateTime": "2021-12-30T08:14:03.921Z",
  21 + "updater": "string"
  22 + },
  23 + "convertJs": "string",
  24 + "createTime": "2021-12-30T08:14:03.921Z",
  25 + "creator": "string",
  26 + "defaultConfig": "string",
  27 + "defaultQueueName": "string",
  28 + "defaultRuleChainId": "string",
  29 + "description": "string",
  30 + "enabled": true,
  31 + "icon": "string",
  32 + "id": "string",
  33 + "name": "string",
  34 + "profileData": {
  35 + "configuration": {},
  36 + "transportConfiguration": {},
  37 + "provisionConfiguration": {
  38 + "provisionDeviceSecret": "string"
  39 + },
  40 + "alarms": [
  41 + {
  42 + "id": "highTemperatureAlarmID",
  43 + "alarmType": "High Temperature Alarm",
  44 + "createRules": {
  45 + "additionalProp1": {
  46 + "condition": {
  47 + "condition": [
  48 + {
  49 + "key": {
  50 + "type": "TIME_SERIES",
  51 + "key": "temp"
  52 + },
  53 + "valueType": "NUMERIC",
  54 + "value": {},
  55 + "predicate": {}
  56 + }
  57 + ],
  58 + "spec": {}
  59 + },
  60 + "schedule": {
  61 + "type": "ANY_TIME"
  62 + },
  63 + "alarmDetails": "string",
  64 + "dashboardId": {
  65 + "id": "784f394c-42b6-435a-983c-b7beff2784f9",
  66 + "entityType": "DASHBOARD"
  67 + }
  68 + },
  69 + "additionalProp2": {
  70 + "condition": {
  71 + "condition": [
  72 + {
  73 + "key": {
  74 + "type": "TIME_SERIES",
  75 + "key": "temp"
  76 + },
  77 + "valueType": "NUMERIC",
  78 + "value": {},
  79 + "predicate": {}
  80 + }
  81 + ],
  82 + "spec": {}
  83 + },
  84 + "schedule": {
  85 + "type": "ANY_TIME"
  86 + },
  87 + "alarmDetails": "string",
  88 + "dashboardId": {
  89 + "id": "784f394c-42b6-435a-983c-b7beff2784f9",
  90 + "entityType": "DASHBOARD"
  91 + }
  92 + },
  93 + "additionalProp3": {
  94 + "condition": {
  95 + "condition": [
  96 + {
  97 + "key": {
  98 + "type": "TIME_SERIES",
  99 + "key": "temp"
  100 + },
  101 + "valueType": "NUMERIC",
  102 + "value": {},
  103 + "predicate": {}
  104 + }
  105 + ],
  106 + "spec": {}
  107 + },
  108 + "schedule": {
  109 + "type": "ANY_TIME"
  110 + },
  111 + "alarmDetails": "string",
  112 + "dashboardId": {
  113 + "id": "784f394c-42b6-435a-983c-b7beff2784f9",
  114 + "entityType": "DASHBOARD"
  115 + }
  116 + }
  117 + },
  118 + "clearRule": {
  119 + "condition": {
  120 + "condition": [
  121 + {
  122 + "key": {
  123 + "type": "TIME_SERIES",
  124 + "key": "temp"
  125 + },
  126 + "valueType": "NUMERIC",
  127 + "value": {},
  128 + "predicate": {}
  129 + }
  130 + ],
  131 + "spec": {}
  132 + },
  133 + "schedule": {
  134 + "type": "ANY_TIME"
  135 + },
  136 + "alarmDetails": "string",
  137 + "dashboardId": {
  138 + "id": "784f394c-42b6-435a-983c-b7beff2784f9",
  139 + "entityType": "DASHBOARD"
  140 + }
  141 + },
  142 + "propagate": true,
  143 + "propagateRelationTypes": [
  144 + "string"
  145 + ]
  146 + }
  147 + ]
  148 + },
  149 + "roleIds": [
  150 + "string"
  151 + ],
  152 + "tbProfileId": "string",
  153 + "tenantExpireTime": "2021-12-30T08:14:03.922Z",
  154 + "tenantId": "string",
  155 + "tenantStatus": "DISABLED",
  156 + "transportType": "string",
  157 + "updateTime": "2021-12-30T08:14:03.922Z",
  158 + "updater": "string"
  159 +}
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 </div> 54 </div>
55 </div> 55 </div>
56 </div> 56 </div>
57 - <div class="w-1/4 flex justify-center"> 57 + <div class="w-1/4 flex justify-center">
58 <img 58 <img
59 style="cursor: pointer" 59 style="cursor: pointer"
60 @click="deleteCondition(index, createIndex)" 60 @click="deleteCondition(index, createIndex)"
@@ -16,11 +16,7 @@ @@ -16,11 +16,7 @@
16 <p v-for="(item, index) in n" :key="index">和</p> 16 <p v-for="(item, index) in n" :key="index">和</p>
17 </div> 17 </div>
18 <div style="width: 45vw; height: 2vh"> 18 <div style="width: 45vw; height: 2vh">
19 - <BasicForm  
20 - :showActionButtonGroup="false"  
21 - @register="registerFilter"  
22 - @submit="handleSubmit"  
23 - > 19 + <BasicForm :showActionButtonGroup="false" @register="registerFilter">
24 <template #add="{ field }"> 20 <template #add="{ field }">
25 <Button v-if="Number(field) === 0" @click="add">添加</Button> 21 <Button v-if="Number(field) === 0" @click="add">添加</Button>
26 <Button v-if="Number(field) === 0" @click="handleAdd">添加复合器</Button> 22 <Button v-if="Number(field) === 0" @click="handleAdd">添加复合器</Button>
@@ -50,7 +46,7 @@ @@ -50,7 +46,7 @@
50 setup(_, { emit }) { 46 setup(_, { emit }) {
51 const getIsWhereType: any = ref(null); 47 const getIsWhereType: any = ref(null);
52 const isUpdate = ref(true); 48 const isUpdate = ref(true);
53 - const getValue: any = ref({}); 49 + const getValue: any = ref(null);
54 const setId: any = ref(1); 50 const setId: any = ref(1);
55 const getTitle = computed(() => (!unref(isUpdate) ? '新增键名筛选器' : '编辑键名筛选器')); 51 const getTitle = computed(() => (!unref(isUpdate) ? '新增键名筛选器' : '编辑键名筛选器'));
56 const [registerForm, { getFieldsValue, setFieldsValue, resetFields }] = useForm({ 52 const [registerForm, { getFieldsValue, setFieldsValue, resetFields }] = useForm({
@@ -108,9 +104,11 @@ @@ -108,9 +104,11 @@
108 getValue.value = getFieldsValue(); 104 getValue.value = getFieldsValue();
109 setId.value += 1; 105 setId.value += 1;
110 getValue.value.id = setId.value; 106 getValue.value.id = setId.value;
  107 + // emit('success', getValue.value);
  108 + // closeModal();
111 } else { 109 } else {
112 getValue.value = getFieldsValue(); 110 getValue.value = getFieldsValue();
113 - setId.value += 1000; 111 + setId.value += 9999;
114 getValue.value.id = setId.value; 112 getValue.value.id = setId.value;
115 } 113 }
116 emit('success', getValue.value); 114 emit('success', getValue.value);
@@ -182,6 +180,8 @@ @@ -182,6 +180,8 @@
182 case 'COMPLEX': 180 case 'COMPLEX':
183 getIsWhereType.value = v; 181 getIsWhereType.value = v;
184 break; 182 break;
  183 + default:
  184 + getIsWhereType.value = 100;
185 } 185 }
186 }); 186 });
187 const [registerModal, { openModal }] = useModal(); 187 const [registerModal, { openModal }] = useModal();
@@ -10,12 +10,11 @@ @@ -10,12 +10,11 @@
10 <BasicTable 10 <BasicTable
11 :showIndexColumn="false" 11 :showIndexColumn="false"
12 :resizeHeightOffset="200" 12 :resizeHeightOffset="200"
13 - @register="registerTable"  
14 :dataSource="getTableApiData" 13 :dataSource="getTableApiData"
  14 + @register="registerTable"
15 > 15 >
16 - >  
17 <template #toolbar> 16 <template #toolbar>
18 - <a-button type="primary" @click="handleAddKey"> 新增键名筛选器 </a-button> 17 + <a-button type="primary" @click="handleAddKey">新增键名筛选器</a-button>
19 </template> 18 </template>
20 <template #action="{ record }"> 19 <template #action="{ record }">
21 <TableAction 20 <TableAction
@@ -46,6 +45,7 @@ @@ -46,6 +45,7 @@
46 :dataSource="detailData" 45 :dataSource="detailData"
47 :pagination="false" 46 :pagination="false"
48 :showIndexColumn="false" 47 :showIndexColumn="false"
  48 + @register="registerTable1"
49 /> 49 />
50 </CollapseContainer> 50 </CollapseContainer>
51 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> 51 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
@@ -75,8 +75,12 @@ @@ -75,8 +75,12 @@
75 emits: ['success', 'register', 'getAllFieldsRule', 'getLastAllFieldsRule'], 75 emits: ['success', 'register', 'getAllFieldsRule', 'getLastAllFieldsRule'],
76 setup(_, { emit }) { 76 setup(_, { emit }) {
77 const getTableApiData: any = ref([]); 77 const getTableApiData: any = ref([]);
  78 + const newFilterArray: any = ref([]);
  79 + const newFilterViewArray: any = ref([]);
  80 + const newFilterKeyArray: any = ref([]);
  81 + const newFilterKeyViewArray: any = ref([]);
78 const detailData: any = ref([]); 82 const detailData: any = ref([]);
79 - const receiveData: any = ref({}); 83 + const receiveData: any = ref(null);
80 const lastValues: any = ref(null); 84 const lastValues: any = ref(null);
81 const addOrUpdateData: any = ref(null); 85 const addOrUpdateData: any = ref(null);
82 const isUpdate = ref(true); 86 const isUpdate = ref(true);
@@ -89,10 +93,11 @@ @@ -89,10 +93,11 @@
89 const [register, { closeModal }] = useModalInner((data) => { 93 const [register, { closeModal }] = useModalInner((data) => {
90 isUpdate.value = !!data?.isUpdate; 94 isUpdate.value = !!data?.isUpdate;
91 }); 95 });
92 - const [registerTable, { reload }] = useTable({ 96 + const [registerTable, { reload, setTableData: setFunc }] = useTable({
93 title: '键名筛选器', 97 title: '键名筛选器',
94 columns: keyColumns, 98 columns: keyColumns,
95 bordered: true, 99 bordered: true,
  100 + // api: useWaitFunc,
96 showIndexColumn: false, 101 showIndexColumn: false,
97 pagination: false, 102 pagination: false,
98 autoCreateKey: true, 103 autoCreateKey: true,
@@ -103,6 +108,11 @@ @@ -103,6 +108,11 @@
103 slots: { customRender: 'action' }, 108 slots: { customRender: 'action' },
104 }, 109 },
105 }); 110 });
  111 + const [registerTable1, { setTableData: setFunc1 }] = useTable({
  112 + bordered: true,
  113 + showIndexColumn: false,
  114 + pagination: false,
  115 + });
106 const handleSubmit = () => { 116 const handleSubmit = () => {
107 if (!unref(isUpdate)) { 117 if (!unref(isUpdate)) {
108 addOrUpdateData.value = getFieldsValue(); 118 addOrUpdateData.value = getFieldsValue();
@@ -130,33 +140,33 @@ @@ -130,33 +140,33 @@
130 isUpdate: true, 140 isUpdate: true,
131 record, 141 record,
132 }); 142 });
133 - const newFilterArray = getTableApiData.value.filter((item) => item.id !== record.id);  
134 - getTableApiData.value = newFilterArray;  
135 - const newFilterViewArray = detailData.value.filter((item) => item.id !== record.id);  
136 - detailData.value = newFilterViewArray; 143 + newFilterArray.value = getTableApiData.value.filter((item) => item.id !== record.id);
  144 + getTableApiData.value = newFilterArray.value;
  145 + newFilterViewArray.value = detailData.value.filter((item) => item.id !== record.id);
  146 + detailData.value = newFilterViewArray.value;
137 reload(); 147 reload();
138 }; 148 };
139 const handleDelete = (record: Recordable) => { 149 const handleDelete = (record: Recordable) => {
140 - const newFilterArray = getTableApiData.value.filter((item) => item.id !== record.id);  
141 - getTableApiData.value = newFilterArray;  
142 - const newFilterViewArray = detailData.value.filter((item) => item.id !== record.id);  
143 - detailData.value = newFilterViewArray; 150 + newFilterKeyArray.value = getTableApiData.value.filter((item) => item.id !== record.id);
  151 + getTableApiData.value = newFilterKeyArray.value;
  152 + newFilterKeyViewArray.value = detailData.value.filter((item) => item.id !== record.id);
  153 + detailData.value = newFilterKeyViewArray.value;
144 reload(); 154 reload();
145 }; 155 };
146 const handleSuccess = (v) => { 156 const handleSuccess = (v) => {
147 receiveData.value = v; 157 receiveData.value = v;
148 - setTimeout(() => {  
149 - useWaitFunc();  
150 - }, 10);  
151 - };  
152 - const useWaitFunc = () => {  
153 - if (unref(getTableApiData.value)) {  
154 - getTableApiData.value.push(receiveData.value);  
155 - detailData.value.push(receiveData.value);  
156 - } 158 + getTableApiData.value.push(receiveData.value);
  159 + detailData.value.push(receiveData.value);
  160 + setFunc(getTableApiData.value);
  161 + setFunc1(detailData.value);
157 reload(); 162 reload();
158 }; 163 };
  164 + // const useWaitFunc = async (v) => {
  165 + // // detailData.value.push(v);
  166 + // return getTableApiData.value.push(v), detailData.value.push(v);
  167 + // };
159 return { 168 return {
  169 + registerTable1,
160 detailData, 170 detailData,
161 getTableApiData, 171 getTableApiData,
162 resetDataFunc, 172 resetDataFunc,
@@ -101,6 +101,26 @@ export const step3Schemas: FormSchema[] = [ @@ -101,6 +101,26 @@ export const step3Schemas: FormSchema[] = [
101 }, 101 },
102 ]; 102 ];
103 103
  104 +export const step3ViewHighSetting: FormSchema[] = [
  105 + {
  106 + field: 'propagate',
  107 + component: 'Checkbox',
  108 + label: '传递报警',
  109 + // renderComponentContent: '忽略大小写',
  110 + },
  111 + {
  112 + field: 'propagateRelationTypes',
  113 + component: 'Input',
  114 + label: '关联类型',
  115 + colProps: {
  116 + span: 11,
  117 + },
  118 + componentProps: {
  119 + placeholder: '要传递的关联类型',
  120 + },
  121 + },
  122 +];
  123 +
104 export const step3HighSetting: FormSchema[] = [ 124 export const step3HighSetting: FormSchema[] = [
105 { 125 {
106 field: 'propagate', 126 field: 'propagate',
@@ -126,7 +146,7 @@ export const isWhereType = ref(null); @@ -126,7 +146,7 @@ export const isWhereType = ref(null);
126 146
127 export const step3CreateAlarm: FormSchema[] = [ 147 export const step3CreateAlarm: FormSchema[] = [
128 { 148 {
129 - field: 'MAJOR', 149 + field: 'WARNING',
130 component: 'Select', 150 component: 'Select',
131 label: '严重程度', 151 label: '严重程度',
132 colProps: { 152 colProps: {