转诊方优化
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
This commit is contained in:
@@ -41,3 +41,18 @@ export async function updateTransferQuestion(data: Record<string, any>) {
|
||||
export async function deleteTransferQuestion(data: Record<string, any>) {
|
||||
return requestClient.post<any>(`${prefix}delete`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转诊助理配置
|
||||
*/
|
||||
export async function getTransferAssistantConfig() {
|
||||
return requestClient.get<any>('transfer-assistant-config/get-config');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新转诊助理配置
|
||||
* @param data
|
||||
*/
|
||||
export async function updateTransferAssistantConfig(data: Record<string, any>) {
|
||||
return requestClient.post<any>('transfer-assistant-config/update-config', data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<script lang="ts" setup>
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { getTransferAssistantConfig, updateTransferAssistantConfig } from '../api';
|
||||
|
||||
// 表单配置
|
||||
const assistantFormProps = {
|
||||
wrapperClass: 'grid-cols-12',
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-12',
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
showDefaultActions: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入助理名字',
|
||||
maxlength: 100,
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '助理名字',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
componentProps: {
|
||||
maxCount: 1,
|
||||
},
|
||||
fieldName: 'avatar',
|
||||
label: '助理头像',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [Form, formApi] = useVbenForm(assistantFormProps);
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
formApi.validate().then(async (e: any) => {
|
||||
if (e.valid) {
|
||||
const values = await formApi.getValues();
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
updateTransferAssistantConfig(values)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
modalApi.close();
|
||||
})
|
||||
.catch((error) => {
|
||||
message.error(error?.message || '保存失败');
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
// 打开时加载当前配置
|
||||
loadConfig();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// 加载配置
|
||||
const loadConfig = async () => {
|
||||
try {
|
||||
const res = await getTransferAssistantConfig();
|
||||
// 接口返回的数据结构:{ data: { code: 0, result: {...}, message: '...' } }
|
||||
// 用户说接口返回的已经是 result 中的数据,所以直接使用 res.data.result
|
||||
const result = res;
|
||||
if (result) {
|
||||
formApi.setValues(result);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载助理配置失败:', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
title="配置助理信息"
|
||||
class="w-[60%]"
|
||||
>
|
||||
<Form />
|
||||
</Modal>
|
||||
</template>
|
||||
@@ -12,6 +12,7 @@ import { TableAction } from '#/components/table-action';
|
||||
|
||||
import { deleteTransferQuestion } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import AssistantConfigModalComponent from './components/AssistantConfigModal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
@@ -40,6 +41,10 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FormModalDemo,
|
||||
});
|
||||
|
||||
const [AssistantConfigModal, assistantConfigModalApi] = useVbenModal({
|
||||
connectedComponent: AssistantConfigModalComponent,
|
||||
});
|
||||
|
||||
const showModal = (data = {}, isUpdate = false) => {
|
||||
formModalApi.setData({
|
||||
// 表单值
|
||||
@@ -67,6 +72,7 @@ const deleteApi = (row: any) => {
|
||||
<template>
|
||||
<Page auto-content-height title="转诊问题配置">
|
||||
<FormModal />
|
||||
<AssistantConfigModal />
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
@@ -77,6 +83,14 @@ const deleteApi = (row: any) => {
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: showModal.bind(null),
|
||||
},
|
||||
{
|
||||
label: '配置助理信息',
|
||||
type: 'default',
|
||||
icon: 'ant-design:user-outlined',
|
||||
onClick: () => {
|
||||
assistantConfigModalApi.open();
|
||||
},
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user