Showing
13 changed files
with
578 additions
and
443 deletions
| ... | ... | @@ -57,7 +57,7 @@ | 
| 57 | 57 | </div> | 
| 58 | 58 | <Card v-else :bordered="false" :bodyStyle="{ padding: 0 }" v-bind="$attrs"> | 
| 59 | 59 | <Skeleton active :paragraph="{ rows: 10 }" :loading="!tenantTop10"> | 
| 60 | - <Descriptions :column="1" title="租户消息量TOP10" v-if="tenantTop10.length"> | |
| 60 | + <Descriptions :column="1" title="租户消息量TOP10"> | |
| 61 | 61 | <template v-for="(item, index) in tenantTop10" :key="item.name"> | 
| 62 | 62 | <DescriptionsItem> | 
| 63 | 63 | <span | 
| ... | ... | @@ -143,7 +143,7 @@ | 
| 143 | 143 | </DescriptionsItem> | 
| 144 | 144 | </template> | 
| 145 | 145 | </Descriptions> | 
| 146 | - <Empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" /> | |
| 146 | + <Empty v-if="!tenantTop10.length" :image="Empty.PRESENTED_IMAGE_SIMPLE" /> | |
| 147 | 147 | </Skeleton> | 
| 148 | 148 | <h1 style="color: rgba(0, 0, 0, 0.85); font-weight: bold; font-size: 16px"> | 
| 149 | 149 | 本月即将过期租户</h1 | ... | ... | 
| ... | ... | @@ -61,6 +61,7 @@ | 
| 61 | 61 | class="mt-4" | 
| 62 | 62 | :actionIndex="index" | 
| 63 | 63 | :actionData="actionData" | 
| 64 | + :triggerData="triggerData" | |
| 64 | 65 | :ref="skipUnwrap.actionItemRefs" | 
| 65 | 66 | @deleteAction="deleteAction" | 
| 66 | 67 | /> | 
| ... | ... | @@ -80,9 +81,9 @@ | 
| 80 | 81 | <script lang="ts" setup> | 
| 81 | 82 | import { ref, watch, unref, computed, nextTick } from 'vue'; | 
| 82 | 83 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 
| 83 | - import { formSchema, organizationId } from './config'; | |
| 84 | + import { formSchema, organizationId } from './config/config.data.ts'; | |
| 84 | 85 | import { BasicForm, useForm } from '/@/components/Form'; | 
| 85 | - import { genTriggerData, genConditionData, genActionData } from './cpns/format-data'; | |
| 86 | + import { genTriggerOrConditionData, genActionData } from './config/formatData.ts'; | |
| 86 | 87 | import { Divider } from 'ant-design-vue'; | 
| 87 | 88 | import { PlusOutlined } from '@ant-design/icons-vue'; | 
| 88 | 89 | import { useMessage } from '/@/hooks/web/useMessage'; | 
| ... | ... | @@ -95,6 +96,7 @@ | 
| 95 | 96 | import Condition from './cpns/Condition.vue'; | 
| 96 | 97 | import Action from './cpns/Action.vue'; | 
| 97 | 98 | import { useUserStore } from '/@/store/modules/user'; | 
| 99 | + import { findOperation } from './config/formatData.ts'; | |
| 98 | 100 | |
| 99 | 101 | const emit = defineEmits(['register', 'success']); | 
| 100 | 102 | |
| ... | ... | @@ -114,6 +116,7 @@ | 
| 114 | 116 | let getConditionFormValue = ref([]); | 
| 115 | 117 | let getActionFormValue = ref([]); | 
| 116 | 118 | const editEntryIdData = ref([]); | 
| 119 | + const editAlarmConfigData = ref([]); | |
| 117 | 120 | const isUpdate = ref(false); | 
| 118 | 121 | const id = ref(undefined); | 
| 119 | 122 | const tenantId = ref(undefined); | 
| ... | ... | @@ -148,62 +151,206 @@ | 
| 148 | 151 | const options = await screenLinkPageByDeptIdGetDevice({ | 
| 149 | 152 | organizationId, | 
| 150 | 153 | }); | 
| 154 | + // 获取当前组织下的告警配置 | |
| 155 | + const alarmConfig = await getOrganizationAlarmConfig({ organizationId }); | |
| 156 | + | |
| 151 | 157 | // 生成回显时对应得组件数量 | 
| 152 | 158 | triggerData.value = [...new Array(triggers.length).keys()]; | 
| 153 | 159 | conditionData.value = [...new Array(doConditions.length).keys()]; | 
| 154 | 160 | actionData.value = [...new Array(doActions.length).keys()]; | 
| 155 | 161 | // 回显设备列表 | 
| 156 | - editEntryIdData.value = options.items.map((v) => { | |
| 162 | + editEntryIdData.value = options.items.map((item) => { | |
| 163 | + return { | |
| 164 | + value: item.tbDeviceId, | |
| 165 | + label: item.name, | |
| 166 | + }; | |
| 167 | + }); | |
| 168 | + editAlarmConfigData.value = alarmConfig.map((item) => { | |
| 157 | 169 | return { | 
| 158 | - value: v.tbDeviceId, | |
| 159 | - label: v.name, | |
| 170 | + value: item.id, | |
| 171 | + label: item.name, | |
| 160 | 172 | }; | 
| 161 | 173 | }); | 
| 162 | 174 | nextTick(() => { | 
| 163 | 175 | setEditFields(skipUnwrap.triggerItemRefs, editEntryIdData); | 
| 164 | 176 | setEditFields(skipUnwrap.conditionItemRefs, editEntryIdData); | 
| 165 | 177 | setEditFields(skipUnwrap.actionItemRefs, editEntryIdData); | 
| 178 | + setEditAlarmConfig(skipUnwrap.actionItemRefs, editAlarmConfigData); | |
| 166 | 179 | }); | 
| 167 | 180 | |
| 168 | 181 | // 回显触发器数据---此处是个闭包! | 
| 169 | 182 | triggers.forEach((trigger, index) => { | 
| 170 | - nextTick(() => { | |
| 183 | + nextTick(async () => { | |
| 171 | 184 | unref(skipUnwrap.triggerItemRefs)[index].setFieldsFormValueFun({ | 
| 185 | + triggered: trigger.triggerCondition.condition.spec.type, | |
| 186 | + device: trigger.entityType, | |
| 172 | 187 | triggerType: trigger.triggerType, | 
| 173 | - entityId: trigger.entityId, | |
| 174 | - type1: trigger.triggerCondition?.condition[0]?.key?.type, | |
| 175 | - type2: trigger.triggerCondition?.condition[0]?.key?.key, | |
| 176 | - operation: trigger.triggerCondition?.condition[0]?.predicate?.operation, | |
| 177 | - value: trigger.triggerCondition?.condition[0]?.predicate?.value?.defaultValue, | |
| 188 | + type1: trigger.triggerCondition?.condition.condition[0]?.key?.type, | |
| 189 | + type2: trigger.triggerCondition?.condition.condition[0]?.key?.key, | |
| 190 | + operationType: trigger.triggerCondition?.condition.condition[0].valueType, | |
| 191 | + detail: trigger.triggerCondition?.alarmDetails, | |
| 192 | + }); | |
| 193 | + // 设置值operationType | |
| 194 | + unref(skipUnwrap.triggerItemRefs)[index].operationType = | |
| 195 | + trigger.triggerCondition?.condition.condition[0].valueType; | |
| 196 | + | |
| 197 | + const ConditionScreeningForm = await unref(skipUnwrap.triggerItemRefs)[ | |
| 198 | + index | |
| 199 | + ].getRefItemConditionScreeningRefs(); | |
| 200 | + triggerData.value = [...new Array(triggers.length).keys()]; | |
| 201 | + | |
| 202 | + // 设置对应条件筛选的个数 | |
| 203 | + unref(skipUnwrap.triggerItemRefs)[index].setConditionScreeningList([ | |
| 204 | + ...new Array(trigger.triggerCondition.condition.condition.length).keys(), | |
| 205 | + ]); | |
| 206 | + // 操作符类型 NUMERIC|String|Boolean|DATE_TIME | |
| 207 | + const valueType = trigger.triggerCondition?.condition.condition[0].valueType; | |
| 208 | + | |
| 209 | + // 循环设置条件筛选值。TODO:此处设置顺序有问题 | |
| 210 | + nextTick(() => { | |
| 211 | + const richTextList = []; | |
| 212 | + trigger.triggerCondition.condition.condition.forEach(async (item, index) => { | |
| 213 | + const formItem = { | |
| 214 | + operation: item.predicate.operation, | |
| 215 | + value: String(item.predicate.value.defaultValue), | |
| 216 | + }; | |
| 217 | + richTextList.push({ | |
| 218 | + // 查询中文操作符 | |
| 219 | + operation: findOperation(valueType, item.predicate.operation).label, | |
| 220 | + value: String(item.predicate.value.defaultValue), | |
| 221 | + attribute: trigger.triggerCondition?.condition.condition[0]?.key?.key, | |
| 222 | + }); | |
| 223 | + ConditionScreeningForm.value[index].setFieldsValue(formItem); | |
| 224 | + }); | |
| 225 | + | |
| 226 | + unref(skipUnwrap.triggerItemRefs)[index].setRichText(richTextList); | |
| 178 | 227 | }); | 
| 179 | 228 | }); | 
| 180 | 229 | }); | 
| 181 | 230 | |
| 182 | - doConditions.forEach((item, index) => { | |
| 183 | - nextTick(() => { | |
| 231 | + doConditions.forEach((condition, index) => { | |
| 232 | + nextTick(async () => { | |
| 184 | 233 | unref(skipUnwrap.conditionItemRefs)[index].setFieldsFormValueFun({ | 
| 185 | - triggerType: item?.triggerType, | |
| 186 | - entityId: item?.entityId, | |
| 187 | - type: item.triggerCondition?.condition[0].key.key, | |
| 188 | - operation: item?.triggerCondition?.condition[0]?.predicate?.operation, | |
| 189 | - value: item?.triggerCondition?.condition[0]?.predicate?.value?.defaultValue, | |
| 234 | + triggered: condition.triggerCondition.condition.spec.type, | |
| 235 | + device: condition.entityType, | |
| 236 | + triggerType: condition.triggerType, | |
| 237 | + type1: condition.triggerCondition?.condition.condition[0]?.key?.type, | |
| 238 | + type2: condition.triggerCondition?.condition.condition[0]?.key?.key, | |
| 239 | + operationType: condition.triggerCondition?.condition.condition[0].valueType, | |
| 240 | + detail: condition.triggerCondition?.alarmDetails, | |
| 241 | + }); | |
| 242 | + // 设置值operationType | |
| 243 | + unref(skipUnwrap.conditionItemRefs)[index].operationType = | |
| 244 | + condition.triggerCondition?.condition.condition[0].valueType; | |
| 245 | + | |
| 246 | + const ConditionScreeningForm = await unref(skipUnwrap.conditionItemRefs)[ | |
| 247 | + index | |
| 248 | + ].getRefItemConditionScreeningRefs(); | |
| 249 | + triggerData.value = [...new Array(condition.length).keys()]; | |
| 250 | + | |
| 251 | + // 设置对应条件筛选的个数 | |
| 252 | + unref(skipUnwrap.conditionItemRefs)[index].setConditionScreeningList([ | |
| 253 | + ...new Array(condition.triggerCondition.condition.condition.length).keys(), | |
| 254 | + ]); | |
| 255 | + // 操作符类型 NUMERIC|String|Boolean|DATE_TIME | |
| 256 | + const valueType = condition.triggerCondition?.condition.condition[0].valueType; | |
| 257 | + | |
| 258 | + // 循环设置条件筛选值。TODO:此处设置顺序有问题 | |
| 259 | + nextTick(() => { | |
| 260 | + const richTextList = []; | |
| 261 | + condition.triggerCondition.condition.condition.forEach(async (item, index) => { | |
| 262 | + const formItem = { | |
| 263 | + operation: item.predicate.operation, | |
| 264 | + value: String(item.predicate.value.defaultValue), | |
| 265 | + }; | |
| 266 | + richTextList.push({ | |
| 267 | + // 查询中文操作符 | |
| 268 | + operation: findOperation(valueType, item.predicate.operation).label, | |
| 269 | + value: String(item.predicate.value.defaultValue), | |
| 270 | + attribute: condition.triggerCondition?.condition.condition[0]?.key?.key, | |
| 271 | + }); | |
| 272 | + ConditionScreeningForm.value[index].setFieldsValue(formItem); | |
| 273 | + }); | |
| 274 | + unref(skipUnwrap.conditionItemRefs)[index].setRichText(richTextList); | |
| 190 | 275 | }); | 
| 191 | 276 | }); | 
| 192 | 277 | }); | 
| 193 | 278 | |
| 194 | - doActions.forEach((item, index) => { | |
| 279 | + doActions.forEach((action, index) => { | |
| 195 | 280 | nextTick(() => { | 
| 196 | 281 | unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ | 
| 197 | - outTarget: item.outTarget, | |
| 198 | - deviceId: item.deviceId, | |
| 282 | + outTarget: action.outTarget, | |
| 283 | + device: action.entityType, | |
| 284 | + deviceId: action.deviceId, | |
| 285 | + alarm_config: action.alarmProfileId, | |
| 286 | + alarm_level: action.doContext.alarmLevel, | |
| 199 | 287 | }); | 
| 200 | - unref(skipUnwrap.actionItemRefs)[index].setJsonValue(item.doContext.params); | |
| 288 | + if (action.outTarget === 'DEVICE_OUT') { | |
| 289 | + unref(skipUnwrap.actionItemRefs)[index].setJsonValue(action.doContext.params); | |
| 290 | + } | |
| 291 | + if (action.doContext.clearRule) { | |
| 292 | + unref(skipUnwrap.actionItemRefs)[index].checked = true; | |
| 293 | + nextTick(async () => { | |
| 294 | + unref(skipUnwrap.actionItemRefs)[index].clearAlarmRef.setFieldsFormValueFun({ | |
| 295 | + triggered: action.doContext?.clearRule?.triggerCondition?.condition.spec.type, | |
| 296 | + device: action.entityType, | |
| 297 | + triggerType: action.doContext?.clearRule.triggerType, | |
| 298 | + type1: action.doContext.clearRule.triggerCondition.condition.condition[0].key.type, | |
| 299 | + type2: action.doContext.clearRule.triggerCondition.condition.condition[0].key.key, | |
| 300 | + operationType: | |
| 301 | + action.doContext.clearRule.triggerCondition.condition.condition[0].valueType, | |
| 302 | + detail: action.doContext.clearRule.triggerCondition?.alarmDetails, | |
| 303 | + }); | |
| 304 | + // 设置值operationType | |
| 305 | + | |
| 306 | + unref(skipUnwrap.actionItemRefs)[index].clearAlarmRef.operationType = | |
| 307 | + action.doContext.clearRule.triggerCondition.condition.condition[0].valueType; | |
| 308 | + | |
| 309 | + const ConditionScreeningForm = await unref(skipUnwrap.actionItemRefs)[ | |
| 310 | + index | |
| 311 | + ].getRefItemConditionScreeningRefs(); | |
| 312 | + triggerData.value = [...new Array(action.length).keys()]; | |
| 313 | + | |
| 314 | + // // 设置对应条件筛选的个数 | |
| 315 | + unref(skipUnwrap.actionItemRefs)[index].setConditionScreeningList([ | |
| 316 | + ...new Array( | |
| 317 | + action.doContext.clearRule.triggerCondition.condition.condition.length | |
| 318 | + ).keys(), | |
| 319 | + ]); | |
| 320 | + // 操作符类型 NUMERIC|String|Boolean|DATE_TIME | |
| 321 | + const valueType = | |
| 322 | + action.doContext.clearRule.triggerCondition?.condition.condition[0].valueType; | |
| 323 | + | |
| 324 | + // 循环设置条件筛选值。TODO:此处设置顺序有问题 | |
| 325 | + nextTick(() => { | |
| 326 | + const richTextList = []; | |
| 327 | + action.doContext.clearRule.triggerCondition.condition.condition.forEach( | |
| 328 | + (item, index) => { | |
| 329 | + const formItem = { | |
| 330 | + operation: item.predicate.operation, | |
| 331 | + value: String(item.predicate.value.defaultValue), | |
| 332 | + }; | |
| 333 | + richTextList.push({ | |
| 334 | + // 查询中文操作符 | |
| 335 | + operation: findOperation(valueType, item.predicate.operation).label, | |
| 336 | + value: String(item.predicate.value.defaultValue), | |
| 337 | + attribute: | |
| 338 | + action.doContext.clearRule.triggerCondition?.condition.condition[0]?.key | |
| 339 | + ?.key, | |
| 340 | + }); | |
| 341 | + ConditionScreeningForm.value[index].setFieldsValue(formItem); | |
| 342 | + } | |
| 343 | + ); | |
| 344 | + unref(skipUnwrap.actionItemRefs)[index].setRichText(richTextList); | |
| 345 | + }); | |
| 346 | + }); | |
| 347 | + } | |
| 201 | 348 | }); | 
| 202 | 349 | }); | 
| 203 | 350 | } | 
| 204 | 351 | if (unref(isUpdate) === 3) isView.value = false; | 
| 205 | 352 | setDrawerProps({ | 
| 206 | - showFooter: isView.value, | |
| 353 | + showFooter: unref(isView), | |
| 207 | 354 | loading: false, | 
| 208 | 355 | }); | 
| 209 | 356 | }); | 
| ... | ... | @@ -214,6 +361,12 @@ | 
| 214 | 361 | item.updateFieldDeviceId(deviceList); | 
| 215 | 362 | }); | 
| 216 | 363 | }; | 
| 364 | + // 设置告警配置options | |
| 365 | + const setEditAlarmConfig = (linkAge, alarmConfigList) => { | |
| 366 | + unref(linkAge).map((item) => { | |
| 367 | + item.updateEditFieldAlarmConfig(alarmConfigList); | |
| 368 | + }); | |
| 369 | + }; | |
| 217 | 370 | // 监听组织变化更新设备列表 | 
| 218 | 371 | const deviceList = ref([]); | 
| 219 | 372 | const alarmConfigList = ref([]); | 
| ... | ... | @@ -271,16 +424,14 @@ | 
| 271 | 424 | */ | 
| 272 | 425 | const getFormValueFunc = () => { | 
| 273 | 426 | getTriggerFormValue.value = unref(skipUnwrap.triggerItemRefs)?.map((item) => { | 
| 274 | - return genTriggerData(item.getFieldsValueFunc()); | |
| 427 | + return genTriggerOrConditionData(item.getFieldsValueFunc()); | |
| 275 | 428 | }); | 
| 276 | 429 | getConditionFormValue.value = unref(skipUnwrap.conditionItemRefs).map((item) => { | 
| 277 | - return genConditionData(item.getFieldsValueFunc()); | |
| 430 | + return genTriggerOrConditionData(item.getFieldsValueFunc()); | |
| 278 | 431 | }); | 
| 279 | 432 | getActionFormValue.value = unref(skipUnwrap.actionItemRefs).map((item) => { | 
| 280 | - console.log(item.jsonInstance.get()); | |
| 281 | 433 | return genActionData(item.getFieldsValueFunc()); | 
| 282 | 434 | }); | 
| 283 | - console.log(getActionFormValue.value); | |
| 284 | 435 | }; | 
| 285 | 436 | const handleSubmit = async () => { | 
| 286 | 437 | let basicFormValue = await validate(); | 
| ... | ... | @@ -300,7 +451,7 @@ | 
| 300 | 451 | id: unref(id), | 
| 301 | 452 | tenantId: unref(tenantId), | 
| 302 | 453 | }; | 
| 303 | - console.log(postAddOrEditData); | |
| 454 | + | |
| 304 | 455 | await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); | 
| 305 | 456 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | 
| 306 | 457 | closeDrawer(); | 
| ... | ... | @@ -319,7 +470,6 @@ | 
| 319 | 470 | unref(conditionData).splice(conditionIndex, 1); | 
| 320 | 471 | }; | 
| 321 | 472 | const deleteAction = ({ actionIndex, outTarget }) => { | 
| 322 | - // console.log(actionIndex, outTarget.value); | |
| 323 | 473 | unref(actionData).splice(actionIndex, 1); | 
| 324 | 474 | if (unref(outTarget) === 'MSG_NOTIFY') { | 
| 325 | 475 | userStore.setOutTarget('DEVICE_OUT'); | ... | ... | 
src/views/rule/linkedge/config/config.data.ts
renamed from
src/views/rule/linkedge/config.ts
| ... | ... | @@ -359,7 +359,7 @@ export const actionSchema: FormSchema[] = [ | 
| 359 | 359 | placeholder: '请选择设备', | 
| 360 | 360 | mode: 'multiple', | 
| 361 | 361 | }, | 
| 362 | - ifShow: ({ values }) => isPart(values.device), | |
| 362 | + ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), | |
| 363 | 363 | colProps: { span: 6 }, | 
| 364 | 364 | }, | 
| 365 | 365 | { | 
| ... | ... | @@ -392,7 +392,7 @@ export const actionSchema: FormSchema[] = [ | 
| 392 | 392 | options: [ | 
| 393 | 393 | { | 
| 394 | 394 | label: '紧急', | 
| 395 | - value: ' CRITICAL', | |
| 395 | + value: 'CRITICAL', | |
| 396 | 396 | }, | 
| 397 | 397 | { | 
| 398 | 398 | label: '重要', | 
| ... | ... | @@ -427,209 +427,3 @@ export const actionSchema: FormSchema[] = [ | 
| 427 | 427 | slot: 'clearAlarm', | 
| 428 | 428 | }, | 
| 429 | 429 | ]; | 
| 430 | -import { Number_Operation, String_Operation, Boolean_Operation } from '/@/enums/operationEnum'; | |
| 431 | -export function isType(operationType) { | |
| 432 | - switch (operationType) { | |
| 433 | - case 'NUMERIC': | |
| 434 | - return [ | |
| 435 | - { | |
| 436 | - field: 'operation', | |
| 437 | - label: '执行操作', | |
| 438 | - component: 'Select', | |
| 439 | - required: true, | |
| 440 | - componentProps: { | |
| 441 | - options: [ | |
| 442 | - { label: '等于', value: Number_Operation.EQUAL }, | |
| 443 | - { label: '不等于', value: Number_Operation.NOT_EQUAL }, | |
| 444 | - { label: '小于', value: Number_Operation.LESS }, | |
| 445 | - { label: '小于等于', value: Number_Operation.LESS_OR_EQUAL }, | |
| 446 | - { label: '大于', value: Number_Operation.GREATER }, | |
| 447 | - { label: '大于等于', value: Number_Operation.GREATER_OR_EQUAL }, | |
| 448 | - ], | |
| 449 | - }, | |
| 450 | - colProps: { | |
| 451 | - span: 8, | |
| 452 | - }, | |
| 453 | - }, | |
| 454 | - { | |
| 455 | - field: 'value', | |
| 456 | - label: '操作值', | |
| 457 | - required: true, | |
| 458 | - component: 'InputNumber', | |
| 459 | - colProps: { | |
| 460 | - span: 8, | |
| 461 | - }, | |
| 462 | - }, | |
| 463 | - ]; | |
| 464 | - case 'STRING': | |
| 465 | - return [ | |
| 466 | - { | |
| 467 | - field: 'ignoreCase', | |
| 468 | - label: '忽略大小写', | |
| 469 | - component: 'Checkbox', | |
| 470 | - labelWidth: 150, | |
| 471 | - colProps: { | |
| 472 | - span: 7, | |
| 473 | - }, | |
| 474 | - }, | |
| 475 | - { | |
| 476 | - field: 'operation', | |
| 477 | - label: '执行操作', | |
| 478 | - component: 'Select', | |
| 479 | - required: true, | |
| 480 | - componentProps: { | |
| 481 | - options: [ | |
| 482 | - { label: '等于', value: String_Operation.EQUAL }, | |
| 483 | - { label: '不等于', value: String_Operation.NOT_EQUAL }, | |
| 484 | - { label: '开始于', value: String_Operation.BEGAN_IN }, | |
| 485 | - { label: '结束于', value: String_Operation.END_IN }, | |
| 486 | - { label: '包含', value: String_Operation.INCLUDE }, | |
| 487 | - { label: '不包含', value: String_Operation.NOT_INCLUDE }, | |
| 488 | - ], | |
| 489 | - }, | |
| 490 | - colProps: { | |
| 491 | - span: 7, | |
| 492 | - }, | |
| 493 | - }, | |
| 494 | - { | |
| 495 | - field: 'value', | |
| 496 | - label: '操作值', | |
| 497 | - required: true, | |
| 498 | - component: 'Input', | |
| 499 | - colProps: { | |
| 500 | - span: 7, | |
| 501 | - }, | |
| 502 | - }, | |
| 503 | - ]; | |
| 504 | - case 'BOOLEAN': | |
| 505 | - return [ | |
| 506 | - { | |
| 507 | - field: 'operation', | |
| 508 | - label: '执行操作', | |
| 509 | - component: 'Select', | |
| 510 | - required: true, | |
| 511 | - componentProps: { | |
| 512 | - options: [ | |
| 513 | - { label: '等于', value: Boolean_Operation.EQUAL }, | |
| 514 | - { label: '不等于', value: Boolean_Operation.NOT_EQUAL }, | |
| 515 | - ], | |
| 516 | - }, | |
| 517 | - colProps: { | |
| 518 | - span: 8, | |
| 519 | - }, | |
| 520 | - }, | |
| 521 | - { | |
| 522 | - field: 'value', | |
| 523 | - label: '操作值', | |
| 524 | - component: 'Select', | |
| 525 | - required: true, | |
| 526 | - componentProps: { | |
| 527 | - options: [ | |
| 528 | - { | |
| 529 | - label: '真', | |
| 530 | - value: 'true', | |
| 531 | - }, | |
| 532 | - { | |
| 533 | - label: '假', | |
| 534 | - value: 'false', | |
| 535 | - }, | |
| 536 | - ], | |
| 537 | - }, | |
| 538 | - colProps: { | |
| 539 | - span: 8, | |
| 540 | - }, | |
| 541 | - }, | |
| 542 | - ]; | |
| 543 | - case 'TIME': | |
| 544 | - return [ | |
| 545 | - { | |
| 546 | - field: 'operation', | |
| 547 | - label: '执行操作', | |
| 548 | - required: true, | |
| 549 | - component: 'Select', | |
| 550 | - componentProps: { | |
| 551 | - options: [ | |
| 552 | - { label: '等于', value: Number_Operation.EQUAL }, | |
| 553 | - { label: '不等于', value: Number_Operation.NOT_EQUAL }, | |
| 554 | - { label: '小于', value: Number_Operation.LESS }, | |
| 555 | - { label: '小于等于', value: Number_Operation.LESS_OR_EQUAL }, | |
| 556 | - { label: '大于', value: Number_Operation.GREATER }, | |
| 557 | - { label: '大于等于', value: Number_Operation.GREATER_OR_EQUAL }, | |
| 558 | - ], | |
| 559 | - }, | |
| 560 | - colProps: { | |
| 561 | - span: 8, | |
| 562 | - }, | |
| 563 | - }, | |
| 564 | - { | |
| 565 | - field: 'value', | |
| 566 | - label: '操作值', | |
| 567 | - required: true, | |
| 568 | - component: 'DatePicker', | |
| 569 | - componentProps: { | |
| 570 | - showTime: true, | |
| 571 | - }, | |
| 572 | - colProps: { | |
| 573 | - span: 8, | |
| 574 | - }, | |
| 575 | - }, | |
| 576 | - ]; | |
| 577 | - } | |
| 578 | -} | |
| 579 | -export function conditionPreView(data, operationType) { | |
| 580 | - if (operationType === 'NUMERIC' || operationType === 'TIME') { | |
| 581 | - const { EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL } = Number_Operation; | |
| 582 | - return data.map((item) => { | |
| 583 | - return { | |
| 584 | - operation: | |
| 585 | - item?.operation === EQUAL | |
| 586 | - ? '等于' | |
| 587 | - : item?.operation === NOT_EQUAL | |
| 588 | - ? '不等于' | |
| 589 | - : item?.operation === LESS | |
| 590 | - ? '小于' | |
| 591 | - : item?.operation === LESS_OR_EQUAL | |
| 592 | - ? '小于等于' | |
| 593 | - : item?.operation === GREATER | |
| 594 | - ? '大于' | |
| 595 | - : item?.operation === GREATER_OR_EQUAL | |
| 596 | - ? '大于等于' | |
| 597 | - : '', | |
| 598 | - value: item.value, | |
| 599 | - attribute: item.attribute, | |
| 600 | - }; | |
| 601 | - }); | |
| 602 | - } else if (operationType === 'STRING') { | |
| 603 | - const { EQUAL, NOT_EQUAL, BEGAN_IN, END_IN, INCLUDE, NOT_INCLUDE } = String_Operation; | |
| 604 | - return data.map((item) => { | |
| 605 | - return { | |
| 606 | - operation: | |
| 607 | - item?.operation === EQUAL | |
| 608 | - ? '等于' | |
| 609 | - : item?.operation === NOT_EQUAL | |
| 610 | - ? '不等于' | |
| 611 | - : item?.operation === BEGAN_IN | |
| 612 | - ? '开始于' | |
| 613 | - : item?.operation === END_IN | |
| 614 | - ? '结束于' | |
| 615 | - : item?.operation === INCLUDE | |
| 616 | - ? '包含' | |
| 617 | - : item?.operation === NOT_INCLUDE | |
| 618 | - ? '不包含' | |
| 619 | - : '', | |
| 620 | - value: item.value, | |
| 621 | - attribute: item.attribute, | |
| 622 | - }; | |
| 623 | - }); | |
| 624 | - } else if (operationType === 'BOOLEAN') { | |
| 625 | - const { EQUAL, NOT_EQUAL } = Boolean_Operation; | |
| 626 | - return data.map((item) => { | |
| 627 | - return { | |
| 628 | - operation: | |
| 629 | - item?.operation === EQUAL ? '等于' : item?.operation === NOT_EQUAL ? '不等于' : '', | |
| 630 | - value: item.value, | |
| 631 | - attribute: item.attribute, | |
| 632 | - }; | |
| 633 | - }); | |
| 634 | - } | |
| 635 | -} | ... | ... | 
src/views/rule/linkedge/config/formatData.ts
renamed from
src/views/rule/linkedge/cpns/format-data/index.ts
| 1 | -export const genTriggerData = (triggerData) => { | |
| 2 | - const { | |
| 3 | - triggerType, | |
| 4 | - entityId, | |
| 5 | - type1, | |
| 6 | - type2, | |
| 7 | - device, | |
| 8 | - detail, | |
| 9 | - predicate, | |
| 10 | - operationType, | |
| 11 | - triggered, | |
| 12 | - schedule, | |
| 13 | - } = triggerData; | |
| 14 | - const mapPredicate = predicate.map((item) => { | |
| 15 | - return { | |
| 16 | - key: { | |
| 17 | - type: type1, | |
| 18 | - key: type2, | |
| 19 | - }, | |
| 20 | - valueType: operationType, | |
| 21 | - value: null, | |
| 22 | - predicate: { | |
| 23 | - type: operationType, | |
| 24 | - operation: item.operation, | |
| 25 | - value: { | |
| 26 | - defaultValue: item.value, | |
| 27 | - userValue: null, | |
| 28 | - dynamicValue: null, | |
| 29 | - }, | |
| 30 | - }, | |
| 31 | - }; | |
| 32 | - }); | |
| 33 | - return { | |
| 34 | - triggerType, | |
| 35 | - entityType: device, | |
| 36 | - entityId: entityId?.length ? entityId : null, | |
| 37 | - triggerCondition: { | |
| 38 | - alarmDetails: detail, | |
| 39 | - condition: { | |
| 40 | - condition: mapPredicate, | |
| 41 | - spec: { | |
| 42 | - type: triggered, | |
| 43 | - // unit: 'SECONDS', | |
| 44 | - // predicate: { | |
| 45 | - // defaultValue: 30, | |
| 46 | - // userValue: null, | |
| 47 | - // dynamicValue: null, | |
| 48 | - // }, | |
| 49 | - }, | |
| 50 | - }, | |
| 51 | - schedule: { | |
| 52 | - type: schedule, | |
| 53 | - // timezone: 'Asia/Shanghai', | |
| 54 | - // daysOfWeek: [2, 3], | |
| 55 | - // startsOn: 8700000, | |
| 56 | - // endsOn: 30300000, | |
| 57 | - }, | |
| 58 | - }, | |
| 59 | - }; | |
| 60 | -}; | |
| 1 | +import { formatToDateTime } from '/@/utils/dateUtil'; | |
| 61 | 2 | |
| 62 | -export const genConditionData = (actionData) => { | |
| 3 | +// 生成触发器或执行条件JSON数据 | |
| 4 | +export const genTriggerOrConditionData = (triggerData) => { | |
| 63 | 5 | const { | 
| 64 | 6 | triggerType, | 
| 65 | 7 | entityId, | 
| ... | ... | @@ -71,8 +13,8 @@ export const genConditionData = (actionData) => { | 
| 71 | 13 | operationType, | 
| 72 | 14 | triggered, | 
| 73 | 15 | schedule, | 
| 74 | - } = actionData; | |
| 75 | - const mapPredicate = predicate.map((item) => { | |
| 16 | + } = triggerData; | |
| 17 | + const mapPredicate = predicate?.map((item) => { | |
| 76 | 18 | return { | 
| 77 | 19 | key: { | 
| 78 | 20 | type: type1, | 
| ... | ... | @@ -81,10 +23,11 @@ export const genConditionData = (actionData) => { | 
| 81 | 23 | valueType: operationType, | 
| 82 | 24 | value: null, | 
| 83 | 25 | predicate: { | 
| 84 | - type: operationType, | |
| 26 | + type: operationType === 'DATE_TIME' ? 'NUMERIC' : operationType, | |
| 85 | 27 | operation: item.operation, | 
| 86 | 28 | value: { | 
| 87 | - defaultValue: item.value, | |
| 29 | + defaultValue: | |
| 30 | + operationType === 'DATE_TIME' ? Number(formatToDateTime(item.value, 'x')) : item.value, | |
| 88 | 31 | userValue: null, | 
| 89 | 32 | dynamicValue: null, | 
| 90 | 33 | }, | 
| ... | ... | @@ -137,8 +80,8 @@ export const genActionData = (conditionData) => { | 
| 137 | 80 | schedule, | 
| 138 | 81 | entityId, | 
| 139 | 82 | deviceId, | 
| 83 | + checked, | |
| 140 | 84 | } = conditionData; | 
| 141 | - | |
| 142 | 85 | const mapPredicate = predicate?.map((item) => { | 
| 143 | 86 | return { | 
| 144 | 87 | key: { | 
| ... | ... | @@ -158,7 +101,6 @@ export const genActionData = (conditionData) => { | 
| 158 | 101 | }, | 
| 159 | 102 | }; | 
| 160 | 103 | }); | 
| 161 | - console.log(doContext); | |
| 162 | 104 | return [ | 
| 163 | 105 | { | 
| 164 | 106 | alarmProfileId: alarm_config, | 
| ... | ... | @@ -195,7 +137,229 @@ export const genActionData = (conditionData) => { | 
| 195 | 137 | }, | 
| 196 | 138 | }, | 
| 197 | 139 | } | 
| 198 | - : doContext, | |
| 140 | + : { | |
| 141 | + ...doContext, | |
| 142 | + alarmLevel: outTarget === 'MSG_NOTIFY' ? alarm_level : undefined, | |
| 143 | + }, | |
| 199 | 144 | }, | 
| 200 | 145 | ]; | 
| 201 | 146 | }; | 
| 147 | + | |
| 148 | +import { Number_Operation, String_Operation, Boolean_Operation } from '/@/enums/operationEnum'; | |
| 149 | + | |
| 150 | +export const operationNumber_OR_TIME = [ | |
| 151 | + { label: '等于', value: Number_Operation.EQUAL }, | |
| 152 | + { label: '不等于', value: Number_Operation.NOT_EQUAL }, | |
| 153 | + { label: '小于', value: Number_Operation.LESS }, | |
| 154 | + { label: '小于等于', value: Number_Operation.LESS_OR_EQUAL }, | |
| 155 | + { label: '大于', value: Number_Operation.GREATER }, | |
| 156 | + { label: '大于等于', value: Number_Operation.GREATER_OR_EQUAL }, | |
| 157 | +]; | |
| 158 | + | |
| 159 | +export const operationString = [ | |
| 160 | + { label: '等于', value: String_Operation.EQUAL }, | |
| 161 | + { label: '不等于', value: String_Operation.NOT_EQUAL }, | |
| 162 | + { label: '开始于', value: String_Operation.BEGAN_IN }, | |
| 163 | + { label: '结束于', value: String_Operation.END_IN }, | |
| 164 | + { label: '包含', value: String_Operation.INCLUDE }, | |
| 165 | + { label: '不包含', value: String_Operation.NOT_INCLUDE }, | |
| 166 | +]; | |
| 167 | + | |
| 168 | +export const operationBoolean = [ | |
| 169 | + { label: '等于', value: Boolean_Operation.EQUAL }, | |
| 170 | + { label: '不等于', value: Boolean_Operation.NOT_EQUAL }, | |
| 171 | +]; | |
| 172 | + | |
| 173 | +// 查找操作符 | |
| 174 | +export function findOperation(valueType, operation) { | |
| 175 | + switch (valueType) { | |
| 176 | + case 'NUMERIC' || 'DATE_TIME': | |
| 177 | + return operationNumber_OR_TIME.find((item) => item.value === operation); | |
| 178 | + case 'STRING': | |
| 179 | + return operationString.find((item) => item.value === operation); | |
| 180 | + case 'BOOLEAN': | |
| 181 | + return operationBoolean.find((item) => item.value === operation); | |
| 182 | + } | |
| 183 | +} | |
| 184 | + | |
| 185 | +export function isType(operationType) { | |
| 186 | + switch (operationType) { | |
| 187 | + case 'NUMERIC': | |
| 188 | + return [ | |
| 189 | + { | |
| 190 | + field: 'operation', | |
| 191 | + label: '执行操作', | |
| 192 | + component: 'Select', | |
| 193 | + required: true, | |
| 194 | + componentProps: { | |
| 195 | + options: operationNumber_OR_TIME, | |
| 196 | + }, | |
| 197 | + colProps: { | |
| 198 | + span: 8, | |
| 199 | + }, | |
| 200 | + }, | |
| 201 | + { | |
| 202 | + field: 'value', | |
| 203 | + label: '操作值', | |
| 204 | + required: true, | |
| 205 | + component: 'InputNumber', | |
| 206 | + colProps: { | |
| 207 | + span: 8, | |
| 208 | + }, | |
| 209 | + }, | |
| 210 | + ]; | |
| 211 | + case 'STRING': | |
| 212 | + return [ | |
| 213 | + { | |
| 214 | + field: 'ignoreCase', | |
| 215 | + label: '忽略大小写', | |
| 216 | + component: 'Checkbox', | |
| 217 | + labelWidth: 150, | |
| 218 | + colProps: { | |
| 219 | + span: 7, | |
| 220 | + }, | |
| 221 | + }, | |
| 222 | + { | |
| 223 | + field: 'operation', | |
| 224 | + label: '执行操作', | |
| 225 | + component: 'Select', | |
| 226 | + required: true, | |
| 227 | + componentProps: { | |
| 228 | + options: operationString, | |
| 229 | + }, | |
| 230 | + colProps: { | |
| 231 | + span: 7, | |
| 232 | + }, | |
| 233 | + }, | |
| 234 | + { | |
| 235 | + field: 'value', | |
| 236 | + label: '操作值', | |
| 237 | + required: true, | |
| 238 | + component: 'Input', | |
| 239 | + colProps: { | |
| 240 | + span: 7, | |
| 241 | + }, | |
| 242 | + }, | |
| 243 | + ]; | |
| 244 | + case 'BOOLEAN': | |
| 245 | + return [ | |
| 246 | + { | |
| 247 | + field: 'operation', | |
| 248 | + label: '执行操作', | |
| 249 | + component: 'Select', | |
| 250 | + required: true, | |
| 251 | + componentProps: { | |
| 252 | + options: operationBoolean, | |
| 253 | + }, | |
| 254 | + colProps: { | |
| 255 | + span: 8, | |
| 256 | + }, | |
| 257 | + }, | |
| 258 | + { | |
| 259 | + field: 'value', | |
| 260 | + label: '操作值', | |
| 261 | + component: 'Select', | |
| 262 | + required: true, | |
| 263 | + componentProps: { | |
| 264 | + options: [ | |
| 265 | + { | |
| 266 | + label: '真', | |
| 267 | + value: 'true', | |
| 268 | + }, | |
| 269 | + { | |
| 270 | + label: '假', | |
| 271 | + value: 'false', | |
| 272 | + }, | |
| 273 | + ], | |
| 274 | + }, | |
| 275 | + colProps: { | |
| 276 | + span: 8, | |
| 277 | + }, | |
| 278 | + }, | |
| 279 | + ]; | |
| 280 | + case 'DATE_TIME': | |
| 281 | + return [ | |
| 282 | + { | |
| 283 | + field: 'operation', | |
| 284 | + label: '执行操作', | |
| 285 | + required: true, | |
| 286 | + component: 'Select', | |
| 287 | + componentProps: { | |
| 288 | + options: operationNumber_OR_TIME, | |
| 289 | + }, | |
| 290 | + colProps: { | |
| 291 | + span: 8, | |
| 292 | + }, | |
| 293 | + }, | |
| 294 | + { | |
| 295 | + field: 'value', | |
| 296 | + label: '操作值', | |
| 297 | + required: true, | |
| 298 | + component: 'DatePicker', | |
| 299 | + componentProps: { | |
| 300 | + showTime: true, | |
| 301 | + }, | |
| 302 | + colProps: { | |
| 303 | + span: 8, | |
| 304 | + }, | |
| 305 | + }, | |
| 306 | + ]; | |
| 307 | + } | |
| 308 | +} | |
| 309 | +export function conditionPreView(data, operationType) { | |
| 310 | + if (operationType === 'NUMERIC' || operationType === 'DATE_TIME') { | |
| 311 | + const { EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL } = Number_Operation; | |
| 312 | + return data.map((item) => { | |
| 313 | + return { | |
| 314 | + operation: | |
| 315 | + item?.operation === EQUAL | |
| 316 | + ? '等于' | |
| 317 | + : item?.operation === NOT_EQUAL | |
| 318 | + ? '不等于' | |
| 319 | + : item?.operation === LESS | |
| 320 | + ? '小于' | |
| 321 | + : item?.operation === LESS_OR_EQUAL | |
| 322 | + ? '小于等于' | |
| 323 | + : item?.operation === GREATER | |
| 324 | + ? '大于' | |
| 325 | + : item?.operation === GREATER_OR_EQUAL | |
| 326 | + ? '大于等于' | |
| 327 | + : '', | |
| 328 | + value: item.value, | |
| 329 | + attribute: item.attribute, | |
| 330 | + }; | |
| 331 | + }); | |
| 332 | + } else if (operationType === 'STRING') { | |
| 333 | + const { EQUAL, NOT_EQUAL, BEGAN_IN, END_IN, INCLUDE, NOT_INCLUDE } = String_Operation; | |
| 334 | + return data.map((item) => { | |
| 335 | + return { | |
| 336 | + operation: | |
| 337 | + item?.operation === EQUAL | |
| 338 | + ? '等于' | |
| 339 | + : item?.operation === NOT_EQUAL | |
| 340 | + ? '不等于' | |
| 341 | + : item?.operation === BEGAN_IN | |
| 342 | + ? '开始于' | |
| 343 | + : item?.operation === END_IN | |
| 344 | + ? '结束于' | |
| 345 | + : item?.operation === INCLUDE | |
| 346 | + ? '包含' | |
| 347 | + : item?.operation === NOT_INCLUDE | |
| 348 | + ? '不包含' | |
| 349 | + : '', | |
| 350 | + value: item.value, | |
| 351 | + attribute: item.attribute, | |
| 352 | + }; | |
| 353 | + }); | |
| 354 | + } else if (operationType === 'BOOLEAN') { | |
| 355 | + const { EQUAL, NOT_EQUAL } = Boolean_Operation; | |
| 356 | + return data.map((item) => { | |
| 357 | + return { | |
| 358 | + operation: | |
| 359 | + item?.operation === EQUAL ? '等于' : item?.operation === NOT_EQUAL ? '不等于' : '', | |
| 360 | + value: item.value, | |
| 361 | + attribute: item.attribute, | |
| 362 | + }; | |
| 363 | + }); | |
| 364 | + } | |
| 365 | +} | ... | ... | 
| ... | ... | @@ -32,7 +32,7 @@ | 
| 32 | 32 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 33 | 33 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 34 | 34 | import { Radio, Card, Select } from 'ant-design-vue'; | 
| 35 | - import { trigger_condition_schema } from '../config'; | |
| 35 | + import { trigger_condition_schema } from '../config/config.data.ts'; | |
| 36 | 36 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 37 | 37 | import ConditionScreening from './ConditionScreening.vue'; | 
| 38 | 38 | |
| ... | ... | @@ -100,7 +100,7 @@ | 
| 100 | 100 | }, | 
| 101 | 101 | { | 
| 102 | 102 | label: '时间', | 
| 103 | - value: 'TIME', | |
| 103 | + value: 'DATE_TIME', | |
| 104 | 104 | }, | 
| 105 | 105 | ]; | 
| 106 | 106 | const childGetFieldsValue = () => getFieldsValue(); | 
| ... | ... | @@ -114,5 +114,6 @@ | 
| 114 | 114 | childGetFieldsValue, | 
| 115 | 115 | conditionScreeningRef, | 
| 116 | 116 | schedule, | 
| 117 | + operationType, | |
| 117 | 118 | }); | 
| 118 | 119 | </script> | ... | ... | 
| ... | ... | @@ -3,10 +3,7 @@ | 
| 3 | 3 | <CollapseContainer ref="collapseContainerRef" @expand="handleExpand"> | 
| 4 | 4 | <template #title> | 
| 5 | 5 | <div>条件筛选</div> | 
| 6 | - <RichText | |
| 7 | - :firstAttribute="firstAttribute" | |
| 8 | - :otherAttribute="otherAttribute" | |
| 9 | - @resetFilter="resetFilter" | |
| 6 | + <RichText :otherAttribute="otherAttribute" @resetFilter="resetFilter" | |
| 10 | 7 | /></template> | 
| 11 | 8 | |
| 12 | 9 | <template v-for="(item, index) in conditionScreeningList" :key="item"> | 
| ... | ... | @@ -29,7 +26,7 @@ | 
| 29 | 26 | <script lang="ts" setup> | 
| 30 | 27 | import { unref, ref } from 'vue'; | 
| 31 | 28 | import ConditionScreeningForm from './ConditionScreeningForm.vue'; | 
| 32 | - import { conditionPreView } from '../config.ts'; | |
| 29 | + import { conditionPreView } from '../config/formatData.ts'; | |
| 33 | 30 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 34 | 31 | import RichText from './RichText.vue'; | 
| 35 | 32 | const props = defineProps({ | 
| ... | ... | @@ -50,53 +47,51 @@ | 
| 50 | 47 | collapseContainerRef.value.handleExpand(); | 
| 51 | 48 | } | 
| 52 | 49 | unref(conditionScreeningList).push(Date.now()); | 
| 50 | + const lastIndex = refItem.conditionScreeningRefs.value.length - 1; | |
| 51 | + refItem.conditionScreeningRefs.value[lastIndex]?.appendSchemaByField( | |
| 52 | + { | |
| 53 | + field: 'AND', | |
| 54 | + label: '和', | |
| 55 | + component: 'Input', | |
| 56 | + slot: 'and', | |
| 57 | + colProps: { span: 3 }, | |
| 58 | + }, | |
| 59 | + 'value' | |
| 60 | + ); | |
| 53 | 61 | }; | 
| 54 | 62 | const handleExpand = (show) => { | 
| 55 | 63 | isPreview.value = show; | 
| 56 | 64 | }; | 
| 57 | 65 | |
| 58 | - const firstAttribute = ref({}); | |
| 59 | 66 | const otherAttribute = ref([]); | 
| 60 | 67 | // 预览条件筛选结果 | 
| 61 | 68 | const preView = async () => { | 
| 62 | 69 | const attributes = []; | 
| 63 | 70 | const fieldsValue = props.childGetFieldsValue(); | 
| 64 | 71 | for (let i = 0; i < unref(refItem.conditionScreeningRefs).length; i++) { | 
| 65 | - if (i === 0) { | |
| 66 | - const attr = conditionPreView( | |
| 67 | - [ | |
| 68 | - { | |
| 69 | - ...unref(refItem.conditionScreeningRefs)[i].getFieldsValue(), | |
| 70 | - attribute: fieldsValue.type2, | |
| 71 | - }, | |
| 72 | - ], | |
| 73 | - fieldsValue.operationType | |
| 74 | - ); | |
| 75 | - firstAttribute.value = attr[0]; | |
| 76 | - await unref(refItem.conditionScreeningRefs)[i].validate(); | |
| 77 | - continue; | |
| 78 | - } | |
| 79 | 72 | const valid = await unref(refItem.conditionScreeningRefs)[i].validate(); | 
| 80 | 73 | if (!valid) return; | 
| 81 | - | |
| 82 | 74 | attributes.push({ | 
| 83 | 75 | ...unref(refItem.conditionScreeningRefs)[i].getFieldsValue(), | 
| 84 | 76 | attribute: fieldsValue.type2, | 
| 85 | 77 | }); | 
| 86 | 78 | } | 
| 87 | 79 | otherAttribute.value = conditionPreView(attributes, fieldsValue.operationType); | 
| 88 | - | |
| 89 | 80 | collapseContainerRef.value.handleExpand(); | 
| 90 | 81 | }; | 
| 91 | 82 | |
| 92 | 83 | const resetFilter = () => { | 
| 93 | - firstAttribute.value = {}; | |
| 94 | 84 | otherAttribute.value = []; | 
| 95 | 85 | }; | 
| 96 | 86 | const deleteConditionForm = (index) => { | 
| 97 | 87 | unref(conditionScreeningList).splice(index, 1); | 
| 88 | + const lastIndex = refItem.conditionScreeningRefs.value.length - 2; | |
| 89 | + refItem.conditionScreeningRefs.value[lastIndex]?.removeSchemaByFiled('AND'); | |
| 98 | 90 | }; | 
| 91 | + | |
| 99 | 92 | defineExpose({ | 
| 100 | 93 | refItem, | 
| 94 | + conditionScreeningList, | |
| 95 | + otherAttribute, | |
| 101 | 96 | }); | 
| 102 | 97 | </script> | ... | ... | 
| ... | ... | @@ -17,7 +17,7 @@ | 
| 17 | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 18 | 18 | import { Icon } from '/@/components/Icon'; | 
| 19 | 19 | import { Tooltip } from 'ant-design-vue'; | 
| 20 | - import { isType } from '../config.ts'; | |
| 20 | + import { isType } from '../config/formatData.ts'; | |
| 21 | 21 | defineProps({ | 
| 22 | 22 | index: { | 
| 23 | 23 | type: Number, | ... | ... | 
| 1 | 1 | <template> | 
| 2 | - <div class="flex ml-4" v-if="firstAttribute?.value && firstAttribute?.attribute"> | |
| 3 | - <div class="text" style="color: #305680">{{ firstAttribute?.attribute }}</div> | |
| 4 | - {{ firstAttribute?.operation }} | |
| 5 | - <div class="text" style="color: #ff8c68">{{ firstAttribute?.value }}</div> | |
| 6 | - {{ firstAttribute?.compoundConditions ?? '' }} | |
| 7 | - </div> | |
| 8 | 2 | <div | 
| 9 | 3 | v-if="otherAttribute.length > 0 && otherAttribute[0].value && otherAttribute[0].operation" | 
| 10 | 4 | class="flex" | 
| 11 | 5 | > | 
| 12 | - <template v-for="item in otherAttribute" :key="item.value"> | |
| 6 | + <template v-for="(item, index) in otherAttribute" :key="item.value"> | |
| 13 | 7 | <div class="flex" v-if="item?.value && item?.attribute"> | 
| 14 | 8 | <div class="text mr-2" style="color: #305680">{{ item.attribute }}</div> | 
| 15 | 9 | {{ item.operation }} | 
| 16 | 10 | <div class="text ml-2" style="color: #ff8c68">{{ item.value }}</div> | 
| 17 | - {{ item.compoundConditions ?? '' }} | |
| 11 | + <span v-if="otherAttribute[index + 1]">和</span> | |
| 18 | 12 | </div> | 
| 19 | 13 | </template> | 
| 20 | 14 | </div> | 
| ... | ... | @@ -23,10 +17,6 @@ | 
| 23 | 17 | <script lang="ts" setup> | 
| 24 | 18 | import { watch, inject } from 'vue'; | 
| 25 | 19 | defineProps({ | 
| 26 | - firstAttribute: { | |
| 27 | - type: Object, | |
| 28 | - default: () => {}, | |
| 29 | - }, | |
| 30 | 20 | otherAttribute: { | 
| 31 | 21 | type: Array, | 
| 32 | 22 | default: () => [], | ... | ... | 
| ... | ... | @@ -51,13 +51,13 @@ | 
| 51 | 51 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 52 | 52 | import { Tooltip, Select, Checkbox, Card } from 'ant-design-vue'; | 
| 53 | 53 | import { Icon } from '/@/components/Icon'; | 
| 54 | - import { actionSchema } from '../config'; | |
| 54 | + import { actionSchema } from '../config/config.data.ts'; | |
| 55 | 55 | import jsoneditor from 'jsoneditor'; | 
| 56 | 56 | import 'jsoneditor/dist/jsoneditor.min.css'; | 
| 57 | 57 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | 
| 58 | 58 | import { useUserStore } from '/@/store/modules/user'; | 
| 59 | 59 | import ClearAlarm from './ClearAlarm.vue'; | 
| 60 | - defineProps({ | |
| 60 | + const props = defineProps({ | |
| 61 | 61 | actionIndex: { | 
| 62 | 62 | type: Number, | 
| 63 | 63 | required: true, | 
| ... | ... | @@ -66,13 +66,22 @@ | 
| 66 | 66 | type: Array, | 
| 67 | 67 | default: () => [], | 
| 68 | 68 | }, | 
| 69 | + triggerData: { | |
| 70 | + type: Array, | |
| 71 | + default: () => [], | |
| 72 | + }, | |
| 69 | 73 | }); | 
| 74 | + | |
| 70 | 75 | const emit = defineEmits(['deleteAction']); | 
| 71 | 76 | const userStore = useUserStore(); | 
| 72 | 77 | const options = computed(() => { | 
| 73 | 78 | return [ | 
| 74 | 79 | { label: '设备输出', value: 'DEVICE_OUT' }, | 
| 75 | - { label: '告警输出', value: 'MSG_NOTIFY', disabled: userStore.getOutTarget === 'MSG_NOTIFY' }, | |
| 80 | + { | |
| 81 | + label: '告警输出', | |
| 82 | + value: 'MSG_NOTIFY', | |
| 83 | + disabled: userStore.getOutTarget === 'MSG_NOTIFY' || !props.triggerData.length, | |
| 84 | + }, | |
| 76 | 85 | ]; | 
| 77 | 86 | }); | 
| 78 | 87 | const hasDisabled = ref(false); | 
| ... | ... | @@ -96,19 +105,14 @@ | 
| 96 | 105 | clearAlarmRef?.value?.conditionScreeningRef?.refItem?.conditionScreeningRefs?.value?.map( | 
| 97 | 106 | (item) => item.getFieldsValue() | 
| 98 | 107 | ); | 
| 99 | - console.log({ | |
| 100 | - ...getFieldsValue(), | |
| 101 | - ...clearAlarmRef?.value?.getFieldsValue(), | |
| 102 | - predicate, | |
| 103 | - doContext: unref(jsonInstance.value).get(), | |
| 104 | - schedule: clearAlarmRef?.value?.schedule, | |
| 105 | - }); | |
| 108 | + | |
| 106 | 109 | return { | 
| 107 | 110 | ...getFieldsValue(), | 
| 108 | 111 | ...clearAlarmRef?.value?.getFieldsValue(), | 
| 109 | 112 | predicate, | 
| 110 | 113 | doContext: unref(jsonInstance.value).get(), | 
| 111 | 114 | schedule: clearAlarmRef?.value?.schedule, | 
| 115 | + checked: checked.value, | |
| 112 | 116 | }; | 
| 113 | 117 | }; | 
| 114 | 118 | const setFieldsFormValueFun = (fieldsValue) => { | 
| ... | ... | @@ -123,6 +127,14 @@ | 
| 123 | 127 | }, | 
| 124 | 128 | }); | 
| 125 | 129 | }; | 
| 130 | + const updateEditFieldAlarmConfig = (alarmConfigList) => { | |
| 131 | + updateSchema({ | |
| 132 | + field: 'alarm_config', | |
| 133 | + componentProps: { | |
| 134 | + options: alarmConfigList, | |
| 135 | + }, | |
| 136 | + }); | |
| 137 | + }; | |
| 126 | 138 | const updateFieldAlarmConfig = (alarmConfigList) => { | 
| 127 | 139 | updateSchema({ | 
| 128 | 140 | field: 'alarm_config', | 
| ... | ... | @@ -169,6 +181,18 @@ | 
| 169 | 181 | |
| 170 | 182 | const operationType = ref<string>(''); | 
| 171 | 183 | const clearAlarmRef = ref(); | 
| 184 | + | |
| 185 | + const getRefItemConditionScreeningRefs = async () => { | |
| 186 | + await nextTick(); | |
| 187 | + return clearAlarmRef.value.conditionScreeningRef.refItem.conditionScreeningRefs; | |
| 188 | + }; | |
| 189 | + const setConditionScreeningList = (list) => { | |
| 190 | + clearAlarmRef.value.conditionScreeningRef.conditionScreeningList = list; | |
| 191 | + }; | |
| 192 | + | |
| 193 | + const setRichText = (list) => { | |
| 194 | + clearAlarmRef.value.conditionScreeningRef.otherAttribute = list; | |
| 195 | + }; | |
| 172 | 196 | provide('operationType', operationType); | 
| 173 | 197 | defineExpose({ | 
| 174 | 198 | getFieldsValueFunc, | 
| ... | ... | @@ -180,6 +204,12 @@ | 
| 180 | 204 | getJsonValue, | 
| 181 | 205 | setJsonValue, | 
| 182 | 206 | jsonInstance, | 
| 207 | + updateEditFieldAlarmConfig, | |
| 208 | + checked, | |
| 209 | + clearAlarmRef, | |
| 210 | + getRefItemConditionScreeningRefs, | |
| 211 | + setConditionScreeningList, | |
| 212 | + setRichText, | |
| 183 | 213 | }); | 
| 184 | 214 | </script> | 
| 185 | 215 | ... | ... | 
| 1 | 1 | <template> | 
| 2 | - <CollapseContainer style="background-color: #f2f2f2" :title="`执行条件 ${conditionIndex + 1}`"> | |
| 3 | - <template #action> | |
| 4 | - <div class="flex"> | |
| 5 | - <div> | |
| 6 | - <span class="mr-2">启用规则</span> | |
| 7 | - <RadioGroup v-model:value="schedule" :options="scheduleOptions" /> | |
| 2 | + <div> | |
| 3 | + <CollapseContainer style="background-color: #f2f2f2" :title="`执行条件${conditionIndex + 1}`"> | |
| 4 | + <template #action> | |
| 5 | + <div class="flex"> | |
| 6 | + <div> | |
| 7 | + <span class="mr-2">启用规则</span> | |
| 8 | + <RadioGroup v-model:value="schedule" :options="scheduleOptions" /> | |
| 9 | + </div> | |
| 10 | + <Tooltip title="移除" class="ml-4"> | |
| 11 | + <Icon | |
| 12 | + icon="fluent:delete-off-20-regular" | |
| 13 | + size="20" | |
| 14 | + class="mr-2 cursor-pointer" | |
| 15 | + @click="handleDelete(conditionIndex)" | |
| 16 | + /> | |
| 17 | + </Tooltip> | |
| 8 | 18 | </div> | 
| 9 | - <Tooltip title="移除" class="ml-4"> | |
| 10 | - <Icon | |
| 11 | - icon="fluent:delete-off-20-regular" | |
| 12 | - size="20" | |
| 13 | - class="mr-2 cursor-pointer" | |
| 14 | - @click="handleDelete(conditionIndex)" | |
| 19 | + </template> | |
| 20 | + <BasicForm @register="registerForm"> | |
| 21 | + <template #operationType="{ model, field }"> | |
| 22 | + <Select | |
| 23 | + :options="options" | |
| 24 | + v-model:value="model[field]" | |
| 25 | + @change="operationType = model[field]" | |
| 26 | + placeholder="请选择比较类型" | |
| 27 | + allowClear | |
| 15 | 28 | /> | 
| 16 | - </Tooltip> | |
| 17 | - </div> | |
| 18 | - </template> | |
| 19 | - <BasicForm @register="registerCondition"> | |
| 20 | - <template #operationType="{ model, field }"> | |
| 21 | - <Select | |
| 22 | - :options="options" | |
| 23 | - v-model:value="model[field]" | |
| 24 | - @change="operationType = model[field]" | |
| 25 | - placeholder="请选择比较类型" | |
| 26 | - allowClear | |
| 29 | + </template> | |
| 30 | + </BasicForm> | |
| 31 | + <Card size="small" :bordered="false" style="border: 2px dashed #797979" v-if="operationType"> | |
| 32 | + <ConditionScreening | |
| 33 | + :childGetFieldsValue="childGetFieldsValue" | |
| 34 | + ref="conditionScreeningRef" | |
| 27 | 35 | /> | 
| 28 | - </template> | |
| 29 | - </BasicForm> | |
| 30 | - <Card size="small" :bordered="false" style="border: 2px dashed #797979" v-if="operationType"> | |
| 31 | - <ConditionScreening :childGetFieldsValue="childGetFieldsValue" ref="conditionScreeningRef" /> | |
| 32 | - </Card> | |
| 33 | - </CollapseContainer> | |
| 36 | + </Card> | |
| 37 | + </CollapseContainer> | |
| 38 | + </div> | |
| 34 | 39 | </template> | 
| 35 | 40 | <script lang="ts" setup> | 
| 36 | - import { ref, provide } from 'vue'; | |
| 41 | + import { ref, provide, nextTick } from 'vue'; | |
| 37 | 42 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 38 | 43 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 44 | + import { Icon } from '/@/components/Icon'; | |
| 39 | 45 | import { Tooltip, Radio, Card, Select } from 'ant-design-vue'; | 
| 40 | - | |
| 41 | - import { trigger_condition_schema } from '../config'; | |
| 46 | + import { trigger_condition_schema } from '../config/config.data.ts'; | |
| 42 | 47 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 43 | - import { Icon } from '/@/components/Icon'; | |
| 44 | 48 | import ConditionScreening from './ConditionScreening.vue'; | 
| 45 | 49 | const RadioGroup = Radio.Group; | 
| 46 | 50 | |
| ... | ... | @@ -51,13 +55,12 @@ | 
| 51 | 55 | }, | 
| 52 | 56 | }); | 
| 53 | 57 | const emit = defineEmits(['deleteCondition']); | 
| 54 | - | |
| 55 | - const [registerCondition, { getFieldsValue, updateSchema, resetFields, setFieldsValue }] = | |
| 56 | - useForm({ | |
| 57 | - schemas: trigger_condition_schema, | |
| 58 | - showActionButtonGroup: false, | |
| 59 | - }); | |
| 60 | 58 | const conditionScreeningRef = ref(); | 
| 59 | + const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | |
| 60 | + schemas: trigger_condition_schema, | |
| 61 | + showActionButtonGroup: false, | |
| 62 | + }); | |
| 63 | + | |
| 61 | 64 | const getFieldsValueFunc = () => { | 
| 62 | 65 | const predicate = conditionScreeningRef?.value?.refItem?.conditionScreeningRefs?.value?.map( | 
| 63 | 66 | (item) => { | 
| ... | ... | @@ -66,7 +69,6 @@ | 
| 66 | 69 | ); | 
| 67 | 70 | return { ...getFieldsValue(), predicate, schedule: schedule.value }; | 
| 68 | 71 | }; | 
| 69 | - const resetFieldsValueFunc = () => resetFields(); | |
| 70 | 72 | const updateFieldDeviceId = (deviceList: any[]) => { | 
| 71 | 73 | updateSchema({ | 
| 72 | 74 | field: 'entityId', | 
| ... | ... | @@ -80,22 +82,30 @@ | 
| 80 | 82 | }, | 
| 81 | 83 | }); | 
| 82 | 84 | }; | 
| 85 | + const resetFieldsValueFunc = () => resetFields(); | |
| 86 | + // 回显数据函数 | |
| 83 | 87 | const setFieldsFormValueFun = (fieldsValue) => { | 
| 84 | 88 | setFieldsValue(fieldsValue); | 
| 85 | 89 | }; | 
| 86 | 90 | const updateFieldAttributeFunc = async () => { | 
| 87 | 91 | const data1 = await getAttribute(); | 
| 88 | - const data = data1.map((m) => ({ label: m, value: m })); | |
| 92 | + const options = data1.map((m) => { | |
| 93 | + return { | |
| 94 | + label: m, | |
| 95 | + value: m, | |
| 96 | + }; | |
| 97 | + }); | |
| 89 | 98 | updateSchema({ | 
| 90 | - field: 'type', | |
| 99 | + field: 'type2', | |
| 91 | 100 | componentProps: { | 
| 92 | 101 | placeholder: '请选择属性', | 
| 93 | - options: data, | |
| 102 | + options, | |
| 94 | 103 | }, | 
| 95 | 104 | }); | 
| 96 | 105 | }; | 
| 97 | - const handleDelete = (conditionIndex) => { | |
| 98 | - emit('deleteCondition', conditionIndex); | |
| 106 | + | |
| 107 | + const handleDelete = (triggerIndex) => { | |
| 108 | + emit('deleteCondition', triggerIndex); | |
| 99 | 109 | }; | 
| 100 | 110 | |
| 101 | 111 | const schedule = ref('ANY_TIME'); | 
| ... | ... | @@ -105,6 +115,7 @@ | 
| 105 | 115 | { label: '自定义启用', value: 'CUSTOM' }, | 
| 106 | 116 | ]; | 
| 107 | 117 | const operationType = ref<string>(''); | 
| 118 | + | |
| 108 | 119 | const options = [ | 
| 109 | 120 | { | 
| 110 | 121 | label: '数字', | 
| ... | ... | @@ -120,19 +131,35 @@ | 
| 120 | 131 | }, | 
| 121 | 132 | { | 
| 122 | 133 | label: '时间', | 
| 123 | - value: 'TIME', | |
| 134 | + value: 'DATE_TIME', | |
| 124 | 135 | }, | 
| 125 | 136 | ]; | 
| 126 | - provide('operationType', operationType); | |
| 127 | - | |
| 128 | 137 | // 子组件获取父组件的值 | 
| 129 | 138 | const childGetFieldsValue = () => getFieldsValue(); | 
| 130 | 139 | |
| 140 | + provide('operationType', operationType); | |
| 141 | + | |
| 142 | + // 获取conditionScreeningForm的组件 | |
| 143 | + const getRefItemConditionScreeningRefs = async () => { | |
| 144 | + await nextTick(); | |
| 145 | + return conditionScreeningRef.value.refItem.conditionScreeningRefs; | |
| 146 | + }; | |
| 147 | + | |
| 148 | + const setConditionScreeningList = (list) => { | |
| 149 | + conditionScreeningRef.value.conditionScreeningList = list; | |
| 150 | + }; | |
| 151 | + const setRichText = (list) => { | |
| 152 | + conditionScreeningRef.value.otherAttribute = list; | |
| 153 | + }; | |
| 131 | 154 | defineExpose({ | 
| 132 | 155 | getFieldsValueFunc, | 
| 133 | 156 | updateFieldDeviceId, | 
| 134 | 157 | resetFieldsValueFunc, | 
| 135 | 158 | setFieldsFormValueFun, | 
| 136 | 159 | childGetFieldsValue, | 
| 160 | + operationType, | |
| 161 | + getRefItemConditionScreeningRefs, | |
| 162 | + setConditionScreeningList, | |
| 163 | + setRichText, | |
| 137 | 164 | }); | 
| 138 | 165 | </script> | ... | ... | 
| ... | ... | @@ -38,12 +38,12 @@ | 
| 38 | 38 | </div> | 
| 39 | 39 | </template> | 
| 40 | 40 | <script lang="ts" setup> | 
| 41 | - import { ref, provide } from 'vue'; | |
| 41 | + import { ref, provide, nextTick } from 'vue'; | |
| 42 | 42 | import { CollapseContainer } from '/@/components/Container/index'; | 
| 43 | 43 | import { BasicForm, useForm } from '/@/components/Form/index'; | 
| 44 | 44 | import { Icon } from '/@/components/Icon'; | 
| 45 | 45 | import { Tooltip, Radio, Card, Select } from 'ant-design-vue'; | 
| 46 | - import { trigger_condition_schema } from '../config'; | |
| 46 | + import { trigger_condition_schema } from '../config/config.data.ts'; | |
| 47 | 47 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 
| 48 | 48 | import ConditionScreening from './ConditionScreening.vue'; | 
| 49 | 49 | const RadioGroup = Radio.Group; | 
| ... | ... | @@ -100,39 +100,6 @@ | 
| 100 | 100 | componentProps: { | 
| 101 | 101 | placeholder: '请选择属性', | 
| 102 | 102 | options, | 
| 103 | - onChange(value) { | |
| 104 | - if (value) { | |
| 105 | - updateSchema([ | |
| 106 | - { | |
| 107 | - field: 'operation', | |
| 108 | - ifShow: true, | |
| 109 | - }, | |
| 110 | - { | |
| 111 | - field: 'value', | |
| 112 | - ifShow: true, | |
| 113 | - }, | |
| 114 | - ]); | |
| 115 | - setFieldsValue({ | |
| 116 | - operation: '', | |
| 117 | - value: '', | |
| 118 | - }); | |
| 119 | - return; | |
| 120 | - } | |
| 121 | - updateSchema([ | |
| 122 | - { | |
| 123 | - field: 'operation', | |
| 124 | - ifShow: false, | |
| 125 | - }, | |
| 126 | - { | |
| 127 | - field: 'value', | |
| 128 | - ifShow: false, | |
| 129 | - }, | |
| 130 | - ]); | |
| 131 | - setFieldsValue({ | |
| 132 | - operation: '', | |
| 133 | - value: '', | |
| 134 | - }); | |
| 135 | - }, | |
| 136 | 103 | }, | 
| 137 | 104 | }); | 
| 138 | 105 | }; | 
| ... | ... | @@ -148,6 +115,7 @@ | 
| 148 | 115 | { label: '自定义启用', value: 'CUSTOM' }, | 
| 149 | 116 | ]; | 
| 150 | 117 | const operationType = ref<string>(''); | 
| 118 | + | |
| 151 | 119 | const options = [ | 
| 152 | 120 | { | 
| 153 | 121 | label: '数字', | 
| ... | ... | @@ -163,7 +131,7 @@ | 
| 163 | 131 | }, | 
| 164 | 132 | { | 
| 165 | 133 | label: '时间', | 
| 166 | - value: 'TIME', | |
| 134 | + value: 'DATE_TIME', | |
| 167 | 135 | }, | 
| 168 | 136 | ]; | 
| 169 | 137 | // 子组件获取父组件的值 | 
| ... | ... | @@ -171,11 +139,27 @@ | 
| 171 | 139 | |
| 172 | 140 | provide('operationType', operationType); | 
| 173 | 141 | |
| 142 | + // 获取conditionScreeningForm的组件 | |
| 143 | + const getRefItemConditionScreeningRefs = async () => { | |
| 144 | + await nextTick(); | |
| 145 | + return conditionScreeningRef.value.refItem.conditionScreeningRefs; | |
| 146 | + }; | |
| 147 | + | |
| 148 | + const setConditionScreeningList = (list) => { | |
| 149 | + conditionScreeningRef.value.conditionScreeningList = list; | |
| 150 | + }; | |
| 151 | + const setRichText = (list) => { | |
| 152 | + conditionScreeningRef.value.otherAttribute = list; | |
| 153 | + }; | |
| 174 | 154 | defineExpose({ | 
| 175 | 155 | getFieldsValueFunc, | 
| 176 | 156 | updateFieldDeviceId, | 
| 177 | 157 | resetFieldsValueFunc, | 
| 178 | 158 | setFieldsFormValueFun, | 
| 179 | 159 | childGetFieldsValue, | 
| 160 | + operationType, | |
| 161 | + getRefItemConditionScreeningRefs, | |
| 162 | + setConditionScreeningList, | |
| 163 | + setRichText, | |
| 180 | 164 | }); | 
| 181 | 165 | </script> | ... | ... | 
| ... | ... | @@ -20,13 +20,13 @@ | 
| 20 | 20 | label: '编辑', | 
| 21 | 21 | icon: 'clarity:note-edit-line', | 
| 22 | 22 | onClick: handleEdit.bind(null, record), | 
| 23 | - ifShow: record.creator === userId, | |
| 23 | + ifShow: record.creator === userId && record.status !== 1, | |
| 24 | 24 | }, | 
| 25 | 25 | { | 
| 26 | 26 | label: '删除', | 
| 27 | 27 | icon: 'ant-design:delete-outlined', | 
| 28 | 28 | color: 'error', | 
| 29 | - ifShow: record.creator === userId, | |
| 29 | + ifShow: record.creator === userId && record.status !== 1, | |
| 30 | 30 | popConfirm: { | 
| 31 | 31 | title: '是否确认删除', | 
| 32 | 32 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 
| ... | ... | @@ -50,7 +50,7 @@ | 
| 50 | 50 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | 
| 51 | 51 | import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | 
| 52 | 52 | |
| 53 | - import { columns, searchFormSchema } from './config'; | |
| 53 | + import { columns, searchFormSchema } from './config/config.data.ts'; | |
| 54 | 54 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 
| 55 | 55 | import { getAuthCache } from '/@/utils/auth'; | 
| 56 | 56 | import { authBtn } from '/@/enums/roleEnum'; | ... | ... |