123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <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')">
- <el-form-item label="印刷计划:">
- <print-plan-select
- v-model.trim="filter.printPlanIdList"
- placeholder="印刷计划"
- multiple
- clearable
- 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="toAdd"
- >
- 新建印刷计划
- </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="200"
- ></el-table-column>
- <el-table-column
- prop="examName"
- label="考试"
- min-width="200"
- ></el-table-column>
- <el-table-column prop="examStartTime" label="考试开始时间" width="170">
- <span slot-scope="scope">{{
- scope.row.examStartTime | timestampFilter
- }}</span>
- </el-table-column>
- <el-table-column prop="examEndTime" label="考试结束时间" width="170">
- <span slot-scope="scope">{{
- scope.row.examEndTime | timestampFilter
- }}</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 prop="status" label="计划状态" width="100">
- <span slot-scope="scope">
- {{ scope.row.status | printPlanStatusFilter }}
- </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="
- 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="
- scope.row.createId === curUserId &&
- scope.row.status === 'NEW' &&
- checkPrivilege('link', 'delete')
- "
- >删除</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>
- </div>
- </template>
- <script>
- import { printPlanListPage, removePrintPlan } from "../api";
- import { PRINT_PLAN_STATUS } from "@/constants/enumerate";
- import pickerOptions from "@/constants/datePickerOptions";
- import ModifyPrintPlan from "../components/ModifyPrintPlan";
- import PrintPlanDetail from "../components/PrintPlanDetail.vue";
- export default {
- name: "print-plan-manage",
- components: { ModifyPrintPlan, PrintPlanDetail },
- 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,
- // date-picker
- createTime: [],
- pickerOptions
- };
- },
- mounted() {
- this.search();
- },
- 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() {
- this.curPrintPlan = {};
- this.editType = "ADD";
- this.$refs.ModifyPrintPlan.open();
- },
- toEdit(row) {
- this.curPrintPlan = row;
- this.editType = "EDIT";
- this.$refs.ModifyPrintPlan.open();
- },
- toPreview(row) {
- this.curPrintPlan = row;
- this.$refs.PrintPlanDetail.open();
- },
- toDelete(row) {
- this.$confirm(`确定要删除印刷计划【${row.name}】吗?`, "提示", {
- type: "warning"
- })
- .then(async () => {
- await removePrintPlan(row.id);
- this.$message.success("删除成功!");
- this.deletePageLastItem();
- })
- .catch(() => {});
- }
- }
- };
- </script>
|