Browse Source

紧急发布-设备

dev
xudanya 3 years ago
parent
commit
5f831b9960
  1. 9
      src/api/publish/urgentMessage.js
  2. 193
      src/views/publishContent/urgentMessage/index.vue

9
src/api/publish/urgentMessage.js

@ -18,3 +18,12 @@ export function reqQueryMessage(parameter) {
params: parameter params: parameter
}) })
} }
// 编辑紧急通知
export function reqEditMessage(parameter) {
return request({
url: 'api/release/editNotice',
method: 'post',
data: parameter
})
}

193
src/views/publishContent/urgentMessage/index.vue

@ -12,12 +12,12 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<!-- prop="name" --> <!-- prop="name" -->
<el-table-column label="序号" type="index" align="center" width="50" /> <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}"> <template slot-scope="{row}">
<div>{{ row.context }}</div>
<div>{{row.context}}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="通知时间" align="center" prop="create_time">
<el-table-column label="通知时间" align="center" prop="create_time" >
<template slot-scope="{row}"> <template slot-scope="{row}">
<div>{{ row.create_time | parseTime }}</div> <div>{{ row.create_time | parseTime }}</div>
</template> </template>
@ -131,8 +131,8 @@
]" ]"
> >
<el-radio-group v-model="form.notice_device" @change="clearCheckbox()"> <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-radio-group>
</el-form-item> </el-form-item>
<div v-if="form.notice_device === 1" class="select_all_tip">所有设备都将被发送</div> <div v-if="form.notice_device === 1" class="select_all_tip">所有设备都将被发送</div>
@ -152,7 +152,7 @@
context_color="#cbe3ff" context_color="#cbe3ff"
@close="handleClose(tag)" @close="handleClose(tag)"
> >
{{ tag.device_name }}
{{ tag.device_name}}
</el-tag> </el-tag>
</div> </div>
</el-form> </el-form>
@ -190,8 +190,8 @@
<script> <script>
import { parseTime } from '@/utils/index.js' 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 { export default {
name: 'UrgentMessage', name: 'UrgentMessage',
filters: { filters: {
@ -201,25 +201,25 @@ export default {
}, },
data() { data() {
return { 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:'', // // 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, messageVisible: false,
selectDeviceVisible: false, selectDeviceVisible: false,
@ -232,40 +232,43 @@ export default {
// newArr:[], // newArr:[],
deviceTags: [], deviceTags: [],
// //
urgentMessage: []
urgentMessage:[]
} }
}, },
mounted() {
mounted(){
this.getUrgentMessage() this.getUrgentMessage()
this.getDevice() this.getDevice()
}, },
methods: { methods: {
// //
getUrgentMessage() {
const params = this.queryInfo
reqUrgentMessage(params).then(res => {
if (res.code == 200) {
this.urgentMessage = res.data.content
getUrgentMessage(){
const params=this.queryInfo
reqUrgentMessage(params).then(res=>{
if(res.code==200){
this.urgentMessage=res.data.content
// console.log( this.urgentMessage) // console.log( this.urgentMessage)
} }
}) })
}, },
// //
getDevice() {
getDevice(){
const params = this.queryInfo const params = this.queryInfo
ReqDeviceList(params).then(res => { ReqDeviceList(params).then(res => {
if (res.code == 200) {
this.deviceList = res.data.content
} else {
if(res.code==200) {
this.deviceList=res.data.content
}else{
return this.$message.error('获取设备列表失败!') return this.$message.error('获取设备列表失败!')
} }
}) })
}, },
isStopHandle(index, row) { 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) console.log(row)
this.messageVisible = true this.messageVisible = true
// id // id
const params = {
notice_id: row.notice_id
const params ={
notice_id:row.notice_id
} }
reqQueryMessage(params).then(res => {
reqQueryMessage(params).then(res=>{
console.log(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(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_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'
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) { handleSelectionChange(val) {
@ -331,45 +346,33 @@ export default {
console.log(this.form.context_color) console.log(this.form.context_color)
}, },
// //
selectPosition(selVal) {
selectPosition(selVal){
// console.log(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() { addDeviceTag() {
this.selectDeviceVisible = true this.selectDeviceVisible = true
}, },
// //
tagHandle(tag) { tagHandle(tag) {
this.form.notice_devices.push({ deviceId: tag.device_id })
console.log('添加选中前----')
console.log(this.deviceTags)
if (this.deviceTags.length == 0) {
this.form.notice_devices.push({deviceId:tag.device_id})
if(this.deviceTags.length==0){
this.deviceTags.push(tag) this.deviceTags.push(tag)
} else {
const current = this.deviceTags.find((item) => {
return item.device_id == tag.device_id
})
}else{
const current = this.deviceTags &&this.deviceTags.some((item) => item.device_name == tag.device_name )
// //
console.log('current', current) console.log('current', current)
if (!current) { if (!current) {
// console.log('')
this.deviceTags.push(tag) this.deviceTags.push(tag)
} else {
console.log('有相同的')
} }
} }
// } else {
// console.log('')
// }
console.log('添加选中后----')
console.log(this.deviceTags)
}, },
// //
handleClose(tag) { handleClose(tag) {
@ -379,7 +382,7 @@ export default {
// //
clearDevice() { clearDevice() {
this.deviceTags = [] this.deviceTags = []
}
},
} }
} }
</script> </script>

Loading…
Cancel
Save