Przeglądaj źródła

课堂分类重粉导出

yh 1 dzień temu
rodzic
commit
365d4ecca1

+ 10 - 1
src/api/course/userCourseCategory.js

@@ -52,6 +52,15 @@ export function exportUserCourseCategory(query) {
   })
   })
 }
 }
 
 
+// 导出重粉
+export function exportFans(query) {
+  return request({
+    url: '/course/userCourseCategory/exportFans',
+    method: 'post',
+    data: query
+  })
+}
+
 // 查询分类父列表
 // 查询分类父列表
 export function getAllCourseCategoryList() {
 export function getAllCourseCategoryList() {
   return request({
   return request({
@@ -73,4 +82,4 @@ export function getCateListByPid(pid) {
     url: '/course/userCourseCategory/getCateListByPid/' + pid,
     url: '/course/userCourseCategory/getCateListByPid/' + pid,
     method: 'get'
     method: 'get'
   })
   })
-}
+}

+ 53 - 1
src/views/course/userCourseCategory/index.vue

@@ -70,6 +70,18 @@
           v-hasPermi="['course:userCourseCategory:export']"
           v-hasPermi="['course:userCourseCategory:export']"
         >导出</el-button>
         >导出</el-button>
       </el-col>
       </el-col>
+
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleFansExport"
+          v-hasPermi="['course:userCourseCategory:fansExport']"
+        >重粉导出</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     </el-row>
 
 
@@ -79,7 +91,9 @@
       :data="userCourseCategoryList"
       :data="userCourseCategoryList"
       row-key="cateId"
       row-key="cateId"
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    @selection-change="handleSelectionChange"
     >
     >
+      <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="分类id" align="left" prop="cateId" />
       <el-table-column label="分类id" align="left" prop="cateId" />
       <el-table-column label="分类名称" align="left" prop="cateName" />
       <el-table-column label="分类名称" align="left" prop="cateName" />
       <el-table-column  label="状态" align="center" prop="isShow">
       <el-table-column  label="状态" align="center" prop="isShow">
@@ -149,7 +163,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { listUserCourseCategory, getUserCourseCategory, delUserCourseCategory, addUserCourseCategory, updateUserCourseCategory, exportUserCourseCategory } from "@/api/course/userCourseCategory";
+import { listUserCourseCategory, getUserCourseCategory, delUserCourseCategory, addUserCourseCategory, updateUserCourseCategory, exportUserCourseCategory, exportFans } from "@/api/course/userCourseCategory";
 import Treeselect from "@riophae/vue-treeselect";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 export default {
 export default {
@@ -273,6 +287,8 @@ export default {
       this.ids = selection.map(item => item.cateId)
       this.ids = selection.map(item => item.cateId)
       this.single = selection.length!==1
       this.single = selection.length!==1
       this.multiple = !selection.length
       this.multiple = !selection.length
+
+      console.log("selection",  selection);
     },
     },
     /** 新增按钮操作 */
     /** 新增按钮操作 */
     handleAdd() {
     handleAdd() {
@@ -341,7 +357,43 @@ export default {
           this.download(response.msg);
           this.download(response.msg);
           this.exportLoading = false;
           this.exportLoading = false;
         }).catch(() => {});
         }).catch(() => {});
+    },
+    handleFansExport() {
+      if (!Array.isArray(this.ids) || this.ids.length === 0) {
+        this.$message.warning('请先选择至少一条数据');
+        return;
+      }
+
+      const params = { ids: this.ids };
+
+      this.$confirm('是否确认导出重粉?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const loading = this.$loading({
+          lock: true,
+          text: '正在导出数据,请稍候...',
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.3)'
+        });
+
+        return exportFans(params)
+          .then(res => {
+            if (res.code !== 200){
+              this.$message.warning(res.msg);
+              return;
+            }
+
+            this.download(res.msg);
+          })
+
+          .finally(() => {
+            loading.close();
+          });
+      });
     }
     }
+
   }
   }
 };
 };
 </script>
 </script>