123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import request from '../../../util/http'
- import apiUrl from '../../../util/apiUrl'
- var app = getApp();
- Page({
- data: {
- allList: []
- },
- onLoad(options) {
- console.log(options);
- },
- onShow() {
- this.initDailyTaskList();
- },
- 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)
- // });
- }
- }).catch(e => {
- console.log(e);
- })
- },
- 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() {
- /**
- * {
- "employRelationNo": "string",
- "taskItems": [
- {
- "categoryId": 0,
- "itemIds": [
- "string"
- ]
- }
- ]
- }
- */
- let params = {
- }
- request.httpServicePost(apiUrl.completeEditDailyTask, params).then(data => {
- console.log(data);
- }).catch(e => {
- console.log(e);
- })
- },
- });
|