123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <!-- -->
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 声部分类管理
- </h2>
- <div class="m-core">
- <auth auths="subject/upset/insertCate" style="padding-bottom: 20px">
- <el-button @click="addCategory" type="primary">添加</el-button>
- </auth>
- <!-- <save-form
- :inline="true"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- >
- <el-form-item>
- <el-input
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="search"
- placeholder="请输入乐团编号"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-input
- v-model.trim="searchForm.search"
- @keyup.enter.native="search"
- placeholder="请输入乐团编号"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item> -->
- <!-- </save-form> -->
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- >
- <el-table-column
- align="center"
- prop="id"
- label="分类编号"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="name"
- label="分类名称"
- ></el-table-column>
- <el-table-column align="center" prop="name" label="操作">
- <template slot-scope="scope">
- <div>
- <!-- v-permission="'subject/upset/del' -->
- <auth auths="subject/upset/resetCate">
- <el-button type="text" @click="resetSubjectCategory(scope.row)"
- >修改</el-button
- >
- </auth>
- <auth auths="subject/upset/delCate">
- <el-button type="text" @click="removeSubjectCategory(scope.row)"
- >删除</el-button
- >
- </auth>
- </div>
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" prop="name" label="分类图片">
- <template slot-scope="scope">
- <el-image
- v-if="scope.row.img"
- style="width: 60px; height: 60px"
- fit="cover"
- :src="scope.row.img.split(',')[0]"
- :previewSrcList="scope.row.img.split(',')"
- >
- </el-image>
- </template>
- </el-table-column> -->
- </el-table>
- <pagination
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <el-dialog
- title="修改分类"
- :visible.sync="categoryVisible"
- width="500px"
- v-if="categoryVisible"
- >
- <el-form :model="form" :inline="true" ref="form">
- <el-form-item
- prop="name"
- label="分类名称"
- :rules="{
- required: true,
- message: '请输入分类名称',
- trigger: 'change,blur',
- }"
- >
- <el-input v-model="form.name"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="categoryVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitReset">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- import pagination from "@/components/Pagination/index";
- import load from "@/utils/loading";
- import { subjectListTree,subjectUpset } from "@/api/specialSetting";
- export default {
- components: { pagination },
- data() {
- return {
- searchForm: {
- search: null,
- },
- form: {
- name: null,
- id: null,
- },
- tableList: [],
- organList: [],
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- categoryVisible: false,
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 获取分部
- this.init();
- },
- methods: {
- init() {
- this.getList();
- },
- getList() {
- subjectListTree({
- delFlag: "NO",
- tenantId: 1,
- rows: this.rules.limit,
- page: this.rules.page,
- }).then((res) => {
- if (res.code == 200) {
- this.tableList = res.data.rows;
- this.rules.total = res.data.total;
- }
- });
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- onReSet() {},
- resetSubjectCategory(row) {
- console.log(row);
- this.form.name = row.name;
- this.form.id = row.id;
- this.categoryVisible = true;
- },
- removeSubjectCategory(row) {
- this.$confirm("是否确认删除分类", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- subjectUpset({
- delFlag: "YES",
- id: row.id,
- }).then((res) => {
- this.messageTips("删除", res);
- this.search()
- });
- });
- },
- messageTips(title, res) {
- if (res.code == 200) {
- this.$message.success(title + "成功");
- } else {
- this.$message.error(res.msg);
- }
- },
- submitReset() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- subjectUpset({
- parentSubjectId: 0,
- tenantId: 1,
- name: this.form.name,
- id:this.form.id
- }).then((res) => {
- if (res.code == 200) {
- this.messageTips("修改", res);
- this.categoryVisible = false;
- this.getList()
- }
- });
- }
- });
- },
- addCategory(){
- this.form.id = null;
- this.form.name = null;
- this.categoryVisible = true;
- }
- },
- };
- </script>
- <style lang='scss' scoped>
- </style>
|