增加llm_api数据库,增加租户入驻 卡片入口

This commit is contained in:
mark
2026-09-27 14:49:46 +08:00
parent 7ad8e4c876
commit e74535f044
13 changed files with 90 additions and 3 deletions
@@ -89,6 +89,51 @@
</div> </div>
</div> </div>
</template> </template>
<!-- 租户入驻 -->
<template v-else-if="view === 'tenant'">
<div class="card">
<div class="card-title">租户入驻信息</div>
<div class="form-group">
<label>租户名称</label>
<input v-model="tenantForm.name" type="text" placeholder="请输入企业/租户名称" />
</div>
<div class="form-group">
<label>联系人</label>
<input v-model="tenantForm.contact" type="text" placeholder="请输入联系人姓名" />
</div>
<div class="form-group">
<label>联系电话</label>
<input v-model="tenantForm.phone" type="text" placeholder="请输入联系电话" />
</div>
<div class="form-group">
<label>联系邮箱</label>
<input v-model="tenantForm.email" type="text" placeholder="请输入邮箱地址" />
</div>
<div class="form-group">
<label>所属行业</label>
<select v-model="tenantForm.industry">
<option value="">请选择行业</option>
<option v-for="ind in industries" :key="ind" :value="ind">{{ ind }}</option>
</select>
</div>
<div class="form-group">
<label>企业规模</label>
<select v-model="tenantForm.scale">
<option value="">请选择规模</option>
<option v-for="s in scales" :key="s" :value="s">{{ s }}</option>
</select>
</div>
<div class="btn-row">
<button class="save-btn" :disabled="tenantSaving" @click="saveTenant">
{{ tenantSaving ? '提交中…' : '提交入驻' }}
</button>
</div>
<div v-if="tenantResult" class="test-result" :class="tenantOk ? 'ok' : 'err'">
{{ tenantResult }}
</div>
</div>
</template>
</div> </div>
</section> </section>
</template> </template>
@@ -104,7 +149,8 @@ defineEmits<{ (e: 'back'): void }>()
const titleMap: Record<string, string> = { const titleMap: Record<string, string> = {
features: '功能开关', features: '功能开关',
api: '大模型 API 设置', api: '大模型 API 设置',
workflow: '日常工作流管理' workflow: '日常工作流管理',
tenant: '租户入驻'
} }
const title = computed(() => titleMap[props.view] ?? '设置') const title = computed(() => titleMap[props.view] ?? '设置')
@@ -271,6 +317,46 @@ function addWorkflow() {
workflows.value.push({ id: Date.now(), name, desc: '新建的工作流', enabled: false }) workflows.value.push({ id: Date.now(), name, desc: '新建的工作流', enabled: false })
} }
} }
/* ====== 租户入驻 ====== */
const industries = ['零售', '餐饮', '教育', '医疗', '制造', '金融', '物流', '互联网', '其他']
const scales = ['1-20 人', '21-100 人', '101-500 人', '500 人以上']
const tenantForm = reactive({
name: '',
contact: '',
phone: '',
email: '',
industry: '',
scale: ''
})
const tenantSaving = ref(false)
const tenantResult = ref('')
const tenantOk = ref(false)
async function saveTenant() {
tenantSaving.value = true
tenantResult.value = ''
tenantOk.value = false
// 简单校验
if (!tenantForm.name || !tenantForm.contact || !tenantForm.phone) {
tenantResult.value = '✗ 请填写租户名称、联系人、联系电话'
tenantSaving.value = false
return
}
try {
// TODO: 后续接入 agent-core 的 tenants 表
// const saved = await window.electronAPI.callAgent('tenant:create', { ...tenantForm })
await new Promise((r) => setTimeout(r, 600)) // 模拟提交
tenantOk.value = true
tenantResult.value = `✓ 租户「${tenantForm.name}」入驻申请已提交,等待审核`
} catch (e: any) {
tenantResult.value = `✗ 提交失败:${e?.message || String(e)}`
}
tenantSaving.value = false
}
</script> </script>
<style scoped> <style scoped>
+2 -1
View File
@@ -11,7 +11,8 @@ export const agentSettings: AgentSetting[] = [
export const settingMenus: SettingMenu[] = [ export const settingMenus: SettingMenu[] = [
{ key: 'features', label: '功能开关', icon: '⚙' }, { key: 'features', label: '功能开关', icon: '⚙' },
{ key: 'api', label: '大模型 API 设置', icon: '🔑' }, { key: 'api', label: '大模型 API 设置', icon: '🔑' },
{ key: 'workflow', label: '日常工作流管理', icon: '🔄' } { key: 'workflow', label: '日常工作流管理', icon: '🔄' },
{ key: 'tenant', label: '租户入驻', icon: '🏢' }
] ]
const mk = (id: number, content: string, time: string): Conversation => ({ const mk = (id: number, content: string, time: string): Conversation => ({
+1 -1
View File
@@ -36,4 +36,4 @@ export interface SettingMenu {
icon: string icon: string
} }
export type ViewType = 'chat' | 'features' | 'api' | 'workflow' export type ViewType = 'chat' | 'features' | 'api' | 'workflow' | 'tenant'