feat: 触控交互
This commit is contained in:
parent
287b3d6293
commit
17374925f3
121
package.json
121
package.json
@ -1,60 +1,61 @@
|
|||||||
{
|
{
|
||||||
"name": "CMVR-IOT-UI",
|
"name": "CMVR-IOT-UI",
|
||||||
"version": "3.8.8",
|
"version": "3.8.8",
|
||||||
"description": "CMVR-IOT平台管理系统前端UI框架",
|
"description": "CMVR-IOT平台管理系统前端UI框架",
|
||||||
"author": "CMVR",
|
"author": "CMVR",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build:dev": "vite build --mode development",
|
"build:dev": "vite build --mode development",
|
||||||
"build:prod": "vite build --mode production",
|
"build:prod": "vite build --mode production",
|
||||||
"build:test": "vite build --mode test",
|
"build:test": "vite build --mode test",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons-vue": "2.3.1",
|
"@element-plus/icons-vue": "2.3.1",
|
||||||
"@logicflow/core": "^2.0.13",
|
"@logicflow/core": "^2.0.13",
|
||||||
"@logicflow/extension": "^2.0.18",
|
"@logicflow/extension": "^2.0.18",
|
||||||
"@vueup/vue-quill": "1.2.0",
|
"@vueup/vue-quill": "1.2.0",
|
||||||
"@vueuse/core": "10.11.0",
|
"@vueuse/core": "10.11.0",
|
||||||
"ace-builds": "^1.43.0",
|
"ace-builds": "^1.43.0",
|
||||||
"axios": "0.28.1",
|
"axios": "0.28.1",
|
||||||
"clipboard": "2.0.11",
|
"clipboard": "2.0.11",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"echarts": "5.5.1",
|
"echarts": "5.5.1",
|
||||||
"element-plus": "2.9.4",
|
"element-plus": "2.9.4",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "6.6.2",
|
"fuse.js": "6.6.2",
|
||||||
"js-beautify": "1.14.11",
|
"js-beautify": "1.14.11",
|
||||||
"js-cookie": "3.0.5",
|
"js-cookie": "3.0.5",
|
||||||
"jsencrypt": "3.3.2",
|
"jsencrypt": "3.3.2",
|
||||||
"json-editor-vue": "^0.18.1",
|
"json-editor-vue": "^0.18.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"pinia": "2.1.7",
|
"pinia": "2.1.7",
|
||||||
"socket.io-client": "^4.8.1",
|
"pnpm": "^10.23.0",
|
||||||
"sockjs-client": "^1.6.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"splitpanes": "3.1.5",
|
"sockjs-client": "^1.6.1",
|
||||||
"uuid": "^11.1.0",
|
"splitpanes": "3.1.5",
|
||||||
"vue": "3.4.31",
|
"uuid": "^11.1.0",
|
||||||
"vue-cropper": "1.1.1",
|
"vue": "3.4.31",
|
||||||
"vue-router": "4.4.0",
|
"vue-cropper": "1.1.1",
|
||||||
"vue3-ace-editor": "^2.2.4",
|
"vue-router": "4.4.0",
|
||||||
"vue3-json-viewer": "2.3.0",
|
"vue3-ace-editor": "^2.2.4",
|
||||||
"vuedraggable": "4.1.0",
|
"vue3-json-viewer": "2.3.0",
|
||||||
"xgplayer": "^3.0.22"
|
"vuedraggable": "4.1.0",
|
||||||
},
|
"xgplayer": "^3.0.22"
|
||||||
"devDependencies": {
|
},
|
||||||
"@vitejs/plugin-vue": "5.0.5",
|
"devDependencies": {
|
||||||
"file-loader": "^6.2.0",
|
"@vitejs/plugin-vue": "5.0.5",
|
||||||
"sass": "1.77.5",
|
"file-loader": "^6.2.0",
|
||||||
"unplugin-auto-import": "0.17.6",
|
"sass": "1.77.5",
|
||||||
"unplugin-vue-setup-extend-plus": "1.0.1",
|
"unplugin-auto-import": "0.17.6",
|
||||||
"vite": "5.3.2",
|
"unplugin-vue-setup-extend-plus": "1.0.1",
|
||||||
"vite-plugin-compression": "0.5.1",
|
"vite": "5.3.2",
|
||||||
"vite-plugin-svg-icons": "2.0.1"
|
"vite-plugin-compression": "0.5.1",
|
||||||
}
|
"vite-plugin-svg-icons": "2.0.1"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,212 +1,213 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="upload-file">
|
<div class="upload-file">
|
||||||
<el-upload
|
<el-upload
|
||||||
multiple
|
multiple
|
||||||
:action="uploadFileUrl"
|
:action="uploadFileUrl"
|
||||||
:before-upload="handleBeforeUpload"
|
:before-upload="handleBeforeUpload"
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
:limit="limit"
|
:limit="limit"
|
||||||
:on-error="handleUploadError"
|
:on-error="handleUploadError"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
class="upload-file-uploader"
|
class="upload-file-uploader"
|
||||||
ref="fileUpload"
|
ref="fileUpload"
|
||||||
>
|
>
|
||||||
<!-- 上传按钮 -->
|
<!-- 上传按钮 -->
|
||||||
<el-button type="primary">选取文件</el-button>
|
<el-button type="primary">选取文件</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<!-- 上传提示 -->
|
<!-- 上传提示 -->
|
||||||
<div class="el-upload__tip" v-if="showTip">
|
<div class="el-upload__tip" v-if="showTip">
|
||||||
请上传
|
请上传
|
||||||
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
||||||
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
||||||
的文件
|
的文件
|
||||||
</div>
|
</div>
|
||||||
<!-- 文件列表 -->
|
<!-- 文件列表 -->
|
||||||
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||||
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||||
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
||||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
</el-link>
|
</el-link>
|
||||||
<div class="ele-upload-list__item-content-action">
|
<div class="ele-upload-list__item-content-action">
|
||||||
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: [String, Object, Array],
|
modelValue: [String, Object, Array],
|
||||||
// 数量限制
|
// 数量限制
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5,
|
||||||
},
|
},
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: {
|
fileSize: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 5,
|
default: 5,
|
||||||
},
|
},
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
fileType: {
|
fileType: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
||||||
},
|
},
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
isShowTip: {
|
isShowTip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const emit = defineEmits();
|
const emit = defineEmits();
|
||||||
const number = ref(0);
|
const number = ref(0);
|
||||||
const uploadList = ref([]);
|
const uploadList = ref([]);
|
||||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||||
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
|
const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
|
||||||
const headers = ref({ Authorization: "Bearer " + getToken() });
|
const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||||
const fileList = ref([]);
|
const fileList = ref([]);
|
||||||
const showTip = computed(
|
const showTip = computed(
|
||||||
() => props.isShowTip && (props.fileType || props.fileSize)
|
() => props.isShowTip && (props.fileType || props.fileSize)
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(() => props.modelValue, val => {
|
watch(() => props.modelValue, val => {
|
||||||
if (val) {
|
if (val) {
|
||||||
let temp = 1;
|
let temp = 1;
|
||||||
// 首先将值转为数组
|
// 首先将值转为数组
|
||||||
const list = Array.isArray(val) ? val : props.modelValue.split(',');
|
const list = Array.isArray(val) ? val : props.modelValue.split(',');
|
||||||
// 然后将数组转为对象数组
|
// 然后将数组转为对象数组
|
||||||
fileList.value = list.map(item => {
|
fileList.value = list.map(item => {
|
||||||
if (typeof item === "string") {
|
if (typeof item === "string") {
|
||||||
item = { name: item, url: item };
|
item = { name: item, url: item };
|
||||||
}
|
}
|
||||||
item.uid = item.uid || new Date().getTime() + temp++;
|
item.uid = item.uid || new Date().getTime() + temp++;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
fileList.value = [];
|
fileList.value = [];
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
},{ deep: true, immediate: true });
|
},{ deep: true, immediate: true });
|
||||||
|
|
||||||
// 上传前校检格式和大小
|
// 上传前校检格式和大小
|
||||||
function handleBeforeUpload(file) {
|
function handleBeforeUpload(file) {
|
||||||
// 校检文件类型
|
// 校检文件类型
|
||||||
if (props.fileType.length) {
|
if (props.fileType.length) {
|
||||||
const fileName = file.name.split('.');
|
const fileName = file.name.split('.');
|
||||||
const fileExt = fileName[fileName.length - 1];
|
const fileExt = fileName[fileName.length - 1];
|
||||||
const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
|
const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
|
||||||
if (!isTypeOk) {
|
if (!isTypeOk) {
|
||||||
proxy.$modal.msgError(`文件格式不正确,请上传${props.fileType.join("/")}格式文件!`);
|
proxy.$modal.msgError(`文件格式不正确,请上传${props.fileType.join("/")}格式文件!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校检文件名是否包含特殊字符
|
// 校检文件名是否包含特殊字符
|
||||||
if (file.name.includes(',')) {
|
if (file.name.includes(',')) {
|
||||||
proxy.$modal.msgError('文件名不正确,不能包含英文逗号!');
|
proxy.$modal.msgError('文件名不正确,不能包含英文逗号!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 校检文件大小
|
// 校检文件大小
|
||||||
if (props.fileSize) {
|
if (props.fileSize) {
|
||||||
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
||||||
if (!isLt) {
|
if (!isLt) {
|
||||||
proxy.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
|
proxy.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxy.$modal.loading("正在上传文件,请稍候...");
|
proxy.$modal.loading("正在上传文件,请稍候...");
|
||||||
number.value++;
|
number.value++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文件个数超出
|
// 文件个数超出
|
||||||
function handleExceed() {
|
function handleExceed() {
|
||||||
proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
|
proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传失败
|
// 上传失败
|
||||||
function handleUploadError(err) {
|
function handleUploadError(err) {
|
||||||
proxy.$modal.msgError("上传文件失败");
|
proxy.$modal.msgError("上传文件失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
function handleUploadSuccess(res, file) {
|
function handleUploadSuccess(res, file) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uploadList.value.push({ name: res.fileName, url: res.fileName });
|
uploadList.value.push({ name: res.fileName, url: res.fileName });
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
} else {
|
} else {
|
||||||
number.value--;
|
number.value--;
|
||||||
proxy.$modal.closeLoading();
|
proxy.$modal.closeLoading();
|
||||||
proxy.$modal.msgError(res.msg);
|
proxy.$modal.msgError(res.msg);
|
||||||
proxy.$refs.fileUpload.handleRemove(file);
|
proxy.$refs.fileUpload.handleRemove(file);
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除文件
|
// 删除文件
|
||||||
function handleDelete(index) {
|
function handleDelete(index) {
|
||||||
fileList.value.splice(index, 1);
|
fileList.value.splice(index, 1);
|
||||||
emit("update:modelValue", listToString(fileList.value));
|
emit("update:modelValue", listToString(fileList.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传结束处理
|
// 上传结束处理
|
||||||
function uploadedSuccessfully() {
|
function uploadedSuccessfully() {
|
||||||
if (number.value > 0 && uploadList.value.length === number.value) {
|
if (number.value > 0 && uploadList.value.length === number.value) {
|
||||||
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
||||||
uploadList.value = [];
|
uploadList.value = [];
|
||||||
number.value = 0;
|
number.value = 0;
|
||||||
emit("update:modelValue", listToString(fileList.value));
|
console.log('fileList.value', fileList.value)
|
||||||
proxy.$modal.closeLoading();
|
emit("update:modelValue", listToString(fileList.value));
|
||||||
}
|
proxy.$modal.closeLoading();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 获取文件名称
|
|
||||||
function getFileName(name) {
|
// 获取文件名称
|
||||||
// 如果是url那么取最后的名字 如果不是直接返回
|
function getFileName(name) {
|
||||||
if (name.lastIndexOf("/") > -1) {
|
// 如果是url那么取最后的名字 如果不是直接返回
|
||||||
return name.slice(name.lastIndexOf("/") + 1);
|
if (name.lastIndexOf("/") > -1) {
|
||||||
} else {
|
return name.slice(name.lastIndexOf("/") + 1);
|
||||||
return name;
|
} else {
|
||||||
}
|
return name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 对象转成指定字符串分隔
|
|
||||||
function listToString(list, separator) {
|
// 对象转成指定字符串分隔
|
||||||
let strs = "";
|
function listToString(list, separator) {
|
||||||
separator = separator || ",";
|
let strs = "";
|
||||||
for (let i in list) {
|
separator = separator || ",";
|
||||||
if (list[i].url) {
|
for (let i in list) {
|
||||||
strs += list[i].url + separator;
|
if (list[i].url) {
|
||||||
}
|
strs += list[i].url + separator;
|
||||||
}
|
}
|
||||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
}
|
||||||
}
|
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||||
</script>
|
}
|
||||||
|
</script>
|
||||||
<style scoped lang="scss">
|
|
||||||
.upload-file-uploader {
|
<style scoped lang="scss">
|
||||||
margin-bottom: 5px;
|
.upload-file-uploader {
|
||||||
}
|
margin-bottom: 5px;
|
||||||
.upload-file-list .el-upload-list__item {
|
}
|
||||||
border: 1px solid #e4e7ed;
|
.upload-file-list .el-upload-list__item {
|
||||||
line-height: 2;
|
border: 1px solid #e4e7ed;
|
||||||
margin-bottom: 10px;
|
line-height: 2;
|
||||||
position: relative;
|
margin-bottom: 10px;
|
||||||
}
|
position: relative;
|
||||||
.upload-file-list .ele-upload-list__item-content {
|
}
|
||||||
display: flex;
|
.upload-file-list .ele-upload-list__item-content {
|
||||||
justify-content: space-between;
|
display: flex;
|
||||||
align-items: center;
|
justify-content: space-between;
|
||||||
color: inherit;
|
align-items: center;
|
||||||
}
|
color: inherit;
|
||||||
.ele-upload-list__item-content-action .el-link {
|
}
|
||||||
margin-right: 10px;
|
.ele-upload-list__item-content-action .el-link {
|
||||||
}
|
margin-right: 10px;
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -38,12 +38,14 @@ router.beforeEach((to, from, next) => {
|
|||||||
useUserStore().getInfo().then(() => {
|
useUserStore().getInfo().then(() => {
|
||||||
isRelogin.show = false
|
isRelogin.show = false
|
||||||
usePermissionStore().generateRoutes().then(accessRoutes => {
|
usePermissionStore().generateRoutes().then(accessRoutes => {
|
||||||
|
console.log('accessRoutes', accessRoutes)
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
accessRoutes.forEach(route => {
|
accessRoutes.forEach(route => {
|
||||||
if (!isHttp(route.path)) {
|
if (!isHttp(route.path)) {
|
||||||
router.addRoute(route) // 动态添加可访问路由表
|
router.addRoute(route) // 动态添加可访问路由表
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('router', router)
|
||||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||
@ -214,6 +214,34 @@ export const dynamicRoutes = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/is/plan",
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
permissions: ["is:project:list"],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "index/:id",
|
||||||
|
component: () => import("@/views/is/project/plan/index"),
|
||||||
|
name: "ProjectPlan",
|
||||||
|
meta: { title: "项目方案", activeMenu: "/is/plan" },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/is/evaluate",
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
permissions: ["is:project:list"],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "index/:id",
|
||||||
|
component: () => import("@/views/is/project/evaluate/index"),
|
||||||
|
name: "ProjectEvaluate",
|
||||||
|
meta: { title: "评价", activeMenu: "/is/evaluate" },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/monitor/job-log",
|
path: "/monitor/job-log",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
|||||||
101
src/views/is/func/FunctionTable/FunctionDialog.vue
Normal file
101
src/views/is/func/FunctionTable/FunctionDialog.vue
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="visible"
|
||||||
|
:title="title"
|
||||||
|
width="500px"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="功能选择" prop="name">
|
||||||
|
<el-select>
|
||||||
|
<el-option>11</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上传图片">
|
||||||
|
<FileUpload :modelValue="imgUrl" :limit="1" :fileSize="5" :fileType="['png', 'jpg', 'jpeg']" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import FileUpload from '@/components/FileUpload/index'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:visible', 'confirm'])
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const formRules = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入功能名称', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const visible = ref(props.visible)
|
||||||
|
|
||||||
|
const imgUrl = ref('')
|
||||||
|
|
||||||
|
watch(() => props.visible, (newVal) => {
|
||||||
|
visible.value = newVal
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(visible, (newVal) => {
|
||||||
|
emit('update:visible', newVal)
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
|
||||||
|
formRef.value.validate((valid) => {
|
||||||
|
emit('confirm', valid, { ...props.formData })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
200
src/views/is/func/FunctionTable/FunctionTable.vue
Normal file
200
src/views/is/func/FunctionTable/FunctionTable.vue
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<div class="function-table">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="searchForm" class="search-form">
|
||||||
|
<el-form-item label="功能名称">
|
||||||
|
<el-input
|
||||||
|
v-model="searchForm.name"
|
||||||
|
placeholder="请输入功能名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input
|
||||||
|
v-model="searchForm.description"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 表格操作栏 -->
|
||||||
|
<div class="table-actions">
|
||||||
|
<el-button type="primary" @click="handleAddFunction">
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
新增功能
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 功能表格 -->
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="id" label="ID" width="80" />
|
||||||
|
<el-table-column prop="name" label="功能名称" min-width="120" />
|
||||||
|
<el-table-column prop="description" label="描述" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="createTime" label="创建日期" width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatDate(row.createTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="danger" @click="handleDeleteFunction(row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 功能编辑对话框 -->
|
||||||
|
<FunctionDialog
|
||||||
|
v-model:visible="functionDialogVisible"
|
||||||
|
:title="functionDialogTitle"
|
||||||
|
:form-data="functionFormData"
|
||||||
|
@confirm="handleFunctionConfirm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
|
import FunctionDialog from './FunctionDialog.vue'
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '导航系统',
|
||||||
|
description: '提供实时导航和路线规划功能',
|
||||||
|
createTime: '2024-01-15 10:30:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '语音助手',
|
||||||
|
description: '支持语音控制和智能交互',
|
||||||
|
createTime: '2024-01-16 14:20:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '娱乐系统',
|
||||||
|
description: '音乐、视频播放和在线流媒体',
|
||||||
|
createTime: '2024-01-17 09:15:00'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 对话框相关
|
||||||
|
const functionDialogVisible = ref(false)
|
||||||
|
const functionDialogTitle = ref('')
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const functionFormData = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 生成ID
|
||||||
|
let functionIdCounter = 100
|
||||||
|
|
||||||
|
function generateFunctionId() {
|
||||||
|
return functionIdCounter++
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索功能
|
||||||
|
function handleSearch() {
|
||||||
|
// 实际项目中这里应该是API调用
|
||||||
|
ElMessage.info('执行搜索操作')
|
||||||
|
console.log('搜索条件:', searchForm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置搜索
|
||||||
|
function handleReset() {
|
||||||
|
searchForm.name = ''
|
||||||
|
searchForm.description = ''
|
||||||
|
handleSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增功能
|
||||||
|
function handleAddFunction() {
|
||||||
|
functionDialogTitle.value = '新增功能'
|
||||||
|
functionFormData.name = ''
|
||||||
|
functionFormData.description = ''
|
||||||
|
functionDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认功能操作
|
||||||
|
function handleFunctionConfirm(valid, formData) {
|
||||||
|
if (valid) {
|
||||||
|
const newFunction = {
|
||||||
|
id: generateFunctionId(),
|
||||||
|
name: formData.name,
|
||||||
|
description: formData.description,
|
||||||
|
createTime: new Date().toLocaleString('zh-CN')
|
||||||
|
}
|
||||||
|
|
||||||
|
tableData.value.unshift(newFunction)
|
||||||
|
functionDialogVisible.value = false
|
||||||
|
ElMessage.success('新增功能成功')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除功能
|
||||||
|
function handleDeleteFunction(row) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
`确定要删除功能"${row.name}"吗?`,
|
||||||
|
'警告',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
const index = tableData.value.findIndex(item => item.id === row.id)
|
||||||
|
if (index > -1) {
|
||||||
|
tableData.value.splice(index, 1)
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消删除
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化日期
|
||||||
|
function formatDate(dateString) {
|
||||||
|
return dateString
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.function-table {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-form {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-actions {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
104
src/views/is/func/TreePanel/TreeDialog.vue
Normal file
104
src/views/is/func/TreePanel/TreeDialog.vue
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="visible"
|
||||||
|
:title="title"
|
||||||
|
width="500px"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
level: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:visible', 'confirm'])
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const formRules = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||||
|
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
description: [
|
||||||
|
{ required: true, message: '请输入描述', trigger: 'blur' },
|
||||||
|
{ min: 1, max: 200, message: '长度在 1 到 200 个字符', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const visible = ref(props.visible)
|
||||||
|
|
||||||
|
watch(() => props.visible, (newVal) => {
|
||||||
|
console.log(123)
|
||||||
|
visible.value = newVal
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(visible, (newVal) => {
|
||||||
|
console.log(234)
|
||||||
|
emit('update:visible', newVal)
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
|
||||||
|
formRef.value.validate((valid) => {
|
||||||
|
emit('confirm', valid, { ...props.formData })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
335
src/views/is/func/TreePanel/TreePanel.vue
Normal file
335
src/views/is/func/TreePanel/TreePanel.vue
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tree-panel">
|
||||||
|
<div class="tree-header">
|
||||||
|
<el-button type="primary" @click="handleAddManufacturer">
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
新增车企
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="tree-container">
|
||||||
|
<el-tree
|
||||||
|
ref="treeRef"
|
||||||
|
:data="treeData"
|
||||||
|
node-key="id"
|
||||||
|
:props="treeProps"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
default-expand-all
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span class="custom-tree-node">
|
||||||
|
<span>{{ node.label }}</span>
|
||||||
|
<span class="node-actions">
|
||||||
|
<!-- 车企层级 -->
|
||||||
|
<template v-if="data.level === 1">
|
||||||
|
<el-button link type="primary" @click="handleAddModel(data)">
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="primary" @click="handleEdit(data)">
|
||||||
|
<el-icon><Edit /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(data)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 车型层级 -->
|
||||||
|
<template v-else-if="data.level === 2">
|
||||||
|
<el-button link type="primary" @click="handleAddVersion(data)">
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="primary" @click="handleEdit(data)">
|
||||||
|
<el-icon><Edit /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(data)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 车机版本层级 -->
|
||||||
|
<template v-else-if="data.level === 3">
|
||||||
|
<el-button link type="primary" @click="handleEdit(data)">
|
||||||
|
<el-icon><Edit /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(data)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 树节点编辑对话框 -->
|
||||||
|
<TreeDialog
|
||||||
|
v-model:visible="dialogVisible"
|
||||||
|
:title="dialogTitle"
|
||||||
|
:level="currentLevel"
|
||||||
|
:form-data="formData"
|
||||||
|
@confirm="handleConfirm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { Plus, Edit, Delete } from '@element-plus/icons-vue'
|
||||||
|
import TreeDialog from './TreeDialog.vue'
|
||||||
|
|
||||||
|
// 定义 emits
|
||||||
|
const emit = defineEmits()
|
||||||
|
|
||||||
|
// 树形结构数据
|
||||||
|
const treeData = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
label: '特斯拉',
|
||||||
|
level: 1,
|
||||||
|
description: '电动汽车制造商',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 11,
|
||||||
|
label: 'Model 3',
|
||||||
|
level: 2,
|
||||||
|
description: '中型电动轿车',
|
||||||
|
parentId: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 111,
|
||||||
|
label: 'V11.0',
|
||||||
|
level: 3,
|
||||||
|
description: '2023年车机系统版本',
|
||||||
|
parentId: 11
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
label: '比亚迪',
|
||||||
|
level: 1,
|
||||||
|
description: '中国新能源汽车品牌',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 21,
|
||||||
|
label: '汉 EV',
|
||||||
|
level: 2,
|
||||||
|
description: '旗舰电动轿车',
|
||||||
|
parentId: 2,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 211,
|
||||||
|
label: 'DiLink 4.0',
|
||||||
|
level: 3,
|
||||||
|
description: '智能网联系统',
|
||||||
|
parentId: 21
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 对话框相关
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const formData = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 当前操作的相关信息
|
||||||
|
const currentAction = ref('add')
|
||||||
|
const currentNode = ref(null)
|
||||||
|
const currentLevel = ref(0)
|
||||||
|
|
||||||
|
// 树形配置
|
||||||
|
const treeProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'label'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成ID
|
||||||
|
let treeIdCounter = 1000
|
||||||
|
|
||||||
|
function generateTreeId() {
|
||||||
|
return treeIdCounter++
|
||||||
|
}
|
||||||
|
|
||||||
|
// 树节点点击
|
||||||
|
function handleNodeClick(data) {
|
||||||
|
emit('node-click', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增车企
|
||||||
|
function handleAddManufacturer() {
|
||||||
|
currentAction.value = 'add'
|
||||||
|
currentLevel.value = 1
|
||||||
|
dialogTitle.value = '新增车企'
|
||||||
|
resetForm()
|
||||||
|
console.log('新增车企')
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增车型
|
||||||
|
function handleAddModel(node) {
|
||||||
|
currentAction.value = 'add'
|
||||||
|
currentLevel.value = 2
|
||||||
|
currentNode.value = node
|
||||||
|
dialogTitle.value = '新增车型'
|
||||||
|
resetForm()
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增车机版本
|
||||||
|
function handleAddVersion(node) {
|
||||||
|
currentAction.value = 'add'
|
||||||
|
currentLevel.value = 3
|
||||||
|
currentNode.value = node
|
||||||
|
dialogTitle.value = '新增车机版本'
|
||||||
|
resetForm()
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑节点
|
||||||
|
function handleEdit(node) {
|
||||||
|
currentAction.value = 'edit'
|
||||||
|
currentLevel.value = node.level
|
||||||
|
currentNode.value = node
|
||||||
|
dialogTitle.value = getEditTitle(node.level)
|
||||||
|
formData.name = node.label
|
||||||
|
formData.description = node.description || ''
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除节点
|
||||||
|
function handleDelete(node) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
`确定要删除"${node.label}"吗?此操作不可恢复。`,
|
||||||
|
'警告',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
deleteNode(treeData.value, node.id)
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
emit('tree-update')
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消删除
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 递归删除节点
|
||||||
|
function deleteNode(nodes, id) {
|
||||||
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
|
if (nodes[i].id === id) {
|
||||||
|
nodes.splice(i, 1)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (nodes[i].children) {
|
||||||
|
if (deleteNode(nodes[i].children, id)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
function resetForm() {
|
||||||
|
formData.name = ''
|
||||||
|
formData.description = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取编辑标题
|
||||||
|
function getEditTitle(level) {
|
||||||
|
const titles = ['', '编辑车企', '编辑车型', '编辑车机版本']
|
||||||
|
return titles[level] || '编辑'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认树节点操作
|
||||||
|
function handleConfirm(valid, formData) {
|
||||||
|
if (valid) {
|
||||||
|
if (currentAction.value === 'add') {
|
||||||
|
// 新增操作
|
||||||
|
const newNode = {
|
||||||
|
id: generateTreeId(),
|
||||||
|
label: formData.name,
|
||||||
|
level: currentLevel.value,
|
||||||
|
description: formData.description,
|
||||||
|
parentId: currentNode.value?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentLevel.value === 1) {
|
||||||
|
// 新增车企
|
||||||
|
newNode.children = []
|
||||||
|
treeData.value.push(newNode)
|
||||||
|
} else if (currentNode.value) {
|
||||||
|
// 新增车型或版本
|
||||||
|
if (!currentNode.value.children) {
|
||||||
|
currentNode.value.children = []
|
||||||
|
}
|
||||||
|
currentNode.value.children.push(newNode)
|
||||||
|
}
|
||||||
|
} else if (currentAction.value === 'edit' && currentNode.value) {
|
||||||
|
// 编辑操作
|
||||||
|
currentNode.value.label = formData.name
|
||||||
|
currentNode.value.description = formData.description
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogVisible.value = false
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
emit('tree-update')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tree-panel {
|
||||||
|
height: 100%;
|
||||||
|
background: white;
|
||||||
|
border-right: 1px solid #e4e7ed;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-header {
|
||||||
|
padding: 16px;
|
||||||
|
border-bottom: 1px solid #e4e7ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-container {
|
||||||
|
flex: 1;
|
||||||
|
padding: 16px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tree-node {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 14px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node__content) {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node__content:hover) {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
49
src/views/is/func/index.vue
Normal file
49
src/views/is/func/index.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div class="is-container">
|
||||||
|
<!-- 左侧树形面板 -->
|
||||||
|
<div class="left-panel">
|
||||||
|
<TreePanel @node-click="handleNodeClick" @tree-update="handleTreeUpdate" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧功能表格 -->
|
||||||
|
<div class="right-panel">
|
||||||
|
<FunctionTable />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import TreePanel from './TreePanel/TreePanel.vue'
|
||||||
|
import FunctionTable from './FunctionTable/FunctionTable.vue'
|
||||||
|
|
||||||
|
function handleNodeClick(data) {
|
||||||
|
console.log('选中节点:', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTreeUpdate() {
|
||||||
|
console.log('树结构已更新')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.is-container {
|
||||||
|
display: flex;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-panel {
|
||||||
|
width: 300px;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-panel {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
93
src/views/is/im/Table/Dialog.vue
Normal file
93
src/views/is/im/Table/Dialog.vue
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="visible"
|
||||||
|
:title="title"
|
||||||
|
width="500px"
|
||||||
|
destroy-on-close
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="界面名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" placeholder="请输入界面名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
formData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['update:visible', 'confirm'])
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
|
|
||||||
|
// 表单验证规则
|
||||||
|
const formRules = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入界面名称', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const visible = ref(props.visible)
|
||||||
|
|
||||||
|
watch(() => props.visible, (newVal) => {
|
||||||
|
visible.value = newVal
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(visible, (newVal) => {
|
||||||
|
emit('update:visible', newVal)
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
|
||||||
|
formRef.value.validate((valid) => {
|
||||||
|
emit('confirm', valid, { ...props.formData })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
200
src/views/is/im/Table/Table.vue
Normal file
200
src/views/is/im/Table/Table.vue
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<div class="function-table">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="searchForm" class="search-form">
|
||||||
|
<el-form-item label="界面名称">
|
||||||
|
<el-input
|
||||||
|
v-model="searchForm.name"
|
||||||
|
placeholder="请输入界面名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input
|
||||||
|
v-model="searchForm.description"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 表格操作栏 -->
|
||||||
|
<div class="table-actions">
|
||||||
|
<el-button type="primary" @click="handleAddFunction">
|
||||||
|
<el-icon><Plus /></el-icon>
|
||||||
|
新增界面
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 界面表格 -->
|
||||||
|
<el-table :data="tableData" style="width: 100%">
|
||||||
|
<el-table-column prop="id" label="ID" width="80" />
|
||||||
|
<el-table-column prop="name" label="界面名称" min-width="120" />
|
||||||
|
<el-table-column prop="description" label="描述" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="createTime" label="创建日期" width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatDate(row.createTime) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button link type="danger" @click="handleDeleteFunction(row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 界面编辑对话框 -->
|
||||||
|
<FunctionDialog
|
||||||
|
v-model:visible="functionDialogVisible"
|
||||||
|
:title="functionDialogTitle"
|
||||||
|
:form-data="functionFormData"
|
||||||
|
@confirm="handleFunctionConfirm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { Plus } from '@element-plus/icons-vue'
|
||||||
|
import FunctionDialog from './Dialog.vue'
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '导航系统',
|
||||||
|
description: '提供实时导航和路线规划界面',
|
||||||
|
createTime: '2024-01-15 10:30:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '语音助手',
|
||||||
|
description: '支持语音控制和智能交互',
|
||||||
|
createTime: '2024-01-16 14:20:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '娱乐系统',
|
||||||
|
description: '音乐、视频播放和在线流媒体',
|
||||||
|
createTime: '2024-01-17 09:15:00'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 对话框相关
|
||||||
|
const functionDialogVisible = ref(false)
|
||||||
|
const functionDialogTitle = ref('')
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const functionFormData = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 生成ID
|
||||||
|
let functionIdCounter = 100
|
||||||
|
|
||||||
|
function generateFunctionId() {
|
||||||
|
return functionIdCounter++
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索界面
|
||||||
|
function handleSearch() {
|
||||||
|
// 实际项目中这里应该是API调用
|
||||||
|
ElMessage.info('执行搜索操作')
|
||||||
|
console.log('搜索条件:', searchForm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置搜索
|
||||||
|
function handleReset() {
|
||||||
|
searchForm.name = ''
|
||||||
|
searchForm.description = ''
|
||||||
|
handleSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增界面
|
||||||
|
function handleAddFunction() {
|
||||||
|
functionDialogTitle.value = '新增界面'
|
||||||
|
functionFormData.name = ''
|
||||||
|
functionFormData.description = ''
|
||||||
|
functionDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认界面操作
|
||||||
|
function handleFunctionConfirm(valid, formData) {
|
||||||
|
if (valid) {
|
||||||
|
const newFunction = {
|
||||||
|
id: generateFunctionId(),
|
||||||
|
name: formData.name,
|
||||||
|
description: formData.description,
|
||||||
|
createTime: new Date().toLocaleString('zh-CN')
|
||||||
|
}
|
||||||
|
|
||||||
|
tableData.value.unshift(newFunction)
|
||||||
|
functionDialogVisible.value = false
|
||||||
|
ElMessage.success('新增界面成功')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除界面
|
||||||
|
function handleDeleteFunction(row) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
`确定要删除界面"${row.name}"吗?`,
|
||||||
|
'警告',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
const index = tableData.value.findIndex(item => item.id === row.id)
|
||||||
|
if (index > -1) {
|
||||||
|
tableData.value.splice(index, 1)
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消删除
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化日期
|
||||||
|
function formatDate(dateString) {
|
||||||
|
return dateString
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.function-table {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-form {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-actions {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
139
src/views/is/im/TreePanel/TreePanel.vue
Normal file
139
src/views/is/im/TreePanel/TreePanel.vue
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tree-panel">
|
||||||
|
<div class="tree-header">
|
||||||
|
车机版本树
|
||||||
|
</div>
|
||||||
|
<div class="tree-container">
|
||||||
|
<el-tree
|
||||||
|
ref="treeRef"
|
||||||
|
:data="treeData"
|
||||||
|
node-key="id"
|
||||||
|
:props="treeProps"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
default-expand-all
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
>
|
||||||
|
<template #default="{ node, data }">
|
||||||
|
<span class="custom-tree-node">
|
||||||
|
<span>{{ node.label }}</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
// 定义 emits
|
||||||
|
const emit = defineEmits()
|
||||||
|
|
||||||
|
// 树形结构数据
|
||||||
|
const treeData = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
label: '特斯拉',
|
||||||
|
level: 1,
|
||||||
|
description: '电动汽车制造商',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 11,
|
||||||
|
label: 'Model 3',
|
||||||
|
level: 2,
|
||||||
|
description: '中型电动轿车',
|
||||||
|
parentId: 1,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 111,
|
||||||
|
label: 'V11.0',
|
||||||
|
level: 3,
|
||||||
|
description: '2023年车机系统版本',
|
||||||
|
parentId: 11
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
label: '比亚迪',
|
||||||
|
level: 1,
|
||||||
|
description: '中国新能源汽车品牌',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 21,
|
||||||
|
label: '汉 EV',
|
||||||
|
level: 2,
|
||||||
|
description: '旗舰电动轿车',
|
||||||
|
parentId: 2,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
id: 211,
|
||||||
|
label: 'DiLink 4.0',
|
||||||
|
level: 3,
|
||||||
|
description: '智能网联系统',
|
||||||
|
parentId: 21
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 树形配置
|
||||||
|
const treeProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'label'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 树节点点击
|
||||||
|
function handleNodeClick(data) {
|
||||||
|
emit('node-click', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tree-panel {
|
||||||
|
height: 100%;
|
||||||
|
background: white;
|
||||||
|
border-right: 1px solid #e4e7ed;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-header {
|
||||||
|
padding: 16px;
|
||||||
|
border-bottom: 1px solid #e4e7ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-container {
|
||||||
|
flex: 1;
|
||||||
|
padding: 16px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tree-node {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 14px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node__content) {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node__content:hover) {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
40
src/views/is/im/index.vue
Normal file
40
src/views/is/im/index.vue
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<template>
|
||||||
|
<div class="im-container">
|
||||||
|
<!-- 左侧树形面板 -->
|
||||||
|
<div class="left-panel">
|
||||||
|
<TreePanel @node-click="handleNodeClick" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧功能表格 -->
|
||||||
|
<div class="right-panel">
|
||||||
|
<Table />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import TreePanel from './TreePanel/TreePanel.vue'
|
||||||
|
import Table from './Table/Table.vue';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.im-container {
|
||||||
|
display: flex;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
width: 100%;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-panel {
|
||||||
|
width: 300px;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-panel {
|
||||||
|
flex: 1;
|
||||||
|
padding: 20px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
69
src/views/is/project/evaluate/index.vue
Normal file
69
src/views/is/project/evaluate/index.vue
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container">
|
||||||
|
<div class="info">
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">项目名称:</div>
|
||||||
|
<div class="text">理想L8测试</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">项目编号:</div>
|
||||||
|
<div class="text">CMVR20250729</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">测试人员:</div>
|
||||||
|
<div class="text">张栖瑞</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">计划测试时间:</div>
|
||||||
|
<div class="text">2025-07-29至2025-07-31</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">样品名称:</div>
|
||||||
|
<div class="text">理想L8</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">委托单位:</div>
|
||||||
|
<div class="text">招商车研</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">送样日期:</div>
|
||||||
|
<div class="text">2025-07-29</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="label">项目描述:</div>
|
||||||
|
<div class="text">语音测试AI-CAP</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup></script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
flex: 0 0 25%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
418
src/views/is/project/index.vue
Normal file
418
src/views/is/project/index.vue
Normal file
@ -0,0 +1,418 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div ref="topContainerRef">
|
||||||
|
<TableSearch
|
||||||
|
:queryParams="queryParams"
|
||||||
|
:showSearch="showSearch"
|
||||||
|
label-width="100px"
|
||||||
|
queryRef="queryRef"
|
||||||
|
@refresh="resetQuery"
|
||||||
|
@search="handleQuery"
|
||||||
|
>
|
||||||
|
<template #one>
|
||||||
|
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||||
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.projectName"
|
||||||
|
placeholder="请输入项目名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||||
|
<el-form-item label="测试人员" prop="tester">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.tester"
|
||||||
|
placeholder="请输入测试人员"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</TableSearch>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:project:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :style="containerHeight">
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
height="100%"
|
||||||
|
:data="projectList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="项目ID" align="center" prop="projectId" width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="项目名称" align="center" prop="projectName" width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="测试人员" align="center" prop="tester" />
|
||||||
|
<el-table-column
|
||||||
|
label="计划测试开始时间"
|
||||||
|
align="center"
|
||||||
|
prop="planStart"
|
||||||
|
width="180"
|
||||||
|
>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ parseTime(row.planStart) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划测试结束时间" align="center" prop="planEnd" width="180">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span>{{ parseTime(row.planEnd) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="项目描述" width="200" show-overflow-tooltip align="center" prop="description" />
|
||||||
|
<el-table-column label="项目状态" align="center" prop="status">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.status == 0 ? '已执行': '未执行' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="320px" class-name="small-padding fixed-width" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleSetting(row)"
|
||||||
|
v-hasPermi="['system:project:add','system:project:edit']"
|
||||||
|
>配置方案
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleEvaluate(row)"
|
||||||
|
v-hasPermi="['system:project:add','system:project:edit']"
|
||||||
|
>评价
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleExecute(row)"
|
||||||
|
v-hasPermi="['system:project:add','system:project:edit']"
|
||||||
|
>执行
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleUpdate(row)"
|
||||||
|
v-hasPermi="['system:project:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="handleDelete(row)"
|
||||||
|
v-hasPermi="['system:project:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加或修改语料库对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
v-model="open"
|
||||||
|
width="740px"
|
||||||
|
:append-to-body="false"
|
||||||
|
body-class="testProject_dialog"
|
||||||
|
>
|
||||||
|
<el-form ref="projectRef" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<div class="card">
|
||||||
|
<div class="form-title">项目信息</div>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
|
<el-input v-model="form.projectName" placeholder="请输入语料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="测试人员" prop="tester">
|
||||||
|
<el-input v-model="form.tester" placeholder="请输入测试人员" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="计划开始时间" prop="planStart">
|
||||||
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
v-model="form.planStart"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择计划测试开始时间"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="计划结束时间" prop="planEnd">
|
||||||
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
v-model="form.planEnd"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="请选择计划测试结束时间"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.sort"
|
||||||
|
placeholder="排序"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="项目描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="form.description"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入项目描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<Run
|
||||||
|
:drawer="executeOpen"
|
||||||
|
@close="executeOpen = false"
|
||||||
|
:currentRow="currentRow"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-drawer
|
||||||
|
v-model="openDashboard"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
:size="580"
|
||||||
|
:title="currentLog.projectName + '的流程'"
|
||||||
|
append-to-body
|
||||||
|
modal-class="rdashboad-log"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<el-card
|
||||||
|
v-for="item in taskRightList"
|
||||||
|
shadow="hover"
|
||||||
|
style="width: 100%; margin-bottom: 10px"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex align-center"
|
||||||
|
style="cursor: pointer"
|
||||||
|
@click="handleLogicFlow(item)"
|
||||||
|
>
|
||||||
|
<div>{{ item.name }}</div>
|
||||||
|
<div class="flex align-center" style="margin-left: 10px">
|
||||||
|
<el-icon>
|
||||||
|
<View />
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import TableSearch from "@/components/TableSearch/index.vue";
|
||||||
|
import { useContainerHeight } from "@/hooks/tableHeight";
|
||||||
|
|
||||||
|
const topContainerRef = ref();
|
||||||
|
const containerHeight = useContainerHeight(topContainerRef);
|
||||||
|
|
||||||
|
const projectList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
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,
|
||||||
|
projectName: null,
|
||||||
|
tester: null,
|
||||||
|
planStart: null,
|
||||||
|
planEnd: null,
|
||||||
|
description: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
projectName: [{ required: true, message: "项目名称不能为空", trigger: "blur" }],
|
||||||
|
tester: [{ required: true, message: "请输入测试人员", trigger: "blur" }],
|
||||||
|
planStart: [{ required: true, message: "请输入计划测试开始时间", trigger: "blur" }],
|
||||||
|
planEnd: [{ required: true, message: "请输入计划测试结束时间", trigger: "blur" }]
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询语音交互-项目列表 */
|
||||||
|
function getList() {
|
||||||
|
projectList.value = [
|
||||||
|
{
|
||||||
|
projectId: '1',
|
||||||
|
projectName: 'test',
|
||||||
|
tester: 'test',
|
||||||
|
planStart: '2025-11-24 11:08:01',
|
||||||
|
planEnd: '2025-11-25 11:08:01',
|
||||||
|
description: 'ssssss'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
projectId: null,
|
||||||
|
projectName: null,
|
||||||
|
tester: null,
|
||||||
|
planStart: null,
|
||||||
|
planEnd: null,
|
||||||
|
description: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map((item) => item.projectId);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加测试项目";
|
||||||
|
}
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const handleSetting = (row) => {
|
||||||
|
router.push('/is/plan/index/' + row.projectId)
|
||||||
|
}
|
||||||
|
|
||||||
|
const executeOpen = ref(false);
|
||||||
|
const currentRow = ref(undefined);
|
||||||
|
|
||||||
|
const handleExecute = (row) => {
|
||||||
|
currentRow.value = row;
|
||||||
|
executeOpen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentLog = ref({});
|
||||||
|
const openDashboard = ref(false);
|
||||||
|
const taskRightList = ref([]);
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function handleClose() {
|
||||||
|
openDashboard.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 评价
|
||||||
|
const handleEvaluate = (row) => {
|
||||||
|
router.push('/is/evaluate/index/' + row.projectId)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep() {
|
||||||
|
.testProject_dialog {
|
||||||
|
.el-date-editor {
|
||||||
|
--el-date-editor-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-number {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
box-shadow: 0px 0px 12px rgba(0, 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__view {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
179
src/views/is/project/plan/FunctionSelection.vue
Normal file
179
src/views/is/project/plan/FunctionSelection.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="btn-container">
|
||||||
|
<el-button type="primary" @click="openDialog">方案选择</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="selectList" height="260">
|
||||||
|
<el-table-column
|
||||||
|
label="功能名称"
|
||||||
|
align="center"
|
||||||
|
prop="corpusName"
|
||||||
|
width="150"
|
||||||
|
show-overflow-tooltip />
|
||||||
|
<el-table-column
|
||||||
|
label="功能图片"
|
||||||
|
align="center"
|
||||||
|
prop="textContent"
|
||||||
|
width="150"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column label="功能/界面" align="center" prop="voiceType" />
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-dialog title="选择功能" v-model="open" width="700px">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="功能名称" prop="corpusName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.corpusName"
|
||||||
|
placeholder="请输入功能名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="getList"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="getList"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
|
:data="corpusList"
|
||||||
|
:tree-props="{ checkStrictly: true }"
|
||||||
|
:row-key="rowKey"
|
||||||
|
:height="400"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
width="55"
|
||||||
|
align="center"
|
||||||
|
v-show="false"
|
||||||
|
:selectable="selectable"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="功能名称"
|
||||||
|
align="center"
|
||||||
|
prop="corpusName"
|
||||||
|
min-width="100"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="功能图片"
|
||||||
|
align="center"
|
||||||
|
prop="textContent"
|
||||||
|
min-width="200"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
|
<el-table-column label="是否功能" align="center" prop="voiceType" />
|
||||||
|
</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>
|
||||||
|
<script setup>
|
||||||
|
import { onMounted } from "vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
corpusIds: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(["updateSelectRows"]);
|
||||||
|
|
||||||
|
const selectList = ref([]);
|
||||||
|
const corpusList = ref([]);
|
||||||
|
|
||||||
|
const open = ref(false);
|
||||||
|
const openDialog = () => {
|
||||||
|
open.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
toggleRowSelection();
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleRowSelection = () => {
|
||||||
|
if (selectList.value.length > 0) {
|
||||||
|
corpusList.value.forEach((row) => {
|
||||||
|
selectList.value.forEach((item) => {
|
||||||
|
if (
|
||||||
|
item.parentId + (item?.corpusId || "") ===
|
||||||
|
row.parentId + (row?.corpusId || "")
|
||||||
|
) {
|
||||||
|
tableRef.value.toggleRowSelection(row, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowKey = (row) => {
|
||||||
|
return row.parentId + (row?.corpusId || "");
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectable = (row) => {
|
||||||
|
if (row.continuous + "" === "0") {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100000,
|
||||||
|
corpusName: '',
|
||||||
|
continuous: 1
|
||||||
|
})
|
||||||
|
const getList = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
queryParams.value.corpusName = ''
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
const submitForm = () => {
|
||||||
|
const rows = tableRef.value.getSelectionRows();
|
||||||
|
selectList.value = rows;
|
||||||
|
open.value = false;
|
||||||
|
emits("updateSelectRows", rows);
|
||||||
|
resetForm()
|
||||||
|
};
|
||||||
|
|
||||||
|
const cancel = () => {
|
||||||
|
open.value = false;
|
||||||
|
resetForm()
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSelectList = (corpusIds) => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
if (props.corpusIds) {
|
||||||
|
getSelectList(props.corpusIds.split(","));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.btn-container {
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
295
src/views/is/project/plan/index.vue
Normal file
295
src/views/is/project/plan/index.vue
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div ref="topContainerRef">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="方案名称" prop="schemeName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.schemeName"
|
||||||
|
placeholder="请输入方案名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.remark"
|
||||||
|
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="['system:scheme:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:scheme:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:scheme:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :style="containerHeight">
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="schemeList"
|
||||||
|
height="100%"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="方案ID" align="center" prop="schemeId" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="所属项目ID" align="center" prop="projectId" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="方案名称" align="center" prop="schemeName" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column label="排序" align="center" prop="sort" />
|
||||||
|
<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="200"
|
||||||
|
fixed="right"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:scheme:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:scheme: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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 添加或修改语音交互-方案对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
v-model="open"
|
||||||
|
width="700px"
|
||||||
|
:append-to-body="false"
|
||||||
|
body-class="plan_dialog"
|
||||||
|
>
|
||||||
|
<el-form ref="schemeRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="方案名称" prop="schemeName">
|
||||||
|
<el-input v-model="form.schemeName" placeholder="请输入方案名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="播放配置" prop="sceneType">
|
||||||
|
<el-select
|
||||||
|
v-model="form.sceneType"
|
||||||
|
placeholder="Select"
|
||||||
|
style="width: 240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in settingOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" :step="1" step-strictly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div>功能选择</div>
|
||||||
|
|
||||||
|
<FunctionSelection />
|
||||||
|
|
||||||
|
<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 { onMounted } from "vue";
|
||||||
|
import { useContainerHeight } from "@/hooks/tableHeight";
|
||||||
|
import FunctionSelection from "./FunctionSelection.vue";
|
||||||
|
|
||||||
|
const topContainerRef = ref();
|
||||||
|
const containerHeight = useContainerHeight(topContainerRef);
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const schemeList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
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: {
|
||||||
|
corpusIds: null,
|
||||||
|
},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
projectId: route.params.id,
|
||||||
|
schemeName: null,
|
||||||
|
corpusIds: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
projectId: [
|
||||||
|
{ required: true, message: "所属项目ID不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
schemeName: [
|
||||||
|
{ required: true, message: "方案名称不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询语音交互-方案列表 */
|
||||||
|
function getList() {
|
||||||
|
schemeList.value = [
|
||||||
|
{
|
||||||
|
schemeId: 1,
|
||||||
|
schemeName: 'test',
|
||||||
|
projectId: 1,
|
||||||
|
sort: 1,
|
||||||
|
remark: '1111',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
schemeId: null,
|
||||||
|
schemeName: null,
|
||||||
|
corpusIds: null,
|
||||||
|
remark: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map((item) => item.schemeId);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
const settingOptions = [
|
||||||
|
{ value: 1, label: "唤醒场景" },
|
||||||
|
{ value: 2, label: "单次对话场景" },
|
||||||
|
{ value: 3, label: "连续对话场景" },
|
||||||
|
];
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加方案";
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep() {
|
||||||
|
.plan_dialog {
|
||||||
|
.el-select {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__view {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user