|
@@ -0,0 +1,132 @@
|
|
|
+<template>
|
|
|
+ <div class="record-type-manage">
|
|
|
+ <div class="part-box part-box-filter part-box-flex">
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('button', 'select')"
|
|
|
+ type="primary"
|
|
|
+ @click="toPage(1)"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="part-box-action">
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('button', 'add')"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
+ @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="类型名称"></el-table-column>
|
|
|
+ <el-table-column class-name="action-column" label="操作" width="160px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <modify-record-type
|
|
|
+ :instance="curRow"
|
|
|
+ @modified="getList"
|
|
|
+ ref="ModifyRecordType"
|
|
|
+ ></modify-record-type>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { recordTypeListQuery, deleteRecordType } from "../api";
|
|
|
+import ModifyRecordType from "../components/ModifyRecordType.vue";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "record-type-manage",
|
|
|
+ components: { ModifyRecordType },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {},
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ dataList: [],
|
|
|
+ curRow: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ if (!this.checkPrivilege("list", "list")) return;
|
|
|
+
|
|
|
+ const datas = {
|
|
|
+ ...this.filter,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await recordTypeListQuery(datas);
|
|
|
+ this.dataList = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ this.curRow = {};
|
|
|
+ this.$refs.ModifyRecordType.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curRow = row;
|
|
|
+ this.$refs.ModifyRecordType.open();
|
|
|
+ },
|
|
|
+ async toDelete(row) {
|
|
|
+ const result = await this.$confirm(
|
|
|
+ `确定要删除类型【${row.semesterName}】吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (result !== "confirm") return;
|
|
|
+
|
|
|
+ await deleteRecordType(row.id);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|