Browse Source

设备列表 紧急发布的bug修复

dev
xudanya 3 years ago
parent
commit
0b85ce5f6b
  1. 1
      src/api/device/deviceList.js
  2. 4
      src/views/components/Editor.vue
  3. 2
      src/views/dashboard/LineChart.vue
  4. 115
      src/views/device/deviceConfig.vue
  5. 121
      src/views/device/index.vue
  6. 2
      src/views/features/401.vue
  7. 8
      src/views/features/404.vue
  8. 2
      src/views/mnt/database/execute.vue
  9. 2
      src/views/mnt/deploy/deploy.vue
  10. 228
      src/views/publishContent/urgentMessage/index.vue

1
src/api/device/deviceList.js

@ -10,7 +10,6 @@ export function ReqDeviceList(parameter) {
} }
// &device_id=${device_id} // &device_id=${device_id}
// 编辑设备发起请求 // 编辑设备发起请求
export function ReqDeviceEdit(parameter) { export function ReqDeviceEdit(parameter) {
return request({ return request({

4
src/views/components/Editor.vue

@ -6,10 +6,10 @@
</p> </p>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="15" :lg="15" :xl="15"> <el-col :xs="24" :sm="24" :md="15" :lg="15" :xl="15">
<div ref="editor" class="text" />
<div ref="editor" class="text"></div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :md="9" :lg="9" :xl="9"> <el-col :xs="24" :sm="24" :md="9" :lg="9" :xl="9">
<div v-html="editorContent" />
<div v-html="editorContent"></div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>

2
src/views/dashboard/LineChart.vue

@ -1,5 +1,5 @@
<template> <template>
<div :class="className" :style="{height:height,width:width}" />
<div :class="className" :style="{height:height,width:width}"></div>
</template> </template>
<script> <script>

115
src/views/device/deviceConfig.vue

@ -39,7 +39,7 @@
</el-table-column> </el-table-column>
<el-table-column label="启动画面" align="center"> <el-table-column label="启动画面" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-image class="cover_img" :src="row.startup_screen" v-show="row.startup_screen"></el-image>
<el-image v-show="row.startup_screen" class="cover_img" :src="row.startup_screen" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="update_time" label="创建时间" align="center" width="200"> <el-table-column prop="update_time" label="创建时间" align="center" width="200">
@ -49,27 +49,12 @@
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="120"> <el-table-column fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
type="primary"
class="edit_btn"
@click="editFormData(scope.row)"
>编辑</el-button>
<el-button type="primary" class="edit_btn" @click="editFormData(scope.row)">编辑</el-button>
<el-button type="info" class="record_btn">记录</el-button> <el-button type="info" class="record_btn">记录</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
style="margin-top: 20px; text-align: center"
:current-page="queryInfo.page"
:total="total"
:page-size="queryInfo.size"
:pager-count="7"
:page-sizes="[3, 5, 10]"
@current-change="getStartUpList"
@size-change="handleSizeChange"
layout="prev, pager, next, jumper,->,sizes,total"
>
</el-pagination>
<el-pagination style="margin-top: 20px; text-align: center" :current-page="queryInfo.page" :total="total" :page-size="queryInfo.size" :pager-count="7" :page-sizes="[3, 5, 10]" layout="prev, pager, next, jumper,->,sizes,total" @current-change="getStartUpList" @size-change="handleSizeChange" />
</el-col> </el-col>
</el-row> </el-row>
@ -82,45 +67,28 @@
<div class="setting_cont"> <div class="setting_cont">
<span>设置时间</span> <span>设置时间</span>
<div> <div>
<el-form-item
prop="open_setting"
:rules="[
<el-form-item prop="open_setting" :rules="[
{ required: true, message: '请选择开机时间', trigger: 'change' }, { required: true, message: '请选择开机时间', trigger: 'change' },
]"
:class="{'no_margin': form.open_setting === 2}"
>
]" :class="{'no_margin': form.open_setting === 2}">
<el-radio-group v-model="form.open_setting" @change="clearCheckbox()"> <el-radio-group v-model="form.open_setting" @change="clearCheckbox()">
<el-radio :label="1" value="everyday">每天</el-radio> <el-radio :label="1" value="everyday">每天</el-radio>
<el-radio :label="2" value="weekly">每周</el-radio> <el-radio :label="2" value="weekly">每周</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item
v-if="form.open_setting === 2"
:class="{'weekly_margin': form.open_setting === 2}"
prop="open_weekly"
:rules="[
<el-form-item v-if="form.open_setting === 2" :class="{'weekly_margin': form.open_setting === 2}" prop="open_weekly" :rules="[
{ required: true, message: '请选择每周开机时间', trigger: 'change' }, { required: true, message: '请选择每周开机时间', trigger: 'change' },
]"
>
]">
<el-checkbox-group v-model="selectOpenWeekly"> <el-checkbox-group v-model="selectOpenWeekly">
<el-checkbox v-for="item in weeklyList" :key="item.id" :label="item.id" :value="item.id" name="type">{{ item.name }}</el-checkbox> <el-checkbox v-for="item in weeklyList" :key="item.id" :label="item.id" :value="item.id" name="type">{{ item.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item
prop="open_time"
:rules="[
<el-form-item prop="open_time" :rules="[
{type: 'string', required: true, message: '请选择具体开机时间', trigger: 'change' }, {type: 'string', required: true, message: '请选择具体开机时间', trigger: 'change' },
]"
>
<el-time-picker
v-model="form.open_time"
:picker-options="{
]">
<el-time-picker v-model="form.open_time" :picker-options="{
selectableRange: '00:00:00 - 23:59:59' selectableRange: '00:00:00 - 23:59:59'
}"
placeholder="任意时间点"
value-format="HH:mm:ss"
/>
}" placeholder="任意时间点" value-format="HH:mm:ss" />
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
@ -130,45 +98,28 @@
<div class="setting_cont"> <div class="setting_cont">
<span>设置时间</span> <span>设置时间</span>
<div> <div>
<el-form-item
prop="close_setting"
:rules="[
<el-form-item prop="close_setting" :rules="[
{required: true, message: '请选择关机时间', trigger: 'change' }, {required: true, message: '请选择关机时间', trigger: 'change' },
]"
:class="{'no_margin': form.close_setting === 2}"
>
]" :class="{'no_margin': form.close_setting === 2}">
<el-radio-group v-model="form.close_setting" @change="clearCheckbox()"> <el-radio-group v-model="form.close_setting" @change="clearCheckbox()">
<el-radio :label="1" value="everyday">每天</el-radio> <el-radio :label="1" value="everyday">每天</el-radio>
<el-radio :label="2" value="weekly">每周</el-radio> <el-radio :label="2" value="weekly">每周</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item
v-if="form.close_setting === 2"
:class="{'weekly_margin': form.close_setting === 2}"
prop="close_weekly"
:rules="[
<el-form-item v-if="form.close_setting === 2" :class="{'weekly_margin': form.close_setting === 2}" prop="close_weekly" :rules="[
{ required: true, message: '请选择每周关机时间', trigger: 'change' }, { required: true, message: '请选择每周关机时间', trigger: 'change' },
]"
>
]">
<el-checkbox-group v-model="selectCloseweekly"> <el-checkbox-group v-model="selectCloseweekly">
<el-checkbox v-for="item in weeklyList" :key="item.id" :label="item.id" :value="item.id" name="type">{{ item.name }}</el-checkbox> <el-checkbox v-for="item in weeklyList" :key="item.id" :label="item.id" :value="item.id" name="type">{{ item.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item
prop="close_time"
:rules="[
<el-form-item prop="close_time" :rules="[
{type: 'string', required: true, message: '请选择具体关机时间', trigger: 'change' }, {type: 'string', required: true, message: '请选择具体关机时间', trigger: 'change' },
]"
>
<el-time-picker
v-model="form.close_time"
:picker-options="{
]">
<el-time-picker v-model="form.close_time" :picker-options="{
selectableRange: '00:00:00 - 23:59:59' selectableRange: '00:00:00 - 23:59:59'
}"
placeholder="任意时间点"
value-format="HH:mm:ss"
/>
}" placeholder="任意时间点" value-format="HH:mm:ss" />
</el-form-item> </el-form-item>
</div> </div>
</div> </div>
@ -177,12 +128,9 @@
<h4>设备方向</h4> <h4>设备方向</h4>
<div class="setting_cont"> <div class="setting_cont">
<span>设备方向</span> <span>设备方向</span>
<el-form-item
prop="device_direction_name"
:rules="[
<el-form-item prop="device_direction_name" :rules="[
{ required: true, message: '请选择具体设备方向', trigger: 'change' }, { required: true, message: '请选择具体设备方向', trigger: 'change' },
]"
>
]">
<el-select v-model="form.device_direction_name" size="small" class="filter-item" value-key="name" @change="selectDirection"> <el-select v-model="form.device_direction_name" size="small" class="filter-item" value-key="name" @change="selectDirection">
<el-option v-for="item in deviceData" :key="item.key" :label="item.name" :value="item" /> <el-option v-for="item in deviceData" :key="item.key" :label="item.name" :value="item" />
</el-select> </el-select>
@ -304,7 +252,7 @@ export default {
return str.split(',').map(i => a[i]).join('/') return str.split(',').map(i => a[i]).join('/')
} }
} }
},
}
}, },
watch: {}, watch: {},
@ -313,8 +261,8 @@ export default {
}, },
methods: { methods: {
// //
getStartUpList(pager=1) {
this.queryInfo.page=pager
getStartUpList () {
// this.queryInfo.page = pager
const params = this.queryInfo const params = this.queryInfo
reqStartUpList(params).then(res => { reqStartUpList(params).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -425,15 +373,15 @@ export default {
}, },
// //
removeStartUp (rows) { removeStartUp (rows) {
let ids=[]
const ids = []
rows.forEach(item => { rows.forEach(item => {
ids.push(item.device_id) ids.push(item.device_id)
}) })
// console.log(ids) // console.log(ids)
this.$confirm('确定要清空选中的配置周期和启动画面吗?', '提示', { this.$confirm('确定要清空选中的配置周期和启动画面吗?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => { }).then(() => {
const params = { const params = {
ids ids
@ -459,8 +407,8 @@ export default {
handleSizeChange (size) { handleSizeChange (size) {
// //
this.queryInfo.size = size this.queryInfo.size = size
this.getStartUpList();
},
this.getStartUpList()
}
} }
} }
</script> </script>
@ -519,7 +467,6 @@ export default {
} }
} }
} }
</style> </style>
<style> <style>
@ -531,7 +478,7 @@ export default {
overflow: hidden; overflow: hidden;
} }
.avatar-uploader .el-upload:hover { .avatar-uploader .el-upload:hover {
border-color: #409EFF;
border-color: #409eff;
} }
.avatar-uploader-icon { .avatar-uploader-icon {
font-size: 28px; font-size: 28px;

121
src/views/device/index.vue

@ -7,41 +7,16 @@
<div class="form_item"> <div class="form_item">
<span>状态</span> <span>状态</span>
<el-select v-model="query.state" size="small" class="filter-item" style="width: 120px"> <el-select v-model="query.state" size="small" class="filter-item" style="width: 120px">
<el-option
v-for="item in stateData"
:key="item.key"
:label="item.name"
:value="item.key"
/>
<el-option v-for="item in stateData" :key="item.key" :label="item.name" :value="item.key" />
</el-select> </el-select>
</div> </div>
<div class="form_item"> <div class="form_item">
<span>设备ID</span> <span>设备ID</span>
<el-input
v-model="queryInfo.device_id"
clearable
size="small"
placeholder="请输入设备ID"
style="width: 200px"
class="filter-item"
@clear="getDevice"
@blur="queryDevice(queryInfo.device_id)"
@keyup.enter.native='queryDevice(queryInfo.device_id)'
/>
<el-input v-model="queryInfo.device_id" clearable size="small" placeholder="请输入设备ID" style="width: 200px" class="filter-item" @clear="getDevice" @blur="queryDevice(queryInfo.device_id)" @keyup.enter.native="queryDevice(queryInfo.device_id)" />
</div> </div>
<div class="form_item"> <div class="form_item">
<span>设备名称</span> <span>设备名称</span>
<el-input
v-model="queryInfo.device_name"
clearable
size="small"
placeholder="请输入设备名称"
style="width: 200px"
class="filter-item"
@clear="getDevice"
@blur="getDevice"
@keyup.enter.native="getDevice"
/>
<el-input v-model="queryInfo.device_name" clearable size="small" placeholder="请输入设备名称" style="width: 200px" class="filter-item" @clear="getDevice" @blur="getDevice" @keyup.enter.native="getDevice" />
</div> </div>
</el-col> </el-col>
<el-col class="page_add" :span="4"> <el-col class="page_add" :span="4">
@ -52,11 +27,7 @@
<!-- table :data="deviceList"--> <!-- table :data="deviceList"-->
<el-row :gutter="15"> <el-row :gutter="15">
<el-col> <el-col>
<el-table
style="width: 100%;"
:data="deviceList"
:header-cell-style="{ background: '#3a8aeb', color: '#fff' }"
>
<el-table style="width: 100%;" :data="deviceList" :header-cell-style="{ background: '#3a8aeb', color: '#fff' }">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column prop="device_id" label="设备ID" align="center" /> <el-table-column prop="device_id" label="设备ID" align="center" />
<el-table-column prop="device_account" label="设备账号" align="center" /> <el-table-column prop="device_account" label="设备账号" align="center" />
@ -85,11 +56,7 @@
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="160"> <el-table-column fixed="right" label="操作" align="center" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
type="primary"
class="edit_btn"
@click="editFormData(scope.row)"
>编辑</el-button>
<el-button type="primary" class="edit_btn" @click="editFormData(scope.row)">编辑</el-button>
<el-button type="danger" class="record_btn" @click="recordData(scope.$index, scope.row)">记录</el-button> <el-button type="danger" class="record_btn" @click="recordData(scope.$index, scope.row)">记录</el-button>
<el-button type="danger" @click="removeDevice(scope.row)">解绑</el-button> <el-button type="danger" @click="removeDevice(scope.row)">解绑</el-button>
</template> </template>
@ -97,27 +64,10 @@
</el-table> </el-table>
</el-col> </el-col>
</el-row> </el-row>
<el-pagination
style="margin-top: 20px; text-align: center"
:current-page="queryInfo.page"
:total="total"
:page-size="queryInfo.size"
:pager-count="7"
:page-sizes="[3, 5, 10]"
@current-change="getDevice"
@size-change="handleSizeChange"
layout="prev, pager, next, jumper,->,sizes,total"
>
</el-pagination>
<el-pagination style="margin-top: 20px; text-align: center" :current-page="queryInfo.page" :total="total" :page-size="queryInfo.size" :pager-count="7" :page-sizes="[3, 5, 10]" layout="prev, pager, next, jumper,->,sizes,total" @current-change="getDevice" @size-change="handleSizeChange" />
<!-- 编辑设备 --> <!-- 编辑设备 -->
<div class="layer"> <div class="layer">
<el-dialog
:title="dialogTitle"
:close-on-click-modal="false"
:show-close="false"
:visible.sync="addFromVisible"
width="576px"
>
<el-dialog :title="dialogTitle" :close-on-click-modal="false" :show-close="false" :visible.sync="addFromVisible" width="576px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="设备账号" prop="account"> <el-form-item label="设备账号" prop="account">
<el-input v-model="form.account" autocomplete="off" disabled /> <el-input v-model="form.account" autocomplete="off" disabled />
@ -127,12 +77,7 @@
</el-form-item> </el-form-item>
<el-form-item label="设备方向" prop="orientation_name"> <el-form-item label="设备方向" prop="orientation_name">
<el-select v-model="form.orientation_name" size="small" class="filter-item" @change="selectDirection"> <el-select v-model="form.orientation_name" size="small" class="filter-item" @change="selectDirection">
<el-option
v-for="item in deviceData"
:key="item.key"
:label="item.name"
:value="item"
/>
<el-option v-for="item in deviceData" :key="item.key" :label="item.name" :value="item" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -144,13 +89,7 @@
</div> </div>
<div class="publish_layer"> <div class="publish_layer">
<el-dialog
title="发布内容"
:close-on-click-modal="false"
:visible.sync="contentVisible"
width="970px"
height="590px"
>
<el-dialog title="发布内容" :close-on-click-modal="false" :visible.sync="contentVisible" width="970px" height="590px">
<div class="content_warp"> <div class="content_warp">
<h4>图片</h4> <h4>图片</h4>
<ul class="item_list"> <ul class="item_list">
@ -189,14 +128,7 @@
</div> </div>
<!-- 记录 --> <!-- 记录 -->
<el-dialog
append-to-body
:close-on-click-modal="false"
:visible.sync="recordVisible"
title="记录"
class="record_layer"
width="750px"
>
<el-dialog append-to-body :close-on-click-modal="false" :visible.sync="recordVisible" title="记录" class="record_layer" width="750px">
<el-table :data="recordData"> <el-table :data="recordData">
<el-table-column property="name" label="操作人" /> <el-table-column property="name" label="操作人" />
<el-table-column property="permissionType" label="角色权限" /> <el-table-column property="permissionType" label="角色权限" />
@ -214,6 +146,11 @@ import { ReqDeviceEdit ,ReqDeviceList,ReqQueryDevice,ReqRemoveDevice} from '@/ap
import { parseTime } from '@/utils/index.js' import { parseTime } from '@/utils/index.js'
export default { export default {
name: 'Device', name: 'Device',
filters: {
parseTime (time, cFormat) {
return parseTime(time, cFormat)
}
},
data () { data () {
return { return {
queryInfo: { queryInfo: {
@ -235,7 +172,7 @@ export default {
stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }], stateData: [{ key: '0', name: '全部' }, { key: '1', name: '在线' }, { key: '2', name: '离线' }],
deviceData: [{ key: '1', name: '竖屏' }, { key: '2', name: '横屏' }], deviceData: [{ key: '1', name: '竖屏' }, { key: '2', name: '横屏' }],
query: { query: {
state:null,
state: null
}, },
// //
form: { form: {
@ -252,19 +189,14 @@ export default {
} }
} }
}, },
filters: {
parseTime(time, cFormat) {
return parseTime(time, cFormat)
}
},
watch: {}, watch: {},
mounted () { mounted () {
this.getDevice() this.getDevice()
}, },
methods: { methods: {
// //
getDevice(pager=1){
this.queryInfo.page=pager
getDevice () {
// this.queryInfo.page = pager
const params = this.queryInfo const params = this.queryInfo
ReqDeviceList(params).then(res => { ReqDeviceList(params).then(res => {
console.log(res) console.log(res)
@ -276,7 +208,6 @@ export default {
return this.$message.error('获取设备列表失败!') return this.$message.error('获取设备列表失败!')
} }
}) })
}, },
// //
editFormData (row) { editFormData (row) {
@ -296,10 +227,10 @@ export default {
// //
removeDevice (row) { removeDevice (row) {
// console.log(row.device_id) // console.log(row.device_id)
this.$confirm(`你确定解绑${row.device_name}?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
this.$confirm(`你确定解绑${row.device_name}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => { }).then(() => {
const params = { const params = {
id: row.device_id id: row.device_id
@ -312,7 +243,6 @@ export default {
}) })
// //
this.getDevice(this.deviceList.length > 1 ? this.queryInfo.page : this.queryInfo.page - 1) this.getDevice(this.deviceList.length > 1 ? this.queryInfo.page : this.queryInfo.page - 1)
} }
}) })
}).catch(() => { }).catch(() => {
@ -321,7 +251,6 @@ export default {
type: 'info' type: 'info'
}) })
}) })
}, },
recordData (index, row) { recordData (index, row) {
this.recordVisible = true this.recordVisible = true
@ -346,9 +275,9 @@ export default {
ReqDeviceEdit(params).then(res => { ReqDeviceEdit(params).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
type: "success",
type: 'success',
message: '修改设备成功' message: '修改设备成功'
});
})
} }
this.addFromVisible = false this.addFromVisible = false
this.getDevice(this.queryInfo.page) this.getDevice(this.queryInfo.page)
@ -376,7 +305,7 @@ export default {
// //
this.queryInfo.size = size this.queryInfo.size = size
this.getDevice() this.getDevice()
},
}
} }
} }

