This commit is contained in:
2021-05-25 20:14:44 +00:00
parent 096e648568
commit 5546c9017f
2 changed files with 93 additions and 2 deletions

View File

@@ -355,11 +355,40 @@ export default {
}
},
methods: {
addTaskGroup() {
async addTaskGroup() {
//add the tasks in the task group ID specified
//verify the id is real
console.log("Selected taskgroupid", this.selectedTaskGroup);
//console.log("Selected taskgroupid", this.selectedTaskGroup);
//fetch it from the server
let res = await window.$gz.api.get(
`task-group/${this.selectedTaskGroup}`
);
if (res.data && res.data.items) {
let newIndex = this.value.items[this.activeWoItemIndex].tasks.length;
let incompleteViz = this.pvm.selectLists.woItemTaskCompletionTypes.find(
s => s.id == 1 //incomplete
).name;
res.data.items.forEach(z => {
newIndex++;
this.value.items[this.activeWoItemIndex].tasks.push({
id: 0,
concurrency: 0,
sequence: newIndex,
task: z.task,
status: 1, //incomplete==1
statusViz: incompleteViz,
completedByUserId: null,
completedDate: null,
isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for error tracking / display
});
});
this.$emit("change");
this.selectedRow = [{ index: newIndex }];
this.activeItemIndex = newIndex;
}
//iterate and append to the current task list
//flag dirty if necessary
this.taskGroupDialog = false;