wolyshaw 4 سال پیش
والد
کامیت
4d45610131

+ 60 - 29
src/views/main/abnormal/index.vue

@@ -19,34 +19,26 @@
       <el-button native-type="reset" type="danger">重置</el-button>
     </save-form>
     <div class="tags">
-      <el-tag v-for="(item, index) in tags" :key="index">{{item.name}}</el-tag>
+      <el-badge
+        :hidden="listByType[item.type].length === 0"
+        :value="listByType[item.type].length"
+        :max="99"
+        v-for="(item, index) in tags"
+        :key="index"
+      >
+        <el-tag
+          :effect="activeKey === item.type ? 'dark' : 'plain'"
+          @click="activeKey = item.type"
+        >{{item.name}}</el-tag>
+      </el-badge>
     </div>
+    <empty desc="暂无需要处理异常" v-if="!activeList.length"/>
     <title-item
-      type="error"
-      :data="[
-        {
-          name: '老师考勤异常',
-          num: 1
-        },
-        {
-          name: '未签到签退',
-          num: 3
-        }
-      ]"
-    >
-      <el-button type="text">立即处理<i class="el-icon-d-arrow-right"/></el-button>
-    </title-item>
-    <title-item
-      :data="[
-        {
-          name: '老师请假',
-          num: 1
-        },
-        {
-          name: '学生请假',
-          num: 3
-        }
-      ]"
+      v-else
+      :type="item[0].isError ? 'error' : 'warning'"
+      v-for="(item, index) in activeList"
+      :key="index"
+      :data="item.map(title => ({name: title.desc, num: title.num}))"
     >
       <el-button type="text">立即处理<i class="el-icon-d-arrow-right"/></el-button>
     </title-item>
@@ -55,6 +47,7 @@
 <script>
 import { getIndexError } from '@/views/main/api'
 import { createNotification } from '@/helpers/notification'
