parent
ed5c395643
commit
4b1c07088e
Binary file not shown.
Binary file not shown.
@ -1,328 +1,381 @@ |
||||
import request from '@/utils/request' |
||||
import request from "@/utils/request"; |
||||
|
||||
export function getSchoolList(query) { |
||||
return request({ |
||||
url: '/train/schoolList', |
||||
method: 'get', |
||||
url: "/train/schoolList", |
||||
method: "get", |
||||
params: query, |
||||
// headers: {
|
||||
// isToken: false
|
||||
// },
|
||||
}) |
||||
}); |
||||
} |
||||
|
||||
export function addSchool(data) { |
||||
return request({ |
||||
url: '/train/school/add', |
||||
method: 'post', |
||||
url: "/train/school/add", |
||||
method: "post", |
||||
data, |
||||
}) |
||||
}); |
||||
} |
||||
export function updateSchool(data) { |
||||
return request({ |
||||
url: '/train/school/update', |
||||
method: 'post', |
||||
url: "/train/school/update", |
||||
method: "post", |
||||
data, |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
export function delSchool(id) { |
||||
return request({ |
||||
url: `/train/school/del/?schoolId=${id}`, |
||||
method: 'delete', |
||||
}) |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
|
||||
export function getSignUpList(query) { |
||||
return request({ |
||||
url: `/train/trainClassList`, |
||||
method: 'get', |
||||
method: "get", |
||||
params: query, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
export function addSignUp(data) { |
||||
return request({ |
||||
url: '/train/trainClass/add', |
||||
method: 'post', |
||||
url: "/train/trainClass/add", |
||||
method: "post", |
||||
data, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
export function updateSignUp(data) { |
||||
return request({ |
||||
url: '/train/trainClass/update', |
||||
method: 'post', |
||||
url: "/train/trainClass/update", |
||||
method: "post", |
||||
data, |
||||
|
||||
|
||||
}) |
||||
}); |
||||
} |
||||
|
||||
export function delSignUp(id) { |
||||
return request({ |
||||
url: `/train/trainClass/del?trainClassId=${id}`, |
||||
method: 'delete', |
||||
|
||||
}) |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
// 查询已报名列表
|
||||
export function searchNum(params) { |
||||
return request({ |
||||
url: `/train/trainStudentList`, |
||||
method: 'get', |
||||
method: "get", |
||||
params, |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
// 人才库+教师
|
||||
// 新增人才
|
||||
export function listTalent(params) { |
||||
return request({ |
||||
url: '/talent/admin/list', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
url: "/talent/admin/list", |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
export function addTalent(data) { |
||||
return request({ |
||||
url: '/talent/admin/add', |
||||
method: 'post', |
||||
url: "/talent/admin/add", |
||||
method: "post", |
||||
data, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
// 修改人才
|
||||
export function updateTalent(data) { |
||||
return request({ |
||||
url: '/talent/admin/update', |
||||
method: 'post', |
||||
url: "/talent/admin/update", |
||||
method: "post", |
||||
data, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
|
||||
// 删除人才-删除教师
|
||||
export function deleteTalent(id) { |
||||
return request({ |
||||
url: '/talent/admin/' + id, |
||||
method: 'delete', |
||||
|
||||
}) |
||||
url: "/talent/admin/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
// 查看人才-教师详情
|
||||
export function detailTalent(id) { |
||||
return request({ |
||||
url: '/talent/admin/' + id, |
||||
method: 'get', |
||||
|
||||
}) |
||||
url: "/talent/admin/" + id, |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
export function listTeacher() { |
||||
return request({ |
||||
url: '/talent/admin/teacherList', |
||||
method: 'get', |
||||
|
||||
}) |
||||
url: "/talent/admin/teacherList", |
||||
method: "get", |
||||
}); |
||||
} |
||||
// 新增教师
|
||||
export function addTeacher(data) { |
||||
return request({ |
||||
url: '/talent/admin/teacher/add', |
||||
method: 'post', |
||||
url: "/talent/admin/teacher/add", |
||||
method: "post", |
||||
data, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
// 修改教师
|
||||
export function updateTeacher(data) { |
||||
return request({ |
||||
url: '/talent/admin/teacher/update', |
||||
method: 'post', |
||||
url: "/talent/admin/teacher/update", |
||||
method: "post", |
||||
data, |
||||
|
||||
}) |
||||
}); |
||||
} |
||||
|
||||
// 下载模板
|
||||
export function importTemplate() { |
||||
return request({ |
||||
url: '/talent/admin/download', |
||||
method: 'get', |
||||
responseType: 'blob', |
||||
|
||||
}) |
||||
url: "/talent/admin/download", |
||||
method: "get", |
||||
responseType: "blob", |
||||
}); |
||||
} |
||||
|
||||
// 查询所有教师
|
||||
export function listTeacherAll() { |
||||
return request({ |
||||
url: '/talent/findAllTeacher', |
||||
method: 'get', |
||||
}) |
||||
url: "/talent/findAllTeacher", |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
// 添加备注
|
||||
export function addRemarkI(data) { |
||||
return request({ |
||||
url: '/train/addRemark', |
||||
method: 'post', |
||||
url: "/train/addRemark", |
||||
method: "post", |
||||
data, |
||||
}) |
||||
}); |
||||
} |
||||
// 删除报名人
|
||||
export function delSign(id) { |
||||
return request({ |
||||
url: '/train/trainStuden/del?studentId=' + id, |
||||
method: 'delete', |
||||
}) |
||||
url: "/train/trainStuden/del?studentId=" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
// 师资班配置json
|
||||
export function setJson(data) { |
||||
return request({ |
||||
url: '/train/trainClass/editData', |
||||
method: 'post', |
||||
url: "/train/trainClass/editData", |
||||
method: "post", |
||||
data, |
||||
}) |
||||
}); |
||||
} |
||||
// 导出excel
|
||||
export function exportExcelF(id) { |
||||
export function exportExcelF(id, params) { |
||||
return request({ |
||||
url: '/train/importStudent/' + id, |
||||
method: 'get', |
||||
responseType: 'blob', |
||||
}) |
||||
url: "/train/importStudent/" + id, |
||||
method: "get", |
||||
params, |
||||
responseType: "blob", |
||||
}); |
||||
} |
||||
|
||||
|
||||
// 获取所有轮播图
|
||||
export function getSwiperInfo() { |
||||
return request({ |
||||
url: '/train/admin/banner/list', |
||||
method: 'get', |
||||
}) |
||||
url: "/train/admin/banner/list", |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
// 提交轮播图
|
||||
export function addSwiperInfo(data) { |
||||
return request({ |
||||
url: 'train/admin/banner/add', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
url: "train/admin/banner/add", |
||||
method: "post", |
||||
data, |
||||
}); |
||||
} |
||||
|
||||
// 获取轮播图班级类型
|
||||
export function getSwiperClass() { |
||||
return request({ |
||||
url: '/train/admin/bannerTrainClasses', |
||||
method: 'get', |
||||
}) |
||||
url: "/train/admin/bannerTrainClasses", |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
// 删除轮播图
|
||||
export function delteSwiper(id) { |
||||
console.log(id); |
||||
return request({ |
||||
url: '/train/admin/banner/' + id, |
||||
method: 'delete', |
||||
}) |
||||
url: "/train/admin/banner/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
// 获取所有班级
|
||||
export function getClassList() { |
||||
export function getClassList(params) { |
||||
return request({ |
||||
url: '/train/admin/trainClasses', |
||||
method: 'get', |
||||
}) |
||||
url: "/train/admin/trainClasses", |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
// 获取所有课程
|
||||
export function getCourseList(params) { |
||||
return request({ |
||||
url: '/course/admin/findAll', |
||||
method: 'get', |
||||
params |
||||
}) |
||||
url: "/course/admin/findAll", |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
|
||||
// 增加课程
|
||||
export function addCourseItem(data) { |
||||
return request({ |
||||
url: '/course/admin/add', |
||||
method: 'post', |
||||
data:JSON.stringify(data) |
||||
}) |
||||
url: "/course/admin/add", |
||||
method: "post", |
||||
data: JSON.stringify(data), |
||||
}); |
||||
} |
||||
|
||||
// 修改课程
|
||||
export function putCourseItem(data) { |
||||
return request({ |
||||
url: '/course/admin/update', |
||||
method: 'post', |
||||
data |
||||
}) |
||||
url: "/course/admin/update", |
||||
method: "post", |
||||
data, |
||||
}); |
||||
} |
||||
|
||||
// 删除课程
|
||||
export function delCourse(id) { |
||||
return request({ |
||||
url: '/course/admin/' + id, |
||||
method: 'delete', |
||||
}) |
||||
url: "/course/admin/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
|
||||
// 根据课程ID获取改课程下所有签到用户信息
|
||||
export function getSigninInfo(id,params) { |
||||
export function getSigninInfo(id, params) { |
||||
return request({ |
||||
url: '/course/admin/singin/' + id, |
||||
method: 'get', |
||||
params |
||||
}) |
||||
url: "/course/admin/singin/" + id, |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
// 删除签到信息
|
||||
export function delSigninItem(id) { |
||||
return request({ |
||||
url: '/course/admin/singin/' + id, |
||||
method: 'delete', |
||||
}) |
||||
url: "/course/admin/singin/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
// 考勤删除
|
||||
export function delAttendance(id) { |
||||
return request({ |
||||
url: '/course/admin/singin/class/' + id, |
||||
method: 'delete', |
||||
}) |
||||
url: "/course/admin/singin/class/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
// 获取考勤信息表
|
||||
export function getAttendanceList(id) { |
||||
return request({ |
||||
url: '/course/admin/singin/class/' + id, |
||||
method: 'get', |
||||
}) |
||||
url: "/course/admin/singin/class/" + id, |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
// 导出考勤表
|
||||
export function exportAttendance(id) { |
||||
return request({ |
||||
url: '/course/admin/importSignIn/class/' + id, |
||||
method: 'get', |
||||
responseType: 'blob' |
||||
}) |
||||
url: "/course/admin/importSignIn/class/" + id, |
||||
method: "get", |
||||
responseType: "blob", |
||||
}); |
||||
} |
||||
// 导出所有签到信息
|
||||
export function exportSignIn(id,params) { |
||||
console.log(params); |
||||
export function exportSignIn(id, params) { |
||||
return request({ |
||||
url: '/course/admin/importSignIn/course/' + id, |
||||
method: 'get', |
||||
url: "/course/admin/importSignIn/course/" + id, |
||||
method: "get", |
||||
params, |
||||
responseType: 'blob' |
||||
}) |
||||
responseType: "blob", |
||||
}); |
||||
} |
||||
|
||||
// 获取收入管理信息
|
||||
export function getInComeInfo(data) { |
||||
return request({ |
||||
url: "/mpay/admin/record/course/payList", |
||||
method: "post", |
||||
data, |
||||
}); |
||||
} |
||||
// 获取学习人次
|
||||
export function getStudyRows(id, params) { |
||||
console.log(id); |
||||
return request({ |
||||
url: "train/online/course/studyList/" + id, |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
|
||||
// 添加学生评价
|
||||
export function addStuentEva(data) { |
||||
return request({ |
||||
url: "train/admin/assessmen/add", |
||||
method: "post", |
||||
data, |
||||
}); |
||||
} |
||||
// 删除学生评价
|
||||
export function delStudentEva(id) { |
||||
return request({ |
||||
url: "train/admin/assessmen/" + id, |
||||
method: "delete", |
||||
}); |
||||
} |
||||
// 获取学生评价列表
|
||||
export function getStudentEva(id, params) { |
||||
console.log(id); |
||||
return request({ |
||||
url: "train/admin/assessmen/list/" + id, |
||||
method: "get", |
||||
params, |
||||
}); |
||||
} |
||||
|
||||
// 导出评价信息
|
||||
export function exportEva(data) { |
||||
return request({ |
||||
url: "/train/admin/import/assement", |
||||
method: "post", |
||||
data, |
||||
responseType: "blob", |
||||
}); |
||||
} |
||||
// 复制班级
|
||||
export function copyClassInfo(id, nid) { |
||||
return request({ |
||||
url: "/course/admin/class/copy/" + id + "/" + nid, |
||||
method: "get", |
||||
}); |
||||
} |
||||
|
||||
// 导出学习人次
|
||||
export function expLearnNum(courseId) { |
||||
return request({ |
||||
url: "/train/admin/import/studyList/" + courseId, |
||||
method: "get", |
||||
responseType: "blob", |
||||
}); |
||||
} |
@ -0,0 +1,81 @@ |
||||
<template> |
||||
<el-upload class="upload-demo myupload" :action="action" :headers="headers" :on-preview="handlePreview" |
||||
:on-remove="handleRemove" :before-remove="beforeRemove" :on-success="successUpload" :limit="3" |
||||
:on-exceed="handleExceed" :before-upload="beforeAvatarUpload"> |
||||
<slot></slot> |
||||
</el-upload> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapGetters } from "vuex"; |
||||
export default { |
||||
data() { |
||||
return { |
||||
action: '/', |
||||
name: '' |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(['token']), |
||||
headers() { |
||||
return { Authorization: "Bearer " + this.token }; |
||||
}, |
||||
}, |
||||
methods: { |
||||
handleRemove(file, fileList) { |
||||
console.log(file, fileList); |
||||
}, |
||||
handlePreview(file) { |
||||
console.log(file); |
||||
}, |
||||
handleExceed(files, fileList) { |
||||
|
||||
}, |
||||
beforeRemove(file, fileList) { |
||||
// return this.$confirm(`确定移除 ${file.name}?`); |
||||
}, |
||||
successUpload(response) { |
||||
console.log(response); |
||||
this.$emit('upload', response, this.name) |
||||
}, |
||||
beforeAvatarUpload(file, fileList) { |
||||
this.name = file.name |
||||
const filetype = file.name.slice(file.name.lastIndexOf('.', file.name.length)) |
||||
console.log(filetype); |
||||
|
||||
const isType = ['.excel', '.xlsx'].some(item => { return item == filetype }) |
||||
if (!isType) { |
||||
this.$message.error('只能上传excel文件!'); |
||||
return false |
||||
} |
||||
this.parseExcel(file) |
||||
}, |
||||
parseExcel(file) { |
||||
let reader = new FileReader() |
||||
let _this = this |
||||
reader.readAsArrayBuffer(file) |
||||
reader.onload = function () { |
||||
let buffer = reader.result |
||||
let bytes = new Uint8Array(buffer) |
||||
let length = bytes.byteLength |
||||
let binary = '' |
||||
for (let i = 0; i < length; i++) { |
||||
binary += String.fromCharCode(bytes[i]) |
||||
} |
||||
let XLSX = require('xlsx') |
||||
let wb = XLSX.read(binary, { |
||||
type: 'binary' |
||||
}) |
||||
let outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) |
||||
console.log(outdata) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss"> |
||||
.myupload .el-upload-list { |
||||
display: none; |
||||
} |
||||
</style> |
@ -0,0 +1,38 @@ |
||||
<template> |
||||
<div class="formOptionsWrap"> |
||||
<div v-for="(form, fIndex) in optionsData" :key="fIndex"> |
||||
<optionsItem :form="form"></optionsItem> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Vue from 'vue'; |
||||
|
||||
|
||||
Vue.component( |
||||
'optionsItem', |
||||
{ |
||||
render: (createElement) => { |
||||
return createElement( |
||||
'div', |
||||
{}, |
||||
'option123' |
||||
) |
||||
} |
||||
} |
||||
) |
||||
const optionsData = [ |
||||
{}, |
||||
{} |
||||
] |
||||
export default { |
||||
data() { |
||||
return { |
||||
optionsData |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style></style> |
@ -0,0 +1,15 @@ |
||||
<template> |
||||
<div class="formResultWrap"></div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.formResultWrap{ |
||||
border-left: 1px solid gray; |
||||
} |
||||
</style> |
@ -0,0 +1,119 @@ |
||||
<template> |
||||
<div class="sourceWrap"> |
||||
<h3 class="sourceTitle">选择组件</h3> |
||||
<div v-for="(form, fIndex) in fomrmSourceList" :key="fIndex"> |
||||
<div class="diyInpWrap"> |
||||
<label>{{ form.label }}:</label> |
||||
<diyInput :form="form"></diyInput> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Vue from 'vue'; |
||||
import { fomrmSourceList } from './template' |
||||
Vue.component("diyInput", { |
||||
props: { |
||||
form: Object |
||||
}, |
||||
render: function (createElement) { |
||||
if (this.form.tag == 'select') { |
||||
return createElement( |
||||
this.form.tag, |
||||
{ |
||||
domProps: { |
||||
type: this.form.type |
||||
} |
||||
}, |
||||
this.form.data.defalut.map(form => { |
||||
return createElement( |
||||
'option', |
||||
{}, |
||||
form |
||||
) |
||||
}) |
||||
) |
||||
} |
||||
else if ((this.form.type == 'radio') || (this.form.type == 'checkBox')) { |
||||
console.log(this.form); |
||||
return createElement( |
||||
'span', {}, this.form.data.defalut.map(form => { |
||||
console.log(form); |
||||
return createElement( |
||||
this.form.tag, |
||||
{ |
||||
domProps: { |
||||
type: this.form.type, |
||||
} |
||||
}, |
||||
form |
||||
) |
||||
}) |
||||
) |
||||
} else if (this.form.tag == 'textarea') { |
||||
return createElement( |
||||
this.form.tag, |
||||
{ |
||||
domProps: { |
||||
name: this.form.type, |
||||
cols: "20", |
||||
rows: "2", |
||||
placeholder: this.form.data.defalut |
||||
} |
||||
}, |
||||
) |
||||
} |
||||
return createElement( |
||||
this.form.tag, |
||||
{ |
||||
domProps: { |
||||
name: this.form.type, |
||||
cols: "50", |
||||
rows: "10", |
||||
placeholder: this.form.data.defalut |
||||
} |
||||
}, |
||||
'test' |
||||
) |
||||
} |
||||
}) |
||||
export default { |
||||
// components: { 'diy-input': diyInput }, |
||||
data() { |
||||
return { |
||||
fomrmSourceList |
||||
} |
||||
}, |
||||
renderInput() { |
||||
|
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.sourceWrap { |
||||
height: calc(100vh - 40px); |
||||
border-right: 1px solid gray; |
||||
text-align: center; |
||||
select,input,textarea{ |
||||
width: 170px; |
||||
height: 25px; |
||||
} |
||||
.sourceTitle { |
||||
line-height: 40px; |
||||
margin: 0; |
||||
} |
||||
|
||||
.diyInpWrap { |
||||
text-align: left; |
||||
margin: 0px 10px 20px 10px; |
||||
background-color: antiquewhite; |
||||
padding: 15px 10px; |
||||
cursor: move; |
||||
border-radius: 5px; |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,78 @@ |
||||
<script> |
||||
import { itemTemp, formItemTemp, formTemplate, propertyMap, formatForm } from './template.js' |
||||
import { testData } from './testData' |
||||
export default { |
||||
name: 'formatForm', |
||||
render: (h, params) => { |
||||
|
||||
const formArray = testData |
||||
// 生产form-Item 和 form , 也就是表单中是所有item,和与这个表单对应的data |
||||
const Factory = (property) => { |
||||
|
||||
// 表单内容 |
||||
const item = JSON.parse(JSON.stringify(itemTemp)) |
||||
// console.log(item); |
||||
// formItem内容 |
||||
const resultFormItem = JSON.parse(JSON.stringify(formItemTemp)) |
||||
// data对应数据的每一项 |
||||
const dataItem = {} |
||||
// 1 |
||||
Object.keys(property).forEach(proKey => { |
||||
// 如果对应表中存在对应关系,给表单属性赋值 |
||||
const targetKey = propertyMap[proKey] |
||||
const targetValue = property[proKey] |
||||
|
||||
if (targetKey) { |
||||
if (proKey == 'type') { |
||||
item[proKey] = targetValue |
||||
item[targetKey] = 'input' |
||||
} |
||||
resultFormItem.children = [item] |
||||
} |
||||
// 不存在对应关系,说明是data中的属性,放在data中组成{key:value} |
||||
else { |
||||
dataItem[proKey] = targetValue |
||||
formatForm.push(dataItem) |
||||
} |
||||
}); |
||||
return { 'formItem': resultFormItem, itemForm: 'formatForm' } |
||||
} |
||||
|
||||
// 获取form的子元素数组,所有元素都添加在此数组 |
||||
// 遍历源数据,生成目标数据 |
||||
const itemResult = formArray.map((li) => { |
||||
const { formItem, itemForm } = Factory(li) |
||||
// data |
||||
formatForm.push(itemForm) |
||||
// 返回form - Item |
||||
return formItem |
||||
}) |
||||
formTemplate.children = itemResult |
||||
const resu = renderFactory(formTemplate) |
||||
|
||||
// 生成dom |
||||
function renderFactory(current) { |
||||
const tag = current.tag |
||||
const property = current.property |
||||
let childrend = current.children |
||||
|
||||
if (current.children.length != 0) { |
||||
childrend = current.children.map(it => { |
||||
return renderFactory(it) |
||||
}) |
||||
} else { |
||||
childrend = '' |
||||
} |
||||
|
||||
return h(tag, property, childrend) |
||||
} |
||||
|
||||
|
||||
return resu |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import url(./style.scss); |
||||
</style> |
@ -0,0 +1,27 @@ |
||||
<template> |
||||
<div class="diyWrap"> |
||||
<formSource></formSource> |
||||
<formOptions></formOptions> |
||||
<formResult></formResult> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import formSource from '@/components/formatForm/formSource.vue' |
||||
import formResult from '@/components/formatForm/formResult.vue' |
||||
import formOptions from '@/components/formatForm/formOptions.vue' |
||||
export default { |
||||
components: { |
||||
formSource, |
||||
formResult, |
||||
formOptions |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.diyWrap{ |
||||
display: grid; |
||||
grid-template-columns: 300px calc(100vw - 600px) 300px; |
||||
} |
||||
</style> |
@ -0,0 +1,6 @@ |
||||
.form-wrap{ |
||||
background-color: antiquewhite; |
||||
.form-item{ |
||||
background-color: aqua; |
||||
} |
||||
} |
@ -0,0 +1,80 @@ |
||||
export const lableWidth = "80px"; |
||||
|
||||
const propertyMap = { |
||||
// title: "label",
|
||||
type: "tag", |
||||
key: "formKey", |
||||
value: "defaultValue", |
||||
}; |
||||
|
||||
const fomrmSourceList = [ |
||||
{ |
||||
type:'input', |
||||
tag:'input', |
||||
label:'输入框', |
||||
data:{defalut:'请输入文本'} |
||||
}, |
||||
{ |
||||
type:'radio', |
||||
label:'单选框', |
||||
tag:'input', |
||||
data:{defalut:['test1','test2']} |
||||
}, |
||||
{ |
||||
type:'checkBox', |
||||
tag:'input', |
||||
label:'多选框', |
||||
data:{defalut:['boxTest1','boxTest2','boxTest3']} |
||||
}, |
||||
{ |
||||
type:'select', |
||||
tag:'select', |
||||
label:'下拉框', |
||||
data:{defalut:['seTest1','seTest2','seTest3']} |
||||
}, |
||||
{ |
||||
tag:'textarea', |
||||
type:'textarea', |
||||
label:'文本框', |
||||
data:{defalut:'请输入文本'} |
||||
}, |
||||
]; |
||||
|
||||
const optionsTemplate = fomrmSourceList |
||||
|
||||
const formatForm = []; |
||||
|
||||
const itemTemp = { |
||||
tag: "", |
||||
property: {}, |
||||
text: "", |
||||
children: [], |
||||
}; |
||||
const formItemTemp = { |
||||
tag: "div", |
||||
property: { |
||||
class: "el-form-item", |
||||
}, |
||||
text: "", |
||||
children: [], |
||||
}; |
||||
const formTemplate = { |
||||
tag: "div", |
||||
property: { |
||||
ref: "forMatform", |
||||
class: "form-wrap", |
||||
":model": `${formatForm}`, |
||||
"label-width": `${lableWidth}`, |
||||
}, |
||||
text: "", |
||||
children: [], |
||||
}; |
||||
export { |
||||
itemTemp, |
||||
formItemTemp, |
||||
formTemplate, |
||||
propertyMap, |
||||
formatForm, |
||||
fomrmSourceList, |
||||
optionsTemplate |
||||
}; |
@ -0,0 +1,42 @@ |
||||
export const testData = [ |
||||
{ name: "姓名", type: "input", key: "name", value: "" }, |
||||
{ title: "在校职务", type: "input", key: "title", value: "" }, |
||||
{ mobile: "手机号", type: "input", key: "mobile", value: "" }, |
||||
{ college: "院校全称", type: "input", key: "college", value: "" }, |
||||
{ address: "院校所在地址", type: "input", key: "address", value: "" }, |
||||
{ |
||||
payType: "培训付款方式", |
||||
type: "radio", |
||||
key: "payType", |
||||
value: [ |
||||
"公对公转账,请于报到前提供截图", |
||||
"现场支付(公务卡、微信、支付宝、现金)", |
||||
], |
||||
}, |
||||
{ sex: "性别", type: "radio", key: "sex", value: ["男", "女"] }, |
||||
{ |
||||
hotel: "是否需要统一安排住宿", |
||||
type: "radio", |
||||
key: "hotel", |
||||
value: [ |
||||
"大床房(付房费全额)", |
||||
"标间(独立居住、付全额房费)", |
||||
"标间(拼房、付房费一半),无指定合住人员", |
||||
"标间(拼房、付房费一半),指定合住人员", |
||||
"其他,请说明,包括非指定日期的订房", |
||||
"无须订房,自行安排", |
||||
], |
||||
}, |
||||
{ |
||||
addWeixin: "是否添加业务负责人微信", |
||||
type: "radio", |
||||
key: "addWeixin", |
||||
value: ["是", "否"], |
||||
}, |
||||
{ |
||||
suggestion: "针对此次培训,您还有什么建议", |
||||
type: "textarea", |
||||
key: "suggestion", |
||||
value: "", |
||||
}, |
||||
]; |
@ -0,0 +1,24 @@ |
||||
<template> |
||||
<div> |
||||
<div class="importArea"> |
||||
<el-select v-model="model" placeholder="请选择班级"> |
||||
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> |
||||
</el-option> |
||||
</el-select> |
||||
<el-upload action=""> |
||||
<el-button size="small" type="primary">点击上传</el-button> |
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> |
||||
</el-upload> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
|
||||
</style> |
@ -0,0 +1,28 @@ |
||||
<template> |
||||
<div class="testModule"> |
||||
<h2 class="testModuleTitle">表单模块测试</h2> |
||||
<diyForm></diyForm> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import diyForm from '@/components/formatForm/indexX.vue' |
||||
// import formSource from '@/components/formatForm/formSource.vue' |
||||
export default { |
||||
components: { |
||||
diyForm |
||||
} |
||||
|
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.testModule { |
||||
.testModuleTitle{ |
||||
text-align: center; |
||||
height: 40px; |
||||
border-bottom: 1px solid gray; |
||||
margin: 0; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,222 @@ |
||||
<template> |
||||
<div class="importCourseWrap"> |
||||
<div class="importArea" v-if="tableList.length == 0"> |
||||
<el-form ref="form" :model="excelForm" :rules="excleRules" label-width="150px"> |
||||
<el-form-item label="请选择班级" prop="className"> |
||||
<el-select v-model="excelForm.className" filterable placeholder="请选择"> |
||||
<el-option v-for="item in classList" :key="item.trainClassId" :label="item.trainClassName" |
||||
:value="item.trainClassId"> |
||||
</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="请上传excel" prop="excelFile"> |
||||
<el-upload class="upload-demo" drag action="#" :file-list="fileList" :before-upload="beforeUpload" |
||||
:show-file-list="false" :on-remove="handleRemove"> |
||||
<i class="el-icon-upload"></i> |
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
||||
<div class="el-upload__tip" slot="tip">只能上传excel、xlsx文件,且不超过500kb</div> |
||||
</el-upload> |
||||
<div>{{ excelForm.excelFile }}</div> |
||||
|
||||
</el-form-item> |
||||
</el-form> |
||||
<div style="text-align: center;"> |
||||
<el-button @click="parseExcel(file)" type="primary" |
||||
:disabled="(excelForm.className == '' || excelForm.excelFile == '')">确认上传{{ excelForm.className && |
||||
excelForm.excelFile }}</el-button> |
||||
</div> |
||||
</div> |
||||
<div v-else> |
||||
<el-table height="800px" :data="tableList" style="width: 100%"> |
||||
<el-table-column prop="courseName" label="课堂名称" width="width"></el-table-column> |
||||
<el-table-column prop="courseTime" label="上课时间" width="width"></el-table-column> |
||||
<el-table-column prop="dateTime" label="下课时间" width="width"></el-table-column> |
||||
<el-table-column prop="instructor" label="老师" width="width"></el-table-column> |
||||
<el-table-column prop="isPay" label="是否付款" width="width"></el-table-column> |
||||
<el-table-column prop="remark" label="备注" width="width"></el-table-column> |
||||
<el-table-column prop="title" label="职称" width="width"></el-table-column> |
||||
<el-table-column prop="url" label="链接" width="width"></el-table-column> |
||||
<el-table-column> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="dialogVisible = true" size="mini">编辑</el-button> |
||||
<el-button type="text" size="mini" @click="delRow(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div style="text-align: center;margin: 10px 0;"> |
||||
<el-button type="primary" @click="tableList = []">重新上传</el-button> |
||||
<el-button type="primary" @click="submit">确定提交</el-button> |
||||
</div> |
||||
</div> |
||||
<el-dialog title="编辑" :visible.sync="dialogVisible" width="width"> |
||||
<div> |
||||
<el-form ref="form" :model="form" label-width="80px"> |
||||
<el-form-item label="1"> |
||||
<el-input placeholder=""></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="2"> |
||||
<el-input placeholder=""></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="3"> |
||||
<el-input placeholder=""></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="4"> |
||||
<el-input placeholder=""></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="5"> |
||||
<el-input placeholder=""></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
<div slot="footer"> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="dialogVisible = false">确 定</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
getClassList, |
||||
} from '@/api/trainService/index' |
||||
const keyMap = { |
||||
'上课时间': 'courseTime', |
||||
'下课时间': 'dateTime', |
||||
'备注': 'remark', |
||||
'授课内容': 'contend', |
||||
'授课老师': 'instructor', |
||||
'是否付费': 'isPay', |
||||
'职称': 'title', |
||||
'课堂名称': 'courseName', |
||||
'课程链接': 'url', |
||||
} |
||||
export default { |
||||
created() { |
||||
this.init() |
||||
}, |
||||
data() { |
||||
return { |
||||
excelForm: { |
||||
className: '', |
||||
excelFile: '' |
||||
}, |
||||
classList: [], |
||||
excleRules: { |
||||
className: [{ required: true, message: '请选择班级', trigger: 'blur' }], |
||||
excelFile: [{ required: true, message: '请上传excel文件', trigger: 'change' }], |
||||
}, |
||||
fileList: [], |
||||
tableList: [], |
||||
file: '', |
||||
newFile: new FormData(), |
||||
dialogVisible: false |
||||
} |
||||
}, |
||||
methods: { |
||||
async init() { |
||||
const res = await getClassList() |
||||
this.classList = res.data |
||||
}, |
||||
beforeUpload(file, fileList) { |
||||
this.name = file.name |
||||
const filetype = file.name.slice(file.name.lastIndexOf('.', file.name.length)) |
||||
console.log(filetype); |
||||
|
||||
const isType = ['.excel', '.xlsx'].some(item => { return item == filetype }) |
||||
if (!isType) { |
||||
this.$message.error('只能上传excel文件!'); |
||||
return false |
||||
} |
||||
this.newFile.append('file', file); // 2. 上传之前,拿到file对象,并将它添加到刚刚定义的FormData对象中。 |
||||
this.file = file |
||||
this.excelForm.excelFile = file.name |
||||
}, |
||||
handleRemove(file, fileList) { |
||||
console.log(file, fileList); |
||||
}, |
||||
product(outdata, loading) { |
||||
const result = outdata.reduce((pre, cur, index) => { |
||||
const obj = {} |
||||
Object.keys(cur).forEach(key => { |
||||
console.log(key); |
||||
if (keyMap[key]) { |
||||
obj[keyMap[key]] = cur[key] |
||||
} else { |
||||
|
||||
} |
||||
}) |
||||
pre.push(obj) |
||||
return pre |
||||
}, []) |
||||
this.tableList = result |
||||
console.log(result); |
||||
|
||||
console.log(outdata); |
||||
loading.close() |
||||
}, |
||||
parseExcel(file) { |
||||
const loading = this.$loading({ |
||||
lock: true, |
||||
text: '解析中', |
||||
spinner: 'el-icon-loading', |
||||
background: 'rgba(0, 0, 0, 0.7)' |
||||
}); |
||||
let reader = new FileReader() |
||||
let _this = this |
||||
reader.readAsArrayBuffer(file) |
||||
reader.onload = function () { |
||||
let buffer = reader.result |
||||
let bytes = new Uint8Array(buffer) |
||||
let length = bytes.byteLength |
||||
let binary = '' |
||||
for (let i = 0; i < length; i++) { |
||||
binary += String.fromCharCode(bytes[i]) |
||||
} |
||||
let XLSX = require('xlsx') |
||||
let wb = XLSX.read(binary, { |
||||
type: 'binary' |
||||
}) |
||||
let outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) |
||||
_this.product(outdata, loading) |
||||
} |
||||
}, |
||||
delRow(row) { |
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '删除成功' |
||||
}); |
||||
}) |
||||
}, |
||||
submit() { |
||||
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning' |
||||
}).then(() => { |
||||
this.$message.success('修改成功') |
||||
this.$router.push('/courseManage') |
||||
}).catch(() => { |
||||
this.$message({ |
||||
type: 'info', |
||||
message: '已取消删除' |
||||
}); |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.importCourseWrap { |
||||
.importArea { |
||||
width: 500px; |
||||
margin: 200px auto; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,68 @@ |
||||
<template> |
||||
<div style="padding: 20px;"> |
||||
<el-button icon="el-icon-download" type="warning" size="small" style="margin-bottom: 20px" |
||||
@click="excelExport">导出为excel</el-button> |
||||
|
||||
<el-table v-loading="false" :data="listenCourseNum"> |
||||
<el-table-column label="序号" type="index" align="center" /> |
||||
<el-table-column label="姓名" align="center" prop="studentName" /> |
||||
<el-table-column label="手机号" align="center" prop="mobile" /> |
||||
<el-table-column label="开始听课时间" align="center" prop="startTime"></el-table-column> |
||||
</el-table> |
||||
<pagination :total="studentTotal" :page.sync="studentParams.pageNum" :limit.sync="studentParams.pageSize" |
||||
@pagination="init('')" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
getStudyRows, |
||||
expLearnNum |
||||
} from '@/api/trainService/index' |
||||
import { saveAs } from 'file-saver'; |
||||
export default { |
||||
data() { |
||||
return { |
||||
listenCourseNum: [], |
||||
studentTotal: 1, |
||||
studentParams: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
}, |
||||
courseId:'', |
||||
rourseName:'' |
||||
} |
||||
}, |
||||
created() { |
||||
this.courseId = this.$route.query.courseId |
||||
this.rourseName = this.$route.query.rourseName |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
init() { |
||||
getStudyRows(this.courseId, this.studentParams).then(res => { |
||||
this.studentTotal = res.total |
||||
this.listenCourseNum = res.rows.map(item => { |
||||
if (!item.data) { |
||||
item.startTime = '未开始' |
||||
return item |
||||
} |
||||
const tempData = JSON.parse(item.data) |
||||
const courseKey = 'courseId_' + this.courseId |
||||
item.startTime = tempData.find(ph => { |
||||
return ph[courseKey] |
||||
})[courseKey] |
||||
return item |
||||
}) |
||||
}) |
||||
}, |
||||
async excelExport() { |
||||
const res = await expLearnNum(this.courseId) |
||||
const blob = new Blob([res]) |
||||
saveAs(blob, this.rourseName + '学习人数表.xlsx') |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style></style> |
@ -0,0 +1,501 @@ |
||||
<template> |
||||
<div class="container" style="padding: 30px"> |
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" |
||||
style="display: flex; justify-content: space-between"> |
||||
<div style="display: flex"> |
||||
<el-form-item label="学校名称" prop="schoolName"> |
||||
<!-- <el-input v-model="queryParams.schoolName" placeholder="请输入学校名称" clearable size="small" /> --> |
||||
<el-select v-model="queryParams.schoolName"> |
||||
<el-option v-for="it in schoolList" :key="it.schoolId" :label="it.schoolName" |
||||
:value="it.schoolName"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="班级名称" prop="trainClassName"> |
||||
<el-input v-model="queryParams.trainClassName" placeholder="请输入班级名称" clearable size="small" /> |
||||
</el-form-item> |
||||
<el-form-item label="班级类型" prop="classType"> |
||||
<!-- <el-input v-model="queryParams.schoolName" placeholder="请输入学校名称" clearable size="small" /> --> |
||||
|
||||
<el-select v-model="queryParams.classType"> |
||||
<el-option label="校企合作班" :value="0"></el-option> |
||||
<el-option label="线下培训进阶班" :value="1"></el-option> |
||||
<el-option label="可靠性人才培训班" :value="2"></el-option> |
||||
<el-option label="师资培训班" :value="3"></el-option> |
||||
<el-option label="线上培训班" :value="4"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</div> |
||||
</el-form> |
||||
<div style="margin-top: 5px; margin-bottom: 20px"> |
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addsign">新增</el-button> |
||||
</div> |
||||
<el-table v-loading="loading" :data="classList"> |
||||
<el-table-column label="序号" align="center" type="index" /> |
||||
<el-table-column label="学校" align="center" prop="schoolName" /> |
||||
<el-table-column label="班级名称" align="center" prop="trainClassName" /> |
||||
<el-table-column label="班级代号" align="center" prop="trainClassCode" /> |
||||
<!-- <el-table-column label="班级人数" align="center" prop="classSize" /> --> |
||||
<el-table-column label="班级类型" align="center" prop="registrationStartTime"> |
||||
<template slot-scope="scope"> |
||||
<span style="color:#F56C6C;" v-if="scope.row.classType == 0">校企合作班</span> |
||||
<span style="color: #E6A23C;" v-if="scope.row.classType == 1">线下培训进阶班</span> |
||||
<span style="color:brown;" v-if="scope.row.classType == 2">可靠性人才培训班</span> |
||||
<span style="color:black;" v-if="scope.row.classType == 3">师资培训班</span> |
||||
<span style="color:cornflowerblue;" v-if="scope.row.classType == 4">线上培训班</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="培训教师" align="center" prop="teacherName" /> |
||||
<el-table-column label="报名开始时间" align="center" prop="registrationStartTime"> |
||||
<template slot-scope="scope"> |
||||
{{ (scope.row.registrationStartTime && scope.row.registrationStartTime.slice(0, 10)) || '未录入' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="报名结束时间" align="center" prop="registrationEndTime"> |
||||
<template slot-scope="scope"> |
||||
{{ (scope.row.registrationEndTime && scope.row.registrationEndTime.slice(0, 10)) || '未录入' }} |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column label="培训开始时间" align="center" prop="trainStartTime"> |
||||
<template slot-scope="scope"> |
||||
{{ (scope.row.trainStartTime && scope.row.trainStartTime.slice(0, 10)) || '未录入' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="培训结束时间" align="center" prop="trainEndTime"> |
||||
<template slot-scope="scope"> |
||||
{{ (scope.row.trainEndTime && scope.row.trainEndTime.slice(0, 10)) || '未录入' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="是否限制人数" align="center" prop="limitApply"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.limitApply == 1 ? '是' : '否' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="已报名/总人数" align="center" prop="classSize"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" |
||||
:style="(scope.row.classType == 4) ? 'color:#000;cursor: default;' : ''" |
||||
@click="searchUp(scope.row)">{{ |
||||
scope.row.ratio || '暂无信息' |
||||
}}</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="状态" align="center" prop="status"> |
||||
<template slot-scope="scope"> |
||||
<!-- 1 报名未开始、2 报名中、 3 报名结束未开课、4 开课中、5 已结束 status字段 --> |
||||
<span v-if="scope.row.status == 1">报名未开始</span> |
||||
<span style="color:#E6A23C;" v-if="scope.row.status == 2">报名中</span> |
||||
<span v-if="scope.row.status == 3">报名结束未开课</span> |
||||
<span style="color:#67C23A" v-if="scope.row.status == 4">开课中</span> |
||||
<span style="color:#F56C6C;" v-if="scope.row.status == 5">已结束</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="200"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" v-if="scope.row.classType == 3" |
||||
@click="setSignTab(scope.row)">配置报名表</el-button> |
||||
<el-button size="mini" type="text" @click="modify(scope.row)">修改</el-button> |
||||
<el-button size="mini" type="text" @click="delrow(scope.row)">删除</el-button> |
||||
<el-button v-show="scope.row.classType != 4" size="mini" type="text" |
||||
@click="option(scope.row)">考勤</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" |
||||
:limit.sync="queryParams.pageSize" @pagination="getList" /> |
||||
<el-dialog class="diaform" :title="title" :visible.sync="visibleopen" :close-on-click-modal="false" |
||||
width="800px" append-to-body @close="colsedia"> |
||||
<el-form :model="form" :rules="rules" ref="form" label-width="120px" inline> |
||||
<!-- 类型 --> |
||||
<el-form-item label="培训班类型" prop="classType"> |
||||
<el-select v-model="form.classType" @change="classTypeChange"> |
||||
<el-option label="校企合作班" :value="0"></el-option> |
||||
<el-option label="线下培训进阶班" :value="1"></el-option> |
||||
<el-option label="可靠性人才培训班" :value="2"></el-option> |
||||
<el-option label="师资培训班" :value="3"></el-option> |
||||
<el-option label="线上培训班" :value="4"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="培训教师" prop="teacherName" v-if="form.classType != 4"> |
||||
<el-select allow-create filterable v-model="form.teacherName"> |
||||
<el-option v-for="it in teacherList" :key="it.talent_id" :label="it.name" |
||||
:value="it.name"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="学校名称" prop="schoolId" v-if="form.classType == 0"> |
||||
<el-select v-model="form.schoolId"> |
||||
<el-option v-for="it in schoolList" :key="it.schoolId" :label="it.schoolName" |
||||
:value="it.schoolId"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="班级代号" prop="trainClassCode" v-if="form.classType == 0"> |
||||
<el-input v-model="form.trainClassCode" placeholder="请输入班级代号" clearable size="small" /> |
||||
</el-form-item> |
||||
|
||||
<el-form-item label="班级名称" prop="trainClassName"> |
||||
<el-input v-model="form.trainClassName" placeholder="请输入班级名称" clearable size="small" /> |
||||
</el-form-item> |
||||
<el-form-item label="班级等级" prop="classLevel" v-if="(form.classType != 0) && (form.classType != 4)"> |
||||
<el-select v-model="form.classLevel"> |
||||
<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> |
||||
|
||||
<el-form-item label="班级人数" prop="classSize" v-if="form.classType != 4"> |
||||
<el-input v-model="form.classSize" placeholder="请输入班级人数" clearable size="small" /> |
||||
</el-form-item> |
||||
<!-- 是否限制人数 --> |
||||
<el-form-item label="是否限制人数" prop="limitApply" class="limitApply" v-if="form.classType != 4"> |
||||
<el-radio-group v-model="form.limitApply"> |
||||
<el-radio label="1">是</el-radio> |
||||
<el-radio label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
<el-form-item label="报名开始时间" prop="registrationStartTime" v-if="form.classType != 4"> |
||||
<el-date-picker clearable size="small" v-model="form.registrationStartTime" type="date" |
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="报名开始时间"> |
||||
</el-date-picker> |
||||
</el-form-item> |
||||
<el-form-item label="报名结束时间" prop="registrationEndTime" v-if="form.classType != 4"> |
||||
<el-date-picker clearable size="small" v-model="form.registrationEndTime" type="date" |
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="报名结束时间"> |
||||
</el-date-picker> |
||||
</el-form-item> |
||||
<el-form-item label="培训开始时间" prop="trainStartTime"> |
||||
<el-date-picker clearable size="small" v-model="form.trainStartTime" type="date" |
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="培训开始时间"> |
||||
</el-date-picker> |
||||
</el-form-item> |
||||
<el-form-item label="培训结束时间" prop="trainEndTime"> |
||||
<el-date-picker clearable size="small" v-model="form.trainEndTime" type="date" |
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="培训结束时间"> |
||||
</el-date-picker> |
||||
</el-form-item> |
||||
<br /> |
||||
<el-form-item label="资料" prop="attachment" v-if="form.classType == 0"> |
||||
<el-input v-model="form.attachment" v-show="false" :limit="1"></el-input> |
||||
<nonimage-upload ref="packageUpload" :limitRemark="',文件请选用压缩包格式'" :limit="1" |
||||
@setImgPath="setPackagePath" imageType="zip|rar" /> |
||||
</el-form-item> |
||||
<!-- 编辑json --> |
||||
|
||||
<el-form-item style="padding-left: 170px"> |
||||
<el-button type="primary" style="width: 135px; font-size: 16px; height: 39px; line-height: 11px" |
||||
@click="submitto('confirm')">确认</el-button> |
||||
<el-button style="width: 135px; font-size: 16px; height: 39px; line-height: 11px; margin-left: 30px" |
||||
@click="colsedia">取消</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</el-dialog> |
||||
|
||||
<!-- 详细学生信息弹层 --> |
||||
<el-dialog class="diaform" title="报名学生信息" :visible.sync="studentOpen" :close-on-click-modal="false" |
||||
width="1200px" append-to-body> |
||||
<el-table :data="studentList"> |
||||
<el-table-column label="序号" align="center" type="index" /> |
||||
<el-table-column label="学号" align="center" prop="studentCode" v-if="activeR.classType == 0" /> |
||||
<el-table-column label="姓名" align="center" prop="studentName" /> |
||||
<el-table-column label="所属学院" align="center" prop="homeCollege" v-if="activeR.classType == 0" /> |
||||
<el-table-column label="专业名称" align="center" prop="majorName" v-if="activeR.classType == 0" /> |
||||
<el-table-column label="手机号" align="center" prop="mobile" /> |
||||
<el-table-column label="报名时间" align="center" prop="registrationTime" /> |
||||
</el-table> |
||||
<pagination v-show="totals > 0" :total="totals" :page.sync="queryParamss.pageNum" |
||||
:limit.sync="queryParamss.pageSize" @pagination="getStudentList" /> |
||||
</el-dialog> |
||||
<!-- json弹层 --> |
||||
<el-dialog title="报名表配置" :visible.sync="signTable" :close-on-click-modal="false" width="800px" append-to-body> |
||||
<JsonTool ref="jsontool" /> |
||||
<div> |
||||
例:name为标题;type为类型(input输入框;radio单选框;textarea文本域);key为标题标识须一致;value为单选框选项 |
||||
</div> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="jsoncancle">取 消</el-button> |
||||
<el-button type="primary" @click="jsonsubmit">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { |
||||
getSchoolList, |
||||
getSignUpList, |
||||
addSignUp, |
||||
updateSignUp, |
||||
delSignUp, |
||||
searchNum, |
||||
listTeacherAll, |
||||
setJson, |
||||
} from '@/api/trainService/index.js' |
||||
import ImageUpload from '@/components/ImgUpload/index.vue' |
||||
import NonimageUpload from '@/views/components/NonimageUpload' |
||||
// 1 报名未开始、2 报名中、 3 报名结束未开课、4 开课中、5 已结束 status字段 |
||||
import JsonTool from '@/components/jsonTool' |
||||
export default { |
||||
name: 'peixunbaoming', |
||||
components: { ImageUpload, NonimageUpload, JsonTool }, |
||||
data() { |
||||
return { |
||||
teacherList: [], |
||||
imgAction: process.env.VUE_APP_BASE_API + '/upload', |
||||
loading: false, |
||||
classList: [], |
||||
schoolList: [], |
||||
// 总条数 |
||||
total: 0, |
||||
// 查询参数 |
||||
queryParams: { |
||||
pageNum: 1, |
||||
pageSize: 20, |
||||
classType: null, |
||||
}, |
||||
queryParamss: { |
||||
pageNum: 1, |
||||
pageSize: 10, |
||||
}, |
||||
totals: 0, |
||||
title: '新增班级', |
||||
visibleopen: false, |
||||
form: { |
||||
classType: 0, |
||||
limitApply: '0', |
||||
}, |
||||
rules: { |
||||
classType: [{ required: true, message: '请输入培训班类型', trigger: 'change' }], |
||||
schoolId: [{ required: true, message: '请选择学校', trigger: 'change' }], |
||||
teacherName: [{ required: true, message: '请选择教师', trigger: 'change' }], |
||||
trainClassCode: [{ required: true, message: '请输入班级代号', trigger: 'blur' }], |
||||
trainClassName: [{ required: true, message: '请输入班级名称', trigger: 'blur' }], |
||||
limitApply: [{ required: true, message: '请选择是否限制人数', trigger: 'change' }], |
||||
classSize: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入班级人数', |
||||
trigger: blur, |
||||
}, |
||||
], |
||||
classLevel: [{ required: true, message: '请输入班级等级', trigger: 'change' }], |
||||
registrationStartTime: [{ required: true, message: '报名开始时间', trigger: 'blur' }], |
||||
registrationEndTime: [{ required: true, message: '报名结束时间', trigger: 'blur' }], |
||||
trainStartTime: [{ required: true, message: '培训开始时间', trigger: 'blur' }], |
||||
trainEndTime: [{ required: true, message: '培训结束时间', trigger: 'blur' }], |
||||
}, |
||||
studentList: [], |
||||
studentOpen: false, |
||||
activeR: {}, |
||||
// Json |
||||
signTable: false, |
||||
activeRowId: '', |
||||
} |
||||
}, |
||||
|
||||
mounted() { }, |
||||
methods: { |
||||
// json |
||||
setSignTab(row) { |
||||
this.signTable = true |
||||
this.activeRowId = row.trainClassId |
||||
this.$nextTick(() => { |
||||
if (row.data) { |
||||
this.$refs.jsontool.jsonData = row.data |
||||
this.$refs.jsontool.formatCode() |
||||
} else { |
||||
this.$refs.jsontool.jsonData = |
||||
'[{"name":"姓名","type":"input","key":"name","value":""},{"title":"在校职务","type":"input","key":"title","value":""},{"mobile":"手机号","type":"input","key":"mobile","value":""},{"college":"院校全称","type":"input","key":"college","value":""},{"address":"院校所在地址","type":"input","key":"address","value":""},{"payType":"培训付款方式","type":"radio","key":"payType","value":["公对公转账,请于报到前提供截图","现场支付(公务卡、微信、支付宝、现金)"]},{"sex":"性别","type":"radio","key":"sex","value":["男","女"]},{"hotel":"是否需要统一安排住宿","type":"radio","key":"hotel","value":["大床房(付房费全额)","标间(独立居住、付全额房费)","标间(拼房、付房费一半),无指定合住人员","标间(拼房、付房费一半),指定合住人员","其他,请说明,包括非指定日期的订房","无须订房,自行安排"]},{"addWeixin":"是否添加业务负责人微信","type":"radio","key":"addWeixin","value":["是","否"]},{"suggestion":"针对此次培训,您还有什么建议","type":"textarea","key":"suggestion","value":""}]' |
||||
this.$refs.jsontool.formatCode() |
||||
} |
||||
this.$refs.jsontool.formatCode() |
||||
}) |
||||
}, |
||||
jsoncancle() { |
||||
this.signTable = false |
||||
}, |
||||
jsonsubmit() { |
||||
const flag = this.$refs.jsontool.onSubumit() |
||||
if (flag) { |
||||
const jsonstr = this.$refs.jsontool.jsonData |
||||
setJson({ data: jsonstr, trainClassId: this.activeRowId }) |
||||
.then((res) => { |
||||
this.$message.success('配置成功') |
||||
this.getList() |
||||
this.signTable = false |
||||
}) |
||||
.catch((error) => { }) |
||||
} else { |
||||
this.$message.warning('请检查JSON数据格式') |
||||
} |
||||
}, |
||||
// json |
||||
// 获取教师列表 |
||||
async getTeacherList() { |
||||
const res = await listTeacherAll() |
||||
this.teacherList = res |
||||
}, |
||||
// 资料 |
||||
setPackagePath(value) { |
||||
this.form.attachment = value |
||||
}, |
||||
// 获取学校 |
||||
async getSchoolListFn() { |
||||
const res = await getSchoolList({ |
||||
pageNum: 1, |
||||
pageSize: 999, |
||||
}) |
||||
this.schoolList = res.rows |
||||
}, |
||||
async getList() { |
||||
const res = await getSignUpList(this.queryParams) |
||||
this.total = res.total |
||||
// res.rows.form(item=>{ |
||||
// if(!item.teacherName && item.instructor){ |
||||
// item.teacherName = item.instructor |
||||
// } |
||||
// }) |
||||
this.classList = res.rows |
||||
}, |
||||
//新增资讯的弹窗 |
||||
addsign() { |
||||
this.title = '新增班级' |
||||
this.visibleopen = true |
||||
}, |
||||
//修改资讯的弹窗 |
||||
async modify(row) { |
||||
this.title = '修改班级' |
||||
this.form =JSON.parse(JSON.stringify(row)) |
||||
// 线上培训班的时间为选填 |
||||
if (row.classType == 4) { |
||||
this.rules.trainStartTime = [] |
||||
this.rules.trainEndTime = [] |
||||
} else { |
||||
this.rules.trainStartTime = [{ required: true, message: '培训开始时间', trigger: 'blur' }] |
||||
this.rules.trainEndTime = [{ required: true, message: '培训结束时间', trigger: 'blur' }] |
||||
} |
||||
// 如果有资料 |
||||
if (row.attachment) { |
||||
let packageFile = [ |
||||
{ |
||||
name: '资料', |
||||
url: row.attachment, |
||||
filePath: row.attachment, |
||||
}, |
||||
] |
||||
this.$nextTick(() => { |
||||
this.$refs.packageUpload.setToolFileList(packageFile) |
||||
}) |
||||
} |
||||
this.visibleopen = true |
||||
}, |
||||
option(row) { |
||||
console.log(row); |
||||
this.$router.push({ |
||||
path: '/attendanceList', |
||||
query: { |
||||
name: row.trainClassName, |
||||
id: row.trainClassId, |
||||
}, |
||||
}) |
||||
}, |
||||
async delrow(row) { |
||||
this.$confirm('是否确认删除培训班?', '提示', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}) |
||||
.then(() => { |
||||
delSignUp(row.trainClassId).then((res) => { |
||||
this.getList() |
||||
this.$message.success('删除成功') |
||||
}) |
||||
}) |
||||
.catch(() => { }) |
||||
}, |
||||
// 提交 |
||||
async submitto() { |
||||
if (this.form.schoolId) { |
||||
const schoolinfo = this.schoolList.find((it) => it.schoolId == this.form.schoolId) |
||||
this.form.schoolName = schoolinfo.schoolName |
||||
} |
||||
this.$refs['form'].validate((valid) => { |
||||
if (valid) { |
||||
if (this.form.trainClassId) { |
||||
// 修改 |
||||
updateSignUp(this.form).then((res) => { |
||||
this.$message.success('修改成功') |
||||
this.colsedia() |
||||
this.getList() |
||||
}) |
||||
} else { |
||||
addSignUp(this.form).then((res) => { |
||||
this.$message.success('新增成功') |
||||
this.colsedia() |
||||
this.getList() |
||||
}) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
// 关闭 |
||||
colsedia() { |
||||
this.$refs['form'].resetFields() |
||||
console.log(this.form); |
||||
this.form = { |
||||
classType: 0, |
||||
limitApply: '0', |
||||
} |
||||
this.$nextTick(() => { |
||||
this.visibleopen = false |
||||
}) |
||||
}, |
||||
handleQuery() { |
||||
this.getList() |
||||
}, |
||||
resetQuery() { |
||||
this.resetForm('queryForm') |
||||
this.getList() |
||||
}, |
||||
// 查询已报名 |
||||
searchUp(rwo) { |
||||
// this.activeR = rwo |
||||
// this.getStudentList() |
||||
if (rwo.classType == 4) { return } |
||||
this.$router.push(`/signupStudent?id=${rwo.trainClassId}&type=${rwo.classType}&name=${rwo.trainClassName}`) |
||||
|
||||
rwo.data && localStorage.setItem('jsondata', rwo.data) |
||||
}, |
||||
async getStudentList() { |
||||
const res = await searchNum(this.activeR.trainClassId) |
||||
this.studentOpen = true |
||||
this.studentList = res.rows |
||||
this.totals = res.total |
||||
}, |
||||
classTypeChange(e) { |
||||
console.log(e); |
||||
if (e == 4) { |
||||
this.rules.trainStartTime = [] |
||||
this.rules.trainEndTime = [] |
||||
} else { |
||||
this.rules.trainStartTime = [{ required: true, message: '培训开始时间', trigger: 'blur' }] |
||||
this.rules.trainEndTime = [{ required: true, message: '培训结束时间', trigger: 'blur' }] |
||||
} |
||||
} |
||||
}, |
||||
created() { |
||||
this.getList() |
||||
this.getSchoolListFn() |
||||
this.getTeacherList() |
||||
}, |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
::v-deep .el-radio-group { |
||||
width: 220px; |
||||
|
||||
} |
||||
</style> |
Loading…
Reference in new issue