Browse Source

Merge branch '0601Action' into test

lex-xin 4 years ago
parent
commit
010293a947

+ 5 - 0
src/components/select-all/index.vue

@@ -19,6 +19,7 @@
         class="select"
         v-bind="{ ...$attrs, ...$props }"
         v-on:input="(value) => $emit('input', value)"
+        @change="onChange"
         ref="select"
       >
         <slot />
@@ -59,7 +60,11 @@ export default {
         .filter((item) => !item.disabled && item.value)
         .map((item) => item.value);
       this.$emit("input", values);
+      this.$emit('change', values)
     },
+    onChange(val) {
+      this.$emit('change', val)
+    }
   },
 };
 </script>

+ 3 - 4
src/views/buildVip/index.vue

@@ -1832,14 +1832,13 @@ export default {
           });
         }
       });
-
-      if (this.leftForm.courseType && this.leftForm.teacher && this.activeStudentList.length == 1) {
-        let firstStudentId = this.activeStudentList[0].studentId
+      if (this.leftForm.courseType && this.leftForm.teacher && this.leftForm.students && this.leftForm.students.length >= 1) {
+        let studentIds = this.leftForm.students.join(',')
         // 根据课程类型获取活动方案
         vipGroupActivityFind({
           categoryId: this.leftForm.courseType,
           teacherId: this.leftForm.teacher,
-          firstStudentId
+          studentIds
         }).then((res) => {
           if (res.code == 200) {
             this.activeList = res.data;

+ 57 - 6
src/views/businessManager/shopManager/shopList.vue

@@ -69,6 +69,20 @@
             placeholder="商品编号/货号/商品名称"
           ></el-input>
         </el-form-item>
+        <el-form-item prop="organId">
+          <el-select
+            v-model.trim="searchForm.organId"
+            clearable
+            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="type">
           <el-select
             v-model.trim="searchForm.type"
@@ -415,6 +429,21 @@
             placeholder="请输入品牌"
           ></el-input>
         </el-form-item>
+        <el-form-item label="所属分部" :label-width="formLabelWidth" prop="organIdList">
+          <select-all v-model.trim="form.organIdList"
+                     filterable
+                     placeholder="请选择所属分部"
+                     style="width: 100% !important"
+                     multiple
+                     :disabled="addDisabled || addType == 'update'"
+                     @change="onOrganChange"
+                     clearable>
+            <el-option v-for="item in selects.branchs"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id.toString()"></el-option>
+          </select-all>
+        </el-form-item>
         <el-form-item
           label="商品类型"
           prop="type"
@@ -482,7 +511,7 @@
               @change="onGoodsChange"
               filterable
               style=" width: 100% !important"
-              :disabled="addDisabled"
+              :disabled="addDisabled || form.organIdList.length <= 0"
               placeholder="请选择商品"
             >
               <el-option
@@ -494,7 +523,7 @@
               ></el-option>
             </el-select>
           </el-form-item>
-          <div v-if="!addDisabled" style="display: inline-block">
+          <div v-if="!addDisabled && form.organIdList.length > 0" style="display: inline-block">
             <el-button
               icon="el-icon-minus"
               v-if="form.goodsList.length > 1"
@@ -724,6 +753,7 @@ export default {
       searchForm: {
         search: null,
         groupGoods: null,
+        organId: null,
         type: null,
         status: null,
         goodsCategoryId: null,
@@ -764,6 +794,7 @@ export default {
         supplyChannel: null,
         name: null,
         type: null,
+        organIdList: [],
         goodsCategoryId: null,
         specification: null,
         marketPrice: null,
@@ -834,6 +865,13 @@ export default {
             trigger: "change",
           },
         ],
+        organIdList: [
+          {
+            required: true,
+            message: "请选择所属分部",
+            trigger: "change",
+          },
+        ],
         goodsCategoryId: [
           {
             required: true,
@@ -939,6 +977,8 @@ export default {
     };
   },
   mounted() {
+    // 获取分部
+    this.$store.dispatch("setBranchs");
     this.init();
   },
   methods: {
@@ -1037,12 +1077,13 @@ export default {
         }
       });
     },
-    getAllGoodsList() {
+    getAllGoodsList(organId) {
       // 获取所有商品
       goodsQuery({
         rows: 9999,
         page: 1,
         groupGoods: 0,
+        organId,
         status: 1,
       }).then((res) => {
         if (res.code == 200 && res.data) {
@@ -1074,6 +1115,7 @@ export default {
         clientShow: null,
         educationalShow: null,
         musicGroupShow: null,
+        organIdList: [],
         courseViewType: [],
         stockWarning: null,
         image: null,
@@ -1094,8 +1136,12 @@ export default {
       if (this.$refs["ruleForm"]) {
         this.$refs["ruleForm"].resetFields();
       }
-      // 获取所有商品
-      this.getAllGoodsList();
+    },
+    onOrganChange(val) {
+      if(val && val.length > 0) {
+        // 获取所有商品
+        this.getAllGoodsList(val.join(','));
+      }
     },
     onValidGoodsStatus() {
       // 更新商品选择状态
@@ -1144,8 +1190,12 @@ export default {
           form.courseViewType = row.courseViewType.split(',')
         }
 
+        if(row.organIdList) {
+          form.organIdList = row.organIdList.split(',')
+          this.getAllGoodsList(row.organIdList);
+        }
+
         this.onValidGoodsStatus();
-        this.getAllGoodsList();
       } else {
         let pageTitle = "添加";
         if (type == "update") {
@@ -1268,6 +1318,7 @@ export default {
           });
           form.complementGoodsIdList = tempIds.join(",");
           form.courseViewType = form.courseViewType.join(',')
+          form.organIdList = form.courseViewType.join(',')
           form.goodsList = null;
           if (this.addType == "create" || this.addType == "copy") {
             if (this.form.id) {

+ 36 - 1
src/views/businessManager/shopManager/shopOperation.vue

@@ -68,6 +68,20 @@
             </el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="所属分部" prop="organIdList">
+          <select-all v-model.trim="form.organIdList"
+                     filterable
+                     placeholder="请选择所属分部"
+                     style="width: 400px !important"
+                     multiple
+                     :disabled="pageDisabled || pageType == 'update'"
+                     clearable>
+            <el-option v-for="item in selects.branchs"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id.toString()"></el-option>
+          </select-all>
+        </el-form-item>
         <el-form-item label="商品型号" prop="specification">
           <el-input
             v-model.trim="form.specification"
@@ -301,6 +315,7 @@ export default {
         name: null,
         type: null,
         goodsCategoryId: null,
+        organIdList: [],
         specification: null,
         stockCount: null,
         taxStockCount: null,
@@ -364,6 +379,13 @@ export default {
             trigger: "change",
           },
         ],
+        organIdList: [
+          {
+            required: true,
+            message: '请选择所属分部',
+            trigger: "change"
+          }
+        ],
         specification: [
           {
             required: true,
@@ -458,6 +480,8 @@ export default {
     };
   },
   mounted() {
+    // 获取分部
+    this.$store.dispatch("setBranchs");
     this.init();
   },
   methods: {
@@ -476,7 +500,12 @@ export default {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           let tempForm = JSON.parse(JSON.stringify(this.form))
-          tempForm.courseViewType = tempForm.courseViewType.join(',')
+          if(tempForm.courseViewType) {
+            tempForm.courseViewType = tempForm.courseViewType.join(',')
+          }
+          if(tempForm.organIdList) {
+            tempForm.organIdList = tempForm.organIdList.join(',')
+          }
           if (this.pageType == "create" || this.pageType == 'copy') {
             if (tempForm.id) {
               // 判断有没有Id,如果有则删除
@@ -536,6 +565,7 @@ export default {
           name: null,
           type: null,
           goodsCategoryId: null,
+          organIdList: [],
           specification: null,
           stockCount: null,
           taxStockCount: null,
@@ -563,6 +593,10 @@ export default {
             if(result.courseViewType) {
               courseViewType = result.courseViewType.split(',')
             }
+            let organIdList = []
+            if(result.organIdList) {
+              organIdList = result.organIdList.split(',')
+            }
             this.form = {
               id: result.id,
               sn: result.sn,
@@ -571,6 +605,7 @@ export default {
               name: result.name,
               type: result.type,
               goodsCategoryId: result.goodsCategoryId,
+              organIdList: organIdList,
               specification: result.specification,
               stockCount: result.stockCount,
               taxStockCount: result.taxStockCount,