|
|
@ -14,7 +14,6 @@ |
|
|
|
</div> |
|
|
|
</el-col> |
|
|
|
<el-col class="page_add" :span="4"> |
|
|
|
<el-button class="table_add setting_btn" type="primary" round>配置</el-button> |
|
|
|
<el-button class="table_add clear_btn" plain :disabled="clearBtnDisabled">清空</el-button> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -32,9 +31,9 @@ |
|
|
|
</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 slot-scope="{row}"> |
|
|
|
<div>{{ row.open_setting==1? '每天 - 开机 '+row.open_time :'每周'+openWeekly(row.open_weekly)+'开机'+row.open_time }}</div> |
|
|
|
<div>{{ row.close_setting==1?'每天 - 关机'+row.close_time :'每周'+closeWeekly(row.close_weekly)+'关机'+row.close_time }}</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="启动画面" align="center"> |
|
|
@ -52,7 +51,7 @@ |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
class="edit_btn" |
|
|
|
@click="editFormData(scope.$index, scope.row)" |
|
|
|
@click="editFormData(scope.row)" |
|
|
|
>编辑</el-button> |
|
|
|
<el-button type="info" class="record_btn">记录</el-button> |
|
|
|
</template> |
|
|
@ -92,7 +91,7 @@ |
|
|
|
|
|
|
|
> |
|
|
|
<el-checkbox-group v-model="open_weekly"> |
|
|
|
<el-checkbox :label="1" name="open_weekly">周一</el-checkbox> |
|
|
|
<el-checkbox :label='1' name="open_weekly">周一</el-checkbox> |
|
|
|
<el-checkbox :label="2" name="open_weekly" >周二</el-checkbox> |
|
|
|
<el-checkbox :label="3" name="open_weekly" >周三</el-checkbox> |
|
|
|
<el-checkbox :label="4" name="open_weekly" >周四</el-checkbox> |
|
|
@ -180,12 +179,12 @@ |
|
|
|
<div class="setting_cont"> |
|
|
|
<span>设备方向:</span> |
|
|
|
<el-form-item |
|
|
|
prop="orientation" |
|
|
|
prop="device_direction" |
|
|
|
:rules="[ |
|
|
|
{ required: true, message: '请选择具体设备方向', trigger: 'change' }, |
|
|
|
]" |
|
|
|
> |
|
|
|
<el-select v-model="form.orientation" size="small" class="filter-item"> |
|
|
|
<el-select v-model="form.device_direction" size="small" class="filter-item"> |
|
|
|
<el-option v-for="item in deviceData" :key="item.key" :label="item.name" :value="item.key" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
@ -196,7 +195,8 @@ |
|
|
|
<!-- action="https://jsonplaceholder.typicode.com/posts/" --> |
|
|
|
<div class="setting_cont upload_img"> |
|
|
|
<el-form-item prop="startup_screen"> |
|
|
|
<el-upload |
|
|
|
<UploadCover ref="childUpload" /> |
|
|
|
<!-- <el-upload |
|
|
|
class="avatar-uploader" |
|
|
|
action="" |
|
|
|
:show-file-list="false" |
|
|
@ -204,7 +204,7 @@ |
|
|
|
> |
|
|
|
<img v-if="form.startup_screen" :src="form.startup_screen" class="avatar" /> |
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
|
|
|
</el-upload> |
|
|
|
</el-upload> --> |
|
|
|
<!-- <el-dialog :visible.sync="dialogVisible"> |
|
|
|
<img width="100%" :src="dialogImageUrl" alt /> |
|
|
|
</el-dialog>--> |
|
|
@ -222,10 +222,12 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import UploadCover from '../components/upload_cover.vue' |
|
|
|
import { reqStartUpList, reqEditStartUp } from '@/api/device/startUpList.js' |
|
|
|
import { parseTime } from '@/utils/index.js' |
|
|
|
export default { |
|
|
|
name: 'DeviceConfig', |
|
|
|
components: { UploadCover }, |
|
|
|
filters: { |
|
|
|
parseTime(time, cFormat) { |
|
|
|
return parseTime(time, cFormat) |
|
|
@ -247,10 +249,10 @@ export default { |
|
|
|
// 开关机列表的数据 |
|
|
|
startUpList: [], |
|
|
|
form: { |
|
|
|
device_direction:null, |
|
|
|
device_id: '', |
|
|
|
open_setting: null, // 开机状态的每天和每周 |
|
|
|
close_setting: null, // 关机状态的每天和每周 |
|
|
|
orientation: null, // 设备方向 |
|
|
|
open_time: '', // 具体的开机时间 |
|
|
|
close_time: '', // 具体的关机时间 |
|
|
|
startup_screen: '', // 启动画面的图片 |
|
|
@ -262,10 +264,36 @@ export default { |
|
|
|
addFromVisible: false, |
|
|
|
selectedList: [], |
|
|
|
clearBtnDisabled: true, |
|
|
|
deviceData: [{ key: '0', name: '竖屏' }, { key: '1', name: '横屏' }] |
|
|
|
deviceData: [{ key: '1', name: '竖屏' }, { key: '2', name: '横屏' }] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 将字符串渲染成汉字显示到页面 |
|
|
|
openWeekly(){ |
|
|
|
const a ={ |
|
|
|
1:'一', |
|
|
|
2:'二', |
|
|
|
3:'三', |
|
|
|
4:'四', |
|
|
|
5:'五', |
|
|
|
6:'六', |
|
|
|
7:'七' |
|
|
|
} |
|
|
|
return(str)=>str.split(',').map(i=>a[i]).join('/') |
|
|
|
}, |
|
|
|
closeWeekly(){ |
|
|
|
const a ={ |
|
|
|
1:'一', |
|
|
|
2:'二', |
|
|
|
3:'三', |
|
|
|
4:'四', |
|
|
|
5:'五', |
|
|
|
6:'六', |
|
|
|
7:'七' |
|
|
|
} |
|
|
|
return(str)=>str.split(',').map(i=>a[i]).join('/') |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: {}, |
|
|
|
watch: {}, |
|
|
|
mounted() { |
|
|
|
this.getStartUpList() |
|
|
@ -283,18 +311,22 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 编辑 |
|
|
|
editFormData(index, row) { |
|
|
|
console.log(row) |
|
|
|
editFormData(row) { |
|
|
|
this.$nextTick(()=>{ |
|
|
|
console.log(this.$refs.childUpload) |
|
|
|
// this.$refs.childUpload.imageUrl=this.form.startup_screen |
|
|
|
}) |
|
|
|
console.log(this.form.startup_screen) |
|
|
|
this.addFromVisible = true |
|
|
|
this.form = { ...row } |
|
|
|
// 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 |
|
|
|
this.form.device_id=row.device_id |
|
|
|
this.form.open_setting=row.open_setting |
|
|
|
this.form.close_setting=row.close_setting |
|
|
|
this.form.open_time=row.open_time |
|
|
|
this.form.close_time=row.close_time |
|
|
|
this.form.startup_screen=row.startup_screen |
|
|
|
this.form.open_weekly=row.open_weekly |
|
|
|
this.form.close_weekly=row.close_weekly |
|
|
|
this.form.device_direction=row.device_direction==1?'竖屏':'横屏' |
|
|
|
}, |
|
|
|
clearCheckbox() { |
|
|
|
if (this.form.open_setting === 1) { |
|
|
@ -311,6 +343,7 @@ export default { |
|
|
|
this.$refs[formName].resetFields() |
|
|
|
}, |
|
|
|
submitForm(formName) { |
|
|
|
this.form.startup_screen = this.$refs.childUpload.imageUrl |
|
|
|
if (this.form.open_setting === 2) { |
|
|
|
this.form.open_weekly = this.open_weekly.join(',') |
|
|
|
} |
|
|
@ -319,7 +352,17 @@ export default { |
|
|
|
} |
|
|
|
this.$refs[formName].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
const params = this.form |
|
|
|
const params = { |
|
|
|
close_setting:this.form.close_setting, |
|
|
|
close_time:this.form.close_time, |
|
|
|
close_weekly:this.form.close_weekly, |
|
|
|
device_id:this.form.device_id, |
|
|
|
open_setting:this.form.open_setting, |
|
|
|
open_time:this.form.open_time, |
|
|
|
open_weekly:this.form.open_weekly, |
|
|
|
device_direction:this.form.device_direction, |
|
|
|
startup_screen:this.form.startup_screen |
|
|
|
} |
|
|
|
console.log(params) |
|
|
|
reqEditStartUp(params).then(res => { |
|
|
|
if (res.code == 200) { |
|
|
@ -348,7 +391,7 @@ export default { |
|
|
|
} else { |
|
|
|
this.clearBtnDisabled = true |
|
|
|
} |
|
|
|
console.log(val) |
|
|
|
// console.log(val) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|