Commit e1d166b3 authored by 纪泽龙's avatar 纪泽龙

Merge branch 'jzl'

parents 1982805d 6ba61b3a
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 16:12:47
* @LastEditTime: 2022-12-26 09:36:52
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -63,7 +63,7 @@
<div class="close" @click="deleteName(item.staffId)">x</div>
</div>
</div>
<div class="bottom-text">已选择n</div>
<div class="bottom-text">已选择{{selectNameList.length}}</div>
</div>
</div>
</template>
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 15:23:58
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 16:51:34
* @LastEditTime: 2022-12-25 16:47:17
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/Lesson-table.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -17,19 +17,19 @@
ref="multipleTable"
>
<el-table-column type="selection"></el-table-column>
<el-table-column label="负责人" align="center" prop="staffName">
<el-table-column label="负责人" align="center" prop="name">
</el-table-column>
<el-table-column
label="手机号"
align="center"
prop="deptName"
prop="phone"
:formatter="formatter"
>
</el-table-column>
<el-table-column
label="所属单位"
align="center"
prop="profession"
prop="contractorName"
:formatter="formatter"
>
</el-table-column>
......@@ -49,6 +49,7 @@
<script>
import { listStaff } from "@/api/safetyManagement/staff";
import { listContractorPerson } from "@/api/contractor/contractorPerson";
export default {
name: "",
props: {
......@@ -64,8 +65,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
staffName: null,
contractorId: null,
name: null,
},
total: 0,
nameList: [],
......@@ -75,12 +76,13 @@ export default {
methods: {
listStaff() {
this.loading = true;
listStaff(this.queryParams).then((res) => {
listContractorPerson(this.queryParams).then((res) => {
console.log('res',res)
this.total = res.total;
this.nameList = res.rows;
this.$nextTick((item) => {
this.selectNameList.forEach((item) => {
this.toggleSelection(item.staffId, true);
this.toggleSelection(item.id, true);
});
this.loading = false;
});
......@@ -110,9 +112,9 @@ export default {
this.$emit("selectAll", this.nameList, allSelect);
},
// 切换选项
toggleSelection(staffId, SeclctFlag = false) {
toggleSelection(id, SeclctFlag = false) {
const item = this.nameList.find((item) => {
return item.staffId == staffId;
return item.id == id;
});
this.$refs.multipleTable.toggleRowSelection(item, SeclctFlag);
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 16:12:56
* @LastEditTime: 2022-12-25 17:49:17
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -12,7 +12,7 @@
<div class="changePeople-left">
<div class="top-search flex">
<el-select
v-model="deptId"
v-model="id"
filterable
placeholder="请选择"
size="mini"
......@@ -21,14 +21,14 @@
>
<el-option
v-for="item in searchList"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
:key="item.id"
:label="item.contractorName"
:value="item.id"
>
</el-option>
</el-select>
<el-input
v-model="staffName"
v-model="name"
size="mini"
placeholder="请输入姓名"
suffix-icon="el-icon-date"
......@@ -57,10 +57,10 @@
<div
class="item flex"
v-for="item in selectNameList"
:key="item.staffId"
:key="item.id"
>
<div>{{ item.staffName }}</div>
<div class="close" @click="deleteName(item.staffId)">x</div>
<div>{{ item.name }}</div>
<div class="close" @click="deleteName(item.id)">x</div>
</div>
</div>
<div class="bottom-text">已选择n人</div>
......@@ -71,6 +71,7 @@
<script>
import ChangPapelTable from "./ChangPapelTable";
import { listDept } from "@/api/system/dept";
import { listAll } from "@/api/contractor/contractorInfo";
export default {
name: "PeopleGuestChange",
......@@ -88,13 +89,15 @@ export default {
return {
selectNameList: [],
searchList: [],
deptId: null,
staffName: null,
// 这个id是访客跟承包商的id。也叫id
id: null,
name: null,
};
},
created() {
listDept().then((res) => {
listAll().then((res) => {
console.log(res);
// return;
this.searchList = res.data;
});
},
......@@ -108,8 +111,8 @@ export default {
if (Array.isArray(this.selectNameList)) {
json = this.selectNameList.map((item) => {
return {
peoPleId: item.staffId,
peoPleName: item.staffName,
peoPleId: item.id,
peoPleName: item.name,
};
});
} else {
......@@ -124,8 +127,8 @@ export default {
if (jsonSelectNameList) {
this.selectNameList = JSON.parse(jsonSelectNameList).map((item) => {
return {
staffId: item.peoPleId,
staffName: item.peoPleName,
id: item.peoPleId,
name: item.peoPleName,
};
});
} else {
......@@ -137,25 +140,25 @@ export default {
this.$refs.table.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: this.deptId,
staffName: this.staffName,
contractorId: this.id,
name: this.name,
};
this.$refs.table.listStaff();
},
deleteName(staffId) {
deleteName(id) {
const index = this.selectNameList.findIndex((item) => {
return item.staffId == staffId;
return item.id == id;
});
if (index >= 0) {
console.log(index);
this.selectNameList.splice(index, 1);
this.$refs.table.toggleSelection(staffId);
this.$refs.table.toggleSelection(id);
}
},
addName(row) {
const index = this.selectNameList.findIndex((item) => {
// console.log(item.id)
return item.staffId == row.staffId;
return item.id == row.id;
});
console.log(index);
if (index >= 0) {
......@@ -170,7 +173,7 @@ export default {
if (allSelect) {
all.forEach((item) => {
const index = this.selectNameList.findIndex((iten) => {
return iten.staffId == item.staffId;
return iten.id == item.id;
});
if (index < 0) {
this.selectNameList.push(item);
......@@ -178,7 +181,7 @@ export default {
});
} else {
all.forEach((item) => {
this.deleteName(item.staffId);
this.deleteName(item.id);
});
}
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 10:24:41
* @LastEditTime: 2022-12-26 09:54:47
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -145,6 +145,10 @@ export default {
},
// 隐藏与显示dialog
dialogCancel() {
// 录入考题的时候不会有修改的缓存
if (this.topicId) {
this.topicId = null;
}
this.$emit("update:visible", false);
},
// 把ID改变了
......
......@@ -123,7 +123,12 @@
// getQuestion,
// getLessonById,
// } from "@/api/educationPlanExam/lessonsProgram.js";
import { addSubject ,getSubject,listSubject,updateSubject} from "@/api/educationPlanExam/subject";
import {
addSubject,
getSubject,
listSubject,
updateSubject,
} from "@/api/educationPlanExam/subject";
export default {
name: "AnswerLesson",
......@@ -158,7 +163,7 @@ export default {
// 如果存在就是修改
if (this.subjectId) {
getSubject(this.subjectId).then((res) => {
console.log('?',res.data);
console.log("?", res.data);
const data = res.data;
this.form = {
topicTitle: data.topicTitle,
......@@ -176,12 +181,12 @@ export default {
methods: {
getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => {
console.log(res)
console.log(res);
// 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.subjectId) {
res.rows.forEach((item, index) => {
if (item.subjectId == this.subjectId) {
this.questionNextNum = index+1;
this.questionNextNum = index + 1;
}
});
} else {
......@@ -243,7 +248,7 @@ export default {
// 把修改的这个归位,变成正常添加
this.$emit("update:subjectId", null);
this.$message({
message: "添加题目成功",
message: this.subjectId ? "添加题目成功" : "修改题目成功",
type: "success",
});
this.$parent.$parent.componentsNumChange(num);
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:28:56
* @LastEditTime: 2022-12-26 09:55:56
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -145,6 +145,10 @@ export default {
},
// 隐藏与显示dialog
dialogCancel() {
// 录入题目的时候不会有修改的缓存
if (this.subjectId) {
this.subjectId = null;
}
this.$emit("update:visible", false);
},
// 把ID改变了
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:28:57
* @LastEditTime: 2022-12-27 16:03:40
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -24,7 +24,8 @@
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>导入</el-button>
>导入</el-button
>
</el-col>
</el-row>
......@@ -89,13 +90,24 @@
</div> -->
<!-- 设备导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport+ '&bankId=' + upload.bankId"
:action="
upload.url +
'?updateSupport=' +
upload.updateSupport +
'&bankId=' +
upload.bankId
"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
......@@ -108,17 +120,19 @@
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
<!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的设备数据-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
<!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的设备数据-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDownload(upload)"
>下载模板</el-button>
>下载模板</el-button
>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
......@@ -160,7 +174,7 @@ export default {
// 设备导入参数
upload: {
//题库id
bankId:0,
bankId: 0,
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
......@@ -172,7 +186,7 @@ export default {
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/subject/import"
url: process.env.VUE_APP_BASE_API + "/system/subject/import",
},
queryParams: {
bankId:0
......@@ -209,7 +223,7 @@ export default {
/** 导入按钮操作 */
handleImport() {
this.upload.bankId=this.bankId;
this.upload.bankId = this.bankId;
this.upload.title = "题目导入";
this.upload.open = true;
},
......@@ -223,10 +237,12 @@ export default {
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getQuestion({ bankId: this.bankId });
// this.getList();
this.$parent.$parent.$parent.getList();
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
importTemplate().then((response) => {
this.download(response.msg);
});
},
......
......@@ -5,7 +5,6 @@
ref="queryForm"
:inline="true"
label-width="68px"
>
<!-- <el-form-item label="课件类别" prop="courseType">
<el-select
......@@ -24,7 +23,7 @@
</el-form-item> -->
<el-form-item
label="考试名称"
label="所属单位"
prop="deptId"
ref="treeItem"
>
......
......@@ -116,14 +116,13 @@
</template>
<script>
// import {
// addQuestion,
// checkQuestion,
// changeQuestion,
// getQuestion,
// getLessonById,
// } from "@/api/educationPlanExam/lessonsProgram.js";
import { addSubject ,getSubject,listSubject,updateSubject} from "@/api/educationPlanExam/subject";
import {
addQuestion,
checkQuestion,
changeQuestion,
getQuestion,
getLessonById,
} from "@/api/educationPlanExam/lessonsProgram.js";
export default {
name: "AnswerLesson",
......@@ -132,10 +131,10 @@ export default {
// type: Boolean,
// default: false,
// },
bankId: {
courseId: {
type: Number,
},
subjectId: {
topicId: {
type: Number,
},
},
......@@ -156,9 +155,9 @@ export default {
created() {
// 如果存在就是修改
if (this.subjectId) {
getSubject(this.subjectId).then((res) => {
console.log('?',res.data);
if (this.topicId) {
checkQuestion(this.topicId).then((res) => {
console.log(res.data);
const data = res.data;
this.form = {
topicTitle: data.topicTitle,
......@@ -171,16 +170,16 @@ export default {
// 查询是第几道题
this.getQuestion();
// 获取课程标题
// this.getLessonById(this.bankId);
this.getLessonById(this.courseId);
},
methods: {
getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => {
console.log(res)
getQuestion({ courseId: this.courseId }).then((res) => {
// 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.subjectId) {
console.log(res)
if (this.topicId) {
res.rows.forEach((item, index) => {
if (item.subjectId == this.subjectId) {
if (item.topicId == this.topicId) {
this.questionNextNum = index+1;
}
});
......@@ -189,18 +188,18 @@ export default {
}
});
},
// getLessonById(bankId) {
// getLessonById(bankId).then((res) => {
// console.log(res);
// this.courseName = res.data.courseName;
// });
// },
getLessonById(courseId) {
getLessonById(courseId).then((res) => {
console.log(res);
this.courseName = res.data.courseName;
});
},
addQuestion(data) {
// 如果是修改,就用修改的方法,如果是新增,就用新增的方法
if (this.subjectId) {
return updateSubject({ subjectId: this.subjectId, ...data });
if (this.topicId) {
return changeQuestion({ topicId: this.topicId, ...data });
} else {
return addSubject({ bankId: this.bankId, ...data });
return addQuestion({ courseId: this.courseId, ...data });
}
},
rightAnswerClick(index) {
......@@ -241,7 +240,7 @@ export default {
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
this.$emit("update:subjectId", null);
this.$emit("update:topicId", null);
this.$message({
message: "添加题目成功",
type: "success",
......
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 09:30:19
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-27 15:59:28
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangeQuestion.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="table-wrapper">
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="所属单位" prop="deptId" ref="treeItem">
<Treeselect
class="tree"
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
style="width: 200px"
/>
</el-form-item>
<el-form-item label="名称" prop="courseName">
<el-input
v-model="queryParams.courseName"
placeholder="考试时间"
clearable
size="small"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="search"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetClick"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" height="435" ref="multipleTable">
<!-- <el-table-column type="selection"></el-table-column> -->
<el-table-column label="" align="center" prop="profession">
<template v-slot="{ row }">
<!-- <div> -->
<el-checkbox
:disabled="row.numberQuestions == 0"
v-model="row.checked"
></el-checkbox>
<!-- </div> -->
</template>
</el-table-column>
<el-table-column label="题库名称" align="center" prop="bankName">
</el-table-column>
<el-table-column label="所属单位" align="center" prop="courseType">
<template v-slot="scope">
<div>
{{ selectList(deptOptions, scope.row.deptId) || "-" }}
</div>
</template>
</el-table-column>
<el-table-column
label="包含题目数量"
align="center"
prop="numberQuestions"
:formatter="formatter"
>
</el-table-column>
<el-table-column label="选取题目数量" align="center" prop="profession">
<template v-slot="{ row }">
<div>
<!-- <el-input
:disabled="!row.checked|| row.numberQuestions==0 "
v-model="row.changeNum"
size="mini"
style="width: 100px"
></el-input> -->
<el-input-number
v-model="row.changeNum"
:disabled="!row.checked || row.numberQuestions == 0"
size="mini"
:min="1"
:max="+row.numberQuestions ? +row.numberQuestions : 1000000"
label="描述文字"
></el-input-number>
</div>
</template>
</el-table-column>
</el-table>
<!-- <div> -->
<el-pagination
:layout="'prev, pager, next'"
v-show="total > 0"
:total="total"
:current-page="queryParams.pageNum"
:page-sizes="[queryParams.pageSize]"
@current-change="currentChangeClick"
/>
</div>
</template>
<script>
import { listBank, delBank } from "@/api/educationPlanExam/questionBank";
// 部门列表
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "",
components: {
Treeselect,
},
props: {
courseId: {
type: Number,
},
},
data() {
return {
queryParams: {},
list: [
{
checked: false,
},
],
total: 20,
loading: false,
// 题库id
deptId: null,
// 归属部门列表
deptOptions: [],
};
},
created() {
this.getList();
this.getTreeselect();
},
methods: {
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
// console.log("123", this.deptOptions);
// console.log(this.selectList(this.deptOptions, 175));
});
},
// 递归查值的方法
selectList(list, id) {
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (item.id == id) {
return item.label;
} else {
if (Array.isArray(item.children)) {
let a = this.selectList(item.children, id);
if (a) {
return a;
}
}
}
}
},
getList() {
this.loading = true;
listBank(this.queryParams)
.then((res) => {
console.log(res);
this.list = res.rows.map((item, index) => {
return {
bankNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
checked: false,
changeNum: 0,
...item,
};
});
this.total = res.total;
})
.finally(() => {
this.loading = false;
});
},
saveAndNext() {
const topicInfos = this.list
.filter((item) => item.checked)
.map((item) => {
return {
bankId: item.bankId,
quan: item.changeNum,
};
});
console.log(this.courseId,topicInfos);
const data = {courseId:this.courseId,topicInfos}
console.log(data);
// this.$parent.$parent.componentsNumChange(2);
},
resetClick() {},
search() {},
currentChangeClick() {},
formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index);
if (!cellValue) return "-";
else return cellValue;
},
},
};
</script>
<style lang="scss" scoped>
.table-wrapper {
padding-top: 22px;
width: 100%;
height: 550px;
overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
}
</style>
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-19 14:01:37
* @LastEditTime: 2022-12-27 09:45:29
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -22,8 +22,8 @@
<transition name="fade" mode="out-in">
<component
:is="currentComponent"
:bankId.sync="bankId"
:subjectId.sync="subjectId"
:courseId.sync="courseId"
:topicId.sync="topicId"
ref="current"
></component>
</transition>
......@@ -33,6 +33,13 @@
</div>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
v-if="this.componentsNum == 2"
@click="componentsNumChange(4)"
>从题库选择</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 1 || this.componentsNum == 3"
......@@ -58,6 +65,7 @@
import Lesson from "./Lesson";
import AddQuestion from "./AddQuestion";
import QuestionList from "./QuestionList";
import ChangeQuestion from "./ChangeQuestion";
export default {
name: "AnswerLesson",
......@@ -70,7 +78,7 @@ export default {
type: Number,
default: 1,
},
bankId: {
courseId: {
type: Number,
},
},
......@@ -85,7 +93,7 @@ export default {
title: "录入课程",
currentComponent: Lesson,
// 当前题目查看
subjectId: null,
topicId: null,
};
},
watch: {
......@@ -93,7 +101,7 @@ export default {
handler(num) {
if (num === 1) {
this.currentComponent = Lesson;
if (this.bankId) {
if (this.courseId) {
this.title = "修改课程";
} else {
this.title = "新增课程";
......@@ -102,13 +110,16 @@ export default {
this.currentComponent = QuestionList;
this.title = "题目列表";
} else {
} else if (num === 3) {
this.currentComponent = AddQuestion;
if (this.subjectId) {
if (this.topicId) {
this.title = "修改题目";
} else {
this.title = "新增题目";
}
} else if (num == 4) {
this.currentComponent = ChangeQuestion;
this.title = "从题库选题";
}
},
deep: true,
......@@ -121,8 +132,10 @@ export default {
text = "保存并录入题目";
} else if (this.componentsNum == 2) {
text = "录入考题";
} else {
} else if (this.componentsNum == 3) {
text = "保存并录入下一题";
} else {
text = "确定选择";
}
return text;
},
......@@ -145,11 +158,15 @@ export default {
},
// 隐藏与显示dialog
dialogCancel() {
// 录入考题的时候不会有修改的缓存
if (this.topicId) {
this.topicId = null;
}
this.$emit("update:visible", false);
},
// 把ID改变了
changeCourseId(bankId) {
this.$emit("update:bankId", bankId);
changeCourseId(courseId) {
this.$emit("update:courseId", courseId);
},
// 改变当前组件
componentsNumChange(num) {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-24 15:50:39
* @LastEditTime: 2022-12-26 16:31:34
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -15,122 +15,89 @@
label-width="auto"
:rules="rules"
>
<el-form-item label="题库名称" prop="bankName">
<el-input style="width: 500px" v-model="form.bankName"></el-input>
<el-form-item label="考试标题" prop="courseName">
<el-input style="width: 700px" v-model="form.courseName"></el-input>
</el-form-item>
<div class="top flex">
<el-form-item label="开始时间" prop="releaseTime">
<el-form-item label="开始时间" prop="testStartTime">
<el-date-picker
style="width: 220px; margin-right: 44px"
v-model="form.startTime"
style="margin-right: 50px"
v-model="form.testStartTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="开始时间"
default-time="12:00:00"
>
</el-date-picker>
placeholder="选择日期时间"
default-time="00:00:00"
/>
</el-form-item>
<el-form-item label="结束时间" prop="releaseTime">
<el-form-item label="结束时间" prop="testEndTime">
<el-date-picker
v-model="form.endTime"
v-model="form.testEndTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="结束时间"
default-time="12:00:00"
>
</el-date-picker>
placeholder="选择日期时间"
default-time="00:00:00"
/>
</el-form-item>
</div>
<el-form-item label="考试范围" prop="releaseTime">
<el-radio-group v-model="form.personelType">
<el-radio :label="1">内部员工</el-radio>
<el-radio :label="2">访客和承包商</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择人员" prop="releaseTime">
<!-- table -->
<!-- jsonSelectNameList就是呗选中的人员的json -->
<!-- getPeopleList 是每次选中或者删除人员都会返回 一个所有人员列表的json串,[{staffId:staffId,staffName:staffName},{staffId:staffId,staffName:staffName}] -->
<!-- 要在jsonSelectNameList赋值完毕之后 调用一下 this.$refs.changePaple.changeNameList 135行 -->
<PeopleGuestChange
<el-form-item label="选择人员" prop="testPersons">
<ChangePapel
ref="changePaple"
:jsonSelectNameList="jsonSelectNameList"
@getPeopleList="getPeopleList"
/>
</el-form-item>
<!-- </div> -->
</el-form>
</div>
</template>
<script>
// 内部
import ChangePapel from "@/components/PeopleChange";
// 访客承包商
import PeopleGuestChange from "@/components/PeopleGuestChange";
// import Editor from "./Editor";
// import FileUpload from "@/components/FileUpload";
// import uploadfile from "@/assets/uploadfile.png";
// import { mapGetters } from "vuex";
// import {
// addLessons,
// getLessonById,
// changeLesson,
// } from "@/api/educationPlanExam/lessonsProgram";
import {
listBank,
addBank,
updateBank,
getBank,
} from "@/api/educationPlanExam/questionBank";
addLessons,
getLessonById,
changeLesson,
} from "@/api/educationPlanExam/lessonsProgram";
// 所有部门
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "",
props: {
bankId: {
courseId: {
type: Number,
},
// jsonSelectNameList: {
// type: String,
// default:
// '[{"staffId":880,"staffName":"孙卓亚"},{"staffId":871,"staffName":"张玉宾"},{"staffId":869,"staffName":"李二朝"},{"staffId":870,"staffName":"盖永峰"},{"staffId":868,"staffName":"刘丽艳"},{"staffId":867,"staffName":"霍文俊"},{"staffId":866,"staffName":"刘志坚"},{"staffId":865,"staffName":"郝文权"},{"staffId":864,"staffName":"齐雪军"},{"staffId":852,"staffName":"刘江平"},{"staffId":853,"staffName":"谷建海"},{"staffId":851,"staffName":"丁振国"},{"staffId":850,"staffName":"齐江波"},{"staffId":849,"staffName":"周立新"},{"staffId":848,"staffName":"史志波"},{"staffId":847,"staffName":"王增波"},{"staffId":846,"staffName":"杨彦龙"},{"staffId":845,"staffName":"杨华国"},{"staffId":844,"staffName":"王青华"}]',
// },
},
components: {
// Editor,
// FileUpload,
ChangePapel,
PeopleGuestChange
},
data() {
return {
form: {
bankName: "",
// courseType: "",
// courseConent: "",
// video: "",
// enclosure: "",
deptId: null,
abc: 0,
personelType: 1,
courseName: "",
testStartTime: "",
testEndTime: "",
testPersons: "",
},
// 参考人员
// jsonSelectNameList: null,
jsonSelectNameList: '[{"peoPleId":880,"peoPleName":"孙卓亚"},{"peoPleId":871,"peoPleName":"张玉宾"}]',
// 考试范围
// 归属部门列表
deptOptions: [],
jsonSelectNameList: null,
// '[{"peoPleId":880,"peoPleName":"孙卓亚"},{"peoPleId":871,"peoPleName":"张玉宾"}]',
fileListVideo: [],
fileListFile: [],
readOnly: false,
// selectNameList: [],
rules: {
bankName: [
courseName: [
{ required: true, trigger: "blur", message: "课程名称不能为空" },
],
deptId: [
{ required: true, trigger: "blur", message: "请选择所属部门" },
testStartTime: [
{ required: true, trigger: "blur", message: "考试开始时间不能为空" },
],
testEndTime: [
{ required: true, trigger: "blur", message: "课程名称不能为空" },
],
},
};
......@@ -140,67 +107,76 @@ export default {
// ...mapGetters(["courseOptions"]),
},
created() {
if (this.bankId) {
if (this.courseId) {
this.getLessonById();
}
// 归属部门列表
// this.getTreeselect();
},
mounted() {
// this.jsonSelectNameList
// '[{"staffId":880,"staffName":"孙卓亚"},{"staffId":871,"staffName":"张玉宾"},{"staffId":869,"staffName":"李二朝"},{"staffId":870,"staffName":"盖永峰"},{"staffId":868,"staffName":"刘丽艳"},{"staffId":867,"staffName":"霍文俊"},{"staffId":866,"staffName":"刘志坚"},{"staffId":865,"staffName":"郝文权"},{"staffId":864,"staffName":"齐雪军"},{"staffId":852,"staffName":"刘江平"},{"staffId":853,"staffName":"谷建海"},{"staffId":851,"staffName":"丁振国"},{"staffId":850,"staffName":"齐江波"},{"staffId":849,"staffName":"周立新"},{"staffId":848,"staffName":"史志波"},{"staffId":847,"staffName":"王增波"},{"staffId":846,"staffName":"杨彦龙"},{"staffId":845,"staffName":"杨华国"},{"staffId":844,"staffName":"王青华"}]';
this.$refs.changePaple.changeNameList(this.jsonSelectNameList);
},
methods: {
// 添加课程
addLessons(data) {
if (!this.bankId) {
console.log("this.courseId", this.courseId);
if (!this.courseId) {
console.log("添加");
return addBank(data);
return addLessons({ dataKind: 1, ...data });
} else {
console.log("修改");
return updateBank({ bankId: this.bankId, ...data });
return changeLesson({ courseId: this.courseId, ...data });
}
},
getPeopleList(list) {
console.log("参考人员", list);
// this.peopleList = list;
this.form.testPersons = list;
},
// 复现
getLessonById() {
getBank(this.bankId).then((res) => {
console.log("res", res);
getLessonById(this.courseId).then((res) => {
if (res.code == 200) {
const data = res.data;
const { courseName, testStartTime, testEndTime, testPersons } = data;
this.form = {
bankName: res.data.bankName,
deptId: res.data.deptId,
courseName,
testStartTime,
testEndTime,
testPersons,
};
// const data = res.data;
// const { bankName, courseType, courseConent, video, enclosure } =
// data;
// this.form = {
// bankName,
// courseType,
// courseConent,
// video,
// enclosure,
// };
// this.fileListVideo = [
// {
// name: bankName + "视频",
// url: uploadfile,
// },
// ];
// this.fileListFile = [
// {
// name: bankName + "附件",
// url: uploadfile,
// },
// ];
this.jsonSelectNameList = testPersons;
this.$refs.changePaple.changeNameList(this.jsonSelectNameList);
}
});
},
// 获取参考人员的list
getPeopleList(list) {
console.log("参考人员", list);
getFileInfoVideo(res) {
this.form.video = res.url;
// this.form.videoName = res.fileName;
this.fileListVideo = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveVideo(e) {
this.fileListVideo = [];
this.form.video = "";
// this.form.videoName = null;
},
getFileInfoFile(res) {
this.form.enclosure = res.url;
// this.form.enclosureName = res.fileName;
this.fileListFile = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveFile(e) {
this.fileListFild = [];
this.form.enclosure = "";
// this.form.fileName = null;
},
save(num = 2) {
// 因为富文本编辑器会残留<p><br></p>,所以要清
......@@ -209,41 +185,30 @@ export default {
// }
this.$refs.form.validate((valid) => {
if (valid) {
// console.log(this.form);
this.addLessons({ ...this.form }).then((res) => {
// 如果添加会传回来,就用传回来的,如果是修改本身就有,就用本身的
// console.log('res',res)
const bankId = this.bankId || res;
// if (res.code == 200) {
const courseId = res.data || this.courseId;
if (res.code == 200) {
// 这样调比较纯函数一点
if (num == 2) {
this.$message({
message: "保存题库成功",
message: "保存课程成功",
type: "success",
});
} else if (num == 3) {
this.$message({
message: "保存题库成功,请开始录入题目",
message: "保存课程成功,请开始录入题目",
type: "success",
});
}
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(bankId);
this.$parent.$parent.changeCourseId(courseId);
this.$parent.$parent.$parent.getList();
return true;
// }
});
} else {
if (!this.form.deptId) {
document.querySelector(
".vue-treeselect__control"
).style.borderColor = "red";
} else {
document.querySelector(
".vue-treeselect__control"
).style.borderColor = "";
this.$refs.treeItem.clearValidate();
}
});
}
});
},
......@@ -258,10 +223,11 @@ export default {
.form-wrapper {
padding-top: 22px;
width: 100%;
height: 600px;
// overflow: hidden;
height: 550px;
overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
// border-bottom: 1px solid #bbbbbb;
.top {
width: 100%;
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:28:57
* @LastEditTime: 2022-12-26 16:55:10
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -10,9 +10,9 @@
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前有<span>{{ questionNum || 0 }}</span
目前有<span>{{ questionNum }}</span
>道题
<!-- <span class="warn">温馨提示:发布课程前需要进行考试设置</span> -->
<span class="warn">温馨提示:发布课程前需要进行考试设置</span>
</div>
<div class="right">{{ courseName }}</div>
</div>
......@@ -25,7 +25,7 @@
<div class="td-wrapper">
<div
v-for="(item, index) in questionList"
:key="item.subjectId"
:key="item.topicId"
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
......@@ -35,13 +35,13 @@
<div class="right">
<div>
<el-button
@click="edit(item.subjectId)"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
@click="deleteLesson(item.subjectId)"
@click="deleteLesson(item.topicId)"
icon="el-icon-delete"
type="text"
>删除</el-button
......@@ -51,9 +51,8 @@
</div>
</div>
</div>
<!-- <div class="rightNum flex">
<div class="left">录入考题</div>
<div class="rightNum flex">
<div class="left">考试设置</div>
<div class="middle flex">
<div class="left-text">答对题目大于</div>
<div>
......@@ -74,7 +73,7 @@
>保存</el-button
>
</div>
</div> -->
</div>
</div>
</template>
......@@ -85,13 +84,10 @@ import {
changeLesson,
getLessonById,
} from "@/api/educationPlanExam/lessonsProgram";
import { listSubject, delSubject } from "@/api/educationPlanExam/subject";
import { getBank } from "@/api/educationPlanExam/questionBank";
export default {
name: "AnswerLesson",
props: {
bankId: {
courseId: {
type: Number,
},
},
......@@ -118,11 +114,11 @@ export default {
// },
created() {
console.log("this.bankId", this.bankId);
if (this.bankId) {
this.getQuestion({ bankId: this.bankId });
console.log("this.courseId", this.courseId);
if (this.courseId) {
this.getQuestion({ courseId: this.courseId });
// 获取只题目正确几题算过关
this.getLessonById(this.bankId);
this.getLessonById(this.courseId);
}
},
methods: {
......@@ -132,14 +128,13 @@ export default {
saveAndNext() {
this.$parent.$parent.componentsNumChange(3);
},
getQuestion(bankId) {
console.log(bankId);
return listSubject(bankId).then((res) => {
console.log("题库res", res);
getQuestion(courseId) {
return getQuestion(courseId).then((res) => {
console.log(res);
this.questionList = res.rows.map((item) => {
return {
subjectId: item.subjectId,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
});
......@@ -147,18 +142,18 @@ export default {
return true;
});
},
getLessonById(bankId) {
getBank(bankId).then((res) => {
// console.log(res);
// this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.bankName;
getLessonById(courseId) {
getLessonById(courseId).then((res) => {
console.log(res);
this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.courseName;
});
},
edit(subjectId) {
this.$emit("update:subjectId", subjectId);
edit(topicId) {
this.$emit("update:topicId", topicId);
this.$parent.$parent.componentsNumChange(3);
},
deleteLesson(subjectId) {
deleteLesson(topicId) {
this.$confirm("请确定删除该题", {
confirmButtonText: "确定",
cancelButtonText: "取消",
......@@ -166,7 +161,7 @@ export default {
})
.then(() => {
this.loading = true;
return delSubject(subjectId);
return deleteQuestion(topicId);
})
.then((res) => {
if (res.code == 200) {
......@@ -175,7 +170,7 @@ export default {
type: "success",
});
}
return this.getQuestion({ bankId: this.bankId });
return this.getQuestion({ courseId: this.courseId });
})
.finally(() => {
this.loading = false;
......@@ -192,7 +187,7 @@ export default {
return;
}
changeLesson({
bankId: this.bankId,
courseId: this.courseId,
qualifiedNum: this.rightNum,
}).then((res) => {
if (res.code == 200) {
......@@ -200,6 +195,7 @@ export default {
message: "答题合格数修改成功",
type: "success",
});
this.$parent.$parent.$parent.getList();
}
});
},
......
......@@ -4,26 +4,9 @@
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
>
<!-- <el-form-item label="课件类别" prop="courseType">
<el-select
v-model="queryParams.courseType"
placeholder="请选择课程类型"
clearable
size="small"
label-width="100px"
>
<el-option
v-for="course in courseOptions"
:key="course.planId"
:label="course.planName"
:value="course.planId"
/>
</el-select>
</el-form-item> -->
<el-form-item label="考试名称" prop="courseName">
<el-form-item label="考试名称" prop="courseType">
<el-input
v-model="queryParams.courseName"
placeholder="请输入课程名称"
......@@ -31,26 +14,24 @@
size="small"
/>
</el-form-item>
<el-form-item label="考试时间" prop="releaseTime">
<el-form-item label="考试开始时间" prop="startTime">
<el-date-picker
v-model="queryParams.releaseTime"
v-model="queryParams.startTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
default-time="12:00:00"
>
</el-date-picker>
/>
</el-form-item>
<!-- <el-form-item label="发布时间" prop="releaseTime">
<el-form-item label="考试结束时间" prop="endTime">
<el-date-picker
v-model="queryParams.releaseTime"
v-model="queryParams.endTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间"
default-time="12:00:00"
>
</el-date-picker>
</el-form-item> -->
/>
</el-form-item>
<el-form-item>
<el-button
......@@ -80,110 +61,83 @@
</el-col>
</el-row>
<el-table v-loading="loading" :data="bankList">
<el-table-column label="序号" width='100' align="center" prop="bankNum"/>
<el-table-column label="考试名称" align="center" prop="bankName">
</el-table-column>
<el-table-column label="开始时间" align="center" prop="startTime">
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endTime">
</el-table-column>
<el-table-column label="答对几题合格" align="center" prop="endTime">
</el-table-column>
<!-- <el-table-column
label="所属单位"
<el-table v-loading="loading" :data="lessonsList">
<el-table-column
label="序号"
align="center"
prop="courseType"
>
<template v-slot="scope">
<div>
{{ selectList(deptOptions, scope.row.deptId)||'-' }}
</div>
</template>
</el-table-column> -->
<!-- <el-table-column label="附件" align="center" prop="enclosure">
<template v-slot="{ row: { enclosure } }">
<a
v-if="enclosure && enclosure.indexOf('.txt') >= 0"
@click="downloadText(enclosure)"
class="down-load"
>下载附件</a
>
<a v-else :href="enclosure" class="down-load">下载附件</a>
</template>
</el-table-column> -->
<!-- <el-table-column label="视频" align="center" prop="video">
<template v-slot="{ row: { courseName, video } }">
<a @click="downLoadVideo(video, courseName)" class="down-load"
>下载视频</a
>
</template>
</el-table-column>
prop="courseNum"
width="55"
/>
<el-table-column label="课程标题" align="center" prop="courseName" />
<el-table-column
label="发布时间"
label="开始时间"
align="center"
prop="releaseTime"
prop="testStartTime"
:formatter="formatter"
/> -->
<!-- <el-table-column
label="考试题数量"
/>
<el-table-column
label="结束时间"
align="center"
prop="testEndTime"
:formatter="formatter"
/>
<el-table-column
label="考试题"
align="center"
prop="topicNum"
width="180"
>
<template v-slot="{ row: { topicNum, bankId } }">
<div @click="checkQuestion(bankId)" class="timuNum">
<template v-slot="{ row: { topicNum, courseId } }">
<div @click="checkQuestion(courseId)" class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<div v-else>未录入</div>
</div>
</template>
</el-table-column> -->
</el-table-column>
<el-table-column
label="答对几题算合格"
align="center"
prop="qualifiedNum"
:formatter="formatter"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template v-slot="{ row: { bankId } }">
<template v-slot="{ row: { status, courseId } }">
<!-- <div>{{status}}</div> -->
<el-button
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-document-add"
@click="changeBank(bankId)"
icon="el-icon-edit"
@click="checkQuestion(courseId)"
>录入考题</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="deletBank(bankId)"
>删除</el-button
>
<el-button
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-edit"
@click="changeBank(bankId)"
@click="changeLesson(courseId)"
>编辑</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="changeBank(bankId)"
>发布考试</el-button
icon="el-icon-delete"
@click="deletLesson(courseId)"
>删除</el-button
>
<!-- <el-button
<el-button
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-delete"
@click="issueLesson(bankId)"
>发布</el-button
> -->
@click="issueLesson(courseId)"
>发布考试</el-button
>
</template>
</el-table-column>
</el-table>
......@@ -198,37 +152,29 @@
<Dia
ref="Dia"
:componentsNum.sync="componentsNum"
:bankId.sync="bankId"
:courseId.sync="courseId"
:visible.sync="dilogFlag"
/>
<el-dialog> </el-dialog>
</div>
</template>
<script>
// import {
// getLessons,
// getLessonById,
// issue,
// deleteLesson,
// } from "@/api/educationPlanExam/lessonsProgram.js";
import { listBank,delBank } from "@/api/educationPlanExam/questionBank";
// 部门列表
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
// 获取课程类型
// import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
// import { mapGetters, mapMutations } from "vuex";
import {
getLessons,
getLessonById,
issue,
deleteLesson,
} from "@/api/educationPlanExam/lessonsProgram.js";
// 获取培训计划
import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
import { mapGetters, mapMutations } from "vuex";
import Dia from "./components/Dia";
export default {
name: "textPaper",
name: "Book",
components: {
Dia,
Treeselect
},
data() {
return {
......@@ -237,15 +183,14 @@ export default {
// 总条数
total: 0,
// courseOptions: [],
bankList: [],
lessonsList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
// 所属部门
deptId: null,
// 题库名称
bankName: null,
dataKind: 1,
courseType: null,
courseName: null,
releaseTime: "",
},
// 表单参数
......@@ -255,49 +200,19 @@ export default {
dilogFlag: false,
componentsNum: 1,
// 点击的id,如果是新增为空
bankId: null,
// 题库id
deptId: null,
// 归属部门列表
deptOptions: [],
courseId: null,
};
},
computed: {
// ...mapGetters(["courseOptions"]),
...mapGetters(["courseOptions"]),
},
created() {
// this.getPlanList();
this.getTreeselect();
this.getList();
},
methods: {
// ...mapMutations({ setOptions: "SET_COURSE_OPTIONS" }),
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
// console.log("123", this.deptOptions);
// console.log(this.selectList(this.deptOptions, 175));
});
},
// 递归查值的方法
selectList(list, id) {
for (let i = 0; i < list.length; i++) {
let item = list[i];
if (item.id == id) {
return item.label;
} else {
if (Array.isArray(item.children)) {
let a = this.selectList(item.children, id);
if (a) {
return a;
}
}
}
}
},
...mapMutations({ setOptions: "SET_COURSE_OPTIONS" }),
// 获取课程类别,也就是计划名称
// getPlanList() {
// getPlanList().then((res) => {
......@@ -315,18 +230,10 @@ export default {
/** 查询课程列表 */
getList() {
this.loading = true;
listBank(this.queryParams)
getLessons(this.queryParams)
.then((res) => {
console.log(res);
this.bankList = res.rows.map((item, index) => {
return {
bankNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
...item,
};
});
this.lessonsList = res.rows;
this.total = res.total;
})
.finally(() => {
......@@ -339,23 +246,23 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.Dia.title = "新增题库";
this.$refs.Dia.title = "新增培训课程";
this.componentsNum = 1;
this.bankId = null;
this.courseId = null;
this.dilogFlag = true;
},
changeBank(bankId) {
this.$refs.Dia.title = "修改题库";
changeLesson(courseId) {
this.$refs.Dia.title = "修改培训课程";
this.componentsNum = 1;
this.bankId = bankId;
this.courseId = courseId;
this.dilogFlag = true;
},
// 直接查看考题
checkQuestion(bankId) {
checkQuestion(courseId) {
// 要查看考题的id
this.bankId = bankId;
console.log(this.bankId);
this.courseId = courseId;
console.log(this.courseId);
// 2代表列表组件
this.componentsNum = 2;
this.dilogFlag = true;
......@@ -375,14 +282,14 @@ export default {
releaseTime: "",
};
},
deletBank(bankId) {
deletLesson(courseId) {
this.$confirm("请确定删除", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
return delBank(bankId);
return deleteLesson(courseId);
})
.then((res) => {
if (res.code == 200) {
......@@ -396,121 +303,48 @@ export default {
.catch(() => {});
},
// 发布
// issueLesson(bankId) {
// this.$confirm("请确定发布", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// })
// .then(() => {
// // 判断是否录入答题合格数
// return getLessonById(bankId);
// })
// .then((res) => {
// if (res.data.qualifiedNum > 0) {
// return true;
// }
// })
// .then((res) => {
// if (res) {
// // 成功就发布
// return issue({ bankId });
// } else {
// this.$message({
// message: "请先录入答题合格数",
// type: "warning",
// });
// }
// })
// .then((res) => {
// if (res.code == 200) {
// this.$message({
// message: "发布成功",
// type: "success",
// });
// this.getList();
// }
// })
// .catch(() => {});
// },
issueLesson(courseId) {
this.$confirm("请确定发布", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// 判断是否录入答题合格数
return getLessonById(courseId);
})
.then((res) => {
if (res.data.qualifiedNum > 0) {
return true;
}
})
.then((res) => {
if (res) {
// 成功就发布
return issue({ courseId });
} else {
this.$message({
message: "请先录入答题合格数",
type: "warning",
});
}
})
.then((res) => {
if (res.code == 200) {
this.$message({
message: "发布成功",
type: "success",
});
this.getList();
}
})
.catch(() => {});
},
formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index);
if (!cellValue) return "-";
else return cellValue;
},
// downloadText(url) {
// // url = url.replace(/\\/g, "/");
// const xhr = new XMLHttpRequest();
// xhr.open("GET", url, true);
// xhr.responseType = "blob";
// //xhr.setRequestHeader('Authorization', 'Basic a2VybWl0Omtlcm1pdA==');
// xhr.onload = function () {
// if (xhr.readyState === 4 && xhr.status === 200) {
// let blob = this.response;
// console.log(blob);
// // 转换一个blob链接
// // 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// // 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
// let downLoadUrl = window.URL.createObjectURL(
// new Blob([blob], {
// type: "txt",
// })
// );
// // 视频的type是video/mp4,图片是image/jpeg
// // 01.创建a标签
// let a = document.createElement("a");
// // 02.给a标签的属性download设定名称
// a.download = name;
// // 03.设置下载的文件名
// a.href = downLoadUrl;
// // 04.对a标签做一个隐藏处理
// a.style.display = "none";
// // 05.向文档中添加a标签
// document.body.appendChild(a);
// // 06.启动点击事件
// a.click();
// // 07.下载完毕删除此标签
// a.remove();
// }
// };
// xhr.send();
// },
// downLoadVideo(url, name) {
// var xhr = new XMLHttpRequest();
// xhr.open("GET", url, true);
// xhr.responseType = "arraybuffer"; // 返回类型blob
// xhr.onload = function () {
// if (xhr.readyState === 4 && xhr.status === 200) {
// let blob = this.response;
// console.log(blob);
// // 转换一个blob链接
// // 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// // 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
// let downLoadUrl = window.URL.createObjectURL(
// new Blob([blob], {
// type: "video/mp4",
// })
// );
// // 视频的type是video/mp4,图片是image/jpeg
// // 01.创建a标签
// let a = document.createElement("a");
// // 02.给a标签的属性download设定名称
// a.download = name;
// // 03.设置下载的文件名
// a.href = downLoadUrl;
// // 04.对a标签做一个隐藏处理
// a.style.display = "none";
// // 05.向文档中添加a标签
// document.body.appendChild(a);
// // 06.启动点击事件
// a.click();
// // 07.下载完毕删除此标签
// a.remove();
// }
// };
// xhr.send();
// },
},
};
</script>
......
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