|
1 | 1 | <template> |
2 | | - <el-affix position="bottom" :offset="20" style="position: absolute; bottom: 5px;"> |
3 | | - <el-tooltip effect="dark" content="You can get some functions templates by click it." placement="top-start"> |
4 | | - <el-button type="primary" @click="dialogVisible = !dialogVisible" |
5 | | - data-intro="You can search your desired template functions.">{{ t('button.toolbox') }} |
6 | | - </el-button> |
7 | | - </el-tooltip> |
8 | | - </el-affix> |
| 2 | + <el-affix position="bottom" :offset="20" style="position: absolute; bottom: 5px"> |
| 3 | + <el-tooltip |
| 4 | + effect="dark" |
| 5 | + content="You can get some functions templates by click it." |
| 6 | + placement="top-start" |
| 7 | + > |
| 8 | + <el-button |
| 9 | + type="primary" |
| 10 | + @click="dialogVisible = !dialogVisible" |
| 11 | + data-intro="You can search your desired template functions." |
| 12 | + >{{ t('button.toolbox') }} |
| 13 | + </el-button> |
| 14 | + </el-tooltip> |
| 15 | + </el-affix> |
9 | 16 |
|
10 | | - <el-dialog v-model="dialogVisible" :title="t('title.templateQuery')" width="40%" draggable destroy-on-close> |
11 | | - <template #footer> |
12 | | - <el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" /> |
13 | | - <span class="dialog-footer"> |
14 | | - <el-table :data="funcs" style="width: 100%"> |
15 | | - <el-table-column label="Key" width="250"> |
16 | | - <template #default="scope"> |
17 | | - <el-input v-model="scope.row.key" placeholder="Value" /> |
18 | | - </template> |
19 | | - </el-table-column> |
20 | | - <el-table-column label="Value"> |
21 | | - <template #default="scope"> |
22 | | - <div style="display: flex; align-items: center"> |
23 | | - <el-input v-model="scope.row.value" placeholder="Value" /> |
24 | | - </div> |
25 | | - </template> |
26 | | - </el-table-column> |
27 | | - </el-table> |
28 | | - </span> |
29 | | - </template> |
30 | | - </el-dialog> |
| 17 | + <el-dialog |
| 18 | + v-model="dialogVisible" |
| 19 | + :title="t('title.templateQuery')" |
| 20 | + width="40%" |
| 21 | + draggable |
| 22 | + destroy-on-close |
| 23 | + > |
| 24 | + <template #footer> |
| 25 | + <el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" /> |
| 26 | + <span class="dialog-footer"> |
| 27 | + <el-table :data="funcs" style="width: 100%"> |
| 28 | + <el-table-column label="Key" width="250"> |
| 29 | + <template #default="scope"> |
| 30 | + <el-input v-model="scope.row.key" placeholder="Value" /> |
| 31 | + </template> |
| 32 | + </el-table-column> |
| 33 | + <el-table-column label="Value"> |
| 34 | + <template #default="scope"> |
| 35 | + <div style="display: flex; align-items: center"> |
| 36 | + <el-input v-model="scope.row.value" placeholder="Value" /> |
| 37 | + </div> |
| 38 | + </template> |
| 39 | + </el-table-column> |
| 40 | + </el-table> |
| 41 | + </span> |
| 42 | + </template> |
| 43 | + </el-dialog> |
31 | 44 | </template> |
32 | 45 |
|
33 | 46 |
|
34 | 47 | <script setup lang="ts"> |
35 | 48 | import { ref } from 'vue' |
36 | | -import type { Pair } from './types' |
| 49 | +import type { Pair } from '../../types/types' |
37 | 50 | import { useI18n } from 'vue-i18n' |
| 51 | +import { FunctionsQuery } from '@/api/cert/cert' |
| 52 | +import { ElMessage } from 'element-plus' |
38 | 53 |
|
39 | 54 | const { t } = useI18n() |
40 | 55 |
|
41 | 56 | const dialogVisible = ref(false) |
42 | 57 | const query = ref('') |
43 | 58 | const funcs = ref([] as Pair[]) |
44 | 59 |
|
45 | | -function queryFuncs() { |
46 | | - API.FunctionsQuery(query.value, (d) => { |
47 | | - funcs.value = d.data |
| 60 | +const queryFuncs = () => { |
| 61 | + FunctionsQuery(query.value) |
| 62 | + .then((res: any) => { |
| 63 | + funcs.value = res.data |
| 64 | + }) |
| 65 | + .catch((err: any) => { |
| 66 | + ElMessage({ |
| 67 | + showClose: true, |
| 68 | + message: err.message, |
| 69 | + type: 'error' |
| 70 | + }) |
48 | 71 | }) |
49 | 72 | } |
50 | 73 | </script> |
0 commit comments