mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-09 02:33:42 +08:00
feat: function CRUD operation is ready
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)">
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)" :width="200">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger">删除</el-button>
|
||||
</template>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)">
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)" :width="200">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger">删除</el-button>
|
||||
</template>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-table-column label="操作" width="150" align="right">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="rowEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定要删除当前函数吗?" @confirm="remove(scope.row)">
|
||||
<el-popconfirm title="确定要删除当前函数吗?" @confirm="remove(scope.row)" :width="200">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger">删除</el-button>
|
||||
</template>
|
||||
@@ -119,6 +119,7 @@
|
||||
<el-input
|
||||
v-model="item.action"
|
||||
autocomplete="off"
|
||||
placeholder="该函数实现的API地址,可以是第三方服务API"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
@@ -126,7 +127,20 @@
|
||||
<el-input
|
||||
v-model="item.token"
|
||||
autocomplete="off"
|
||||
/>
|
||||
placeholder="API授权Token"
|
||||
>
|
||||
<template #append>
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
content="只有本地服务才可以使用自动生成Token<br/>第三方服务请填写第三方服务API Token"
|
||||
placement="top-end"
|
||||
raw-content
|
||||
>
|
||||
<el-button @click="generateToken">生成Token</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态">
|
||||
<el-switch v-model="item.enabled"/>
|
||||
@@ -207,6 +221,7 @@ const rowEdit = function (index, row) {
|
||||
|
||||
const addRow = function () {
|
||||
item.value = {enabled:true}
|
||||
params.value = []
|
||||
showDialog.value = true
|
||||
}
|
||||
|
||||
@@ -240,7 +255,7 @@ const save = function () {
|
||||
}
|
||||
|
||||
const remove = function (row) {
|
||||
httpGet('/api/admin/role/remove?id=' + row.id).then(() => {
|
||||
httpGet('/api/admin/function/remove?id=' + row.id).then(() => {
|
||||
ElMessage.success("删除成功!")
|
||||
fetch()
|
||||
}).catch(() => {
|
||||
@@ -267,6 +282,14 @@ const functionSet = (filed,row) => {
|
||||
})
|
||||
}
|
||||
|
||||
const generateToken = () => {
|
||||
httpGet('/api/admin/function/token').then(res => {
|
||||
item.value.token = res.data
|
||||
}).catch(() => {
|
||||
ElMessage.error("生成 Token 失败")
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)">
|
||||
<el-popconfirm title="确定要删除当前记录吗?" @confirm="remove(scope.row)" :width="200">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger">删除</el-button>
|
||||
</template>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<el-table-column label="操作" width="150" align="right">
|
||||
<template #default="scope">
|
||||
<el-button size="small" type="primary" @click="rowEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-popconfirm title="确定要删除当前角色吗?" @confirm="removeRole(scope.row)">
|
||||
<el-popconfirm title="确定要删除当前角色吗?" @confirm="removeRole(scope.row)" :width="200">
|
||||
<template #reference>
|
||||
<el-button size="small" type="danger">删除</el-button>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user