Przeglądaj źródła

1

修改到vip活动
mo 4 lat temu
rodzic
commit
584c1aaf86

+ 2 - 1
src/components/select-all/index.vue

@@ -44,8 +44,9 @@ export default {
 }
 .btn{
   width: 50px;
-  padding: 10px;
+  padding: 0 10px;
   border-left: none;
   border-radius: 0 4px 4px 0;
+  height: 40px;
 }
 </style>

+ 14 - 6
src/views/arrearage-students/index.vue

@@ -19,21 +19,29 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-select
-            v-model.trim="searchForm.organIds"
+          <select-all  v-model.trim="searchForm.organIds"
             clearable
             filterable
             multiple
             collapse-tags
-            placeholder="请选择所属分部"
-          >
-            <el-option
+            placeholder="请选择所属分部">
+             <el-option
               v-for="(item, index) in selects.branchs"
               :key="index"
               :label="item.name"
               :value="item.id"
             ></el-option>
-          </el-select>
+          </select-all>
+          <!-- <el-select
+            v-model.trim="searchForm.organIds"
+            clearable
+            filterable
+            multiple
+            collapse-tags
+            placeholder="请选择所属分部"
+          > -->
+
+          <!-- </el-select> -->
         </el-form-item>
         <el-form-item>
           <el-select

+ 8 - 6
src/views/businessManager/orderManager/salesList.vue

@@ -38,21 +38,23 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-select
-            multiple
+          <select-all  multiple
             collapse-tags
             v-model="searchForm.organIdList"
             clearable
             filterable
-            placeholder="请选择所属分部"
-          >
-            <el-option
+            placeholder="请选择所属分部">
+              <el-option
               v-for="(item, index) in selects.branchs"
               :key="index"
               :label="item.name"
               :value="item.id"
             ></el-option>
-          </el-select>
+          </select-all>
+          <!-- <el-select
+          >
+
+          </el-select> -->
         </el-form-item>
         <el-form-item>
           <el-select

+ 179 - 145
src/views/businessManager/shopManager/shopCategory.vue

@@ -1,242 +1,276 @@
 
 <template>
-  <div class='m-container'>
+  <div class="m-container">
     <h2>
-      <div class="squrt"></div>商品分类管理
+      <div class="squrt"></div>
+      商品分类管理
     </h2>
     <div class="m-core">
-      <div class='newBand'
-           v-permission="'category/upset'"
-           @click="openTypes('create')">添加</div>
+      <div
+        class="newBand"
+        v-permission="'category/upset'"
+        @click="openTypes('create')"
+      >
+        添加
+      </div>
       <!-- 列表 -->
       <div class="tableWrap">
-        <el-table :data='tableList'
-                  :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-          <el-table-column align='center'
-                           prop="name"
-                           label="分类名称">
+        <el-table
+          :data="tableList"
+          :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        >
+          <el-table-column align="center" prop="name" label="分类名称">
           </el-table-column>
-          <el-table-column align='center'
-                           label="声部属性">
+          <el-table-column align="center" label="声部属性">
             <template slot-scope="scope">
-              <overflow-text width="100%" :text="scope.row.subjectName | joinArray(',')"></overflow-text>
+              <overflow-text
+                width="100%"
+                :text="scope.row.subjectName | joinArray(',')"
+              ></overflow-text>
             </template>
           </el-table-column>
-          <el-table-column align='center'
-                           label="操作">
+          <el-table-column align="center" label="操作">
             <template slot-scope="scope">
-              <el-button @click="openTypes('update', scope.row)"
-                         v-permission="'category/upset'"
-                         type="text">修改</el-button>
-              <el-button @click="onTypesDelOpeation(scope.row)"
-                         v-permission="'category/del'"
-                         type="text">删除</el-button>
+              <el-button
+                @click="openTypes('update', scope.row)"
+                v-permission="'category/upset'"
+                type="text"
+                >修改</el-button
+              >
+              <el-button
+                @click="onTypesDelOpeation(scope.row)"
+                v-permission="'category/del'"
+                type="text"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
-        <pagination sync :total.sync="pageInfo.total"
-                    :page.sync="pageInfo.page"
-                    :limit.sync="pageInfo.limit"
-                    :page-sizes="pageInfo.page_size"
-                    @pagination="getList" />
+        <pagination
+          sync
+          :total.sync="pageInfo.total"
+          :page.sync="pageInfo.page"
+          :limit.sync="pageInfo.limit"
+          :page-sizes="pageInfo.page_size"
+          @pagination="getList"
+        />
       </div>
     </div>
