无人机管理后台前端(已迁走)
张含笑
2025-08-05 c832bf2e80ac465e71b7a1c1f7a59d4252030989
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
  <a-popover
    :visible="state.sVisible"
    trigger="click"
    v-bind="$attrs"
    :overlay-class-name="overlayClassName"
    placement="bottom"
    @visibleChange=""
    v-on="$attrs"
  >
    <template #content>
      <div class="title-content"></div>
      <slot name="formContent" />
      <div class="uranus-popconfirm-btns">
        <a-button size="sm" @click="onCancel">
          {{ cancelText || '取消' }}
        </a-button>
        <a-button
          size="sm"
          :loading="loading"
          type="primary"
          class="confirm-btn"
          @click="onConfirm"
        >
          {{ okText || '确定' }}
        </a-button>
      </div>
    </template>
    <template v-if="$slots.default">
      <slot></slot>
    </template>
  </a-popover>
</template>
 
<script setup>
import { defineProps, defineEmits, reactive, watch, computed } from 'vue';
 
const props = defineProps();
 
const emit = defineEmits(['cancel', 'confirm']);
 
const state = reactive({
  sVisible: false,
  loading: false,
});
 
watch(
  () => props.visible,
  val => {
    state.sVisible = val || false;
  }
);
 
const loading = computed(() => {
  return props.loading;
});
const okLabel = computed(() => {
  return props.loading ? '' : '确定';
});
 
const overlayClassName = computed(() => {
  const classList = ['device-setting-popconfirm'];
  return classList.join(' ');
});
 
function onConfirm(e) {
  if (props.disabled) {
    return;
  }
  emit('confirm', e);
}
 
function onCancel(e) {
  state.sVisible = false;
  emit('cancel', e);
}
</script>
 
<style lang="scss">
.device-setting-popconfirm {
  min-width: 300px;
 
  .uranus-popconfirm-btns {
    display: flex;
    padding: 10px 0px;
    justify-content: flex-end;
 
    .confirm-btn {
      margin-left: 10px;
    }
  }
 
  .form-content {
    display: inline-flex;
    align-items: center;
 
    .form-label {
      padding-right: 10px;
    }
  }
}
</style>