|
|
@ -52,14 +52,12 @@ |
|
|
|
type="primary" |
|
|
|
class="edit_btn" |
|
|
|
@click="editFormData(scope.row)" |
|
|
|
>编辑</el-button |
|
|
|
> |
|
|
|
>编辑</el-button> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
:class="['start_btn', { stop_btn: scope.row.is_state == 1 }]" |
|
|
|
@click="isStopHandle(scope.$index, scope.row)" |
|
|
|
>{{ scope.row.is_state == 1 ? "停止" : "恢复" }}</el-button |
|
|
|
> |
|
|
|
>{{ scope.row.is_state == 1 ? "停止" : "恢复" }}</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
@ -73,11 +71,10 @@ |
|
|
|
:page-size="queryInfo.size" |
|
|
|
:pager-count="5" |
|
|
|
:page-sizes="[3, 5, 10]" |
|
|
|
layout="prev, pager, next, jumper,->,sizes,total" |
|
|
|
@current-change="getUrgentMessage" |
|
|
|
@size-change="handleSizeChange" |
|
|
|
layout="prev, pager, next, jumper,->,sizes,total" |
|
|
|
> |
|
|
|
</el-pagination> |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 编辑紧急通知 --> |
|
|
|
<div class="publish_layer"> |
|
|
@ -193,14 +190,14 @@ |
|
|
|
@change="clearCheckbox()" |
|
|
|
> |
|
|
|
<el-radio :label="1" value="all">所有设备</el-radio> |
|
|
|
<el-radio :label="2" value="other" |
|
|
|
<el-radio |
|
|
|
:label="2" |
|
|
|
value="other" |
|
|
|
>部分设备<i |
|
|
|
v-if="form.notice_device === 2" |
|
|
|
class="radio_tip" |
|
|
|
@click="addDeviceTag()" |
|
|
|
>添加</i |
|
|
|
></el-radio |
|
|
|
> |
|
|
|
>添加</i></el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
<div v-if="form.notice_device === 1" class="select_all_tip"> |
|
|
@ -211,15 +208,16 @@ |
|
|
|
class="select_other" |
|
|
|
> |
|
|
|
<el-row> |
|
|
|
<el-col :span="10" class="other_tip" |
|
|
|
>以下设备都将被发送<span |
|
|
|
>总计{{ deviceTags.length }}个设备</span |
|
|
|
></el-col |
|
|
|
> |
|
|
|
<el-col |
|
|
|
:span="10" |
|
|
|
class="other_tip" |
|
|
|
>以下设备都将被发送<span>总计{{ deviceTags.length }}个设备</span></el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-button round class="delt_btn" @click="clearDevice()" |
|
|
|
>清空</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
round |
|
|
|
class="delt_btn" |
|
|
|
@click="clearDevice()" |
|
|
|
>清空</el-button> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-tag |
|
|
@ -269,44 +267,44 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { parseTime } from "@/utils/index.js"; |
|
|
|
import { ReqDeviceList } from "@/api/device/deviceList.js"; |
|
|
|
import { |
|
|
|
import { parseTime } from '@/utils/index.js' |
|
|
|
import { ReqDeviceList } from '@/api/device/deviceList.js' |
|
|
|
import { |
|
|
|
reqUrgentMessage, |
|
|
|
reqQueryMessage, |
|
|
|
reqEditMessage, |
|
|
|
reqChangeMessage |
|
|
|
} from "@/api/publish/urgentMessage"; |
|
|
|
export default { |
|
|
|
name: "UrgentMessage", |
|
|
|
} from '@/api/publish/urgentMessage' |
|
|
|
export default { |
|
|
|
name: 'UrgentMessage', |
|
|
|
filters: { |
|
|
|
parseTime(time, cFormat) { |
|
|
|
return parseTime(time, cFormat); |
|
|
|
}, |
|
|
|
return parseTime(time, cFormat) |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
isAddEdit: false, |
|
|
|
form: { |
|
|
|
context_color: "#ff0000", //文本的颜色 |
|
|
|
context: "", //文本的内容 |
|
|
|
context_position: null, //文本的位置 |
|
|
|
context_color: '#ff0000', // 文本的颜色 |
|
|
|
context: '', // 文本的内容 |
|
|
|
context_position: null, // 文本的位置 |
|
|
|
context_position_name: null, |
|
|
|
context_speed_name: null, |
|
|
|
context_speed: null, //文本的速度 |
|
|
|
context_speed: null, // 文本的速度 |
|
|
|
context_size_name: null, |
|
|
|
context_size: null, //文字的大小 |
|
|
|
context_size: null, // 文字的大小 |
|
|
|
// create_by:'', //发布人 |
|
|
|
notice_device: null, |
|
|
|
notice_devices: [], |
|
|
|
notice_id: "", //紧急通知的id |
|
|
|
orga_id: "133221333123111", |
|
|
|
notice_id: '', // 紧急通知的id |
|
|
|
orga_id: '133221333123111' |
|
|
|
}, |
|
|
|
queryInfo: { |
|
|
|
notice_name: "", |
|
|
|
orga_id: "133221333123111", |
|
|
|
notice_name: '', |
|
|
|
orga_id: '133221333123111', |
|
|
|
page: 1, |
|
|
|
size: 3, |
|
|
|
size: 3 |
|
|
|
}, |
|
|
|
total: 0, |
|
|
|
messageVisible: false, |
|
|
@ -315,17 +313,17 @@ |
|
|
|
{ key: 0, name: 16 }, |
|
|
|
{ key: 1, name: 22 }, |
|
|
|
{ key: 2, name: 24 }, |
|
|
|
{ key: 3, name: 30 }, |
|
|
|
{ key: 3, name: 30 } |
|
|
|
], |
|
|
|
positionData: [ |
|
|
|
{ key: 1, name: "顶部" }, |
|
|
|
{ key: 2, name: "中间" }, |
|
|
|
{ key: 3, name: "底部" }, |
|
|
|
{ key: 1, name: '顶部' }, |
|
|
|
{ key: 2, name: '中间' }, |
|
|
|
{ key: 3, name: '底部' } |
|
|
|
], |
|
|
|
speedData: [ |
|
|
|
{ key: 0, name: "1s" }, |
|
|
|
{ key: 1, name: "2s" }, |
|
|
|
{ key: 2, name: "3s" }, |
|
|
|
{ key: 0, name: '1s' }, |
|
|
|
{ key: 1, name: '2s' }, |
|
|
|
{ key: 2, name: '3s' } |
|
|
|
], |
|
|
|
selectedList: [], |
|
|
|
// 部分设备列表的数据 |
|
|
@ -333,36 +331,36 @@ |
|
|
|
// newArr:[], |
|
|
|
deviceTags: [], |
|
|
|
// 紧急通知列表 |
|
|
|
urgentMessage: [], |
|
|
|
}; |
|
|
|
urgentMessage: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.getUrgentMessage(); |
|
|
|
this.getDevice(); |
|
|
|
this.getUrgentMessage() |
|
|
|
this.getDevice() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取紧急通知的列表 |
|
|
|
getUrgentMessage(pager=1) { |
|
|
|
this.queryInfo.page=pager |
|
|
|
const params = this.queryInfo; |
|
|
|
getUrgentMessage(pager = 1) { |
|
|
|
this.queryInfo.page = pager |
|
|
|
const params = this.queryInfo |
|
|
|
reqUrgentMessage(params).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.urgentMessage = res.data.content; |
|
|
|
this.total = res.data.totalElements; |
|
|
|
this.urgentMessage = res.data.content |
|
|
|
this.total = res.data.totalElements |
|
|
|
// console.log(this.urgentMessage); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取设备列表的信息 |
|
|
|
getDevice() { |
|
|
|
const params = this.queryInfo; |
|
|
|
const params = this.queryInfo |
|
|
|
ReqDeviceList(params).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.deviceList = res.data.content; |
|
|
|
this.deviceList = res.data.content |
|
|
|
} else { |
|
|
|
return this.$message.error("获取设备列表失败!"); |
|
|
|
return this.$message.error('获取设备列表失败!') |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 紧急通知的状态 is_state为1 发布中 2 停止 |
|
|
|
// row.is_state == 1 ? "停止" : "恢复" |
|
|
@ -370,57 +368,55 @@ |
|
|
|
console.log(row) |
|
|
|
// console.log(index) |
|
|
|
if (row.is_state == 1) { |
|
|
|
row.is_state = 2; |
|
|
|
row.is_state = 2 |
|
|
|
} else { |
|
|
|
row.is_state = 1; |
|
|
|
row.is_state = 1 |
|
|
|
} |
|
|
|
const params={ |
|
|
|
id:row.notice_id, |
|
|
|
state:row.is_state |
|
|
|
const params = { |
|
|
|
id: row.notice_id, |
|
|
|
state: row.is_state |
|
|
|
} |
|
|
|
reqChangeMessage(params).then(res=>{ |
|
|
|
reqChangeMessage(params).then(res => { |
|
|
|
// console.log(res) |
|
|
|
if(res.code==200){ |
|
|
|
if(params.state==1){ |
|
|
|
if (res.code == 200) { |
|
|
|
if (params.state == 1) { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message:'已发布成功!' |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
type: 'success', |
|
|
|
message: '已发布成功!' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
message:'已停止!' |
|
|
|
}); |
|
|
|
type: 'success', |
|
|
|
message: '已停止!' |
|
|
|
}) |
|
|
|
} |
|
|
|
}else{ |
|
|
|
return this.$message.error("失败了~~~~"); |
|
|
|
} else { |
|
|
|
return this.$message.error('失败了~~~~') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 编辑 |
|
|
|
editFormData(row) { |
|
|
|
this.messageVisible = true; |
|
|
|
this.messageVisible = true |
|
|
|
// 根据id查询返回的紧急通知的数据 |
|
|
|
const params = { |
|
|
|
notice_id: row.notice_id, |
|
|
|
}; |
|
|
|
notice_id: row.notice_id |
|
|
|
} |
|
|
|
reqQueryMessage(params).then((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; |
|
|
|
this.form.notice_id = row.notice_id; |
|
|
|
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 |
|
|
|
this.form.notice_id = row.notice_id |
|
|
|
// 判断文字位置 |
|
|
|
if (this.form.context_position == 1) { |
|
|
|
this.form.context_position_name = "顶部"; |
|
|
|
this.form.context_position_name = '顶部' |
|
|
|
} else if (this.form.context_position == 2) { |
|
|
|
this.form.context_position_name = "中部"; |
|
|
|
this.form.context_position_name = '中部' |
|
|
|
} else { |
|
|
|
this.form.context_position_name = "底部"; |
|
|
|
this.form.context_position_name = '底部' |
|
|
|
} |
|
|
|
// 判断速度 |
|
|
|
// if(context_speed_name == 0){ |
|
|
@ -430,25 +426,25 @@ |
|
|
|
// }else{ |
|
|
|
// this.form.context_speed_name='3s' |
|
|
|
// } |
|
|
|
//判断文字大小 |
|
|
|
// 判断文字大小 |
|
|
|
if (this.form.context_size == 0) { |
|
|
|
this.form.context_size_name = "16"; |
|
|
|
this.form.context_size_name = '16' |
|
|
|
} else if (this.form.context_size == 1) { |
|
|
|
this.form.context_size_name = "22"; |
|
|
|
this.form.context_size_name = '22' |
|
|
|
} else if (this.form.context_size == 2) { |
|
|
|
this.form.context_size_name = "24"; |
|
|
|
this.form.context_size_name = '24' |
|
|
|
} else { |
|
|
|
this.form.context_size_name = "30"; |
|
|
|
this.form.context_size_name = '30' |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 新增 |
|
|
|
addFormData() { |
|
|
|
this.messageVisible = true; |
|
|
|
this.messageVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.form.notice_id = null; |
|
|
|
}); |
|
|
|
this.form.notice_id = null |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
submit() { |
|
|
@ -464,32 +460,32 @@ |
|
|
|
notice_device: this.form.notice_device, |
|
|
|
notice_devices: this.form.notice_devices, |
|
|
|
notice_id: this.form.notice_id, |
|
|
|
orga_id: "133221333123111", |
|
|
|
}; |
|
|
|
orga_id: '133221333123111' |
|
|
|
} |
|
|
|
reqEditMessage(params).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.$message({ |
|
|
|
type: "success", |
|
|
|
type: 'success', |
|
|
|
message: this.form.notice_id |
|
|
|
? "修改紧急通知成功" |
|
|
|
: "添加紧急通知成功", |
|
|
|
}); |
|
|
|
this.messageVisible = false; |
|
|
|
this.getUrgentMessage(this.form.notice_id? this.queryInfo:1); |
|
|
|
? '修改紧急通知成功' |
|
|
|
: '添加紧急通知成功' |
|
|
|
}) |
|
|
|
this.messageVisible = false |
|
|
|
this.getUrgentMessage(this.form.notice_id ? this.queryInfo : 1) |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 所有设备和部分设备的切换数据处理 |
|
|
|
clearCheckbox() { |
|
|
|
if (this.form.notice_device == 1) { |
|
|
|
this.form.notice_devices = []; |
|
|
|
this.form.notice_devices = [] |
|
|
|
} |
|
|
|
}, |
|
|
|
// 多选框 |
|
|
|
handleSelectionChange(val) { |
|
|
|
this.selectedList = val; |
|
|
|
this.selectedList = val |
|
|
|
// if (val.length > 0) { |
|
|
|
// this.clearBtnDisabled = false; |
|
|
|
// } else { |
|
|
@ -498,52 +494,52 @@ |
|
|
|
}, |
|
|
|
// 改变文字的颜色 |
|
|
|
headleChangeColor() { |
|
|
|
this.form.context_size; |
|
|
|
this.form.context_size |
|
|
|
}, |
|
|
|
// 改变文字的大小 |
|
|
|
selectSize(selVal) { |
|
|
|
this.form.context_size = selVal.key; |
|
|
|
this.form.context_size_name = selVal.name; |
|
|
|
this.form.context_size = selVal.key |
|
|
|
this.form.context_size_name = selVal.name |
|
|
|
}, |
|
|
|
// 改变文字的位置 |
|
|
|
selectPosition(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; |
|
|
|
this.form.context_speed = selVal.key |
|
|
|
this.form.context_speed_name = selVal.name |
|
|
|
}, |
|
|
|
//添加设备的对话框 |
|
|
|
// 添加设备的对话框 |
|
|
|
addDeviceTag() { |
|
|
|
this.selectDeviceVisible = true; |
|
|
|
this.selectDeviceVisible = true |
|
|
|
}, |
|
|
|
// 添加设备 |
|
|
|
tagHandle(tag) { |
|
|
|
// 收集参数 部分设备的列表 |
|
|
|
if (this.form.notice_devices.length == 0) { |
|
|
|
this.form.notice_devices.push({ deviceId: tag.device_id }); |
|
|
|
this.form.notice_devices.push({ deviceId: tag.device_id }) |
|
|
|
} else { |
|
|
|
const result = this.form.notice_devices.some((item) => { |
|
|
|
return item.deviceId == tag.device_id; |
|
|
|
}); |
|
|
|
return item.deviceId == tag.device_id |
|
|
|
}) |
|
|
|
if (!result) { |
|
|
|
this.form.notice_devices.push({ deviceId: tag.device_id }); |
|
|
|
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 && |
|
|
|
this.deviceTags.some((item) => item.device_name == tag.device_name); |
|
|
|
this.deviceTags.some((item) => item.device_name == tag.device_name) |
|
|
|
if (!current) { |
|
|
|
this.deviceTags.push(tag); |
|
|
|
this.deviceTags.push(tag) |
|
|
|
} else { |
|
|
|
this.$message("请勿添加重复的设备!"); |
|
|
|
this.$message('请勿添加重复的设备!') |
|
|
|
} |
|
|
|
// !this.deviceTags.some(item => item.device_name === tag.device_name) |
|
|
|
// && this.deviceTags.push(tag) |
|
|
@ -551,25 +547,25 @@ |
|
|
|
}, |
|
|
|
// 单独删除某一个设备 |
|
|
|
handleClose(tag) { |
|
|
|
this.deviceTags.splice(this.deviceTags.indexOf(tag), 1); |
|
|
|
this.deviceTags.splice(this.deviceTags.indexOf(tag), 1) |
|
|
|
}, |
|
|
|
// 清空设备 |
|
|
|
clearDevice() { |
|
|
|
this.deviceTags = []; |
|
|
|
this.deviceTags = [] |
|
|
|
}, |
|
|
|
// 关闭重置表单 |
|
|
|
closeDialog() { |
|
|
|
this.messageVisible = false; |
|
|
|
this.$refs.form.resetFields(); |
|
|
|
this.messageVisible = false |
|
|
|
this.$refs.form.resetFields() |
|
|
|
}, |
|
|
|
// 每条显示数据改变时的事件 |
|
|
|
handleSizeChange(size) { |
|
|
|
//整理参数 |
|
|
|
// 整理参数 |
|
|
|
this.queryInfo.size = size |
|
|
|
this.getUrgentMessage(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
this.getUrgentMessage() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|