-    <el-dialog :title="formTitle[formActionTitle]"
-               :visible.sync="typeStatus"
-               @close="onFormClose('ruleForm')"
-               width="500px">
-      <el-form :model="form"
-               :rules="rules"
-               ref="ruleForm">
-        <el-form-item label="商品分类名称"
-                      prop="name"
-                      :label-width="formLabelWidth">
-          <el-input v-model.trim="form.name"
-                    autocomplete="off"></el-input>
+    <el-dialog
+      :title="formTitle[formActionTitle]"
+      :visible.sync="typeStatus"
+      @close="onFormClose('ruleForm')"
+      width="500px"
+    >
+      <el-form :model="form" :rules="rules" ref="ruleForm">
+        <el-form-item
+          label="商品分类名称"
+          prop="name"
+          :label-width="formLabelWidth"
+        >
+          <el-input v-model.trim="form.name" autocomplete="off"></el-input>
         </el-form-item>
-        <el-form-item label="声部属性"
-                      v-if="form.classGroupType != 'MIX'"
-                      prop="subjectIds"
-                      :label-width="formLabelWidth">
-          <el-select v-model.trim="form.subjectIds"
-                     clearable
-                     filterable
-                     multiple>
-            <el-option-group v-for="group in subjectList"
-                             :key="group.label"
-                             :label="group.label">
-              <el-option v-for="item in group.options"
-                         :key="item.value"
-                         :label="item.label"
-                         :value="item.value">
+        <el-form-item
+          label="声部属性"
+          v-if="form.classGroupType != 'MIX'"
+          prop="subjectIds"
+          :label-width="formLabelWidth"
+        >
+          <select-all
+            v-model.trim="form.subjectIds"
+            clearable
+            filterable
+            multiple
+          >
+            <!-- <el-select > -->
+            <el-option-group
+              v-for="group in subjectList"
+              :key="group.id"
+              :label="group.label"
+            >
+              <el-option
+                v-for="item in group.options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
               </el-option>
             </el-option-group>
-          </el-select>
+          </select-all>
+          <!-- </el-select> -->
         </el-form-item>
       </el-form>
-      <span slot="footer"
-            class="dialog-footer">
+      <span slot="footer" class="dialog-footer">
         <el-button @click="typeStatus = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="onTypesSubmit('ruleForm')">确 定</el-button>
+        <el-button type="primary" @click="onTypesSubmit('ruleForm')"
+          >确 定</el-button
+        >
       </span>
     </el-dialog>
   </div>
 </template>
 <script>
-import pagination from '@/components/Pagination/index'
-import store from '@/store'
-import { subjectListTree } from '@/api/specialSetting'
-import { categoryListTree, categoryUpSet, categoryUpSetDel } from '@/api/businessManager'
+import pagination from "@/components/Pagination/index";
+import store from "@/store";
+import { subjectListTree } from "@/api/specialSetting";
+import {
+  categoryListTree,
+  categoryUpSet,
+  categoryUpSetDel,
+} from "@/api/businessManager";
 export default {
   components: { pagination },
-  name: 'shopCategory',
-  data () {
+  name: "shopCategory",
+  data() {
     return {
       tableList: [],
       subjectList: [], // 声部列表
-      formActionTitle: 'create',
+      formActionTitle: "create",
       formTitle: {
-        create: '添加商品分类',
-        update: '修改商品分类'
+        create: "添加商品分类",
+        update: "修改商品分类",
       },
       typeStatus: false, // 添加教学点
-      formLabelWidth: '120px',
+      formLabelWidth: "120px",
       form: {
         name: null, // 作业模块名称
-        subjectIds: []
+        subjectIds: [],
       },
       rules: {
-        name: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
-        subjectIds: [{ required: true, message: '请选择声部组合', trigger: 'change' }]
+        name: [{ required: true, message: "请输入类型名称", trigger: "blur" }],
+        subjectIds: [
+          { required: true, message: "请选择声部组合", trigger: "change" },
+        ],
       },
       pageInfo: {
         // 分页规则
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50] // 选择限制显示条数
-      }
-    }
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+    };
   },
