|
|
@ -1,12 +1,13 @@ |
|
|
|
<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-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" |
|
|
|
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value+''" |
|
|
|
v-if="item.timingControl"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
@ -21,7 +22,7 @@ |
|
|
|
|
|
|
|
<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 v-for="item in deviceArr" :key="item.id" :label="item.deviceName" :value="item.id"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
@ -29,7 +30,7 @@ |
|
|
|
<template v-if="searchData.deviceType=='2'"> |
|
|
|
|
|
|
|
<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> |
|
|
|
</el-select> |
|
|
@ -37,16 +38,16 @@ |
|
|
|
|
|
|
|
<el-form-item label="选择设备"> |
|
|
|
<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" |
|
|
|
v-if="item.screenSize == filterData.screenSize"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="预览" v-if="filterData.pixelSize"> |
|
|
|
<el-form-item label="预览" v-if="filterData.screenSize"> |
|
|
|
<div class="tplItem"> |
|
|
|
<!-- 模板内容 --> |
|
|
|
<BoardPreview class="boardPreview" :boardWH="filterData.pixelSize" :tpl="editData.type2" /> |
|
|
|
<BoardPreview class="boardPreview" :boardWH="filterData.screenSize" :tpl="editData.type2" /> |
|
|
|
<!-- 操作按钮 --> |
|
|
|
<div class="infoBtnBox"> |
|
|
|
<el-tooltip content="编辑" placement="top"> |
|
|
@ -55,6 +56,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else-if="searchData.deviceType == '5'"> |
|
|
@ -68,7 +70,7 @@ |
|
|
|
<!-- 激光疲劳唤醒 --> |
|
|
|
<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-option v-for="value,key in gzmsMap" :key="key" :label="value" :value="key" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="工作时长"> |
|
|
@ -83,7 +85,7 @@ |
|
|
|
<!-- 行车诱导 --> |
|
|
|
<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-option v-for="value, key in gzztMap" :key="key" :label="value" :value="key" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="工作时长"> |
|
|
@ -97,18 +99,18 @@ |
|
|
|
<template v-else-if="searchData.deviceType == '13'"> |
|
|
|
<!-- 智能设备箱 --> |
|
|
|
<el-form-item label="开启"> |
|
|
|
<el-switch v-model="editData.type13.open"> |
|
|
|
<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-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 => { |
|
|
|
if (this.searchData.deviceType == '2'){ |
|
|
|
res.data.forEach(item => { |
|
|
|
this.deviceOptions.push({ |
|
|
|
label: item.deviceName, |
|
|
|
value: item.id, |
|
|
|
pixelSize: JSON.parse(item.otherConfig).screenSize |
|
|
|
}) |
|
|
|
item.screenSize = JSON.parse(item.otherConfig).screenSize; |
|
|
|
// this.deviceArr.push(item); |
|
|
|
}) |
|
|
|
} |
|
|
|
this.deviceArr = res.data; |
|
|
|
}).catch(err => { }) |
|
|
|
}, |
|
|
|
resetEditData(){ |
|
|
|