Browse Source

清除记录与0元课程

1
mo 2 years ago
parent
commit
9256907c69

+ 10 - 0
src/views/reportForm/api.js

@@ -11,3 +11,13 @@ export function managerDownloadList(data) {
     params: data
   })
 }
+
+// 清除下载记录
+export function managerDownloadRecord(data) {
+  return request2({
+    url: api + '/managerDownload/batchDel',
+    method: 'post',
+    data: data,
+    requestType:'form'
+  })
+}

+ 119 - 20
src/views/reportForm/downList.vue

@@ -6,37 +6,50 @@
       下载列表
     </h2>
     <div class="m-core">
-      <save-form :inline="true" class="searchForm" :model="searchForm" @submit="search" @reset='onReSet'>
+      <save-form
+        :inline="true"
+        class="searchForm"
+        :model="searchForm"
+        @submit="search"
+        @reset="onReSet"
+      >
         <el-form-item prop="type">
           <!-- downTypeList -->
-           <el-form-item>
-          <el-select
-            v-model.trim="searchForm.type"
-            clearable
-            filterable
-            placeholder="文件搜索类型"
-          >
-            <el-option
-              v-for="(item, index) in downTypeList"
-              :key="index"
-              :value="item.value"
-              :label="item.label"
-            ></el-option>
-          </el-select>
-        </el-form-item>
+          <el-form-item>
+            <el-select
+              v-model.trim="searchForm.type"
+              clearable
+              filterable
+              placeholder="文件搜索类型"
+            >
+              <el-option
+                v-for="(item, index) in downTypeList"
+                :key="index"
+                :value="item.value"
+                :label="item.label"
+              ></el-option>
+            </el-select>
+          </el-form-item>
         </el-form-item>
 
         <el-form-item>
           <el-button native-type="submit" type="primary">搜索</el-button>
           <el-button native-type="reset" type="danger">重置</el-button>
+          <auth auths="managerDownload/batchDel" style="margin-left:10px;">
+            <el-button type="primary" @click="clearRecord">清除记录</el-button>
+          </auth>
         </el-form-item>
       </save-form>
       <div class="tableWrap">
         <el-table
           style="width: 100%"
+          ref="tableList"
           :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
           :data="tableList"
+          @selection-change="handleSelectionChange"
+          @select="onTableSelect"
         >
+          <el-table-column type="selection" width="55"></el-table-column>
           <el-table-column
             width="120"
             align="center"
@@ -51,7 +64,7 @@
           <el-table-column align="center" prop="type" label="文件类型">
             <template slot-scope="scope">
               <div>
-                {{ scope.row.type |downListType }}
+                {{ scope.row.type | downListType }}
               </div>
             </template>
           </el-table-column>
@@ -103,8 +116,8 @@ import axios from "axios";
 import { getToken } from "@/utils/auth";
 import pagination from "@/components/Pagination/index";
 import load from "@/utils/loading";
-import {downTypeList} from "@/utils/searchArray"
-import { managerDownloadList } from "./api";
+import { downTypeList } from "@/utils/searchArray";
+import { managerDownloadList, managerDownloadRecord } from "./api";
 export default {
   components: { pagination },
   data() {
@@ -122,6 +135,7 @@ export default {
         total: 0, // 总条数
         page_size: [10, 20, 40, 50], // 选择限制显示条数
       },
+      deleteList: [],
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -145,6 +159,19 @@ export default {
         });
         this.tableList = res.data.rows;
         this.rules.total = res.data.total;
+
+        let idList = this.deleteList.map((course) => {
+          return course.id;
+        });
+        this.$nextTick(() => {
+          this.tableList.forEach((course) => {
+            if (idList.indexOf(course.id) != -1) {
+              console.log(course.id);
+              this.$refs.tableList.toggleRowSelection(course, true);
+            }
+          });
+          this.isDetele = false;
+        });
       } catch (e) {
         console.log(e);
       }