-  mounted () {
-    this.getList()
-    this.getSubjectTree()
+  mounted() {
+    this.getList();
+    this.getSubjectTree();
   },
   methods: {
-    onTypesDelOpeation (row) {
-
+    onTypesDelOpeation(row) {
       this.$confirm("您确定删除该分类?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning"
+        type: "warning",
       }).then(() => {
-        categoryUpSetDel({ id: row.id }).then(res => {
-          this.messageTips('删除', res)
-        })
+        categoryUpSetDel({ id: row.id }).then((res) => {
+          this.messageTips("删除", res);
+        });
       });
-
     },
-    onTypesSubmit (formName) { // 添加数据
+    onTypesSubmit(formName) {
+      // 添加数据
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          if (this.formActionTitle == 'create') {
-            if (this.form.id) { // 判断有没有Id,如果有则删除
-              delete this.form.id
+          if (this.formActionTitle == "create") {
+            if (this.form.id) {
+              // 判断有没有Id,如果有则删除
+              delete this.form.id;
             }
-            categoryUpSet(this.form).then(res => {
-              this.messageTips('添加', res)
-            })
-          } else if (this.formActionTitle == 'update') {
-            categoryUpSet(this.form).then(res => {
-              this.messageTips('修改', res)
-            })
+            categoryUpSet(this.form).then((res) => {
+              this.messageTips("添加", res);
+            });
+          } else if (this.formActionTitle == "update") {
+            categoryUpSet(this.form).then((res) => {
+              this.messageTips("修改", res);
+            });
           }
         } else {
           return false;
         }
-      })
+      });
     },
 
-    messageTips (title, res) {
+    messageTips(title, res) {
       if (res.code == 200) {
-        this.$message.success(title + '成功')
-        this.typeStatus = false
-        this.getList()
+        this.$message.success(title + "成功");
+        this.typeStatus = false;
+        this.getList();
       } else {
-        this.$message.error(res.msg)
+        this.$message.error(res.msg);
       }
     },
-    getList () {
+    getList() {
       categoryListTree({
         delFlag: 0,
         rows: this.pageInfo.limit,
-        page: this.pageInfo.page
-      }).then(res => {
-        let result = res.data
+        page: this.pageInfo.page,
+      }).then((res) => {
+        let result = res.data;
         if (res.code == 200) {
-          result.rows.forEach(row => {
+          result.rows.forEach((row) => {
             let subjectname = [],
-              subjectIds = []
-            row.subjects.forEach(item => {
-              subjectname.push(item.name)
-              subjectIds.push(item.id)
-            })
-            row.subjectName = subjectname
-            row.subjectIds = subjectIds
-          })
-          this.tableList = result.rows
-          this.pageInfo.total = result.total
+              subjectIds = [];
+            row.subjects.forEach((item) => {
+              subjectname.push(item.name);
+              subjectIds.push(item.id);
+            });
+            row.subjectName = subjectname;
+            row.subjectIds = subjectIds;
+          });
+          this.tableList = result.rows;
+          this.pageInfo.total = result.total;
         }
-      })
+      });
     },
-    openTypes (type, row) {
-      this.typeStatus = true
-      this.formActionTitle = type
+    openTypes(type, row) {
+      this.typeStatus = true;
+      this.formActionTitle = type;
       // 修改的时候赋值
-      if (type == 'update') {
+      if (type == "update") {
         this.form = {
           id: row.id,
           name: row.name,
-          subjectIds: row.subjectIds
-        }
+          subjectIds: row.subjectIds,
+        };
       }
     },
-    onFormClose (formName) { // 关闭弹窗重置验证
+    onFormClose(formName) {
+      // 关闭弹窗重置验证
       this.form = {
         name: null, // 作业模块名称
-        subjectIds: []
-      }
-      this.$refs[formName].resetFields()
+        subjectIds: [],
+      };
+      this.$refs[formName].resetFields();
     },
-    getSubjectTree () { // 获取声部列表
+    getSubjectTree() {
+      // 获取声部列表
       subjectListTree({
         delFlag: 0,
-        rows: 9999
-      }).then(res => {
-        let result = res.data
+        rows: 9999,
+      }).then((res) => {
+        let result = res.data;
         if (res.code == 200) {
-          let tempArray = []
+          let tempArray = [];
           result.rows.forEach((item, index) => {
-            let subject = []
-            item.subjects.forEach(s => {
+            let subject = [];
+            item.subjects.forEach((s) => {
               subject.push({
                 value: s.id,
-                label: s.name
-              })
-            })
+                label: s.name,
+              });
+            });
 
             tempArray[index] = {
               label: item.name,
-              options: subject
-            }
-          })
-          this.subjectList = tempArray
+              options: subject,
+            };
+          });
+          this.subjectList = tempArray;
         }
