-
+
新增子任务
删除
@@ -50,6 +49,8 @@
+
+
@@ -63,6 +64,7 @@ import { Message } from "element-ui";
import { addEditFormList } from "./../data";
import taskEditDialog from "./taskEditDialog.vue";
+import timeEditDialog from "./timeEditDialog.vue";
import TaskItem from "./TaskItem.vue";
export default {
@@ -72,7 +74,8 @@ export default {
Button,
Form,
TaskItem,
- taskEditDialog
+ taskEditDialog,
+ timeEditDialog
},
model: {
prop: "visible",
@@ -96,6 +99,7 @@ export default {
editData:{},
mode:"",
isEditing:false,
+ isShowTimeEdit:false,
group:{},
submitting: false,
formList: addEditFormList,
@@ -152,7 +156,28 @@ export default {
this.getTaskList(); //新增task后自动刷新任务列表
},
onAddTaskGroup(){
- this.taskGroupsEditing.push({time:"08:00:00",tasks:[1,2,3]});
+ this.isShowTimeEdit = true;
+ },
+ onSubmitTime(time){
+ this.isShowTimeEdit = false;
+ this.taskGroupsEditing.push({ time, tasks: [] });
+
+ let detailedConfiguration =[];
+ this.taskGroupsEditing.forEach(item=>{
+ detailedConfiguration.push({time:item.time, tasks:_.map(item.tasksEdit, "id")});
+ });
+ request({
+ url: `/business/dcBatchFunctionsJobGroup`,
+ method: "PUT",
+ data: {
+ id: this.editData.id,
+ detailedConfiguration: JSON.stringify(detailedConfiguration)
+ },
+ })
+ .then((result) => {
+ if (result.code != 200) return;
+ Message.success(`提交成功!`);
+ })
},
onAddTaskItem(taskG){
this.selectedTaskGroup = taskG;
@@ -184,22 +209,22 @@ export default {
},
getTaskList(){
- // this.taskGroupsEditing = JSON.parse(this.propData.detailedConfiguration);
- this.taskGroupsEditing = [{time:"08:00:00",tasks:[1],tasksEdit:[]}];
+ this.taskGroupsEditing = JSON.parse(this.propData.detailedConfiguration);
+ // this.taskGroupsEditing = [{time:"08:00:00",tasks:[1],tasksEdit:[]}];
// 测试代码开始
- let rstData = [
- {
- id: 1,
- callParameter: '{"deviceType":"2","direction":"1","devices":[{"id":904,"iotDeviceId":"81221 - 65535","deviceType":"2","direction":"1"},{"id":2116,"iotDeviceId":"26113 - 65535","deviceType":"2","direction":"1"}],"functions":[{"functionId":"11","params":{"size":"65535","fileName":"play012.lst"}},{"functionId":"13","params":{"STAY":90,"ACTION":"1","SPEED":"0","COLOR":"ffff00","FONT":"3","FONT_SIZE":"24","CONTENT":"长清收费站\\\\n出入口封闭","width":"160","height":"80","formatStyle":"2"}},{"functionId":"1B","params":{"fileId":"12"}}]}',
- jobGroup: 1
- }
- ]
- this.taskGroupsEditing.forEach(item => {
- let arr = _.filter(rstData, itm => { return item.tasks.includes(itm.id) });
- item.tasksEdit = arr;
- });
- return
+ // let rstData = [
+ // {
+ // id: 1,
+ // callParameter: '{"deviceType":"2","direction":"1","devices":[{"id":904,"iotDeviceId":"81221 - 65535","deviceType":"2","direction":"1"},{"id":2116,"iotDeviceId":"26113 - 65535","deviceType":"2","direction":"1"}],"functions":[{"functionId":"11","params":{"size":"65535","fileName":"play012.lst"}},{"functionId":"13","params":{"STAY":90,"ACTION":"1","SPEED":"0","COLOR":"ffff00","FONT":"3","FONT_SIZE":"24","CONTENT":"长清收费站\\\\n出入口封闭","width":"160","height":"80","formatStyle":"2"}},{"functionId":"1B","params":{"fileId":"12"}}]}',
+ // jobGroup: 1
+ // }
+ // ]
+ // this.taskGroupsEditing.forEach(item => {
+ // let arr = _.filter(rstData, itm => { return item.tasks.includes(itm.id) });
+ // item.tasksEdit = arr;
+ // });
+ // return
// 测试代码结束
request({
@@ -211,16 +236,18 @@ export default {
})
.then((result) => {
if (result.code != 200) return;
- result.data = [
- {
- id:1,
- callParameter: '{"deviceType":"2","devices":[{"id":904,"iotDeviceId":"81221 - 65535","deviceType":"2","direction":"1"},{"id":2116,"iotDeviceId":"26113 - 65535","deviceType":"2","direction":"1"}],"functions":[{"functionId":"11","params":{"size":"65535","fileName":"play012.lst"}},{"functionId":"13","params":{"STAY":90,"ACTION":"1","SPEED":"0","COLOR":"ffff00","FONT":"3","FONT_SIZE":"24","CONTENT":"长清收费站\\\\n出入口封闭","width":"160","height":"80","formatStyle":"2"}},{"functionId":"1B","params":{"fileId":"12"}}]}',
- jobGroup:1
- }
- ]
+ console.log("当前任务组下的任务", result.data);
+ // result.data = [
+ // {
+ // id:1,
+ // callParameter: '{"deviceType":"2","devices":[{"id":904,"iotDeviceId":"81221 - 65535","deviceType":"2","direction":"1"},{"id":2116,"iotDeviceId":"26113 - 65535","deviceType":"2","direction":"1"}],"functions":[{"functionId":"11","params":{"size":"65535","fileName":"play012.lst"}},{"functionId":"13","params":{"STAY":90,"ACTION":"1","SPEED":"0","COLOR":"ffff00","FONT":"3","FONT_SIZE":"24","CONTENT":"长清收费站\\\\n出入口封闭","width":"160","height":"80","formatStyle":"2"}},{"functionId":"1B","params":{"fileId":"12"}}]}',
+ // jobGroup:1
+ // }
+ // ]
this.taskGroupsEditing.forEach(item=>{
- let arr = _.filter(result.data, itm=>{ return item.tasks.includes(itm.id)});
- item.tasksEdit = arr;
+ let arr = _.filter(result.data, itm => { return item.tasks.includes(itm.jobId)});
+ this.$set(item, "tasksEdit", arr);
+ // item.tasksEdit = arr;
});
})
},
@@ -250,7 +277,6 @@ export default {
Message.success(`提交成功!`);
this.$emit("onSuccess");
-
this.editData = { ...result.data };
this.mode = "edit"
diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue
index d0dafe15..4e23ff5b 100644
--- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue
+++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue
@@ -14,19 +14,20 @@
-
+
+
-
+
-
+
-
+
-
+
@@ -36,7 +37,7 @@