2
src/views/features/401.vue

@ -20,7 +20,7 @@
</ul> </ul>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<img :src="errGif" width="313" height="428" alt="Girl has dropped her ice cream.">
<img :src="errGif" width="313" height="428" alt="Girl has dropped her ice cream." />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>

8
src/views/features/404.vue

@ -2,10 +2,10 @@
<div class="wscn-http404-container"> <div class="wscn-http404-container">
<div class="wscn-http404"> <div class="wscn-http404">
<div class="pic-404"> <div class="pic-404">
<img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404">
<img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404">
<img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404">
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
<img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404" />
<img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404" />
<img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404" />
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404" />
</div> </div>
<div class="bullshit"> <div class="bullshit">
<div class="bullshit__oops">OOPS!</div> <div class="bullshit__oops">OOPS!</div>

2
src/views/mnt/database/execute.vue

@ -10,7 +10,7 @@
class="upload-demo" class="upload-demo"
drag drag
> >
<i class="el-icon-upload" />
<i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处 将文件拖到此处
<em>点击上传</em> <em>点击上传</em>

2
src/views/mnt/deploy/deploy.vue

@ -10,7 +10,7 @@
class="upload-demo" class="upload-demo"
drag drag
> >
<i class="el-icon-upload" />
<i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处 将文件拖到此处
<em>点击上传</em> <em>点击上传</em>

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

