瀏覽代碼

提交一下 多选加全选

1
mo 4 年之前
父節點
當前提交
aa88a38472
共有 3 個文件被更改,包括 156 次插入104 次删除
  1. 1 1
      src/components/filter-search/index.vue
  2. 0 1
      src/components/install.js
  3. 155 102
      src/views/main/abnormal/index.vue

+ 1 - 1
src/components/filter-search/index.vue

@@ -38,7 +38,7 @@ for (const key in errorType) {
   }
 }
 
-console.log(typesByUrl)
+// console.log(typesByUrl)
 
 export default {
   name: 'filter-search',

+ 0 - 1
src/components/install.js

@@ -18,7 +18,6 @@ import autoHeight from '@/components/auto-height'
 import auth from '@/components/Auth'
 import filterSearch from '@/components/filter-search'
 import singeFileUpload from '@/components/singe-file-upload'
-
 export default {
   install(Vue) {
     Vue.component(saveform.name, saveform)

+ 155 - 102
src/views/main/abnormal/index.vue

@@ -1,6 +1,12 @@
 <template>
   <div class="container">
-    <save-form inline :model="search" @submit="FetchList" @reset="reset" saveKey="/main/main/abnormal">
+    <save-form
+      inline
+      :model="search"
+      @submit="FetchList"
+      @reset="reset"
+      saveKey="/main/main/abnormal"
+    >
       <el-form-item prop="organId">
         <el-select
           clearable
@@ -8,14 +14,17 @@
           v-model="search.organId"
           placeholder="请选择分部"
         >
-          <el-option v-for="(item,index) in selects.branchs"
+          <el-option
+            v-for="(item, index) in selects.branchs"
             :key="index"
             :label="item.name"
-            :value="item.id"></el-option>
+            :value="item.id"
+          ></el-option>
         </el-select>
       </el-form-item>
       <el-button native-type="submit" type="primary">搜索</el-button>
       <el-button native-type="reset" type="danger">重置</el-button>
+      <el-button type="primary" @click="exportAbnormal">导出</el-button>
     </save-form>
     <div class="tags">
       <el-badge
@@ -27,23 +36,40 @@
         <el-tag
           :effect="activeKey === item ? 'dark' : 'plain'"
           @click="changeTag(item)"
-        >{{keyNames[item].name}}</el-tag>
+          >{{ keyNames[item].name }}</el-tag
+        >
       </el-badge>
     </div>
-    <empty desc="暂无需要处理异常" v-if="!activeList.length"/>
-    <el-button @click="handle(item)"
-      style="width: 100%;color: #303133;margin-left: 0;"
+    <empty desc="暂无需要处理异常" v-if="!activeList.length" />
+    <el-button
+      @click="handle(item)"
+      style="width: 100%; color: #303133; margin-left: 0"
       v-else
       v-for="(item, index) in activeList"
       :key="index"
-      :disabled="(item[0].result && !item[0].result.length) || (!item[0].num)" type="text"
+      :disabled="(item[0].result && !item[0].result.length) || !item[0].num"
+      type="text"
     >
       <title-item
         :type="item[0].isError ? 'error' : 'warning'"
-        :data="item.map(title => ({name: title.desc, num: title.num, num2: title.num2, errorType:title.errorType}))"
+        :data="
+          item.map((title) => ({
+            name: title.desc,
+            num: title.num,
+            num2: title.num2,
+            errorType: title.errorType,
+          }))
+        "
       >
-        <span style="color: #14928A;" v-if='!errorType[item[0].errorType] || (errorType[item[0].errorType] && permission(errorType[item[0].errorType].permission))'>
-            立即处理<i class="el-icon-d-arrow-right"/>
+        <span
+          style="color: #14928a"
+          v-if="
+            !errorType[item[0].errorType] ||
+            (errorType[item[0].errorType] &&
+              permission(errorType[item[0].errorType].permission))
+          "
+        >
+          立即处理<i class="el-icon-d-arrow-right" />
         </span>
       </title-item>
     </el-button>
@@ -71,96 +97,110 @@
   </div>
 </template>
 <script>
-import { Searchs } from '@/helpers'
-import { getIndexError } from '@/views/main/api'
-import { createNotification } from '@/helpers/notification'
-import { errorType } from '@/views/main/constant'
-import { permission } from '@/utils/directivePage'
-import title from './title'
+import { Searchs } from "@/helpers";
+import { getIndexError } from "@/views/main/api";
+import { createNotification } from "@/helpers/notification";
+import { errorType } from "@/views/main/constant";
+import { permission } from "@/utils/directivePage";
+import title from "./title";
+import{Export}  from "@/utils/downLoadFile";
 const initSearch = {
-  organId: null
-}
+  organId: null,
+};
 export default {
   components: {
-    'title-item': title
+    "title-item": title,
   },
   data() {
     return {
       search: {
-        ...initSearch
+        ...initSearch,
       },
       listByType: {},
       infoByType: {},
       list: [],
-      errorType: errorType
-    }
+      errorType: errorType,
+    };
   },
   computed: {
     keyNames() {
-      const { status } = this.$store.state.app
+      const { status } = this.$store.state.app;
       return {
         MUSIC_PATROL: {
-          name: '乐团巡查',
+          name: "乐团巡查",
           num: status.musicPatrol || false,
         },
         STUDENT_INFO: {
-          name: '学员处理',
+          name: "学员处理",
           num: status.studentInfo || false,
         },
         TEACHER_INFO: {
-          name: '日常行政',
+          name: "日常行政",
           num: status.teacherInfo || false,
         },
-        ATTENDANCE_SERVE:{
-          name:'考勤及服务',
+        ATTENDANCE_SERVE: {
+          name: "考勤及服务",
           num: status.attendanceServe || false,
-        }
-      }
+        },
+      };
     },
     permissionTags() {
-      const url = 'getIndexErrData?errorType='
-      const permissions = ['MUSIC_PATROL', 'STUDENT_INFO', 'TEACHER_INFO','ATTENDANCE_SERVE']
-      return permissions.filter(item => {
-        return this.permission(url + item)
-      })
+      const url = "getIndexErrData?errorType=";
+      const permissions = [
+        "MUSIC_PATROL",
+        "STUDENT_INFO",
+        "TEACHER_INFO",
+        "ATTENDANCE_SERVE",
+      ];
+      return permissions.filter((item) => {
+        return this.permission(url + item);
+      });
     },
     activeKey() {
-      let key = ''
-      const { tag } = this.$route.query
+      let key = "";
+      const { tag } = this.$route.query;
       if (tag) {
-        key = tag
+        key = tag;
       } else if (this.permissionTags[0]) {
-        key = this.permissionTags[0]
+        key = this.permissionTags[0];
       }
-      return key
+      return key;
     },
     tags() {
-      const tags = this.list.map(item => ({name: item.desc, type: item.errorType, num: item.num}))
-      return tags
+      const tags = this.list.map((item) => ({
+        name: item.desc,
+        type: item.errorType,
+        num: item.num,
+      }));
+      return tags;
     },
     activeList() {
-
-      const list = this.listByType[this.activeKey] || []
-      return list
+      const list = this.listByType[this.activeKey] || [];
+      return list;
     },
   },
   mounted() {
-    this.FetchList()
-    this.$store.dispatch('setBranchs')
+    this.FetchList();
+    this.$store.dispatch("setBranchs");
   },
   methods: {
     permission,
     handle(item) {
       // 添加判断权限
-      if(errorType[item[0].errorType] && !this.permission(errorType[item[0].errorType].permission)) {
-        return
+      if (
+        errorType[item[0].errorType] &&
+        !this.permission(errorType[item[0].errorType].permission)
+      ) {
+        return;
       }
 
       // 单独对未缴费学员数
-      if(item[0].errorType == 'STUDENT_NOT_PAYMENT') {
-        item[0].query['result'] = item[0].result ? (item[0].result || []).join(',') : undefined
+      if (item[0].errorType == "STUDENT_NOT_PAYMENT") {
+        item[0].query["result"] = item[0].result
+          ? (item[0].result || []).join(",")
+          : undefined;
       }
-      new Searchs().removeByKey(item[0].url)
+      new Searchs().removeByKey(item[0].url);
       this.$router.push({
         path: item[0].url,
         query: {
@@ -168,85 +208,98 @@ export default {
           tag: this.$route.query.tag,
           filter_type: item[0].errorType,
           organId: this.search.organId || undefined,
-          [item[0].resultKey]: item[0].resultKey ? (item[0].result || []).join(',') : undefined
-        }
-      })
+          [item[0].resultKey]: item[0].resultKey
+            ? (item[0].result || []).join(",")
+            : undefined,
+        },
+      });
     },
     changeTag(type) {
       this.$router.replace({
         query: {
           ...this.$route.query,
-          tag: type
-        }
-      })
-      this.FetchList()
+          tag: type,
+        },
+      });
+      this.FetchList();
     },
     formatData(data) {
-      const list = {}
+      const list = {};
       for (const item of data) {
-        const row = errorType[item.errorType] || {}
-        const key = row.parent || item.errorType
+        const row = errorType[item.errorType] || {};
+        const key = row.parent || item.errorType;
         if (!list[key]) {
-          list[key] = []
+          list[key] = [];
         }
-        list[key].push(
-          {
-            ...item,
-            ...row,
-          }
-        )
-
+        list[key].push({
+          ...item,
+          ...row,
+        });
       }
-      return Object.values(list)
+      return Object.values(list);
     },
     async FetchList() {
       try {
         const res = await getIndexError({
           errorType: this.activeKey,
           ...this.search,
-        })
-        this.list = res.data.data
-        const data = {}
-        const info = {}
+        });
+        this.list = res.data.data;
+        const data = {};
+        const info = {};
         for (const item of this.list) {
-          info[item.errorType] = item
-          data[item.errorType] = this.formatData(item?.result || [])
+          info[item.errorType] = item;
+          data[item.errorType] = this.formatData(item?.result || []);
         }
