123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <div class="print-plan-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')">
- <secp-select
- v-model="filter"
- defaultSelectExam
- @exam-default="search"
- ></secp-select>
- <el-form-item label="印刷计划:">
- <print-plan-select
- v-model.trim="filter.printPlanIdList"
- placeholder="印刷计划"
- multiple
- clearable
- :semester-id="filter.semesterId"
- :exam-id="filter.examId"
- style="width: 300px"
- ></print-plan-select>
- </el-form-item>
- <el-form-item label="计划状态:">
- <el-select
- v-model="filter.status"
- style="width: 142px"
- placeholder="计划状态"
- clearable
- >
- <el-option
- v-for="(val, key) in PRINT_PLAN_STATUS"
- :key="key"
- :value="key"
- :label="val"
- ></el-option>
- </el-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="search"
- >查询</el-button
- >
- </el-form-item>
- </el-form>
- <div class="part-box-action">
- <el-button
- v-if="checkPrivilege('button', 'add')"
- icon="el-icon-circle-plus-outline"
- type="primary"
- @click="modalIsShow = true"
- >
- 新增
- </el-button>
- </div>
- </div>
- <div class="part-box part-box-pad">
- <el-table ref="TableList" :data="dataList">
- <el-table-column
- type="index"
- label="序号"
- width="70"
- :index="indexMethod"
- ></el-table-column>
- <el-table-column
- prop="name"
- label="印刷计划"
- min-width="200"
- ></el-table-column>
- <!-- <el-table-column
- prop="semesterName"
- label="学期"
- min-width="210"
- ></el-table-column>
- <el-table-column
- prop="examName"
- label="考试"
- min-width="200"
- ></el-table-column> -->
- <el-table-column prop="status" label="计划状态" width="100">
- <span slot-scope="scope">
- {{ scope.row.status | printPlanStatusFilter }}
- </span>
- </el-table-column>
- <el-table-column
- prop="createName"
- label="创建人"
- min-width="100"
- ></el-table-column>
- <el-table-column prop="createTime" label="创建时间" width="170">
- <span slot-scope="scope">{{
- scope.row.createTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column
- class-name="action-column"
- label="操作"
- width="140"
- fixed="right"
- >
- <template slot-scope="scope">
- <el-button
- v-if="checkPrivilege('link', 'preview')"
- class="btn-primary"
- type="text"
- @click="toPreview(scope.row)"
- >查看</el-button
- >
- <el-button
- class="btn-primary"
- type="text"
- @click="toEdit(scope.row)"
- v-if="
- (isSchoolAdmin || scope.row.createId === curUserId) &&
- scope.row.status === 'NEW' &&
- checkPrivilege('link', 'edit')
- "
- >编辑</el-button
- >
- <el-button
- class="btn-danger"
- type="text"
- @click="toDelete(scope.row)"
- v-if="checkPrivilege('link', 'delete')"
- >删除</el-button
- >
- <el-button
- class="btn-danger"
- type="text"
- @click="toFinish(scope.row)"
- v-if="
- scope.row.status !== 'END' && checkPrivilege('link', 'Finish')
- "
- >结束</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="part-page">
- <el-pagination
- background
- layout="total, sizes, prev, pager, next, jumper"
- :pager-count="5"
- :current-page="current"
- :total="total"
- :page-size="size"
- @current-change="toPage"
- @size-change="pageSizeChange"
- >
- </el-pagination>
- </div>
- </div>
- <!-- ModifyPrintPlan -->
- <modify-print-plan
- v-if="checkPrivilege('link', 'edit') || checkPrivilege('button', 'add')"
- ref="ModifyPrintPlan"
- :instance="curPrintPlan"
- :edit-type="editType"
- @modified="getList"
- ></modify-print-plan>
- <!-- PrintPlanDetail -->
- <print-plan-detail
- v-if="checkPrivilege('link', 'preview')"
- ref="PrintPlanDetail"
- :plan="curPrintPlan"
- ></print-plan-detail>
- <!-- PrintPlanBkDetail -->
- <print-plan-bk-detail
- v-if="checkPrivilege('link', 'preview')"
- ref="PrintPlanBkDetail"
- :plan="curPrintPlan"
- ></print-plan-bk-detail>
- <!-- print-type-dialog -->
- <el-dialog
- :visible.sync="modalIsShow"
- title="新建印刷计划"
- top="10vh"
- width="500px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- >
- <div class="big-btns">
- <el-button
- v-for="(val, key) in PRINT_PLAN_TYPE"
- :key="key"
- type="primary"
- @click="toAdd(key)"
- >{{ val }}</el-button
- >
- </div>
- <div slot="footer"></div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { printPlanListPage, removePrintPlan, finishPrintPlan } from "../api";
- import { PRINT_PLAN_STATUS, PRINT_PLAN_TYPE } from "@/constants/enumerate";
- import pickerOptions from "@/constants/datePickerOptions";
- import ModifyPrintPlan from "../components/ModifyPrintPlan";
- import PrintPlanDetail from "../components/PrintPlanDetail.vue";
- import PrintPlanBkDetail from "../components/PrintPlanBkDetail.vue";
- export default {
- name: "print-plan-manage",
- components: { ModifyPrintPlan, PrintPlanDetail, PrintPlanBkDetail },
- data() {
- return {
- filter: {
- semesterId: "",
- examId: "",
- printPlanIdList: [],
- status: "",
- startTime: "",
- endTime: "",
- },
- current: 1,
- size: this.GLOBAL.pageSize,
- total: 0,
- dataList: [],
- curPrintPlan: {},
- editType: "ADD",
- PRINT_PLAN_STATUS,
- curUserId: this.$ls.get("user", { id: "" }).id,
- isSchoolAdmin: this.$ls
- .get("user", { role: [] })
- .role.includes("SCHOOL_ADMIN"),
- modalIsShow: false,
- PRINT_PLAN_TYPE,
- // date-picker
- createTime: [],
- pickerOptions,
- };
- },
- methods: {
- 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 printPlanListPage(datas);
- this.dataList = data.records;
- this.total = data.total;
- },
- toPage(page) {
- this.current = page;
- this.getList();
- },
- search() {
- this.toPage(1);
- },
- toAdd(category) {
- this.modalIsShow = false;
- this.curPrintPlan = { category };
- this.editType = "ADD";
- this.$refs.ModifyPrintPlan.open();
- },
- toEdit(row) {
- this.curPrintPlan = row;
- this.editType = "EDIT";
- this.$refs.ModifyPrintPlan.open();
- },
- toPreview(row) {
- this.curPrintPlan = row;
- if (row.category === "FORMAL" || !row.category) {
- this.$refs.PrintPlanDetail.open();
- } else {
- this.$refs.PrintPlanBkDetail.open();
- }
- },
- toDelete(row) {
- this.$confirm(`确定要删除印刷计划【${row.name}】吗?`, "提示", {
- type: "warning",
- })
- .then(async () => {
- await removePrintPlan(row.id);
- this.$message.success("删除成功!");
- this.deletePageLastItem();
- })
- .catch(() => {});
- },
- toFinish(row) {
- this.$confirm(`结束后状态无法回退,是否继续操作?`, "提示", {
- type: "warning",
- })
- .then(async () => {
- await finishPrintPlan(row.id);
- this.$message.success("操作成功!");
- this.getList();
- })
- .catch(() => {});
- },
- },
- };
- </script>
|