提交 019d9053 authored 作者: 王鹏飞's avatar 王鹏飞

feat: 添加状态过滤器到班级、专业、学期和课程列表

上级 ea02d53e
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
import PreviewFiles from './PreviewFiles.vue' import PreviewFiles from './PreviewFiles.vue'
let dialogVisible = ref(false) let dialogVisible = ref(false)
const protocol = ref(false) const protocol = ref(true)
const prop = defineProps({ const prop = defineProps({
select: Boolean select: Boolean,
}) })
const item = { const item = {
url: '/center_resource/紫荆教育用户入驻及网络教学资源协议.docx' url: '/center_resource/紫荆教育用户入驻及网络教学资源协议.docx',
} }
const emit = defineEmits(['change']) const emit = defineEmits(['change'])
......
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取班级列表 // 获取班级列表
export function getClassList(params?: { name?: string; organ_id?: string; page?: string; 'per-page'?: string }) { export function getClassList(params?: { name?: string; organ_id?: string; status?: string; page?: string; 'per-page'?: string }) {
return httpRequest.get('/api/resource/v1/learning/class/list', { params }) return httpRequest.get('/api/resource/v1/learning/class/list', { params })
} }
// 添加班级 // 添加班级
......
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useProjectList } from '@/composables/useGetProjectList' import { useProjectList } from '@/composables/useGetProjectList'
import { useMapStore } from '@/stores/map'
import AddClass from '../components/AddClass.vue' import AddClass from '../components/AddClass.vue'
import ClassStudents from '../components/ClassStudents.vue' import ClassStudents from '../components/ClassStudents.vue'
...@@ -10,6 +11,7 @@ import { getClassList, updateClass } from '../api' ...@@ -10,6 +11,7 @@ import { getClassList, updateClass } from '../api'
import ImportClass from '../components/ImportClass.vue' import ImportClass from '../components/ImportClass.vue'
const departmentList: any = useProjectList('', '79806610719731712').departmentList const departmentList: any = useProjectList('', '79806610719731712').departmentList
const store = useMapStore()
// 判断当前用户是不是超级管理员 // 判断当前用户是不是超级管理员
const user = useUserStore().roles const user = useUserStore().roles
...@@ -23,10 +25,11 @@ const isShowClassStuDialog = ref(false) ...@@ -23,10 +25,11 @@ const isShowClassStuDialog = ref(false)
const isRelatingDialog = ref(false) const isRelatingDialog = ref(false)
const listOptions = computed(() => { const listOptions = computed(() => {
return { return {
remote: { httpRequest: getClassList, params: { name: '', organ_id: '' } }, remote: { httpRequest: getClassList, params: { name: '', organ_id: '', status: '' } },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '班级名称:', placeholder: '班级名称' }, { type: 'input', prop: 'name', label: '班级名称:', placeholder: '班级名称' },
{ type: 'select', prop: 'organ_id', slots: 'filter-department' } { type: 'select', prop: 'organ_id', slots: 'filter-department' },
{ type: 'select', prop: 'status', label: '状态:', options: store.getMapValuesByKey('system_status') },
], ],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
......
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取专业列表 // 获取专业列表
export function getProList(params?: { name?: string; page?: string; 'per-page'?: string }) { export function getProList(params?: { name?: string; status?: string; page?: string; 'per-page'?: string }) {
return httpRequest.get('/api/resource/v1/backend/specialty/list', { params }) return httpRequest.get('/api/resource/v1/backend/specialty/list', { params })
} }
// 创建专业 // 创建专业
......
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { getProList, updatePro } from '../api' import { getProList, updatePro } from '../api'
import { useMapStore } from '@/stores/map'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import AddPro from '../components/AddPro.vue' import AddPro from '../components/AddPro.vue'
import ImportPro from '../components/ImportPro.vue' import ImportPro from '../components/ImportPro.vue'
// 判断当前用户是不是超级管理员 // 判断当前用户是不是超级管理员
const user = useUserStore().roles const user = useUserStore().roles
const isAdmin = !!user.find((item: any) => item.name === '超级管理员') const isAdmin = !!user.find((item: any) => item.name === '超级管理员')
const store = useMapStore()
const appList = ref() const appList = ref()
const title = ref('') const title = ref('')
const id = ref('') const id = ref('')
...@@ -14,8 +16,11 @@ const isEdit = ref('') ...@@ -14,8 +16,11 @@ const isEdit = ref('')
const isShowProDialog = ref(false) const isShowProDialog = ref(false)
const listOptions = computed(() => { const listOptions = computed(() => {
return { return {
remote: { httpRequest: getProList, params: { name: '' } }, remote: { httpRequest: getProList, params: { name: '', status: '' } },
filters: [{ type: 'input', prop: 'name', label: '专业名称:', placeholder: '专业名称' }], filters: [
{ type: 'input', prop: 'name', label: '专业名称:', placeholder: '专业名称' },
{ type: 'select', prop: 'status', label: '状态:', options: store.getMapValuesByKey('system_status') },
],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
{ label: '专业代码', prop: 'code', align: 'center' }, { label: '专业代码', prop: 'code', align: 'center' },
......
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取学期列表 // 获取学期列表
export function getSemList(params?: { name?: string; organ_id?: string; page?: number; page_size?: number }) { export function getSemList(params?: { name?: string; organ_id?: string; status?: string; page?: number; page_size?: number }) {
return httpRequest.get('/api/resource/v1/learning/semester/list', { params }) return httpRequest.get('/api/resource/v1/learning/semester/list', { params })
} }
......
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useProjectList } from '@/composables/useGetProjectList' import { useProjectList } from '@/composables/useGetProjectList'
import { useMapStore } from '@/stores/map'
import AddSemester from '../components/AddSemester.vue' import AddSemester from '../components/AddSemester.vue'
import SemesterCourse from '../components/SemesterCourse.vue' import SemesterCourse from '../components/SemesterCourse.vue'
import ImportSemester from '../components/ImportSemester.vue' import ImportSemester from '../components/ImportSemester.vue'
import { getSemList, updateSem } from '../api' import { getSemList, updateSem } from '../api'
const departmentList: any = useProjectList('', '79806610719731712').departmentList const departmentList: any = useProjectList('', '79806610719731712').departmentList
const store = useMapStore()
// 判断当前用户是不是超级管理员 // 判断当前用户是不是超级管理员
const user = useUserStore().roles const user = useUserStore().roles
const isAdmin = !!user.find((item: any) => item.name === '超级管理员') const isAdmin = !!user.find((item: any) => item.name === '超级管理员')
...@@ -18,10 +20,11 @@ const isShowAddSemDialog = ref(false) ...@@ -18,10 +20,11 @@ const isShowAddSemDialog = ref(false)
const isShowSemCourseDialog = ref(false) const isShowSemCourseDialog = ref(false)
const listOptions = computed(() => { const listOptions = computed(() => {
return { return {
remote: { httpRequest: getSemList, params: { name: '', organ_id: '' } }, remote: { httpRequest: getSemList, params: { name: '', organ_id: '', status: '' } },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '学期名称:', placeholder: '学期名称' }, { type: 'input', prop: 'name', label: '学期名称:', placeholder: '学期名称' },
{ type: 'select', prop: 'organ_id', slots: 'filter-department' }, { type: 'select', prop: 'organ_id', slots: 'filter-department' },
{ type: 'select', prop: 'status', label: '状态:', options: store.getMapValuesByKey('system_status') },
], ],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
......
...@@ -21,6 +21,7 @@ export function getVideoDetails(params: { id: string }) { ...@@ -21,6 +21,7 @@ export function getVideoDetails(params: { id: string }) {
// 获取课程列表 // 获取课程列表
export function getCourseList(params: { export function getCourseList(params: {
tab: string tab: string
status?: string
name?: string name?: string
authorized?: string authorized?: string
page?: number page?: number
......
...@@ -4,6 +4,7 @@ import { getCourseList } from '../api' ...@@ -4,6 +4,7 @@ import { getCourseList } from '../api'
import CardListItem from '../components/CardListItem.vue' import CardListItem from '../components/CardListItem.vue'
import { PictureFilled } from '@element-plus/icons-vue' import { PictureFilled } from '@element-plus/icons-vue'
import { useProjectList } from '@/composables/useGetProjectList' import { useProjectList } from '@/composables/useGetProjectList'
import { useMapStore } from '@/stores/map'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
// 统计资源数据整合 // 统计资源数据整合
...@@ -12,6 +13,7 @@ import Statistics from '../components/Statistics.vue' ...@@ -12,6 +13,7 @@ import Statistics from '../components/Statistics.vue'
// 判断当前用户是不是超级管理员 // 判断当前用户是不是超级管理员
const user = useUserStore().roles const user = useUserStore().roles
const isAdmin = !!user.find((item: any) => item.name === '超级管理员') const isAdmin = !!user.find((item: any) => item.name === '超级管理员')
const store = useMapStore()
// 筛选部门列表 // 筛选部门列表
const departmentList: any = useProjectList('', '79806610719731712').departmentList const departmentList: any = useProjectList('', '79806610719731712').departmentList
...@@ -63,6 +65,12 @@ const listOptions = computed(() => { ...@@ -63,6 +65,12 @@ const listOptions = computed(() => {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department', slots: 'filter-department',
}, },
{
type: 'select',
prop: 'status',
label: '状态:',
options: store.getMapValuesByKey('system_status'),
},
], ],
columns, columns,
} }
......
...@@ -69,14 +69,14 @@ const listOptions = computed(() => { ...@@ -69,14 +69,14 @@ const listOptions = computed(() => {
params: { tab: tabValue, status: '', authorized: '', name: '' }, params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '标题:' },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status'), options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department', slots: 'filter-department',
......
...@@ -25,7 +25,7 @@ const form: any = reactive({ ...@@ -25,7 +25,7 @@ const form: any = reactive({
knowledge_points: '', knowledge_points: '',
url: '', url: '',
type: '', type: '',
size: '' size: '',
}) })
// 编辑数据回显 // 编辑数据回显
...@@ -35,8 +35,8 @@ if (isUpdate.value) { ...@@ -35,8 +35,8 @@ if (isUpdate.value) {
form.file = [ form.file = [
{ {
name: res.data.name, name: res.data.name,
url: res.data.url url: res.data.url,
} },
] ]
}) })
} }
...@@ -46,22 +46,22 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -46,22 +46,22 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 监听文件上传 // 监听文件上传
watch( watch(
() => form.file, () => form.file,
value => { (value) => {
form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.')) || '' form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.')) || ''
} },
) )
// 表单验证 // 表单验证
const rules = { const rules = {
name: [{ required: true, message: '请输入标题', trigger: 'blur' }], name: [{ required: true, message: '请输入标题', trigger: 'blur' }],
classification: [{ required: true, message: '请选择分类', trigger: 'change' }], classification: [{ required: true, message: '请选择分类', trigger: 'change' }],
file: [{ required: true, message: '' }] file: [{ required: true, message: '' }],
} }
// 新建编辑表单提交 // 新建编辑表单提交
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
...@@ -71,7 +71,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { ...@@ -71,7 +71,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
if (!submitFlag) return if (!submitFlag) return
submitFlag = false submitFlag = false
await formEl.validate(valid => { await formEl.validate((valid) => {
if (valid) { if (valid) {
if (!protocol.value) { if (!protocol.value) {
submitFlag = true submitFlag = true
...@@ -106,7 +106,7 @@ const updateResources = (params: any) => { ...@@ -106,7 +106,7 @@ const updateResources = (params: any) => {
ElMessage({ message: '更新成功', type: 'success' }) ElMessage({ message: '更新成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/courseware' path: '/resource/courseware',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -126,7 +126,7 @@ const createResources = (params: any) => { ...@@ -126,7 +126,7 @@ const createResources = (params: any) => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/courseware' path: '/resource/courseware',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -139,7 +139,7 @@ const createResources = (params: any) => { ...@@ -139,7 +139,7 @@ const createResources = (params: any) => {
} }
// 协议 // 协议
const protocol = ref(false) const protocol = ref(true)
const changeProtocol = (data: any) => { const changeProtocol = (data: any) => {
protocol.value = data.value protocol.value = data.value
...@@ -173,8 +173,7 @@ const changeProtocol = (data: any) => { ...@@ -173,8 +173,7 @@ const changeProtocol = (data: any) => {
:data="selectTree" :data="selectTree"
placeholder="请选择课件分类" placeholder="请选择课件分类"
node-key="id" node-key="id"
:default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" :default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" />
/>
</el-form-item> </el-form-item>
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:"> <el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:">
<el-input <el-input
...@@ -182,8 +181,7 @@ const changeProtocol = (data: any) => { ...@@ -182,8 +181,7 @@ const changeProtocol = (data: any) => {
maxlength="100" maxlength="100"
v-model="form.knowledge_points" v-model="form.knowledge_points"
:rows="2" :rows="2"
type="textarea" type="textarea" />
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="protocol-box"> <div class="protocol-box">
......
...@@ -69,14 +69,14 @@ const listOptions = computed(() => { ...@@ -69,14 +69,14 @@ const listOptions = computed(() => {
params: { tab: tabValue, status: '', authorized: '', name: '' }, params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '标题:' },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status'), options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department', slots: 'filter-department',
......
...@@ -25,7 +25,7 @@ const form: any = reactive({ ...@@ -25,7 +25,7 @@ const form: any = reactive({
knowledge_points: '', knowledge_points: '',
url: '', url: '',
type: '', type: '',
size: '' size: '',
}) })
// 编辑数据回显 // 编辑数据回显
...@@ -35,8 +35,8 @@ if (isUpdate.value) { ...@@ -35,8 +35,8 @@ if (isUpdate.value) {
form.file = [ form.file = [
{ {
name: res.data.name, name: res.data.name,
url: res.data.url url: res.data.url,
} },
] ]
}) })
} }
...@@ -46,24 +46,24 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -46,24 +46,24 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 监听文件上传 // 监听文件上传
watch( watch(
() => form.file, () => form.file,
value => { (value) => {
if (value[0]?.name.lastIndexOf('.') != -1) { if (value[0]?.name.lastIndexOf('.') != -1) {
form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.')) || '' form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.')) || ''
} }
} },
) )
// 表单验证 // 表单验证
const rules = { const rules = {
name: [{ required: true, message: '请输入标题', trigger: 'blur' }], name: [{ required: true, message: '请输入标题', trigger: 'blur' }],
classification: [{ required: true, message: '请选择分类', trigger: 'change' }], classification: [{ required: true, message: '请选择分类', trigger: 'change' }],
file: [{ required: true, message: '' }] file: [{ required: true, message: '' }],
} }
// 新建编辑表单提交 // 新建编辑表单提交
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
...@@ -72,7 +72,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { ...@@ -72,7 +72,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!submitFlag) return if (!submitFlag) return
submitFlag = false submitFlag = false
if (!formEl) return if (!formEl) return
await formEl.validate(valid => { await formEl.validate((valid) => {
if (valid) { if (valid) {
if (!protocol.value) { if (!protocol.value) {
submitFlag = true submitFlag = true
...@@ -107,7 +107,7 @@ const updateResources = (params: any) => { ...@@ -107,7 +107,7 @@ const updateResources = (params: any) => {
ElMessage({ message: '更新成功', type: 'success' }) ElMessage({ message: '更新成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/lessonplan' path: '/resource/lessonplan',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -127,7 +127,7 @@ const createResources = (params: any) => { ...@@ -127,7 +127,7 @@ const createResources = (params: any) => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/lessonplan' path: '/resource/lessonplan',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -140,7 +140,7 @@ const createResources = (params: any) => { ...@@ -140,7 +140,7 @@ const createResources = (params: any) => {
} }
// 协议 // 协议
const protocol = ref(false) const protocol = ref(true)
const changeProtocol = (data: any) => { const changeProtocol = (data: any) => {
protocol.value = data.value protocol.value = data.value
...@@ -173,8 +173,7 @@ const changeProtocol = (data: any) => { ...@@ -173,8 +173,7 @@ const changeProtocol = (data: any) => {
v-model="form.classification" v-model="form.classification"
:data="selectTree" :data="selectTree"
node-key="id" node-key="id"
:default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" :default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" />
/>
</el-form-item> </el-form-item>
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:"> <el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:">
<el-input <el-input
...@@ -182,8 +181,7 @@ const changeProtocol = (data: any) => { ...@@ -182,8 +181,7 @@ const changeProtocol = (data: any) => {
maxlength="100" maxlength="100"
v-model="form.knowledge_points" v-model="form.knowledge_points"
:rows="2" :rows="2"
type="textarea" type="textarea" />
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="protocol-box"> <div class="protocol-box">
......
...@@ -70,14 +70,14 @@ const listOptions = computed(() => { ...@@ -70,14 +70,14 @@ const listOptions = computed(() => {
params: { tab: tabValue, status: '', authorized: '', name: '' }, params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '标题:' },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status'), options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department', slots: 'filter-department',
......
...@@ -25,7 +25,7 @@ const form: any = reactive({ ...@@ -25,7 +25,7 @@ const form: any = reactive({
knowledge_points: '', knowledge_points: '',
url: '', url: '',
type: '', type: '',
size: '' size: '',
}) })
// 编辑数据回显 // 编辑数据回显
...@@ -35,8 +35,8 @@ if (isUpdate.value) { ...@@ -35,8 +35,8 @@ if (isUpdate.value) {
form.file = [ form.file = [
{ {
name: res.data.name, name: res.data.name,
url: res.data.url url: res.data.url,
} },
] ]
}) })
} }
...@@ -46,26 +46,26 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -46,26 +46,26 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 监听文件上传 // 监听文件上传
watch( watch(
() => form.file, () => form.file,
value => { (value) => {
if (value[0]?.name.includes('.')) { if (value[0]?.name.includes('.')) {
form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.')) form.name = value[0]?.name.slice(0, value[0]?.name.lastIndexOf('.'))
} else { } else {
form.name = value[0]?.name || '' form.name = value[0]?.name || ''
} }
} },
) )
// 表单验证 // 表单验证
const rules = { const rules = {
name: [{ required: true, message: '请输入标题', trigger: 'blur' }], name: [{ required: true, message: '请输入标题', trigger: 'blur' }],
classification: [{ required: true, message: '请选择分类', trigger: 'change' }], classification: [{ required: true, message: '请选择分类', trigger: 'change' }],
file: [{ required: true, message: '' }] file: [{ required: true, message: '' }],
} }
// 新建编辑表单提交 // 新建编辑表单提交
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
...@@ -74,7 +74,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { ...@@ -74,7 +74,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!submitFlag) return if (!submitFlag) return
submitFlag = false submitFlag = false
if (!formEl) return if (!formEl) return
await formEl.validate(valid => { await formEl.validate((valid) => {
if (valid) { if (valid) {
if (!protocol.value) { if (!protocol.value) {
submitFlag = true submitFlag = true
...@@ -109,7 +109,7 @@ const updateResources = (params: any) => { ...@@ -109,7 +109,7 @@ const updateResources = (params: any) => {
ElMessage({ message: '更新成功', type: 'success' }) ElMessage({ message: '更新成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/other' path: '/resource/other',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -129,7 +129,7 @@ const createResources = (params: any) => { ...@@ -129,7 +129,7 @@ const createResources = (params: any) => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/other' path: '/resource/other',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -142,7 +142,7 @@ const createResources = (params: any) => { ...@@ -142,7 +142,7 @@ const createResources = (params: any) => {
} }
// 协议 // 协议
const protocol = ref(false) const protocol = ref(true)
const changeProtocol = (data: any) => { const changeProtocol = (data: any) => {
protocol.value = data.value protocol.value = data.value
...@@ -159,8 +159,7 @@ const changeProtocol = (data: any) => { ...@@ -159,8 +159,7 @@ const changeProtocol = (data: any) => {
<AppUpload <AppUpload
accept=".doc,.docx,.xls,.xlsx,.pdf,.ppt,.pptx,.mp3,.mp4,.png,.jpeg,.jpg,.rar,.zip" accept=".doc,.docx,.xls,.xlsx,.pdf,.ppt,.pptx,.mp3,.mp4,.png,.jpeg,.jpg,.rar,.zip"
:limit="1" :limit="1"
v-model="form.file" v-model="form.file"></AppUpload>
></AppUpload>
<div class="upload-btn">本地文件</div> <div class="upload-btn">本地文件</div>
</div> </div>
</div> </div>
...@@ -180,8 +179,7 @@ const changeProtocol = (data: any) => { ...@@ -180,8 +179,7 @@ const changeProtocol = (data: any) => {
style="width: 100%" style="width: 100%"
v-model="form.classification" v-model="form.classification"
:data="selectTree" :data="selectTree"
:default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" :default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" />
/>
</el-form-item> </el-form-item>
<el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:"> <el-form-item label="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;知识点:">
<el-input <el-input
...@@ -189,8 +187,7 @@ const changeProtocol = (data: any) => { ...@@ -189,8 +187,7 @@ const changeProtocol = (data: any) => {
maxlength="100" maxlength="100"
v-model="form.knowledge_points" v-model="form.knowledge_points"
:rows="2" :rows="2"
type="textarea" type="textarea" />
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="protocol-box"> <div class="protocol-box">
......
...@@ -69,14 +69,14 @@ const listOptions = computed(() => { ...@@ -69,14 +69,14 @@ const listOptions = computed(() => {
params: { tab: tabValue, status: '', authorized: '', name: '' }, params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '标题:' },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status'), options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department', slots: 'filter-department',
......
...@@ -32,13 +32,13 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -32,13 +32,13 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 视频封面图轮播 // 视频封面图轮播
const swiperCovers = ref<{ id: string; url: string }[][]>([[]]) const swiperCovers = ref<{ id: string; url: string }[][]>([[]])
// 获取封面 // 获取封面
getCoverList().then(res => { getCoverList().then((res) => {
const filtersData = res.data.list.filter((i: any) => i.type === '1') const filtersData = res.data.list.filter((i: any) => i.type === '1')
let index = 0 let index = 0
while (index < filtersData.length) { while (index < filtersData.length) {
...@@ -61,13 +61,13 @@ const swiperItemHandle = (url: string) => { ...@@ -61,13 +61,13 @@ const swiperItemHandle = (url: string) => {
// form表单 // form表单
let form = reactive({ let form = reactive({
data: { name: '', source: '2', classification: '', knowledge_points: '', cover: '', source_id: '', size: 0 } data: { name: '', source: '2', classification: '', knowledge_points: '', cover: '', source_id: '', size: 0 },
}) })
// 表单验证 // 表单验证
const rules = { const rules = {
name: [{ required: true, message: '请输入标题', trigger: 'blur' }], name: [{ required: true, message: '请输入标题', trigger: 'blur' }],
classification: [{ required: true, message: '请选择分类', trigger: 'change' }], classification: [{ required: true, message: '请选择分类', trigger: 'change' }],
source_id: [{ required: true, message: '' }] source_id: [{ required: true, message: '' }],
} }
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
let submitFlag = true let submitFlag = true
...@@ -75,7 +75,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { ...@@ -75,7 +75,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
if (!submitFlag) return if (!submitFlag) return
submitFlag = false submitFlag = false
if (!formEl) return if (!formEl) return
await formEl.validate(valid => { await formEl.validate((valid) => {
if (valid) { if (valid) {
if (!protocol.value) { if (!protocol.value) {
submitFlag = true submitFlag = true
...@@ -103,7 +103,7 @@ const updateResources = () => { ...@@ -103,7 +103,7 @@ const updateResources = () => {
ElMessage({ message: '更新成功', type: 'success' }) ElMessage({ message: '更新成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/video' path: '/resource/video',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -123,7 +123,7 @@ const createResources = () => { ...@@ -123,7 +123,7 @@ const createResources = () => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
setTimeout(() => { setTimeout(() => {
router.push({ router.push({
path: '/resource/video' path: '/resource/video',
}) })
}, 1000) }, 1000)
} else { } else {
...@@ -136,7 +136,7 @@ const createResources = () => { ...@@ -136,7 +136,7 @@ const createResources = () => {
} }
// 协议勾选 // 协议勾选
const protocol = ref(false) const protocol = ref(true)
// 上传视频成功 // 上传视频成功
const uploadVideo = (data: any) => { const uploadVideo = (data: any) => {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论