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

Merge branch 'jzl'

parents 1982805d 6ba61b3a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55 * @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<div class="close" @click="deleteName(item.staffId)">x</div> <div class="close" @click="deleteName(item.staffId)">x</div>
</div> </div>
</div> </div>
<div class="bottom-text">已选择n</div> <div class="bottom-text">已选择{{selectNameList.length}}</div>
</div> </div>
</div> </div>
</template> </template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 15:23:58 * @Date: 2022-12-19 15:23:58
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
ref="multipleTable" ref="multipleTable"
> >
<el-table-column type="selection"></el-table-column> <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>
<el-table-column <el-table-column
label="手机号" label="手机号"
align="center" align="center"
prop="deptName" prop="phone"
:formatter="formatter" :formatter="formatter"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="所属单位" label="所属单位"
align="center" align="center"
prop="profession" prop="contractorName"
:formatter="formatter" :formatter="formatter"
> >
</el-table-column> </el-table-column>
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<script> <script>
import { listStaff } from "@/api/safetyManagement/staff"; import { listStaff } from "@/api/safetyManagement/staff";
import { listContractorPerson } from "@/api/contractor/contractorPerson";
export default { export default {
name: "", name: "",
props: { props: {
...@@ -64,8 +65,8 @@ export default { ...@@ -64,8 +65,8 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
deptId: null, contractorId: null,
staffName: null, name: null,
}, },
total: 0, total: 0,
nameList: [], nameList: [],
...@@ -75,12 +76,13 @@ export default { ...@@ -75,12 +76,13 @@ export default {
methods: { methods: {
listStaff() { listStaff() {
this.loading = true; this.loading = true;
listStaff(this.queryParams).then((res) => { listContractorPerson(this.queryParams).then((res) => {
console.log('res',res)
this.total = res.total; this.total = res.total;
this.nameList = res.rows; this.nameList = res.rows;
this.$nextTick((item) => { this.$nextTick((item) => {
this.selectNameList.forEach((item) => { this.selectNameList.forEach((item) => {
this.toggleSelection(item.staffId, true); this.toggleSelection(item.id, true);
}); });
this.loading = false; this.loading = false;
}); });
...@@ -110,9 +112,9 @@ export default { ...@@ -110,9 +112,9 @@ export default {
this.$emit("selectAll", this.nameList, allSelect); this.$emit("selectAll", this.nameList, allSelect);
}, },
// 切换选项 // 切换选项
toggleSelection(staffId, SeclctFlag = false) { toggleSelection(id, SeclctFlag = false) {
const item = this.nameList.find((item) => { const item = this.nameList.find((item) => {
return item.staffId == staffId; return item.id == id;
}); });
this.$refs.multipleTable.toggleRowSelection(item, SeclctFlag); this.$refs.multipleTable.toggleRowSelection(item, SeclctFlag);
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55 * @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="changePeople-left"> <div class="changePeople-left">
<div class="top-search flex"> <div class="top-search flex">
<el-select <el-select
v-model="deptId" v-model="id"
filterable filterable
placeholder="请选择" placeholder="请选择"
size="mini" size="mini"
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
> >
<el-option <el-option
v-for="item in searchList" v-for="item in searchList"
:key="item.deptId" :key="item.id"
:label="item.deptName" :label="item.contractorName"
:value="item.deptId" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-input <el-input
v-model="staffName" v-model="name"
size="mini" size="mini"
placeholder="请输入姓名" placeholder="请输入姓名"
suffix-icon="el-icon-date" suffix-icon="el-icon-date"
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
<div <div
class="item flex" class="item flex"
v-for="item in selectNameList" v-for="item in selectNameList"
:key="item.staffId" :key="item.id"
> >
<div>{{ item.staffName }}</div> <div>{{ item.name }}</div>
<div class="close" @click="deleteName(item.staffId)">x</div> <div class="close" @click="deleteName(item.id)">x</div>
</div> </div>
</div> </div>
<div class="bottom-text">已选择n人</div> <div class="bottom-text">已选择n人</div>
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<script> <script>
import ChangPapelTable from "./ChangPapelTable"; import ChangPapelTable from "./ChangPapelTable";
import { listDept } from "@/api/system/dept"; import { listDept } from "@/api/system/dept";
import { listAll } from "@/api/contractor/contractorInfo";
export default { export default {
name: "PeopleGuestChange", name: "PeopleGuestChange",
...@@ -88,13 +89,15 @@ export default { ...@@ -88,13 +89,15 @@ export default {
return { return {
selectNameList: [], selectNameList: [],
searchList: [], searchList: [],
deptId: null, // 这个id是访客跟承包商的id。也叫id
staffName: null, id: null,
name: null,
}; };
}, },
created() { created() {
listDept().then((res) => { listAll().then((res) => {
console.log(res); console.log(res);
// return;
this.searchList = res.data; this.searchList = res.data;
}); });
}, },
...@@ -108,8 +111,8 @@ export default { ...@@ -108,8 +111,8 @@ export default {
if (Array.isArray(this.selectNameList)) { if (Array.isArray(this.selectNameList)) {
json = this.selectNameList.map((item) => { json = this.selectNameList.map((item) => {
return { return {
peoPleId: item.staffId, peoPleId: item.id,
peoPleName: item.staffName, peoPleName: item.name,
}; };
}); });
} else { } else {
...@@ -124,8 +127,8 @@ export default { ...@@ -124,8 +127,8 @@ export default {
if (jsonSelectNameList) { if (jsonSelectNameList) {
this.selectNameList = JSON.parse(jsonSelectNameList).map((item) => { this.selectNameList = JSON.parse(jsonSelectNameList).map((item) => {
return { return {
staffId: item.peoPleId, id: item.peoPleId,
staffName: item.peoPleName, name: item.peoPleName,
}; };
}); });
} else { } else {
...@@ -137,25 +140,25 @@ export default { ...@@ -137,25 +140,25 @@ export default {
this.$refs.table.queryParams = { this.$refs.table.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
deptId: this.deptId, contractorId: this.id,
staffName: this.staffName, name: this.name,
}; };
this.$refs.table.listStaff(); this.$refs.table.listStaff();
}, },
deleteName(staffId) { deleteName(id) {
const index = this.selectNameList.findIndex((item) => { const index = this.selectNameList.findIndex((item) => {
return item.staffId == staffId; return item.id == id;
}); });
if (index >= 0) { if (index >= 0) {
console.log(index); console.log(index);
this.selectNameList.splice(index, 1); this.selectNameList.splice(index, 1);
this.$refs.table.toggleSelection(staffId); this.$refs.table.toggleSelection(id);
} }
}, },
addName(row) { addName(row) {
const index = this.selectNameList.findIndex((item) => { const index = this.selectNameList.findIndex((item) => {
// console.log(item.id) // console.log(item.id)
return item.staffId == row.staffId; return item.id == row.id;
}); });
console.log(index); console.log(index);
if (index >= 0) { if (index >= 0) {
...@@ -170,7 +173,7 @@ export default { ...@@ -170,7 +173,7 @@ export default {
if (allSelect) { if (allSelect) {
all.forEach((item) => { all.forEach((item) => {
const index = this.selectNameList.findIndex((iten) => { const index = this.selectNameList.findIndex((iten) => {
return iten.staffId == item.staffId; return iten.id == item.id;
}); });
if (index < 0) { if (index < 0) {
this.selectNameList.push(item); this.selectNameList.push(item);
...@@ -178,7 +181,7 @@ export default { ...@@ -178,7 +181,7 @@ export default {
}); });
} else { } else {
all.forEach((item) => { all.forEach((item) => {
this.deleteName(item.staffId); this.deleteName(item.id);
}); });
} }
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49 * @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -145,6 +145,10 @@ export default { ...@@ -145,6 +145,10 @@ export default {
}, },
// 隐藏与显示dialog // 隐藏与显示dialog
dialogCancel() { dialogCancel() {
// 录入考题的时候不会有修改的缓存
if (this.topicId) {
this.topicId = null;
}
this.$emit("update:visible", false); this.$emit("update:visible", false);
}, },
// 把ID改变了 // 把ID改变了
......
...@@ -123,7 +123,12 @@ ...@@ -123,7 +123,12 @@
// getQuestion, // getQuestion,
// getLessonById, // getLessonById,
// } from "@/api/educationPlanExam/lessonsProgram.js"; // } 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 { export default {
name: "AnswerLesson", name: "AnswerLesson",
...@@ -158,7 +163,7 @@ export default { ...@@ -158,7 +163,7 @@ export default {
// 如果存在就是修改 // 如果存在就是修改
if (this.subjectId) { if (this.subjectId) {
getSubject(this.subjectId).then((res) => { getSubject(this.subjectId).then((res) => {
console.log('?',res.data); console.log("?", res.data);
const data = res.data; const data = res.data;
this.form = { this.form = {
topicTitle: data.topicTitle, topicTitle: data.topicTitle,
...@@ -176,12 +181,12 @@ export default { ...@@ -176,12 +181,12 @@ export default {
methods: { methods: {
getQuestion() { getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => { listSubject({ bankId: this.bankId }).then((res) => {
console.log(res) console.log(res);
// 如果是修改 就是原来的值,如果不是,就是总数+1 // 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.subjectId) { if (this.subjectId) {
res.rows.forEach((item, index) => { res.rows.forEach((item, index) => {
if (item.subjectId == this.subjectId) { if (item.subjectId == this.subjectId) {
this.questionNextNum = index+1; this.questionNextNum = index + 1;
} }
}); });
} else { } else {
...@@ -243,7 +248,7 @@ export default { ...@@ -243,7 +248,7 @@ export default {
// 把修改的这个归位,变成正常添加 // 把修改的这个归位,变成正常添加
this.$emit("update:subjectId", null); this.$emit("update:subjectId", null);
this.$message({ this.$message({
message: "添加题目成功", message: this.subjectId ? "添加题目成功" : "修改题目成功",
type: "success", type: "success",
}); });
this.$parent.$parent.componentsNumChange(num); this.$parent.$parent.componentsNumChange(num);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49 * @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -145,6 +145,10 @@ export default { ...@@ -145,6 +145,10 @@ export default {
}, },
// 隐藏与显示dialog // 隐藏与显示dialog
dialogCancel() { dialogCancel() {
// 录入题目的时候不会有修改的缓存
if (this.subjectId) {
this.subjectId = null;
}
this.$emit("update:visible", false); this.$emit("update:visible", false);
}, },
// 把ID改变了 // 把ID改变了
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05 * @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
icon="el-icon-upload2" icon="el-icon-upload2"
size="mini" size="mini"
@click="handleImport" @click="handleImport"
>导入</el-button> >导入</el-button
>
</el-col> </el-col>
</el-row> </el-row>
...@@ -89,13 +90,24 @@ ...@@ -89,13 +90,24 @@
</div> --> </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 <el-upload
ref="upload" ref="upload"
:limit="1" :limit="1"
accept=".xlsx, .xls" accept=".xlsx, .xls"
:headers="upload.headers" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport+ '&bankId=' + upload.bankId" :action="
upload.url +
'?updateSupport=' +
upload.updateSupport +
'&bankId=' +
upload.bankId
"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
...@@ -108,17 +120,19 @@ ...@@ -108,17 +120,19 @@
<em>点击上传</em> <em>点击上传</em>
</div> </div>
<div class="el-upload__tip" slot="tip"> <div class="el-upload__tip" slot="tip">
<!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的设备数据--> <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的设备数据-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>--> <!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleDownload(upload)" @click="handleDownload(upload)"
>下载模板</el-button> >下载模板</el-button
>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入“xls”或“xlsx”格式文件!
</div> </div>
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button> <el-button type="primary" @click="submitFileForm">确 定</el-button>
...@@ -160,7 +174,7 @@ export default { ...@@ -160,7 +174,7 @@ export default {
// 设备导入参数 // 设备导入参数
upload: { upload: {
//题库id //题库id
bankId:0, bankId: 0,
// 是否显示弹出层(用户导入) // 是否显示弹出层(用户导入)
open: false, open: false,
// 弹出层标题(用户导入) // 弹出层标题(用户导入)
...@@ -172,7 +186,7 @@ export default { ...@@ -172,7 +186,7 @@ export default {
// 设置上传的请求头部 // 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() }, 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: { queryParams: {
bankId:0 bankId:0
...@@ -209,7 +223,7 @@ export default { ...@@ -209,7 +223,7 @@ export default {
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.bankId=this.bankId; this.upload.bankId = this.bankId;
this.upload.title = "题目导入"; this.upload.title = "题目导入";
this.upload.open = true; this.upload.open = true;
}, },
...@@ -223,10 +237,12 @@ export default { ...@@ -223,10 +237,12 @@ export default {
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true }); this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getQuestion({ bankId: this.bankId }); this.getQuestion({ bankId: this.bankId });
// this.getList();
this.$parent.$parent.$parent.getList();
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
importTemplate().then(response => { importTemplate().then((response) => {
this.download(response.msg); this.download(response.msg);
}); });
}, },
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
ref="queryForm" ref="queryForm"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
> >
<!-- <el-form-item label="课件类别" prop="courseType"> <!-- <el-form-item label="课件类别" prop="courseType">
<el-select <el-select
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
</el-form-item> --> </el-form-item> -->
<el-form-item <el-form-item
label="考试名称" label="所属单位"
prop="deptId" prop="deptId"
ref="treeItem" ref="treeItem"
> >
......
...@@ -116,14 +116,13 @@ ...@@ -116,14 +116,13 @@
</template> </template>
<script> <script>
// import { import {
// addQuestion, addQuestion,
// checkQuestion, checkQuestion,
// changeQuestion, changeQuestion,
// getQuestion, getQuestion,
// getLessonById, getLessonById,
// } from "@/api/educationPlanExam/lessonsProgram.js"; } from "@/api/educationPlanExam/lessonsProgram.js";
import { addSubject ,getSubject,listSubject,updateSubject} from "@/api/educationPlanExam/subject";
export default { export default {
name: "AnswerLesson", name: "AnswerLesson",
...@@ -132,10 +131,10 @@ export default { ...@@ -132,10 +131,10 @@ export default {
// type: Boolean, // type: Boolean,
// default: false, // default: false,
// }, // },
bankId: { courseId: {
type: Number, type: Number,
}, },
subjectId: { topicId: {
type: Number, type: Number,
}, },
}, },
...@@ -156,9 +155,9 @@ export default { ...@@ -156,9 +155,9 @@ export default {
created() { created() {
// 如果存在就是修改 // 如果存在就是修改
if (this.subjectId) { if (this.topicId) {
getSubject(this.subjectId).then((res) => { checkQuestion(this.topicId).then((res) => {
console.log('?',res.data); console.log(res.data);
const data = res.data; const data = res.data;
this.form = { this.form = {
topicTitle: data.topicTitle, topicTitle: data.topicTitle,
...@@ -171,16 +170,16 @@ export default { ...@@ -171,16 +170,16 @@ export default {
// 查询是第几道题 // 查询是第几道题
this.getQuestion(); this.getQuestion();
// 获取课程标题 // 获取课程标题
// this.getLessonById(this.bankId); this.getLessonById(this.courseId);
}, },
methods: { methods: {
getQuestion() { getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => { getQuestion({ courseId: this.courseId }).then((res) => {
console.log(res)
// 如果是修改 就是原来的值,如果不是,就是总数+1 // 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.subjectId) { console.log(res)
if (this.topicId) {
res.rows.forEach((item, index) => { res.rows.forEach((item, index) => {
if (item.subjectId == this.subjectId) { if (item.topicId == this.topicId) {
this.questionNextNum = index+1; this.questionNextNum = index+1;
} }
}); });
...@@ -189,18 +188,18 @@ export default { ...@@ -189,18 +188,18 @@ export default {
} }
}); });
}, },
// getLessonById(bankId) { getLessonById(courseId) {
// getLessonById(bankId).then((res) => { getLessonById(courseId).then((res) => {
// console.log(res); console.log(res);
// this.courseName = res.data.courseName; this.courseName = res.data.courseName;
// }); });
// }, },
addQuestion(data) { addQuestion(data) {
// 如果是修改,就用修改的方法,如果是新增,就用新增的方法 // 如果是修改,就用修改的方法,如果是新增,就用新增的方法
if (this.subjectId) { if (this.topicId) {
return updateSubject({ subjectId: this.subjectId, ...data }); return changeQuestion({ topicId: this.topicId, ...data });
} else { } else {
return addSubject({ bankId: this.bankId, ...data }); return addQuestion({ courseId: this.courseId, ...data });
} }
}, },
rightAnswerClick(index) { rightAnswerClick(index) {
...@@ -241,7 +240,7 @@ export default { ...@@ -241,7 +240,7 @@ export default {
this.addQuestion(data).then((res) => { this.addQuestion(data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// 把修改的这个归位,变成正常添加 // 把修改的这个归位,变成正常添加
this.$emit("update:subjectId", null); this.$emit("update:topicId", null);
this.$message({ this.$message({
message: "添加题目成功", message: "添加题目成功",
type: "success", 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 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49 * @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<component <component
:is="currentComponent" :is="currentComponent"
:bankId.sync="bankId" :courseId.sync="courseId"
:subjectId.sync="subjectId" :topicId.sync="topicId"
ref="current" ref="current"
></component> ></component>
</transition> </transition>
...@@ -33,6 +33,13 @@ ...@@ -33,6 +33,13 @@
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button
type="primary"
v-if="this.componentsNum == 2"
@click="componentsNumChange(4)"
>从题库选择</el-button
>
<el-button <el-button
type="primary" type="primary"
v-if="this.componentsNum == 1 || this.componentsNum == 3" v-if="this.componentsNum == 1 || this.componentsNum == 3"
...@@ -58,6 +65,7 @@ ...@@ -58,6 +65,7 @@
import Lesson from "./Lesson"; import Lesson from "./Lesson";
import AddQuestion from "./AddQuestion"; import AddQuestion from "./AddQuestion";
import QuestionList from "./QuestionList"; import QuestionList from "./QuestionList";
import ChangeQuestion from "./ChangeQuestion";
export default { export default {
name: "AnswerLesson", name: "AnswerLesson",
...@@ -70,7 +78,7 @@ export default { ...@@ -70,7 +78,7 @@ export default {
type: Number, type: Number,
default: 1, default: 1,
}, },
bankId: { courseId: {
type: Number, type: Number,
}, },
}, },
...@@ -85,7 +93,7 @@ export default { ...@@ -85,7 +93,7 @@ export default {
title: "录入课程", title: "录入课程",
currentComponent: Lesson, currentComponent: Lesson,
// 当前题目查看 // 当前题目查看
subjectId: null, topicId: null,
}; };
}, },
watch: { watch: {
...@@ -93,7 +101,7 @@ export default { ...@@ -93,7 +101,7 @@ export default {
handler(num) { handler(num) {
if (num === 1) { if (num === 1) {
this.currentComponent = Lesson; this.currentComponent = Lesson;
if (this.bankId) { if (this.courseId) {
this.title = "修改课程"; this.title = "修改课程";
} else { } else {
this.title = "新增课程"; this.title = "新增课程";
...@@ -102,13 +110,16 @@ export default { ...@@ -102,13 +110,16 @@ export default {
this.currentComponent = QuestionList; this.currentComponent = QuestionList;
this.title = "题目列表"; this.title = "题目列表";
} else { } else if (num === 3) {
this.currentComponent = AddQuestion; this.currentComponent = AddQuestion;
if (this.subjectId) { if (this.topicId) {
this.title = "修改题目"; this.title = "修改题目";
} else { } else {
this.title = "新增题目"; this.title = "新增题目";
} }
} else if (num == 4) {
this.currentComponent = ChangeQuestion;
this.title = "从题库选题";
} }
}, },
deep: true, deep: true,
...@@ -121,8 +132,10 @@ export default { ...@@ -121,8 +132,10 @@ export default {
text = "保存并录入题目"; text = "保存并录入题目";
} else if (this.componentsNum == 2) { } else if (this.componentsNum == 2) {
text = "录入考题"; text = "录入考题";
} else { } else if (this.componentsNum == 3) {
text = "保存并录入下一题"; text = "保存并录入下一题";
} else {
text = "确定选择";
} }
return text; return text;
}, },
...@@ -145,11 +158,15 @@ export default { ...@@ -145,11 +158,15 @@ export default {
}, },
// 隐藏与显示dialog // 隐藏与显示dialog
dialogCancel() { dialogCancel() {
// 录入考题的时候不会有修改的缓存
if (this.topicId) {
this.topicId = null;
}
this.$emit("update:visible", false); this.$emit("update:visible", false);
}, },
// 把ID改变了 // 把ID改变了
changeCourseId(bankId) { changeCourseId(courseId) {
this.$emit("update:bankId", bankId); this.$emit("update:courseId", courseId);
}, },
// 改变当前组件 // 改变当前组件
componentsNumChange(num) { componentsNumChange(num) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44 * @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -15,122 +15,89 @@ ...@@ -15,122 +15,89 @@
label-width="auto" label-width="auto"
:rules="rules" :rules="rules"
> >
<el-form-item label="题库名称" prop="bankName"> <el-form-item label="考试标题" prop="courseName">
<el-input style="width: 500px" v-model="form.bankName"></el-input> <el-input style="width: 700px" v-model="form.courseName"></el-input>
</el-form-item> </el-form-item>
<div class="top flex"> <div class="top flex">
<el-form-item label="开始时间" prop="releaseTime"> <el-form-item label="开始时间" prop="testStartTime">
<el-date-picker <el-date-picker
style="width: 220px; margin-right: 44px" style="margin-right: 50px"
v-model="form.startTime" v-model="form.testStartTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="开始时间" placeholder="选择日期时间"
default-time="12:00:00" default-time="00:00:00"
> />
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="结束时间" prop="releaseTime"> <el-form-item label="结束时间" prop="testEndTime">
<el-date-picker <el-date-picker
v-model="form.endTime" v-model="form.testEndTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="结束时间" placeholder="选择日期时间"
default-time="12:00:00" default-time="00:00:00"
> />
</el-date-picker>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item label="考试范围" prop="releaseTime"> <el-form-item label="选择人员" prop="testPersons">
<el-radio-group v-model="form.personelType"> <ChangePapel
<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
ref="changePaple" ref="changePaple"
:jsonSelectNameList="jsonSelectNameList" :jsonSelectNameList="jsonSelectNameList"
@getPeopleList="getPeopleList" @getPeopleList="getPeopleList"
/> />
</el-form-item> </el-form-item>
<!-- </div> -->
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
// 内部
import ChangePapel from "@/components/PeopleChange"; 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 { mapGetters } from "vuex";
// import {
// addLessons,
// getLessonById,
// changeLesson,
// } from "@/api/educationPlanExam/lessonsProgram";
import { import {
listBank, addLessons,
addBank, getLessonById,
updateBank, changeLesson,
getBank, } from "@/api/educationPlanExam/lessonsProgram";
} 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 { export default {
name: "", name: "",
props: { props: {
bankId: { courseId: {
type: Number, 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: { components: {
// Editor,
// FileUpload,
ChangePapel, ChangePapel,
PeopleGuestChange
}, },
data() { data() {
return { return {
form: { form: {
bankName: "", courseName: "",
// courseType: "", testStartTime: "",
// courseConent: "", testEndTime: "",
// video: "", testPersons: "",
// enclosure: "",
deptId: null,
abc: 0,
personelType: 1,
}, },
// 参考人员 jsonSelectNameList: null,
// jsonSelectNameList: null, // '[{"peoPleId":880,"peoPleName":"孙卓亚"},{"peoPleId":871,"peoPleName":"张玉宾"}]',
jsonSelectNameList: '[{"peoPleId":880,"peoPleName":"孙卓亚"},{"peoPleId":871,"peoPleName":"张玉宾"}]',
// 考试范围
// 归属部门列表
deptOptions: [],
fileListVideo: [], fileListVideo: [],
fileListFile: [], fileListFile: [],
readOnly: false, readOnly: false,
// selectNameList: [],
rules: { rules: {
bankName: [ courseName: [
{ required: true, trigger: "blur", message: "课程名称不能为空" }, { required: true, trigger: "blur", message: "课程名称不能为空" },
], ],
deptId: [ testStartTime: [
{ required: true, trigger: "blur", message: "请选择所属部门" }, { required: true, trigger: "blur", message: "考试开始时间不能为空" },
],
testEndTime: [
{ required: true, trigger: "blur", message: "课程名称不能为空" },
], ],
}, },
}; };
...@@ -140,67 +107,76 @@ export default { ...@@ -140,67 +107,76 @@ export default {
// ...mapGetters(["courseOptions"]), // ...mapGetters(["courseOptions"]),
}, },
created() { created() {
if (this.bankId) { if (this.courseId) {
this.getLessonById(); this.getLessonById();
} }
// 归属部门列表
// this.getTreeselect();
}, },
mounted() { 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); this.$refs.changePaple.changeNameList(this.jsonSelectNameList);
}, },
methods: { methods: {
// 添加课程 // 添加课程
addLessons(data) { addLessons(data) {
if (!this.bankId) { console.log("this.courseId", this.courseId);
if (!this.courseId) {
console.log("添加"); console.log("添加");
return addBank(data); return addLessons({ dataKind: 1, ...data });
} else { } else {
console.log("修改"); 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() { getLessonById() {
getBank(this.bankId).then((res) => { getLessonById(this.courseId).then((res) => {
console.log("res", res);
if (res.code == 200) { if (res.code == 200) {
const data = res.data;
const { courseName, testStartTime, testEndTime, testPersons } = data;
this.form = { this.form = {
bankName: res.data.bankName, courseName,
deptId: res.data.deptId, testStartTime,
testEndTime,
testPersons,
}; };
// const data = res.data; this.jsonSelectNameList = testPersons;
// const { bankName, courseType, courseConent, video, enclosure } = this.$refs.changePaple.changeNameList(this.jsonSelectNameList);
// data;
// this.form = {
// bankName,
// courseType,
// courseConent,
// video,
// enclosure,
// };
// this.fileListVideo = [
// {
// name: bankName + "视频",
// url: uploadfile,
// },
// ];
// this.fileListFile = [
// {
// name: bankName + "附件",
// url: uploadfile,
// },
// ];
} }
}); });
}, },
// 获取参考人员的list getFileInfoVideo(res) {
getPeopleList(list) { this.form.video = res.url;
console.log("参考人员", list); // 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) { save(num = 2) {
// 因为富文本编辑器会残留<p><br></p>,所以要清 // 因为富文本编辑器会残留<p><br></p>,所以要清
...@@ -209,41 +185,30 @@ export default { ...@@ -209,41 +185,30 @@ export default {
// } // }
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
// console.log(this.form);
this.addLessons({ ...this.form }).then((res) => { this.addLessons({ ...this.form }).then((res) => {
// 如果添加会传回来,就用传回来的,如果是修改本身就有,就用本身的 // 如果添加会传回来,就用传回来的,如果是修改本身就有,就用本身的
// console.log('res',res) const courseId = res.data || this.courseId;
const bankId = this.bankId || res; if (res.code == 200) {
// if (res.code == 200) {
// 这样调比较纯函数一点 // 这样调比较纯函数一点
if (num == 2) { if (num == 2) {
this.$message({ this.$message({
message: "保存题库成功", message: "保存课程成功",
type: "success", type: "success",
}); });
} else if (num == 3) { } else if (num == 3) {
this.$message({ this.$message({
message: "保存题库成功,请开始录入题目", message: "保存课程成功,请开始录入题目",
type: "success", type: "success",
}); });
} }
this.$parent.$parent.componentsNumChange(num); this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(bankId); this.$parent.$parent.changeCourseId(courseId);
this.$parent.$parent.$parent.getList(); this.$parent.$parent.$parent.getList();
return true; 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 { ...@@ -258,10 +223,11 @@ export default {
.form-wrapper { .form-wrapper {
padding-top: 22px; padding-top: 22px;
width: 100%; width: 100%;
height: 600px; height: 550px;
// overflow: hidden; overflow: hidden;
// padding-bottom: 10px; // padding-bottom: 10px;
margin-bottom: 20px; margin-bottom: 20px;
// border-bottom: 1px solid #bbbbbb; // border-bottom: 1px solid #bbbbbb;
.top { .top {
width: 100%; width: 100%;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com * @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05 * @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com * @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 * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
<div ref="myBody" class="add-question flex"> <div ref="myBody" class="add-question flex">
<div class="text flex"> <div class="text flex">
<div class="left"> <div class="left">
目前有<span>{{ questionNum || 0 }}</span 目前有<span>{{ questionNum }}</span
>道题 >道题
<!-- <span class="warn">温馨提示:发布课程前需要进行考试设置</span> --> <span class="warn">温馨提示:发布课程前需要进行考试设置</span>
</div> </div>
<div class="right">{{ courseName }}</div> <div class="right">{{ courseName }}</div>
</div> </div>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<div class="td-wrapper"> <div class="td-wrapper">
<div <div
v-for="(item, index) in questionList" v-for="(item, index) in questionList"
:key="item.subjectId" :key="item.topicId"
class="td flex" class="td flex"
> >
<div class="left">{{ index + 1 }}</div> <div class="left">{{ index + 1 }}</div>
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
<div class="right"> <div class="right">
<div> <div>
<el-button <el-button
@click="edit(item.subjectId)" @click="edit(item.topicId)"
icon="el-icon-edit" icon="el-icon-edit"
type="text" type="text"
>修改</el-button >修改</el-button
> >
<el-button <el-button
@click="deleteLesson(item.subjectId)" @click="deleteLesson(item.topicId)"
icon="el-icon-delete" icon="el-icon-delete"
type="text" type="text"
>删除</el-button >删除</el-button
...@@ -51,9 +51,8 @@ ...@@ -51,9 +51,8 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="rightNum flex"> <div class="rightNum flex">
<div class="left">考试设置</div>
<div class="left">录入考题</div>
<div class="middle flex"> <div class="middle flex">
<div class="left-text">答对题目大于</div> <div class="left-text">答对题目大于</div>
<div> <div>
...@@ -74,7 +73,7 @@ ...@@ -74,7 +73,7 @@
>保存</el-button >保存</el-button
> >
</div> </div>
</div> --> </div>
</div> </div>
</template> </template>
...@@ -85,13 +84,10 @@ import { ...@@ -85,13 +84,10 @@ import {
changeLesson, changeLesson,
getLessonById, getLessonById,
} from "@/api/educationPlanExam/lessonsProgram"; } from "@/api/educationPlanExam/lessonsProgram";
import { listSubject, delSubject } from "@/api/educationPlanExam/subject";
import { getBank } from "@/api/educationPlanExam/questionBank";
export default { export default {
name: "AnswerLesson", name: "AnswerLesson",
props: { props: {
bankId: { courseId: {
type: Number, type: Number,
}, },
}, },
...@@ -118,11 +114,11 @@ export default { ...@@ -118,11 +114,11 @@ export default {
// }, // },
created() { created() {
console.log("this.bankId", this.bankId); console.log("this.courseId", this.courseId);
if (this.bankId) { if (this.courseId) {
this.getQuestion({ bankId: this.bankId }); this.getQuestion({ courseId: this.courseId });
// 获取只题目正确几题算过关 // 获取只题目正确几题算过关
this.getLessonById(this.bankId); this.getLessonById(this.courseId);
} }
}, },
methods: { methods: {
...@@ -132,14 +128,13 @@ export default { ...@@ -132,14 +128,13 @@ export default {
saveAndNext() { saveAndNext() {
this.$parent.$parent.componentsNumChange(3); this.$parent.$parent.componentsNumChange(3);
}, },
getQuestion(bankId) { getQuestion(courseId) {
console.log(bankId); return getQuestion(courseId).then((res) => {
return listSubject(bankId).then((res) => { console.log(res);
console.log("题库res", res);
this.questionList = res.rows.map((item) => { this.questionList = res.rows.map((item) => {
return { return {
subjectId: item.subjectId, topicId: item.topicId,
topicTitle: item.topicTitle, topicTitle: item.topicTitle,
}; };
}); });
...@@ -147,18 +142,18 @@ export default { ...@@ -147,18 +142,18 @@ export default {
return true; return true;
}); });
}, },
getLessonById(bankId) { getLessonById(courseId) {
getBank(bankId).then((res) => { getLessonById(courseId).then((res) => {
// console.log(res); console.log(res);
// this.rightNum = res.data.qualifiedNum; this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.bankName; this.courseName = res.data.courseName;
}); });
}, },
edit(subjectId) { edit(topicId) {
this.$emit("update:subjectId", subjectId); this.$emit("update:topicId", topicId);
this.$parent.$parent.componentsNumChange(3); this.$parent.$parent.componentsNumChange(3);
}, },
deleteLesson(subjectId) { deleteLesson(topicId) {
this.$confirm("请确定删除该题", { this.$confirm("请确定删除该题", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
...@@ -166,7 +161,7 @@ export default { ...@@ -166,7 +161,7 @@ export default {
}) })
.then(() => { .then(() => {
this.loading = true; this.loading = true;
return delSubject(subjectId); return deleteQuestion(topicId);
}) })
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -175,7 +170,7 @@ export default { ...@@ -175,7 +170,7 @@ export default {
type: "success", type: "success",
}); });
} }
return this.getQuestion({ bankId: this.bankId }); return this.getQuestion({ courseId: this.courseId });
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
...@@ -192,7 +187,7 @@ export default { ...@@ -192,7 +187,7 @@ export default {
return; return;
} }
changeLesson({ changeLesson({
bankId: this.bankId, courseId: this.courseId,
qualifiedNum: this.rightNum, qualifiedNum: this.rightNum,
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -200,6 +195,7 @@ export default { ...@@ -200,6 +195,7 @@ export default {
message: "答题合格数修改成功", message: "答题合格数修改成功",
type: "success", type: "success",
}); });
this.$parent.$parent.$parent.getList();
} }
}); });
}, },
......
...@@ -4,26 +4,9 @@ ...@@ -4,26 +4,9 @@
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
:inline="true" :inline="true"
label-width="68px" label-width="100px"
>
<!-- <el-form-item label="课件类别" prop="courseType">
<el-select
v-model="queryParams.courseType"
placeholder="请选择课程类型"
clearable
size="small"
> >
<el-option <el-form-item label="考试名称" prop="courseType">
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-input <el-input
v-model="queryParams.courseName" v-model="queryParams.courseName"
placeholder="请输入课程名称" placeholder="请输入课程名称"
...@@ -31,26 +14,24 @@ ...@@ -31,26 +14,24 @@
size="small" size="small"
/> />
</el-form-item> </el-form-item>
<el-form-item label="考试时间" prop="releaseTime"> <el-form-item label="考试开始时间" prop="startTime">
<el-date-picker <el-date-picker
v-model="queryParams.releaseTime" v-model="queryParams.startTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="选择日期时间" placeholder="选择日期时间"
default-time="12:00:00" default-time="12:00:00"
> />
</el-date-picker>
</el-form-item> </el-form-item>
<!-- <el-form-item label="发布时间" prop="releaseTime"> <el-form-item label="考试结束时间" prop="endTime">
<el-date-picker <el-date-picker
v-model="queryParams.releaseTime" v-model="queryParams.endTime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" type="datetime"
placeholder="选择日期时间" placeholder="选择日期时间"
default-time="12:00:00" default-time="12:00:00"
> />
</el-date-picker> </el-form-item>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button <el-button
...@@ -80,110 +61,83 @@ ...@@ -80,110 +61,83 @@
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="bankList"> <el-table v-loading="loading" :data="lessonsList">
<el-table-column label="序号" width='100' align="center" prop="bankNum"/> <el-table-column
<el-table-column label="考试名称" align="center" prop="bankName"> label="序号"
</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="所属单位"
align="center" align="center"
prop="courseType" prop="courseNum"
> width="55"
<template v-slot="scope"> />
<div> <el-table-column label="课程标题" align="center" prop="courseName" />
{{ 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>
<el-table-column <el-table-column
label="发布时间" label="开始时间"
align="center" align="center"
prop="releaseTime" prop="testStartTime"
:formatter="formatter" :formatter="formatter"
/> --> />
<!-- <el-table-column <el-table-column
label="考试题数量" label="结束时间"
align="center"
prop="testEndTime"
:formatter="formatter"
/>
<el-table-column
label="考试题"
align="center" align="center"
prop="topicNum" prop="topicNum"
width="180" width="180"
> >
<template v-slot="{ row: { topicNum, bankId } }"> <template v-slot="{ row: { topicNum, courseId } }">
<div @click="checkQuestion(bankId)" class="timuNum"> <div @click="checkQuestion(courseId)" class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div> <div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<div v-else>未录入</div> <div v-else>未录入</div>
</div> </div>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column
label="答对几题算合格"
align="center"
prop="qualifiedNum"
:formatter="formatter"
/>
<el-table-column <el-table-column
label="操作" label="操作"
align="center" align="center"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
> >
<template v-slot="{ row: { bankId } }"> <template v-slot="{ row: { status, courseId } }">
<!-- <div>{{status}}</div> --> <!-- <div>{{status}}</div> -->
<el-button <el-button
v-if="status == 0"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-document-add" icon="el-icon-edit"
@click="changeBank(bankId)" @click="checkQuestion(courseId)"
>录入考题</el-button >录入考题</el-button
> >
<el-button <el-button
size="mini" v-if="status == 0"
type="text"
icon="el-icon-delete"
@click="deletBank(bankId)"
>删除</el-button
>
<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="changeBank(bankId)" @click="changeLesson(courseId)"
>编辑</el-button >编辑</el-button
> >
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-delete"
@click="changeBank(bankId)" @click="deletLesson(courseId)"
>发布考试</el-button >删除</el-button
> >
<el-button
<!-- <el-button
v-if="status == 0" v-if="status == 0"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="issueLesson(bankId)" @click="issueLesson(courseId)"
>发布</el-button >发布考试</el-button
> --> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -198,37 +152,29 @@ ...@@ -198,37 +152,29 @@
<Dia <Dia
ref="Dia" ref="Dia"
:componentsNum.sync="componentsNum" :componentsNum.sync="componentsNum"
:bankId.sync="bankId" :courseId.sync="courseId"
:visible.sync="dilogFlag" :visible.sync="dilogFlag"
/> />
<el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
// import { import {
// getLessons, getLessons,
// getLessonById, getLessonById,
// issue, issue,
// deleteLesson, deleteLesson,
// } from "@/api/educationPlanExam/lessonsProgram.js"; } from "@/api/educationPlanExam/lessonsProgram.js";
import { listBank,delBank } from "@/api/educationPlanExam/questionBank"; // 获取培训计划
// 部门列表 import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
import { treeselect } from "@/api/system/dept"; import { mapGetters, mapMutations } from "vuex";
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 Dia from "./components/Dia"; import Dia from "./components/Dia";
export default { export default {
name: "textPaper", name: "Book",
components: { components: {
Dia, Dia,
Treeselect
}, },
data() { data() {
return { return {
...@@ -237,15 +183,14 @@ export default { ...@@ -237,15 +183,14 @@ export default {
// 总条数 // 总条数
total: 0, total: 0,
// courseOptions: [], // courseOptions: [],
bankList: [], lessonsList: [],
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// 所属部门 dataKind: 1,
deptId: null, courseType: null,
// 题库名称 courseName: null,
bankName: null,
releaseTime: "", releaseTime: "",
}, },
// 表单参数 // 表单参数
...@@ -255,49 +200,19 @@ export default { ...@@ -255,49 +200,19 @@ export default {
dilogFlag: false, dilogFlag: false,
componentsNum: 1, componentsNum: 1,
// 点击的id,如果是新增为空 // 点击的id,如果是新增为空
bankId: null, courseId: null,
// 题库id
deptId: null,
// 归属部门列表
deptOptions: [],
}; };
}, },
computed: { computed: {
// ...mapGetters(["courseOptions"]), ...mapGetters(["courseOptions"]),
}, },
created() { created() {
// this.getPlanList(); // this.getPlanList();
this.getTreeselect();
this.getList(); this.getList();
}, },
methods: { methods: {
// ...mapMutations({ setOptions: "SET_COURSE_OPTIONS" }), ...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;
}
}
}
}
},
// 获取课程类别,也就是计划名称 // 获取课程类别,也就是计划名称
// getPlanList() { // getPlanList() {
// getPlanList().then((res) => { // getPlanList().then((res) => {
...@@ -315,18 +230,10 @@ export default { ...@@ -315,18 +230,10 @@ export default {
/** 查询课程列表 */ /** 查询课程列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listBank(this.queryParams) getLessons(this.queryParams)
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.bankList = res.rows.map((item, index) => { this.lessonsList = res.rows;
return {
bankNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
...item,
};
});
this.total = res.total; this.total = res.total;
}) })
.finally(() => { .finally(() => {
...@@ -339,23 +246,23 @@ export default { ...@@ -339,23 +246,23 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$refs.Dia.title = "新增题库"; this.$refs.Dia.title = "新增培训课程";
this.componentsNum = 1; this.componentsNum = 1;
this.bankId = null; this.courseId = null;
this.dilogFlag = true; this.dilogFlag = true;
}, },
changeBank(bankId) { changeLesson(courseId) {
this.$refs.Dia.title = "修改题库"; this.$refs.Dia.title = "修改培训课程";
this.componentsNum = 1; this.componentsNum = 1;
this.bankId = bankId; this.courseId = courseId;
this.dilogFlag = true; this.dilogFlag = true;
}, },
// 直接查看考题 // 直接查看考题
checkQuestion(bankId) { checkQuestion(courseId) {
// 要查看考题的id // 要查看考题的id
this.bankId = bankId; this.courseId = courseId;
console.log(this.bankId); console.log(this.courseId);
// 2代表列表组件 // 2代表列表组件
this.componentsNum = 2; this.componentsNum = 2;
this.dilogFlag = true; this.dilogFlag = true;
...@@ -375,14 +282,14 @@ export default { ...@@ -375,14 +282,14 @@ export default {
releaseTime: "", releaseTime: "",
}; };
}, },
deletBank(bankId) { deletLesson(courseId) {
this.$confirm("请确定删除", { this.$confirm("请确定删除", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}) })
.then(() => { .then(() => {
return delBank(bankId); return deleteLesson(courseId);
}) })
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
...@@ -396,121 +303,48 @@ export default { ...@@ -396,121 +303,48 @@ export default {
.catch(() => {}); .catch(() => {});
}, },
// 发布 // 发布
// issueLesson(bankId) { issueLesson(courseId) {
// this.$confirm("请确定发布", { this.$confirm("请确定发布", {
// confirmButtonText: "确定", confirmButtonText: "确定",
// cancelButtonText: "取消", cancelButtonText: "取消",
// type: "warning", type: "warning",
// }) })
// .then(() => { .then(() => {
// // 判断是否录入答题合格数 // 判断是否录入答题合格数
// return getLessonById(bankId); return getLessonById(courseId);
// }) })
// .then((res) => { .then((res) => {
// if (res.data.qualifiedNum > 0) { if (res.data.qualifiedNum > 0) {
// return true; return true;
// } }
// }) })
// .then((res) => { .then((res) => {
// if (res) { if (res) {
// // 成功就发布 // 成功就发布
// return issue({ bankId }); return issue({ courseId });
// } else { } else {
// this.$message({ this.$message({
// message: "请先录入答题合格数", message: "请先录入答题合格数",
// type: "warning", type: "warning",
// }); });
// } }
// }) })
// .then((res) => { .then((res) => {
// if (res.code == 200) { if (res.code == 200) {
// this.$message({ this.$message({
// message: "发布成功", message: "发布成功",
// type: "success", type: "success",
// }); });
// this.getList(); this.getList();
// } }
// }) })
// .catch(() => {}); .catch(() => {});
// }, },
formatter(row, column, cellValue, index) { formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index); // console.log(row, column, cellValue, index);
if (!cellValue) return "-"; if (!cellValue) return "-";
else return cellValue; 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> </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