Files
dvcp_v2_wxcp_app/src/apps/AppBroadcast/selectEquipment.vue

219 lines
5.2 KiB
Vue
Raw Normal View History

2021-11-15 10:29:05 +08:00
<template>
<div class="selectEquipment">
2022-06-14 09:00:17 +08:00
<AiTopFixed>
<div class="currentLeft-top">
<div class="left">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" selectRoot>
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
2023-01-06 15:44:42 +08:00
<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px"/>
2022-06-14 09:00:17 +08:00
</AiAreaPicker>
2021-11-15 10:29:05 +08:00
</div>
2023-01-06 15:44:42 +08:00
<u-search v-model="keyword" :clearabled="true" placeholder="请输入设备名称" :show-action="false" bg-color="#F5F5F5" search-icon-color="#ccc" color="#666"
2023-01-17 09:28:01 +08:00
height="58" @search="getList" @clear="handerClear"></u-search>
2021-11-15 10:29:05 +08:00
</div>
2022-06-14 09:00:17 +08:00
</AiTopFixed>
<div class="record">
<div class="item" v-for="(item, index) in list" :key="index" @click="checkClick(index)">
<img src="./img/select-blue.png" mode="aspectFill" alt="" class="check-img" v-if="item.isCheck">
<img src="./img/cir.png" alt="" mode="aspectFill" class="check-img" v-else>
2021-12-27 08:58:42 +08:00
<img src="./img/lb@2x.png" alt="" class="voice-img">
2021-11-15 10:29:05 +08:00
<div class="info">
<div class="text">
2023-01-06 15:44:42 +08:00
<p>{{ item.name }}</p>
<span>{{ item.areaName }}</span>
2021-11-15 10:29:05 +08:00
</div>
2022-06-14 09:00:17 +08:00
<div class="status">{{ $dict.getLabel('dlbDevStatus', item.devStatus) }}</div>
2021-11-15 10:29:05 +08:00
</div>
</div>
</div>
2022-06-14 09:00:17 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2021-11-15 10:29:05 +08:00
<div class="btn">
2022-06-14 09:00:17 +08:00
<div @click="confirm">确定选择</div>
2021-11-15 10:29:05 +08:00
</div>
</div>
</template>
2021-12-15 14:37:20 +08:00
<script>
2023-01-06 15:44:42 +08:00
import {mapState} from 'vuex'
2021-11-15 10:29:05 +08:00
export default {
name: "selectEquipment",
2022-06-21 17:18:22 +08:00
appName: '选择设备',
2022-06-14 09:00:17 +08:00
data() {
return {
areaId: '',
areaName: '',
keyword: '',
list: [],
selectList: []
}
},
2023-01-06 15:44:42 +08:00
computed: {...mapState(['user'])},
2023-01-06 14:16:25 +08:00
onLoad() {
2022-06-14 09:00:17 +08:00
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.$dict.load(['dlbDevStatus']).then(() => {
this.getList()
})
},
methods: {
areaSelect(e) {
this.areaId = e
2022-12-26 16:16:10 +08:00
this.getList()
2022-06-14 09:00:17 +08:00
},
getList() {
2023-01-06 14:30:23 +08:00
this.$http.post(`/app/appdlbquipment/list?current=1&size=1000&name=${this.keyword}&devStatus=5&areaId=${this.areaId}`).then((res) => {
2022-06-14 09:00:17 +08:00
if (res.code == 0) {
res.data.records.map(item => {
item.isCheck = false
})
2022-12-26 16:18:43 +08:00
this.list = res.data.records
// if (this.current > 1) {
// this.list = [...this.list, ...res.data.records]
// } else {
// this.list = res.data.records
// }
2022-06-14 09:00:17 +08:00
}
})
},
checkClick(index) {
this.list[index].isCheck = !this.list[index].isCheck
},
confirm() {
this.selectList = []
this.list.map(item => {
2023-01-06 15:44:42 +08:00
if (item.isCheck) {
2022-06-14 09:00:17 +08:00
var info = {
serialNo: item.serialNo,
serialName: item.name
}
this.selectList.push(info)
}
})
2023-01-06 15:44:42 +08:00
if (!this.selectList.length) {
2022-06-14 09:00:17 +08:00
return this.$u.toast('请选择播放设备')
}
uni.$emit('chooseEquipment', {
equipmentList: this.selectList
})
uni.navigateBack({
delta: 1
})
}
}
2021-11-15 10:29:05 +08:00
}
</script>
<style lang="scss" scoped>
.selectEquipment {
2023-01-06 15:44:42 +08:00
height: 100vh;
2022-06-14 09:00:17 +08:00
.currentLeft-top {
display: flex;
align-items: center;
2021-12-15 14:37:20 +08:00
2022-06-14 09:00:17 +08:00
.left {
width: 200px;
display: flex;
align-items: center;
2021-12-15 14:37:20 +08:00
img {
2022-06-14 09:00:17 +08:00
width: 48px;
height: 48px;
2021-11-15 10:29:05 +08:00
}
}
}
2023-01-06 15:44:42 +08:00
2021-12-15 14:37:20 +08:00
.record {
2022-06-14 09:00:17 +08:00
margin-top: 8px;
2023-01-06 11:23:31 +08:00
padding-bottom: 128px;
2021-12-15 14:37:20 +08:00
.item {
2021-11-15 10:29:05 +08:00
width: 100%;
display: flex;
2022-06-14 09:00:17 +08:00
align-items: center;
2023-01-06 15:44:42 +08:00
height: 110px;
2021-11-15 10:29:05 +08:00
border-bottom: 1px solid #ddd;
2023-01-06 11:23:31 +08:00
padding-left: 32px;
box-sizing: border-box;
background-color: #fff;
2021-12-15 14:37:20 +08:00
2022-06-14 09:00:17 +08:00
&:last-child {
border: none;
}
2021-12-15 14:37:20 +08:00
.check-img {
2022-06-14 09:00:17 +08:00
width: 44px;
height: 44px;
margin-right: 32px;
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
.voice-img {
2022-06-14 09:00:17 +08:00
width: 44px;
height: 44px;
margin-right: 32px;
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
.info {
2022-06-14 09:00:17 +08:00
flex: 1;
2021-11-15 10:29:05 +08:00
line-height: 44px;
2022-06-14 09:00:17 +08:00
padding-right: 32px;
2021-11-15 10:29:05 +08:00
font-size: 34px;
display: flex;
justify-content: space-between;
2022-06-14 09:00:17 +08:00
align-items: center;
2021-12-15 14:37:20 +08:00
.text {
p {
2021-11-15 10:29:05 +08:00
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #333;
margin-bottom: 8px;
}
2021-12-15 14:37:20 +08:00
span {
2021-11-15 10:29:05 +08:00
font-size: 26px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #999;
line-height: 36px;
}
}
2021-12-15 14:37:20 +08:00
.status {
2021-11-15 10:29:05 +08:00
font-size: 34px;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #4E8EEE;
line-height: 48px;
}
}
}
}
2021-12-15 14:37:20 +08:00
.btn {
2021-11-15 10:29:05 +08:00
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 128px;
background: #FFF;
border-top: 1px solid #ddd;
padding: 24px 32px 24px 0;
box-sizing: border-box;
2021-12-15 14:37:20 +08:00
div {
2021-11-15 10:29:05 +08:00
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background: #3975C6;
border-radius: 4px;
color: #fff;
font-size: 32px;
float: right;
2021-12-15 14:37:20 +08:00
}
2021-11-15 10:29:05 +08:00
}
}
</style>