Explorar el Código

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

una hace 4 años
padre
commit
387b66114b

+ 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}}"  a:for-item="dailyitem" class="daily-item {{dailyitem.checked==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.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>
     </view>
   </view>

+ 5 - 5
client/pages/customer/dailytasks/dailytasks.js

@@ -23,7 +23,7 @@ Page({
         var that = this;
         for(let i=0;i<dailytasklist.length;i++){
           for(let j=0;j<dailytasklist[i].TaskItems.length;j++){
-            dailytasklist[i].TaskItems[j].checked=false;
+            dailytasklist[i].TaskItems[j].disabled=false;
           }
         }
         this.setData({
@@ -48,10 +48,10 @@ Page({
       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].checked){
-              dailytasklist[i].TaskItems[j].checked=false;
+            if(dailytasklist[i].TaskItems[j].disabled){
+              dailytasklist[i].TaskItems[j].disabled=false;
             }else{
-              dailytasklist[i].TaskItems[j].checked=true;
+              dailytasklist[i].TaskItems[j].disabled=true;
             }
           }
         }
@@ -70,7 +70,7 @@ Page({
       let itemIds=[];
       let t=0;
         for(let j=0;j<this.data.allList[i].TaskItems.length;j++){
-          if(this.data.allList[i].TaskItems[j].checked==true){
+          if(this.data.allList[i].TaskItems[j].disabled==true){
             itemIds[t]=this.data.allList[i].TaskItems[j].id;
             t++;
           }

+ 2 - 2
client/pages/customer/editDailyTask/editDailyTask.axml

@@ -1,9 +1,9 @@
 <view class="common-page-padding daily-servant-page">
-  <view a:for="{{allList}}" key="{{index}}">
+  <view a:for="{{selectdailytasklist}}" key="{{index}}">
     <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.checked==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.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>
     </view>
   </view>

+ 25 - 46
client/pages/customer/editDailyTask/editDailyTask.js

@@ -4,7 +4,7 @@ import apiUrl1 from '../../../util/apiUrl1'
 var app = getApp();
 Page({
   data: {
-    allList: []
+    selectdailytasklist: []
   },
   onLoad(options) {
     console.log(options);
@@ -14,24 +14,18 @@ Page({
   },
   //数据加载
   initDailyTaskList() {
-    let params = {
-    }
-    request.httpServiceGet(apiUrl.getDailyTaskList, params).then(data => {
-      if (data.length > 0) {
-        //添加选中的状态列
-        let dailytasklist = data;
-        var that = this;
-        for(let i=0;i<dailytasklist.length;i++){
-          for(let j=0;j<dailytasklist[i].TaskItems.length;j++){
-            dailytasklist[i].TaskItems[j].checked=false;
-          }
-        }
-        this.setData({
-          allList: dailytasklist
-        });
+  let employRelationNo = app.globalData.employRelationNo;
+  let params = {employRelationNo:employRelationNo}
+  request.httpServiceGet(apiUrl1.selectChooseDayTaskItem, params).then(data => {
+    if (data.length > 0) {
+      //添加选中的状态列
+      let selectdailytasklist = data;
+      this.setData({
+        selectdailytasklist: selectdailytasklist
+      });
       } else {
         this.setData({
-          allList: []
+          selectdailytasklist: []
         });
       }
     }).catch(e => {
@@ -48,10 +42,10 @@ Page({
       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].checked){
-              dailytasklist[i].TaskItems[j].checked=false;
+            if(dailytasklist[i].TaskItems[j].disabled){
+              dailytasklist[i].TaskItems[j].disabled=false;
             }else{
-              dailytasklist[i].TaskItems[j].checked=true;
+              dailytasklist[i].TaskItems[j].disabled=true;
             }
           }
         }
@@ -60,34 +54,19 @@ Page({
     this.setData({
           allList: dailytasklist
         });
-
   },
   //提交数据
   dailytasksdeit() {
   let employRelationNo = app.globalData.employRelationNo;
-  let dailytasklist=[];
-    for(let i=0;i<this.data.allList.length;i++){
-      let itemIds=[];
-      let t=0;
-        for(let j=0;j<this.data.allList[i].TaskItems.length;j++){
-          if(this.data.allList[i].TaskItems[j].checked==true){
-            itemIds[t]=this.data.allList[i].TaskItems[j].id;
-            t++;
-          }
-        }
-        if(itemIds.length>0){
-          dailytasklist.push({categoryId:this.data.allList[i].categoryId,itemIds:itemIds});
-        }
-    }
-    request.httpServicePost(apiUrl1.createDayTaskItem,{employRelationNo:employRelationNo,taskItems:dailytasklist}).then(data=>{
-      my.alert({
-        title: '提示',
-        content: '保存完成',
-        buttonText: '确定',
-        success: () => {
-          my.navigateBack();
-        }
-      } );
-    });
-  },
+  request.httpServicePost(apiUrl1.createDayTaskItem,{employRelationNo:employRelationNo,dailytasklist:this.data.dailytasklist}).then(data=>{
+    my.alert({
+      title: '提示',
+      content: '保存完成',
+      buttonText: '确定',
+      success: () => {
+        my.navigateBack();
+      }
+    } );
+  });
+},
 });

+ 0 - 1
client/pages/servant/servantedit/servantedit.js

@@ -25,7 +25,6 @@ Page({
               console.log(subjectList);
           }
         }
-
         this.setData({
           servanteditlist: subjectList
         });

+ 16 - 4
client/util/apiUrl1.js

@@ -2,9 +2,19 @@ let baseService = '/servantappletservice';
 // 新设置题目时获取题目
 const servantappletservicePath = baseService + '/servantlove/getSubjectWhenFirst';
 //新设置服务标准
-const insertNewservantappletservicePath = baseService + '/servantlove/insertNewServantLove';
+
+const insertNewservantappletservicePath = baseService+'/servantlove/insertNewServantLove';
+
+
 //设置每日任务
-const createDayTaskItem = baseService + '/taskItem/createDayTaskItem';
+const createDayTaskItem = baseService+'/taskItem/createDayTaskItem';
+//通过雇佣关系编号查询已选择每日任务
+const selectChooseDayTaskItem=baseService+'/taskItem/selectChooseDayTaskItem';
+//编辑每日任务
+const updateDayTaskItem=baseService+'/taskItem/updateDayTaskItem';
+
+
+
 //编辑时获取已选择的题目答案
 const getSubjectWhenEdit = baseService + '/servantlove/getSubjectWhenEdit';
 // 编辑阿姨偏好
@@ -25,10 +35,12 @@ export default {
   servantappletservicePath,
   insertNewservantappletservicePath,
   createDayTaskItem,
+   selectChooseDayTaskItem,
   getSubjectWhenEdit,
   selectDayTaskItemPath,
   updateServantLove,
   insertDailyCostPath,
   updateEmployerLove,
-  getEmployerSubjectWhenEdit
-}
+  getEmployerSubjectWhenEdit,
+updateDayTaskItem
+}