Browse Source

完善设备管控

wangqin
hui 7 months ago
parent
commit
63e85b111f
  1. 226
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue
  2. 111
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue
  3. 345
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue
  4. 34
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue
  5. 39
      ruoyi-ui/src/views/JiHeExpressway/utils/api/batch.js
  6. 11
      ruoyi-ui/src/views/JiHeExpressway/utils/enum.js
  7. 30
      ruoyi-ui/src/views/JiHeExpressway/utils/infoBoard.js
  8. 6
      ruoyi-ui/vue.config.js

226
ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue

@ -1,37 +1,57 @@
<template>
<Dialog v-model="modelVisible" :title="data ? '修改' : '新增'" width="900px">
<Dialog v-model="modelVisible" :title="propData ? '修改' : '新增'" width="1400px">
{{ propData }}
<div class="AddNEditDialog">
<!-- <Form :value="formData" class="form" ref="FormConfigRef" :formList="formList" column="1" labelWidth="80px" /> -->
<el-form ref="form" :model="formStrategy" label-width="80px">
<el-form-item label="名称">
<el-input v-model="formData.groupName"></el-input>
<!-- <Form :value="propData" class="form" ref="basicInfoForm" :formList="formList" column="1" labelWidth="80px" /> -->
<el-form ref="basicInfoForm" :model="editData" label-width="80px" :rules="groupBasicRules">
<el-form-item label="名称" prop="groupName">
<el-input v-model="editData.groupName"></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input v-model="formData.remark"></el-input>
<el-form-item label="描述" prop="remark">
<el-input v-model="editData.remark"></el-input>
</el-form-item>
<div class="task" v-for="task,index in formStrategy">
<el-form-item label="状态" prop="status">
<el-switch v-model="editData.status" active-value="1" inactive-value="0"></el-switch>
</el-form-item>
<div style="display: flex; justify-content: flex-end;">
<Button style="background-color: rgba(0, 179, 204, 0.3)"
@click.native="(modelVisible = false), (submitting = false)">
取消
</Button>
<Button @click.native="onSaveTaskGroup" :loading="submitting"> 提交 </Button>
</div>
</el-form>
{{ editData.id }}
<template v-if="editData.id">
<!-- 如果是新增的还没有保存的任务组不能添加任务 -->
<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="task.time"></el-input>
<el-input v-model="taskGroup.time"></el-input>
<div class="fl-around task_op">
<el-button size="mini" type="primary">新增</el-button>
<el-button size="mini" type="primary" @click="onAddTaskItem(taskGroup)">新增子任务</el-button>
<el-button size="mini" type="primary">删除</el-button>
</div>
</div>
<div>
<TaskItem v-for="item, index in task.content" :data="item" @onModify="newV=>onModifyItem(newV, item)">
<TaskItem v-for="item, index1 in taskGroup.tasksEdit" :propData="item" :groupId="propData.id"
:time="taskGroup.time" @onModify="newV=>onModifyItem(newV, item)">
</TaskItem>
</div>
</div>
</el-form>
</template>
</div>
<template #footer>
<Button style="background-color: rgba(0, 179, 204, 0.3)"
@click.native="(modelVisible = false), (submitting = false)">
取消
</Button>
<Button @click.native="handleSubmit" :loading="submitting"> 确定 </Button>
</template>
<taskEditDialog v-model="isEditing" :groupId="propData.id" :time="selectedTaskGroup.time" :propData="{}"
@onSubmit="onSubmitTaskItem" />
</Dialog>
</template>
@ -43,8 +63,8 @@ import Form from "@screen/components/FormConfig";
import request from "@/utils/request";
import { Message } from "element-ui";
import { addEditFormList } from "./../data";
import { stakeMarkToArray, findPathIdByTreeId } from "@screen/utils/index.js";
import taskEditDialog from "./taskEditDialog.vue";
import TaskItem from "./TaskItem.vue";
export default {
@ -53,7 +73,8 @@ export default {
Dialog,
Button,
Form,
TaskItem
TaskItem,
taskEditDialog
},
model: {
prop: "visible",
@ -61,37 +82,31 @@ export default {
},
props: {
visible: Boolean,
data: Object,
dataAll: Array,
propData: {
type: Object,
default: ()=>{}
},
},
data() {
let gNameValidator = (rule, value, callback)=>{
if (value.trim().length<=0){
return callback(new Error('请输入任务组名称'));
}
};
return {
editData:{},
mode:"",
isEditing:false,
group:{},
submitting: false,
formData: {},
formList: addEditFormList,
formStrategy:[
{
time:"gdfsfds",
content:[
{
type:"5",
devices:[""],
options:{
}
},
{
type: "2",
devices: [""],
options: {
}
}
]
}
]
taskGroupsEditing:[],
selectedTaskGroup:{},
groupBasicRules:{
groupName: [
{ validator: gNameValidator, trigger: 'blur' }
],
}
};
},
computed: {
@ -110,12 +125,13 @@ export default {
handler(bool) {
if (!bool) return;
this.formData = !this.data
? {}
: {
...this.data,
};
this.testGetData();
// this.propData = !this.propData
// ? {}
// : {
// ...this.propData,
// };
this.initEditingData();
this.getTaskList();
},
},
},
@ -132,51 +148,102 @@ export default {
// });
},
methods: {
onSubmitTaskItem(){
this.getTaskList(); //task
},
onAddTaskGroup(){
this.taskGroupsEditing.push({time:"08:00:00",tasks:[1,2,3]});
},
onAddTaskItem(taskG){
this.selectedTaskGroup = taskG;
this.isEditing = true;
},
onModifyItem(newV , oldV){
console.log(newV, oldV , "修改条目》》》")
// oldV.devices
},
testGetData(){
initEditingData(){
if(this.propData?.id){
this.mode = "edit"
this.editData = {
id: this.propData.id,
groupName : this.propData.groupName,
status: this.propData.status,
remark: this.propData.remark,
detailedConfiguration: this.propData.detailedConfiguration
}
} else {
this.mode = "add"
this.editData = {
groupName: "任务组AAA",
status: "1",
remark: "",
detailedConfiguration: ""
}
}
},
getTaskList(){
// 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
//
request({
url: `/business/dcBatchFunctionsJob/query`,
method: "GET",
params: {
jobGroup: 0
jobGroup: this.propData.id
},
})
.then((result) => {
if (result.code != 200) return;
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;
});
})
},
checkRepeat(word) {
let temp = _.find(this.dataAll, { word: word });
if (
temp &&
Object.keys(temp).length > 0 &&
!(this.data && this.data.id == temp.id)
) {
this.$message.error("该关键词已存在。");
return false;
} else {
return true;
}
},
handleSubmit() {
this.$refs.FormConfigRef.validate().then((data) => {
data.word = data.word.trim();
onSaveTaskGroup() {
this.$refs.basicInfoForm.validate().then((result) => {
if (!result){
return ;
}
this.editData.groupName = this.editData.groupName.trim();
this.editData.remark = this.editData.remark.trim();
this.submitting = true;
if (this.data) data.id = this.data.id;
// if (!this.checkRepeat(data.word)) {
// return;
// }
//
this.$set(this.editData, "id", 11);
this.submitting = false;
return
//
request({
url: `/business/dcInfoBoardVocabulary`,
method: this.data ? "PUT" : "POST",
data,
url: `/business/dcBatchFunctionsJobGroup`,
method: this.mode=="edit" ? "PUT" : "POST",
data: this.editData,
})
.then((result) => {
if (result.code != 200) return;
@ -184,7 +251,6 @@ export default {
Message.success(`提交成功!`);
this.$emit("onSuccess");
this.modelVisible = false;
})
.catch((err) => {
console.log(

111
ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue

@ -1,41 +1,71 @@
<template>
<div class="task_editor_box">
<div class="task_editor_box" v-if="isCompReady">
<el-form>
<div class="flex" style="justify-content: space-between;">
<div>
设备类型:<span>{{ deviceTypeDic[editData.deviceType].label }}</span>
</div>
<div>
设备:
<!-- {{ deviceDic }} -->
<span v-for="item,index in editData.devices">
{{ deviceDic[item.id].deviceName }}
</span>{{ editData.devices.length }}个设备
</div>
<!-- <div>{{ editData.params }}</div> -->
<template v-if="editData.deviceType=='2'">
<BoardRecordPreview :tpl="editData.params" style="width:300px; height: 100%;"></BoardRecordPreview>
</template>
<template v-if="editData.deviceType == '5'">
</template>
<template v-if="editData.deviceType == '2'">
</template>
<template v-if="editData.deviceType == '2'">
</template>
<template v-if="editData.deviceType == '2'">
</template>
<div class="flex">
<div>
任务内容
<!-- {{ data }} -->
<el-form-item>
<el-button size="mini" type="primary" @click="onModify">修改</el-button>
<el-button size="mini" type="danger" @click="onDelete">删除</el-button>
</el-form-item>
</div>
<el-form-item>
<el-button size="mini" type="primary" @click="onModify">修改</el-button>
<el-button size="mini" type="danger" @click="onDelete">删除</el-button>
</el-form-item>
</div>
</el-form>
<taskEditDialog v-model="isEditing" :data="data" @onSubmit="onSubmit" />
<taskEditDialog v-model="isEditing" :groupId="groupId" :time="time" :deviceDic="deviceDic" :deviceList="deviceList"
:propData="editData" @onSubmit="onSubmit" />
</div>
</template>
<script>
import { deviceTypeOptions } from "@screen/utils/enum.js"
import { deviceTypeDic } from "@screen/utils/enum.js"
import { getDeviceList } from "@screen/utils/api/device.js"
import taskEditDialog from "./taskEditDialog.vue";
import BoardRecordPreview from '@screen/components/infoBoard/BoardRecordPreview.vue'
export default {
name: "TaskEditor",
name: "TaskItem",
components: {
taskEditDialog
taskEditDialog, BoardRecordPreview
},
props: {
data:Object
groupId:Number,
time:String,
propData:Object
},
data() {
return {
isCompReady:false,
editData:{},
isEditing: false,
selectedType:"",
deviceTypeOptions:"",
deviceOptions:""
deviceTypeDic:"",
deviceDic:{},
deviceList:[]
};
},
computed: {
@ -45,34 +75,51 @@ export default {
},
mounted() {
this.deviceTypeOptions = deviceTypeOptions;
this.deviceTypeDic = deviceTypeDic;
this.initBasicData().then(res=>{
console.log(this.deviceDic);
let temp = JSON.parse(this.propData.callParameter);
//BoardRecordPreview
temp.functions[1].params.CONTENT = temp.functions[1].params.CONTENT.replaceAll(/\\n/g, '\\\\n').replaceAll(/=/g, '\\=').replaceAll(/,/g, '\\,').replaceAll(/&nbsp/g, ' ');
this.editData = {
id: this.propData.id,
direction: temp.direction,
deviceType: temp.deviceType,
devices: temp.devices,
params: temp.functions[1].params,
screenSize: "160*80"
};
this.isCompReady = true;
})
},
methods: {
onModify(){
this.isEditing = true;
},
onSubmit(){
this.isEditing = false;
let devices = _.filter(this.deviceOptions, item=>{
this.editData.devices.includes(item.id);
})
console.log(devices, "选中的设备")
this.$emit("onModify", {devices});
// this.isEditing = false;
// let devices = _.filter(this.deviceOptions, item=>{
// this.editData.devices.includes(item.id);
// })
// console.log(devices, "")
// this.$emit("onModify", {devices});
},
onDelete(){
},
onChange(val){
initBasicData(){
this.deviceOptions = [];
getDeviceList({ deviceType :val}).then(res=>{
this.deviceDic = {};
return getDeviceList({ deviceType: this.editData.deviceType }).then(res=>{
this.deviceList = res.data;
res.data.forEach(item=>{
this.deviceOptions.push({
label: item.deviceName,
value: item.id
})
// this.deviceOptions.push({
item.screenSize = JSON.parse(item.otherConfig||'{}').screenSize;
this.$set(this.deviceDic, item.id, item);
})
}).catch(err=>{})
})
}
},
};

345
ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/taskEditDialog.vue

@ -1,114 +1,116 @@
<template>
<Dialog v-model="modelVisible" title="修改" width="600px">
<el-form-item label="设备类型">
<!-- <el-radio-group v-model="searchData.deviceType" @input="onChange">
<Dialog v-model="modelVisible" title="修改" width="600px" label-width="120px">
<el-form>
<el-form-item label="设备类型">
<!-- <el-radio-group v-model="searchData.deviceType" @input="onChange">
<el-radio-button v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value"
v-if="item.timingControl"></el-radio-button>
</el-radio-group> -->
<el-select v-model="searchData.deviceType" placeholder="请选择设备类型" @change="onChange">
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value"
v-if="item.timingControl">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="方向">
<el-select v-model="searchData.direction" placeholder="请选择方向" @change="onChange" clearable>
<el-option v-for="item in directionOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择设备" v-if="searchData.deviceType != '2'">
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable>
<el-option v-for="item in deviceOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<template v-if="searchData.deviceType=='2'">
<el-select v-model="searchData.deviceType" placeholder="请选择设备类型" @change="onChange">
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value+''"
v-if="item.timingControl">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="屏幕像素">
<el-select v-model="filterData.pixelSize" placeholder="请选择" clearable @change="resetEditData">
<el-option v-for="item in boardPixelOptions" :key="item.value" :label="item.label" :value="item.value">
<el-form-item label="方向">
<el-select v-model="searchData.direction" placeholder="请选择方向" @change="onChange" clearable>
<el-option v-for="item in directionOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择设备">
<el-form-item label="选择设备" v-if="searchData.deviceType != '2'">
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable>
<el-option v-for="item in deviceOptions" :key="item.value" :label="item.label" :value="item.value"
v-if="item.pixelSize == filterData.pixelSize">
<el-option v-for="item in deviceArr" :key="item.id" :label="item.deviceName" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="预览" v-if="filterData.pixelSize">
<div class="tplItem">
<!-- 模板内容 -->
<BoardPreview class="boardPreview" :boardWH="filterData.pixelSize" :tpl="editData.type2" />
<!-- 操作按钮 -->
<div class="infoBtnBox">
<el-tooltip content="编辑" placement="top">
<p @click="onEditBoard" class="btn btnEdit"></p>
</el-tooltip>
<template v-if="searchData.deviceType=='2'">
<el-form-item label="屏幕像素">
<el-select v-model="filterData.screenSize" placeholder="请选择" clearable @change="resetEditData">
<el-option v-for="item in boardPixelOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择设备">
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable>
<el-option v-for="item in deviceArr" :key="item.id" :label="item.deviceName" :value="item.id"
v-if="item.screenSize == filterData.screenSize">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="预览" v-if="filterData.screenSize">
<div class="tplItem">
<!-- 模板内容 -->
<BoardPreview class="boardPreview" :boardWH="filterData.screenSize" :tpl="editData.type2" />
<!-- 操作按钮 -->
<div class="infoBtnBox">
<el-tooltip content="编辑" placement="top">
<p @click="onEditBoard" class="btn btnEdit"></p>
</el-tooltip>
</div>
</div>
</div>
</el-form-item>
</template>
</el-form-item>
<template v-else-if="searchData.deviceType == '5'">
<!-- 语音广播 -->
<el-form-item label="广播内容">
<el-input type="textarea" v-model="editData.type5.content"></el-input>
</el-form-item>
</template>
</template>
<template v-else-if="searchData.deviceType == '10'">
<!-- 激光疲劳唤醒 -->
<el-form-item label="工作模式">
<el-select v-model="editData.type10.mode" placeholder="请选择">
<el-option v-for="key,value in gzmsMap" :key="key" :label="value" :value="key" />
</el-select>
</el-form-item>
<el-form-item label="工作时长">
<el-col :span="8">
<el-input-number v-model="editData.type10.timeLength" :min="1" :max="600" label="描述文字" />
</el-col>
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> -->
</el-form-item>
</template>
<template v-else-if="searchData.deviceType == '5'">
<!-- 语音广播 -->
<el-form-item label="广播内容">
<el-input type="textarea" v-model="editData.type5.content"></el-input>
</el-form-item>
</template>
<template v-else-if="searchData.deviceType == '12'">
<!-- 行车诱导 -->
<el-form-item label="工作状态">
<el-select v-model="editData.type12.mode" placeholder="请选择">
<el-option v-for="key, value in gzztMap" :key="key" :label="value" :value="key" />
</el-select>
</el-form-item>
<el-form-item label="工作时长">
<el-col :span="8">
<el-input-number v-model="editData.type12.timeLength" :min="1" :max="600" label="描述文字" />
</el-col>
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> -->
</el-form-item>
</template>
<template v-else-if="searchData.deviceType == '10'">
<!-- 激光疲劳唤醒 -->
<el-form-item label="工作模式">
<el-select v-model="editData.type10.mode" placeholder="请选择">
<el-option v-for="value,key in gzmsMap" :key="key" :label="value" :value="key" />
</el-select>
</el-form-item>
<el-form-item label="工作时长">
<el-col :span="8">
<el-input-number v-model="editData.type10.timeLength" :min="1" :max="600" label="描述文字" />
</el-col>
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> -->
</el-form-item>
</template>
<template v-else-if="searchData.deviceType == '13'">
<!-- 智能设备箱 -->
<el-form-item label="开启">
<el-switch v-model="editData.type13.open">
<!-- active-color="#13ce66" inactive-color="#ff4949" -->
</el-switch>
</el-form-item>
</template>
<template v-else-if="searchData.deviceType == '12'">
<!-- 行车诱导 -->
<el-form-item label="工作状态">
<el-select v-model="editData.type12.mode" placeholder="请选择">
<el-option v-for="value, key in gzztMap" :key="key" :label="value" :value="key" />
</el-select>
</el-form-item>
<el-form-item label="工作时长">
<el-col :span="8">
<el-input-number v-model="editData.type12.timeLength" :min="1" :max="600" label="描述文字" />
</el-col>
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> -->
</el-form-item>
</template>
<el-form-item>
<el-button size="mini" type="primary" @click="onSubmit">确定</el-button>
</el-form-item>
<template v-else-if="searchData.deviceType == '13'">
<!-- 智能设备箱 -->
<el-form-item label="开启">
<el-switch v-model="editData.type13.switch">
<!-- active-color="#13ce66" inactive-color="#ff4949" -->
</el-switch>
</el-form-item>
</template>
<el-form-item>
<el-button size="mini" type="primary" @click="onSubmit">保存</el-button>
</el-form-item>
</el-form>
<BoardInfoEditor @afterSubmit="____onEditSubmit" :mode="editDialog.mode" :type="editDialog.type"
:visible.sync="editDialog.visible" :screenSize="'768*60'" :tpl="editDialog.tpl"></BoardInfoEditor>
:visible.sync="editDialog.visible" :screenSize="this.propData.screenSize" :tpl="editDialog.tpl"></BoardInfoEditor>
</Dialog>
</template>
@ -118,6 +120,8 @@ import { deviceTypeOptions, directionOptions, gzmsMap, gzztMap } from "@screen/u
import { getDeviceList } from "@screen/utils/api/device.js"
import BoardPreview from "@screen/components/infoBoard/BoardPreview.vue";
import BoardInfoEditor from "@screen/components/infoBoard/BoardInfoEditor";
import BoardUtils from "@screen/utils/infoBoard.js"
import { addTaskRequest } from "@screen/utils/api/batch.js"
export default {
name: "taskEditDialog",
components: {
@ -128,21 +132,27 @@ export default {
event: "update:value",
},
props: {
deviceDic:Object,
deviceList:Array,
groupId: Number,
time: String,
visible: Boolean,
data: Object
propData: Object
},
data() {
return {
mode:"add",
deviceTypeOptions,
directionOptions,
gzmsMap,
deviceOptions:[],
gzztMap,
deviceArr:[],
searchData: {
deviceType: "",
direction: ""
},
filterData:{
pixelSize:""
screenSize:""
},
editData:{
devices:[],
@ -170,6 +180,9 @@ export default {
immediate: true,
handler(bool) {
if (!bool) return;
this.propData?.id ? this.mode = 'edit' : this.mode = 'add';
this.transformData();
this.initBasicData();
},
},
},
@ -178,43 +191,62 @@ export default {
// this.directionOptions = directionOptions;
},
methods: {
initBasicData(){
if(this.mode=='edit'){
this.deviceArr = this.deviceList;
}
},
transformData(){
//props
if (this.mode == 'edit'){
this.searchData.deviceType = this.propData.deviceType;
this.searchData.direction = this.propData.direction;
this.filterData.screenSize = this.propData.screenSize;
this.editData.devices = _.map(this.propData.devices, "id");
// { "STAY": 90, "ACTION": "1", "SPEED": "0", "COLOR": "ffff00", "FONT": "3", "FONT_SIZE": "24", "CONTENT": "\\\\n", "width": "160", "height": "80", "formatStyle": "2" }
this.editData.type2 = BoardUtils.contentToDeviceItem(this.propData.params);
}else{
}
},
onEditBoard(){
this.editDialog = {
visible: true,
mode: "edit",
type: "device",
tpl: {
"residenceTime": "90",
"intonation": "0",
"fontSpacing": "0",
"screenEntryMethod": "1",
"screenOutputMethod": "1",
"lineSpacing": "0",
"yCoordinate": "0",
"whetherToSynchronizePlayback": "0",
"whetherToPlayText": "0",
"playbackCount": "1",
"flashingFrequency": "5",
"backgroundColor": "8",
"foregroundColor": "ffff00",
"textContent": "长清收费站\\\\n出入口封闭",
"fontStyle": "0",
"displayAreaWidth": "160",
"playbackDuration": "90",
"displayAreaHeight": "80",
"volume": "0",
"xCoordinate": "0",
"screenEntrySpeed": "1",
"horizontalAlignment": "2",
"playSpecialEffects": "0",
"setUpTheSpeaker": "0",
"flickerSpeed": "0",
"specialEffectsSpeed": "1",
"fontSize": "24",
"verticalAlignment": "2",
"speechSpeed": "0",
"font": "3"
},
tpl:this.editData.type2
// {
// "residenceTime": "90",
// "intonation": "0",
// "fontSpacing": "0",
// "screenEntryMethod": "1",
// "screenOutputMethod": "1",
// "lineSpacing": "0",
// "yCoordinate": "0",
// "whetherToSynchronizePlayback": "0",
// "whetherToPlayText": "0",
// "playbackCount": "1",
// "flashingFrequency": "5",
// "backgroundColor": "8",
// "foregroundColor": "ffff00",
// "textContent": "\\\\n",
// "fontStyle": "0",
// "displayAreaWidth": "160",
// "playbackDuration": "90",
// "displayAreaHeight": "80",
// "volume": "0",
// "xCoordinate": "0",
// "screenEntrySpeed": "1",
// "horizontalAlignment": "2",
// "playSpecialEffects": "0",
// "setUpTheSpeaker": "0",
// "flickerSpeed": "0",
// "specialEffectsSpeed": "1",
// "fontSize": "24",
// "verticalAlignment": "2",
// "speechSpeed": "0",
// "font": "3"
// },
};
},
____onEditSubmit(data){
@ -224,21 +256,66 @@ export default {
},
onSubmit(){
// this.boardDataTransform();
// let devices =
// let data = {devices, functions }
console.log(this.editData , "编辑出来的数据");
let devices = [];
this.deviceArr.forEach((item,index)=>{
if (this.editData.devices.includes(item.id)){
let temp = {
id: item.id,
iotDeviceId: item.iotDeviceId,
deviceType: item.deviceType,
direction: item.direction
}
if(item.type == '2'){
temp.screenSize = item.screenSize;
}
devices.push(temp);
}
});
let params = this.processParams();
if(this.mode == "add"){
}
addTaskRequest(devices, params, { jobGroup: this.groupId, time:this.time }).then(res=>{
console.log(res)
});
this.$emit("onSubmit")
},
processParams(){
if(this.searchData.deviceType == "2"){
return BoardUtils.deviceItemToContent(this.editData.type2);
}else if(this.searchData.deviceType == "5"){
return {
content : editData.type5.content
}
} else if (this.searchData.deviceType == "10") {
return {
mode: editData.type10.mode,
timeLength: editData.type10.timeLength
}
} else if (this.searchData.deviceType == "12") {
return {
mode: editData.type12.mode,
timeLength: editData.type12.timeLength
}
} else if (this.searchData.deviceType == "13") {
return {
switch: editData.type13.switch
}
}
},
onChange() {
this.resetEditData();
this.deviceOptions = [];
this.deviceArr = [];
getDeviceList(this.searchData).then(res => {
res.data.forEach(item => {
this.deviceOptions.push({
label: item.deviceName,
value: item.id,
pixelSize: JSON.parse(item.otherConfig).screenSize
if (this.searchData.deviceType == '2'){
res.data.forEach(item => {
item.screenSize = JSON.parse(item.otherConfig).screenSize;
// this.deviceArr.push(item);
})
})
}
this.deviceArr = res.data;
}).catch(err => { })
},
resetEditData(){

34
ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/index.vue

@ -3,7 +3,7 @@
element-loading-background="rgba(0, 0, 0, 0.3)">
<div class="filter">
<div>
<ButtonGradient @click.native="handleAddEdit(true)">
<ButtonGradient @click.native="onAddEdit()">
<template #prefix>
<img src="@screen/images/insert.svg" />
</template>
@ -40,10 +40,10 @@
<template #button>
<Switcher class="switcher" :activeOption="activeOption" :value="item.status!='0'"
@change="(value) => handleSwitcherChange(value, item) " />
<Button @click.native="() => handleAddEdit(true, item)">
<Button @click.native="() => onAddEdit(item)">
编辑
</Button>
<Button style="background-color: #ff5f5f" @click.native="handleDelete(item)">
<Button style="background-color: #ff5f5f" @click.native="onDelete(item)">
删除
</Button>
</template>
@ -59,7 +59,7 @@
@current-change="handleCurrentChange" />
</div>
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @onSuccess="getData" :dataAll="data" />
<AddNEditDialog v-model="isShowDialog" :propData="dialogData" @onSuccess="getData" />
</div>
</template>
@ -120,7 +120,7 @@ export default {
},
],
data: [],
dialogData: null,
dialogData: {},
isShowDialog: false,
isFirst: true,
};
@ -145,11 +145,11 @@ export default {
// };
return params;
},
async handleDelete(data) {
await confirm({ message: "是否要删除该敏感词?" });
async onDelete(data) {
await confirm({ message: "删除该任务组?" });
request({
url: `/business/dcInfoBoardVocabulary/${data.id}`,
url: `/business/dcBatchFunctionsJobGroup/${data.id}`,
method: "DELETE",
data: {},
})
@ -162,9 +162,9 @@ export default {
Message.error("删除失败");
});
},
handleAddEdit(bool, data) {
this.isShowDialog = bool;
this.dialogData = data;
onAddEdit(data) {
this.isShowDialog = true;
this.dialogData = data||{};
},
handleExport() {
exportFile({
@ -191,8 +191,10 @@ export default {
//
this.data = [{
id:1,
groupName : "任务组一",
remark : "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。"
remark : "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。",
detailedConfiguration:"[{time:'08:00:00',tasks:[1]}]"
}]
this.isLoading = false;
return;
@ -204,12 +206,12 @@ export default {
params: this.getSearchData(),
})
.then((result) => {
this.searchText = this.searchData?.word || "请输入敏感词,回车搜索";
this.searchText = this.searchData?.word || "请输入关键词,回车搜索";
if (result.code != 200) return;
this.data = result.rows;
this.data.map(item=>{
item.remark = "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。"
});
// this.data.map(item=>{
// item.remark = "7777"
// });
this.numTotal = result.total;
// this.pageTotal = Math.ceil(result.total/this.pageSize);
})

39
ruoyi-ui/src/views/JiHeExpressway/utils/api/batch.js

@ -0,0 +1,39 @@
import request from '@/utils/request'
export function addTaskRequest(devices, params, others) {
let data = {
...others,
devices: devices,
"functions": [
{
"functionId": "11",
"params": {
"size": "65535",
"fileName": "play012.lst"
}
},
{
"functionId": "13",
"params": params
},
{
"functionId": "1B",
"params": {
"fileId": "12"
}
}
]
}
// console.log(JSON.stringify(data));
return request({
// url: '/business/board/batch/publish',
url: `/business/dcBatchFunctionsJob`,
method: 'post',
// data: data
data
})
}

11
ruoyi-ui/src/views/JiHeExpressway/utils/enum.js

@ -163,6 +163,13 @@ export const WarningType = {
99: "其他事件",
};
function arrayToDic(arr){
let obj = {};
arr.map(item=>{
obj[item.value] = item;
});
return obj;
}
//设备Options
export const deviceTypeOptions = [
{
@ -228,6 +235,8 @@ export const deviceTypeOptions = [
},
];
export const deviceTypeDic = arrayToDic(deviceTypeOptions);
export const WarningTypeList = Object.keys(WarningType).map((key) => {
return {
value: key * 1,
@ -794,7 +803,7 @@ export const eventSubClassMap = {
],
},
};
//激光疲劳唤醒 工作模式
export const gzmsMap = {
SETMD0: "激光关闭",

30
ruoyi-ui/src/views/JiHeExpressway/utils/infoBoard.js

@ -70,5 +70,35 @@ export default {
data1 = _.merge(data.origin, temp);
}
return data1;
},
deviceItemToContent(item){
let temp = {
STAY: item.playbackDuration,
ACTION: item.screenEntryMethod,
SPEED: item.fontSpacing || 0,
COLOR: item.foregroundColor,
FONT: item.font,
FONT_SIZE: item.fontSize,
CONTENT: item.textContent.replaceAll(',', '\\,').replaceAll('=', '\\=').replaceAll('\n', '\\\\n'),
width: item.displayAreaWidth,
height: item.displayAreaHeight,
formatStyle: item.verticalAlignment
}
return temp
},
contentToDeviceItem(item){
let temp = {
playbackDuration : item.STAY,
screenEntryMethod : item.ACTION,
fontSpacing : item.SPEED,
foregroundColor : item.COLOR,
font : item.FONT,
fontSize : item.FONT_SIZE,
textContent: item.CONTENT.replaceAll('\\,', ',').replaceAll('\\=', '=').replaceAll('\\\\n', '\n'),
displayAreaWidth : item.width,
displayAreaHeight : item.height,
verticalAlignment : item.formatStyle
}
return temp
}
}

6
ruoyi-ui/vue.config.js

@ -31,7 +31,7 @@ module.exports = {
devServer: {
host: "0.0.0.0",
port: port,
https: true,
// https: true,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
@ -52,8 +52,8 @@ module.exports = {
// target: `http://10.0.81.204:8087`, //现场后台 刘文阁
// target: `http://10.168.69.255:8087`, //正晨后台 连现场物联 刘文阁
// target: `http://10.168.78.135:8087`, //王钦
target: `http://10.168.66.196:8087`, //正晨后台 连现场物联 刘文阁2
// target: `http://10.168.68.42:8087`, //王思祥
// target: `http://10.168.66.196:8087`, //正晨后台 连现场物联 刘文阁2
target: `http://10.168.68.42:8087`, //王思祥
// target: `http://10.168.65.194:8087`, //赵祥龙
// target: `http://10.168.65.156:8097`, //孟
// target: `http://10.168.56.165:8087`, //王家宝

Loading…
Cancel
Save