-      })
-    }
-  }
-}
+      });
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
 /deep/.el-date-editor.el-input {

+ 326 - 240
src/views/categroyManager/insideSetting/branchActiveOperation.vue

@@ -1,150 +1,181 @@
 <template>
-  <div class='m-container'>
+  <div class="m-container">
     <h2>
-      <el-page-header @back="onCancel"
-                      :content="(pageType == 'create' ? '添加' : '修改') + '分部活动'"></el-page-header>
+      <el-page-header
+        @back="onCancel"
+        :content="(pageType == 'create' ? '添加' : '修改') + '分部活动'"
+      ></el-page-header>
     </h2>
     <div class="m-core">
-      <el-form :model="result"
-               :rules="rules"
-               ref="form"
-               label-width="120px">
-        <el-form-item label="活动名称"
-                      prop="name"
-                      style="width: 500px">
+      <el-form :model="result" :rules="rules" ref="form" label-width="120px">
+        <el-form-item label="活动名称" prop="name" style="width: 500px">
           <el-input v-model.trim="result.name"></el-input>
         </el-form-item>
-        <el-form-item prop="rewardMode"
-                      label="活动类型"
-                      style="width: 500px">
+        <el-form-item prop="rewardMode" label="活动类型" style="width: 500px">
           <el-radio-group v-model.trim="result.rewardMode">
             <el-radio label="STAIR">阶梯奖励</el-radio>
             <el-radio label="PER">累计奖励</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item class="moreRule"
-                      style="margin-bottom: 0;">
+        <el-form-item class="moreRule" style="margin-bottom: 0">
           <span class="min">最小值</span>
           <span class="min">最大值</span>
           <span class="max">奖励金额</span>
         </el-form-item>
         <div class="moreRule">
-          <div class="moreRuleIn"
-               v-for="(domain, index) in result.domains"
-               :key="domain.key">
+          <div
+            class="moreRuleIn"
+            v-for="(domain, index) in result.domains"
+            :key="domain.key"
+          >
             <el-form-item :label="'梯度' + (index + 1)">
-              <el-input type="number"
-                        v-number
-                        :disabled="domain.disabled"
-                        @mousewheel.native.prevent
-                        v-model.trim="domain.min"></el-input>
+              <el-input
+                type="number"
+                v-number
+                :disabled="domain.disabled"
+                @mousewheel.native.prevent
+                v-model.trim="domain.min"
+              ></el-input>
             </el-form-item>
             <el-form-item>
-              <el-input type="number"
-                        @mousewheel.native.prevent
-                        v-number
-                        :disabled="domain.disabled"
-                        v-model.trim="domain.max"></el-input>
+              <el-input
+                type="number"
+                @mousewheel.native.prevent
+                v-number
+                :disabled="domain.disabled"
+                v-model.trim="domain.max"
+              ></el-input>
             </el-form-item>
             <el-form-item>
-              <el-input style="width: auto;"
-                        type="number"
-                        @mousewheel.native.prevent
-                        :disabled="domain.disabled"
-                        v-model.trim="domain.money"></el-input>
-              <el-button v-if="index != 0 && !domain.disabled"
-                         @click.prevent="removeDomain(result, domain)">删除</el-button>
+              <el-input
+                style="width: auto"
+                type="number"
+                @mousewheel.native.prevent
+                :disabled="domain.disabled"
+                v-model.trim="domain.money"
+              ></el-input>
+              <el-button
+                v-if="index != 0 && !domain.disabled"
+                @click.prevent="removeDomain(result, domain)"
+                >删除</el-button
+              >
             </el-form-item>
           </div>
-          <div class="el-form-item__error"
-               v-if="result.errorText">{{ result.errorText }}</div>
+          <div class="el-form-item__error" v-if="result.errorText">
+            {{ result.errorText }}
+          </div>
         </div>
         <el-form-item class="add">
-          <el-button icon="el-icon-plus"
-                     @click="addDomain(result)">新增梯度</el-button>
+          <el-button icon="el-icon-plus" @click="addDomain(result)"
+            >新增梯度</el-button
+          >
         </el-form-item>
 
-        <el-form-item prop="vipGroupCategoryIdList"
-                      label="课程类型"
-                      style="width: 500px">
-          <el-select style="width: 100% !important;"
-                     v-model.trim="result.vipGroupCategoryIdList"
-                     filterable
-                     clearable
-                     multiple
-                     placeholder="请选择">
-            <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
+          prop="vipGroupCategoryIdList"
+          label="课程类型"
+          style="width: 500px"
+        >
+          <select-all
+            style="width: 100% !important"
+            v-model.trim="result.vipGroupCategoryIdList"
+            filterable
+            clearable
+            multiple
+            placeholder="请选择"
+          >
+            <!-- <el-select > -->
+            <el-option
+              v-for="item in selects.vipGroupCategory"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id.toString()"
+            >
+            </el-option>
+          </select-all>
+          <!-- </el-select> -->
         </el-form-item>
 
-        <el-form-item prop="organId"
-                      label="所属分部"
-                      style="width: 500px">
-          <el-select style="width: 100% !important;"
-                     filterable
-                     clearable
-                     @change="onSubjectChange('search')"
-                     v-model.trim="result.organId"
-                     placeholder="请选择">
-            <el-option v-for="item in selects.branchs"
-                       :key="item.id"
-                       :label="item.name"
-                       :value="item.id.toString()"> </el-option>
+        <el-form-item prop="organId" label="所属分部" style="width: 500px">
+          <el-select
+            style="width: 100% !important"
+            filterable
+            clearable
+            @change="onSubjectChange('search')"
+            v-model.trim="result.organId"
+            placeholder="请选择"
+          >
+            <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>
 
-        <el-form-item prop="subjectIds"
-                      label="所属声部"
-                      style="width: 500px">
-          <el-select style="width: 100% !important;"
-                     filterable
-                     clearable
-                     multiple
-                     @change="onSubjectChange('search')"
-                     v-model.trim="result.subjectIds"
-                     placeholder="请选择">
-            <el-option v-for="(item, i) in selects.subjects"
-                         :key="i"
-                         :label="item.name"
-                         :value="item.id.toString()"></el-option>
-          </el-select>
+        <el-form-item prop="subjectIds" label="所属声部" style="width: 500px">
+          <select-all
+            style="width: 100% !important"
+            filterable
+            clearable
+            multiple
+            @change="onSubjectChange('search')"
+            v-model.trim="result.subjectIds"
+            placeholder="请选择"
+          >
+            <el-option
+              v-for="(item, i) in selects.subjects"
+              :key="i"
+              :label="item.name"
+              :value="item.id.toString()"
+            ></el-option>
+          </select-all>
         </el-form-item>
 
-        <el-form-item prop="teacherId"
-                      label="老师"
-                      style="width: 500px">
-          <el-select style="width: 80% !important;"
-                     v-model.trim="result.teacherId"
-                     filterable
-                     clearable
-                     multiple
-                     placeholder="请选择">
-            <el-option v-for="(item, index) in teacherList"
-                       :key="index"
-                       :label="item.label"
-                       :value="item.value.toString()"> </el-option>
-          </el-select>
-          <el-button @click="onCheckAll">全选</el-button>
+        <el-form-item prop="teacherId" label="老师" style="width: 500px">
+          <select-all
+            style="width: 100% !important"
+            v-model.trim="result.teacherId"
+            filterable
+            clearable
+            multiple
+            placeholder="请选择"
+          >
+            <el-option
+              v-for="(item, index) in teacherList"
+              :key="index"
+              :label="item.label"
+              :value="item.value.toString()"
+            >
+            </el-option>
+          </select-all>
+          <!-- <el-button @click="onCheckAll">全选</el-button> -->
         </el-form-item>
         <el-form-item>
           <el-button @click="resetForm">重置</el-button>
-          <el-button type="primary"
-                     @click="onSubmit('form')">立即{{ pageType == "create" ? '创建' : '修改' }}</el-button>
+          <el-button type="primary" @click="onSubmit('form')"
+            >立即{{ pageType == "create" ? "创建" : "修改" }}</el-button
+          >
         </el-form-item>
       </el-form>
     </div>
   </div>
 </template>
 <script>
-import { getEmployeeOrgan, getSoundTree } from '@/api/buildTeam'
-import { courseScheduleRewardsQuery, getUserRole, courseScheduleRewardsAdd, courseScheduleRewardsUpdate, findTeacherByOrganId } from '@/api/systemManage'
-import { vipGroupCategory } from "@/api/vipSeting"
+import { getEmployeeOrgan, getSoundTree } from "@/api/buildTeam";
+import {
+  courseScheduleRewardsQuery,
+  getUserRole,
+  courseScheduleRewardsAdd,
+  courseScheduleRewardsUpdate,
+  findTeacherByOrganId,
+} from "@/api/systemManage";
+import { vipGroupCategory } from "@/api/vipSeting";
 export default {
-  name: 'branchActiveOperation',
-  data () {
+  name: "branchActiveOperation",
+  data() {
     return {
       organId: null,
       pageType: this.$route.query.type,
@@ -157,224 +188,279 @@ export default {
         organId: null,
         teacherId: null,
         subjectIds: null,
-        courseScheduleType: 'VIP',
-        domains: [{
-          min: null,
-          max: null,
-          money: null,
-          disabled: false,
-          key: Date.now()
-        }],
-        errorText: null
+        courseScheduleType: "VIP",
+        domains: [
+          {
+            min: null,
+            max: null,
+            money: null,
+            disabled: false,
+            key: Date.now(),
+          },
+        ],
+        errorText: null,
       },
       rules: {
-        name: [{ required: true, message: '请输入活动名称', trigger: 'blur' }],
-        rewardMode: [{ required: true, message: '请选择活动类型', trigger: 'change' }],
-        vipGroupCategoryIdList: [{ type: 'array', required: true, message: '请选择课程类型', trigger: 'change' }],
-        organId: [{ required: true, message: '请选择所属分部', trigger: 'change' }],
-        subjectIds: [{ type: 'array', required: true, message: '请选择所属声部', trigger: 'change' }],
-        teacherId: [{ type: 'array', required: true, message: '请选择老师', trigger: 'change' }]
-      }
-    }
+        name: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
+        rewardMode: [
+          { required: true, message: "请选择活动类型", trigger: "change" },
+        ],
+        vipGroupCategoryIdList: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择课程类型",
+            trigger: "change",
+          },
+        ],
+        organId: [
+          { required: true, message: "请选择所属分部", trigger: "change" },
+        ],
+        subjectIds: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择所属声部",
+            trigger: "change",
+          },
+        ],
+        teacherId: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择老师",
+            trigger: "change",
+          },
+        ],
+      },
+    };
   },
