Browse Source

紧急发布-设备

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

9
src/api/publish/urgentMessage.js

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

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

@ -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>

Loading…
Cancel
Save