逻辑完善

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

View File

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