This commit is contained in:
yanran200730
2023-04-18 10:05:10 +08:00
3 changed files with 29 additions and 73 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="AppEquipmentManage"> <div class="AppEquipmentManage">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> <component :is="currentPage" v-bind="$props"/>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
@@ -17,38 +17,13 @@ export default {
instance: Function, instance: Function,
dict: Object, dict: Object,
}, },
computed: {
data() { currentPage: v => v.$route.hash == "#taskList" ? taskList : List
return {
component: 'List',
params: {},
include: [],
}
}, },
components: { components: {
List, List,
taskList, taskList,
}, }
methods: {
onChange(data) {
if (data.type === 'taskList') {
this.component = 'taskList'
this.params = data.params
}
if (data.type == 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
},
},
} }
</script> </script>

View File

@@ -49,9 +49,7 @@ export default {
props: { props: {
dict: Object, dict: Object,
instance: Function, instance: Function,
params: Object,
}, },
data() { data() {
return { return {
isAdd: false, isAdd: false,
@@ -113,17 +111,13 @@ export default {
locate: false locate: false
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
}, },
created() { created() {
this.dict.load('dlbDevStatus', 'yesOrNo').then(() => { this.getList()
this.getList() this.dict.load('dlbDevStatus', 'yesOrNo')
})
}, },
methods: { methods: {
bind(item) { bind(item) {
this.areaId = '' this.areaId = ''
@@ -186,13 +180,7 @@ export default {
}, },
toTaskList(id) { toTaskList(id) {
this.$emit('change', { this.$router.push({hash: "#taskList", query: {id}})
type: 'taskList',
params: {
id: id || '',
// areaId: this.areaId,
},
})
}, },
update() { update() {
this.btnLoading = true this.btnLoading = true

View File

@@ -1,7 +1,7 @@
<template> <template>
<section class="taskList"> <section class="taskList">
<ai-list> <ai-list>
<ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel(true)"/> <ai-title slot="title" title="任务列表" isShowBack isShowBottomBorder @onBackClick="cancel"/>
<template #content> <template #content>
<ai-search-bar bottomBorder> <ai-search-bar bottomBorder>
<template slot="right"> <template slot="right">
@@ -25,13 +25,13 @@
</template> </template>
<script> <script>
import {mapMutations} from "vuex";
export default { export default {
name: 'taskList', name: 'taskList',
components: {},
props: { props: {
dict: Object, dict: Object,
instance: Function, instance: Function,
params: Object,
}, },
data() { data() {
return { return {
@@ -54,16 +54,16 @@ export default {
label: '媒资类型', label: '媒资类型',
width: '200', width: '200',
align: 'center', align: 'center',
render: (h, { row })=>{ render: (h, {row}) => {
return h('span',null,this.dict.getLabel('dlbResourceType',row.type)) return h('span', null, this.dict.getLabel('dlbResourceType', row.type))
} }
}, },
{ {
prop: 'messageLevel', prop: 'messageLevel',
label: '级别', label: '级别',
align: 'center', align: 'center',
render: (h, { row })=>{ render: (h, {row}) => {
return h('span',null,this.dict.getLabel('dlbMessageUrgency',row.messageLevel)) return h('span', null, this.dict.getLabel('dlbMessageUrgency', row.messageLevel))
} }
}, },
{ {
@@ -72,7 +72,7 @@ export default {
width: '220', width: '220',
align: 'center', align: 'center',
render: (h, {row}) => { render: (h, {row}) => {
return h('span', null, (row.taskType == 1? '定时播放':'立即播放')) return h('span', null, (row.taskType == 1 ? '定时播放' : '立即播放'))
}, },
}, },
{ {
@@ -85,8 +85,8 @@ export default {
prop: 'broadcastStatus', prop: 'broadcastStatus',
label: '状态', label: '状态',
align: 'center', align: 'center',
render: (h, { row })=>{ render: (h, {row}) => {
return h('span',null, (row.broadcastStatus == 0? '已下发': row.broadcastStatus == 3? '播发成功': row.broadcastStatus == 6? '已取消': '')) return h('span', null, (row.broadcastStatus == 0 ? '已下发' : row.broadcastStatus == 3 ? '播发成功' : row.broadcastStatus == 6 ? '已取消' : ''))
} }
}, },
{ {
@@ -103,27 +103,23 @@ export default {
} }
}, },
created() { created() {
this.$dict.load('dlbDyclingType','dlbMessageUrgency','dlbBroadcastStatus','dlbResourceType').then(()=>{ this.setPageTitle("设备任务列表")
this.getList() this.dict.load('dlbDyclingType', 'dlbMessageUrgency', 'dlbBroadcastStatus', 'dlbResourceType')
}) this.getList()
}, },
methods: { methods: {
...mapMutations(['setPageTitle']),
getList() { getList() {
this.instance.post(`/app/appzyvideobroadcast/list?deviceId`,null,{ const {id: deviceId} = this.$route.query
params: { this.instance.post(`/app/appzyvideobroadcast/list`, null, {
...this.page, params: {...this.page, ...this.search, deviceId}
...this.search, }).then(res => {
deviceId: this.params.deviceId if (res?.data) {
}
}).then(res=>{
if(res?.data) {
this.tableData = res.data.records this.tableData = res.data.records
this.page.total = res.data.total this.page.total = res.data.total
} }
}) })
}, },
reset(id) { reset(id) {
this.$confirm('确定要撤回该任务吗?').then(() => { this.$confirm('确定要撤回该任务吗?').then(() => {
this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => { this.instance.post(`/app/appzyvideobroadcast/getBroadcastRecall?broadcastId=${id}`).then((res) => {
@@ -134,11 +130,8 @@ export default {
}) })
}) })
}, },
cancel(isRefresh) { cancel() {
this.$emit('change', { this.$router.push({})
type: 'list',
isRefresh: !!isRefresh,
})
}, },
}, },
} }
@@ -148,4 +141,4 @@ export default {
.taskList { .taskList {
height: 100%; height: 100%;
} }
</style> </style>