@@ -155,7 +182,79 @@ export default {
     },
     onReSet() {
       this.searchForm.type = null;
-      this.search()
+      this.clearCom();
+      this.search();
+    },
+    handleSelectionChange(arr) {
+      // this.deleteList = arr;
+      if (arr.length > 0) {
+        // 有可能加 有可能减
+        this.deleteList = this.deleteList.concat(arr);
+        // 去重
+        this.deleteList = this.$helpers.lodash.uniqBy(this.deleteList, "id");
+      }
+      // else if(){}
+      else {
+        if (this.isDetele) return;
+        // 有2种 1是新页
+        // 2是点击反选
+        let idList = this.deleteList.map((course) => {
+          return course.id;
+        });
+        this.$nextTick(() => {
+          let tableIdList = [];
+          this.tableList.forEach((course) => {
+            tableIdList.push(course.id);
+            if (idList.indexOf(course.id) != -1) {
+              this.$refs.tableList.toggleRowSelection(course, false);
+              // 删除这个元素
+            }
+          });
+          this.deleteList = this.$helpers.lodash.remove(
+            this.deleteList,
+            function (item) {
+              return tableIdList.indexOf(item.id) == -1;
+            }
+          );
+          if (this.deleteList.length <= 0) {
+            this.clearCom();
+          }
+        });
+      }
+    },
+    onTableSelect(rows, row) {
+      let idList = this.deleteList.map((course) => {
+        return course.id;
+      });
+      if (idList.indexOf(row.id) != -1) {
+        this.deleteList.splice(idList.indexOf(row.id), 1);
+        if (this.deleteList.length <= 0) {
+          this.clearCom();
+        }
+      }
+    },
+    clearCom() {
+      // this.deleteList = [];
+      this.$set(this, "deleteList", []);
+      this.$refs.tableList.clearSelection();
+      // this.$refs.addCompound.isLook = false;
+    },
+    async clearRecord() {
+      if (this.deleteList.length <= 0) {
+        this.$message.error("请至少勾选一条记录");
+        return;
+      }
+      try {
+        let idList = this.deleteList.map((course) => {
+          return course.id;
+        });
+        const res = await managerDownloadRecord({ ids: idList.join(",") });
+        this.$message.success("清除成功");
+        this.clearCom();
+        this.getList();
+      } catch (e) {
+        console.log(e);
+      }
     },
   },
 };

+ 8 - 5
src/views/reportForm/index.vue

@@ -452,11 +452,12 @@
           </div>
           <div class="m-wrap" v-permission="'export/exportIndexErrData'">
             <div class="title">异常处理数据导出:</div>
-            <el-select
+            <select-all
               clearable
               filterable
               class="organSelect"
-              v-model="Abnormal.organId"
+              v-model="Abnormal.organIds"
+              multiple
               placeholder="请选择分部"
             >
               <el-option
@@ -465,7 +466,7 @@
                 :label="item.name"
                 :value="item.id + ''"
               ></el-option>
-            </el-select>
+            </select-all>
 
             <!-- <el-button
               type="primary"
@@ -895,7 +896,7 @@ export default {
       serviceOrganId: [], // 服务报表
       serviceTimer: [],
       Abnormal: {
-        organId: null,
+        organIds: [],
       },
       activeName: ["1", "2", "3", "4"],
       vipStudentCourseOrganId: [],
@@ -1720,7 +1721,9 @@ export default {
     },
     exportAbnormal() {
       console.log(this.Abnormal);
-      return this.Abnormal;
+      return {
+        organIds:this.Abnormal.organIds.join(',')
+      };
     },
     exportSalar() {
       // if (!this.mouth) {

+ 6 - 2
src/views/resetTeaming/components/payInfoDetail.vue

@@ -267,11 +267,14 @@
               </el-row>
             </div>
           </el-form>
-          <div v-if="!teamCourse && !member && !leBao && !teamActive">
+          <!-- <div v-if="!teamCourse && !member && !leBao && !teamActive">
             <empty desc="暂无缴费项目配置" />
           </div>
           <div v-else style="text-align: center">
             <el-button class="submitBtn" @click="submitForm">确认</el-button>
+          </div> -->
+           <div  style="text-align: center">
+            <el-button class="submitBtn" @click="submitForm">确认</el-button>
           </div>
         </div>
       </div>
@@ -434,7 +437,8 @@ export default {
       ) {
         // 课程团的创建缴费
         this.teamCourse = true;
-        this.teamCourseDisabled = true;
+        // 现在课程团不在
+        // this.teamCourseDisabled = true;
         this.form.paymentType = "MUSIC_APPLY";
       } else if (
         this.courseViewType == 2 &&