项目调整,培训计划变更

This commit is contained in:
Yjhon 2022-03-10 17:28:30 +08:00
parent 372890bc7a
commit 8f4387f5cc
11 changed files with 476 additions and 150 deletions

View File

@ -32,6 +32,7 @@
"mockjs2": "1.0.8", "mockjs2": "1.0.8",
"moment": "^2.24.0", "moment": "^2.24.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qs": "^6.10.3",
"react-draft-wysiwyg": "^1.14.7", "react-draft-wysiwyg": "^1.14.7",
"store": "^2.0.12", "store": "^2.0.12",
"viser-vue": "^2.4.6", "viser-vue": "^2.4.6",
@ -76,4 +77,4 @@
"webpack": "^4.44.2", "webpack": "^4.44.2",
"webpack-theme-color-replacer": "^1.3.12" "webpack-theme-color-replacer": "^1.3.12"
} }
} }

View File

@ -5,90 +5,98 @@ import notification from 'ant-design-vue/es/notification'
import { VueAxios } from './axios' import { VueAxios } from './axios'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import router from '../router' import router from '../router'
import qs from 'qs'
const SUCCESS_CODE = 200 const SUCCESS_CODE = 200
const INVALID_TOKEN_CODE = 401 const INVALID_TOKEN_CODE = 401
const toast = (msg, description) => { const toast = (msg, description) => {
notification.error({ notification.error({
message: msg, message: msg,
description: description description: description
}) })
} }
// 创建 axios 实例 // 创建 axios 实例
const request = axios.create({ const request = axios.create({
// API 请求的默认前缀 // API 请求的默认前缀
baseURL: process.env.VUE_APP_API_BASE_URL, baseURL: process.env.VUE_APP_API_BASE_URL,
timeout: 60000 // 请求超时时间 timeout: 60000 // 请求超时时间
}) })
// 异常拦截处理器 // 异常拦截处理器
const errorHandler = (error) => { const errorHandler = (error) => {
if (error.response) { if (error.response) {
const data = error.response.data const data = error.response.data
// 从 localstorage 获取 token // 从 localstorage 获取 token
const token = storage.get(ACCESS_TOKEN) const token = storage.get(ACCESS_TOKEN)
if (error.response.status === 403) { if (error.response.status === 403) {
toast('Forbidden:', data.msg) toast('Forbidden:', data.msg)
}
if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
toast('Unauthorized:', 'Authorization verification failed')
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
window.location.reload()
}, 1500)
})
}
}
} }
if (error.response.status === 401 && !(data.result && data.result.isLogin)) { return Promise.reject(error)
toast('Unauthorized:', 'Authorization verification failed')
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
window.location.reload()
}, 1500)
})
}
}
}
return Promise.reject(error)
} }
// request interceptor // request interceptor
request.interceptors.request.use(config => { request.interceptors.request.use(config => {
const token = storage.get(ACCESS_TOKEN) const token = storage.get(ACCESS_TOKEN)
// 由于登录接口待联调token使用默认值 // 由于登录接口待联调token使用默认值
// const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjY0MjM0YmY0LTkxOWEtNDFkMS05MzZlLTMwZDU3NDhkYmVjZCJ9.J15_FhVqcm_GsNIS2BCEYf26sWQQ4pMSTedV5eKauZT8-f6480Mx1s5ZdqWdEOlORnkKSc5pUioCngbCopr9cQ' // const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjY0MjM0YmY0LTkxOWEtNDFkMS05MzZlLTMwZDU3NDhkYmVjZCJ9.J15_FhVqcm_GsNIS2BCEYf26sWQQ4pMSTedV5eKauZT8-f6480Mx1s5ZdqWdEOlORnkKSc5pUioCngbCopr9cQ'
// 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改 // 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改
if (token) { if (token) {
config.headers[ACCESS_TOKEN] = token config.headers[ACCESS_TOKEN] = token
}
if (config.method === 'post') {
if (!config.data) {
config.data = {}
} }
} if (config.method === 'post') {
return config if (!config.data) {
config.data = {}
}
}
// get方法传递数组的处理重点代码
if (config.method === 'get') {
config.paramsSerializer = function(params) {
return qs.stringify(params, { arrayFormat: 'repeat' })
}
}
return config
}, errorHandler) }, errorHandler)
// response interceptor // response interceptor
request.interceptors.response.use((response) => { request.interceptors.response.use((response) => {
if (response.status === 200 && response.data.code === SUCCESS_CODE) { if (response.status === 200 && response.data.code === SUCCESS_CODE) {
return Promise.resolve(response.data) return Promise.resolve(response.data)
} else if (response.data && response.data.code === INVALID_TOKEN_CODE) { } else if (response.data && response.data.code === INVALID_TOKEN_CODE) {
toast(response.data.msg) toast(response.data.msg)
store.dispatch('Logout').then(() => { store.dispatch('Logout').then(() => {
router.push({ name: 'login' }) router.push({ name: 'login' })
}) })
return Promise.reject(response) return Promise.reject(response)
} else { } else {
if (response.data && response.data.msg) toast(response.data.msg) if (response.data && response.data.msg) toast(response.data.msg)
return Promise.reject(response) return Promise.reject(response)
} }
}, errorHandler) }, errorHandler)
const installer = { const installer = {
vm: {}, vm: {},
install(Vue) { install(Vue) {
Vue.use(VueAxios, request) Vue.use(VueAxios, request)
} }
} }
export default request export default request
export { export {
installer as VueAxios, installer as VueAxios,
request as axios request as axios
} }

