逻辑完善

This commit is contained in:
李寻欢 2024-02-04 14:03:09 +08:00
parent 64d85c22c2
commit 3c0a280456
2 changed files with 25 additions and 7 deletions

View File

@ -58,13 +58,16 @@ const getAllAiAssistantHandle = async () => {
};
//
const saveAssistantHandle = async (item: AiAssistantResult) => {
const saveAssistantHandle = async (item: any, isCreate?: boolean) => {
//
item.saveLoading = true;
//
saveAiAssistant(item)
.then(() => {
message("保存成功", { type: "success" });
if (isCreate) {
showCreateDialog.value = false;
}
//
getAllAiAssistantHandle();
})
@ -135,13 +138,17 @@ onMounted(() => {
>
{{ item.edit ? "取消" : "编辑" }}
</el-button>
<el-button
<el-popconfirm
v-if="!item.edit"
link
type="danger"
@click="deleteAssistantHandle(item.id)"
>删除</el-button
title="是否删除当前 AI 助手?"
confirm-button-text="是"
cancel-button-text="否"
@confirm="deleteAssistantHandle(item.id)"
>
<template #reference>
<el-button link type="danger">删除</el-button>
</template>
</el-popconfirm>
<el-button
v-else
link
@ -241,6 +248,17 @@ onMounted(() => {
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button
type="primary"
@click="saveAssistantHandle(createAssistantParam, true)"
>
保存
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>

View File

@ -56,7 +56,7 @@ const onLogin = async (formEl: FormInstance | undefined) => {
if (valid) {
useUserStoreHook()
.loginByUsername(ruleForm)
.then(res => {
.then(() => {
//
initRouter().then(() => {
router.push(getTopMenu(true).path);