schangxiang@126.com
2025-05-20 e92383f760f42050f55aa032c649814deb3b7752
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
  <el-dialog
    :append-to-body="true"
    :close-on-click-modal="false"
    :destroy-on-close="true"
    :modal="false"
    :title="title"
    custom-class="cms-el-dialog"
    width="661px"
    @close="close"
  >
    <div class="dialog-body">
      <div class="row">
        <div class="col">
          <InputCode ref="inputCode" v-model="code"></InputCode>
        </div>
      </div>
    </div>
 
    <template #footer>
      <el-button class="btn" @click="close">取消</el-button>
      <el-button class="btn btn-submit" type="primary" @click="change"
        >确定</el-button
      >
    </template>
  </el-dialog>
</template>
<script setup lang="ts">
import { defineEmits, ref, watch } from 'vue'
import InputCode from './InputCode.vue'
 
const props = defineProps({
  code: {
    type: String,
    default: '',
  },
  title: {
    type: String,
    default: '',
  },
})
 
const emit = defineEmits(['update:modelValue', 'update:code', 'change'])
 
// code ------------------------------
 
let code = ref('')
const reset = () => {
  code.value = props.code || ''
}
watch(
  () => props.code,
  () => {
    code.value = props.code || ''
  },
  { immediate: true }
)
 
async function change() {
  emit('update:code', code.value)
  emit('change', code.value)
}
 
function close() {
  emit('update:modelValue', false)
  reset()
}
</script>
 
<!-- .row>.col -->
<style lang="scss" scoped>
.row {
  display: flex;
  gap: 1px;
  .col {
    flex: 1;
    min-width: 0;
  }
}
</style>
 
<!-- panel -->
<style lang="scss" scoped>
.dialog-body {
  margin-top: -8px;
  .header {
    font-size: 14px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #ffffff;
    padding: 0 10px 12px;
    span {
      font-size: 12px;
      font-family: PingFang SC-Regular, PingFang SC;
      font-weight: 700;
      color: #606162;
    }
  }
}
</style>
<!-- global -->
<style lang="scss">
dl.global_usage_0002 {
  margin: -6px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 480px;
  // pointer-events: none;
  > div {
    display: flex;
    // gap: 10px;
    dt {
      flex: none;
    }
    dd {
      margin: 0;
      white-space: pre-line;
    }
  }
}
</style>