浏览代码

bug修改

wyq 4 年之前
父节点
当前提交
8c81ba5cd3
共有 1 个文件被更改,包括 185 次插入49 次删除
  1. 185 49
      src/components/icss/plan/AddPlan.vue

+ 185 - 49
src/components/icss/plan/AddPlan.vue

@@ -43,8 +43,8 @@
                     <transition name="plus-icon">
                       <div v-if="isOpenCloseItems">
                         <ul class="sub" v-for="(item,index) in  planDefaultList" :key="item.id">
-                          <li class="planItem">
-                            <div class="sort">
+                          <li class="planItem" >
+                            <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')"
@@ -66,8 +66,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"
@@ -96,6 +98,39 @@
                               </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>
@@ -264,56 +299,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];
       }
     },
 
@@ -342,7 +393,7 @@ export default {
       this.isTopLight = -1;
     },
 
-    // 获取默认方案配置
+    // 添加 获取默认方案配置
     _getDefaultPlans() {
       api.getDefaultPlans().then(res => {
         // console.log(res, '获取默认的方案配置');
@@ -351,6 +402,43 @@ export default {
             res.data.data &&
             res.data.data.planDetailDefault.length !== 0 &&
             res.data.data.planDetailDefault[0].planDetails;
+          let planDefaultList = this.planDefaultList.map((item, index) => {
+            if (
+              item.name == '高危' ||
+              item.name == '危急值提醒' ||
+              item.name == '其他提醒'
+            ) {
+              return {
+                ismove: false,
+                ...item
+              };
+            } else {
+              return {
+                arr: [],
+                ismove: true,
+                ...item
+              };
+            }
+          });
+          // this.planDefaultList = JSON.parse(JSON.stringify(planDefaultList)) ;
+          planDefaultList
+            .slice()
+            .reverse()
+            .forEach((item, i, arr) => {
+              if (
+                item.name == '高危' ||
+                item.name == '危急值提醒' ||
+                item.name == '其他提醒'
+              ) {
+                planDefaultList.splice(arr.length - 1 - i, 1);
+                planDefaultList
+                  .find(items => {
+                    return items.name == '开单合理性';
+                  })
+                  .arr.push(item);
+              }
+            });
+          this.planDefaultList = planDefaultList;
           this.switchSubStatus =
             res.data.data &&
             res.data.data.planDetailDefault.length !== 0 &&
@@ -414,10 +502,58 @@ export default {
       }
       // console.log(endArr,'-=-=-=-=-=');
       this.planDefaultList = endArr;
+      let planDefaultList = this.planDefaultList.map((item, index) => {
+        if (
+          item.name == '高危' ||
+          item.name == '危急值提醒' ||
+          item.name == '其他提醒'
+        ) {
+          return {
+            ismove: false,
+            ...item
+          };
+        } else {
+          return {
+            arr: [],
+            ismove: true,
+            ...item
+          };
+        }
+      });
+      planDefaultList
+            .slice()
+            .reverse()
+            .forEach((item, i, arr) => {
+              if (
+                item.name == '高危' ||
+                item.name == '危急值提醒' ||
+                item.name == '其他提醒'
+              ) {
+                planDefaultList.splice(arr.length - 1 - i, 1);
+                planDefaultList
+                  .find(items => {
+                    return items.name == '开单合理性';
+                  })
+                  .arr.push(item);
+              }
+            });
+      this.planDefaultList = planDefaultList;
     },
 
     // format处理细项数据
     handleSendData() {
+      this.planDefaultList.forEach((item, i) => {
+        if(item.name == '开单合理性'){
+          item.arr.slice().reverse().forEach(items => {
+            if (items.name == '高危' ||items.name == '危急值提醒' ||items.name == '其他提醒') {
+              console.log(i)
+              this.planDefaultList.splice(i+1, 0, items);
+            }
+          })
+          item.arr = []
+        }
+      })
+      console.log(this.planDefaultList)
       let TempPlanDetail = [];
       TempPlanDetail = this.planDefaultList.map((item, index) => {
         return {
@@ -433,7 +569,7 @@ export default {
         };
       });
       return TempPlanDetail;
-      // console.log(TempPlanDetail, 'TempPlanDetail');
+      console.log(TempPlanDetail, 'TempPlanDetail');
     },
 
     // 处理保存活动信息参数