-  mounted () {
-    this.__init()
+  mounted() {
+    this.__init();
   },
   methods: {
-    async __init () {
-      this.$refs.form.resetFields()
+    async __init() {
+      this.$refs.form.resetFields();
       // 获取类型
-      this.$store.dispatch('setVipGroupCategory')
+      this.$store.dispatch("setVipGroupCategory");
       // 获取分部
-      this.$store.dispatch('setBranchs')
+      this.$store.dispatch("setBranchs");
       // 获取声部
-      this.$store.dispatch('setSubjects')
+      this.$store.dispatch("setSubjects");
 
-      if (this.pageType == 'update') {
-        let courseScheduleRewards = await courseScheduleRewardsQuery({ id: this.id })
+      if (this.pageType == "update") {
+        let courseScheduleRewards = await courseScheduleRewardsQuery({
+          id: this.id,
+        });
         if (courseScheduleRewards.code == 200) {
-          let data = courseScheduleRewards.data
+          let data = courseScheduleRewards.data;
           this.$nextTick(() => {
-            this.result.organId = data.organId
-            this.result.subjectIds = data.subjectIds ? data.subjectIds.split(',') : data.subjectIds
-            this.onSubjectChange('update')
+            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,
+              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
-            }
-          })
+              domains: data.rewardsRulesJson
+                ? JSON.parse(data.rewardsRulesJson)
+                : [
+                    {
+                      min: null,
+                      max: null,
+                      money: null,
+                      disabled: false,
+                      key: Date.now(),
+                    },
+                  ],
+              errorText: null,
+            };
+          });
         }
       } else {
-        this.resetForm()
+        this.resetForm();
       }
     },
