|
|
@ -12,17 +12,17 @@ |
|
|
|
<el-table-column type="selection" width="55" /> |
|
|
|
<!-- prop="name" --> |
|
|
|
<el-table-column label="序号" type="index" align="center" width="50" /> |
|
|
|
<el-table-column label="发布内容" align="center" prop="context" width="400"> |
|
|
|
<el-table-column label="发布内容" align="center" prop="context" width="400" > |
|
|
|
<template slot-scope="{row}"> |
|
|
|
<div>{{ row.context }}</div> |
|
|
|
<div>{{row.context}}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="通知时间" align="center" prop="create_time"> |
|
|
|
<template slot-scope="{row}"> |
|
|
|
<div>{{ row.create_time | parseTime }}</div> |
|
|
|
</template> |
|
|
|
<el-table-column label="通知时间" align="center" prop="create_time" > |
|
|
|
<template slot-scope="{row}"> |
|
|
|
<div>{{ row.create_time | parseTime }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="发布人" align="center" prop="creater_name" /> |
|
|
|
<el-table-column label="状态" align="center" prop="is_state"> |
|
|
|
<template slot-scope="{row}"> |
|
|
@ -98,7 +98,7 @@ |
|
|
|
{ required: true, message: '请选择文本位置', trigger: 'change' }, |
|
|
|
]" |
|
|
|
> |
|
|
|
<el-select v-model="form.context_position_name" size="small" value-key="name" class="filter-item" @change="selectPosition"> |
|
|
|
<el-select v-model="form.context_position_name" size="small" value-key="name" class="filter-item" @change="selectPosition"> |
|
|
|
<el-option |
|
|
|
v-for="item in positionData" |
|
|
|
:key="item.key" |
|
|
@ -131,8 +131,8 @@ |
|
|
|
]" |
|
|
|
> |
|
|
|
<el-radio-group v-model="form.notice_device" @change="clearCheckbox()"> |
|
|
|
<el-radio :label="1" value="all">所有设备</el-radio> |
|
|
|
<el-radio :label="2" value="other">部分设备<i v-if="form.notice_device === 2" class="radio_tip" @click="addDeviceTag()">添加</i></el-radio> |
|
|
|
<el-radio :label="1" value="all" >所有设备</el-radio> |
|
|
|
<el-radio :label="2" value= "other" >部分设备<i v-if="form.notice_device === 2" class="radio_tip" @click="addDeviceTag()">添加</i></el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
<div v-if="form.notice_device === 1" class="select_all_tip">所有设备都将被发送</div> |
|
|
@ -152,12 +152,12 @@ |
|
|
|
context_color="#cbe3ff" |
|
|
|
@close="handleClose(tag)" |
|
|
|
> |
|
|
|
{{ tag.device_name }} |
|
|
|
{{ tag.device_name}} |
|
|
|
</el-tag> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<!-- :loading="crud.status.cu === 2" |
|
|
|
<!-- :loading="crud.status.cu === 2" |
|
|
|
@click="crud.submitCU"--> |
|
|
|
<el-button type="primary" round @click="submit">保存</el-button> |
|
|
|
<el-button round @click="messageVisible=false">关闭</el-button> |
|
|
@ -190,8 +190,8 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { parseTime } from '@/utils/index.js' |
|
|
|
import { ReqDeviceList } from '@/api/device/deviceList.js' |
|
|
|
import { reqUrgentMessage, reqQueryMessage } from '@/api/publish/urgentMessage' |
|
|
|
import { ReqDeviceList} from '@/api/device/deviceList.js' |
|
|
|
import {reqUrgentMessage,reqQueryMessage,reqEditMessage} from '@/api/publish/urgentMessage' |
|
|
|
export default { |
|
|
|
name: 'UrgentMessage', |
|
|
|
filters: { |
|
|
@ -201,71 +201,74 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
form: { |
|
|
|
context_color: '#ff0000', // 文本的颜色 |
|
|
|
context: '', // 文本的内容 |
|
|
|
context_position: null, // 文本的位置 |
|
|
|
context_position_name: null, |
|
|
|
context_speed_name: null, |
|
|
|
context_speed: null, // 文本的速度 |
|
|
|
context_size: null, // 文字的大小 |
|
|
|
form :{ |
|
|
|
context_color: '#ff0000',//文本的颜色 |
|
|
|
context: '', //文本的内容 |
|
|
|
context_position: null, //文本的位置 |
|
|
|
context_position_name:null, |
|
|
|
context_speed_name:null, |
|
|
|
context_speed: null, //文本的速度 |
|
|
|
context_size:null,//文字的大小 |
|
|
|
// create_by:'', //发布人 |
|
|
|
notice_device: null, |
|
|
|
notice_devices: [], |
|
|
|
notice_id: '', // 紧急通知的id |
|
|
|
orga_id: '133221333123111' |
|
|
|
notice_device:null, |
|
|
|
notice_devices:[], |
|
|
|
notice_id:'' ,//紧急通知的id |
|
|
|
orga_id:'133221333123111', |
|
|
|
}, |
|
|
|
queryInfo: { |
|
|
|
notice_name: '', |
|
|
|
orga_id: '133221333123111', |
|
|
|
page: 1, |
|
|
|
size: 3 |
|
|
|
queryInfo:{ |
|
|
|
notice_name:'', |
|
|
|
orga_id:'133221333123111', |
|
|
|
page:1, |
|
|
|
size:3 |
|
|
|
}, |
|
|
|
messageVisible: false, |
|
|
|
selectDeviceVisible: false, |
|
|
|
sizeData: [{ key: '0', name: 16 }, { key: '1', name: 22 }, { key: '2', name: 24 }, { key: '3', name: 30 }], |
|
|
|
positionData: [{ key: 1, name: '顶部' }, { key: 2, name: '中间' }, { key: 3, name: '底部' }], |
|
|
|
speedData: [{ key: 0, name: '1s' }, { key: 1, name: '2s' }, { key: 2, name: '3s' }], |
|
|
|
speedData: [{ key: 0, name: '1s' }, { key: 1, name: '2s' }, { key: 2, name: '3s' }], |
|
|
|
selectedList: [], |
|
|
|
// 部分设备列表的数据 |
|
|
|
deviceList: [], |
|
|
|
// newArr:[], |
|
|
|
deviceTags: [], |
|
|
|
// 紧急通知列表 |
|
|
|
urgentMessage: [] |
|
|
|
urgentMessage:[] |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted(){ |
|
|
|
this.getUrgentMessage() |
|
|
|
this.getDevice() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取紧急通知的列表 |
|
|
|
getUrgentMessage() { |
|
|
|
const params = this.queryInfo |
|
|
|
reqUrgentMessage(params).then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.urgentMessage = res.data.content |
|
|
|
// console.log( this.urgentMessage) |
|
|
|
} |
|
|
|
}) |
|
|
|
getUrgentMessage(){ |
|
|
|
const params=this.queryInfo |
|
|
|
reqUrgentMessage(params).then(res=>{ |
|
|
|
|
|
|
|
if(res.code==200){ |
|
|
|
this.urgentMessage=res.data.content |
|
|
|
// console.log( this.urgentMessage) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
// 获取设备列表的信息 |
|
|
|
getDevice() { |
|
|
|
getDevice(){ |
|
|
|
const params = this.queryInfo |
|
|
|
ReqDeviceList(params).then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.deviceList = res.data.content |
|
|
|
} else { |
|
|
|
return this.$message.error('获取设备列表失败!') |
|
|
|
} |
|
|
|
if(res.code==200) { |
|
|
|
this.deviceList=res.data.content |
|
|
|
}else{ |
|
|
|
return this.$message.error('获取设备列表失败!') |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
isStopHandle(index, row) { |
|
|
|
if (row.is_state == 1) { |
|
|
|
row.is_state = 2 |
|
|
|
} else { |
|
|
|
row.is_state = 1 |
|
|
|
if(row.is_state ==1){ |
|
|
|
row.is_state=2 |
|
|
|
}else{ |
|
|
|
row.is_state=1 |
|
|
|
} |
|
|
|
}, |
|
|
|
// 编辑 |
|
|
@ -273,48 +276,60 @@ export default { |
|
|
|
console.log(row) |
|
|
|
this.messageVisible = true |
|
|
|
// 根据id查询返回的紧急通知的数据 |
|
|
|
const params = { |
|
|
|
notice_id: row.notice_id |
|
|
|
const params ={ |
|
|
|
notice_id:row.notice_id |
|
|
|
} |
|
|
|
reqQueryMessage(params).then(res => { |
|
|
|
console.log(res) |
|
|
|
if (res.code == 200) { |
|
|
|
this.form.notice_device = res.data.notice.noticeDevice |
|
|
|
this.form.context_color = res.data.notice.contextColor |
|
|
|
this.form.context = res.data.notice.context |
|
|
|
this.form.context_position = res.data.notice.contextPosition |
|
|
|
this.form.context_size = res.data.notice.contextSize |
|
|
|
// 判断文字位置 |
|
|
|
if (this.form.context_position == 1) { |
|
|
|
this.form.context_position_name = '顶部' |
|
|
|
} else if (this.form.context_position == 2) { |
|
|
|
this.form.context_position_name = '中部' |
|
|
|
} else { |
|
|
|
this.form.context_position_name = '底部' |
|
|
|
} |
|
|
|
// 判断速度 |
|
|
|
if (this.form.context_speed == 0) { |
|
|
|
this.form.context_speed_name = '1s' |
|
|
|
} else if (this.form.context_speed == 1) { |
|
|
|
this.form.context_speed_name = '2s' |
|
|
|
} else { |
|
|
|
this.form.context_speed_name = '3s' |
|
|
|
} |
|
|
|
reqQueryMessage(params).then(res=>{ |
|
|
|
console.log(res) |
|
|
|
if(res.code==200) { |
|
|
|
this.form.notice_device=res.data.notice.noticeDevice |
|
|
|
this.form.context_color=res.data.notice.contextColor |
|
|
|
this.form.context=res.data.notice.context |
|
|
|
this.form.context_position=res.data.notice.contextPosition |
|
|
|
this.form.context_size=res.data.notice.contextSize |
|
|
|
// 判断文字位置 |
|
|
|
if( this.form.context_position==1){ |
|
|
|
this.form.context_position_name='顶部' |
|
|
|
}else if( this.form.context_position==2){ |
|
|
|
this.form.context_position_name='中部' |
|
|
|
}else{ |
|
|
|
this.form.context_position_name='底部' |
|
|
|
} |
|
|
|
// 判断速度 |
|
|
|
if(this.form.context_speed==0){ |
|
|
|
this.form.context_speed_name='1s' |
|
|
|
}else if(this.form.context_speed==1){ |
|
|
|
this.form.context_speed_name='2s' |
|
|
|
}else{ |
|
|
|
this.form.context_speed_name='3s' |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
console.log('submit--') |
|
|
|
console.log(this.form.notice_device) |
|
|
|
console.log(this.form.notice_devices) |
|
|
|
console.log('----submit') |
|
|
|
submit(){ |
|
|
|
const params={ |
|
|
|
context:this.form.context, |
|
|
|
context_color:this.form.context_color, |
|
|
|
context_position: this.form.context_position, |
|
|
|
context_size:this.form.context_size, |
|
|
|
context_speed:this.form.context_speed, |
|
|
|
notice_device:this.form.notice_device, |
|
|
|
notice_devices:this.form.notice_devices, |
|
|
|
notice_id:this.form.notice_id, |
|
|
|
orga_id:'133221333123111' |
|
|
|
} |
|
|
|
reqEditMessage(params).then(res=>{ |
|
|
|
console.log(params) |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 所有设备和部分设备的切换数据处理 |
|
|
|
clearCheckbox() { |
|
|
|
if (this.form.notice_device == 1) { |
|
|
|
this.form.notice_devices = [] |
|
|
|
} else { |
|
|
|
this.form.AllDevice = this.deviceList |
|
|
|
clearCheckbox(){ |
|
|
|
if(this.form.notice_device==1){ |
|
|
|
this.form.notice_devices=[] |
|
|
|
}else{ |
|
|
|
this.form.AllDevice=this.deviceList |
|
|
|
} |
|
|
|
}, |
|
|
|
handleSelectionChange(val) { |
|
|
@ -331,46 +346,34 @@ export default { |
|
|
|
console.log(this.form.context_color) |
|
|
|
}, |
|
|
|
// 改变文字的位置 |
|
|
|
selectPosition(selVal) { |
|
|
|
selectPosition(selVal){ |
|
|
|
// console.log(selVal) |
|
|
|
this.form.context_position = selVal.key |
|
|
|
this.form.context_position_name = selVal.name |
|
|
|
this.form.context_position=selVal.key |
|
|
|
this.form.context_position_name=selVal.name |
|
|
|
}, |
|
|
|
// 速度 |
|
|
|
selectSpeed(selVal) { |
|
|
|
this.form.context_speed = selVal.key |
|
|
|
this.form.context_speed_name = selVal.name |
|
|
|
selectSpeed(selVal){ |
|
|
|
this.form.context_speed=selVal.key |
|
|
|
this.form.context_speed_name=selVal.name |
|
|
|
}, |
|
|
|
// 添加设备的对话框 |
|
|
|
//添加设备的对话框 |
|
|
|
addDeviceTag() { |
|
|
|
this.selectDeviceVisible = true |
|
|
|
}, |
|
|
|
// 添加设备 |
|
|
|
tagHandle(tag) { |
|
|
|
this.form.notice_devices.push({ deviceId: tag.device_id }) |
|
|
|
console.log('添加选中前----') |
|
|
|
console.log(this.deviceTags) |
|
|
|
if (this.deviceTags.length == 0) { |
|
|
|
tagHandle(tag) { |
|
|
|
this.form.notice_devices.push({deviceId:tag.device_id}) |
|
|
|
if(this.deviceTags.length==0){ |
|
|
|
this.deviceTags.push(tag) |
|
|
|
} else { |
|
|
|
const current = this.deviceTags.find((item) => { |
|
|
|
return item.device_id == tag.device_id |
|
|
|
}) |
|
|
|
// 查找是否存在相同的 |
|
|
|
console.log('current', current) |
|
|
|
if (!current) { |
|
|
|
// console.log('没有相同的') |
|
|
|
this.deviceTags.push(tag) |
|
|
|
} else { |
|
|
|
console.log('有相同的') |
|
|
|
} |
|
|
|
} |
|
|
|
// } else { |
|
|
|
// console.log('有相同的') |
|
|
|
// } |
|
|
|
console.log('添加选中后----') |
|
|
|
console.log(this.deviceTags) |
|
|
|
}, |
|
|
|
}else{ |
|
|
|
const current = this.deviceTags &&this.deviceTags.some((item) => item.device_name == tag.device_name ) |
|
|
|
// 查找是否存在相同的 |
|
|
|
console.log('current', current) |
|
|
|
if (!current) { |
|
|
|
this.deviceTags.push(tag) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 单独删除某一个设备 |
|
|
|
handleClose(tag) { |
|
|
|
this.deviceTags.splice(this.deviceTags.indexOf(tag), 1) |
|
|
@ -379,7 +382,7 @@ export default { |
|
|
|
// 清空设备 |
|
|
|
clearDevice() { |
|
|
|
this.deviceTags = [] |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|