|
@@ -96,7 +96,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column fixed="right" label="操作" align="center" width="150">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="mini" @click="useRowRemove(scope.row)">删行</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="useRowRemove(scope.$index,scope.row)">删行</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -118,7 +118,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column fixed="right" label="操作" align="center" width="150">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="mini" @click="useRowRemove(scope.row)">删行</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="useRowRemove(scope.$index,scope.row)">删行</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -264,6 +264,7 @@ export default {
|
|
|
}
|
|
|
this.loading = true;
|
|
|
let res = null;
|
|
|
+ console.log("1111",1111);
|
|
|
if (this.openMode === "add") {
|
|
|
res = await addTargetTemplate(this.form);
|
|
|
}
|
|
@@ -293,7 +294,6 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
arr = arr.filter(item => !item.target);
|
|
|
- console.log("arr",arr);
|
|
|
if(arr.length > 0){
|
|
|
this.$modal.msgError("指标页签不能存在空数据!");
|
|
|
return false;
|
|
@@ -327,6 +327,7 @@ export default {
|
|
|
this.$modal.msgError("周期页签不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
+ return true;
|
|
|
},
|
|
|
//查询详情
|
|
|
async fetchTemplate(id) {
|
|
@@ -369,7 +370,7 @@ export default {
|
|
|
console.log("this.form[this.activeName]",this.form[this.activeName]);
|
|
|
},
|
|
|
//删行
|
|
|
- async useRowRemove(row) {
|
|
|
+ async useRowRemove(index,row) {
|
|
|
if (row.id) {
|
|
|
this.form[this.activeName].forEach(e => {
|
|
|
if(e.id == row.id){
|
|
@@ -377,7 +378,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
- this.form[this.activeName] = form[this.activeName].filter(item => item.$index != row.$index);
|
|
|
+ this.form[this.activeName].splice(index, 1);
|
|
|
}
|
|
|
console.log("this.form[this.activeName]",this.form[this.activeName]);
|
|
|
},
|
|
@@ -409,58 +410,48 @@ export default {
|
|
|
if(this.form.cycle == 'period'){
|
|
|
cycles.push({
|
|
|
name:'目标期间',
|
|
|
- startTime:start,
|
|
|
- deadlineTime:deadline,
|
|
|
+ startTime:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
+ deadlineTime:this.formatDateTime(deadline, 'yyyy-MM-dd'),
|
|
|
});
|
|
|
}else{
|
|
|
while(deadline >= start){
|
|
|
- console.log(start);
|
|
|
if(this.form.cycle == 'day'){
|
|
|
var cy = {
|
|
|
name:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
- startTime:start,
|
|
|
- deadlineTime:start,
|
|
|
+ startTime:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
+ deadlineTime:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
}
|
|
|
- console.log(cy);
|
|
|
cycles.push(cy);
|
|
|
- start = start.setDate(start.getDate()+1);
|
|
|
- start = new Date(start);
|
|
|
+ start.setDate(start.getDate()+1);
|
|
|
}
|
|
|
if(this.form.cycle == 'week'){
|
|
|
- var de = start;
|
|
|
- var cy = {
|
|
|
- name:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
- startTime:start,
|
|
|
- deadlineTime:de.setDate(de.getDate()+7),
|
|
|
- }
|
|
|
- console.log(cy);
|
|
|
+ var cy = {};
|
|
|
+ cy.name = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
+ cy.startTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
+ start.setDate(start.getDate()+6);
|
|
|
+ cy.deadlineTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
cycles.push(cy);
|
|
|
- start = start.setDate(start.getDate()+7);
|
|
|
- start = new Date(start);
|
|
|
+ start.setDate(start.getDate()+1);
|
|
|
}
|
|
|
if(this.form.cycle == 'month'){
|
|
|
- var de = start;
|
|
|
- var cy = {
|
|
|
- name:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
- startTime:start,
|
|
|
- deadlineTime:de.setDate(de.getDate()+30),
|
|
|
- }
|
|
|
- console.log(cy);
|
|
|
+ var cy = {};
|
|
|
+ cy.name = this.formatDateTime(start, 'yyyy-MM');
|
|
|
+ cy.startTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
+ let arr = cy.startTime.split('-');
|
|
|
+ start = this.getLastDay(arr[0],arr[1]);
|
|
|
+ console.log('start',start);
|
|
|
+ cy.deadlineTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
cycles.push(cy);
|
|
|
- start = start.setDate(start.getDate()+30);
|
|
|
- start = new Date(start);
|
|
|
+ start.setDate(start.getDate()+1);
|
|
|
}
|
|
|
if(this.form.cycle == 'season'){
|
|
|
- var de = start;
|
|
|
- var cy = {
|
|
|
- name:this.formatDateTime(start, 'yyyy-MM-dd'),
|
|
|
- startTime:start,
|
|
|
- deadlineTime:de.setDate(de.getDate()+90),
|
|
|
- }
|
|
|
- console.log(cy);
|
|
|
+ var cy = {};
|
|
|
+ cy.name = this.formatDateTime(start, 'yyyy-MM');
|
|
|
+ cy.startTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
+ start.setDate(start.getDate()+90);
|
|
|
+ cy.deadlineTime = this.formatDateTime(start, 'yyyy-MM-dd');
|
|
|
cycles.push(cy);
|
|
|
- start = start.setDate(start.getDate()+90);
|
|
|
- start = new Date(start);
|
|
|
+ start.setDate(start.getDate()+1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -493,6 +484,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
return format;
|
|
|
+ },
|
|
|
+ getLastDay(year, month) {
|
|
|
+ return new Date(new Date(`${month<12?year:++year}-${month==12?1:++month} 00:00`).getTime() - 1);
|
|
|
}
|
|
|
},
|
|
|
};
|