fix: 将 admin 改为普通目录
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div class="ai-config">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-table size="large" v-loading="pager.loading" :data="pager.lists">
|
||||
<el-table-column label="ID" prop="id" min-width="60" />
|
||||
<el-table-column label="配置名称" prop="name" min-width="150" />
|
||||
<el-table-column label="配置值" prop="value" min-width="250" show-overflow-tooltip />
|
||||
<el-table-column label="备注" prop="remark" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="100" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['ai.aiConfig/edit']" type="primary" link
|
||||
@click="handleEdit(row)">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-model="showEdit" title="编辑配置" :width="isPromptConfig ? '800px' : '600px'">
|
||||
<el-form ref="editFormRef" :model="editData" label-width="80px">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="editData.name" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="editData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="值">
|
||||
<el-input v-model="editData.value" type="textarea" :rows="isPromptConfig ? 15 : 4"
|
||||
placeholder="请输入配置值" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showEdit = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="aiConfig">
|
||||
import { aiConfigLists, aiConfigEdit } from '@/api/ai'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
|
||||
const { pager, getLists } = usePaging({ fetchFun: aiConfigLists })
|
||||
|
||||
const showEdit = ref(false)
|
||||
const editData = reactive({ id: 0, name: '', value: '', remark: '' })
|
||||
const isPromptConfig = computed(() => editData.name.includes('prompt'))
|
||||
|
||||
const handleEdit = (row: any) => {
|
||||
Object.assign(editData, { id: row.id, name: row.name, value: row.value, remark: row.remark || '' })
|
||||
showEdit.value = true
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await aiConfigEdit(editData)
|
||||
showEdit.value = false
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
Reference in New Issue
Block a user