提交 | 用户 | 时间
|
1c14d6
|
1 |
<template> |
L |
2 |
<!-- 搜索 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-form |
|
5 |
class="-mb-15px" |
|
6 |
:model="queryParams" |
|
7 |
ref="queryFormRef" |
|
8 |
:inline="true" |
|
9 |
label-width="68px" |
|
10 |
> |
|
11 |
<el-form-item label="名称" prop="name"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.name" |
|
14 |
placeholder="请输入名称" |
|
15 |
clearable |
|
16 |
@keyup.enter="handleQuery" |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="handleQuery"> |
6d9c08
|
22 |
<Icon icon="ep:search" class="mr-5px"/> |
1c14d6
|
23 |
搜索 |
L |
24 |
</el-button> |
|
25 |
<el-button @click="resetQuery"> |
6d9c08
|
26 |
<Icon icon="ep:refresh" class="mr-5px"/> |
1c14d6
|
27 |
重置 |
L |
28 |
</el-button> |
|
29 |
<el-button |
|
30 |
type="primary" |
|
31 |
plain |
|
32 |
@click="openForm('create')" |
6d9c08
|
33 |
v-hasPermi="['data:channel-http:create']" |
1c14d6
|
34 |
> |
6d9c08
|
35 |
<Icon icon="ep:plus" class="mr-5px"/> |
1c14d6
|
36 |
新增 |
L |
37 |
</el-button> |
|
38 |
</el-form-item> |
|
39 |
</el-form> |
|
40 |
</ContentWrap> |
|
41 |
|
|
42 |
<!-- 列表 --> |
|
43 |
<ContentWrap> |
|
44 |
<el-table v-loading="loading" :data="list"> |
6d9c08
|
45 |
<el-table-column label="名称" align="center" prop="name"/> |
潘 |
46 |
<el-table-column label="编码" align="center" prop="code"/> |
|
47 |
<el-table-column label="url" header-align="center" align="left" min-width="300" prop="url"/> |
|
48 |
<el-table-column label="方法" align="center" prop="method"/> |
|
49 |
<el-table-column label="参数" align="center" prop="param"/> |
|
50 |
<el-table-column label="描述" header-align="center" align="left" min-width="300" prop="descp"/> |
1c14d6
|
51 |
<el-table-column label="操作" align="center" min-width="110" fixed="right"> |
L |
52 |
<template #default="scope"> |
|
53 |
<el-button |
|
54 |
link |
|
55 |
type="primary" |
|
56 |
@click="openForm('update', scope.row.id)" |
6d9c08
|
57 |
v-hasPermi="['data:channel-http:update']" |
1c14d6
|
58 |
> |
L |
59 |
编辑 |
|
60 |
</el-button> |
|
61 |
<el-button |
|
62 |
link |
91cd98
|
63 |
type="primary" |
6c2636
|
64 |
@click="openTagList(scope.row.id, scope.row.name)" |
91cd98
|
65 |
v-hasPermi="['data:channel-http:update']" |
潘 |
66 |
> |
|
67 |
TAG |
|
68 |
</el-button> |
|
69 |
<el-button |
|
70 |
link |
1c14d6
|
71 |
type="danger" |
L |
72 |
@click="handleDelete(scope.row.id)" |
6d9c08
|
73 |
v-hasPermi="['data:channel-http:delete']" |
1c14d6
|
74 |
> |
L |
75 |
删除 |
|
76 |
</el-button> |
|
77 |
</template> |
|
78 |
</el-table-column> |
|
79 |
</el-table> |
|
80 |
<!-- 分页 --> |
|
81 |
<Pagination |
|
82 |
:total="total" |
|
83 |
v-model:page="queryParams.pageNo" |
|
84 |
v-model:limit="queryParams.pageSize" |
|
85 |
@pagination="getList" |
|
86 |
/> |
|
87 |
</ContentWrap> |
|
88 |
|
|
89 |
<!-- 表单弹窗:添加/修改 --> |
6d9c08
|
90 |
<HttpApiForm ref="formRef" @success="getList"/> |
1c14d6
|
91 |
|
91cd98
|
92 |
<!-- TAG弹窗:添加/修改 --> |
潘 |
93 |
<TagList ref="tagRef" @success="getList" /> |
|
94 |
|
1c14d6
|
95 |
</template> |
L |
96 |
<script lang="ts" setup> |
|
97 |
import * as HttpApi from '@/api/data/channel/http' |
|
98 |
import HttpApiForm from './HttpApiForm.vue' |
91cd98
|
99 |
import TagList from './tag/index.vue' |
1c14d6
|
100 |
|
6d9c08
|
101 |
defineOptions({name: 'DataHttpApi'}) |
1c14d6
|
102 |
|
6d9c08
|
103 |
const message = useMessage() // 消息弹窗 |
潘 |
104 |
const {t} = useI18n() // 国际化 |
1c14d6
|
105 |
|
6d9c08
|
106 |
const loading = ref(true) // 列表的加载中 |
潘 |
107 |
const total = ref(0) // 列表的总页数 |
|
108 |
const list = ref([]) // 列表的数据 |
|
109 |
const queryParams = reactive({ |
|
110 |
pageNo: 1, |
|
111 |
pageSize: 10, |
|
112 |
name: undefined |
|
113 |
}) |
|
114 |
const queryFormRef = ref() // 搜索的表单 |
|
115 |
const exportLoading = ref(false) // 导出的加载中 |
1c14d6
|
116 |
|
6d9c08
|
117 |
/** 查询列表 */ |
潘 |
118 |
const getList = async () => { |
|
119 |
loading.value = true |
|
120 |
try { |
|
121 |
const page = await HttpApi.getHttpApiPage(queryParams) |
|
122 |
list.value = page.list |
|
123 |
total.value = page.total |
|
124 |
} finally { |
|
125 |
loading.value = false |
1c14d6
|
126 |
} |
6d9c08
|
127 |
} |
1c14d6
|
128 |
|
6d9c08
|
129 |
/** 搜索按钮操作 */ |
潘 |
130 |
const handleQuery = () => { |
|
131 |
queryParams.pageNo = 1 |
|
132 |
getList() |
|
133 |
} |
1c14d6
|
134 |
|
6d9c08
|
135 |
/** 重置按钮操作 */ |
潘 |
136 |
const resetQuery = () => { |
|
137 |
queryFormRef.value.resetFields() |
|
138 |
handleQuery() |
|
139 |
} |
1c14d6
|
140 |
|
6d9c08
|
141 |
/** 添加/修改操作 */ |
潘 |
142 |
const formRef = ref() |
|
143 |
const openForm = (type: string, id?: number) => { |
|
144 |
formRef.value.open(type, id) |
|
145 |
} |
1c14d6
|
146 |
|
91cd98
|
147 |
/** TAG操作 */ |
潘 |
148 |
const tagRef = ref() |
93ce03
|
149 |
const openTagList = (id?: string,name?: string) => { |
6c2636
|
150 |
tagRef.value.open(id,name) |
91cd98
|
151 |
} |
潘 |
152 |
|
6d9c08
|
153 |
/** 删除按钮操作 */ |
潘 |
154 |
const handleDelete = async (id: number) => { |
|
155 |
try { |
|
156 |
// 删除的二次确认 |
|
157 |
await message.delConfirm() |
|
158 |
// 发起删除 |
|
159 |
await HttpApi.deleteHttpApi(id) |
|
160 |
message.success(t('common.delSuccess')) |
|
161 |
// 刷新列表 |
1c14d6
|
162 |
await getList() |
6d9c08
|
163 |
} catch { |
潘 |
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
/** 初始化 **/ |
|
168 |
onMounted(async () => { |
|
169 |
await getList() |
|
170 |
}) |
1c14d6
|
171 |
</script> |