Browse Source

完善设备管控

wangqin
hui 7 months ago
parent
commit
63e85b111f
  1. 218
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/AddNEditDialog.vue
  2. 99
      ruoyi-ui/src/views/JiHeExpressway/pages/control/device/strategy/components/TaskItem.vue
  3. 193
      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. 9
      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

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

@ -1,37 +1,57 @@
<template> <template>
<Dialog v-model="modelVisible" :title="data ? '修改' : '新增'" width="900px"> <Dialog v-model="modelVisible" :title="propData ? '修改' : '新增'" width="1400px">
{{ propData }}
<div class="AddNEditDialog"> <div class="AddNEditDialog">
<!-- <Form :value="formData" class="form" ref="FormConfigRef" :formList="formList" column="1" labelWidth="80px" /> --> <!-- <Form :value="propData" class="form" ref="basicInfoForm" :formList="formList" column="1" labelWidth="80px" /> -->
<el-form ref="form" :model="formStrategy" label-width="80px"> <el-form ref="basicInfoForm" :model="editData" label-width="80px" :rules="groupBasicRules">
<el-form-item label="名称"> <el-form-item label="名称" prop="groupName">
<el-input v-model="formData.groupName"></el-input> <el-input v-model="editData.groupName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="描述"> <el-form-item label="描述" prop="remark">
<el-input v-model="formData.remark"></el-input> <el-input v-model="editData.remark"></el-input>
</el-form-item> </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"> <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"> <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> <el-button size="mini" type="primary">删除</el-button>
</div> </div>
</div> </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> </TaskItem>
</div> </div>
</div> </div>
</el-form> </template>
</div> </div>
<template #footer> <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> </template>
<taskEditDialog v-model="isEditing" :groupId="propData.id" :time="selectedTaskGroup.time" :propData="{}"
@onSubmit="onSubmitTaskItem" />
</Dialog> </Dialog>
</template> </template>
@ -43,8 +63,8 @@ import Form from "@screen/components/FormConfig";
import request from "@/utils/request"; import request from "@/utils/request";
import { Message } from "element-ui"; import { Message } from "element-ui";
import { addEditFormList } from "./../data"; import { addEditFormList } from "./../data";
import { stakeMarkToArray, findPathIdByTreeId } from "@screen/utils/index.js";
import taskEditDialog from "./taskEditDialog.vue";
import TaskItem from "./TaskItem.vue"; import TaskItem from "./TaskItem.vue";
export default { export default {
@ -53,7 +73,8 @@ export default {
Dialog, Dialog,
Button, Button,
Form, Form,
TaskItem TaskItem,
taskEditDialog
}, },
model: { model: {
prop: "visible", prop: "visible",
@ -61,37 +82,31 @@ export default {
}, },
props: { props: {
visible: Boolean, visible: Boolean,
data: Object, propData: {
dataAll: Array, type: Object,
default: ()=>{}
},
}, },
data() { data() {
let gNameValidator = (rule, value, callback)=>{
if (value.trim().length<=0){
return callback(new Error('请输入任务组名称'));
}
};
return { return {
editData:{},
mode:"",
isEditing:false,
group:{},
submitting: false, submitting: false,
formData: {},
formList: addEditFormList, formList: addEditFormList,
formStrategy:[ taskGroupsEditing:[],
selectedTaskGroup:{},
{ groupBasicRules:{
time:"gdfsfds", groupName: [
content:[ { validator: gNameValidator, trigger: 'blur' }
{ ],
type:"5",
devices:[""],
options:{
}
},
{
type: "2",
devices: [""],
options: {
} }
}
]
}
]
}; };
}, },
computed: { computed: {
@ -110,12 +125,13 @@ export default {
handler(bool) { handler(bool) {
if (!bool) return; if (!bool) return;
this.formData = !this.data // this.propData = !this.propData
? {} // ? {}
: { // : {
...this.data, // ...this.propData,
}; // };
this.testGetData(); this.initEditingData();
this.getTaskList();
}, },
}, },
}, },
@ -132,51 +148,102 @@ export default {
// }); // });
}, },
methods: { 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){ onModifyItem(newV , oldV){
console.log(newV, oldV , "修改条目》》》") console.log(newV, oldV , "修改条目》》》")
// oldV.devices // 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({ request({
url: `/business/dcBatchFunctionsJob/query`, url: `/business/dcBatchFunctionsJob/query`,
method: "GET", method: "GET",
params: { params: {
jobGroup: 0 jobGroup: this.propData.id
}, },
}) })
.then((result) => { .then((result) => {
if (result.code != 200) return; 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) { onSaveTaskGroup() {
let temp = _.find(this.dataAll, { word: word }); this.$refs.basicInfoForm.validate().then((result) => {
if ( if (!result){
temp && return ;
Object.keys(temp).length > 0 &&
!(this.data && this.data.id == temp.id)
) {
this.$message.error("该关键词已存在。");
return false;
} else {
return true;
} }
}, this.editData.groupName = this.editData.groupName.trim();
handleSubmit() { this.editData.remark = this.editData.remark.trim();
this.$refs.FormConfigRef.validate().then((data) => {
data.word = data.word.trim();
this.submitting = true; 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({ request({
url: `/business/dcInfoBoardVocabulary`, url: `/business/dcBatchFunctionsJobGroup`,
method: this.data ? "PUT" : "POST", method: this.mode=="edit" ? "PUT" : "POST",
data, data: this.editData,
}) })
.then((result) => { .then((result) => {
if (result.code != 200) return; if (result.code != 200) return;
@ -184,7 +251,6 @@ export default {
Message.success(`提交成功!`); Message.success(`提交成功!`);
this.$emit("onSuccess"); this.$emit("onSuccess");
this.modelVisible = false;
}) })
.catch((err) => { .catch((err) => {
console.log( console.log(

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

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

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

@ -1,12 +1,13 @@
<template> <template>
<Dialog v-model="modelVisible" title="修改" width="600px"> <Dialog v-model="modelVisible" title="修改" width="600px" label-width="120px">
<el-form>
<el-form-item label="设备类型"> <el-form-item label="设备类型">
<!-- <el-radio-group v-model="searchData.deviceType" @input="onChange"> <!-- <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" <el-radio-button v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value"
v-if="item.timingControl"></el-radio-button> v-if="item.timingControl"></el-radio-button>
</el-radio-group> --> </el-radio-group> -->
<el-select v-model="searchData.deviceType" placeholder="请选择设备类型" @change="onChange"> <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" <el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value+''"
v-if="item.timingControl"> v-if="item.timingControl">
</el-option> </el-option>
</el-select> </el-select>
@ -21,7 +22,7 @@
<el-form-item label="选择设备" v-if="searchData.deviceType != '2'"> <el-form-item label="选择设备" v-if="searchData.deviceType != '2'">
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable> <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 v-for="item in deviceArr" :key="item.id" :label="item.deviceName" :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -29,7 +30,7 @@
<template v-if="searchData.deviceType=='2'"> <template v-if="searchData.deviceType=='2'">
<el-form-item label="屏幕像素"> <el-form-item label="屏幕像素">
<el-select v-model="filterData.pixelSize" placeholder="请选择" clearable @change="resetEditData"> <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 v-for="item in boardPixelOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -37,16 +38,16 @@
<el-form-item label="选择设备"> <el-form-item label="选择设备">
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable> <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 v-for="item in deviceArr" :key="item.id" :label="item.deviceName" :value="item.id"
v-if="item.pixelSize == filterData.pixelSize"> v-if="item.screenSize == filterData.screenSize">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="预览" v-if="filterData.pixelSize"> <el-form-item label="预览" v-if="filterData.screenSize">
<div class="tplItem"> <div class="tplItem">
<!-- 模板内容 --> <!-- 模板内容 -->
<BoardPreview class="boardPreview" :boardWH="filterData.pixelSize" :tpl="editData.type2" /> <BoardPreview class="boardPreview" :boardWH="filterData.screenSize" :tpl="editData.type2" />
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div class="infoBtnBox"> <div class="infoBtnBox">
<el-tooltip content="编辑" placement="top"> <el-tooltip content="编辑" placement="top">
@ -55,6 +56,7 @@
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="searchData.deviceType == '5'"> <template v-else-if="searchData.deviceType == '5'">
@ -68,7 +70,7 @@
<!-- 激光疲劳唤醒 --> <!-- 激光疲劳唤醒 -->
<el-form-item label="工作模式"> <el-form-item label="工作模式">
<el-select v-model="editData.type10.mode" placeholder="请选择"> <el-select v-model="editData.type10.mode" placeholder="请选择">
<el-option v-for="key,value in gzmsMap" :key="key" :label="value" :value="key" /> <el-option v-for="value,key in gzmsMap" :key="key" :label="value" :value="key" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="工作时长"> <el-form-item label="工作时长">
@ -83,7 +85,7 @@
<!-- 行车诱导 --> <!-- 行车诱导 -->
<el-form-item label="工作状态"> <el-form-item label="工作状态">
<el-select v-model="editData.type12.mode" placeholder="请选择"> <el-select v-model="editData.type12.mode" placeholder="请选择">
<el-option v-for="key, value in gzztMap" :key="key" :label="value" :value="key" /> <el-option v-for="value, key in gzztMap" :key="key" :label="value" :value="key" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="工作时长"> <el-form-item label="工作时长">
@ -97,18 +99,18 @@
<template v-else-if="searchData.deviceType == '13'"> <template v-else-if="searchData.deviceType == '13'">
<!-- 智能设备箱 --> <!-- 智能设备箱 -->
<el-form-item label="开启"> <el-form-item label="开启">
<el-switch v-model="editData.type13.open"> <el-switch v-model="editData.type13.switch">
<!-- active-color="#13ce66" inactive-color="#ff4949" --> <!-- active-color="#13ce66" inactive-color="#ff4949" -->
</el-switch> </el-switch>
</el-form-item> </el-form-item>
</template> </template>
<el-form-item> <el-form-item>
<el-button size="mini" type="primary" @click="onSubmit">确定</el-button> <el-button size="mini" type="primary" @click="onSubmit">保存</el-button>
</el-form-item> </el-form-item>
</el-form>
<BoardInfoEditor @afterSubmit="____onEditSubmit" :mode="editDialog.mode" :type="editDialog.type" <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> </Dialog>
</template> </template>
@ -118,6 +120,8 @@ import { deviceTypeOptions, directionOptions, gzmsMap, gzztMap } from "@screen/u
import { getDeviceList } from "@screen/utils/api/device.js" import { getDeviceList } from "@screen/utils/api/device.js"
import BoardPreview from "@screen/components/infoBoard/BoardPreview.vue"; import BoardPreview from "@screen/components/infoBoard/BoardPreview.vue";
import BoardInfoEditor from "@screen/components/infoBoard/BoardInfoEditor"; import BoardInfoEditor from "@screen/components/infoBoard/BoardInfoEditor";
import BoardUtils from "@screen/utils/infoBoard.js"
import { addTaskRequest } from "@screen/utils/api/batch.js"
export default { export default {
name: "taskEditDialog", name: "taskEditDialog",
components: { components: {
@ -128,21 +132,27 @@ export default {
event: "update:value", event: "update:value",
}, },
props: { props: {
deviceDic:Object,
deviceList:Array,
groupId: Number,
time: String,
visible: Boolean, visible: Boolean,
data: Object propData: Object
}, },
data() { data() {
return { return {
mode:"add",
deviceTypeOptions, deviceTypeOptions,
directionOptions, directionOptions,
gzmsMap, gzmsMap,
deviceOptions:[], gzztMap,
deviceArr:[],
searchData: { searchData: {
deviceType: "", deviceType: "",
direction: "" direction: ""
}, },
filterData:{ filterData:{
pixelSize:"" screenSize:""
}, },
editData:{ editData:{
devices:[], devices:[],
@ -170,6 +180,9 @@ export default {
immediate: true, immediate: true,
handler(bool) { handler(bool) {
if (!bool) return; 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; // this.directionOptions = directionOptions;
}, },
methods: { 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(){ onEditBoard(){
this.editDialog = { this.editDialog = {
visible: true, visible: true,
mode: "edit", mode: "edit",
type: "device", type: "device",
tpl: { tpl:this.editData.type2
"residenceTime": "90", // {
"intonation": "0", // "residenceTime": "90",
"fontSpacing": "0", // "intonation": "0",
"screenEntryMethod": "1", // "fontSpacing": "0",
"screenOutputMethod": "1", // "screenEntryMethod": "1",
"lineSpacing": "0", // "screenOutputMethod": "1",
"yCoordinate": "0", // "lineSpacing": "0",
"whetherToSynchronizePlayback": "0", // "yCoordinate": "0",
"whetherToPlayText": "0", // "whetherToSynchronizePlayback": "0",
"playbackCount": "1", // "whetherToPlayText": "0",
"flashingFrequency": "5", // "playbackCount": "1",
"backgroundColor": "8", // "flashingFrequency": "5",
"foregroundColor": "ffff00", // "backgroundColor": "8",
"textContent": "长清收费站\\\\n出入口封闭", // "foregroundColor": "ffff00",
"fontStyle": "0", // "textContent": "\\\\n",
"displayAreaWidth": "160", // "fontStyle": "0",
"playbackDuration": "90", // "displayAreaWidth": "160",
"displayAreaHeight": "80", // "playbackDuration": "90",
"volume": "0", // "displayAreaHeight": "80",
"xCoordinate": "0", // "volume": "0",
"screenEntrySpeed": "1", // "xCoordinate": "0",
"horizontalAlignment": "2", // "screenEntrySpeed": "1",
"playSpecialEffects": "0", // "horizontalAlignment": "2",
"setUpTheSpeaker": "0", // "playSpecialEffects": "0",
"flickerSpeed": "0", // "setUpTheSpeaker": "0",
"specialEffectsSpeed": "1", // "flickerSpeed": "0",
"fontSize": "24", // "specialEffectsSpeed": "1",
"verticalAlignment": "2", // "fontSize": "24",
"speechSpeed": "0", // "verticalAlignment": "2",
"font": "3" // "speechSpeed": "0",
}, // "font": "3"
// },
}; };
}, },
____onEditSubmit(data){ ____onEditSubmit(data){
@ -224,21 +256,66 @@ export default {
}, },
onSubmit(){ onSubmit(){
// this.boardDataTransform(); // this.boardDataTransform();
// let devices = let devices = [];
// let data = {devices, functions } this.deviceArr.forEach((item,index)=>{
console.log(this.editData , "编辑出来的数据"); 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() { onChange() {
this.resetEditData(); this.resetEditData();
this.deviceOptions = []; this.deviceArr = [];
getDeviceList(this.searchData).then(res => { getDeviceList(this.searchData).then(res => {
if (this.searchData.deviceType == '2'){
res.data.forEach(item => { res.data.forEach(item => {
this.deviceOptions.push({ item.screenSize = JSON.parse(item.otherConfig).screenSize;
label: item.deviceName, // this.deviceArr.push(item);
value: item.id,
pixelSize: JSON.parse(item.otherConfig).screenSize
})
}) })
}
this.deviceArr = res.data;
}).catch(err => { }) }).catch(err => { })
}, },
resetEditData(){ 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)"> element-loading-background="rgba(0, 0, 0, 0.3)">
<div class="filter"> <div class="filter">
<div> <div>
<ButtonGradient @click.native="handleAddEdit(true)"> <ButtonGradient @click.native="onAddEdit()">
<template #prefix> <template #prefix>
<img src="@screen/images/insert.svg" /> <img src="@screen/images/insert.svg" />
</template> </template>
@ -40,10 +40,10 @@
<template #button> <template #button>
<Switcher class="switcher" :activeOption="activeOption" :value="item.status!='0'" <Switcher class="switcher" :activeOption="activeOption" :value="item.status!='0'"
@change="(value) => handleSwitcherChange(value, item) " /> @change="(value) => handleSwitcherChange(value, item) " />
<Button @click.native="() => handleAddEdit(true, item)"> <Button @click.native="() => onAddEdit(item)">
编辑 编辑
</Button> </Button>
<Button style="background-color: #ff5f5f" @click.native="handleDelete(item)"> <Button style="background-color: #ff5f5f" @click.native="onDelete(item)">
删除 删除
</Button> </Button>
</template> </template>
@ -59,7 +59,7 @@
@current-change="handleCurrentChange" /> @current-change="handleCurrentChange" />
</div> </div>
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @onSuccess="getData" :dataAll="data" /> <AddNEditDialog v-model="isShowDialog" :propData="dialogData" @onSuccess="getData" />
</div> </div>
</template> </template>
@ -120,7 +120,7 @@ export default {
}, },
], ],
data: [], data: [],
dialogData: null, dialogData: {},
isShowDialog: false, isShowDialog: false,
isFirst: true, isFirst: true,
}; };
@ -145,11 +145,11 @@ export default {
// }; // };
return params; return params;
}, },
async handleDelete(data) { async onDelete(data) {
await confirm({ message: "是否要删除该敏感词?" }); await confirm({ message: "删除该任务组?" });
request({ request({
url: `/business/dcInfoBoardVocabulary/${data.id}`, url: `/business/dcBatchFunctionsJobGroup/${data.id}`,
method: "DELETE", method: "DELETE",
data: {}, data: {},
}) })
@ -162,9 +162,9 @@ export default {
Message.error("删除失败"); Message.error("删除失败");
}); });
}, },
handleAddEdit(bool, data) { onAddEdit(data) {
this.isShowDialog = bool; this.isShowDialog = true;
this.dialogData = data; this.dialogData = data||{};
}, },
handleExport() { handleExport() {
exportFile({ exportFile({
@ -191,8 +191,10 @@ export default {
// //
this.data = [{ this.data = [{
id:1,
groupName : "任务组一", groupName : "任务组一",
remark : "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。" remark : "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。",
detailedConfiguration:"[{time:'08:00:00',tasks:[1]}]"
}] }]
this.isLoading = false; this.isLoading = false;
return; return;
@ -204,12 +206,12 @@ export default {
params: this.getSearchData(), params: this.getSearchData(),
}) })
.then((result) => { .then((result) => {
this.searchText = this.searchData?.word || "请输入敏感词,回车搜索"; this.searchText = this.searchData?.word || "请输入关键词,回车搜索";
if (result.code != 200) return; if (result.code != 200) return;
this.data = result.rows; this.data = result.rows;
this.data.map(item=>{ // this.data.map(item=>{
item.remark = "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。" // item.remark = "7777"
}); // });
this.numTotal = result.total; this.numTotal = result.total;
// this.pageTotal = Math.ceil(result.total/this.pageSize); // 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
})
}

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

@ -163,6 +163,13 @@ export const WarningType = {
99: "其他事件", 99: "其他事件",
}; };
function arrayToDic(arr){
let obj = {};
arr.map(item=>{
obj[item.value] = item;
});
return obj;
}
//设备Options //设备Options
export const deviceTypeOptions = [ export const deviceTypeOptions = [
{ {
@ -228,6 +235,8 @@ export const deviceTypeOptions = [
}, },
]; ];
export const deviceTypeDic = arrayToDic(deviceTypeOptions);
export const WarningTypeList = Object.keys(WarningType).map((key) => { export const WarningTypeList = Object.keys(WarningType).map((key) => {
return { return {
value: key * 1, value: key * 1,

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

@ -70,5 +70,35 @@ export default {
data1 = _.merge(data.origin, temp); data1 = _.merge(data.origin, temp);
} }
return data1; 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: { devServer: {
host: "0.0.0.0", host: "0.0.0.0",
port: port, port: port,
https: true, // https: true,
open: true, open: true,
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-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.0.81.204:8087`, //现场后台 刘文阁
// target: `http://10.168.69.255:8087`, //正晨后台 连现场物联 刘文阁 // target: `http://10.168.69.255:8087`, //正晨后台 连现场物联 刘文阁
// target: `http://10.168.78.135:8087`, //王钦 // target: `http://10.168.78.135:8087`, //王钦
target: `http://10.168.66.196:8087`, //正晨后台 连现场物联 刘文阁2 // target: `http://10.168.66.196:8087`, //正晨后台 连现场物联 刘文阁2
// target: `http://10.168.68.42:8087`, //王思祥 target: `http://10.168.68.42:8087`, //王思祥
// target: `http://10.168.65.194:8087`, //赵祥龙 // target: `http://10.168.65.194:8087`, //赵祥龙
// target: `http://10.168.65.156:8097`, //孟 // target: `http://10.168.65.156:8097`, //孟
// target: `http://10.168.56.165:8087`, //王家宝 // target: `http://10.168.56.165:8087`, //王家宝

Loading…
Cancel
Save