소스 검색

fix:处理监控企业分组id未传递

yangfeng 6 달 전
부모
커밋
9e0ef0b4dd

+ 6 - 0
apps/bigmember_pc/src/composables/quick-monitor/component/MonitorGroup.vue

@@ -173,6 +173,10 @@ function setGroupSelected(data) {
     })
   })
 }
+
+defineExpose({
+  getSelected
+})
 </script>
 <template>
   <div class="monitor-group" :class="{ disabled: isDisabled }">
@@ -186,6 +190,7 @@ function setGroupSelected(data) {
           placeholder="请输入分组名称"
           class="add-input"
           maxlength="15"
+          autofocus
           @keyup.enter.native="onAddConfirm"
         >
           <template #suffix>
@@ -251,6 +256,7 @@ function setGroupSelected(data) {
             placeholder="请输入分组名称"
             class="add-input input-bg"
             maxlength="15"
+            autofocus
             @input="onItemInput($event, item)"
             @keyup.enter.native="onItemConfirm(item)"
           >

+ 12 - 2
apps/bigmember_pc/src/composables/quick-monitor/component/QuickMonitor.vue

@@ -27,7 +27,7 @@ const props = defineProps({
 })
 
 const that = getCurrentInstance().proxy
-const groupId = ref('')
+const groupRef = ref('')
 
 const {
   // 基础展示信息
@@ -80,6 +80,15 @@ function onChangeGroup(id) {
   doChangeGroup(id)
 }
 
+function doClickMonitorActionsFn(item) {
+  //  未触发子组件change事件时,手动获取选中的分组
+  if (groupRef.value) {
+    const selected = groupRef.value.getSelected()
+    doChangeGroup(selected)
+  }
+  doClickMonitorActions(item.action || 'doCloseDialog')
+}
+
 defineExpose({
   model,
   getParams
@@ -134,7 +143,7 @@ defineExpose({
           class="action-button"
           :class="item.class"
           :disabled="item.disabled"
-          @click="doClickMonitorActions(item.action || 'doCloseDialog')"
+          @click="doClickMonitorActionsFn(item)"
         >
           {{ item.label }}
         </button>
@@ -142,6 +151,7 @@ defineExpose({
       <!-- 选择监控分组 -->
       <MonitorGroup
         v-if="dialogConfig.template === 'group'"
+        ref="groupRef"
         :list="groupList"
         @emitDisabled="onGroupDisabled"
         @onChange="onChangeGroup"