|
|
@ -1,6 +1,5 @@ |
|
|
|
<template> |
|
|
|
<Dialog v-model="modelVisible" :title="propData ? '修改' : '新增'" width="1400px"> |
|
|
|
{{ editData }} |
|
|
|
<div class="AddNEditDialog"> |
|
|
|
<!-- <Form :value="propData" class="form" ref="basicInfoForm" :formList="formList" column="1" labelWidth="80px" /> --> |
|
|
|
<el-form ref="basicInfoForm" :model="editData" label-width="80px" :rules="groupBasicRules"> |
|
|
@ -25,22 +24,27 @@ |
|
|
|
<div class="fl-around task_op"> |
|
|
|
<el-button size="mini" type="primary" @click="onAddTaskGroup">新增任务组</el-button> |
|
|
|
</div> |
|
|
|
<div class="task" v-for="taskGroup,index in taskGroupsEditing"> |
|
|
|
<div class="fl-around task_info"> |
|
|
|
<el-input v-model="taskGroup.time" style="width: 180px;"></el-input> |
|
|
|
<div class="fl-around task_op"> |
|
|
|
<el-button size="mini" type="primary" @click="onAddTaskItem(taskGroup)">新增子任务</el-button> |
|
|
|
<el-button size="mini" type="primary">删除</el-button> |
|
|
|
<div class="all_groups"> |
|
|
|
|
|
|
|
<div class="task_group" v-for="taskGroup,index in taskGroupsEditing"> |
|
|
|
<div class="fl-around task_info"> |
|
|
|
<div class="time_show"> |
|
|
|
<el-input placeholder="请输入内容" v-model="taskGroup.time" style="width: 180px;" disabled> |
|
|
|
</el-input> |
|
|
|
<i class="icon el-icon-edit-outline" @click='onModifyTime(taskGroup)'></i> |
|
|
|
</div> |
|
|
|
<div class="fl-around task_op"> |
|
|
|
<el-button size="mini" type="primary" @click="onAddTaskItem(taskGroup)">新增子任务</el-button> |
|
|
|
<el-button size="mini" type="danger" @click="onDeleteTaskGroup(taskGroup)">删除任务组</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<TaskItem v-for="item, index1 in taskGroup.tasksEdit" :propData="item" :groupId="propData.id" |
|
|
|
:time="taskGroup.time" @onSubmit="onSubmitTaskItem"> |
|
|
|
</TaskItem> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<!-- |
|
|
|
<p v-for="item, index1 in taskGroup.tasksEdit"> |
|
|
|
{{ item.jobId }}</p> --> |
|
|
|
<TaskItem v-for="item, index1 in taskGroup.tasksEdit" :propData="item" :groupId="propData.id" |
|
|
|
:time="taskGroup.time" @onModify="newV=>onModifyItem(newV, item)"> |
|
|
|
</TaskItem> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</div> |
|
|
@ -52,7 +56,7 @@ |
|
|
|
<taskEditDialog v-model="isEditing" :groupId="propData.id" :time="selectedTaskGroup.time" :propData="{}" |
|
|
|
@onSubmit="onSubmitTaskItem" /> |
|
|
|
|
|
|
|
<timeEditDialog v-model="isShowTimeEdit" @onSubmit="onSubmitTime" /> |
|
|
|
<timeEditDialog v-model="isShowTimeEdit" :propData="editingTime" @onSubmit="onSubmitTime" /> |
|
|
|
|
|
|
|
</Dialog> |
|
|
|
</template> |
|
|
@ -99,6 +103,7 @@ export default { |
|
|
|
// } |
|
|
|
}; |
|
|
|
return { |
|
|
|
editingTime:"", |
|
|
|
editData:{}, |
|
|
|
mode:"", |
|
|
|
isEditing:false, |
|
|
@ -156,18 +161,61 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onSubmitTaskItem(){ |
|
|
|
this.getTaskList(); //新增task后自动刷新任务列表 |
|
|
|
this.isEditing = false; |
|
|
|
request({ |
|
|
|
url: `/business/dcBatchFunctionsJobGroup/${this.propData.id}`, |
|
|
|
method: "GET" |
|
|
|
}).then(res=>{ |
|
|
|
this.editData = { |
|
|
|
id: res.data.id, |
|
|
|
groupName: res.data.groupName, |
|
|
|
status: res.data.status, |
|
|
|
remark: res.data.remark, |
|
|
|
detailedConfiguration: res.data.detailedConfiguration |
|
|
|
} |
|
|
|
this.getTaskList(); //新增task后自动刷新任务列表 |
|
|
|
}); |
|
|
|
}, |
|
|
|
onAddTaskGroup(){ |
|
|
|
this.isShowTimeEdit = true; |
|
|
|
}, |
|
|
|
onModifyTime(taskG){ |
|
|
|
this.editingTime = taskG.time; |
|
|
|
this.selectedTaskGroup = taskG; |
|
|
|
this.isShowTimeEdit = true; |
|
|
|
}, |
|
|
|
onDeleteTaskGroup(taskG){ |
|
|
|
request({ |
|
|
|
url: `/business/dcBatchFunctionsJob/time/${this.propData.id}/${taskG.time}`, |
|
|
|
method: "DELETE" |
|
|
|
}).then(res => { |
|
|
|
request({ |
|
|
|
url: `/business/dcBatchFunctionsJobGroup/${this.propData.id}`, |
|
|
|
method: "GET" |
|
|
|
}).then(res => { |
|
|
|
this.editData = { |
|
|
|
id: res.data.id, |
|
|
|
groupName: res.data.groupName, |
|
|
|
status: res.data.status, |
|
|
|
remark: res.data.remark, |
|
|
|
detailedConfiguration: res.data.detailedConfiguration |
|
|
|
} |
|
|
|
this.getTaskList(); //新增task后自动刷新任务列表 |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
onSubmitTime(time){ |
|
|
|
this.isShowTimeEdit = false; |
|
|
|
this.taskGroupsEditing.push({ time, tasks: [] }); |
|
|
|
|
|
|
|
if (this.selectedTaskGroup){ |
|
|
|
this.selectedTaskGroup.time = time; |
|
|
|
}else{ |
|
|
|
this.taskGroupsEditing.push({ time, tasks: [] }); |
|
|
|
} |
|
|
|
|
|
|
|
let detailedConfiguration =[]; |
|
|
|
this.taskGroupsEditing.forEach(item=>{ |
|
|
|
detailedConfiguration.push({time:item.time, tasks:_.map(item.tasksEdit, "id")}); |
|
|
|
detailedConfiguration.push({time:item.time, tasks:_.map(item.tasksEdit, "jobId")}); |
|
|
|
}); |
|
|
|
request({ |
|
|
|
url: `/business/dcBatchFunctionsJobGroup`, |
|
|
@ -179,6 +227,7 @@ export default { |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return; |
|
|
|
|
|
|
|
Message.success(`提交成功!`); |
|
|
|
}) |
|
|
|
}, |
|
|
@ -186,10 +235,6 @@ export default { |
|
|
|
this.selectedTaskGroup = taskG; |
|
|
|
this.isEditing = true; |
|
|
|
}, |
|
|
|
onModifyItem(newV , oldV){ |
|
|
|
console.log(newV, oldV , "修改条目》》》") |
|
|
|
// oldV.devices |
|
|
|
}, |
|
|
|
initEditingData(){ |
|
|
|
if(this.propData?.id){ |
|
|
|
this.mode = "edit" |
|
|
@ -212,7 +257,7 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
getTaskList(){ |
|
|
|
this.taskGroupsEditing = JSON.parse(this.propData.detailedConfiguration); |
|
|
|
this.taskGroupsEditing = JSON.parse(this.editData.detailedConfiguration); |
|
|
|
// this.taskGroupsEditing = [{time:"08:00:00",tasks:[1],tasksEdit:[]}]; |
|
|
|
|
|
|
|
// 测试代码开始 |
|
|
@ -312,9 +357,16 @@ export default { |
|
|
|
font-size: 12px; |
|
|
|
} |
|
|
|
} |
|
|
|
.task{ |
|
|
|
.all_groups{ |
|
|
|
max-height:500px; |
|
|
|
overflow-y: scroll; |
|
|
|
} |
|
|
|
.task_group{ |
|
|
|
border: 1px solid #FFF; |
|
|
|
.task_info{ |
|
|
|
.time_show{ |
|
|
|
color: #0AC; |
|
|
|
} |
|
|
|
} |
|
|
|
.task_op{ |
|
|
|
} |
|
|
|