123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <template>
- <div class="task-apply-manage">
- <div class="part-box part-box-filter part-box-flex">
- <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
- <template v-if="checkPrivilege('condition', 'condition')">
- <el-form-item label="审核状态:">
- <el-select
- v-model="filter.auditStatus"
- style="width: 142px;"
- placeholder="审核状态"
- clearable
- >
- <el-option
- v-for="(val, key) in AUDITING_STATUS"
- :key="key"
- :value="key"
- :label="val"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="题卡规则:">
- <card-rule-select
- ref="CardRuleSelect"
- v-model.trim="filter.cardRuleId"
- placeholder="题卡规则"
- clearable
- ></card-rule-select>
- </el-form-item>
- <el-form-item label="课程(代码):" label-width="110px">
- <course-select
- ref="CourseSelect"
- v-model.trim="filter.courseCode"
- placeholder="课程(代码)"
- clearable
- ></course-select>
- </el-form-item>
- <el-form-item label="命题老师:">
- <el-input
- v-model="filter.userName"
- placeholder="命题老师"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item label="试卷编号:">
- <paper-number-select
- ref="PaperNumberSelect"
- v-model="filter.paperNumber"
- placeholder="试卷编号"
- clearable
- ></paper-number-select>
- </el-form-item>
- <el-form-item label="命题时间:">
- <el-date-picker
- v-model="createTime"
- type="datetimerange"
- :picker-options="pickerOptions"
- range-separator="至"
- start-placeholder="命题开始时间"
- end-placeholder="命题结束时间"
- value-format="timestamp"
- align="right"
- unlink-panels
- >
- </el-date-picker>
- </el-form-item>
- </template>
- <el-form-item label-width="0px">
- <el-button
- v-if="checkPrivilege('button', 'select')"
- type="primary"
- @click="toPage(1)"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- v-if="checkPrivilege('button', 'addTask')"
- icon="el-icon-circle-plus-outline"
- type="primary"
- @click="toAddApply"
- >
- 新建命题申请
- </el-button>
- </div>
- </div>
- <div class="part-box part-box-pad">
- <el-table ref="TableList" :data="examTasks">
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
- <el-table-column prop="courseName" label="课程(代码)">
- <template slot-scope="scope">
- {{ scope.row.courseName }}({{ scope.row.courseCode }})
- </template>
- </el-table-column>
- <el-table-column prop="cardRuleName" label="题卡规则"></el-table-column>
- <el-table-column
- prop="userName"
- label="命题老师"
- width="100"
- ></el-table-column>
- <el-table-column prop="startTime" label="命题开始时间">
- <span slot-scope="scope">{{
- scope.row.startTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="endTime" label="命题结束时间">
- <span slot-scope="scope">{{
- scope.row.endTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="auditStatus" label="审核状态" width="100">
- <template slot-scope="scope">
- {{ scope.row.auditStatus | auditStatusFilter }}
- </template>
- </el-table-column>
- <el-table-column class-name="action-column" label="操作" width="160px">
- <template slot-scope="scope">
- <el-button
- v-if="checkPrivilege('link', 'preview')"
- class="btn-primary"
- type="text"
- @click="toPreview(scope.row)"
- >查看详情</el-button
- >
- <el-button
- v-if="
- (scope.row.setup === 1 || scope.row.setup === null) &&
- checkPrivilege('link', 'edit')
- "
- class="btn-primary"
- type="text"
- @click="toEdit(scope.row)"
- >立即申请</el-button
- >
- <el-button
- v-if="
- scope.row.auditStatus === 'AUDITED' &&
- scope.row.reviewStatus === 'NOT_PASS' &&
- checkPrivilege('link', 'edit')
- "
- class="btn-primary"
- type="text"
- @click="toEdit(scope.row)"
- >重新申请</el-button
- >
- <el-button
- v-if="scope.row.setup === 0 && checkPrivilege('link', 'end')"
- class="btn-danger"
- type="text"
- @click="toCancel(scope.row)"
- >撤销申请</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- v-if="examTasks.length"
- background
- layout="total,prev, pager, next"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- >
- </el-pagination>
- </div>
- </div>
- <!-- ModifyTaskApply -->
- <modify-task-apply
- ref="ModifyTaskApply"
- :edit-type="editType"
- :instance="curExamTask"
- @modified="taskModified"
- ></modify-task-apply>
- <!-- CreateTaskApply -->
- <create-task-apply
- ref="CreateTaskApply"
- @modified="taskModified"
- ></create-task-apply>
- </div>
- </template>
- <script>
- import ModifyTaskApply from "../components/ModifyTaskApply";
- import CreateTaskApply from "../components/createTaskApply/CreateTaskApply";
- // import CreateTaskApply from "../components/CreateTaskApply";
- import { AUDITING_STATUS } from "@/constants/enumerate";
- import pickerOptions from "@/constants/datePickerOptions";
- import { taskApplyListPage, cancelOrRestartTaskApply } from "../api";
- import { mapActions } from "vuex";
- export default {
- name: "task-apply-manage",
- components: {
- ModifyTaskApply,
- CreateTaskApply
- },
- data() {
- return {
- filter: {
- auditStatus: "",
- reviewStatus: "",
- cardRuleId: "",
- courseCode: "",
- userName: "",
- paperNumber: "",
- startTime: "",
- endTime: ""
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- editType: "APPLY",
- AUDITING_STATUS,
- examTasks: [],
- curExamTask: {},
- curUserId: this.$ls.get("user", { id: "" }).id,
- userRoles: this.$ls.get("user", { roleList: [] }).roleList,
- // date-picker
- createTime: [],
- pickerOptions
- };
- },
- mounted() {
- this.initData();
- },
- methods: {
- ...mapActions("exam", ["updateWaitTaskCount"]),
- async initData() {
- const cachePageInfo = this.$ls.get("cachePageInfo");
- if (cachePageInfo) {
- this.filter = this.$objAssign(this.filter, cachePageInfo.filter);
- if (this.filter.startTime && this.filter.endTime)
- this.createTime = [this.filter.startTime, this.filter.endTime];
- this.current = cachePageInfo.page;
- await this.getList();
- this.$nextTick(() => {
- const curRow = this.examTasks.find(
- item => item.id === cachePageInfo.curRowId
- );
- if (!curRow) return;
- this.toEdit(curRow);
- });
- } else {
- this.toPage(1);
- }
- this.$ls.remove("cachePageInfo");
- },
- async getList() {
- if (!this.checkPrivilege("list", "list")) return;
- const datas = {
- ...this.filter,
- pageNumber: this.current,
- pageSize: this.size
- };
- if (this.createTime) {
- datas.startTime = this.createTime[0];
- datas.endTime = this.createTime[1];
- }
- const data = await taskApplyListPage(datas);
- this.examTasks = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- toCancel(row) {
- this.$confirm("确定要撤销当前申请吗?", "提示", {
- type: "warning"
- })
- .then(async () => {
- const data = await cancelOrRestartTaskApply({
- id: row.id,
- status: "CANCEL"
- }).catch(() => {});
- if (!data) return;
- this.$message.success("操作成功!");
- this.getList();
- })
- .catch(() => {});
- },
- toEdit(row) {
- this.curExamTask = row;
- this.editType = "APPLY";
- this.$refs.ModifyTaskApply.open();
- },
- toPreview(row) {
- this.curExamTask = row;
- this.editType = "PREVIEW";
- this.$refs.ModifyTaskApply.open();
- },
- taskModified() {
- this.getList();
- this.updateWaitTaskCount(this.userRoles);
- },
- toAddApply() {
- this.$refs.CreateTaskApply.open();
- }
- },
- beforeRouteLeave(to, from, next) {
- if (to.name === "CardDesign") {
- this.$ls.set("cachePageInfo", {
- page: this.current,
- filter: this.filter,
- curRowId: this.curExamTask.id
- });
- } else {
- this.$ls.remove("cachePageInfo");
- }
- next();
- }
- };
- </script>
|