Browse Source

每日任务编辑

yangyongyong 4 years ago
parent
commit
31ba2b582a

+ 1 - 1
client/pages/customer/editDailyTask/editDailyTask.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}}"  a:for-item="dailyitem" class="daily-item {{dailyitem.disabled==true ?'daily-item-selected':''}}" a:for-item="dailyitem" a:for-index='sdddd' key="{{index}}" data-id="{{dailyitem.id}}" data-index="{{dailyitem.categoryId}}" onTap="toggleWashinGandnursing">{{dailyitem.itemName}}</view>
+        <view a:for="{{item.TaskItems}}"  a:for-item="dailyitem" class="daily-item {{dailyitem.choose==1 ?'daily-item-selected':''}}" a:for-item="dailyitem" a:for-index='sdddd' key="{{index}}" data-id="{{dailyitem.itemId}}" data-index="{{dailyitem.categoryId}}" onTap="toggleWashinGandnursing">{{dailyitem.itemName}}</view>
       </view>
     </view>
   </view>

+ 21 - 9
client/pages/customer/editDailyTask/editDailyTask.js

@@ -4,7 +4,7 @@ import apiUrl1 from '../../../util/apiUrl1'
 var app = getApp();
 Page({
   data: {
-    selectdailytasklist: []
+    selectdailytasklist: [],
   },
   onLoad(options) {
     console.log(options);
@@ -37,28 +37,40 @@ Page({
   toggleWashinGandnursing(e) {
     let currentIndex= e.target.dataset.index;//类型ID
     let id = e.target.dataset.id;//选中当前ID
-    let dailytasklist=this.data.allList;
+    let dailytasklist=this.data.selectdailytasklist;
     for(let i=0;i<dailytasklist.length;i++){
       if(dailytasklist[i].categoryId==currentIndex){
         for(let j=0;j<dailytasklist[i].TaskItems.length;j++){
-          if(dailytasklist[i].TaskItems[j].id==id){
-            if(dailytasklist[i].TaskItems[j].disabled){
-              dailytasklist[i].TaskItems[j].disabled=false;
+          if(dailytasklist[i].TaskItems[j].itemId==id){
+            if(dailytasklist[i].TaskItems[j].choose==1){
+              dailytasklist[i].TaskItems[j].choose=0;
             }else{
-              dailytasklist[i].TaskItems[j].disabled=true;
+              dailytasklist[i].TaskItems[j].choose=1;
             }
           }
         }
       }
     }
     this.setData({
-          allList: dailytasklist
+          selectdailytasklist: dailytasklist
         });
   },
   //提交数据
   dailytasksdeit() {
   let employRelationNo = app.globalData.employRelationNo;
-  request.httpServicePost(apiUrl1.createDayTaskItem,{employRelationNo:employRelationNo,dailytasklist:this.data.dailytasklist}).then(data=>{
+  let dailytasklist=[];
+    for(let i=0;i<this.data.selectdailytasklist.length;i++){
+        let items=[];
+        for(let j=0;j<this.data.selectdailytasklist[i].TaskItems.length;j++){
+          if(this.data.selectdailytasklist[i].TaskItems[j].choose==1){
+            items.push({itemId:this.data.selectdailytasklist[i].TaskItems[j].itemId,choose:1});
+          }else{
+            items.push({itemId:this.data.selectdailytasklist[i].TaskItems[j].itemId,choose:0});
+          }
+        }
+        dailytasklist.push({categoryId:this.data.selectdailytasklist[i].categoryId,itemIds:items});
+    }
+  request.httpServicePost(apiUrl1.updateDayTaskItem,{employRelationNo:employRelationNo,taskItems:dailytasklist}).then(data=>{
     my.alert({
       title: '提示',
       content: '保存完成',
@@ -69,4 +81,4 @@ Page({
     } );
   });
 },
-});
+});

+ 1 - 1
client/pages/customer/taskreminder/taskreminder.js

@@ -106,6 +106,7 @@ Page({
       showchangetime: true,
     });
   },
+  //日历选中
   handleSelect(e) {
       console.log(e[0]);
   },
@@ -162,5 +163,4 @@ Page({
 
     })
   },
-
 });

+ 5 - 1
client/pages/servant/taskreminder/taskreminder.js

@@ -95,7 +95,11 @@ Page({
   handleSelect(e) {
     console.log(e[0]);
   },
-
+onSelectHasDisableDate() {
+    my.alert({
+      content: 'SelectHasDisableDate',
+    });
+  },
   // 查询保姆每日任务
   selectDayTaskItem() {
     let params = {