@ -1,263 +1,25 @@ |
||||
import Setting from "@/setting"; |
||||
const host = Setting.apiBaseURL |
||||
const uploadURL = Setting.upload.apiURL; |
||||
const host1 = "http://121.37.12.51:8080/" |
||||
const host1 = 'http://192.168.31.151:10000/' |
||||
|
||||
export default { |
||||
queryToken: `liuwanr/userInfo/queryToken`, |
||||
|
||||
logins: `users/users/user/login`, //登录
|
||||
verification: `${host}users/users/user/captcha`,// 验证码图片
|
||||
isClient: `users/users/user/isClient`,// 是否为客户
|
||||
getUserAllRoleByToken : `users/users/role/getUserAllRoleByToken`, |
||||
getSchoolIdByToken : `users/users/data/user/getSchoolIdByToken`, |
||||
|
||||
platformLogList: `nakadai/nakadai/log/platformLogList`, |
||||
logNotification: `nakadai/nakadai/log/logNotification`, |
||||
//实验台
|
||||
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情
|
||||
curriculumChapter: `nakadai/nakadai/curriculum/chapter/queryChaptersAndSubsections`, // 根据课程id查询章节小节,树状结构
|
||||
curriculumGetSubsection: `nakadai/nakadai/curriculum/subsection/getSubsection`, // 根据小节id获取预览文件地址
|
||||
|
||||
// 权限管理
|
||||
getUserRolesPermissionMenu: `users/users/user-role/getUserRolesPermissionMenu`, |
||||
|
||||
//学生管理
|
||||
resetPassword: `users/users/userAccount/resetPwd`, // 密码重置
|
||||
updateAccountEnable: `occupationlab/occupationlab/architecture/updateAccountEnable`, // 密码重置
|
||||
checkEmailOrPhone: `occupationlab/occupationlab/architecture/checkEmailOrPhone`, // 新增学生前:校验手机号或者邮箱
|
||||
checkWorkNumOrAccount: `occupationlab/occupationlab/architecture/checkWorkNumOrAccount`, // 新增/编辑学生前:校验学号或者学生账号
|
||||
delStudent: `occupationlab/occupationlab/architecture/delStudent`, // 单个、批量删除学生
|
||||
addStudent: `occupationlab/occupationlab/architecture/addStudent`, // 新增学生
|
||||
modifyStudent: `occupationlab/occupationlab/architecture/modifyStudent`, // 编辑学生
|
||||
getStudentInfoByAccountId: `occupationlab/occupationlab/architecture/getStudentInfoByAccountId`, // 查看学生信息
|
||||
getDetailByAccount: `occupationlab/occupationlab/architecture/getDetailByAccount`, // 新增用户前调用:按帐户获取详细信息
|
||||
importStudent: `${host}occupationlab/occupationlab/architecture/importStudent`, // 批量导入学生
|
||||
exportFailure: `${host}occupationlab/occupationlab/architecture/exportFailure`, // 批量导入学生失败数据导出
|
||||
removeStudent: `occupationlab/occupationlab/architecture/removeStudent`, // 移除学生
|
||||
organizationalStudentList: `occupationlab/occupationlab/architecture/organizationalStudentList`, // 根据组织架构筛选学生列表
|
||||
studentList: `occupationlab/occupationlab/architecture/studentList`, // 学生列表
|
||||
stuOrganizationTree: `occupationlab/occupationlab/architecture/stuOrganizationTree`, // 学生组织架构树
|
||||
treeList: `occupationlab/occupationlab/architecture/treeList`, // 学生组织架构树形列表
|
||||
saveOrg: `occupationlab/occupationlab/architecture/save`, // 新增组织架构
|
||||
updateOrg: `occupationlab/occupationlab/architecture/update`, // 编辑组织架构
|
||||
deleteOrg: `occupationlab/occupationlab/architecture/delete`, // 删除组织架构
|
||||
studentTemplate: `http://121.37.12.51/template/学生导入模板.xlsx`, // 学生导入模板
|
||||
|
||||
// 测评管理
|
||||
questionsList: `occupationlab/occupationlab/questions/list`, // 题库列表查询
|
||||
questionsSave: `occupationlab/occupationlab/questions/save`, // 新增题目
|
||||
questionsUpdate: `occupationlab/occupationlab/questions/update`, // 根据试题id修改试题信息
|
||||
questionsDetail: `occupationlab/occupationlab/questions/detail`, // 查看当前题库信息
|
||||
questionsDelete: `occupationlab/occupationlab/questions/delete`, // 根据主键删除
|
||||
questionsIsDisable: `occupationlab/occupationlab/questions/isDisable`, // 是否禁用试题
|
||||
questionsTemplate: `http://121.37.12.51/template/试题导入模板.xlsx`, //excel模板文件下载
|
||||
questionsImport: `${host}occupationlab/occupationlab/questions/importQuestion`, // 批量导入题库
|
||||
questionsExportFailure: `${host}occupationlab/occupationlab/questions/exportFailure`, // 批量导入题库失败数据导出
|
||||
questionsInfo: `occupationlab/occupationlab/questions/info`, // 测评规则信息的展示
|
||||
questionsUpdateRules: `occupationlab/occupationlab/questions/updateEvaluationRules`, // 修改测评规则信息
|
||||
|
||||
// 考核管理
|
||||
pageByCondition: `occupationlab/occupationlab/assessment/pageByCondition`, // 考核管理列表
|
||||
saveAssessment: `occupationlab/occupationlab/assessment/saveAssessment`, // 创建考核
|
||||
modifyAssessment: `occupationlab/occupationlab/assessment/modifyAssessment`, // 编辑考核
|
||||
enableAssessment: `occupationlab/occupationlab/assessment/enableAssessment`, // 修改考核状态
|
||||
getDetailById: `occupationlab/occupationlab/assessment/getDetailById`, // 根据考核Id查询考核详情
|
||||
deleteAssessment: `occupationlab/occupationlab/assessment/deleteAssessment`, // 单个、批量删除
|
||||
collectPaper: `occupationlab/occupationlab/assessment/collectPaper`, // 收卷(提前结束)
|
||||
schoolCourse: `nakadai/nakadai/curriculum/schoolCourse`, // 获取学校购买订单后的课程
|
||||
projectListByCourseId: `occupationlab/occupationlab/projectManage/getSchoolProjectByAssessent`, // 根据课程id获取实训项目列表
|
||||
|
||||
// 成绩管理
|
||||
deleteExperimentalReport: `occupationlab/occupationlab/achievement/deleteExperimentalReport`, // 单个、批量删除实验报告
|
||||
exportAssessmentInfo: `${host}occupationlab/occupationlab/achievement/exportAssessmentInfo`, // 批量导出考核成绩
|
||||
exportPracticeInfo: `${host}occupationlab/occupationlab/achievement/exportPracticeInfo`, // 批量导出练习成绩
|
||||
getAchievementInfo: `occupationlab/occupationlab/achievement/getAchievementInfo`, // 管理端成绩管理
|
||||
getAssessmentDetail: `occupationlab/occupationlab/achievement/getAssessmentDetail`, // 管理端考核成绩详情
|
||||
getPracticeDetail: `occupationlab/occupationlab/achievement/getPracticeDetail`, // 管理端练习成绩详情
|
||||
myClass: `occupationlab/occupationlab/achievement/myClass`, // 教师端:我的班级
|
||||
deleteReportById: `occupationlab/occupationlab/achievement/deleteReportById`, // 批量删除成绩管理中的项目/批量删除成绩管理中的考核
|
||||
reportDetail: `occupationlab/occupationlab/achievement/reportDetail`, // 查看实验报告
|
||||
schoolCourseByAchievement: `nakadai/nakadai/curriculum/schoolCourseByAchievement`, // 获取学校购买订单后的课程
|
||||
spliceClass: `occupationlab/occupationlab/achievement/spliceClass`, |
||||
|
||||
// 项目管理
|
||||
getSystemIdBySchool: `occupationlab/occupationlab/projectManage/getSystemIdBySchool`, // 获取学校下拥有的系统
|
||||
avgValues: `occupationlab/occupationlab/projectManage/avgValues`, // 平均分分配值
|
||||
deleteProjectManage: `occupationlab/occupationlab/projectManage/deleteProjectManage`, // 新增项目管理
|
||||
getProjectBySystemId: `occupationlab/occupationlab/projectManage/getProjectBySystemId`, // 根据系统id获取全部项目(项目中没有用上这个接口)
|
||||
queryNameIsExist: `occupationlab/occupationlab/projectManage/queryNameIsExist`, // 新增/编辑项目管理名称判重
|
||||
queryProjectManage: `occupationlab/occupationlab/projectManage/queryProjectManage`, // 项目管理列表(分页、筛选)
|
||||
updateIsOpen: `occupationlab/occupationlab/projectManage/updateIsOpen`, // 更新开启状态
|
||||
getProjectDetail: `occupationlab/occupationlab/projectManage/getProjectDetail`, // 根据项目id查询详情
|
||||
saveProjectDraft: `occupationlab/occupationlab/projectManage/saveProjectDraft`, // 新增项目管理
|
||||
addProjectManage: `occupationlab/occupationlab/projectManage/addProjectManage`, // 新增项目管理
|
||||
updateProjectManage: `occupationlab/occupationlab/projectManage/updateProjectManage`, // 修改项目管理
|
||||
editProjectDraft: `occupationlab/occupationlab/projectManage/editProjectDraft`, // 修改项目管理
|
||||
copyProjectManage: `occupationlab/occupationlab/projectManage/copyProjectManage`, // 复制项目管理
|
||||
|
||||
// 判分点
|
||||
getBcJudgmentPoint: `judgment/judgment/bcJudgmentPoint/getTeacherJudgmentPoint`, // 获取编程类判分点列表(分页)
|
||||
getLcJudgmentPoint: `judgment/judgment/lcJudgmentPoint/queryAllJudgmentPoint`, // 获取流程类判分点列表(分页)
|
||||
addProjectJudgment: `occupationlab/occupationlab/projectJudgment/addProjectJudgment`, // 添加项目管理、判分点中间表
|
||||
updateProjectJudgment: `occupationlab/occupationlab/projectJudgment/updateProjectJudgment`, // 判分点中间表批量更新
|
||||
deleteProjectJudgment: `occupationlab/occupationlab/projectJudgment/deleteProjectJudgment`, // 判分点中间表批量删除
|
||||
|
||||
|
||||
// 赛事
|
||||
contestPageConditionQueryByOccupationlab: `occupationlab/occupationlab/enterprise/match/contest/contestPageConditionQueryByOccupationlab`, |
||||
addContest: `occupationlab/occupationlab/enterprise/match/contest/addContest`, |
||||
editContest: `occupationlab/occupationlab/enterprise/match/contest/editContest`, |
||||
deleteContest: `occupationlab/occupationlab/enterprise/match/contest/deleteContest`, |
||||
getContest: `occupationlab/occupationlab/enterprise/match/contest/getContest`, |
||||
deleteAnnex: `occupationlab/occupationlab/contest/annex/delete`, |
||||
saveAnnex: `occupationlab/occupationlab/contest/annex/save`, |
||||
getSchoolsByProvince: `nakadai/nakadai/school/getSchoolsByProvince`, |
||||
disabledEvents: `occupationlab/occupationlab/enterprise/match/contest/disabledEvents`, |
||||
batchDeleteContest: `occupationlab/occupationlab/enterprise/match/contest/batchDeleteContest`, |
||||
|
||||
// 竞赛进展
|
||||
addContestProgress: `occupationlab/occupationlab/enterprise/match/contest-progress/addContestProgress`, |
||||
deleteContestProgress: `occupationlab/occupationlab/enterprise/match/contest-progress/deleteContestProgress`, |
||||
getContestProgress: `occupationlab/occupationlab/enterprise/match/contest-progress/getContestProgress`, |
||||
editContestProgress: `occupationlab/occupationlab/enterprise/match/contest-progress/editContestProgress`, |
||||
// 报名人员
|
||||
addApplicant: `occupationlab/occupationlab/enterprise/match/applicant/addApplicant`, |
||||
disableContests: `occupationlab/occupationlab/enterprise/match/applicant/disableContests`, |
||||
excelExport: `${host}occupationlab/occupationlab/enterprise/match/applicant/excelExport`, |
||||
queryApplicantByCondition: `occupationlab/occupationlab/enterprise/match/applicant/queryApplicantByCondition`, |
||||
disableApplicant: `occupationlab/occupationlab/enterprise/match/applicant/disableApplicant`, |
||||
exportDataInBatches: `${host}occupationlab/occupationlab/enterprise/match/applicant/exportDataInBatches`, |
||||
// 赛事公告
|
||||
addAnnouncement: `occupationlab/occupationlab/contest/announcement/addAnnouncement`, |
||||
amendmentAnnouncement: `occupationlab/occupationlab/contest/announcement/amendmentAnnouncement`, |
||||
deleteAnnouncement: `occupationlab/occupationlab/contest/announcement/deleteAnnouncement`, |
||||
disableAnnouncement: `occupationlab/occupationlab/contest/announcement/disableAnnouncement`, |
||||
queryAnnouncementByContestId: `occupationlab/occupationlab/contest/announcement/queryAnnouncementByContestId`, |
||||
queryAnnouncementDetails: `occupationlab/occupationlab/contest/announcement/queryAnnouncementDetails`, |
||||
deleteAnnouncementAnnex: `occupationlab/occupationlab/contestAnnouncementAnnex/delete`, |
||||
saveAnnouncementAnnex: `occupationlab/occupationlab/contestAnnouncementAnnex/save`, |
||||
|
||||
// 栏目管理
|
||||
addColumn: `occupationlab/occupationlab/enterprise/information/column/addColumn`, |
||||
deleteColumn: `occupationlab/occupationlab/enterprise/information/column/deleteColumn`, |
||||
editColumn: `occupationlab/occupationlab/enterprise/information/column/editColumn`, |
||||
queryAllColumns: `occupationlab/occupationlab/enterprise/information/column/queryAllColumns`, |
||||
columnReorder: `occupationlab/occupationlab/enterprise/information/column/reorder`, |
||||
// 内容管理
|
||||
addArticle: `occupationlab/occupationlab/enterprise/information/article/addArticle`, |
||||
deleteArticles: `occupationlab/occupationlab/enterprise/information/article/deleteArticles`, |
||||
editArticle: `occupationlab/occupationlab/enterprise/information/article/editArticle`, |
||||
enableArticle: `occupationlab/occupationlab/enterprise/information/article/enableArticle`, |
||||
getArticle: `occupationlab/occupationlab/enterprise/information/article/getArticle`, |
||||
getArticles: `occupationlab/occupationlab/enterprise/information/article/getArticles`, |
||||
queryArticleByCondition: `occupationlab/occupationlab/enterprise/information/article/queryArticleByCondition`, |
||||
articleSort: `occupationlab/occupationlab/enterprise/information/article/articleSort`, |
||||
|
||||
// 课程管理
|
||||
queryCourseByCondition: `occupationlab/occupationlab/management/edu/course/queryCourseByCondition`, // 课程列表分页条件查询
|
||||
addCourse: `occupationlab/occupationlab/management/edu/course/addCourse`, // 添加课程
|
||||
deleteCourse: `occupationlab/occupationlab/management/edu/course/deleteCourse`, // 根据id删除课程
|
||||
deleteCourses: `occupationlab/occupationlab/management/edu/course/deleteCourses`, // 批量删除课程
|
||||
editCourse: `occupationlab/occupationlab/management/edu/course/editCourse`, // 修改课程
|
||||
enableCourse: `occupationlab/occupationlab/management/schoolCourse/enableGlCourse`, // 是否启用管理端课程
|
||||
getCourse: `occupationlab/occupationlab/management/edu/course/getCourse`, // 根据id查询课程
|
||||
// 分类管理
|
||||
queryGlClassification: `occupationlab/occupationlab/management/edu/courseClassification/queryGlClassification`, |
||||
deleteClassification: `occupationlab/occupationlab/management/edu/courseClassification/deleteClassification`, |
||||
addClassification: `occupationlab/occupationlab/management/edu/courseClassification/addClassification`, |
||||
editClassification: `occupationlab/occupationlab/management/edu/courseClassification/editClassification`, |
||||
// 课程章节管理
|
||||
addChapter: `occupationlab/occupationlab/management/edu/courseChapter/addChapter`, |
||||
chapterReorder: `occupationlab/occupationlab/management/edu/courseChapter/chapterReorder`, |
||||
deleteChapter: `occupationlab/occupationlab/management/edu/courseChapter/deleteChapter`, |
||||
editChapter: `occupationlab/occupationlab/management/edu/courseChapter/editChapter`, |
||||
queryChaptersAndSubsections: `occupationlab/occupationlab/management/edu/courseChapter/queryChaptersAndSubsections`, |
||||
reorder: `occupationlab/occupationlab/management/edu/courseChapter/reorder`, |
||||
// 课程小节管理
|
||||
addSubsection: `occupationlab/occupationlab/management/edu/courseSubsection/addSubsection`, // 添加小节
|
||||
deleteSubsection: `occupationlab/occupationlab/management/edu/courseSubsection/deleteSubsection`, // 根据id删除小节
|
||||
editSubsection: `occupationlab/occupationlab/management/edu/courseSubsection/editSubsection`, // 修改小节
|
||||
getSubsection: `occupationlab/occupationlab/management/edu/courseSubsection/getSubsection`, // 根据小节id获取预览文件地址
|
||||
|
||||
// 阿里云文件/视频管理
|
||||
fileDeletion: `${uploadURL}oss/manage/fileDeletion`, // 删除OSS文件
|
||||
fileupload: `${uploadURL}oss/manage/fileupload`, // 文件上传
|
||||
getPlayAuth: `${uploadURL}oss/manage/getPlayAuth`, // 获取播放凭证
|
||||
removeMoreVideo: `${uploadURL}oss/manage/removeMoreVideo`, // 批量删除视频文件
|
||||
removeVideo: `${uploadURL}oss/manage/removeVideo`, // 删除视频文件
|
||||
|
||||
queryProvince: `nakadai/nakadai/province/queryProvince`, //查询省份
|
||||
queryCity: `nakadai/nakadai/city/queryCity`, //查询城市
|
||||
querySchoolData: `nakadai/nakadai/school/querySchool`, //根据学校名称查询学校信息
|
||||
queryCourseDiscipline: `nakadai/nakadai/subject/courseDiscipline`, //查询课程学科
|
||||
queryCourseProfessionalClass: `nakadai/nakadai/subject/courseProfessionalClass`, //查询专业类
|
||||
queryCourseProfessional: `nakadai/nakadai/subject/courseProfessional`, //查询专业
|
||||
|
||||
// 个人中心
|
||||
uploadUserAvatars: `${host}users/users/userAccount/updateUserAvatars`, //更改头像
|
||||
queryUserInfoDetails: `users/users/userAccount/queryUserInfoDetails`,//个人中心信息展示
|
||||
updatePersonCenter: `users/users/userAccount/updatePersonCenter`,//个人中心信息修改
|
||||
examinePassword: `users/users/userAccount/examinePassword`,//更换密码
|
||||
bindPhoneOrEmail: `users/users/userAccount/bindPhoneOrEmail`,// 绑定手机或邮箱
|
||||
sendPhoneOrEmailCode: `users/users/userAccount/sendPhoneOrEmailCode`,// 更换手机号或邮箱--发送手机验证码
|
||||
unbindMobilePhone: `users/users/userAccount/unbindMobilePhone`, |
||||
|
||||
// 系统设置
|
||||
// 员工组织架构
|
||||
professionalList: `occupationlab/occupationlab/staff/professionalList`, //查询专业列表
|
||||
staffGradeList: `occupationlab/occupationlab/staff/staffGradeList`, //根据专业id查询年级
|
||||
saveProfessional: `occupationlab/occupationlab/staff/saveProfessional`, //新增专业
|
||||
updateProfessional: `occupationlab/occupationlab/staff/updateProfessional`, //编辑专业
|
||||
deleteProfessional: `occupationlab/occupationlab/staff/deleteProfessional`, //删除专业
|
||||
saveGrade: `occupationlab/occupationlab/staff/saveGrade`, //新增年级
|
||||
updateGrade: `occupationlab/occupationlab/staff/updateGrade`, //编辑年级
|
||||
deleteGrade: `occupationlab/occupationlab/staff/deleteGrade`, //删除年级
|
||||
// 员工管理
|
||||
saveStaff: `occupationlab/occupationlab/staff/saveStaff`, //新增员工
|
||||
staffDetail: `occupationlab/occupationlab/staff/staffDetail`, //员工详情
|
||||
modifyStaff: `occupationlab/occupationlab/staff/modifyStaff`, //编辑员工
|
||||
delStaff: `occupationlab/occupationlab/staff/delStaff`, //删除员工
|
||||
staffList: `occupationlab/occupationlab/staff/staffList`, //员工列表
|
||||
staffTemplate: `http://121.37.12.51/template/员工用户导入模板.xlsx`, //员工用户导入模板
|
||||
exportFailureStaff: `${host}occupationlab/occupationlab/staff/exportFailure`, //批量导入员工失败数据导出
|
||||
importStaff: `${host}occupationlab/occupationlab/staff/importStaff`, //批量导入员工
|
||||
// 角色管理
|
||||
batchRemove: `users/users/role/batchRemove`, //批量删除角色
|
||||
checkRoleIsExist: `users/users/role/checkRoleIsExist`, //判断该角色是否存在
|
||||
delRoleByAccountId: `users/users/role/delRoleByAccountId`, //删除某用户下的某个角色
|
||||
roleList: `users/users/role/list`, //角色分页列表查询
|
||||
obtainDetails: `users/users/role/obtainDetails`, //获取角色详情
|
||||
saveOrUpdate: `users/users/role/saveOrUpdate`, //新增或更新角色
|
||||
queryAllMenus: `users/users/permission/queryAllMenus`, //查询所有菜单
|
||||
// 系统logo设置
|
||||
logoDetail: `occupationlab/occupationlab/sys/logo/detail`, //查看系统设置信息
|
||||
logoSave: `occupationlab/occupationlab/sys/logo/save`, //新增系统设置信息
|
||||
logoUpdate: `occupationlab/occupationlab/sys/logo/update`, //编辑系统设置信息
|
||||
|
||||
|
||||
|
||||
|
||||
// 教师评语
|
||||
addComment: `evaluation/cevaluation/comment/addComment`, |
||||
queryComment: `evaluation/evaluation/ccomment/queryComment`, |
||||
updateComment: `evaluation/evaluation/ccomment/updateComment`, |
||||
|
||||
// 老师签名照
|
||||
daleteSignature: `evaluation/evaluation/csignature/daleteSignature`, |
||||
querySignature: `evaluation/evaluation/csignature/querySignature`, |
||||
uploadSignature: `evaluation/evaluation/csignature/uploadSignature`, |
||||
|
||||
// 判分点
|
||||
queryListTrading: `judgment/judgment/tradingJudgmentPoints/query`, |
||||
queryDetailsTrading: `judgment/judgment/tradingJudgmentPoints/queryDetails`, |
||||
// 科大
|
||||
queryPoint: `kdSys/queryPoint`, |
||||
querySubject: `kdSys/querySubject`, |
||||
queryItem: `kdSys/queryItem`, |
||||
// 川大
|
||||
firstLevel: `${host1}sichuan/point/firstLevel`, |
||||
secondaryLevel: `${host1}sichuan/point/secondaryLevel`, |
||||
thirdLevel: `${host1}sichuan/point/thirdLevel` |
||||
|
||||
}; |
||||
logins: `iasf/sys/user/login`, |
||||
verification: `${host}iasf/sys/getVerify`, |
||||
dept: `iasf/sys/dept`, |
||||
deptTree: `iasf/sys/dept/tree`, |
||||
deptId: `iasf/sys/dept`, |
||||
depts: `iasf/sys/depts`, |
||||
listWithTree: `${host1}iasf/sysColumn/listWithTree`, |
||||
saveColumn: `${host1}iasf/sysColumn/save`, |
||||
updateColumn: `${host1}iasf/sysColumn/update`, |
||||
findColumn: `${host1}iasf/sysColumn/findById`, |
||||
deleteColumn: `${host1}iasf/sysColumn/delete`, |
||||
sameLevelJudgment: `${host1}iasf/sysColumn/sameLevelJudgment`, |
||||
checkIfTheTitleIsRepeat: `${host1}iasf/sysContent/checkIfTheTitleIsRepeat`, |
||||
deleteArticle: `${host1}iasf/sysContent/delete`, |
||||
findArticle: `${host1}iasf/sysContent/findById`, |
||||
queryArticle: `${host1}iasf/sysContent/pagingQuery`, |
||||
saveArticle: `${host1}iasf/sysContent/save`, |
||||
updateArticle: `${host1}iasf/sysContent/update`, |
||||
} |
After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 829 B |
Before Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 321 B |
After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 323 B |
@ -0,0 +1,47 @@ |
||||
/** |
||||
* 栏目配置 |
||||
* */ |
||||
|
||||
export default { |
||||
// 栏目类型
|
||||
types: [ |
||||
{ |
||||
id: 1, |
||||
name: '常规栏目' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '跳转链接' |
||||
}, |
||||
{ |
||||
id: 3, |
||||
name: '长页栏目' |
||||
}, |
||||
{ |
||||
id: 4, |
||||
name: '子级优先栏目' |
||||
} |
||||
], |
||||
// 栏目模板
|
||||
templates: [ |
||||
{ |
||||
id: 1, |
||||
name: '文章' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '文库' |
||||
}, |
||||
], |
||||
// 站点
|
||||
sites: [ |
||||
{ |
||||
id: 1, |
||||
name: 'EFL中文' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: 'SRL中文' |
||||
}, |
||||
], |
||||
} |
@ -0,0 +1,529 @@ |
||||
<template> |
||||
<div> |
||||
<el-form> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="goBack" :content="(isEdit ? '更新' : '创建') + '文章'"></el-page-header> |
||||
<div> |
||||
<el-button type="primary" @click="submit(1)">发布</el-button> |
||||
<el-button v-if="!form.id" type="primary" @click="submit(0)">保存为草稿</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">标题</p> |
||||
<el-input |
||||
placeholder="请输入标题" |
||||
v-model.trim="form.title" |
||||
clearable |
||||
maxlength="15" |
||||
class="inline-input" |
||||
@change="nameChange" |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">所属栏目</p> |
||||
<el-cascader |
||||
ref="column" |
||||
v-model="form.columnId" |
||||
:options="columns" |
||||
:props="columnProps" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">发布日期</p> |
||||
<div class="inline-input"> |
||||
<el-date-picker |
||||
v-model="form.releaseTime" |
||||
type="date" |
||||
placeholder="选择日期" |
||||
format="yyyy-MM-dd" |
||||
value-format="yyyy-MM-dd"> |
||||
</el-date-picker> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">来源</p> |
||||
<el-input |
||||
placeholder="请输入来源" |
||||
v-model.trim="form.source" |
||||
clearable |
||||
maxlength="15" |
||||
class="inline-input" |
||||
@change="nameChange" |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">作者</p> |
||||
<el-input |
||||
placeholder="请输入作者" |
||||
v-model.trim="form.author" |
||||
clearable |
||||
maxlength="15" |
||||
class="inline-input" |
||||
@change="nameChange" |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">标题图</p> |
||||
<el-upload |
||||
class="avatar-uploader" |
||||
accept=".jpg,.png,.jpeg,.gif" |
||||
:on-remove="handleRemove" |
||||
:on-error="uploadError" |
||||
:on-success="uploadSuccess" |
||||
:before-remove="beforeRemove" |
||||
:limit="1" |
||||
:on-exceed="handleExceed" |
||||
:action="this.api.fileupload" |
||||
:headers="headers" |
||||
name="file" |
||||
> |
||||
<img v-if="form.titleImg" :src="form.titleImg" class="avatar"> |
||||
<div class="uploader-default" v-else> |
||||
<i class="el-icon-plus"></i> |
||||
<p>上传banner</p> |
||||
</div> |
||||
<div slot="tip" class="el-upload__tip"> |
||||
<p>展示宽度为220,高度140,JPG/PNG/GIF,3MB以内</p> |
||||
</div> |
||||
</el-upload> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">banner图</p> |
||||
<el-upload |
||||
class="avatar-uploader avatar-uploader-lg" |
||||
accept=".jpg,.png,.jpeg,.gif" |
||||
:on-remove="handleRemove" |
||||
:on-error="uploadError" |
||||
:on-success="uploadSuccessBanner" |
||||
:before-remove="beforeRemove" |
||||
:limit="1" |
||||
:on-exceed="handleExceed" |
||||
:action="this.api.fileupload" |
||||
:headers="headers" |
||||
name="file" |
||||
> |
||||
<img v-if="form.bannerImg" :src="form.bannerImg" class="avatar"> |
||||
<div class="uploader-default" v-else> |
||||
<i class="el-icon-plus"></i> |
||||
<p>上传banner</p> |
||||
</div> |
||||
<div slot="tip" class="el-upload__tip"> |
||||
<p>展示宽度为220,高度140,JPG/PNG/GIF,3MB以内</p> |
||||
</div> |
||||
</el-upload> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">独立文章模板</p> |
||||
<div class="style-wrap"> |
||||
<ul class="styles"> |
||||
<li> |
||||
<el-radio v-model="form.articleTemplate" :label="1">视频详情</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.articleTemplate" :label="2">富文本</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.articleTemplate" :label="3">链接</el-radio> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<template v-if="form.articleTemplate === 1 || form.articleTemplate === 2"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">正文</p> |
||||
<quill :border="true" v-model="form.mainBody" :height="400" /> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">文件上传</p> |
||||
<el-upload |
||||
:on-remove="handleRemove" |
||||
:on-error="uploadError" |
||||
:on-success="uploadSuccessFile" |
||||
:before-remove="beforeRemove" |
||||
:limit="1" |
||||
:on-exceed="handleExceed" |
||||
:action="this.api.fileupload" |
||||
:headers="headers" |
||||
name="file" |
||||
> |
||||
<el-button type="primary">上传</el-button> |
||||
</el-upload> |
||||
</div> |
||||
</el-card> |
||||
</template> |
||||
<template v-if="form.articleTemplate === 3"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">连接类型</p> |
||||
<el-radio-group v-model="form.connectionType"> |
||||
<el-radio :label="1">站内链接</el-radio> |
||||
<el-radio :label="2">站外链接</el-radio> |
||||
<el-radio :label="3">其他站点链接</el-radio> |
||||
</el-radio-group> |
||||
</div> |
||||
</el-card> |
||||
<el-card v-show="form.connectionType === 1" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站内链接</p> |
||||
<el-cascader |
||||
v-model="links" |
||||
:options="columns" |
||||
:props="columnProps" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
<el-card v-show="form.connectionType === 2" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站外链接</p> |
||||
<el-input |
||||
placeholder="请输入站外链接" |
||||
v-model.trim="form.linkAddress" |
||||
clearable |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<template v-if="form.connectionType === 3"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站点选择</p> |
||||
<el-select v-model="form.siteSelection"> |
||||
<el-option |
||||
v-for="item in sites" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目</p> |
||||
<el-cascader |
||||
v-model="links" |
||||
:options="columns" |
||||
:props="columnProps" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
</template> |
||||
</template> |
||||
<el-card v-show="form.typeId === 4" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">在新窗口打开</p> |
||||
<el-switch |
||||
v-model="form.showWithDetails" |
||||
:active-value="1" |
||||
:inactive-value="0"> |
||||
</el-switch> |
||||
</div> |
||||
</el-card> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import ColumnConst from '@/const/column' |
||||
import quill from '@/components/quill' |
||||
import { mapState, mapActions } from "vuex"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
isEdit: this.$route.query.type === 'edit', |
||||
headers: {}, |
||||
nameRepeat: false, |
||||
types: ColumnConst.types, |
||||
templates: ColumnConst.templates, |
||||
sites: ColumnConst.sites, |
||||
columns: [], |
||||
columnProps: { |
||||
checkStrictly: true, |
||||
value: 'id', |
||||
label: 'columnName' |
||||
}, |
||||
links: [], |
||||
form: { |
||||
id: this.$route.query.id || '', |
||||
founderId: +this.$store.state.user.userId, |
||||
editorId: +this.$store.state.user.userId, |
||||
articleTemplate: '', |
||||
author: '', |
||||
bannerImg: '', |
||||
columnId: +this.$route.query.columnId, |
||||
file: '', |
||||
isRelease : '', |
||||
mainBody: '', |
||||
releaseTime: '', |
||||
source: '', |
||||
summary : '', |
||||
title: '', |
||||
titleImg: '', |
||||
connectionType : 1, |
||||
linkAddress: '', |
||||
siteSelection: 1, |
||||
}, |
||||
submiting: false, // 新增编辑防抖标识 |
||||
updateTime: 0 |
||||
}; |
||||
}, |
||||
components: { |
||||
quill |
||||
}, |
||||
mounted() { |
||||
this.getList() |
||||
this.form.id && this.getData() |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler(val){ |
||||
this.updateTime++ |
||||
}, |
||||
deep:true |
||||
}, |
||||
}, |
||||
methods: { |
||||
// 获取栏目 |
||||
getList() { |
||||
this.$post(this.api.listWithTree, { |
||||
columnName: '', |
||||
templateId: '', |
||||
typeId : '', |
||||
}).then(({ data }) => { |
||||
this.columns = data |
||||
this.$nextTick(() => { |
||||
// this.$refs.column.setCheckedKeys(data[0].id) |
||||
console.log("🚀 ~ file: index.vue ~ line 309 ~ this.$nextTick ~ his.$refs.column", this.$refs.column.setCheckedKeys) |
||||
}) |
||||
}).catch(err => {}) |
||||
}, |
||||
// 获取详情 |
||||
getData() { |
||||
this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => { |
||||
this.form = data |
||||
if (data.articleTemplate === 3 && data.connectionType !== 2 && data.linkAddress) this.links = data.linkAddress.split(',').map(e => +e) |
||||
this.originalName = data.title |
||||
}).catch(err => {}) |
||||
}, |
||||
// 文章名称判重 |
||||
nameChange(){ |
||||
const { title, level, id } = this.form |
||||
if(title && title !== this.originalName){ |
||||
this.$post(this.api.checkIfTheTitleIsRepeat, { |
||||
title, |
||||
id: id || '' |
||||
}).then(res => { |
||||
this.nameRepeat = false |
||||
}).catch(res => { |
||||
this.nameRepeat = true |
||||
}) |
||||
}else{ |
||||
this.nameRepeat = false |
||||
} |
||||
}, |
||||
// 文章类型回调 |
||||
typeChange(val) { |
||||
|
||||
}, |
||||
uploadError(err, file, fileList) { |
||||
this.$message({ |
||||
message: "上传出错,请重试!", |
||||
type: "error", |
||||
center: true |
||||
}) |
||||
}, |
||||
beforeRemove(file, fileList) { |
||||
return this.$confirm(`确定移除 ${file.name}?`); |
||||
}, |
||||
handleExceed(files, fileList) { |
||||
util.errorMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
||||
}, |
||||
handleRemove(file, fileList) { |
||||
this.form.columnBanner = '' |
||||
}, |
||||
uploadSuccess(res) { |
||||
this.form.columnBanner = res.data.filesResult.fileUrl |
||||
}, |
||||
uploadSuccessBanner(res) { |
||||
this.form.bannerImg = res.data.filesResult.fileUrl |
||||
}, |
||||
uploadSuccessFile(res) { |
||||
this.form.file = res.data.filesResult.fileUrl |
||||
}, |
||||
// 提交 |
||||
submit(isRelease) { |
||||
if (this.submiting) return false |
||||
const { form } = this |
||||
if (!form.title) return util.errorMsg('请填写标题') |
||||
if (this.nameRepeat) return util.errorMsg('该标题已重复!') |
||||
if (!form.releaseTime) return util.errorMsg('请选择发布日期') |
||||
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] |
||||
if (form.articleTemplate === 3 && form.connectionType !== 2) { |
||||
const { links } = this |
||||
if (!links.length && form.connectionType === 1) return util.errorMsg('请选择站内链接') |
||||
if (!links.length && form.connectionType === 3) return util.errorMsg('请选择栏目') |
||||
form.linkAddress = links.join() |
||||
} |
||||
console.log(44, this.links) |
||||
form.isRelease = isRelease |
||||
this.submiting = true |
||||
if (form.id) { |
||||
delete form.children |
||||
form.editorId = +this.$store.state.user.userId |
||||
this.$post(this.api.updateArticle, form).then(res => { |
||||
util.successMsg("修改成功") |
||||
this.$router.back() |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}) |
||||
} else { |
||||
this.$post(this.api.saveArticle, form).then(res => { |
||||
util.successMsg("创建成功") |
||||
this.$router.back() |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}) |
||||
} |
||||
}, |
||||
// 返回上一页 |
||||
backPage() { |
||||
this.$router.back() |
||||
}, |
||||
goBack() { |
||||
const { id } = this.form |
||||
const { updateTime } = this |
||||
// 更改了信息才需要提示 |
||||
if ((!this.isEdit && updateTime > 1) || (id && updateTime > 2)) { |
||||
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.submit() |
||||
}).catch(() => { |
||||
this.backPage() |
||||
}) |
||||
} else { |
||||
this.backPage() |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.inline-input { |
||||
width: 500px; |
||||
} |
||||
$upload-width: 220px; |
||||
$upload-height: 140px; |
||||
$upload-lg-height: 150px; |
||||
/deep/ .avatar-uploader { |
||||
.el-upload { |
||||
position: relative; |
||||
width: $upload-width; |
||||
height: $upload-height; |
||||
border: 1px dashed #d9d9d9; |
||||
border-radius: 6px; |
||||
cursor: pointer; |
||||
overflow: hidden; |
||||
|
||||
&:hover { |
||||
border-color: #cb221c; |
||||
} |
||||
|
||||
.uploader-default { |
||||
display: flex; |
||||
height: $upload-height; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
text-align: center; |
||||
background: rgba(0, 0, 0, 0.04); |
||||
|
||||
i { |
||||
font-size: 20px; |
||||
font-weight: bold; |
||||
color: #8c939d; |
||||
} |
||||
|
||||
p { |
||||
margin-top: 10px; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.65); |
||||
line-height: 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
&.avatar-uploader-lg { |
||||
.el-upload { |
||||
width: 100%; |
||||
max-width: 960px; |
||||
height: $upload-lg-height; |
||||
|
||||
.uploader-default { |
||||
height: $upload-lg-height; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.avatar { |
||||
display: block; |
||||
width: $upload-width; |
||||
height: $upload-height; |
||||
} |
||||
|
||||
.avatar-lg { |
||||
display: block; |
||||
width: 100%; |
||||
height: $upload-lg-height; |
||||
} |
||||
|
||||
.el-upload__tip { |
||||
margin-top: 0; |
||||
|
||||
p { |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.45); |
||||
line-height: 1; |
||||
|
||||
&:first-child { |
||||
margin-bottom: 5px; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.style-wrap { |
||||
display: flex; |
||||
margin-top: 10px; |
||||
.label { |
||||
margin-right: 30px; |
||||
} |
||||
} |
||||
.styles { |
||||
display: inline-flex; |
||||
li { |
||||
margin-right: 20px; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,206 @@ |
||||
<template> |
||||
<div class="flex"> |
||||
<div class="page" style="width: 320px"> |
||||
<div> |
||||
<div class="flex-between m-b-20"> |
||||
<h6 class="p-title" style="margin-bottom: 0">栏目</h6> |
||||
</div> |
||||
|
||||
<div style="height: 504px; max-height: 504px; overflow: auto"> |
||||
<el-tree ref="column" :data="columns" :props="defaultProps" node-key="id" @node-click="columnClick"></el-tree> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="page flex-1 m-l-20"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input style="width: 250px;" placeholder="请输入文章标题" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button type="info" v-auth @click="add">新增</el-button> |
||||
<el-button type="primary" v-auth @click="delAllSelection">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="title" label="标题" align="center" min-width="100"></el-table-column> |
||||
<el-table-column prop="columnName" label="栏目" align="center" min-width="100"></el-table-column> |
||||
<el-table-column prop="releaseTime" label="发布日期" align="center" min-width="100"></el-table-column> |
||||
<el-table-column prop="workNumber" label="状态" align="center" min-width="100"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.isRelease ? '已发布' : '草稿' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="300"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-auth type="text" @click="resetPassword(scope.row)">预览</el-button> |
||||
<el-button v-auth type="text" @click="edit(scope.row)">编辑</el-button> |
||||
<el-button v-auth type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import Setting from "@/setting"; |
||||
import { mapState } from "vuex"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
columns: [], |
||||
defaultProps: { |
||||
value: 'id', |
||||
label: 'columnName' |
||||
}, |
||||
keyword: "", |
||||
originForm: {}, |
||||
form: { |
||||
userName: "", |
||||
phone: "", |
||||
uniqueIdentification: "", |
||||
workNumber: "", |
||||
email: "", |
||||
account: "", |
||||
classId: "" |
||||
}, |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getColumn() |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
if (this.studentType) { |
||||
this.initData(); |
||||
} else { |
||||
this.getOrgStudentData(); |
||||
} |
||||
|
||||
}, 500); |
||||
}, |
||||
}, |
||||
methods: { |
||||
// 栏目树形 |
||||
getColumn() { |
||||
this.$post(this.api.listWithTree, { |
||||
columnName: '', |
||||
templateId: '', |
||||
typeId : '', |
||||
}).then(({ data }) => { |
||||
this.columns = data |
||||
this.$nextTick(() => { |
||||
this.$refs.column.setCurrentKey(data[0].id) |
||||
this.getData() |
||||
}) |
||||
}).catch(e => {}) |
||||
}, |
||||
// 栏目点击 |
||||
columnClick(data, node) { |
||||
this.getData() |
||||
}, |
||||
// 文章列表 |
||||
getData() { |
||||
this.$post(this.api.queryArticle, { |
||||
columnIds: [this.$refs.column.getCurrentKey()], |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
title: this.keyword |
||||
}).then(({ data }) => { |
||||
this.list = data.records |
||||
this.total = +data.total |
||||
}).catch(err => {}) |
||||
}, |
||||
currentChange(val) { // 切换页码 |
||||
this.page = val; |
||||
this.getData() |
||||
}, |
||||
handleSelectionChange(val) { // 多选 |
||||
this.multipleSelection = val; |
||||
}, |
||||
initData() { |
||||
this.$refs.table.clearSelection(); |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
delAllSelection() { // 批量删除 |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除选中用户吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.accountId; |
||||
}); |
||||
this.$post(`${this.api.delStudent}?accountIds=${ids.toString()}`).then(res => { |
||||
this.multipleSelection = []; |
||||
this.$refs.table.clearSelection(); |
||||
util.successMsg("删除成功"); |
||||
if (this.studentType) { |
||||
this.getData(); |
||||
} else { |
||||
this.getOrgStudentData(); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
if(this.multipleSelection.length === this.list.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleDelete(row) { // 删除 |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteArticle}?id=${row.id}`).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData() |
||||
}).catch(res => {}) |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
// 新增 |
||||
add() { |
||||
this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}`) |
||||
}, |
||||
// 编辑 |
||||
edit(row) { |
||||
this.$router.push(`add?id=${row.id}`) |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.custom-tree-node { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
} |
||||
.name { |
||||
display: inline-block; |
||||
max-width: 160px; |
||||
margin-right: 20px; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
} |
||||
</style> |
@ -1,445 +0,0 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<label>创建时间</label> |
||||
<el-radio-group v-model="form.month" @change="initData"> |
||||
<el-radio v-for="(item,index) in dateList" :key="index" :label="item.id" border>{{ item.name }}</el-radio> |
||||
</el-radio-group> |
||||
<el-date-picker v-model="date" @blur='pickerInput' align="right" unlink-panels type="daterange" style="width: 300px;margin-left: 10px;" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker> |
||||
</li> |
||||
<li> |
||||
<label>发布类型</label> |
||||
<el-select v-model="form.type" clearable placeholder="请选择发布类型" @change="initData"> |
||||
<el-option v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.value"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>实验状态</label> |
||||
<el-select v-model="form.status" clearable placeholder="请选择实验状态" @change="initData"> |
||||
<el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>课程</label> |
||||
<el-select v-model="curriculumId" placeholder="请选择" @change="initData"> |
||||
<el-option label="不限" value=""></el-option> |
||||
<el-option |
||||
v-for="item in curriculumList" |
||||
:key="item.cid" |
||||
:label="item.curriculumName" |
||||
:value="item.cid" |
||||
></el-option> |
||||
</el-select> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入实验班级/项目名称/考核名称" prefix-icon="el-icon-search" v-model.trim="keyWord" clearable style="width: 300px"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<div> |
||||
<el-button v-auth type="info" round @click="add" >创建考核</el-button> |
||||
<el-button v-auth type="primary" round @click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table v-loading="listLoading" ref="table" :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
||||
<el-table-column type="selection" :selectable="row => row.status !== 1" width="50" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (pageNum - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="className" label="实验班级" align="center" min-width="120px" show-overflow-tooltip></el-table-column> |
||||
<el-table-column prop="experimentalName" label="考核名称" align="center" min-width="120px" show-overflow-tooltip></el-table-column> |
||||
<el-table-column prop="projectName" label="项目名称" min-width="200" show-overflow-tooltip align="center"></el-table-column> |
||||
<el-table-column prop="experimenterNum" label="实验人数" align="center"></el-table-column> |
||||
<el-table-column prop="experimentDuration" label="实验时长" align="center"></el-table-column> |
||||
<el-table-column label="邀请码" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.isEnableCode == 1 ? scope.row.invitationCode : "" }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="type" label="发布类型" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ types[scope.row.type] }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="createTime" width="150" label="创建时间" align="center"> |
||||
</el-table-column> |
||||
<el-table-column prop="startTime" width="150" label="起始时间" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ transferTime(scope.row.startTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="stopTime" width="150" label="结束时间" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ transferTime(scope.row.stopTime) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="倒计时" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ timeFilter(scope.row) }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="实验状态" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span> |
||||
{{ status[scope.row.status] }} |
||||
</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="170" align="center"> |
||||
<template slot-scope="scope"> |
||||
<template v-if="scope.row.status == 0 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
||||
<el-button v-auth v-if="scope.row.type == 1" type="text" @click="start(scope.row)">启动</el-button> |
||||
<el-button v-auth type="text" @click="edit(scope.row)">修改</el-button> |
||||
</template> |
||||
<template v-else-if="scope.row.status == 1 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
||||
<el-button v-auth type="text" @click="finish(scope.row)">提前结束</el-button> |
||||
</template> |
||||
<template v-else-if="scope.row.status == 2"> |
||||
<el-button v-auth type="text" @click="show(scope.row)">查看成绩</el-button> |
||||
</template> |
||||
<el-button v-auth v-if="(scope.row.status == 0 || scope.row.status == 2) && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="delData(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="pageNum"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState } from "vuex"; |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
typeList: [ |
||||
{ |
||||
value: "", |
||||
name: "不限" |
||||
}, { |
||||
value: 1, |
||||
name: "手动发布" |
||||
}, { |
||||
value: 2, |
||||
name: "定时发布" |
||||
} |
||||
], |
||||
types: ["", "手动发布", "定时发布"], |
||||
statusList: [ |
||||
{ |
||||
value: "", |
||||
name: "不限" |
||||
}, { |
||||
value: 0, |
||||
name: "待开始" |
||||
}, { |
||||
value: 1, |
||||
name: "进行中" |
||||
}, { |
||||
value: 2, |
||||
name: "已结束" |
||||
} |
||||
], |
||||
status: ["待开始", "进行中", "已结束"], |
||||
dateList: [ |
||||
{ |
||||
id: "", |
||||
name: "不限" |
||||
}, { |
||||
id: 1, |
||||
name: "近一个月" |
||||
}, { |
||||
id: 3, |
||||
name: "近三个月" |
||||
}, { |
||||
id: 6, |
||||
name: "近六个月" |
||||
} |
||||
], |
||||
date: [], |
||||
curriculumList: [], |
||||
curriculumId: "", |
||||
keyWord: "", // 搜索框筛选条件 |
||||
searchTimer: null, |
||||
form: { |
||||
type: "", |
||||
status: "", |
||||
startTime: "", |
||||
endTime: "", |
||||
month: "" |
||||
}, |
||||
pageNum: +this.$route.query.page || 1, // 当前页数 |
||||
pageSize: 10, // 每页10条 |
||||
total: 0, // 总数 |
||||
listData: [], // 表格数据 |
||||
multipleSelection: [], // 多选 |
||||
listLoading:false,// 列表加载 |
||||
ticker: null, // 倒计时定时器 |
||||
sss:1, |
||||
datassdata:0 |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapState("user", [ |
||||
'roleName' |
||||
]) |
||||
}, |
||||
watch: { |
||||
"form.month": function(val) { |
||||
if (val) { |
||||
let unit = 24 * 60 * 60 * 1000; |
||||
this.date = [util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() - unit * 30 * val)), util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() + unit))]; |
||||
} else { |
||||
this.date = []; |
||||
} |
||||
}, |
||||
date: function(val) { |
||||
if (val) { |
||||
this.form.startTime = val[0]; |
||||
this.form.endTime = val[1]; |
||||
} else { |
||||
this.form.startTime = ""; |
||||
this.form.endTime = ""; |
||||
this.form.month = ''; |
||||
} |
||||
this.initData(); |
||||
}, |
||||
keyWord: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
// 页面离开的时候销毁手机和邮箱验证码定时器 |
||||
this.$once("hook:beforeDestroy", function() { |
||||
this.sss = 0 |
||||
// clearInterval(this.ticker); |
||||
// this.ticker = null; |
||||
}); |
||||
this.getData(); |
||||
this.getschoolCourse(); |
||||
}, |
||||
methods: { |
||||
pickerInput(){ |
||||
this.form.month = '6' |
||||
}, |
||||
beginTimer() { |
||||
this.ticker = setInterval(() => { |
||||
if(this.sss == 0){ |
||||
clearInterval(this.ticker); |
||||
this.ticker = null; |
||||
}else{ |
||||
for (let i = 0; i < this.listData.length; i++) { |
||||
const item = this.listData[i]; |
||||
if (item.countDown > 0) { |
||||
item.countDown--; |
||||
} else { |
||||
if (item.status == 0 && item.type == 2) { // 待开始-定时发布 |
||||
item.status = 1; |
||||
item.countDown = (new Date(item.stopTime).getTime() - new Date().getTime()) / 1000; |
||||
// } |
||||
} else if (item.status == 1) { |
||||
// item.status = 2; |
||||
} |
||||
} |
||||
item.show = true; |
||||
this.$set(this.listData, i, item); |
||||
} |
||||
} |
||||
}, 1000); |
||||
}, |
||||
timeFilter(countDown) { |
||||
if (countDown.countDown > 0) { |
||||
let h = Math.floor(countDown.countDown / (60 * 60)); |
||||
let m = Math.floor(countDown.countDown % (60 * 60) / 60); |
||||
let s = Math.floor(countDown.countDown % (60 * 60) % 60); |
||||
return `${h > 9 ? h : `0${h}`}:${m > 9 ? m : `0${m}`}:${s > 9 ? s : `0${s}`}`; |
||||
} else { |
||||
if(countDown.status == 1){ |
||||
countDown.status = 2 |
||||
} |
||||
return "00:00:00"; |
||||
} |
||||
}, |
||||
getData() { |
||||
this.datassdata = this.datassdata+1 |
||||
this.listLoading = true; |
||||
this.listData.splice(0); |
||||
this.sss = 0 |
||||
let data = { |
||||
...this.form, |
||||
keyWord: this.keyWord, |
||||
pageNum: this.pageNum, |
||||
pageSize: this.pageSize, |
||||
curriculumId: this.curriculumId |
||||
}; |
||||
this.$post(this.api.pageByCondition, data).then(res => { |
||||
this.listData = res.list; |
||||
this.total = res.total; |
||||
this.listData.forEach(i => { |
||||
i.show = false; |
||||
if (i.status == 2) { // 已结束 |
||||
i.countDown = 0; |
||||
} else { |
||||
if (i.type == 2) { // 定时发布 |
||||
if (i.status == 0) { |
||||
// 待开始 |
||||
i.countDown = (new Date(i.startTime).getTime() - new Date().getTime()) / 1000; // 获得两个日期时间的秒数差 |
||||
} else if (i.status == 1) { |
||||
// 进行中 |
||||
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
||||
} |
||||
} else if (i.type == 1) { // 手动发布 |
||||
if (i.status == 0) { |
||||
// 待开始 |
||||
i.countDown = 0; |
||||
} else if (i.status == 1) { |
||||
// 进行中 |
||||
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
this.sss = 1; |
||||
if(this.datassdata == 1){ |
||||
this.beginTimer() |
||||
} |
||||
// setTimeout(,3000) |
||||
this.listLoading = false; |
||||
}).catch(err => { |
||||
this.listLoading = false; |
||||
}); |
||||
}, |
||||
initData() { |
||||
this.$refs.table.clearSelection(); |
||||
this.pageNum = 1; |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}, |
||||
getschoolCourse() { // 获取课程下拉框数据 |
||||
this.$get(this.api.schoolCourse).then(res => { |
||||
this.curriculumList = res.data; |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
add() { |
||||
this.$router.push("add"); |
||||
}, |
||||
edit(row) { |
||||
this.$router.push(`add?id=${row.id}`); |
||||
}, |
||||
show(row) { |
||||
this.$router.push(`/achievement/teach?id=${row.id}&projectName=${row.projectName}&permissions=1`) |
||||
}, |
||||
start(row) { |
||||
this.$post(`${this.api.enableAssessment}?id=${row.id}`).then(res => { |
||||
util.successMsg("启动成功!"); |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
finish(row) { |
||||
this.$confirm("确定要提前结束吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let data = { |
||||
id: row.id, |
||||
endTime: util.formatDate("yyyy-MM-dd hh:mm:ss", new Date()), |
||||
status: 2 |
||||
}; |
||||
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => { |
||||
util.successMsg("提前结束成功!"); |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
delData(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(this.api.deleteAssessment, [row.id]).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
delAllData() { |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
|
||||
this.$post(this.api.deleteAssessment, ids).then(res => { |
||||
this.multipleSelection = []; |
||||
this.$refs.table.clearSelection(); |
||||
util.successMsg("删除成功"); |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
if(this.multipleSelection.length === this.listData.length && this.pageNum>1) { |
||||
this.handleCurrentChange(this.pageNum - 1) |
||||
} |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
onSearch() { |
||||
this.pageNum = 1; |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.pageNum = val |
||||
this.$router.push(`list?page=${val}`) |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}, |
||||
transferTime(date) { |
||||
if (date == "0000-00-00 00:00:00" || !date) return "---"; |
||||
return date; |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.el-radio-group { |
||||
white-space: nowrap; |
||||
} |
||||
.el-radio.is-bordered + .el-radio.is-bordered { |
||||
margin-left: 0; |
||||
} |
||||
</style> |
@ -0,0 +1,513 @@ |
||||
<template> |
||||
<div> |
||||
<el-form> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="goBack" :content="(isEdit ? '更新' : '创建') + '栏目'"></el-page-header> |
||||
<div> |
||||
<el-button type="primary" @click="submit">{{ form.id ? "更新" : "创建" }}</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目名称</p> |
||||
<el-input |
||||
placeholder="请输入栏目名称" |
||||
v-model.trim="form.columnName" |
||||
clearable |
||||
maxlength="15" |
||||
class="inline-input" |
||||
@change="nameChange" |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">设置上级</p> |
||||
<el-cascader |
||||
v-model="form.fatherId" |
||||
:options="columns" |
||||
:props="columnProps" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目类型</p> |
||||
<div class="inline-input"> |
||||
<el-select v-model="form.typeId" @change="typeChange"> |
||||
<el-option |
||||
v-for="item in types" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">分页条数</p> |
||||
<el-input |
||||
placeholder="请输入分页条数" |
||||
v-model.trim="form.pageSize" |
||||
maxlength="15" |
||||
type="number" |
||||
style="width: 150px" |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">导航菜单可见</p> |
||||
<el-switch |
||||
v-model="form.menuVisible" |
||||
:active-value="0" |
||||
:inactive-value="1"> |
||||
</el-switch> |
||||
</div> |
||||
</el-card> |
||||
<template v-if="form.typeId === 1 || form.typeId === 4"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目banner</p> |
||||
<el-upload |
||||
class="avatar-uploader avatar-uploader-lg" |
||||
accept=".jpg,.png,.jpeg,.gif" |
||||
:on-remove="handleRemove" |
||||
:on-error="uploadError" |
||||
:on-success="uploadSuccess" |
||||
:before-remove="beforeRemove" |
||||
:limit="1" |
||||
:on-exceed="handleExceed" |
||||
:action="this.api.fileupload" |
||||
:headers="headers" |
||||
name="file" |
||||
> |
||||
<img v-if="form.columnBanner" :src="form.columnBanner" class="avatar"> |
||||
<div class="uploader-default" v-else> |
||||
<i class="el-icon-plus"></i> |
||||
<p>上传banner</p> |
||||
</div> |
||||
<div slot="tip" class="el-upload__tip"> |
||||
<p>展示宽度为220,高度140,JPG/PNG/GIF,3MB以内</p> |
||||
</div> |
||||
</el-upload> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目模板</p> |
||||
<el-select v-model="form.templateId"> |
||||
<el-option |
||||
v-for="item in templates" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
<div class="style-wrap"> |
||||
<p class="label">列表样式</p> |
||||
<ul class="styles"> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="1">图片列表</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="2">新闻列表</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="3">出版物列表</el-radio> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
<div class="style-wrap"> |
||||
<p class="label">详情样式</p> |
||||
<ul class="styles"> |
||||
<li> |
||||
<el-radio v-model="form.detailStyle" :label="1">视频详情</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.detailStyle" :label="2">富文本</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.detailStyle" :label="3">链接</el-radio> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
</template> |
||||
<template v-if="form.typeId === 2"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">连接类型</p> |
||||
<el-radio-group v-model="form.connectionType"> |
||||
<el-radio :label="1">站内链接</el-radio> |
||||
<el-radio :label="2">站外链接</el-radio> |
||||
<el-radio :label="3">其他站点链接</el-radio> |
||||
</el-radio-group> |
||||
</div> |
||||
</el-card> |
||||
<el-card v-show="form.connectionType === 1" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站内链接</p> |
||||
<el-cascader |
||||
v-model="links" |
||||
:options="columns" |
||||
:props="columnProps" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
<el-card v-show="form.connectionType === 2" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站外链接</p> |
||||
<el-input |
||||
placeholder="请输入站外链接" |
||||
v-model.trim="form.linkAddress" |
||||
clearable |
||||
></el-input> |
||||
</div> |
||||
</el-card> |
||||
<template v-if="form.connectionType === 3"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">站点选择</p> |
||||
<el-select v-model="form.siteSelection"> |
||||
<el-option |
||||
v-for="item in sites" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
</div> |
||||
</el-card> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目</p> |
||||
<el-cascader |
||||
:options="links" |
||||
:props="{ checkStrictly: true }" |
||||
clearable></el-cascader> |
||||
</div> |
||||
</el-card> |
||||
</template> |
||||
</template> |
||||
<template v-if="form.typeId === 3"> |
||||
<el-card shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">栏目模板</p> |
||||
<el-select v-model="form.templateId"> |
||||
<el-option |
||||
v-for="item in templates" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id"> |
||||
</el-option> |
||||
</el-select> |
||||
<div class="style-wrap"> |
||||
<p class="label">列表样式</p> |
||||
<ul class="styles"> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="1">图片列表</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="2">新闻列表</el-radio> |
||||
</li> |
||||
<li> |
||||
<el-radio v-model="form.listStyleId" :label="3">出版物列表</el-radio> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
</template> |
||||
<el-card v-show="form.typeId === 4" shadow="hover" class="mgr20 m-b-20"> |
||||
<div> |
||||
<p class="m-b-20">只有一篇文章时,以详情方式展示</p> |
||||
<el-switch |
||||
v-model="form.showWithDetails" |
||||
:active-value="1" |
||||
:inactive-value="0"> |
||||
</el-switch> |
||||
</div> |
||||
</el-card> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import ColumnConst from '@/const/column' |
||||
import { mapState, mapActions } from "vuex"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
isEdit: this.$route.query.type === 'edit', |
||||
headers: {}, |
||||
nameRepeat: false, |
||||
types: ColumnConst.types, |
||||
templates: ColumnConst.templates, |
||||
sites: ColumnConst.sites, |
||||
columns: [], |
||||
columnProps: { |
||||
checkStrictly: true, |
||||
value: 'id', |
||||
label: 'columnName' |
||||
}, |
||||
links: [], |
||||
form: { |
||||
id: this.$route.query.id || '', |
||||
founderId: +this.$store.state.user.userId, |
||||
editorId: +this.$store.state.user.userId, |
||||
fatherId: +this.$route.query.id || 0, |
||||
level: this.$route.query.level || 1, |
||||
columnName: '', |
||||
typeId: 1, |
||||
pageSize: 10, |
||||
menuVisible: 0, |
||||
columnBanner: '', |
||||
templateId: 1, |
||||
listStyleId: 1, |
||||
detailStyle: 1, |
||||
connectionType: 1, |
||||
linkAddress : '', |
||||
showWithDetails: 0, |
||||
siteSelection: 1, |
||||
status: 1, |
||||
sort: 1, |
||||
}, |
||||
submiting: false, // 新增编辑防抖标识 |
||||
updateTime: 0 |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getList() |
||||
this.isEdit && this.getData() |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
form: { |
||||
handler(val){ |
||||
this.updateTime++ |
||||
}, |
||||
deep:true |
||||
}, |
||||
}, |
||||
methods: { |
||||
// 获取栏目列表 |
||||
getList() { |
||||
this.$post(this.api.listWithTree, { |
||||
columnName: '', |
||||
templateId: '', |
||||
typeId : '', |
||||
}).then(({ data }) => { |
||||
this.columns = data |
||||
}).catch(err => {}) |
||||
}, |
||||
// 获取详情 |
||||
getData() { |
||||
this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => { |
||||
this.form = data |
||||
}).catch(err => {}) |
||||
}, |
||||
// 赋值上级 |
||||
setFatherId() { |
||||
|
||||
}, |
||||
// 栏目名称判重 |
||||
nameChange(){ |
||||
const { columnName, level, id } = this.form |
||||
if(columnName && columnName !== this.originalName){ |
||||
this.$post(this.api.sameLevelJudgment, { |
||||
columnName, |
||||
level: +level, |
||||
id: +id || '' |
||||
}).then(res => { |
||||
this.nameRepeat = false |
||||
}).catch(res => { |
||||
this.nameRepeat = true |
||||
}) |
||||
}else{ |
||||
this.nameRepeat = false |
||||
} |
||||
}, |
||||
// 栏目类型回调 |
||||
typeChange(val) { |
||||
|
||||
}, |
||||
uploadError(err, file, fileList) { |
||||
this.$message({ |
||||
message: "上传出错,请重试!", |
||||
type: "error", |
||||
center: true |
||||
}) |
||||
}, |
||||
beforeRemove(file, fileList) { |
||||
return this.$confirm(`确定移除 ${file.name}?`); |
||||
}, |
||||
handleExceed(files, fileList) { |
||||
util.errorMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
||||
}, |
||||
handleRemove(file, fileList) { |
||||
this.form.columnBanner = '' |
||||
}, |
||||
uploadSuccess(res) { |
||||
this.form.columnBanner = res.data.filesResult.fileUrl |
||||
}, |
||||
// 提交 |
||||
submit() { |
||||
if (this.submiting) return false |
||||
const { form } = this |
||||
if (!form.columnName) return util.errorMsg('请填写栏目名称') |
||||
if (this.nameRepeat) return util.errorMsg('同级下已存在重复栏目!') |
||||
if (!form.pageSize) return util.errorMsg('请填写分页条数') |
||||
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] |
||||
if (form.typeId === 2 && form.connectionType !== 2) { |
||||
const { links } = this |
||||
if (!links.length && form.connectionType === 1) return util.errorMsg('请选择站内链接') |
||||
if (!links.length && form.connectionType === 3) return util.errorMsg('请选择栏目') |
||||
form.linkAddress = links.join() |
||||
} |
||||
console.log(44, this.links) |
||||
this.submiting = true |
||||
if (this.isEdit) { |
||||
delete form.children |
||||
form.editorId = +this.$store.state.user.userId |
||||
this.$post(this.api.updateColumn, form).then(res => { |
||||
util.successMsg("修改成功") |
||||
this.$router.back() |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}) |
||||
} else { |
||||
this.$post(this.api.saveColumn, form).then(res => { |
||||
util.successMsg("创建成功") |
||||
this.$router.back() |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}) |
||||
} |
||||
}, |
||||
// 返回上一页 |
||||
backPage() { |
||||
this.$router.back() |
||||
}, |
||||
goBack() { |
||||
const { id } = this.form |
||||
const { updateTime } = this |
||||
// 更改了信息才需要提示 |
||||
if ((!this.isEdit && updateTime > 1) || (id && updateTime > 2)) { |
||||
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.submit() |
||||
}).catch(() => { |
||||
this.backPage() |
||||
}) |
||||
} else { |
||||
this.backPage() |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.inline-input { |
||||
width: 500px; |
||||
} |
||||
$upload-width: 220px; |
||||
$upload-height: 140px; |
||||
$upload-lg-height: 150px; |
||||
/deep/ .avatar-uploader { |
||||
.el-upload { |
||||
position: relative; |
||||
width: $upload-width; |
||||
height: $upload-height; |
||||
border: 1px dashed #d9d9d9; |
||||
border-radius: 6px; |
||||
cursor: pointer; |
||||
overflow: hidden; |
||||
|
||||
&:hover { |
||||
border-color: #cb221c; |
||||
} |
||||
|
||||
.uploader-default { |
||||
display: flex; |
||||
height: $upload-height; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
text-align: center; |
||||
background: rgba(0, 0, 0, 0.04); |
||||
|
||||
i { |
||||
font-size: 20px; |
||||
font-weight: bold; |
||||
color: #8c939d; |
||||
} |
||||
|
||||
p { |
||||
margin-top: 10px; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.65); |
||||
line-height: 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
&.avatar-uploader-lg { |
||||
.el-upload { |
||||
width: 100%; |
||||
max-width: 960px; |
||||
height: $upload-lg-height; |
||||
|
||||
.uploader-default { |
||||
height: $upload-lg-height; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.avatar { |
||||
display: block; |
||||
width: $upload-width; |
||||
height: $upload-height; |
||||
} |
||||
|
||||
.avatar-lg { |
||||
display: block; |
||||
width: 100%; |
||||
height: $upload-lg-height; |
||||
} |
||||
|
||||
.el-upload__tip { |
||||
margin-top: 0; |
||||
|
||||
p { |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.45); |
||||
line-height: 1; |
||||
|
||||
&:first-child { |
||||
margin-bottom: 5px; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.style-wrap { |
||||
display: flex; |
||||
margin-top: 10px; |
||||
.label { |
||||
margin-right: 30px; |
||||
} |
||||
} |
||||
.styles { |
||||
display: inline-flex; |
||||
li { |
||||
margin-right: 20px; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,158 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入栏目名称" prefix-icon="el-icon-search" v-model.trim="keyWord" clearable style="width: 300px"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<div> |
||||
<el-button type="info" round @click="add" >新增</el-button> |
||||
<el-button type="primary" round @click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table v-loading="listLoading" ref="table" :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
||||
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="columnName" label="名称"></el-table-column> |
||||
<el-table-column prop="typeId" label="栏目类型" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ types.find(e => e.id == scope.row.typeId) && types.find(e => e.id == scope.row.typeId).name }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="templateId" label="栏目模板" align="center"></el-table-column> |
||||
<el-table-column prop="listStyleId" label="列表/长页样式" align="center"></el-table-column> |
||||
<el-table-column prop="detailStyle" label="详情样式" align="center"></el-table-column> |
||||
<el-table-column prop="menuVisible" label="导航菜单" align="center"></el-table-column> |
||||
<el-table-column prop="id" label="ID" align="center"></el-table-column> |
||||
<el-table-column label="操作" width="170" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row, 'add')">新增下级</el-button> |
||||
<el-button type="text" @click="edit(scope.row, 'edit')">编辑</el-button> |
||||
<el-button type="text" @click="del(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import ColumnConst from '@/const/column' |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
types: ColumnConst.types, |
||||
templates: ColumnConst.templates, |
||||
keyWord: "", // 搜索框筛选条件 |
||||
searchTimer: null, |
||||
page: +this.$route.query.page || 1, // 当前页数 |
||||
pageSize: 10, // 每页10条 |
||||
total: 0, // 总数 |
||||
listData: [], // 表格数据 |
||||
multipleSelection: [], // 多选 |
||||
listLoading:false,// 列表加载 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyWord: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.getData() |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$post(this.api.listWithTree, { |
||||
columnName: this.keyWord, |
||||
templateId: '', |
||||
typeId : '', |
||||
}).then(({ data }) => { |
||||
this.listData = data |
||||
this.listLoading = false |
||||
}).catch(err => { |
||||
this.listLoading = false |
||||
}) |
||||
}, |
||||
initData() { |
||||
this.$refs.table.clearSelection() |
||||
this.page = 1 |
||||
this.getData() |
||||
}, |
||||
add() { |
||||
this.$router.push('add') |
||||
}, |
||||
edit(row, type) { |
||||
this.$router.push(`add?id=${row.id}&level=${row.level + 1}&type=${type}`) |
||||
}, |
||||
del(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteColumn}?id=${row.id}`).then(res => { |
||||
util.successMsg("删除成功") |
||||
this.getData() |
||||
}).catch(res => {}) |
||||
}).catch(() => {}) |
||||
}, |
||||
delAllData() { |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
|
||||
this.$post(this.api.deleteAssessment, ids).then(res => { |
||||
this.multipleSelection = []; |
||||
this.$refs.table.clearSelection(); |
||||
util.successMsg("删除成功"); |
||||
this.sss = 0 |
||||
this.getData(); |
||||
}).catch(res => { |
||||
}); |
||||
if(this.multipleSelection.length === this.listData.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val |
||||
this.$router.push(`list?page=${val}`) |
||||
this.getData(); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.el-radio-group { |
||||
white-space: nowrap; |
||||
} |
||||
.el-radio.is-bordered + .el-radio.is-bordered { |
||||
margin-left: 0; |
||||
} |
||||
</style> |
@ -0,0 +1,90 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入栏目或模板名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable style="width: 300px"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<div> |
||||
<!-- <el-button v-auth type="info" round @click="add" >创建考核</el-button> |
||||
<el-button v-auth type="primary" round @click="delAllData">批量删除</el-button> --> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table ref="table" :data="list" class="table" stripe header-align="center" row-key="id"> |
||||
<el-table-column type="selection" :selectable="row => row.status !== 1" width="50" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (pageNum - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="createTime" label="长页栏目名称" align="center"></el-table-column> |
||||
<el-table-column prop="createTime" label="模板名称" align="center"></el-table-column> |
||||
<el-table-column prop="createTime" label="上级栏目" align="center"></el-table-column> |
||||
<el-table-column prop="createTime" label="最近编辑" align="center"></el-table-column> |
||||
<el-table-column prop="createTime" label="编辑人" align="center"></el-table-column> |
||||
<el-table-column label="操作" width="170" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="start(scope.row)">预览</el-button> |
||||
<el-button type="text" @click="start(scope.row)">编辑</el-button> |
||||
<el-button type="text" @click="start(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="pageNum"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState } from "vuex"; |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
keyword: '', |
||||
pageNum: +this.$route.query.page || 1, // 当前页数 |
||||
pageSize: 10, // 每页10条 |
||||
total: 0, // 总数 |
||||
list: [] |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
|
||||
}, |
||||
methods: { |
||||
handleCurrentChange(val) { |
||||
this.page = val |
||||
// this.getData(); |
||||
}, |
||||
add() { |
||||
this.$router.push("add"); |
||||
}, |
||||
edit(row) { |
||||
this.$router.push(`add?id=${row.id}`); |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.el-radio-group { |
||||
white-space: nowrap; |
||||
} |
||||
.el-radio.is-bordered + .el-radio.is-bordered { |
||||
margin-left: 0; |
||||
} |
||||
</style> |
@ -1,714 +0,0 @@ |
||||
<template> |
||||
<div ref="main" class="main"> |
||||
<el-form :disabled="isDetail"> |
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="flex-between"> |
||||
<el-page-header @back="back" content="项目配置"></el-page-header> |
||||
<div v-if="!isDetail"> |
||||
<el-button type="success" @click="handleSubmit(0)">保存为草稿</el-button> |
||||
<el-button type="primary" @click="handleSubmit(1)">确定并发布</el-button> |
||||
</div> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<h6 class="p-title">基本信息</h6> |
||||
<div> |
||||
<el-form label-width="80px" :disabled="isDetail"> |
||||
<div class="flex"> |
||||
<el-form-item label="系统"> |
||||
<el-select v-model="projectManage.systemId" placeholder="请选择" @change="systemChange"> |
||||
<el-option |
||||
v-for="item in systemList" |
||||
:key="item.id" |
||||
:label="item.label" |
||||
:value="item.id" |
||||
></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="项目名称"> |
||||
<el-input v-model.trim="projectManage.projectName" placeholder="20个字符以内" @blur="projectNameExistis"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="项目权限"> |
||||
<el-select v-model="projectManage.permissions" placeholder="请选择" @change="permissionChange"> |
||||
<el-option label="练习" :value="0"></el-option> |
||||
<el-option label="考核" :value="1"></el-option> |
||||
<el-option label="竞赛" :value="2"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</div> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<h6 class="p-title">实验目标</h6> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentTarget" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<h6 class="p-title">案例描述</h6> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentDescription" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="m-b-20 flex-between"> |
||||
<h6 class="p-title" style="margin-bottom: 0">实验任务</h6> |
||||
<div> |
||||
<!--<el-button :disabled="isDetail" type="primary" @click="toJudgePoint('home')">进入判分点</el-button>--> |
||||
</div> |
||||
</div> |
||||
<div class="m-b-20 flex-between"> |
||||
<div class="flex-center"> |
||||
<div class="m-r-20" style="color: #f00">项目总分值:100分</div> |
||||
<!-- <div>权重 <div class="dib"><el-input></el-input></div></div> --> |
||||
</div> |
||||
<div> |
||||
<el-button class="m-r-20" type="text" @click="avgDistributionScore">平均分配分值</el-button> |
||||
<el-button class="m-r-20" type="text" @click="manualDistributionScore">手动分配分值</el-button> |
||||
<span>(待分配分值: {{ handDistributionScore }}/100分)</span> |
||||
</div> |
||||
</div> |
||||
<el-button type="primary" icon="el-icon-plus" round @click="handleQueryJudgment" style="margin-bottom: 10px">判分点</el-button> |
||||
<el-button type="primary" icon="el-icon-delete" round @click="batchDeleteProjectJudgment" style="margin-bottom: 10px">批量删除</el-button> |
||||
<div class="draggable"> |
||||
<el-table |
||||
ref="projectJudgementTable" |
||||
:data="projectJudgmentData" |
||||
class="table" |
||||
stripe |
||||
header-align="center" |
||||
@selection-change="handleSelectionProjectJudgment" |
||||
row-key="judgmentId" |
||||
v-loading="listLoading" |
||||
> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column prop="sort" label="序号" width="80" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.sort }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="判分指标" align="center"></el-table-column> |
||||
<el-table-column prop="name" label="判分点名称" align="center"></el-table-column> |
||||
<el-table-column label="实验要求" align="center" width="600"> |
||||
<template slot-scope="scope"> |
||||
<quill :border="true" :readonly="true" elseRead="true" v-model="scope.row.experimentalRequirements" :minHeight="150" :height="150" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="score" label="分数" align="center" width="120"> |
||||
<template slot-scope="scope"> |
||||
<!--type="number" @blur="updateProjectJudgment"--> |
||||
<el-input v-model.trim="scope.row.score" @input="scoreChange(scope.row, scope.$index,$event)"></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="100" align="center"> |
||||
<template slot-scope="scope"> |
||||
<!--<el-button :disabled="isDetail" type="text" style="margin-right: 10px" @click="toJudgePoint('edit', scope.row)">自定义</el-button>--> |
||||
<el-button type="text" @click="delJudgePoint(scope.$index)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</el-card> |
||||
|
||||
<el-card shadow="hover" class="m-b-20"> |
||||
<div class="m-b-20 flex-between"> |
||||
<h6 class="p-title" style="margin-bottom: 0">实验提示</h6> |
||||
<div> |
||||
启用 |
||||
<el-switch :active-value="0" :inactive-value="1" v-model="projectManage.hintOpen"></el-switch> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<el-form label-width="0"> |
||||
<el-form-item prop="tips" label=""> |
||||
<quill :border="true" :readonly="isDetail" v-model="projectManage.experimentHint" :minHeight="150" :height="150" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
</el-form> |
||||
|
||||
<!--选择判分点对话框--> |
||||
<el-dialog title="添加判分点" :visible.sync="dialogVisible" width="40%" :close-on-click-modal="false"> |
||||
<div class="text-right m-b-10"> |
||||
<div> |
||||
<el-input placeholder="请输入需要查找的判分点" prefix-icon="el-icon-search" v-model.trim="judgementpointsquery" clearable></el-input> |
||||
</div> |
||||
</div> |
||||
<el-table |
||||
v-loading="visibleLoading" |
||||
:data="judgementData" |
||||
ref="judgementTable" |
||||
class="table" |
||||
stripe |
||||
header-align="center" |
||||
max-height="400" |
||||
@selection-change="handleSelectionJudgment" |
||||
:row-key="rowKey" |
||||
> |
||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column prop="id" label="序号" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="判分点名称" align="center"></el-table-column> |
||||
<el-table-column label="操作" align="center" width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" @click="toJudgePoint('view', scope.row)">查看</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div slot="footer" class="dialog-footer"> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="addJudgment">确 定</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Setting from "@/setting"; |
||||
import util from "@/libs/util"; |
||||
import { mapState, mapActions } from "vuex"; |
||||
import quill from "@/components/quill"; |
||||
import Sortable from "sortablejs"; |
||||
|
||||
export default { |
||||
components: { |
||||
quill |
||||
}, |
||||
data() { |
||||
return { |
||||
projectId: this.$route.query.projectId, |
||||
founder: this.$route.query.founder, |
||||
systemList: [], |
||||
token: btoa(util.local.get(Setting.tokenKey)), |
||||
isDetail: Boolean(this.$route.query.show), |
||||
|
||||
projectManage: { |
||||
founder: 0, // 创建人角色(0、系统 1、老师) |
||||
projectName: "", // 项目名称 |
||||
permissions: 0, // 项目权限(0、练习 1、考核 2、竞赛) |
||||
systemId: this.$store.state.project.lastSystemId, // 系统id |
||||
hintOpen: 0, // 实验提示是否开启(0开启 1不开启 默认0) |
||||
experimentHint: "", // 实验提示 |
||||
experimentTarget: "", // 实验目标 |
||||
experimentDescription: "", // 案例描述 |
||||
state: 0, // 状态(0、草稿箱 1、已发布) |
||||
isOpen: 0, // 是否开启(0开启 1未开启 默认0) |
||||
isDel: 0 // 是否删除(0、未删除 1、已删除 默认0) |
||||
}, |
||||
projectJudgmentData: [], //实验任务(项目判分点) |
||||
selectedProjectJudgment: [], // 选中的项目判分点 |
||||
|
||||
dialogVisible: false, // 选择判分点对话框 |
||||
judgementpointsquery: "", //条件筛选判分点 |
||||
judgementData: [], // 判分点列表数据 |
||||
selectedJudgment: [], // 选中的判分点 |
||||
rowKey: "", // 判分点行数据的 Key |
||||
projectNameRepeat: false, // 项目名称是否重复 |
||||
originName: '', |
||||
|
||||
flag: false, //判分点表格分数是否禁用 |
||||
avgValuelist: [], //取得判分点平均分的数组 |
||||
|
||||
searchTimer: null, |
||||
isToPoint: false, // 判断是否是跳转到判分点系统 |
||||
visibleLoading: false, // 加载弹框 |
||||
listLoading:false,// 列表加载 |
||||
submiting: false, // 新增编辑员工防抖标识 |
||||
updateTime: 0 |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapState("project", [ |
||||
"projectFields", "lastSystemId" |
||||
]), |
||||
handDistributionScore: function() { |
||||
//计算判分点分值,超出100提示, |
||||
let score = 0; |
||||
this.projectJudgmentData.forEach(e => { |
||||
score += parseInt(e.score); |
||||
}); |
||||
if (isNaN(score)) { |
||||
return 0; |
||||
} |
||||
if (score > 100) { |
||||
// util.errorMsg(res.message); |
||||
util.errorMsg("分配的数值已超过100"); |
||||
} |
||||
console.log("chuli"); |
||||
return score; |
||||
} |
||||
}, |
||||
watch: { |
||||
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
||||
projectManage: { |
||||
handler(){ |
||||
this.updateTime++ |
||||
}, |
||||
deep:true |
||||
}, |
||||
judgementpointsquery(n) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.handleQueryJudgment(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSystemData(); |
||||
}, |
||||
mounted() { |
||||
if (this.$route.query.projectId) { |
||||
this.projectId = this.$route.query.projectId; |
||||
this.getInfoData(); |
||||
} |
||||
// 判断有没有缓存数据 |
||||
if (JSON.stringify(this.projectFields) != "{}") { |
||||
let { projectManage, projectJudgmentData } = this.projectFields; |
||||
this.projectManage = projectManage; |
||||
this.projectJudgmentData = projectJudgmentData; |
||||
} |
||||
this.rowDrop(); |
||||
this.$refs.main.scrollTop = 0; |
||||
}, |
||||
beforeDestroy() { |
||||
if (!this.isToPoint) { |
||||
this.setProject({}); |
||||
} |
||||
}, |
||||
methods: { |
||||
...mapActions("project", [ |
||||
"setSystemId", "setProject" |
||||
]), |
||||
getSystemData() { |
||||
this.$get(this.api.getSystemIdBySchool).then(res => { |
||||
this.systemList = res.data; |
||||
}); |
||||
}, |
||||
getInfoData() { // 获取详情数据 |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${this.projectId}`).then(res => { |
||||
let { projectManage, projectJudgmentVos } = res; |
||||
this.projectManage = projectManage; |
||||
this.originName = projectManage.projectName |
||||
this.projectJudgmentData = projectJudgmentVos; |
||||
this.projectJudgmentData.forEach((e, i) => { |
||||
e.sort = i + 1; |
||||
}); |
||||
this.$nextTick(() => { |
||||
this.$refs.main.scrollTop = 0; |
||||
}); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
projectNameExistis() { // 项目管理名称判重 |
||||
const { projectName } = this.projectManage |
||||
if (this.originName === projectName) { |
||||
this.projectNameRepeat = false |
||||
} else { |
||||
this.$post(this.api.queryNameIsExist, { projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true |
||||
}) |
||||
} |
||||
}, |
||||
systemChange() { // 切换系统 |
||||
if (this.projectJudgmentData.length) { |
||||
this.$confirm("更换系统会清空实验任务,确认更换?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.projectJudgmentData = []; |
||||
this.setSystemId(this.projectManage.systemId); |
||||
}).catch(() => { |
||||
this.projectManage.systemId = this.lastSystemId; |
||||
// console.log(this.lastSystemId, "this.lastSystemId"); |
||||
}); |
||||
} |
||||
}, |
||||
// 去除空白标签 |
||||
removeTag(val) { |
||||
return val.replace('<p><br></p>', '') |
||||
}, |
||||
judgmentRelease(state) { //判断能否成功发布 |
||||
let { |
||||
projectName, |
||||
experimentTarget, |
||||
experimentDescription, |
||||
experimentHint, |
||||
hintOpen |
||||
} = this.projectManage; |
||||
if (!projectName) { |
||||
util.errorMsg("请输入项目名称"); |
||||
return false; |
||||
} |
||||
if (this.projectNameRepeat) { |
||||
util.errorMsg("项目名称重复!"); |
||||
return false; |
||||
} |
||||
if (state) { |
||||
if (!experimentTarget || !this.removeTag(experimentTarget)) { |
||||
util.errorMsg("请输入实验目标"); |
||||
return false; |
||||
} |
||||
if (!experimentDescription || !this.removeTag(experimentDescription)) { |
||||
util.errorMsg("请输入案例描述"); |
||||
return false; |
||||
} |
||||
if (this.projectJudgmentData.length == 0) { |
||||
util.errorMsg("请添加判分点"); |
||||
return false; |
||||
} |
||||
if (this.handDistributionScore < 100) { |
||||
util.errorMsg("判分点分数未满100"); |
||||
return false; |
||||
} |
||||
if (this.handDistributionScore > 100) { |
||||
util.errorMsg("判分点分数已超过100"); |
||||
return false; |
||||
} |
||||
if ((!experimentHint || !this.removeTag(experimentHint)) && hintOpen == 0) { |
||||
util.errorMsg("请输入实验提示"); |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
}, |
||||
handleSubmit(state) { //处理提交 |
||||
if (this.submiting) return false |
||||
if (!this.judgmentRelease(state)) { //判断页面是否有没有输入的内容 |
||||
return; |
||||
} |
||||
this.submiting = true |
||||
this.setSystemId(this.projectManage.systemId); |
||||
this.projectManage.state = state; |
||||
let { systemId } = this.projectManage; |
||||
if (this.projectId) { |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else { |
||||
// 更新 |
||||
this.updateProjectJudgment(); |
||||
} |
||||
} else { |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else { |
||||
// 添加 |
||||
let tempArr = this.projectJudgmentData.map(i => { |
||||
let obj = { |
||||
projectId: this.projectId ? this.projectId : "", |
||||
judgmentId: i.judgmentId, |
||||
score: i.score, |
||||
sort: i.sort |
||||
}; |
||||
return obj; |
||||
}); |
||||
|
||||
let params = { |
||||
projectManage: this.projectManage, |
||||
projectJudgmentList: tempArr |
||||
}; |
||||
this.addProject(params); |
||||
} |
||||
} |
||||
}, |
||||
updateProject(params) { // 更新项目 |
||||
this.$post(this.api[params.projectManage.state ? 'updateProjectManage' : 'editProjectDraft'], params).then(res => { |
||||
util.successMsg("更新实验项目成功"); |
||||
this.$router.back(); |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}); |
||||
}, |
||||
addProject(params) { // 添加项目 |
||||
console.log("🚀 ~ file: index.vue ~ line 448 ~ addProject ~ params", params) |
||||
this.$post(this.api[params.projectManage.state ? 'addProjectManage' : 'saveProjectDraft'], params).then(res => { |
||||
util.successMsg("添加实验项目成功"); |
||||
this.$router.back(); |
||||
}).catch(err => { |
||||
this.submiting = false |
||||
}); |
||||
}, |
||||
manualDistributionScore() { //点击手动分配分值 |
||||
|
||||
}, |
||||
avgDistributionScore() { |
||||
//点击平均分配分值 |
||||
if (this.projectJudgmentData.length) { |
||||
this.$get(this.api.avgValues, { |
||||
number: this.projectJudgmentData.length |
||||
}).then(res => { |
||||
if (res.data) { |
||||
this.projectJudgmentData = this.projectJudgmentData.map((item, index) => { |
||||
item.score = res.data[index]; |
||||
return item; |
||||
}); |
||||
// this.updateProjectJudgment(); |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
scoreChange(row, index, val) { // 暂时解决,输入分数,页面没有更新 |
||||
this.projectJudgmentData.splice(index, 1, row); |
||||
}, |
||||
delJudgePoint(index) { // 删除判分点 |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.projectJudgmentData.splice(index, 1); |
||||
}).catch(() => { |
||||
}); |
||||
}, |
||||
handleSelectionProjectJudgment(val) { |
||||
this.selectedProjectJudgment = val; |
||||
}, |
||||
batchDeleteProjectJudgment() { // 批量删除判分点 |
||||
if (this.selectedProjectJudgment.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let list = this.projectJudgmentData; |
||||
let result = []; |
||||
list.map(i => { |
||||
this.selectedProjectJudgment.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.projectJudgmentData = result; |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
util.errorMsg("请选择判分点"); |
||||
} |
||||
}, |
||||
handleQueryJudgment() { // 查询判分点数据 |
||||
let { systemId } = this.projectManage; |
||||
this.dialogVisible = true; |
||||
this.$nextTick(() => { |
||||
this.$refs.judgementTable.clearSelection(); |
||||
}); |
||||
let params = { |
||||
systemId, |
||||
name: this.judgementpointsquery |
||||
}; |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log("系统id:", systemId); |
||||
} else if (systemId == 11) { |
||||
// (流程)交易类 |
||||
this.rowKey = "lcId"; |
||||
this.getProcessClassData(params); |
||||
} else { |
||||
// 编程类 |
||||
this.rowKey = "bcId"; |
||||
this.getProgrammingClassData(params); |
||||
} |
||||
}, |
||||
getProcessClassData(params) { // 获取流程类判分点列表数据 |
||||
this.visibleLoading = true; |
||||
this.$get(`${this.api.getBcJudgmentPoint}`, params).then(res => { |
||||
let list = res.judgmentPoints |
||||
let result = []; |
||||
list.map(i => { |
||||
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.visibleLoading = false; |
||||
this.judgementData = result; |
||||
}).catch(err => { |
||||
this.visibleLoading = false |
||||
}); |
||||
}, |
||||
getProgrammingClassData(params) { // 获取编程类判分点列表数据 |
||||
this.visibleLoading = true; |
||||
this.$get(this.api.getBcJudgmentPoint, params).then(res => { |
||||
let list = res.judgmentPoints |
||||
let result = []; |
||||
list.map(i => { |
||||
this.projectJudgmentData.find(j => j.judgmentId === i.judgmentId) || result.push(i); |
||||
}); |
||||
this.visibleLoading = false; |
||||
this.judgementData = result; |
||||
}).catch(err => { |
||||
this.visibleLoading = false |
||||
}); |
||||
}, |
||||
handleSelectionJudgment(val) { // 处理多选判分点 |
||||
this.selectedJudgment = val; |
||||
}, |
||||
addJudgment() { // 确认选择判分点 |
||||
if (this.selectedJudgment.length) { |
||||
// console.log(this.selectedJudgment, "queren"); |
||||
this.dialogVisible = false; |
||||
let tempArr = this.selectedJudgment.map(i => { |
||||
i.score = 0; |
||||
return i; |
||||
}); |
||||
this.projectJudgmentData = this.projectJudgmentData.concat(tempArr); |
||||
this.projectJudgmentData.map((e, i) => { |
||||
e.sort = i + 1; |
||||
}); |
||||
this.$nextTick(() => { |
||||
this.$refs.projectJudgementTable.clearSelection(); |
||||
}); |
||||
} else { |
||||
util.errorMsg("请选择判分点"); |
||||
} |
||||
}, |
||||
handleCacheData() { // 处理缓存数据 |
||||
this.isToPoint = true; |
||||
this.setProject({ projectManage: this.projectManage, projectJudgmentData: this.projectJudgmentData }); |
||||
}, |
||||
toJudgePoint(type, row) { // 进入判分点系统 |
||||
this.handleCacheData(); |
||||
let jumpPath = Setting.jumpPath; |
||||
// let jumpPath = "http://192.168.31.154:8087/"; // 本地 |
||||
let { systemId } = this.projectManage; |
||||
let href = ""; |
||||
if (type === "view") { |
||||
// 查看 |
||||
if (systemId == 2) { |
||||
console.log(systemId); |
||||
} else if (systemId == 3) { |
||||
console.log(systemId); |
||||
} else if (systemId == 11) { |
||||
// 交易类判分点(银行综合系统) |
||||
href = `${jumpPath}#/Transaction?isView=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${window.btoa(location.href)}`; |
||||
} else { |
||||
// 编程类判分点(python子系统) |
||||
href = `${jumpPath}#/program?isView=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${window.btoa(location.href)}`; |
||||
} |
||||
} else if (type === "edit") { |
||||
// 自定义(老师端隐藏此功能) |
||||
if (systemId == 2) { |
||||
console.log(systemId); |
||||
} else if (systemId == 3) { |
||||
console.log(systemId); |
||||
} else if (systemId == 11) { |
||||
// 交易类判分点(银行综合系统) |
||||
href = `${jumpPath}#/Transaction?isEdit=true&systemId=${systemId}&lcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} else { |
||||
// 编程类判分点(python子系统) |
||||
href = `${jumpPath}#/program?isEdit=true&systemId=${systemId}&bcId=${row.judgmentId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} |
||||
} else if (type === "home") { |
||||
if (systemId == 2 || systemId == 3) { |
||||
console.log(systemId); |
||||
} else { |
||||
// 进入判分点系统首页(老师端隐藏此功能) |
||||
href = `${jumpPath}#/?systemId=${systemId}&token=${this.token}&referrer=${btoa(location.href)}`; |
||||
} |
||||
} |
||||
location.href = href; |
||||
}, |
||||
permissionChange(){ |
||||
if (this.projectManage.permissions == 1){ |
||||
this.projectManage.hintOpen = 1 |
||||
}else{ |
||||
this.projectManage.hintOpen = 0 |
||||
} |
||||
}, |
||||
// 行拖拽 |
||||
rowDrop() { |
||||
// 此时找到的元素是要拖拽元素的父容器 |
||||
const tbody = document.querySelector(".draggable .el-table__body-wrapper tbody"); |
||||
const _this = this; |
||||
Sortable.create(tbody, { |
||||
// 指定父元素下可被拖拽的子元素 |
||||
draggable: ".draggable .el-table__row", |
||||
onEnd({ newIndex, oldIndex }) { |
||||
_this.projectJudgmentData.splice(newIndex, 0, _this.projectJudgmentData.splice(oldIndex, 1)[0]); |
||||
let newArray = _this.projectJudgmentData.slice(0); |
||||
_this.projectJudgmentData = []; |
||||
_this.$nextTick(function () { |
||||
newArray.forEach((e, i) => { |
||||
_this.$set(e, "sort", i + 1);// 不更新 |
||||
_this.$set(e, "name", e.name + "?"); |
||||
_this.$set(e, "name", e.name.slice(0, e.name.length - 1)); // 不更新的解决方案 |
||||
}); |
||||
_this.projectJudgmentData = newArray; |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
// 修改判分点中间表 |
||||
async updateProjectJudgment() { |
||||
let param = this.projectJudgmentData.map((e, i) => { |
||||
let obj = { |
||||
judgmentId: e.judgmentId, |
||||
projectId: this.projectId || "", |
||||
score: e.score, |
||||
sort: i + 1, |
||||
id: e.id |
||||
}; |
||||
return obj; |
||||
}); |
||||
await this.$post(`${this.api.updateProjectJudgment}?projectId=${this.projectId}`, param).then(res => { |
||||
let tempArr = this.projectJudgmentData.map(i => { |
||||
let obj = { |
||||
projectId: this.projectId ? this.projectId : "", |
||||
judgmentId: i.judgmentId, |
||||
score: i.score, |
||||
sort: i.sort |
||||
}; |
||||
return obj; |
||||
}); |
||||
let params = { |
||||
projectManage: this.projectManage, |
||||
projectJudgmentList: tempArr |
||||
}; |
||||
this.updateProject(params); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
// 返回列表 |
||||
toList() { |
||||
this.$router.back() |
||||
}, |
||||
// 返回 |
||||
back() { |
||||
// 更改了信息才需要提示 |
||||
if(this.updateTime > 1){ |
||||
this.$confirm('编辑的内容未保存,是否保存?', "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.handleSubmit(this.projectManage.state) |
||||
}).catch(() => { |
||||
this.toList() |
||||
}) |
||||
} else { |
||||
this.toList() |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
/deep/ .readonly .ql-toolbar { |
||||
height: 0; |
||||
padding: 0; |
||||
border-bottom: 0; |
||||
} |
||||
.main{ |
||||
overflow: auto; |
||||
overflow-x: hidden; |
||||
height: calc(100vh - 152px ); |
||||
} |
||||
</style> |
@ -1,436 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-card v-if="showBack" shadow="hover" class="m-b-20"> |
||||
<el-page-header content="实验项目管理" @back="goBack"></el-page-header> |
||||
</el-card> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<label>创建人</label> |
||||
<el-select v-model="queryData.founder" placeholder="请选择创建人" @change="founderChange"> |
||||
<el-option |
||||
v-for="(item,index) in founderList" |
||||
:key="index" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>状态</label> |
||||
<el-select v-model="queryData.state" clearable placeholder="请选择状态" @change="initData"> |
||||
<el-option |
||||
v-for="(item,index) in stateList" |
||||
:key="index" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>权限</label> |
||||
<el-select v-model="queryData.permissions" placeholder="请选择" @change="initData"> |
||||
<el-option |
||||
v-for="item in permissionsList" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>课程</label> |
||||
<el-select v-model="queryData.cid" @change="courseChange"> |
||||
<el-option |
||||
v-for="item in curriculumList" |
||||
:key="item.cid" |
||||
:label="item.curriculumName" |
||||
:value="item.cid"> |
||||
</el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>系统</label> |
||||
<el-select v-model="systemId" placeholder="请选择" @change="initData"> |
||||
<el-option |
||||
v-for="item in systemList" |
||||
:key="item.id" |
||||
:label="item.label" |
||||
:value="item.id" |
||||
></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button v-auth type="info" @click="add">新增项目</el-button> |
||||
<el-button v-auth type="primary" @click="delAllData">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" |
||||
@selection-change="handleSelectionChange"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="disabledSelection"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope">{{ scope.$index + (page - 1) * pageSize + 1 }}</template> |
||||
</el-table-column> |
||||
<el-table-column prop="projectName" label="实验项目名称" min-width="400" align="center" show-overflow-tooltip></el-table-column> |
||||
<el-table-column prop="founder" label="创建人" min-width="150" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ founderKeys[scope.row.founder] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="权限" min-width="120" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ permissionsKeys[scope.row.permissions] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="createTime" label="创建时间" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="status" label="状态" min-width="100" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ stateKeys[scope.row.state] }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" width="300" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row, 1)">查看</el-button> |
||||
<el-button v-if="scope.row.founder && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="edit(scope.row)">编辑</el-button> |
||||
<el-button v-if="scope.row.founder && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="handleDelete(scope.row.projectId)">删除</el-button> |
||||
<el-button v-auth type="text" @click="copyData(scope.row.projectId)">复制</el-button> |
||||
<el-switch |
||||
v-auth="'禁用'" |
||||
v-if="scope.row.state" |
||||
v-model="scope.row.ccupationlabOpen" |
||||
:active-text="scope.row.ccupationlabOpen ? '关闭' : '启用'" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
style="margin: 0 10px 0 10px" |
||||
@change="switchOff(scope.row)" |
||||
></el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog title="复制" :visible.sync="copyVisible" width="24%" center :close-on-click-modal="false"> |
||||
<el-form> |
||||
<el-form-item> |
||||
<!--前端不用做名称判重了:@change='projectNameExistis'--> |
||||
<el-input placeholder="请输入项目名称" v-model="projectName"></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="copyVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="copySubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState, mapActions, mapMutations } from "vuex"; |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
showBack: Boolean(this.$route.query.show), |
||||
roleIdEd: this.roleId ? 13 : this.roleId,// 管理员的roleId是13,老师的roleId是14,1个用户也可能是两个角色,就是13,14,当一个用户是两个角色的话,就取权重大的一个,就是管理员,即13;管理员>老师 |
||||
systemId: "", |
||||
systemList: [], |
||||
systemListAll: [], |
||||
curriculumId: '', |
||||
curriculumList: [], |
||||
queryData: { |
||||
platformId: 1, // 平台:职站:1 中台:3 |
||||
founder: +this.$route.query.founder || 2, // 创建人角色(0:系统 1:老师 2:全部) |
||||
state: "", // 状态(0:草稿箱 1:已发布) |
||||
permissions: "", // 项目权限(0:练习 1:考核 2:竞赛) |
||||
cid: '' |
||||
}, |
||||
keyword: "", |
||||
status: "", |
||||
listData: [], |
||||
total: 0, |
||||
permissionsList: [ |
||||
{ |
||||
value: "", |
||||
label: "不限" |
||||
}, { |
||||
value: 0, |
||||
label: "练习" |
||||
}, { |
||||
value: 1, |
||||
label: "考核" |
||||
}, { |
||||
value: 2, |
||||
label: "竞赛" |
||||
} |
||||
], |
||||
permissionsKeys: { |
||||
0: "练习", |
||||
1: "考核", |
||||
2: "竞赛" |
||||
}, |
||||
founderList: [ |
||||
{ |
||||
value: 2, |
||||
label: "全部" |
||||
}, { |
||||
value: 0, |
||||
label: "系统" |
||||
}, { |
||||
value: 1, |
||||
label: "老师" |
||||
} |
||||
], |
||||
founderKeys: { |
||||
0: "系统", |
||||
1: "老师" |
||||
}, |
||||
stateList: [ |
||||
{ |
||||
value: "", |
||||
label: "不限" |
||||
}, { |
||||
value: 0, |
||||
label: "草稿箱" |
||||
}, { |
||||
value: 1, |
||||
label: "已发布" |
||||
} |
||||
], |
||||
stateKeys: { |
||||
0: "草稿箱", |
||||
1: "已发布" |
||||
}, |
||||
page: +this.$route.query.page || 1, |
||||
pageSize: 10, |
||||
multipleSelection: [], |
||||
copyVisible: false, |
||||
projectName: "", |
||||
currentRow: {}, // 复制之后,提交到后台的数据 |
||||
listDataAll: [], |
||||
isFirst: true |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapState("user", [ |
||||
"userId", "roleId", 'roleName' |
||||
]), |
||||
...mapState("project", [ |
||||
"lastSystemId", |
||||
"assFields", |
||||
"queryDataStatus", |
||||
]) |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
}, |
||||
queryData: { |
||||
handler: function(newVal) { |
||||
this.setQueryStatus({...newVal}) |
||||
}, |
||||
deep: true |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.getSystemData() |
||||
if(this.queryDataStatus.platformId) { |
||||
this.queryData = this.queryDataStatus |
||||
} |
||||
}, |
||||
methods: { |
||||
...mapActions("project", [ |
||||
"setSystemId" |
||||
]), |
||||
...mapMutations({ |
||||
setQueryStatus: "project/SET_QUERYDATASTATUS" |
||||
}), |
||||
getData() { |
||||
this.setSystemId(this.systemId); |
||||
if (this.isFirst) this.page = +this.$route.query.page || 1 |
||||
let data = { |
||||
...this.queryData, |
||||
projectName: this.keyword, |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
systemId: this.systemId |
||||
}; |
||||
this.$post(this.api.queryProjectManage, data).then(res => { |
||||
this.isFirst = false |
||||
this.listData = res.data.records; |
||||
this.total = res.data.total; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 获取系统 |
||||
getSystemData() { |
||||
this.$get(this.api.getSystemIdBySchool).then(({ data }) => { |
||||
this.systemListAll = data |
||||
// 如果systemId有历史记录,就取历史记录里的systemId,否则就取默认的systemId |
||||
this.getschoolCourse() |
||||
}); |
||||
}, |
||||
// 获取课程 |
||||
getschoolCourse() { |
||||
this.$get(this.api.schoolCourse).then(({ data }) => { |
||||
this.curriculumList = data |
||||
const { cid } = this.queryData |
||||
if (data.length) { |
||||
this.queryData.cid = cid || data[0].cid |
||||
this.courseChange() |
||||
} |
||||
}).catch(err => {}) |
||||
}, |
||||
// 课程选择回调 |
||||
courseChange(val) { |
||||
const systemIds = this.curriculumList.find(e => e.cid == this.queryData.cid).systemId.split(',') // 获取选取的课程的systemId |
||||
this.systemList = this.systemListAll.filter(e => systemIds.includes(e.id + '')) // 筛选出该课程下的系统 |
||||
this.systemId = this.systemList.length ? this.systemList[0].id : '' |
||||
this.initData() |
||||
}, |
||||
// 创建人选择回调 |
||||
founderChange(val) { |
||||
this.$router.push({ |
||||
path: 'list', |
||||
query: { |
||||
...this.$route.query, |
||||
founder: val |
||||
} |
||||
}) |
||||
this.initData() |
||||
}, |
||||
initData() { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
disabledSelection(row, index) { // 禁用勾选 |
||||
const roleName = this.roleName |
||||
if (row.founder && (roleName.includes('超级') || roleName === row.roleName || (roleName === '管理员' && !row.roleName.includes('超级')))) return true |
||||
return false |
||||
}, |
||||
handleCurrentChange(val) { // 切换页码 |
||||
this.page = val; |
||||
this.$router.push({ |
||||
path: 'list', |
||||
query: { |
||||
...this.$route.query, |
||||
page: val |
||||
} |
||||
}) |
||||
this.getData(); |
||||
}, |
||||
add() { // 新增项目 |
||||
this.setSystemId(this.systemId); |
||||
this.$router.push(`/project/add?founder=${this.queryData.founder}`); |
||||
}, |
||||
edit(row, show) { // 编辑 |
||||
this.setSystemId(row.systemId); |
||||
this.$router.push(`/project/add?projectId=${row.projectId}&founder=${this.queryData.founder}${show ? `&show=1` : ''}`); |
||||
}, |
||||
handleSelectionChange(val) { // 处理多选 |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData() { // 批量删除 |
||||
if (this.multipleSelection.length) { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.projectId; |
||||
}); |
||||
let strIds = ids.toString(); |
||||
this.handleDelete(strIds); |
||||
} else { |
||||
util.errorMsg("请先选择项目"); |
||||
} |
||||
}, |
||||
handleDelete(ids) { // 删除 |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.deleteProjectManage}?projectIds=${ids}&platformId=${this.queryData.platformId}`).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.$refs.table.clearSelection() |
||||
this.getData(); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}).catch(() => { |
||||
this.$message.info("已取消删除"); |
||||
}); |
||||
}, |
||||
switchOff(row) { // 更新是否启用 |
||||
this.$get(`${this.api.updateIsOpen}?isOpen=${row.ccupationlabOpen}&projectId=${row.projectId}&platformId=${this.queryData.platformId}`).then(res => { |
||||
util.successMsg("更新启用状态成功"); |
||||
this.getData(); |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
projectNameExistis() { // 项目管理名称判重 |
||||
if (this.projectName) { |
||||
this.$post(this.api.queryNameIsExist, { projectName: this.projectName }).then(res => { |
||||
if (res.status === 200) { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}).catch(err => { |
||||
this.projectNameRepeat = true; |
||||
}); |
||||
} else { |
||||
this.projectNameRepeat = false; |
||||
} |
||||
}, |
||||
copyData(projectId) { // 复制,根据项目id查询详情 |
||||
this.copyVisible = true; |
||||
this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { |
||||
this.projectName = res.projectManage.projectName; |
||||
this.currentRow = { |
||||
projectManage: res.projectManage, |
||||
projectJudgmentList: res.projectJudgmentVos |
||||
}; |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
copySubmit() { |
||||
if (!this.projectName) { |
||||
util.warningMsg("请输入项目名称"); |
||||
return; |
||||
} |
||||
; |
||||
if (this.projectNameRepeat) { |
||||
util.warningMsg("该项目名称已存在"); |
||||
return; |
||||
} |
||||
this.currentRow.projectManage.projectName = this.projectName; |
||||
this.currentRow.projectManage.projectId = ""; |
||||
this.currentRow.projectJudgmentList.forEach(i => { |
||||
i.projectId = ""; |
||||
}); |
||||
this.$post(`${this.api.copyProjectManage}`, this.currentRow).then(res => { |
||||
this.initData(); |
||||
util.successMsg("复制实验项目成功"); |
||||
this.copyVisible = false; |
||||
}).catch(err => { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
goBack() { // 返回 |
||||
this.$router.back(); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
@ -0,0 +1,271 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button v-auth="'角色权限:新增角色'" type="info" round @click="addRole">新增角色</el-button> |
||||
<el-button v-auth="'角色权限:批量删除'" type="primary" round @click="delAllSelection">批量删除</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys"> |
||||
<el-table-column type="selection" width="55" align="center" :selectable="practiceSelectable" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
||||
<el-table-column prop="roleName" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> |
||||
<el-table-column label="角色描述" min-width="400" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button v-auth="'角色权限:查看'" type="text" @click="showRole(scope.row)">查看</el-button> |
||||
<el-button v-auth="'角色权限:编辑'" v-if="scope.row.roleName !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button> |
||||
<el-button v-auth="'角色权限:删除'" v-if="scope.row.roleName !== '超级管理员' && scope.row.roleName !== '管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
||||
</div> |
||||
|
||||
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false"> |
||||
<el-form ref="form" label-width="80px" :disabled="isDetail"> |
||||
<el-form-item label="角色名称"> |
||||
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="角色描述"> |
||||
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="role" label="角色权限"> |
||||
<div style="max-height: 300px; overflow: auto"> |
||||
<el-tree |
||||
ref="per" |
||||
:data="permissions" |
||||
show-checkbox |
||||
default-expand-all |
||||
node-key="id" |
||||
:default-expanded-keys="checkedIds" |
||||
:default-checked-keys="checkedIds" |
||||
:props="defaultProps"> |
||||
</el-tree> |
||||
</div> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
||||
<el-button @click="roleVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="saveData">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import util from "@/libs/util"; |
||||
import Setting from "@/setting"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
keyword: "", |
||||
searchTimer: null, |
||||
isDetail: false, |
||||
form: { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}, |
||||
listData: [], |
||||
defaultProps: { |
||||
children: "children", |
||||
label: "name" |
||||
}, |
||||
page: 1, |
||||
pageSize: 10, |
||||
total: 0, |
||||
multipleSelection: [], |
||||
isAdd: true, |
||||
roleVisible: false, |
||||
permissions: [], |
||||
checkedIds: [], |
||||
roleNameReapeat: false // 角色名称是否重复 |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.getData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.getData(); |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${util.encodeStr(this.keyword)}&platformId=1&port=0`).then(res => { |
||||
this.listData = res.rolePage.records; |
||||
this.total = res.rolePage.total; |
||||
}).catch(res => {}); |
||||
}, |
||||
currentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => { |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
}).catch(() => {}); |
||||
}, |
||||
getRowKeys(row) { |
||||
return row.id; |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllSelection() { |
||||
if (this.multipleSelection.length) { |
||||
this.$confirm("确定要删除吗?", "提示", { |
||||
type: "warning" |
||||
}).then(() => { |
||||
let ids = this.multipleSelection.map(item => { |
||||
return item.id; |
||||
}); |
||||
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
util.successMsg("删除成功"); |
||||
this.getData(); |
||||
}).catch(res => {}); |
||||
if(this.multipleSelection.length === this.listData.length && this.page>1) { |
||||
this.handleCurrentChange(this.page - 1) |
||||
} |
||||
}).catch(() => {}); |
||||
} else { |
||||
util.errorMsg("请先选择数据!"); |
||||
} |
||||
}, |
||||
practiceSelectable(row, index){ |
||||
let boolean = true; |
||||
if(row.roleName == '超级管理员'){ |
||||
boolean = false |
||||
}else{ |
||||
boolean = true |
||||
} |
||||
return boolean; |
||||
}, |
||||
closeRole() { |
||||
this.isDetail = false; |
||||
this.form = { |
||||
id: "", |
||||
roleName: "", |
||||
remark: "" |
||||
}; |
||||
this.checkedIds = []; |
||||
this.permissions = []; |
||||
}, |
||||
// 获取权限菜单 |
||||
getPer(row) { |
||||
if (!this.permissions.length) { |
||||
this.$get(`${this.api.queryAllMenus}?platformId=${Setting.platformId}`).then(res => { |
||||
let data = res.children; |
||||
// 因为有些菜单是后来去掉的,但是数据库里要去掉的话就得全部重新加了,所以就在前端来手动把不需要了的菜单给去掉,下面同理 |
||||
let yw = data.findIndex(n => n.name == "业务后台"); |
||||
yw != -1 && data.splice(yw, 1); |
||||
try { |
||||
let system = data.findIndex(n => n.name == "系统设置"); |
||||
|
||||
if (system != -1) { |
||||
data[system].children[1].children.splice(4, 1); |
||||
data[system].children[1].children.splice(1, 1); |
||||
data[system].children[1].children.splice(0, 1); |
||||
} |
||||
} catch (error) { |
||||
} |
||||
this.permissions = data; |
||||
if (row) { |
||||
this.getDetail(row); |
||||
} |
||||
}).catch(res => { |
||||
}); |
||||
} |
||||
}, |
||||
addRole() { |
||||
this.isAdd = true; |
||||
this.getPer(); |
||||
this.checkedIds = []; |
||||
this.permissions.length && this.$refs.per.setCheckedNodes([]); |
||||
this.roleVisible = true; |
||||
}, |
||||
// 递归处理勾选的权限 |
||||
handleRolePer(data, permissions) { |
||||
let result = data; |
||||
if (permissions.length) { |
||||
permissions.map(e => { |
||||
if (result.includes(e.id) && e.children) { |
||||
// 如果该权限下的子权限不是每个都勾选了,就把该权限的id从已勾选的id集合里去除,因为如果不去除的话,这个权限就会勾选,同时会把该权限下的所有子权限都一起勾选 |
||||
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1); |
||||
} |
||||
e.children && e.children.length && this.handleRolePer(data, e.children); |
||||
}); |
||||
} |
||||
return result; |
||||
}, |
||||
async getDetail(row) { // 查询详情 |
||||
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); |
||||
this.form = res.role; |
||||
this.form.id = row.id; |
||||
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); |
||||
this.$refs.per.setCheckedNodes(this.checkedIds); |
||||
}, |
||||
showRole(row) { |
||||
this.isDetail = true; |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
editRole(row) { |
||||
this.isAdd = false; |
||||
this.getPer(row); |
||||
this.roleVisible = true; |
||||
}, |
||||
async saveData() { |
||||
if (!this.form.roleName) return util.warningMsg("请填写角色名称"); |
||||
if (!this.form.remark) return util.warningMsg("请填写角色描述"); |
||||
if (!this.$refs.per.getCheckedKeys().length) return util.warningMsg("请选择角色权限"); |
||||
// 获取已勾选的,和半勾选的(即子级没有全部勾选的节点),半勾选的一样要传给后端 |
||||
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]; |
||||
let data = { |
||||
...this.form, |
||||
permissionId, |
||||
platformId:1, |
||||
}; |
||||
if (this.form.id) { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
util.successMsg("修改成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
} else { |
||||
this.$post(this.api.saveOrUpdate, data).then(res => { |
||||
util.successMsg("新增成功"); |
||||
this.getData(); |
||||
this.roleVisible = false; |
||||
}).catch(res => {}); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
@ -0,0 +1,86 @@ |
||||
<template> |
||||
<div class="page"> |
||||
<h6 class="p-title">筛选</h6> |
||||
<div class="tool mul"> |
||||
<ul class="filter"> |
||||
<li> |
||||
<el-input placeholder="请输入站点名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable style="width: 300px"></el-input> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
|
||||
<el-table ref="table" :data="list" class="table" stripe header-align="center" row-key="id"> |
||||
<el-table-column type="index" width="60" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="name" label="站点名称" align="center"></el-table-column> |
||||
<el-table-column prop="domain" label="域名" align="center"></el-table-column> |
||||
<el-table-column label="操作" width="170" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="toIndex(scope.row)">前往网站首页</el-button> |
||||
<el-button type="text" @click="content(scope.row)">内容管理</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"></el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapState } from "vuex"; |
||||
import util from "@/libs/util"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
keyword: '', |
||||
page: +this.$route.query.page || 1, // 当前页数 |
||||
pageSize: 10, // 每页10条 |
||||
total: 0, // 总数 |
||||
list: [ |
||||
{ |
||||
id: 1, |
||||
name: '粒子研究院中文站点', |
||||
domain: 'www.iasf.ac.cn' |
||||
}, |
||||
{ |
||||
id: 2, |
||||
name: '粒子研究院英文文站点', |
||||
domain: 'www.iasf.ac.en' |
||||
} |
||||
] |
||||
}; |
||||
}, |
||||
watch: { |
||||
keyword: function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500) |
||||
} |
||||
}, |
||||
mounted() { |
||||
|
||||
}, |
||||
methods: { |
||||
handleCurrentChange(val) { |
||||
this.page = val |
||||
}, |
||||
// 前往网站首页 |
||||
toIndex(row) { |
||||
|
||||
}, |
||||
// 内容管理 |
||||
content(row) { |
||||
this.$router.push(`/page`) |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
|
||||
</style> |
@ -0,0 +1,29 @@ |
||||
import BasicLayout from '@/layouts/home' |
||||
|
||||
const meta = {} |
||||
|
||||
const pre = 'article-' |
||||
|
||||
export default { |
||||
path: '/article', |
||||
name: 'article', |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import('@/pages/article/list'), |
||||
meta: { title: '文章管理' } |
||||
}, |
||||
{ |
||||
name: `${pre}add`, |
||||
path: `add`, |
||||
component: () => import('@/pages/article/add'), |
||||
meta: { title: '添加文章' } |
||||
} |
||||
] |
||||
} |
@ -1,29 +0,0 @@ |
||||
import BasicLayout from "@/layouts/home"; |
||||
|
||||
const meta = {}; |
||||
|
||||
const pre = "assessment-"; |
||||
|
||||
export default { |
||||
path: "/assessment", |
||||
name: "assessment", |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import("@/pages/assessment/list"), |
||||
meta: { title: "考核管理" } |
||||
}, |
||||
{ |
||||
name: `${pre}add`, |
||||
path: `add`, |
||||
component: () => import("@/pages/assessment/add/index.vue"), |
||||
meta: { title: "添加考核" } |
||||
} |
||||
] |
||||
}; |
@ -0,0 +1,29 @@ |
||||
import BasicLayout from '@/layouts/home' |
||||
|
||||
const meta = {} |
||||
|
||||
const pre = 'column-' |
||||
|
||||
export default { |
||||
path: '/column', |
||||
name: 'column', |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import('@/pages/column/list'), |
||||
meta: { title: '栏目管理' } |
||||
}, |
||||
{ |
||||
name: `${pre}add`, |
||||
path: `add`, |
||||
component: () => import('@/pages/column/add/index.vue'), |
||||
meta: { title: '添加栏目' } |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,29 @@ |
||||
import BasicLayout from '@/layouts/home' |
||||
|
||||
const meta = {} |
||||
|
||||
const pre = 'page-' |
||||
|
||||
export default { |
||||
path: '/page', |
||||
name: 'page', |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import('@/pages/page/list'), |
||||
meta: { title: '页面管理' } |
||||
}, |
||||
{ |
||||
name: `${pre}add`, |
||||
path: `add`, |
||||
component: () => import('@/pages/page/add/index.vue'), |
||||
meta: { title: '添加页面' } |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,23 @@ |
||||
import BasicLayout from '@/layouts/home' |
||||
|
||||
const meta = {} |
||||
|
||||
const pre = 'role-' |
||||
|
||||
export default { |
||||
path: '/role', |
||||
name: 'role', |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import('@/pages/role/list'), |
||||
meta: { title: '角色管理' } |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,23 @@ |
||||
import BasicLayout from '@/layouts/home' |
||||
|
||||
const meta = {} |
||||
|
||||
const pre = 'site-' |
||||
|
||||
export default { |
||||
path: '/site', |
||||
name: 'site', |
||||
redirect: { |
||||
name: `${pre}list` |
||||
}, |
||||
meta, |
||||
component: BasicLayout, |
||||
children: [ |
||||
{ |
||||
name: `${pre}list`, |
||||
path: `list`, |
||||
component: () => import('@/pages/site/list'), |
||||
meta: { title: '站点管理' } |
||||
} |
||||
] |
||||
} |
@ -1,6 +1,6 @@ |
||||
/* 改变主题色变量 */ |
||||
|
||||
$--color-primary: #9278FF; |
||||
$--color-primary: #2962FF; |
||||
|
||||
/* 改变 icon 字体路径变量,必需 */ |
||||
$--font-path: '~element-ui/lib/theme-chalk/fonts'; |
||||
|