Selaa lähdekoodia

Merge branch 'master' of http://47.102.110.240:3000/yuxiangpei/tbServantMini_cloud

una 4 vuotta sitten
vanhempi
commit
db941067fb

+ 1 - 1
client/pages/customer/dailytasks/dailytasks.axml

@@ -3,7 +3,7 @@
     <view class="common-card dailyitem">
       <view class="cell-title">{{item.categoryName}}</view>
       <view class="daily-list">
-        <view a:for="{{item.TaskItems}}" class="daily-item {{item.TaskItems.indexOf(item.id)!=-1 ?'daily-item-selected':''}}" key="{{index}}" data-id="{{item.id}}"  onTap="toggleWashinGandnursing">{{item.itemName}}</view>
+        <view a:for="{{item.TaskItems}}" class="daily-item {{item.TaskItems.indexOf(item.index)!=-1 ?'work-item-selected':''}}" a:for-index='sdddd' key="{{index}}" data-id="{{item.id}}" data-index="{{index}}" onTap="toggleWashinGandnursing">{{item.itemName}}</view>
       </view>
     </view>
   </view>

+ 84 - 40
client/pages/customer/dailytasks/dailytasks.js

@@ -113,57 +113,101 @@ Page({
       }
     ]
      */
-    allList:[]
+    allList: []
   },
   onLoad(options) {
     console.log(options);
   },
-  onShow(){
+  onShow() {
     this.initDailyTaskList();
   },
-  initDailyTaskList(){
-    let params={
+  initDailyTaskList() {
+    let params = {
     }
-     request.httpServiceGet(apiUrl.getDailyTaskList,params).then(data=>{
-        console.log(data);
-        if(data.length>0){
-            this.setData({
-              allList:data
-            });
-        }else{
-          this.setData({
-              allList:[]
-            });
-    //           my.alert({
-    //    content:JSON.stringify(data.dataList)
-    //  });  
-        }
+    request.httpServiceGet(apiUrl.getDailyTaskList, params).then(data => {
+      console.log(data);
+      if (data.length > 0) {
+        this.setData({
+          allList: data
+        });
+      } else {
+        this.setData({
+          allList: []
+        });
+        //           my.alert({
+        //    content:JSON.stringify(data.dataList)
+        //  });  
+      }
+
 
+    }).catch(e => {
+      console.log(e);
 
-          }).catch(e=>{
-           console.log(e);
-           
-        })
+    })
 
   },
-  toggleWashinGandnursing(e){
-    
-    let id=e.target.dataset.id;
-    if(this.data.washingandnursinglist.indexOf(id)==-1){
-      let newArr=this.data.washingandnursinglist;
-      newArr.push(id);
-      this.setData({
-        washingandnursinglist:newArr
-      })
-    }else{
-      let newArr=this.data.washingandnursinglist;
-      newArr.splice(newArr.indexOf(id),1);
-      this.setData({
-        washingandnursinglist:newArr
-      })
-    }
+  toggleWashinGandnursing(e) {
+
+    // let id = e.target.dataset.id;
+    let currentIndex= e.target.dataset.index;
+    console.log('index=' + currentIndex);
+    // console.log(id.currentIndex);
+    // let id=e.target.dataset.id;
+    // let isNew=this.data.allList[currentIndex].every(item=>{return id!=item.id});
+    // if(isNew){
+    //    let newArr=this.data.allList[currentIndex];
+    //    let obj={
+    //      index:id,
+    //    }
+    //   newArr.push(obj);
+    //    let newArrClass=this.data.allList[currentIndex];
+    //   newArrClass.push(id);
+    //   this.setData({
+    //     workSelectedList:newArr,
+    //     workSelectedClassList:newArrClass
+    //   })
+    // }else{
+    //   let spliceIndex='';
+    //    this.data.workSelectedList.forEach((item,index)=> {
+    //      if(item.index==id){
+    //        console.log(item,index);
+    //        spliceIndex=index;
+    //        return;
+
+    //      }
+    //    })
+    //   let newArr=this.data.workSelectedList;
+    //    let newArrClass=this.data.workSelectedClassList;
+    //    newArr.splice(spliceIndex,1);
+    //   newArrClass.splice(newArrClass.indexOf(id),1);
+    //   this.setData({
+    //      workSelectedList:newArr,
+    //     workSelectedClassList:newArrClass
+    //   })
+    // }
   },
-  dailytasksdeit(){
-    
+  dailytasksdeit() {
+    /**
+     * {
+          "employRelationNo": "string",
+          "taskItems": [
+            {
+              "categoryId": 0,
+              "itemIds": [
+              "string"
+              ]
+            }
+          ]
+        }
+     */
+    let params = {
+    }
+    request.httpServicePost(apiUrl.completeEditDailyTask, params).then(data => {
+      console.log(data);
+
+    }).catch(e => {
+      console.log(e);
+
+    })
   },
 });