lex-xin 4 лет назад
Родитель
Сommit
c7282555a8

+ 2 - 1
src/components/save-form/index.vue

@@ -31,6 +31,7 @@ export default {
   },
   methods: {
     save(search = null, type = 'form') {
+      search = search ? search : this.model
       this.searchs.update(search, undefined, type)
     },
     validate(FC) {
@@ -42,9 +43,9 @@ export default {
       })
     },
     resetFields() {
+      this.$refs.form.resetFields()
       this.searchs.update(this.model, undefined, 'form')
       this.searchs.update({}, undefined, 'page')
-      this.$refs.form.resetFields()
     }
   },
 }

+ 5 - 0
src/constant/index.js

@@ -150,3 +150,8 @@ export const workType = {
   TEACHING: "助教",
   BISHOP: "主教"
 }
+
+export const rewardModeType = {
+  PER: '累计奖励',
+  STAIR: '阶梯奖励'
+}

+ 0 - 1
src/permission.js

@@ -41,7 +41,6 @@ router.beforeEach(async (to, from, next) => {
   // from.query = to.query
   // start progress bar
   NProgress.start()
-
   // set page title
   // document.title = getPageTitle(to.meta.title)
   document.title = getPageTitle()

+ 2 - 0
src/router/notKeepAliveList.js

@@ -6,4 +6,6 @@ export default [
   '/business/auditList',
   // '/operateManager/HumanResources'
   '/vipClassSet/vipParameterManager',
+  '/vipClassSet/branchActive',
+  '/vipClassSet/branchActiveOperation'
 ]

+ 14 - 1
src/store/modules/selects.js

@@ -2,6 +2,7 @@
 import { branchQueryPage } from '@/api/specialSetting'
 import { getSubject, getTeacher } from '@/api/buildTeam'
 import { getSchool } from '@/api/systemManage'
+import { vipGroupCategory } from "@/api/vipSeting"
 
 /**
  *
@@ -20,6 +21,7 @@ export default {
     subjects: [],
     teachers: [],
     schools: [],
+    vipGroupCategory: []
   },
   mutations: {
     commit_branchs: (state, branchs) => {
@@ -34,6 +36,9 @@ export default {
     commit_schools: (state, schools) => {
       state.schools = schools
     },
+    commit_vip_group_category: (state, vipGroupCategory) => {
+      state.vipGroupCategory = vipGroupCategory
+    }
   },
   actions: {
     async setBranchs ({ commit, state }, force) {
@@ -44,7 +49,7 @@ export default {
         } catch (error) { }
       }
     },
-    async setSubject ({ commit, state }, force) {
+    async setSubjects ({ commit, state }, force) {
       if (!state.subjects.length || force === true) {
         try {
           const res = await getSubject({ rows: 9999 })
@@ -68,5 +73,13 @@ export default {
         } catch (error) { }
       }
     },
+    async setVipGroupCategory ({ commit, state }, force) {
+      if (!state.subjects.length || force === true) {
+        try {
+          const res = await vipGroupCategory()
+          commit('commit_vip_group_category', res.data)
+        } catch (error) { }
+      }
+    },
   }
 }

+ 1 - 0
src/store/modules/tagsView.js

@@ -9,6 +9,7 @@ const tagsView = {
         state.visitedViews.forEach(v => {
           if (v.path === view.path) {
             v.fullPath = view.fullPath
+            v.title = view.meta.title
             if (view.query) {
               v.query = view.query
             }

+ 2 - 1
src/utils/searchArray.js

@@ -1,5 +1,5 @@
 // 搜索用的下拉数据列表
-import { payOrderType, auditType, auditPaymentType, orderServerType, orderAuditType } from '../constant'
+import { payOrderType, auditType, auditPaymentType, orderServerType, orderAuditType, rewardModeType } from '../constant'
 // 课程类型
 export const courseType = [
   { label: "单技课", value: "SINGLE" },
@@ -211,6 +211,7 @@ export const auditTypeList = getValueForKey(auditType)
 export const auditPaymentTypeList = getValueForKey(auditPaymentType)
 export const orderServerList = getValueForKey(orderServerType)
 export const orderAuditTypeList = getValueForKey(orderAuditType)
+export const rewardModeTypeList = getValueForKey(rewardModeType)
 function getValueForKey (obj) {
   let arr = []
   for (let k in obj) {

+ 4 - 0
src/utils/vueFilter.js

@@ -697,3 +697,7 @@ Vue.filter('orderAuditType', value => {
 Vue.filter('songUseTypeFormat', value => {
   return constant.songUseType[value]
 })
+
+Vue.filter('rewardModeTypeFormat', value => {
+  return constant.rewardModeType[value]
+})

+ 49 - 72
src/views/categroyManager/insideSetting/branchActive.vue

@@ -4,58 +4,56 @@
       <div class="squrt"></div>VIP分部活动列表
     </h2>
     <div class="m-core">
-      <div @click="openActive('create')"
-           v-permission="'/branchActiveOperationAdd'"
-           class='newBand'>新建</div>
+      <el-button type="primary" @click="openActive('create')" style="margin-bottom: 20px"
+           v-permission="'/branchActiveOperationAdd'" >新建</el-button>
       <!-- 搜索类型 -->
-      <el-form :inline="true"
-               class="searchForm"
+      <save-form :inline="true"
+               ref="searchForm"
                @submit.native.prevent
-               v-model.trim="searchForm">
-        <el-form-item>
+               :model.sync="searchForm">
+        <el-form-item prop="search">
           <el-input type="text"
                     v-model.trim="searchForm.search"
                     @keyup.enter.native='getList'
                     placeholder="分部活动名"></el-input>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="rewardMode">
           <el-select v-model.trim="searchForm.rewardMode"
                      clearable
-                     filterable
                      placeholder="分部活动类型">
-            <el-option label="累计奖励"
-                       value="PER"></el-option>
-            <el-option label="阶梯奖励"
-                       value="STAIR"></el-option>
+            <el-option v-for="(item,index) in rewardModeTypeList"
+                       :key="index"
+                       :label="item.label"
+                       :value="item.value"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="teacherId">
           <el-select v-model.trim="searchForm.teacherId"
                      clearable
                      filterable
                      placeholder="适用老师">
-            <el-option v-for="item in teacherList"
-                       :key="item.value"
-                       :label="item.label"
-                       :value="item.value"></el-option>
+            <el-option v-for="item in selects.teachers"
+                       :key="item.id"
+                       :label="item.realName"
+                       :value="item.id"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item>
+        <el-form-item prop="vipGroupCategoryId">
           <el-select v-model.trim="searchForm.vipGroupCategoryId"
                      filterable
                      clearable
                      placeholder="课程类型">
-            <el-option v-for="item in vipGroupCategoryList"
-                       :key="item.value"
-                       :label="item.label"
-                       :value="item.value"></el-option>
+            <el-option v-for="item in selects.vipGroupCategory"
+                       :key="item.id"
+                       :label="item.name"
+                       :value="item.id"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button @click="getList"
-                     type="danger">搜索</el-button>
+          <el-button @click="onSearch" type="primary">搜索</el-button>
+          <el-button @click="onReset" type="danger">重置</el-button>
         </el-form-item>
-      </el-form>
+      </save-form>
       <!-- 列表 -->
       <div class="tableWrap">
         <el-table :data='tableList'
@@ -68,7 +66,7 @@
                            prop='rewardMode'
                            label="分部活动类型">
             <template slot-scope="scope">
-              {{ scope.row.rewardMode == 'PER' ? '累计奖励' : '阶梯奖励' }}
+              {{ scope.row.rewardMode | rewardModeTypeFormat }}
             </template>
           </el-table-column>
           <el-table-column align='center'
@@ -95,6 +93,7 @@
         <pagination :total="pageInfo.total"
                     :page.sync="pageInfo.page"
                     :limit.sync="pageInfo.limit"
+                    :sync="true"
                     :page-sizes="pageInfo.page_size"
                     @pagination="getList" />
       </div>
@@ -105,14 +104,14 @@
 <script>
 import pagination from '@/components/Pagination/index'
 import { courseScheduleRewards } from '@/api/systemManage'
-import { vipGroupCategory } from "@/api/vipSeting"
 import { getTeacher } from '@/api/buildTeam'
-import store from '@/store'
+import { rewardModeTypeList } from "@/utils/searchArray";
 export default {
   name: 'branchActive',
   components: { pagination },
   data () {
     return {
+      rewardModeTypeList,
       searchForm: {
         search: null,
         rewardMode: null,
@@ -120,10 +119,7 @@ export default {
         teacherId: null,
       },
       organId: null,
-      searchLsit: [],
       tableList: [],
-      vipGroupCategoryList: [],
-      teacherList: [],
       pageInfo: {
         // 分页规则
         limit: 10, // 限制显示条数
@@ -134,46 +130,16 @@ export default {
 
     }
   },
-  created () {
-    if (this.$route.query.searchForm) {
-      this.$route.query.searchForm instanceof Object ? this.searchForm = this.$route.query.searchForm : this.searchForm = JSON.parse(this.$route.query.searchForm);
-    }
-    if (this.$route.query.rules) {
-      this.$route.query.rules instanceof Object ? this.pageInfo = this.$route.query.rules : this.pageInfo = JSON.parse(this.$route.query.rules);
-    }
-  },
-  activated () {
-    this.getList()
-    this.__init()
-  },
   mounted () {
     this.getList() // 获取列表数据
     this.__init()
-
   },
   methods: {
     async __init () {
-      let vipGroupCategoryList = await vipGroupCategory({ page: 1, rows: 9999 })
-      if (vipGroupCategoryList.code == 200) {
-        this.vipGroupCategoryList = []
-        vipGroupCategoryList.data.forEach(item => {
-          this.vipGroupCategoryList.push({
-            label: item.name,
-            value: item.id
-          })
-        })
-      }
+      // 获取类型
+      this.$store.dispatch('setVipGroupCategory')
 
-      let teacherList = await getTeacher()
-      if (teacherList.code == 200) {
-        this.teacherList = []
-        teacherList.data.forEach(item => {
-          this.teacherList.push({
-            label: item.realName,
-            value: item.id
-          })
-        })
-      }
+      this.$store.dispatch('setTeachers')
     },
     getList () {
       let params = this.searchForm
@@ -187,23 +153,34 @@ export default {
       })
     },
     openActive (type, row) {
-      let pageInfo = JSON.stringify(this.pageInfo)
-      let searchForm = JSON.stringify(this.searchForm)
       let params = {
         path: '/vipClassSet/branchActiveOperation',
         query: {
-          type: type,
-          searchForm,
-          pageInfo
-        }
+          type: type
+        },
       }
+      let tagTitle = '新建'
       if (row) {
         params.query.id = row.id
+        tagTitle = '修改'
       }
-      this.$router.push(params)
+      this.$router.push(params, (route) => {
+        route.meta.title = tagTitle + 'VIP分部活动'
+      })
     },
     onFormClose (formName) { // 关闭弹窗重置验证
       this.$refs[formName].clearValidate()
+    },
+    onSearch() {
+      this.$refs.searchForm.validate(valid => {
+        this.pageInfo.page = 1
+        this.getList()
+      })
+    },
+    onReset() {
+      this.$refs.searchForm.resetFields()
+      this.pageInfo.page = 1
+      this.getList()
     }
   }
 }

+ 41 - 97
src/views/categroyManager/insideSetting/branchActiveOperation.vue

@@ -73,10 +73,10 @@
                      clearable
                      multiple
                      placeholder="请选择">
-            <el-option v-for="item in vipGroupCategoryList"
-                       :key="item.value"
-                       :label="item.label"
-                       :value="item.value.toString()"> </el-option>
+            <el-option v-for="item in selects.vipGroupCategory"
+                       :key="item.id"
+                       :label="item.name"
+                       :value="item.id.toString()"> </el-option>
           </el-select>
         </el-form-item>
 
@@ -89,10 +89,10 @@
                      @change="onSubjectChange('search')"
                      v-model.trim="result.organId"
                      placeholder="请选择">
-            <el-option v-for="item in branchList"
-                       :key="item.value"
-                       :label="item.label"
-                       :value="item.value.toString()"> </el-option>
+            <el-option v-for="item in selects.branchs"
+                       :key="item.id"
+                       :label="item.name"
+                       :value="item.id.toString()"> </el-option>
           </el-select>
         </el-form-item>
 
@@ -106,15 +106,10 @@
                      @change="onSubjectChange('search')"
                      v-model.trim="result.subjectIds"
                      placeholder="请选择">
-            <el-option-group v-for="(group, index) in subjectTreeList"
-                             :key="index"
-                             :label="group.label">
-              <el-option v-for="(item, i) in group.options"
+            <el-option v-for="(item, i) in selects.subjects"
                          :key="i"
-                         :label="item.label"
-                         :value="item.value.toString()">
-              </el-option>
-            </el-option-group>
+                         :label="item.name"
+                         :value="item.id.toString()"></el-option>
           </el-select>
         </el-form-item>
 
@@ -144,7 +139,6 @@
   </div>
 </template>
 <script>
-import store from '@/store'
 import { getEmployeeOrgan, getSoundTree } from '@/api/buildTeam'
 import { courseScheduleRewardsQuery, getUserRole, courseScheduleRewardsAdd, courseScheduleRewardsUpdate, findTeacherByOrganId } from '@/api/systemManage'
 import { vipGroupCategory } from "@/api/vipSeting"
@@ -155,12 +149,7 @@ export default {
       organId: null,
       pageType: this.$route.query.type,
       id: this.$route.query.id,
-      pageInfo: this.$route.query.pageInfo,
-      searchForm: this.$route.query.searchForm,
-      branchList: [],
       teacherList: [], // 老师列表
-      subjectTreeList: [], // 声部列表
-      vipGroupCategoryList: [],
       result: {
         name: null,
         rewardMode: null,
@@ -189,91 +178,46 @@ export default {
     }
   },
   mounted () {
-    this.pageType = this.$route.query.type
-    this.id = this.$route.query.id
-    this.pageInfo = this.$route.query.pageInfo
-    this.searchForm = this.$route.query.searchForm
-    this.__init()
-  },
-  activated () {
-    this.pageType = this.$route.query.type
-    this.id = this.$route.query.id
-    this.pageInfo = this.$route.query.pageInfo
-    this.searchForm = this.$route.query.searchForm
     this.__init()
   },
   methods: {
     async __init () {
       this.$refs.form.resetFields()
-      let vipGroupCategoryList = await vipGroupCategory({ page: 1, rows: 9999 })
-      if (vipGroupCategoryList.code == 200) {
-        this.vipGroupCategoryList = []
-        vipGroupCategoryList.data.forEach(item => {
-          this.vipGroupCategoryList.push({
-            label: item.name,
-            value: item.id
-          })
-        })
-      }
-
-      let branchList = await getEmployeeOrgan({ delFlag: 0, rows: 9999 })
-      if (branchList.code == 200) {
-        this.branchList = []
-        branchList.data.forEach(item => {
-          let tempArr = {}
-          tempArr = {
-            label: item.name,
-            value: item.id
-          }
-          this.branchList.push(tempArr)
-        })
-      }
-
-      let subjectTree = await getSoundTree({ delFlag: 0, rows: 9999 })
-      if (subjectTree.code == 200) {
-        let subjectResult = subjectTree.data
-        subjectResult.rows.forEach(element => {
-          let tempElement = {}
-          tempElement = { label: element.name, options: [] }
-          // 判断子级声部是否为空
-          if (element.subjects) {
-            element.subjects.forEach(subject => {
-              tempElement.options.push({
-                value: subject.id,
-                label: subject.name
-              })
-            })
-          }
-          this.subjectTreeList.push(tempElement)
-        })
-      }
+      // 获取类型
+      this.$store.dispatch('setVipGroupCategory')
+      // 获取分部
+      this.$store.dispatch('setBranchs')
+      // 获取声部
+      this.$store.dispatch('setSubjects')
 
       if (this.pageType == 'update') {
         let courseScheduleRewards = await courseScheduleRewardsQuery({ id: this.id })
         if (courseScheduleRewards.code == 200) {
           let data = courseScheduleRewards.data
-          this.result.organId = data.organId
-          this.result.subjectIds = data.subjectIds ? data.subjectIds.split(',') : data.subjectIds
-          this.onSubjectChange('update')
-          this.result = {
-            id: data.id,
-            name: data.name,
-            rewardMode: data.rewardMode,
-            organId: data.organId,
-            subjectIds: data.subjectIds ? data.subjectIds.split(',') : data.subjectIds,
-            vipGroupCategoryIdList: data.vipGroupCategoryIdList ? data.vipGroupCategoryIdList.split(',') : data.vipGroupCategoryIdList,
-            teacherId: data.teacherId ? data.teacherId.split(',') : data.teacherId,
-            courseScheduleType: data.courseScheduleType,
-            domains: data.rewardsRulesJson ?
-              JSON.parse(data.rewardsRulesJson) : [{
-                min: null,
-                max: null,
-                money: null,
-                disabled: false,
-                key: Date.now()
-              }],
-            errorText: null
-          }
+          this.$nextTick(() => {
+            this.result.organId = data.organId
+            this.result.subjectIds = data.subjectIds ? data.subjectIds.split(',') : data.subjectIds
+            this.onSubjectChange('update')
+            this.result = {
+              id: data.id,
+              name: data.name,
+              rewardMode: data.rewardMode,
+              organId: data.organId,
+              subjectIds: data.subjectIds ? data.subjectIds.split(',') : data.subjectIds,
+              vipGroupCategoryIdList: data.vipGroupCategoryIdList ? data.vipGroupCategoryIdList.split(',') : data.vipGroupCategoryIdList,
+              teacherId: data.teacherId ? data.teacherId.split(',') : data.teacherId,
+              courseScheduleType: data.courseScheduleType,
+              domains: data.rewardsRulesJson ?
+                JSON.parse(data.rewardsRulesJson) : [{
+                  min: null,
+                  max: null,
+                  money: null,
+                  disabled: false,
+                  key: Date.now()
+                }],
+              errorText: null
+            }
+          })
         }
       } else {
         this.resetForm()

+ 1 - 1
src/views/save-form-test/index.vue

@@ -138,7 +138,7 @@ export default {
   },
   mounted() {
     this.$store.dispatch('setBranchs')
-    this.$store.dispatch('setSubject')
+    this.$store.dispatch('setSubjects')
   },
   methods: {
     getList() {