-    async onSubjectChange (type) {
-      let organId = this.result.organId
-      let subject = this.result.subjectIds
+    async onSubjectChange(type) {
+      let organId = this.result.organId;
+      let subject = this.result.subjectIds;
       // 判断是否有分部和声部
-      if (subject.length <= 0 || !organId || organId == '') {
-        this.teacherList = []
-        this.result.teacherId = []
-        return
+      if (subject.length <= 0 || !organId || organId == "") {
+        this.teacherList = [];
+        this.result.teacherId = [];
+        return;
       }
-      let subjectIds = Object.assign([], subject).join(',')
-      await findTeacherByOrganId({ organId: organId, subjectIds: subjectIds, jobNature: 'FULL_TIME' }).then(res => {
+      let subjectIds = Object.assign([], subject).join(",");
+      await findTeacherByOrganId({
+        organId: organId,
+        subjectIds: subjectIds,
+        jobNature: "FULL_TIME",
+      }).then((res) => {
         if (res.code == 200) {
-          if (type != 'update') {
-            this.teacherList = []
-            this.result.teacherId = []
+          if (type != "update") {
+            this.teacherList = [];
+            this.result.teacherId = [];
           }
-          res.data.forEach(item => {
+          res.data.forEach((item) => {
             this.teacherList.push({
               label: item.realName,
-              value: item.id
-            })
-          })
+              value: item.id,
+            });
+          });
         }
-      })
+      });
     },
-    onCheckAll () { // 全选老师
+    onCheckAll() {
+      // 全选老师
       if (this.teacherList.length <= 0) {
-        return
+        return;
       }
-      this.result.teacherId = []
-      this.teacherList.forEach(item => {
-        this.result.teacherId.push(item.value.toString())
-      })
+      this.result.teacherId = [];
+      this.teacherList.forEach((item) => {
+        this.result.teacherId.push(item.value.toString());
+      });
     },
-    onSubmit (formName) {
+    onSubmit(formName) {
       this.$refs[formName].validate((valid) => {
-        let result = JSON.parse(JSON.stringify(this.result))
-        this.addDomain(result, true)
+        let result = JSON.parse(JSON.stringify(this.result));
+        this.addDomain(result, true);
         if (valid && !result.errorText) {
           // 如果奖励金额为空时,默认为0
-          result.domains.forEach(item => {
+          result.domains.forEach((item) => {
             if (!item.money) {
-              item.money = 0
+              item.money = 0;
             }
-          })
+          });
           let params = {
             organId: result.organId,
-            vipGroupCategoryIdList: result.vipGroupCategoryIdList.join(','),
-            teacherId: result.teacherId.join(','),
+            vipGroupCategoryIdList: result.vipGroupCategoryIdList.join(","),
+            teacherId: result.teacherId.join(","),
             courseScheduleType: result.courseScheduleType,
             rewardMode: result.rewardMode,
-            subjectIds: result.subjectIds.join(','),
+            subjectIds: result.subjectIds.join(","),
             rewardsRulesJson: JSON.stringify(result.domains),
-            name: result.name
-          }
-          if (this.pageType == 'update') {
-            params.id = result.id
-            courseScheduleRewardsUpdate(params).then(res => {
-              this.messageTips('修改', res)
-            })
-          } else if (this.pageType == 'create') {
+            name: result.name,
+          };
+          if (this.pageType == "update") {
+            params.id = result.id;
+            courseScheduleRewardsUpdate(params).then((res) => {
+              this.messageTips("修改", res);
+            });
+          } else if (this.pageType == "create") {
             // return false
-            courseScheduleRewardsAdd(params).then(res => {
-              this.messageTips('添加', res)
-            })
+            courseScheduleRewardsAdd(params).then((res) => {
+              this.messageTips("添加", res);
+            });
           }
         } else {
           return false;
         }
-      })
-
+      });
     },
-    messageTips (title, res) {
+    messageTips(title, res) {
       if (res.code == 200) {
-        this.$message.success('修改成功')
-        this.$store.dispatch('delVisitedViews', this.$route)
-        this.$router.push({ path: '/vipClassSet/branchActive', query: { rules: this.pageInfo, searchForm: this.searchForm } })
+        this.$message.success("修改成功");
+        this.$store.dispatch("delVisitedViews", this.$route);
+        this.$router.push({
+          path: "/vipClassSet/branchActive",
+          query: { rules: this.pageInfo, searchForm: this.searchForm },
+        });
       } else {
-        this.$message.error(res.msg)
+        this.$message.error(res.msg);
       }
     },
-    onCancel () {
-      this.$store.dispatch('delVisitedViews', this.$route)
-      this.$router.push({ path: '/vipClassSet/branchActive', query: { rules: this.pageInfo, searchForm: this.searchForm } })
+    onCancel() {
+      this.$store.dispatch("delVisitedViews", this.$route);
+      this.$router.push({
+        path: "/vipClassSet/branchActive",
+        query: { rules: this.pageInfo, searchForm: this.searchForm },
+      });
     },
-    resetForm () {
-      this.teacherList = []
+    resetForm() {
+      this.teacherList = [];
       this.result = {
         name: null,
         rewardMode: null,
         organId: null,
         subjectIds: [],
         teacherId: [],
-        courseScheduleType: 'VIP',
-        domains: [{
-          min: null,
-          max: null,
-          money: null,
-          disabled: false,
-          key: Date.now()
-        }],
-        errorText: null
-      }
-      this.$refs.form.resetFields()
+        courseScheduleType: "VIP",
+        domains: [
+          {
+            min: null,
+            max: null,
+            money: null,
+            disabled: false,
+            key: Date.now(),
+          },
+        ],
+        errorText: null,
+      };
+      this.$refs.form.resetFields();
     },
-    removeDomain (form, item) {
-      var index = form.domains.indexOf(item)
+    removeDomain(form, item) {
+      var index = form.domains.indexOf(item);
       if (index !== -1) {
-        form.domains.splice(index, 1)
+        form.domains.splice(index, 1);
         // 取消最后一个数据的禁用状态
-        form.domains[form.domains.length - 1].disabled = false
-        form.errorText = null
+        form.domains[form.domains.length - 1].disabled = false;
+        form.errorText = null;
       }
     },
-    addDomain (form, checked) {
+    addDomain(form, checked) {
       // debugger
       let domains = form.domains,
         singleLength = domains.length,
-        lastDate = domains[singleLength - 1] // 获取倒数一个对象
+        lastDate = domains[singleLength - 1]; // 获取倒数一个对象
       if (!lastDate.min) {
-        form.errorText = '最小值不能为空'
-        return
+        form.errorText = "最小值不能为空";
+        return;
       }
       if (singleLength <= 1 && parseInt(lastDate.min) <= 0) {
-        form.errorText = '最小值不能小于0'
-        return
-      } else if (singleLength > 1 && parseInt(lastDate.min) <= parseInt(domains[singleLength - 2].max)) {
-        form.errorText = '最小值不能小于或等于上一个梯度的最大值'
-        return
+        form.errorText = "最小值不能小于0";
+        return;
+      } else if (
+        singleLength > 1 &&
+        parseInt(lastDate.min) <= parseInt(domains[singleLength - 2].max)
+      ) {
+        form.errorText = "最小值不能小于或等于上一个梯度的最大值";
+        return;
       }
 
       if (!parseInt(lastDate.max)) {
-        form.errorText = '最大值不能为空'
-        return
+        form.errorText = "最大值不能为空";
+        return;
       } else if (parseInt(lastDate.max) <= parseInt(lastDate.min)) {
-        form.errorText = '最大值应大于该梯度的最小值'
-        return
+        form.errorText = "最大值应大于该梯度的最小值";
+        return;
       }
 
-      form.errorText = null
+      form.errorText = null;
       if (!checked) {
-        lastDate.disabled = true
+        lastDate.disabled = true;
         domains.push({
           min: null,
           max: null,
           disabled: false,
-          key: Date.now()
-        })
+          key: Date.now(),
+        });
       }
-    }
-  }
-}
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
 .el-button--primary {
@@ -445,4 +531,4 @@ export default {
   text-align: center;
   margin-right: 10px;
 }
-</style>
+</style>

+ 11 - 7
src/views/vipClass/vipList.vue

@@ -75,7 +75,7 @@
         </el-form-item>
 
         <el-form-item>
-          <el-select
+          <!-- <el-select
             v-model.trim="searchForm.teacherId"
             clearable
             filterable
@@ -87,7 +87,11 @@
               :value="item.id"
               :label="item.realName"
             ></el-option>
-          </el-select>
+          </el-select> -->
+               <remote-search
+            :commit="'setTeachers'"
+            v-model="searchForm.userId"
+          />
         </el-form-item>
         <el-form-item>
           <el-select
@@ -438,11 +442,11 @@ export default {
       });
 
       //   <!-- 状态 指导老师 活动方案-->
-      getTeacher({ organId: this.organId }).then((res) => {
-        if (res.code == 200) {
-          this.teacherList = res.data;
-        }
-      });
+      // getTeacher({ organId: this.organId }).then((res) => {
+      //   if (res.code == 200) {
+      //     this.teacherList = res.data;
+      //   }
+      // });
       // 获取活动方案
       vipGroupActivity({ organId: this.organId, rows: 9999 }).then((res) => {
         if (res.code == 200) {