lex-xin il y a 3 ans
Parent
commit
fad53a348a

+ 2 - 0
src/router/index.js

@@ -466,6 +466,8 @@ export const asyncRoutes = {
   backManager: () => import('@/views/backManager'),
   // 教材列表
   teachManager: () => import('@/views/teachManager'),
+  // 教材分类
+  teachClass: () => import('@/views/teachManager/teachClass'),
   // 课程规则设置
   courseRulersManager: () => import('@/views/courseRulersManager'),
   // 基础规则设置

+ 2 - 3
src/views/helpCenter/helpCategory.vue

@@ -7,10 +7,9 @@
                       content="帮助中心分类"></el-page-header>
     </h2>
     <div class="m-core">
-      <div class="newBand"
-           v-permission="'helpCenterCatalog/modify'"
-           @click="openTypes('create')">添加</div>
       <!-- 列表 -->
+      <el-button  style="margin-bottom: 20px;" type="primary" v-permission="'helpCenterCatalog/modify'"
+           @click="openTypes('create')"icon="el-icon-plus">添加</el-button>
       <div class="tableWrap">
         <el-table :data="tableList"
                   :header-cell-style="{background:'#EDEEF0',color:'#444'}"

+ 4 - 4
src/views/platformManager/productManger/operationModel.vue

@@ -54,8 +54,8 @@
                   :props="defaultProps">
           <div slot-scope="{ node, data }">
             {{ node.label }}
-            <el-tag v-if="data.type == 1"
-                    effect="dark">按钮</el-tag>
+            <!-- <el-tag v-if="data.type == 1"
+                    effect="dark">按钮</el-tag> -->
           </div>
         </el-tree>
       </el-form-item>
@@ -147,9 +147,9 @@ export default {
         const silderData = silderList.data || []
         let silderItem = []
         silderData.forEach(item => { // 去掉公用权限
-          if(item.permission != "publicAuthority") {
+          // if(item.permission != "publicAuthority") {
             silderItem.push(item)
-          }
+          // }
         })
 
         this.silderList = silderItem

+ 47 - 36
src/views/teachManager/index.vue

@@ -56,7 +56,7 @@
       </save-form>
       <div class="btnList">
         <auth auths="sysMusicScoreCategories/save">
-          <el-button type="primary" @click="addRoot">新增教材</el-button>
+          <el-button type="primary" @click="addTeachClass">新增教材</el-button>
         </auth>
       </div>
       <div class="tableWrap">
@@ -64,6 +64,7 @@
           style="width: 100%"
           :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
           :data="tableList"
+          :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
         >
           <el-table-column
             align="center"
@@ -116,7 +117,14 @@
                     >查看</el-button
                   >
                 </auth>
-
+                <auth auths="sysMusicScoreCategories/update">
+                  <el-button
+                    type="text"
+                    @click="resetTeach(scope.row)"
+                    v-if="!scope.row.enable"
+                    >添加</el-button
+                  >
+                </auth>
                 <auth auths="sysMusicScoreCategories/update">
                   <el-button
                     type="text"
@@ -151,45 +159,47 @@
             </template>
           </el-table-column>
         </el-table>
-        <pagination
+        <!-- <pagination
           sync
           :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="teachVisible"
+    <el-dialog
+      title="新增教材"
+      :visible.sync="teachClassVisible"
       width="600px"
-      v-if="teachVisible"
+      v-if="teachClassVisible"
     >
-      <addRoot
-        @close="teachVisible = false"
+      <teachClass
+        @close="teachClassVisible = false"
         @getList="getList"
-        ref="addRoot"
-        v-if="teachVisible"
+        ref="teachClass"
+        v-if="teachClassVisible"
         :activeRow="activeRow"
       />
       <span slot="footer" class="dialog-footer">
-        <el-button @click="teachVisible = false">取 消</el-button>
-        <el-button type="primary" @click="submitAdd">确 定</el-button>
+        <el-button @click="teachClassVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitAddClass">确 定</el-button>
       </span>
-    </el-dialog> -->
+    </el-dialog>
+
+
     <el-dialog
       title="新增教材"
       :visible.sync="teachVisible"
       width="600px"
       v-if="teachVisible"
     >
-      <addRoot
+      <addTeach
         @close="teachVisible = false"
         @getList="getList"
-        ref="addRoot"
+        ref="addTeach"
         v-if="teachVisible"
         :activeRow="activeRow"
       />
@@ -206,14 +216,16 @@ import axios from "axios";
 import { getToken } from "@/utils/auth";
 import pagination from "@/components/Pagination/index";
 import load from "@/utils/loading";
-import addRoot from "./modals/addRoot";
+import addTeach from "./modals/addTeach";
+import teachClass from "./modals/addRoot";
+import { queryTree } from '../accompaniment/api'
 import {
   getSysMusicScoreList,
   enableSysMusicScore,
   removeSysMusicScore,
 } from "./api";
 export default {
-  components: { pagination, addRoot },
+  components: { pagination, addTeach, teachClass },
   data() {
     return {
       searchForm: {
@@ -223,15 +235,10 @@ export default {
 
       tableList: [],
       organList: [],
-      rules: {
-        // 分页规则
-        limit: 10, // 限制显示条数
-        page: 1, // 当前页
-        total: 0, // 总条数
-        page_size: [10, 20, 40, 50], // 选择限制显示条数
-      },
       teachVisible: false,
       activeRow: null,
+      teachClassVisible: false,
+      activeClassRow: null,
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -240,7 +247,7 @@ export default {
   mounted() {
     // 获取分部
      this.$store.dispatch("setBranchs");
-    this.init();
+    this.getList();
   },
   filters: {
     formatSoundReSource(val) {
@@ -253,20 +260,17 @@ export default {
     }
   },
   methods: {
-    init() {
-      this.getList();
-    },
     async getList() {
       let {organId ,...rest} =  this.searchForm
       try {
-        const res = await getSysMusicScoreList({
-          organId:organId.join(','),
+        const res = await queryTree({
+          // organId:organId.join(','),
          ...rest,
           page: this.rules.page,
           rows: this.rules.limit,
         });
-        this.rules.total = res.data.total;
-        this.tableList = res.data.rows;
+        console.log(res)
+        this.tableList = res.data;
       } catch (e) {}
     },
     search() {
@@ -277,12 +281,19 @@ export default {
       this.$refs.searchForm.resetFields();
       this.search();
     },
-    addRoot() {
+    addTeachClass() {
+      this.activeRow = null;
+      this.teachClassVisible = true;
+    },
+    submitAddClass() {
+      this.$refs.teachClass.addSubmit();
+    },
+    addTeach() {
       this.activeRow = null;
       this.teachVisible = true;
     },
     submitAdd() {
-      this.$refs.addRoot.addSubmit();
+      this.$refs.addTeach.addSubmit();
     },
     resetTeach(row) {
       this.activeRow = row;

+ 353 - 0
src/views/teachManager/teachClass.vue

@@ -0,0 +1,353 @@
+<!--  -->
+<template>
+  <div class="m-container">
+    <h2>
+      <div class="squrt"></div>
+      教材分类
+    </h2>
+    <div class="m-core">
+      <save-form
+        :inline="true"
+        :model="searchForm"
+        @submit="search"
+        @reset="onReSet"
+        ref="searchForm"
+      >
+        <el-form-item prop="search">
+          <el-input
+            v-model.trim="searchForm.search"
+            clearable
+            @keyup.enter.native="search"
+            placeholder="教材编号、名称"
+          ></el-input>
+        </el-form-item>
+        <!-- <el-form-item prop="organId">
+          <el-select
+            class="multiple"
+            v-model.trim="searchForm.organId"
+            filterable
+            multiple
+            collapse-tags
+            clearable
+            placeholder="请选择分部"
+          >
+            <el-option
+              v-for="(item, index) in selects.branchs"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item> -->
+        <el-form-item prop="enable">
+          <el-select
+            v-model.trim="searchForm.enable"
+            placeholder="教材状态"
+            clearable
+          >
+            <el-option label="启用" value="1"></el-option>
+            <el-option label="停用" value="0"></el-option>
+          </el-select>
+        </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="btnList">
+        <auth auths="sysMusicScoreCategories/save">
+          <el-button type="primary" @click="addRoot">新增教材</el-button>
+        </auth>
+      </div>
+      <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="organNames" label="可见分部">
+            <template slot-scope="scope">
+              <div>
+                <overflow-text :text="scope.row.organNames"></overflow-text>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            align="center"
+            prop="musicScoreNum"
+            label="曲目数量"
+          ></el-table-column>
+          <el-table-column
+            align="center"
+            prop="musicScoreNum"
+            label="使用音源"
+          >
+            <template slot-scope="scope">
+              {{ scope.row.soundResource | formatSoundReSource }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            align="center"
+            prop="updateTime"
+            label="最后更新时间"
+          ></el-table-column>
+          <el-table-column align="center" prop="studentId" label="教材状态">
+            <template slot-scope="scope">
+              <div>
+                {{ scope.row.enable ? "启用" : "停用" }}
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" prop="studentId" label="操作">
+            <template slot-scope="scope">
+              <div>
+                <auth auths="/accompaniment">
+                  <el-button type="text" @click="lookMusic(scope.row)"
+                    >查看</el-button
+                  >
+                </auth>
+
+                <auth auths="sysMusicScoreCategories/update">
+                  <el-button
+                    type="text"
+                    @click="resetTeach(scope.row)"
+                    v-if="!scope.row.enable"
+                    >修改</el-button
+                  >
+                </auth>
+                <auth auths="sysMusicScoreCategories/enable">
+                  <el-button
+                    type="text"
+                    v-if="scope.row.enable"
+                    @click="stopTeach(scope.row)"
+                    >停用</el-button
+                  >
+                  <el-button
+                    type="text"
+                    v-if="!scope.row.enable"
+                    @click="stopTeach(scope.row)"
+                    >启用</el-button
+                  >
+                </auth>
+                <auth auths="sysMusicScoreCategories/delete">
+                  <el-button
+                    type="text"
+                    v-if="!scope.row.enable"
+                    @click="removeTeach(scope.row)"
+                    >删除</el-button
+                  >
+                </auth>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+        <pagination
+          sync
+          :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="teachVisible"
+      width="600px"
+      v-if="teachVisible"
+    >
+      <addRoot
+        @close="teachVisible = false"
+        @getList="getList"
+        ref="addRoot"
+        v-if="teachVisible"
+        :activeRow="activeRow"
+      />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="teachVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitAdd">确 定</el-button>
+      </span>
+    </el-dialog> -->
+    <el-dialog
+      title="新增教材"
+      :visible.sync="teachVisible"
+      width="600px"
+      v-if="teachVisible"
+    >
+      <addRoot
+        @close="teachVisible = false"
+        @getList="getList"
+        ref="addRoot"
+        v-if="teachVisible"
+        :activeRow="activeRow"
+      />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="teachVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitAdd">确 定</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 addRoot from "./modals/addRoot";
+import {
+  getSysMusicScoreList,
+  enableSysMusicScore,
+  removeSysMusicScore,
+} from "./api";
+export default {
+  components: { pagination, addRoot },
+  data() {
+    return {
+      searchForm: {
+        search: null,
+        enable: null,
+      },
+
+      tableList: [],
+      organList: [],
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      teachVisible: false,
+      activeRow: null,
+    };
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {
+    // 获取分部
+     this.$store.dispatch("setBranchs");
+    this.getList();
+  },
+  filters: {
+    formatSoundReSource(val) {
+      let template = {
+        NOTEPERFORMER: 'NotePerformer音源',
+        TANG: '标准音源',
+        OFFICIAL: '官方音源'
+      }
+      return template[val]
+    }
+  },
+  methods: {
+    async getList() {
+      let {organId ,...rest} =  this.searchForm
+      try {
+        const res = await getSysMusicScoreList({
+          // organId:organId.join(','),
+         ...rest,
+          parentId: 0,
+          page: this.rules.page,
+          rows: this.rules.limit,
+        });
+        this.rules.total = res.data.total;
+        this.tableList = res.data.rows;
+      } catch (e) {
+        console.log(e)
+      }
+    },
+    search() {
+      this.rules.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.$refs.searchForm.resetFields();
+      this.search();
+    },
+    addRoot() {
+      this.activeRow = null;
+      this.teachVisible = true;
+    },
+    submitAdd() {
+      this.$refs.addRoot.addSubmit();
+    },
+    resetTeach(row) {
+      this.activeRow = row;
+      this.teachVisible = true;
+    },
+    async stopTeach(row) {
+      let str = "";
+      if (row.enable) {
+        str = `是否停用${row.name}该教材`;
+      } else {
+        str = `是否启用${row.name}该教材`;
+      }
+      this.$confirm(str, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            const res = await enableSysMusicScore({ categoriesId: row.id });
+            if (row.enable) {
+              this.$message.success("停用成功");
+            } else {
+              this.$message.success("启用成功");
+            }
+
+            this.getList();
+          } catch (e) {
+            console.log(e);
+          }
+        })
+        .catch((e) => {
+          console.log(e);
+        });
+    },
+    async removeTeach(row) {
+      this.$confirm(`是否删除${row.name}`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            const res = await removeSysMusicScore({ id: row.id });
+            this.$message.success("删除成功");
+            this.getList();
+          } catch (e) {
+            console.log(e);
+          }
+        })
+        .catch((e) => {
+          console.log(e);
+        });
+    },
+    lookMusic(row) {
+      this.$router.push({
+        name: "accompaniment",
+        params: { categoriesId: row.id },
+      });
+    },
+  },
+};
+</script>
+<style lang='scss' scoped>
+.btnList {
+  margin-bottom: 20px;
+}
+</style>