优化ai角色
This commit is contained in:
@@ -59,18 +59,20 @@ const formData = ref({
|
|||||||
updatedAt: undefined
|
updatedAt: undefined
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
|
companionId: [{ required: true, message: '主表ID不能为空', trigger: 'blur' }],
|
||||||
locale: [{ required: true, message: '语言标识不能为空', trigger: 'blur' }],
|
locale: [{ required: true, message: '语言标识不能为空', trigger: 'blur' }],
|
||||||
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
|
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number, companionId?: number) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
resetForm()
|
resetForm()
|
||||||
formData.value.id = id as any
|
formData.value.id = id as any
|
||||||
|
formData.value.companionId = companionId as any
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
|
|||||||
@@ -1,39 +1,79 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['keyboard:ai-companion:create']">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm('create')"
|
||||||
|
v-hasPermi="['keyboard:ai-companion:create']"
|
||||||
|
>
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="danger" plain :disabled="isEmpty(checkedIds)" @click="handleDeleteBatch"
|
<el-button
|
||||||
v-hasPermi="['keyboard:ai-companion:delete']">
|
type="danger"
|
||||||
|
plain
|
||||||
|
:disabled="isEmpty(checkedIds)"
|
||||||
|
@click="handleDeleteBatch"
|
||||||
|
v-hasPermi="['keyboard:ai-companion:delete']"
|
||||||
|
>
|
||||||
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
<Icon icon="ep:delete" class="mr-5px" /> 批量删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-table row-key="id" v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"
|
<el-table
|
||||||
@selection-change="handleRowCheckboxChange">
|
row-key="id"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="list"
|
||||||
|
:stripe="true"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
@selection-change="handleRowCheckboxChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="主表ID" align="center" prop="companionId" width="120px" />
|
<el-table-column label="主表ID" align="center" prop="companionId" width="120px" />
|
||||||
<el-table-column label="语言标识" align="center" prop="locale" width="120px" />
|
<el-table-column label="语言标识" align="center" prop="locale" width="120px" />
|
||||||
<el-table-column label="角色名称" align="center" prop="name" width="180px" />
|
<el-table-column label="角色名称" align="center" prop="name" width="180px" />
|
||||||
<el-table-column label="一句话描述" align="center" prop="shortDesc" width="200px" />
|
<el-table-column label="一句话描述" align="center" prop="shortDesc" width="200px" />
|
||||||
<el-table-column label="详细介绍" align="center" prop="introText" min-width="300px" />
|
<el-table-column label="详细介绍" align="center" prop="introText" min-width="300px" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createdAt" :formatter="dateFormatter" width="180px" />
|
<el-table-column
|
||||||
<el-table-column label="更新时间" align="center" prop="updatedAt" :formatter="dateFormatter" width="180px" />
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createdAt"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="更新时间"
|
||||||
|
align="center"
|
||||||
|
prop="updatedAt"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click="openForm('update', scope.row.id)"
|
<el-button
|
||||||
v-hasPermi="['keyboard:ai-companion:update']">
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['keyboard:ai-companion:update']"
|
||||||
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button link type="danger" @click="handleDelete(scope.row.id)"
|
<el-button
|
||||||
v-hasPermi="['keyboard:ai-companion:delete']">
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['keyboard:ai-companion:delete']"
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
<Pagination
|
||||||
@pagination="getList" />
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<AiCompanionI18nForm ref="formRef" @success="getList" />
|
<AiCompanionI18nForm ref="formRef" @success="getList" />
|
||||||
@@ -130,21 +170,3 @@ const handleRowCheckboxChange = (records: AiCompanionI18n[]) => {
|
|||||||
checkedIds.value = records.map((item) => item.id!);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
/* 按钮间距 */
|
|
||||||
.el-button {
|
|
||||||
margin-right: 8px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表格样式优化 */
|
|
||||||
.el-table {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 操作按钮间距 */
|
|
||||||
.el-table-column__content .el-button {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,9 @@
|
|||||||
<el-form-item label="产品描述" prop="description">
|
<el-form-item label="产品描述" prop="description">
|
||||||
<el-input v-model="formData.description" placeholder="请输入产品描述" />
|
<el-input v-model="formData.description" placeholder="请输入产品描述" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="平台" prop="platform">
|
||||||
|
<el-input v-model="formData.platform" placeholder="请输入平台" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" prop="createdAt">
|
<el-form-item label="创建时间" prop="createdAt">
|
||||||
<el-date-picker v-model="formData.createdAt" type="date" value-format="x" placeholder="选择创建时间" />
|
<el-date-picker v-model="formData.createdAt" type="date" value-format="x" placeholder="选择创建时间" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -74,6 +77,7 @@ const formData = ref({
|
|||||||
price: undefined,
|
price: undefined,
|
||||||
currency: undefined,
|
currency: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
|
platform: undefined,
|
||||||
createdAt: undefined,
|
createdAt: undefined,
|
||||||
updatedAt: undefined,
|
updatedAt: undefined,
|
||||||
durationDays: undefined
|
durationDays: undefined
|
||||||
@@ -147,6 +151,7 @@ const resetForm = () => {
|
|||||||
price: undefined,
|
price: undefined,
|
||||||
currency: undefined,
|
currency: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
|
platform: undefined,
|
||||||
createdAt: undefined,
|
createdAt: undefined,
|
||||||
updatedAt: undefined,
|
updatedAt: undefined,
|
||||||
durationDays: undefined
|
durationDays: undefined
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
<el-table-column label="时长单位" align="center" prop="durationUnit" width="100px" />
|
<el-table-column label="时长单位" align="center" prop="durationUnit" width="100px" />
|
||||||
<el-table-column label="价格" align="center" prop="price" width="110px" />
|
<el-table-column label="价格" align="center" prop="price" width="110px" />
|
||||||
<el-table-column label="货币" align="center" prop="currency" width="90px" />
|
<el-table-column label="货币" align="center" prop="currency" width="90px" />
|
||||||
|
<el-table-column label="平台" align="center" prop="platform" width="90px" />
|
||||||
<el-table-column label="描述" align="center" prop="description" min-width="180px" />
|
<el-table-column label="描述" align="center" prop="description" min-width="180px" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createdAt" :formatter="dateFormatter" width="180px" />
|
<el-table-column label="创建时间" align="center" prop="createdAt" :formatter="dateFormatter" width="180px" />
|
||||||
<el-table-column label="更新时间" align="center" prop="updatedAt" :formatter="dateFormatter" width="180px" />
|
<el-table-column label="更新时间" align="center" prop="updatedAt" :formatter="dateFormatter" width="180px" />
|
||||||
|
|||||||
Reference in New Issue
Block a user