+import { errorType } from '@/views/main/constant'
 import title from './title'
 export default {
   components: {
@@ -62,22 +55,49 @@ export default {
   },
   data() {
     return {
+      activeKey: '',
       search: {
         organIds: []
       },
+      listByType: {},
       list: [],
     }
   },
   computed: {
     tags() {
-      return this.list.map(item => ({name: item.desc, type: item.errorType}))
-    }
+      const tags = this.list.map(item => ({name: item.desc, type: item.errorType}))
+      if (tags.length && !this.activeKey) {
+        this.activeKey = tags[0].type
+      }
+      return tags
+    },
+    activeList() {
+      const list = this.listByType[this.activeKey] || []
+      return list
+    },
   },
   mounted() {
     this.FetchList()
     this.$store.dispatch('setBranchs')
   },
   methods: {
+    formatData(data) {
+      const list = {}
+      for (const item of data) {
+        const row = errorType[item.errorType] || {}
+        const key = row.parent || item.errorType
+        if (!list[key]) {
+          list[key] = []
+        }
+        list[key].push(
+          {
+            ...item,
+            isError: row.isError
+          }
+        )
+      }
+      return Object.values(list)
+    },
     async FetchList() {
       try {
         const res = await getIndexError({
@@ -85,6 +105,11 @@ export default {
           organIds: this.search.organIds.join(',')
         })
         this.list = res.data.data
+        const data = {}
+        for (const item of this.list) {
+          data[item.errorType] = this.formatData(item?.result || [])
+        }
+        this.listByType = data
       } catch (error) {}
     },
     send() {
@@ -100,5 +125,11 @@ export default {
 }
 </script>
 <style lang="less" scoped>
-
+  .tags{
+    margin-bottom: 20px;
+    >div{
+      margin-right: 20px;
+      cursor: pointer;
+    }
+  }
 </style>

+ 42 - 0
src/views/main/api.js

@@ -18,6 +18,13 @@ export const getIndexError = data => request2({
   method: 'get',
 })
 
+// 获取事项提醒
+export const getRemindMatterData = data => request2({
+  url: '/api-web/getRemindMatterData',
+  params: data,
+  method: 'get',
+})
+
 // 处理乐团主管日程安排
 export const resetInspectionItem = data => request2({
   url: '/api-web/inspectionItem/update',
@@ -25,3 +32,38 @@ export const resetInspectionItem = data => request2({
   method: 'post',
   requestType:'form'
 })
+
+// 添加巡查任务
+export const inspectionAdd = data => request2({
+  url: '/api-web/inspection/add',
+  data: data,
+  method: 'post',
+})
+
+// 删除巡查任务
+export const inspectionDelete = data => request2({
+  url: '/api-web/inspection/delete',
+  params: data,
+  method: 'post',
+})
+
+// 查看巡查任务详情
+export const inspectionGetInfo = data => request2({
+  url: '/api-web/inspection/getInfo',
+  params: data,
+  method: 'get',
+})
+
+// 巡查任务列表
+export const inspectionQueryPage = data => request2({
+  url: '/api-web/inspection/queryPage',
+  data: data,
+  method: 'get',
+})
+
+// 修改巡查任务
+export const inspectionUpdate = data => request2({
+  url: '/api-web/inspection/update',
+  data: data,
+  method: 'post',
+})

+ 1 - 0
src/views/main/baseinfo/index.vue

@@ -5,6 +5,7 @@
         <el-date-picker
           v-model="search.year"
           type="year"
+          format="yyyy年"
           :picker-options="{
             disabledDate(time) {
               return time.getTime() > Date.now()

+ 43 - 0
src/views/main/constant.js

@@ -23,3 +23,46 @@ export const descs = {
   VIP_GROUP_COURSE: '本年度截止到当月VIP课【已完成】+【未开始】总数',
   PRACTICE_GROUP_COURSE: '本年度截止到当月网管课【已完成】+【未开始】总数',
 }
+
+export const errorType = {
+  MUSIC_PATROL_ITEM: {
+    isError: false,
+  },
+  HIGH_CLASS_STUDENT_LESS_THAN_THREE: {
+    isError: true,
+  },
+  STUDENT_NOT_PAYMENT: {
+    isError: true,
+  },
+  STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP: {
+    isError: true
+  },
+  WAIT_CREATE_PAYMENT_CALENDER: {
+    isError: true
+  },
+  COURSE_TRUANT_STUDENT_NUM: {
+    isError: true
+  },
+  COURSE_LEAVE_STUDENT_NUM: {
+    isError: true,
+    parent: 'COURSE_TRUANT_STUDENT_NUM'
+  },
+  TEACHER_EXCEPTION_ATTENDANCE: {
+    isError: true
+  },
+  TEACHER_NOT_A_CLASS: {
+    isError: true,
+    parent: 'TEACHER_EXCEPTION_ATTENDANCE'
+  },
+  TEACHER_LEAVE: {
+    isError: false
+  },
+  TEACHER_EXPECT_SALARY_BE_LOW: {
+    isError: false
+  },
+}
+
+export const matterTypes = {
+  INSPECT: '下校巡查',
+  VISIT: '学员回访',
+}

+ 5 - 0
src/views/main/index.vue

@@ -11,6 +11,9 @@
         <el-tab-pane lazy label="异常处理" name="abnormal">
           <abnormal/>
         </el-tab-pane>
+        <el-tab-pane lazy label="事项提醒" name="reminders">
+          <reminders/>
+        </el-tab-pane>
         <el-tab-pane lazy label="【乐团主管】日程安排" name="teamSchedule">
           <teamSchedule />
         </el-tab-pane>
@@ -26,6 +29,7 @@ import baseinfo from './baseinfo'
 import abnormal from './abnormal'
 import teamSchedule from './teamSchedule'
 import ScheduleBranch from './schedule-branch'
+import reminders from './reminders'
 export default {
   name: 'Main',
   components: {
@@ -33,6 +37,7 @@ export default {
     abnormal,
     teamSchedule,
     ScheduleBranch,
+    reminders,
   },
 }
 </script>

+ 65 - 0
src/views/main/reminders/index.vue

@@ -0,0 +1,65 @@
+<template>
+  <div>
+    <save-form inline :model="search" @submit="FetchList" @reset="FetchList">
+      <el-form-item prop="organIds">
+        <el-select
+          multiple
+          clearable
+          filterable
+          collapse-tags
+          v-model="search.organIds"
+        >
+          <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-button native-type="submit" type="primary">搜索</el-button>
+      <el-button native-type="reset" type="danger">重置</el-button>
+    </save-form>
+    <empty desc="暂无需要处理异常" v-if="!list.length"/>
+    <title-item
+      v-else
+      type="warning"
+      v-for="(item, index) in list"
+      :key="index"
+      :data="[{name: item.desc, num: item.num}]"
+    >
+      <el-button @click="$router.push({
+        path: '/business/teamDetail',
+        query: {
+          search: (item.result || []).join(',')
+        }
+      })" type="text">立即处理<i class="el-icon-d-arrow-right"/></el-button>
+    </title-item>
+  </div>
+</template>
+<script>
+import { getRemindMatterData } from '@/views/main/api'
+import title from '../abnormal/title'
+export default {
+  components: {
+    'title-item': title
+  },
+  data() {
+    return {
+      search: {
+        organIds: []
+      },
+      list: [],
+    }
+  },
+  mounted() {
+    this.FetchList()
+  },
+  methods: {
+    async FetchList() {
+      try {
+        const res = await getRemindMatterData()
+        this.list = res.data
+      } catch (error) {}
+    }
+  }
+}
+</script>

+ 91 - 12
src/views/main/schedule-branch/index.vue

@@ -48,59 +48,111 @@
     >
       <el-table-column
         label="分部"
-        prop="分部"
+        prop="organName"
       ></el-table-column>
       <el-table-column
         label="工作周期"
-        prop="工作周期"
-      ></el-table-column>
+        prop="month"
+      >
+        <span slot-scope="scope">{{$helpers.dayjs(scope.row.month).format('YYYY-MM')}}</span>
+      </el-table-column>
       <el-table-column
         label="乐团主管"
-        prop="乐团主管"
+        prop="userName"
       ></el-table-column>
       <el-table-column
         label="任务事项数量"
-        prop="任务事项数量"
+        prop="itemNum"
       ></el-table-column>
       <el-table-column
         label="任务总次数"
-        prop="任务总次数"
+        prop="times"
       ></el-table-column>
       <el-table-column
         label="操作"
         prop="操作"
       >
         <template slot-scope="scope">
-          <el-button type="text">查看</el-button>
-          <el-button type="text">修改任务</el-button>
-          <el-button type="text">删除</el-button>
+          <el-button type="text" @click="view(scope.row)">查看</el-button>
+          <el-button type="text" @click="edit(scope.row)">修改任务</el-button>
+          <el-button type="text" @click="remove(scope.row.id)">删除</el-button>
         </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="FetchList"
+    />
     <el-dialog
       :visible.sync="visible"
       title="创建任务"
       width="800px"
     >
-      <create/>
+      <create
+        v-if="visible"
+        @close="visible = false"
+        @submited="FetchList"
+      />
+    </el-dialog>
+    <el-dialog
+      :visible.sync="editVisible"
+      title="修改任务"
+      width="800px"
+    >
+      <create
+        v-if="editVisible && detail"
+        :id="detail.id"
+        @close="editVisible = false"
+        @submited="FetchList"
+      />
+    </el-dialog>
+    <el-dialog
+      :visible.sync="viewVisible"
+      title="查看任务"
+      width="800px"
+    >
+      <view-detail
+        v-if="viewVisible && detail"
+        :id="detail.id"
+        @close="viewVisible = false"
+        @submited="FetchList"
+      />
     </el-dialog>
   </div>
 </template>
 <script>
+import pagination from "@/components/Pagination/index";
+import { inspectionQueryPage, inspectionDelete } from '@/views/main/api'
 import create from './modals/create'
+import view from './modals/view'
+import View from './modals/view.vue';
 const initSearch = {
   organIds: [],
   month: '',
 }
 export default {
   components: {
-    create
+    create,
+    'view-detail': view,
+    pagination,
   },
   data() {
     return {
       search: {...initSearch},
       list: [],
       visible: false,
+      viewVisible: false,
+      editVisible: false,
+      detail: null,
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
+      },
     }
   },
   mounted() {
@@ -113,12 +165,39 @@ export default {
       this.FetchList()
     },
     reset() {
+      this.rules.page = 1
       this.search = {...initSearch}
       this.FetchList()
     },
+    view(row) {
+      this.viewVisible = true
+      this.detail = row
+    },
+    edit(row) {
+      this.editVisible = true
+      this.detail = row
+    },
+    async remove(id) {
+      try {
+        await this.$confirm('是否确认删除此条数据?', '提示', {
+          type: 'warning'
+        })
+        await inspectionDelete({
+          id
+        })
+        this.$message.success('删除成功')
+        this.FetchList()
+      } catch (error) {}
+    },
     async FetchList() {
       try {
-
+        const res = await inspectionQueryPage({
+          ...this.search,
+          page: this.rules.page,
+          rows: this.rules.limit,
+        })
+        this.list = res.data.rows
+        this.rules.total = res.data.total
       } catch (error) {}
     }
   }

+ 86 - 30
src/views/main/schedule-branch/modals/create.vue

@@ -39,57 +39,48 @@
         <el-col :span="6">
           <el-form-item
             label="乐团主管"
-            :prop="`group.${groupIndex}.zhuguan`"
+            :prop="`group.${groupIndex}.userId`"
             :rules="[{required: true, message: '请选择乐团主管'}]"
           >
             <el-select
               clearable
               filterable
-              v-model="groupItem.zhuguan"
-              placeholder="请选择分部"
+              v-model="groupItem.userId"
+              placeholder="请选择乐团主管"
             >
-              <el-option v-for="(item,index) in selects.branchs"
+              <el-option v-for="(item,index) in technicians"
                 :key="index"
-                :label="item.name"
-                :value="item.id"></el-option>
+                :label="item.realName"
+                :value="item.userId"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <template v-for="(matterItem, matterIndex) in groupItem.matter">
           <el-col :offset="matterIndex === 0 ? 0 : 6" :span="6" :key="groupIndex + '-' + matterIndex">
+            {{groupIndex + '-' + matterIndex}}
             <el-form-item
               :label="'任务事项' + (matterIndex + 1)"
-              :prop="`group.${groupIndex}.matter.${matterIndex}.type`"
+              :prop="`group.${groupIndex}.matter.${matterIndex}.item`"
             >
               <el-select
                 clearable
                 filterable
-                v-model="matterItem.type"
+                v-model="matterItem.item"
                 placeholder="请选择任务事项"
               >
-                <el-option v-for="(item,index) in selects.branchs"
+                <el-option v-for="(item,index) in matterTypesOptions"
                   :key="index"
-                  :label="item.name"
-                  :value="item.id"></el-option>
+                  :label="item.label"
+                  :value="item.value"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="6" :key="groupIndex + '-' + matterIndex">
             <el-form-item
               :label="'任务次数' + (matterIndex + 1)"
-              :prop="`group.${groupIndex}.matter.${matterIndex}.num`"
+              :prop="`group.${groupIndex}.matter.${matterIndex}.times`"
             >
-              <el-select
-                clearable
-                filterable
-                v-model="matterItem.num"
-                placeholder="请输入次数"
-              >
-                <el-option v-for="(item,index) in selects.branchs"
-                  :key="index"
-                  :label="item.name"
-                  :value="item.id"></el-option>
-              </el-select>
+              <el-input clearable v-model="matterItem.times" placeholder="请输入次数" />
             </el-form-item>
           </el-col>
           <el-col :span="6" :key="groupIndex + '-' + matterIndex">
@@ -113,7 +104,7 @@
                   ></el-button>
                 </el-tooltip>
               </span>
-              <el-tooltip content="删除乐团主管" placement="top" :open-delay=".5">
+              <el-tooltip  v-if="isCreate" content="删除乐团主管" placement="top" :open-delay=".5">
                 <el-button
                   icon="el-icon-delete"
                   circle
@@ -128,7 +119,7 @@
           </el-col>
         </template>
       </el-row>
-      <el-button @click="createGroup" plain block style="width: 100%">添加乐团主管</el-button>
+      <el-button v-if="isCreate" @click="createGroup" plain block style="width: 100%">添加乐团主管</el-button>
     </el-form>
     <div slot="footer" style="text-align: right;margin-top: 20px;">
       <el-button>取消</el-button>
@@ -137,26 +128,72 @@
   </div>
 </template>
 <script>
+import { findTechnician } from '@/api/repairManager'
+import { matterTypes } from '@/views/main/constant'
+import { objectToOptions } from '@/utils'
+import { createRandom } from '@/helpers/uuidv4'
+import { inspectionAdd, inspectionGetInfo, inspectionUpdate } from '@/views/main/api'
 const emptyMatter = {
-  name: '',
-  num: ''
+  item: '',
+  times: ''
 }
 export default {
+  props: ['id'],
   data() {
     return {
       form: {
         organId: '',
         group: [{
-          person: '',
+          _uuid: createRandom(),
+          userId: '',
           matter: [{...emptyMatter}]
         }]
+      },
+      technicians: []
+    }
+  },
+  computed: {
+    matterTypesOptions() {
+      return objectToOptions(matterTypes)
+    },
+    isCreate() {
+      return !this.id
+    },
+  },
+  watch: {
+    async 'form.organId'() {
+      if (this.form.organId) {
+        try {
+          const res = await findTechnician({
+            organId: this.form.organId
+          })
+          this.technicians = res.data
+          this.$set(this.form, 'group', group.map(item => ({...item, userId: ''})))
+        } catch (error) {}
       }
     }
   },
+  async mounted() {
+    try {
+      const res = await inspectionGetInfo({
+        id: this.id
+      })
+      this.form = {
+        ...this.form,
+        organId: res.data.organId,
+        month: res.data.month,
+        group: [{
+          _uuid: createRandom(),
+          userId: res.data.userId,
+          matter: res.data.inspectionItems.map(item => ({item: item.item, times: item.times}))
+        }]
+      }
+    } catch (error) {}
+  },
   methods: {
     createGroup() {
       this.form.group.push({
-        person: '',
+        userId: '',
         matter: [{...emptyMatter}]
       })
     },
@@ -178,7 +215,26 @@ export default {
       try {
         this.$refs.form.validate(async valid => {
           if (valid) {
-            console.log(this.form)
+            const data = this.form.group.map(item => ({
+              organId: this.form.organId,
+              month: this.form.month,
+              userId: item.userId,
+              inspectionItems: item.matter.map(m => ({
+                ...m,
+                organId: this.form.organId,
+                month: this.form.month,
+              }))
+            }))
+            if (this.isCreate) {
+              await inspectionAdd(data)
+              this.$message.success('创建成功')
+            } else {
+              await inspectionUpdate({
+                ...data[0],
+                id: this.id,
+              })
+              this.$message.success('修改成功')
+            }
             this.$emit('close')
             this.$emit('submited')
           }

+ 60 - 0
src/views/main/schedule-branch/modals/view.vue

@@ -0,0 +1,60 @@
+<template>
+  <div>
+    <descriptions :column="3">
+      <descriptions-item label="分部">{{detail.organName}}</descriptions-item>
+      <descriptions-item label="工作周期">{{$helpers.dayjs(detail.month).format('YYYY-MM')}}</descriptions-item>
+      <descriptions-item label="乐团主管">{{detail.userName}}</descriptions-item>
+      <descriptions-item label="处理意见">{{detail.memo}}</descriptions-item>
+    </descriptions>
+    <el-table
+      :data="detail.inspectionItems || []"
+      style="width: 100%;margin-top: 20px;"
+      max-height="500px"
+      :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+    >
+      <el-table-column
+        label="任务事项"
+        prop="item"
+      >
+        <template slot-scope="scope">{{matterTypes[scope.row.item]}}</template>
+      </el-table-column>
+      <el-table-column
+        label="任务次数"
+        prop="times"
+      />
+      <el-table-column
+        label="实际安排"
+        prop="plannedTimes"
+      />
+    </el-table>
+    <div slot="footer" style="text-align: right;margin-top: 20px;">
+      <el-button type="primary" @click="$emit('close')">确认</el-button>
+    </div>
+  </div>
+</template>
+<script>
+import { inspectionGetInfo } from '@/views/main/api'
+import { matterTypes } from '@/views/main/constant'
+export default {
+  props: ['id'],
+  data() {
+    return {
+      matterTypes,
+      detail: {},
+    }
+  },
+  mounted() {
+    this.FetchDetail()
+  },
+  methods: {
+    async FetchDetail() {
+      try {
+        const res = await inspectionGetInfo({
+          id: this.id
+        })
+        this.detail = res.data
+      } catch (error) {}
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/teamDetail/teamCourseList.vue

@@ -268,7 +268,7 @@
               <div>
                 <el-button type="text"
                   @click="removeCourse(scope.row)"
-                  v-permission="'courseSchedule/batchDelete'">删除</el-button>
+                  v-permission="'courseSchedule/batchDelete?page=teamCourseList'">删除</el-button>
                 <el-button type="text"
                            v-if="permission('teamCourseList/details')"
                            @click="lookDetail(scope.row)">详情</el-button>

+ 10 - 0
src/views/teamDetail/teamList.vue

@@ -337,6 +337,7 @@ export default {
     closeStudens
   },
   mounted () {
+    this.$set(this.topForm, 'teamName', this.$route.query.search)
     this.init();
   },
   activated () {
@@ -368,6 +369,15 @@ export default {
     reset () {
       this.rules.page = 1;
       this.$refs['topForm'].resetFields();
+      if (this.$route.query.search) {
+        this.$router.replace({
+          path: this.$route.path,
+          query: {
+            ...this.$route.query,
+            search: undefined
+          }
+        })
+      }
       this.getList()
     },
     search () {