|
@@ -0,0 +1,219 @@
|
|
|
+<template>
|
|
|
+ <div class="card-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-input
|
|
|
+ v-model.trim="filter.name"
|
|
|
+ placeholder="名称"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="创建方式:" label-width="90px">
|
|
|
+ <el-select
|
|
|
+ v-model="filter.createType"
|
|
|
+ style="width: 120px;"
|
|
|
+ placeholder="创建方式"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(val, key) in CARD_CREATE_TYPE"
|
|
|
+ :key="key"
|
|
|
+ :value="key"
|
|
|
+ :label="val"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <el-form-item>
|
|
|
+ <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', 'add')"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
+ @click="toSelectCardCreateType"
|
|
|
+ >添加题卡</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-box part-box-pad">
|
|
|
+ <el-table ref="TableList" :data="cardList">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="序号"
|
|
|
+ width="70"
|
|
|
+ :index="indexMethod"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="name" label="题卡名称"></el-table-column>
|
|
|
+ <el-table-column prop="type" label="类型"></el-table-column>
|
|
|
+ <el-table-column prop="orgs" label="适用学院">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <more-text :data="scope.row.orgNames"></more-text>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createType" label="创建方式"></el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注">
|
|
|
+ <span slot-scope="scope">{{
|
|
|
+ scope.row.remark | defaultFieldFilter
|
|
|
+ }}</span>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="创建时间" width="180">
|
|
|
+ <span slot-scope="scope">{{
|
|
|
+ scope.row.createTime | timestampFilter
|
|
|
+ }}</span>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column class-name="action-column" label="操作" width="140">
|
|
|
+ <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="checkPrivilege('link', 'edit')"
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ @click="toEdit(scope.row)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('link', 'delete')"
|
|
|
+ class="btn-danger"
|
|
|
+ type="text"
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="part-page">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="total,prev, pager, next"
|
|
|
+ :current-page="current"
|
|
|
+ :total="total"
|
|
|
+ :page-size="size"
|
|
|
+ @current-change="toPage"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- card-create-type -->
|
|
|
+ <el-dialog
|
|
|
+ class="card-create-type"
|
|
|
+ :visible.sync="modalIsShow"
|
|
|
+ title="题卡创建方式"
|
|
|
+ top="10vh"
|
|
|
+ width="600px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <div class="card-types">
|
|
|
+ <div
|
|
|
+ v-for="(val, key) in CARD_CREATE_TYPE"
|
|
|
+ :key="key"
|
|
|
+ class="card-type"
|
|
|
+ @click="toAdd(key)"
|
|
|
+ >
|
|
|
+ {{ val }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div slot="footer"></div>
|
|
|
+ </el-dialog>
|
|
|
+ <!-- ModifyCardInfo -->
|
|
|
+ <modify-card-info
|
|
|
+ ref="ModifyCardInfo"
|
|
|
+ :instance="curCard"
|
|
|
+ @modified="getList"
|
|
|
+ ></modify-card-info>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { CARD_CREATE_TYPE } from "../../../constants/enumerate";
|
|
|
+import { cardListPage, deleteCard } from "../api";
|
|
|
+import ModifyCardInfo from "../components/ModifyCardInfo";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "card-manage",
|
|
|
+ components: { ModifyCardInfo },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {
|
|
|
+ name: "",
|
|
|
+ createType: ""
|
|
|
+ },
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ CARD_CREATE_TYPE,
|
|
|
+ cardList: [],
|
|
|
+ curCard: {},
|
|
|
+ // card-create-type dialog
|
|
|
+ modalIsShow: false,
|
|
|
+ editType: "ADD"
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ if (!this.checkPrivilege("list", "list")) return;
|
|
|
+
|
|
|
+ const datas = {
|
|
|
+ ...this.filter,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await cardListPage(datas);
|
|
|
+ this.cardList = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd(createType) {
|
|
|
+ console.log(createType);
|
|
|
+ this.curCard = { createType };
|
|
|
+ this.modalIsShow = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.ModifyCardInfo.open();
|
|
|
+ }, 200);
|
|
|
+ },
|
|
|
+ toSelectCardCreateType() {
|
|
|
+ this.modalIsShow = true;
|
|
|
+ },
|
|
|
+ toPreview(row) {
|
|
|
+ this.curCard = row;
|
|
|
+ this.$refs.ModifyRole.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curCard = row;
|
|
|
+ this.$refs.ModifyRole.open();
|
|
|
+ },
|
|
|
+ toDelete(row) {
|
|
|
+ this.$confirm(`确定要删除题卡【${row.name}】吗?`, "提示", {
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await deleteCard(row.id);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|