-        this.infoByType = info
-        this.listByType = data
+        this.infoByType = info;
+        this.listByType = data;
       } catch (error) {}
     },
     reset() {
-      this.search = {...initSearch}
-      this.FetchList()
+      this.search = { ...initSearch };
+      this.FetchList();
     },
     send() {
       createNotification({
-        title: '测试发送通知',
-        body: '您有一条待处理通知,请及时处理',
+        title: "测试发送通知",
+        body: "您有一条待处理通知,请及时处理",
         onClick: () => {
-          this.$router.replace('/main/main')
-        }
-      })
-    }
-  }
-}
+          this.$router.replace("/main/main");
+        },
+      });
+    },
+    exportAbnormal() {
+      let params = this.search;
+      Export(
+        this,
+        {
+          method: "post",
+          url: "/api-web/export/exportIndexErrData",
+          params: this.$helpers.qs.stringify({
+            ...params
+          }),
+        },
+        "是否确认导出报表?"
+      );
+    },
+  },
+};
 </script>
 <style lang="less" scoped>
-  .tags{
-    margin-bottom: 20px;
-    >div{
-      margin-right: 20px;
-      cursor: pointer;
-    }
+.tags {
+  margin-bottom: 20px;
+  > div {
+    margin-right: 20px;
+    cursor: pointer;
   }
-  .container{
-    /deep/ .is-disabled {
-      .title{
-        >span{
-          color: #C0C4CC!important;
-        }
+}
+.container {
+  /deep/ .is-disabled {
+    .title {
+      > span {
+        color: #c0c4cc !important;
       }
     }
   }
+}
 </style>