提交 75284254 编写于 作者: haoguojing's avatar haoguojing

feat: master分支去掉已有代码

上级 600eb2cd
<template>
<div class="table">
<el-row :gutter="10">
<el-col :span="2" class="padding-top-10"><label>考试列表</label></el-col>
<el-col :span="4">
<div class="grid-content bg-purple">
<el-input v-model="eagleTraining.name"></el-input>
</div>
</el-col>
<el-col :span="4">
<div class="grid-content bg-purple"></div>
</el-col>
<el-col :span="4">
<div class="grid-content bg-purple"></div>
</el-col>
<el-col :span="4">
<div class="grid-content bg-purple"></div>
</el-col>
<el-col :span="4">
<div class="grid-content bg-purple"></div>
</el-col>
</el-row>
<el-row :gutter="10" class="row">
<el-col :span="2" :offset="20">
<el-button type="primary" icon="search" @click="search">搜索</el-button>
</el-col>
<el-col :span="2">
<el-button type="primary" icon="edit" @click="addEagleTraining">新增考试</el-button>
</el-col>
</el-row>
<el-table :data="tableData" stripe border style="width: 100%" ref="multipleTable">
<!--<el-table-column type="selection" width="55"></el-table-column>-->
<el-table-column prop="name" label="序号" :show-overflow-tooltip="tooltip" width="130">
</el-table-column>
<el-table-column label="考试名称" min-width="230">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.start_time | dateFormat }} ~ {{ scope.row.end_time | dateFormat }}</span>
</template>
</el-table-column>
<el-table-column prop="test_user" label="时间限制" :show-overflow-tooltip="tooltip" min-width="170">
</el-table-column>
<el-table-column prop="responsible_user" label="通过标准" :show-overflow-tooltip="tooltip" min-width="100">
</el-table-column>
<el-table-column prop="created_time" label="字段要求" :show-overflow-tooltip="tooltip" min-width="150">
</el-table-column><el-table-column prop="created_time" label="允许考试次数" :show-overflow-tooltip="tooltip" min-width="150">
</el-table-column><el-table-column prop="created_time" label="考试开放时间" :show-overflow-tooltip="tooltip" min-width="150">
</el-table-column><el-table-column prop="created_time" label="答题规则" :show-overflow-tooltip="tooltip" min-width="150">
</el-table-column>
<el-table-column prop="created_time" label="发布结果" :show-overflow-tooltip="tooltip" min-width="150">
</el-table-column>
<el-table-column prop="status" label="状态" min-width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.status | statusFilter }}</span>
<!--<el-select v-model="scope.row.status" class="handle-select mr10">-->
<!--<el-option-->
<!--v-for="item in options"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value">-->
<!--</el-option>-->
<!--</el-select>-->
</template>
</el-table-column>
<el-table-column label="操作" min-width="200">
<template scope="scope">
<el-button size="small" @click="updateEagleTraining(scope.$index, scope.row,'form')">刷新题目</el-button>
<el-button size="small" @click="updateEagleTraining(scope.$index, scope.row,'form')">管理试卷</el-button>
<el-button size="small" @click="updateEagleTraining(scope.$index, scope.row,'form')">编辑</el-button>
<el-button size="small" v-show="scope.row.status == 1" @click="updateStatus(scope.row)">暂停/发布</el-button>
<el-button size="small" v-show="scope.row.status == 1" @click="updateStatus(scope.row)">发布</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNo"
:page-sizes="[15, 30, 50, 100, 200, 500, 700, 1000,1500, 2000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
</el-pagination>
</div>
</div>
</template>
<script>
import fetch from '../../common/fetch';
import {ossUpload, getFilePath} from '../../common/ossUtil';
import {errorResponseCheck, isEmptyUtils, isNotEmptyUtils,openLoading,closeLoading ,messageBox} from '../../common/utils';
import ElInput from "../../../node_modules/element-ui/packages/input/src/input.vue";
export default {
components: {ElInput},
data() {
return {
tooltip: true,//是否省略号显示
options: [{value: 1, label: '未发布'}, {value: 2, label: '已发布'}],
// type_options: [{value: 1, label: '医典活动'}],
tableData: [],
// dialogTableVisible: false,
// dialogFormVisible: false,
// fileList: [],//上传文件列表
// uploadProgress: 0,//上传进度
// uploadStatus: false,
// imageUrl: '',
// personAmt: 0,
// form: {},
// formObj: {
// name: '',
// join_role: 4,
// type: 1,
// start_date: '',
// amount: '',
// avg_max_amount: '',
// max_answer_num: '',
// min_online_num: '',
// count_c: 1,
// image_url: ''
// },
// 校验规则
// rules: {
// name: [
// {required: true, message: '活动名称', trigger: 'blur'},
// {min: 1, max: 15, message: '长度在 1 到 15 个字符', trigger: 'blur'}
// ],
// join_role: [
// {required: true, type: 'number', message: '请输入参与角色', trigger: 'change '},
// ],
// type: [
// {type: 'number', required: true, message: '请输入活动类型', trigger: 'change'},
// ],
// start_date: [
// {type: 'date', required: true, message: '请输入开始时间', trigger: 'change'},
// ],
// amount: [
// {required: true, type: 'number', message: '请输入活动金额', trigger: 'blur'},
//
// ],
// avg_max_amount: [
// {required: true, type: 'number', message: '请输入人均最大金额', trigger: 'blur'},
// ],
// max_answer_num: [
// {required: true, type: 'number', message: '请输入最大提交人数', trigger: 'blur'},
// ],
// min_online_num: [
// {required: true, type: 'number', message: '请输入最小期望在线人数', trigger: 'blur'},
// ],
// image_url: [
// {required: true, message: '请输入背景图片', trigger: 'blur'},
// ]
//
// },
// formLabelWidth: '120px',
totalRows: 0,
pageSize: 15,
pageNo: 1,
eagleTraining: {name: ''}
}
},
created() {
let self = this;
self.getData();
console.log("test_list:" + JSON.stringify(self.test_list));
},
methods: {
handleSizeChange(val) {
this.pageSize = val;
this.search();
},
handleCurrentChange(val) {
this.pageNo = val;
this.search();
},
getData() {
let self = this;
self.search();
},
search() {
this.is_search = true;
let self = this;
let promise = fetch('eagleTraining/getEagleTrainingList', {
token: localStorage.getItem("token"),
name: this.eagleTraining.name,
pageSize: self.pageSize,
pageNo: self.pageNo
}, 'GET', 'GET')
promise.then(function (data) {
self.tableData = data.pdModelList;
self.totalRows = data.totalRows;
}, function (error) {
});
},
deleteEagleTraining(row) {
this.is_search = true;
let self = this;
let system_time = new Date().format("yyyy-MM-dd hh:mm");
if (row.status == 2 && system_time >= new Date(row.start_time).format("yyyy-MM-dd hh:mm")) {
self.$message.warning("计划已开始或已经结束,不能删除!");
return;
}
messageBox(self,"提示","是否删除?","是", function () {
openLoading(self);
let promise = fetch('eagleTraining/deleteEagleTraining', {
token: localStorage.getItem("token"),
id: row.id
}, 'GET', 'GET')
promise.then(function (data) {
closeLoading(self);
self.search();
}, function (error) {
closeLoading(self);
});
},"否", function () {
}, "warning");
},
updateEagleTraining(row) {
let path = {path: 'editActive', query: {item: row}};
this.$router.push(path);
},
addEagleTraining() {
let path = {path: 'editActive'};
this.$router.push(path);
},
updateStatus(row) {
let self = this;
let system_time = new Date().format("yyyy-MM-dd hh:mm");
if (row.status == 2 && system_time >= new Date(row.start_time).format("yyyy-MM-dd hh:mm")) {
self.$message.warning("计划已开始或已经结束,不能下架!");
return;
}
let con = "";
if (row.status == 2) {
con = "是否下架?"
}else{
con = "是否发布?"
}
messageBox(self,"提示",con,"是", function () {
openLoading(self);
let promise = fetch('eagleTraining/updateStatus', {
token: localStorage.getItem("token"),
id: row.id,
status: row.status
}, 'GET', 'GET')
promise.then(function (data) {
closeLoading(self);
self.search();
}, function (error) {
closeLoading(self);
});
},"否", function () {
}, "warning");
},
formatter(row, column) {
return row.address;
},
},
computed: {
onRoutes() {
return this.$route.path.replace('/', '');
}
},
filters: {
sizeFilter: function (value) {
if (!value) return '0M';
return (value / 1000 / 1000).toFixed(2) + 'M';
},
statusFilter: function (value) {
if (!value) return '';
let hash = {
1: '未发布',
2: '已发布'
};
return hash[value];
},
typeFilter: function (value) {
if (!value) return '';
let hash = {
1: '云鹊医典'
};
return hash[value];
},
dateFormat: function (value) {
// debugger
if (!value) return '';
return new Date(value).format("yyyy-MM-dd hh:mm");
}
}
}
</script>
<style scoped>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
.row {
margin-top: 20px;
margin-bottom: 20px;
}
.padding-top-10 {
padding-top: 10px;
}
</style>
<template>
<div class="table">
<el-row :gutter="10" class="row" type="flex">
<el-col :span="3">
<h3>新增/修改考试</h3>
</el-col>
</el-row>
<hr>
<el-row :gutter="10" class="row" type="flex">
<el-col :span="14">
<el-row :gutter="0" class="row" type="flex">
<el-form ref="eagleForm" :inline="false" :model="eagle" label-width="110px" label-suffix=":" size="mini" :rules="rules">
<el-form-item label="考试名称" prop="name">
<el-input class="form-input" v-model="eagle.name" placeholder="考试名称"></el-input>
</el-form-item>
<el-form-item label="通过标准" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in eagleQuestionCategories" :key="item.no" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="字段要求" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in eagleQuestionCategories" :key="item.id" :label="item.name + '/' + item.question_count" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="考试开放时间" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in testTime" :key="item.id" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="允许考试次数" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in testCount" :key="item.id" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="中途退考" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in retreatMidway" :key="item.id" :label="item.name + '/' + item.question_count" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="发布成绩" required>
<el-form-item prop="base_question">
<el-select class="form-input" v-model="base_question" filterable placeholder="请选择" @change="testChange()">
<el-option v-for="item in eagleQuestionCategories" :key="item.id" :label="item.name + '/' + item.question_count" :value="item"></el-option>
</el-select>
</el-form-item>
</el-form-item>
</el-form>
</el-row>
</el-col>
</el-row>
<el-row :gutter="10" class="" type="flex" justify="center">
<el-button type="primary" @click="save('eagleForm')">确 定</el-button>
<el-col :span="1"></el-col>
<el-button @click="back">取 消</el-button>
</el-row>
</div>
</template>
<script>
import {ossUpload, getFilePath} from "../../common/ossUtil";
import fetch from "../../common/fetch";
import {errorResponseCheck, isEmptyUtils, isNotEmptyUtils, isEmptyList, messageBox, stringToArr, openLoading, closeLoading, htmlMessageBox} from "../../common/utils";
export default {
data() {
return {
testTime: [{no:0, value:'始终开放(默认)'}, {no:1, value:'定时开放'}],
testCount: [{no:0, value:'1(默认)'}, {no:1, value:'2'}, {no:2, value:'3'}, {no:3, value:'4'}, {no:4, value:'5'}, {no:5, value:'不限次数'}],
retreatMidway: [{no:0, value:'中途退出直接提交'}, {no:1, value:'中途退出'}],
active: this.$route.query.item//前页面参数
, mxalength: 11
, base_question_flag: false
, certification_question_flag: false
, start_end_time_flag: false
, base_time_flag: false
, certification_time_flag: false
, base_start_time_flag: false
, certification_start_time_flag: false
, certification_base_time_flag: false
, certification_question_excellent_flag: false
, certification_excellent_well_flag: false
, certification_well_pass_flag: false
, resource_url: localStorage.getItem('resource_url')
, eagle: {
name: null//培训名称
, start_time: null//培训开始时间
, end_time: null//培训结束时间
, base_question_num: null//摸底题数
, base_start_time: null//摸底考试开始时间
, base_end_time: null//摸底考试结束时间
, base_duration_time: null//
, base_cover_url: null//摸底考试封面
, certification_question_num: null//结业题数
, certification_start_time: null//结业考试开始时间
, certification_end_time: null//结业考试结束时间
, certification_duration_time: null//
, certification_cover_url: null//结业考试封面
, certification_excellent_num: null//结业考试优秀正确题数
, certification_well_num: null//结业考试良好正确题数
, certification_pass_num: null//结业考试及格正确题数
, status: null//是否发布 1已发布 2未发布
, training_status: null//培训状态 1未开始 3进行中 5已结束
, cover_url: null//app封面url
, delete_flag: null//删除标志
, created_id: null//创建人id
, created_time: null//创建时间
, modified_id: null//修改人id
, modified_time: null//修改时间
}
, join_doc_name: null//手动添加参加考试的人员
, join_doc_mobile: null//手动添加参加考试的人员
, charge_mobile: null//负责考试人员
, charge_name: null//负责考试人员
//负责考试人员list TODO
, chargeMobileList: [
// {name: '王大', mobile: '13849763813'}
]
, base_question: []//摸底考试题库
, certification_question: []//结业考试题库
, showFileList: false //不展示上传list
, eagleQuestionCategories: [
{no: 1, value: '无限制(默认)'}, {no: 2, value: '身份证'}, {no: 3, value: '身份证及学历'}
]//demo //TODO
//参加考试人员 TODO
, joinDoctorList: [
// {name: '王大', mobile: '13849763813'}, {name: '王二', mobile: '13849763845'}, {name: '王小', mobile: '13849763821'},
// {name: '王大', mobile: '13849763823'}, {name: '王二', mobile: '13849763855'}, {name: '王小', mobile: '13849763221'},
// {name: '王大', mobile: '13849763833'}, {name: '王二', mobile: '13849763865'}, {name: '王小', mobile: '13849763121'},
// {name: '李大', mobile: '13849763826'}, {name: '李二', mobile: '13849763824'}, {name: '李小', mobile: '13849763326'}
]
//未注册人员list TODO
, unregisteredList: [
// {name: '王大', mobile: '13849763813'}, {name: '王二', mobile: '13849763845'}, {name: '王小', mobile: '13849763821'},
// {name: '王大', mobile: '13849763823'}, {name: '王二', mobile: '13849763855'}, {name: '王小', mobile: '13849763221'},
// {name: '王大', mobile: '13849763833'}, {name: '王二', mobile: '13849763865'}, {name: '王小', mobile: '13849763121'},
// {name: '李大', mobile: '13849763826'}, {name: '李二', mobile: '13849763824'}, {name: '李小', mobile: '13849763326'}
]
//未认证人员list TODO
, noCertifiedList: [
// {name: '王大', mobile: '13849763813'}, {name: '王二', mobile: '13849763845'}, {name: '王小', mobile: '13849763821'},
// {name: '王大', mobile: '13849763823'}, {name: '王二', mobile: '13849763855'}, {name: '王小', mobile: '13849763221'},
// {name: '王大', mobile: '13849763833'}, {name: '王二', mobile: '13849763865'}, {name: '王小', mobile: '13849763121'},
// {name: '李大', mobile: '13849763826'}, {name: '李二', mobile: '13849763824'}, {name: '李小', mobile: '13849763326'}
]
, tagType: 'success'//tag颜色
//统一控制宽度
, a: 10
, b: 1
, c: 3
, d: 6
//上传
, uploadProgress: 0//上传进度
, uploadStatus: false//是否在上传
//校验
, errFlg: false//点保存时校验标志
, rules: {
name: [
{required: true, message: '请输入培训名称', trigger: 'change'},
],
start_time: [
{type: 'date', required: true, message: '请选择开始时间', trigger: 'change'}
],
end_time: [
{type: 'date', required: true, message: '请选择结束时间', trigger: 'change'}
],
base_question_num: [
{type: 'number', required: true, message: '请输入摸底题数', trigger: 'change'},
],
base_start_time: [
{type: 'date', required: true, message: '请选择开始时间', trigger: 'change'}
],
base_end_time: [
{type: 'date', required: true, message: '请选择结束时间', trigger: 'change'}
],
certification_question_num: [
{type: 'number', required: true, message: '请输入结业考试题数', trigger: 'change'},
],
certification_start_time: [
{type: 'date', required: true, message: '请选择开始时间', trigger: 'change'}
],
certification_end_time: [
{type: 'date', required: true, message: '请选择结束时间', trigger: 'change'}
],
certification_excellent_num: [
{type: 'number', required: true, message: '请输入优秀的正确题数', trigger: 'change'},
],
certification_well_num: [
{type: 'number', required: true, message: '请输入良好的正确题数', trigger: 'change'},
],
certification_pass_num: [
{type: 'number', required: true, message: '请输入及格的正确题数', trigger: 'change'},
],
// base_cover_url: [
// {validator: baseCoverUrlCheck, trigger: 'change'},
// ],
// certification_cover_url: [
// {validator: certificationCoverUrlCheck, trigger: 'change'},
// ],
// cover_url: [
// {validator: coverUrlCheck, trigger: 'change'},
// ]
}
}
},
beforeCreate() {
},
created() {
if (this.active != null) {
this.getTrainingInfo();
}
this.getQuestionCategory();
},
mounted() {
// this.save('eagleForm');
},
methods: {
getQuestionCategory() {
let self = this;
let promise = fetch('eagleQuestionCategorys/searchAll', {
token: localStorage.getItem("token")
}, 'GET', 'GET')
promise.then(function (data) {
self.eagleQuestionCategories = data.eagleQuestionCategories;
}, function (error) {
});
},
getTrainingInfo() {
let self = this;
let promise = fetch('eagleTraining/getEagleTraining', {
token: localStorage.getItem("token"),
name: this.active.id
}, 'GET', 'GET')
promise.then(function (data) {
self.eagle = data.eagleTrainingModel;
self.unregisteredList = data.eagleDoctorUnRegists;
self.noCertifiedList = data.eagleDoctorRegists;
self.joinDoctorList = data.eagleDoctorCertifys;
self.chargeMobileList = data.chargeMobileList;
}, function (error) {
});
},
addOne(type, mobile) {
if (isEmptyUtils(mobile)) {
self.$message.warning("请输入手机号");
return;
}
//手动添加考试人员
let self = this;
if (type === 1) {
let param = {
mobile_phone: mobile,
token: localStorage.getItem("token")
};
let promise = fetch('PICADoctorServiceImpl/getDoctor', param, 'GET', 'GET');
promise.then(function (data) {
let doctor = Object.assign({}, data.picapDoctor);
let doctorTmp = {};
//type 1 为添加考试人员
//未注册人员
if (isEmptyUtils(doctor.status)) {
doctorTmp.name = self.join_doc_name;
doctorTmp.mobile_phone = self.join_doc_mobile;
self.unregisteredList.push(doctorTmp);
}
//参加考试人员
else if (doctor.status === 3) {
doctorTmp.name = doctor.name;
doctorTmp.mobile_phone = doctor.mobile_phone;
self.joinDoctorList.push(doctorTmp);
}
//未认证人员
else if (doctor.status === 1 || doctor.status === 2) {
doctorTmp.name = doctor.name;
doctorTmp.mobile_phone = doctor.mobile_phone;
self.noCertifiedList.push(doctorTmp);
}
self.join_doc_name = "";
self.join_doc_mobile = "";
self.$message.success("考试人员添加成功");
}, function (error) {
errorResponseCheck(error, self);
});
}
//type 2 为添加负责人
else if (type === 2) {
let doctorTmp = {};
doctorTmp.name = self.charge_name;
doctorTmp.mobile_phone = self.charge_mobile;
self.chargeMobileList.push(doctorTmp);
self.$message.success("负责人添加成功");
self.charge_name = "";
self.charge_mobile = "";
}
},
testChange() {
},
beforeUpload1(file) {
this.doUpload(file, 1);//摸底考试封面
},
beforeUpload2(file) {
this.doUpload(file, 2);//结业考试封面
},
beforeUpload3(file) {
this.doUpload(file, 3);//封面
},
doUpload(file, index) {
let self = this;
//如果没有选择文件,返回
if (isEmptyUtils(file)) {
return;
}
self.$message.info('开始上传');
//上传 指定文件名
ossUpload(self, file, getFilePath(file), null, null, null).then(function (path) {
if (index === 1) {
//摸底考试封面
self.eagle.base_cover_url = path;
} else if (index === 2) {
//结业考试封面
self.eagle.certification_cover_url = path;
} else if (index === 3) {
//封面
self.eagle.cover_url = path;
}
self.$message.success('上传成功');
});
return false;
},
handleRemove(file, fileList) {
// console.log(file, fileList);
//重置resource
// this.audioAddress = null;
},
save(formName) {
let self = this;
debugger
self.$refs[formName].validate((valid) => {
if (valid) {
let saveFlag = false;
if (self.eagle.base_question_num > self.base_question.question_count) {
self.base_question_flag = true;
saveFlag = true;
}
// debugger
if (self.eagle.certification_question_num > self.certification_question.question_count) {
self.certification_question_flag = true;
saveFlag = true;
}
if (self.eagle.start_time >= self.eagle.end_time) {
self.start_end_time_flag = true;
saveFlag = true;
}
if (self.eagle.base_start_time >= self.eagle.base_end_time) {
self.base_time_flag = true;
saveFlag = true;
}
if (self.eagle.certification_start_time >= self.eagle.certification_end_time) {
self.certification_time_flag = true;
saveFlag = true;
}
if (self.eagle.base_start_time <= self.eagle.start_time || self.eagle.base_start_time >= self.eagle.end_time
|| self.eagle.base_end_time <= self.eagle.start_time || self.eagle.base_end_time >= self.eagle.end_time) {
self.base_start_time_flag = true;
saveFlag = true;
}
if (self.eagle.certification_start_time <= self.eagle.start_time || self.eagle.certification_start_time >= self.eagle.end_time
|| self.eagle.certification_end_time <= self.eagle.start_time || self.eagle.certification_end_time >= self.eagle.end_time) {
self.certification_start_time_flag = true;
saveFlag = true;
}
if (self.eagle.certification_start_time <= self.eagle.base_end_time ) {
self.certification_base_time_flag = true;
saveFlag = true;
}
if (self.eagle.certification_question_num <= self.eagle.certification_excellent_num ) {
self.certification_question_excellent_flag = true;
saveFlag = true;
}
if (self.eagle.certification_excellent_num <= self.eagle.certification_well_num ) {
self.certification_excellent_well_flag = true;
saveFlag = true;
}
if (self.eagle.certification_well_num <= self.eagle.certification_pass_num ) {
self.certification_well_pass_flag = true;
saveFlag = true;
}
if (saveFlag) {
return;
}
//参加考试人员校验
if (isEmptyList(self.joinDoctorList) || isEmptyList(self.unregisteredList) || isEmptyList(self.noCertifiedList)) {
self.$message.error("请添加参加考试人员");
self.errFlg = true;
return false;
}
//考试负责人校验
if (isEmptyList(self.chargeMobileList)) {
self.$message.error("请添加考试负责人");
self.errFlg = true;
return false;
}
//是否正在上传
if (self.uploadStatus) {
self.$message.error('图片没有上传完成');
self.errFlg = true;
return;
}
//图片校验
if (isEmptyUtils(self.eagle.base_cover_url) || isEmptyUtils(self.eagle.certification_cover_url) || isEmptyUtils(self.eagle.cover_url)) {
self.errFlg = true;
return false;
}
openLoading(self);
let req = {
token: localStorage.getItem("token"),
eagle: self.eagle,
joinDoctorList: self.joinDoctorList,
unregisteredList: self.unregisteredList,
noCertifiedList: self.noCertifiedList,
chargeMobileList: self.chargeMobileList
};
console.log(JSON.stringify(req));
debugger
self.$axios.post(localStorage.getItem("Url") + 'eagleTraining/insert'
, JSON.stringify(req)
).then(function (res) {
closeLoading(self);
this.$message({
message: self.isUpdate ? '编辑成功' : '添加成功',
type: 'success',
duration: 1000,
onClose() {
self.cancel();
}
});
}).catch(function (error) {
self.$message.error('培训创建失败');
errorResponseCheck(error, self);
});
self.$message("save");
} else {
this.$message("error");
return false;
}
});
},
back() {
//返回上一级
// 后退一步记录,等同于 history.back()
this.$router.go(-1);
// let path = {path: 'listActive', query: {}};
// this.$router.push(path);
},
beforeImport(file) {
let self = this;
// self.importFlag = true;
//导入题目
//如果没有选择文件,返回
if (isEmptyUtils(file)) {
return;
}
let arr = file.type.split('/');
let ext = "." + arr[1];
let reader = new FileReader();
// reader.readAsBinaryString(file);
reader.onload = function (e) {
self.$message('开始导入');
let fileJson = {
fileName: file.name,
file: e.target.result.substr(e.target.result.indexOf("base64,") + 7),
ext: ext
};
let fileArray = [{
type: 'ActivityQA',
base64: fileJson
}];
openLoading(self);
let req = {
token: localStorage.getItem("token"),
activity_id: self.active.id,
fileArray: fileArray
};
self.$axios.post(localStorage.getItem("Url") + 'importServiceImpl/importActivityQA'
, JSON.stringify(req)
).then(function (res) {
closeLoading(self);
let data = JSON.parse(JSON.stringify(res.data));//通过这个实现深拷贝
if (data.flag) {
self.$message('导入成功');
self.questionList = self.handleQuestionList(data.list);
} else {
self.$message.error('导入题目失败');
let errorList = data.errorList;
let message = "";
if (isNotEmptyUtils(errorList)) {
for (let i = 0; i < errorList.length; i++) {
message += "第" + errorList[i].index + "行:" + errorList[i].name + '<br>';
}
}
htmlMessageBox(self, "警告", message, "确定", function () {
}, "", null, "warning");
}
}).catch(function (error) {
self.$message.error('导入题目失败');
errorResponseCheck(error, self);
});
};
reader.readAsDataURL(file);
},
},
computed: {
onRoutes() {
return this.$route.path.replace('/', '');
}
},
watch: {},
components: {},
filters: {
typeFilter: function (value) {
if (!value) return '';
if (value == 1) {
return '云鹊医典';
}
return value;
},
userRoleFilter: function (value, enumList) {
if (!value) return '';
// var hash = {
// 'R001': '普通',
// 2: '2016高危',
// 3: '2017高危',
// 10: '青海西藏'
// };
// return hash[value];
let hash = {};
if (enumList != null && enumList.length > 0) {
for (let i = 0; i < enumList.length; i++) {
hash[enumList[i].role_code] = enumList[i].role_name;
}
}
return hash[value];
}
}
}
</script>
<style scoped>
.row {
margin-top: 20px;
margin-bottom: 20px;
}
.form-input {
width: auto;
}
.tag {
margin-bottom: 5px;
margin-right: 1px;
}
.box {
border: 1px solid #000000;
}
.box-title {
margin-top: 10px;
}
.box-row {
margin-bottom: 20px;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader-icon {
background-color: #fbfdff;
border: 1px dashed #c0ccda;
border-radius: 6px;
box-sizing: border-box;
width: 148px;
height: 148px;
cursor: pointer;
line-height: 146px;
vertical-align: top;
}
.avatar {
width: 148px;
height: 148px;
display: block;
}
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册