View File

@ -40,19 +40,19 @@
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<template> <template>
<a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)"> <a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)">
<a v-if="hasPerm(power.release) && record.status == '1'" href="javascript:;">发布</a> <a v-if="hasPerm(power.release) && record.status == '1' && record.projectType != 0" href="javascript:;">发布</a>
</a-popconfirm> </a-popconfirm>
<!-- <a v-if="hasPerm(power.release) && record.status == '1'" href="javascript:;" @click="handledRelease(record)">发布</a> --> <!-- <a v-if="hasPerm(power.release) && record.status == '1'" href="javascript:;" @click="handledRelease(record)">发布</a> -->
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && hasPerm(power.release) && record.status == '1'" /> <a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && hasPerm(power.release) && record.status == '1' && record.projectType != 0 " />
<a v-if="hasPerm('project:list')" href="javascript:;" @click="getDetail(record)">详情</a> <a v-if="hasPerm('project:list') " href="javascript:;" @click="getDetail(record)">详情</a>
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && ['1'].includes(record.status)" /> <a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model')" />
<a v-if="hasPerm(power.edit) && ['1'].includes(record.status)" href="javascript:;" @click="handledCreate(record)">修改</a> <a v-if="hasPerm(power.edit) && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" v-if="hasPerm(power.del) && hasPerm('project:list') && ['1'].includes(record.status)" /> <a-divider type="vertical" v-if="hasPerm(power.del) && hasPerm('project:list') && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm(power.del) && ['1'].includes(record.status)" href="javascript:;">删除</a> <a v-if="hasPerm(power.del) && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " href="javascript:;">删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical" v-if="queryParam.type == 'model'" /> <a-divider type="vertical" v-if="queryParam.type == 'model'" />
<a v-if="queryParam.type == 'model'" href="javascript:;" @click="handledCreate(record)" >编辑后发布到自主项目</a> <a v-if="queryParam.type == 'model'" href="javascript:;" @click="handledCreate(record)">编辑后发布到自主项目</a>
</template> </template>
</span> </span>
</s-table> </s-table>
@ -111,6 +111,7 @@ export default {
}, },
{ {
title: '项目状态', title: '项目状态',
key: 'status',
dataIndex: 'status', dataIndex: 'status',
customRender: (text, record, index) => { customRender: (text, record, index) => {
// 1- 2- 3- 4- // 1- 2- 3- 4-
@ -124,7 +125,7 @@ export default {
return '进行中' return '进行中'
} }
if (text == 4) { if (text == 4) {
return '已完成' return '已结束'
} }
}, },
}, },
@ -133,6 +134,7 @@ export default {
{ {
title: '操作', title: '操作',
width: 200, width: 200,
key: 'action',
align: 'center', align: 'center',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
}, },
@ -204,6 +206,7 @@ export default {
}, },
// //
changeType(path) { changeType(path) {
console.log('变更路由:',path)
var arr = [] var arr = []
if (path) { if (path) {
arr = path.split('/') arr = path.split('/')
@ -212,6 +215,23 @@ export default {
} }
let str = arr[arr.length - 1] let str = arr[arr.length - 1]
this.queryParam.type = str this.queryParam.type = str
/** 控制表格列的显示 */
if (str === 'sys' || str === 'model') {
let c = this.columns;
// console.log('columns-------c', c)
// let d = c.filter(item => {return item.key != 'startDate'})
// let e = d.filter(item => {return item.key != 'personNum'})
// let f = e.filter(item => {return item.key != 'status'})
c = c.filter(item => {return item.key != 'startDate'})
c = c.filter(item => {return item.key != 'personNum'})
c = c.filter(item => {return item.key != 'status'})
this.columns = c
console.log('columns-------', this.columns)
}
// //
str === 'sys' ? this.power.add = 'project:sys:add' : this.power.add = 'project:add' str === 'sys' ? this.power.add = 'project:sys:add' : this.power.add = 'project:add'
str === 'sys' ? this.power.del = 'project:sys:del' : this.power.del = 'project:del' str === 'sys' ? this.power.del = 'project:sys:del' : this.power.del = 'project:del'

View File

@ -1,20 +1,22 @@
<template> <template>
<!-- PageHeader 第二种使用方式 (v-slot) --> <!-- PageHeader 第二种使用方式 (v-slot) -->
<a-card :bordered="false" :title="title"> <a-card :bordered="false" :title="title">
<a-steps class="steps" :current="currentTab"> <a-steps ref="steps" class="steps" :current="currentTab">
<a-step title="基本信息" /> <a-step key="basic" title="基本信息" :disabled="true" />
<!-- <a-step title="选择单位" /> --> <!-- <a-step title="选择单位" /> -->
<a-step title="选择课程" /> <a-step key="course" title="选择课程" :disabled="true" />
<a-step v-if="this.form.projectType != 0" title="选择人员" /> <a-step key="person" title="选择人员" :disabled="true" />
<a-step v-if="['2', '4'].includes(form.trainWay)" title="组卷策略" /> <!-- v-if="this.form.projectType != 0" -->
<a-step :title="this.result ? '完成' : '失败'" /> <a-step key="zujuan" title="组卷策略" :disabled="true" />
<!-- v-if="['2', '4'].includes(form.trainWay)" -->
<a-step key="result" :title="this.result ? '完成' : '失败'" :disabled="true" />
</a-steps> </a-steps>
<div class="content"> <div class="content" >
<!-- <keep-alive exclude="result"> --> <!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" @setFormType="setFormType"/> <step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" @setFormType="setFormType" />
<!-- <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave"/> --> <!-- <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave"/> -->
<step3 v-if="currentTab === 1" :projectForm="form" :courseChange="courseChange" @nextStep="nextStep" @prevStep="prevStep" /> <step3 v-if="currentTab === 1" :projectForm="form" :courseChange="courseChange" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<step4 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" /> <step4 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<step5 v-if="currentTab === 3" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" /> <step5 v-if="currentTab === 3" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<result v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" @close="close" /> <result v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" @close="close" />
<!-- </keep-alive> --> <!-- </keep-alive> -->
@ -46,11 +48,11 @@ export default {
// - 访this // - 访this
created() { created() {
console.log('分步表单创建完成', this.$route) console.log('分步表单创建完成', this.$route)
if(this.$route.query.t === 'self') this.form.projectType = 1; if (this.$route.query.t === 'self') this.form.projectType = 1;
// if(this.$route.query.t === 'year') this.form.projectType = 2; // if(this.$route.query.t === 'year') this.form.projectType = 2;
// if(this.$route.query.t === 'unit') this.form.projectType = 3; // if(this.$route.query.t === 'unit') this.form.projectType = 3;
if(this.$route.query.t === 'year') this.form.projectType = 2; if (this.$route.query.t === 'year') this.form.projectType = 2;
if(this.$route.query.t === 'unit') this.form.projectType = 3; if (this.$route.query.t === 'unit') this.form.projectType = 3;
}, },
destroyed() { destroyed() {
console.log('分步表单销毁了。。。。。') console.log('分步表单销毁了。。。。。')
@ -59,15 +61,17 @@ export default {
return { return {
title: '', title: '',
currentTab: 0, currentTab: 0,
currentTab: 0,
sourcePath: '', sourcePath: '',
t: '', t: '',
labelCol: {xs: { span: 24 }, sm: { span: 6 } }, labelCol: { xs: { span: 24 }, sm: { span: 6 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
modalTitle: '新增项目', modalTitle: '新增项目',
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
type: '', type: '',
form: { form: {
stag: 0, //0
t: this.$route.query.t, t: this.$route.query.t,
projectType: 0, projectType: 0,
trainWay: '4', trainWay: '4',
@ -80,7 +84,7 @@ export default {
}, },
methods: { methods: {
// //
setFormType(type){ setFormType(type) {
this.form.trainWay = type this.form.trainWay = type
}, },
// //
@ -114,31 +118,42 @@ export default {
}, },
// //
nextStep(childValue,beChange) { nextStep(childValue, beChange) {
console.log('进入下一步', childValue,beChange) console.log('进入下一步', childValue, beChange)
if(beChange){ if (beChange) {
this.courseChange = beChange this.courseChange = beChange
} }
if (this.currentTab < 5) { if (this.currentTab < 4) {
if (childValue) { if (childValue) {
this.form = childValue this.form = childValue
} }
this.currentTab += 1 if (this.form.projectType == 0 && this.currentTab == 1) {
this.currentTab = 3
} else {
this.currentTab += 1
}
} }
console.log('currentTab key:', this.$refs.steps.$slots.default)
console.log('currentTab:', this.currentTab, 'currentTab:', this.currentTab)
console.log('ProjectStepForm表单数据', this.form) console.log('ProjectStepForm表单数据', this.form)
}, },
// //
prevStep(childValue,beChange) { prevStep(childValue, beChange) {
if(beChange){ if (beChange) {
this.courseChange = beChange this.courseChange = beChange
} }
console.log('返回上一步', childValue,beChange) console.log('返回上一步', childValue, beChange)
if (this.currentTab > 0) { if (this.currentTab > 0) {
if (childValue) { if (childValue) {
this.form = childValue this.form = childValue
} }
this.currentTab -= 1 if (this.form.projectType == 0 && this.currentTab == 2) {
this.currentTab = 1
} else {
this.currentTab -= 1
}
} }
console.log('currentTab:', this.currentTab, 'currentTab:', this.currentTab)
console.log('ProjectStepForm表单数据', this.form) console.log('ProjectStepForm表单数据', this.form)
}, },
//list //list

View File

@ -43,7 +43,9 @@
<project-course-select ref="CourseSelect" @selectKeyDataSubmit="selectKeyDataChange" :tabDisabled="tabDisabled" :selectRows="selData"></project-course-select> <project-course-select ref="CourseSelect" @selectKeyDataSubmit="selectKeyDataChange" :tabDisabled="tabDisabled" :selectRows="selData"></project-course-select>
<a-col :span="24" style="text-align: center;margin-top: 10px;"> <a-col :span="24" style="text-align: center;margin-top: 10px;">
<a-button type="primary" size="default" @click="toPrep" style="margin-right: 8px;">上一步</a-button> <a-button type="primary" size="default" @click="toPrep" style="margin-right: 8px;">上一步</a-button>
<a-button type="primary" size="default" @click="toNext">下一步</a-button> <a-button v-if="['2','4'].includes(form.trainWay) || form.projectType != 0 " type="primary" size="default" @click="toNext">下一步</a-button>
<a-button v-if="['1','3'].includes(form.trainWay) && form.projectType == 0 " type="primary" size="default" @click="toSaveOrIssue('save')" style="margin-right: 8px;">保存</a-button>
<a-button v-if="['1','3'].includes(form.trainWay) && form.projectType == 0 " type="primary" size="default" @click="toSaveOrIssue('issue')">发布</a-button>
</a-col> </a-col>
<a-drawer title="课程预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="courseVisible" @close="drawerClose"> <a-drawer title="课程预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="courseVisible" @close="drawerClose">
<courseware-list :courseId="selectCourseId"></courseware-list> <courseware-list :courseId="selectCourseId"></courseware-list>
@ -100,7 +102,7 @@ export default {
courseVisible: false, // courseVisible: false, //
questionVisible: false, // questionVisible: false, //
requiredTopicVisible:false, // requiredTopicVisible: false, //
queryParam: { queryParam: {
ids: '', ids: '',
@ -117,7 +119,7 @@ export default {
loadData: (parameter) => { loadData: (parameter) => {
if (this.$route.query.projectId && !this.beChange) { if (this.$route.query.projectId && !this.beChange) {
/** 编辑进来的有项目id 并且没有被编辑过*/ /** 编辑进来的有项目id 并且没有被编辑过*/
return getCourseList({id:this.$route.query.projectId}).then((res) => { return getCourseList({ id: this.$route.query.projectId }).then((res) => {
this.selData = res.data; this.selData = res.data;
this.calc(res.data) this.calc(res.data)
return res.data return res.data
@ -140,22 +142,42 @@ export default {
// //
methods: { methods: {
// //
drawerClose(){ drawerClose() {
this.courseVisible = false; this.courseVisible = false;
this.requiredTopicVisible = false; this.requiredTopicVisible = false;
this.questionVisible = false; this.questionVisible = false;
}, },
// //
openVisible(type,record) { openVisible(type, record) {
this.selectCourseId = record.id; this.selectCourseId = record.id;
if(type === 'course') this.courseVisible = true; if (type === 'course') this.courseVisible = true;
else if(type === 'topic') this.requiredTopicVisible = true; else if (type === 'topic') this.requiredTopicVisible = true;
else if(type === 'question') this.questionVisible = true; else if (type === 'question') this.questionVisible = true;
}, },
/** 删除table项 */ // &&
handleDelete(record){ toSaveOrIssue(type) {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
})
if (this.form.lessonIds.length > 0) {
console.log('进来了')
if (type != 'issue') {
console.log('save')
this.form.projectStatus = 1
this.$emit('executeSave', this.form)
} else {
console.log('issue')
this.form.projectStatus = 2
this.$emit('executeIssue', this.form)
}
} else {
this.$message.warning('培训课程不能为空')
}
}, },
// //
calc(data) { calc(data) {
@ -174,10 +196,13 @@ export default {
let ids = this.queryParam.ids.split(',') let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => { ids.forEach((id, index, arr) => {
// console.log('id-----------------------', id) // console.log('id-----------------------', id)
this.form.lessonIds.push({ ids: id, sort: index }) if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
}) })
if (this.form.lessonIds.length > 0) { if (this.form.lessonIds.length > 0) {
this.$emit('nextStep', this.form,this.beChange) console.log('----------', this.form.lessonIds)
this.$emit('nextStep', this.form, this.beChange)
} else { } else {
this.$message.warning('培训课程不能为空') this.$message.warning('培训课程不能为空')
} }
@ -187,11 +212,13 @@ export default {
this.form.lessonIds = [] this.form.lessonIds = []
let ids = this.queryParam.ids.split(',') let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => { ids.forEach((id, index, arr) => {
this.form.lessonIds.push({ ids: id, sort: index }) if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
}) })
// console.log('toPrep', this.form) // console.log('toPrep', this.form)
this.$emit('prevStep', this.form,this.beChange) this.$emit('prevStep', this.form, this.beChange)
}, },
//ids //ids
initIds() { initIds() {
@ -207,7 +234,7 @@ export default {
}) })
this.queryParam.ids = arr.join(',') this.queryParam.ids = arr.join(',')
} }
if(this.form.projectType === 0) this.tabDisabled = true; if (this.form.projectType === 0) this.tabDisabled = true;
}, },
//list //list
selectKeyDataChange(childValue) { selectKeyDataChange(childValue) {

View File

@ -5,7 +5,8 @@
<a-col :span="4" id="tree"> <a-col :span="4" id="tree">
<a-menu v-model="menuKey" mode="horizontal" @select="menuChack"> <a-menu v-model="menuKey" mode="horizontal" @select="menuChack">
<a-menu-item key="sys">系统课程</a-menu-item> <a-menu-item key="sys">系统课程</a-menu-item>
<a-menu-item key="self" :disabled="tabDis">自主课程</a-menu-item> <a-menu-item key="self" >自主课程</a-menu-item>
<!-- :disabled="tabDis" -->
</a-menu> </a-menu>
<!-- :defaultExpandedKeys="defaultExpandedKeys" --> <!-- :defaultExpandedKeys="defaultExpandedKeys" -->
<a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :replaceFields="replaceFields"> <a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :replaceFields="replaceFields">
@ -20,6 +21,13 @@
<a-form-item label="课程名称"> <a-form-item label="课程名称">
<a-input v-model="queryParam.name" placeholder="请输入课程名称" /> <a-input v-model="queryParam.name" placeholder="请输入课程名称" />
</a-form-item> </a-form-item>
<a-form-item label="标签名称">
<a-select mode="tags" style="width: 300px" placeholder="标签选择" @change="handleTagChange" :value="queryParam.tags">
<a-select-option v-for="(item,index) in dictCourseTag" :key="index" :value="item.value">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button> <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
</a-row> </a-row>
</a-form> </a-form>
@ -31,7 +39,7 @@
</s-table> </s-table>
</a-col> </a-col>
<a-col :span="6" id="select"> <a-col :span="6" id="select">
<div class="alist" > <div class="alist">
<p>点击列表项取消选择或<a @click="removeAllSelece">清空所有</a></p> <p>点击列表项取消选择或<a @click="removeAllSelece">清空所有</a></p>
<a-list size="small" :data-source="selectedRows" :rowKey="(item) => item.id"> <a-list size="small" :data-source="selectedRows" :rowKey="(item) => item.id">
<a-list-item slot="renderItem" slot-scope="item" @click="changeList({ item })"> <a-list-item slot="renderItem" slot-scope="item" @click="changeList({ item })">
@ -51,6 +59,7 @@
// import from '' // import from ''
import { coursewareClassList } from '@/api/course/courseware' import { coursewareClassList } from '@/api/course/courseware'
import { listByClass } from '@/api/course/course' import { listByClass } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { STable } from '@/components' import { STable } from '@/components'
const rootParentId = 0 const rootParentId = 0
@ -75,10 +84,11 @@ export default {
tabDis: this.tabDisabled, tabDis: this.tabDisabled,
menuKey: ['sys'], // menuKey: ['sys'], //
// //
queryParam: { name: '', classType: 1, type: 1 }, queryParam: { name: '', classType: 1, type: 1, tags: [] },
replaceFields: { children: 'children', title: 'name', key: 'value', value: 'id' }, replaceFields: { children: 'children', title: 'name', key: 'value', value: 'id' },
expandedKeys: [], expandedKeys: [],
autoExpandParent: true, autoExpandParent: true,
dictCourseTag: [], //
// defaultExpandedKeys: [], // defaultExpandedKeys: [],
selectedRowKeys: [], selectedRowKeys: [],
selectedRows: [], selectedRows: [],
@ -111,12 +121,19 @@ export default {
// //
menuChack() { menuChack() {
console.log('menuKey', this.menuKey) console.log('menuKey', this.menuKey)
//
this.queryParam.name = null
this.queryParam.tags = []
let type = 2; let type = 2;
console.log('菜单改变', this.menuKey[0]) console.log('菜单改变', this.menuKey[0])
if (this.menuKey[0] === 'self') type = 1; if (this.menuKey[0] === 'self') type = 1;
this.queryParam.type = type this.queryParam.type = type
this.getCourseTreeData(type); this.getCourseTreeData(type);
this.$refs.table.refresh(true); this.$refs.table.refresh(true);
this.queryParam.name = null
this.queryParam.tags = []
}, },
// //
edit(record) { edit(record) {
@ -147,6 +164,21 @@ export default {
this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys]) this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys])
this.selectedRows = this.unique([...this.selectedRows, ...selectedRows]) this.selectedRows = this.unique([...this.selectedRows, ...selectedRows])
}, },
//
dictionaryItemDown(code) {
//
dictionaryDropDown({ dictionaryCode: code }).then((res) => {
const tagList = res.data
for (let i = 0; i < tagList.length; i++) {
tagList[i].value = tagList[i].value.toString()
}
this.dictCourseTag = tagList
})
},
//
handleTagChange(value) {
this.queryParam.tags = value
},
/** table取消勾选 */ /** table取消勾选 */
tableOnSelect(record, selected, selectedRows, nativeEvent) { tableOnSelect(record, selected, selectedRows, nativeEvent) {
@ -243,6 +275,7 @@ export default {
// - 访this // - 访this
created() { created() {
this.getCourseTreeData(0) // this.getCourseTreeData(0) //
this.dictionaryItemDown('0008') //
}, },
// - 访DOM // - 访DOM
mounted() { }, mounted() { },

View File

@ -19,7 +19,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-model-item label="培训种类" prop="trainClass"> <a-form-model-item label="培训种类" prop="trainClass">
<a-select v-model="form.trainClass" placeholder="--请选择--"> <a-select v-model="form.trainClass" placeholder="--请选择--">
<a-select-option v-for="entity in trainClass" :key="entity.value"> {{ entity.name }} </a-select-option> <a-select-option v-for="entity in trainClass" :key="entity.value"> {{ entity.name }} </a-select-option>
</a-select> </a-select>
<!-- <a-button type="primary" @click="$refs.classList.list()"> 新增种类 </a-button> --> <!-- <a-button type="primary" @click="$refs.classList.list()"> 新增种类 </a-button> -->
@ -93,13 +93,6 @@
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }" prop="examNumber"> <a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }" prop="examNumber">
<a-input-number v-model="form.examNumber" :min="0" style="width: 100%" /> <a-input-number v-model="form.examNumber" :min="0" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
<!-- <span> 补考次数: </span>
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" />
</a-form-model-item>
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-button type="primary" @click="randomResit"> 随机补考 </a-button>
</a-form-model-item> -->
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
@ -127,8 +120,8 @@
</template> </template>
<script> <script>
import { classList } from '@/api/project/class' import { classList } from '@/api/project/class'
import { dictGet , getProjectDetail } from '@/api/project/project' import { dictGet, getProjectDetail } from '@/api/project/project'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem' import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default { export default {
props: { props: {
@ -167,17 +160,19 @@ export default {
dictGet, dictGet,
classList classList
}, },
computed: {},
created(ClassList) { created(ClassList) {
console.log('第一个表单创建了') console.log('第一个表单创建了')
if (this.$route.query.projectId) { if (this.$route.query.projectId && this.projectForm.stag == 0) {
getProjectDetail({ id: this.$route.query.projectId }).then(res => { getProjectDetail({ id: this.$route.query.projectId }).then(res => {
let form = res.data; let form = res.data;
if(this.$route.query.t == 'model') { if (this.$route.query.t == 'model') {
console.log('form',form) console.log('form', form)
form.projectType = 1; form.projectType = 1;
form.id = null;
} }
this.form = form; this.form = form;
this.$emit('setFormType',this.form.trainWay) this.$emit('setFormType', this.form.trainWay)
}) })
} }
// this.fetchTemplateData() // this.fetchTemplateData()
@ -223,10 +218,49 @@ export default {
}) })
}, },
/** 条件判断隐藏 */
condition() {
let f = this.form;
console.log('条件判断')
if (f.projectType == 0) {
f.trainSdate = null;
f.trainEdate = null;
f.practiceSdate = null;
f.practiceEdate = null;
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
} else {
if (f.trainWay == '1') {
f.practiceSdate = null;
f.practiceEdate = null;
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
}
if (f.trainWay == '2') {
f.practiceSdate = null;
f.practiceEdate = null;
f.trainSdate = null;
f.trainEdate = null;
}
if (f.trainWay == '3') {
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
}
}
this.form = f;
},
// //
//from //from
toNext() { toNext() {
// console.log('toNext', this.form) this.form.stag = 1;
this.condition();
this.$refs.form.validate(validate => { this.$refs.form.validate(validate => {
if (validate) { if (validate) {
this.$emit('nextStep', this.form) this.$emit('nextStep', this.form)
@ -237,5 +271,6 @@ export default {
destroyed() { destroyed() {
console.log('第一个表单销毁了') console.log('第一个表单销毁了')
} }
} }
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<a-card :bordered="false" title="组卷策略信息"> <a-card :bordered="false" title="组卷策略信息">
<a-form-model :rules="rules" :model="form" v-bind="formItemLayout"> <a-form-model ref="form" :rules="rules" :model="form" v-bind="formItemLayout">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="10" :sm="12"> <a-col :md="10" :sm="12">
<a-form-model-item label="总分" prop="totalScore"> <a-form-model-item label="总分" prop="totalScore">
@ -35,13 +35,7 @@
</a-row> </a-row>
<a-card :bordered="false" title="组卷策略详情"> <a-card :bordered="false" title="组卷策略详情">
<a-table <a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
:columns="columns"
:data-source="tableData"
bordered
:position="{ disabled: false }"
:pagination="false"
>
<template slot="topicNum" slot-scope="text, record"> <template slot="topicNum" slot-scope="text, record">
<a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" /> <a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" />
</template> </template>
@ -140,7 +134,7 @@ export default {
watch: { watch: {
tableData: { tableData: {
deep: true, deep: true,
handler: function() { handler: function () {
let sum = 0 let sum = 0
this.tableData.forEach(t => { this.tableData.forEach(t => {
if (t.topicNum && t.topicScore) { if (t.topicNum && t.topicScore) {
@ -156,15 +150,23 @@ export default {
methods: { methods: {
// //
toSave() { toSave() {
this.form.testPaperTactics = this.tableData.filter((Item) => {return Item.topicNum && Item.topicScore}); this.form.testPaperTactics = this.tableData.filter((Item) => { return Item.topicNum && Item.topicScore });
this.form.projectStatus = 1 this.form.projectStatus = 1
this.$emit('executeSave', this.form) this.$refs.form.validate(validate => {
if (validate) {
this.$emit('executeSave', this.form)
}
})
}, },
// //
toIssue() { toIssue() {
this.form.testPaperTactics = this.tableData.filter((Item) => {return Item.topicNum && Item.topicScore}); this.form.testPaperTactics = this.tableData.filter((Item) => { return Item.topicNum && Item.topicScore });
this.form.projectStatus = 2 this.form.projectStatus = 2
this.$emit('executeIssue', this.form) this.$refs.form.validate(validate => {
if (validate) {
this.$emit('executeIssue', this.form)
}
})
}, },
// //
toPrev() { toPrev() {
@ -195,21 +197,21 @@ export default {
this.initTable() this.initTable()
}, },
// - 访DOM // - 访DOM
mounted() {}, mounted() { },
// - // -
beforeCreate() {}, beforeCreate() { },
// - // -
beforeMount() {}, beforeMount() { },
// - // -
beforeUpdate() {}, beforeUpdate() { },
// - // -
updated() {}, updated() { },
// - // -
beforeDestroy() {}, beforeDestroy() { },
// - // -
destroyed() {}, destroyed() { },
// keep-alive // keep-alive
activated() {} activated() { }
} }
</script> </script>
<style scoped> <style scoped>

View File

@ -5,7 +5,7 @@
:form="queryParam" :form="queryParam"
:list="queryOptions" :list="queryOptions"
@search="handleRefresh" @search="handleRefresh"
@reset="() => {;(queryParam = {}), handleRefresh()}" @reset="() => {(queryParam = {}), handleRefresh()}"
></SearchCom> ></SearchCom>
<br/> <br/>
<a-space class="table-operator" direction="horizontal"> <a-space class="table-operator" direction="horizontal">
@ -69,10 +69,10 @@ export default {
// //
return { return {
queryParam: { queryParam: {
status: this.$route.query.terminalTrainStatus || null, status: null, //this.$route.query.terminalTrainStatus ||
name: this.$route.query.terminalTrainName || null, name: null, //this.$route.query.terminalTrainName ||
startDate: this.$route.query.terminalTrainStartDate || null, startDate: null, //this.$route.query.terminalTrainStartDate ||
endDate: this.$route.query.terminalTrainEndDate || null, endDate: null, //this.$route.query.terminalTrainEndDate ||
}, },
columns: [ columns: [
{ title: '序号', width: 'auto', align: 'center', dataIndex: 'id', key: 'id', scopedSlots: { customRender: 'serial' }, }, { title: '序号', width: 'auto', align: 'center', dataIndex: 'id', key: 'id', scopedSlots: { customRender: 'serial' }, },

View File

@ -0,0 +1,47 @@
<template>
<a-card :bordered="false" title="培训计划">
</a-card>
</template>
<script>
// jsjsjson
// import from ''
export default {
// import使
components: {},
props: {},
data() {
//
return {};
},
// data
computed: {},
// data
watch: {},
//
methods: {},
// - 访this
created() { },
// - 访DOM
mounted() { },
// -
beforeCreate() { },
// -
beforeMount() { },
// -
beforeUpdate() { },
// -
updated() { },
// -
beforeDestroy() { },
// -
destroyed() { },
// keep-alive
activated() { }
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,138 @@
<template>
<a-card :bordered="false" :title="title">
<a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal">
培训计划名称:
<a-input v-model="queryParam.name" style="width: 100%" />
计划年度:
<a-select v-model="queryParam.year" placeholder="请选择" default-value="null" style="width: 150px">
<a-select-option value="null">全部</a-select-option>
<a-select-option value="2022">2022年度</a-select-option>
<a-select-option value="2023">2023年度</a-select-option>
<a-select-option value="2024">2024年度</a-select-option>
</a-select>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="redo" @click="() => (queryParam.name=null,queryParam.year=null)">重置</a-button>
<a-button type="primary" icon="plus" @click="handledCreate">新增培训计划</a-button>
</a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)">
<a href="javascript:;">发布</a>
</a-popconfirm>
</template>
</span>
</s-table>
</a-space>
</a-card>
</template>
<script>
// jsjsjson
// import from ''
import { STable } from '@/components'
import { getProjectList, releaseProject, projectDel } from '@/api/project/project'
export default {
// import使
components: {
STable,
},
props: {},
data() {
//
return {
title: '',
queryParam: {
name: '',
year: '',
type: '',
},
//
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '计划名称', dataIndex: 'projectName', key: 'projectName' },
{ title: '年度', dataIndex: 'startDate', key: 'startDate', customRender: (text, record, index) => { return record.year + ' 年度 ' } },
{
title: '项目状态', key: 'status', dataIndex: 'status',
customRender: (text, record, index) => {
// 1- 2- 3- 4-
if (text == 1) {
return '未发布'
}
if (text == 2) {
return '未开始'
}
if (text == 3) {
return '进行中'
}
if (text == 4) {
return '已结束'
}
},
},
{ title: '创建人员', key: 'createBy', dataIndex: 'createBy' },
{ title: '创建时间', key: 'createDate', dataIndex: 'createDate' },
{ title: '操作', width: 200, key: 'action', align: 'center', scopedSlots: { customRender: 'action' }, },
],
// Promise
loadData: (parameter) => {
return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
};
},
// data
computed: {},
// data
watch: {
$route(to, from) { //to from
this.changeType(to.path)
this.$refs.table.refresh(true)
},
},
//
methods: {
//
changeType(path) {
console.log('变更路由:', path)
var arr = []
if (path) {
arr = path.split('/')
} else {
arr = this.$route.path.split('/')
}
let str = arr[arr.length - 1]
this.queryParam.type = str
str == 'year' ? this.title='年度培训计划列表' : this.title='单位培训计划列表'
},
// - 访this
created() { this.changeType(this.$route.path) },
// - 访DOM
mounted() { },
// -
beforeCreate() { },
// -
beforeMount() { },
// -
beforeUpdate() { },
// -
updated() { },
// -
beforeDestroy() { },
// -
destroyed() { },
// keep-alive
activated() { }
}
}
</script>
<style scoped>
</style>