123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <div class="exam_plan_kj_hz_solfege pg-main">
- <div class="pg-title">
- <span>结果汇总进度(视唱机考)</span>
- </div>
- <div class="pg-select-infos">
- <Form ref="kj_progress_queryform_one" :label-width="80" inline>
- <Row>
- <Col span="8">
- <FormItem label="考试任务" style="width: 100%">
- <Select @on-change="selectExam" v-model="query.examCode">
- <Option value="">全部</Option>
- <Option
- v-for="item in xldata.examCodeList"
- :value="item.examCode"
- :key="item.examCode"
- >{{ item.name }}</Option
- >
- </Select>
- </FormItem>
- </Col>
- <Col span="8">
- <FormItem label="考点" style="width: 100%">
- <Select @on-change="selectPlace" v-model="query.placeCode">
- <Option value="">全部</Option>
- <Option
- v-for="item in xldata.placeCodeList"
- :value="item.value"
- :key="item.value"
- >{{ item.name }}</Option
- >
- </Select>
- </FormItem>
- </Col>
- <Col span="8">
- <FormItem label="考场" style="width: 100%">
- <Select v-model="query.roomCode">
- <Option value="">全部</Option>
- <Option
- v-for="item in xldata.roomCodeList"
- :value="item.value"
- :key="item.value"
- >{{ item.name }}</Option
- >
- </Select>
- </FormItem>
- </Col>
- </Row>
- </Form>
- <Form ref="kj_progress_queryform_two" :label-width="80" inline>
- <FormItem :label-width="20">
- <Row>
- <Col span="5">
- <Button @click="doQuery" type="primary" icon="md-search"
- >查询</Button
- >
- </Col>
- <Col span="6">
- <Upload
- :before-upload="beforeBatchImport"
- action=""
- style="display: inline-block; margin-left: 10px"
- >
- <Button type="primary" icon="md-folder">本地导入</Button>
- </Upload>
- </Col>
- <Col span="8">
- <Button
- style="margin-left: 30px"
- @click="doExport"
- type="primary"
- icon="md-document"
- >OW导出(无答案)</Button
- >
- </Col>
- </Row>
- </FormItem>
- </Form>
- <Row v-for="(item, index) in batchFileList" :key="index">
- <Col span="22">
- <Alert type="success"
- >文件:{{ item.name }}上传进度:
- <Progress :percent="item.percent"></Progress>
- </Alert>
- </Col>
- </Row>
- </div>
- <div class="pg-body">
- <Table
- ref="kj_progress_table"
- :columns="columns"
- :data="list"
- :stripe="true"
- :disabled-hover="true"
- ></Table>
- <Page
- placement="top"
- :current="query.pageNo"
- :loading="true"
- :page-size="query.pageSize"
- :total="query.totalElements"
- show-total
- show-sizer
- @on-change="changePageNo"
- @on-page-size-change="changePageSize"
- ></Page>
- </div>
- </div>
- </template>
- <script>
- import { axios, baseUrl } from "../../libs/http";
- export default {
- name: "exam_plan_kj_hz_solfege",
- data() {
- return {
- formats: ["zip"],
- batchFileList: [],
- xldata: {
- examCodeList: [],
- placeCodeList: [],
- roomCodeList: [],
- },
- query: {
- pageNo: 1,
- pageSize: 10,
- totalElements: 0,
- totalPages: 0,
- examCode: "",
- placeCode: "",
- roomCode: "",
- },
- list: [],
- columns: [
- {
- type: "index_seq",
- title: "序号",
- align: "center",
- width: 80,
- render: (h, params) => {
- return h(
- "span",
- (this.query.pageNo - 1) * this.query.pageSize + params.index + 1
- );
- },
- },
- {
- title: "考点",
- key: "placeName",
- minWidth: 180,
- align: "center",
- },
- {
- title: "考场",
- key: "roomName",
- minWidth: 180,
- align: "center",
- },
- {
- title: "应考人数",
- key: "total",
- width: 120,
- align: "center",
- },
- {
- title: "已上传人数",
- key: "uploadedCount",
- minWidth: 120,
- align: "center",
- },
- {
- title: "已上传人数占比",
- key: "uploadedPercent",
- minWidth: 140,
- align: "center",
- },
- {
- title: "当前汇总人数",
- key: "answeredCount",
- minWidth: 120,
- align: "center",
- },
- {
- title: "汇总人数占比",
- minWidth: 120,
- key: "answeredPercent",
- align: "center",
- },
- ],
- };
- },
- methods: {
- doExport() {
- if (!this.query.examCode) {
- this.$Notice.error({
- title: "系统提示",
- desc: "<p>请先选择一个考试任务</p>",
- });
- return false;
- }
- let url =
- baseUrl +
- "/system/kj/hz/owexport?examCode=" +
- this.query.examCode +
- "&A-P-T_v_auth=" +
- localStorage.encryptToken;
- axios({
- method: "post",
- url: url, // 请求地址
- data: {}, // 参数
- responseType: "blob", // 表明返回服务器返回的数据类型
- }).then((res) => {
- // 处理返回的文件流
- let content = res.data;
- let blob = new Blob([content]);
- let fileName = "阅卷数据.zip";
- if ("download" in document.createElement("a")) {
- let elink = document.createElement("a");
- elink.download = fileName;
- elink.style.display = "none";
- elink.href = URL.createObjectURL(blob);
- document.body.appendChild(elink);
- elink.click();
- URL.revokeObjectURL(elink.href); // 释放URL 对象
- document.body.removeChild(elink);
- } else {
- navigator.msSaveBlob(blob, fileName);
- }
- });
- },
- // hideProgress(index) {
- // let $tr = $(".ivu-table-row").eq(index);
- // $tr.find(".ivu-progress").hide();
- // $tr.find(".ivu-progress-bg").width("0%");
- // $tr.find(".ivu-progress-text-inner").html("0%");
- // },
- // updateProgress(index, pro) {
- // if (pro > 0) {
- // let $tr = $(".ivu-table-row").eq(index);
- // $tr.find(".ivu-progress").show();
- // $tr.find(".ivu-progress-bg").width(pro + "%");
- // $tr.find(".ivu-progress-text-inner").html(pro + "%");
- // }
- // },
- formatFileSize(size) {
- let fileSize = size != undefined && size != null ? size : 0;
- if (size > 1024 * 1024)
- fileSize =
- (Math.round((size * 100) / (1024 * 1024)) / 100).toString() + "MB";
- else fileSize = (Math.round((size * 100) / 1024) / 100).toString() + "KB";
- return fileSize;
- },
- beforeBatchImport(file) {
- if (!this.query.examCode) {
- this.$Notice.error({
- title: "系统提示",
- desc: "<p>请先选择一个考试任务</p>",
- });
- return false;
- }
- if (file.name.indexOf(".qm") == -1) {
- this.$Notice.error({
- title: "系统消息",
- desc: "<p>上传数据包格式错误,不是qm格式</p>",
- });
- return false;
- }
- if (file.size > 1073741824) {
- this.$Notice.error({
- title: "系统消息",
- desc: "<p>文件大小超过了系统限制的文件大小1G</p>",
- });
- return false;
- }
- //上传操作
- file.percent = 0;
- this.batchFileList.push(file);
- let fd = new FormData();
- fd.append("file", file);
- let xhr = new XMLHttpRequest();
- xhr.upload.addEventListener(
- "progress",
- (evt) => {
- if (evt.lengthComputable) {
- let percentComplete = Math.round((evt.loaded * 100) / evt.total);
- file.percent = percentComplete;
- }
- },
- false
- );
- xhr.addEventListener(
- "error",
- (evt) => {
- let index = this.batchFileList.indexOf(file);
- if (index > -1) {
- this.batchFileList.splice(index, 1);
- }
- this.$store.commit("closeloading");
- this.$Notice.error({
- title: "系统提示",
- desc: "<p>" + evt + "</p>",
- });
- },
- false
- );
- xhr.addEventListener(
- "load",
- (evt) => {
- let index = this.batchFileList.indexOf(file);
- if (index > -1) {
- this.batchFileList.splice(index, 1);
- }
- this.$store.commit("closeloading");
- let statusCode = evt.target.status;
- if (statusCode == 200) {
- let data = JSON.parse(evt.target.responseText);
- if (data.code != 0) {
- this.$Notice.error({
- title: "系统提示",
- desc:
- "<p>文件:" + file.name + "导入失败," + data.message + "</p>",
- });
- } else {
- //刷新当前的列表页面
- this.load();
- this.$Notice.success({
- title: "导入成功",
- desc: "<p>文件:" + file.name + "导入成功" + "</p>",
- });
- }
- } else {
- this.$Notice.error({
- title: "系统提示",
- desc: "<p>文件:" + file.name + "上传失败" + "</p>",
- });
- }
- },
- false
- );
- xhr.open(
- "POST",
- baseUrl + "/system/kj/hz/file/solfegeImport/" + this.query.examCode
- ); //修改成自己的接口
- xhr.setRequestHeader(
- "authorization-token",
- this.$store.state.user.accessToken
- );
- xhr.setRequestHeader("fileName", encodeURIComponent(file.name));
- xhr.setRequestHeader("schoolId", this.$store.state.user.schoolId);
- xhr.send(fd);
- this.$store.commit("showloading");
- return false;
- },
- load() {
- if (this.query.examCode) {
- axios
- .post("/system/kj/hz/getSolfegeKjProgress", this.query)
- .then((response) => {
- let data = response.data.data;
- if (data) {
- this.list = data.content || [];
- this.query.totalElements = data.totalElements;
- this.query.totalPages = data.totalPages;
- }
- });
- }
- },
- selectPlace() {
- if (this.query.placeCode && this.query.placeCode.length > 0) {
- axios
- .post("/system/kj/hz/getRoomByPlaceCode", this.query)
- .then((response) => {
- let data = response.data.data;
- if (data) {
- this.xldata.roomCodeList = [];
- this.xldata.roomCodeList = data;
- }
- });
- } else {
- this.xldata.roomCodeList = [];
- }
- },
- selectExam() {
- if (this.query.examCode && this.query.examCode.length > 0) {
- axios
- .post("/system/kj/hz/getPlaceByExamCode", this.query)
- .then((response) => {
- let data = response.data.data;
- if (data) {
- this.xldata.placeCodeList = [];
- this.xldata.placeCodeList = data;
- }
- });
- } else {
- this.xldata.placeCodeList = [];
- }
- },
- doQuery() {
- if (!this.query.examCode || this.query.examCode.length == 0) {
- this.query.pageNo = 1;
- this.query.pageSize = 10;
- this.query.totalElements = 0;
- this.query.totalPages = 0;
- this.list = [];
- } else {
- this.query.pageNo = 1;
- this.load();
- }
- },
- changePageNo(p) {
- //切换页码
- this.query.pageNo = p;
- this.load();
- },
- changePageSize(pageSize) {
- //切换每一页显示多少条
- if (this.query.examCode) {
- this.query.pageSize = pageSize;
- this.load();
- }
- },
- },
- created() {
- let myexamCode = this.query.examCode;
- axios.post("/system/kj/hz/getPlans", {}).then((response) => {
- let data = response.data.data;
- if (data) {
- this.xldata.examCodeList = [];
- data.forEach((item, index) => {
- if (item.examType == "SOLFEGE") {
- this.xldata.examCodeList.push(item);
- this.query.examCode = myexamCode;
- }
- });
- }
- });
- },
- };
- </script>
|