@ -52,14 +52,12 @@
type="primary" type="primary"
class="edit_btn" class="edit_btn"
@click="editFormData(scope.row)" @click="editFormData(scope.row)"
>编辑</el-button
>
>编辑</el-button>
<el-button <el-button
type="primary" type="primary"
:class="['start_btn', { stop_btn: scope.row.is_state == 1 }]" :class="['start_btn', { stop_btn: scope.row.is_state == 1 }]"
@click="isStopHandle(scope.$index, scope.row)" @click="isStopHandle(scope.$index, scope.row)"
>{{ scope.row.is_state == 1 ? "停止" : "恢复" }}</el-button
>
>{{ scope.row.is_state == 1 ? "停止" : "恢复" }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -73,11 +71,10 @@
:page-size="queryInfo.size" :page-size="queryInfo.size"
:pager-count="5" :pager-count="5"
:page-sizes="[3, 5, 10]" :page-sizes="[3, 5, 10]"
layout="prev, pager, next, jumper,->,sizes,total"
@current-change="getUrgentMessage" @current-change="getUrgentMessage"
@size-change="handleSizeChange" @size-change="handleSizeChange"
layout="prev, pager, next, jumper,->,sizes,total"
>
</el-pagination>
/>
<!-- 编辑紧急通知 --> <!-- 编辑紧急通知 -->
<div class="publish_layer"> <div class="publish_layer">
@ -193,14 +190,14 @@
@change="clearCheckbox()" @change="clearCheckbox()"
> >
<el-radio :label="1" value="all">所有设备</el-radio> <el-radio :label="1" value="all">所有设备</el-radio>
<el-radio :label="2" value="other"
<el-radio
:label="2"
value="other"
>部分设备<i >部分设备<i
v-if="form.notice_device === 2" v-if="form.notice_device === 2"
class="radio_tip" class="radio_tip"
@click="addDeviceTag()" @click="addDeviceTag()"
>添加</i
></el-radio
>
>添加</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 v-if="form.notice_device === 1" class="select_all_tip">
@ -211,15 +208,16 @@
class="select_other" class="select_other"
> >
<el-row> <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-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-col>
</el-row> </el-row>
<el-tag <el-tag
@ -269,27 +267,27 @@
</template> </template>
<script> <script>
import { parseTime } from "@/utils/index.js";
import { ReqDeviceList } from "@/api/device/deviceList.js";
import { parseTime } from '@/utils/index.js'
import { ReqDeviceList } from '@/api/device/deviceList.js'
import { import {
reqUrgentMessage, reqUrgentMessage,
reqQueryMessage, reqQueryMessage,
reqEditMessage, reqEditMessage,
reqChangeMessage reqChangeMessage
} from "@/api/publish/urgentMessage";
} from '@/api/publish/urgentMessage'
export default { export default {
name: "UrgentMessage",
name: 'UrgentMessage',
filters: { filters: {
parseTime(time, cFormat) { parseTime(time, cFormat) {
return parseTime(time, cFormat);
},
return parseTime(time, cFormat)
}
}, },
data() { data() {
return { return {
isAddEdit: false, isAddEdit: false,
form: { form: {
context_color: "#ff0000", //
context: "", //
context_color: '#ff0000', //
context: '', //
context_position: null, // context_position: null, //
context_position_name: null, context_position_name: null,
context_speed_name: null, context_speed_name: null,
@ -299,14 +297,14 @@
// create_by:'', // // create_by:'', //
notice_device: null, notice_device: null,
notice_devices: [], notice_devices: [],
notice_id: "", //id
orga_id: "133221333123111",
notice_id: '', // id
orga_id: '133221333123111'
}, },
queryInfo: { queryInfo: {
notice_name: "",
orga_id: "133221333123111",
notice_name: '',
orga_id: '133221333123111',
page: 1, page: 1,
size: 3,
size: 3
}, },
total: 0, total: 0,
messageVisible: false, messageVisible: false,
@ -315,17 +313,17 @@
{ key: 0, name: 16 }, { key: 0, name: 16 },
{ key: 1, name: 22 }, { key: 1, name: 22 },
{ key: 2, name: 24 }, { key: 2, name: 24 },
{ key: 3, name: 30 },
{ key: 3, name: 30 }
], ],
positionData: [ positionData: [
{ key: 1, name: "顶部" },
{ key: 2, name: "中间" },
{ key: 3, name: "底部" },
{ key: 1, name: '顶部' },
{ key: 2, name: '中间' },
{ key: 3, name: '底部' }
], ],
speedData: [ 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: [], selectedList: [],
// //
@ -333,36 +331,36 @@
// newArr:[], // newArr:[],
deviceTags: [], deviceTags: [],
// //
urgentMessage: [],
};
urgentMessage: []
}
}, },
mounted() { mounted() {
this.getUrgentMessage();
this.getDevice();
this.getUrgentMessage()
this.getDevice()
}, },
methods: { methods: {
// //
getUrgentMessage(pager = 1) { getUrgentMessage(pager = 1) {
this.queryInfo.page = pager this.queryInfo.page = pager
const params = this.queryInfo;
const params = this.queryInfo
reqUrgentMessage(params).then((res) => { reqUrgentMessage(params).then((res) => {
if (res.code == 200) { 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); // 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) { if (res.code == 200) {
this.deviceList = res.data.content;
this.deviceList = res.data.content
} else { } else {
return this.$message.error("获取设备列表失败!");
return this.$message.error('获取设备列表失败!')
} }
});
})
}, },
// is_state1 2 // is_state1 2
// row.is_state == 1 ? "" : "" // row.is_state == 1 ? "" : ""
@ -370,9 +368,9 @@
console.log(row) console.log(row)
// console.log(index) // console.log(index)
if (row.is_state == 1) { if (row.is_state == 1) {
row.is_state = 2;
row.is_state = 2
} else { } else {
row.is_state = 1;
row.is_state = 1
} }
const params = { const params = {
id: row.notice_id, id: row.notice_id,
@ -383,44 +381,42 @@
if (res.code == 200) { if (res.code == 200) {
if (params.state == 1) { if (params.state == 1) {
this.$message({ this.$message({
type: "success",
type: 'success',
message: '已发布成功!' message: '已发布成功!'
});
})
} else { } else {
this.$message({ this.$message({
type: "success",
type: 'success',
message: '已停止!' message: '已停止!'
});
})
} }
} else { } else {
return this.$message.error("失败了~~~~");
return this.$message.error('失败了~~~~')
} }
}) })
}, },
// //
editFormData(row) { editFormData(row) {
this.messageVisible = true;
this.messageVisible = true
// id // id
const params = { const params = {
notice_id: row.notice_id,
};
notice_id: row.notice_id
}
reqQueryMessage(params).then((res) => { reqQueryMessage(params).then((res) => {
if (res.code == 200) { 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) { if (this.form.context_position == 1) {
this.form.context_position_name = "顶部";
this.form.context_position_name = '顶部'
} else if (this.form.context_position == 2) { } else if (this.form.context_position == 2) {
this.form.context_position_name = "中部";
this.form.context_position_name = '中部'
} else { } else {
this.form.context_position_name = "底部";
this.form.context_position_name = '底部'
} }
// //
// if(context_speed_name == 0){ // if(context_speed_name == 0){
@ -432,23 +428,23 @@
// } // }
// //
if (this.form.context_size == 0) { 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) { } 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) { } else if (this.form.context_size == 2) {
this.form.context_size_name = "24";
this.form.context_size_name = '24'
} else { } else {
this.form.context_size_name = "30";
this.form.context_size_name = '30'
} }
} }
});
})
}, },
// //
addFormData() { addFormData() {
this.messageVisible = true;
this.messageVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.notice_id = null;
});
this.form.notice_id = null
})
}, },
// //
submit() { submit() {
@ -464,32 +460,32 @@
notice_device: this.form.notice_device, notice_device: this.form.notice_device,
notice_devices: this.form.notice_devices, notice_devices: this.form.notice_devices,
notice_id: this.form.notice_id, notice_id: this.form.notice_id,
orga_id: "133221333123111",
};
orga_id: '133221333123111'
}
reqEditMessage(params).then((res) => { reqEditMessage(params).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message({ this.$message({
type: "success",
type: 'success',
message: this.form.notice_id 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() { clearCheckbox() {
if (this.form.notice_device == 1) { if (this.form.notice_device == 1) {
this.form.notice_devices = [];
this.form.notice_devices = []
} }
}, },
// //
handleSelectionChange(val) { handleSelectionChange(val) {
this.selectedList = val;
this.selectedList = val
// if (val.length > 0) { // if (val.length > 0) {
// this.clearBtnDisabled = false; // this.clearBtnDisabled = false;
// } else { // } else {
@ -498,52 +494,52 @@
}, },
// //
headleChangeColor() { headleChangeColor() {
this.form.context_size;
this.form.context_size
}, },
// //
selectSize(selVal) { 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) { 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) { 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() { addDeviceTag() {
this.selectDeviceVisible = true;
this.selectDeviceVisible = true
}, },
// //
tagHandle(tag) { tagHandle(tag) {
// //
if (this.form.notice_devices.length == 0) { 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 { } else {
const result = this.form.notice_devices.some((item) => { const result = this.form.notice_devices.some((item) => {
return item.deviceId == tag.device_id;
});
return item.deviceId == tag.device_id
})
if (!result) { 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) { if (this.deviceTags.length == 0) {
this.deviceTags.push(tag);
this.deviceTags.push(tag)
} else { } else {
const current = const current =
this.deviceTags && this.deviceTags &&
this.deviceTags.some((item) => item.device_name == tag.device_name);
this.deviceTags.some((item) => item.device_name == tag.device_name)
if (!current) { if (!current) {
this.deviceTags.push(tag);
this.deviceTags.push(tag)
} else { } else {
this.$message("请勿添加重复的设备!");
this.$message('请勿添加重复的设备!')
} }
// !this.deviceTags.some(item => item.device_name === tag.device_name) // !this.deviceTags.some(item => item.device_name === tag.device_name)
// && this.deviceTags.push(tag) // && this.deviceTags.push(tag)
@ -551,25 +547,25 @@
}, },
// //
handleClose(tag) { handleClose(tag) {
this.deviceTags.splice(this.deviceTags.indexOf(tag), 1);
this.deviceTags.splice(this.deviceTags.indexOf(tag), 1)
}, },
// //
clearDevice() { clearDevice() {
this.deviceTags = [];
this.deviceTags = []
}, },
// //
closeDialog() { closeDialog() {
this.messageVisible = false;
this.$refs.form.resetFields();
this.messageVisible = false
this.$refs.form.resetFields()
}, },
// //
handleSizeChange(size) { handleSizeChange(size) {
// //
this.queryInfo.size = size this.queryInfo.size = size
this.getUrgentMessage();
},
},
};
this.getUrgentMessage()
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save