|
@@ -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();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ });
|
|
|
+},
|
|
|
});
|