Browse Source

bug修改

wyq 4 years ago
parent
commit
f6e33924f4
1 changed files with 103 additions and 48 deletions
  1. 103 48
      src/components/cdssManage/plan/AddPlan.vue

+ 103 - 48
src/components/cdssManage/plan/AddPlan.vue

@@ -62,7 +62,7 @@
                       <div v-if="isOpenCloseItems">
                         <ul class="sub" v-for="(item,index) in  planDefaultList" :key="item.id">
                           <li class="planItem">
-                            <div class="sort">
+                            <div class="sort" v-if="item.ismove">
                               <div class="top">
                                 <img
                                   :src="isTopLight !== index ? require('../../../images/icon_default_top.png') : require('../../../images/icon_hover_top.png')"
@@ -84,8 +84,10 @@
                                 />
                               </div>
                             </div>
+                            <div class="sort" v-else></div>
                             <div class="openOrClose">
                               <span class="planInfo">{{item.name}}</span>
+                              <!-- <span class="planInfo">{{i.name}}</span> -->
                               <div class="switch">
                                 <el-switch
                                   v-model="item.status"
@@ -114,6 +116,43 @@
                               </el-select>
                             </div>
                           </li>
+                          <li
+                            class="planItem"
+                            v-if="item.arr.length>0"
+                            v-for="i in  item.arr"
+                            :key="i.id"
+                          >
+                            <div class="sort"></div>
+                            <div class="openOrClose">
+                              <span class="planInfo">{{i.name}}</span>
+                              <div class="switch">
+                                <el-switch
+                                  v-model="i.status"
+                                  :active-value="1"
+                                  :inactive-value="0"
+                                  active-color="#4BC4D7"
+                                  inactive-color="#BBBBBB"
+                                ></el-switch>
+                              </div>
+                              <span class="planStatus">{{i.status === 1 ? '启用中' : '未启用'}}</span>
+                            </div>
+                            <div class="showNum" v-if="item.number">
+                              <span style="marginRight:8px;">默认显示个数</span>
+                              <el-select
+                                v-model="item.number"
+                                placeholder="请选择"
+                                size="small"
+                                :disabled="item.status !== 1 ? true: false"
+                              >
+                                <el-option label="1" value="1"></el-option>
+                                <el-option label="2" value="2"></el-option>
+                                <el-option label="3" value="3"></el-option>
+                                <el-option label="4" value="4"></el-option>
+                                <el-option label="5" value="5"></el-option>
+                                <el-option label="6" value="6"></el-option>
+                              </el-select>
+                            </div>
+                          </li>
                         </ul>
                       </div>
                     </transition>
@@ -227,7 +266,7 @@ export default {
     };
   },
   beforeRouteLeave(to, from, next) {
-    console.log(this.editCount,'this.editCount');
+    console.log(this.editCount, 'this.editCount');
     if (
       (this.editCount > 3 && !this.isSaveSuccess && this.isEdit) ||
       (this.editCount > 1 && !this.isSaveSuccess && !this.isEdit)
@@ -275,7 +314,7 @@ export default {
     if (isEdit) {
       // 编辑页面
       this.isEdit = true;
-      this.form.hospitalId = data.hospitalId
+      this.form.hospitalId = data.hospitalId;
       let params = {
         hospitalId: data.hospitalId,
         id: data.id
@@ -298,56 +337,72 @@ export default {
     },
     // 方案配置排序
     sortPlan(item, index, type) {
-      // console.log('排序', item, index, type);
+      console.log('排序', item, index, type);
       let tempList = [...this.planDefaultList];
       if (type === 'down') {
+        tempList.splice(index + 2, 0, item);
+        tempList.splice(index, 1);
+        [tempList[index + 1].orderNo, tempList[index].orderNo] = [
+          tempList[index].orderNo,
+          tempList[index + 1].orderNo
+        ];
+        this.planDefaultList = tempList;
         // 降序
-        let plan = tempList.find(item => {
-          return item.orderNo === index + 1;
-        });
-        let tempPlan = { ...plan };
-        let planNext = tempList.find(item => {
-          return item.orderNo === index + 2;
-        });
-        let tempPlanNext = { ...planNext };
-        plan = tempPlanNext;
-        plan.orderNo -= 1;
-        planNext = tempPlan;
-        planNext.orderNo += 1;
-        let arr = tempList.map((i, idx) => {
-          if (idx === index) {
-            return { ...plan };
-          } else if (idx === index + 1) {
-            return { ...planNext };
-          } else {
-            return i;
-          }
-        });
-        this.planDefaultList = [...arr];
+        // let plan = tempList.find(item => {
+        //   console.log(item)
+        //   return item.orderNo === index + 1;
+        // });
+        // console.log(item);
+        // let tempPlan = { ...plan };
+        // let planNext = tempList.find(item => {
+        //   return item.orderNo === index + 2;
+        // });
+        // let tempPlanNext = { ...planNext };
+        // plan = tempPlanNext;
+        // plan.orderNo -= 1;
+        // planNext = tempPlan;
+        // planNext.orderNo += 1;
+        // let arr = tempList.map((i, idx) => {
+        //   if (idx === index) {
+        //     return { ...plan };
+        //   } else if (idx === index + 1) {
+        //     return { ...planNext };
+        //   } else {
+        //     return i;
+        //   }
+        // });
+        // this.planDefaultList = [...arr];
       } else {
+         tempList.splice(index - 1, 0, item);
+        tempList.splice(index+1, 1);
+        [tempList[index - 1].orderNo, tempList[index+1].orderNo] = [
+          tempList[index+1].orderNo,
+          tempList[index - 1].orderNo
+        ];
+        this.planDefaultList = tempList;
         // 升序
-        let plan = tempList.find(item => {
-          return item.orderNo === index + 1;
-        });
-        let tempPlan = { ...plan };
-        let planPre = tempList.find(item => {
-          return item.orderNo === index;
-        });
-        let tempPlanPre = { ...planPre };
-        plan = tempPlanPre;
-        plan.orderNo += 1;
-        planPre = tempPlan;
-        planPre.orderNo -= 1;
-        let arr = tempList.map((i, idx) => {
-          if (idx === index) {
-            return { ...plan };
-          } else if (idx === index - 1) {
-            return { ...planPre };
-          } else {
-            return i;
-          }
-        });
-        this.planDefaultList = [...arr];
+        // let plan = tempList.find(item => {
+        //   return item.orderNo === index + 1;
+        // });
+        // let tempPlan = { ...plan };
+        // let planPre = tempList.find(item => {
+        //   return item.orderNo === index;
+        // });
+        // let tempPlanPre = { ...planPre };
+        // plan = tempPlanPre;
+        // plan.orderNo += 1;
+        // planPre = tempPlan;
+        // planPre.orderNo -= 1;
+        // let arr = tempList.map((i, idx) => {
+        //   if (idx === index) {
+        //     return { ...plan };
+        //   } else if (idx === index - 1) {
+        //     return { ...planPre };
+        //   } else {
+        //     return i;
+        //   }
+        // });
+        // this.planDefaultList = [...arr];
       }
     },