Commit 0a220e4a by Lin

feat(MultipleCourse): 优化自选课程组件,增加课程搜索和分类功能

- 重构自选课程组件,优化模板结构,增强用户体验
- 新增课程搜索功能,支持按课程名称、所属目录和标签进行筛选
- 增加课程分类显示,提升信息展示的清晰度
- 调整表格布局,确保与新表单设计一致
1 parent eeee5cfa
......@@ -18,8 +18,7 @@
<div class="form-row">
<el-form-item label="课程搜索:">
<el-input v-model="courseForm.courseName"
prefix-icon="el-icon-search"
placeholder="课程/标签搜索"
placeholder="课程搜索"
clearable />
</el-form-item>
<el-form-item label="所属目录:">
......@@ -94,6 +93,36 @@
</div>
</div>
</template>
<!-- 所属目录 -->
<template #categoryName="scope">
<div>
<span v-if="(scope.scope.categoryName || '').length < 8">
{{
(scope.scope.categoryName || '').slice(0, 8)
}}
</span>
<div v-else>
<el-tooltip class="item"
effect="light"
:content="scope.scope.categoryName"
placement="top-start">
<span> {{ (scope.scope.categoryName || '').slice(0, 8) }}...</span>
</el-tooltip>
</div>
</div>
</template>
<!-- 标签 -->
<template #tagNameHtml="scope">
<div v-if="parseTagNames(scope.scope.tagName).length"
class="course-tag-list">
<span v-for="(tag, index) in parseTagNames(scope.scope.tagName)"
:key="index"
class="course-tag-item">
{{ tag }}
</span>
</div>
<span v-else>-</span>
</template>
<!-- 状态 -->
<template #statusHtml="scope">
<el-tooltip v-if="scope.scope.status == 2 || scope.scope.status == 5"
......@@ -163,6 +192,36 @@
</div>
</div>
</template>
<!-- 所属目录 -->
<template #categoryName="scope">
<div>
<span v-if="(scope.scope.categoryName || '').length < 8">
{{
(scope.scope.categoryName || '').slice(0, 8)
}}
</span>
<div v-else>
<el-tooltip class="item"
effect="light"
:content="scope.scope.categoryName"
placement="top-start">
<span> {{ (scope.scope.categoryName || '').slice(0, 8) }}...</span>
</el-tooltip>
</div>
</div>
</template>
<!-- 标签 -->
<template #tagNameHtml="scope">
<div v-if="parseTagNames(scope.scope.tagName).length"
class="course-tag-list">
<span v-for="(tag, index) in parseTagNames(scope.scope.tagName)"
:key="index"
class="course-tag-item">
{{ tag }}
</span>
</div>
<span v-else>-</span>
</template>
<!-- 状态 -->
<template #statusHtml="scope">
<el-tooltip v-if="scope.scope.status == 2 || scope.scope.status == 5"
......@@ -286,12 +345,14 @@ export default {
{
label: "所属目录",
prop: "categoryName",
width: "88px",
width: "130px",
addHtml: "categoryName",
},
{
label: "标签",
prop: "tagName",
width: "88px",
width: "120px",
addHtml: "tagNameHtml",
},
{
label: "课程状态",
......@@ -343,12 +404,14 @@ export default {
{
label: "所属目录",
prop: "categoryName",
width: "88px",
width: "120px",
addHtml: "categoryName",
},
{
label: "标签",
prop: "tagName",
width: "88px",
width: "120px",
addHtml: "tagNameHtml",
},
{
label: "课程状态",
......@@ -433,6 +496,11 @@ export default {
let item = baseData[optKey].find(item => item.confId == row[rowKey]);
return (item && item.confValue) || "-";
},
parseTagNames(tagName) {
if (!tagName || typeof tagName !== "string")
return [];
return tagName.split(",").map(tag => tag.trim()).filter(Boolean);
},
reset() {
this.selected = [];
this.selectCourseList = [];
......@@ -888,6 +956,26 @@ export default {
margin: 8px auto;
}
.course-tag-list {
display: flex;
flex-wrap: nowrap;
overflow: hidden;
justify-content: center;
max-width: 100%;
gap: 4px;
padding: 0 6px;
}
.course-tag-item {
flex-shrink: 0;
border-radius: 2px;
border: 1px solid #e5e5e5;
background: #f8faff;
color: #333;
font-size: 12px;
padding: 0 6px;
line-height: 20px;
white-space: nowrap;
}
.status {
padding: 2px 8px;
font-size: 12px;
......
......@@ -175,9 +175,9 @@
@handleMultiple="handleConfirmMultiple">
</MultipleDialog>
<!-- 新增课程 -->
<AllocationDialog v-if="!isVisible"
<AllocationDialog v-if="isVisible"
ref="allocationDialog"
:is-visible="!isVisible"
:is-visible="isVisible"
:selected-rows="selectStaffCourseList"
:staff-item="staffItem"
@handleClose="handleCloseCouseDialog"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!