feat: 连续对话
This commit is contained in:
parent
95c53fab93
commit
d1f23f0c87
@ -1,9 +1,10 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
import { method } from 'lodash'
|
||||||
|
|
||||||
// 查询语料库列表
|
// 查询语料库列表
|
||||||
export function listCorpus(query) {
|
export function listCorpus(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/vi/corpus/list',
|
url: '/vi/corpus/single/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@ -42,3 +43,35 @@ export function delCorpus(corpusId) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function batchAddCorpus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/vi/corpus/continuous/insert',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function batchUpdateCorpus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/vi/corpus/continuous/update',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBatchCorpus(query) {
|
||||||
|
return request({
|
||||||
|
url: '/vi/corpus/continuous/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteBatchCorpus(corpusIds) {
|
||||||
|
return request({
|
||||||
|
url: `/vi/corpus/continuous`,
|
||||||
|
method: 'delete',
|
||||||
|
data: corpusIds
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -29,9 +29,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<!-- <router-link to="/user/profile">-->
|
<router-link to="/zhtest/profilettt">
|
||||||
<!-- <el-dropdown-item>个人中心</el-dropdown-item>-->
|
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||||
<!-- </router-link>-->
|
</router-link>
|
||||||
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
|
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
|
||||||
<span>布局设置</span>
|
<span>布局设置</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {createWebHistory, createRouter} from 'vue-router'
|
import { createWebHistory, createRouter } from "vue-router";
|
||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '@/layout'
|
import Layout from "@/layout";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: 路由配置项
|
* Note: 路由配置项
|
||||||
@ -27,227 +27,222 @@ import Layout from '@/layout'
|
|||||||
// 公共路由
|
// 公共路由
|
||||||
export const constantRoutes = [
|
export const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/redirect',
|
path: "/redirect",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/redirect/:path(.*)',
|
path: "/redirect/:path(.*)",
|
||||||
component: () => import('@/views/redirect/index.vue')
|
component: () => import("@/views/redirect/index.vue"),
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: "/login",
|
||||||
component: () => import('@/views/login'),
|
component: () => import("@/views/login"),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/register',
|
path: "/register",
|
||||||
component: () => import('@/views/register'),
|
component: () => import("@/views/register"),
|
||||||
hidden: true
|
hidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/zhtest",
|
||||||
|
component: import("@/views/system/user/profile/index"),
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// path: "profilettt",
|
||||||
|
// component: () => import("@/views/system/user/profile/index"),
|
||||||
|
// name: "Profile",
|
||||||
|
// meta: { title: "个人中心", icon: "user", hidden: true },
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/:pathMatch(.*)*",
|
path: "/:pathMatch(.*)*",
|
||||||
component: () => import('@/views/error/404'),
|
component: () => import("@/views/error/404"),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/401',
|
path: "/401",
|
||||||
component: () => import('@/views/error/401'),
|
component: () => import("@/views/error/401"),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//机械臂路由
|
//机械臂路由
|
||||||
path: '/mechanical_arm/:id',
|
path: "/mechanical_arm/:id",
|
||||||
component: () => import('@/views/device/register/components/MechanicalArm/index.vue'),
|
component: () =>
|
||||||
hidden: true
|
import("@/views/device/register/components/MechanicalArm/index.vue"),
|
||||||
|
hidden: true,
|
||||||
},
|
},
|
||||||
// router/index.js
|
// router/index.js
|
||||||
{
|
{
|
||||||
path: '/device',
|
path: "/device",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'camera/:id',
|
path: "camera/:id",
|
||||||
component: () => import('@/views/device/register/components/Camera/index.vue'),
|
component: () =>
|
||||||
name: '摄像头示教',
|
import("@/views/device/register/components/Camera/index.vue"),
|
||||||
meta: { title: '摄像头详情' },
|
name: "摄像头示教",
|
||||||
hidden: true
|
meta: { title: "摄像头详情" },
|
||||||
}
|
hidden: true,
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/device',
|
path: "hand/:id",
|
||||||
component: Layout,
|
component: () =>
|
||||||
children: [
|
import("@/views/device/register/components/DexHand/index.vue"),
|
||||||
{
|
name: "灵巧手示教",
|
||||||
path: 'hand/:id',
|
meta: { title: "灵巧手详情" },
|
||||||
component: () => import('@/views/device/register/components/DexHand/index.vue'),
|
hidden: true,
|
||||||
name: '灵巧手示教',
|
|
||||||
meta: { title: '灵巧手详情' },
|
|
||||||
hidden: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/device',
|
path: "speaker/:id",
|
||||||
component: Layout,
|
component: () =>
|
||||||
children: [
|
import("@/views/device/register/components/Speaker/index.vue"),
|
||||||
{
|
name: "扬声器示教",
|
||||||
path: 'speaker/:id',
|
meta: { title: "扬声器详情" },
|
||||||
component: () => import('@/views/device/register/components/Speaker/index.vue'),
|
hidden: true,
|
||||||
name: '扬声器示教',
|
},
|
||||||
meta: { title: '扬声器详情' },
|
],
|
||||||
hidden: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//语音合成
|
//语音合成
|
||||||
path: '/speech_synthesis',
|
path: "/speech_synthesis",
|
||||||
component: () => import('@/views/device/register/components/SpeechSynthesis/index.vue'),
|
component: () =>
|
||||||
meta: {title: '语音合成', noLogin: true},
|
import("@/views/device/register/components/SpeechSynthesis/index.vue"),
|
||||||
hidden: true
|
meta: { title: "语音合成", noLogin: true },
|
||||||
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//触摸交互
|
//触摸交互
|
||||||
path: '/touch_interaction',
|
path: "/touch_interaction",
|
||||||
component: () => import('@/views/device/register/components/TouchInteraction/index.vue'),
|
component: () =>
|
||||||
meta: {title: '触摸交互', noLogin: true},
|
import("@/views/device/register/components/TouchInteraction/index.vue"),
|
||||||
hidden: true
|
meta: { title: "触摸交互", noLogin: true },
|
||||||
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//logicFlow
|
//logicFlow
|
||||||
path: '/logic_flow',
|
path: "/logic_flow",
|
||||||
component: () => import('@/views/device/register/components/LogicFlow/index.vue'),
|
component: () =>
|
||||||
meta: {title: 'logicFlow', noLogin: true},
|
import("@/views/device/register/components/LogicFlow/index.vue"),
|
||||||
hidden: true
|
meta: { title: "logicFlow", noLogin: true },
|
||||||
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//logicFlow
|
//logicFlow
|
||||||
path: '/flow',
|
path: "/flow",
|
||||||
component: () => import('@/views/flow/index.vue'),
|
component: () => import("@/views/flow/index.vue"),
|
||||||
meta: {title: 'flow', noLogin: true},
|
meta: { title: "flow", noLogin: true },
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//电机路由
|
//电机路由
|
||||||
path: '/Motor/:id',
|
path: "/Motor/:id",
|
||||||
component: () => import('@/views/device/register/components/Motor/index.vue'),
|
component: () =>
|
||||||
hidden: true
|
import("@/views/device/register/components/Motor/index.vue"),
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: Layout,
|
|
||||||
redirect: '/index',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/index',
|
|
||||||
component: () => import('@/views/index'),
|
|
||||||
name: 'Index',
|
|
||||||
meta: {title: '首页', icon: 'dashboard', affix: true}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/user',
|
|
||||||
component: Layout,
|
|
||||||
hidden: true,
|
hidden: true,
|
||||||
redirect: 'noredirect',
|
},
|
||||||
|
{
|
||||||
|
path: "",
|
||||||
|
component: Layout,
|
||||||
|
redirect: "/index",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'profile',
|
path: "/index",
|
||||||
component: () => import('@/views/system/user/profile/index'),
|
component: () => import("@/views/index"),
|
||||||
name: 'Profile',
|
name: "Index",
|
||||||
meta: {title: '个人中心', icon: 'user'}
|
meta: { title: "首页", icon: "dashboard", affix: true },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
|
||||||
|
];
|
||||||
|
|
||||||
// 动态路由,基于用户权限动态去加载
|
// 动态路由,基于用户权限动态去加载
|
||||||
export const dynamicRoutes = [
|
export const dynamicRoutes = [
|
||||||
{
|
{
|
||||||
path: '/system/user-auth',
|
path: "/system/user-auth",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:user:edit'],
|
permissions: ["system:user:edit"],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'role/:userId(\\d+)',
|
path: "role/:userId(\\d+)",
|
||||||
component: () => import('@/views/system/user/authRole'),
|
component: () => import("@/views/system/user/authRole"),
|
||||||
name: 'AuthRole',
|
name: "AuthRole",
|
||||||
meta: {title: '分配角色', activeMenu: '/system/user'}
|
meta: { title: "分配角色", activeMenu: "/system/user" },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/role-auth',
|
path: "/system/role-auth",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:role:edit'],
|
permissions: ["system:role:edit"],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'user/:roleId(\\d+)',
|
path: "user/:roleId(\\d+)",
|
||||||
component: () => import('@/views/system/role/authUser'),
|
component: () => import("@/views/system/role/authUser"),
|
||||||
name: 'AuthUser',
|
name: "AuthUser",
|
||||||
meta: {title: '分配用户', activeMenu: '/system/role'}
|
meta: { title: "分配用户", activeMenu: "/system/role" },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/dict-data',
|
path: "/system/dict-data",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:dict:list'],
|
permissions: ["system:dict:list"],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:dictId(\\d+)',
|
path: "index/:dictId(\\d+)",
|
||||||
component: () => import('@/views/system/dict/data'),
|
component: () => import("@/views/system/dict/data"),
|
||||||
name: 'Data',
|
name: "Data",
|
||||||
meta: {title: '字典数据', activeMenu: '/system/dict'}
|
meta: { title: "字典数据", activeMenu: "/system/dict" },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/monitor/job-log',
|
path: "/monitor/job-log",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['monitor:job:list'],
|
permissions: ["monitor:job:list"],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:jobId(\\d+)',
|
path: "index/:jobId(\\d+)",
|
||||||
component: () => import('@/views/monitor/job/log'),
|
component: () => import("@/views/monitor/job/log"),
|
||||||
name: 'JobLog',
|
name: "JobLog",
|
||||||
meta: {title: '调度日志', activeMenu: '/monitor/job'}
|
meta: { title: "调度日志", activeMenu: "/monitor/job" },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/tool/gen-edit',
|
path: "/tool/gen-edit",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['tool:gen:edit'],
|
permissions: ["tool:gen:edit"],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:tableId(\\d+)',
|
path: "index/:tableId(\\d+)",
|
||||||
component: () => import('@/views/tool/gen/editTable'),
|
component: () => import("@/views/tool/gen/editTable"),
|
||||||
name: 'GenEdit',
|
name: "GenEdit",
|
||||||
meta: {title: '修改生成配置', activeMenu: '/tool/gen'}
|
meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
];
|
||||||
|
console.log("constantRoutes", constantRoutes);
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes: constantRoutes,
|
routes: constantRoutes,
|
||||||
scrollBehavior(to, from, savedPosition) {
|
scrollBehavior(to, from, savedPosition) {
|
||||||
if (savedPosition) {
|
if (savedPosition) {
|
||||||
return savedPosition
|
return savedPosition;
|
||||||
}
|
}
|
||||||
return {top: 0}
|
return { top: 0 };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,7 @@ watch(
|
|||||||
() => {
|
() => {
|
||||||
if (props.properties.nodeParams && props.properties.nodeParams.length > 0) {
|
if (props.properties.nodeParams && props.properties.nodeParams.length > 0) {
|
||||||
formData.nodeParams = props.properties.nodeParams
|
formData.nodeParams = props.properties.nodeParams
|
||||||
const option = getInputNumber(props.model.id)
|
const option = getInput(props.model.id)
|
||||||
if (option) {
|
if (option) {
|
||||||
quoteOptions.value = option
|
quoteOptions.value = option
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="语种" prop="dialect">
|
<el-form-item label="语种" prop="dialect">
|
||||||
<el-select v-model="queryParams.voiceType" placeholder="请选择语种" clearable style="width: 200px">
|
<el-select v-model="queryParams.dialect" placeholder="请选择语种" clearable style="width: 200px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in vi_dialect_type"
|
v-for="dict in vi_dialect_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@ -85,21 +85,23 @@
|
|||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="corpusList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="corpusList" table-layout="auto" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="语料名称" align="center" prop="corpusName" />
|
<el-table-column label="语料名称" align="center" prop="corpusName" />
|
||||||
<el-table-column label="语料类型" align="center" prop="type" />
|
<el-table-column label="语音文本" align="center" prop="textContent" min-width="200" show-overflow-tooltip />
|
||||||
<el-table-column label="语音文本" align="center" prop="textContent" />
|
<el-table-column label="语音文件路径" align="center" prop="audioPath" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column label="语音文件路径" align="center" prop="audioPath" />
|
|
||||||
<el-table-column label="音色" align="center" prop="voiceType" />
|
<el-table-column label="音色" align="center" prop="voiceType" />
|
||||||
<el-table-column label="语种" align="center" prop="dialect" />
|
<el-table-column label="语种" align="center" prop="dialect" />
|
||||||
<el-table-column label="预期结果" align="center" prop="expectedResult" />
|
<el-table-column label="预期结果" align="center" prop="expectedResult" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column label="顺序" align="center" prop="sortOrder" />
|
<el-table-column label="顺序" align="center" prop="sortOrder" />
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['vi:corpus:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['vi:corpus:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['vi:corpus:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['vi:corpus:remove']">删除</el-button>
|
||||||
|
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)" v-hasPermi="['vi:corpus:upload']">上传</el-button>
|
||||||
|
<el-button link type="primary" icon="VideoPlay" @click="handlePlay(scope.row)" v-hasPermi="['vi:corpus:play']">试听</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -118,7 +120,7 @@
|
|||||||
<el-form-item label="语料名称" prop="corpusName">
|
<el-form-item label="语料名称" prop="corpusName">
|
||||||
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="语音文本">
|
<el-form-item label="语音文本" prop="textContent">
|
||||||
<el-input v-model="form.textContent" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.textContent" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="文件路径" prop="audioPath">
|
<el-form-item label="文件路径" prop="audioPath">
|
||||||
@ -135,7 +137,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="语种" prop="dialect">
|
<el-form-item label="语种" prop="dialect">
|
||||||
<el-select v-model="form.voiceType" placeholder="请选择语种" clearable style="width: 100%">
|
<el-select v-model="form.dialect" placeholder="请选择语种" clearable style="width: 100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in vi_dialect_type"
|
v-for="dict in vi_dialect_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@ -145,10 +147,13 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预期结果" prop="expectedResult">
|
<el-form-item label="预期结果" prop="expectedResult">
|
||||||
<el-input v-model="form.audioPath" type="textarea" placeholder="请输入预期结果" />
|
<el-input v-model="form.expectedResult" type="textarea" placeholder="请输入预期结果" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="顺序" prop="sortOrder">
|
<el-form-item label="顺序" prop="sortOrder">
|
||||||
<el-input v-model="form.sortOrder" placeholder="请输入同一父语料下的顺序" />
|
<el-inputNumber v-model="form.sortOrder" placeholder="请输入顺序" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -177,26 +182,32 @@ const total = ref(0)
|
|||||||
const title = ref("")
|
const title = ref("")
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {
|
||||||
|
type: 'WAKEUP'
|
||||||
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
corpusName: null,
|
corpusName: null,
|
||||||
type: 'WAKE',
|
type: 'WAKEUP',
|
||||||
|
continuous: 1,
|
||||||
textContent: null,
|
textContent: null,
|
||||||
audioPath: null,
|
|
||||||
voiceType: null,
|
voiceType: null,
|
||||||
dialect: null,
|
dialect: null,
|
||||||
expectedResult: null,
|
expectedResult: null,
|
||||||
sortOrder: null,
|
|
||||||
status: null,
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
type: [
|
corpusName: [
|
||||||
{ required: true, message: "语料类型不能为空", trigger: "change" }
|
{ required: true, message: "请输入语料名称", trigger: "change" }
|
||||||
],
|
],
|
||||||
textContent: [
|
textContent: [
|
||||||
{ required: true, message: "语音对应的文本不能为空", trigger: "blur" }
|
{ required: true, message: "请输入语音文本", trigger: "blur" }
|
||||||
|
],
|
||||||
|
voiceType: [
|
||||||
|
{ required: true, message: "请选择音色", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dialect: [
|
||||||
|
{ required: true, message: "请选择语种", trigger: "blur" }
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -226,7 +237,7 @@ function reset() {
|
|||||||
form.value = {
|
form.value = {
|
||||||
corpusId: null,
|
corpusId: null,
|
||||||
corpusName: null,
|
corpusName: null,
|
||||||
type: null,
|
type: 'WAKEUP',
|
||||||
textContent: null,
|
textContent: null,
|
||||||
audioPath: null,
|
audioPath: null,
|
||||||
voiceType: null,
|
voiceType: null,
|
||||||
@ -283,6 +294,7 @@ function handleUpdate(row) {
|
|||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["corpusRef"].validate(valid => {
|
proxy.$refs["corpusRef"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
console.log('f', form.value)
|
||||||
if (form.value.corpusId != null) {
|
if (form.value.corpusId != null) {
|
||||||
updateCorpus(form.value).then(response => {
|
updateCorpus(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
@ -311,6 +323,14 @@ function handleDelete(row) {
|
|||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUpload = (row) => {
|
||||||
|
console.log('上传')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
console.log('播放')
|
||||||
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('vi/corpus/export', {
|
proxy.download('vi/corpus/export', {
|
||||||
|
|||||||
485
src/views/vi/corpus/test/MultipleConversations/index.vue
Normal file
485
src/views/vi/corpus/test/MultipleConversations/index.vue
Normal file
@ -0,0 +1,485 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="语料名称" prop="corpusName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.corpusName"
|
||||||
|
placeholder="请输入语料名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="音色" prop="voiceType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.voiceType"
|
||||||
|
placeholder="请选择音色"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_voice_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="语种" prop="dialect">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.dialect"
|
||||||
|
placeholder="请选择语种"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_dialect_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预期结果" prop="expectedResult">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.expectedResult"
|
||||||
|
placeholder="请输入预期结果"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['vi:corpus:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['vi:corpus:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['vi:corpus:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['vi:corpus:export']"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="corpusList"
|
||||||
|
table-layout="auto"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="语料名称" align="center" prop="corpusName" />
|
||||||
|
<el-table-column label="音色" align="center" prop="voiceType" />
|
||||||
|
<el-table-column label="语种" align="center" prop="dialect" />
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
width="280"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(row)"
|
||||||
|
v-hasPermi="['vi:corpus:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(row)"
|
||||||
|
v-hasPermi="['vi:corpus:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="VideoPlay"
|
||||||
|
@click="handlePlay(row)"
|
||||||
|
v-hasPermi="['vi:corpus:play']"
|
||||||
|
>试听</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改语料库对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="740px" append-to-body>
|
||||||
|
<el-form
|
||||||
|
ref="corpusRef"
|
||||||
|
:inline="true"
|
||||||
|
:model="formData"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="语料名称" prop="corpusName">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.corpusName"
|
||||||
|
placeholder="请输入语料名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="音色" prop="voiceType">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.voiceType"
|
||||||
|
placeholder="请选择音色"
|
||||||
|
clearable
|
||||||
|
style="width: 192px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_voice_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="语种" prop="dialect">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.dialect"
|
||||||
|
placeholder="请选择语种"
|
||||||
|
clearable
|
||||||
|
style="width: 192px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_dialect_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-table :data="formData.tableData">
|
||||||
|
<el-table-column prop="textContent" label="语料文本">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-form-item
|
||||||
|
:prop="`tableData[${$index}].textContent`"
|
||||||
|
:rules="rules.textContent"
|
||||||
|
class="tableFormItem"
|
||||||
|
>
|
||||||
|
<el-input v-model="row.textContent" />
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="audioPath" label="音频文件">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-form-item
|
||||||
|
:prop="`tableData[${$index}].audioPath`"
|
||||||
|
class="tableFormItem"
|
||||||
|
>
|
||||||
|
<el-input v-model="row.audioPath" />
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="expectedResult" label="预期结果">
|
||||||
|
<template #default="{ row, $index }">
|
||||||
|
<el-form-item
|
||||||
|
:prop="`tableData[${$index}].expectedResult`"
|
||||||
|
:rules="rules.expectedResult"
|
||||||
|
class="tableFormItem"
|
||||||
|
>
|
||||||
|
<el-input v-model="row.expectedResult" />
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template #default="{ _row, $index }">
|
||||||
|
<el-button
|
||||||
|
:icon="Plus"
|
||||||
|
circle
|
||||||
|
size="small"
|
||||||
|
@click="addRow"
|
||||||
|
></el-button>
|
||||||
|
<el-button
|
||||||
|
:icon="Minus"
|
||||||
|
v-if="$index !== 0"
|
||||||
|
circle
|
||||||
|
size="small"
|
||||||
|
@click="deleteRow($index)"
|
||||||
|
></el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { Plus, Minus } from "@element-plus/icons-vue";
|
||||||
|
import {
|
||||||
|
getBatchCorpus,
|
||||||
|
deleteBatchCorpus,
|
||||||
|
batchAddCorpus,
|
||||||
|
batchUpdateCorpus,
|
||||||
|
} from "@/api/vi/corpus";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const { vi_voice_type, vi_dialect_type } = proxy.useDict(
|
||||||
|
"vi_voice_type",
|
||||||
|
"vi_dialect_type"
|
||||||
|
);
|
||||||
|
const corpusList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const title = ref("");
|
||||||
|
const isAdd = ref(true);
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
formData: {
|
||||||
|
tableData: [{}],
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
corpusName: null,
|
||||||
|
type: "TEST",
|
||||||
|
continuous: 0,
|
||||||
|
textContent: null,
|
||||||
|
expectedResult: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
corpusName: [
|
||||||
|
{ required: true, message: "请输入语料名称", trigger: "change" },
|
||||||
|
],
|
||||||
|
voiceType: [{ required: true, message: "请选择音色", trigger: "blur" }],
|
||||||
|
dialect: [{ required: true, message: "请选择语种", trigger: "blur" }],
|
||||||
|
textContent: [
|
||||||
|
{ required: true, message: "请输入语音文本", trigger: "change" },
|
||||||
|
],
|
||||||
|
expectedResult: [
|
||||||
|
{ required: true, message: "请输入预期结果", trigger: "change" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, formData, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询语料库列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
getBatchCorpus(queryParams.value)
|
||||||
|
.then((response) => {
|
||||||
|
corpusList.value = response.rows;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
formData.value = {
|
||||||
|
tableData: [{}],
|
||||||
|
};
|
||||||
|
proxy.resetForm("corpusRef");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection
|
||||||
|
.map((item) => item.parentId)
|
||||||
|
.filter((item) => item !== undefined);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
isAdd.value = true;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加连续对话语料";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
// 深拷贝row数据,切断引用!!!
|
||||||
|
const deepCloneRow = JSON.parse(JSON.stringify(row));
|
||||||
|
isAdd.value = false;
|
||||||
|
const { children, ...other } = deepCloneRow;
|
||||||
|
formData.value = {
|
||||||
|
...other,
|
||||||
|
tableData: children || [{}],
|
||||||
|
};
|
||||||
|
open.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["corpusRef"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const arr = formData.value.tableData.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
type: formData.value.type || "TEST",
|
||||||
|
parentId: formData.value?.parentId || null,
|
||||||
|
corpusId: item?.corpusId || null,
|
||||||
|
voiceType: formData.value.voiceType,
|
||||||
|
dialect: formData.value.dialect,
|
||||||
|
corpusName: formData.value.corpusName,
|
||||||
|
continuous: 0,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const obj = {
|
||||||
|
corpusName: formData.value.corpusName,
|
||||||
|
dialect: formData.value.dialect,
|
||||||
|
parentId: formData.value?.parentId || null,
|
||||||
|
voiceType: formData.value.voiceType,
|
||||||
|
children: arr,
|
||||||
|
};
|
||||||
|
if (isAdd.value) {
|
||||||
|
batchAddCorpus(obj).then((res) => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
batchUpdateCorpus(obj).then((res) => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _corpusIds = [row.parentId, ...ids.value];
|
||||||
|
proxy.$modal
|
||||||
|
.confirm("是否确认删除语料数据项?")
|
||||||
|
.then(function () {
|
||||||
|
return deleteBatchCorpus(_corpusIds);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
console.log("播放");
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download(
|
||||||
|
"vi/corpus/export",
|
||||||
|
{
|
||||||
|
...queryParams.value,
|
||||||
|
},
|
||||||
|
`corpus_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const addRow = () => {
|
||||||
|
formData.value.tableData.push({});
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteRow = (index) => {
|
||||||
|
formData.value.tableData.splice(index, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tableFormItem {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
345
src/views/vi/corpus/test/SingleConversation/index.vue
Normal file
345
src/views/vi/corpus/test/SingleConversation/index.vue
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="语料名称" prop="corpusName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.corpusName"
|
||||||
|
placeholder="请输入语料名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="音色" prop="voiceType">
|
||||||
|
<el-select v-model="queryParams.voiceType" placeholder="请选择音色" clearable style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_voice_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="语种" prop="dialect">
|
||||||
|
<el-select v-model="queryParams.dialect" placeholder="请选择语种" clearable style="width: 200px">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_dialect_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预期结果" prop="expectedResult">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.expectedResult"
|
||||||
|
placeholder="请输入预期结果"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['vi:corpus:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['vi:corpus:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['vi:corpus:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['vi:corpus:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="corpusList" table-layout="auto" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="语料名称" align="center" prop="corpusName" />
|
||||||
|
<el-table-column label="语音文本" align="center" prop="textContent" min-width="200" show-overflow-tooltip />
|
||||||
|
<el-table-column label="语音文件路径" align="center" prop="audioPath" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="音色" align="center" prop="voiceType" />
|
||||||
|
<el-table-column label="语种" align="center" prop="dialect" />
|
||||||
|
<el-table-column label="预期结果" align="center" prop="expectedResult" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['vi:corpus:edit']">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['vi:corpus:remove']">删除</el-button>
|
||||||
|
<el-button link type="primary" icon="VideoPlay" @click="handlePlay(scope.row)" v-hasPermi="['vi:corpus:play']">试听</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改语料库对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="580px" append-to-body>
|
||||||
|
<el-form ref="corpusRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="语料名称" prop="corpusName">
|
||||||
|
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="语音文本" prop="textContent">
|
||||||
|
<el-input v-model="form.textContent" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文件路径" prop="audioPath">
|
||||||
|
<el-input v-model="form.audioPath" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="音色" prop="voiceType">
|
||||||
|
<el-select v-model="form.voiceType" placeholder="请选择音色" clearable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_voice_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="语种" prop="dialect">
|
||||||
|
<el-select v-model="form.dialect" placeholder="请选择语种" clearable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in vi_dialect_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预期结果" prop="expectedResult">
|
||||||
|
<el-input v-model="form.expectedResult" type="textarea" placeholder="请输入预期结果" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="顺序" prop="sortOrder">
|
||||||
|
<el-inputNumber v-model="form.sortOrder" placeholder="请输入顺序" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Corpus">
|
||||||
|
import { listCorpus, getCorpus, delCorpus, addCorpus, updateCorpus } from "@/api/vi/corpus"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { vi_voice_type, vi_dialect_type } = proxy.useDict("vi_voice_type", "vi_dialect_type")
|
||||||
|
const corpusList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {
|
||||||
|
type: 'TEST'
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
corpusName: null,
|
||||||
|
type: 'TEST',
|
||||||
|
continuous: 1,
|
||||||
|
textContent: null,
|
||||||
|
audioPath: null,
|
||||||
|
voiceType: null,
|
||||||
|
dialect: null,
|
||||||
|
expectedResult: null,
|
||||||
|
sortOrder: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
corpusName: [
|
||||||
|
{ required: true, message: "请输入语料名称", trigger: "change" }
|
||||||
|
],
|
||||||
|
textContent: [
|
||||||
|
{ required: true, message: "请输入语音文本", trigger: "blur" }
|
||||||
|
],
|
||||||
|
voiceType: [
|
||||||
|
{ required: true, message: "请选择音色", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dialect: [
|
||||||
|
{ required: true, message: "请选择语种", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询语料库列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listCorpus(queryParams.value).then(response => {
|
||||||
|
corpusList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
}).catch(err => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
corpusId: null,
|
||||||
|
corpusName: null,
|
||||||
|
type: 'TEST',
|
||||||
|
textContent: null,
|
||||||
|
audioPath: null,
|
||||||
|
voiceType: null,
|
||||||
|
dialect: null,
|
||||||
|
expectedResult: null,
|
||||||
|
sortOrder: null,
|
||||||
|
status: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
}
|
||||||
|
proxy.resetForm("corpusRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.corpusId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加语料库"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _corpusId = row.corpusId || ids.value
|
||||||
|
getCorpus(_corpusId).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改语料库"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["corpusRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
console.log('f', form.value)
|
||||||
|
if (form.value.corpusId != null) {
|
||||||
|
updateCorpus(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addCorpus(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _corpusIds = row.corpusId || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除语料库编号为"' + _corpusIds + '"的数据项?').then(function() {
|
||||||
|
return delCorpus(_corpusIds)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
console.log('播放')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('vi/corpus/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `corpus_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
getList
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -1,335 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<el-tabs v-model="activeName" class="demo-tabs">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-tab-pane label="单次对话" name="single">
|
||||||
<el-form-item label="语料名称" prop="corpusName">
|
<SingleConversation v-if="activeName === 'single'" ref="singleRef" />
|
||||||
<el-input
|
</el-tab-pane>
|
||||||
v-model="queryParams.corpusName"
|
<el-tab-pane label="连续对话" name="multiple">
|
||||||
placeholder="请输入语料名称"
|
<MultipleConversations v-if="activeName === 'multiple'" ref="multipleRef" />
|
||||||
clearable
|
</el-tab-pane>
|
||||||
@keyup.enter="handleQuery"
|
</el-tabs>
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="音色" prop="voiceType">
|
|
||||||
<el-select v-model="queryParams.voiceType" placeholder="请选择音色" clearable style="width: 200px">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in vi_voice_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="语种" prop="dialect">
|
|
||||||
<el-select v-model="queryParams.voiceType" placeholder="请选择语种" clearable style="width: 200px">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in vi_dialect_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="预期结果" prop="expectedResult">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.expectedResult"
|
|
||||||
placeholder="请输入预期结果"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['vi:corpus:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['vi:corpus:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['vi:corpus:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="Download"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['vi:corpus:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="corpusList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="语料名称" align="center" prop="corpusName" />
|
|
||||||
<el-table-column label="语料类型" align="center" prop="type" />
|
|
||||||
<el-table-column label="语音文本" align="center" prop="textContent" />
|
|
||||||
<el-table-column label="语音文件路径" align="center" prop="audioPath" />
|
|
||||||
<el-table-column label="音色" align="center" prop="voiceType" />
|
|
||||||
<el-table-column label="语种" align="center" prop="dialect" />
|
|
||||||
<el-table-column label="预期结果" align="center" prop="expectedResult" />
|
|
||||||
<el-table-column label="顺序" align="center" prop="sortOrder" />
|
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['vi:corpus:edit']">修改</el-button>
|
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['vi:corpus:remove']">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNum"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改语料库对话框 -->
|
|
||||||
<el-dialog :title="title" v-model="open" width="640px" append-to-body>
|
|
||||||
<el-form ref="corpusRef" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="语料名称" prop="corpusName">
|
|
||||||
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="音色" prop="voiceType">
|
|
||||||
<el-select v-model="form.voiceType" placeholder="请选择音色" clearable style="width: 100%">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in vi_voice_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="语种" prop="dialect">
|
|
||||||
<el-select v-model="form.voiceType" placeholder="请选择语种" clearable style="width: 100%">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in vi_dialect_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<el-table :data="tableData">
|
|
||||||
<el-table-column prop="num" label="序号">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-inputNumber style="width: 100px;" v-model="row.num" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="textContent" label="语料文本">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.textContent" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="audioPath" label="音频文件">
|
|
||||||
<el-button>上传文件</el-button>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="expectedResult" label="预期结果">
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-input v-model="row.expectedResult" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="action" label="操作">
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Corpus">
|
<script lang="ts" setup>
|
||||||
import { listCorpus, getCorpus, delCorpus, addCorpus, updateCorpus } from "@/api/vi/corpus"
|
import SingleConversation from './SingleConversation/index.vue'
|
||||||
|
import MultipleConversations from './MultipleConversations/index.vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const activeName = ref('single')
|
||||||
const { vi_voice_type, vi_dialect_type } = proxy.useDict("vi_voice_type", "vi_dialect_type")
|
|
||||||
const corpusList = ref([])
|
|
||||||
const open = ref(false)
|
|
||||||
const loading = ref(true)
|
|
||||||
const showSearch = ref(true)
|
|
||||||
const ids = ref([])
|
|
||||||
const single = ref(true)
|
|
||||||
const multiple = ref(true)
|
|
||||||
const total = ref(0)
|
|
||||||
const title = ref("")
|
|
||||||
|
|
||||||
const data = reactive({
|
const singleRef = ref()
|
||||||
form: {},
|
const multipleRef= ref()
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
corpusName: null,
|
|
||||||
type: null,
|
|
||||||
textContent: null,
|
|
||||||
audioPath: null,
|
|
||||||
voiceType: null,
|
|
||||||
dialect: null,
|
|
||||||
expectedResult: null,
|
|
||||||
sortOrder: null,
|
|
||||||
status: null,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
type: [
|
|
||||||
{ required: true, message: "语料类型不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
textContent: [
|
|
||||||
{ required: true, message: "语音对应的文本不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data)
|
|
||||||
|
|
||||||
/** 查询语料库列表 */
|
|
||||||
function getList() {
|
|
||||||
loading.value = true
|
|
||||||
listCorpus(queryParams.value).then(response => {
|
|
||||||
corpusList.value = response.rows
|
|
||||||
total.value = response.total
|
|
||||||
loading.value = false
|
|
||||||
}).catch(err => {
|
|
||||||
loading.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消按钮
|
|
||||||
function cancel() {
|
|
||||||
open.value = false
|
|
||||||
reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 表单重置
|
|
||||||
function reset() {
|
|
||||||
form.value = {
|
|
||||||
corpusId: null,
|
|
||||||
corpusName: null,
|
|
||||||
type: null,
|
|
||||||
textContent: null,
|
|
||||||
audioPath: null,
|
|
||||||
voiceType: null,
|
|
||||||
dialect: null,
|
|
||||||
expectedResult: null,
|
|
||||||
sortOrder: null,
|
|
||||||
status: null,
|
|
||||||
createBy: null,
|
|
||||||
createTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
}
|
|
||||||
proxy.resetForm("corpusRef")
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
function handleQuery() {
|
|
||||||
queryParams.value.pageNum = 1
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
function resetQuery() {
|
|
||||||
proxy.resetForm("queryRef")
|
|
||||||
handleQuery()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多选框选中数据
|
|
||||||
function handleSelectionChange(selection) {
|
|
||||||
ids.value = selection.map(item => item.corpusId)
|
|
||||||
single.value = selection.length != 1
|
|
||||||
multiple.value = !selection.length
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
function handleAdd() {
|
|
||||||
reset()
|
|
||||||
open.value = true
|
|
||||||
title.value = "添加语料库"
|
|
||||||
}
|
|
||||||
|
|
||||||
const tableData = ref([{}])
|
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
function handleUpdate(row) {
|
|
||||||
reset()
|
|
||||||
const _corpusId = row.corpusId || ids.value
|
|
||||||
getCorpus(_corpusId).then(response => {
|
|
||||||
form.value = response.data
|
|
||||||
open.value = true
|
|
||||||
title.value = "修改语料库"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交按钮 */
|
|
||||||
function submitForm() {
|
|
||||||
proxy.$refs["corpusRef"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (form.value.corpusId != null) {
|
|
||||||
updateCorpus(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("修改成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
addCorpus(form.value).then(response => {
|
|
||||||
proxy.$modal.msgSuccess("新增成功")
|
|
||||||
open.value = false
|
|
||||||
getList()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
function handleDelete(row) {
|
|
||||||
const _corpusIds = row.corpusId || ids.value
|
|
||||||
proxy.$modal.confirm('是否确认删除语料库编号为"' + _corpusIds + '"的数据项?').then(function() {
|
|
||||||
return delCorpus(_corpusIds)
|
|
||||||
}).then(() => {
|
|
||||||
getList()
|
|
||||||
proxy.$modal.msgSuccess("删除成功")
|
|
||||||
}).catch(() => {})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
function handleExport() {
|
|
||||||
proxy.download('vi/corpus/export', {
|
|
||||||
...queryParams.value
|
|
||||||
}, `corpus_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
|
|
||||||
getList()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.demo-tabs {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.el-tabs__header {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 12px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
310
src/views/vi/testProject/index.vue
Normal file
310
src/views/vi/testProject/index.vue
Normal file
@ -0,0 +1,310 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="项目名称" prop="corpusName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.corpusName"
|
||||||
|
placeholder="请输入项目名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['vi:corpus:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['vi:corpus:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['vi:corpus:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="corpusList" table-layout="auto" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="项目名称" align="center" prop="corpusName" />
|
||||||
|
<el-table-column label="项目编号" align="center" prop="textContent" min-width="200" show-overflow-tooltip />
|
||||||
|
<el-table-column label="测试人员" align="center" prop="audioPath" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="计划测试时间" align="center" prop="voiceType" />
|
||||||
|
<el-table-column label="项目描述" align="center" prop="dialect" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="280">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">详情</el-button>
|
||||||
|
<el-button link type="primary" icon="Upload" @click="handleUpload(scope.row)">下载</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
<el-button link type="primary" icon="VideoPlay" @click="handlePlay(scope.row)">执行</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改语料库对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="740px" append-to-body>
|
||||||
|
<el-form ref="corpusRef" :inline="true" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<div class="card">
|
||||||
|
<div class="form-title">项目信息</div>
|
||||||
|
<el-form-item label="项目名称" prop="corpusName">
|
||||||
|
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目编号" prop="textContent">
|
||||||
|
<el-input v-model="form.textContent" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="测试人员" prop="audioPath">
|
||||||
|
<el-input v-model="form.audioPath" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计划测试时间" prop="voiceType">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.voiceType"
|
||||||
|
type="date"
|
||||||
|
placeholder="Pick a date"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="项目描述" prop="dialect">
|
||||||
|
<el-input v-model="form.expectedResult" type="textarea" placeholder="请输入项目描述" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="form-title">样品信息</div>
|
||||||
|
<el-form-item label="样品名称" prop="corpusName">
|
||||||
|
<el-input v-model="form.corpusName" placeholder="请输入语料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商标" prop="textContent">
|
||||||
|
<el-input v-model="form.textContent" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="型号规格" prop="audioPath">
|
||||||
|
<el-input v-model="form.audioPath" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="样品数量" prop="voiceType">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.voiceType"
|
||||||
|
type="date"
|
||||||
|
placeholder="Pick a date"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产单位" prop="dialect">
|
||||||
|
<el-input v-model="form.expectedResult" placeholder="请输入项目描述" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="委托单位" prop="dialect">
|
||||||
|
<el-input v-model="form.expectedResult" placeholder="请输入项目描述" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Corpus">
|
||||||
|
import { listCorpus, getCorpus, delCorpus, addCorpus, updateCorpus } from "@/api/vi/corpus"
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance()
|
||||||
|
const { vi_voice_type, vi_dialect_type } = proxy.useDict("vi_voice_type", "vi_dialect_type")
|
||||||
|
const corpusList = ref([])
|
||||||
|
const open = ref(false)
|
||||||
|
const loading = ref(true)
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const ids = ref([])
|
||||||
|
const single = ref(true)
|
||||||
|
const multiple = ref(true)
|
||||||
|
const total = ref(0)
|
||||||
|
const title = ref("")
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
corpusName: null
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data)
|
||||||
|
|
||||||
|
/** 查询语料库列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
listCorpus(queryParams.value).then(response => {
|
||||||
|
corpusList.value = response.rows
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
}).catch(err => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
corpusName: null,
|
||||||
|
}
|
||||||
|
proxy.resetForm("corpusRef")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef")
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.corpusId)
|
||||||
|
single.value = selection.length != 1
|
||||||
|
multiple.value = !selection.length
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset()
|
||||||
|
open.value = true
|
||||||
|
title.value = "添加测试项目"
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset()
|
||||||
|
const _corpusId = row.corpusId || ids.value
|
||||||
|
getCorpus(_corpusId).then(response => {
|
||||||
|
form.value = response.data
|
||||||
|
open.value = true
|
||||||
|
title.value = "修改测试项目"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["corpusRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
console.log('f', form.value)
|
||||||
|
if (form.value.corpusId != null) {
|
||||||
|
updateCorpus(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addCorpus(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功")
|
||||||
|
open.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _corpusIds = row.corpusId || ids.value
|
||||||
|
proxy.$modal.confirm('是否确认删除语料库编号为"' + _corpusIds + '"的数据项?').then(function() {
|
||||||
|
return delCorpus(_corpusIds)
|
||||||
|
}).then(() => {
|
||||||
|
getList()
|
||||||
|
proxy.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleUpload = (row) => {
|
||||||
|
console.log('上传')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
console.log('播放')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('vi/corpus/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `corpus_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card {
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
box-shadow: 0px 0px 12px rgba(0, 0, 0, .12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 16px;
|
||||||
|
background: blue;
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user