Commit 62eaa310 authored by 王飞龙's avatar 王飞龙

个人开课

parent cc4925b6
......@@ -109,7 +109,7 @@
<!-- 开课类型-->
<el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true">
<template slot-scope="scope">
<!-- {{ scope.row.isPay === 0 ? '试用' : '付费' }}-->
<!-- {{ scope.row.isPay === 0 ? '试用' : '付费' }}-->
<span v-if="scope.row.flag === '0'">{{ scope.row.isPay === 0 ? '试用' : '付费' }}</span>
<el-select
v-if="scope.row.flag === '1'"
......@@ -204,15 +204,15 @@
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.flag === '0'"> {{ scope.row.remarks || '-' }}</span>
<el-input
v-if="scope.row.flag === '1'"
v-model="scope.row.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</template>
<el-input
v-if="scope.row.flag === '1'"
v-model="scope.row.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="200px">
<template slot-scope="scope">
......@@ -426,9 +426,9 @@
width="50"
align="center"
/>
<el-table-column label="单位" prop="unit">
<el-table-column label="单位" prop="applicantUnit">
<template slot-scope="scope">
{{ scope.row.unitName || '-' }}
{{ getUnitName(scope.row.applicantUnit) || '-' }}
</template>
</el-table-column>
<el-table-column label="课程" prop="class">
......@@ -466,22 +466,73 @@
</el-table-column>
<el-table-column label="开课类型" prop="isPay">
<template slot-scope="scope">
{{ scope.row.isPay === 0 ? '试用' : '付费' }}
<!-- {{ scope.row.isPay === 0 ? '试用' : '付费' }}-->
<span v-if="scope.row.flag === '0'">{{ scope.row.isPay === 0 ? '试用' : '付费' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.isPay"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in isPayList"
:key="index"
:label="items.label"
:value="items.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="岗位分类" prop="jobClassification">
<template slot-scope="scope">
{{ getJobClassificationName(scope.row.jobClassification) || '-' }}
<!-- {{ getJobClassificationName(scope.row.jobClassification) || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ getJobClassificationName(scope.row.jobClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.jobClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in valueOptions"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="技术分类" prop="teDirection">
<template slot-scope="scope">
{{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}
<!-- {{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.technicalClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in courseDirection"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
<!-- {{ scope.row.remarks || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ scope.row.remarks || '-' }}</span>
<el-input
v-if="scope.row.flag === '1'"
v-model="scope.row.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width">
......@@ -626,7 +677,7 @@ export default {
technicalClassification: '',
beginTrialTime: '',
endTrialTime: '',
applicantType: 1
applicantType: 2
},
// 开课类型list
isPayList: [
......@@ -686,6 +737,16 @@ export default {
this.unitOptions = res.data
})
},
// 根据id获取单位名称
getUnitName(businessId) {
let name = ''
this.unitOptions.forEach(item => {
if (item.businessId === businessId) {
name = item.unitName
}
})
return name
},
// 获取岗位类型
getJobClassification() {
// const obj = {
......@@ -818,7 +879,7 @@ export default {
technicalClassification: this.addForm.technicalClassification,
isPay: this.addForm.isPay,
remarks: this.addForm.remarks,
applicantType: 1
applicantType: 2
}
this.form.settingList.push(obj)
......@@ -945,20 +1006,6 @@ export default {
/** 修改按钮操作 */
handleUpdate(index) {
this.dateList[index].flag = '1'
// this.reset()
// const roleId = row.businessId || this.ids
// const roleMenu = this.getRoleMenuTreeSelect(roleId)
// getRole(roleId).then(response => {
// this.form = response.data
// this.open = true
//
// this.$nextTick(() => {
// roleMenu.then(res => {
// this.$refs.menu.setCheckedKeys(res.data.checkedKeys)
// })
// })
// this.title = '修改角色'
// })
},
/** 保存按钮操作 */
handleSave(index) {
......
......@@ -4,47 +4,96 @@
<div v-show="showSwitch.courseContent" class="courseContent">
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item>
<el-input v-model="queryParams.answerName" placeholder="请输入申请人姓名、登录名、手机号" clearable />
<!-- 开课类型-->
<el-form-item label="开课类型" prop="isPay">
<el-select v-model="queryParams.isPay" placeholder="开课类型" clearable>
<el-option
v-for="item in [{label:'试用',value:0},{label:'付费',value:1}]"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- 处理单位-->
<el-form-item>
<el-input v-model="queryParams.applicantUnit" placeholder="请输入申请单位" clearable />
<el-form-item label="课程名称" prop="lessonName">
<el-input
v-model="queryParams.lessonName"
placeholder="课程名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- 状态-->
<el-form-item>
<el-select v-model="queryParams.flag" placeholder="请选择状处理状态" clearable>
<el-option label="未处理" value="0" />
<el-option label="已处理" value="1" />
<el-form-item label="岗位分类" prop="value">
<el-select v-model="queryParams.jobClassification" placeholder="岗位分类" clearable>
<el-option
v-for="item in valueOptions"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<!-- 备注-->
<el-form-item>
<el-input v-model="queryParams.remarks" placeholder="请输入备注" clearable />
<el-form-item label="技术分类" prop="teDirection">
<el-select v-model="queryParams.technicalClassification" placeholder="技术分类" clearable>
<el-option
v-for="item in courseDirection"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<!-- //查询按钮-->
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="loadData"
>{{ commonField.queryName }}</el-button>
<!-- //重置按钮-->
<el-button
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>{{ commonField.resetName }}</el-button>
<el-form-item label="开始日期" prop="beginTrialTime">
<el-date-picker
v-model="queryParams.beginTrialTime"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="开始日期"
/>
</el-form-item>
<div style="float: right" />
<el-form-item label="结束日期" prop="endTrialTime">
<el-date-picker
v-model="queryParams.endTrialTime"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="结束日期"
/>
</el-form-item>
<!-- //查询按钮-->
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="loadData"
>{{ commonField.queryName }}</el-button>
<!-- //重置按钮-->
<el-button
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>{{ commonField.resetName }}</el-button>
<div style="float: right">
<el-form-item>
<!-- //新增按钮-->
<el-button
:class="commonField.addClass"
:type="commonField.typePrimary"
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleAdd"
>{{ commonField.addName }}</el-button>
</el-form-item>
</div>
</el-form>
</div>
<div style="padding:5px 10px">
<div class="tableTitle">试用申请管理</div>
<div class="tableTitle">个人开课管理</div>
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span>
<el-table-column align="left" prop="id" label="序号" width="55px">
......@@ -52,56 +101,138 @@
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true">
<template slot-scope="scope">
<!-- {{ scope.row.isPay === 0 ? '试用' : '付费' }}-->
<span v-if="scope.row.flag === '0'">{{ scope.row.isPay === 0 ? '试用' : '付费' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.isPay"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in isPayList"
:key="index"
:label="items.label"
:value="items.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人">
<template slot-scope="scope">
{{ scope.row.applicantName }}
</template>
</el-table-column>
<el-table-column prop="applicantUnitName" label="申请单位" show-overflow-tooltip />
<el-table-column prop="phone" label="手机号" show-overflow-tooltip />
<!-- 课程名称-->
<el-table-column prop="lessonName" label="课程名称">
<el-table-column label="课程名称" prop="roleKey" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.lessonName }}
{{ scope.row.lessonName || '-' }}
</template>
</el-table-column>
<!-- 岗位分类-->
<el-table-column prop="postClassification" label="岗位分类">
<el-table-column label="岗位分类" prop="jobClassification" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.jobClassification }}
<span v-if="scope.row.flag === '0'"> {{ getJobClassificationName(scope.row.jobClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.jobClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in valueOptions"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<!-- 技术分类-->
<el-table-column prop="technicalClassification" label="技术分类">
<el-table-column label="技术分类" prop="value" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.technicalClassification }}
<span v-if="scope.row.flag === '0'"> {{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.technicalClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in courseDirection"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="remarks" label="开始试用日期">
<el-table-column label="开始日期" prop="value2" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ replace(scope.row.applicantTime) }}
<span v-if="scope.row.flag === '0'">{{ scope.row.beginTrialTime |transformDateByFormat('YYYY-MM-DD') }}</span>
<el-date-picker
v-if="scope.row.flag === '1'"
v-model="scope.row.beginTrialTime"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</template>
</el-table-column>
<el-table-column prop="remarks" label="结束试用日期">
<el-table-column label="结束日期" prop="value3" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ replace(scope.row.applicantEndTime) }}
<span v-if="scope.row.flag === '0'">{{ scope.row.endTrialTime |transformDateByFormat('YYYY-MM-DD') }}</span>
<el-date-picker
v-if="scope.row.flag === '1'"
v-model="scope.row.endTrialTime"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</template>
</el-table-column>
<el-table-column prop="flag" label="状态">
<!-- 备注-->
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ statusChange(scope.row.flag) }}
<span v-if="scope.row.flag === '0'"> {{ scope.row.remarks || '-' }}</span>
<el-input
v-if="scope.row.flag === '1'"
v-model="scope.row.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</template>
</el-table-column>
<el-table-column prop="remarks" label="备注" show-overflow-tooltip />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<!-- //编辑-->
<el-button
v-show="scope.row.flag === '0'"
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleUpdate(scope.$index)"
>{{ commonField.updateName }}</el-button>
<!-- //删除-->
<el-button
:class="commonField.resetPasClass"
v-show="scope.row.flag === '0'"
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="removeCourse(scope.row)"
>删除</el-button>
@click="handleDelete(scope.row)"
>{{ commonField.deleteName }}</el-button>
<el-button
v-show="scope.row.flag === '1'"
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleSave(scope.$index)"
>保存</el-button>
</template>
</el-table-column>
</el-table>
......@@ -112,69 +243,316 @@
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
/>
<footer />
</div>
<!-- 新建题型对话框-->
<el-dialog
title="试卷审批"
:visible.sync="dialogFormVisible"
width="55%"
>
<template>
<el-form ref="form" :model="form" label-width="20px" :rules="rules">
<div v-for="(item, index) in form" :key="index">
<el-row class="elClass">
<el-col :span="24">
<div>{{ index+1 +':' }}{{ item.title }}</div>
</el-col>
</el-row>
<el-row class="elClass">
<el-col :span="24">
<div>作答:
<span :style="{ color: item.isRight ? 'green' : 'red'}">
{{ item.answer }}</span></div>
</el-col>
</el-row>
<el-row class="elClass">
<el-col :span="24">
<div>正确答案:{{ item.standardAnswer }}</div>
</el-col>
</el-row>
<el-row class="elClass">
<el-col :span="1.5" style="padding-top: 15px">得分:</el-col>
<el-col :span="22">
<el-form-item :prop="`${index}.score`" :rules="[{ required: true, message: '请选择得分', trigger: 'change' }]">
<el-radio-group v-model="item.score" :disabled="item.questionType!==4||!submitIsShow">
<el-radio-button label="0" />
<el-radio-button label="1" />
<el-radio-button label="2" />
<el-radio-button label="3" />
<el-radio-button label="4" />
<el-radio-button label="5" />
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row class="elClass">
<el-col :span="1.5" style="padding-top: 15px">
<div>评价:</div>
</el-col>
<el-col :span="22">
<el-form-item prop="remarks">
<el-input v-model="item.remarks" type="textarea" placeholder="请输入评价" :disabled="!submitIsShow" />
</el-form-item>
</el-col>
</el-row>
<el-dialog :title="title" :visible.sync="open" width="1100px" :close-on-click-modal="false" append-to-body @close="handleClose">
<el-form ref="form" :model="form" size="small" label-width="auto">
<div style="display: flex;justify-content: space-between;align-items: center">
<div>
<el-form-item
label="申请人"
prop="applicant"
>
<el-select
v-model="addForm.applicant"
:disabled="unitDisplay"
filterable
style="width: 160px"
@change="handleUnitChange"
>
<el-option
v-for="(items,index) in userOptions"
:key="index"
:label="items.nickName"
:value="items.businessId"
/>
</el-select>
</el-form-item>
</div>
<el-form-item>
<div style="margin-left: 680px;margin-top: 30px">
<el-button @click="cancel">取 消</el-button>
<el-button v-if="submitIsShow" type="primary" @click="submit">确 定</el-button>
</div>
</el-form-item>
</el-form>
</template>
<div>
<el-form-item
label="课程"
prop="class"
>
<el-select
v-model="addForm.lessonId"
filterable
style="width: 160px"
@change="handleLessonChange"
>
<el-option
v-for="(items,index) in classOptions"
:key="index"
:label="items.lessonName"
:value="items.businessId"
/>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item
label="开始时间"
prop="createTime"
>
<span>
<el-date-picker
v-model="addForm.beginDate"
style="width: 160px"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</span>
</el-form-item>
</div>
<div>
<el-form-item
label="结束时间"
prop="endTime"
>
<span>
<el-date-picker
v-model="addForm.endDate"
style="width: 160px"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</span>
</el-form-item>
</div>
<div />
</div>
<div style="display: flex;justify-content: space-between;align-items: center">
<div>
<el-form-item
label="开课类型"
prop="isPay"
>
<el-select
v-model="addForm.isPay"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in isPayList"
:key="index"
:label="items.label"
:value="items.value"
/>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item
label="岗位分类"
prop="jobClassification"
>
<el-select
v-model="addForm.jobClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in valueOptions"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item
label="技术分类"
prop="teDirection"
>
<el-select
v-model="addForm.technicalClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in courseDirection"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</el-form-item>
</div>
<div>
<el-form-item
label="备注"
prop="remarks"
>
<el-input
v-model="addForm.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
</div>
</div>
</el-form>
<div style="padding: 20px;text-align: center">
<el-button class="fourWordsBtn" type="primary" icon="el-icon-plus" size="mini" @click="handleAddShift">新增</el-button>
<el-button class="fourWordsBtn" icon="el-icon-refresh" size="mini" @click="handleClear">重置</el-button>
</div>
<el-table class="DBXXClass" border :data="form.settingList">
<el-table-column
label="序号"
type="index"
width="50"
align="center"
/>
<el-table-column label="申请人" prop="applicant">
<template slot-scope="scope">
{{ getUserName(scope.row.applicant) || '-' }}
</template>
</el-table-column>
<el-table-column label="课程" prop="class">
<template slot-scope="scope">
{{ scope.row.lessonName || '-' }}
</template>
</el-table-column>
<el-table-column label="开始日期" prop="createTime">
<template slot-scope="scope">
<span v-if="scope.row.flag === '0'">{{ scope.row.beginTrialTime || '-' }}</span>
<el-date-picker
v-if="scope.row.flag === '1'"
v-model="scope.row.beginTrialTime"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</template>
</el-table-column>
<el-table-column label="结束日期" prop="endTime">
<template slot-scope="scope">
<span v-if="scope.row.flag === '0'">{{ scope.row.endTrialTime || '-' }}</span>
<el-date-picker
v-if="scope.row.flag === '1'"
v-model="scope.row.endTrialTime"
type="date"
placeholder="-"
:editable="false"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
/>
</template>
</el-table-column>
<el-table-column label="开课类型" prop="isPay">
<template slot-scope="scope">
<!-- {{ scope.row.isPay === 0 ? '试用' : '付费' }}-->
<span v-if="scope.row.flag === '0'">{{ scope.row.isPay === 0 ? '试用' : '付费' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.isPay"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in isPayList"
:key="index"
:label="items.label"
:value="items.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="岗位分类" prop="jobClassification">
<template slot-scope="scope">
<!-- {{ getJobClassificationName(scope.row.jobClassification) || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ getJobClassificationName(scope.row.jobClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.jobClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in valueOptions"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="技术分类" prop="teDirection">
<template slot-scope="scope">
<!-- {{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ getCourseDirectionName(scope.row.technicalClassification) || '-' }}</span>
<el-select
v-if="scope.row.flag === '1'"
v-model="scope.row.technicalClassification"
filterable
style="width: 160px"
>
<el-option
v-for="(items,index) in courseDirection"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks">
<template slot-scope="scope">
<!-- {{ scope.row.remarks || '-' }}-->
<span v-if="scope.row.flag === '0'"> {{ scope.row.remarks || '-' }}</span>
<el-input
v-if="scope.row.flag === '1'"
v-model="scope.row.remarks"
placeholder="备注"
clearable
:maxlength="30"
size="small"
/>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-show="scope.row.flag === '0'"
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleAddFromUpdate(scope.$index)"
>{{ commonField.updateName }}</el-button>
<el-button
v-show="scope.row.flag === '0'"
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleAddFromDelete(scope.$index)"
>{{ commonField.deleteName }}</el-button>
<el-button
v-show="scope.row.flag === '1'"
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleAddFromSave(scope.$index)"
>保存</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="handleClose">取 消</el-button>
<el-button class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -188,7 +566,16 @@ import {
import { delTeaExamQuestions } from '@/api/examination/teaExamQuestions'
import { delApplicationTrial, listApplicationTrial } from '@/api/try/applicationTrial'
import { delSysContentNewsInformation } from '@/api/contentManagement/sysContentNewsInformation'
import { listTeaTrialCourse } from '@/api/try/teaTrialCourse'
import {
batchAddTeaTrialCourse,
delTeaTrialCourse,
listTeaTrialCourse,
updateTeaTrialCourse
} from '@/api/try/teaTrialCourse'
import { getDict } from '@/api/system/dict/data'
import { queryOpenCourseByUnit, validOpenCourse } from '@/api/classManagement'
import { getListUser, listUser } from '@/api/system/user'
import { listCourseAll } from '@/api/sysUnit'
export default {
name: 'TryoutApplication',
data() {
......@@ -205,6 +592,25 @@ export default {
rules: {
},
tableData: [],
valueOptions: [
],
addForm: {
unitId: '',
unitName: '',
lessonId: '',
lessonName: '',
beginDate: null,
endDate: null
},
// 表单参数
form: {
settingList: []
},
open: false,
title: '',
courseDirection: [],
classOptions: [],
// 是否显示确认按钮
submitIsShow: true,
teaexamId: '',
......@@ -220,15 +626,23 @@ export default {
queryParams: {
page: 1,
rows: 10,
applicantUnit: '',
applicant: '',
flag: '',
remarks: ''
remarks: '',
applicantType: 1
},
unitDisplay: false,
// pagination
total: 10,
total: 0,
// 开课类型list
isPayList: [
{ label: '试用', value: 0 },
{ label: '付费', value: 1 }
],
actionUrl: '',
filelist: [],
userOptions: [],
bussid: [],
fullscreenLoading: false,
......@@ -253,8 +667,13 @@ export default {
}
},
created() {
},
mounted: function() {
this.getJobClassification()
this.getCourseDirection()
this.getClassOptions()
this.getUserList()
this.loadData()
},
methods: {
......@@ -266,10 +685,122 @@ export default {
return '已处理'
}
},
/** 保存**/
handleAddFromSave(index) {
this.form.settingList[index].flag = '0'
},
// 查询用户列表
getUserList() {
const params = {
page: -1,
rows: -1
}
listUser(params).then(res => {
this.userOptions = res.rows
})
},
/** 2.获取全部课程 **/
getClassOptions() {
const obj = {
flag: '1'
}
listCourseAll(obj).then(res => {
this.classOptions = res.data
})
},
// 根据id返回用户名称
getUserName(id) {
let name = ''
this.userOptions.forEach(item => {
if (item.businessId === id) {
name = item.nickName
}
})
return name
},
/** 5.关闭时请表单想和列表数据清空**/
handleClose() {
this.resetAddFrom()
this.open = false
},
/** 7.当课程有值是将课程label查询*/
handleLessonChange(value) {
if (value && value !== '' && value !== undefined) {
if (this.classOptions.find(item => item.businessId === value)) {
this.addForm.lessonName = this.classOptions.find(item => item.businessId === value).lessonName
} else {
this.addForm.lessonName = null
}
}
},
/** 3.当用户选中单位时将单位选择框禁用**/
handleUnitChange(value) {
if (value && value !== '' && value !== undefined) {
this.unitDisplay = true
/**
* 1.根据value找到label值
* 2.根据value值查询该单位所开的课程
**/
if (this.userOptions.find(item => item.businessId === value)) {
this.addForm.unitName = this.userOptions.find(item => item.businessId === value).unitName
} else {
this.addForm.unitName = null
}
const obj = {
unitId: value
}
queryOpenCourseByUnit(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
this.form.settingList = res.data
}
})
} else {
this.unitDisplay = false
this.addForm.unitName = null
this.form.settingList = []
}
},
// 日期格式转换
replace(time) {
return parseTime(time, '{y}/{m}/{d}:{h}:{i}')
},
// 获取岗位类型
getJobClassification() {
// const obj = {
// dictType: 'job_classify'
// }
getDict('job_classify').then(res => {
this.valueOptions = res.data
})
},
// 获取技术分类
getCourseDirection() {
getDict('tec_classify').then(res => {
this.courseDirection = res.data
})
},
// 根据岗位的id获取岗位的名称
getJobClassificationName(dictValue) {
let name = ''
this.valueOptions.forEach(item => {
if (item.dictValue === dictValue) {
name = item.dictLabel
}
})
return name
},
// 根据技术分类的id获取技术分类的名称
getCourseDirectionName(dictValue) {
let name = ''
this.courseDirection.forEach(item => {
if (item.dictValue === dictValue) {
name = item.dictLabel
}
})
return name
},
submit() {
console.log('this,form', this.form)
// 表单校验
......@@ -305,13 +836,20 @@ export default {
cancel() {
this.dialogFormVisible = false
},
/** 10.编辑列表中的信息**/
handleAddFromUpdate(index) {
/**
* 1.将该行状态改成可编辑
* 2.将开始时间和结束时间改成可编辑状态
* **/
this.form.settingList[index].flag = '1'
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
applicantUnit: '',
applicant: '',
flag: '',
remarks: ''
}
......@@ -349,15 +887,78 @@ export default {
}).catch(function() {
})
},
// 难度转换
difficultyChange(difficulty) {
if (difficulty === '1') {
return '简单'
} else if (difficulty === '2') {
return '一般'
} else if (difficulty === '3') {
return '困难'
// 表单重置
reset() {
},
/** 8.添加时判断单位和课程不能为空**/
handleAddShift() {
/**
* 1.根据单位和课程验重
* **/
if (this.addForm.applicant && this.addForm.applicant !== '' && this.addForm.applicant !== undefined && this.addForm.lessonId && this.addForm.lessonId !== '' && this.addForm.lessonId !== undefined) {
const obj = {
unitId: this.addForm.applicant,
lessonId: this.addForm.lessonId
}
validOpenCourse(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
console.log('addForm', this.addForm)
if (!this.onlyList(this.form.settingList)) {
const obj = {
applyPost: null,
flag: '0',
beginTrialTime: this.addForm.beginDate,
endTrialTime: this.addForm.endDate,
lessonName: this.addForm.lessonName,
applicant: this.addForm.applicant,
lessonId: this.addForm.lessonId,
jobClassification: this.addForm.jobClassification,
technicalClassification: this.addForm.technicalClassification,
isPay: this.addForm.isPay,
remarks: this.addForm.remarks,
applicantType: 1
}
this.form.settingList.push(obj)
} else {
return this.$message.error('和列表中数据是否重复')
}
}
})
} else {
if (!this.addForm.applicant || this.addForm.applicant === '' || this.addForm.applicant === undefined) {
return this.$message.error('请选择申请人')
}
if (!this.addForm.lessonId || this.addForm.lessonId === '' || this.addForm.lessonId === undefined) {
return this.$message.error('请选择课程')
}
}
// const params = JSON.parse(JSON.stringify(this.addForm))
// this.form.settingList.push(params)
},
/** 9.删除对应的课程**/
handleAddFromDelete(index) {
console.log('index', index)
this.form.settingList.splice(index, 1)
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delTeaTrialCourse(row.businessId)
}).then(() => {
this.loadData()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function() {
})
},
loadData() {
// 列表渲染数据
......@@ -365,14 +966,7 @@ export default {
const _this = this
this.tableData = []
_this.fullscreenLoading = true
const params = {
page: _this.queryParams.page,
rows: _this.queryParams.rows,
applicantUnit: _this.queryParams.applicantUnit,
flag: _this.queryParams.flag,
remarks: _this.queryParams.remarks
}
listTeaTrialCourse(params).then(res => {
listTeaTrialCourse(this.queryParams).then(res => {
var pages = res.rows// 查询过来的每页数据
_this.total = res.total// 总记录数
_this.bussid = []
......@@ -387,58 +981,86 @@ export default {
}
})
},
/** 新增按钮操作 */
handleAdd() {
this.dialogFormVisible = true
/** 4.重置时将单位回复正常**/
handleClear() {
this.resetAddFrom()
this.unitDisplay = false
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log('row', row)
this.teaexamId = row.businessId
if (row.flag === '1') {
this.submitIsShow = false
} else {
this.submitIsShow = true
}
console.log(this.submitIsShow)
// 查询详情
getById(row.businessId).then(res => {
if (res.code === 200) {
res.data.forEach(item => {
if (item.questionType === 4) {
item.score = ''
} else if (item.answer === item.standardAnswer) {
item.score = item.mark
item.isRight = true
} else {
item.score = 0
item.isRight = false
}
})
this.form = res.data
console.log('this.form', this.form)
/** 判断时刻是否有这个课程**/
onlyList(list) {
var b = false
console.log('数组中的数据', list)
console.log('对象', this.addForm)
list.forEach(item => {
if (item.applicant === this.addForm.applicant && item.lessonId === this.addForm.lessonId) {
b = true
}
})
this.dialogFormVisible = true
return b
},
// 查看方法
handleView(row) {
this.dialogFormVisible = true
this.submitIsShow = false
this.teaexamId = row.businessId
// 查询详情
getById(row.businessId).then(res => {
/** 保存按钮操作 */
handleSave(index) {
const obj = {
businessId: this.tableData[index].businessId,
beginTrialTime: this.tableData[index].beginTrialTime,
endTrialTime: this.tableData[index].endTrialTime,
jobClassification: this.tableData[index].jobClassification,
technicalClassification: this.tableData[index].technicalClassification,
remarks: this.tableData[index].remarks,
isPay: this.tableData[index].isPay
}
updateTeaTrialCourse(obj).then(res => {
if (res.code === 200) {
res.data.forEach(item => {
if (item.answer === item.standardAnswer) {
item.isRight = true
} else {
item.isRight = false
}
})
this.form = res.data
this.tableData[index].flag = '0'
this.$message.success('保存成功')
}
})
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.unitDisplay = false
this.title = '开课新增'
},
/** 提交按钮 */
submitForm: function() {
if (this.form.settingList.length > 0) {
console.log('this.form', this.form)
batchAddTeaTrialCourse(this.form).then(res => {
if (res.code === 200) {
this.resetAddFrom()
this.open = false
this.loadData()
this.$message({
message: '新增成功',
type: 'success'
})
}
})
} else {
return this.$message.error('请添加列表数据')
}
},
/** 修改按钮操作 */
handleUpdate(index) {
this.tableData[index].flag = '1'
},
/** 6.重置方法**/
resetAddFrom() {
this.addForm = {
unitId: '',
unitName: '',
lessonId: '',
lessonName: '',
beginDate: null,
endDate: null,
isPay: '',
jobClassification: '',
technicalClassification: '',
remarks: ''
}
this.form.settingList = []
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment