From bfd32cee66d606eb5a28ac3d7173ee2850cc4669 Mon Sep 17 00:00:00 2001 From: hui <770260999@qq.com> Date: Wed, 24 Apr 2024 17:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../strategy/components/AddNEditDialog.vue | 84 ++++++--- .../device/strategy/components/TaskItem.vue | 31 +-- .../strategy/components/taskEditDialog.vue | 9 +- .../strategy/components/timeEditDialog.vue | 176 ++++++++++++++++++ .../pages/control/device/strategy/index.vue | 22 ++- .../views/JiHeExpressway/utils/api/batch.js | 9 +- 6 files changed, 276 insertions(+), 55 deletions(-) create mode 100644 ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/timeEditDialog.vue diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue index 95236c5d..67c15ed3 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue @@ -20,15 +20,14 @@ 提交 - {{ editData.id }} @@ -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 @@ - @@ -61,7 +62,7 @@ export default { return { isCompReady:false, editData:{}, - isEditing: false, + isEditingTask: false, selectedType:"", deviceTypeDic:"", deviceDic:{}, @@ -78,28 +79,28 @@ export default { this.deviceTypeDic = deviceTypeDic; this.initBasicData().then(res=>{ - console.log(this.deviceDic); - let temp = JSON.parse(this.propData.callParameter); + let temp = JSON.parse(this.propData.callParameter)[0]; //callParameter是个字符串 //转成BoardRecordPreview组件需要的格式,用来预览 temp.functions[1].params.CONTENT = temp.functions[1].params.CONTENT.replaceAll(/\\n/g, '\\\\n').replaceAll(/=/g, '\\=').replaceAll(/,/g, '\\,').replaceAll(/ /g, ' '); this.editData = { - id: this.propData.id, - direction: temp.direction, - deviceType: temp.deviceType, + id: this.propData.jobId, + direction: temp.direction || temp.devices[0].direction, + deviceType: temp.deviceType || temp.devices[0].deviceType, devices: temp.devices, params: temp.functions[1].params, - screenSize: "160*80" + screenSize: temp.screenSize || temp.devices[0].screenSize || this.deviceDic[temp.devices[0].id].screenSize }; + console.log(this.editData , "+++======"); this.isCompReady = true; }) }, methods: { onModify(){ - this.isEditing = true; + this.isEditingTask = true; }, onSubmit(){ - // this.isEditing = false; + this.isEditingTask = false; // let devices = _.filter(this.deviceOptions, item=>{ // this.editData.devices.includes(item.id); // }) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue index f08d9aa0..853ad4f1 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue @@ -110,7 +110,7 @@ + :visible.sync="editDialog.visible" :screenSize="filterData.screenSize" :tpl="editDialog.tpl"> @@ -212,7 +212,7 @@ export default { onEditBoard(){ this.editDialog = { visible: true, - mode: "edit", + mode: this.mode, type: "device", tpl:this.editData.type2 // { @@ -250,7 +250,6 @@ export default { }; }, ____onEditSubmit(data){ - console.log(data.data); this.editDialog.visible = false; this.editData.type2 = data.data; }, @@ -260,7 +259,7 @@ export default { this.deviceArr.forEach((item,index)=>{ if (this.editData.devices.includes(item.id)){ let temp = { - id: item.id, + jobId: item.id, iotDeviceId: item.iotDeviceId, deviceType: item.deviceType, direction: item.direction @@ -277,7 +276,7 @@ export default { if(this.mode == "add"){ } - addTaskRequest(devices, params, { jobGroup: this.groupId, time:this.time }).then(res=>{ + addTaskRequest(devices, params, { deviceType: this.searchData.deviceType, screenSize: this.filterData.screenSize, jobGroup: this.groupId, time:this.time }).then(res=>{ console.log(res) }); this.$emit("onSubmit") diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/timeEditDialog.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/timeEditDialog.vue new file mode 100644 index 00000000..13852ad7 --- /dev/null +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/timeEditDialog.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue index 07c3b9e1..b41340f2 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue @@ -38,8 +38,11 @@