zhoule
9 months ago
3 changed files with 1054 additions and 752 deletions
File diff suppressed because it is too large
@ -0,0 +1,276 @@ |
|||
<template> |
|||
<Dialog v-model="modelVisible" title="选择情报板"> |
|||
<div class="EventAddPlanDialog"> |
|||
<vuescroll :ops="scrollOptions" class="listBox"> |
|||
<div v-for="(item) in templateAvailable" :key="item.dictValue"> |
|||
<!-- 原来是<el-collapse v-model="activeNames"> --> |
|||
<h3>{{ item.dictLabel }}</h3> |
|||
<div v-for="(itm, indx) in item.list" :key="indx" class="tplItem"> |
|||
<!-- 模板内容 --> |
|||
<BoardTplPreview class="boardPreview" boardWH="1400*200" :tpl="itm"></BoardTplPreview> |
|||
<!-- 操作按钮 --> |
|||
<div class="infoBtnBox infoBtnBoxSm"> |
|||
<p class="btn"> |
|||
<el-radio v-model="radio1" :label="itm.id" @input="changeRadio(itm)" /> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</vuescroll> |
|||
</div> |
|||
|
|||
<template #footer> |
|||
<Button style="background: #C9C9C9;padding:0 24px;" |
|||
@click.native="modelVisible = false, submitting = false">取消</Button> |
|||
<Button style="padding:0 24px;" @click.native="handleSubmit" :loading="submitting">确认</Button> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import vuescroll from "vuescroll"; |
|||
import scrollOptions from "@/common/scrollbar.js"; |
|||
import BoardTplPreview from "@screen/components/infoBoard/BoardTplPreview.vue"; |
|||
import Dialog from "@screen/components/Dialog/index"; |
|||
import Button from '@screen/components/Buttons/Button.vue'; |
|||
import { getTemplateList } from "@/api/board/template"; |
|||
|
|||
export default { |
|||
name: 'qbbDialog', |
|||
components: { |
|||
Dialog, |
|||
Button, |
|||
vuescroll, |
|||
BoardTplPreview |
|||
}, |
|||
model: { |
|||
prop: 'visible', |
|||
event: 'close' |
|||
}, |
|||
props: { |
|||
visible: Boolean, |
|||
detail: { |
|||
type: Object, |
|||
default: () => { } |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
submitting: false, |
|||
selectedSize: "", |
|||
scrollOptions, |
|||
templateAvailable: null, |
|||
tplCategory: [], |
|||
templateAll: [], |
|||
radio1: '', |
|||
itmData: {} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.initData(); |
|||
}, |
|||
computed: { |
|||
modelVisible: { |
|||
get() { |
|||
return this.visible; |
|||
}, |
|||
set(val) { |
|||
this.$emit('close', val) |
|||
} |
|||
}, |
|||
}, |
|||
methods: { |
|||
initData() { |
|||
if (this.tplCategory.length && this.templateAll.length) { |
|||
this.____setAvailableTemplate(); |
|||
} else { |
|||
Promise.all([ |
|||
this.____getTemplateCategory(), |
|||
this.____getAllTemplate(), |
|||
]).then((res) => { |
|||
this.____setAvailableTemplate(); |
|||
}); |
|||
} |
|||
|
|||
}, |
|||
// 获取信息模板分类 |
|||
____getTemplateCategory() { |
|||
return this.getDicts("iot_template_category").then((res) => { |
|||
this.tplCategory = res.data; |
|||
}); |
|||
}, |
|||
//获取全部模版 |
|||
____getAllTemplate() { |
|||
return getTemplateList().then((res) => { |
|||
this.templateAll = res.data; |
|||
}); |
|||
}, |
|||
// 设置当前设备可用的模板 |
|||
____setAvailableTemplate() { |
|||
this.templateAvailable = []; |
|||
this.tplCategory.forEach((item, index) => { |
|||
let arr = this.templateAll["" + index]; |
|||
if (arr.length > 0) { |
|||
let temp = []; |
|||
arr.forEach((tpl) => { |
|||
if (tpl.screenSize) { |
|||
temp.push(tpl); |
|||
} |
|||
}); |
|||
if (temp.length > 0) { |
|||
this.templateAvailable.push({ |
|||
...item, |
|||
list: temp, |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
changeRadio(data) { |
|||
this.itmData = data; |
|||
}, |
|||
handleSubmit() { |
|||
this.modelVisible = false; |
|||
this.$emit('dialogSubmit', this.itmData); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.listBox { |
|||
padding: 20px; |
|||
|
|||
.tplItem { |
|||
margin-right: 14px; |
|||
display: flex; |
|||
align-items: stretch; |
|||
padding-bottom: 10px; |
|||
|
|||
.boardPreview { |
|||
border: 1px solid rgba(61, 232, 255, 0.5); |
|||
// width: 560px; |
|||
// height:80px; |
|||
flex: 1; |
|||
} |
|||
|
|||
.infoBtnBox { |
|||
&.infoBtnBoxSm { |
|||
width: 60px; |
|||
} |
|||
|
|||
width: 110px; |
|||
height: 80px; |
|||
display: flex; |
|||
margin-left: 10px; |
|||
/* // border: solid 1px #05afe3; */ |
|||
border: 1px solid rgba(61, 232, 255, 0.5); |
|||
display: flex; |
|||
justify-content: space-around; |
|||
align-items: center; |
|||
|
|||
.btn { |
|||
background-repeat: no-repeat; |
|||
background-size: 100% 100%; |
|||
width: 15px; |
|||
height: 30px; |
|||
|
|||
&.btnApply { |
|||
background-image: url(~@/assets/jihe/images/button/toLeft.svg); |
|||
} |
|||
|
|||
&.btnEdit { |
|||
background-image: url(~@/assets/jihe/images/button/edit.svg); |
|||
} |
|||
|
|||
&.btnDelete { |
|||
background-image: url(~@/assets/jihe/images/button/delete.svg); |
|||
} |
|||
} |
|||
|
|||
i { |
|||
font-size: 24px; |
|||
color: #666; |
|||
padding-left: 4px; |
|||
cursor: pointer; |
|||
caret-color: rgba(0, 0, 0, 0); |
|||
user-select: none; |
|||
} |
|||
|
|||
i:hover { |
|||
color: #05afe3; |
|||
} |
|||
|
|||
.disabledClass { |
|||
pointer-events: none; |
|||
cursor: auto !important; |
|||
color: #ccc; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.controlBox { |
|||
margin-top: 10px; |
|||
margin-bottom: 10px; |
|||
display: flex; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.el-collapse { |
|||
max-height: 100% !important; |
|||
overflow: auto; |
|||
border-bottom: none; |
|||
border-top: none; |
|||
padding: 0 0.5vw; |
|||
} |
|||
} |
|||
|
|||
.fade-enter-active, |
|||
.fade-leave-active { |
|||
transition: opacity .24s; |
|||
} |
|||
|
|||
.fade-enter, |
|||
.fade-leave-to { |
|||
opacity: 0; |
|||
} |
|||
|
|||
.EventAddPlanDialog { |
|||
gap: 9px; |
|||
width: 650px; |
|||
height: 510px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.first, |
|||
.second, |
|||
.third { |
|||
padding: 5px 10px 8px; |
|||
background-color: #296887; |
|||
margin-bottom: 15px; |
|||
|
|||
.text { |
|||
margin-top: 12px; |
|||
} |
|||
} |
|||
|
|||
::v-deep { |
|||
.el-radio__label { |
|||
display: none; |
|||
} |
|||
} |
|||
|
|||
.form { |
|||
flex: 1; |
|||
overflow-y: auto; |
|||
} |
|||
|
|||
.footer { |
|||
display: flex; |
|||
justify-content: end; |
|||
gap: 15px; |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue