wz_shi 3 years ago
parent
commit
a90d4051c3
  1. 182
      src/views/device/deviceConfig.vue

182
src/views/device/deviceConfig.vue

@ -6,13 +6,12 @@
<el-col :span="20" class="col_flex">
<div class="form_item">
<span>设备ID</span>
<el-input v-model="query.blurry" clearable size="small" placeholder="请输入设备ID" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-input v-model="queryInfo.device_id" clearable size="small" placeholder="请输入设备ID" style="width: 200px" class="filter-item" @keyup.enter.native="getStartUpList" @blur="getStartUpList" />
</div>
<div class="form_item">
<span>设备名称</span>
<el-input v-model="query.blurry" clearable size="small" placeholder="请输入设备名称" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-input v-model="queryInfo.device_name" clearable size="small" placeholder="请输入设备名称" style="width: 200px" class="filter-item" @keyup.enter.native="getStartUpList" @blur="getStartUpList" />
</div>
<rrOperation />
</el-col>
<el-col class="page_add" :span="4">
<el-button class="table_add setting_btn" type="primary" round>配置</el-button>
@ -22,19 +21,32 @@
</div>
<el-row :gutter="15">
<el-col>
<el-table style="width: 100%;" :data="tableData" :header-cell-style="{ background: '#3a8aeb', color: '#fff' }" @selection-change="handleSelectionChange">
<el-table style="width: 100%;" :data="startUpList" :header-cell-style="{ background: '#3a8aeb', color: '#fff' }" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="设备ID" align="center" />
<el-table-column prop="account" label="设备账号" align="center" width="150" />
<el-table-column prop="name" label="设备名称" align="center" />
<el-table-column prop="orientation" label="设备方向" align="center" />
<el-table-column prop="period" label="配置周期" align="center" width="300" />
<el-table-column prop="cover" label="启动画面" align="center">
<template slot-scope="scope">
<el-image class="cover_img" :src="scope.row.cover" />
<el-table-column prop="device_id" label="设备ID" align="center" />
<el-table-column prop="device_account" label="设备账号" align="center" width="150" />
<el-table-column prop="device_name" label="设备名称" align="center" />
<el-table-column label="设备方向" align="center" >
<template slot-scope="{row}">
<div>{{row.device_direction==1? '竖屏' : '横屏' }}</div>
</template>
</el-table-column>
<el-table-column prop="period" label="配置周期" align="center" width="300" >
<template slot-scope="{row}">
<div>{{row.open_setting==1? '每天 - 开机 - '+row.open_time :'每周'+row.open_weekly}}</div>
<div>{{row.close_setting==1? '关机 - '+row.close_time :'每周'+row.close_weekly}}</div>
</template>
</el-table-column>
<el-table-column label="启动画面" align="center">
<template slot-scope="{row}">
<el-image class="cover_img" :src="row.startup_screen" />
</template>
</el-table-column>
<el-table-column prop="date" label="创建时间" align="center" width="200" />
<el-table-column prop="create_time" label="创建时间" align="center" width="200" >
<template slot-scope="{row}">
<div>{{ row.create_time | parseTime}}</div>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button
@ -47,12 +59,11 @@
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</el-col>
</el-row>
<!-- 编辑设备 -->
<div class="layer device_layer">
<el-dialog title="配置" :close-on-click-modal="false" :show-close="false" :visible.sync="addFromVisible" width="880px">
<el-dialog title="编辑" :close-on-click-modal="false" :show-close="false" :visible.sync="addFromVisible" width="880px">
<el-form ref="form" :model="form">
<div class="setting_item">
<h4>开机时间</h4>
@ -64,22 +75,22 @@
:rules="[
{ required: true, message: '请选择开机时间', trigger: 'change' },
]"
:class="{'no_margin': form.ontime === '每周'}"
:class="{'no_margin': form.ontime === 2}"
>
<el-radio-group v-model="form.ontime" @change="clearCheckbox()">
<el-radio label="每天" value="everyday" />
<el-radio label="每周" value="weekly" />
<el-radio :label="1" value="everyday">每天</el-radio>
<el-radio :label="2" value="weekly">每周</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="form.ontime === '每周'"
:class="{'weekly_margin': form.ontime === '每周'}"
v-if="form.ontime === 2"
:class="{'weekly_margin': form.ontime === 2}"
prop="onweek"
:rules="[
{ required: true, message: '请选择每周开机时间', trigger: 'change' },
]"
>
<el-checkbox-group v-model="form.onweek">
<el-checkbox-group v-model="onweek">
<el-checkbox label="周一" name="onweek" />
<el-checkbox label="周二" name="onweek" />
<el-checkbox label="周三" name="onweek" />
@ -117,22 +128,22 @@
:rules="[
{ required: true, message: '请选择关机时间', trigger: 'change' },
]"
:class="{'no_margin': form.offtime === '每周'}"
:class="{'no_margin': form.offtime === 2}"
>
<el-radio-group v-model="form.offtime" @change="clearCheckbox()">
<el-radio label="每天" value="everyday" />
<el-radio label="每周" value="weekly" />
<el-radio :label="1" value="everyday">每天</el-radio>
<el-radio :label="2" value="weekly">每周</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="form.offtime === '每周'"
:class="{'weekly_margin': form.offtime === '每周'}"
v-if="form.offtime === 2"
:class="{'weekly_margin': form.offtime === 2}"
prop="offweek"
:rules="[
{ required: true, message: '请选择每周关机时间', trigger: 'change' },
]"
>
<el-checkbox-group v-model="form.offweek">
<el-checkbox-group v-model="offweek">
<el-checkbox label="周一" name="offweek" />
<el-checkbox label="周二" name="offweek" />
<el-checkbox label="周三" name="offweek" />
@ -184,29 +195,7 @@
<!-- <i slot="default" class="el-icon-plus"></i> -->
<img src="@/assets/images/t-sc.png" alt />
<div slot="file" slot-scope="{file}">
<img class="el-upload-list__item-thumbnail" :src="file.url" alt />
<!-- <span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span>
</span>-->
<img class="el-upload-list__item-thumbnail" :src="file.url" alt />
</div>
</el-upload>
<!-- <el-dialog :visible.sync="dialogVisible">
@ -226,62 +215,81 @@
</template>
<script>
import crudUser from '@/api/system/user'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
const defaultForm = {
ontime: null,
offtime: null,
onweek: [],
offweek: [],
orientation: null,
ontimeValue: '',
offtimeValue: ''
}
import {reqStartUpList} from '@/api/device/startUpList.js'
import {parseTime} from '@/utils/index.js'
export default {
name: 'DeviceConfig',
components: { rrOperation, pagination },
cruds() {
return CRUD({
title: '用户',
url: 'api/users',
crudMethod: { ...crudUser }
})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
query:{
blurry:''
},
//
queryInfo:{
device_id:'',
device_name:'',
is_state:'',
page:'1',
size:'3'
},
//
startUpList:[],
form:{
ontime: null, //
offtime: null, //
orientation: null, //
ontimeValue: '', //
offtimeValue: '' //
},
offweek: [], //
onweek: [], //
addFromVisible: false,
selectedList: [],
clearBtnDisabled: true,
tableData: [
{
id: 'XXXXXXXXX',
account: '13476289682',
name: 'GCXR2',
orientation: '竖屏',
period: '每周(一/二/三/四/五)- 开机 - 8:00-18:00',
cover: 'https://qiniu.aiyxlib.com/1636076789085.png',
date: '2021-09-14 16:35'
}
],
deviceData: [{ key: '0', name: '竖屏' }, { key: '1', name: '横屏' }]
}
},
filters: {
parseTime(time, cFormat) {
return parseTime(time, cFormat)
}
},
computed: {},
watch: {},
mounted(){
this.getStartUpList()
},
methods: {
//
getStartUpList(){
const params = this.queryInfo
reqStartUpList(params).then(res => {
if(res.code==200) {
this.startUpList=res.data.content
}else{
return this.$message.error('获取设备列表失败!')
}
})
},
//
editFormData(index, row) {
console.log(row)
this.addFromVisible = true
this.form={
ontime:row.open_setting ,
offtime:row.close_setting,
ontimeValue:row.open_time,
offtimeValue:row.close_time,
}
// this.offweek=row.close_weekly
// this.onweek=row.open_weekly
},
clearCheckbox() {
if (this.form.ontime === '每天') {
this.form.onweek = []
if (this.form.ontime == 1) {
this.onweek = []
}
if (this.form.offtime === '每天') {
this.form.offweek = []
if (this.form.offtime == 1) {
this.offweek = []
}
},
resetForm(formName) {

Loading…
Cancel
Save